FreeINCHI:
  119|  6.37k|{
  120|  6.37k|    if (!out)
  ------------------
  |  Branch (120:9): [True: 0, False: 6.37k]
  ------------------
  121|      0|    {
  122|      0|        return;
  123|      0|    }
  124|       |
  125|  6.37k|    if (out->szInChI)
  ------------------
  |  Branch (125:9): [True: 5.02k, False: 1.34k]
  ------------------
  126|  5.02k|    {
  127|  5.02k|        inchi_free( out->szInChI );
  ------------------
  |  | 1152|  5.02k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 5.02k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 5.02k]
  |  |  ------------------
  ------------------
  128|  5.02k|    }
  129|  6.37k|    if (out->szLog)
  ------------------
  |  Branch (129:9): [True: 6.28k, False: 89]
  ------------------
  130|  6.28k|    {
  131|  6.28k|        inchi_free( out->szLog );
  ------------------
  |  | 1152|  6.28k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 6.28k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 6.28k]
  |  |  ------------------
  ------------------
  132|  6.28k|    }
  133|  6.37k|    if (out->szMessage)
  ------------------
  |  Branch (133:9): [True: 6.28k, False: 89]
  ------------------
  134|  6.28k|    {
  135|  6.28k|        inchi_free( out->szMessage );
  ------------------
  |  | 1152|  6.28k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 6.28k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 6.28k]
  |  |  ------------------
  ------------------
  136|  6.28k|    }
  137|       |
  138|  6.37k|    memset( out, 0, sizeof( *out ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  139|  6.37k|}
FreeStructFromINCHI:
  174|  6.37k|{
  175|  6.37k|    if (!out)
  ------------------
  |  Branch (175:9): [True: 0, False: 6.37k]
  ------------------
  176|      0|    {
  177|      0|        return;
  178|      0|    }
  179|       |
  180|  6.37k|    if (out->atom)
  ------------------
  |  Branch (180:9): [True: 1.75k, False: 4.61k]
  ------------------
  181|  1.75k|    {
  182|  1.75k|        inchi_free( out->atom );
  ------------------
  |  | 1152|  1.75k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 1.75k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 1.75k]
  |  |  ------------------
  ------------------
  183|  1.75k|    }
  184|  6.37k|    if (out->stereo0D)
  ------------------
  |  Branch (184:9): [True: 386, False: 5.98k]
  ------------------
  185|    386|    {
  186|    386|        inchi_free( out->stereo0D );
  ------------------
  |  | 1152|    386|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 386, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 386]
  |  |  ------------------
  ------------------
  187|    386|    }
  188|  6.37k|    if (out->szLog)
  ------------------
  |  Branch (188:9): [True: 6.28k, False: 89]
  ------------------
  189|  6.28k|    {
  190|  6.28k|        inchi_free( out->szLog );
  ------------------
  |  | 1152|  6.28k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 6.28k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 6.28k]
  |  |  ------------------
  ------------------
  191|  6.28k|    }
  192|  6.37k|    if (out->szMessage)
  ------------------
  |  Branch (192:9): [True: 6.28k, False: 89]
  ------------------
  193|  6.28k|    {
  194|  6.28k|        inchi_free( out->szMessage );
  ------------------
  |  | 1152|  6.28k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 6.28k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 6.28k]
  |  |  ------------------
  ------------------
  195|  6.28k|    }
  196|       |
  197|  6.37k|    memset( out, 0, sizeof( *out ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  198|  6.37k|}
CheckINCHI:
  812|  12.7k|{
  813|  12.7k|    int ret = INCHI_VALID_NON_STANDARD;
  814|  12.7k|    int ret_i2i;
  815|  12.7k|    inchi_InputINCHI    inchi_inp;
  816|  12.7k|    inchi_Output        inchi_out;
  817|  12.7k|    size_t slen, pos_slash1 = 0;
  818|  12.7k|    char *str = NULL;
  819|  12.7k|    size_t i;
  820|  12.7k|    size_t slen0;
  821|  12.7k|    char pp;
  822|       |
  823|       |    /* .. non-empty */
  824|  12.7k|    if (szINCHI == NULL)
  ------------------
  |  Branch (824:9): [True: 0, False: 12.7k]
  ------------------
  825|      0|    {
  826|      0|        return INCHI_INVALID_PREFIX;
  827|      0|    }
  828|       |
  829|  12.7k|    slen = strlen( szINCHI );
  830|       |
  831|       |
  832|       |    /* .. has valid prefix */
  833|  12.7k|    if (slen < LEN_INCHI_STRING_PREFIX + 3)
  ------------------
  |  |  739|  12.7k|#define LEN_INCHI_STRING_PREFIX 6
  ------------------
  |  Branch (833:9): [True: 2, False: 12.7k]
  ------------------
  834|      2|    {
  835|      2|        return INCHI_INVALID_PREFIX;
  836|      2|    }
  837|  12.7k|    if (memcmp( szINCHI, INCHI_STRING_PREFIX, LEN_INCHI_STRING_PREFIX ))
  ------------------
  |  |  738|  12.7k|#define INCHI_STRING_PREFIX "InChI="
  ------------------
                  if (memcmp( szINCHI, INCHI_STRING_PREFIX, LEN_INCHI_STRING_PREFIX ))
  ------------------
  |  |  739|  12.7k|#define LEN_INCHI_STRING_PREFIX 6
  ------------------
  |  Branch (837:9): [True: 26, False: 12.7k]
  ------------------
  838|     26|    {
  839|     26|        return INCHI_INVALID_PREFIX;
  840|     26|    }
  841|       |
  842|       |    /* .. has InChI version 1 */
  843|       |    /* if (!isdigit(szINCHI[LEN_INCHI_STRING_PREFIX]) )  */
  844|  12.7k|    if (szINCHI[LEN_INCHI_STRING_PREFIX] != '1')
  ------------------
  |  |  739|  12.7k|#define LEN_INCHI_STRING_PREFIX 6
  ------------------
  |  Branch (844:9): [True: 0, False: 12.7k]
  ------------------
  845|      0|    {
  846|      0|        return INCHI_INVALID_VERSION;
  847|      0|    }
  848|       |
  849|       |    /* Determine the InChI calculation-class designator.
  850|       |     * Historical InChI=1/... remains accepted as non-standard input.
  851|       |     */
  852|  12.7k|    pos_slash1 = LEN_INCHI_STRING_PREFIX + 1;
  ------------------
  |  |  739|  12.7k|#define LEN_INCHI_STRING_PREFIX 6
  ------------------
  853|       |
  854|  12.7k|    if (szINCHI[pos_slash1] == 'S')
  ------------------
  |  Branch (854:9): [True: 72, False: 12.6k]
  ------------------
  855|     72|    {
  856|     72|        ret = INCHI_VALID_STANDARD;
  857|     72|        pos_slash1++;
  858|     72|    }
  859|  12.6k|    else if (szINCHI[pos_slash1] == 'B')
  ------------------
  |  Branch (859:14): [True: 48, False: 12.5k]
  ------------------
  860|     48|    {
  861|     48|        ret = INCHI_VALID_BETA;
  862|     48|        pos_slash1++;
  863|     48|    }
  864|  12.5k|    else if (szINCHI[pos_slash1] == 'N')
  ------------------
  |  Branch (864:14): [True: 0, False: 12.5k]
  ------------------
  865|      0|    {
  866|      0|        ret = INCHI_VALID_NON_STANDARD;
  867|      0|        pos_slash1++;
  868|      0|    }
  869|       |
  870|       |    /* Molecular Inorganics subversion designator */
  871|  12.7k|    if (szINCHI[pos_slash1] == 'B')
  ------------------
  |  Branch (871:9): [True: 0, False: 12.7k]
  ------------------
  872|      0|    {
  873|      0|        pos_slash1++;
  874|      0|    }
  875|       |
  876|       |    /* .. has trailing slash in the right place */
  877|  12.7k|    if (szINCHI[pos_slash1] != '/')
  ------------------
  |  Branch (877:9): [True: 0, False: 12.7k]
  ------------------
  878|      0|    {
  879|      0|        return INCHI_INVALID_LAYOUT;
  880|      0|    }
  881|       |
  882|       |    /* .. the rest of source string contains valid literals */
  883|       |
  884|       |
  885|       |    /* adjust line len so we not check trailing whitespaces */
  886|  12.7k|    i = slen - 1;
  887|  12.7k|    while (isspace(UCINT szINCHI[i--])) slen--;
  ------------------
  |  Branch (887:12): [True: 646, False: 12.7k]
  ------------------
  888|       |
  889|       |    /* Treat possible SaveOpt letters  */
  890|  12.7k|    slen0 = slen;
  891|  12.7k|    if (( szINCHI[slen - 3] == '\\' ) &&
  ------------------
  |  Branch (891:9): [True: 28, False: 12.6k]
  ------------------
  892|     28|        ( szINCHI[slen - 2] >= 'A' ) && ( szINCHI[slen - 2] <= 'Z' ) &&
  ------------------
  |  Branch (892:9): [True: 26, False: 2]
  |  Branch (892:41): [True: 26, False: 0]
  ------------------
  893|     26|        ( szINCHI[slen - 1] >= 'A' ) && ( szINCHI[slen - 1] <= 'Z' )
  ------------------
  |  Branch (893:9): [True: 26, False: 0]
  |  Branch (893:41): [True: 26, False: 0]
  ------------------
  894|  12.7k|        )
  895|     26|    {
  896|     26|        slen0 = slen - 3;
  897|     26|    }
  898|       |
  899|  12.7k|    int prev_is_slash = 1;
  900|  4.80M|    for (i = pos_slash1 + 1; i < slen0; i++)
  ------------------
  |  Branch (900:30): [True: 4.79M, False: 12.5k]
  ------------------
  901|  4.79M|    {
  902|  4.79M|        pp = szINCHI[i];
  903|  4.79M|#if ( FIX_GAF_2020_GENERIC==1 )
  904|  4.79M|        if (prev_is_slash)
  ------------------
  |  Branch (904:13): [True: 88.0k, False: 4.70M]
  ------------------
  905|  88.0k|        {
  906|       |            /* After slash: */
  907|  88.0k|            if (pp == '0')
  ------------------
  |  Branch (907:17): [True: 4, False: 88.0k]
  ------------------
  908|      4|            {
  909|       |                /* '0' is never allowed */
  910|      4|                return INCHI_INVALID_LAYOUT;
  911|      4|            }
  912|  88.0k|            if (i > pos_slash1 + 1)
  ------------------
  |  Branch (912:17): [True: 75.3k, False: 12.7k]
  ------------------
  913|  75.3k|            {
  914|       |                /* Not in main formula layer... */
  915|  75.3k|                if (!islower(pp))
  ------------------
  |  Branch (915:21): [True: 34, False: 75.2k]
  ------------------
  916|     34|                {
  917|       |                    /* only lowercase letters are allowed */
  918|     34|                    return INCHI_INVALID_LAYOUT;
  919|     34|                }
  920|  75.3k|            }
  921|  88.0k|        }
  922|  4.79M|        prev_is_slash = (pp != '/') ? 0 : 1;
  ------------------
  |  Branch (922:25): [True: 4.71M, False: 76.1k]
  ------------------
  923|  4.79M|#endif
  924|  4.79M|        if (pp >= 'A' && pp <= 'Z')   continue;
  ------------------
  |  Branch (924:13): [True: 2.92M, False: 1.86M]
  |  Branch (924:26): [True: 191k, False: 2.73M]
  ------------------
  925|  4.60M|        if (pp >= 'a' && pp <= 'z')   continue;
  ------------------
  |  Branch (925:13): [True: 2.73M, False: 1.86M]
  |  Branch (925:26): [True: 2.73M, False: 0]
  ------------------
  926|  1.86M|        if (pp >= '0' && pp <= '9')  continue;
  ------------------
  |  Branch (926:13): [True: 780k, False: 1.08M]
  |  Branch (926:26): [True: 762k, False: 17.5k]
  ------------------
  927|  1.10M|        switch (pp)
  928|  1.10M|        {
  929|   703k|            case '(': case ')':
  ------------------
  |  Branch (929:13): [True: 370k, False: 731k]
  |  Branch (929:23): [True: 333k, False: 768k]
  ------------------
  930|   710k|            case '*': case '+':
  ------------------
  |  Branch (930:13): [True: 4.31k, False: 1.09M]
  |  Branch (930:23): [True: 2.76k, False: 1.09M]
  ------------------
  931|   992k|            case ',': case '-':
  ------------------
  |  Branch (931:13): [True: 213k, False: 888k]
  |  Branch (931:23): [True: 67.8k, False: 1.03M]
  ------------------
  932|  1.08M|            case '.': case '/':
  ------------------
  |  Branch (932:13): [True: 15.8k, False: 1.08M]
  |  Branch (932:23): [True: 76.1k, False: 1.02M]
  ------------------
  933|  1.08M|#if ( FIX_GAF_2020_GENERIC==1 )
  934|  1.10M|            case ';': case '?':     continue;
  ------------------
  |  Branch (934:13): [True: 8.26k, False: 1.09M]
  |  Branch (934:23): [True: 9.20k, False: 1.09M]
  ------------------
  935|       |#else
  936|       |            case ';': case '=':
  937|       |            case '?': case '@':     continue;
  938|       |#endif
  939|    112|            default:            return INCHI_INVALID_LAYOUT;
  ------------------
  |  Branch (939:13): [True: 112, False: 1.10M]
  ------------------
  940|  1.10M|        }
  941|  1.10M|    }
  942|       |
  943|  12.5k|    if (strict)
  ------------------
  |  Branch (943:9): [True: 0, False: 12.5k]
  ------------------
  944|      0|    {
  945|      0|        char opts[] = "?FixedH ?RecMet ?SUU ?SLUUD";
  946|      0|        extract_inchi_substring( &str, szINCHI, slen );
  947|      0|        if (NULL == str)
  ------------------
  |  Branch (947:13): [True: 0, False: 0]
  ------------------
  948|      0|        {
  949|      0|            ret = INCHI_FAIL_I2I;
  950|      0|            goto fin;
  951|      0|        }
  952|       |
  953|      0|        inchi_inp.szInChI = str;
  954|      0|        opts[0] = opts[8] = opts[16] = opts[21] = INCHI_OPTION_PREFX;
  ------------------
  |  |  231|      0|#define   INCHI_OPTION_PREFX  '-'
  ------------------
  955|      0|        inchi_inp.szOptions = opts;
  956|       |
  957|      0|        ret_i2i = GetINCHIfromINCHI( &inchi_inp, &inchi_out );
  958|       |
  959|      0|        if (( ( ret_i2i != inchi_Ret_OKAY ) && ( ret_i2i != inchi_Ret_WARNING ) ) || !inchi_out.szInChI)
  ------------------
  |  Branch (959:15): [True: 0, False: 0]
  |  Branch (959:48): [True: 0, False: 0]
  |  Branch (959:86): [True: 0, False: 0]
  ------------------
  960|      0|        {
  961|      0|            ret = INCHI_FAIL_I2I;
  962|      0|        }
  963|      0|        else
  964|      0|        {
  965|      0|            const char *in_str = inchi_inp.szInChI;
  966|      0|            const char *out_str = inchi_out.szInChI;
  967|       |
  968|       |            /*
  969|       |             * Historical non-standard InChI=1/ input is normalized
  970|       |             * to the explicit InChI=1N/ form during InChI-to-InChI
  971|       |             * conversion. Ignore only this prefix difference.
  972|       |             */
  973|      0|            if (!strncmp(in_str, "InChI=1/", 8) &&
  ------------------
  |  Branch (973:17): [True: 0, False: 0]
  ------------------
  974|      0|                !strncmp(out_str, "InChI=1N/", 9))
  ------------------
  |  Branch (974:17): [True: 0, False: 0]
  ------------------
  975|      0|            {
  976|      0|                in_str += 8;
  977|      0|                out_str += 9;
  978|      0|            }
  979|       |
  980|      0|            if (strcmp(in_str, out_str))
  ------------------
  |  Branch (980:17): [True: 0, False: 0]
  ------------------
  981|      0|            {
  982|      0|                ret = INCHI_FAIL_I2I;
  983|      0|            }
  984|      0|        }
  985|      0|    }
  986|       |
  987|  12.5k|fin:if (strict)
  ------------------
  |  Branch (987:9): [True: 0, False: 12.5k]
  ------------------
  988|      0|{
  989|      0|    if (NULL != str)
  ------------------
  |  Branch (989:9): [True: 0, False: 0]
  ------------------
  990|      0|        inchi_free( str );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  991|      0|}
  992|       |
  993|  12.5k|    return ret;
  994|  12.5k|}
parse_options_string:
 1042|  12.7k|{
 1043|  12.7k|    char    *p;
 1044|  12.7k|    char    *pArgCurChar;
 1045|  12.7k|    int      bInsideQuotes;
 1046|  12.7k|    int      bCopyCharToArg;
 1047|  12.7k|    int      nNumBackSlashes;
 1048|  12.7k|    int      i;
 1049|       |
 1050|  12.7k|    i = 0;
 1051|  12.7k|    argv[i++] = ""; /* zeroth argument is not used */
 1052|  12.7k|    p = cmd;
 1053|  12.7k|    bInsideQuotes = 0;
 1054|       |
 1055|       |    /* arguments, one by one */
 1056|  25.4k|    while (i < maxargs - 1)
  ------------------
  |  Branch (1056:12): [True: 25.4k, False: 0]
  ------------------
 1057|  25.4k|    {
 1058|       |        /* bypass spaces */
 1059|  38.2k|        while (*p == ' ' || *p == '\t')
  ------------------
  |  Branch (1059:16): [True: 12.7k, False: 25.4k]
  |  Branch (1059:29): [True: 0, False: 25.4k]
  ------------------
 1060|  12.7k|        {
 1061|  12.7k|            p++;
 1062|  12.7k|        }
 1063|  25.4k|        if (!*p)
  ------------------
  |  Branch (1063:13): [True: 12.7k, False: 12.7k]
  ------------------
 1064|  12.7k|        {
 1065|  12.7k|            break;
 1066|  12.7k|        }
 1067|       |
 1068|       |        /* scan an argument */
 1069|  12.7k|        argv[i++] = pArgCurChar = p;     /* store preliminary ptr to arg */
 1070|       |
 1071|   171k|        while (1)
  ------------------
  |  Branch (1071:16): [True: 171k, Folded]
  ------------------
 1072|   171k|        {
 1073|   171k|            bCopyCharToArg = 1;
 1074|   171k|            nNumBackSlashes = 0;
 1075|   171k|            while (*p == '\\')
  ------------------
  |  Branch (1075:20): [True: 0, False: 171k]
  ------------------
 1076|      0|            {
 1077|      0|                ++p;
 1078|      0|                ++nNumBackSlashes;
 1079|      0|            }
 1080|       |
 1081|       |            /* each pair of backslashes => one backslash; one more backslash => literal quote */
 1082|   171k|            if (*p == '\"')
  ------------------
  |  Branch (1082:17): [True: 0, False: 171k]
  ------------------
 1083|      0|            {
 1084|       |                /* one " found */
 1085|      0|                if (nNumBackSlashes % 2 == 0)
  ------------------
  |  Branch (1085:21): [True: 0, False: 0]
  ------------------
 1086|      0|                {
 1087|      0|                    if (bInsideQuotes)
  ------------------
  |  Branch (1087:25): [True: 0, False: 0]
  ------------------
 1088|      0|                    {
 1089|      0|                        if (*( p + 1 ) == '\"')
  ------------------
  |  Branch (1089:29): [True: 0, False: 0]
  ------------------
 1090|      0|                        {
 1091|      0|                            p++;
 1092|      0|                        }
 1093|      0|                        else
 1094|      0|                        {
 1095|      0|                            bCopyCharToArg = 0;
 1096|      0|                        }
 1097|      0|                    }
 1098|      0|                    else
 1099|      0|                    {
 1100|      0|                        bCopyCharToArg = 0;
 1101|      0|                    }
 1102|      0|                    bInsideQuotes = !bInsideQuotes;
 1103|      0|                }
 1104|      0|                nNumBackSlashes /= 2;          /* divide nNumBackSlashes by two */
 1105|      0|            }
 1106|   171k|            while (nNumBackSlashes--)
  ------------------
  |  Branch (1106:20): [True: 0, False: 171k]
  ------------------
 1107|      0|            {
 1108|      0|                *pArgCurChar++ = '\\';
 1109|      0|            }
 1110|   171k|            if (!*p)
  ------------------
  |  Branch (1110:17): [True: 12.7k, False: 159k]
  ------------------
 1111|  12.7k|            {
 1112|  12.7k|                break;
 1113|  12.7k|            }
 1114|   159k|            if (!bInsideQuotes && ( *p == ' ' || *p == '\t' ))
  ------------------
  |  Branch (1114:17): [True: 159k, False: 0]
  |  Branch (1114:37): [True: 0, False: 159k]
  |  Branch (1114:50): [True: 0, False: 159k]
  ------------------
 1115|      0|            {
 1116|      0|                p++;
 1117|       |                /* move to the next char because this char may become
 1118|       |                 * zero due to  *pArgCurChar++ = '\0'; line below */
 1119|      0|                break;
 1120|      0|            }
 1121|   159k|            if (bCopyCharToArg)
  ------------------
  |  Branch (1121:17): [True: 159k, False: 0]
  ------------------
 1122|   159k|            {
 1123|   159k|                *pArgCurChar++ = *p;
 1124|   159k|            }
 1125|   159k|            ++p;
 1126|   159k|        }
 1127|  12.7k|        *pArgCurChar++ = '\0';  /* argument zero termination */
 1128|  12.7k|    }
 1129|       |
 1130|       |    /* The last argument is NULL */
 1131|  12.7k|    argv[i] = NULL;
 1132|       |
 1133|  12.7k|    return i;
 1134|  12.7k|}
InpAtom0DToInchiAtom:
 1680|  1.75k|{
 1681|  1.75k|    int num_stereo_centers, num_stereo_bonds, num_inp_stereo0D, i, m, m1, m2, n, ret = 0;
 1682|       |
 1683|       |    /* count stereobonds, allenes. cumulenes. and stereoatoms */
 1684|  1.75k|    num_stereo_centers = num_stereo_bonds = ret = 0;
 1685|       |
 1686|  1.75k|    *atom = NULL;
 1687|  1.75k|    *num_atoms = 0;
 1688|  1.75k|    *stereo0D = NULL;
 1689|  1.75k|    *num_stereo0D = 0;
 1690|       |
 1691|   132k|    for (i = 0; i < num_inp_atoms; i++)
  ------------------
  |  Branch (1691:17): [True: 130k, False: 1.75k]
  ------------------
 1692|   130k|    {
 1693|   130k|        if (at[i].p_parity)
  ------------------
  |  Branch (1693:13): [True: 224, False: 130k]
  ------------------
 1694|    224|        {
 1695|       |            /* stereocenter */
 1696|    224|            num_stereo_centers++;
 1697|    224|        }
 1698|   130k|        else
 1699|   130k|        {
 1700|   130k|            for (m = 0; m < MAX_NUM_STEREO_BONDS && at[i].sb_parity[m]; m++)
  ------------------
  |  |  873|   261k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1700:25): [True: 130k, False: 14]
  |  Branch (1700:53): [True: 738, False: 130k]
  ------------------
 1701|    738|            {
 1702|    738|                ;
 1703|    738|            }
 1704|   130k|            num_stereo_bonds += m;
 1705|   130k|        }
 1706|   130k|    }
 1707|       |
 1708|  1.75k|    num_stereo_bonds /= 2;
 1709|  1.75k|    num_inp_stereo0D = num_stereo_bonds + num_stereo_centers;
 1710|       |
 1711|  1.75k|    if (num_inp_atoms > 0)
  ------------------
  |  Branch (1711:9): [True: 1.75k, False: 0]
  ------------------
 1712|  1.75k|    {
 1713|  1.75k|        *atom = (inchi_Atom *) inchi_calloc( num_inp_atoms, sizeof( ( *atom )[0] ) );
  ------------------
  |  | 1146|  1.75k|#define inchi_calloc   calloc
  ------------------
 1714|  1.75k|    }
 1715|       |
 1716|  1.75k|    *num_atoms = num_inp_atoms;
 1717|       |
 1718|  1.75k|    if (num_inp_stereo0D > 0)
  ------------------
  |  Branch (1718:9): [True: 386, False: 1.36k]
  ------------------
 1719|    386|    {
 1720|    386|        *stereo0D = (inchi_Stereo0D *) inchi_calloc( num_inp_stereo0D, sizeof( ( *stereo0D )[0] ) );
  ------------------
  |  | 1146|    386|#define inchi_calloc   calloc
  ------------------
 1721|    386|    }
 1722|       |
 1723|  1.75k|    if ((num_inp_atoms && !( *atom )) || (num_inp_stereo0D > 0 && !( *stereo0D ))) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (1723:10): [True: 1.75k, False: 0]
  |  Branch (1723:27): [True: 0, False: 1.75k]
  |  Branch (1723:43): [True: 386, False: 1.36k]
  |  Branch (1723:67): [True: 0, False: 386]
  ------------------
 1724|      0|    {
 1725|       |        /* allocation failed */
 1726|      0|        ret = -1;
 1727|      0|        goto exit_function;
 1728|      0|    }
 1729|       |
 1730|       |    /* copy atom properties */
 1731|   132k|    for (i = 0; i < num_inp_atoms; i++)
  ------------------
  |  Branch (1731:17): [True: 130k, False: 1.75k]
  ------------------
 1732|   130k|    {
 1733|   130k|        ( *atom )[i].num_bonds = at[i].valence;
 1734|   250k|        for (m = 0; m < at[i].valence; m++)
  ------------------
  |  Branch (1734:21): [True: 120k, False: 130k]
  ------------------
 1735|   120k|        {
 1736|   120k|            ( *atom )[i].bond_type[m] = at[i].bond_type[m];
 1737|   120k|            ( *atom )[i].neighbor[m] = at[i].neighbor[m];
 1738|   120k|        }
 1739|   130k|        ( *atom )[i].charge = at[i].charge;
 1740|       |#if USE_BCF
 1741|       |        memcpy_s( ( *atom )[i].elname, ATOM_EL_LEN, at[i].elname, ATOM_EL_LEN ); /* djb-rwth: function replaced with its safe C11 variant */
 1742|       |#else
 1743|   130k|        memcpy( ( *atom )[i].elname, at[i].elname, ATOM_EL_LEN );
  ------------------
  |  |   71|   130k|#define ATOM_EL_LEN               6 /* length of ASCIIZ element symbol field        */
  ------------------
 1744|   130k|#endif
 1745|   130k|        if (at[i].iso_atw_diff)
  ------------------
  |  Branch (1745:13): [True: 704, False: 129k]
  ------------------
 1746|    704|        {
 1747|    704|            ( *atom )[i].isotopic_mass = ISOTOPIC_SHIFT_FLAG + ( at[i].iso_atw_diff > 0 ? at[i].iso_atw_diff - 1 : at[i].iso_atw_diff );
  ------------------
  |  |   73|    704|#define ISOTOPIC_SHIFT_FLAG   10000 /* add to isotopic mass if isotopic_mass =      */
  ------------------
  |  Branch (1747:66): [True: 682, False: 22]
  ------------------
 1748|    704|        }
 1749|   130k|        ( *atom )[i].num_iso_H[0] = at[i].num_H;
 1750|   521k|        for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |   72|   521k|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (1750:21): [True: 391k, False: 130k]
  ------------------
 1751|   391k|        {
 1752|   391k|            ( *atom )[i].num_iso_H[m + 1] = at[i].num_iso_H[m];
 1753|   391k|        }
 1754|   130k|        ( *atom )[i].radical = at[i].radical;
 1755|   130k|    }
 1756|       |
 1757|       |    /* stereo */
 1758|   132k|    for (i = n = 0; i < num_inp_atoms; i++)
  ------------------
  |  Branch (1758:21): [True: 130k, False: 1.75k]
  ------------------
 1759|   130k|    {
 1760|   130k|        if (at[i].p_parity)
  ------------------
  |  Branch (1760:13): [True: 224, False: 130k]
  ------------------
 1761|    224|        {
 1762|    224|            if (n < num_inp_stereo0D)
  ------------------
  |  Branch (1762:17): [True: 223, False: 1]
  ------------------
 1763|    223|            {
 1764|    223|                ( *stereo0D )[n].central_atom = i;
 1765|    223|                ( *stereo0D )[n].parity = at[i].p_parity;
 1766|    223|                ( *stereo0D )[n].type = INCHI_StereoType_Tetrahedral;
 1767|  1.11k|                for (m = 0; m < MAX_NUM_STEREO_ATOM_NEIGH; m++)
  ------------------
  |  |  877|  1.11k|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (1767:29): [True: 892, False: 223]
  ------------------
 1768|    892|                {
 1769|    892|                    ( *stereo0D )[n].neighbor[m] = at[i].p_orig_at_num[m] - 1;
 1770|    892|                }
 1771|    223|                n++;
 1772|    223|            }
 1773|      1|            else
 1774|      1|            {
 1775|      1|                ret |= 1;
 1776|      1|                break;
 1777|      1|            }
 1778|    224|        }
 1779|   130k|        else
 1780|   130k|        {
 1781|   130k|            for (m1 = 0; m1 < MAX_NUM_STEREO_BONDS && at[i].sb_parity[m1]; m1++)
  ------------------
  |  |  873|   261k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1781:26): [True: 130k, False: 14]
  |  Branch (1781:55): [True: 738, False: 130k]
  ------------------
 1782|    738|            {
 1783|       |                /* find the opposite atom at the other end of double bond, allene, or cumulene */
 1784|    738|                int chain[12], len = 0, nxt_neigh, nxt, cur;
 1785|    738|                cur = chain[len++] = i;
 1786|    738|                nxt_neigh = at[cur].sb_ord[m1];
 1787|       |
 1788|    738|                do
 1789|    759|                {
 1790|       |                    /* add next atom */
 1791|    759|                    chain[len++] = nxt = at[cur].neighbor[nxt_neigh];
 1792|    759|                    nxt_neigh = ( at[nxt].neighbor[0] == cur );
 1793|    759|                    cur = nxt;
 1794|       |                    /* find nxt_neigh */
 1795|    759|                }
 1796|    759|                while (!at[cur].sb_parity[0] &&
  ------------------
  |  Branch (1796:24): [True: 21, False: 738]
  ------------------
 1797|     21|                       len < 12 &&
  ------------------
  |  Branch (1797:24): [True: 21, False: 0]
  ------------------
 1798|     21|                       at[cur].valence == 2);
  ------------------
  |  Branch (1798:24): [True: 21, False: 0]
  ------------------
 1799|       |
 1800|    738|                if (at[cur].sb_parity[0] && len <= 4 && i < cur /* count bonds only one time */)
  ------------------
  |  Branch (1800:21): [True: 738, False: 0]
  |  Branch (1800:45): [True: 738, False: 0]
  |  Branch (1800:57): [True: 367, False: 371]
  ------------------
 1801|    367|                {
 1802|       |                    /* double bond, cumulene, or allene has been found */
 1803|    413|                    for (m2 = 0; m2 < MAX_NUM_STEREO_BONDS && at[cur].sb_parity[m2]; m2++)
  ------------------
  |  |  873|    826|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1803:34): [True: 413, False: 0]
  |  Branch (1803:63): [True: 412, False: 1]
  ------------------
 1804|    412|                    {
 1805|    412|                        if (chain[len - 2] == at[cur].neighbor[(int) at[cur].sb_ord[m2]])
  ------------------
  |  Branch (1805:29): [True: 366, False: 46]
  ------------------
 1806|    366|                        {
 1807|    366|                            if (n < num_inp_stereo0D)
  ------------------
  |  Branch (1807:33): [True: 366, False: 0]
  ------------------
 1808|    366|                            {
 1809|    366|                                int parity1 = at[i].sb_parity[m1];
 1810|    366|                                int parity2 = at[cur].sb_parity[m2];
 1811|    366|                                int parity;
 1812|    366|                                if (( INCHI_PARITY_ODD == parity1 || INCHI_PARITY_EVEN == parity1 ) &&
  ------------------
  |  Branch (1812:39): [True: 137, False: 229]
  |  Branch (1812:70): [True: 110, False: 119]
  ------------------
 1813|    247|                                    ( INCHI_PARITY_ODD == parity2 || INCHI_PARITY_EVEN == parity2 ))
  ------------------
  |  Branch (1813:39): [True: 33, False: 214]
  |  Branch (1813:70): [True: 214, False: 0]
  ------------------
 1814|    247|                                {
 1815|       |                                    /* well-defined parity */
 1816|    247|                                    parity = ( parity1 == parity2 ) ? INCHI_PARITY_EVEN : INCHI_PARITY_ODD;
  ------------------
  |  Branch (1816:46): [True: 105, False: 142]
  ------------------
 1817|    247|                                }
 1818|    119|                                else
 1819|    119|                                {
 1820|    119|                                    parity = inchi_max( parity1, parity2 );
  ------------------
  |  |  138|    119|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 119]
  |  |  ------------------
  ------------------
 1821|    119|                                }
 1822|    366|                                ( *stereo0D )[n].central_atom = ( len == 3 ) ? chain[1] : NO_ATOM;
  ------------------
  |  |  369|    728|#define NO_ATOM          (-1) /* non-existent (central) atom */
  ------------------
  |  Branch (1822:65): [True: 4, False: 362]
  ------------------
 1823|    366|                                ( *stereo0D )[n].parity = parity;
 1824|    366|                                ( *stereo0D )[n].type = len == 3 ? INCHI_StereoType_Allene : INCHI_StereoType_DoubleBond;
  ------------------
  |  Branch (1824:57): [True: 4, False: 362]
  ------------------
 1825|    366|                                ( *stereo0D )[n].neighbor[0] = at[i].sn_orig_at_num[m1] - 1;
 1826|    366|                                ( *stereo0D )[n].neighbor[1] = i;
 1827|    366|                                ( *stereo0D )[n].neighbor[2] = cur;
 1828|    366|                                ( *stereo0D )[n].neighbor[3] = at[cur].sn_orig_at_num[m2] - 1;
 1829|    366|                                n++;
 1830|    366|                            }
 1831|      0|                            else
 1832|      0|                            {
 1833|      0|                                ret |= 1;
 1834|      0|                            }
 1835|    366|                            break;
 1836|    366|                        }
 1837|    412|                    }
 1838|    367|                }
 1839|    738|            }
 1840|   130k|        }
 1841|   130k|    }
 1842|       |
 1843|  1.75k|    *num_stereo0D = n;
 1844|       |
 1845|  1.75k|exit_function:
 1846|  1.75k|    if (ret < 0)
  ------------------
  |  Branch (1846:9): [True: 0, False: 1.75k]
  ------------------
 1847|      0|    {
 1848|      0|        if (*atom)
  ------------------
  |  Branch (1848:13): [True: 0, False: 0]
  ------------------
 1849|      0|        {
 1850|      0|            inchi_free( *atom );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1851|      0|        }
 1852|      0|        if (*stereo0D)
  ------------------
  |  Branch (1852:13): [True: 0, False: 0]
  ------------------
 1853|      0|        {
 1854|      0|            inchi_free( *stereo0D );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1855|      0|        }
 1856|      0|        *atom = NULL;
 1857|      0|        *stereo0D = NULL;
 1858|      0|        *num_atoms = 0;
 1859|      0|        *num_stereo0D = 0;
 1860|      0|    }
 1861|       |
 1862|  1.75k|    return ret;
 1863|  1.75k|}
GetINCHIfromINCHI:
 2120|  6.37k|{
 2121|  6.37k|    STRUCT_DATA struct_data;
 2122|  6.37k|    STRUCT_DATA *sd = &struct_data;
 2123|       |
 2124|  6.37k|    static char szMainOption[] = " ?InChI2InChI";
 2125|       |
 2126|  6.37k|    INCHI_CLOCK ic;
 2127|  6.37k|    CANON_GLOBALS CG;
 2128|       |
 2129|  6.37k|    int i;
 2130|  6.37k|    char      szSdfDataValue[MAX_SDF_VALUE + 1];
 2131|  6.37k|    unsigned long  ulDisplTime = 0;    /*  infinite, milliseconds */
 2132|       |
 2133|  6.37k|    INPUT_PARMS inp_parms;
 2134|  6.37k|    INPUT_PARMS *ip = &inp_parms;
 2135|       |
 2136|  6.37k|    int             bReleaseVersion = bRELEASE_VERSION;
  ------------------
  |  |  238|  6.37k|#define bRELEASE_VERSION  1    /* 1=> release version; comment out to disable */
  ------------------
 2137|  6.37k|    int   nRet = 0, nRet1;
 2138|       |
 2139|       |#if ( defined(REPEAT_ALL) && REPEAT_ALL > 0 )
 2140|       |    int  num_repeat = REPEAT_ALL;
 2141|       |#endif
 2142|       |
 2143|  6.37k|    const char *argv[INCHI_MAX_NUM_ARG + 1];
 2144|  6.37k|    int   argc;
 2145|  6.37k|    char *szOptions = NULL;
 2146|       |
 2147|  6.37k|    INCHI_IOSTREAM inchi_file[3], *out_file = inchi_file, *log_file = inchi_file + 1, *input_file = inchi_file + 2;
 2148|       |
 2149|       |#if( TRACE_MEMORY_LEAKS == 1 )
 2150|       |    _CrtSetDbgFlag( _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF );
 2151|       |/* for execution outside the VC++ debugger uncomment one of the following two */
 2152|       |
 2153|       |#ifdef MY_REPORT_FILE
 2154|       |    _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
 2155|       |    _CrtSetReportFile( _CRT_WARN, MY_REPORT_FILE );
 2156|       |    _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
 2157|       |    _CrtSetReportFile( _CRT_ERROR, MY_REPORT_FILE );
 2158|       |    _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
 2159|       |    _CrtSetReportFile( _CRT_ASSERT, MY_REPORT_FILE );
 2160|       |#else
 2161|       |    _CrtSetReportMode( _CRT_WARN | _CRT_ERROR, _CRTDBG_MODE_DEBUG );
 2162|       |#endif
 2163|       |
 2164|       |    /* turn on floating point exceptions */
 2165|       |#if ( !defined(__STDC__) || __STDC__ != 1 )
 2166|       |    {
 2167|       |        /* Get the default control word. */
 2168|       |        int cw = _controlfp( 0, 0 );
 2169|       |
 2170|       |        /* Set the exception masks OFF, turn exceptions on. */
 2171|       |        /*cw &=~(EM_OVERFLOW|EM_UNDERFLOW|EM_INEXACT|EM_ZERODIVIDE|EM_DENORMAL);*/
 2172|       |        cw &= ~( EM_OVERFLOW | EM_UNDERFLOW | EM_ZERODIVIDE | EM_DENORMAL );
 2173|       |
 2174|       |        /* Set the control word. */
 2175|       |        _controlfp( cw, MCW_EM );
 2176|       |    }
 2177|       |#endif
 2178|       |#endif
 2179|       |
 2180|  6.37k|    memset( out, 0, sizeof( *out ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2181|       |#if ( defined(REPEAT_ALL) && REPEAT_ALL > 0 )
 2182|       |repeat:
 2183|       |    FreeINCHI( out );
 2184|       |    inchi_ios_close( out_file );
 2185|       |    inchi_ios_close( log_file );
 2186|       |    inchi_ios_reset( input_file );  /* do not close input_file - its string buffer may point to inpInChI->szInChI */
 2187|       |#endif
 2188|       |
 2189|       |    /* Initialize internal for this function I/O streams as string buffers */
 2190|  6.37k|    inchi_ios_init( input_file, INCHI_IOS_TYPE_STRING, NULL );
  ------------------
  |  | 1016|  6.37k|#define INCHI_IOS_TYPE_STRING 1
  ------------------
 2191|  6.37k|    inchi_ios_init( out_file, INCHI_IOS_TYPE_STRING, NULL );
  ------------------
  |  | 1016|  6.37k|#define INCHI_IOS_TYPE_STRING 1
  ------------------
 2192|  6.37k|    inchi_ios_init( log_file, INCHI_IOS_TYPE_STRING, NULL );
  ------------------
  |  | 1016|  6.37k|#define INCHI_IOS_TYPE_STRING 1
  ------------------
 2193|       |
 2194|  6.37k|    sd->bUserQuit = 0;
 2195|       |
 2196|       |    /* clear original input structure */
 2197|       |    /* memset( inchi_file, 0, sizeof(inchi_file) ); */
 2198|  6.37k|    memset( sd, 0, sizeof( *sd ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2199|  6.37k|    memset( ip, 0, sizeof( *ip ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2200|  6.37k|    memset( szSdfDataValue, 0, sizeof( szSdfDataValue ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2201|       |
 2202|  6.37k|    memset( &ic, 0, sizeof( ic ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2203|  6.37k|    memset( &CG, 0, sizeof( CG ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2204|       |
 2205|  6.37k|    szMainOption[1] = INCHI_OPTION_PREFX;
  ------------------
  |  |  231|  6.37k|#define   INCHI_OPTION_PREFX  '-'
  ------------------
 2206|       |
 2207|  6.37k|    if (!inpInChI)
  ------------------
  |  Branch (2207:9): [True: 0, False: 6.37k]
  ------------------
 2208|      0|    {
 2209|      0|        nRet = _IS_ERROR;
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
 2210|      0|        goto exit_function;
 2211|      0|    }
 2212|       |
 2213|       |    /* options */
 2214|  6.37k|    if (inpInChI)
  ------------------
  |  Branch (2214:9): [True: 6.37k, False: 0]
  ------------------
 2215|  6.37k|    {
 2216|  6.37k|        int opt_len = (int) ( ( inpInChI->szOptions ? strlen( inpInChI->szOptions ) : 0 ) + sizeof( szMainOption ) + 1 );
  ------------------
  |  Branch (2216:33): [True: 0, False: 6.37k]
  ------------------
 2217|  6.37k|        szOptions = (char*) inchi_calloc( (long long)opt_len + 1, sizeof( szOptions[0] ) ); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  6.37k|#define inchi_calloc   calloc
  ------------------
 2218|  6.37k|        if (szOptions)
  ------------------
  |  Branch (2218:13): [True: 6.37k, False: 0]
  ------------------
 2219|  6.37k|        {
 2220|  6.37k|            if (inpInChI->szOptions)
  ------------------
  |  Branch (2220:17): [True: 0, False: 6.37k]
  ------------------
 2221|      0|            {
 2222|      0|                strcpy( szOptions, inpInChI->szOptions );
 2223|      0|            }
 2224|  6.37k|            strcat( szOptions, szMainOption );
 2225|  6.37k|            argc = parse_options_string( szOptions, argv, INCHI_MAX_NUM_ARG );
  ------------------
  |  |   11|  6.37k|#define INCHI_MAX_NUM_ARG 32
  ------------------
 2226|  6.37k|        }
 2227|      0|        else
 2228|      0|        {
 2229|      0|            nRet = _IS_FATAL;
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
 2230|      0|            goto translate_RetVal; /* emergency exit */
 2231|      0|        }
 2232|  6.37k|    }
 2233|      0|    else
 2234|      0|    {
 2235|      0|        argc = 1;
 2236|      0|        argv[0] = "";
 2237|      0|        argv[1] = NULL;
 2238|      0|    }
 2239|       |
 2240|  6.37k|    if ((argc == 1
  ------------------
  |  Branch (2240:10): [True: 0, False: 6.37k]
  ------------------
 2241|      0|#ifdef TARGET_API_LIB
 2242|      0|        && ( !inpInChI || !inpInChI->szInChI ))
  ------------------
  |  Branch (2242:14): [True: 0, False: 0]
  |  Branch (2242:27): [True: 0, False: 0]
  ------------------
 2243|  6.37k|#endif
 2244|       |
 2245|  6.37k|        || (argc == 2 && ( argv[1][0] == INCHI_OPTION_PREFX ) &&
  ------------------
  |  |  231|  6.37k|#define   INCHI_OPTION_PREFX  '-'
  ------------------
  |  Branch (2245:13): [True: 6.37k, False: 0]
  |  Branch (2245:26): [True: 6.37k, False: 0]
  ------------------
 2246|  6.37k|        ( !strcmp( argv[1] + 1, "?" ) || !inchi_stricmp( argv[1] + 1, "help" ) ))) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (2246:11): [True: 0, False: 6.37k]
  |  Branch (2246:42): [True: 0, False: 6.37k]
  ------------------
 2247|      0|    {
 2248|      0|        HelpCommandLineParms( log_file );
 2249|      0|        out->szLog = log_file->s.pStr;
 2250|      0|        memset( log_file, 0, sizeof( *log_file ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2251|      0|        nRet = _IS_EOF;
  ------------------
  |  |   15|      0|#define _IS_EOF    -1    /* end of file */
  ------------------
 2252|      0|        inchi_free(szOptions); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2253|      0|        goto translate_RetVal;
 2254|      0|    }
 2255|       |
 2256|  6.37k|    nRet1 = ReadCommandLineParms( argc, argv, ip, szSdfDataValue,
 2257|  6.37k|                                &ulDisplTime, bReleaseVersion, log_file );
 2258|       |
 2259|  6.37k|    if (szOptions)
  ------------------
  |  Branch (2259:9): [True: 6.37k, False: 0]
  ------------------
 2260|  6.37k|    {
 2261|       |        /* argv pointed to strings in szOptions */
 2262|  6.37k|        inchi_free( szOptions );
  ------------------
  |  | 1152|  6.37k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 6.37k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 6.37k]
  |  |  ------------------
  ------------------
 2263|  6.37k|        szOptions = NULL;
 2264|  6.37k|    }
 2265|       |    /* INChI DLL specific */
 2266|  6.37k|    ip->bNoStructLabels = 1;
 2267|       |
 2268|  6.37k|    if (0 > nRet1)
  ------------------
  |  Branch (2268:9): [True: 0, False: 6.37k]
  ------------------
 2269|      0|    {
 2270|      0|        goto exit_function;
 2271|      0|    }
 2272|       |
 2273|  6.37k|    if (ip->bNoStructLabels)
  ------------------
  |  Branch (2273:9): [True: 6.37k, False: 0]
  ------------------
 2274|  6.37k|    {
 2275|  6.37k|        ip->pSdfLabel = NULL;
 2276|  6.37k|        ip->pSdfValue = NULL;
 2277|  6.37k|    }
 2278|      0|    else if (ip->nInputType == INPUT_INCHI_XML ||
  ------------------
  |  Branch (2278:14): [True: 0, False: 0]
  ------------------
 2279|      0|            ip->nInputType == INPUT_INCHI_PLAIN ||
  ------------------
  |  Branch (2279:13): [True: 0, False: 0]
  ------------------
 2280|      0|            ip->nInputType == INPUT_CMLFILE ||
  ------------------
  |  Branch (2280:13): [True: 0, False: 0]
  ------------------
 2281|      0|            ip->nInputType == INPUT_INCHI)
  ------------------
  |  Branch (2281:13): [True: 0, False: 0]
  ------------------
 2282|      0|    {
 2283|       |        /* the input may contain both the header and the label of the structure */
 2284|      0|        if (!ip->pSdfLabel)
  ------------------
  |  Branch (2284:13): [True: 0, False: 0]
  ------------------
 2285|      0|        {
 2286|      0|            ip->pSdfLabel = ip->szSdfDataHeader;
 2287|      0|        }
 2288|      0|        if (!ip->pSdfValue)
  ------------------
  |  Branch (2288:13): [True: 0, False: 0]
  ------------------
 2289|      0|        {
 2290|      0|            ip->pSdfValue = szSdfDataValue;
 2291|      0|        }
 2292|      0|    }
 2293|       |
 2294|  6.37k|    if (ip->nInputType && ip->nInputType != INPUT_INCHI)
  ------------------
  |  Branch (2294:9): [True: 6.37k, False: 0]
  |  Branch (2294:27): [True: 0, False: 6.37k]
  ------------------
 2295|      0|    {
 2296|      0|        inchi_ios_eprint( log_file, "Input type set to INPUT_INCHI\n" );
 2297|      0|        ip->nInputType = INPUT_INCHI;
 2298|      0|    }
 2299|       |
 2300|  6.37k|    if (!inpInChI->szInChI)
  ------------------
  |  Branch (2300:9): [True: 0, False: 6.37k]
  ------------------
 2301|      0|    {
 2302|      0|        nRet = _IS_ERROR;
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
 2303|      0|        goto exit_function;
 2304|      0|    }
 2305|  6.37k|    else
 2306|  6.37k|    {
 2307|  6.37k|        const int strict = 0;
 2308|  6.37k|        nRet = CheckINCHI( inpInChI->szInChI, strict );
 2309|  6.37k|        if (nRet != INCHI_VALID_STANDARD     &&
  ------------------
  |  Branch (2309:13): [True: 6.33k, False: 35]
  ------------------
 2310|  6.33k|            nRet != INCHI_VALID_NON_STANDARD &&
  ------------------
  |  Branch (2310:13): [True: 113, False: 6.22k]
  ------------------
 2311|    113|            nRet != INCHI_VALID_BETA)
  ------------------
  |  Branch (2311:13): [True: 89, False: 24]
  ------------------
 2312|     89|        {
 2313|     89|            nRet = _IS_ERROR;
  ------------------
  |  |   12|     89|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
 2314|     89|            goto exit_function;
 2315|     89|        }
 2316|  6.37k|    }
 2317|       |
 2318|       |
 2319|  6.28k|    PrintInputParms( log_file, ip );
 2320|       |
 2321|       |    /********************************/
 2322|       |    /* InChI -> InChI               */
 2323|       |    /********************************/
 2324|       |
 2325|       |    /* input_file simulation */
 2326|  6.28k|    input_file->s.pStr = inpInChI->szInChI;
 2327|  6.28k|    input_file->s.nUsedLength = (int) strlen( input_file->s.pStr ) + 1;
 2328|  6.28k|    input_file->s.nAllocatedLength = input_file->s.nUsedLength;
 2329|  6.28k|    input_file->s.nPtr = 0;
 2330|       |
 2331|       |    /* buffer for the message */
 2332|  6.28k|    out->szMessage = (char *) inchi_calloc( MAX_MSG_LEN, sizeof( out->szMessage[0] ) );
  ------------------
  |  | 1146|  6.28k|#define inchi_calloc   calloc
  ------------------
                  out->szMessage = (char *) inchi_calloc( MAX_MSG_LEN, sizeof( out->szMessage[0] ) );
  ------------------
  |  | 2102|  6.28k|#define MAX_MSG_LEN 512
  ------------------
 2333|  6.28k|    if (!out->szMessage)
  ------------------
  |  Branch (2333:9): [True: 0, False: 6.28k]
  ------------------
 2334|      0|    {
 2335|      0|        inchi_ios_eprint( log_file, "Cannot allocate output message buffer.\n" );
 2336|      0|        nRet = -1;
 2337|      0|    }
 2338|  6.28k|    else
 2339|  6.28k|    {
 2340|  6.28k|        nRet = ReadWriteInChI( &ic, &CG, input_file, out_file, log_file,
 2341|  6.28k|                                ip, sd,
 2342|  6.28k|                                NULL, 0, NULL,
 2343|  6.28k|                                NULL, NULL,
 2344|  6.28k|                                out->szMessage, MAX_MSG_LEN,
  ------------------
  |  | 2102|  6.28k|#define MAX_MSG_LEN 512
  ------------------
 2345|  6.28k|                                NULL /*out->WarningFlags*/ );
 2346|  6.28k|    }
 2347|       |
 2348|  6.28k|    if (nRet >= 0 && out_file->s.pStr)
  ------------------
  |  Branch (2348:9): [True: 5.12k, False: 1.16k]
  |  Branch (2348:22): [True: 5.02k, False: 93]
  ------------------
 2349|  5.02k|    {
 2350|       |        /* success */
 2351|  5.02k|        char* p = NULL;
 2352|       |        /* djb-rwth: fixing oss-fuzz issue #40971 */
 2353|  5.02k|        int p_len, out_szinchi_len;
 2354|  5.02k|        out_szinchi_len = strlen(out_file->s.pStr);
 2355|  5.02k|        out->szInChI = out_file->s.pStr;
 2356|  5.02k|        out->szAuxInfo = NULL;
 2357|       |
 2358|  5.02k|        for (p = strchr( out->szInChI, '\n' ); p; p = strchr( p + 1, '\n' ))
  ------------------
  |  Branch (2358:48): [True: 5.02k, False: 0]
  ------------------
 2359|  5.02k|        {
 2360|  5.02k|            p_len = strlen(p);
 2361|  5.02k|            if ((p_len >= 8) && !memcmp( p, "\nAuxInfo", 8 ))
  ------------------
  |  Branch (2361:17): [True: 0, False: 5.02k]
  |  Branch (2361:33): [True: 0, False: 0]
  ------------------
 2362|      0|            {
 2363|      0|                *p = '\0';            /* remove LF after INChI */
 2364|      0|                out->szAuxInfo = p + 1; /* save pointer to AuxInfo */
 2365|      0|            }
 2366|  5.02k|            else if (out->szAuxInfo || !p[1])
  ------------------
  |  Branch (2366:22): [True: 0, False: 5.02k]
  |  Branch (2366:40): [True: 5.02k, False: 0]
  ------------------
 2367|  5.02k|            {
 2368|       |                /* remove LF after aux info or from the last char */
 2369|  5.02k|                *p = '\0';
 2370|  5.02k|                break;
 2371|  5.02k|            }
 2372|  5.02k|        }
 2373|  5.02k|        out_file->s.pStr = NULL;
 2374|  5.02k|    }
 2375|       |
 2376|       |    /*
 2377|       |    out->szLog = log_file->pStr;
 2378|       |    log_file->pStr   = NULL;
 2379|       |    */
 2380|       |
 2381|  6.37k|exit_function:;
 2382|       |
 2383|  31.8k|    for (i = 0; i < MAX_NUM_PATHS; i++)
  ------------------
  |  |   58|  31.8k|#define MAX_NUM_PATHS 4
  ------------------
  |  Branch (2383:17): [True: 25.4k, False: 6.37k]
  ------------------
 2384|  25.4k|    {
 2385|  25.4k|        if (ip->path[i])
  ------------------
  |  Branch (2385:13): [True: 0, False: 25.4k]
  ------------------
 2386|      0|        {
 2387|      0|            inchi_free( (char*) ip->path[i] ); /*  cast deliberately discards 'const' qualifier */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2388|      0|            ip->path[i] = NULL;
 2389|      0|        }
 2390|  25.4k|    }
 2391|       |
 2392|  6.37k|    SetBitFree( &CG );
 2393|       |
 2394|       |#if ( defined(REPEAT_ALL) && REPEAT_ALL > 0 )
 2395|       |    if (num_repeat-- > 0)
 2396|       |    {
 2397|       |        goto repeat;
 2398|       |    }
 2399|       |#endif
 2400|       |
 2401|  6.37k|#ifdef TARGET_API_LIB
 2402|       |    /* output */
 2403|       |
 2404|  6.37k|        if (log_file->s.pStr && log_file->s.nUsedLength > 0)
  ------------------
  |  Branch (2404:13): [True: 6.28k, False: 89]
  |  Branch (2404:33): [True: 6.28k, False: 0]
  ------------------
 2405|  6.28k|        {
 2406|  17.5k|            while (log_file->s.nUsedLength && '\n' == log_file->s.pStr[log_file->s.nUsedLength - 1])
  ------------------
  |  Branch (2406:20): [True: 17.5k, False: 0]
  |  Branch (2406:47): [True: 11.3k, False: 6.28k]
  ------------------
 2407|  11.3k|            {
 2408|  11.3k|                log_file->s.pStr[--log_file->s.nUsedLength] = '\0'; /* remove last LF */
 2409|  11.3k|            }
 2410|  6.28k|            if (out)
  ------------------
  |  Branch (2410:17): [True: 6.28k, False: 0]
  ------------------
 2411|  6.28k|            {
 2412|  6.28k|                out->szLog = log_file->s.pStr;
 2413|  6.28k|                log_file->s.pStr = NULL;
 2414|  6.28k|            }
 2415|  6.28k|        }
 2416|       |
 2417|  6.37k|#endif
 2418|       |
 2419|  6.37k|translate_RetVal:
 2420|       |
 2421|       |    /* close internal output streams */
 2422|  6.37k|    inchi_ios_close( out_file );
 2423|  6.37k|    inchi_ios_close( log_file );
 2424|  6.37k|    inchi_ios_reset( input_file );  /* do not close input_file - its string buffer may point to inpInChI->szInChI */
 2425|       |
 2426|  6.37k|    switch (nRet)
 2427|  6.37k|    {
 2428|      9|        case -3: nRet = inchi_Ret_ERROR; break; /* Error: no Structure has been created */
  ------------------
  |  Branch (2428:9): [True: 9, False: 6.36k]
  ------------------
 2429|  1.15k|        case -2: nRet = inchi_Ret_ERROR; break; /* Error: no Structure has been created */
  ------------------
  |  Branch (2429:9): [True: 1.15k, False: 5.21k]
  ------------------
 2430|      0|        case -1: nRet = inchi_Ret_FATAL; break; /* Severe error: no Structure has been created (typically; break; memory allocation failed) */
  ------------------
  |  Branch (2430:9): [True: 0, False: 6.37k]
  ------------------
 2431|  5.20k|        default:
  ------------------
  |  Branch (2431:9): [True: 5.20k, False: 1.16k]
  ------------------
 2432|       |            /*
 2433|       |            if ( !outStruct->atom || !outStruct->num_atoms )
 2434|       |            {
 2435|       |                nRet = inchi_Ret_EOF;
 2436|       |            }
 2437|       |            else
 2438|       |            {
 2439|       |                int m,n,t=0;
 2440|       |                for ( m=0; m < 2; m ++ )
 2441|       |                {
 2442|       |                    for ( n=0; n < 2; n ++ )
 2443|       |                    {
 2444|       |                        if ( outStruct->WarningFlags[m][n] ) {
 2445|       |                            t ++;
 2446|       |                        }
 2447|       |                    }
 2448|       |                }
 2449|       |                nRet = t? inchi_Ret_WARNING : inchi_Ret_OKAY;
 2450|       |            }
 2451|       |            */
 2452|  5.20k|            break;
 2453|  6.37k|    }
 2454|       |
 2455|  6.37k|    return nRet;
 2456|  6.37k|}
GetStructFromINCHIEx:
 2491|  6.37k|{
 2492|  6.37k|    INCHI_CLOCK ic;
 2493|  6.37k|    CANON_GLOBALS CG;
 2494|  6.37k|    STRUCT_DATA struct_data;
 2495|  6.37k|    STRUCT_DATA *sd = &struct_data;
 2496|  6.37k|    INPUT_PARMS inp_parms;
 2497|  6.37k|    INPUT_PARMS *ip = &inp_parms;
 2498|  6.37k|    INCHI_IOSTREAM inchi_file[3];
 2499|  6.37k|    INCHI_IOSTREAM *out_file = inchi_file, *log_file = inchi_file + 1, *input_file = inchi_file + 2;
 2500|  6.37k|    int    i, nRet = 0, nRet1;
 2501|       |    /* djb-rwth: removing redundant variables/code */
 2502|  6.37k|    int bReleaseVersion = bRELEASE_VERSION; /* djb-rwth: ignoring LLVM warning: variable used in function call */
  ------------------
  |  |  238|  6.37k|#define bRELEASE_VERSION  1    /* 1=> release version; comment out to disable */
  ------------------
 2503|  6.37k|    unsigned long  ulDisplTime = 0;    /*  infinite, milliseconds */
 2504|       |#if ( defined(REPEAT_ALL) && REPEAT_ALL > 0 )
 2505|       |    int  num_repeat = REPEAT_ALL;
 2506|       |#endif
 2507|  6.37k|    static char szMainOption[] = " ?InChI2Struct";
 2508|  6.37k|    char szSdfDataValue[MAX_SDF_VALUE + 1];
 2509|  6.37k|    const char *argv[INCHI_MAX_NUM_ARG + 1];
 2510|  6.37k|    int   argc;
 2511|  6.37k|    char *szOptions = NULL;
 2512|       |    /* conversion result */
 2513|  6.37k|    inp_ATOM *at = NULL;
 2514|  6.37k|    int num_at = 0;
 2515|  6.37k|    OAD_Polymer *polymer = NULL;
 2516|  6.37k|    OAD_V3000    *v3000 = NULL;
 2517|       |
 2518|       |#if( TRACE_MEMORY_LEAKS == 1 )
 2519|       |    _CrtSetDbgFlag( _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF );
 2520|       |
 2521|       |/* for execution outside the VC++ debugger uncomment one of the following two */
 2522|       |#ifdef MY_REPORT_FILE
 2523|       |    _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
 2524|       |    _CrtSetReportFile( _CRT_WARN, MY_REPORT_FILE );
 2525|       |    _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
 2526|       |    _CrtSetReportFile( _CRT_ERROR, MY_REPORT_FILE );
 2527|       |    _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
 2528|       |    _CrtSetReportFile( _CRT_ASSERT, MY_REPORT_FILE );
 2529|       |#else
 2530|       |    _CrtSetReportMode( _CRT_WARN | _CRT_ERROR, _CRTDBG_MODE_DEBUG );
 2531|       |#endif
 2532|       |
 2533|       |    /* turn on floating point exceptions */
 2534|       |#if ( !defined(__STDC__) || __STDC__ != 1 )
 2535|       |    {
 2536|       |        /* Get the default control word. */
 2537|       |        int cw = _controlfp( 0, 0 );
 2538|       |
 2539|       |        /* Set the exception masks OFF, turn exceptions on. */
 2540|       |        /*cw &=~(EM_OVERFLOW|EM_UNDERFLOW|EM_INEXACT|EM_ZERODIVIDE|EM_DENORMAL);*/
 2541|       |        cw &= ~( EM_OVERFLOW | EM_UNDERFLOW | EM_ZERODIVIDE | EM_DENORMAL );
 2542|       |
 2543|       |        /* Set the control word. */
 2544|       |        _controlfp( cw, MCW_EM );
 2545|       |    }
 2546|       |#endif
 2547|       |#endif
 2548|       |
 2549|  6.37k|    memset( outStruct, 0, sizeof( *outStruct ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2550|       |
 2551|       |#if ( defined(REPEAT_ALL) && REPEAT_ALL > 0 )
 2552|       |    repeat:
 2553|       |    FreeStructFromINCHI( &outStruct );
 2554|       |    inchi_ios_reset( input_file );  /* do not close input_file - its string buffer may point to inpInChI->szInChI */
 2555|       |    inchi_ios_close( out_file );
 2556|       |    inchi_ios_close( log_file );
 2557|       |#endif
 2558|       |
 2559|  6.37k|    sd->bUserQuit = 0;
 2560|       |
 2561|       |    /* Initialize internal for this function I/O streams as string buffers */
 2562|  6.37k|    inchi_ios_init( input_file, INCHI_IOS_TYPE_STRING, NULL );
  ------------------
  |  | 1016|  6.37k|#define INCHI_IOS_TYPE_STRING 1
  ------------------
 2563|  6.37k|    inchi_ios_init( out_file, INCHI_IOS_TYPE_STRING, NULL );
  ------------------
  |  | 1016|  6.37k|#define INCHI_IOS_TYPE_STRING 1
  ------------------
 2564|  6.37k|    inchi_ios_init( log_file, INCHI_IOS_TYPE_STRING, NULL );
  ------------------
  |  | 1016|  6.37k|#define INCHI_IOS_TYPE_STRING 1
  ------------------
 2565|       |
 2566|       |    /* clear original input structure */
 2567|  6.37k|    memset( sd, 0, sizeof( *sd ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2568|  6.37k|    memset( ip, 0, sizeof( *ip ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2569|  6.37k|    memset( szSdfDataValue, 0, sizeof( szSdfDataValue ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2570|       |
 2571|  6.37k|    memset( &ic, 0, sizeof( ic ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2572|  6.37k|    memset( &CG, 0, sizeof( CG ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2573|       |
 2574|  6.37k|    szMainOption[1] = INCHI_OPTION_PREFX;
  ------------------
  |  |  231|  6.37k|#define   INCHI_OPTION_PREFX  '-'
  ------------------
 2575|       |
 2576|  6.37k|    if (!inpInChI)
  ------------------
  |  Branch (2576:9): [True: 0, False: 6.37k]
  ------------------
 2577|      0|    {
 2578|      0|        nRet = _IS_ERROR;
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
 2579|      0|        goto exit_function;
 2580|      0|    }
 2581|       |
 2582|       |    /* options */
 2583|  6.37k|    if (inpInChI /*&& inpInChI->szOptions*/)
  ------------------
  |  Branch (2583:9): [True: 6.37k, False: 0]
  ------------------
 2584|  6.37k|    {
 2585|       |        /* fix bug discovered by Burt Leland 2008-12-23 */
 2586|  6.37k|        int opt_len = ( inpInChI->szOptions ? strlen( inpInChI->szOptions ) : 0 ) + sizeof( szMainOption ) + 1;
  ------------------
  |  Branch (2586:25): [True: 0, False: 6.37k]
  ------------------
 2587|  6.37k|        szOptions = (char*)inchi_calloc((long long)opt_len + 1, sizeof(szOptions[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  6.37k|#define inchi_calloc   calloc
  ------------------
 2588|  6.37k|        if (szOptions)
  ------------------
  |  Branch (2588:13): [True: 6.37k, False: 0]
  ------------------
 2589|  6.37k|        {
 2590|  6.37k|            if (inpInChI->szOptions)
  ------------------
  |  Branch (2590:17): [True: 0, False: 6.37k]
  ------------------
 2591|       |                /* fix bug discovered by Burt Leland 2008-12-23 */
 2592|      0|                strcpy(szOptions, inpInChI->szOptions);
 2593|  6.37k|            strcat(szOptions, szMainOption);
 2594|  6.37k|            argc = parse_options_string( szOptions, argv, INCHI_MAX_NUM_ARG );
  ------------------
  |  |   11|  6.37k|#define INCHI_MAX_NUM_ARG 32
  ------------------
 2595|  6.37k|        }
 2596|      0|        else
 2597|      0|        {
 2598|      0|            nRet = _IS_FATAL;
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
 2599|      0|            goto translate_RetVal; /* emergency exit */
 2600|      0|        }
 2601|  6.37k|    }
 2602|      0|    else
 2603|      0|    {
 2604|      0|        argc = 1;
 2605|      0|            argv[0] = "";
 2606|      0|        argv[1] = NULL;
 2607|      0|    }
 2608|       |
 2609|  6.37k|    if ((argc == 1
  ------------------
  |  Branch (2609:10): [True: 0, False: 6.37k]
  ------------------
 2610|      0|#ifdef TARGET_API_LIB
 2611|      0|        && ( !inpInChI || !inpInChI->szInChI ))
  ------------------
  |  Branch (2611:14): [True: 0, False: 0]
  |  Branch (2611:27): [True: 0, False: 0]
  ------------------
 2612|  6.37k|#endif
 2613|  6.37k|        || (argc == 2 && ( argv[1][0] == INCHI_OPTION_PREFX ) &&
  ------------------
  |  |  231|  6.37k|#define   INCHI_OPTION_PREFX  '-'
  ------------------
  |  Branch (2613:13): [True: 6.37k, False: 0]
  |  Branch (2613:26): [True: 6.37k, False: 0]
  ------------------
 2614|  6.37k|        ( !strcmp( argv[1] + 1, "?" ) || !inchi_stricmp( argv[1] + 1, "help" ) ))) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (2614:11): [True: 0, False: 6.37k]
  |  Branch (2614:42): [True: 0, False: 6.37k]
  ------------------
 2615|      0|    {
 2616|      0|        HelpCommandLineParms( log_file );
 2617|      0|        outStruct->szLog = log_file->s.pStr;
 2618|      0|        nRet = _IS_EOF;
  ------------------
  |  |   15|      0|#define _IS_EOF    -1    /* end of file */
  ------------------
 2619|      0|        goto translate_RetVal;
 2620|      0|    }
 2621|       |
 2622|  6.37k|    nRet1 = ReadCommandLineParms( argc, argv, ip, szSdfDataValue,
 2623|  6.37k|                                  &ulDisplTime, bReleaseVersion,
 2624|  6.37k|                                  log_file );
 2625|       |
 2626|  6.37k|    if (szOptions)
  ------------------
  |  Branch (2626:9): [True: 6.37k, False: 0]
  ------------------
 2627|  6.37k|    {
 2628|       |        /* argv pointed to strings in szOptions */
 2629|  6.37k|        inchi_free( szOptions );
  ------------------
  |  | 1152|  6.37k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 6.37k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 6.37k]
  |  |  ------------------
  ------------------
 2630|  6.37k|        szOptions = NULL;
 2631|  6.37k|    }
 2632|       |
 2633|       |    /* INChI DLL specific */
 2634|  6.37k|    ip->bNoStructLabels = 1;
 2635|       |
 2636|  6.37k|    if (0 > nRet1)
  ------------------
  |  Branch (2636:9): [True: 0, False: 6.37k]
  ------------------
 2637|      0|    {
 2638|      0|        goto exit_function;
 2639|      0|    }
 2640|       |
 2641|  6.37k|    if (ip->bNoStructLabels)
  ------------------
  |  Branch (2641:9): [True: 6.37k, False: 0]
  ------------------
 2642|  6.37k|    {
 2643|  6.37k|        ip->pSdfLabel = NULL;
 2644|  6.37k|        ip->pSdfValue = NULL;
 2645|  6.37k|    }
 2646|      0|    else if (ip->nInputType == INPUT_INCHI_XML ||
  ------------------
  |  Branch (2646:14): [True: 0, False: 0]
  ------------------
 2647|      0|            ip->nInputType == INPUT_INCHI_PLAIN ||
  ------------------
  |  Branch (2647:13): [True: 0, False: 0]
  ------------------
 2648|      0|            ip->nInputType == INPUT_CMLFILE ||
  ------------------
  |  Branch (2648:13): [True: 0, False: 0]
  ------------------
 2649|      0|            ip->nInputType == INPUT_INCHI)
  ------------------
  |  Branch (2649:13): [True: 0, False: 0]
  ------------------
 2650|      0|    {
 2651|       |        /* the input may contain both the header and the label of the structure */
 2652|      0|        if (!ip->pSdfLabel)
  ------------------
  |  Branch (2652:13): [True: 0, False: 0]
  ------------------
 2653|      0|            ip->pSdfLabel = ip->szSdfDataHeader;
 2654|      0|        if (!ip->pSdfValue)
  ------------------
  |  Branch (2654:13): [True: 0, False: 0]
  ------------------
 2655|      0|            ip->pSdfValue = szSdfDataValue;
 2656|      0|    }
 2657|       |
 2658|  6.37k|    if (ip->nInputType && ip->nInputType != INPUT_INCHI)
  ------------------
  |  Branch (2658:9): [True: 6.37k, False: 0]
  |  Branch (2658:27): [True: 0, False: 6.37k]
  ------------------
 2659|      0|    {
 2660|      0|        inchi_ios_eprint( log_file, "Input type set to INPUT_INCHI\n" );
 2661|      0|        ip->nInputType = INPUT_INCHI;
 2662|      0|    }
 2663|       |
 2664|  6.37k|    if (!inpInChI->szInChI)
  ------------------
  |  Branch (2664:9): [True: 0, False: 6.37k]
  ------------------
 2665|      0|    {
 2666|      0|        nRet = _IS_ERROR;
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
 2667|      0|        goto exit_function;
 2668|      0|    }
 2669|  6.37k|    else
 2670|  6.37k|    {
 2671|  6.37k|        const int strict = 0;                     /* do not use strict mode, it may be too alarmous */
 2672|  6.37k|        nRet = CheckINCHI( inpInChI->szInChI, strict );
 2673|  6.37k|        if (nRet == INCHI_VALID_STANDARD || nRet == INCHI_VALID_NON_STANDARD || nRet == INCHI_VALID_BETA) /* djb-rwth: removing redundant code */
  ------------------
  |  Branch (2673:13): [True: 35, False: 6.33k]
  |  Branch (2673:45): [True: 6.22k, False: 113]
  |  Branch (2673:81): [True: 24, False: 89]
  ------------------
 2674|  6.28k|        {
 2675|  6.28k|            ;
 2676|  6.28k|        }
 2677|     89|        else
 2678|     89|        {
 2679|     89|            nRet = _IS_ERROR;
  ------------------
  |  |   12|     89|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
 2680|     89|            goto exit_function;
 2681|     89|        }
 2682|  6.37k|    }
 2683|       |
 2684|  6.28k|    PrintInputParms( log_file, ip );
 2685|       |
 2686|       |    /*********************************/
 2687|       |    /* InChI -> Structure conversion */
 2688|       |    /*********************************/
 2689|       |
 2690|       |    /* input_file simulation */
 2691|       |
 2692|       |    /*
 2693|       |    that was incorrect simulation, and correct one is much simpler, see below
 2694|       |    input_file->s.pStr = inpInChI->szInChI;
 2695|       |    input_file->s.nUsedLength = (int) strlen(input_file->s.pStr)+1;
 2696|       |    input_file->s.nAllocatedLength = input_file->s.nUsedLength;
 2697|       |    input_file->s.nPtr = 0;
 2698|       |    */
 2699|  6.28k|    inchi_ios_print_nodisplay( input_file, inpInChI->szInChI );
 2700|       |
 2701|       |    /* buffer for the message */
 2702|       |    /* outStruct->szMessage = (char *)inchi_calloc( MAX_MSG_LEN, sizeof(outStruct->szMessage[0])); */
 2703|       |
 2704|  6.28k|    outStruct->szMessage = (char *) inchi_calloc( MAX_MSG_LEN, sizeof( char ) );
  ------------------
  |  | 1146|  6.28k|#define inchi_calloc   calloc
  ------------------
                  outStruct->szMessage = (char *) inchi_calloc( MAX_MSG_LEN, sizeof( char ) );
  ------------------
  |  | 2102|  6.28k|#define MAX_MSG_LEN 512
  ------------------
 2705|  6.28k|    if (!outStruct->szMessage)
  ------------------
  |  Branch (2705:9): [True: 0, False: 6.28k]
  ------------------
 2706|      0|    {
 2707|      0|        inchi_ios_eprint( log_file, "Cannot allocate output message buffer.\n" );
 2708|      0|        nRet = -1;
 2709|      0|    }
 2710|  6.28k|    else
 2711|  6.28k|    {
 2712|  6.28k|        int num_bonds;
 2713|  6.28k|        nRet = ReadWriteInChI( &ic, &CG , input_file, out_file, log_file,
 2714|  6.28k|                                ip, sd, &at, &num_at, &num_bonds,
 2715|  6.28k|                                &polymer, &v3000,
 2716|  6.28k|                                outStruct->szMessage,
 2717|  6.28k|                                MAX_MSG_LEN, outStruct->WarningFlags );
  ------------------
  |  | 2102|  6.28k|#define MAX_MSG_LEN 512
  ------------------
 2718|       |
 2719|  6.28k|        if (nRet >= 0 && polymer && at && (num_at > 0)) /* djb-rwth: fixing oss-fuzz issue #68329, #68286 */
  ------------------
  |  Branch (2719:13): [True: 1.82k, False: 4.45k]
  |  Branch (2719:26): [True: 143, False: 1.68k]
  |  Branch (2719:37): [True: 143, False: 0]
  |  Branch (2719:43): [True: 143, False: 0]
  ------------------
 2720|    143|        {
 2721|    143|            OAD_Polymer_SmartReopenCyclizedUnits( polymer, at,
 2722|    143|                                                 num_at, &num_bonds );
 2723|    143|        }
 2724|  6.28k|    }
 2725|       |
 2726|  6.28k|    if (nRet >= 0 && at && num_at)
  ------------------
  |  Branch (2726:9): [True: 1.82k, False: 4.45k]
  |  Branch (2726:22): [True: 1.75k, False: 73]
  |  Branch (2726:28): [True: 1.75k, False: 0]
  ------------------
 2727|  1.75k|    {
 2728|       |        /* success */
 2729|  1.75k|        nRet = InpAtom0DToInchiAtom( at, num_at,
 2730|  1.75k|                                    &outStruct->num_atoms,
 2731|  1.75k|                                    &outStruct->atom,
 2732|  1.75k|                                    &outStruct->num_stereo0D,
 2733|  1.75k|                                    &outStruct->stereo0D );
 2734|       |
 2735|  1.75k|        if (at)
  ------------------
  |  Branch (2735:13): [True: 1.75k, False: 0]
  ------------------
 2736|  1.75k|        {
 2737|  1.75k|            inchi_free( at );
  ------------------
  |  | 1152|  1.75k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 1.75k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 1.75k]
  |  |  ------------------
  ------------------
 2738|  1.75k|            at = NULL;
 2739|  1.75k|        }
 2740|       |
 2741|  1.75k|        if (nRet >= 0 && polymer)
  ------------------
  |  Branch (2741:13): [True: 1.75k, False: 0]
  |  Branch (2741:26): [True: 143, False: 1.61k]
  ------------------
 2742|    143|        {
 2743|       |            /* Check for and then replace ZZ for star atoms if Polymer extension is supplied */
 2744|  17.7k|            for (i = 0; i < outStruct->num_atoms; i++)
  ------------------
  |  Branch (2744:25): [True: 17.5k, False: 143]
  ------------------
 2745|  17.5k|            {
 2746|  17.5k|                if (!strcmp( outStruct->atom[i].elname, "Zz" ))
  ------------------
  |  Branch (2746:21): [True: 196, False: 17.3k]
  ------------------
 2747|    196|                {
 2748|    196|                    strcpy( outStruct->atom[i].elname, "*" );
 2749|    196|                }
 2750|  17.5k|            }
 2751|    143|        }
 2752|       |
 2753|  1.75k|        if (nRet >= 0)
  ------------------
  |  Branch (2753:13): [True: 1.75k, False: 0]
  ------------------
 2754|  1.75k|        {
 2755|  1.75k|            if (polymer || v3000)
  ------------------
  |  Branch (2755:17): [True: 143, False: 1.61k]
  |  Branch (2755:28): [True: 0, False: 1.61k]
  ------------------
 2756|    143|            {
 2757|    143|                nRet = SetInChIExtInputByExtOrigAtData( polymer, v3000,
 2758|    143|                                                        &outStruct->polymer,
 2759|    143|                                                        &outStruct->v3000,
 2760|    143|                                                        outStruct->num_atoms ); /* pair to SetExtOrigAtDataByInChIExtInput */
 2761|    143|                FreeExtOrigAtData( polymer, v3000 );
 2762|    143|                polymer = NULL;
 2763|    143|                v3000 = NULL;
 2764|    143|            }
 2765|  1.75k|        }
 2766|  1.75k|        if (nRet < 0)
  ------------------
  |  Branch (2766:13): [True: 0, False: 1.75k]
  ------------------
 2767|      0|        {
 2768|      0|            inchi_ios_eprint( log_file, "Final structure conversion failed\n" );
 2769|      0|        }
 2770|  1.75k|    }
 2771|  6.28k|    outStruct->szLog = log_file->s.pStr;
 2772|       |
 2773|  6.37k|exit_function:;
 2774|       |
 2775|  31.8k|    for (i = 0; i < MAX_NUM_PATHS; i++)
  ------------------
  |  |   58|  31.8k|#define MAX_NUM_PATHS 4
  ------------------
  |  Branch (2775:17): [True: 25.4k, False: 6.37k]
  ------------------
 2776|  25.4k|    {
 2777|  25.4k|        if (ip->path[i])
  ------------------
  |  Branch (2777:13): [True: 0, False: 25.4k]
  ------------------
 2778|      0|        {
 2779|      0|            inchi_free( (char*) ip->path[i] ); /*  cast deliberately discards 'const' qualifier */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2780|      0|            ip->path[i] = NULL;
 2781|      0|        }
 2782|  25.4k|    }
 2783|       |
 2784|  6.37k|    SetBitFree( &CG );
 2785|       |
 2786|       |#if ( defined(REPEAT_ALL) && REPEAT_ALL > 0 )
 2787|       |    if (num_repeat-- > 0)
 2788|       |    {
 2789|       |        goto repeat;
 2790|       |    }
 2791|       |#endif
 2792|       |
 2793|  6.37k|#ifdef TARGET_API_LIB
 2794|       |    /* output */
 2795|  6.37k|    if (log_file->s.pStr && log_file->s.nUsedLength > 0)
  ------------------
  |  Branch (2795:9): [True: 6.28k, False: 89]
  |  Branch (2795:29): [True: 6.28k, False: 0]
  ------------------
 2796|  6.28k|    {
 2797|  12.8k|        while (log_file->s.nUsedLength &&
  ------------------
  |  Branch (2797:16): [True: 12.8k, False: 0]
  ------------------
 2798|  12.8k|                '\n' == log_file->s.pStr[log_file->s.nUsedLength - 1])
  ------------------
  |  Branch (2798:17): [True: 6.56k, False: 6.28k]
  ------------------
 2799|  6.56k|        {
 2800|  6.56k|            log_file->s.pStr[--log_file->s.nUsedLength] = '\0'; /* remove last LF */
 2801|  6.56k|        }
 2802|  6.28k|        if (outStruct)
  ------------------
  |  Branch (2802:13): [True: 6.28k, False: 0]
  ------------------
 2803|  6.28k|        {
 2804|  6.28k|            outStruct->szLog = log_file->s.pStr;
 2805|  6.28k|            log_file->s.pStr = NULL;
 2806|  6.28k|        }
 2807|  6.28k|    }
 2808|  6.37k|#endif
 2809|       |
 2810|  6.37k|translate_RetVal:
 2811|       |
 2812|       |    /* Close internal I/O streams */
 2813|       |    /* that was incorrect also
 2814|       |    inchi_ios_reset(input_file);  */    /* do not close input_file - its string buffer may point to inpInChI->szInChI */
 2815|  6.37k|    inchi_ios_close( input_file );
 2816|  6.37k|    inchi_ios_close( out_file );
 2817|  6.37k|    inchi_ios_close( log_file );
 2818|       |
 2819|  6.37k|    switch (nRet)
 2820|  6.37k|    {
 2821|  3.44k|        case -3: nRet = inchi_Ret_ERROR; break; /* Error: no Structure has been created */
  ------------------
  |  Branch (2821:9): [True: 3.44k, False: 2.92k]
  ------------------
 2822|  1.01k|        case -2: nRet = inchi_Ret_ERROR; break; /* Error: no Structure has been created */
  ------------------
  |  Branch (2822:9): [True: 1.01k, False: 5.36k]
  ------------------
 2823|      0|        case -1: nRet = inchi_Ret_FATAL; break; /* Severe error: no Structure has been created (typically; break; memory allocation failed) */
  ------------------
  |  Branch (2823:9): [True: 0, False: 6.37k]
  ------------------
 2824|  1.91k|        default:
  ------------------
  |  Branch (2824:9): [True: 1.91k, False: 4.45k]
  ------------------
 2825|  1.91k|            if (outStruct) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (2825:17): [True: 1.91k, False: 0]
  ------------------
 2826|  1.91k|            {
 2827|  1.91k|                if (!outStruct->atom || !outStruct->num_atoms)
  ------------------
  |  Branch (2827:21): [True: 162, False: 1.75k]
  |  Branch (2827:41): [True: 0, False: 1.75k]
  ------------------
 2828|    162|                {
 2829|    162|                    nRet = inchi_Ret_EOF;
 2830|    162|                }
 2831|  1.75k|                else
 2832|  1.75k|                {
 2833|  1.75k|                    int m, n, t = 0;
 2834|  5.26k|                    for (m = 0; m < 2; m++)
  ------------------
  |  Branch (2834:33): [True: 3.50k, False: 1.75k]
  ------------------
 2835|  3.50k|                    {
 2836|  10.5k|                        for (n = 0; n < 2; n++)
  ------------------
  |  Branch (2836:37): [True: 7.01k, False: 3.50k]
  ------------------
 2837|  7.01k|                        {
 2838|  7.01k|                            if (outStruct->WarningFlags[m][n])
  ------------------
  |  Branch (2838:33): [True: 1.54k, False: 5.47k]
  ------------------
 2839|  1.54k|                            {
 2840|  1.54k|                                t++;
 2841|  1.54k|                            }
 2842|  7.01k|                        }
 2843|  3.50k|                    }
 2844|  1.75k|                    nRet = t ? inchi_Ret_WARNING : inchi_Ret_OKAY;
  ------------------
  |  Branch (2844:28): [True: 1.47k, False: 279]
  ------------------
 2845|  1.75k|                }
 2846|  1.91k|                break;
 2847|  1.91k|            }
 2848|  6.37k|    }
 2849|       |
 2850|  6.37k|    return nRet;
 2851|  6.37k|}
GetStructFromINCHI:
 2862|  6.37k|{
 2863|  6.37k|    int ret = 0;
 2864|       |
 2865|  6.37k|    inchi_OutputStructEx outex;
 2866|  6.37k|    memset( out, 0, sizeof( *out ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2867|       |
 2868|  6.37k|    ret = GetStructFromINCHIEx( inpInChI, &outex );
 2869|       |
 2870|  6.37k|    out->szLog = outex.szLog;
 2871|  6.37k|    out->szMessage = outex.szMessage;
 2872|  6.37k|    out->WarningFlags[0][0] = outex.WarningFlags[0][0];
 2873|  6.37k|    out->WarningFlags[0][1] = outex.WarningFlags[0][1];
 2874|  6.37k|    out->WarningFlags[1][0] = outex.WarningFlags[1][0];
 2875|  6.37k|    out->WarningFlags[1][1] = outex.WarningFlags[1][1];
 2876|       |
 2877|  6.37k|    if (ret == inchi_Ret_OKAY || ret == inchi_Ret_WARNING)
  ------------------
  |  Branch (2877:9): [True: 279, False: 6.09k]
  |  Branch (2877:34): [True: 1.47k, False: 4.61k]
  ------------------
 2878|  1.75k|    {
 2879|  1.75k|        out->num_atoms = outex.num_atoms;
 2880|  1.75k|        out->atom = outex.atom;
 2881|  1.75k|        out->num_stereo0D = outex.num_stereo0D;
 2882|  1.75k|        out->stereo0D = outex.stereo0D;
 2883|  1.75k|    }
 2884|       |
 2885|  6.37k|    return ret;
 2886|  6.37k|}
SetInChIExtInputByExtOrigAtData:
 3267|    143|{
 3268|    143|    int    k, m, err = 0;
 3269|       |
 3270|       |        /* Polymers */
 3271|    143|    if (orp && orp->n > 0)
  ------------------
  |  Branch (3271:9): [True: 143, False: 0]
  |  Branch (3271:16): [True: 143, False: 0]
  ------------------
 3272|    143|    {
 3273|       |        /* djb-rwth: fixing oss-fuzz issue #67695, #66748 */
 3274|    143|        inchi_Input_Polymer* iip_tmp = (inchi_Input_Polymer*) inchi_calloc( 1, sizeof( inchi_Input_Polymer ) );
  ------------------
  |  | 1146|    143|#define inchi_calloc   calloc
  ------------------
 3275|    143|        inchi_Input_PolymerUnit** units_tmp = (inchi_Input_PolymerUnit**) inchi_calloc( orp->n, sizeof( ( *iip )->units[0] ) );
  ------------------
  |  | 1146|    143|#define inchi_calloc   calloc
  ------------------
 3276|    143|        int** uk_al_tmp = (int**)inchi_malloc((orp->n) * sizeof(int*));
  ------------------
  |  | 1143|    143|#define inchi_malloc   malloc
  ------------------
 3277|    143|        inchi_Input_PolymerUnit** unitk = (inchi_Input_PolymerUnit**)inchi_malloc((orp->n) * sizeof(inchi_Input_PolymerUnit*));
  ------------------
  |  | 1143|    143|#define inchi_malloc   malloc
  ------------------
 3278|       |
 3279|    143|        if (!iip_tmp || !units_tmp || !uk_al_tmp || !unitk)
  ------------------
  |  Branch (3279:13): [True: 0, False: 143]
  |  Branch (3279:25): [True: 0, False: 143]
  |  Branch (3279:39): [True: 0, False: 143]
  |  Branch (3279:53): [True: 0, False: 143]
  ------------------
 3280|      0|        {
 3281|      0|            err = 9001;
 3282|      0|            goto preexitf;
 3283|      0|        }
 3284|       |        /* *iip = iip_tmp; */
 3285|    143|        iip_tmp->n = orp->n;
 3286|    143|        iip_tmp->units = units_tmp;
 3287|    143|        memset(units_tmp, 0, sizeof( *units_tmp) ); /* djb-rwth: memset_s C11/Annex K variant? */
 3288|    598|        for (k = 0; k < orp->n; k++)
  ------------------
  |  Branch (3288:21): [True: 455, False: 143]
  ------------------
 3289|    455|        {
 3290|    455|            int q = 0;
 3291|    455|            unitk[k] = (inchi_Input_PolymerUnit*)inchi_calloc(1, sizeof(inchi_Input_PolymerUnit));
  ------------------
  |  | 1146|    455|#define inchi_calloc   calloc
  ------------------
 3292|    455|            OAD_PolymerUnit    *groupk = orp->units[k];
 3293|       |            /* unitk = ( *iip )->units[k]; */
 3294|    455|            if (!unitk[k])
  ------------------
  |  Branch (3294:17): [True: 0, False: 455]
  ------------------
 3295|      0|            {
 3296|      0|                err = 9001;
 3297|      0|                goto preexitf;
 3298|      0|            }
 3299|    455|            iip_tmp->units[k] = unitk[k];
 3300|    455|            memset( unitk[k], 0, sizeof(*unitk[k])); /* djb-rwth: memset_s C11/Annex K variant? */
 3301|    455|            unitk[k]->id = groupk->id;
 3302|    455|            unitk[k]->type = groupk->type;
 3303|    455|            unitk[k]->subtype = groupk->subtype;
 3304|    455|            unitk[k]->conn = groupk->conn;
 3305|    455|            unitk[k]->label = groupk->label;
 3306|  2.27k|            for (q = 0; q < 4; q++)
  ------------------
  |  Branch (3306:25): [True: 1.82k, False: 455]
  ------------------
 3307|  1.82k|            {
 3308|  1.82k|                unitk[k]->xbr1[q] = groupk->xbr1[q];
 3309|  1.82k|                unitk[k]->xbr2[q] = groupk->xbr2[q];
 3310|  1.82k|            }
 3311|    455|            strcpy( unitk[k]->smt, groupk->smt);
 3312|    455|            unitk[k]->na = groupk->na;
 3313|    455|            uk_al_tmp[k] = (int*)inchi_calloc(unitk[k]->na, sizeof(int));
  ------------------
  |  | 1146|    455|#define inchi_calloc   calloc
  ------------------
 3314|    455|            if (!uk_al_tmp[k])
  ------------------
  |  Branch (3314:17): [True: 0, False: 455]
  ------------------
 3315|      0|            {
 3316|      0|                err = 9001;
 3317|      0|                goto preexitf;
 3318|      0|            }
 3319|    455|            unitk[k]->alist = uk_al_tmp[k];
 3320|  1.94k|            for (m = 0; m < unitk[k]->na; m++)
  ------------------
  |  Branch (3320:25): [True: 1.48k, False: 455]
  ------------------
 3321|  1.48k|            {
 3322|  1.48k|                uk_al_tmp[k][m] = groupk->alist[m];
 3323|  1.48k|            }
 3324|    455|            unitk[k]->nb = groupk->nb;
 3325|    455|            if (unitk[k]->nb > 0)
  ------------------
  |  Branch (3325:17): [True: 104, False: 351]
  ------------------
 3326|    104|            {
 3327|    104|                unitk[k]->blist = (int*)inchi_calloc(2 * (long long)unitk[k]->nb, sizeof(int)); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|    104|#define inchi_calloc   calloc
  ------------------
 3328|    104|                if (!unitk[k]->blist)
  ------------------
  |  Branch (3328:21): [True: 0, False: 104]
  ------------------
 3329|      0|                {
 3330|      0|                    err = 9001;
 3331|      0|                    goto preexitf;
 3332|      0|                }
 3333|    520|                for (m = 0; m < 2 * groupk->nb; m++)
  ------------------
  |  Branch (3333:29): [True: 416, False: 104]
  ------------------
 3334|    416|                {
 3335|    416|                    unitk[k]->blist[m] = groupk->blist[m];
 3336|    416|                }
 3337|    104|            }
 3338|    351|            else
 3339|    351|            {
 3340|    351|                unitk[k]->blist = NULL;
 3341|    351|            }
 3342|       |
 3343|    455|            inchi_free(unitk[k]);
  ------------------
  |  | 1152|    455|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 455, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 455]
  |  |  ------------------
  ------------------
 3344|    455|            inchi_free(uk_al_tmp[k]);
  ------------------
  |  | 1152|    455|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 455, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 455]
  |  |  ------------------
  ------------------
 3345|    455|        }
 3346|       |    /* djb-rwth: avoiding memory leak */
 3347|    143|    preexitf:
 3348|       |        /* djb-rwth: fixing GHI #165 */
 3349|    143|        if (iip_tmp && *iip) /* djb-rwth: fixing oss-fuzz issue #455987437 */
  ------------------
  |  Branch (3349:13): [True: 143, False: 0]
  |  Branch (3349:24): [True: 0, False: 143]
  ------------------
 3350|      0|        {
 3351|      0|            memcpy(*iip, iip_tmp, sizeof(inchi_Input_Polymer));
 3352|      0|        }
 3353|    143|        inchi_free(iip_tmp);
  ------------------
  |  | 1152|    143|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 143, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 143]
  |  |  ------------------
  ------------------
 3354|    143|        inchi_free(units_tmp);
  ------------------
  |  | 1152|    143|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 143, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 143]
  |  |  ------------------
  ------------------
 3355|    143|        inchi_free(uk_al_tmp);
  ------------------
  |  | 1152|    143|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 143, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 143]
  |  |  ------------------
  ------------------
 3356|    143|        inchi_free(unitk);
  ------------------
  |  | 1152|    143|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 143, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 143]
  |  |  ------------------
  ------------------
 3357|    143|        if (err)
  ------------------
  |  Branch (3357:13): [True: 0, False: 143]
  ------------------
 3358|      0|        {
 3359|      0|            goto exitf;
 3360|      0|        }
 3361|    143|    }
 3362|       |
 3363|    143|    if (orv)
  ------------------
  |  Branch (3363:9): [True: 0, False: 143]
  ------------------
 3364|      0|    {
 3365|      0|        int nn;
 3366|      0|        *iiv = (inchi_Input_V3000 *) inchi_calloc( 1, sizeof(inchi_Input_V3000) ); /* djb-rwth: fixing the incorrect type of variable */
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 3367|      0|        if (!*iiv)
  ------------------
  |  Branch (3367:13): [True: 0, False: 0]
  ------------------
 3368|      0|        {
 3369|      0|            err = 9001;
 3370|      0|            goto exitf;
 3371|      0|        }
 3372|      0|        memset( *iiv, 0, sizeof( **iiv ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 3373|       |
 3374|      0|        ( *iiv )->n_collections = orv->n_collections;
 3375|      0|        ( *iiv )->n_haptic_bonds = orv->n_haptic_bonds;
 3376|      0|        ( *iiv )->n_non_haptic_bonds = orv->n_non_haptic_bonds;
 3377|      0|        ( *iiv )->n_sgroups = orv->n_sgroups;
 3378|      0|        ( *iiv )->n_non_star_atoms = orv->n_non_star_atoms;
 3379|      0|        ( *iiv )->n_star_atoms = orv->n_star_atoms;
 3380|      0|        ( *iiv )->n_steabs = orv->n_steabs;
 3381|      0|        ( *iiv )->n_sterac = orv->n_sterac;
 3382|      0|        ( *iiv )->n_sterel = orv->n_sterel;
 3383|      0|        ( *iiv )->n_3d_constraints = orv->n_3d_constraints;
 3384|       |
 3385|      0|        if (orv->atom_index_orig)
  ------------------
  |  Branch (3385:13): [True: 0, False: 0]
  ------------------
 3386|      0|        {
 3387|      0|            ( *iiv )->atom_index_orig = (int *) inchi_calloc( nat, sizeof( int ) );
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 3388|      0|            if (NULL == ( *iiv )->atom_index_orig)
  ------------------
  |  Branch (3388:17): [True: 0, False: 0]
  ------------------
 3389|      0|            {
 3390|      0|                err = 9001;
 3391|      0|                goto exitf;
 3392|      0|            }
 3393|      0|            memcpy( ( *iiv )->atom_index_orig, orv->atom_index_orig, nat );
 3394|      0|        }
 3395|      0|        if (orv->atom_index_fin)
  ------------------
  |  Branch (3395:13): [True: 0, False: 0]
  ------------------
 3396|      0|        {
 3397|      0|            ( *iiv )->atom_index_fin = (int *) inchi_calloc( nat, sizeof( int ) );
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 3398|      0|            if (NULL == ( *iiv )->atom_index_fin)
  ------------------
  |  Branch (3398:17): [True: 0, False: 0]
  ------------------
 3399|      0|            {
 3400|      0|                err = 9001;
 3401|      0|                goto exitf;
 3402|      0|            }
 3403|      0|            memcpy( ( *iiv )->atom_index_fin, orv->atom_index_fin, nat );
 3404|      0|        }
 3405|      0|        if (orv->n_haptic_bonds && orv->lists_haptic_bonds)
  ------------------
  |  Branch (3405:13): [True: 0, False: 0]
  |  Branch (3405:36): [True: 0, False: 0]
  ------------------
 3406|      0|        {
 3407|      0|            ( *iiv )->lists_haptic_bonds = (int **) inchi_calloc( orv->n_haptic_bonds, sizeof( int* ) );
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 3408|      0|            if (NULL == ( *iiv )->lists_haptic_bonds)
  ------------------
  |  Branch (3408:17): [True: 0, False: 0]
  ------------------
 3409|      0|            {
 3410|      0|                err = 9001;
 3411|      0|                goto exitf;
 3412|      0|            }
 3413|      0|            for (m = 0; m < orv->n_haptic_bonds; m++)
  ------------------
  |  Branch (3413:25): [True: 0, False: 0]
  ------------------
 3414|      0|            {
 3415|      0|                int *lst = NULL;
 3416|      0|                int *mol_lst = orv->lists_haptic_bonds[m];
 3417|      0|                nn = mol_lst[2] + 3;
 3418|      0|                lst = ( *iiv )->lists_haptic_bonds[m] = (int *) inchi_calloc( nn, sizeof( int ) );
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 3419|      0|                if (NULL == lst)
  ------------------
  |  Branch (3419:21): [True: 0, False: 0]
  ------------------
 3420|      0|                {
 3421|      0|                    err = 9001;
 3422|      0|                    goto exitf;
 3423|      0|                }
 3424|      0|                for (k = 0; k < nn; k++)
  ------------------
  |  Branch (3424:29): [True: 0, False: 0]
  ------------------
 3425|      0|                {
 3426|      0|                    lst[k] = mol_lst[k];
 3427|      0|                }
 3428|      0|            }
 3429|      0|        }
 3430|      0|        if (orv->n_steabs && orv->lists_steabs)
  ------------------
  |  Branch (3430:13): [True: 0, False: 0]
  |  Branch (3430:30): [True: 0, False: 0]
  ------------------
 3431|      0|        {
 3432|      0|            ( *iiv )->lists_steabs = (int **) inchi_calloc( orv->n_steabs, sizeof( int* ) );
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 3433|      0|            if (NULL == ( *iiv )->lists_steabs) { err = 9001; goto exitf; }
  ------------------
  |  Branch (3433:17): [True: 0, False: 0]
  ------------------
 3434|      0|            for (m = 0; m < orv->n_steabs; m++)
  ------------------
  |  Branch (3434:25): [True: 0, False: 0]
  ------------------
 3435|      0|            {
 3436|      0|                int *lst = NULL;
 3437|      0|                int *mol_lst = orv->lists_steabs[m];
 3438|      0|                nn = mol_lst[1] + 2;
 3439|      0|                lst = ( *iiv )->lists_steabs[m] = (int *) inchi_calloc( nn, sizeof( int ) );
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 3440|      0|                if (NULL == lst)
  ------------------
  |  Branch (3440:21): [True: 0, False: 0]
  ------------------
 3441|      0|                {
 3442|      0|                    err = 9001;
 3443|      0|                    goto exitf;
 3444|      0|                }
 3445|      0|                for (k = 0; k < nn; k++)
  ------------------
  |  Branch (3445:29): [True: 0, False: 0]
  ------------------
 3446|      0|                {
 3447|      0|                    lst[k] = mol_lst[k];
 3448|      0|                }
 3449|      0|            }
 3450|      0|        }
 3451|      0|        if (orv->n_sterac && orv->lists_sterac)
  ------------------
  |  Branch (3451:13): [True: 0, False: 0]
  |  Branch (3451:30): [True: 0, False: 0]
  ------------------
 3452|      0|        {
 3453|      0|            ( *iiv )->lists_sterac = (int **) inchi_calloc( orv->n_sterac, sizeof( int* ) );
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 3454|      0|            if (NULL == ( *iiv )->lists_sterac) { err = 9001; goto exitf; }
  ------------------
  |  Branch (3454:17): [True: 0, False: 0]
  ------------------
 3455|      0|            for (m = 0; m < orv->n_sterac; m++)
  ------------------
  |  Branch (3455:25): [True: 0, False: 0]
  ------------------
 3456|      0|            {
 3457|      0|                int *lst = NULL;
 3458|      0|                int *mol_lst = orv->lists_sterac[m];
 3459|      0|                nn = mol_lst[1] + 2;
 3460|      0|                lst = ( *iiv )->lists_sterac[m] = (int *) inchi_calloc( nn, sizeof( int ) );
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 3461|      0|                if (NULL == lst)
  ------------------
  |  Branch (3461:21): [True: 0, False: 0]
  ------------------
 3462|      0|                {
 3463|      0|                    err = 9001;
 3464|      0|                    goto exitf;
 3465|      0|                }
 3466|      0|                for (k = 0; k < nn; k++)
  ------------------
  |  Branch (3466:29): [True: 0, False: 0]
  ------------------
 3467|      0|                {
 3468|      0|                    lst[k] = mol_lst[k];
 3469|      0|                }
 3470|      0|            }
 3471|      0|        }
 3472|      0|        if (orv->n_sterel && orv->lists_sterel)
  ------------------
  |  Branch (3472:13): [True: 0, False: 0]
  |  Branch (3472:30): [True: 0, False: 0]
  ------------------
 3473|      0|        {
 3474|      0|            ( *iiv )->lists_sterel = (int **) inchi_calloc( orv->n_sterel, sizeof( int* ) );
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 3475|      0|            if (NULL == ( *iiv )->lists_sterel) { err = 9001; goto exitf; }
  ------------------
  |  Branch (3475:17): [True: 0, False: 0]
  ------------------
 3476|      0|            for (m = 0; m < orv->n_sterel; m++)
  ------------------
  |  Branch (3476:25): [True: 0, False: 0]
  ------------------
 3477|      0|            {
 3478|      0|                int *lst = NULL;
 3479|      0|                int *mol_lst = orv->lists_sterel[m];
 3480|      0|                nn = mol_lst[1] + 2;
 3481|      0|                lst = ( *iiv )->lists_sterel[m] = (int *) inchi_calloc( nn, sizeof( int ) );
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 3482|      0|                if (NULL == lst)
  ------------------
  |  Branch (3482:21): [True: 0, False: 0]
  ------------------
 3483|      0|                {
 3484|      0|                    err = 9001;
 3485|      0|                    goto exitf;
 3486|      0|                }
 3487|      0|                for (k = 0; k < nn; k++)
  ------------------
  |  Branch (3487:29): [True: 0, False: 0]
  ------------------
 3488|      0|                {
 3489|      0|                    lst[k] = mol_lst[k];
 3490|      0|                }
 3491|      0|            }
 3492|      0|        }
 3493|      0|    }
 3494|       |
 3495|    143|exitf:
 3496|    143|    if (err)
  ------------------
  |  Branch (3496:9): [True: 0, False: 143]
  ------------------
 3497|      0|    {
 3498|      0|        FreeInChIExtInput( *iip, *iiv );
 3499|      0|    }
 3500|       |
 3501|    143|    return err;
 3502|    143|}

CreateCompositeNormAtom:
 1943|    811|{
 1944|    811|    int i, j, jj, k, n, m, tot_num_at, tot_num_H, cur_num_at, cur_num_H; /* djb-rwth: removing redundant variables */
 1945|    811|    int num_comp[TAUT_NUM + 1], num_taut[TAUT_NUM + 1], num_del[TAUT_NUM + 1], num_at[TAUT_NUM + 1], num_inp_at[TAUT_NUM + 1];
 1946|    811|    int ret = 0, indicator = 1;
 1947|    811|    inp_ATOM *at, *at_from;
 1948|    811|    memset( num_comp, 0, sizeof( num_comp ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 1949|    811|    memset( num_taut, 0, sizeof( num_taut ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 1950|    811|    memset( num_del, 0, sizeof( num_taut ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 1951|       |    /* count taut and non-taut components */
 1952|  2.43k|    for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  573|  2.43k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1952:17): [True: 1.62k, False: 811]
  ------------------
 1953|  1.62k|    {
 1954|  1.62k|        num_comp[j] = num_taut[j] = 0;
 1955|  74.5k|        for (i = 0; i < num_components; i++)
  ------------------
  |  Branch (1955:21): [True: 72.8k, False: 1.62k]
  ------------------
 1956|  72.8k|        {
 1957|  72.8k|            if (all_inp_norm_data[i][j].bExists)
  ------------------
  |  Branch (1957:17): [True: 71.4k, False: 1.40k]
  ------------------
 1958|  71.4k|            {
 1959|  71.4k|                num_del[j] += ( 0 != all_inp_norm_data[i][j].bDeleted );
 1960|  71.4k|                num_comp[j] ++;
 1961|  71.4k|                num_taut[j] += ( 0 != all_inp_norm_data[i][j].bTautomeric );
 1962|  71.4k|            }
 1963|  72.8k|        }
 1964|  1.62k|    }
 1965|       |
 1966|       |    /* count intermediate taut structure components */
 1967|    811|    if (num_comp[TAUT_YES] > num_del[TAUT_YES] && num_taut[TAUT_YES])
  ------------------
  |  |  575|    811|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  if (num_comp[TAUT_YES] > num_del[TAUT_YES] && num_taut[TAUT_YES])
  ------------------
  |  |  575|    811|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  if (num_comp[TAUT_YES] > num_del[TAUT_YES] && num_taut[TAUT_YES])
  ------------------
  |  |  575|    706|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1967:9): [True: 706, False: 105]
  |  Branch (1967:51): [True: 69, False: 637]
  ------------------
 1968|     69|    {
 1969|       |        /*
 1970|       |        num_comp[TAUT_INI] = num_comp[TAUT_YES] - num_del[TAUT_YES];
 1971|       |        */
 1972|       |
 1973|    207|        for (i = 0, j = TAUT_YES; i < num_components; i++)
  ------------------
  |  |  575|     69|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1973:35): [True: 138, False: 69]
  ------------------
 1974|    138|        {
 1975|    138|            if (all_inp_norm_data[i][j].bExists &&
  ------------------
  |  Branch (1975:17): [True: 138, False: 0]
  ------------------
 1976|    138|                ( all_inp_norm_data[i][j].bDeleted ||
  ------------------
  |  Branch (1976:19): [True: 0, False: 138]
  ------------------
 1977|    138|                    (all_inp_norm_data[i][j].bTautomeric &&
  ------------------
  |  Branch (1977:22): [True: 69, False: 69]
  ------------------
 1978|     69|                    all_inp_norm_data[i][j].at_fixed_bonds &&
  ------------------
  |  Branch (1978:21): [True: 69, False: 0]
  ------------------
 1979|     69|                    all_inp_norm_data[i][j].bTautPreprocessed) )) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (1979:21): [True: 47, False: 22]
  ------------------
 1980|     47|            {
 1981|     47|                num_comp[TAUT_INI] ++;
  ------------------
  |  |  576|     47|#define TAUT_INI            2    /* 2 => intermediate tautomeric structure */
  ------------------
 1982|     47|            }
 1983|    138|        }
 1984|     69|    }
 1985|       |
 1986|       |    /* count atoms and allocate composite atom data */
 1987|  3.24k|    for (jj = 0; jj <= TAUT_INI; jj++)
  ------------------
  |  |  576|  3.24k|#define TAUT_INI            2    /* 2 => intermediate tautomeric structure */
  ------------------
  |  Branch (1987:18): [True: 2.43k, False: 811]
  ------------------
 1988|  2.43k|    {
 1989|  2.43k|        num_at[jj] = num_inp_at[jj] = 0;
 1990|  2.43k|        j = inchi_min( jj, TAUT_YES );
  ------------------
  |  |  139|  2.43k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 811, False: 1.62k]
  |  |  ------------------
  ------------------
 1991|  2.43k|        if (num_comp[jj])
  ------------------
  |  Branch (1991:13): [True: 972, False: 1.46k]
  ------------------
 1992|    972|        {
 1993|  72.5k|            for (i = 0; i < num_components; i++)
  ------------------
  |  Branch (1993:25): [True: 71.5k, False: 972]
  ------------------
 1994|  71.5k|            {
 1995|  71.5k|                if (all_inp_norm_data[i][j].bDeleted)
  ------------------
  |  Branch (1995:21): [True: 35.0k, False: 36.5k]
  ------------------
 1996|  35.0k|                {
 1997|  35.0k|                    continue;
 1998|  35.0k|                }
 1999|       |                /* find k = the normaized structure index */
 2000|  36.5k|                if (jj == TAUT_INI)
  ------------------
  |  |  576|  36.5k|#define TAUT_INI            2    /* 2 => intermediate tautomeric structure */
  ------------------
  |  Branch (2000:21): [True: 94, False: 36.4k]
  ------------------
 2001|     94|                {
 2002|     94|                    if (all_inp_norm_data[i][j].bExists &&
  ------------------
  |  Branch (2002:25): [True: 94, False: 0]
  ------------------
 2003|     94|                         all_inp_norm_data[i][j].at_fixed_bonds)
  ------------------
  |  Branch (2003:26): [True: 94, False: 0]
  ------------------
 2004|     94|                    {
 2005|     94|                        k = j;
 2006|     94|                    }
 2007|      0|                    else
 2008|      0|                    {
 2009|      0|                        if (all_inp_norm_data[i][ALT_TAUT( j )].bExists && !all_inp_norm_data[i][ALT_TAUT( j )].bDeleted &&
  ------------------
  |  |  577|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                      if (all_inp_norm_data[i][ALT_TAUT( j )].bExists && !all_inp_norm_data[i][ALT_TAUT( j )].bDeleted &&
  ------------------
  |  |  577|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2009:29): [True: 0, False: 0]
  |  Branch (2009:76): [True: 0, False: 0]
  ------------------
 2010|      0|                                !all_inp_norm_data[i][j].bDeleted)
  ------------------
  |  Branch (2010:33): [True: 0, False: 0]
  ------------------
 2011|      0|                        {
 2012|      0|                            k = ALT_TAUT( j );
  ------------------
  |  |  577|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2013|      0|                        }
 2014|      0|                        else
 2015|      0|                        {
 2016|      0|                            if (all_inp_norm_data[i][j].bExists)
  ------------------
  |  Branch (2016:33): [True: 0, False: 0]
  ------------------
 2017|      0|                            {
 2018|      0|                                k = j;
 2019|      0|                            }
 2020|      0|                            else
 2021|      0|                            {
 2022|      0|                                continue;
 2023|      0|                            }
 2024|      0|                        }
 2025|      0|                    }
 2026|     94|                }
 2027|  36.4k|                else
 2028|  36.4k|                {
 2029|  36.4k|                    if (all_inp_norm_data[i][j].bExists)
  ------------------
  |  Branch (2029:25): [True: 36.4k, False: 9]
  ------------------
 2030|  36.4k|                    {
 2031|  36.4k|                        k = j;
 2032|  36.4k|                    }
 2033|      9|                    else
 2034|      9|                    {
 2035|      9|                        if (all_inp_norm_data[i][ALT_TAUT( j )].bExists && !all_inp_norm_data[i][ALT_TAUT( j )].bDeleted)
  ------------------
  |  |  577|      9|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      9|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 9]
  |  |  ------------------
  ------------------
                                      if (all_inp_norm_data[i][ALT_TAUT( j )].bExists && !all_inp_norm_data[i][ALT_TAUT( j )].bDeleted)
  ------------------
  |  |  577|      9|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      9|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 9]
  |  |  ------------------
  ------------------
  |  Branch (2035:29): [True: 9, False: 0]
  |  Branch (2035:76): [True: 9, False: 0]
  ------------------
 2036|      9|                        {
 2037|      9|                            k = ALT_TAUT( j );
  ------------------
  |  |  577|      9|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      9|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 9]
  |  |  ------------------
  ------------------
 2038|      9|                        }
 2039|      0|                        else
 2040|      0|                        {
 2041|      0|                            continue;
 2042|      0|                        }
 2043|      9|                    }
 2044|  36.4k|                }
 2045|  36.5k|                num_inp_at[jj] += all_inp_norm_data[i][k].num_at; /* all atoms including terminal H */
 2046|  36.5k|                num_at[jj] += all_inp_norm_data[i][k].num_at - all_inp_norm_data[i][k].num_removed_H;
 2047|  36.5k|            }
 2048|    972|            if (num_inp_at[jj])
  ------------------
  |  Branch (2048:17): [True: 867, False: 105]
  ------------------
 2049|    867|            {
 2050|    867|                if (!CreateCompAtomData( composite_norm_data + jj, num_inp_at[jj], num_components, jj == TAUT_INI ))
  ------------------
  |  |  576|    867|#define TAUT_INI            2    /* 2 => intermediate tautomeric structure */
  ------------------
  |  Branch (2050:21): [True: 0, False: 867]
  ------------------
 2051|      0|                    goto exit_error;
 2052|    867|                composite_norm_data[jj].num_removed_H = num_inp_at[jj] - num_at[jj];
 2053|    867|            }
 2054|    972|        }
 2055|  2.43k|    }
 2056|       |
 2057|       |    /* fill out composite atom */
 2058|  3.24k|    for (jj = 0; jj <= TAUT_INI; jj++, indicator <<= 1)
  ------------------
  |  |  576|  3.24k|#define TAUT_INI            2    /* 2 => intermediate tautomeric structure */
  ------------------
  |  Branch (2058:18): [True: 2.43k, False: 811]
  ------------------
 2059|  2.43k|    {
 2060|  2.43k|        j = inchi_min( jj, TAUT_YES );
  ------------------
  |  |  139|  2.43k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 811, False: 1.62k]
  |  |  ------------------
  ------------------
 2061|  2.43k|        if (num_comp[jj])
  ------------------
  |  Branch (2061:13): [True: 972, False: 1.46k]
  ------------------
 2062|    972|        {
 2063|    972|            tot_num_at = 0;
 2064|    972|            tot_num_H = 0;
 2065|  72.5k|            for (i = 0; i < num_components; i++)
  ------------------
  |  Branch (2065:25): [True: 71.5k, False: 972]
  ------------------
 2066|  71.5k|            {
 2067|  71.5k|                if (all_inp_norm_data[i][j].bDeleted)
  ------------------
  |  Branch (2067:21): [True: 35.0k, False: 36.5k]
  ------------------
 2068|  35.0k|                {
 2069|  35.0k|                    composite_norm_data[jj].nNumRemovedProtons += all_inp_norm_data[i][j].nNumRemovedProtons;
 2070|   140k|                    for (n = 0; n < NUM_H_ISOTOPES; n++)
  ------------------
  |  |   72|   140k|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (2070:33): [True: 105k, False: 35.0k]
  ------------------
 2071|   105k|                    {
 2072|   105k|                        composite_norm_data[jj].nNumRemovedProtonsIsotopic[n] += all_inp_norm_data[i][j].nNumRemovedProtonsIsotopic[n];
 2073|   105k|                    }
 2074|  35.0k|                    continue;
 2075|  35.0k|                }
 2076|       |                /* djb-rwth: removing redundant code */
 2077|  36.5k|                k = TAUT_NUM; /* djb-rwth: ignoring LLVM warning: value used */
  ------------------
  |  |  573|  36.5k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
 2078|       |                /* find k = the normaized structure index */
 2079|  36.5k|                if (jj == TAUT_INI)
  ------------------
  |  |  576|  36.5k|#define TAUT_INI            2    /* 2 => intermediate tautomeric structure */
  ------------------
  |  Branch (2079:21): [True: 94, False: 36.4k]
  ------------------
 2080|     94|                {
 2081|     94|                    if (all_inp_norm_data[i][j].bExists && all_inp_norm_data[i][j].at_fixed_bonds)
  ------------------
  |  Branch (2081:25): [True: 94, False: 0]
  |  Branch (2081:60): [True: 94, False: 0]
  ------------------
 2082|     94|                    {
 2083|     94|                        k = j;
 2084|     94|                    }
 2085|      0|                    else
 2086|      0|                    {
 2087|      0|                        if (all_inp_norm_data[i][ALT_TAUT( j )].bExists)
  ------------------
  |  |  577|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2087:29): [True: 0, False: 0]
  ------------------
 2088|      0|                        {
 2089|      0|                            k = ALT_TAUT( j );
  ------------------
  |  |  577|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2090|      0|                        }
 2091|      0|                        else
 2092|      0|                        {
 2093|      0|                            if (all_inp_norm_data[i][j].bExists && !all_inp_norm_data[i][ALT_TAUT( j )].bDeleted)
  ------------------
  |  |  577|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2093:33): [True: 0, False: 0]
  |  Branch (2093:68): [True: 0, False: 0]
  ------------------
 2094|      0|                            {
 2095|      0|                                k = j;
 2096|      0|                            }
 2097|      0|                            else
 2098|      0|                            {
 2099|      0|                                continue;
 2100|      0|                            }
 2101|      0|                        }
 2102|      0|                    }
 2103|     94|                }
 2104|  36.4k|                else
 2105|  36.4k|                {
 2106|  36.4k|                    if (all_inp_norm_data[i][j].bExists)
  ------------------
  |  Branch (2106:25): [True: 36.4k, False: 9]
  ------------------
 2107|  36.4k|                    {
 2108|  36.4k|                        k = j;
 2109|  36.4k|                    }
 2110|      9|                    else
 2111|      9|                    {
 2112|      9|                        if (all_inp_norm_data[i][ALT_TAUT( j )].bExists && !all_inp_norm_data[i][ALT_TAUT( j )].bDeleted)
  ------------------
  |  |  577|      9|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      9|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 9]
  |  |  ------------------
  ------------------
                                      if (all_inp_norm_data[i][ALT_TAUT( j )].bExists && !all_inp_norm_data[i][ALT_TAUT( j )].bDeleted)
  ------------------
  |  |  577|      9|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      9|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 9]
  |  |  ------------------
  ------------------
  |  Branch (2112:29): [True: 9, False: 0]
  |  Branch (2112:76): [True: 9, False: 0]
  ------------------
 2113|      9|                        {
 2114|      9|                            k = ALT_TAUT( j );
  ------------------
  |  |  577|      9|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      9|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 9]
  |  |  ------------------
  ------------------
 2115|      9|                        }
 2116|      0|                        else
 2117|      0|                        {
 2118|      0|                            continue;
 2119|      0|                        }
 2120|      9|                    }
 2121|  36.4k|                }
 2122|       |                /* copy main atoms */
 2123|  36.5k|                cur_num_H = all_inp_norm_data[i][k].num_removed_H;       /* number of terminal H atoms */
 2124|  36.5k|                cur_num_at = all_inp_norm_data[i][k].num_at - cur_num_H;  /* number of all but explicit terminal H atoms */
 2125|       |
 2126|  36.5k|                if (( tot_num_at + cur_num_at ) > num_at[jj] ||
  ------------------
  |  Branch (2126:21): [True: 0, False: 36.5k]
  ------------------
 2127|  36.5k|                    ( num_at[jj] + tot_num_H + cur_num_H ) > num_inp_at[jj])
  ------------------
  |  Branch (2127:21): [True: 0, False: 36.5k]
  ------------------
 2128|      0|                {
 2129|      0|                    goto exit_error; /* miscount */
 2130|      0|                }
 2131|  36.5k|                at = composite_norm_data[jj].at + tot_num_at; /* points to the 1st destination atom */
 2132|  36.5k|                at_from = ( jj == TAUT_INI && k == TAUT_YES && all_inp_norm_data[i][k].at_fixed_bonds ) ?
  ------------------
  |  |  576|  73.1k|#define TAUT_INI            2    /* 2 => intermediate tautomeric structure */
  ------------------
                              at_from = ( jj == TAUT_INI && k == TAUT_YES && all_inp_norm_data[i][k].at_fixed_bonds ) ?
  ------------------
  |  |  575|  36.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2132:29): [True: 94, False: 36.4k]
  |  Branch (2132:47): [True: 94, False: 0]
  |  Branch (2132:64): [True: 94, False: 0]
  ------------------
 2133|  36.4k|                    all_inp_norm_data[i][k].at_fixed_bonds : all_inp_norm_data[i][k].at;
 2134|  36.5k|                memcpy( at, at_from, sizeof( composite_norm_data[0].at[0] ) * cur_num_at ); /* copy atoms except terminal H */
 2135|       |                /* shift neighbors of main atoms */
 2136|  75.6k|                for (n = 0; n < cur_num_at; n++, at++)
  ------------------
  |  Branch (2136:29): [True: 39.1k, False: 36.5k]
  ------------------
 2137|  39.1k|                {
 2138|  44.5k|                    for (m = 0; m < at->valence; m++)
  ------------------
  |  Branch (2138:33): [True: 5.38k, False: 39.1k]
  ------------------
 2139|  5.38k|                    {
 2140|  5.38k|                        at->neighbor[m] += tot_num_at;
 2141|  5.38k|                    }
 2142|  39.1k|                }
 2143|       |                /* copy explicit H */
 2144|  36.5k|                if (cur_num_H)
  ------------------
  |  Branch (2144:21): [True: 282, False: 36.2k]
  ------------------
 2145|    282|                {
 2146|    282|                    at = composite_norm_data[jj].at + num_at[jj] + tot_num_H; /* points to the 1st destination atom */
 2147|    282|                    memcpy( at, at_from + cur_num_at, sizeof( composite_norm_data[0].at[0] ) * cur_num_H );
 2148|       |                    /* shift neighbors of explicit H atoms */
 2149|    597|                    for (n = 0; n < cur_num_H; n++, at++)
  ------------------
  |  Branch (2149:33): [True: 315, False: 282]
  ------------------
 2150|    315|                    {
 2151|    630|                        for (m = 0; m < at->valence; m++)
  ------------------
  |  Branch (2151:37): [True: 315, False: 315]
  ------------------
 2152|    315|                        {
 2153|    315|                            at->neighbor[m] += tot_num_at;
 2154|    315|                        }
 2155|    315|                    }
 2156|    282|                }
 2157|       |                /* composite counts */
 2158|  36.5k|                composite_norm_data[jj].bHasIsotopicLayer |= all_inp_norm_data[i][k].bHasIsotopicLayer;
 2159|  36.5k|                composite_norm_data[jj].num_isotopic += all_inp_norm_data[i][k].num_isotopic;
 2160|  36.5k|                composite_norm_data[jj].num_bonds += all_inp_norm_data[i][k].num_bonds;
 2161|  36.5k|                composite_norm_data[jj].bTautomeric += ( j == jj ) && all_inp_norm_data[i][k].bTautomeric;
  ------------------
  |  Branch (2161:56): [True: 36.4k, False: 94]
  |  Branch (2161:71): [True: 69, False: 36.3k]
  ------------------
 2162|  36.5k|                composite_norm_data[jj].nNumRemovedProtons += all_inp_norm_data[i][k].nNumRemovedProtons;
 2163|   146k|                for (n = 0; n < NUM_H_ISOTOPES; n++)
  ------------------
  |  |   72|   146k|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (2163:29): [True: 109k, False: 36.5k]
  ------------------
 2164|   109k|                {
 2165|   109k|                    composite_norm_data[jj].nNumRemovedProtonsIsotopic[n] += all_inp_norm_data[i][k].nNumRemovedProtonsIsotopic[n];
 2166|   109k|                    composite_norm_data[jj].num_iso_H[n] += all_inp_norm_data[i][k].num_iso_H[n];
 2167|   109k|                }
 2168|       |                /*
 2169|       |                composite_norm_data[j].num_at            += cur_num_at + cur_num_H;
 2170|       |                composite_norm_data[j].num_removed_H     += cur_num_H;
 2171|       |                */
 2172|       |                /* total count */
 2173|  36.5k|                tot_num_at += cur_num_at;
 2174|  36.5k|                tot_num_H += cur_num_H;
 2175|       |                /* offset for the next component */
 2176|  36.5k|                if (composite_norm_data[jj].nOffsetAtAndH)
  ------------------
  |  Branch (2176:21): [True: 36.4k, False: 94]
  ------------------
 2177|  36.4k|                {
 2178|  36.4k|                    composite_norm_data[jj].nOffsetAtAndH[2 * i] = tot_num_at;
 2179|  36.4k|                    composite_norm_data[jj].nOffsetAtAndH[2 * i + 1] = num_at[jj] + tot_num_H;
 2180|  36.4k|                }
 2181|  36.5k|            }
 2182|    972|            if (tot_num_at != num_at[jj] ||
  ------------------
  |  Branch (2182:17): [True: 0, False: 972]
  ------------------
 2183|    972|                 num_at[jj] + tot_num_H != num_inp_at[jj])
  ------------------
  |  Branch (2183:18): [True: 0, False: 972]
  ------------------
 2184|      0|            {
 2185|      0|                goto exit_error; /* miscount */
 2186|      0|            }
 2187|    972|            composite_norm_data[jj].bExists = ( tot_num_at > 0 );
 2188|    972|            ret |= indicator;
 2189|    972|        }
 2190|  2.43k|    }
 2191|    811|    return ret;
 2192|       |
 2193|      0|exit_error:
 2194|      0|    return ret;
 2195|    811|}
CreateCompAtomData:
 2203|    867|{
 2204|    867|    FreeCompAtomData( inp_at_data );
 2205|    867|    if (( inp_at_data->at = CreateInpAtom( num_atoms ) ) &&
  ------------------
  |  Branch (2205:9): [True: 867, False: 0]
  ------------------
 2206|    867|        ( num_components <= 1 || bIntermediateTaut ||
  ------------------
  |  Branch (2206:11): [True: 0, False: 867]
  |  Branch (2206:34): [True: 47, False: 820]
  ------------------
 2207|    820|        ( inp_at_data->nOffsetAtAndH = (AT_NUMB*) inchi_calloc( 2 * ( (long long)num_components + 1 ), sizeof( inp_at_data->nOffsetAtAndH[0] ) ) ) )) /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|    820|#define inchi_calloc   calloc
  ------------------
  |  Branch (2207:9): [True: 820, False: 0]
  ------------------
 2208|    867|    {
 2209|       |
 2210|    867|        inp_at_data->num_at = num_atoms;
 2211|    867|        inp_at_data->num_components = ( num_components > 1 ) ? num_components : 0;
  ------------------
  |  Branch (2211:39): [True: 867, False: 0]
  ------------------
 2212|    867|        return 1;
 2213|    867|    }
 2214|      0|    FreeCompAtomData( inp_at_data );
 2215|       |
 2216|      0|    return 0;
 2217|    867|}

RestoreEdgeFlow:
  408|  65.9k|{
  409|       |    /*flow1 = edge->flow;*/ /* output from BNS */
  410|  65.9k|    switch (bChangeFlow & BNS_EF_CHNG_RSTR)
  ------------------
  |  |  372|  65.9k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  65.9k|#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)
  |  |  ------------------
  |  |  |  |  371|  65.9k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
  |  Branch (410:13): [True: 65.9k, False: 0]
  ------------------
  411|  65.9k|    {
  412|      0|        case 0:
  ------------------
  |  Branch (412:9): [True: 0, False: 65.9k]
  ------------------
  413|       |            /* the flow has not been permitted to change inside the BNS */
  414|       |            /* nothing to do */
  415|       |            /*flow1 = edge->flow;*/    /* output from BNS, the original flow value */
  416|       |                                       /*flow2 = flow1 + delta;*/ /* the flow would be changed to this value by the BNS if permitted */
  417|      0|            break;
  418|  1.27k|        case BNS_EF_CHNG_FLOW:
  ------------------
  |  |  370|  1.27k|#define BNS_EF_CHNG_FLOW      1  /* change Balanced Network (BN) flow inside the BNS search */
  ------------------
  |  Branch (418:9): [True: 1.27k, False: 64.6k]
  ------------------
  419|       |            /* the flow has been changed by the BNS; update flow0 */
  420|       |            /*flow2 = edge->flow;*/    /* output from BNS, the changed value */
  421|       |                                       /*flow1 = flow2 - delta;*/ /* the original flow value before the BNS */
  422|  1.27k|            edge->flow0 = edge->flow;   /* SAVE NEW EDGE FLOW AS THE INITIAL FLOW FROM CHEM. BONDS */
  423|  1.27k|            break;
  424|  64.6k|        case BNS_EF_CHNG_RSTR:
  ------------------
  |  |  372|  64.6k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  64.6k|#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)
  |  |  ------------------
  |  |  |  |  371|  64.6k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
  |  Branch (424:9): [True: 64.6k, False: 1.27k]
  ------------------
  425|       |            /* the flow has been changed by the BNS; requested to change it back */
  426|       |            /*flow2 = edge->flow;*/    /* output from BNS, the changed value */
  427|       |                                       /*flow1 = flow2 - delta;*/ /* the original flow value before the BNS */
  428|  64.6k|            edge->flow = edge->flow - delta;    /* CHANGE EDGE FLOW BACK (RESTORE) */
  429|  64.6k|            break;
  430|      0|        case BNS_EF_RSTR_FLOW:
  ------------------
  |  |  371|      0|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  ------------------
  |  Branch (430:9): [True: 0, False: 65.9k]
  ------------------
  431|       |            /* the flow has not been permitted to change inside the BNS */
  432|       |            /* nothing to do */
  433|       |            /*flow1 = edge->flow;*/    /* output from BNS, the original flow value */
  434|       |                                       /*flow2 = flow1 + delta;*/ /* the flow would be changed to this value by the BNS if permitted */
  435|      0|            break;
  436|  65.9k|    }
  437|       |
  438|  65.9k|    return 0;
  439|  65.9k|}
SetAtomBondType:
  450|  68.3k|{
  451|  68.3k|    int    flow1, flow2, tmp, ret = 0;
  452|  68.3k|    int   bond_mark = 0, bond_type, new_bond_type; /* djb-rwth: addressing LLVM warning */
  453|       |
  454|  68.3k|    if (!edge->pass || !bond_type21)
  ------------------
  |  Branch (454:9): [True: 0, False: 68.3k]
  |  Branch (454:24): [True: 0, False: 68.3k]
  ------------------
  455|      0|    {
  456|      0|        return 0;
  457|      0|    }
  458|       |
  459|  68.3k|    switch (bChangeFlow & BNS_EF_CHNG_RSTR)
  ------------------
  |  |  372|  68.3k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  68.3k|#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)
  |  |  ------------------
  |  |  |  |  371|  68.3k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
  460|  68.3k|    {
  461|  28.6k|        case 0:                    /* the flow has not been permitted to change inside the BNS: simulated in case of check one bond */
  ------------------
  |  Branch (461:9): [True: 28.6k, False: 39.6k]
  ------------------
  462|  28.6k|        case BNS_EF_RSTR_FLOW:     /* the flow has not been permitted to change inside the BNS: obsolete mode, unexpected bChangeFlow */
  ------------------
  |  |  371|  28.6k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  ------------------
  |  Branch (462:9): [True: 0, False: 68.3k]
  ------------------
  463|  28.6k|            flow1 = edge->flow0;   /* output from BNS, the original (old) flow value */
  464|  28.6k|            flow2 = flow1 + delta; /* the flow would be changed to this value by the BNS if permitted */
  465|  28.6k|            break;
  466|    598|        case BNS_EF_CHNG_FLOW:     /* the flow has been changed by the BNS */
  ------------------
  |  |  370|    598|#define BNS_EF_CHNG_FLOW      1  /* change Balanced Network (BN) flow inside the BNS search */
  ------------------
  |  Branch (466:9): [True: 598, False: 67.7k]
  ------------------
  467|  39.6k|        case BNS_EF_CHNG_RSTR:     /* the flow has been changed by the BNS; requested to change it back */
  ------------------
  |  |  372|  39.6k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  39.6k|#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)
  |  |  ------------------
  |  |  |  |  371|  39.6k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
  |  Branch (467:9): [True: 39.1k, False: 29.2k]
  ------------------
  468|  39.6k|            flow2 = edge->flow;    /* output from BNS, the changed (new) value */
  469|  39.6k|            flow1 = edge->flow0;   /* the original flow (old) value before the BNS */
  470|  39.6k|            break;
  471|      0|        default:
  ------------------
  |  Branch (471:9): [True: 0, False: 68.3k]
  ------------------
  472|      0|            return 0; /* added 2006-03-21 */
  473|  68.3k|    }
  474|       |
  475|  68.3k|    if (( bChangeFlow & BNS_EF_CHNG_BONDS ) && ( bChangeFlow & BNS_EF_ALTR_NS ) != BNS_EF_ALTR_NS)
  ------------------
  |  |  373|  68.3k|#define BNS_EF_CHNG_BONDS     4  /* change bonds in the structure according to the BN flow */
  ------------------
                  if (( bChangeFlow & BNS_EF_CHNG_BONDS ) && ( bChangeFlow & BNS_EF_ALTR_NS ) != BNS_EF_ALTR_NS)
  ------------------
  |  |  382|    598|#define BNS_EF_ALTR_NS      (BNS_EF_ALTR_BONDS | BNS_EF_SET_NOSTEREO)
  |  |  ------------------
  |  |  |  |  374|    598|#define BNS_EF_ALTR_BONDS     8  /* make altern. bonds in the structure if the flow has changed */
  |  |  ------------------
  |  |               #define BNS_EF_ALTR_NS      (BNS_EF_ALTR_BONDS | BNS_EF_SET_NOSTEREO)
  |  |  ------------------
  |  |  |  |  377|    598|#define BNS_EF_SET_NOSTEREO  32  /* in combination with BNS_EF_ALTR_BONDS only:
  |  |  ------------------
  ------------------
                  if (( bChangeFlow & BNS_EF_CHNG_BONDS ) && ( bChangeFlow & BNS_EF_ALTR_NS ) != BNS_EF_ALTR_NS)
  ------------------
  |  |  382|    598|#define BNS_EF_ALTR_NS      (BNS_EF_ALTR_BONDS | BNS_EF_SET_NOSTEREO)
  |  |  ------------------
  |  |  |  |  374|    598|#define BNS_EF_ALTR_BONDS     8  /* make altern. bonds in the structure if the flow has changed */
  |  |  ------------------
  |  |               #define BNS_EF_ALTR_NS      (BNS_EF_ALTR_BONDS | BNS_EF_SET_NOSTEREO)
  |  |  ------------------
  |  |  |  |  377|    598|#define BNS_EF_SET_NOSTEREO  32  /* in combination with BNS_EF_ALTR_BONDS only:
  |  |  ------------------
  ------------------
  |  Branch (475:9): [True: 598, False: 67.7k]
  |  Branch (475:48): [True: 278, False: 320]
  ------------------
  476|    278|    {
  477|       |        /* Set new bond types according to the new flow values */
  478|    278|        new_bond_type = flow2 + BOND_SINGLE;
  ------------------
  |  |  177|    278|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|    278|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  479|    278|        if (*bond_type12 != new_bond_type)
  ------------------
  |  Branch (479:13): [True: 277, False: 1]
  ------------------
  480|    277|        {
  481|    277|            *bond_type12 = *bond_type21 = new_bond_type;
  482|    277|            ret++;
  483|    277|        }
  484|    278|    }
  485|  68.1k|    else
  486|  68.1k|    {
  487|  68.1k|        if (bChangeFlow & BNS_EF_ALTR_BONDS)
  ------------------
  |  |  374|  68.1k|#define BNS_EF_ALTR_BONDS     8  /* make altern. bonds in the structure if the flow has changed */
  ------------------
  |  Branch (487:13): [True: 51.9k, False: 16.1k]
  ------------------
  488|  51.9k|        {
  489|  51.9k|            if (flow1 == flow2)
  ------------------
  |  Branch (489:17): [True: 5, False: 51.9k]
  ------------------
  490|      5|            {
  491|      5|                goto exit_function;
  492|      5|            }
  493|       |            /* Update alternating bond information */
  494|  51.9k|            if (flow1 > flow2)
  ------------------
  |  Branch (494:17): [True: 25.7k, False: 26.1k]
  ------------------
  495|  25.7k|            {
  496|       |                /* Make sure flow2 > flow1 */
  497|  25.7k|                tmp = flow1;
  498|  25.7k|                flow1 = flow2;
  499|  25.7k|                flow2 = tmp;
  500|  25.7k|            }
  501|       |            /* djb-rwth: removing redundant code */
  502|  51.9k|            switch (bond_type = ( *bond_type12 & BOND_TYPE_MASK ))
  ------------------
  |  |  189|  51.9k|#define BOND_TYPE_MASK        0x0f
  ------------------
  503|  51.9k|            {
  504|  11.6k|                case BOND_SINGLE:
  ------------------
  |  |  177|  11.6k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|  11.6k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (504:17): [True: 11.6k, False: 40.2k]
  ------------------
  505|  22.5k|                case BOND_DOUBLE:
  ------------------
  |  |  178|  22.5k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|  22.5k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (505:17): [True: 10.8k, False: 41.0k]
  ------------------
  506|  25.6k|                case BOND_TRIPLE:
  ------------------
  |  |  179|  25.6k|#define BOND_TRIPLE BOND_TYPE_TRIPLE  /* 3                                  */
  |  |  ------------------
  |  |  |  |   34|  25.6k|#define BOND_TYPE_TRIPLE    3
  |  |  ------------------
  ------------------
  |  Branch (506:17): [True: 3.13k, False: 48.8k]
  ------------------
  507|       |                    /* assume that the input bond type fits either flow1 or flow2 */
  508|  25.6k|                    if (flow1 == 0 && flow2 == 1)
  ------------------
  |  Branch (508:25): [True: 20.9k, False: 4.74k]
  |  Branch (508:39): [True: 20.1k, False: 758]
  ------------------
  509|  20.1k|                    {
  510|  20.1k|                        if (bChangeFlow & BNS_EF_SET_NOSTEREO)
  ------------------
  |  |  377|  20.1k|#define BNS_EF_SET_NOSTEREO  32  /* in combination with BNS_EF_ALTR_BONDS only:
  ------------------
  |  Branch (510:29): [True: 10.6k, False: 9.50k]
  ------------------
  511|  10.6k|                        {
  512|  10.6k|                            bond_mark = BOND_MARK_ALT12NS;
  ------------------
  |  |  197|  10.6k|#define BOND_MARK_ALT12NS     0x50  /* 1 or 2, non-stereo                   */
  ------------------
  513|  10.6k|                            bond_type = BOND_ALT12NS;
  ------------------
  |  |  186|  10.6k|#define BOND_ALT12NS             9
  ------------------
  514|  10.6k|                        }
  515|  9.50k|                        else
  516|  9.50k|                        {
  517|  9.50k|                            bond_mark = BOND_MARK_ALT12;
  ------------------
  |  |  193|  9.50k|#define BOND_MARK_ALT12       0x10
  ------------------
  518|  9.50k|                            bond_type = BOND_ALTERN;
  ------------------
  |  |  180|  9.50k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|  9.50k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  519|  9.50k|                        }
  520|  20.1k|                    }
  521|  5.49k|                    else
  522|  5.49k|                    {
  523|  5.49k|                        if (flow1 == 0 && flow2 == 2)
  ------------------
  |  Branch (523:29): [True: 758, False: 4.74k]
  |  Branch (523:43): [True: 758, False: 0]
  ------------------
  524|    758|                        {
  525|    758|                            bond_mark = BOND_MARK_ALT13;
  ------------------
  |  |  195|    758|#define BOND_MARK_ALT13       0x30
  ------------------
  526|    758|                            bond_type = BOND_ALT_13;
  ------------------
  |  |  183|    758|#define BOND_ALT_13              6   /* single/triple                       */
  ------------------
  527|    758|                        }
  528|  4.74k|                        else
  529|  4.74k|                        {
  530|  4.74k|                            if (flow1 == 1 && flow2 == 2)
  ------------------
  |  Branch (530:33): [True: 4.74k, False: 0]
  |  Branch (530:47): [True: 4.74k, False: 0]
  ------------------
  531|  4.74k|                            {
  532|  4.74k|                                bond_mark = BOND_MARK_ALT23;
  ------------------
  |  |  196|  4.74k|#define BOND_MARK_ALT23       0x40
  ------------------
  533|  4.74k|                                bond_type = BOND_ALT_23;
  ------------------
  |  |  184|  4.74k|#define BOND_ALT_23              7   /* double/triple                       */
  ------------------
  534|  4.74k|                            }
  535|      0|                            else
  536|      0|                            {
  537|      0|                                return BNS_BOND_ERR; /* error */
  ------------------
  |  |   52|      0|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
  538|      0|                            }
  539|  4.74k|                        }
  540|  5.49k|                    }
  541|  25.6k|                    break;
  542|  25.6k|                case BOND_TAUTOM:
  ------------------
  |  |  185|  14.9k|#define BOND_TAUTOM              8
  ------------------
  |  Branch (542:17): [True: 14.9k, False: 37.0k]
  ------------------
  543|  14.9k|                    if (flow1 == 0 && flow2 == 1)
  ------------------
  |  Branch (543:25): [True: 14.9k, False: 5]
  |  Branch (543:39): [True: 14.9k, False: 0]
  ------------------
  544|  14.9k|                    {
  545|  14.9k|                        bond_mark = BOND_MARK_ALT12NS;
  ------------------
  |  |  197|  14.9k|#define BOND_MARK_ALT12NS     0x50  /* 1 or 2, non-stereo                   */
  ------------------
  546|  14.9k|                    }
  547|      5|                    else
  548|      5|                        if (flow1 == 1 && flow2 == 2) {
  ------------------
  |  Branch (548:29): [True: 5, False: 0]
  |  Branch (548:43): [True: 5, False: 0]
  ------------------
  549|      5|                            bond_mark = BOND_MARK_ALT23;
  ------------------
  |  |  196|      5|#define BOND_MARK_ALT23       0x40
  ------------------
  550|      5|                        }
  551|      0|                        else {
  552|      0|                            return BNS_BOND_ERR; /* error */
  ------------------
  |  |   52|      0|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
  553|      0|                        }
  554|  14.9k|                        break;
  555|  14.9k|                default:
  ------------------
  |  Branch (555:17): [True: 11.3k, False: 40.6k]
  ------------------
  556|  11.3k|                    new_bond_type = bond_type;
  557|  11.3k|                    bond_mark = ( *bond_type12 & BOND_MARK_MASK );
  ------------------
  |  |  198|  11.3k|#define BOND_MARK_MASK        0x70
  ------------------
  558|  11.3k|                    switch (bond_mark)
  559|  11.3k|                    {
  560|  4.26k|                        case BOND_MARK_ALT12:
  ------------------
  |  |  193|  4.26k|#define BOND_MARK_ALT12       0x10
  ------------------
  |  Branch (560:25): [True: 4.26k, False: 7.06k]
  ------------------
  561|  4.26k|                            if (( bChangeFlow & BNS_EF_SET_NOSTEREO ) && flow1 == 0 && flow2 == 1)
  ------------------
  |  |  377|  4.26k|#define BNS_EF_SET_NOSTEREO  32  /* in combination with BNS_EF_ALTR_BONDS only:
  ------------------
  |  Branch (561:33): [True: 617, False: 3.64k]
  |  Branch (561:74): [True: 580, False: 37]
  |  Branch (561:88): [True: 580, False: 0]
  ------------------
  562|    580|                            {
  563|    580|                                bond_mark = BOND_MARK_ALT12NS;
  ------------------
  |  |  197|    580|#define BOND_MARK_ALT12NS     0x50  /* 1 or 2, non-stereo                   */
  ------------------
  564|    580|                                new_bond_type = BOND_ALT12NS;
  ------------------
  |  |  186|    580|#define BOND_ALT12NS             9
  ------------------
  565|    580|                                break;
  566|    580|                            }
  567|  7.08k|                        case BOND_MARK_ALT12NS:
  ------------------
  |  |  197|  7.08k|#define BOND_MARK_ALT12NS     0x50  /* 1 or 2, non-stereo                   */
  ------------------
  |  Branch (567:25): [True: 3.40k, False: 7.92k]
  ------------------
  568|  7.08k|                            if (flow1 == 2 || flow2 == 2)
  ------------------
  |  Branch (568:33): [True: 0, False: 7.08k]
  |  Branch (568:47): [True: 560, False: 6.52k]
  ------------------
  569|    560|                            {
  570|    560|                                bond_mark = BOND_MARK_ALT123;
  ------------------
  |  |  194|    560|#define BOND_MARK_ALT123      0x20
  ------------------
  571|    560|                                new_bond_type = BOND_ALT_123;
  ------------------
  |  |  182|    560|#define BOND_ALT_123             5   /* single/double/triple                */
  ------------------
  572|    560|                            }
  573|  7.08k|                            break;
  574|    760|                        case BOND_MARK_ALT13:
  ------------------
  |  |  195|    760|#define BOND_MARK_ALT13       0x30
  ------------------
  |  Branch (574:25): [True: 760, False: 10.5k]
  ------------------
  575|    760|                            if (flow1 == 1 || flow2 == 1)
  ------------------
  |  Branch (575:33): [True: 429, False: 331]
  |  Branch (575:47): [True: 329, False: 2]
  ------------------
  576|    758|                            {
  577|    758|                                bond_mark = BOND_MARK_ALT123;
  ------------------
  |  |  194|    758|#define BOND_MARK_ALT123      0x20
  ------------------
  578|    758|                                new_bond_type = BOND_ALT_123;
  ------------------
  |  |  182|    758|#define BOND_ALT_123             5   /* single/double/triple                */
  ------------------
  579|    758|                            }
  580|    760|                            break;
  581|  2.09k|                        case BOND_MARK_ALT23:
  ------------------
  |  |  196|  2.09k|#define BOND_MARK_ALT23       0x40
  ------------------
  |  Branch (581:25): [True: 2.09k, False: 9.23k]
  ------------------
  582|  2.09k|                            if (flow1 == 0 || flow2 == 0)
  ------------------
  |  Branch (582:33): [True: 792, False: 1.29k]
  |  Branch (582:47): [True: 0, False: 1.29k]
  ------------------
  583|    792|                            {
  584|    792|                                bond_mark = BOND_MARK_ALT123;
  ------------------
  |  |  194|    792|#define BOND_MARK_ALT123      0x20
  ------------------
  585|    792|                                new_bond_type = BOND_ALT_123;
  ------------------
  |  |  182|    792|#define BOND_ALT_123             5   /* single/double/triple                */
  ------------------
  586|    792|                            }
  587|  2.09k|                            break;
  588|    817|                        case BOND_MARK_ALT123:
  ------------------
  |  |  194|    817|#define BOND_MARK_ALT123      0x20
  ------------------
  |  Branch (588:25): [True: 817, False: 10.5k]
  ------------------
  589|    817|                            break;
  590|       |
  591|      0|                        case 0: /* special case: second alt bond testing */
  ------------------
  |  Branch (591:25): [True: 0, False: 11.3k]
  ------------------
  592|      0|                            if (flow1 == 0 && flow2 == 1)
  ------------------
  |  Branch (592:33): [True: 0, False: 0]
  |  Branch (592:47): [True: 0, False: 0]
  ------------------
  593|      0|                            {
  594|      0|                                bond_mark = BOND_MARK_ALT12;
  ------------------
  |  |  193|      0|#define BOND_MARK_ALT12       0x10
  ------------------
  595|      0|                            }
  596|      0|                            else
  597|      0|                            {
  598|      0|                                if (flow1 == 0 && flow2 == 2)
  ------------------
  |  Branch (598:37): [True: 0, False: 0]
  |  Branch (598:51): [True: 0, False: 0]
  ------------------
  599|      0|                                {
  600|      0|                                    bond_mark = BOND_MARK_ALT13;
  ------------------
  |  |  195|      0|#define BOND_MARK_ALT13       0x30
  ------------------
  601|      0|                                }
  602|      0|                                else
  603|      0|                                {
  604|      0|                                    if (flow1 == 1 && flow2 == 2)
  ------------------
  |  Branch (604:41): [True: 0, False: 0]
  |  Branch (604:55): [True: 0, False: 0]
  ------------------
  605|      0|                                    {
  606|      0|                                        bond_mark = BOND_MARK_ALT23;
  ------------------
  |  |  196|      0|#define BOND_MARK_ALT23       0x40
  ------------------
  607|      0|                                    }
  608|      0|                                    else
  609|      0|                                    {
  610|      0|                                        return BNS_BOND_ERR; /* error */
  ------------------
  |  |   52|      0|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
  611|      0|                                    }
  612|      0|                                }
  613|      0|                            }
  614|      0|                            break;
  615|       |
  616|      0|                        default:
  ------------------
  |  Branch (616:25): [True: 0, False: 11.3k]
  ------------------
  617|      0|                            return BNS_BOND_ERR; /* error */
  ------------------
  |  |   52|      0|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
  618|  11.3k|                    }
  619|       |
  620|  11.3k|                    switch (bond_type)
  621|  11.3k|                    {
  622|      0|                        case BOND_TAUTOM:
  ------------------
  |  |  185|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (622:25): [True: 0, False: 11.3k]
  ------------------
  623|      0|                            break;
  624|  4.26k|                        case BOND_ALTERN:
  ------------------
  |  |  180|  4.26k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|  4.26k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (624:25): [True: 4.26k, False: 7.06k]
  ------------------
  625|  7.66k|                        case BOND_ALT12NS:
  ------------------
  |  |  186|  7.66k|#define BOND_ALT12NS             9
  ------------------
  |  Branch (625:25): [True: 3.40k, False: 7.92k]
  ------------------
  626|  8.47k|                        case BOND_ALT_123:
  ------------------
  |  |  182|  8.47k|#define BOND_ALT_123             5   /* single/double/triple                */
  ------------------
  |  Branch (626:25): [True: 817, False: 10.5k]
  ------------------
  627|  9.23k|                        case BOND_ALT_13:
  ------------------
  |  |  183|  9.23k|#define BOND_ALT_13              6   /* single/triple                       */
  ------------------
  |  Branch (627:25): [True: 760, False: 10.5k]
  ------------------
  628|  11.3k|                        case BOND_ALT_23:
  ------------------
  |  |  184|  11.3k|#define BOND_ALT_23              7   /* double/triple                       */
  ------------------
  |  Branch (628:25): [True: 2.09k, False: 9.23k]
  ------------------
  629|  11.3k|                            bond_type = new_bond_type;
  630|  11.3k|                            break;
  631|      0|                        default:
  ------------------
  |  Branch (631:25): [True: 0, False: 11.3k]
  ------------------
  632|      0|                            return BNS_BOND_ERR; /* error */
  ------------------
  |  |   52|      0|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
  633|  11.3k|                    }
  634|  51.9k|            }
  635|       |
  636|  51.9k|            new_bond_type = bond_type | bond_mark;
  637|  51.9k|            if (new_bond_type != *bond_type12)
  ------------------
  |  Branch (637:17): [True: 40.8k, False: 11.1k]
  ------------------
  638|  40.8k|            {
  639|  40.8k|                *bond_type12 = *bond_type21 = new_bond_type;
  640|  40.8k|                ret++;
  641|  40.8k|            }
  642|  51.9k|        }
  643|  68.1k|    }
  644|       |
  645|  68.3k|exit_function:
  646|       |
  647|  68.3k|    return ret;
  648|  68.3k|}
RunBalancedNetworkSearch:
  655|   567k|{
  656|   567k|    int pass, delta = 0, nSumDelta;
  657|       |
  658|   567k|    nSumDelta = 0;
  659|   690k|    for (pass = 0; pass < pBNS->max_altp; pass++)
  ------------------
  |  Branch (659:20): [True: 690k, False: 2]
  ------------------
  660|   690k|    {
  661|   690k|        pBNS->alt_path = pBNS->altp[pass];
  662|   690k|        pBNS->bChangeFlow = 0;
  663|   690k|        delta = BalancedNetworkSearch( pBNS, pBD, bChangeFlow );
  664|   690k|        ReInitBnData( pBD );
  665|   690k|        if (0 < delta)
  ------------------
  |  Branch (665:13): [True: 122k, False: 567k]
  ------------------
  666|   122k|        {
  667|   122k|            pBNS->num_altp++;
  668|   122k|            nSumDelta += abs( delta );
  669|   122k|        }
  670|   567k|        else
  671|   567k|        {
  672|   567k|            break;
  673|   567k|        }
  674|   690k|    }
  675|       |
  676|   567k|    if (IS_BNS_ERROR( delta ))
  ------------------
  |  |   67|   567k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   567k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   567k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   567k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 567k, False: 0]
  |  |  |  Branch (67:44): [True: 2, False: 567k]
  |  |  ------------------
  ------------------
  677|      2|    {
  678|      2|        return delta;
  679|      2|    }
  680|       |
  681|   567k|    if (bInchiTimeIsOver( pBNS->ic, pBNS->ulTimeOutTime ))
  ------------------
  |  Branch (681:9): [True: 0, False: 567k]
  ------------------
  682|      0|    {
  683|      0|        return BNS_TIMEOUT;
  ------------------
  |  |   63|      0|#define BNS_TIMEOUT        (BNS_ERR + 14) /*(-9985)*/ /* v. 1.05 */
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
  684|      0|    }
  685|       |
  686|   567k|    return nSumDelta; /* number of eliminated pairs of "dots"  */
  687|   567k|}
SetAtomRadAndChemValFromVertexCapFlow:
  694|     40|{
  695|     40|    BNS_VERTEX *vert = pBNS->vert + v1;
  696|     40|    inp_ATOM *at = atom + v1;
  697|     40|    S_CHAR      cValue;
  698|     40|    int  nChanges = 0;
  699|       |
  700|       |    /* Set only on the 1st pass */
  701|     40|    if (!vert->st_edge.pass)
  ------------------
  |  Branch (701:9): [True: 0, False: 40]
  ------------------
  702|      0|    {
  703|      0|        return 0;
  704|      0|    }
  705|       |
  706|       |    /* Adjust chem_bonds_valence */
  707|     40|    cValue = at->chem_bonds_valence - at->valence;
  708|     40|    if (cValue >= 0 && cValue != vert->st_edge.flow)
  ------------------
  |  Branch (708:9): [True: 40, False: 0]
  |  Branch (708:24): [True: 40, False: 0]
  ------------------
  709|     40|    {
  710|     40|        at->chem_bonds_valence = at->valence + vert->st_edge.flow;
  711|     40|        nChanges++;
  712|     40|    }
  713|       |
  714|       |    /* Adjist radical */
  715|     40|    switch (vert->st_edge.cap - vert->st_edge.flow)
  716|     40|    {
  717|     40|        case 0:
  ------------------
  |  Branch (717:9): [True: 40, False: 0]
  ------------------
  718|     40|            cValue = 0;
  719|     40|            break;
  720|      0|        case 1:
  ------------------
  |  Branch (720:9): [True: 0, False: 40]
  ------------------
  721|      0|            cValue = RADICAL_DOUBLET;
  ------------------
  |  |   76|      0|#define RADICAL_DOUBLET 2
  ------------------
  722|      0|            break;
  723|      0|        case 2:
  ------------------
  |  Branch (723:9): [True: 0, False: 40]
  ------------------
  724|      0|            cValue = RADICAL_TRIPLET;
  ------------------
  |  |   77|      0|#define RADICAL_TRIPLET 3
  ------------------
  725|      0|            break;
  726|      0|        default:
  ------------------
  |  Branch (726:9): [True: 0, False: 40]
  ------------------
  727|      0|            return BNS_BOND_ERR;
  ------------------
  |  |   52|      0|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
  728|     40|    }
  729|     40|    if (cValue != at->radical)
  ------------------
  |  Branch (729:9): [True: 40, False: 0]
  ------------------
  730|     40|    {
  731|     40|        at->radical = cValue;
  732|     40|        nChanges++;
  733|     40|    }
  734|       |
  735|     40|    return nChanges;
  736|     40|}
AddChangedAtHChargeBNS:
  744|    197|{
  745|    197|    int i, mask, num;
  746|  1.62k|    for (i = 0, num = 0; i < num_atoms; i++)
  ------------------
  |  Branch (746:26): [True: 1.43k, False: 197]
  ------------------
  747|  1.43k|    {
  748|  1.43k|        if (mark[i])
  ------------------
  |  Branch (748:13): [True: 450, False: 980]
  ------------------
  749|    450|        {
  750|    450|            mark[i] = 0;
  751|    450|#if ( FIX_NORM_BUG_ADD_ION_PAIR == 1 )
  752|       |            /* add ignoring adjacent charges */
  753|    450|            at[i].at_type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, -2 );
  754|       |#else
  755|       |            at[i].at_type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 0 );
  756|       |#endif
  757|    450|            num++;
  758|    450|        }
  759|  1.43k|    }
  760|       |
  761|    197|    return num;
  762|    197|}
EliminatePlusMinusChargeAmbiguity:
  778|    197|{
  779|    197|    int pass, i, v0, v1, v2, ineigh1, /*ineigh0,*/ /*ineigh2,*/
  780|    197|        vLast, n, delta, ret, err = 0;
  781|    197|    int nFound, k;
  782|    197|    BNS_EDGE *edge;
  783|       |
  784|    394|    for (pass = pBNS->num_altp - 1, ret = 0; 0 <= pass; pass--)
  ------------------
  |  Branch (784:46): [True: 197, False: 197]
  ------------------
  785|    197|    {
  786|       |
  787|    197|        pBNS->alt_path = pBNS->altp[pass];
  788|    197|        v1 = ALTP_START_ATOM( pBNS->alt_path );
  ------------------
  |  |  103|    197|#define ALTP_START_ATOM(altp)           (altp)[iALTP_START_ATOM].number
  ------------------
  789|    197|        n = ALTP_PATH_LEN( pBNS->alt_path );
  ------------------
  |  |  101|    197|#define ALTP_PATH_LEN(altp)             (altp)[iALTP_PATH_LEN].number  /* number of bonds = number of atoms-1*/
  ------------------
  790|    197|        delta = ALTP_DELTA( pBNS->alt_path );
  ------------------
  |  |  112|    197|#define ALTP_DELTA(altp)                 (altp)[iALTP_FLOW].flow[0]
  ------------------
  791|    197|        vLast = ALTP_END_ATOM( pBNS->alt_path );
  ------------------
  |  |  102|    197|#define ALTP_END_ATOM(altp)             (altp)[iALTP_END_ATOM].number
  ------------------
  792|    197|        v0 = v2 = NO_VERTEX; /* negative number */
  ------------------
  |  |  118|    197|#define NO_VERTEX    -2
  ------------------
  793|       |
  794|  1.40k|        for (i = 0; i < n; i++, delta = -delta, v0 = v1, v1 = v2 /*, ineigh0 = ineigh1*/)
  ------------------
  |  Branch (794:21): [True: 1.20k, False: 197]
  ------------------
  795|  1.20k|        {
  796|  1.20k|            ineigh1 = ALTP_THIS_ATOM_NEIGHBOR( pBNS->alt_path, i );  /* v1->v2 neighbor */
  ------------------
  |  |  104|  1.20k|#define ALTP_THIS_ATOM_NEIGHBOR(altp,X) (altp)[iALTP_NEIGHBOR+(X)].ineigh[0]  /* 0 <= X < path_len */
  ------------------
  797|       |                                                                     /*ineigh2 = ALTP_NEXT_ATOM_NEIGHBOR(pBNS->alt_path, i);*/  /* v2->v1 neighbor */
  798|  1.20k|            edge = pBNS->edge + pBNS->vert[v1].iedge[ineigh1];
  799|       |            /* follow the BN Structure, not the inp_ATOM, to take care of swithching to
  800|       |            t-groups, c-groups or other fictitious edges/vertices
  801|       |            */
  802|  1.20k|            v2 = edge->neighbor12 ^ v1;
  803|  1.20k|            if (v1 < num_atoms &&
  ------------------
  |  Branch (803:17): [True: 771, False: 434]
  ------------------
  804|    771|                ( (v0 >= num_atoms && ( pBNS->vert[v0].type & BNS_VERT_TYPE_C_GROUP )) ||
  ------------------
  |  |   49|    237|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
  |  Branch (804:20): [True: 237, False: 534]
  |  Branch (804:39): [True: 207, False: 30]
  ------------------
  805|    564|                  (v2 >= num_atoms && ( pBNS->vert[v2].type & BNS_VERT_TYPE_C_GROUP ) ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   49|    235|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
  |  Branch (805:20): [True: 235, False: 329]
  |  Branch (805:39): [True: 112, False: 123]
  ------------------
  806|    319|            {
  807|    319|                int        cgPos = 0, cgNeg = 0;
  808|    319|                int        neighPos = -1, neighNeg = -1;
  809|    319|                BNS_EDGE *edgePos, *edgeNeg;
  810|    319|                nFound = 0;
  811|  1.28k|                for (k = pBNS->vert[v1].num_adj_edges - 1; k >= 0 && ( neighPos < 0 || neighNeg < 0 ); k--)
  ------------------
  |  Branch (811:60): [True: 1.18k, False: 96]
  |  Branch (811:72): [True: 961, False: 223]
  |  Branch (811:88): [True: 0, False: 223]
  ------------------
  812|    961|                {
  813|    961|                    BNS_EDGE   *next_edge = pBNS->edge + pBNS->vert[v1].iedge[k];
  814|    961|                    int         v = next_edge->neighbor12 ^ v1;
  815|    961|                    if (pBNS->vert[v].type & BNS_VERT_TYPE_C_GROUP)
  ------------------
  |  |   49|    961|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
  |  Branch (815:25): [True: 542, False: 419]
  ------------------
  816|    542|                    {
  817|    542|                        if (pBNS->vert[v].type & BNS_VERT_TYPE_C_NEGATIVE)
  ------------------
  |  |   54|    542|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  ------------------
  |  Branch (817:29): [True: 319, False: 223]
  ------------------
  818|    319|                        {
  819|    319|                            cgNeg = v;
  820|    319|                            neighNeg = k;
  821|    319|                            nFound++;
  822|    319|                        }
  823|    223|                        else
  824|    223|                        {
  825|    223|                            cgPos = v;
  826|    223|                            neighPos = k;
  827|    223|                            nFound++;
  828|    223|                        }
  829|    542|                    }
  830|    961|                }
  831|    319|                if (2 == nFound && neighPos >= 0 && neighNeg >= 0)
  ------------------
  |  Branch (831:21): [True: 223, False: 96]
  |  Branch (831:36): [True: 223, False: 0]
  |  Branch (831:53): [True: 223, False: 0]
  ------------------
  832|    223|                {
  833|       |                    /* both c-groups have been found */
  834|    223|                    edgePos = pBNS->edge + pBNS->vert[v1].iedge[neighPos];
  835|    223|                    edgeNeg = pBNS->edge + pBNS->vert[v1].iedge[neighNeg];
  836|    223|                    if (edgePos->flow < edgeNeg->flow)
  ------------------
  |  Branch (836:25): [True: 0, False: 223]
  ------------------
  837|      0|                    {
  838|       |                        /* ambiguity found; replace (+cg)--N==(-cg) with (+cg)==N--(-cg) */
  839|      0|                        int dflow = edgeNeg->flow - edgePos->flow;
  840|       |
  841|      0|                        edgePos->flow += dflow;
  842|      0|                        pBNS->vert[cgPos].st_edge.cap += dflow;
  843|      0|                        pBNS->vert[cgPos].st_edge.flow += dflow;
  844|       |
  845|      0|                        edgeNeg->flow -= dflow;
  846|      0|                        pBNS->vert[cgNeg].st_edge.cap -= dflow;
  847|      0|                        pBNS->vert[cgNeg].st_edge.flow -= dflow;
  848|      0|                        ret++;
  849|      0|                    }
  850|    223|                }
  851|    319|            }
  852|  1.20k|        }
  853|       |
  854|    197|        if (v2 != vLast)
  ------------------
  |  Branch (854:13): [True: 0, False: 197]
  ------------------
  855|      0|        {
  856|      0|            err = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
  857|      0|        }
  858|    197|    }
  859|       |
  860|    197|    return err ? err : ret;
  ------------------
  |  Branch (860:12): [True: 0, False: 197]
  ------------------
  861|    197|}
AddOrRemoveExplOrImplH:
  872|  5.11k|{
  873|  5.11k|    int i, iso, tot_num_iso_H,
  874|  5.11k|        num_H,                  /* number of H before the removal, including explicit H  */
  875|  5.11k|        nNum2Remove,            /* number of H to remove */
  876|  5.11k|        nNumRemovedExplicitH; /* djb-rwth: removing redundant variables */
  877|  5.11k|    S_CHAR    num_iso_H[NUM_H_ISOTOPES];
  878|  5.11k|    inp_ATOM *at_H;
  879|       |
  880|  5.11k|    if (!nDelta)
  ------------------
  |  Branch (880:9): [True: 0, False: 5.11k]
  ------------------
  881|      0|    {
  882|      0|        return 0;
  883|      0|    }
  884|       |    /* add */
  885|  5.11k|    if (nDelta > 0)
  ------------------
  |  Branch (885:9): [True: 4.21k, False: 900]
  ------------------
  886|  4.21k|    {
  887|  4.21k|        at[at_no].num_H += nDelta;
  888|  4.21k|        t_group_info->tni.nNumRemovedProtons--;
  889|  4.21k|        return nDelta;
  890|  4.21k|    }
  891|       |    /* remove */
  892|    900|    nNum2Remove = -nDelta;
  893|    900|    nNumRemovedExplicitH = t_group_info->tni.nNumRemovedExplicitH; /* number of explicit H saved separately in
  894|       |                                                                   at[num_atoms+i], i=0..nNumRemovedExplicitH-1 */
  895|    900|    tot_num_iso_H = NUM_ISO_H( at, at_no );
  ------------------
  |  |   55|    900|#define NUM_ISO_H(AT, N) (AT[N].num_iso_H[0] + AT[N].num_iso_H[1] + AT[N].num_iso_H[2])
  ------------------
  896|    900|    num_H = at[at_no].num_H;
  897|       |    /*
  898|       |    tot_num_iso_H          = NUM_ISO_H(at,at_no);
  899|       |    num_H                  = at[at_no].num_H;
  900|       |    nNumAtomExplicitH      = 0;
  901|       |    nNumRemovedExplicitH   = t_group_info->tni.nNumRemovedExplicitH;
  902|       |    tot_num_explicit_iso_H = 0;
  903|       |    */
  904|       |
  905|    900|    at_H = at + num_atoms;
  906|    900|    memcpy(num_iso_H, at[at_no].num_iso_H, sizeof(num_iso_H));
  907|       |    /*  Remove all explicit H, otherwise a false stereo can occur.
  908|       |    Example: remove H(+) from the following substructure:
  909|       |
  910|       |    H                                            H
  911|       |    A      /                                      A     /
  912|       |    >X==N(+)    produces false stereogenic bond:  >X==N
  913|       |    B      \                                      B
  914|       |    H
  915|       |
  916|       |    To avoid this effect all explicit H atoms must be removed
  917|       |    */
  918|       |
  919|       |    /* djb-rwth: removing redundant code */
  920|  1.36k|    for (i = 0; i < nNumRemovedExplicitH; )
  ------------------
  |  Branch (920:17): [True: 461, False: 900]
  ------------------
  921|    461|    {
  922|    461|        if (at_H[i].neighbor[0] == at_no)
  ------------------
  |  Branch (922:13): [True: 307, False: 154]
  ------------------
  923|    307|        {
  924|    307|            int m, k, orig_no = at_H[i].orig_at_number;
  925|    307|            nNumRemovedExplicitH--;
  926|       |            /* djb-rwth: removing redundant code */
  927|    307|            if (nNumRemovedExplicitH > i)
  ------------------
  |  Branch (927:17): [True: 60, False: 247]
  ------------------
  928|     60|            {
  929|     60|                inp_ATOM at_i = at_H[i];
  930|     60|                memmove(at_H + i, at_H + i + 1, sizeof(at_H[0]) * ((long long)nNumRemovedExplicitH - i)); /* djb-rwth: cast operator added */
  931|     60|                at_H[nNumRemovedExplicitH] = at_i; /* save removed H (for debugging purposes?) */
  932|     60|            }
  933|       |            /* Adjust 0D parities */
  934|    307|            if (at[at_no].sb_parity[0])
  ------------------
  |  Branch (934:17): [True: 81, False: 226]
  ------------------
  935|     81|            {
  936|    163|                for (m = 0; m < MAX_NUM_STEREO_BONDS && at[at_no].sb_parity[m]; m++)
  ------------------
  |  |  873|    326|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (936:29): [True: 163, False: 0]
  |  Branch (936:57): [True: 82, False: 81]
  ------------------
  937|     82|                {
  938|     82|                    if (at[at_no].sn_orig_at_num[m] == orig_no)
  ------------------
  |  Branch (938:25): [True: 65, False: 17]
  ------------------
  939|     65|                    {
  940|     65|                        if (at[at_no].valence >= MIN_NUM_STEREO_BOND_NEIGH)
  ------------------
  |  |  875|     65|#define MIN_NUM_STEREO_BOND_NEIGH 2
  ------------------
  |  Branch (940:29): [True: 30, False: 35]
  ------------------
  941|     30|                        {
  942|     30|                            at[at_no].sn_ord[m] = k = ( at[at_no].sb_ord[m] == 0 );
  943|     30|                            at[at_no].sn_orig_at_num[m] = at[(int) at[at_no].neighbor[k]].orig_at_number;
  944|     30|                            if (ATOM_PARITY_WELL_DEF( at[at_no].sb_parity[m] ))
  ------------------
  |  |  259|     30|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|     30|#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)
  |  |  ------------------
  |  |  |  |  236|     30|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 30, False: 0]
  |  |  |  Branch (259:75): [True: 13, False: 17]
  |  |  ------------------
  ------------------
  945|     13|                            {
  946|     13|                                at[at_no].sb_parity[m] = 3 - at[at_no].sb_parity[m];
  947|     13|                            }
  948|     30|                        }
  949|     35|                        else
  950|     35|                        {
  951|     35|                            at[at_no].sn_ord[m] = -99; /* no sb neighbor exists anymore */
  952|     35|                            at[at_no].sn_orig_at_num[m] = 0;
  953|     35|                            if (ATOM_PARITY_WELL_DEF( at[at_no].sb_parity[m] ))
  ------------------
  |  |  259|     35|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|     35|#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)
  |  |  ------------------
  |  |  |  |  236|     35|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 35, False: 0]
  |  |  |  Branch (259:75): [True: 25, False: 10]
  |  |  ------------------
  ------------------
  954|     25|                            {
  955|     25|                                int pnxt_atom, pinxt2cur, pinxt_sb_parity_ord;
  956|     25|                                if (0 < get_opposite_sb_atom( at, at_no, at[at_no].sb_ord[m],
  ------------------
  |  Branch (956:37): [True: 25, False: 0]
  ------------------
  957|     25|                                                              &pnxt_atom, &pinxt2cur, &pinxt_sb_parity_ord ))
  958|     25|                                {
  959|     25|                                    at[at_no].sb_parity[m] =
  960|     25|                                        at[pnxt_atom].sb_parity[pinxt_sb_parity_ord] = AB_PARITY_UNDF;
  ------------------
  |  |  222|     25|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  961|     25|                                }
  962|     25|                            }
  963|     35|                        }
  964|     65|                    }
  965|     82|                }
  966|     81|            }
  967|       |            /* do not increment i here: we have shifted next at_H[] element
  968|       |            to the ith position and decremented nNumRemovedExplicitH */
  969|    307|        }
  970|    154|        else
  971|    154|        {
  972|    154|            i++;
  973|    154|        }
  974|    461|    }
  975|       |
  976|  1.85k|    for (iso = -1; iso < NUM_H_ISOTOPES && 0 < nNum2Remove; iso++)
  ------------------
  |  |   25|  3.70k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (976:20): [True: 1.84k, False: 11]
  |  Branch (976:44): [True: 954, False: 889]
  ------------------
  977|    954|    {
  978|       |        /* Each pass removes up to one H */
  979|    954|        if (iso < 0)
  ------------------
  |  Branch (979:13): [True: 900, False: 54]
  ------------------
  980|    900|        {
  981|       |            /* Try to remove non-isotopic */
  982|  1.77k|            while (tot_num_iso_H < num_H && 0 < nNum2Remove)
  ------------------
  |  Branch (982:20): [True: 1.06k, False: 706]
  |  Branch (982:45): [True: 873, False: 194]
  ------------------
  983|    873|            {
  984|       |                /* Non-isotopic H exists */
  985|    873|                num_H--;
  986|    873|                t_group_info->tni.nNumRemovedProtons++;
  987|    873|                nNum2Remove--;
  988|    873|            }
  989|    900|        }
  990|     54|        else
  991|     54|        {
  992|       |            /* Remove isotopic */
  993|     74|            while (num_iso_H[iso] && num_H && 0 < nNum2Remove)
  ------------------
  |  Branch (993:20): [True: 23, False: 51]
  |  Branch (993:38): [True: 21, False: 2]
  |  Branch (993:47): [True: 20, False: 1]
  ------------------
  994|     20|            {
  995|       |                /* Isotopic H exists */
  996|     20|                num_H--;
  997|     20|                num_iso_H[iso] --;
  998|     20|                t_group_info->tni.nNumRemovedProtonsIsotopic[iso] ++;
  999|     20|                t_group_info->tni.nNumRemovedProtons++;
 1000|     20|                nNum2Remove--;
 1001|     20|            }
 1002|     54|        }
 1003|    954|    }
 1004|       |#if ( bRELEASE_VERSION != 1 )
 1005|       |    if (nNum2Remove)
 1006|       |    {
 1007|       |        int stop = 1; /* <BRKPT> Program error */
 1008|       |    }
 1009|       |#endif
 1010|    900|    if (nDelta + nNum2Remove < 0)
  ------------------
  |  Branch (1010:9): [True: 893, False: 7]
  ------------------
 1011|    893|    {
 1012|    893|        at[at_no].num_H = num_H;
 1013|    893|        memcpy(at[at_no].num_iso_H, num_iso_H, sizeof(at[0].num_iso_H));
 1014|    893|        t_group_info->tni.nNumRemovedExplicitH = nNumRemovedExplicitH;
 1015|    893|    }
 1016|       |
 1017|    900|    return nDelta + nNum2Remove;
 1018|  5.11k|}
SubtractOrChangeAtHChargeBNS:
 1029|    394|{
 1030|    394|    int       pass, i, v0, v1, v2, ineigh1, /*ineigh2,*/ vLast, n, delta, ret, err = 0;
 1031|    394|    BNS_EDGE *edge;
 1032|    394|    int       nDeltaH, nDeltaCharge;
 1033|    394|    int       mask, type; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 1034|       |
 1035|    788|    for (pass = pBNS->num_altp - 1, ret = 0; 0 <= pass; pass--)
  ------------------
  |  Branch (1035:46): [True: 394, False: 394]
  ------------------
 1036|    394|    {
 1037|       |
 1038|    394|        pBNS->alt_path = pBNS->altp[pass];
 1039|    394|        v1 = ALTP_START_ATOM( pBNS->alt_path );
  ------------------
  |  |  103|    394|#define ALTP_START_ATOM(altp)           (altp)[iALTP_START_ATOM].number
  ------------------
 1040|    394|        n = ALTP_PATH_LEN( pBNS->alt_path );
  ------------------
  |  |  101|    394|#define ALTP_PATH_LEN(altp)             (altp)[iALTP_PATH_LEN].number  /* number of bonds = number of atoms-1*/
  ------------------
 1041|    394|        delta = ALTP_DELTA( pBNS->alt_path );
  ------------------
  |  |  112|    394|#define ALTP_DELTA(altp)                 (altp)[iALTP_FLOW].flow[0]
  ------------------
 1042|    394|        vLast = ALTP_END_ATOM( pBNS->alt_path );
  ------------------
  |  |  102|    394|#define ALTP_END_ATOM(altp)             (altp)[iALTP_END_ATOM].number
  ------------------
 1043|    394|        v0 = v2 = NO_VERTEX;
  ------------------
  |  |  118|    394|#define NO_VERTEX    -2
  ------------------
 1044|       |
 1045|  2.80k|        for (i = 0; i < n; i++, delta = -delta, v0 = v1, v1 = v2)
  ------------------
  |  Branch (1045:21): [True: 2.41k, False: 394]
  ------------------
 1046|  2.41k|        {
 1047|  2.41k|            ineigh1 = ALTP_THIS_ATOM_NEIGHBOR( pBNS->alt_path, i );  /* v1->v2 neighbor */
  ------------------
  |  |  104|  2.41k|#define ALTP_THIS_ATOM_NEIGHBOR(altp,X) (altp)[iALTP_NEIGHBOR+(X)].ineigh[0]  /* 0 <= X < path_len */
  ------------------
 1048|       |                                                                     /*ineigh2 = ALTP_NEXT_ATOM_NEIGHBOR(pBNS->alt_path, i);*/  /* v2->v1 neighbor */
 1049|  2.41k|            edge = pBNS->edge + pBNS->vert[v1].iedge[ineigh1];
 1050|       |            /* follow the BN Structure, not the inp_ATOM, to take care of swithching to
 1051|       |            t-groups, c-groups or other fictitious edges/vertices
 1052|       |            */
 1053|  2.41k|            v2 = edge->neighbor12 ^ v1;
 1054|  2.41k|            if (v1 < num_atoms && ( v0 >= num_atoms || v2 >= num_atoms ))
  ------------------
  |  Branch (1054:17): [True: 1.54k, False: 868]
  |  Branch (1054:37): [True: 474, False: 1.06k]
  |  Branch (1054:56): [True: 466, False: 602]
  ------------------
 1055|    940|            {
 1056|    940|                nDeltaH = nDeltaCharge = 0;
 1057|    940|                if (v0 >= num_atoms)
  ------------------
  |  Branch (1057:21): [True: 474, False: 466]
  ------------------
 1058|    474|                {
 1059|       |                    /* delta(v0-v1) = -delta(v1-v2) along the alternating path */
 1060|    474|                    if (pBNS->vert[v0].type & BNS_VERT_TYPE_TGROUP)
  ------------------
  |  |   47|    474|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
  |  Branch (1060:25): [True: 38, False: 436]
  ------------------
 1061|     38|                    {
 1062|     38|                        nDeltaH -= delta;
 1063|     38|                    }
 1064|    436|                    else
 1065|    436|                    {
 1066|    436|                        if (pBNS->vert[v0].type & BNS_VERT_TYPE_C_GROUP)
  ------------------
  |  |   49|    436|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
  |  Branch (1066:29): [True: 414, False: 22]
  ------------------
 1067|    414|                        {
 1068|    414|                            nDeltaCharge += delta;
 1069|    414|                        }
 1070|    436|                    }
 1071|    474|                }
 1072|    940|                if (v2 >= num_atoms)
  ------------------
  |  Branch (1072:21): [True: 474, False: 466]
  ------------------
 1073|    474|                {
 1074|    474|                    if (pBNS->vert[v2].type & BNS_VERT_TYPE_TGROUP)
  ------------------
  |  |   47|    474|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
  |  Branch (1074:25): [True: 228, False: 246]
  ------------------
 1075|    228|                    {
 1076|    228|                        nDeltaH += delta;
 1077|    228|                    }
 1078|    246|                    else
 1079|    246|                    {
 1080|    246|                        if (pBNS->vert[v2].type & BNS_VERT_TYPE_C_GROUP)
  ------------------
  |  |   49|    246|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
  |  Branch (1080:29): [True: 224, False: 22]
  ------------------
 1081|    224|                        {
 1082|    224|                            nDeltaCharge -= delta;
 1083|    224|                        }
 1084|    246|                    }
 1085|    474|                }
 1086|    940|                if (nDeltaH || nDeltaCharge)
  ------------------
  |  Branch (1086:21): [True: 266, False: 674]
  |  Branch (1086:32): [True: 634, False: 40]
  ------------------
 1087|    900|                {
 1088|    900|                    if (bSubtract)
  ------------------
  |  Branch (1088:25): [True: 450, False: 450]
  ------------------
 1089|    450|                    {
 1090|    450|                        if (!mark[v1])
  ------------------
  |  Branch (1090:29): [True: 450, False: 0]
  ------------------
 1091|    450|                        {
 1092|       |                            /* first time the atom has been encountered: subtract */
 1093|       |                            /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 1094|    450|#if ( FIX_NORM_BUG_ADD_ION_PAIR == 1 )
 1095|    450|                            type = GetAtomChargeType(at, v1, nAtTypeTotals, &mask, 2);
 1096|       |#else
 1097|       |                            type = GetAtomChargeType(at, v1, nAtTypeTotals, &mask, 1);
 1098|       |#endif
 1099|    450|                            ret++; /* number of changed atoms */
 1100|    450|                            mark[v1] ++;
 1101|    450|                        }
 1102|    450|                    }
 1103|    450|                    else
 1104|    450|                    {
 1105|       |                        /* Change */
 1106|    450|                        at[v1].charge += nDeltaCharge;
 1107|    450|                        if (nDeltaH)
  ------------------
  |  Branch (1107:29): [True: 133, False: 317]
  ------------------
 1108|    133|                        {
 1109|    133|                            AddOrRemoveExplOrImplH( nDeltaH, at, num_atoms, (AT_NUMB) v1, t_group_info );
 1110|    133|                        }
 1111|    450|                        ret++; /* number of changed atoms */
 1112|    450|                    }
 1113|    900|                }
 1114|    940|            }
 1115|  2.41k|        }
 1116|       |
 1117|    394|        if (v2 != vLast)
  ------------------
  |  Branch (1117:13): [True: 0, False: 394]
  ------------------
 1118|      0|        {
 1119|      0|            err = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 1120|      0|        }
 1121|    394|    }
 1122|       |
 1123|    394|    return err ? err : ret;
  ------------------
  |  Branch (1123:12): [True: 0, False: 394]
  ------------------
 1124|    394|}
SetBondsFromBnStructFlow:
 1134|  26.1k|{
 1135|  26.1k|    int       pass, i, v0, v1, v2, ineigh1, ineigh2, vLast, n, delta, ret, ret_val, err = 0;
 1136|  26.1k|    BNS_EDGE *edge;
 1137|  26.1k|    int       bChangeFlowAdd; /* djb-rwth: removing redundant variables */
 1138|  26.1k|    int       bChangeFlow = ( bChangeFlow0 & ~BNS_EF_SET_NOSTEREO );
  ------------------
  |  |  377|  26.1k|#define BNS_EF_SET_NOSTEREO  32  /* in combination with BNS_EF_ALTR_BONDS only:
  ------------------
 1139|       |    /*
 1140|       |    bCheckMovingRad = (bChangeFlow & BNS_EF_ALTR_NS) == BNS_EF_ALTR_NS &&
 1141|       |    pBNS->tot_st_cap > pBNS->tot_st_flow;
 1142|       |    */
 1143|  53.1k|    for (pass = pBNS->num_altp - 1, ret = 0; 0 <= pass; pass--)
  ------------------
  |  Branch (1143:46): [True: 26.9k, False: 26.1k]
  ------------------
 1144|  26.9k|    {
 1145|  26.9k|        pBNS->alt_path = pBNS->altp[pass];
 1146|  26.9k|        v1 = ALTP_START_ATOM( pBNS->alt_path );
  ------------------
  |  |  103|  26.9k|#define ALTP_START_ATOM(altp)           (altp)[iALTP_START_ATOM].number
  ------------------
 1147|  26.9k|        n = ALTP_PATH_LEN( pBNS->alt_path );
  ------------------
  |  |  101|  26.9k|#define ALTP_PATH_LEN(altp)             (altp)[iALTP_PATH_LEN].number  /* number of bonds = number of atoms-1*/
  ------------------
 1148|  26.9k|        delta = ALTP_DELTA( pBNS->alt_path );
  ------------------
  |  |  112|  26.9k|#define ALTP_DELTA(altp)                 (altp)[iALTP_FLOW].flow[0]
  ------------------
 1149|  26.9k|        vLast = ALTP_END_ATOM( pBNS->alt_path );
  ------------------
  |  |  102|  26.9k|#define ALTP_END_ATOM(altp)             (altp)[iALTP_END_ATOM].number
  ------------------
 1150|  26.9k|        if (( bChangeFlow0 & BNS_EF_SET_NOSTEREO ) &&
  ------------------
  |  |  377|  26.9k|#define BNS_EF_SET_NOSTEREO  32  /* in combination with BNS_EF_ALTR_BONDS only:
  ------------------
  |  Branch (1150:13): [True: 9.69k, False: 17.2k]
  ------------------
 1151|  9.69k|            ( pBNS->vert[v1].st_edge.cap0 > pBNS->vert[v1].st_edge.flow0 ||
  ------------------
  |  Branch (1151:15): [True: 3.44k, False: 6.25k]
  ------------------
 1152|  6.25k|              pBNS->vert[vLast].st_edge.cap0 > pBNS->vert[vLast].st_edge.flow0 ))
  ------------------
  |  Branch (1152:15): [True: 4.03k, False: 2.22k]
  ------------------
 1153|  7.47k|        {
 1154|       |            /* djb-rwth: removing redundant code */
 1155|  7.47k|            bChangeFlowAdd = BNS_EF_SET_NOSTEREO;
  ------------------
  |  |  377|  7.47k|#define BNS_EF_SET_NOSTEREO  32  /* in combination with BNS_EF_ALTR_BONDS only:
  ------------------
 1156|  7.47k|            ret |= 2;
 1157|  7.47k|        }
 1158|  19.4k|        else
 1159|  19.4k|        {
 1160|  19.4k|            bChangeFlowAdd = 0;
 1161|  19.4k|        }
 1162|       |        /* start vertex */
 1163|  26.9k|        if (( bChangeFlow & BNS_EF_CHNG_RSTR ) == BNS_EF_CHNG_RSTR)
  ------------------
  |  |  372|  26.9k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  26.9k|#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)
  |  |  ------------------
  |  |  |  |  371|  26.9k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
                      if (( bChangeFlow & BNS_EF_CHNG_RSTR ) == BNS_EF_CHNG_RSTR)
  ------------------
  |  |  372|  26.9k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  26.9k|#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)
  |  |  ------------------
  |  |  |  |  371|  26.9k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
  |  Branch (1163:13): [True: 26.7k, False: 217]
  ------------------
 1164|  26.7k|        {
 1165|       |            /* Restore s-v1 edge flow to the BNS this pass input value */
 1166|  26.7k|            ; /*pBNS->vert[v1].st_edge.flow -= delta;*/
 1167|  26.7k|        }
 1168|    217|        else
 1169|    217|        {
 1170|    217|            if (( bChangeFlow & BNS_EF_SAVE_ALL ) == BNS_EF_SAVE_ALL)
  ------------------
  |  |  381|    217|#define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  370|    217|#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)
  |  |  ------------------
  |  |  |  |  373|    217|#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)
  |  |  ------------------
  |  |  |  |  375|    217|#define BNS_EF_UPD_RAD_ORI   16  /* update BN flow0 & Atom radical values:
  |  |  ------------------
  ------------------
                          if (( bChangeFlow & BNS_EF_SAVE_ALL ) == BNS_EF_SAVE_ALL)
  ------------------
  |  |  381|    217|#define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  370|    217|#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)
  |  |  ------------------
  |  |  |  |  373|    217|#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)
  |  |  ------------------
  |  |  |  |  375|    217|#define BNS_EF_UPD_RAD_ORI   16  /* update BN flow0 & Atom radical values:
  |  |  ------------------
  ------------------
  |  Branch (1170:17): [True: 217, False: 0]
  ------------------
 1171|    217|            {
 1172|    217|                if (v1 < num_atoms)
  ------------------
  |  Branch (1172:21): [True: 20, False: 197]
  ------------------
 1173|     20|                {
 1174|       |                    /* Will produce wrong result if called for v1 next time? */
 1175|     20|                    ret_val = SetAtomRadAndChemValFromVertexCapFlow( pBNS, at, v1 );
 1176|     20|                    if (ret_val < 0)
  ------------------
  |  Branch (1176:25): [True: 0, False: 20]
  ------------------
 1177|      0|                    {
 1178|      0|                        err = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 1179|      0|                    }
 1180|     20|                    else
 1181|     20|                    {
 1182|     20|                        ret |= ( ret_val > 0 );
 1183|     20|                    }
 1184|     20|                }
 1185|       |                /*pBNS->vert[v1].st_edge.flow0 = pBNS->vert[v1].st_edge.flow;*/
 1186|    217|            }
 1187|    217|        }
 1188|       |
 1189|  26.9k|        pBNS->vert[v1].st_edge.pass = 0;
 1190|       |
 1191|  26.9k|        v0 = v2 = NO_VERTEX;
  ------------------
  |  |  118|  26.9k|#define NO_VERTEX    -2
  ------------------
 1192|  90.7k|        for (i = 0; i < n; i++, delta = -delta, v0 = v1, v1 = v2)
  ------------------
  |  Branch (1192:21): [True: 63.8k, False: 26.9k]
  ------------------
 1193|  63.8k|        {
 1194|  63.8k|            ineigh1 = ALTP_THIS_ATOM_NEIGHBOR( pBNS->alt_path, i );  /* v1->v2 neighbor */
  ------------------
  |  |  104|  63.8k|#define ALTP_THIS_ATOM_NEIGHBOR(altp,X) (altp)[iALTP_NEIGHBOR+(X)].ineigh[0]  /* 0 <= X < path_len */
  ------------------
 1195|  63.8k|            ineigh2 = ALTP_NEXT_ATOM_NEIGHBOR( pBNS->alt_path, i );  /* v2->v1 neighbor */
  ------------------
  |  |  105|  63.8k|#define ALTP_NEXT_ATOM_NEIGHBOR(altp,X) (altp)[iALTP_NEIGHBOR+(X)].ineigh[1]
  ------------------
 1196|  63.8k|            edge = pBNS->edge + pBNS->vert[v1].iedge[ineigh1];
 1197|       |            /* follow the BN Structure, not the inp_ATOM, to take care of swithching to
 1198|       |            t-groups, c-groups or other fictitious edges/vertices
 1199|       |            */
 1200|       |
 1201|  63.8k|            v2 = edge->neighbor12 ^ v1;
 1202|       |
 1203|       |            /* change at->chem_bonds_valence 2004-03-08 */
 1204|  63.8k|            if (( bChangeFlow & BNS_EF_CHNG_BONDS ) && v1 < num_atoms)
  ------------------
  |  |  373|  63.8k|#define BNS_EF_CHNG_BONDS     4  /* change bonds in the structure according to the BN flow */
  ------------------
  |  Branch (1204:17): [True: 1.27k, False: 62.5k]
  |  Branch (1204:56): [True: 837, False: 434]
  ------------------
 1205|    837|            {
 1206|    837|                if (v0 >= num_atoms && v2 < num_atoms)
  ------------------
  |  Branch (1206:21): [True: 237, False: 600]
  |  Branch (1206:40): [True: 233, False: 4]
  ------------------
 1207|    233|                {
 1208|    233|                    at[v1].chem_bonds_valence += delta; /* change in v1-v2 bond order */
 1209|    233|                }
 1210|    604|                else
 1211|    604|                {
 1212|    604|                    if (v0 < num_atoms && v2 >= num_atoms && v0 != NO_VERTEX)
  ------------------
  |  |  118|    233|#define NO_VERTEX    -2
  ------------------
  |  Branch (1212:25): [True: 600, False: 4]
  |  Branch (1212:43): [True: 233, False: 367]
  |  Branch (1212:62): [True: 233, False: 0]
  ------------------
 1213|    233|                    {
 1214|    233|                        at[v1].chem_bonds_valence -= delta; /* change in v0-v1 bond order */
 1215|    233|                    }
 1216|    604|                }
 1217|    837|            }
 1218|       |
 1219|  63.8k|            if (!edge->pass)
  ------------------
  |  Branch (1219:17): [True: 620, False: 63.2k]
  ------------------
 1220|    620|            {
 1221|    620|                continue;
 1222|    620|            }
 1223|       |
 1224|  63.2k|            if (v1 < num_atoms && ineigh1 < at[v1].valence &&
  ------------------
  |  Branch (1224:17): [True: 57.1k, False: 6.06k]
  |  Branch (1224:35): [True: 39.6k, False: 17.4k]
  ------------------
 1225|  39.6k|                 v2 < num_atoms && ineigh2 < at[v2].valence)
  ------------------
  |  Branch (1225:18): [True: 39.6k, False: 0]
  |  Branch (1225:36): [True: 39.6k, False: 0]
  ------------------
 1226|  39.6k|            {
 1227|  39.6k|                if (( bChangeFlow0 & BNS_EF_ALTR_NS ) == BNS_EF_ALTR_NS &&
  ------------------
  |  |  382|  39.6k|#define BNS_EF_ALTR_NS      (BNS_EF_ALTR_BONDS | BNS_EF_SET_NOSTEREO)
  |  |  ------------------
  |  |  |  |  374|  39.6k|#define BNS_EF_ALTR_BONDS     8  /* make altern. bonds in the structure if the flow has changed */
  |  |  ------------------
  |  |               #define BNS_EF_ALTR_NS      (BNS_EF_ALTR_BONDS | BNS_EF_SET_NOSTEREO)
  |  |  ------------------
  |  |  |  |  377|  39.6k|#define BNS_EF_SET_NOSTEREO  32  /* in combination with BNS_EF_ALTR_BONDS only:
  |  |  ------------------
  ------------------
                              if (( bChangeFlow0 & BNS_EF_ALTR_NS ) == BNS_EF_ALTR_NS &&
  ------------------
  |  |  382|  79.3k|#define BNS_EF_ALTR_NS      (BNS_EF_ALTR_BONDS | BNS_EF_SET_NOSTEREO)
  |  |  ------------------
  |  |  |  |  374|  39.6k|#define BNS_EF_ALTR_BONDS     8  /* make altern. bonds in the structure if the flow has changed */
  |  |  ------------------
  |  |               #define BNS_EF_ALTR_NS      (BNS_EF_ALTR_BONDS | BNS_EF_SET_NOSTEREO)
  |  |  ------------------
  |  |  |  |  377|  39.6k|#define BNS_EF_SET_NOSTEREO  32  /* in combination with BNS_EF_ALTR_BONDS only:
  |  |  ------------------
  ------------------
  |  Branch (1227:21): [True: 11.2k, False: 28.4k]
  ------------------
 1228|  11.2k|                    ( bChangeFlow0 & BNS_EF_SAVE_ALL ) == BNS_EF_SAVE_ALL)
  ------------------
  |  |  381|  11.2k|#define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  370|  11.2k|#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)
  |  |  ------------------
  |  |  |  |  373|  11.2k|#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)
  |  |  ------------------
  |  |  |  |  375|  11.2k|#define BNS_EF_UPD_RAD_ORI   16  /* update BN flow0 & Atom radical values:
  |  |  ------------------
  ------------------
                                  ( bChangeFlow0 & BNS_EF_SAVE_ALL ) == BNS_EF_SAVE_ALL)
  ------------------
  |  |  381|  11.2k|#define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  370|  11.2k|#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)
  |  |  ------------------
  |  |  |  |  373|  11.2k|#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)
  |  |  ------------------
  |  |  |  |  375|  11.2k|#define BNS_EF_UPD_RAD_ORI   16  /* update BN flow0 & Atom radical values:
  |  |  ------------------
  ------------------
  |  Branch (1228:21): [True: 533, False: 10.7k]
  ------------------
 1229|    533|                {
 1230|       |                    /* 2004-07-02 special mode: save new ring bonds and mark as non-stereo non-ring bonds */
 1231|    533|                    if (at[v1].nRingSystem != at[v2].nRingSystem)
  ------------------
  |  Branch (1231:25): [True: 320, False: 213]
  ------------------
 1232|    320|                    {
 1233|       |                        /* Non-ring bond (bridge) */
 1234|    320|                        bChangeFlowAdd = BNS_EF_ALTR_NS;
  ------------------
  |  |  382|    320|#define BNS_EF_ALTR_NS      (BNS_EF_ALTR_BONDS | BNS_EF_SET_NOSTEREO)
  |  |  ------------------
  |  |  |  |  374|    320|#define BNS_EF_ALTR_BONDS     8  /* make altern. bonds in the structure if the flow has changed */
  |  |  ------------------
  |  |               #define BNS_EF_ALTR_NS      (BNS_EF_ALTR_BONDS | BNS_EF_SET_NOSTEREO)
  |  |  ------------------
  |  |  |  |  377|    320|#define BNS_EF_SET_NOSTEREO  32  /* in combination with BNS_EF_ALTR_BONDS only:
  |  |  ------------------
  ------------------
 1235|    320|                    }
 1236|    213|                    else
 1237|    213|                    {
 1238|       |                        /* Ring bond */
 1239|    213|                        bChangeFlowAdd = 0;
 1240|    213|                    }
 1241|    533|                }
 1242|       |                /* Change bonds on the first pass only: in this case all flow correspond to the BNS output */
 1243|  39.6k|                ret_val = SetAtomBondType( edge, &at[v1].bond_type[ineigh1], &at[v2].bond_type[ineigh2], delta, bChangeFlow | bChangeFlowAdd );
 1244|  39.6k|                if (ret_val < 0)
  ------------------
  |  Branch (1244:21): [True: 0, False: 39.6k]
  ------------------
 1245|      0|                {
 1246|      0|                    err = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 1247|      0|                }
 1248|  39.6k|                else
 1249|  39.6k|                {
 1250|  39.6k|                    ret |= ( ret_val > 0 );
 1251|  39.6k|                }
 1252|  39.6k|            }
 1253|  63.2k|            edge->pass = 0;
 1254|  63.2k|        }
 1255|       |
 1256|  26.9k|        if (v2 != vLast)
  ------------------
  |  Branch (1256:13): [True: 0, False: 26.9k]
  ------------------
 1257|      0|        {
 1258|      0|            err = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 1259|      0|        }
 1260|  26.9k|        else
 1261|  26.9k|        {
 1262|  26.9k|            if (( bChangeFlow & BNS_EF_CHNG_RSTR ) == BNS_EF_CHNG_RSTR)
  ------------------
  |  |  372|  26.9k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  26.9k|#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)
  |  |  ------------------
  |  |  |  |  371|  26.9k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
                          if (( bChangeFlow & BNS_EF_CHNG_RSTR ) == BNS_EF_CHNG_RSTR)
  ------------------
  |  |  372|  26.9k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  26.9k|#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)
  |  |  ------------------
  |  |  |  |  371|  26.9k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
  |  Branch (1262:17): [True: 26.7k, False: 217]
  ------------------
 1263|  26.7k|            {
 1264|       |                /* Restore v2-t edge flow to the BNS this pass input value */
 1265|       |                /* "+=" instead of "-=" explanation: delta must have same sign as at the last edge */
 1266|  26.7k|                ; /*pBNS->vert[v2].st_edge.flow += delta; */
 1267|  26.7k|            }
 1268|    217|            else
 1269|    217|            {
 1270|    217|                if (( bChangeFlow & BNS_EF_SAVE_ALL ) == BNS_EF_SAVE_ALL)
  ------------------
  |  |  381|    217|#define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  370|    217|#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)
  |  |  ------------------
  |  |  |  |  373|    217|#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)
  |  |  ------------------
  |  |  |  |  375|    217|#define BNS_EF_UPD_RAD_ORI   16  /* update BN flow0 & Atom radical values:
  |  |  ------------------
  ------------------
                              if (( bChangeFlow & BNS_EF_SAVE_ALL ) == BNS_EF_SAVE_ALL)
  ------------------
  |  |  381|    217|#define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  370|    217|#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)
  |  |  ------------------
  |  |  |  |  373|    217|#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)
  |  |  ------------------
  |  |  |  |  375|    217|#define BNS_EF_UPD_RAD_ORI   16  /* update BN flow0 & Atom radical values:
  |  |  ------------------
  ------------------
  |  Branch (1270:21): [True: 217, False: 0]
  ------------------
 1271|    217|                {
 1272|    217|                    if (v2 < num_atoms)
  ------------------
  |  Branch (1272:25): [True: 20, False: 197]
  ------------------
 1273|     20|                    {
 1274|     20|                        ret_val = SetAtomRadAndChemValFromVertexCapFlow( pBNS, at, v2 );
 1275|     20|                        if (ret_val < 0)
  ------------------
  |  Branch (1275:29): [True: 0, False: 20]
  ------------------
 1276|      0|                        {
 1277|      0|                            err = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 1278|      0|                        }
 1279|     20|                        else
 1280|     20|                        {
 1281|     20|                            ret |= ( ret_val > 0 );
 1282|     20|                        }
 1283|     20|                    }
 1284|       |                    /*pBNS->vert[v2].st_edge.flow0 = pBNS->vert[v2].st_edge.flow;*/
 1285|    217|                }
 1286|    217|            }
 1287|  26.9k|        }
 1288|  26.9k|        pBNS->vert[v2].st_edge.pass = 0;
 1289|  26.9k|    }
 1290|       |
 1291|  26.1k|    return err ? err : ret;
  ------------------
  |  Branch (1291:12): [True: 0, False: 26.1k]
  ------------------
 1292|  26.1k|}
RestoreBnStructFlow:
 1491|  27.7k|{
 1492|  27.7k|    int       pass, i, v1, v2, ineigh1, ineigh2, vLast, n, delta, ret, err = 0; /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 1493|  27.7k|    BNS_EDGE *edge;
 1494|       |
 1495|  56.3k|    for (pass = pBNS->num_altp - 1, ret = 0; 0 <= pass; pass--)
  ------------------
  |  Branch (1495:46): [True: 28.6k, False: 27.7k]
  ------------------
 1496|  28.6k|    {
 1497|  28.6k|        pBNS->alt_path = pBNS->altp[pass];
 1498|  28.6k|        v1 = ALTP_START_ATOM( pBNS->alt_path );
  ------------------
  |  |  103|  28.6k|#define ALTP_START_ATOM(altp)           (altp)[iALTP_START_ATOM].number
  ------------------
 1499|  28.6k|        n = ALTP_PATH_LEN( pBNS->alt_path );
  ------------------
  |  |  101|  28.6k|#define ALTP_PATH_LEN(altp)             (altp)[iALTP_PATH_LEN].number  /* number of bonds = number of atoms-1*/
  ------------------
 1500|  28.6k|        delta = ALTP_DELTA( pBNS->alt_path );
  ------------------
  |  |  112|  28.6k|#define ALTP_DELTA(altp)                 (altp)[iALTP_FLOW].flow[0]
  ------------------
 1501|  28.6k|        vLast = ALTP_END_ATOM( pBNS->alt_path );
  ------------------
  |  |  102|  28.6k|#define ALTP_END_ATOM(altp)             (altp)[iALTP_END_ATOM].number
  ------------------
 1502|  28.6k|        v2 = NO_VERTEX;
  ------------------
  |  |  118|  28.6k|#define NO_VERTEX    -2
  ------------------
 1503|       |        /* starting vertex */
 1504|  28.6k|        if (( bChangeFlow & BNS_EF_CHNG_RSTR ) == BNS_EF_CHNG_RSTR)
  ------------------
  |  |  372|  28.6k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  28.6k|#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)
  |  |  ------------------
  |  |  |  |  371|  28.6k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
                      if (( bChangeFlow & BNS_EF_CHNG_RSTR ) == BNS_EF_CHNG_RSTR)
  ------------------
  |  |  372|  28.6k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  28.6k|#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)
  |  |  ------------------
  |  |  |  |  371|  28.6k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
  |  Branch (1504:13): [True: 28.4k, False: 217]
  ------------------
 1505|  28.4k|        {
 1506|  28.4k|            pBNS->vert[v1].st_edge.flow -= delta; /* restore s-v1 edge flow to the BNS input value */
 1507|  28.4k|        }
 1508|    217|        else
 1509|    217|        {
 1510|    217|            if (( bChangeFlow & BNS_EF_SAVE_ALL ) == BNS_EF_SAVE_ALL)
  ------------------
  |  |  381|    217|#define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  370|    217|#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)
  |  |  ------------------
  |  |  |  |  373|    217|#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)
  |  |  ------------------
  |  |  |  |  375|    217|#define BNS_EF_UPD_RAD_ORI   16  /* update BN flow0 & Atom radical values:
  |  |  ------------------
  ------------------
                          if (( bChangeFlow & BNS_EF_SAVE_ALL ) == BNS_EF_SAVE_ALL)
  ------------------
  |  |  381|    217|#define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  370|    217|#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)
  |  |  ------------------
  |  |  |  |  373|    217|#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)
  |  |  ------------------
  |  |  |  |  375|    217|#define BNS_EF_UPD_RAD_ORI   16  /* update BN flow0 & Atom radical values:
  |  |  ------------------
  ------------------
  |  Branch (1510:17): [True: 20, False: 197]
  ------------------
 1511|     20|            {
 1512|     20|                pBNS->vert[v1].st_edge.flow0 = pBNS->vert[v1].st_edge.flow;
 1513|     20|            }
 1514|    217|        }
 1515|       |
 1516|       |        /* Augmenting path edges */
 1517|  94.5k|        for (i = 0; i < n; i++, delta = -delta, v1 = v2)
  ------------------
  |  Branch (1517:21): [True: 65.9k, False: 28.6k]
  ------------------
 1518|  65.9k|        {
 1519|  65.9k|            ineigh1 = ALTP_THIS_ATOM_NEIGHBOR( pBNS->alt_path, i );  /* v1->v2 neighbor */
  ------------------
  |  |  104|  65.9k|#define ALTP_THIS_ATOM_NEIGHBOR(altp,X) (altp)[iALTP_NEIGHBOR+(X)].ineigh[0]  /* 0 <= X < path_len */
  ------------------
 1520|  65.9k|            ineigh2 = ALTP_NEXT_ATOM_NEIGHBOR(pBNS->alt_path, i);  /* v2->v1 neighbor */ /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  105|  65.9k|#define ALTP_NEXT_ATOM_NEIGHBOR(altp,X) (altp)[iALTP_NEIGHBOR+(X)].ineigh[1]
  ------------------
 1521|  65.9k|            edge = pBNS->edge + pBNS->vert[v1].iedge[ineigh1];
 1522|  65.9k|            v2 = edge->neighbor12 ^ v1;
 1523|  65.9k|            RestoreEdgeFlow( edge, delta, bChangeFlow );
 1524|  65.9k|            edge->pass = 0;
 1525|  65.9k|        }
 1526|       |
 1527|       |        /* Ending vertex */
 1528|  28.6k|        if (v2 != vLast)
  ------------------
  |  Branch (1528:13): [True: 0, False: 28.6k]
  ------------------
 1529|      0|        {
 1530|      0|            err = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 1531|      0|        }
 1532|  28.6k|        else
 1533|  28.6k|        {
 1534|  28.6k|            if (( bChangeFlow & BNS_EF_CHNG_RSTR ) == BNS_EF_CHNG_RSTR)
  ------------------
  |  |  372|  28.6k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  28.6k|#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)
  |  |  ------------------
  |  |  |  |  371|  28.6k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
                          if (( bChangeFlow & BNS_EF_CHNG_RSTR ) == BNS_EF_CHNG_RSTR)
  ------------------
  |  |  372|  28.6k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  28.6k|#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)
  |  |  ------------------
  |  |  |  |  371|  28.6k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
  |  Branch (1534:17): [True: 28.4k, False: 217]
  ------------------
 1535|  28.4k|            {
 1536|       |                /* Restore v2-t edge flow to the original value */
 1537|       |                /* "+=" instead of "-=" explanation: delta must have same sign as at the last edge */
 1538|  28.4k|                pBNS->vert[v2].st_edge.flow += delta;
 1539|  28.4k|            }
 1540|    217|            else
 1541|    217|            {
 1542|    217|                if (( bChangeFlow & BNS_EF_SAVE_ALL ) == BNS_EF_SAVE_ALL)
  ------------------
  |  |  381|    217|#define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  370|    217|#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)
  |  |  ------------------
  |  |  |  |  373|    217|#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)
  |  |  ------------------
  |  |  |  |  375|    217|#define BNS_EF_UPD_RAD_ORI   16  /* update BN flow0 & Atom radical values:
  |  |  ------------------
  ------------------
                              if (( bChangeFlow & BNS_EF_SAVE_ALL ) == BNS_EF_SAVE_ALL)
  ------------------
  |  |  381|    217|#define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  370|    217|#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)
  |  |  ------------------
  |  |  |  |  373|    217|#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)
  |  |  ------------------
  |  |  |  |  375|    217|#define BNS_EF_UPD_RAD_ORI   16  /* update BN flow0 & Atom radical values:
  |  |  ------------------
  ------------------
  |  Branch (1542:21): [True: 20, False: 197]
  ------------------
 1543|     20|                {
 1544|     20|                    pBNS->vert[v2].st_edge.flow0 = pBNS->vert[v2].st_edge.flow;
 1545|     20|                }
 1546|    217|            }
 1547|  28.6k|        }
 1548|  28.6k|    }
 1549|       |
 1550|  27.7k|    return err ? err : ret;
  ------------------
  |  Branch (1550:12): [True: 0, False: 27.7k]
  ------------------
 1551|  27.7k|}
bNeedToTestTheFlow:
 1558|  89.6k|{
 1559|  89.6k|    int nBondType = ( BOND_TYPE_MASK & bond_type );
  ------------------
  |  |  189|  89.6k|#define BOND_TYPE_MASK        0x0f
  ------------------
 1560|  89.6k|    int nBondAttrib = ( BOND_MARK_MASK & bond_type );
  ------------------
  |  |  198|  89.6k|#define BOND_MARK_MASK        0x70
  ------------------
 1561|       |
 1562|  89.6k|    if (bTestForNonStereoBond)
  ------------------
  |  Branch (1562:9): [True: 38.5k, False: 51.0k]
  ------------------
 1563|  38.5k|    {
 1564|  38.5k|        if (nBondAttrib || nBondType == BOND_ALTERN || nBondType == BOND_ALT12NS)
  ------------------
  |  |  180|  25.5k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|  64.1k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                      if (nBondAttrib || nBondType == BOND_ALTERN || nBondType == BOND_ALT12NS)
  ------------------
  |  |  186|  25.5k|#define BOND_ALT12NS             9
  ------------------
  |  Branch (1564:13): [True: 12.9k, False: 25.5k]
  |  Branch (1564:28): [True: 0, False: 25.5k]
  |  Branch (1564:56): [True: 0, False: 25.5k]
  ------------------
 1565|  12.9k|        {
 1566|  12.9k|            switch (nTestFlow)
  ------------------
  |  Branch (1566:21): [True: 12.9k, False: 0]
  ------------------
 1567|  12.9k|            {
 1568|  3.23k|                case 0:  /* single: can be 1 (single)?  */
  ------------------
  |  Branch (1568:17): [True: 3.23k, False: 9.76k]
  ------------------
 1569|  3.23k|                    if (nBondAttrib == BOND_MARK_ALT12NS ||
  ------------------
  |  |  197|  6.47k|#define BOND_MARK_ALT12NS     0x50  /* 1 or 2, non-stereo                   */
  ------------------
  |  Branch (1569:25): [True: 1.85k, False: 1.38k]
  ------------------
 1570|  1.38k|                         nBondAttrib == BOND_MARK_ALT123 ||
  ------------------
  |  |  194|  4.62k|#define BOND_MARK_ALT123      0x20
  ------------------
  |  Branch (1570:26): [True: 372, False: 1.01k]
  ------------------
 1571|  1.01k|                         nBondAttrib == BOND_MARK_ALT13)
  ------------------
  |  |  195|  1.01k|#define BOND_MARK_ALT13       0x30
  ------------------
  |  Branch (1571:26): [True: 1, False: 1.01k]
  ------------------
 1572|  2.22k|                    {
 1573|  2.22k|                        return 0; /* yes, already checked */
 1574|  2.22k|                    }
 1575|  1.01k|                    break;
 1576|       |
 1577|  8.02k|                case 1:  /* double: can be 2 (double)? */
  ------------------
  |  Branch (1577:17): [True: 8.02k, False: 4.97k]
  ------------------
 1578|  8.02k|                    if (nBondAttrib == BOND_MARK_ALT12NS ||
  ------------------
  |  |  197|  16.0k|#define BOND_MARK_ALT12NS     0x50  /* 1 or 2, non-stereo                   */
  ------------------
  |  Branch (1578:25): [True: 6.22k, False: 1.80k]
  ------------------
 1579|  1.80k|                         nBondAttrib == BOND_MARK_ALT123 ||
  ------------------
  |  |  194|  9.82k|#define BOND_MARK_ALT123      0x20
  ------------------
  |  Branch (1579:26): [True: 207, False: 1.59k]
  ------------------
 1580|  1.59k|                         nBondAttrib == BOND_MARK_ALT23)
  ------------------
  |  |  196|  1.59k|#define BOND_MARK_ALT23       0x40
  ------------------
  |  Branch (1580:26): [True: 601, False: 995]
  ------------------
 1581|  7.02k|                    {
 1582|  7.02k|                        return 0; /* yes, already checked */
 1583|  7.02k|                    }
 1584|    995|                    break;
 1585|  1.73k|                case 2:  /* triple: can be 3 (triple)?  */
  ------------------
  |  Branch (1585:17): [True: 1.73k, False: 11.2k]
  ------------------
 1586|  1.73k|                    if (nBondAttrib == BOND_MARK_ALT13 ||
  ------------------
  |  |  195|  3.47k|#define BOND_MARK_ALT13       0x30
  ------------------
  |  Branch (1586:25): [True: 0, False: 1.73k]
  ------------------
 1587|  1.73k|                         nBondAttrib == BOND_MARK_ALT123 ||
  ------------------
  |  |  194|  3.47k|#define BOND_MARK_ALT123      0x20
  ------------------
  |  Branch (1587:26): [True: 274, False: 1.46k]
  ------------------
 1588|  1.46k|                         nBondAttrib == BOND_MARK_ALT23)
  ------------------
  |  |  196|  1.46k|#define BOND_MARK_ALT23       0x40
  ------------------
  |  Branch (1588:26): [True: 732, False: 731]
  ------------------
 1589|  1.00k|                    {
 1590|  1.00k|                        return 0; /* yes, already checked */
 1591|  1.00k|                    }
 1592|    731|                    break;
 1593|  12.9k|            }
 1594|  12.9k|        }
 1595|  38.5k|    }
 1596|  51.0k|    else
 1597|  51.0k|    {
 1598|  51.0k|        if (nBondAttrib || nBondType == BOND_ALTERN || nBondType == BOND_ALT12NS)
  ------------------
  |  |  180|  37.0k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|  88.1k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                      if (nBondAttrib || nBondType == BOND_ALTERN || nBondType == BOND_ALT12NS)
  ------------------
  |  |  186|  37.0k|#define BOND_ALT12NS             9
  ------------------
  |  Branch (1598:13): [True: 13.9k, False: 37.0k]
  |  Branch (1598:28): [True: 0, False: 37.0k]
  |  Branch (1598:56): [True: 0, False: 37.0k]
  ------------------
 1599|  13.9k|        {
 1600|  13.9k|            switch (nTestFlow)
  ------------------
  |  Branch (1600:21): [True: 13.9k, False: 0]
  ------------------
 1601|  13.9k|            {
 1602|  5.34k|                case 0:  /* single: can be 1 (single)?  */
  ------------------
  |  Branch (1602:17): [True: 5.34k, False: 8.64k]
  ------------------
 1603|  5.34k|                    if (nBondAttrib == BOND_MARK_ALT12 ||
  ------------------
  |  |  193|  10.6k|#define BOND_MARK_ALT12       0x10
  ------------------
  |  Branch (1603:25): [True: 2.81k, False: 2.53k]
  ------------------
 1604|  2.53k|                         nBondAttrib == BOND_MARK_ALT12NS ||
  ------------------
  |  |  197|  7.88k|#define BOND_MARK_ALT12NS     0x50  /* 1 or 2, non-stereo                   */
  ------------------
  |  Branch (1604:26): [True: 2.07k, False: 461]
  ------------------
 1605|    461|                         nBondAttrib == BOND_MARK_ALT123 ||
  ------------------
  |  |  194|  5.81k|#define BOND_MARK_ALT123      0x20
  ------------------
  |  Branch (1605:26): [True: 326, False: 135]
  ------------------
 1606|    135|                         nBondAttrib == BOND_MARK_ALT13)
  ------------------
  |  |  195|    135|#define BOND_MARK_ALT13       0x30
  ------------------
  |  Branch (1606:26): [True: 0, False: 135]
  ------------------
 1607|  5.21k|                    {
 1608|  5.21k|                        return 0;
 1609|  5.21k|                    }
 1610|    135|                    break;
 1611|       |
 1612|  7.56k|                case 1:  /* double: can be 2 (double)? */
  ------------------
  |  Branch (1612:17): [True: 7.56k, False: 6.43k]
  ------------------
 1613|  7.56k|                    if (nBondAttrib == BOND_MARK_ALT12 ||
  ------------------
  |  |  193|  15.1k|#define BOND_MARK_ALT12       0x10
  ------------------
  |  Branch (1613:25): [True: 3.21k, False: 4.35k]
  ------------------
 1614|  4.35k|                         nBondAttrib == BOND_MARK_ALT12NS ||
  ------------------
  |  |  197|  11.9k|#define BOND_MARK_ALT12NS     0x50  /* 1 or 2, non-stereo                   */
  ------------------
  |  Branch (1614:26): [True: 3.54k, False: 811]
  ------------------
 1615|    811|                         nBondAttrib == BOND_MARK_ALT123 ||
  ------------------
  |  |  194|  8.37k|#define BOND_MARK_ALT123      0x20
  ------------------
  |  Branch (1615:26): [True: 526, False: 285]
  ------------------
 1616|    285|                         nBondAttrib == BOND_MARK_ALT23)
  ------------------
  |  |  196|    285|#define BOND_MARK_ALT23       0x40
  ------------------
  |  Branch (1616:26): [True: 126, False: 159]
  ------------------
 1617|  7.40k|                    {
 1618|  7.40k|                        return 0; /* yes */
 1619|  7.40k|                    }
 1620|    159|                    break;
 1621|  1.08k|                case 2:  /* triple: can be 3 (triple)?  */
  ------------------
  |  Branch (1621:17): [True: 1.08k, False: 12.9k]
  ------------------
 1622|  1.08k|                    if (nBondAttrib == BOND_MARK_ALT13 ||
  ------------------
  |  |  195|  2.16k|#define BOND_MARK_ALT13       0x30
  ------------------
  |  Branch (1622:25): [True: 0, False: 1.08k]
  ------------------
 1623|  1.08k|                         nBondAttrib == BOND_MARK_ALT123 ||
  ------------------
  |  |  194|  2.16k|#define BOND_MARK_ALT123      0x20
  ------------------
  |  Branch (1623:26): [True: 426, False: 658]
  ------------------
 1624|    658|                         nBondAttrib == BOND_MARK_ALT23)
  ------------------
  |  |  196|    658|#define BOND_MARK_ALT23       0x40
  ------------------
  |  Branch (1624:26): [True: 226, False: 432]
  ------------------
 1625|    652|                    {
 1626|    652|                        return 0;
 1627|    652|                    }
 1628|    432|                    break;
 1629|  13.9k|            }
 1630|  13.9k|        }
 1631|  51.0k|    }
 1632|       |
 1633|  66.1k|    return 1;
 1634|  89.6k|}
nBondsValenceInpAt:
 1641|  1.41M|{
 1642|  1.41M|    int j, bond_type, nBondsValence = 0, nAltBonds = 0, nNumWrong = 0;
 1643|  2.14M|    for (j = 0; j < at->valence; j++)
  ------------------
  |  Branch (1643:17): [True: 727k, False: 1.41M]
  ------------------
 1644|   727k|    {
 1645|   727k|        bond_type = at->bond_type[j] & BOND_TYPE_MASK;
  ------------------
  |  |  189|   727k|#define BOND_TYPE_MASK        0x0f
  ------------------
 1646|   727k|        switch (bond_type)
 1647|   727k|        {
 1648|      0|            case 0:  /* for structure from InChI reconstruction */
  ------------------
  |  Branch (1648:13): [True: 0, False: 727k]
  ------------------
 1649|   477k|            case BOND_SINGLE:
  ------------------
  |  |  177|   477k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|   477k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (1649:13): [True: 477k, False: 250k]
  ------------------
 1650|   648k|            case BOND_DOUBLE:
  ------------------
  |  |  178|   648k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|   648k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (1650:13): [True: 171k, False: 556k]
  ------------------
 1651|   727k|            case BOND_TRIPLE:
  ------------------
  |  |  179|   727k|#define BOND_TRIPLE BOND_TYPE_TRIPLE  /* 3                                  */
  |  |  ------------------
  |  |  |  |   34|   727k|#define BOND_TYPE_TRIPLE    3
  |  |  ------------------
  ------------------
  |  Branch (1651:13): [True: 79.1k, False: 648k]
  ------------------
 1652|   727k|                nBondsValence += bond_type;
 1653|   727k|                break;
 1654|      0|            case BOND_ALTERN:
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (1654:13): [True: 0, False: 727k]
  ------------------
 1655|      0|                nAltBonds++;
 1656|      0|                break;
 1657|      0|            default:
  ------------------
  |  Branch (1657:13): [True: 0, False: 727k]
  ------------------
 1658|      0|                nNumWrong++;
 1659|   727k|        }
 1660|   727k|    }
 1661|  1.41M|    switch (nAltBonds)
 1662|  1.41M|    {
 1663|  1.41M|        case 0:
  ------------------
  |  Branch (1663:9): [True: 1.41M, False: 0]
  ------------------
 1664|  1.41M|            break;
 1665|      0|        case 1:
  ------------------
  |  Branch (1665:9): [True: 0, False: 1.41M]
  ------------------
 1666|      0|            nBondsValence += 1; /* 1 or greater than 3 is wrong */
 1667|      0|            nNumWrong++;
 1668|      0|            break;
 1669|      0|        default:
  ------------------
  |  Branch (1669:9): [True: 0, False: 1.41M]
  ------------------
 1670|      0|            nBondsValence += nAltBonds + 1;
 1671|      0|            break;
 1672|  1.41M|    }
 1673|  1.41M|    if (nNumAltBonds)
  ------------------
  |  Branch (1673:9): [True: 1.09M, False: 318k]
  ------------------
 1674|  1.09M|    {
 1675|  1.09M|        *nNumAltBonds = nAltBonds;
 1676|  1.09M|    }
 1677|  1.41M|    if (nNumWrongBonds)
  ------------------
  |  Branch (1677:9): [True: 1.09M, False: 318k]
  ------------------
 1678|  1.09M|    {
 1679|  1.09M|        *nNumWrongBonds = nNumWrong;
 1680|  1.09M|    }
 1681|       |
 1682|  1.41M|    return nBondsValence;
 1683|  1.41M|}
BnsAdjustFlowBondsRad:
 1694|   288k|{
 1695|   288k|    int  bError = 0, nOrigDelta = 0, ret, num_removed;
 1696|       |
 1697|   288k|#if( CHECK_AROMBOND2ALT == 1 )
 1698|   288k|    int *pcValMinusBondsVal = NULL;
 1699|   288k|    int  i, nValMinusBondsVal, nAltBonds, bIgnore, valen, is_rad, excess;
 1700|       |
 1701|       |    /* Find valence excess (it may only be due to aromatic bonds) */
 1702|  1.38M|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1702:17): [True: 1.09M, False: 288k]
  ------------------
 1703|  1.09M|    {
 1704|  1.09M|        valen = nBondsValenceInpAt( at + i, &nAltBonds, &bIgnore );
 1705|  1.09M|        nValMinusBondsVal = (int) at[i].chem_bonds_valence - valen;
 1706|  1.09M|        bIgnore += ( nAltBonds > 3 );
 1707|  1.09M|        if (!bIgnore && nValMinusBondsVal > 0)
  ------------------
  |  Branch (1707:13): [True: 1.09M, False: 0]
  |  Branch (1707:25): [True: 0, False: 1.09M]
  ------------------
 1708|      0|        {
 1709|      0|            if (!pcValMinusBondsVal &&
  ------------------
  |  Branch (1709:17): [True: 0, False: 0]
  ------------------
 1710|      0|                 !( pcValMinusBondsVal = (int *) inchi_calloc( num_atoms, sizeof( pcValMinusBondsVal[0] ) ) ))
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (1710:18): [True: 0, False: 0]
  ------------------
 1711|      0|            {
 1712|      0|                bError = BNS_OUT_OF_RAM;
  ------------------
  |  |   49|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 1713|      0|                goto exit_function;
 1714|      0|            }
 1715|       |            /* Mark atoms that have extra unsatisfied valence due to aromatic bonds */
 1716|      0|            is_rad = ( at[i].radical == RADICAL_DOUBLET );
  ------------------
  |  |   76|      0|#define RADICAL_DOUBLET 2
  ------------------
 1717|      0|            excess = nValMinusBondsVal + is_rad;
 1718|      0|            pcValMinusBondsVal[i] = excess;
 1719|      0|        }
 1720|  1.09M|    }
 1721|   288k|#endif /* CHECK_AROMBOND2ALT */
 1722|       |
 1723|       |    /* Match bonds to valences */
 1724|   288k|    do
 1725|   288k|    {
 1726|   288k|        num_removed = 0;
 1727|   288k|        ret = RunBalancedNetworkSearch( pBNS, pBD, BNS_EF_CHNG_FLOW );
  ------------------
  |  |  370|   288k|#define BNS_EF_CHNG_FLOW      1  /* change Balanced Network (BN) flow inside the BNS search */
  ------------------
 1728|   288k|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|   288k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   288k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   288k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   288k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 288k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 288k]
  |  |  ------------------
  ------------------
 1729|      0|        {
 1730|      0|            bError = ret;
 1731|      0|        }
 1732|   288k|        else
 1733|   288k|        {
 1734|   288k|            nOrigDelta += ret;
 1735|   288k|            num_removed = pBNS->num_altp; /* number of augmenting paths */
 1736|   288k|            if (ret > 0)
  ------------------
  |  Branch (1736:17): [True: 19, False: 288k]
  ------------------
 1737|     19|            {
 1738|       |                /* save new bonds in at[] and flows in pBNS and at[] */
 1739|     19|                ret = SetBondsFromBnStructFlow( pBNS, at, num_atoms, BNS_EF_SAVE_ALL ); /* must include 1: 5=(4|1) */
  ------------------
  |  |  381|     19|#define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  370|     19|#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)
  |  |  ------------------
  |  |  |  |  373|     19|#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)
  |  |  ------------------
  |  |  |  |  375|     19|#define BNS_EF_UPD_RAD_ORI   16  /* update BN flow0 & Atom radical values:
  |  |  ------------------
  ------------------
 1740|     19|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|     19|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|     19|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|     19|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|     19|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 19, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 19]
  |  |  ------------------
  ------------------
 1741|      0|                {
 1742|      0|                    bError = ret;
 1743|      0|                }
 1744|     19|                ret = RestoreBnStructFlow( pBNS, BNS_EF_SAVE_ALL ); /* must include 1: 5=(4|1) */
  ------------------
  |  |  381|     19|#define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  370|     19|#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)
  |  |  ------------------
  |  |  |  |  373|     19|#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)
  |  |  ------------------
  |  |  |  |  375|     19|#define BNS_EF_UPD_RAD_ORI   16  /* update BN flow0 & Atom radical values:
  |  |  ------------------
  ------------------
 1745|     19|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|     19|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|     19|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|     19|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|     19|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 19, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 19]
  |  |  ------------------
  ------------------
 1746|      0|                {
 1747|      0|                    bError = ret;
 1748|      0|                }
 1749|     19|            }
 1750|   288k|            ReInitBnStructAltPaths( pBNS );
 1751|   288k|        }
 1752|   288k|    } while (num_removed && num_removed == pBNS->max_altp && !bError);
  ------------------
  |  Branch (1752:14): [True: 19, False: 288k]
  |  Branch (1752:29): [True: 0, False: 19]
  |  Branch (1752:62): [True: 0, False: 0]
  ------------------
 1753|       |
 1754|   288k|#if( CHECK_AROMBOND2ALT == 1 )
 1755|       |    /* Check whether aromatic bonds have been replaced with alternating bonds */
 1756|   288k|    if (!bError && pcValMinusBondsVal)
  ------------------
  |  Branch (1756:9): [True: 288k, False: 0]
  |  Branch (1756:20): [True: 0, False: 288k]
  ------------------
 1757|      0|    {
 1758|      0|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1758:21): [True: 0, False: 0]
  ------------------
 1759|      0|        {
 1760|      0|            if (!pcValMinusBondsVal[i])
  ------------------
  |  Branch (1760:17): [True: 0, False: 0]
  ------------------
 1761|      0|            {
 1762|      0|                continue;
 1763|      0|            }
 1764|      0|            valen = nBondsValenceInpAt( at + i, &nAltBonds, &bIgnore );
 1765|      0|            nValMinusBondsVal = (int) at[i].chem_bonds_valence - valen;
 1766|      0|            is_rad = ( at[i].radical == RADICAL_DOUBLET );
  ------------------
  |  |   76|      0|#define RADICAL_DOUBLET 2
  ------------------
 1767|      0|            excess = nValMinusBondsVal + is_rad;
 1768|      0|            if (bIgnore ||
  ------------------
  |  Branch (1768:17): [True: 0, False: 0]
  ------------------
 1769|      0|                ( pcValMinusBondsVal[i] - excess ) != 1)
  ------------------
  |  Branch (1769:17): [True: 0, False: 0]
  ------------------
 1770|      0|            {
 1771|       |                /* radical excess has not been reduced */
 1772|      0|                bError = BNS_ALTBOND_ERR;
  ------------------
  |  |   61|      0|#define BNS_ALTBOND_ERR    (BNS_ERR + 13) /*(-9986)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 1773|      0|                break;
 1774|      0|            }
 1775|      0|        }
 1776|      0|    }
 1777|       |
 1778|   288k|exit_function:
 1779|   288k|    if (pcValMinusBondsVal)
  ------------------
  |  Branch (1779:9): [True: 0, False: 288k]
  ------------------
 1780|      0|    {
 1781|      0|        inchi_free( pcValMinusBondsVal );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1782|      0|    }
 1783|   288k|#endif /* CHECK_AROMBOND2ALT */
 1784|       |
 1785|   288k|    return bError ? bError : nOrigDelta;
  ------------------
  |  Branch (1785:12): [True: 0, False: 288k]
  ------------------
 1786|   288k|}
BnsTestAndMarkAltBonds:
 1797|   293k|{
 1798|   293k|    int ret, iat, ineigh, neigh;
 1799|   293k|    int nMinFlow, nMaxFlow, nTestFlow, nCurFlow;
 1800|   293k|    int iedge, bError, nDots, nChanges, bTestForNonStereoBond; /* djb-rwth: removing redundant variables */
 1801|       |
 1802|       |    /* Normalize bonds and find tautomeric groups */
 1803|   293k|    bError = 0;
 1804|   293k|    nChanges = 0;
 1805|   293k|    bTestForNonStereoBond = pBNS->tot_st_cap > pBNS->tot_st_flow;
 1806|       |
 1807|  1.42M|    for (iat = 0; iat < num_atoms && !bError; iat++)
  ------------------
  |  Branch (1807:19): [True: 1.12M, False: 293k]
  |  Branch (1807:38): [True: 1.12M, False: 0]
  ------------------
 1808|  1.12M|    {
 1809|  1.66M|        for (ineigh = 0; ineigh < at[iat].valence && !bError; ineigh++)
  ------------------
  |  Branch (1809:26): [True: 539k, False: 1.12M]
  |  Branch (1809:54): [True: 539k, False: 0]
  ------------------
 1810|   539k|        {
 1811|   539k|            neigh = at[iat].neighbor[ineigh];
 1812|   539k|            if (neigh < iat)
  ------------------
  |  Branch (1812:17): [True: 269k, False: 269k]
  ------------------
 1813|   269k|            {
 1814|   269k|                continue; /* we have already tested the bond */
 1815|   269k|            }
 1816|   269k|            iedge = pBNS->vert[iat].iedge[ineigh];
 1817|   269k|            if (IS_FORBIDDEN( pBNS->edge[iedge].forbidden, pBNS ))
  ------------------
  |  |   41|   269k|#define IS_FORBIDDEN(EDGE_FORBIDDEN, PBNS)     (EDGE_FORBIDDEN)
  |  |  ------------------
  |  |  |  Branch (41:48): [True: 8.36k, False: 261k]
  |  |  ------------------
  ------------------
 1818|  8.36k|            {
 1819|  8.36k|                continue;
 1820|  8.36k|            }
 1821|   261k|            if (nBondTypeToTest && ( at[iat].bond_type[ineigh] & BOND_TYPE_MASK ) != nBondTypeToTest)
  ------------------
  |  |  189|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (1821:17): [True: 0, False: 261k]
  |  Branch (1821:36): [True: 0, False: 0]
  ------------------
 1822|      0|            {
 1823|      0|                continue;
 1824|      0|            }
 1825|   261k|            nMinFlow = nMinFlow2Check( pBNS, iedge );
 1826|   261k|            nMaxFlow = nMaxFlow2Check( pBNS, iedge );
 1827|   261k|            nCurFlow = nCurFlow2Check( pBNS, iedge );
 1828|   261k|            if (nMinFlow == nMaxFlow)
  ------------------
  |  Branch (1828:17): [True: 192k, False: 69.0k]
  ------------------
 1829|   192k|            {
 1830|   192k|                if (nMaxFlow && bTestForNonStereoBond)
  ------------------
  |  Branch (1830:21): [True: 67.7k, False: 124k]
  |  Branch (1830:33): [True: 12.2k, False: 55.4k]
  ------------------
 1831|  12.2k|                {
 1832|  12.2k|                    nTestFlow = nMaxFlow - (int) ( pBNS->tot_st_cap - pBNS->tot_st_flow ); /* temporary use of nTestFlow */
 1833|  12.2k|                    nMinFlow = inchi_max( 0, nTestFlow );
  ------------------
  |  |  138|  12.2k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 2.31k, False: 9.91k]
  |  |  ------------------
  ------------------
 1834|  12.2k|                }
 1835|   180k|                else
 1836|   180k|                {
 1837|   180k|                    continue;
 1838|   180k|                }
 1839|   192k|            }
 1840|   252k|            for (nTestFlow = nMinFlow; nTestFlow <= nMaxFlow && !bError; nTestFlow++)
  ------------------
  |  Branch (1840:40): [True: 170k, False: 81.3k]
  |  Branch (1840:65): [True: 170k, False: 0]
  ------------------
 1841|   170k|            {
 1842|   170k|                if (nTestFlow == nCurFlow)
  ------------------
  |  Branch (1842:21): [True: 81.3k, False: 89.6k]
  ------------------
 1843|  81.3k|                {
 1844|  81.3k|                    continue;
 1845|  81.3k|                }
 1846|  89.6k|                if (!bNeedToTestTheFlow( at[iat].bond_type[ineigh], nTestFlow, bTestForNonStereoBond ))
  ------------------
  |  Branch (1846:21): [True: 23.5k, False: 66.1k]
  ------------------
 1847|  23.5k|                {
 1848|  23.5k|                    continue;
 1849|  23.5k|                }
 1850|       |                /* djb-rwth: removing redundant code */
 1851|  66.1k|                nDots = bSetFlowToCheckOneBond( pBNS, iedge, nTestFlow, fcd );
 1852|       |
 1853|  66.1k|                if (IS_BNS_ERROR( nDots ))
  ------------------
  |  |   67|  66.1k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  66.1k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  66.1k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  66.1k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 66.1k, False: 0]
  |  |  |  Branch (67:44): [True: 5.08k, False: 61.0k]
  |  |  ------------------
  ------------------
 1854|  5.08k|                {
 1855|  5.08k|                    if (nDots == BNS_CANT_SET_BOND)
  ------------------
  |  |   57|  5.08k|#define BNS_CANT_SET_BOND  (BNS_ERR +  9) /*(-9990)*/
  |  |  ------------------
  |  |  |  |   47|  5.08k|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
  |  Branch (1855:25): [True: 5.08k, False: 0]
  ------------------
 1856|  5.08k|                    {
 1857|  5.08k|                        ret = bRestoreFlowAfterCheckOneBond( pBNS, fcd );
 1858|  5.08k|                        if (!IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  5.08k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  5.08k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  5.08k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  5.08k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 5.08k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 5.08k]
  |  |  ------------------
  ------------------
 1859|  5.08k|                        {
 1860|  5.08k|                            continue;
 1861|  5.08k|                        }
 1862|  5.08k|                    }
 1863|      0|                    bError = nDots;
 1864|      0|                }
 1865|  61.0k|                else
 1866|  61.0k|                {
 1867|  61.0k|                    if (nDots > 0)
  ------------------
  |  Branch (1867:25): [True: 59.4k, False: 1.56k]
  ------------------
 1868|  59.4k|                    {
 1869|  59.4k|                        ret = RunBalancedNetworkSearch( pBNS, pBD, bChangeFlow );
 1870|  59.4k|                        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  59.4k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  59.4k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  59.4k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  59.4k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 59.4k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 59.4k]
  |  |  ------------------
  ------------------
 1871|      0|                        {
 1872|      0|                            bError = ret;
 1873|      0|                        }
 1874|  59.4k|                        else
 1875|  59.4k|                        {
 1876|  59.4k|                            if (ret > 0)
  ------------------
  |  Branch (1876:33): [True: 17.5k, False: 41.8k]
  ------------------
 1877|  17.5k|                            {
 1878|  17.5k|                                if (2 * ret == nDots)
  ------------------
  |  Branch (1878:37): [True: 16.9k, False: 656]
  ------------------
 1879|  16.9k|                                {
 1880|  16.9k|                                    ret = bSetBondsAfterCheckOneBond( pBNS, fcd, nTestFlow, at, num_atoms, bChangeFlow );
 1881|  16.9k|                                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  16.9k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  16.9k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  16.9k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  16.9k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 16.9k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 16.9k]
  |  |  ------------------
  ------------------
 1882|      0|                                    {
 1883|      0|                                        bError = ret;
 1884|      0|                                    }
 1885|  16.9k|                                    else
 1886|  16.9k|                                    {
 1887|  16.9k|                                        nChanges += ( ret & 1 );
 1888|  16.9k|                                        ret = SetBondsFromBnStructFlow( pBNS, at, num_atoms, bChangeFlow );
 1889|  16.9k|                                        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  16.9k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  16.9k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  16.9k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  16.9k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 16.9k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 16.9k]
  |  |  ------------------
  ------------------
 1890|      0|                                        {
 1891|      0|                                            bError = ret;
 1892|      0|                                        }
 1893|  16.9k|                                        else
 1894|  16.9k|                                        {
 1895|  16.9k|                                            if (ret >= 0)
  ------------------
  |  Branch (1895:49): [True: 16.9k, False: 0]
  ------------------
 1896|  16.9k|                                            {
 1897|  16.9k|                                                nChanges += ( ret & 1 );
 1898|       |                                                /* djb-rwth: removing redundant code */
 1899|  16.9k|                                            }
 1900|      0|                                            else
 1901|      0|                                            {
 1902|      0|                                                bError = ret;
 1903|      0|                                            }
 1904|  16.9k|                                        }
 1905|  16.9k|                                    }
 1906|  16.9k|                                }
 1907|       |                                /* typically 2*ret < nDots; 2*ret > nDots should not happen. Check later */
 1908|  17.5k|                                ret = RestoreBnStructFlow( pBNS, bChangeFlow & BNS_EF_CHNG_RSTR );
  ------------------
  |  |  372|  17.5k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  17.5k|#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)
  |  |  ------------------
  |  |  |  |  371|  17.5k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
 1909|  17.5k|                                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  17.5k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  17.5k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  17.5k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  17.5k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 17.5k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 17.5k]
  |  |  ------------------
  ------------------
 1910|      0|                                {
 1911|      0|                                    bError = ret;
 1912|      0|                                }
 1913|  17.5k|                            }
 1914|  59.4k|                        }
 1915|       |                        /* --- Reinitialize to repeat the calculations --- */
 1916|  59.4k|                        ReInitBnStructAltPaths( pBNS );
 1917|  59.4k|                    }
 1918|       |
 1919|  1.56k|                    else
 1920|  1.56k|                    {
 1921|  1.56k|                        if (nDots == 0)
  ------------------
  |  Branch (1921:29): [True: 1.56k, False: 0]
  ------------------
 1922|  1.56k|                        {
 1923|  1.56k|                            ret = bSetBondsAfterCheckOneBond( pBNS, fcd, nTestFlow, at, num_atoms, bChangeFlow );
 1924|  1.56k|                            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  1.56k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  1.56k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  1.56k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  1.56k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 1.56k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 1.56k]
  |  |  ------------------
  ------------------
 1925|      0|                            {
 1926|      0|                                bError = ret;
 1927|      0|                            }
 1928|  1.56k|                            else
 1929|  1.56k|                            {
 1930|  1.56k|                                nChanges += ( ret & 1 );
 1931|  1.56k|                            }
 1932|  1.56k|                        }
 1933|  1.56k|                    }
 1934|  61.0k|                }
 1935|       |
 1936|  61.0k|                ret = bRestoreFlowAfterCheckOneBond( pBNS, fcd );
 1937|       |
 1938|  61.0k|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  61.0k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  61.0k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  61.0k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  61.0k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 61.0k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 61.0k]
  |  |  ------------------
  ------------------
 1939|      0|                {
 1940|      0|                    bError = ret;
 1941|      0|                }
 1942|       |
 1943|  61.0k|            } /* for (nTestFlow = */
 1944|  81.3k|        } /* for (ineigh = */
 1945|  1.12M|    } /* for (iat =  */
 1946|       |
 1947|   293k|    return bError ? bError : nChanges;
  ------------------
  |  Branch (1947:12): [True: 0, False: 293k]
  ------------------
 1948|   293k|}
SetForbiddenEdges:
 1973|   376k|{
 1974|       |
 1975|       |
 1976|   376k|    int i, j, neigh, num_found;
 1977|   376k|    BNS_IEDGE iedge;
 1978|       |    /*S_CHAR    edge_forbidden_mask = BNS_EDGE_FORBIDDEN_MASK;*/
 1979|   376k|    S_CHAR    edge_forbidden_mask = forbidden_mask;
 1980|       |
 1981|   376k|    pBNS->edge_forbidden_mask |= forbidden_mask;
 1982|       |
 1983|   376k|    num_found = 0;
 1984|       |
 1985|  2.30M|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1985:17): [True: 1.93M, False: 376k]
  ------------------
 1986|  1.93M|    {
 1987|       |        /* acetyl */
 1988|  1.93M|        if (at[i].el_number == EL_NUMBER_C && 3 == at[i].valence &&
  ------------------
  |  |   13|  3.86M|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (1988:13): [True: 195k, False: 1.73M]
  |  Branch (1988:47): [True: 10.7k, False: 184k]
  ------------------
 1989|  10.7k|             4 == at[i].chem_bonds_valence)
  ------------------
  |  Branch (1989:14): [True: 9.47k, False: 1.29k]
  ------------------
 1990|  9.47k|        {
 1991|  9.47k|            int num_O = 0;
 1992|  9.47k|            int bond_to_O_val = 0;
 1993|  9.47k|            int forbidden_bond_pos = -1;
 1994|  9.47k|            int forbidden_bond_val = -1;
 1995|  37.9k|            for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (1995:25): [True: 28.4k, False: 9.47k]
  ------------------
 1996|  28.4k|            {
 1997|  28.4k|                neigh = at[i].neighbor[j];
 1998|  28.4k|                if (at[neigh].el_number == EL_NUMBER_O &&
  ------------------
  |  |   15|  56.8k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (1998:21): [True: 3.88k, False: 24.5k]
  ------------------
 1999|  3.88k|                     at[neigh].valence == 1)
  ------------------
  |  Branch (1999:22): [True: 2.43k, False: 1.45k]
  ------------------
 2000|  2.43k|                {
 2001|  2.43k|                    num_O++;
 2002|  2.43k|                    bond_to_O_val += ( at[i].bond_type[j] & BOND_TYPE_MASK );
  ------------------
  |  |  189|  2.43k|#define BOND_TYPE_MASK        0x0f
  ------------------
 2003|  2.43k|                }
 2004|  25.9k|                else
 2005|  25.9k|                {
 2006|  25.9k|                    forbidden_bond_pos = j;
 2007|  25.9k|                    forbidden_bond_val = ( at[i].bond_type[j] & BOND_TYPE_MASK );
  ------------------
  |  |  189|  25.9k|#define BOND_TYPE_MASK        0x0f
  ------------------
 2008|  25.9k|                }
 2009|  28.4k|            }
 2010|  9.47k|            if (2 == num_O && 3 == bond_to_O_val && 1 == forbidden_bond_val)
  ------------------
  |  Branch (2010:17): [True: 804, False: 8.67k]
  |  Branch (2010:31): [True: 782, False: 22]
  |  Branch (2010:53): [True: 782, False: 0]
  ------------------
 2011|    782|            {
 2012|    782|                iedge = pBNS->vert[i].iedge[forbidden_bond_pos];
 2013|    782|                pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2014|    782|                num_found++;
 2015|    782|            }
 2016|  9.47k|        }
 2017|  1.92M|        else
 2018|  1.92M|        {
 2019|       |            /* nitro */
 2020|  1.92M|            if (at[i].el_number == EL_NUMBER_N && 3 == at[i].valence &&
  ------------------
  |  |   14|  3.84M|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (2020:17): [True: 196k, False: 1.72M]
  |  Branch (2020:51): [True: 14.5k, False: 181k]
  ------------------
 2021|  14.5k|                ( 4 == at[i].chem_bonds_valence || 5 == at[i].chem_bonds_valence ))
  ------------------
  |  Branch (2021:19): [True: 2.23k, False: 12.3k]
  |  Branch (2021:52): [True: 7.79k, False: 4.54k]
  ------------------
 2022|  10.0k|            {
 2023|  10.0k|                int num_O = 0;
 2024|  10.0k|                int bond_to_O_val = 0;
 2025|  10.0k|                int forbidden_bond_pos = -1;
 2026|  10.0k|                int forbidden_bond_val = -1;
 2027|  40.1k|                for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (2027:29): [True: 30.0k, False: 10.0k]
  ------------------
 2028|  30.0k|                {
 2029|  30.0k|                    neigh = at[i].neighbor[j];
 2030|  30.0k|                    if (at[neigh].el_number == EL_NUMBER_O &&
  ------------------
  |  |   15|  60.1k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2030:25): [True: 1.30k, False: 28.7k]
  ------------------
 2031|  1.30k|                         at[neigh].valence == 1)
  ------------------
  |  Branch (2031:26): [True: 774, False: 531]
  ------------------
 2032|    774|                    {
 2033|    774|                        num_O++;
 2034|    774|                        bond_to_O_val += ( at[i].bond_type[j] & BOND_TYPE_MASK );
  ------------------
  |  |  189|    774|#define BOND_TYPE_MASK        0x0f
  ------------------
 2035|    774|                    }
 2036|  29.3k|                    else
 2037|  29.3k|                    {
 2038|  29.3k|                        forbidden_bond_pos = j;
 2039|  29.3k|                        forbidden_bond_val = ( at[i].bond_type[j] & BOND_TYPE_MASK );
  ------------------
  |  |  189|  29.3k|#define BOND_TYPE_MASK        0x0f
  ------------------
 2040|  29.3k|                    }
 2041|  30.0k|                }
 2042|  10.0k|                if (2 == num_O && ( 3 == bond_to_O_val || 4 == bond_to_O_val ) && 1 == forbidden_bond_val)
  ------------------
  |  Branch (2042:21): [True: 31, False: 10.0k]
  |  Branch (2042:37): [True: 11, False: 20]
  |  Branch (2042:59): [True: 20, False: 0]
  |  Branch (2042:83): [True: 23, False: 8]
  ------------------
 2043|     23|                {
 2044|     23|                    iedge = pBNS->vert[i].iedge[forbidden_bond_pos];
 2045|     23|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2046|     23|                    num_found++;
 2047|     23|                }
 2048|  10.0k|            }
 2049|  1.92M|        }
 2050|  1.93M|    }
 2051|       |
 2052|       |#ifdef FIX_SRU_CYCLIZING_PS_BONDS_IN_BNS
 2053|       |    if (nebend > 1)
 2054|       |        num_found += fix_explicitly_indicated_bonds( nebend, ebend, pBNS, at, num_atoms );
 2055|       |#endif
 2056|       |
 2057|   376k|#if ( REMOVE_ION_PAIRS_FIX_BONDS == 1 )
 2058|   376k|    num_found += fix_special_bonds( pBNS, at, num_atoms, edge_forbidden_mask );
 2059|   376k|#endif
 2060|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 2061|       |    num_found += TempFix_NH_NH_Bonds( pBNS, at, num_atoms );
 2062|       |#endif
 2063|       |
 2064|   376k|    return num_found;
 2065|   376k|}
fix_special_bonds:
 2150|   376k|{
 2151|   376k|    int num_changes = 0;
 2152|       |
 2153|   376k|#define MAX_NEIGH 6
 2154|       |
 2155|   376k|    int i, k, n1, n2, n3, i1, i2, i3, i4, bond_type; /* djb-rwth: removing redundant variables */
 2156|   376k|    inp_ATOM *a;
 2157|   376k|    int j[3], m[3], num_O, k_O, num_N, num_OH, num_OM, num_X, num_other, k_N;
 2158|       |
 2159|   376k|    BNS_IEDGE iedge;
 2160|       |    /*S_CHAR    edge_forbidden_mask = BNS_EDGE_FORBIDDEN_MASK;*/
 2161|   376k|    S_CHAR    edge_forbidden_mask = forbidden_mask;
 2162|       |
 2163|   376k|    pBNS->edge_forbidden_mask |= edge_forbidden_mask;
 2164|       |
 2165|  2.30M|    for (i = 0, a = at; i < num_atoms; i++, a++)
  ------------------
  |  Branch (2165:25): [True: 1.93M, False: 376k]
  ------------------
 2166|  1.93M|    {
 2167|       |
 2168|  1.93M|        if (!a->charge && !a->radical &&
  ------------------
  |  Branch (2168:13): [True: 1.71M, False: 219k]
  |  Branch (2168:27): [True: 1.68M, False: 24.0k]
  ------------------
 2169|  1.68M|             2 <= a->chem_bonds_valence + NUMH( a, 0 ) - get_el_valence( a->el_number, 0, 0 ) &&
  ------------------
  |  |   56|  1.68M|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  1.68M|#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 (2169:14): [True: 60.9k, False: 1.62M]
  ------------------
 2170|  60.9k|             0 == num_of_H( at, i ) &&
  ------------------
  |  Branch (2170:14): [True: 50.2k, False: 10.6k]
  ------------------
 2171|  50.2k|             2 == nNoMetalBondsValence( at, i ) + NUMH( a, 0 ) - get_el_valence( a->el_number, 0, 0 ) &&
  ------------------
  |  |   56|  50.2k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  50.2k|#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 (2171:14): [True: 36.6k, False: 13.6k]
  ------------------
 2172|  36.6k|             ion_el_group( at[i].el_number ) == EL_NUMBER_N )
  ------------------
  |  |   14|  36.6k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (2172:14): [True: 18.3k, False: 18.2k]
  ------------------
 2173|  18.3k|        {
 2174|       |            /* Found N(V), no H */
 2175|  18.3k|            if (2 == nNoMetalNumBonds( at, i ))
  ------------------
  |  Branch (2175:17): [True: 1.80k, False: 16.5k]
  ------------------
 2176|  1.80k|            {
 2177|       |                /* #N= */
 2178|       |                /* fix bonds: double and triple: =N# so that bonds cannot be changed by the normalization */
 2179|  1.80k|#if ( FIX_N_V_METAL_BONDS_GPF == 1 )
 2180|  1.80k|                if (0 > ( i1 = nNoMetalNeighIndex( at, i ) ) ||
  ------------------
  |  Branch (2180:21): [True: 0, False: 1.80k]
  ------------------
 2181|  1.80k|                     0 > ( i2 = nNoMetalOtherNeighIndex( at, i, n1 = a->neighbor[i1]/* non-metal neighbor #1 */ ) ))
  ------------------
  |  Branch (2181:22): [True: 3, False: 1.79k]
  ------------------
 2182|      3|                {
 2183|       |                    /*num_err ++; */ /* do not count would-be original InChI v.1 buffer overflow GPF */
 2184|      3|                    continue;       /* v1 bug: 2 bonds to metal yield i1 < 0 and/or i2 < 0 => bounds violation */
 2185|      3|                }
 2186|       |#else
 2187|       |                i1 = nNoMetalNeighIndex( at, i );
 2188|       |                n1 = a->neighbor[i1]; /* non-metal neighbor #1 */
 2189|       |                i2 = nNoMetalOtherNeighIndex( at, i, n1 );
 2190|       |#endif
 2191|  1.79k|                n2 = a->neighbor[i2]; /* non-metal neighbor #2 */
 2192|       |                                      /* forbid all edges to non-metals */
 2193|  1.79k|                iedge = pBNS->vert[i].iedge[i1];
 2194|  1.79k|                pBNS->edge[iedge].forbidden |= edge_forbidden_mask; /* fix bond to neighbor #1 */
 2195|  1.79k|                iedge = pBNS->vert[i].iedge[i2];
 2196|  1.79k|                pBNS->edge[iedge].forbidden |= edge_forbidden_mask; /* fix bond to neighbor #1 */
 2197|  1.79k|                num_changes++;  /* added 11-15-2005 */
 2198|       |                                /*                                                      i n3 */
 2199|       |                                /* forbid single bond edge beyond the neighboring =N- as in #N=N- */
 2200|       |                /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 2201|  1.79k|                if (( at[i].bond_type[i1] & BOND_TYPE_MASK ) == BOND_TYPE_DOUBLE)
  ------------------
  |  |  189|  1.79k|#define BOND_TYPE_MASK        0x0f
  ------------------
                              if (( at[i].bond_type[i1] & BOND_TYPE_MASK ) == BOND_TYPE_DOUBLE)
  ------------------
  |  |   33|  1.79k|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2201:21): [True: 1.03k, False: 768]
  ------------------
 2202|  1.03k|                {
 2203|  1.03k|                    i3 = i1; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 2204|  1.03k|                    n3 = n1;
 2205|  1.03k|                }
 2206|    768|                else
 2207|    768|                {
 2208|    768|                    i3 = i2; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 2209|    768|                    n3 = n2;
 2210|    768|                }
 2211|  1.79k|                if (0 == NUMH( at, n3 ) && 2 == nNoMetalNumBonds( at, n3 ) &&
  ------------------
  |  |   56|  3.59k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  1.79k|#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 (2211:21): [True: 1.79k, False: 8]
  |  Branch (2211:44): [True: 1.51k, False: 277]
  ------------------
 2212|  1.51k|                     3 == nNoMetalBondsValence( at, n3 ) &&
  ------------------
  |  Branch (2212:22): [True: 918, False: 595]
  ------------------
 2213|    918|                     ion_el_group( at[n3].el_number ) == EL_NUMBER_N &&
  ------------------
  |  |   14|  2.71k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (2213:22): [True: 817, False: 101]
  ------------------
 2214|    817|                     0 <= ( k = nNoMetalOtherNeighIndex( at, n3, i ) ))
  ------------------
  |  Branch (2214:22): [True: 709, False: 108]
  ------------------
 2215|    709|                {
 2216|       |                    /* found =N- ; forbid the edge*/
 2217|    709|                    iedge = pBNS->vert[n3].iedge[k];
 2218|    709|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2219|    709|                    num_changes++;
 2220|    709|                }
 2221|  1.79k|            }
 2222|  16.5k|            else if (3 == nNoMetalNumBonds( at, i ) &&
  ------------------
  |  Branch (2222:22): [True: 9.60k, False: 6.94k]
  ------------------
 2223|       |                      /*         |                      */
 2224|       |                      /* found  =N=                     */
 2225|       |                      /* locate all non-metal neighbors */
 2226|  9.60k|                      0 <= ( j[0] = nNoMetalNeighIndex( at, i ) ) &&
  ------------------
  |  Branch (2226:23): [True: 9.59k, False: 3]
  ------------------
 2227|  9.59k|                      0 <= ( j[1] = nNoMetalOtherNeighIndex( at, i, m[0] = a->neighbor[j[0]] ) ) &&
  ------------------
  |  Branch (2227:23): [True: 9.58k, False: 16]
  ------------------
 2228|  9.58k|                      0 <= ( j[2] = nNoMetalOtherNeighIndex2( at, i, m[0], m[1] = a->neighbor[j[1]] ) ))
  ------------------
  |  Branch (2228:23): [True: 8.64k, False: 940]
  ------------------
 2229|  8.64k|            {
 2230|       |                /* Count specific neighbors: N(V)=N, N(V)-N N(V)=O, and N(V)-N */
 2231|       |
 2232|       |                /*  if there is a single neighbor connected by a double bond, namely
 2233|       |                N(V)=N and/or N(V)=O, then fix the bond(s).
 2234|       |                If N(V)=O was fixed then do not fix another bond */
 2235|  8.64k|                m[2] = a->neighbor[j[2]];
 2236|  8.64k|                num_O = num_N = 0;
 2237|  34.5k|                for (k = 0; k < 3; k++)
  ------------------
  |  Branch (2237:29): [True: 25.9k, False: 8.64k]
  ------------------
 2238|  25.9k|                {
 2239|  25.9k|                    n1 = m[k];
 2240|  25.9k|                    i1 = j[k]; /* djb-rwth: ignoring LLVM warning: variable used */
 2241|  25.9k|                    if (ion_el_group( at[n1].el_number ) == EL_NUMBER_N)
  ------------------
  |  |   14|  25.9k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (2241:25): [True: 14.8k, False: 11.1k]
  ------------------
 2242|  14.8k|                    {
 2243|  14.8k|                        k_N = k;
 2244|  14.8k|                        num_N++;
 2245|  14.8k|                    }
 2246|  11.1k|                    else if (ion_el_group( at[n1].el_number ) == EL_NUMBER_O &&
  ------------------
  |  |   15|  22.2k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2246:30): [True: 3.29k, False: 7.81k]
  ------------------
 2247|  3.29k|                             1 == nNoMetalNumBonds( at, n1 ))
  ------------------
  |  Branch (2247:30): [True: 2.59k, False: 701]
  ------------------
 2248|  2.59k|                    {
 2249|  2.59k|                        k_O = k;
 2250|  2.59k|                        num_O++;
 2251|  2.59k|                    }
 2252|  25.9k|                }
 2253|  8.64k|                num_other = 0;
 2254|  8.64k|                if (1 == num_O &&
  ------------------
  |  Branch (2254:21): [True: 1.07k, False: 7.56k]
  ------------------
 2255|  1.07k|                     0 == at[n1 = m[k_O]].charge &&
  ------------------
  |  Branch (2255:22): [True: 961, False: 111]
  ------------------
 2256|    961|                     0 == at[n1].radical            &&
  ------------------
  |  Branch (2256:22): [True: 851, False: 110]
  ------------------
 2257|    851|                     BOND_TYPE_DOUBLE == ( at[i].bond_type[i1 = j[k_O]] & BOND_TYPE_MASK )
  ------------------
  |  |   33|    851|#define BOND_TYPE_DOUBLE    2
  ------------------
                                   BOND_TYPE_DOUBLE == ( at[i].bond_type[i1 = j[k_O]] & BOND_TYPE_MASK )
  ------------------
  |  |  189|    851|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (2257:22): [True: 835, False: 16]
  ------------------
 2258|  8.64k|                     )
 2259|    835|                {
 2260|       |                    /* Fix bond to neighbor =O */
 2261|    835|                    iedge = pBNS->vert[i].iedge[i1];
 2262|    835|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2263|    835|                    num_changes++;
 2264|    835|                    num_other++; /* indicator: double to a terminal O has been fixed */
 2265|    835|                }
 2266|  8.64k|                if (!num_other                    &&
  ------------------
  |  Branch (2266:21): [True: 7.80k, False: 835]
  ------------------
 2267|  7.80k|                     num_O <= 1 &&
  ------------------
  |  Branch (2267:22): [True: 7.04k, False: 763]
  ------------------
 2268|  7.04k|                     1 == num_N &&
  ------------------
  |  Branch (2268:22): [True: 1.92k, False: 5.12k]
  ------------------
 2269|  1.92k|                     0 == at[n1 = m[k_N]].charge &&
  ------------------
  |  Branch (2269:22): [True: 1.08k, False: 838]
  ------------------
 2270|  1.08k|                     0 == at[n1].radical            &&
  ------------------
  |  Branch (2270:22): [True: 808, False: 275]
  ------------------
 2271|    808|                     BOND_TYPE_DOUBLE == ( at[i].bond_type[i1 = j[k_N]] & BOND_TYPE_MASK ))
  ------------------
  |  |   33|    808|#define BOND_TYPE_DOUBLE    2
  ------------------
                                   BOND_TYPE_DOUBLE == ( at[i].bond_type[i1 = j[k_N]] & BOND_TYPE_MASK ))
  ------------------
  |  |  189|    808|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (2271:22): [True: 422, False: 386]
  ------------------
 2272|    422|                {
 2273|       |                    /* Fix bond to neighbor =N */
 2274|    422|                    iedge = pBNS->vert[i].iedge[i1];
 2275|    422|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2276|    422|                    num_changes++;
 2277|    422|                }
 2278|  8.64k|            }
 2279|  7.90k|            else if (4 == nNoMetalNumBonds( at, i ))
  ------------------
  |  Branch (2279:22): [True: 6.87k, False: 1.02k]
  ------------------
 2280|  6.87k|            {
 2281|       |                /*         |                      */
 2282|       |                /* found  -N=N-                   */
 2283|       |                /*         |                      */
 2284|       |                /* locate non-metal neighbor connected by a double bond;
 2285|       |                * if it is =N- then fix the double bond and the single bond beyond the neighbor
 2286|       |                */
 2287|  6.87k|                num_N = 0;
 2288|  6.87k|                num_other = 0; /* djb-rwth: ignoring LLVM warning: variable used */
 2289|  34.3k|                for (i1 = 0; i1 < at[i].valence; i1++)
  ------------------
  |  Branch (2289:30): [True: 27.5k, False: 6.87k]
  ------------------
 2290|  27.5k|                {
 2291|  27.5k|                    if (BOND_TYPE_DOUBLE == ( at[i].bond_type[i1] & BOND_TYPE_MASK ) &&
  ------------------
  |  |   33|  27.5k|#define BOND_TYPE_DOUBLE    2
  ------------------
                                  if (BOND_TYPE_DOUBLE == ( at[i].bond_type[i1] & BOND_TYPE_MASK ) &&
  ------------------
  |  |  189|  27.5k|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (2291:25): [True: 6.74k, False: 20.7k]
  ------------------
 2292|  6.74k|                         !is_el_a_metal( at[n1 = (int) at[i].neighbor[i1]].el_number ) &&
  ------------------
  |  Branch (2292:26): [True: 6.50k, False: 236]
  ------------------
 2293|  6.50k|                         ion_el_group( at[n1].el_number ) == EL_NUMBER_N)
  ------------------
  |  |   14|  6.50k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (2293:26): [True: 2.94k, False: 3.56k]
  ------------------
 2294|  2.94k|                    {
 2295|  2.94k|                        num_N++;
 2296|  2.94k|                        n2 = n1;
 2297|  2.94k|                        i2 = i1;
 2298|  2.94k|                    }
 2299|  27.5k|                }
 2300|  6.87k|                if (1 == num_N && 0 == NUMH( at, n2 ) &&
  ------------------
  |  |   56|  9.68k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  2.80k|#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 (2300:21): [True: 2.80k, False: 4.06k]
  |  Branch (2300:35): [True: 2.63k, False: 170]
  ------------------
 2301|  2.63k|                     2 == nNoMetalNumBonds( at, n2 ) &&
  ------------------
  |  Branch (2301:22): [True: 642, False: 1.99k]
  ------------------
 2302|    642|                     3 == nNoMetalBondsValence( at, n2 ) &&
  ------------------
  |  Branch (2302:22): [True: 628, False: 14]
  ------------------
 2303|    628|                     0 <= ( i3 = nNoMetalOtherNeighIndex( at, n2, i ) ) &&
  ------------------
  |  Branch (2303:22): [True: 561, False: 67]
  ------------------
 2304|    561|                     BOND_TYPE_SINGLE == ( at[n2].bond_type[i3] & BOND_TYPE_MASK ))
  ------------------
  |  |   32|    561|#define BOND_TYPE_SINGLE    1
  ------------------
                                   BOND_TYPE_SINGLE == ( at[n2].bond_type[i3] & BOND_TYPE_MASK ))
  ------------------
  |  |  189|    561|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (2304:22): [True: 561, False: 0]
  ------------------
 2305|    561|                {
 2306|       |                    /* fix the single bond beyond the N(V) neighbor N(V)=N- */
 2307|    561|                    iedge = pBNS->vert[n2].iedge[i3];
 2308|    561|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2309|    561|                    num_changes++;
 2310|       |                    /* fix the double bond */
 2311|    561|                    iedge = pBNS->vert[i].iedge[i2];
 2312|    561|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2313|    561|                    num_changes++;
 2314|    561|                }
 2315|  6.87k|            }
 2316|  18.3k|        }
 2317|       |
 2318|  1.91M|        else if (!a->charge && !a->radical &&
  ------------------
  |  Branch (2318:18): [True: 1.69M, False: 219k]
  |  Branch (2318:32): [True: 1.66M, False: 24.0k]
  ------------------
 2319|  1.66M|                  2 <= a->chem_bonds_valence + NUMH( a, 0 ) - get_el_valence( a->el_number, 0, 0 ) &&
  ------------------
  |  |   56|  1.66M|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  1.66M|#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 (2319:19): [True: 42.6k, False: 1.62M]
  ------------------
 2320|  42.6k|                  0 == num_of_H( at, i ) &&
  ------------------
  |  Branch (2320:19): [True: 31.9k, False: 10.6k]
  ------------------
 2321|  31.9k|                  2 == nNoMetalBondsValence( at, i ) + NUMH( a, 0 ) - get_el_valence( a->el_number, 0, 0 ) &&
  ------------------
  |  |   56|  31.9k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  31.9k|#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 (2321:19): [True: 18.2k, False: 13.6k]
  ------------------
 2322|  18.2k|                  a->el_number != EL_NUMBER_O && ion_el_group( a->el_number ) == EL_NUMBER_O &&
  ------------------
  |  |   15|  1.93M|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
                                a->el_number != EL_NUMBER_O && ion_el_group( a->el_number ) == EL_NUMBER_O &&
  ------------------
  |  |   15|  1.92M|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2322:19): [True: 16.4k, False: 1.84k]
  |  Branch (2322:50): [True: 4.98k, False: 11.4k]
  ------------------
 2323|  4.98k|                  3 == nNoMetalNumBonds( at, i ))
  ------------------
  |  Branch (2323:19): [True: 2.69k, False: 2.28k]
  ------------------
 2324|  2.69k|        {
 2325|       |            /* Found S(IV), no H, one double bond, total 3 bonds */
 2326|       |            /*       OH
 2327|       |            /
 2328|       |            in O=S   (X != O) fix single bond O-X  (type 1)
 2329|       |            \
 2330|       |            X
 2331|       |
 2332|       |            X
 2333|       |            /
 2334|       |            in Z=S    (X, Y != OH) fix double bond Z=S (type 2)
 2335|       |            \
 2336|       |            Y
 2337|       |            */
 2338|  2.69k|            num_N = 0;  /* number of non-metal neighbors connected by a double bond */
 2339|  2.69k|            num_OH = 0; /* number of neighbors OH connected by a single bond */
 2340|  2.69k|            num_OM = 0; /* number of charged neighbors O connected by a single bond */
 2341|  2.69k|            num_O = 0;  /* number of neighbors =O connected by a double bond */
 2342|  2.69k|            num_other = 0;
 2343|       |
 2344|  10.7k|            for (i1 = 0; i1 < a->valence; i1++)
  ------------------
  |  Branch (2344:26): [True: 8.07k, False: 2.69k]
  ------------------
 2345|  8.07k|            {
 2346|  8.07k|                n1 = (int) a->neighbor[i1];
 2347|  8.07k|                if (is_el_a_metal( at[n1].el_number ))
  ------------------
  |  Branch (2347:21): [True: 1.31k, False: 6.75k]
  ------------------
 2348|  1.31k|                {
 2349|  1.31k|                    continue;
 2350|  1.31k|                }
 2351|       |
 2352|  6.75k|                bond_type = ( a->bond_type[i1] & BOND_TYPE_MASK );
  ------------------
  |  |  189|  6.75k|#define BOND_TYPE_MASK        0x0f
  ------------------
 2353|       |
 2354|  6.75k|                if (BOND_TYPE_DOUBLE == bond_type)
  ------------------
  |  |   33|  6.75k|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2354:21): [True: 2.46k, False: 4.29k]
  ------------------
 2355|  2.46k|                {
 2356|  2.46k|                    num_N++;
 2357|  2.46k|                    n2 = n1;
 2358|  2.46k|                    i2 = i1;
 2359|  2.46k|                    if (ion_el_group( at[n1].el_number ) == EL_NUMBER_O)
  ------------------
  |  |   15|  2.46k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2359:25): [True: 1.13k, False: 1.32k]
  ------------------
 2360|  1.13k|                    {
 2361|  1.13k|                        num_O++;
 2362|  1.13k|                    }
 2363|  2.46k|                }
 2364|  4.29k|                else if (BOND_TYPE_SINGLE == bond_type &&
  ------------------
  |  |   32|  4.29k|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2364:26): [True: 4.25k, False: 46]
  ------------------
 2365|  4.25k|                          1 == nNoMetalNumBonds( at, n1 ) &&
  ------------------
  |  Branch (2365:27): [True: 942, False: 3.30k]
  ------------------
 2366|    942|                          1 == nNoMetalBondsValence( at, n1 ) &&
  ------------------
  |  Branch (2366:27): [True: 942, False: 0]
  ------------------
 2367|    942|                          ion_el_group( at[n1].el_number ) == EL_NUMBER_O)
  ------------------
  |  |   15|    942|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2367:27): [True: 411, False: 531]
  ------------------
 2368|    411|                {
 2369|    411|                    if (0 == at[n1].charge)
  ------------------
  |  Branch (2369:25): [True: 134, False: 277]
  ------------------
 2370|    134|                    {
 2371|    134|                        num_OH++;
 2372|    134|                        n3 = n1;
 2373|    134|                        i3 = i1; /* djb-rwth: ignoring LLVM warning: variable used */
 2374|    134|                    }
 2375|    277|                    else
 2376|    277|                    {
 2377|    277|                        num_OM++;
 2378|    277|                    }
 2379|    411|                }
 2380|  3.88k|                else
 2381|  3.88k|                {
 2382|  3.88k|                    num_other++;
 2383|       |                    /* djb-rwth: removing redundant code */
 2384|  3.88k|                    i4 = i1;
 2385|  3.88k|                }
 2386|  6.75k|            } /* for (i1 = */
 2387|       |
 2388|  2.69k|            if (1 == num_N && 1 == num_O && 1 == num_OH + num_OM)
  ------------------
  |  Branch (2388:17): [True: 2.45k, False: 235]
  |  Branch (2388:31): [True: 1.13k, False: 1.31k]
  |  Branch (2388:45): [True: 351, False: 786]
  ------------------
 2389|    351|            {
 2390|    351|                if (1 == num_other)
  ------------------
  |  Branch (2390:21): [True: 218, False: 133]
  ------------------
 2391|    218|                {
 2392|       |                    /* type 1: fix the single bond S-X */
 2393|    218|                    iedge = pBNS->vert[i].iedge[i4];
 2394|    218|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2395|    218|                    num_changes++;
 2396|    218|                }
 2397|    351|            }
 2398|  2.34k|            else if (1 == num_N && !num_OH && !num_OM)
  ------------------
  |  Branch (2398:22): [True: 2.10k, False: 235]
  |  Branch (2398:36): [True: 2.05k, False: 50]
  |  Branch (2398:47): [True: 2.05k, False: 5]
  ------------------
 2399|  2.05k|            {
 2400|  2.05k|                int    bFound = 0; /* flag */
 2401|  2.05k|                int    bDoNotFixAnyBond = 0; /* flag */
 2402|       |                                             /* Avoid case N=S-NH or N=S-N(-); N = N, P, As, Sb */
 2403|  2.05k|                if (ion_el_group( at[n2].el_number ) == EL_NUMBER_N)
  ------------------
  |  |   14|  2.05k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (2403:21): [True: 1.02k, False: 1.02k]
  ------------------
 2404|  1.02k|                {
 2405|  1.02k|                    U_CHAR el_number = at[n2].el_number;
 2406|  4.11k|                    for (i1 = 0; i1 < a->valence; i1++)
  ------------------
  |  Branch (2406:34): [True: 3.08k, False: 1.02k]
  ------------------
 2407|  3.08k|                    {
 2408|  3.08k|                        n1 = (int) a->neighbor[i1];
 2409|  3.08k|                        bond_type = ( a->bond_type[i1] & BOND_TYPE_MASK );
  ------------------
  |  |  189|  3.08k|#define BOND_TYPE_MASK        0x0f
  ------------------
 2410|  3.08k|                        if (BOND_TYPE_SINGLE == bond_type &&
  ------------------
  |  |   32|  3.08k|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2410:29): [True: 2.05k, False: 1.02k]
  ------------------
 2411|  2.05k|                            ( NUMH( at, n1 ) || -1 == at[n1].charge ) &&
  ------------------
  |  |   56|  4.11k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  2.05k|#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 (56:21): [True: 90, False: 1.96k]
  |  |  ------------------
  ------------------
  |  Branch (2411:49): [True: 442, False: 1.52k]
  ------------------
 2412|    532|                             el_number == at[n1].el_number)
  ------------------
  |  Branch (2412:30): [True: 521, False: 11]
  ------------------
 2413|    521|                        {
 2414|    521|                            i3 = i1; /* djb-rwth: ignoring LLVM warning: variable used */
 2415|    521|                            n3 = n1;
 2416|    521|                            bFound++;
 2417|    521|                        }
 2418|  3.08k|                    }
 2419|  1.02k|                }
 2420|       |                /* Exception: check if Z==X and they belong to the same ring system */
 2421|  8.20k|                for (i1 = 0; i1 < a->valence; i1++)
  ------------------
  |  Branch (2421:30): [True: 6.15k, False: 2.05k]
  ------------------
 2422|  6.15k|                {
 2423|  6.15k|                    if (i1 != i2)
  ------------------
  |  Branch (2423:25): [True: 4.10k, False: 2.05k]
  ------------------
 2424|  4.10k|                    {
 2425|  4.10k|                        n1 = (int) a->neighbor[i1];
 2426|  4.10k|                        if (at[n2].el_number == at[n1].el_number &&
  ------------------
  |  Branch (2426:29): [True: 1.90k, False: 2.19k]
  ------------------
 2427|  1.90k|                             at[n2].nRingSystem == at[n1].nRingSystem)
  ------------------
  |  Branch (2427:30): [True: 362, False: 1.54k]
  ------------------
 2428|    362|                        {
 2429|    362|                            bDoNotFixAnyBond++;
 2430|    362|                        }
 2431|  4.10k|                    }
 2432|  6.15k|                }
 2433|  2.05k|                if (bDoNotFixAnyBond)
  ------------------
  |  Branch (2433:21): [True: 280, False: 1.77k]
  ------------------
 2434|    280|                {
 2435|    280|                    ; /* do nothing */
 2436|    280|                }
 2437|  1.77k|                else if (bFound)
  ------------------
  |  Branch (2437:26): [True: 495, False: 1.27k]
  ------------------
 2438|    495|                {
 2439|    495|                    if (1 == bFound &&
  ------------------
  |  Branch (2439:25): [True: 486, False: 9]
  ------------------
 2440|    486|                         0 <= ( i4 = nNoMetalOtherNeighIndex2( at, i, n2, n3 ) ))
  ------------------
  |  Branch (2440:26): [True: 470, False: 16]
  ------------------
 2441|    470|                    {
 2442|       |                        /* fix bond i4 */
 2443|    470|                        iedge = pBNS->vert[i].iedge[i4];
 2444|    470|                        pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2445|    470|                        num_changes++;
 2446|    470|                    }
 2447|    495|                }
 2448|  1.27k|                else
 2449|  1.27k|                {
 2450|       |                    /* fix the double bond >S=X */
 2451|  1.27k|                    iedge = pBNS->vert[i].iedge[i2];
 2452|  1.27k|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2453|  1.27k|                    num_changes++;
 2454|       |                    /* -- test later --
 2455|       |                    if ( 2 == nNoMetalNumBonds( at, n2 ) &&
 2456|       |                    0 <= ( i3 = nNoMetalOtherNeighIndex( at, n2, i ) ) ) {
 2457|       |                    iedge = pBNS->vert[n2].iedge[i3];
 2458|       |                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2459|       |                    num_changes ++;
 2460|       |                    }
 2461|       |                    -------------------*/
 2462|  1.27k|                }
 2463|  2.05k|            }
 2464|  2.69k|        }
 2465|       |
 2466|  1.91M|        else if (!a->charge && !a->radical &&
  ------------------
  |  Branch (2466:18): [True: 1.69M, False: 219k]
  |  Branch (2466:32): [True: 1.66M, False: 24.0k]
  ------------------
 2467|  1.66M|                  4 <= a->chem_bonds_valence + NUMH( a, 0 ) - get_el_valence( a->el_number, 0, 0 ) &&
  ------------------
  |  |   56|  1.66M|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  1.66M|#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 (2467:19): [True: 10.5k, False: 1.65M]
  ------------------
 2468|  10.5k|                  0 == num_of_H( at, i ) &&
  ------------------
  |  Branch (2468:19): [True: 7.67k, False: 2.90k]
  ------------------
 2469|  7.67k|                  4 == nNoMetalBondsValence( at, i ) + NUMH( a, 0 ) - get_el_valence( a->el_number, 0, 0 ) &&
  ------------------
  |  |   56|  7.67k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  7.67k|#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 (2469:19): [True: 5.69k, False: 1.97k]
  ------------------
 2470|  5.69k|                  a->el_number != EL_NUMBER_O && ion_el_group( a->el_number ) == EL_NUMBER_O &&
  ------------------
  |  |   15|  1.91M|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
                                a->el_number != EL_NUMBER_O && ion_el_group( a->el_number ) == EL_NUMBER_O &&
  ------------------
  |  |   15|  1.91M|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2470:19): [True: 5.68k, False: 10]
  |  Branch (2470:50): [True: 3.02k, False: 2.66k]
  ------------------
 2471|  3.02k|                  4 == nNoMetalNumBonds( at, i ))
  ------------------
  |  Branch (2471:19): [True: 1.67k, False: 1.35k]
  ------------------
 2472|  1.67k|        {
 2473|       |            /* Found S(VI), no H, two double bonds or one triple bond */
 2474|       |            /*     O
 2475|       |            ||
 2476|       |            in O=S--Y-   (X, Y -- non-terminal) fix single bonds S-X, S-Y  (type 1)
 2477|       |            \
 2478|       |            X--
 2479|       |
 2480|       |            O
 2481|       |            ||
 2482|       |            in O=S--O(-)    (X -- non-terminal) fix single bond S-X (type 2)
 2483|       |            \
 2484|       |            X--
 2485|       |
 2486|       |            O
 2487|       |            ||
 2488|       |            in O=S--OH     (X -- non-terminal) fix single bond S-X (type 3)
 2489|       |            \
 2490|       |            X--
 2491|       |
 2492|       |            */
 2493|  1.67k|            int iN[4];  /* indexes of non-terminal neighbors connected by a single bond */
 2494|  1.67k|            num_N = 0; /* number of non-metal neighbors connected by a double bond */
 2495|  1.67k|            num_OH = 0; /* number of neighbors OH connected by a single bond */
 2496|  1.67k|            num_OM = 0; /* number of non-terminal neighbors connected by a single bond */
 2497|  1.67k|            num_O = 0; /* number of neighbors =O connected by a double bond */
 2498|  1.67k|            num_X = 0; /* number of terminal atom X != O connected by a single bond */
 2499|  1.67k|            num_other = 0;
 2500|  8.36k|            for (i1 = 0; i1 < a->valence; i1++)
  ------------------
  |  Branch (2500:26): [True: 6.69k, False: 1.67k]
  ------------------
 2501|  6.69k|            {
 2502|  6.69k|                n1 = (int) a->neighbor[i1];
 2503|  6.69k|                if (is_el_a_metal( at[n1].el_number ))
  ------------------
  |  Branch (2503:21): [True: 571, False: 6.12k]
  ------------------
 2504|    571|                {
 2505|    571|                    continue;
 2506|    571|                }
 2507|  6.12k|                bond_type = ( a->bond_type[i1] & BOND_TYPE_MASK );
  ------------------
  |  |  189|  6.12k|#define BOND_TYPE_MASK        0x0f
  ------------------
 2508|  6.12k|                if (BOND_TYPE_DOUBLE == bond_type)
  ------------------
  |  |   33|  6.12k|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2508:21): [True: 2.91k, False: 3.20k]
  ------------------
 2509|  2.91k|                {
 2510|  2.91k|                    num_N++;
 2511|  2.91k|                    if (( 0 == at[n1].charge
  ------------------
  |  Branch (2511:27): [True: 2.34k, False: 576]
  ------------------
 2512|    576|#if ( S_VI_O_PLUS_METAL_FIX_BOND == 1 )
 2513|    576|                          || (1 == at[n1].charge && 2 == at[n1].valence) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2513:31): [True: 254, False: 322]
  |  Branch (2513:53): [True: 50, False: 204]
  ------------------
 2514|  2.91k|#endif
 2515|  2.91k|                          ) &&
 2516|  2.39k|                         0 == at[n1].radical &&
  ------------------
  |  Branch (2516:26): [True: 2.36k, False: 25]
  ------------------
 2517|  2.36k|                         0 == num_of_H( at, n1 ) &&
  ------------------
  |  Branch (2517:26): [True: 2.31k, False: 47]
  ------------------
 2518|  2.31k|                         ion_el_group( at[n1].el_number ) == EL_NUMBER_O &&
  ------------------
  |  |   15|  5.23k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2518:26): [True: 2.02k, False: 291]
  ------------------
 2519|  2.02k|                         1 == nNoMetalNumBonds( at, n1 ))
  ------------------
  |  Branch (2519:26): [True: 1.56k, False: 460]
  ------------------
 2520|  1.56k|                    {
 2521|  1.56k|                        num_O++;
 2522|  1.56k|                    }
 2523|  2.91k|                }
 2524|  3.20k|                else if (BOND_TYPE_SINGLE == bond_type &&
  ------------------
  |  |   32|  3.20k|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2524:26): [True: 2.95k, False: 248]
  ------------------
 2525|  2.95k|                          1 == nNoMetalNumBonds( at, n1 ) &&
  ------------------
  |  Branch (2525:27): [True: 1.02k, False: 1.92k]
  ------------------
 2526|  1.02k|                          ion_el_group( at[n1].el_number ) == EL_NUMBER_O &&
  ------------------
  |  |   15|  4.23k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2526:27): [True: 664, False: 364]
  ------------------
 2527|    664|                          1 >= num_of_H( at, n1 ) &&
  ------------------
  |  Branch (2527:27): [True: 659, False: 5]
  ------------------
 2528|    659|                          1 == ( ( 0 == at[n1].charge ) && 1 == num_of_H( at, n1 ) )
  ------------------
  |  Branch (2528:27): [True: 547, False: 112]
  |  Branch (2528:34): [True: 176, False: 483]
  |  Branch (2528:60): [True: 65, False: 111]
  ------------------
 2529|    659|                          + ( ( -1 == at[n1].charge ) && 0 == num_of_H( at, n1 ) ))
  ------------------
  |  Branch (2529:31): [True: 483, False: 176]
  |  Branch (2529:58): [True: 482, False: 1]
  ------------------
 2530|    547|                {
 2531|    547|                    num_OH++; /* -OH or -O(-) */
 2532|    547|                }
 2533|  2.65k|                else if (BOND_TYPE_SINGLE == bond_type &&
  ------------------
  |  |   32|  2.65k|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2533:26): [True: 2.41k, False: 248]
  ------------------
 2534|  2.41k|                          1 < nNoMetalNumBonds( at, n1 ))
  ------------------
  |  Branch (2534:27): [True: 1.92k, False: 481]
  ------------------
 2535|  1.92k|                {
 2536|  1.92k|                    iN[num_OM++] = i1; /* non-terminal neighbor connected by a single bond */
 2537|  1.92k|                }
 2538|    729|                else if (BOND_TYPE_SINGLE == bond_type &&
  ------------------
  |  |   32|    729|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2538:26): [True: 481, False: 248]
  ------------------
 2539|    481|                          1 == nNoMetalNumBonds( at, n1 ))
  ------------------
  |  Branch (2539:27): [True: 481, False: 0]
  ------------------
 2540|    481|                {
 2541|    481|                    num_X++; /* other terminal neighbor connected by a single bond */
 2542|    481|                }
 2543|    248|                else
 2544|    248|                {
 2545|    248|                    num_other++;
 2546|    248|                }
 2547|  6.12k|            }
 2548|  1.67k|            if (num_N == num_O && 2 == num_O && 2 == num_OH + num_OM + num_X && 0 == num_other)
  ------------------
  |  Branch (2548:17): [True: 659, False: 1.01k]
  |  Branch (2548:35): [True: 476, False: 183]
  |  Branch (2548:49): [True: 279, False: 197]
  |  Branch (2548:81): [True: 279, False: 0]
  ------------------
 2549|    279|            {
 2550|    630|                for (i2 = 0; i2 < num_OM; i2++)
  ------------------
  |  Branch (2550:30): [True: 351, False: 279]
  ------------------
 2551|    351|                {
 2552|    351|                    i1 = iN[i2];
 2553|       |                    /* fix bond i1 */
 2554|    351|                    iedge = pBNS->vert[i].iedge[i1];
 2555|    351|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2556|    351|                    num_changes++;
 2557|    351|                }
 2558|    279|            }
 2559|  1.67k|        }
 2560|       |
 2561|  1.90M|        else if (!a->charge && !a->radical &&
  ------------------
  |  Branch (2561:18): [True: 1.68M, False: 219k]
  |  Branch (2561:32): [True: 1.66M, False: 24.0k]
  ------------------
 2562|  1.66M|                  6 <= a->chem_bonds_valence + NUMH( a, 0 ) - get_el_valence( a->el_number, 0, 0 ) &&
  ------------------
  |  |   56|  1.66M|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  1.66M|#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 (2562:19): [True: 2.66k, False: 1.66M]
  ------------------
 2563|  2.66k|                  0 == num_of_H( at, i ) &&
  ------------------
  |  Branch (2563:19): [True: 1.48k, False: 1.18k]
  ------------------
 2564|  1.48k|                  6 == nNoMetalBondsValence( at, i ) + NUMH( a, 0 ) - get_el_valence( a->el_number, 0, 0 ) &&
  ------------------
  |  |   56|  1.48k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  1.48k|#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 (2564:19): [True: 1.19k, False: 292]
  ------------------
 2565|  1.19k|                  a->el_number != EL_NUMBER_O && ion_el_group( a->el_number ) == EL_NUMBER_O &&
  ------------------
  |  |   15|  1.91M|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
                                a->el_number != EL_NUMBER_O && ion_el_group( a->el_number ) == EL_NUMBER_O &&
  ------------------
  |  |   15|  1.91M|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2565:19): [True: 1.18k, False: 8]
  |  Branch (2565:50): [True: 48, False: 1.13k]
  ------------------
 2566|     48|                  5 == nNoMetalNumBonds( at, i ))
  ------------------
  |  Branch (2566:19): [True: 45, False: 3]
  ------------------
 2567|     45|        {
 2568|       |            /* Found S(VIII), no H, three double bonds or two triple bond */
 2569|       |            /*
 2570|       |
 2571|       |            O
 2572|       |            ||
 2573|       |            in O=S--Y--     (X, Y -- non-terminal) fix single bond S-X, S-Y (type 4)
 2574|       |            //\
 2575|       |            O   X--
 2576|       |
 2577|       |            note: this structure is a mistakenly drawn structure
 2578|       |
 2579|       |            O                  O
 2580|       |            ||                 ||
 2581|       |            O=S--O--Y--  or    O=S--Y--
 2582|       |            \                  \
 2583|       |            X--                O--X--
 2584|       |
 2585|       |
 2586|       |            */
 2587|     45|            int iN[5];  /* indexes of non-terminal neighbors connected by a single bond */
 2588|     45|            num_N = 0; /* number of non-metal neighbors connected by a double bond */
 2589|     45|            num_OH = 0; /* number of neighbors OH connected by a single bond */
 2590|     45|            num_OM = 0; /* number of non-terminal neighbors connected by a single bond */
 2591|     45|            num_O = 0; /* number of neighbors =O connected by a double bond */
 2592|     45|            num_X = 0; /* number of terminal atom X != O connected by a single bond */
 2593|     45|            num_other = 0;
 2594|    270|            for (i1 = 0; i1 < a->valence; i1++)
  ------------------
  |  Branch (2594:26): [True: 225, False: 45]
  ------------------
 2595|    225|            {
 2596|    225|                n1 = (int) a->neighbor[i1];
 2597|    225|                if (is_el_a_metal( at[n1].el_number ))
  ------------------
  |  Branch (2597:21): [True: 92, False: 133]
  ------------------
 2598|     92|                {
 2599|     92|                    continue;
 2600|     92|                }
 2601|    133|                bond_type = ( a->bond_type[i1] & BOND_TYPE_MASK );
  ------------------
  |  |  189|    133|#define BOND_TYPE_MASK        0x0f
  ------------------
 2602|    133|                if (BOND_TYPE_DOUBLE == bond_type)
  ------------------
  |  |   33|    133|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2602:21): [True: 57, False: 76]
  ------------------
 2603|     57|                {
 2604|     57|                    num_N++;
 2605|     57|                    if (( 0 == at[n1].charge
  ------------------
  |  Branch (2605:27): [True: 46, False: 11]
  ------------------
 2606|     11|#if ( S_VI_O_PLUS_METAL_FIX_BOND == 1 )
 2607|     11|                          || (1 == at[n1].charge && 2 == at[n1].valence) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2607:31): [True: 1, False: 10]
  |  Branch (2607:53): [True: 0, False: 1]
  ------------------
 2608|     57|#endif
 2609|     57|                          )
 2610|     46|                         && 0 == at[n1].radical &&
  ------------------
  |  Branch (2610:29): [True: 46, False: 0]
  ------------------
 2611|     46|                         0 == num_of_H( at, n1 ) &&
  ------------------
  |  Branch (2611:26): [True: 45, False: 1]
  ------------------
 2612|     45|                         ion_el_group( at[n1].el_number ) == EL_NUMBER_O &&
  ------------------
  |  |   15|    102|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2612:26): [True: 36, False: 9]
  ------------------
 2613|     36|                         1 == nNoMetalNumBonds( at, n1 ))
  ------------------
  |  Branch (2613:26): [True: 35, False: 1]
  ------------------
 2614|     35|                    {
 2615|     35|                        num_O++;
 2616|     35|                    }
 2617|     57|                }
 2618|     76|                else if (BOND_TYPE_SINGLE == bond_type &&
  ------------------
  |  |   32|     76|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2618:26): [True: 33, False: 43]
  ------------------
 2619|     33|                          1 == nNoMetalNumBonds( at, n1 ) &&
  ------------------
  |  Branch (2619:27): [True: 18, False: 15]
  ------------------
 2620|     18|                          ion_el_group( at[n1].el_number ) == EL_NUMBER_O &&
  ------------------
  |  |   15|     94|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2620:27): [True: 7, False: 11]
  ------------------
 2621|      7|                          1 >= num_of_H( at, n1 ) &&
  ------------------
  |  Branch (2621:27): [True: 7, False: 0]
  ------------------
 2622|      7|                          1 == ( ( 0 == at[n1].charge ) && 1 == num_of_H( at, n1 ) )
  ------------------
  |  Branch (2622:27): [True: 7, False: 0]
  |  Branch (2622:34): [True: 3, False: 4]
  |  Branch (2622:60): [True: 3, False: 0]
  ------------------
 2623|      7|                          + ( ( -1 == at[n1].charge ) && 0 == num_of_H( at, n1 ) ))
  ------------------
  |  Branch (2623:31): [True: 4, False: 3]
  |  Branch (2623:58): [True: 4, False: 0]
  ------------------
 2624|      7|                {
 2625|      7|                    num_OH++; /* -OH or -O(-) */
 2626|      7|                }
 2627|     69|                else
 2628|     69|                {
 2629|     69|                    if (BOND_TYPE_SINGLE == bond_type &&
  ------------------
  |  |   32|     69|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2629:25): [True: 26, False: 43]
  ------------------
 2630|     26|                         1 < nNoMetalNumBonds( at, n1 ))
  ------------------
  |  Branch (2630:26): [True: 15, False: 11]
  ------------------
 2631|     15|                    {
 2632|       |
 2633|     15|                        iN[num_OM++] = i1; /* non-terminal neighbor connected by a single bond */
 2634|     15|                    }
 2635|     54|                    else
 2636|     54|                    {
 2637|     54|                        if (BOND_TYPE_SINGLE == bond_type && 1 == nNoMetalNumBonds( at, n1 ))
  ------------------
  |  |   32|     54|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2637:29): [True: 11, False: 43]
  |  Branch (2637:62): [True: 11, False: 0]
  ------------------
 2638|     11|                        {
 2639|       |
 2640|     11|                            num_X++; /* other terminal neighbor connected by a single bond */
 2641|     11|                        }
 2642|     43|                        else
 2643|     43|                        {
 2644|     43|                            num_other++;
 2645|     43|                        }
 2646|     54|                    }
 2647|     69|                }
 2648|    133|            }
 2649|     45|            if (num_N == num_O && 3 == num_O && 2 == num_OH + num_OM + num_X && 0 == num_other)
  ------------------
  |  Branch (2649:17): [True: 24, False: 21]
  |  Branch (2649:35): [True: 4, False: 20]
  |  Branch (2649:49): [True: 0, False: 4]
  |  Branch (2649:81): [True: 0, False: 0]
  ------------------
 2650|      0|            {
 2651|      0|                for (i2 = 0; i2 < num_OM; i2++)
  ------------------
  |  Branch (2651:30): [True: 0, False: 0]
  ------------------
 2652|      0|                {
 2653|      0|                    i1 = iN[i2];
 2654|       |                    /* fix bond i1 */
 2655|      0|                    iedge = pBNS->vert[i].iedge[i1];
 2656|      0|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2657|      0|                    num_changes++;
 2658|      0|                }
 2659|      0|            }
 2660|     45|        }
 2661|       |
 2662|  1.93M|    } /* for (i =  */
 2663|       |
 2664|   376k|    return num_changes;
 2665|   376k|}
is_Z_atom:
 2747|   699k|{
 2748|   699k|    switch ( el_number ) 
 2749|   699k|    {
 2750|   123k|        case EL_NUMBER_C: /* fallthrough */
  ------------------
  |  |   13|   123k|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (2750:9): [True: 123k, False: 576k]
  ------------------
 2751|   422k|        case EL_NUMBER_N:
  ------------------
  |  |   14|   422k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (2751:9): [True: 298k, False: 401k]
  ------------------
 2752|   483k|        case EL_NUMBER_P:
  ------------------
  |  |   18|   483k|#define EL_NUMBER_P  ((U_CHAR)15)
  ------------------
  |  Branch (2752:9): [True: 60.9k, False: 639k]
  ------------------
 2753|   487k|        case EL_NUMBER_AS:
  ------------------
  |  |   22|   487k|#define EL_NUMBER_AS ((U_CHAR)33)
  ------------------
  |  Branch (2753:9): [True: 4.13k, False: 695k]
  ------------------
 2754|   489k|        case EL_NUMBER_SB:
  ------------------
  |  |   25|   489k|#define EL_NUMBER_SB ((U_CHAR)51)
  ------------------
  |  Branch (2754:9): [True: 2.81k, False: 697k]
  ------------------
 2755|   551k|        case EL_NUMBER_S:
  ------------------
  |  |   19|   551k|#define EL_NUMBER_S  ((U_CHAR)16)
  ------------------
  |  Branch (2755:9): [True: 61.2k, False: 638k]
  ------------------
 2756|   558k|        case EL_NUMBER_SE:
  ------------------
  |  |   23|   558k|#define EL_NUMBER_SE ((U_CHAR)34)
  ------------------
  |  Branch (2756:9): [True: 7.21k, False: 692k]
  ------------------
 2757|   572k|        case EL_NUMBER_TE:
  ------------------
  |  |   26|   572k|#define EL_NUMBER_TE ((U_CHAR)52)
  ------------------
  |  Branch (2757:9): [True: 13.6k, False: 686k]
  ------------------
 2758|   572k|        case EL_NUMBER_CL:
  ------------------
  |  |   20|   572k|#define EL_NUMBER_CL ((U_CHAR)17)
  ------------------
  |  Branch (2758:9): [True: 600, False: 699k]
  ------------------
 2759|   573k|        case EL_NUMBER_BR:
  ------------------
  |  |   24|   573k|#define EL_NUMBER_BR ((U_CHAR)35)
  ------------------
  |  Branch (2759:9): [True: 255, False: 699k]
  ------------------
 2760|   588k|        case EL_NUMBER_I:
  ------------------
  |  |   27|   588k|#define EL_NUMBER_I  ((U_CHAR)53)
  ------------------
  |  Branch (2760:9): [True: 15.6k, False: 684k]
  ------------------
 2761|       |#if ( ALL_NONMETAL_Z == 1 )        
 2762|       |        case EL_NUMBER_B:
 2763|       |        case EL_NUMBER_O:
 2764|       |        case EL_NUMBER_SI:
 2765|       |        case EL_NUMBER_GE:
 2766|       |        case EL_NUMBER_F:
 2767|       |        case EL_NUMBER_AT:
 2768|       |#endif        
 2769|   588k|            return 1;
 2770|   111k|        default:
  ------------------
  |  Branch (2770:9): [True: 111k, False: 588k]
  ------------------
 2771|   111k|            return 0;    
 2772|   699k|    }
 2773|   699k|}
IsZOX:
 2780|  18.8k|{
 2781|  18.8k|    inp_ATOM *at_Z = atom + atom[at_x].neighbor[ord];
 2782|       |
 2783|  18.8k|    int i, neigh, num_O;
 2784|       |
 2785|  91.7k|    for (i = 0, num_O = 0; i < at_Z->valence; i++)
  ------------------
  |  Branch (2785:28): [True: 72.8k, False: 18.8k]
  ------------------
 2786|  72.8k|    {
 2787|  72.8k|        neigh = at_Z->neighbor[i];
 2788|  72.8k|        if (neigh == at_x)
  ------------------
  |  Branch (2788:13): [True: 18.8k, False: 53.9k]
  ------------------
 2789|  18.8k|        {
 2790|  18.8k|            continue;
 2791|  18.8k|        }
 2792|  53.9k|        if (atom[neigh].valence == 1 &&
  ------------------
  |  Branch (2792:13): [True: 37.6k, False: 16.2k]
  ------------------
 2793|  37.6k|             atom[neigh].chem_bonds_valence == 2 &&
  ------------------
  |  Branch (2793:14): [True: 18.7k, False: 18.9k]
  ------------------
 2794|  18.7k|             atom[neigh].charge == 0 &&
  ------------------
  |  Branch (2794:14): [True: 10.2k, False: 8.48k]
  ------------------
 2795|  10.2k|             atom[neigh].radical == 0 &&
  ------------------
  |  Branch (2795:14): [True: 10.1k, False: 80]
  ------------------
 2796|  10.1k|             ( atom[neigh].el_number == EL_NUMBER_O ||
  ------------------
  |  |   15|  20.3k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2796:16): [True: 6.44k, False: 3.71k]
  ------------------
 2797|  3.71k|               atom[neigh].el_number == EL_NUMBER_S ||
  ------------------
  |  |   19|  13.8k|#define EL_NUMBER_S  ((U_CHAR)16)
  ------------------
  |  Branch (2797:16): [True: 2.51k, False: 1.19k]
  ------------------
 2798|  1.19k|               atom[neigh].el_number == EL_NUMBER_SE ||
  ------------------
  |  |   23|  11.3k|#define EL_NUMBER_SE ((U_CHAR)34)
  ------------------
  |  Branch (2798:16): [True: 717, False: 482]
  ------------------
 2799|    482|               atom[neigh].el_number == EL_NUMBER_TE ))
  ------------------
  |  |   26|    482|#define EL_NUMBER_TE ((U_CHAR)52)
  ------------------
  |  Branch (2799:16): [True: 313, False: 169]
  ------------------
 2800|  9.98k|        {
 2801|  9.98k|            num_O++;
 2802|  9.98k|        }
 2803|  53.9k|    }
 2804|       |
 2805|  18.8k|    return num_O;
 2806|  18.8k|}
GetAtomChargeType:
 2843|  1.76M|{
 2844|       |
 2845|  1.76M|    inp_ATOM *at = atom + at_no;
 2846|  1.76M|#if ( FIX_NORM_BUG_ADD_ION_PAIR == 1 )
 2847|  1.76M|    int i, neigh, mask, type, num_z, num_m, num_o, delta = bSubtract > 0 ? -1 : 1; /* 0 or -2 => add, 1 or 2 => subtract */
  ------------------
  |  Branch (2847:60): [True: 5.78k, False: 1.76M]
  ------------------
 2848|  1.76M|    int32_t bit; /* djb-rwth: fixing coverity ID #499579 */
 2849|  1.76M|    int bNoAdjIon = ( bSubtract == 0 || bSubtract == 1 );
  ------------------
  |  Branch (2849:23): [True: 1.76M, False: 6.23k]
  |  Branch (2849:41): [True: 5.33k, False: 900]
  ------------------
 2850|       |#else
 2851|       |    int i, neigh, mask, bit, type, num_z, num_m, num_o, delta = bSubtract ? -1 : 1;
 2852|       |#endif
 2853|  1.76M|    int bUnsatNHasTerminalO = 0;
 2854|       |
 2855|  1.76M|    type = ATT_NONE;
  ------------------
  |  |   30|  1.76M|#define ATT_NONE 0x0000
  ------------------
 2856|  1.76M|    mask = 0;
 2857|       |
 2858|  1.76M|    if (at->radical && at->radical != RADICAL_SINGLET)
  ------------------
  |  |   75|  79.8k|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2858:9): [True: 79.8k, False: 1.68M]
  |  Branch (2858:24): [True: 79.8k, False: 0]
  ------------------
 2859|  79.8k|    {
 2860|  79.8k|        goto exit_function;
 2861|  79.8k|    }
 2862|       |    
 2863|  1.68M|    if (is_el_a_metal( at->el_number ))
  ------------------
  |  Branch (2863:9): [True: 379k, False: 1.30M]
  ------------------
 2864|   379k|    {
 2865|   379k|        goto exit_function;
 2866|   379k|    }
 2867|  1.30M|    if (at->charge < -1 || at->charge > 1)
  ------------------
  |  Branch (2867:9): [True: 825, False: 1.30M]
  |  Branch (2867:28): [True: 185, False: 1.30M]
  ------------------
 2868|  1.01k|    {
 2869|  1.01k|        goto exit_function;
 2870|  1.01k|    }
 2871|       |
 2872|  1.30M|    if (!at->valence && at->charge == 1 && !at->num_H && !at->radical && at->el_number == EL_NUMBER_H)
  ------------------
  |  |   11|   175k|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
  |  Branch (2872:9): [True: 640k, False: 667k]
  |  Branch (2872:25): [True: 175k, False: 464k]
  |  Branch (2872:44): [True: 175k, False: 132]
  |  Branch (2872:58): [True: 175k, False: 0]
  |  Branch (2872:74): [True: 175k, False: 85]
  ------------------
 2873|   175k|    {
 2874|       |        /* a proton H+ (#1) */
 2875|   175k|        type = ATT_PROTON;
  ------------------
  |  |   43|   175k|#define ATT_PROTON 0x1000
  ------------------
 2876|   175k|        mask = ATBIT_Proton;
  ------------------
  |  |  119|   175k|#define ATBIT_Proton     (1 << ATTOT_NUM_Proton)
  ------------------
 2877|   175k|        goto count_mask_bits;
 2878|   175k|    }
 2879|       |
 2880|  1.13M|    if (  !at->valence && at->charge == -1	&& 
  ------------------
  |  Branch (2880:11): [True: 464k, False: 667k]
  |  Branch (2880:27): [True: 287, False: 464k]
  ------------------
 2881|    287|          !at->num_H && !at->radical		&&
  ------------------
  |  Branch (2881:11): [True: 35, False: 252]
  |  Branch (2881:25): [True: 35, False: 0]
  ------------------
 2882|     35|          (	at->el_number == EL_NUMBER_F || at->el_number == EL_NUMBER_CL	||
  ------------------
  |  |   16|     70|#define EL_NUMBER_F  ((U_CHAR)9)
  ------------------
                        (	at->el_number == EL_NUMBER_F || at->el_number == EL_NUMBER_CL	||
  ------------------
  |  |   20|     66|#define EL_NUMBER_CL ((U_CHAR)17)
  ------------------
  |  Branch (2882:13): [True: 4, False: 31]
  |  Branch (2882:45): [True: 0, False: 31]
  ------------------
 2883|     31|            at->el_number == EL_NUMBER_BR || at->el_number == EL_NUMBER_I	 ) 
  ------------------
  |  |   24|     66|#define EL_NUMBER_BR ((U_CHAR)35)
  ------------------
                          at->el_number == EL_NUMBER_BR || at->el_number == EL_NUMBER_I	 ) 
  ------------------
  |  |   27|     31|#define EL_NUMBER_I  ((U_CHAR)53)
  ------------------
  |  Branch (2883:13): [True: 0, False: 31]
  |  Branch (2883:46): [True: 2, False: 29]
  ------------------
 2884|  1.13M|        )
 2885|      6|    {
 2886|       |        /* a halogen anion Hal- (#2) */
 2887|      6|        type = ATT_HalAnion;
  ------------------
  |  |   44|      6|#define ATT_HalAnion 0x2000
  ------------------
 2888|      6|        mask = ATBIT_HalAnion;
  ------------------
  |  |  120|      6|#define ATBIT_HalAnion   (1 << ATTOT_NUM_HalAnion)
  ------------------
 2889|      6|        goto count_mask_bits;
 2890|      6|    }
 2891|  1.13M|#if ( HAL_ACID_H_XCHG == 1 )
 2892|       |    /* halogen/chalcogen acid */
 2893|  1.13M|    if ((!at->valence && at->charge == 0 && 1 == at->num_H && !at->radical &&
  ------------------
  |  Branch (2893:10): [True: 464k, False: 667k]
  |  Branch (2893:26): [True: 464k, False: 498]
  |  Branch (2893:45): [True: 1.18k, False: 463k]
  |  Branch (2893:63): [True: 1.18k, False: 0]
  ------------------
 2894|  1.18k|        ( at->el_number == EL_NUMBER_F ||
  ------------------
  |  |   16|  2.36k|#define EL_NUMBER_F  ((U_CHAR)9)
  ------------------
  |  Branch (2894:11): [True: 568, False: 614]
  ------------------
 2895|    614|          at->el_number == EL_NUMBER_CL ||
  ------------------
  |  |   20|  1.79k|#define EL_NUMBER_CL ((U_CHAR)17)
  ------------------
  |  Branch (2895:11): [True: 0, False: 614]
  ------------------
 2896|    614|          at->el_number == EL_NUMBER_BR ||
  ------------------
  |  |   24|  1.79k|#define EL_NUMBER_BR ((U_CHAR)35)
  ------------------
  |  Branch (2896:11): [True: 418, False: 196]
  ------------------
 2897|    196|          at->el_number == EL_NUMBER_I )) ||
  ------------------
  |  |   27|    196|#define EL_NUMBER_I  ((U_CHAR)53)
  ------------------
  |  Branch (2897:11): [True: 114, False: 82]
  ------------------
 2898|  1.13M|         (!at->valence && at->charge == 0 && 2 == at->num_H && !at->radical &&
  ------------------
  |  Branch (2898:11): [True: 463k, False: 667k]
  |  Branch (2898:27): [True: 463k, False: 498]
  |  Branch (2898:46): [True: 442, False: 462k]
  |  Branch (2898:64): [True: 442, False: 0]
  ------------------
 2899|    442|         ( at->el_number == EL_NUMBER_O ||
  ------------------
  |  |   15|    884|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2899:12): [True: 135, False: 307]
  ------------------
 2900|    307|           at->el_number == EL_NUMBER_S ||
  ------------------
  |  |   19|    749|#define EL_NUMBER_S  ((U_CHAR)16)
  ------------------
  |  Branch (2900:12): [True: 265, False: 42]
  ------------------
 2901|     42|           at->el_number == EL_NUMBER_SE ||
  ------------------
  |  |   23|    484|#define EL_NUMBER_SE ((U_CHAR)34)
  ------------------
  |  Branch (2901:12): [True: 16, False: 26]
  ------------------
 2902|     26|           at->el_number == EL_NUMBER_TE )) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   26|     26|#define EL_NUMBER_TE ((U_CHAR)52)
  ------------------
  |  Branch (2902:12): [True: 26, False: 0]
  ------------------
 2903|  1.13M|         )
 2904|  1.54k|    {
 2905|       |        /* a halogen/chalcogen acid (#3) */
 2906|  1.54k|        type = ATT_HalAcid;
  ------------------
  |  |   45|  1.54k|#define ATT_HalAcid 0x4000
  ------------------
 2907|  1.54k|        mask = ATBIT_HalAcid;
  ------------------
  |  |  121|  1.54k|#define ATBIT_HalAcid    (1 << ATTOT_NUM_HalAcid)
  ------------------
 2908|  1.54k|        goto count_mask_bits;
 2909|  1.54k|    }
 2910|  1.13M|#endif
 2911|       |
 2912|  1.13M|    if (detect_unusual_el_valence( at->el_number, at->charge, at->radical,
  ------------------
  |  Branch (2912:9): [True: 78.1k, False: 1.05M]
  ------------------
 2913|  1.13M|                                   at->chem_bonds_valence, at->num_H, at->valence ))
 2914|  78.1k|    {
 2915|  78.1k|        goto exit_function; /* unusual valence state */
 2916|  78.1k|    }
 2917|       |
 2918|       |    /* Check neighbors */
 2919|  1.75M|    for (i = 0, num_z = 0, num_m = 0, num_o = 0; i < at->valence; i++)
  ------------------
  |  Branch (2919:50): [True: 941k, False: 811k]
  ------------------
 2920|   941k|    {
 2921|   941k|        neigh = at->neighbor[i];
 2922|   941k|#if ( FIX_NORM_BUG_ADD_ION_PAIR == 1 )
 2923|   941k|        if (atom[neigh].charge < -1 || atom[neigh].charge > 1)
  ------------------
  |  Branch (2923:13): [True: 3.93k, False: 937k]
  |  Branch (2923:40): [True: 13.1k, False: 924k]
  ------------------
 2924|  17.0k|        {
 2925|  17.0k|            goto exit_function; /* neighboring charge */
 2926|  17.0k|        }
 2927|   924k|        if (atom[neigh].charge && at->charge)
  ------------------
  |  Branch (2927:13): [True: 322k, False: 601k]
  |  Branch (2927:35): [True: 98.8k, False: 223k]
  ------------------
 2928|  98.8k|        {
 2929|  98.8k|            if (bNoAdjIon)
  ------------------
  |  Branch (2929:17): [True: 98.8k, False: 0]
  ------------------
 2930|  98.8k|            {
 2931|  98.8k|#if ( FIX_RENUM_BUG_FOR_CASE_OF_ACIDIC_OH_AT_P_PLUS == 1 )
 2932|  98.8k|                goto count_mask_bits;
 2933|       |                /*update_some_attype_totals(nAtTypeTotals, mask, delta, at->charge);*/
 2934|      0|#endif
 2935|      0|                goto exit_function; /* neighboring charge */
 2936|  98.8k|            }
 2937|      0|            type = ATT_NONE;
  ------------------
  |  |   30|      0|#define ATT_NONE 0x0000
  ------------------
 2938|      0|            mask = 0;
 2939|      0|            goto count_mask_bits;
 2940|  98.8k|        }
 2941|       |#else
 2942|       |        if (atom[neigh].charge < -1 || atom[neigh].charge > 1 || atom[neigh].charge && at->charge)
 2943|       |        {
 2944|       |            goto exit_function; /* neighboring charge */
 2945|       |        }
 2946|       |#endif
 2947|   825k|        if (detect_unusual_el_valence( atom[neigh].el_number, atom[neigh].charge, atom[neigh].radical,
  ------------------
  |  Branch (2947:13): [True: 125k, False: 699k]
  ------------------
 2948|   825k|                                       atom[neigh].chem_bonds_valence, atom[neigh].num_H,
 2949|   825k|                                       atom[neigh].valence ))
 2950|   125k|        {
 2951|       |            /* neighbor in unusual valence state */
 2952|   125k|            goto exit_function;
 2953|   125k|        }
 2954|   699k|        if (is_Z_atom( atom[neigh].el_number ))
  ------------------
  |  Branch (2954:13): [True: 588k, False: 111k]
  ------------------
 2955|   588k|        {
 2956|   588k|            num_z++;
 2957|   588k|        }
 2958|   699k|        if (is_el_a_metal( atom[neigh].el_number ))
  ------------------
  |  Branch (2958:13): [True: 31.8k, False: 668k]
  ------------------
 2959|  31.8k|        {
 2960|  31.8k|            num_m++;
 2961|  31.8k|        }
 2962|   699k|        num_o += ( atom[neigh].el_number == EL_NUMBER_O );
  ------------------
  |  |   15|   699k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
 2963|   699k|        if (at->el_number == EL_NUMBER_N && at->valence == 2 && !at->charge &&
  ------------------
  |  |   14|  1.39M|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (2963:13): [True: 315k, False: 383k]
  |  Branch (2963:45): [True: 172k, False: 143k]
  |  Branch (2963:65): [True: 108k, False: 64.5k]
  ------------------
 2964|       |             /*at->valence < at->chem_bonds_valence &&*/
 2965|   108k|             atom[neigh].valence == 1 && atom[neigh].chem_bonds_valence == 2 &&
  ------------------
  |  Branch (2965:14): [True: 18.2k, False: 90.1k]
  |  Branch (2965:42): [True: 10.0k, False: 8.19k]
  ------------------
 2966|  10.0k|             ( atom[neigh].el_number == EL_NUMBER_O ||
  ------------------
  |  |   15|  20.0k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2966:16): [True: 640, False: 9.40k]
  ------------------
 2967|  9.40k|               atom[neigh].el_number == EL_NUMBER_S ||
  ------------------
  |  |   19|  19.4k|#define EL_NUMBER_S  ((U_CHAR)16)
  ------------------
  |  Branch (2967:16): [True: 1.71k, False: 7.69k]
  ------------------
 2968|  7.69k|               atom[neigh].el_number == EL_NUMBER_SE ||
  ------------------
  |  |   23|  17.7k|#define EL_NUMBER_SE ((U_CHAR)34)
  ------------------
  |  Branch (2968:16): [True: 295, False: 7.39k]
  ------------------
 2969|  7.39k|               atom[neigh].el_number == EL_NUMBER_TE ))
  ------------------
  |  |   26|  7.39k|#define EL_NUMBER_TE ((U_CHAR)52)
  ------------------
  |  Branch (2969:16): [True: 602, False: 6.79k]
  ------------------
 2970|  3.25k|        {
 2971|  3.25k|            bUnsatNHasTerminalO++;
 2972|  3.25k|        }
 2973|   699k|    } /* eof check neighbors */
 2974|       |
 2975|       |    /* O, S, Se, Te */
 2976|   811k|    if ( at->el_number == EL_NUMBER_O	||
  ------------------
  |  |   15|  1.62M|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2976:10): [True: 206k, False: 604k]
  ------------------
 2977|   604k|         at->el_number == EL_NUMBER_S	||
  ------------------
  |  |   19|  1.41M|#define EL_NUMBER_S  ((U_CHAR)16)
  ------------------
  |  Branch (2977:10): [True: 71.5k, False: 532k]
  ------------------
 2978|   532k|         at->el_number == EL_NUMBER_SE	||
  ------------------
  |  |   23|  1.34M|#define EL_NUMBER_SE ((U_CHAR)34)
  ------------------
  |  Branch (2978:10): [True: 4.55k, False: 528k]
  ------------------
 2979|   528k|         at->el_number == EL_NUMBER_TE	 )
  ------------------
  |  |   26|   528k|#define EL_NUMBER_TE ((U_CHAR)52)
  ------------------
  |  Branch (2979:10): [True: 7.92k, False: 520k]
  ------------------
 2980|   290k|    {
 2981|   290k|        if (at->charge == 1)
  ------------------
  |  Branch (2981:13): [True: 5.44k, False: 285k]
  ------------------
 2982|  5.44k|        {
 2983|  5.44k|            if (at->num_H)
  ------------------
  |  Branch (2983:17): [True: 1.45k, False: 3.99k]
  ------------------
 2984|  1.45k|            {
 2985|       |                /* #4 */
 2986|  1.45k|                type = ATT_O_PLUS;
  ------------------
  |  |   42|  1.45k|#define ATT_O_PLUS 0x0800   /**< -OH2(+), =OH(+), -OH(+)-, OH3(+), =O(+)-, etc; O=O,S,Se,Te */
  ------------------
 2987|  1.45k|                mask |= ATBIT_OH_Plus;
  ------------------
  |  |  117|  1.45k|#define ATBIT_OH_Plus    (1 << ATTOT_NUM_OH_Plus)
  ------------------
 2988|  1.45k|            }
 2989|  3.99k|            else
 2990|  3.99k|            {
 2991|       |                /* #5 */
 2992|  3.99k|                type = ATT_O_PLUS;
  ------------------
  |  |   42|  3.99k|#define ATT_O_PLUS 0x0800   /**< -OH2(+), =OH(+), -OH(+)-, OH3(+), =O(+)-, etc; O=O,S,Se,Te */
  ------------------
 2993|  3.99k|                mask |= ATBIT_O_Plus;
  ------------------
  |  |  118|  3.99k|#define ATBIT_O_Plus     (1 << ATTOT_NUM_O_Plus)
  ------------------
 2994|  3.99k|            }
 2995|  5.44k|        }
 2996|   285k|        else
 2997|   285k|        {
 2998|       |            /* at->charge != 1 */
 2999|   285k|            if (at->valence > 1)
  ------------------
  |  Branch (2999:17): [True: 19.7k, False: 265k]
  ------------------
 3000|  19.7k|            {
 3001|  19.7k|                goto exit_function;  /* not a terminal atom #C1 */
 3002|  19.7k|            }
 3003|   265k|            else
 3004|   265k|            {
 3005|   265k|                if (at->valence && !( num_z || num_o ))
  ------------------
  |  Branch (3005:21): [True: 73.0k, False: 192k]
  |  Branch (3005:39): [True: 65.1k, False: 7.87k]
  |  Branch (3005:48): [True: 6.10k, False: 1.76k]
  ------------------
 3006|  1.76k|                {
 3007|  1.76k|                    if (num_m == at->valence)
  ------------------
  |  Branch (3007:25): [True: 541, False: 1.22k]
  ------------------
 3008|    541|                    {
 3009|    541|                        goto exit_function; /* #C2 */
 3010|    541|                    }
 3011|  1.22k|                    goto count_mask_bits;  /* #C3 count charges, no donor or acceptor found */
 3012|  1.76k|                }
 3013|   263k|                else
 3014|   263k|                {
 3015|       |                    /* Here at->neigh[0] is one of: O, or Z={C, N, P, As, Sb, S, Se, Te, Cl, Br, I} */
 3016|   263k|                    if (at->valence)
  ------------------
  |  Branch (3016:25): [True: 71.2k, False: 192k]
  ------------------
 3017|  71.2k|                    {
 3018|  71.2k|                        neigh = at->neighbor[0]; /* Z or O only */
 3019|  71.2k|                        if (!atom[neigh].charge && atom[neigh].el_number == EL_NUMBER_C &&
  ------------------
  |  |   13|   135k|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (3019:29): [True: 64.1k, False: 7.15k]
  |  Branch (3019:52): [True: 14.3k, False: 49.8k]
  ------------------
 3020|  14.3k|                             atom[neigh].chem_bonds_valence > atom[neigh].valence)
  ------------------
  |  Branch (3020:30): [True: 11.5k, False: 2.73k]
  ------------------
 3021|  11.5k|                        {
 3022|       |                            /* =C-OH, #C-OH, =C-O(-), #C-O(-), -C=O, =C=O; O = O, S, Se, Te */
 3023|  11.5k|                            type = ATT_ACIDIC_CO;
  ------------------
  |  |   31|  11.5k|#define ATT_ACIDIC_CO 0x0001
  ------------------
 3024|  11.5k|                            if (at->num_H == 1)
  ------------------
  |  Branch (3024:33): [True: 2.68k, False: 8.89k]
  ------------------
 3025|  2.68k|                            {
 3026|  2.68k|                                mask |= ( ATBIT_COH );            /* #6: =C-OH, #C-OH; O=O,S,Se,Te */
  ------------------
  |  |   98|  2.68k|#define ATBIT_COH        (1 << ATTOT_NUM_COH)
  ------------------
 3027|       |                                                                  /*nAtTypeTotals[ATTOT_NUM_COH] ++;*/
 3028|  2.68k|                            }
 3029|  8.89k|                            else
 3030|  8.89k|                            {
 3031|  8.89k|                                if (at->charge == -1)
  ------------------
  |  Branch (3031:37): [True: 5.99k, False: 2.89k]
  ------------------
 3032|  5.99k|                                {
 3033|  5.99k|                                    mask |= ( ATBIT_CO_Minus );       /* #7: =C-O(-), #C-O(-); O=O,S,Se,Te */
  ------------------
  |  |  109|  5.99k|#define ATBIT_CO_Minus   (1 << ATTOT_NUM_CO_Minus)
  ------------------
 3034|       |                                                                      /*nAtTypeTotals[ATTOT_NUM_CO_Minus] ++;*/
 3035|  5.99k|                                }
 3036|  2.89k|                                else
 3037|  2.89k|                                {
 3038|  2.89k|                                    if (!at->num_H && !at->charge)
  ------------------
  |  Branch (3038:41): [True: 2.88k, False: 14]
  |  Branch (3038:55): [True: 2.88k, False: 0]
  ------------------
 3039|  2.88k|                                    {
 3040|  2.88k|                                        mask |= ( ATBIT_CO );             /* #8 -C=O, =C=O; O=O,S,Se,Te */
  ------------------
  |  |  105|  2.88k|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  ------------------
 3041|       |                                                                          /*nAtTypeTotals[ATTOT_NUM_CO] ++;*/
 3042|  2.88k|                                    }
 3043|     14|                                    else
 3044|     14|                                    {
 3045|     14|                                        mask |= ( ATBIT_Errors );
  ------------------
  |  |  124|     14|#define ATBIT_Errors     (1 << ATTOT_NUM_Errors)
  ------------------
 3046|       |                                        /*nAtTypeTotals[ATTOT_NUM_Errors] ++;*/
 3047|     14|                                    }
 3048|  2.89k|                                }
 3049|  8.89k|                            }
 3050|  11.5k|                        }
 3051|  59.6k|                        else
 3052|  59.6k|                        {
 3053|  59.6k|                            if (!atom[neigh].charge &&
  ------------------
  |  Branch (3053:33): [True: 52.5k, False: 7.15k]
  ------------------
 3054|  52.5k|                                ( atom[neigh].el_number == EL_NUMBER_O ||
  ------------------
  |  |   15|   105k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (3054:35): [True: 5.53k, False: 46.9k]
  ------------------
 3055|  46.9k|                                  atom[neigh].el_number == EL_NUMBER_S ||
  ------------------
  |  |   19|  99.5k|#define EL_NUMBER_S  ((U_CHAR)16)
  ------------------
  |  Branch (3055:35): [True: 6.87k, False: 40.1k]
  ------------------
 3056|  40.1k|                                  atom[neigh].el_number == EL_NUMBER_SE ||
  ------------------
  |  |   23|  92.6k|#define EL_NUMBER_SE ((U_CHAR)34)
  ------------------
  |  Branch (3056:35): [True: 1.85k, False: 38.2k]
  ------------------
 3057|  38.2k|                                  atom[neigh].el_number == EL_NUMBER_TE ) &&
  ------------------
  |  |   26|  38.2k|#define EL_NUMBER_TE ((U_CHAR)52)
  ------------------
  |  Branch (3057:35): [True: 730, False: 37.5k]
  ------------------
 3058|  14.9k|                                 atom[neigh].chem_bonds_valence == atom[neigh].valence)
  ------------------
  |  Branch (3058:34): [True: 8.59k, False: 6.39k]
  ------------------
 3059|  8.59k|                            {
 3060|       |                                /* -O-OH, -O-O(-); O = O, S, Se, Te */
 3061|  8.59k|                                type = ATT_OO;
  ------------------
  |  |   33|  8.59k|#define ATT_OO 0x0004
  ------------------
 3062|  8.59k|                                if (at->num_H == 1)
  ------------------
  |  Branch (3062:37): [True: 3.05k, False: 5.54k]
  ------------------
 3063|  3.05k|                                {
 3064|  3.05k|                                    mask |= ( ATBIT_OOH );            /* #9 -O-OH */
  ------------------
  |  |  101|  3.05k|#define ATBIT_OOH        (1 << ATTOT_NUM_OOH)
  ------------------
 3065|       |                                                                      /*nAtTypeTotals[ATTOT_NUM_OOH] ++;*/
 3066|  3.05k|                                }
 3067|  5.54k|                                else
 3068|  5.54k|                                {
 3069|  5.54k|                                    if (at->charge == -1)
  ------------------
  |  Branch (3069:41): [True: 5.53k, False: 14]
  ------------------
 3070|  5.53k|                                    {
 3071|  5.53k|                                        mask |= ( ATBIT_OO_Minus );       /* #10 -O-O(-) */
  ------------------
  |  |  112|  5.53k|#define ATBIT_OO_Minus   (1 << ATTOT_NUM_OO_Minus)
  ------------------
 3072|       |                                                                          /*nAtTypeTotals[ATTOT_NUM_OO_Minus] ++;*/
 3073|  5.53k|                                    }
 3074|     14|                                    else
 3075|     14|                                    {
 3076|     14|                                        mask |= ( ATBIT_Errors );
  ------------------
  |  |  124|     14|#define ATBIT_Errors     (1 << ATTOT_NUM_Errors)
  ------------------
 3077|       |                                        /*nAtTypeTotals[ATTOT_NUM_Errors] ++;*/
 3078|     14|                                    }
 3079|  5.54k|                                }
 3080|  8.59k|                            }
 3081|  51.0k|                            else
 3082|  51.0k|                            {
 3083|  51.0k|                                if (!atom[neigh].charge &&
  ------------------
  |  Branch (3083:37): [True: 43.9k, False: 7.15k]
  ------------------
 3084|  43.9k|                                     atom[neigh].chem_bonds_valence == atom[neigh].valence &&
  ------------------
  |  Branch (3084:38): [True: 7.09k, False: 36.8k]
  ------------------
 3085|  7.09k|                                     atom[neigh].el_number == EL_NUMBER_C &&
  ------------------
  |  |   13|  58.1k|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (3085:38): [True: 2.73k, False: 4.36k]
  ------------------
 3086|  2.73k|                                     at->el_number != EL_NUMBER_O)
  ------------------
  |  |   15|  2.73k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (3086:38): [True: 2.53k, False: 193]
  ------------------
 3087|  2.53k|                                {
 3088|       |                                    /* >C-S(-), >C-SH; S = S, Se, Te  */
 3089|  2.53k|                                    type = ATT_ACIDIC_S;
  ------------------
  |  |   32|  2.53k|#define ATT_ACIDIC_S 0x0002
  ------------------
 3090|  2.53k|                                    if (at->num_H == 1)
  ------------------
  |  Branch (3090:41): [True: 634, False: 1.90k]
  ------------------
 3091|    634|                                    {
 3092|    634|                                        mask |= ( ATBIT_CSH );            /* #11: >C-SH, >CH-SH, -CH2-SH; S = S, Se, Te */
  ------------------
  |  |   99|    634|#define ATBIT_CSH        (1 << ATTOT_NUM_CSH)
  ------------------
 3093|       |                                                                          /*nAtTypeTotals[ATTOT_NUM_CSH] ++;*/
 3094|    634|                                    }
 3095|  1.90k|                                    else
 3096|  1.90k|                                    {
 3097|  1.90k|                                        if (at->charge == -1)
  ------------------
  |  Branch (3097:45): [True: 1.90k, False: 0]
  ------------------
 3098|  1.90k|                                        {
 3099|  1.90k|                                            mask |= ( ATBIT_CS_Minus );       /* #12: >C-S(-), >CH-S(-), -CH2-S(-); S = S, Se, Te  */
  ------------------
  |  |  110|  1.90k|#define ATBIT_CS_Minus   (1 << ATTOT_NUM_CS_Minus)
  ------------------
 3100|       |                                                                              /*nAtTypeTotals[ATTOT_NUM_CS_Minus] ++;*/
 3101|  1.90k|                                        }
 3102|      0|                                        else
 3103|      0|                                        {
 3104|      0|                                            mask |= ( ATBIT_Errors );
  ------------------
  |  |  124|      0|#define ATBIT_Errors     (1 << ATTOT_NUM_Errors)
  ------------------
 3105|       |                                            /*nAtTypeTotals[ATTOT_NUM_Errors] ++;*/
 3106|      0|                                        }
 3107|  1.90k|                                    }
 3108|  2.53k|                                }
 3109|  48.5k|                                else
 3110|  48.5k|                                {
 3111|  48.5k|                                    if (atom[neigh].el_number == EL_NUMBER_N &&
  ------------------
  |  |   14|  97.1k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (3111:41): [True: 16.4k, False: 32.1k]
  ------------------
 3112|  16.4k|                                         atom[neigh].valence == 2 &&
  ------------------
  |  Branch (3112:42): [True: 6.07k, False: 10.3k]
  ------------------
 3113|  6.07k|                                         ( !atom[neigh].num_H || (atom[neigh].num_H == 1 && atom[neigh].charge == 1) )) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3113:44): [True: 5.73k, False: 337]
  |  Branch (3113:67): [True: 293, False: 44]
  |  Branch (3113:93): [True: 105, False: 188]
  ------------------
 3114|  5.84k|                                    {
 3115|       |                                        /* N or N(-) or NH(+) neighbor */
 3116|  5.84k|                                        type = ATT_NO; /* single bond only */
  ------------------
  |  |   35|  5.84k|#define ATT_NO 0x0010
  ------------------
 3117|  5.84k|                                        if (at->num_H == 1)
  ------------------
  |  Branch (3117:45): [True: 409, False: 5.43k]
  ------------------
 3118|    409|                                        {
 3119|    409|                                            mask |= ( ATBIT_NOH );            /* #13: =N-OH, =NH(+)-OH, #N(+)-OH, -N(-)-OH; O = O, S, Se, Te */
  ------------------
  |  |  103|    409|#define ATBIT_NOH        (1 << ATTOT_NUM_NOH)
  ------------------
 3120|       |                                                                              /*nAtTypeTotals[ATTOT_NUM_NOH] ++;*/
 3121|    409|                                        }
 3122|  5.43k|                                        else
 3123|  5.43k|                                        {
 3124|  5.43k|                                            if (at->charge == -1)
  ------------------
  |  Branch (3124:49): [True: 1.07k, False: 4.35k]
  ------------------
 3125|  1.07k|                                            {
 3126|  1.07k|                                                mask |= ( ATBIT_NO_Minus );       /* #14: =N-O(-); O = O, S, Se, Te */
  ------------------
  |  |  114|  1.07k|#define ATBIT_NO_Minus   (1 << ATTOT_NUM_NO_Minus)
  ------------------
 3127|       |                                                                                  /*nAtTypeTotals[ATTOT_NUM_NO_Minus] ++;*/
 3128|  1.07k|                                            }
 3129|  4.35k|                                            else
 3130|  4.35k|                                            {
 3131|  4.35k|                                                if (atom[neigh].charge == 1 || atom[neigh].charge == 0)
  ------------------
  |  Branch (3131:53): [True: 1.07k, False: 3.28k]
  |  Branch (3131:80): [True: 3.24k, False: 35]
  ------------------
 3132|  4.32k|                                                {
 3133|  4.32k|                                                    mask |= ( ATBIT_NO );             /* #15: =N(+)=O, -NH(+)=O -N=O */
  ------------------
  |  |  107|  4.32k|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  ------------------
 3134|       |                                                                                      /*nAtTypeTotals[ATTOT_NUM_NO] ++;*/
 3135|  4.32k|                                                }
 3136|     35|                                                else
 3137|     35|                                                {
 3138|     35|                                                    mask |= ( ATBIT_Errors );
  ------------------
  |  |  124|     35|#define ATBIT_Errors     (1 << ATTOT_NUM_Errors)
  ------------------
 3139|       |                                                    /*nAtTypeTotals[ATTOT_NUM_Errors] ++;*/
 3140|     35|                                                }
 3141|  4.35k|                                            }
 3142|  5.43k|                                        }
 3143|  5.84k|                                    }
 3144|  42.7k|                                    else
 3145|  42.7k|                                    {
 3146|  42.7k|                                        if (atom[neigh].el_number == EL_NUMBER_N)
  ------------------
  |  |   14|  42.7k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (3146:45): [True: 10.5k, False: 32.1k]
  ------------------
 3147|  10.5k|                                        {
 3148|  10.5k|                                            type = ATT_N_O; /* #16: single bond only */
  ------------------
  |  |   36|  10.5k|#define ATT_N_O 0x0020
  ------------------
 3149|  10.5k|                                            if (at->num_H == 1)
  ------------------
  |  Branch (3149:49): [True: 367, False: 10.2k]
  ------------------
 3150|    367|                                            {
 3151|    367|                                                mask |= ( ATBIT_N_OH );            /* #16: -NH-OH, >N-OH or >N(+)<OH; O = O, S, Se, Te */
  ------------------
  |  |  104|    367|#define ATBIT_N_OH       (1 << ATTOT_NUM_N_OH)
  ------------------
 3152|       |                                                                                   /*nAtTypeTotals[ATTOT_NUM_NOH] ++;*/
 3153|    367|                                            }
 3154|  10.2k|                                            else
 3155|  10.2k|                                            {
 3156|  10.2k|                                                if (at->charge == -1)
  ------------------
  |  Branch (3156:53): [True: 5.64k, False: 4.57k]
  ------------------
 3157|  5.64k|                                                {
 3158|  5.64k|                                                    mask |= ( ATBIT_N_O_Minus );       /* #17: -NH-O(-), >N-O(-); O = O, S, Se, Te */
  ------------------
  |  |  115|  5.64k|#define ATBIT_N_O_Minus  (1 << ATTOT_NUM_N_O_Minus)
  ------------------
 3159|       |                                                                                       /*nAtTypeTotals[ATTOT_NUM_NO_Minus] ++;*/
 3160|  5.64k|                                                }
 3161|  4.57k|                                                else
 3162|  4.57k|                                                {
 3163|  4.57k|                                                    if (atom[neigh].charge == 1)
  ------------------
  |  Branch (3163:57): [True: 1.51k, False: 3.05k]
  ------------------
 3164|  1.51k|                                                    {
 3165|  1.51k|                                                        mask |= ( ATBIT_N_O );             /* #18:  >N(+)=O */
  ------------------
  |  |  108|  1.51k|#define ATBIT_N_O        (1 << ATTOT_NUM_N_O)
  ------------------
 3166|       |                                                                                           /*nAtTypeTotals[ATTOT_NUM_NO] ++;*/
 3167|  1.51k|                                                    }
 3168|  3.05k|                                                    else
 3169|  3.05k|                                                    {
 3170|  3.05k|                                                        mask |= ( ATBIT_Errors );
  ------------------
  |  |  124|  3.05k|#define ATBIT_Errors     (1 << ATTOT_NUM_Errors)
  ------------------
 3171|       |                                                        /*nAtTypeTotals[ATTOT_NUM_Errors] ++;*/
 3172|  3.05k|                                                    }
 3173|  4.57k|                                                }
 3174|  10.2k|                                            }
 3175|  10.5k|                                        }
 3176|  32.1k|                                        else
 3177|  32.1k|                                        {
 3178|  32.1k|                                            if ( atom[neigh].el_number != EL_NUMBER_C &&
  ------------------
  |  |   13|  64.2k|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (3178:50): [True: 31.5k, False: 606]
  ------------------
 3179|  31.5k|                                                 atom[neigh].el_number != EL_NUMBER_O &&
  ------------------
  |  |   15|  63.6k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (3179:50): [True: 30.9k, False: 576]
  ------------------
 3180|  30.9k|                                                 !is_el_a_metal( atom[neigh].el_number ) &&
  ------------------
  |  Branch (3180:50): [True: 30.6k, False: 260]
  ------------------
 3181|  30.6k|                                                 atom[neigh].chem_bonds_valence > atom[neigh].valence)
  ------------------
  |  Branch (3181:50): [True: 29.3k, False: 1.31k]
  ------------------
 3182|  29.3k|                                            {
 3183|       |                                                /* =Z-OH, #Z-OH, =Z-O(-), #Z-O(-), -Z=O, =Z=O;
 3184|       |                                                =Z(+)-OH, #Z(+)-OH, =Z-O(-), #Z-O(-), -Z(+)=O, =Z(+)=O; O = O, S, Se, Te */
 3185|       |                                                /* neigh = Z\{N,C} = P, As, Sb, S, Se, Te, Cl, Br, I */
 3186|  29.3k|                                                if (at->chem_bonds_valence == 1 && IsZOX( atom, at_no, 0 ))
  ------------------
  |  Branch (3186:53): [True: 18.8k, False: 10.4k]
  |  Branch (3186:84): [True: 9.43k, False: 9.45k]
  ------------------
 3187|  9.43k|                                                {
 3188|  9.43k|                                                    type = ATT_ZOO;
  ------------------
  |  |   34|  9.43k|#define ATT_ZOO 0x0008
  ------------------
 3189|  9.43k|                                                    if (at->num_H == 1)
  ------------------
  |  Branch (3189:57): [True: 2.25k, False: 7.17k]
  ------------------
 3190|  2.25k|                                                    {
 3191|  2.25k|                                                        mask |= ( ATBIT_ZOOH );            /* 18: O=Z-OH; O=O,S,Se,Te; Z may have charge */
  ------------------
  |  |  102|  2.25k|#define ATBIT_ZOOH       (1 << ATTOT_NUM_ZOOH)
  ------------------
 3192|       |                                                                                           /*nAtTypeTotals[ATTOT_NUM_ZOOH] ++;*/
 3193|  2.25k|                                                    }
 3194|  7.17k|                                                    else
 3195|  7.17k|                                                    {
 3196|  7.17k|                                                        if (at->charge == -1)
  ------------------
  |  Branch (3196:61): [True: 7.17k, False: 0]
  ------------------
 3197|  7.17k|                                                        {
 3198|  7.17k|                                                            mask |= ( ATBIT_ZOO_Minus );       /* 19: O=Z-O(-); O = O, S, Se, Te */
  ------------------
  |  |  113|  7.17k|#define ATBIT_ZOO_Minus  (1 << ATTOT_NUM_ZOO_Minus)
  ------------------
 3199|       |                                                                                               /*nAtTypeTotals[ATTOT_NUM_ZOO_Minus] ++;*/
 3200|  7.17k|                                                        }
 3201|      0|                                                        else
 3202|      0|                                                        {
 3203|      0|                                                            mask |= ( ATBIT_Errors );
  ------------------
  |  |  124|      0|#define ATBIT_Errors     (1 << ATTOT_NUM_Errors)
  ------------------
 3204|       |                                                            /*nAtTypeTotals[ATTOT_NUM_Errors] ++;*/
 3205|      0|                                                        }
 3206|  7.17k|                                                    }
 3207|  9.43k|                                                }
 3208|  19.9k|                                                else
 3209|  19.9k|                                                {
 3210|  19.9k|                                                    type = ATT_OTHER_ZO;
  ------------------
  |  |   40|  19.9k|#define ATT_OTHER_ZO 0x0200 /**<  -Z=O or =Z=O */
  ------------------
 3211|  19.9k|                                                    if (at->num_H == 1)
  ------------------
  |  Branch (3211:57): [True: 450, False: 19.4k]
  ------------------
 3212|    450|                                                    {
 3213|    450|                                                        mask |= ( ATBIT_ZOH );            /* 20: =Z-OH, #Z-OH; O=O,S,Se,Te; Z may have charge */
  ------------------
  |  |  100|    450|#define ATBIT_ZOH        (1 << ATTOT_NUM_ZOH)
  ------------------
 3214|       |                                                                                          /*nAtTypeTotals[ATTOT_NUM_ZOH] ++;*/
 3215|    450|                                                    }
 3216|  19.4k|                                                    else
 3217|  19.4k|                                                    {
 3218|  19.4k|                                                        if (at->charge == -1)
  ------------------
  |  Branch (3218:61): [True: 9.31k, False: 10.1k]
  ------------------
 3219|  9.31k|                                                        {
 3220|  9.31k|                                                            mask |= ( ATBIT_ZO_Minus );       /* 21: =Z-O(-), #Z-O(-); O = O, S, Se, Te */
  ------------------
  |  |  111|  9.31k|#define ATBIT_ZO_Minus   (1 << ATTOT_NUM_ZO_Minus)
  ------------------
 3221|       |                                                                                              /*nAtTypeTotals[ATTOT_NUM_ZO_Minus] ++;*/
 3222|  9.31k|                                                        }
 3223|  10.1k|                                                        else
 3224|  10.1k|                                                        {
 3225|  10.1k|                                                            if (at->num_H == 0)
  ------------------
  |  Branch (3225:65): [True: 10.1k, False: 18]
  ------------------
 3226|  10.1k|                                                            {
 3227|  10.1k|                                                                mask |= ( ATBIT_ZO );             /* 22: -Z=O, =Z=O; O=O,S,Se,Te; Z may have charge */
  ------------------
  |  |  106|  10.1k|#define ATBIT_ZO         (1 << ATTOT_NUM_ZO)
  ------------------
 3228|       |                                                                                                  /*nAtTypeTotals[ATTOT_NUM_ZO] ++;*/
 3229|  10.1k|                                                            }
 3230|     18|                                                            else
 3231|     18|                                                            {
 3232|     18|                                                                mask |= ( ATBIT_Errors );
  ------------------
  |  |  124|     18|#define ATBIT_Errors     (1 << ATTOT_NUM_Errors)
  ------------------
 3233|       |                                                                /*nAtTypeTotals[ATTOT_NUM_Errors] ++;*/
 3234|     18|                                                            }
 3235|  10.1k|                                                        }
 3236|  19.4k|                                                    }
 3237|  19.9k|                                                }
 3238|  29.3k|                                            }
 3239|  2.75k|                                            else
 3240|  2.75k|                                            {
 3241|  2.75k|                                                if (at->charge == -1 && !is_el_a_metal( atom[neigh].el_number ))
  ------------------
  |  Branch (3241:53): [True: 1.46k, False: 1.29k]
  |  Branch (3241:73): [True: 1.37k, False: 87]
  ------------------
 3242|  1.37k|                                                {
 3243|       |                                                    /* >Z-O(-); O=O,S,Se,Te */
 3244|  1.37k|                                                    type = ATT_OTHER_NEG_O;
  ------------------
  |  |   39|  1.37k|#define ATT_OTHER_NEG_O 0x0100
  ------------------
 3245|  1.37k|                                                    mask |= ( ATBIT_O_Minus );            /* 23: -Z-O(-); O=O,S,Se,Te */
  ------------------
  |  |  116|  1.37k|#define ATBIT_O_Minus    (1 << ATTOT_NUM_O_Minus)
  ------------------
 3246|       |                                                                                          /*nAtTypeTotals[ATTOT_NUM_ZO_Minus] ++;*/
 3247|  1.37k|                                                }
 3248|  2.75k|                                            }
 3249|  32.1k|                                        }
 3250|  42.7k|                                    }
 3251|  48.5k|                                }
 3252|  51.0k|                            }
 3253|  59.6k|                        }
 3254|  71.2k|                    }
 3255|       |
 3256|   192k|                    else
 3257|   192k|                    {
 3258|   192k|                        if (at->charge == -1 && at->num_H == 1)
  ------------------
  |  Branch (3258:29): [True: 225, False: 192k]
  |  Branch (3258:49): [True: 211, False: 14]
  ------------------
 3259|    211|                        {
 3260|    211|                            type = ATT_OH_MINUS;
  ------------------
  |  |   41|    211|#define ATT_OH_MINUS 0x0400 /**< OH(-), O=O,S,Se,Te */
  ------------------
 3261|    211|                            mask |= ( ATBIT_O_Minus );            /* 25: HO(-); O=O,S,Se,Te */
  ------------------
  |  |  116|    211|#define ATBIT_O_Minus    (1 << ATTOT_NUM_O_Minus)
  ------------------
 3262|    211|                        }
 3263|   192k|                    }
 3264|   263k|                }
 3265|   265k|            }
 3266|   285k|        }
 3267|   290k|    }
 3268|       |
 3269|   520k|    else
 3270|   520k|    {
 3271|       |        /* P, N, neutral valence = 3 (not 5) */
 3272|   520k|        if (( at->el_number == EL_NUMBER_N ||
  ------------------
  |  |   14|  1.04M|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (3272:15): [True: 188k, False: 331k]
  ------------------
 3273|   331k|              at->el_number == EL_NUMBER_P ) &&
  ------------------
  |  |   18|   331k|#define EL_NUMBER_P  ((U_CHAR)15)
  ------------------
  |  Branch (3273:15): [True: 22.8k, False: 308k]
  ------------------
 3274|   211k|             0 <= at->valence && at->valence <= 3 &&
  ------------------
  |  Branch (3274:14): [True: 211k, False: 0]
  |  Branch (3274:34): [True: 203k, False: 7.87k]
  ------------------
 3275|   203k|             at->chem_bonds_valence + at->num_H == 3 + at->charge)
  ------------------
  |  Branch (3275:14): [True: 135k, False: 68.1k]
  ------------------
 3276|   135k|        {
 3277|   135k|            if (at->valence && !( num_z /*|| num_o == at->valence*/ ))
  ------------------
  |  Branch (3277:17): [True: 135k, False: 51]
  |  Branch (3277:32): [True: 769, False: 134k]
  ------------------
 3278|    769|            {
 3279|    769|                if (num_m == at->valence)
  ------------------
  |  Branch (3279:21): [True: 163, False: 606]
  ------------------
 3280|    163|                {
 3281|    163|                    goto exit_function;
 3282|    163|                }
 3283|    606|                goto count_mask_bits; /* N(III), N(-)(II), N(+)(IV) and same P that have only oxygen neighbors are ignored here */
 3284|    769|            }
 3285|   134k|            type = ( at->el_number == EL_NUMBER_N ) ? ATT_ATOM_N : ATT_ATOM_P;
  ------------------
  |  |   14|   134k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
                          type = ( at->el_number == EL_NUMBER_N ) ? ATT_ATOM_N : ATT_ATOM_P;
  ------------------
  |  |   37|   121k|#define ATT_ATOM_N 0x0040
  ------------------
                          type = ( at->el_number == EL_NUMBER_N ) ? ATT_ATOM_N : ATT_ATOM_P;
  ------------------
  |  |   38|   147k|#define ATT_ATOM_P 0x0080
  ------------------
  |  Branch (3285:20): [True: 121k, False: 12.8k]
  ------------------
 3286|   134k|            switch (at->charge)
 3287|   134k|            {
 3288|  32.7k|                case -1:
  ------------------
  |  Branch (3288:17): [True: 32.7k, False: 102k]
  ------------------
 3289|  32.7k|                    if (at->el_number == EL_NUMBER_N)
  ------------------
  |  |   14|  32.7k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (3289:25): [True: 29.6k, False: 3.09k]
  ------------------
 3290|  29.6k|                    {
 3291|  29.6k|                        mask |= ( ATBIT_N_Minus ); /* 26: -NH(-), =N(-), >N(-) */
  ------------------
  |  |   95|  29.6k|#define ATBIT_N_Minus    (1 << ATTOT_NUM_N_Minus)
  ------------------
 3292|  29.6k|                        if (at->num_H)
  ------------------
  |  Branch (3292:29): [True: 1.58k, False: 28.0k]
  ------------------
 3293|  1.58k|                        {
 3294|  1.58k|                            mask |= ( ATBIT_NP_H ); /* 27: -NH(-) */
  ------------------
  |  |   94|  1.58k|#define ATBIT_NP_H       (1 << ATTOT_NUM_NP_H)
  ------------------
 3295|  1.58k|                        }
 3296|  28.0k|#if ( FIX_NP_MINUS_BUG == 1 )
 3297|  28.0k|                        else
 3298|  28.0k|                        {
 3299|  28.0k|                            if (at->valence == 1 && at->chem_bonds_valence >= 2 && ( at->bond_type[0] & BOND_MARK_ALL ))
  ------------------
  |  |  191|  23.7k|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
  |  Branch (3299:33): [True: 23.7k, False: 4.34k]
  |  Branch (3299:53): [True: 23.7k, False: 0]
  |  Branch (3299:84): [True: 84, False: 23.6k]
  ------------------
 3300|     84|                            {
 3301|     84|                                type |= ATT_NP_MINUS_V23; /* =N(-) created by normalization 2010-03-11 DT */
  ------------------
  |  |   47|     84|#define ATT_NP_MINUS_V23 0x8000 /**< =N(-) or =P(-) where = previously was triple */
  ------------------
 3302|     84|                            }
 3303|  28.0k|                        }
 3304|  29.6k|#endif
 3305|  29.6k|                    }
 3306|       |                    /*nAtTypeTotals[ATTOT_NUM_N_Minus] += (at->el_number == EL_NUMBER_N);*/
 3307|  32.7k|                    break;
 3308|  73.6k|                case 0:
  ------------------
  |  Branch (3308:17): [True: 73.6k, False: 61.1k]
  ------------------
 3309|  73.6k|                    if (at->num_H)
  ------------------
  |  Branch (3309:25): [True: 7.77k, False: 65.8k]
  ------------------
 3310|  7.77k|                    {
 3311|  7.77k|                        mask |= ( ATBIT_NP_H );          /* 28: -NH2, =NH, >NH */
  ------------------
  |  |   94|  7.77k|#define ATBIT_NP_H       (1 << ATTOT_NUM_NP_H)
  ------------------
 3312|       |                                                         /*nAtTypeTotals[ATTOT_NUM_NP_H] ++;*/
 3313|  7.77k|                    }
 3314|  65.8k|                    else
 3315|  65.8k|                    {
 3316|  65.8k|                        if (bUnsatNHasTerminalO == 1)
  ------------------
  |  Branch (3316:29): [True: 3.08k, False: 62.7k]
  ------------------
 3317|  3.08k|                        {
 3318|  3.08k|                            mask |= ( ATBIT_ON );            /* 29: -N=O,-N=OH(+) only, not =N-OH */
  ------------------
  |  |   97|  3.08k|#define ATBIT_ON         (1 << ATTOT_NUM_ON)
  ------------------
 3319|  3.08k|                        }
 3320|  62.7k|                        else
 3321|  62.7k|                        {
 3322|  62.7k|                            mask |= ( ATBIT_NP );            /* 30: -P=O,-P=OH(+), >N- =N- (incl. =N-OH) , #N */
  ------------------
  |  |   96|  62.7k|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  ------------------
 3323|       |                                                             /*nAtTypeTotals[ATTOT_NUM_NP] ++;*/
 3324|  62.7k|                        }
 3325|  65.8k|                    }
 3326|  73.6k|                    break; /* ignore neutral N or P */
 3327|  28.3k|                case 1:
  ------------------
  |  Branch (3327:17): [True: 28.3k, False: 106k]
  ------------------
 3328|  28.3k|                    if (at->num_H)
  ------------------
  |  Branch (3328:25): [True: 1.20k, False: 27.1k]
  ------------------
 3329|  1.20k|                    {
 3330|  1.20k|                        mask |= ( ATBIT_NP_Proton );       /* 31: NH4(+), -NH3(+), =NH2(+), >NH2(+), =NH(+)-, >NH(+)-, #NH(+) */
  ------------------
  |  |   93|  1.20k|#define ATBIT_NP_Proton  (1 << ATTOT_NUM_NP_Proton)
  ------------------
 3331|       |                                                           /*nAtTypeTotals[ATTOT_NUM_NP_Proton] ++;*/
 3332|  1.20k|                    }
 3333|  27.1k|                    else
 3334|  27.1k|                    {
 3335|  27.1k|                        if (at->chem_bonds_valence > at->valence)
  ------------------
  |  Branch (3335:29): [True: 27.1k, False: 0]
  ------------------
 3336|  27.1k|                        {
 3337|  27.1k|                            mask |= ( ATBIT_NP_Plus );         /* =N(+)=, #N(+)-, =N(+)< */
  ------------------
  |  |   92|  27.1k|#define ATBIT_NP_Plus    (1 << ATTOT_NUM_NP_Plus)
  ------------------
 3338|       |                                                               /*nAtTypeTotals[ATTOT_NUM_NP_Plus] ++;*/
 3339|  27.1k|                        }
 3340|      0|                        else
 3341|      0|                        {
 3342|      0|                            type = 0; /* 32: ignore onium cations >N(+)< */
 3343|      0|                        }
 3344|  27.1k|                    }
 3345|  28.3k|                    break;
 3346|      0|                default:
  ------------------
  |  Branch (3346:17): [True: 0, False: 134k]
  ------------------
 3347|      0|                    mask |= ( 1 << ATTOT_NUM_Errors );
 3348|       |                    /*nAtTypeTotals[ATTOT_NUM_Errors] ++;*/
 3349|      0|                    break;
 3350|   134k|            }
 3351|   134k|        }
 3352|   520k|    }
 3353|       |
 3354|  1.06M|count_mask_bits:
 3355|  1.06M|    if (nAtTypeTotals)
  ------------------
  |  Branch (3355:9): [True: 623k, False: 443k]
  ------------------
 3356|   623k|    {
 3357|   623k|        if (mask && !( mask & ( ATBIT_Errors ) ))
  ------------------
  |  |  124|  97.0k|#define ATBIT_Errors     (1 << ATTOT_NUM_Errors)
  ------------------
  |  Branch (3357:13): [True: 97.0k, False: 526k]
  |  Branch (3357:21): [True: 95.8k, False: 1.21k]
  ------------------
 3358|  95.8k|        {
 3359|  3.25M|            for (i = 0, bit = 1; i < ATTOT_ARRAY_LEN; i++, bit <<= 1)
  ------------------
  |  Branch (3359:34): [True: 3.16M, False: 95.8k]
  ------------------
 3360|  3.16M|            {
 3361|  3.16M|                if (bit & mask)
  ------------------
  |  Branch (3361:21): [True: 96.2k, False: 3.06M]
  ------------------
 3362|  96.2k|                {
 3363|  96.2k|                    nAtTypeTotals[i] += delta;
 3364|  96.2k|                }
 3365|  3.16M|            }
 3366|  95.8k|        }
 3367|       |
 3368|       |        /* Count charges */
 3369|   623k|        if (at->charge)
  ------------------
  |  Branch (3369:13): [True: 86.3k, False: 536k]
  ------------------
 3370|  86.3k|        {
 3371|  86.3k|            nAtTypeTotals[ATTOT_TOT_CHARGE] += delta * at->charge;
 3372|  86.3k|            nAtTypeTotals[ATTOT_NUM_CHARGES] += delta;
 3373|  86.3k|        }
 3374|   623k|    }
 3375|       |
 3376|  1.06M|    if (pMask)
  ------------------
  |  Branch (3376:9): [True: 1.06M, False: 0]
  ------------------
 3377|  1.06M|    {
 3378|  1.06M|        *pMask = mask;
 3379|  1.06M|    }
 3380|       |
 3381|  1.76M|exit_function:
 3382|  1.76M|    if (mask & ( ATBIT_Errors ))
  ------------------
  |  |  124|  1.76M|#define ATBIT_Errors     (1 << ATTOT_NUM_Errors)
  ------------------
  |  Branch (3382:9): [True: 3.13k, False: 1.76M]
  ------------------
 3383|  3.13k|    {
 3384|  3.13k|        type = 0;
 3385|  3.13k|        if (nAtTypeTotals)
  ------------------
  |  Branch (3385:13): [True: 1.21k, False: 1.92k]
  ------------------
 3386|  1.21k|        {
 3387|  1.21k|            nAtTypeTotals[ATTOT_NUM_Errors] += 1;
 3388|  1.21k|        }
 3389|  3.13k|    }
 3390|       |
 3391|       |
 3392|  1.76M|    return type;
 3393|  1.06M|}
SimpleRemoveHplusNPO:
 3401|    665|{
 3402|    665|    int i, mask, type, num_removed;
 3403|  4.32k|    for (i = 0, num_removed = 0; i < num_atoms; i++)
  ------------------
  |  Branch (3403:34): [True: 3.66k, False: 665]
  ------------------
 3404|  3.66k|    {
 3405|       |        /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 3406|  3.66k|        if (( PR_SIMPLE_TYP & ( type = GetAtomChargeType( at, i, NULL, &mask, 0 ) ) ) &&
  ------------------
  |  |  137|  3.66k|#define PR_SIMPLE_TYP  (ATT_ATOM_N | ATT_ATOM_P | ATT_O_PLUS)
  |  |  ------------------
  |  |  |  |   37|  3.66k|#define ATT_ATOM_N 0x0040
  |  |  ------------------
  |  |               #define PR_SIMPLE_TYP  (ATT_ATOM_N | ATT_ATOM_P | ATT_O_PLUS)
  |  |  ------------------
  |  |  |  |   38|  3.66k|#define ATT_ATOM_P 0x0080
  |  |  ------------------
  |  |               #define PR_SIMPLE_TYP  (ATT_ATOM_N | ATT_ATOM_P | ATT_O_PLUS)
  |  |  ------------------
  |  |  |  |   42|  3.66k|#define ATT_O_PLUS 0x0800   /**< -OH2(+), =OH(+), -OH(+)-, OH3(+), =O(+)-, etc; O=O,S,Se,Te */
  |  |  ------------------
  ------------------
  |  Branch (3406:13): [True: 1.31k, False: 2.34k]
  ------------------
 3407|  1.31k|            ( PR_SIMPLE_MSK & mask ))
  ------------------
  |  |  136|  1.31k|#define PR_SIMPLE_MSK  (ATBIT_NP_Proton | ATBIT_OH_Plus)
  |  |  ------------------
  |  |  |  |   93|  1.31k|#define ATBIT_NP_Proton  (1 << ATTOT_NUM_NP_Proton)
  |  |  ------------------
  |  |               #define PR_SIMPLE_MSK  (ATBIT_NP_Proton | ATBIT_OH_Plus)
  |  |  ------------------
  |  |  |  |  117|  1.31k|#define ATBIT_OH_Plus    (1 << ATTOT_NUM_OH_Plus)
  |  |  ------------------
  ------------------
  |  Branch (3407:13): [True: 683, False: 635]
  ------------------
 3408|    683|        {
 3409|       |#if ( bRELEASE_VERSION == 0 )
 3410|       |            if (at[i].charge != 1 || at[i].num_H == 0)
 3411|       |            {
 3412|       |                return -1;  /* program error */
 3413|       |            }
 3414|       |#endif
 3415|    683|            type = GetAtomChargeType(at, i, nAtTypeTotals, &mask, 1); /* subtract at[i] */ /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 3416|    683|            at[i].charge = 0;
 3417|    683|            AddOrRemoveExplOrImplH( -1, at, num_atoms, (AT_NUMB) i, t_group_info );
 3418|       |            /*at[i].num_H --;*/
 3419|    683|            num_removed++;
 3420|    683|#if ( FIX_NORM_BUG_ADD_ION_PAIR == 1 )
 3421|    683|            type = GetAtomChargeType(at, i, nAtTypeTotals, &mask, 0); /* add changed at[i] */ /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 3422|       |#else
 3423|       |            type = GetAtomChargeType(at, i, nAtTypeTotals, &mask, 1); /* bug: subtract instead of add */ /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 3424|       |#endif
 3425|       |                                                                        /*
 3426|       |                                                                        if ( nAtTypeTotals ) {
 3427|       |                                                                        nAtTypeTotals[ATTOT_NUM_NP_Proton] --;
 3428|       |                                                                        if ( at[i].num_H ) {
 3429|       |                                                                        nAtTypeTotals[ATTOT_NUM_NP_H] ++;
 3430|       |                                                                        } else {
 3431|       |                                                                        nAtTypeTotals[ATTOT_NUM_NP] ++;
 3432|       |                                                                        }
 3433|       |                                                                        nAtTypeTotals[ATTOT_TOT_CHARGE] --;
 3434|       |                                                                        nAtTypeTotals[ATTOT_NUM_CHARGES] --;
 3435|       |                                                                        }
 3436|       |                                                                        */
 3437|    683|        }
 3438|  3.66k|    }
 3439|       |
 3440|    665|    return num_removed;
 3441|    665|}
bIsAtomTypeHard:
 3450|  1.13k|{
 3451|  1.13k|    int        mask;
 3452|  1.13k|    if (( nType & GetAtomChargeType( at, endpoint, NULL, &mask, 0 ) ) && ( mask & nMask )
  ------------------
  |  Branch (3452:9): [True: 302, False: 828]
  |  Branch (3452:74): [True: 296, False: 6]
  ------------------
 3453|       |#if ( OPPOSITE_CHARGE_IN_CGROUP == 0 )
 3454|       |         && ( at[endpoint].charge == nCharge || !at[endpoint].charge )
 3455|       |#endif
 3456|  1.13k|         )
 3457|    296|    {
 3458|    296|        return 1;
 3459|    296|    }
 3460|       |
 3461|    834|    return 0;
 3462|  1.13k|}
bIsHDonorAccAtomType:
 3467|    565|{
 3468|    565|    if (bIsAtomTypeHard( at, endpoint, PR_HARD_TYP_H, PR_HARD_MSK_H, 0 ))
  ------------------
  |  |  197|    565|#define PR_HARD_TYP_H     (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  150|    565|#define ATTYP_N     (ATT_ATOM_N)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    565|#define ATT_ATOM_N 0x0040
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PR_HARD_TYP_H     (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  148|    565|#define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|    565|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   32|    565|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   33|    565|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|    565|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|    565|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|    565|#define ATT_OTHER_ZO 0x0200 /**<  -Z=O or =Z=O */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  if (bIsAtomTypeHard( at, endpoint, PR_HARD_TYP_H, PR_HARD_MSK_H, 0 ))
  ------------------
  |  |  196|    565|#define PR_HARD_MSK_H     (ATBIT_MSK_NP | ATBIT_MSK_OS)
  |  |  ------------------
  |  |  |  |  139|    565|#define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|    565|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|    565|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|    565|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|    565|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|    565|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PR_HARD_MSK_H     (ATBIT_MSK_NP | ATBIT_MSK_OS)
  |  |  ------------------
  |  |  |  |  141|    565|#define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |   98|    565|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |   99|    565|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  100|    565|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|    565|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  102|    565|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|    565|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|    565|#define ATBIT_N_OH       (1 << ATTOT_NUM_N_OH)
  |  |  |  |  ------------------
  |  |  |  |  142|    565|                        ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|    565|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  106|    565|#define ATBIT_ZO         (1 << ATTOT_NUM_ZO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|    565|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|    565|#define ATBIT_N_O        (1 << ATTOT_NUM_N_O)
  |  |  |  |  ------------------
  |  |  |  |  143|    565|                        ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  109|    565|#define ATBIT_CO_Minus   (1 << ATTOT_NUM_CO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|    565|#define ATBIT_CS_Minus   (1 << ATTOT_NUM_CS_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|    565|#define ATBIT_ZO_Minus   (1 << ATTOT_NUM_ZO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  112|    565|#define ATBIT_OO_Minus   (1 << ATTOT_NUM_OO_Minus)
  |  |  |  |  ------------------
  |  |  |  |  144|    565|                        ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|    565|#define ATBIT_ZOO_Minus  (1 << ATTOT_NUM_ZOO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|    565|#define ATBIT_NO_Minus   (1 << ATTOT_NUM_NO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|    565|#define ATBIT_N_O_Minus  (1 << ATTOT_NUM_N_O_Minus)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3468:9): [True: 148, False: 417]
  ------------------
 3469|    148|    {
 3470|       |        /* Obtain donor/acceptor info */
 3471|    148|        int neutral_valence = at[endpoint].chem_bonds_valence + at[endpoint].num_H - at[endpoint].charge;
 3472|    148|        if (neutral_valence != 2 /* O, S, Se, Te */ &&
  ------------------
  |  Branch (3472:13): [True: 146, False: 2]
  ------------------
 3473|    146|             neutral_valence != 3 /* N, P */)
  ------------------
  |  Branch (3473:14): [True: 1, False: 145]
  ------------------
 3474|      1|        {
 3475|      1|            return -1; /* wrong endpoint neutral valence */
 3476|      1|        }
 3477|    147|        else
 3478|    147|        {
 3479|    147|            int edge_flow = at[endpoint].num_H;
 3480|    147|            int num_bonds = at[endpoint].valence;
 3481|    147|            int edge_cap = neutral_valence - num_bonds; /* does not allow to reduce -NH3(+) to #N or -OH(+)- to -O- */
 3482|    147|            edge_flow = inchi_min( edge_flow, edge_cap );
  ------------------
  |  |  139|    147|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 84, False: 63]
  |  |  ------------------
  ------------------
 3483|       |            /* what this means: */
 3484|    147|            if (edge_cap)
  ------------------
  |  Branch (3484:17): [True: 96, False: 51]
  ------------------
 3485|     96|            {
 3486|     96|                if (edge_cap > edge_flow)
  ------------------
  |  Branch (3486:21): [True: 81, False: 15]
  ------------------
 3487|     81|                {
 3488|     81|                    *cSubType |= SALT_ACCEPTOR;
  ------------------
  |  |   64|     81|#define SALT_ACCEPTOR     4
  ------------------
 3489|     81|                }
 3490|     96|                if (edge_flow)
  ------------------
  |  Branch (3490:21): [True: 37, False: 59]
  ------------------
 3491|     37|                {
 3492|     37|                    *cSubType |= SALT_DONOR_H;
  ------------------
  |  |   62|     37|#define SALT_DONOR_H      1
  ------------------
 3493|     37|                }
 3494|     96|                return 4;
 3495|     96|            }
 3496|    147|        }
 3497|    148|    }
 3498|       |
 3499|    468|    return -1;
 3500|    565|}
bIsNegAtomType:
 3505|    565|{
 3506|    565|    int sub_type = 0;
 3507|    565|    if (bIsAtomTypeHard( at, endpoint, PR_HARD_TYP_NEG, PR_HARD_MSK_NEG, -1 ))
  ------------------
  |  |  194|    565|#define PR_HARD_TYP_NEG   (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  150|    565|#define ATTYP_N     (ATT_ATOM_N)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    565|#define ATT_ATOM_N 0x0040
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PR_HARD_TYP_NEG   (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  148|    565|#define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|    565|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   32|    565|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   33|    565|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|    565|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|    565|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|    565|#define ATT_OTHER_ZO 0x0200 /**<  -Z=O or =Z=O */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  if (bIsAtomTypeHard( at, endpoint, PR_HARD_TYP_NEG, PR_HARD_MSK_NEG, -1 ))
  ------------------
  |  |  193|    565|#define PR_HARD_MSK_NEG   (ATBIT_MSK_NP | ATBIT_MSK_OS)
  |  |  ------------------
  |  |  |  |  139|    565|#define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|    565|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|    565|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|    565|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|    565|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|    565|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PR_HARD_MSK_NEG   (ATBIT_MSK_NP | ATBIT_MSK_OS)
  |  |  ------------------
  |  |  |  |  141|    565|#define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |   98|    565|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |   99|    565|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  100|    565|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|    565|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  102|    565|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|    565|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|    565|#define ATBIT_N_OH       (1 << ATTOT_NUM_N_OH)
  |  |  |  |  ------------------
  |  |  |  |  142|    565|                        ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|    565|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  106|    565|#define ATBIT_ZO         (1 << ATTOT_NUM_ZO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|    565|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|    565|#define ATBIT_N_O        (1 << ATTOT_NUM_N_O)
  |  |  |  |  ------------------
  |  |  |  |  143|    565|                        ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  109|    565|#define ATBIT_CO_Minus   (1 << ATTOT_NUM_CO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|    565|#define ATBIT_CS_Minus   (1 << ATTOT_NUM_CS_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|    565|#define ATBIT_ZO_Minus   (1 << ATTOT_NUM_ZO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  112|    565|#define ATBIT_OO_Minus   (1 << ATTOT_NUM_OO_Minus)
  |  |  |  |  ------------------
  |  |  |  |  144|    565|                        ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|    565|#define ATBIT_ZOO_Minus  (1 << ATTOT_NUM_ZOO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|    565|#define ATBIT_NO_Minus   (1 << ATTOT_NUM_NO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|    565|#define ATBIT_N_O_Minus  (1 << ATTOT_NUM_N_O_Minus)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3507:9): [True: 148, False: 417]
  ------------------
 3508|    148|    {
 3509|       |        /* Obtain donor/acceptor info */
 3510|    148|        int neutral_valence = at[endpoint].chem_bonds_valence + at[endpoint].num_H - at[endpoint].charge;
 3511|    148|        if (neutral_valence != 2 /* O, S, Se, Te */ &&
  ------------------
  |  Branch (3511:13): [True: 146, False: 2]
  ------------------
 3512|    146|             neutral_valence != 3 /* N, P */)
  ------------------
  |  Branch (3512:14): [True: 1, False: 145]
  ------------------
 3513|      1|        {
 3514|      1|            return -1; /* wrong endpoint neutral valence */
 3515|      1|        }
 3516|    147|        else
 3517|    147|        {
 3518|    147|            int edge_flow = ( at[endpoint].charge == -1 );
 3519|    147|            int num_bonds = at[endpoint].valence;
 3520|    147|            int edge_cap = neutral_valence - num_bonds - at[endpoint].num_H; /* does not allow to reduce -NH3(+) to #N or -OH(+)- to -O- */
 3521|    147|            edge_flow = inchi_min( edge_flow, edge_cap );
  ------------------
  |  |  139|    147|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 75, False: 72]
  |  |  ------------------
  ------------------
 3522|       |            /* what this means: */
 3523|    147|            if (edge_cap)
  ------------------
  |  Branch (3523:17): [True: 84, False: 63]
  ------------------
 3524|     84|            {
 3525|     84|                if (edge_cap > edge_flow)
  ------------------
  |  Branch (3525:21): [True: 75, False: 9]
  ------------------
 3526|     75|                {
 3527|     75|                    sub_type |= SALT_ACCEPTOR;
  ------------------
  |  |   64|     75|#define SALT_ACCEPTOR     4
  ------------------
 3528|     75|                }
 3529|     84|                if (edge_flow)
  ------------------
  |  Branch (3529:21): [True: 11, False: 73]
  ------------------
 3530|     11|                {
 3531|     11|                    sub_type |= SALT_DONOR_Neg;
  ------------------
  |  |   63|     11|#define SALT_DONOR_Neg    2
  ------------------
 3532|     11|                }
 3533|     84|                if (sub_type)
  ------------------
  |  Branch (3533:21): [True: 84, False: 0]
  ------------------
 3534|     84|                {
 3535|     84|                    *cSubType |= sub_type;
 3536|     84|                    return 4;
 3537|     84|                }
 3538|     84|            }
 3539|    147|        }
 3540|    148|    }
 3541|       |
 3542|    480|    return -1;
 3543|    565|}
bIsHardRemHCandidate:
 3548|    565|{
 3549|    565|    int ret1, ret2, ret;
 3550|    565|    int sub_type = 0;
 3551|    565|    ret1 = bIsHDonorAccAtomType( at, i, &sub_type );
 3552|    565|    ret2 = bIsNegAtomType( at, i, &sub_type );
 3553|    565|    ret = inchi_max( ret1, ret2 );
  ------------------
  |  |  138|    565|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 15, False: 550]
  |  |  ------------------
  ------------------
 3554|    565|    if (ret > 0 && sub_type)
  ------------------
  |  Branch (3554:9): [True: 99, False: 466]
  |  Branch (3554:20): [True: 99, False: 0]
  ------------------
 3555|     99|    {
 3556|     99|        *cSubType |= sub_type;
 3557|     99|        return ret;
 3558|     99|    }
 3559|    466|    return -1;
 3560|    565|}
CreateCGroupInBnStruct:
 3570|   110k|{
 3571|   110k|    int         k, c_point, cg, centerpoint, fictpoint, type, ret = 0;
 3572|   110k|    int         num_cg = 1;
 3573|   110k|    int         num_edges = pBNS->num_edges;
 3574|   110k|    int         num_vertices = pBNS->num_vertices; /* new c-group bns-ID */
 3575|   110k|    BNS_VERTEX *vert_ficpoint, *ver_ficpont_prev;  /* fictitious vertex describing charge c-group */
 3576|   110k|    BNS_VERTEX *vertex_cpoint;
 3577|   110k|    BNS_EDGE   *edge;      /* edge between that vertex and the tautomeric c_point */
 3578|   110k|    int        mask, num_CPoints;
 3579|       |
 3580|       |    /* Debug: check overflow */
 3581|   110k|    if (num_vertices + num_cg >= pBNS->max_vertices)
  ------------------
  |  Branch (3581:9): [True: 0, False: 110k]
  ------------------
 3582|      0|    {
 3583|      0|        return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3584|      0|    }
 3585|       |
 3586|       |    /* Count new c-group edges */
 3587|   407k|    for (c_point = 0, num_CPoints = 0; c_point < num_atoms; c_point++)
  ------------------
  |  Branch (3587:40): [True: 296k, False: 110k]
  ------------------
 3588|   296k|    {
 3589|   296k|        if (( nType & GetAtomChargeType( at, c_point, NULL, &mask, 0 ) ) && ( mask & nMask )
  ------------------
  |  Branch (3589:13): [True: 30.6k, False: 265k]
  |  Branch (3589:77): [True: 29.5k, False: 1.15k]
  ------------------
 3590|       |#if ( OPPOSITE_CHARGE_IN_CGROUP == 0 )
 3591|       |             && ( at[c_point].charge == nCharge || !at[c_point].charge )
 3592|       |#endif
 3593|   296k|             )
 3594|  29.5k|        {
 3595|  29.5k|            num_CPoints++;
 3596|  29.5k|        }
 3597|   296k|    }
 3598|       |
 3599|   110k|    if (!num_CPoints)
  ------------------
  |  Branch (3599:9): [True: 94.6k, False: 16.1k]
  ------------------
 3600|  94.6k|    {
 3601|  94.6k|        return 0;
 3602|  94.6k|    }
 3603|       |
 3604|       |    /* Clear the new vertex */
 3605|  16.1k|    memset( pBNS->vert + num_vertices, 0, 1 * sizeof( pBNS->vert[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 3606|       |
 3607|       |    /* *old* Make sure the last t-group has the largest t-group ID:
 3608|       |    this is necessary to correctly add new edges and vertices for testing augmenting paths
 3609|       |    */
 3610|       |
 3611|       |    /**************************************/
 3612|       |    /* initialize new fictitious vertex   */
 3613|       |    /* representing c-point group         */
 3614|       |    /**************************************/
 3615|       |
 3616|  16.1k|    ver_ficpont_prev = pBNS->vert + num_vertices - 1;
 3617|       |
 3618|  32.2k|    for (cg = 0; cg < num_cg; cg++, ver_ficpont_prev = vert_ficpoint)
  ------------------
  |  Branch (3618:18): [True: 16.1k, False: 16.1k]
  ------------------
 3619|  16.1k|    {
 3620|       |        /*
 3621|       |        vert_ficpoint-1 is the last vertex;
 3622|       |        vert_ficpoint   is the being added vertex
 3623|       |        Note: nGroupNumber are not contiguous
 3624|       |        */
 3625|  16.1k|        vert_ficpoint = pBNS->vert + num_vertices + cg;
 3626|  16.1k|        vert_ficpoint->iedge = ver_ficpont_prev->iedge + ver_ficpont_prev->max_adj_edges;
 3627|  16.1k|        vert_ficpoint->max_adj_edges = num_CPoints + BNS_ADD_EDGES;
  ------------------
  |  |   89|  16.1k|#define BNS_ADD_EDGES        1  /* max. number of edges to add to each atom (except edges to a t-group or c-group) */
  ------------------
 3628|  16.1k|        vert_ficpoint->num_adj_edges = 0;
 3629|  16.1k|        vert_ficpoint->st_edge.flow = vert_ficpoint->st_edge.flow0 = 0;
 3630|  16.1k|        vert_ficpoint->st_edge.cap = vert_ficpoint->st_edge.cap0 = 0;
 3631|  16.1k|        vert_ficpoint->type = BNS_VERT_TYPE_C_GROUP | ( ( nCharge < 0 ) ? BNS_VERT_TYPE_C_NEGATIVE : 0 );
  ------------------
  |  |   49|  16.1k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
                      vert_ficpoint->type = BNS_VERT_TYPE_C_GROUP | ( ( nCharge < 0 ) ? BNS_VERT_TYPE_C_NEGATIVE : 0 );
  ------------------
  |  |   54|  8.93k|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  ------------------
  |  Branch (3631:57): [True: 8.93k, False: 7.19k]
  ------------------
 3632|  16.1k|    }
 3633|       |
 3634|       |    /************************************************/
 3635|       |    /* Connect c-points to the fictitious vertices  */
 3636|       |    /* representing c-point groups; set caps, flows */
 3637|       |    /************************************************/
 3638|  16.1k|    cg = 1;
 3639|   108k|    for (c_point = 0; c_point < num_atoms; c_point++)
  ------------------
  |  Branch (3639:23): [True: 92.1k, False: 16.1k]
  ------------------
 3640|  92.1k|    {
 3641|  92.1k|        if (( nType & ( type = GetAtomChargeType( at, c_point, NULL, &mask, 0 ) ) ) && ( mask & nMask )
  ------------------
  |  Branch (3641:13): [True: 30.4k, False: 61.7k]
  |  Branch (3641:88): [True: 29.5k, False: 910]
  ------------------
 3642|       |#if ( OPPOSITE_CHARGE_IN_CGROUP == 0 )
 3643|       |             && ( at[c_point].charge == nCharge || !at[c_point].charge )
 3644|       |#endif
 3645|  92.1k|             )
 3646|  29.5k|        {
 3647|  29.5k|            ;
 3648|  29.5k|        }
 3649|  62.6k|        else
 3650|  62.6k|        {
 3651|  62.6k|            continue;
 3652|  62.6k|        }
 3653|       |
 3654|  29.5k|        fictpoint = cg + num_vertices - 1; /* c-group vertex index */
 3655|  29.5k|        vert_ficpoint = pBNS->vert + fictpoint; /* c-group vertex */
 3656|  29.5k|        vertex_cpoint = pBNS->vert + c_point;   /* c_point vertex */
 3657|       |
 3658|       |                                                /* Debug: check overflow */
 3659|  29.5k|        if (fictpoint >= pBNS->max_vertices ||
  ------------------
  |  Branch (3659:13): [True: 0, False: 29.5k]
  ------------------
 3660|  29.5k|             num_edges >= pBNS->max_edges ||
  ------------------
  |  Branch (3660:14): [True: 0, False: 29.5k]
  ------------------
 3661|  29.5k|             vert_ficpoint->num_adj_edges >= vert_ficpoint->max_adj_edges ||
  ------------------
  |  Branch (3661:14): [True: 0, False: 29.5k]
  ------------------
 3662|  29.5k|             vertex_cpoint->num_adj_edges >= vertex_cpoint->max_adj_edges)
  ------------------
  |  Branch (3662:14): [True: 0, False: 29.5k]
  ------------------
 3663|      0|        {
 3664|       |            /* djb-rwth: removing redundant code */
 3665|      0|            break;
 3666|      0|        }
 3667|  29.5k|        vertex_cpoint->type |= BNS_VERT_TYPE_C_POINT;
  ------------------
  |  |   48|  29.5k|#define BNS_VERT_TYPE_C_POINT       0x0008
  ------------------
 3668|  29.5k|        if (( KNOWN_ACIDIC_TYPE & type ) && nCharge < 0)
  ------------------
  |  |  140|  29.5k|#define KNOWN_ACIDIC_TYPE   (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO)
  |  |  ------------------
  |  |  |  |   31|  29.5k|#define ATT_ACIDIC_CO 0x0001
  |  |  ------------------
  |  |               #define KNOWN_ACIDIC_TYPE   (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO)
  |  |  ------------------
  |  |  |  |   32|  29.5k|#define ATT_ACIDIC_S 0x0002
  |  |  ------------------
  |  |               #define KNOWN_ACIDIC_TYPE   (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO)
  |  |  ------------------
  |  |  |  |   33|  29.5k|#define ATT_OO 0x0004
  |  |  ------------------
  |  |               #define KNOWN_ACIDIC_TYPE   (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO)
  |  |  ------------------
  |  |  |  |   34|  29.5k|#define ATT_ZOO 0x0008
  |  |  ------------------
  |  |               #define KNOWN_ACIDIC_TYPE   (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO)
  |  |  ------------------
  |  |  |  |   35|  29.5k|#define ATT_NO 0x0010
  |  |  ------------------
  ------------------
  |  Branch (3668:13): [True: 1.47k, False: 28.0k]
  |  Branch (3668:45): [True: 1.47k, False: 0]
  ------------------
 3669|  1.47k|        {
 3670|  1.47k|            vertex_cpoint->type |= pBNS->type_TACN;
 3671|  1.47k|        }
 3672|       |
 3673|       |#if ( FIX_CPOINT_BOND_CAP != 1 )  /* { */
 3674|       |        /* Set capacity = 1 to the edges from the c_point to the centerpoint(s)     */
 3675|       |        /* if their current capacity is zero                                        */
 3676|       |        /* the centerpoint is any adjacent atom that is adjacent to a multiple bond */
 3677|       |        for (k = 0; k < vertex_cpoint->num_adj_edges; k++)
 3678|       |        {
 3679|       |            int iedge = vertex_cpoint->iedge[k];
 3680|       |            if (!pBNS->edge[iedge].cap)
 3681|       |            {
 3682|       |                /* single bond, possibly between c_point and centerpoint */
 3683|       |                centerpoint = ( pBNS->edge[iedge].neighbor12 ^ c_point );
 3684|       |                if (centerpoint < pBNS->num_atoms &&
 3685|       |                     pBNS->vert[centerpoint].st_edge.cap >= 1)
 3686|       |                {
 3687|       |                    int bond_type = ( at[c_point].bond_type[k] & BOND_TYPE_MASK );
 3688|       |                    if (bond_type == BOND_TAUTOM ||
 3689|       |                         bond_type == BOND_ALTERN ||
 3690|       |                         bond_type == BOND_SINGLE)
 3691|       |                    {
 3692|       |                        pBNS->edge[iedge].cap = 1;
 3693|       |                    }
 3694|       |                }
 3695|       |            }
 3696|       |        }
 3697|       |#endif /* } FIX_CPOINT_BOND_CAP */
 3698|       |
 3699|       |        /* Create a new edge connecting c_point to the new fictitious c-group vertex vert_ficpoint */
 3700|  29.5k|        edge = pBNS->edge + num_edges;
 3701|  29.5k|        edge->cap = 1;
 3702|  29.5k|        edge->flow = 0;
 3703|  29.5k|        edge->pass = 0;
 3704|  29.5k|#if ( RESET_EDGE_FORBIDDEN_MASK == 1 )
 3705|  29.5k|        edge->forbidden &= pBNS->edge_forbidden_mask; /* remove previous temporary ban */
 3706|  29.5k|#endif
 3707|       |
 3708|       |                                                      /* nCharge = +1: mark edge to c-point having no (+)-moveable charge with flow=1 */
 3709|       |                                                      /* nCharge = -1: mark edge to c-point having -1 moveable charge with flow=1 */
 3710|       |
 3711|  29.5k|        if ((nCharge == 1 && at[c_point].charge != 1) || (nCharge == -1 && at[c_point].charge == -1)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3711:14): [True: 13.0k, False: 16.4k]
  |  Branch (3711:30): [True: 9.60k, False: 3.45k]
  |  Branch (3711:59): [True: 16.4k, False: 3.45k]
  |  Branch (3711:76): [True: 4.71k, False: 11.7k]
  ------------------
 3712|       |            /*if ( !CHARGED_CPOINT(at,c_point) )*/
 3713|  14.3k|        {
 3714|       |            /* Increment new edge flow, update st_edges of the adjacent vertices */
 3715|  14.3k|            edge->flow++;
 3716|       |            /* Increment c-group vertex st-flow & cap */
 3717|  14.3k|            vert_ficpoint->st_edge.flow++;
 3718|  14.3k|            vert_ficpoint->st_edge.cap++;
 3719|       |            /* Increment c-point vertex st-flow & cap */
 3720|  14.3k|            vertex_cpoint->st_edge.flow++;
 3721|  14.3k|            vertex_cpoint->st_edge.cap++;
 3722|  14.3k|        }
 3723|       |
 3724|  29.5k|#if ( FIX_CPOINT_BOND_CAP == 1 ) /* { */
 3725|       |        /* Set capacity = 1 to the edges from the c_point to the centerpoint(s)     */
 3726|       |        /* if their current capacity is zero                                        */
 3727|       |        /* the centerpoint is any adjacent atom that is adjacent to a multiple bond */
 3728|  90.0k|        for (k = 0; k < vertex_cpoint->num_adj_edges; k++)
  ------------------
  |  Branch (3728:21): [True: 60.5k, False: 29.5k]
  ------------------
 3729|  60.5k|        {
 3730|  60.5k|            int iedge = vertex_cpoint->iedge[k];
 3731|  60.5k|            VertexFlow  nNewCap = vertex_cpoint->st_edge.cap;
 3732|  60.5k|            centerpoint = ( pBNS->edge[iedge].neighbor12 ^ c_point );
 3733|  60.5k|            if (!pBNS->edge[iedge].cap)
  ------------------
  |  Branch (3733:17): [True: 9.52k, False: 51.0k]
  ------------------
 3734|  9.52k|            {
 3735|       |                /* Single bond, possibly between c_point and centerpoint */
 3736|  9.52k|                if (centerpoint < pBNS->num_atoms &&
  ------------------
  |  Branch (3736:21): [True: 9.52k, False: 0]
  ------------------
 3737|  9.52k|                     pBNS->vert[centerpoint].st_edge.cap >= 1)
  ------------------
  |  Branch (3737:22): [True: 3.50k, False: 6.01k]
  ------------------
 3738|  3.50k|                {
 3739|  3.50k|                    nNewCap = inchi_min( pBNS->vert[centerpoint].st_edge.cap, nNewCap );
  ------------------
  |  |  139|  3.50k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 3.50k]
  |  |  ------------------
  ------------------
 3740|  3.50k|                    nNewCap = inchi_min( nNewCap, MAX_BOND_EDGE_CAP );
  ------------------
  |  |  139|  3.50k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 3.50k, False: 0]
  |  |  ------------------
  ------------------
 3741|  3.50k|                    pBNS->edge[iedge].cap = nNewCap;
 3742|  3.50k|                }
 3743|  9.52k|            }
 3744|       |#if ( FIX_CPOINT_BOND_CAP2 == 1 ) /* multiple bond */
 3745|       |            else
 3746|       |            {
 3747|       |                if (centerpoint < pBNS->num_atoms &&
 3748|       |                     edge->flow && pBNS->edge[iedge].cap < MAX_BOND_EDGE_CAP)
 3749|       |                {
 3750|       |                    pBNS->edge[iedge].cap++;
 3751|       |                }
 3752|       |            }
 3753|       |#endif
 3754|  60.5k|        }
 3755|  29.5k|#endif  /* } FIX_CPOINT_BOND_CAP */
 3756|       |
 3757|       |        /* Connect edge to c_point and fictpoint and increment the counters of neighbors and edges */
 3758|  29.5k|        edge->neighbor1 = c_point; /* the smallest out of v1=endopoint and v2=num_vertices */
 3759|  29.5k|        edge->neighbor12 = c_point ^ fictpoint; /* v1 ^ v2 */
 3760|  29.5k|        vertex_cpoint->iedge[vertex_cpoint->num_adj_edges] = num_edges;
 3761|  29.5k|        vert_ficpoint->iedge[vert_ficpoint->num_adj_edges] = num_edges++;
 3762|  29.5k|        edge->neigh_ord[0] = vertex_cpoint->num_adj_edges++;
 3763|  29.5k|        edge->neigh_ord[1] = vert_ficpoint->num_adj_edges++;
 3764|  29.5k|        edge->cap0 = edge->cap;
 3765|  29.5k|        edge->flow0 = edge->flow;
 3766|  29.5k|    }
 3767|       |
 3768|  16.1k|    ret = pBNS->num_vertices; /* new c-group atom number */
 3769|  16.1k|    pBNS->num_edges = num_edges;
 3770|  16.1k|    pBNS->num_vertices += num_cg;
 3771|  16.1k|    pBNS->num_c_groups += num_cg;
 3772|       |
 3773|  16.1k|    return ret;
 3774|   110k|}
CreateTGroupInBnStruct:
 3783|  93.6k|{
 3784|  93.6k|    int ret = 0;
 3785|       |    /* ret = ReInitBnStruct( pBNS ); */
 3786|  93.6k|    int         k, endpoint, tg, centerpoint, fictpoint;
 3787|  93.6k|    int         num_tg = 1;
 3788|  93.6k|    int         num_edges = pBNS->num_edges;
 3789|  93.6k|    int         num_vertices = pBNS->num_vertices;
 3790|  93.6k|    BNS_VERTEX *vert_ficpoint, *ver_ficpont_prev;  /* fictitious vertex describing t-group */
 3791|  93.6k|    BNS_VERTEX *vert_endpoint;
 3792|  93.6k|    BNS_EDGE   *edge;      /* edge between that vertex and the tautomeric endpoint */
 3793|  93.6k|    int        mask, num_endpoints, neutral_valence, edge_flow, edge_cap, num_bonds;
 3794|       |
 3795|       |    /* Debug: check overflow */
 3796|  93.6k|    if (num_vertices + num_tg >= pBNS->max_vertices)
  ------------------
  |  Branch (3796:9): [True: 0, False: 93.6k]
  ------------------
 3797|      0|    {
 3798|      0|        return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3799|      0|    }
 3800|       |
 3801|       |    /* Count new t-group edges */
 3802|   294k|    for (endpoint = 0, num_endpoints = 0; endpoint < num_atoms; endpoint++)
  ------------------
  |  Branch (3802:43): [True: 200k, False: 93.6k]
  ------------------
 3803|   200k|    {
 3804|   200k|        if (( nType & GetAtomChargeType( at, endpoint, NULL, &mask, 0 ) ) && ( mask & nMask )
  ------------------
  |  Branch (3804:13): [True: 16.9k, False: 183k]
  |  Branch (3804:78): [True: 16.4k, False: 495]
  ------------------
 3805|   200k|             )
 3806|  16.4k|        {
 3807|  16.4k|            num_endpoints++;
 3808|  16.4k|        }
 3809|   200k|    }
 3810|       |
 3811|  93.6k|    if (!num_endpoints)
  ------------------
  |  Branch (3811:9): [True: 84.8k, False: 8.77k]
  ------------------
 3812|  84.8k|    {
 3813|  84.8k|        return 0;
 3814|  84.8k|    }
 3815|       |
 3816|       |    /* Since t-group IDs may be not contiguous, clear all vertices that will be added.
 3817|       |    all-zeroes-vertex will be ignored by the BNS
 3818|       |    */
 3819|  8.77k|    memset( pBNS->vert + num_vertices, 0, num_tg * sizeof( pBNS->vert[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 3820|       |
 3821|       |    /* *old* Make sure the last t-group has the largest t-group ID:
 3822|       |    this is necessary to correctly add new edges and vertices for testing augmenting paths
 3823|       |    */
 3824|       |
 3825|       |    /**************************************/
 3826|       |    /* Initialize new fictitious vertex   */
 3827|       |    /* representing t-point group         */
 3828|       |    /**************************************/
 3829|  8.77k|    ver_ficpont_prev = pBNS->vert + num_vertices - 1;
 3830|       |
 3831|  17.5k|    for (tg = 0; tg < num_tg; tg++, ver_ficpont_prev = vert_ficpoint)
  ------------------
  |  Branch (3831:18): [True: 8.77k, False: 8.77k]
  ------------------
 3832|  8.77k|    {
 3833|       |        /*
 3834|       |        vert_ficpoint-1 is the last vertex;
 3835|       |        vert_ficpoint   is the vertex that is being added
 3836|       |        Note: nGroupNumber are not contiguous
 3837|       |        */
 3838|  8.77k|        vert_ficpoint = pBNS->vert + num_vertices + tg;
 3839|  8.77k|        vert_ficpoint->iedge = ver_ficpont_prev->iedge + ver_ficpont_prev->max_adj_edges;
 3840|  8.77k|        vert_ficpoint->max_adj_edges = num_endpoints + BNS_ADD_EDGES + BNS_ADD_SUPER_TGROUP;
  ------------------
  |  |   89|  8.77k|#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;
  ------------------
  |  |   85|  8.77k|#define BNS_ADD_SUPER_TGROUP 1  /* reserve one more edge for a t-group to connect to a single super-t-group */
  ------------------
 3841|  8.77k|        vert_ficpoint->num_adj_edges = 0;
 3842|  8.77k|        vert_ficpoint->st_edge.flow = vert_ficpoint->st_edge.flow0 = 0;
 3843|  8.77k|        vert_ficpoint->st_edge.cap = vert_ficpoint->st_edge.cap0 = 0;
 3844|  8.77k|        vert_ficpoint->type |= BNS_VERT_TYPE_TGROUP;
  ------------------
  |  |   47|  8.77k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 3845|  8.77k|    }
 3846|       |
 3847|  8.77k|    tg = 1;
 3848|  58.8k|    for (endpoint = 0; endpoint < num_atoms; endpoint++)
  ------------------
  |  Branch (3848:24): [True: 50.1k, False: 8.76k]
  ------------------
 3849|  50.1k|    {
 3850|  50.1k|        if (( nType & GetAtomChargeType( at, endpoint, NULL, &mask, 0 ) ) && ( mask & nMask ))
  ------------------
  |  Branch (3850:13): [True: 16.8k, False: 33.2k]
  |  Branch (3850:78): [True: 16.4k, False: 414]
  ------------------
 3851|  16.4k|        {
 3852|  16.4k|            ;
 3853|  16.4k|        }
 3854|  33.6k|        else
 3855|  33.6k|        {
 3856|  33.6k|            continue;
 3857|  33.6k|        }
 3858|  16.4k|        fictpoint = tg + num_vertices - 1;
 3859|  16.4k|        vert_ficpoint = pBNS->vert + fictpoint;
 3860|  16.4k|        vert_endpoint = pBNS->vert + endpoint;
 3861|       |        /* Debug: check overflow */
 3862|  16.4k|        if (fictpoint >= pBNS->max_vertices ||
  ------------------
  |  Branch (3862:13): [True: 0, False: 16.4k]
  ------------------
 3863|  16.4k|             num_edges >= pBNS->max_edges ||
  ------------------
  |  Branch (3863:14): [True: 0, False: 16.4k]
  ------------------
 3864|  16.4k|             vert_ficpoint->num_adj_edges >= vert_ficpoint->max_adj_edges ||
  ------------------
  |  Branch (3864:14): [True: 0, False: 16.4k]
  ------------------
 3865|  16.4k|             vert_endpoint->num_adj_edges >= vert_endpoint->max_adj_edges)
  ------------------
  |  Branch (3865:14): [True: 0, False: 16.4k]
  ------------------
 3866|      0|        {
 3867|       |            /* djb-rwth: removing redundant code */
 3868|      0|            break;
 3869|      0|        }
 3870|       |
 3871|       |        /* Obtain donor/acceptor info */
 3872|  16.4k|        neutral_valence = at[endpoint].chem_bonds_valence + at[endpoint].num_H - at[endpoint].charge;
 3873|  16.4k|        if (neutral_valence != 2 /* O, S, Se, Te */ &&
  ------------------
  |  Branch (3873:13): [True: 13.0k, False: 3.38k]
  ------------------
 3874|  13.0k|             neutral_valence != 3 /* N, P */)
  ------------------
  |  Branch (3874:14): [True: 6, False: 13.0k]
  ------------------
 3875|      6|        {
 3876|       |            /* djb-rwth: removing redundant code */
 3877|      6|            break;
 3878|      6|        }
 3879|  16.4k|        edge_flow = at[endpoint].num_H;
 3880|  16.4k|        num_bonds = at[endpoint].valence;
 3881|  16.4k|        edge_cap = neutral_valence - num_bonds; /* does not allow to reduce -NH3(+) to #N or -OH(+)- to -O- */
 3882|       |
 3883|  16.4k|        if (3 == neutral_valence /* N or P */ && 1 < num_bonds)
  ------------------
  |  Branch (3883:13): [True: 13.0k, False: 3.38k]
  |  Branch (3883:50): [True: 8.23k, False: 4.82k]
  ------------------
 3884|  8.23k|        {
 3885|  8.23k|            edge_cap++; /* allow -NH2(+)- => -N=, >NH(+)- => >N- */
 3886|  8.23k|        }
 3887|  16.4k|        edge_flow = inchi_min( edge_flow, edge_cap );
  ------------------
  |  |  139|  16.4k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 15.9k, False: 541]
  |  |  ------------------
  ------------------
 3888|       |        /*
 3889|       |        if ( !nGetEndpointInfo( at, endpoint, &eif ) ) {
 3890|       |        ret = BNS_BOND_ERR;
 3891|       |        break;
 3892|       |        }
 3893|       |        */
 3894|  16.4k|        vert_endpoint->type |= BNS_VERT_TYPE_ENDPOINT;
  ------------------
  |  |   46|  16.4k|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 3895|       |
 3896|       |        /* Create a new edge connecting endpoint to the new fictitious t-group vertex vert_ficpoint */
 3897|  16.4k|        edge = pBNS->edge + num_edges;
 3898|  16.4k|        edge->cap = edge_cap;
 3899|  16.4k|        edge->flow = edge_flow;
 3900|  16.4k|        edge->pass = 0;
 3901|  16.4k|#if ( RESET_EDGE_FORBIDDEN_MASK == 1 )
 3902|  16.4k|        edge->forbidden &= pBNS->edge_forbidden_mask;
 3903|  16.4k|#endif
 3904|       |
 3905|       |        /* Adjust st_flow and st_cap of the adjacent vertices */
 3906|       |        /* Adjust t-group vertex st-flow & cap */
 3907|  16.4k|        vert_ficpoint->st_edge.flow += edge->flow;
 3908|  16.4k|        vert_ficpoint->st_edge.cap += edge->flow;
 3909|       |        /* adjust endpoint vertex st-flow & cap */
 3910|  16.4k|        vert_endpoint->st_edge.flow += edge->flow;
 3911|  16.4k|        vert_endpoint->st_edge.cap += edge->flow;
 3912|       |
 3913|       |        /* Adjust edge cap & flow according to the number of H and number of bonds */
 3914|  71.3k|        for (k = 0; k < vert_endpoint->num_adj_edges; k++)
  ------------------
  |  Branch (3914:21): [True: 54.9k, False: 16.4k]
  ------------------
 3915|  54.9k|        {
 3916|  54.9k|            int iedge = vert_endpoint->iedge[k];
 3917|  54.9k|            VertexFlow  nNewCap = vert_endpoint->st_edge.cap;
 3918|  54.9k|            if (!pBNS->edge[iedge].cap)
  ------------------
  |  Branch (3918:17): [True: 3.15k, False: 51.7k]
  ------------------
 3919|  3.15k|            {
 3920|       |                /* single bond, possibly between endpoint and centerpoint */
 3921|  3.15k|                centerpoint = ( pBNS->edge[iedge].neighbor12 ^ endpoint );
 3922|  3.15k|                if (centerpoint < pBNS->num_atoms &&
  ------------------
  |  Branch (3922:21): [True: 3.15k, False: 0]
  ------------------
 3923|  3.15k|                     pBNS->vert[centerpoint].st_edge.cap >= 1)
  ------------------
  |  Branch (3923:22): [True: 341, False: 2.81k]
  ------------------
 3924|    341|                {
 3925|    341|                    nNewCap = inchi_min( pBNS->vert[centerpoint].st_edge.cap, nNewCap );
  ------------------
  |  |  139|    341|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 341]
  |  |  ------------------
  ------------------
 3926|    341|                    nNewCap = inchi_min( nNewCap, MAX_BOND_EDGE_CAP );
  ------------------
  |  |  139|    341|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 341, False: 0]
  |  |  ------------------
  ------------------
 3927|    341|                    pBNS->edge[iedge].cap = nNewCap;
 3928|    341|                }
 3929|  3.15k|            }
 3930|  54.9k|        }
 3931|       |
 3932|       |        /* Connect edge to endpoint and fictpoint and increment the counters of neighbors and edges */
 3933|  16.4k|        edge->neighbor1 = endpoint; /* the smallest out of v1=endopoint and v2=num_vertices */
 3934|  16.4k|        edge->neighbor12 = endpoint ^ fictpoint; /* v1 ^ v2 */
 3935|  16.4k|        vert_endpoint->iedge[vert_endpoint->num_adj_edges] = num_edges;
 3936|  16.4k|        vert_ficpoint->iedge[vert_ficpoint->num_adj_edges] = num_edges++;
 3937|  16.4k|        edge->neigh_ord[0] = vert_endpoint->num_adj_edges++;
 3938|  16.4k|        edge->neigh_ord[1] = vert_ficpoint->num_adj_edges++;
 3939|  16.4k|        edge->cap0 = edge->cap;
 3940|  16.4k|        edge->flow0 = edge->flow;
 3941|  16.4k|    }
 3942|       |
 3943|  8.77k|    ret = pBNS->num_vertices; /* new t-group atom number */
 3944|  8.77k|    pBNS->num_edges = num_edges;
 3945|  8.77k|    pBNS->num_vertices += num_tg;
 3946|  8.77k|    pBNS->num_t_groups += num_tg;
 3947|       |
 3948|  8.77k|    return ret;
 3949|  93.6k|}
RemoveLastGroupFromBnStruct:
 3957|  24.9k|{
 3958|  24.9k|    int ret = 0;
 3959|       |    /* ret = ReInitBnStruct( pBNS ); */
 3960|  24.9k|    int         k, endpoint, /*centerpoint, fictpoint,*/ iedge;
 3961|  24.9k|    int         num_edges = pBNS->num_edges;
 3962|  24.9k|    int         num_vertices = pBNS->num_vertices;
 3963|  24.9k|    BNS_VERTEX *vert_ficpoint /*, *ver_ficpont_prev*/;  /* fictitious vertex describing t-group */
 3964|  24.9k|    BNS_VERTEX *vert_endpoint;
 3965|  24.9k|    BNS_EDGE   *edge;      /* edge between that vertex and the tautomeric endpoint */
 3966|       |                           /*int        mask, num_endpoints, neutral_valence, edge_flow, edge_cap, num_bonds;*/
 3967|  24.9k|    int        is_t_group = 0, is_c_group = 0;
 3968|       |
 3969|       |    /* Debug: check overflow */
 3970|  24.9k|    if (pBNS->num_added_atoms + pBNS->num_c_groups + pBNS->num_t_groups + num_atoms >= pBNS->max_vertices)
  ------------------
  |  Branch (3970:9): [True: 0, False: 24.9k]
  ------------------
 3971|      0|    {
 3972|      0|        return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3973|      0|    }
 3974|       |
 3975|  24.9k|    if (tg + 1 != num_vertices)
  ------------------
  |  Branch (3975:9): [True: 0, False: 24.9k]
  ------------------
 3976|      0|    {
 3977|      0|        return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3978|      0|    }
 3979|       |
 3980|  24.9k|    vert_ficpoint = pBNS->vert + tg;
 3981|       |
 3982|  24.9k|    if (vert_ficpoint->type & BNS_VERT_TYPE_TGROUP)
  ------------------
  |  |   47|  24.9k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
  |  Branch (3982:9): [True: 8.77k, False: 16.1k]
  ------------------
 3983|  8.77k|    {
 3984|  8.77k|        is_t_group = 1;
 3985|  8.77k|    }
 3986|  24.9k|    if (vert_ficpoint->type & BNS_VERT_TYPE_C_GROUP)
  ------------------
  |  |   49|  24.9k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
  |  Branch (3986:9): [True: 16.1k, False: 8.77k]
  ------------------
 3987|  16.1k|    {
 3988|  16.1k|        is_c_group = 1;
 3989|  16.1k|        if (vert_ficpoint->type & BNS_VERT_TYPE_C_NEGATIVE)
  ------------------
  |  |   54|  16.1k|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  ------------------
  |  Branch (3989:13): [True: 8.93k, False: 7.19k]
  ------------------
 3990|  8.93k|        {
 3991|  8.93k|            is_c_group = 2;
 3992|  8.93k|        }
 3993|  16.1k|    }
 3994|       |
 3995|  70.8k|    for (k = vert_ficpoint->num_adj_edges - 1; 0 <= k; k--)
  ------------------
  |  Branch (3995:48): [True: 45.9k, False: 24.9k]
  ------------------
 3996|  45.9k|    {
 3997|  45.9k|        iedge = vert_ficpoint->iedge[k];
 3998|  45.9k|        if (iedge + 1 != num_edges)
  ------------------
  |  Branch (3998:13): [True: 0, False: 45.9k]
  ------------------
 3999|      0|        {
 4000|      0|            return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 4001|      0|        }
 4002|  45.9k|        edge = pBNS->edge + iedge;
 4003|  45.9k|        endpoint = edge->neighbor12 ^ tg;
 4004|  45.9k|        vert_endpoint = pBNS->vert + endpoint;
 4005|       |        /* adjust st_flow, st_cap */
 4006|  45.9k|        vert_endpoint->st_edge.cap0 =
 4007|  45.9k|            vert_endpoint->st_edge.cap -= edge->flow;
 4008|  45.9k|        vert_endpoint->st_edge.flow0 =
 4009|  45.9k|            vert_endpoint->st_edge.flow -= edge->flow;
 4010|  45.9k|        if (pBNS->type_TACN && ( vert_endpoint->type & pBNS->type_TACN ) == pBNS->type_TACN)
  ------------------
  |  Branch (4010:13): [True: 45.9k, False: 0]
  |  Branch (4010:32): [True: 1.47k, False: 44.4k]
  ------------------
 4011|  1.47k|        {
 4012|  1.47k|            vert_endpoint->type ^= pBNS->type_TACN;
 4013|  1.47k|        }
 4014|  45.9k|        if (is_t_group)
  ------------------
  |  Branch (4014:13): [True: 16.4k, False: 29.4k]
  ------------------
 4015|  16.4k|        {
 4016|  16.4k|            vert_endpoint->type ^= ( vert_ficpoint->type & BNS_VERT_TYPE_ENDPOINT );
  ------------------
  |  |   46|  16.4k|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 4017|  16.4k|        }
 4018|  45.9k|        if (is_c_group)
  ------------------
  |  Branch (4018:13): [True: 29.4k, False: 16.4k]
  ------------------
 4019|  29.4k|        {
 4020|  29.4k|            vert_endpoint->type ^= ( vert_ficpoint->type & BNS_VERT_TYPE_C_POINT );
  ------------------
  |  |   48|  29.4k|#define BNS_VERT_TYPE_C_POINT       0x0008
  ------------------
 4021|  29.4k|        }
 4022|       |        /* Remove edge */
 4023|  45.9k|        if (edge->neigh_ord[0] + 1 != vert_endpoint->num_adj_edges)
  ------------------
  |  Branch (4023:13): [True: 0, False: 45.9k]
  ------------------
 4024|      0|        {
 4025|      0|            return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 4026|      0|        }
 4027|  45.9k|        vert_endpoint->num_adj_edges--;
 4028|  45.9k|        memset( edge, 0, sizeof( *edge ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4029|  45.9k|        num_edges--;
 4030|  45.9k|        if (1 == is_t_group && endpoint < num_atoms)
  ------------------
  |  Branch (4030:13): [True: 16.4k, False: 29.4k]
  |  Branch (4030:32): [True: 16.4k, False: 0]
  ------------------
 4031|  16.4k|        {
 4032|  16.4k|            at->endpoint = 0;
 4033|  16.4k|        }
 4034|  45.9k|        if (1 == is_c_group && endpoint < num_atoms)
  ------------------
  |  Branch (4034:13): [True: 13.0k, False: 32.8k]
  |  Branch (4034:32): [True: 13.0k, False: 0]
  ------------------
 4035|  13.0k|        {
 4036|  13.0k|            at->c_point = 0;
 4037|  13.0k|        }
 4038|  45.9k|    }
 4039|  24.9k|    memset( vert_ficpoint, 0, sizeof( *vert_ficpoint ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4040|  24.9k|    num_vertices--;
 4041|       |
 4042|  24.9k|    pBNS->num_edges = num_edges;
 4043|  24.9k|    pBNS->num_vertices = num_vertices;
 4044|  24.9k|    if (is_t_group)
  ------------------
  |  Branch (4044:9): [True: 8.77k, False: 16.1k]
  ------------------
 4045|  8.77k|    {
 4046|  8.77k|        pBNS->num_t_groups--;
 4047|  8.77k|    }
 4048|  24.9k|    if (is_c_group)
  ------------------
  |  Branch (4048:9): [True: 16.1k, False: 8.77k]
  ------------------
 4049|  16.1k|    {
 4050|  16.1k|        pBNS->num_c_groups--;
 4051|  16.1k|    }
 4052|       |
 4053|  24.9k|    return ret;
 4054|  24.9k|}
SetInitCapFlowToCurrent:
 4060|  4.60k|{
 4061|  4.60k|    int       i, j;
 4062|  4.60k|    BNS_EDGE *pEdge = NULL;
 4063|  36.0k|    for (i = 0; i < pBNS->num_vertices; i++)
  ------------------
  |  Branch (4063:17): [True: 31.4k, False: 4.60k]
  ------------------
 4064|  31.4k|    {
 4065|  31.4k|        pBNS->vert[i].st_edge.flow0 = pBNS->vert[i].st_edge.flow;
 4066|  31.4k|        pBNS->vert[i].st_edge.cap0 = pBNS->vert[i].st_edge.cap;
 4067|  78.9k|        for (j = 0; j < pBNS->vert[i].num_adj_edges; j++)
  ------------------
  |  Branch (4067:21): [True: 47.5k, False: 31.4k]
  ------------------
 4068|  47.5k|        {
 4069|  47.5k|            pEdge = pBNS->edge + pBNS->vert[i].iedge[j];
 4070|  47.5k|            pEdge->cap0 = pEdge->cap;
 4071|  47.5k|            pEdge->flow0 = pEdge->flow;
 4072|  47.5k|        }
 4073|  31.4k|    }
 4074|       |
 4075|  4.60k|    return 0;
 4076|  4.60k|}
SimpleRemoveAcidicProtons:
 4098|  41.8k|{
 4099|  41.8k|    int i, j, max_j = -1, mask, type, num_removed;
 4100|  41.8k|    int num[AR_SIMPLE_STEPS + 1], num_tot;
 4101|       |
 4102|  83.7k|    for (j = 0; ArTypMask[2 * j]; j++)
  ------------------
  |  Branch (4102:17): [True: 41.8k, False: 41.8k]
  ------------------
 4103|  41.8k|    {
 4104|  41.8k|        num[max_j = j] = 0;
 4105|  41.8k|    }
 4106|       |
 4107|   117k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (4107:17): [True: 75.7k, False: 41.8k]
  ------------------
 4108|  75.7k|    {
 4109|  75.7k|        if (!at[i].charge && at[i].num_H && ( type = GetAtomChargeType( at, i, NULL, &mask, 0 ) ))
  ------------------
  |  Branch (4109:13): [True: 22.3k, False: 53.4k]
  |  Branch (4109:30): [True: 867, False: 21.4k]
  |  Branch (4109:45): [True: 454, False: 413]
  ------------------
 4110|    454|        {
 4111|    768|            for (j = 0; j <= max_j; j++)
  ------------------
  |  Branch (4111:25): [True: 454, False: 314]
  ------------------
 4112|    454|            {
 4113|    454|                if (( type & ArTypMask[2 * j] ) && ( mask && ArTypMask[2 * j + 1] ))
  ------------------
  |  Branch (4113:21): [True: 140, False: 314]
  |  Branch (4113:54): [True: 140, False: 0]
  |  Branch (4113:62): [True: 140, False: 0]
  ------------------
 4114|    140|                {
 4115|    140|                    num[j]  ++;
 4116|    140|                    break;
 4117|    140|                }
 4118|    454|            }
 4119|    454|        }
 4120|  75.7k|    }
 4121|  83.6k|    for (j = 0, num_tot = 0; j <= max_j; j++)
  ------------------
  |  Branch (4121:30): [True: 41.8k, False: 41.7k]
  ------------------
 4122|  41.8k|    {
 4123|  41.8k|        if (( num_tot += num[j] ) >= num2remove)
  ------------------
  |  Branch (4123:13): [True: 98, False: 41.7k]
  ------------------
 4124|     98|        {
 4125|     98|            max_j = j;
 4126|     98|            break;
 4127|     98|        }
 4128|  41.8k|    }
 4129|  41.8k|    if (!num_tot)
  ------------------
  |  Branch (4129:9): [True: 41.7k, False: 103]
  ------------------
 4130|  41.7k|    {
 4131|  41.7k|        return 0;
 4132|  41.7k|    }
 4133|    639|    for (i = 0, num_removed = 0; i < num_atoms && num_removed < num2remove; i++)
  ------------------
  |  Branch (4133:34): [True: 615, False: 24]
  |  Branch (4133:51): [True: 536, False: 79]
  ------------------
 4134|    536|    {
 4135|    536|        if (!at[i].charge && at[i].num_H && ( type = GetAtomChargeType( at, i, NULL, &mask, 0 ) ))
  ------------------
  |  Branch (4135:13): [True: 421, False: 115]
  |  Branch (4135:30): [True: 113, False: 308]
  |  Branch (4135:45): [True: 105, False: 8]
  ------------------
 4136|    105|        {
 4137|    107|            for (j = 0; j <= max_j; j++)
  ------------------
  |  Branch (4137:25): [True: 105, False: 2]
  ------------------
 4138|    105|            {
 4139|    105|                if (num[j] && ( type & ArTypMask[2 * j] ) && ( mask && ArTypMask[2 * j + 1] ))
  ------------------
  |  Branch (4139:21): [True: 105, False: 0]
  |  Branch (4139:31): [True: 103, False: 2]
  |  Branch (4139:64): [True: 103, False: 0]
  |  Branch (4139:72): [True: 103, False: 0]
  ------------------
 4140|    103|                {
 4141|       |                    /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 4142|    103|                    type = GetAtomChargeType(at, i, pAATG->nAtTypeTotals, &mask, 1); /* subtract at[i] */ 
 4143|    103|                    num[j]  --;
 4144|    103|                    at[i].charge--;
 4145|    103|                    AddOrRemoveExplOrImplH( -1, at, num_atoms, (AT_NUMB) i, pAATG->t_group_info );
 4146|       |                    /*at[i].num_H  --;*/
 4147|    103|                    num_removed++;
 4148|    103|                    type = GetAtomChargeType(at, i, pAATG->nAtTypeTotals, &mask, 0); /* add changed at[i] */ /* ! THIS CHANGES pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] */ 
 4149|    103|                    break;
 4150|    103|                }
 4151|    105|            }
 4152|    105|        }
 4153|    536|    }
 4154|       |
 4155|       |    /*
 4156|       |    pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE]  -= num_removed;
 4157|       |    pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] += num_removed;
 4158|       |    */
 4159|       |
 4160|    103|    return num_removed;
 4161|  41.8k|}
bHasAcidicHydrogen:
 4166|  1.00M|{
 4167|  1.00M|    int bFound = 0, j, type, mask;
 4168|  1.00M|    if (!at[i].charge && at[i].num_H && ( type = GetAtomChargeType( at, i, NULL, &mask, 0 ) ))
  ------------------
  |  Branch (4168:9): [True: 908k, False: 100k]
  |  Branch (4168:26): [True: 6.55k, False: 901k]
  |  Branch (4168:41): [True: 2.15k, False: 4.39k]
  ------------------
 4169|  2.15k|    {
 4170|  2.37k|        for (j = 0; ArTypMask[2 * j]; j++)
  ------------------
  |  Branch (4170:21): [True: 2.15k, False: 227]
  ------------------
 4171|  2.15k|        {
 4172|  2.15k|            if (( type & ArTypMask[2 * j] ) && ( mask & ArTypMask[2 * j + 1] ))
  ------------------
  |  Branch (4172:17): [True: 1.93k, False: 215]
  |  Branch (4172:48): [True: 1.92k, False: 12]
  ------------------
 4173|  1.92k|            {
 4174|  1.92k|                bFound++;
 4175|  1.92k|                break;
 4176|  1.92k|            }
 4177|  2.15k|        }
 4178|  2.15k|    }
 4179|       |
 4180|  1.00M|    return bFound;
 4181|  1.00M|}
bHasOtherExchangableH:
 4186|    312|{
 4187|    312|    int bFound = 0, type, mask;
 4188|    312|    if (at[i].num_H && ( type = GetAtomChargeType( at, i, NULL, &mask, 0 ) ))
  ------------------
  |  Branch (4188:9): [True: 312, False: 0]
  |  Branch (4188:24): [True: 24, False: 288]
  ------------------
 4189|     24|    {
 4190|     24|        if (( type & ATT_ATOM_N ) && ( mask & ATBIT_NP_H ))
  ------------------
  |  |   37|     24|#define ATT_ATOM_N 0x0040
  ------------------
                      if (( type & ATT_ATOM_N ) && ( mask & ATBIT_NP_H ))
  ------------------
  |  |   94|     11|#define ATBIT_NP_H       (1 << ATTOT_NUM_NP_H)
  ------------------
  |  Branch (4190:13): [True: 11, False: 13]
  |  Branch (4190:38): [True: 11, False: 0]
  ------------------
 4191|     11|        {
 4192|     11|            bFound++;
 4193|     11|        }
 4194|     24|    }
 4195|       |
 4196|    312|    return bFound;
 4197|    312|}
SimpleAddAcidicProtons:
 4222|  10.8k|{
 4223|  10.8k|    int i, j, max_j = -1, mask, type, num_added;
 4224|  10.8k|    int num[AR_SIMPLE_STEPS + 1], num_tot;
 4225|       |
 4226|  32.4k|    for (j = 0; AaTypMask[2 * j]; j++)
  ------------------
  |  Branch (4226:17): [True: 21.6k, False: 10.8k]
  ------------------
 4227|  21.6k|    {
 4228|  21.6k|        num[max_j = j] = 0;
 4229|  21.6k|    }
 4230|       |
 4231|  73.3k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (4231:17): [True: 62.5k, False: 10.8k]
  ------------------
 4232|  62.5k|    {
 4233|  62.5k|        if (at[i].charge == -1 && ( type = GetAtomChargeType( at, i, NULL, &mask, 0 ) ))
  ------------------
  |  Branch (4233:13): [True: 16.2k, False: 46.2k]
  |  Branch (4233:35): [True: 8.55k, False: 7.70k]
  ------------------
 4234|  8.55k|        {
 4235|  16.6k|            for (j = 0; j <= max_j; j++)
  ------------------
  |  Branch (4235:25): [True: 12.6k, False: 4.05k]
  ------------------
 4236|  12.6k|            {
 4237|  12.6k|                if (( type & AaTypMask[2 * j] ) && ( mask && AaTypMask[2 * j + 1] ))
  ------------------
  |  Branch (4237:21): [True: 4.50k, False: 8.12k]
  |  Branch (4237:54): [True: 4.50k, False: 0]
  |  Branch (4237:62): [True: 4.50k, False: 0]
  ------------------
 4238|  4.50k|                {
 4239|  4.50k|                    num[j]  ++;
 4240|  4.50k|                    break;
 4241|  4.50k|                }
 4242|  12.6k|            }
 4243|  8.55k|        }
 4244|  62.5k|    }
 4245|  25.1k|    for (j = 0, num_tot = 0; j <= max_j; j++)
  ------------------
  |  Branch (4245:30): [True: 17.9k, False: 7.15k]
  ------------------
 4246|  17.9k|    {
 4247|  17.9k|        if (( num_tot += num[j] ) >= num2add)
  ------------------
  |  Branch (4247:13): [True: 3.66k, False: 14.3k]
  ------------------
 4248|  3.66k|        {
 4249|  3.66k|            max_j = j;
 4250|  3.66k|            break;
 4251|  3.66k|        }
 4252|  17.9k|    }
 4253|  10.8k|    if (!num_tot)
  ------------------
  |  Branch (4253:9): [True: 6.88k, False: 3.93k]
  ------------------
 4254|  6.88k|    {
 4255|  6.88k|        return 0;
 4256|  6.88k|    }
 4257|  19.0k|    for (i = 0, num_added = 0; i < num_atoms && num_added < num2add; i++)
  ------------------
  |  Branch (4257:32): [True: 18.3k, False: 650]
  |  Branch (4257:49): [True: 15.0k, False: 3.28k]
  ------------------
 4258|  15.0k|    {
 4259|  15.0k|        if (at[i].charge == -1 && ( type = GetAtomChargeType( at, i, NULL, &mask, 0 ) ))
  ------------------
  |  Branch (4259:13): [True: 4.85k, False: 10.2k]
  |  Branch (4259:35): [True: 4.39k, False: 468]
  ------------------
 4260|  4.39k|        {
 4261|  4.76k|            for (j = 0; j <= max_j; j++)
  ------------------
  |  Branch (4261:25): [True: 4.57k, False: 193]
  ------------------
 4262|  4.57k|            {
 4263|  4.57k|                if (num[j] && ( type & AaTypMask[2 * j] ) && ( mask && AaTypMask[2 * j + 1] ))
  ------------------
  |  Branch (4263:21): [True: 4.35k, False: 216]
  |  Branch (4263:31): [True: 4.19k, False: 161]
  |  Branch (4263:64): [True: 4.19k, False: 0]
  |  Branch (4263:72): [True: 4.19k, False: 0]
  ------------------
 4264|  4.19k|                {
 4265|       |                    /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 4266|  4.19k|                    type = GetAtomChargeType(at, i, pAATG->nAtTypeTotals, &mask, 1); /* subtract at[i] */
 4267|  4.19k|                    num[j]  --;
 4268|  4.19k|                    at[i].charge++;
 4269|  4.19k|                    AddOrRemoveExplOrImplH( 1, at, num_atoms, (AT_NUMB) i, pAATG->t_group_info );
 4270|       |                    /*at[i].num_H  ++;*/
 4271|  4.19k|                    num_added++;
 4272|  4.19k|                    type = GetAtomChargeType(at, i, pAATG->nAtTypeTotals, &mask, 0); /* add changed at[i] */
 4273|  4.19k|                    break;
 4274|  4.19k|                }
 4275|  4.57k|            }
 4276|  4.39k|        }
 4277|  15.0k|    }
 4278|       |
 4279|       |    /*
 4280|       |    pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE]  += num_added;
 4281|       |    pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] -= num_added;
 4282|       |    */
 4283|       |
 4284|  3.93k|    return num_added;
 4285|  10.8k|}
bHasAcidicMinus:
 4290|  1.00M|{
 4291|  1.00M|    int bFound = 0, j, type, mask;
 4292|  1.00M|    if (at[i].charge == -1 && ( type = GetAtomChargeType( at, i, NULL, &mask, 0 ) ))
  ------------------
  |  Branch (4292:9): [True: 25.5k, False: 980k]
  |  Branch (4292:31): [True: 2.01k, False: 23.5k]
  ------------------
 4293|  2.01k|    {
 4294|  4.87k|        for (j = 0; AaTypMask[2 * j]; j++)
  ------------------
  |  Branch (4294:21): [True: 3.44k, False: 1.42k]
  ------------------
 4295|  3.44k|        {
 4296|  3.44k|            if (( type & AaTypMask[2 * j] ) && ( mask & AaTypMask[2 * j + 1] ))
  ------------------
  |  Branch (4296:17): [True: 599, False: 2.84k]
  |  Branch (4296:48): [True: 592, False: 7]
  ------------------
 4297|    592|            {
 4298|    592|                bFound++;
 4299|    592|                break;
 4300|    592|            }
 4301|  3.44k|        }
 4302|  2.01k|    }
 4303|       |
 4304|  1.00M|    return bFound;
 4305|  1.00M|}
HardRemoveAcidicProtons:
 4324|  41.7k|{
 4325|  41.7k|    int cg_Plus = 0;
 4326|  41.7k|    int cg_Minus = 0;
 4327|  41.7k|    int tg_H_Other = 0;
 4328|  41.7k|    int tg_H_Acid = 0;
 4329|       |
 4330|  41.7k|    int ret = 0, ret2;
 4331|  41.7k|    int nDelta, nNumMoved2AcidH = 0, nNumNeutralized = 0, nPrevNumCharges; /* djb-rwth: removing redundant variables */
 4332|       |
 4333|  41.7k|    int nPosCharges, nPosCharges2;
 4334|  41.7k|    int nNegCharges, nNegCharges2;
 4335|       |    /*
 4336|       |    int nNumNP_H, nNumNP_H2;
 4337|       |    int nNumOS_H, nNumOS_H2;
 4338|       |    */
 4339|       |
 4340|  41.7k|    nPosCharges = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] + pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4341|  41.7k|    nNegCharges = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] - pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4342|       |    /*
 4343|       |    nNumNP_H    =  pAATG->nAtTypeTotals[ATTOT_NUM_NP_H] +
 4344|       |    pAATG->nAtTypeTotals[ATTOT_NUM_NP_Proton];
 4345|       |    nNumOS_H    =  pAATG->nAtTypeTotals[ATTOT_NUM_COH] +
 4346|       |    pAATG->nAtTypeTotals[ATTOT_NUM_CSH] +
 4347|       |    pAATG->nAtTypeTotals[ATTOT_NUM_ZOH];
 4348|       |    */
 4349|       |
 4350|       |    /* Prevent free exchange H <-> (-) */
 4351|  41.7k|    pBNS->type_CN = ( BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE );
  ------------------
  |  |   49|  41.7k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
                  pBNS->type_CN = ( BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE );
  ------------------
  |  |   54|  41.7k|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  ------------------
 4352|  41.7k|    pBNS->type_T = BNS_VERT_TYPE_TGROUP;
  ------------------
  |  |   47|  41.7k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 4353|  41.7k|    pBNS->type_TACN = BNS_VERT_TYPE_ACID;
  ------------------
  |  |   55|  41.7k|#define BNS_VERT_TYPE_ACID          0x0200  /* only for this type are allowed paths: t_group-atom-c_group_neg (path_TACN) */
  ------------------
 4354|       |
 4355|       |    /* Create (+) charge group */
 4356|  41.7k|    cg_Plus = CreateCGroupInBnStruct( at, num_atoms, pBNS, AR_HARD_TYP_POS, AR_HARD_MSK_POS, 1 );
  ------------------
  |  |  202|  41.7k|#define AR_HARD_TYP_POS   ATTYP_N
  |  |  ------------------
  |  |  |  |  150|  41.7k|#define ATTYP_N     (ATT_ATOM_N)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  41.7k|#define ATT_ATOM_N 0x0040
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  cg_Plus = CreateCGroupInBnStruct( at, num_atoms, pBNS, AR_HARD_TYP_POS, AR_HARD_MSK_POS, 1 );
  ------------------
  |  |  201|  41.7k|#define AR_HARD_MSK_POS   ATBIT_MSK_NP
  |  |  ------------------
  |  |  |  |  139|  41.7k|#define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|  41.7k|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4357|       |
 4358|       |    /* create (-) charge group */
 4359|       |    /*
 4360|       |    if ( nAtTypeTotals[ATTOT_NUM_CO_Minus] +
 4361|       |    nAtTypeTotals[ATTOT_NUM_CS_Minus] +
 4362|       |    nAtTypeTotals[ATTOT_NUM_ZO_Minus] +
 4363|       |    nAtTypeTotals[ATTOT_NUM_N_Minus] )
 4364|       |    */
 4365|       |
 4366|  41.7k|    cg_Minus = CreateCGroupInBnStruct( at, num_atoms, pBNS, AR_HARD_TYP_NEG, AR_HARD_MSK_NEG, -1 );
  ------------------
  |  |  205|  41.7k|#define AR_HARD_TYP_NEG   (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  150|  41.7k|#define ATTYP_N     (ATT_ATOM_N)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  41.7k|#define ATT_ATOM_N 0x0040
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define AR_HARD_TYP_NEG   (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  148|  41.7k|#define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   32|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   33|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|  41.7k|#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 );
  ------------------
  |  |  204|  41.7k|#define AR_HARD_MSK_NEG   (ATBIT_MSK_NP | ATBIT_MSK_OS)
  |  |  ------------------
  |  |  |  |  139|  41.7k|#define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|  41.7k|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define AR_HARD_MSK_NEG   (ATBIT_MSK_NP | ATBIT_MSK_OS)
  |  |  ------------------
  |  |  |  |  141|  41.7k|#define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |   98|  41.7k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |   99|  41.7k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  100|  41.7k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|  41.7k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  102|  41.7k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|  41.7k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|  41.7k|#define ATBIT_N_OH       (1 << ATTOT_NUM_N_OH)
  |  |  |  |  ------------------
  |  |  |  |  142|  41.7k|                        ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|  41.7k|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  106|  41.7k|#define ATBIT_ZO         (1 << ATTOT_NUM_ZO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|  41.7k|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|  41.7k|#define ATBIT_N_O        (1 << ATTOT_NUM_N_O)
  |  |  |  |  ------------------
  |  |  |  |  143|  41.7k|                        ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  109|  41.7k|#define ATBIT_CO_Minus   (1 << ATTOT_NUM_CO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  41.7k|#define ATBIT_CS_Minus   (1 << ATTOT_NUM_CS_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|  41.7k|#define ATBIT_ZO_Minus   (1 << ATTOT_NUM_ZO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  112|  41.7k|#define ATBIT_OO_Minus   (1 << ATTOT_NUM_OO_Minus)
  |  |  |  |  ------------------
  |  |  |  |  144|  41.7k|                        ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|  41.7k|#define ATBIT_ZOO_Minus  (1 << ATTOT_NUM_ZOO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|  41.7k|#define ATBIT_NO_Minus   (1 << ATTOT_NUM_NO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  41.7k|#define ATBIT_N_O_Minus  (1 << ATTOT_NUM_N_O_Minus)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4367|       |
 4368|  41.7k|    pBNS->type_CN = ( BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE );
  ------------------
  |  |   49|  41.7k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
                  pBNS->type_CN = ( BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE );
  ------------------
  |  |   54|  41.7k|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  ------------------
 4369|  41.7k|    pBNS->type_T = BNS_VERT_TYPE_TGROUP;
  ------------------
  |  |   47|  41.7k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 4370|  41.7k|    pBNS->type_TACN = BNS_VERT_TYPE_ACID;
  ------------------
  |  |   55|  41.7k|#define BNS_VERT_TYPE_ACID          0x0200  /* only for this type are allowed paths: t_group-atom-c_group_neg (path_TACN) */
  ------------------
 4371|       |
 4372|       |    /* Create tautomeric group for non-acidic or negatively charged acidic O  */
 4373|  41.7k|    tg_H_Other = CreateTGroupInBnStruct( at, num_atoms, pBNS, AR_HARD_TYP_HN, AR_HARD_MSK_HN );
  ------------------
  |  |  211|  41.7k|#define AR_HARD_TYP_HN    ((ATTYP_N | ATTYP_OS) /*& ~AR_HARD_TYP_HA*/)
  |  |  ------------------
  |  |  |  |  150|  41.7k|#define ATTYP_N     (ATT_ATOM_N)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  41.7k|#define ATT_ATOM_N 0x0040
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define AR_HARD_TYP_HN    ((ATTYP_N | ATTYP_OS) /*& ~AR_HARD_TYP_HA*/)
  |  |  ------------------
  |  |  |  |  148|  41.7k|#define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   32|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   33|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|  41.7k|#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 );
  ------------------
  |  |  210|  41.7k|#define AR_HARD_MSK_HN    ((ATBIT_MSK_NP | ATBIT_MSK_OS) & ~AR_HARD_MSK_HA)
  |  |  ------------------
  |  |  |  |  139|  41.7k|#define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  41.7k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|  41.7k|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define AR_HARD_MSK_HN    ((ATBIT_MSK_NP | ATBIT_MSK_OS) & ~AR_HARD_MSK_HA)
  |  |  ------------------
  |  |  |  |  141|  41.7k|#define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |   98|  41.7k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |   99|  41.7k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  100|  41.7k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|  41.7k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  102|  41.7k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|  41.7k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|  41.7k|#define ATBIT_N_OH       (1 << ATTOT_NUM_N_OH)
  |  |  |  |  ------------------
  |  |  |  |  142|  41.7k|                        ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|  41.7k|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  106|  41.7k|#define ATBIT_ZO         (1 << ATTOT_NUM_ZO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|  41.7k|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|  41.7k|#define ATBIT_N_O        (1 << ATTOT_NUM_N_O)
  |  |  |  |  ------------------
  |  |  |  |  143|  41.7k|                        ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  109|  41.7k|#define ATBIT_CO_Minus   (1 << ATTOT_NUM_CO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  41.7k|#define ATBIT_CS_Minus   (1 << ATTOT_NUM_CS_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|  41.7k|#define ATBIT_ZO_Minus   (1 << ATTOT_NUM_ZO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  112|  41.7k|#define ATBIT_OO_Minus   (1 << ATTOT_NUM_OO_Minus)
  |  |  |  |  ------------------
  |  |  |  |  144|  41.7k|                        ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|  41.7k|#define ATBIT_ZOO_Minus  (1 << ATTOT_NUM_ZOO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|  41.7k|#define ATBIT_NO_Minus   (1 << ATTOT_NUM_NO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  41.7k|#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)
  |  |  ------------------
  |  |  |  |  207|  41.7k|#define AR_HARD_MSK_HA    (ATBIT_CO | ATBIT_NO )
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|  41.7k|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  |  |  ------------------
  |  |  |  |               #define AR_HARD_MSK_HA    (ATBIT_CO | ATBIT_NO )
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|  41.7k|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4374|       |
 4375|       |    /* Create tautomeric group for possibly acidic O */
 4376|  41.7k|    tg_H_Acid = CreateTGroupInBnStruct( at, num_atoms, pBNS, AR_HARD_TYP_HA, AR_HARD_MSK_HA );
  ------------------
  |  |  208|  41.7k|#define AR_HARD_TYP_HA    (ATT_ACIDIC_CO | ATT_NO)
  |  |  ------------------
  |  |  |  |   31|  41.7k|#define ATT_ACIDIC_CO 0x0001
  |  |  ------------------
  |  |               #define AR_HARD_TYP_HA    (ATT_ACIDIC_CO | ATT_NO)
  |  |  ------------------
  |  |  |  |   35|  41.7k|#define ATT_NO 0x0010
  |  |  ------------------
  ------------------
                  tg_H_Acid = CreateTGroupInBnStruct( at, num_atoms, pBNS, AR_HARD_TYP_HA, AR_HARD_MSK_HA );
  ------------------
  |  |  207|  41.7k|#define AR_HARD_MSK_HA    (ATBIT_CO | ATBIT_NO )
  |  |  ------------------
  |  |  |  |  105|  41.7k|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  ------------------
  |  |               #define AR_HARD_MSK_HA    (ATBIT_CO | ATBIT_NO )
  |  |  ------------------
  |  |  |  |  107|  41.7k|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  ------------------
  ------------------
 4377|  41.7k|    if (tg_H_Other >= num_atoms && tg_H_Acid >= num_atoms)
  ------------------
  |  Branch (4377:9): [True: 2.41k, False: 39.3k]
  |  Branch (4377:36): [True: 142, False: 2.27k]
  ------------------
 4378|    142|    {
 4379|       |        /* Find alt path to remove one proton */
 4380|    142|        do
 4381|    147|        {
 4382|       |            /* Remove a proton */
 4383|    147|            nPrevNumCharges = pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES];
 4384|       |            /* djb-rwth: addressing coverity ID #499503 -- tg_H_Other negative values handled properly */
 4385|    147|            ret = bExistsAltPath( pCG, pBNS, pBD, pAATG,
 4386|    147|                                  at, num_atoms,
 4387|    147|                                  tg_H_Other /*nVertDoubleBond*/,
 4388|    147|                                  tg_H_Acid /*nVertSingleBond*/,
 4389|    147|                                  ALT_PATH_MODE_REM_PROTON );
  ------------------
  |  |  318|    147|#define ALT_PATH_MODE_REM_PROTON 9   /* remove proton, adjust bonds, charges, H-counts 2004-03-05 */
  ------------------
 4390|    147|            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|    147|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|    147|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|    147|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    147|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 147, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 147]
  |  |  ------------------
  ------------------
 4391|      0|            {
 4392|      0|                return ret;
 4393|      0|            }
 4394|    147|            if (ret & 1)
  ------------------
  |  Branch (4394:17): [True: 11, False: 136]
  ------------------
 4395|     11|            {
 4396|     11|                nDelta = ( ret & ~3 ) >> 2;
 4397|       |                /* djb-rwth: removing redundant code */
 4398|     11|                if (nDelta)
  ------------------
  |  Branch (4398:21): [True: 0, False: 11]
  ------------------
 4399|      0|                {
 4400|       |                    /* Radical pair has disappeared */
 4401|      0|                    ; /* goto quick_exit;*/
 4402|      0|                }
 4403|     11|                nNumMoved2AcidH++;
 4404|     11|                if (nPrevNumCharges > pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] + 1)
  ------------------
  |  Branch (4404:21): [True: 0, False: 11]
  ------------------
 4405|      0|                {
 4406|      0|                    nNumNeutralized += ( nPrevNumCharges - ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] - 1 ) ) / 2;
 4407|      0|                }
 4408|     11|            }
 4409|    147|        } while (( ret & 1 ) && nNumMoved2AcidH < num2remove);
  ------------------
  |  Branch (4409:18): [True: 11, False: 136]
  |  Branch (4409:33): [True: 5, False: 6]
  ------------------
 4410|       |
 4411|       |        /* Neutralize: remove ion pairs like >N(+)=-O(-) => >N-=O */
 4412|    142|        if (( nNumMoved2AcidH /*|| bCancelChargesAlways*/ ) && cg_Minus >= num_atoms && cg_Plus >= num_atoms &&
  ------------------
  |  Branch (4412:13): [True: 11, False: 131]
  |  Branch (4412:64): [True: 11, False: 0]
  |  Branch (4412:89): [True: 10, False: 1]
  ------------------
 4413|     10|             pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] > abs( pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ))
  ------------------
  |  Branch (4413:14): [True: 1, False: 9]
  ------------------
 4414|      1|        {
 4415|      1|            do
 4416|      1|            {
 4417|      1|                nPrevNumCharges = pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES];
 4418|      1|                ret = bExistsAltPath( pCG, pBNS, pBD, pAATG,
 4419|      1|                                      at, num_atoms,
 4420|      1|                                      cg_Minus /*nVertDoubleBond*/,
 4421|      1|                                      cg_Plus /*nVertSingleBond*/,
 4422|      1|                                      ALT_PATH_MODE_REM_PROTON );
  ------------------
  |  |  318|      1|#define ALT_PATH_MODE_REM_PROTON 9   /* remove proton, adjust bonds, charges, H-counts 2004-03-05 */
  ------------------
 4423|      1|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|      1|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      1|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      1|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      1|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 1, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 4424|      0|                {
 4425|      0|                    return ret;
 4426|      0|                }
 4427|      1|                if (ret & 1)
  ------------------
  |  Branch (4427:21): [True: 0, False: 1]
  ------------------
 4428|      0|                {
 4429|      0|                    nDelta = ( ret & ~3 ) >> 2;
 4430|       |                    /* djb-rwth: removing redundant code */
 4431|      0|                    if (nDelta)
  ------------------
  |  Branch (4431:25): [True: 0, False: 0]
  ------------------
 4432|      0|                    {
 4433|       |                        /* Radical pair has disappeared */
 4434|      0|                        ; /* goto quick_exit;*/
 4435|      0|                    }
 4436|      0|                    if (nPrevNumCharges > pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES])
  ------------------
  |  Branch (4436:25): [True: 0, False: 0]
  ------------------
 4437|      0|                    {
 4438|      0|                        nNumNeutralized += ( nPrevNumCharges - pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] ) / 2;
 4439|      0|                    }
 4440|      0|                }
 4441|      1|            } while (ret & 1);
  ------------------
  |  Branch (4441:22): [True: 0, False: 1]
  ------------------
 4442|      1|        }
 4443|    142|    }
 4444|       |
 4445|  41.7k|    ret = 0;
 4446|  41.7k|    if (tg_H_Acid >= num_atoms)
  ------------------
  |  Branch (4446:9): [True: 193, False: 41.5k]
  ------------------
 4447|    193|    {
 4448|    193|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, tg_H_Acid, pBNS );
 4449|    193|        if (!ret && ret2)
  ------------------
  |  Branch (4449:13): [True: 193, False: 0]
  |  Branch (4449:21): [True: 0, False: 193]
  ------------------
 4450|      0|        {
 4451|      0|            ret = ret2;
 4452|      0|        }
 4453|    193|    }
 4454|  41.7k|    if (tg_H_Other >= num_atoms)
  ------------------
  |  Branch (4454:9): [True: 2.41k, False: 39.3k]
  ------------------
 4455|  2.41k|    {
 4456|  2.41k|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, tg_H_Other, pBNS );
 4457|  2.41k|        if (!ret && ret2)
  ------------------
  |  Branch (4457:13): [True: 2.41k, False: 0]
  |  Branch (4457:21): [True: 0, False: 2.41k]
  ------------------
 4458|      0|        {
 4459|      0|            ret = ret2;
 4460|      0|        }
 4461|  2.41k|    }
 4462|  41.7k|    if (cg_Minus >= num_atoms)
  ------------------
  |  Branch (4462:9): [True: 2.46k, False: 39.3k]
  ------------------
 4463|  2.46k|    {
 4464|  2.46k|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, cg_Minus, pBNS );
 4465|  2.46k|        if (!ret && ret2)
  ------------------
  |  Branch (4465:13): [True: 2.46k, False: 0]
  |  Branch (4465:21): [True: 0, False: 2.46k]
  ------------------
 4466|      0|        {
 4467|      0|            ret = ret2;
 4468|      0|        }
 4469|  2.46k|    }
 4470|  41.7k|    if (cg_Plus >= num_atoms)
  ------------------
  |  Branch (4470:9): [True: 2.00k, False: 39.7k]
  ------------------
 4471|  2.00k|    {
 4472|  2.00k|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, cg_Plus, pBNS );
 4473|  2.00k|        if (!ret && ret2)
  ------------------
  |  Branch (4473:13): [True: 2.00k, False: 0]
  |  Branch (4473:21): [True: 0, False: 2.00k]
  ------------------
 4474|      0|        {
 4475|      0|            ret = ret2;
 4476|      0|        }
 4477|  2.00k|    }
 4478|       |
 4479|  41.7k|    pBNS->type_CN = 0;
 4480|  41.7k|    pBNS->type_T = 0;
 4481|  41.7k|    pBNS->type_TACN = 0;
 4482|       |
 4483|  41.7k|    if (ret)
  ------------------
  |  Branch (4483:9): [True: 0, False: 41.7k]
  ------------------
 4484|      0|    {
 4485|      0|        return ret;
 4486|      0|    }
 4487|       |
 4488|  41.7k|    if (pAATG->nAtTypeTotals[ATTOT_NUM_CO_Minus] + pAATG->nAtTypeTotals[ATTOT_NUM_ZO_Minus] &&
  ------------------
  |  Branch (4488:9): [True: 7, False: 41.7k]
  ------------------
 4489|      7|         pAATG->nAtTypeTotals[ATTOT_NUM_N_Minus])
  ------------------
  |  Branch (4489:10): [True: 0, False: 7]
  ------------------
 4490|      0|    {
 4491|      0|    }
 4492|       |
 4493|  41.7k|    nPosCharges2 = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] + pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4494|  41.7k|    nNegCharges2 = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] - pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4495|       |    /*
 4496|       |    nNumNP_H2    = pAATG->nAtTypeTotals[ATTOT_NUM_NP_H] +
 4497|       |    pAATG->nAtTypeTotals[ATTOT_NUM_NP_Proton];
 4498|       |    nNumOS_H2    = pAATG->nAtTypeTotals[ATTOT_NUM_COH] +
 4499|       |    pAATG->nAtTypeTotals[ATTOT_NUM_CSH] +
 4500|       |    pAATG->nAtTypeTotals[ATTOT_NUM_ZOH];
 4501|       |    */
 4502|  41.7k|    if (( nPosCharges - nNegCharges ) - ( nPosCharges2 - nNegCharges2 ) != 0)
  ------------------
  |  Branch (4502:9): [True: 0, False: 41.7k]
  ------------------
 4503|      0|    {
 4504|      0|        return BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 4505|      0|    }
 4506|       |
 4507|  41.7k|    if (nNumCanceledCharges)
  ------------------
  |  Branch (4507:9): [True: 41.7k, False: 0]
  ------------------
 4508|  41.7k|    {
 4509|       |#if ( FIX_CANCEL_CHARGE_COUNT_BUG == 1 )
 4510|       |        *nNumCanceledCharges += 2 * nNumNeutralized;
 4511|       |#else
 4512|  41.7k|        *nNumCanceledCharges = 2 * nNumNeutralized;
 4513|  41.7k|#endif
 4514|  41.7k|    }
 4515|       |
 4516|  41.7k|    return nNumMoved2AcidH;
 4517|  41.7k|}
HardAddAcidicProtons:
 4529|  7.15k|{
 4530|  7.15k|    int cg_Plus = 0;
 4531|  7.15k|    int cg_Minus_CO = 0;
 4532|  7.15k|    int cg_Minus_Other = 0;
 4533|  7.15k|    int tg_H = 0;
 4534|       |
 4535|  7.15k|    int ret = 0, ret2;
 4536|  7.15k|    int nDelta, nNumChanges = 0, nNumMoved2AcidMinus = 0, nNumNeutralized = 0, nPrevNumCharges; /* djb-rwth: removing redundant variables */
 4537|       |
 4538|  7.15k|    int nPosCharges, nPosCharges2;
 4539|  7.15k|    int nNegCharges, nNegCharges2;
 4540|       |    /*
 4541|       |    int nNumNP_H, nNumNP_H2;
 4542|       |    int nNumOS_H, nNumOS_H2;
 4543|       |    */
 4544|  7.15k|    nPosCharges = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] + pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4545|  7.15k|    nNegCharges = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] - pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4546|       |    /*
 4547|       |    nNumNP_H    =  pAATG->nAtTypeTotals[ATTOT_NUM_NP_H] +
 4548|       |    pAATG->nAtTypeTotals[ATTOT_NUM_NP_Proton];
 4549|       |    nNumOS_H    =  pAATG->nAtTypeTotals[ATTOT_NUM_COH] +
 4550|       |    pAATG->nAtTypeTotals[ATTOT_NUM_CSH] +
 4551|       |    pAATG->nAtTypeTotals[ATTOT_NUM_ZOH];
 4552|       |    */
 4553|       |
 4554|       |    /* Prevent free exchange H <-> (-) */
 4555|  7.15k|    pBNS->type_CN = ( BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE );
  ------------------
  |  |   49|  7.15k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
                  pBNS->type_CN = ( BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE );
  ------------------
  |  |   54|  7.15k|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  ------------------
 4556|  7.15k|    pBNS->type_T = BNS_VERT_TYPE_TGROUP;
  ------------------
  |  |   47|  7.15k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 4557|  7.15k|    pBNS->type_TACN = BNS_VERT_TYPE_ACID;
  ------------------
  |  |   55|  7.15k|#define BNS_VERT_TYPE_ACID          0x0200  /* only for this type are allowed paths: t_group-atom-c_group_neg (path_TACN) */
  ------------------
 4558|       |
 4559|       |    /* Create (+) charge group */
 4560|  7.15k|    cg_Plus = CreateCGroupInBnStruct( at, num_atoms, pBNS, AA_HARD_TYP_POS, AA_HARD_MSK_POS, 1 );
  ------------------
  |  |  216|  7.15k|#define AA_HARD_TYP_POS   ATTYP_N
  |  |  ------------------
  |  |  |  |  150|  7.15k|#define ATTYP_N     (ATT_ATOM_N)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  7.15k|#define ATT_ATOM_N 0x0040
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  cg_Plus = CreateCGroupInBnStruct( at, num_atoms, pBNS, AA_HARD_TYP_POS, AA_HARD_MSK_POS, 1 );
  ------------------
  |  |  215|  7.15k|#define AA_HARD_MSK_POS   ATBIT_MSK_NP
  |  |  ------------------
  |  |  |  |  139|  7.15k|#define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|  7.15k|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4561|       |
 4562|       |    /* Create (-) charge group */
 4563|       |    /*
 4564|       |    if ( nAtTypeTotals[ATTOT_NUM_CO_Minus] +
 4565|       |    nAtTypeTotals[ATTOT_NUM_CS_Minus] +
 4566|       |    nAtTypeTotals[ATTOT_NUM_ZO_Minus] +
 4567|       |    nAtTypeTotals[ATTOT_NUM_N_Minus] )
 4568|       |    */
 4569|  7.15k|    cg_Minus_CO = CreateCGroupInBnStruct( at, num_atoms, pBNS, AA_HARD_TYP_CO, AA_HARD_MSK_CO, -1 );
  ------------------
  |  |  222|  7.15k|#define AA_HARD_TYP_CO    (ATT_ACIDIC_CO | ATT_NO)
  |  |  ------------------
  |  |  |  |   31|  7.15k|#define ATT_ACIDIC_CO 0x0001
  |  |  ------------------
  |  |               #define AA_HARD_TYP_CO    (ATT_ACIDIC_CO | ATT_NO)
  |  |  ------------------
  |  |  |  |   35|  7.15k|#define ATT_NO 0x0010
  |  |  ------------------
  ------------------
                  cg_Minus_CO = CreateCGroupInBnStruct( at, num_atoms, pBNS, AA_HARD_TYP_CO, AA_HARD_MSK_CO, -1 );
  ------------------
  |  |  221|  7.15k|#define AA_HARD_MSK_CO    (ATBIT_CO | ATBIT_NO )
  |  |  ------------------
  |  |  |  |  105|  7.15k|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  ------------------
  |  |               #define AA_HARD_MSK_CO    (ATBIT_CO | ATBIT_NO )
  |  |  ------------------
  |  |  |  |  107|  7.15k|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  ------------------
  ------------------
 4570|       |
 4571|  7.15k|    cg_Minus_Other = CreateCGroupInBnStruct( at, num_atoms, pBNS, AA_HARD_TYP_NEG, AA_HARD_MSK_NEG, -1 );
  ------------------
  |  |  219|  7.15k|#define AA_HARD_TYP_NEG   (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  150|  7.15k|#define ATTYP_N     (ATT_ATOM_N)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  7.15k|#define ATT_ATOM_N 0x0040
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define AA_HARD_TYP_NEG   (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  148|  7.15k|#define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   32|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   33|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|  7.15k|#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 );
  ------------------
  |  |  218|  7.15k|#define AA_HARD_MSK_NEG   ((ATBIT_MSK_NP | ATBIT_MSK_OS) & ~(ATBIT_CO | ATBIT_NO ))
  |  |  ------------------
  |  |  |  |  139|  7.15k|#define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|  7.15k|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define AA_HARD_MSK_NEG   ((ATBIT_MSK_NP | ATBIT_MSK_OS) & ~(ATBIT_CO | ATBIT_NO ))
  |  |  ------------------
  |  |  |  |  141|  7.15k|#define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |   98|  7.15k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |   99|  7.15k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  100|  7.15k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|  7.15k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  102|  7.15k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|  7.15k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|  7.15k|#define ATBIT_N_OH       (1 << ATTOT_NUM_N_OH)
  |  |  |  |  ------------------
  |  |  |  |  142|  7.15k|                        ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|  7.15k|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  106|  7.15k|#define ATBIT_ZO         (1 << ATTOT_NUM_ZO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|  7.15k|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|  7.15k|#define ATBIT_N_O        (1 << ATTOT_NUM_N_O)
  |  |  |  |  ------------------
  |  |  |  |  143|  7.15k|                        ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  109|  7.15k|#define ATBIT_CO_Minus   (1 << ATTOT_NUM_CO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  7.15k|#define ATBIT_CS_Minus   (1 << ATTOT_NUM_CS_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|  7.15k|#define ATBIT_ZO_Minus   (1 << ATTOT_NUM_ZO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  112|  7.15k|#define ATBIT_OO_Minus   (1 << ATTOT_NUM_OO_Minus)
  |  |  |  |  ------------------
  |  |  |  |  144|  7.15k|                        ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|  7.15k|#define ATBIT_ZOO_Minus  (1 << ATTOT_NUM_ZOO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|  7.15k|#define ATBIT_NO_Minus   (1 << ATTOT_NUM_NO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  7.15k|#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 ))
  |  |  ------------------
  |  |  |  |  105|  7.15k|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  ------------------
  |  |               #define AA_HARD_MSK_NEG   ((ATBIT_MSK_NP | ATBIT_MSK_OS) & ~(ATBIT_CO | ATBIT_NO ))
  |  |  ------------------
  |  |  |  |  107|  7.15k|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  ------------------
  ------------------
 4572|       |
 4573|  7.15k|    pBNS->type_CN = ( BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE );
  ------------------
  |  |   49|  7.15k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
                  pBNS->type_CN = ( BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE );
  ------------------
  |  |   54|  7.15k|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  ------------------
 4574|  7.15k|    pBNS->type_T = BNS_VERT_TYPE_TGROUP;
  ------------------
  |  |   47|  7.15k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 4575|  7.15k|    pBNS->type_TACN = BNS_VERT_TYPE_ACID;
  ------------------
  |  |   55|  7.15k|#define BNS_VERT_TYPE_ACID          0x0200  /* only for this type are allowed paths: t_group-atom-c_group_neg (path_TACN) */
  ------------------
 4576|       |
 4577|       |    /* Create tautomeric group for all H  */
 4578|  7.15k|    tg_H = CreateTGroupInBnStruct( at, num_atoms, pBNS, AA_HARD_TYP_H, AA_HARD_MSK_H );
  ------------------
  |  |  225|  7.15k|#define AA_HARD_TYP_H     (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  150|  7.15k|#define ATTYP_N     (ATT_ATOM_N)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  7.15k|#define ATT_ATOM_N 0x0040
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define AA_HARD_TYP_H     (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  148|  7.15k|#define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   32|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   33|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|  7.15k|#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 );
  ------------------
  |  |  224|  7.15k|#define AA_HARD_MSK_H     (ATBIT_MSK_NP | ATBIT_MSK_OS)
  |  |  ------------------
  |  |  |  |  139|  7.15k|#define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  7.15k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|  7.15k|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define AA_HARD_MSK_H     (ATBIT_MSK_NP | ATBIT_MSK_OS)
  |  |  ------------------
  |  |  |  |  141|  7.15k|#define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |   98|  7.15k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |   99|  7.15k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  100|  7.15k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|  7.15k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  102|  7.15k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|  7.15k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|  7.15k|#define ATBIT_N_OH       (1 << ATTOT_NUM_N_OH)
  |  |  |  |  ------------------
  |  |  |  |  142|  7.15k|                        ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|  7.15k|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  106|  7.15k|#define ATBIT_ZO         (1 << ATTOT_NUM_ZO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|  7.15k|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|  7.15k|#define ATBIT_N_O        (1 << ATTOT_NUM_N_O)
  |  |  |  |  ------------------
  |  |  |  |  143|  7.15k|                        ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  109|  7.15k|#define ATBIT_CO_Minus   (1 << ATTOT_NUM_CO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  7.15k|#define ATBIT_CS_Minus   (1 << ATTOT_NUM_CS_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|  7.15k|#define ATBIT_ZO_Minus   (1 << ATTOT_NUM_ZO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  112|  7.15k|#define ATBIT_OO_Minus   (1 << ATTOT_NUM_OO_Minus)
  |  |  |  |  ------------------
  |  |  |  |  144|  7.15k|                        ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|  7.15k|#define ATBIT_ZOO_Minus  (1 << ATTOT_NUM_ZOO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|  7.15k|#define ATBIT_NO_Minus   (1 << ATTOT_NUM_NO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  7.15k|#define ATBIT_N_O_Minus  (1 << ATTOT_NUM_N_O_Minus)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4579|       |
 4580|  7.15k|    if (cg_Minus_Other >= num_atoms && cg_Minus_CO >= num_atoms)
  ------------------
  |  Branch (4580:9): [True: 3.59k, False: 3.56k]
  |  Branch (4580:40): [True: 305, False: 3.28k]
  ------------------
 4581|    305|    {
 4582|       |        /* Find alt path to remove one proton */
 4583|    305|        do
 4584|    328|        {
 4585|       |            /* Add a proton */
 4586|    328|            nPrevNumCharges = pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES];
 4587|       |            /* djb-rwth: addressing coverity ID #499474 -- cg_Minus_CO negative values handled properly */
 4588|    328|            ret = bExistsAltPath( pCG, pBNS, pBD, pAATG,
 4589|    328|                                  at, num_atoms,
 4590|    328|                                  cg_Minus_Other /*nVertDoubleBond*/,
 4591|    328|                                  cg_Minus_CO /*nVertSingleBond*/,
 4592|    328|                                  ALT_PATH_MODE_REM_PROTON );
  ------------------
  |  |  318|    328|#define ALT_PATH_MODE_REM_PROTON 9   /* remove proton, adjust bonds, charges, H-counts 2004-03-05 */
  ------------------
 4593|    328|            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|    328|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|    328|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|    328|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    328|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 328, False: 0]
  |  |  |  Branch (67:44): [True: 2, False: 326]
  |  |  ------------------
  ------------------
 4594|      2|            {
 4595|      2|                return ret;
 4596|      2|            }
 4597|    326|            if (ret & 1)
  ------------------
  |  Branch (4597:17): [True: 70, False: 256]
  ------------------
 4598|     70|            {
 4599|     70|                nDelta = ( ret & ~3 ) >> 2;
 4600|     70|                nNumChanges += (0 != (ret & 2)); /* djb-rwth: ignoring LLVM warning: variable used */
 4601|     70|                if (nDelta)
  ------------------
  |  Branch (4601:21): [True: 0, False: 70]
  ------------------
 4602|      0|                {
 4603|       |                    /* Radical pair has disappeared */
 4604|      0|                    ; /* goto quick_exit;*/
 4605|      0|                }
 4606|     70|                nNumMoved2AcidMinus++;
 4607|     70|                if (nPrevNumCharges > pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] + 1)
  ------------------
  |  Branch (4607:21): [True: 0, False: 70]
  ------------------
 4608|      0|                {
 4609|      0|                    nNumNeutralized += ( nPrevNumCharges - ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] - 1 ) ) / 2;
 4610|      0|                }
 4611|     70|            }
 4612|    326|        } while (( ret & 1 ) && nNumMoved2AcidMinus < num2add);
  ------------------
  |  Branch (4612:18): [True: 70, False: 256]
  |  Branch (4612:33): [True: 23, False: 47]
  ------------------
 4613|       |
 4614|       |        /* Neutralize: remove ion pairs like >N(+)=-O(-) => >N-=O */
 4615|    303|        if (( nNumMoved2AcidMinus /*|| bCancelChargesAlways*/ ) &&
  ------------------
  |  Branch (4615:13): [True: 70, False: 233]
  ------------------
 4616|     70|             cg_Minus_Other >= num_atoms && cg_Plus >= num_atoms &&
  ------------------
  |  Branch (4616:14): [True: 70, False: 0]
  |  Branch (4616:45): [True: 51, False: 19]
  ------------------
 4617|     51|             pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] > abs( pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ))
  ------------------
  |  Branch (4617:14): [True: 1, False: 50]
  ------------------
 4618|      1|        {
 4619|      1|            do
 4620|      1|            {
 4621|      1|                nPrevNumCharges = pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES];
 4622|      1|                ret = bExistsAltPath( pCG, pBNS, pBD, pAATG,
 4623|      1|                                      at, num_atoms,
 4624|      1|                                      cg_Minus_Other /*nVertDoubleBond*/,
 4625|      1|                                      cg_Plus /*nVertSingleBond*/,
 4626|      1|                                      ALT_PATH_MODE_REM_PROTON );
  ------------------
  |  |  318|      1|#define ALT_PATH_MODE_REM_PROTON 9   /* remove proton, adjust bonds, charges, H-counts 2004-03-05 */
  ------------------
 4627|      1|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|      1|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      1|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      1|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      1|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 1, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 4628|      0|                {
 4629|      0|                    return ret;
 4630|      0|                }
 4631|      1|                if (ret & 1)
  ------------------
  |  Branch (4631:21): [True: 0, False: 1]
  ------------------
 4632|      0|                {
 4633|      0|                    nDelta = ( ret & ~3 ) >> 2;
 4634|      0|                    nNumChanges += (0 != (ret & 2)); /* djb-rwth: ignoring LLVM warning: variable used */
 4635|      0|                    if (nDelta)
  ------------------
  |  Branch (4635:25): [True: 0, False: 0]
  ------------------
 4636|      0|                    {
 4637|       |                        /* Radical pair has disappeared */
 4638|      0|                        ; /* goto quick_exit;*/
 4639|      0|                    }
 4640|      0|                    if (nPrevNumCharges > pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES])
  ------------------
  |  Branch (4640:25): [True: 0, False: 0]
  ------------------
 4641|      0|                    {
 4642|      0|                        nNumNeutralized += ( nPrevNumCharges - pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] ) / 2;
 4643|      0|                    }
 4644|      0|                }
 4645|      1|            } while (ret & 1);
  ------------------
  |  Branch (4645:22): [True: 0, False: 1]
  ------------------
 4646|      1|        }
 4647|    303|    }
 4648|       |
 4649|  7.15k|    ret = 0;
 4650|  7.15k|    if (tg_H >= num_atoms)
  ------------------
  |  Branch (4650:9): [True: 3.63k, False: 3.51k]
  ------------------
 4651|  3.63k|    {
 4652|  3.63k|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, tg_H, pBNS );
 4653|  3.63k|        if (!ret && ret2)
  ------------------
  |  Branch (4653:13): [True: 3.63k, False: 0]
  |  Branch (4653:21): [True: 0, False: 3.63k]
  ------------------
 4654|      0|        {
 4655|      0|            ret = ret2;
 4656|      0|        }
 4657|  3.63k|    }
 4658|  7.15k|    if (cg_Minus_Other >= num_atoms)
  ------------------
  |  Branch (4658:9): [True: 3.58k, False: 3.56k]
  ------------------
 4659|  3.58k|    {
 4660|  3.58k|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, cg_Minus_Other, pBNS );
 4661|  3.58k|        if (!ret && ret2)
  ------------------
  |  Branch (4661:13): [True: 3.58k, False: 0]
  |  Branch (4661:21): [True: 0, False: 3.58k]
  ------------------
 4662|      0|        {
 4663|      0|            ret = ret2;
 4664|      0|        }
 4665|  3.58k|    }
 4666|  7.15k|    if (cg_Minus_CO >= num_atoms)
  ------------------
  |  Branch (4666:9): [True: 353, False: 6.80k]
  ------------------
 4667|    353|    {
 4668|    353|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, cg_Minus_CO, pBNS );
 4669|    353|        if (!ret && ret2)
  ------------------
  |  Branch (4669:13): [True: 353, False: 0]
  |  Branch (4669:21): [True: 0, False: 353]
  ------------------
 4670|      0|        {
 4671|      0|            ret = ret2;
 4672|      0|        }
 4673|    353|    }
 4674|  7.15k|    if (cg_Plus >= num_atoms)
  ------------------
  |  Branch (4674:9): [True: 2.73k, False: 4.41k]
  ------------------
 4675|  2.73k|    {
 4676|  2.73k|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, cg_Plus, pBNS );
 4677|  2.73k|        if (!ret && ret2)
  ------------------
  |  Branch (4677:13): [True: 2.73k, False: 0]
  |  Branch (4677:21): [True: 0, False: 2.73k]
  ------------------
 4678|      0|        {
 4679|      0|            ret = ret2;
 4680|      0|        }
 4681|  2.73k|    }
 4682|       |
 4683|  7.15k|    pBNS->type_CN = 0;
 4684|  7.15k|    pBNS->type_T = 0;
 4685|  7.15k|    pBNS->type_TACN = 0;
 4686|       |
 4687|  7.15k|    if (ret)
  ------------------
  |  Branch (4687:9): [True: 0, False: 7.15k]
  ------------------
 4688|      0|    {
 4689|      0|        return ret;
 4690|      0|    }
 4691|       |
 4692|  7.15k|    if (pAATG->nAtTypeTotals[ATTOT_NUM_CO_Minus] + pAATG->nAtTypeTotals[ATTOT_NUM_ZO_Minus] &&
  ------------------
  |  Branch (4692:9): [True: 757, False: 6.39k]
  ------------------
 4693|    757|         pAATG->nAtTypeTotals[ATTOT_NUM_N_Minus])
  ------------------
  |  Branch (4693:10): [True: 262, False: 495]
  ------------------
 4694|    262|    {
 4695|    262|    }
 4696|       |
 4697|  7.15k|    nPosCharges2 = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] + pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4698|  7.15k|    nNegCharges2 = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] - pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4699|       |    /*
 4700|       |    nNumNP_H2    = pAATG->nAtTypeTotals[ATTOT_NUM_NP_H] +
 4701|       |    pAATG->nAtTypeTotals[ATTOT_NUM_NP_Proton];
 4702|       |    nNumOS_H2    = pAATG->nAtTypeTotals[ATTOT_NUM_COH] +
 4703|       |    pAATG->nAtTypeTotals[ATTOT_NUM_CSH] +
 4704|       |    pAATG->nAtTypeTotals[ATTOT_NUM_ZOH];
 4705|       |    */
 4706|       |
 4707|  7.15k|    if (( nPosCharges - nNegCharges ) - ( nPosCharges2 - nNegCharges2 ) != 0)
  ------------------
  |  Branch (4707:9): [True: 1, False: 7.15k]
  ------------------
 4708|      1|    {
 4709|      1|        return BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      1|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      1|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 4710|      1|    }
 4711|       |
 4712|  7.15k|    if (nNumCanceledCharges)
  ------------------
  |  Branch (4712:9): [True: 7.15k, False: 0]
  ------------------
 4713|  7.15k|    {
 4714|       |#if ( FIX_CANCEL_CHARGE_COUNT_BUG == 1 )
 4715|       |        *nNumCanceledCharges += 2 * nNumNeutralized;
 4716|       |#else
 4717|  7.15k|        *nNumCanceledCharges = 2 * nNumNeutralized;
 4718|  7.15k|#endif
 4719|  7.15k|    }
 4720|       |
 4721|  7.15k|    return nNumMoved2AcidMinus;
 4722|  7.15k|}
HardRemoveHplusNP:
 4743|  2.88k|{
 4744|       |
 4745|  2.88k|    int cg_Plus = 0;
 4746|  2.88k|    int cg_Minus = 0;
 4747|  2.88k|    int tg_H = 0;
 4748|       |#if ( MOVE_PPLUS_TO_REMOVE_PROTONS == 1 )
 4749|       |    int cg_PlusP = 0;
 4750|       |#endif
 4751|  2.88k|#if ( FIX_REM_PROTON_COUNT_BUG == 1 )
 4752|  2.88k|    int nPrevRemovedProtons, nCurrRemovedProtons;
 4753|  2.88k|#endif
 4754|  2.88k|    int ret = 0, ret2;
 4755|  2.88k|    int nDelta, nNumChanges = 0, nNumRemovedProtons = 0, nNumNeutralized = 0, nPrevNumCharges; /* djb-rwth: ignoring LLVM warning: variable used */
 4756|       |
 4757|  2.88k|    int nPosCharges, nPosCharges2;
 4758|  2.88k|    int nNegCharges, nNegCharges2;
 4759|       |    /*
 4760|       |    int nNumNP_H, nNumNP_H2;
 4761|       |    int nNumOS_H, nNumOS_H2;
 4762|       |    */
 4763|       |
 4764|  2.88k|    nPosCharges = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] + pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4765|  2.88k|    nNegCharges = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] - pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4766|       |    /*
 4767|       |    nNumNP_H    =  pAATG->nAtTypeTotals[ATTOT_NUM_NP_H] +
 4768|       |    pAATG->nAtTypeTotals[ATTOT_NUM_NP_Proton];
 4769|       |    nNumOS_H    =  pAATG->nAtTypeTotals[ATTOT_NUM_COH] +
 4770|       |    pAATG->nAtTypeTotals[ATTOT_NUM_CSH] +
 4771|       |    pAATG->nAtTypeTotals[ATTOT_NUM_ZOH];
 4772|       |    */
 4773|       |
 4774|       |    /* Prevent free exchange H <-> (-) */
 4775|  2.88k|    pBNS->type_CN = ( BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE );
  ------------------
  |  |   49|  2.88k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
                  pBNS->type_CN = ( BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE );
  ------------------
  |  |   54|  2.88k|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  ------------------
 4776|  2.88k|    pBNS->type_T = BNS_VERT_TYPE_TGROUP;
  ------------------
  |  |   47|  2.88k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 4777|  2.88k|    pBNS->type_TACN = BNS_VERT_TYPE_ACID;
  ------------------
  |  |   55|  2.88k|#define BNS_VERT_TYPE_ACID          0x0200  /* only for this type are allowed paths: t_group-atom-c_group_neg (path_TACN) */
  ------------------
 4778|       |
 4779|       |    /* Create (+) charge group */
 4780|  2.88k|    cg_Plus = CreateCGroupInBnStruct( at, num_atoms, pBNS, PR_HARD_TYP_POS, PR_HARD_MSK_POS, 1 );
  ------------------
  |  |  190|  2.88k|#define PR_HARD_TYP_POS   ATTYP_N
  |  |  ------------------
  |  |  |  |  150|  2.88k|#define ATTYP_N     (ATT_ATOM_N)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  2.88k|#define ATT_ATOM_N 0x0040
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  cg_Plus = CreateCGroupInBnStruct( at, num_atoms, pBNS, PR_HARD_TYP_POS, PR_HARD_MSK_POS, 1 );
  ------------------
  |  |  189|  2.88k|#define PR_HARD_MSK_POS   ATBIT_MSK_NP
  |  |  ------------------
  |  |  |  |  139|  2.88k|#define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|  2.88k|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4781|       |
 4782|       |    /* Create (-) charge group */
 4783|       |    /*
 4784|       |    if ( nAtTypeTotals[ATTOT_NUM_CO_Minus] +
 4785|       |    nAtTypeTotals[ATTOT_NUM_CS_Minus] +
 4786|       |    nAtTypeTotals[ATTOT_NUM_ZO_Minus] +
 4787|       |    nAtTypeTotals[ATTOT_NUM_N_Minus] )
 4788|       |    */
 4789|       |#if ( MOVE_PPLUS_TO_REMOVE_PROTONS == 1 )
 4790|       |    cg_PlusP = CreateCGroupInBnStruct( at, num_atoms, pBNS, PR_HARD_TYP_POSP, PR_HARD_MSK_POS, 1 );
 4791|       |#endif
 4792|  2.88k|    cg_Minus = CreateCGroupInBnStruct( at, num_atoms, pBNS, PR_HARD_TYP_NEG, PR_HARD_MSK_NEG, -1 );
  ------------------
  |  |  194|  2.88k|#define PR_HARD_TYP_NEG   (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  150|  2.88k|#define ATTYP_N     (ATT_ATOM_N)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  2.88k|#define ATT_ATOM_N 0x0040
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PR_HARD_TYP_NEG   (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  148|  2.88k|#define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   32|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   33|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|  2.88k|#define ATT_OTHER_ZO 0x0200 /**<  -Z=O or =Z=O */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  cg_Minus = CreateCGroupInBnStruct( at, num_atoms, pBNS, PR_HARD_TYP_NEG, PR_HARD_MSK_NEG, -1 );
  ------------------
  |  |  193|  2.88k|#define PR_HARD_MSK_NEG   (ATBIT_MSK_NP | ATBIT_MSK_OS)
  |  |  ------------------
  |  |  |  |  139|  2.88k|#define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|  2.88k|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PR_HARD_MSK_NEG   (ATBIT_MSK_NP | ATBIT_MSK_OS)
  |  |  ------------------
  |  |  |  |  141|  2.88k|#define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |   98|  2.88k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |   99|  2.88k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  100|  2.88k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|  2.88k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  102|  2.88k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|  2.88k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|  2.88k|#define ATBIT_N_OH       (1 << ATTOT_NUM_N_OH)
  |  |  |  |  ------------------
  |  |  |  |  142|  2.88k|                        ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|  2.88k|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  106|  2.88k|#define ATBIT_ZO         (1 << ATTOT_NUM_ZO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|  2.88k|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|  2.88k|#define ATBIT_N_O        (1 << ATTOT_NUM_N_O)
  |  |  |  |  ------------------
  |  |  |  |  143|  2.88k|                        ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  109|  2.88k|#define ATBIT_CO_Minus   (1 << ATTOT_NUM_CO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  2.88k|#define ATBIT_CS_Minus   (1 << ATTOT_NUM_CS_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|  2.88k|#define ATBIT_ZO_Minus   (1 << ATTOT_NUM_ZO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  112|  2.88k|#define ATBIT_OO_Minus   (1 << ATTOT_NUM_OO_Minus)
  |  |  |  |  ------------------
  |  |  |  |  144|  2.88k|                        ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|  2.88k|#define ATBIT_ZOO_Minus  (1 << ATTOT_NUM_ZOO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|  2.88k|#define ATBIT_NO_Minus   (1 << ATTOT_NUM_NO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  2.88k|#define ATBIT_N_O_Minus  (1 << ATTOT_NUM_N_O_Minus)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4793|       |
 4794|       |    /* Create single tautomeric group */
 4795|  2.88k|    tg_H = CreateTGroupInBnStruct( at, num_atoms, pBNS, PR_HARD_TYP_H, PR_HARD_MSK_H );
  ------------------
  |  |  197|  2.88k|#define PR_HARD_TYP_H     (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  150|  2.88k|#define ATTYP_N     (ATT_ATOM_N)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  2.88k|#define ATT_ATOM_N 0x0040
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PR_HARD_TYP_H     (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  148|  2.88k|#define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   32|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   33|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|  2.88k|#define ATT_OTHER_ZO 0x0200 /**<  -Z=O or =Z=O */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  tg_H = CreateTGroupInBnStruct( at, num_atoms, pBNS, PR_HARD_TYP_H, PR_HARD_MSK_H );
  ------------------
  |  |  196|  2.88k|#define PR_HARD_MSK_H     (ATBIT_MSK_NP | ATBIT_MSK_OS)
  |  |  ------------------
  |  |  |  |  139|  2.88k|#define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   93|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   94|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  2.88k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|  2.88k|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PR_HARD_MSK_H     (ATBIT_MSK_NP | ATBIT_MSK_OS)
  |  |  ------------------
  |  |  |  |  141|  2.88k|#define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |   98|  2.88k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |   99|  2.88k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  100|  2.88k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|  2.88k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  102|  2.88k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|  2.88k|#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 |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|  2.88k|#define ATBIT_N_OH       (1 << ATTOT_NUM_N_OH)
  |  |  |  |  ------------------
  |  |  |  |  142|  2.88k|                        ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|  2.88k|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  106|  2.88k|#define ATBIT_ZO         (1 << ATTOT_NUM_ZO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|  2.88k|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|  2.88k|#define ATBIT_N_O        (1 << ATTOT_NUM_N_O)
  |  |  |  |  ------------------
  |  |  |  |  143|  2.88k|                        ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  109|  2.88k|#define ATBIT_CO_Minus   (1 << ATTOT_NUM_CO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  2.88k|#define ATBIT_CS_Minus   (1 << ATTOT_NUM_CS_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|  2.88k|#define ATBIT_ZO_Minus   (1 << ATTOT_NUM_ZO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  112|  2.88k|#define ATBIT_OO_Minus   (1 << ATTOT_NUM_OO_Minus)
  |  |  |  |  ------------------
  |  |  |  |  144|  2.88k|                        ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|  2.88k|#define ATBIT_ZOO_Minus  (1 << ATTOT_NUM_ZOO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|  2.88k|#define ATBIT_NO_Minus   (1 << ATTOT_NUM_NO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  2.88k|#define ATBIT_N_O_Minus  (1 << ATTOT_NUM_N_O_Minus)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4796|       |
 4797|  2.88k|    if (tg_H >= num_atoms && cg_Plus >= num_atoms)
  ------------------
  |  Branch (4797:9): [True: 2.52k, False: 358]
  |  Branch (4797:30): [True: 2.45k, False: 71]
  ------------------
 4798|  2.45k|    {
 4799|       |
 4800|       |#if ( FIX_N_MINUS_NORN_BUG == 1 )
 4801|       |        /* neutralize: remove ion pairs like >N(+)=-O(-) => >N-=O; >N(+)=-NH(-) => >N-=NH */
 4802|       |        if (( nNumRemovedProtons || bCancelChargesAlways ) && cg_Minus >= num_atoms && cg_Plus >= num_atoms &&
 4803|       |             pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] > abs( pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ))
 4804|       |        {
 4805|       |            do
 4806|       |            {
 4807|       |                nPrevNumCharges = pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES];
 4808|       |#if ( FIX_REM_PROTON_COUNT_BUG == 1 )
 4809|       |                nPrevRemovedProtons = pAATG->t_group_info->tni.nNumRemovedProtons;
 4810|       |#endif
 4811|       |                ret = bExistsAltPath( pCG, pBNS, pBD, pAATG, at, num_atoms,
 4812|       |                                      cg_Minus /*nVertDoubleBond*/, cg_Plus /*nVertSingleBond*/, ALT_PATH_MODE_REM_PROTON );
 4813|       |                if (IS_BNS_ERROR( ret ))
 4814|       |                {
 4815|       |                    return ret;
 4816|       |                }
 4817|       |#if ( FIX_REM_PROTON_COUNT_BUG == 1 )
 4818|       |                nCurrRemovedProtons = pAATG->t_group_info->tni.nNumRemovedProtons;
 4819|       |                if (nCurrRemovedProtons != nPrevRemovedProtons)
 4820|       |                {
 4821|       |                    return BNS_RADICAL_ERR;
 4822|       |                }
 4823|       |#endif
 4824|       |                if (ret & 1)
 4825|       |                {
 4826|       |                    nDelta = ( ret & ~3 ) >> 2;
 4827|       |                    nNumChanges += ( 0 != ( ret & 2 ) );
 4828|       |                    if (nDelta)
 4829|       |                    {
 4830|       |                        /* radical pair has disappeared */
 4831|       |                        ; /* goto quick_exit;*/
 4832|       |                    }
 4833|       |                    if (nPrevNumCharges > pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES])
 4834|       |                    {
 4835|       |                        nNumNeutralized += ( nPrevNumCharges - pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] ) / 2;
 4836|       |                    }
 4837|       |                }
 4838|       |            } while (ret & 1);
 4839|       |        }
 4840|       |#endif
 4841|       |
 4842|       |        /* Find alt path to remove one proton */
 4843|  2.45k|        do
 4844|  2.54k|        {
 4845|       |            /* Remove a proton */
 4846|  2.54k|            nPrevNumCharges = pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES];
 4847|  2.54k|#if ( FIX_REM_PROTON_COUNT_BUG == 1 )
 4848|  2.54k|            nPrevRemovedProtons = pAATG->t_group_info->tni.nNumRemovedProtons;
 4849|  2.54k|#endif
 4850|       |            /* djb-rwth: addressing coverity ID #499572 -- tg_H negative values handled properly */
 4851|  2.54k|            ret = bExistsAltPath( pCG, pBNS, pBD, pAATG, at, num_atoms,
 4852|  2.54k|                                  tg_H /*nVertDoubleBond*/,
 4853|  2.54k|                                  cg_Plus /*nVertSingleBond*/,
 4854|  2.54k|                                  ALT_PATH_MODE_REM_PROTON );
  ------------------
  |  |  318|  2.54k|#define ALT_PATH_MODE_REM_PROTON 9   /* remove proton, adjust bonds, charges, H-counts 2004-03-05 */
  ------------------
 4855|  2.54k|            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  2.54k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  2.54k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  2.54k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  2.54k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 2.54k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 2.54k]
  |  |  ------------------
  ------------------
 4856|      0|            {
 4857|      0|                return ret;
 4858|      0|            }
 4859|  2.54k|#if ( FIX_REM_PROTON_COUNT_BUG == 1 )
 4860|  2.54k|            nCurrRemovedProtons = pAATG->t_group_info->tni.nNumRemovedProtons;
 4861|  2.54k|            if (nCurrRemovedProtons != nPrevRemovedProtons + ( ret & 1 ))
  ------------------
  |  Branch (4861:17): [True: 0, False: 2.54k]
  ------------------
 4862|      0|            {
 4863|      0|                return BNS_RADICAL_ERR;
  ------------------
  |  |   59|      0|#define BNS_RADICAL_ERR    (BNS_ERR + 11) /*(-9988)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 4864|      0|            }
 4865|  2.54k|#endif
 4866|  2.54k|            if (ret & 1)
  ------------------
  |  Branch (4866:17): [True: 95, False: 2.45k]
  ------------------
 4867|     95|            {
 4868|     95|                nDelta = ( ret & ~3 ) >> 2;
 4869|     95|                nNumChanges += (0 != (ret & 2)); /* djb-rwth: ignoring LLVM warning: variable used */
 4870|     95|                if (nDelta)
  ------------------
  |  Branch (4870:21): [True: 0, False: 95]
  ------------------
 4871|      0|                {
 4872|       |                    /* radical pair has disappeared */
 4873|      0|                    ; /* goto quick_exit;*/
 4874|      0|                }
 4875|     95|                nNumRemovedProtons++;
 4876|     95|                if (nPrevNumCharges > pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] + 1)
  ------------------
  |  Branch (4876:21): [True: 0, False: 95]
  ------------------
 4877|      0|                {
 4878|      0|                    nNumNeutralized += ( nPrevNumCharges - ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] - 1 ) ) / 2;
 4879|      0|                }
 4880|     95|            }
 4881|  2.54k|        } while (ret & 1);
  ------------------
  |  Branch (4881:18): [True: 95, False: 2.45k]
  ------------------
 4882|       |
 4883|       |        /* Neutralize: remove ion pairs like >N(+)=-O(-) => >N-=O */
 4884|  2.45k|        if (( nNumRemovedProtons || bCancelChargesAlways ) && cg_Minus >= num_atoms && cg_Plus >= num_atoms &&
  ------------------
  |  Branch (4884:15): [True: 95, False: 2.35k]
  |  Branch (4884:37): [True: 2.35k, False: 0]
  |  Branch (4884:63): [True: 2.45k, False: 0]
  |  Branch (4884:88): [True: 2.45k, False: 0]
  ------------------
 4885|  2.45k|             pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] > abs( pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ))
  ------------------
  |  Branch (4885:14): [True: 1.33k, False: 1.11k]
  ------------------
 4886|  1.33k|        {
 4887|  1.33k|            do
 4888|  1.35k|            {
 4889|  1.35k|                nPrevNumCharges = pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES];
 4890|  1.35k|#if ( FIX_REM_PROTON_COUNT_BUG == 1 )
 4891|  1.35k|                nPrevRemovedProtons = pAATG->t_group_info->tni.nNumRemovedProtons;
 4892|  1.35k|#endif
 4893|  1.35k|                ret = bExistsAltPath( pCG, pBNS, pBD, pAATG, at, num_atoms,
 4894|  1.35k|                                      cg_Minus /*nVertDoubleBond*/,
 4895|  1.35k|                                      cg_Plus /*nVertSingleBond*/,
 4896|  1.35k|                                      ALT_PATH_MODE_REM_PROTON );
  ------------------
  |  |  318|  1.35k|#define ALT_PATH_MODE_REM_PROTON 9   /* remove proton, adjust bonds, charges, H-counts 2004-03-05 */
  ------------------
 4897|  1.35k|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  1.35k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  1.35k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  1.35k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  1.35k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 1.35k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 1.35k]
  |  |  ------------------
  ------------------
 4898|      0|                {
 4899|      0|                    return ret;
 4900|      0|                }
 4901|  1.35k|#if ( FIX_REM_PROTON_COUNT_BUG == 1 )
 4902|  1.35k|                nCurrRemovedProtons = pAATG->t_group_info->tni.nNumRemovedProtons;
 4903|  1.35k|                if (nCurrRemovedProtons != nPrevRemovedProtons)
  ------------------
  |  Branch (4903:21): [True: 0, False: 1.35k]
  ------------------
 4904|      0|                {
 4905|      0|                    return BNS_RADICAL_ERR;
  ------------------
  |  |   59|      0|#define BNS_RADICAL_ERR    (BNS_ERR + 11) /*(-9988)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 4906|      0|                }
 4907|  1.35k|#endif
 4908|  1.35k|                if (ret & 1)
  ------------------
  |  Branch (4908:21): [True: 21, False: 1.33k]
  ------------------
 4909|     21|                {
 4910|     21|                    nDelta = ( ret & ~3 ) >> 2;
 4911|     21|                    nNumChanges += (0 != (ret & 2)); /* djb-rwth: ignoring LLVM warning: variable used */
 4912|     21|                    if (nDelta)
  ------------------
  |  Branch (4912:25): [True: 0, False: 21]
  ------------------
 4913|      0|                    {
 4914|       |                        /* Radical pair has disappeared */
 4915|      0|                        ; /* goto quick_exit;*/
 4916|      0|                    }
 4917|     21|                    if (nPrevNumCharges > pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES])
  ------------------
  |  Branch (4917:25): [True: 21, False: 0]
  ------------------
 4918|     21|                    {
 4919|     21|                        nNumNeutralized += ( nPrevNumCharges - pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] ) / 2;
 4920|     21|                    }
 4921|     21|                }
 4922|  1.35k|            } while (ret & 1);
  ------------------
  |  Branch (4922:22): [True: 21, False: 1.33k]
  ------------------
 4923|  1.33k|        }
 4924|  2.45k|    }
 4925|       |
 4926|  2.88k|    ret = 0;
 4927|  2.88k|    if (tg_H >= num_atoms)
  ------------------
  |  Branch (4927:9): [True: 2.52k, False: 358]
  ------------------
 4928|  2.52k|    {
 4929|  2.52k|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, tg_H, pBNS );
 4930|  2.52k|        if (!ret && ret2)
  ------------------
  |  Branch (4930:13): [True: 2.52k, False: 0]
  |  Branch (4930:21): [True: 0, False: 2.52k]
  ------------------
 4931|      0|        {
 4932|      0|            ret = ret2;
 4933|      0|        }
 4934|  2.52k|    }
 4935|  2.88k|    if (cg_Minus >= num_atoms)
  ------------------
  |  Branch (4935:9): [True: 2.52k, False: 358]
  ------------------
 4936|  2.52k|    {
 4937|  2.52k|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, cg_Minus, pBNS );
 4938|  2.52k|        if (!ret && ret2)
  ------------------
  |  Branch (4938:13): [True: 2.52k, False: 0]
  |  Branch (4938:21): [True: 0, False: 2.52k]
  ------------------
 4939|      0|        {
 4940|      0|            ret = ret2;
 4941|      0|        }
 4942|  2.52k|    }
 4943|       |#if ( MOVE_PPLUS_TO_REMOVE_PROTONS == 1 )
 4944|       |    if (cg_PlusP >= num_atoms)
 4945|       |    {
 4946|       |        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, cg_PlusP, pBNS );
 4947|       |        if (!ret && ret2)
 4948|       |        {
 4949|       |            ret = ret2;
 4950|       |        }
 4951|       |    }
 4952|       |#endif
 4953|  2.88k|    if (cg_Plus >= num_atoms)
  ------------------
  |  Branch (4953:9): [True: 2.45k, False: 429]
  ------------------
 4954|  2.45k|    {
 4955|  2.45k|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, cg_Plus, pBNS );
 4956|  2.45k|        if (!ret && ret2)
  ------------------
  |  Branch (4956:13): [True: 2.45k, False: 0]
  |  Branch (4956:21): [True: 0, False: 2.45k]
  ------------------
 4957|      0|        {
 4958|      0|            ret = ret2;
 4959|      0|        }
 4960|  2.45k|    }
 4961|       |
 4962|  2.88k|    pBNS->type_CN = 0;
 4963|  2.88k|    pBNS->type_T = 0;
 4964|  2.88k|    pBNS->type_TACN = 0;
 4965|       |
 4966|  2.88k|    if (ret)
  ------------------
  |  Branch (4966:9): [True: 0, False: 2.88k]
  ------------------
 4967|      0|    {
 4968|      0|        return ret;
 4969|      0|    }
 4970|       |
 4971|  2.88k|    if (pAATG->nAtTypeTotals[ATTOT_NUM_CO_Minus] + pAATG->nAtTypeTotals[ATTOT_NUM_ZO_Minus] &&
  ------------------
  |  Branch (4971:9): [True: 63, False: 2.82k]
  ------------------
 4972|     63|         pAATG->nAtTypeTotals[ATTOT_NUM_N_Minus])
  ------------------
  |  Branch (4972:10): [True: 2, False: 61]
  ------------------
 4973|      2|    {
 4974|      2|    }
 4975|       |
 4976|  2.88k|    nPosCharges2 = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] + pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4977|  2.88k|    nNegCharges2 = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] - pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4978|       |    /*
 4979|       |    nNumNP_H2    = pAATG->nAtTypeTotals[ATTOT_NUM_NP_H] +
 4980|       |    pAATG->nAtTypeTotals[ATTOT_NUM_NP_Proton];
 4981|       |    nNumOS_H2    = pAATG->nAtTypeTotals[ATTOT_NUM_COH] +
 4982|       |    pAATG->nAtTypeTotals[ATTOT_NUM_CSH] +
 4983|       |    pAATG->nAtTypeTotals[ATTOT_NUM_ZOH];
 4984|       |    */
 4985|       |
 4986|  2.88k|    if (( nPosCharges - nNegCharges ) - ( nPosCharges2 - nNegCharges2 ) != nNumRemovedProtons)
  ------------------
  |  Branch (4986:9): [True: 0, False: 2.88k]
  ------------------
 4987|      0|    {
 4988|      0|        return BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 4989|      0|    }
 4990|       |
 4991|  2.88k|    if (nNumCanceledCharges)
  ------------------
  |  Branch (4991:9): [True: 2.88k, False: 0]
  ------------------
 4992|  2.88k|    {
 4993|       |#if ( FIX_CANCEL_CHARGE_COUNT_BUG == 1 )
 4994|       |        *nNumCanceledCharges += 2 * nNumNeutralized;
 4995|       |#else
 4996|  2.88k|        *nNumCanceledCharges = 2 * nNumNeutralized;
 4997|  2.88k|#endif
 4998|  2.88k|    }
 4999|       |
 5000|  2.88k|    return nNumRemovedProtons;
 5001|  2.88k|}
mark_at_type:
 5006|   253k|{
 5007|   253k|    int i, max_num_ions, mask, type;
 5008|       |    /*int max_protons, max_O_Minus, num_H = 0, num_CO=0;*/
 5009|       |
 5010|   253k|    if (nAtTypeTotals)
  ------------------
  |  Branch (5010:9): [True: 253k, False: 0]
  ------------------
 5011|   253k|    {
 5012|   253k|        memset( nAtTypeTotals, 0, ATTOT_ARRAY_LEN * sizeof( nAtTypeTotals[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5013|   253k|    }
 5014|       |
 5015|  1.31M|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5015:17): [True: 1.05M, False: 253k]
  ------------------
 5016|  1.05M|    {
 5017|  1.05M|        type = GetAtomChargeType( atom, i, nAtTypeTotals, &mask, 0 );
 5018|  1.05M|        atom[i].at_type = type;
 5019|       |        /*
 5020|       |        num_H  += ((type & PR_HARD_TYP_H)  && (mask & ATBIT_MSK_H));
 5021|       |        num_CO += ((type & AR_HARD_TYP_HA) && (mask & AR_HARD_MSK_HA));
 5022|       |        */
 5023|  1.05M|    }
 5024|       |
 5025|   253k|    if (nAtTypeTotals)
  ------------------
  |  Branch (5025:9): [True: 253k, False: 0]
  ------------------
 5026|   253k|    {
 5027|       |        /*
 5028|       |        max_protons = nAtTypeTotals[ATTOT_NUM_NP_Proton] +
 5029|       |        inchi_min(num_H, nAtTypeTotals[ATTOT_NUM_NP_Plus]);
 5030|       |        max_O_Minus = nAtTypeTotals[ATTOT_NUM_CO_Minus] + nAtTypeTotals[ATTOT_NUM_CS_Minus] +
 5031|       |        nAtTypeTotals[ATTOT_NUM_ZO_Minus] + nAtTypeTotals[ATTOT_NUM_OO_Minus] +
 5032|       |        nAtTypeTotals[ATTOT_NUM_ZOO_Minus] + nAtTypeTotals[ATTOT_NUM_NO_Minus] +
 5033|       |        nAtTypeTotals[ATTOT_NUM_O_Minus] +nAtTypeTotals[ATTOT_NUM_N_Minus];
 5034|       |        ;
 5035|       |        max_num_ions = max_protons + max_O_Minus + nAtTypeTotals[ATTOT_NUM_CHARGES];
 5036|       |        */
 5037|   253k|        max_num_ions = nAtTypeTotals[ATTOT_NUM_CHARGES];
 5038|   253k|    }
 5039|      0|    else
 5040|      0|    {
 5041|      0|        max_num_ions = 0;
 5042|      0|    }
 5043|       |
 5044|   253k|    return max_num_ions;
 5045|   253k|}
RemoveNPProtonsAndAcidCharges:
 5055|  59.9k|{
 5056|       |
 5057|       |    /* Prepare data structure */
 5058|  59.9k|    int num;
 5059|  59.9k|    int nNumCanceledCharges = 0;
 5060|       |    /* djb-rwth: removing redundant variables */
 5061|  59.9k|    T_GROUP_INFO *t_group_info = pAATG->t_group_info;
 5062|  59.9k|    int ret = 0, bError = 0;
 5063|       |
 5064|  59.9k|    int bAllowHardRemove = ( t_group_info->bTautFlags & TG_FLAG_TEST_TAUT__SALTS ) &&
  ------------------
  |  |  920|  59.9k|#define TG_FLAG_TEST_TAUT__SALTS         0x00000004   /* DISCONNECT_SALTS if possible find long-range H/(-) taut. on =C-OH, >C=O    */
  ------------------
  |  Branch (5064:28): [True: 59.9k, False: 0]
  ------------------
 5065|  59.9k|        ( t_group_info->bTautFlags & TG_FLAG_TEST_TAUT2_SALTS ) &&
  ------------------
  |  |  922|  59.9k|#define TG_FLAG_TEST_TAUT2_SALTS         0x00000010   /* TEST_REMOVE_S_ATOMS multi-attachement long-range H/(-) taut. on =C-OH, >C=O   */
  ------------------
  |  Branch (5065:9): [True: 59.9k, False: 0]
  ------------------
 5066|  59.9k|        ( t_group_info->bTautFlags & TG_FLAG_MOVE_POS_CHARGES ) &&
  ------------------
  |  |  921|  59.9k|#define TG_FLAG_MOVE_POS_CHARGES         0x00000008   /* MOVE_CHARGES allow long-range movement of N(+), P(+) charges           */
  ------------------
  |  Branch (5066:9): [True: 59.9k, False: 0]
  ------------------
 5067|  59.9k|        ( t_group_info->bTautFlags & TG_FLAG_HARD_ADD_REM_PROTONS );
  ------------------
  |  |  936|  59.9k|#define TG_FLAG_HARD_ADD_REM_PROTONS     0x00001000   /* add/remove protons to neutralize in hard way */
  ------------------
  |  Branch (5067:9): [True: 59.9k, False: 0]
  ------------------
 5068|       |
 5069|  59.9k|    if (pAATG->nMarkedAtom && num_atoms < pAATG->nAllocLen)
  ------------------
  |  Branch (5069:9): [True: 0, False: 59.9k]
  |  Branch (5069:31): [True: 0, False: 0]
  ------------------
 5070|      0|    {
 5071|      0|        inchi_free( pAATG->nMarkedAtom );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5072|      0|        qzfree( pAATG->nEndPoint );
  ------------------
  |  | 1176|      0|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 0, False: 0]
  |  |  |  Branch (1176:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5073|      0|        memset( pAATG, 0, sizeof( *pAATG ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5074|      0|    }
 5075|       |
 5076|  59.9k|    if (!pAATG->nMarkedAtom && ( pAATG->nMarkedAtom = (S_CHAR *) inchi_malloc( num_atoms * sizeof( pAATG->nMarkedAtom[0] ) ) ))
  ------------------
  |  | 1143|  59.9k|#define inchi_malloc   malloc
  ------------------
  |  Branch (5076:9): [True: 59.9k, False: 0]
  |  Branch (5076:32): [True: 59.9k, False: 0]
  ------------------
 5077|  59.9k|    {
 5078|  59.9k|        pAATG->nAllocLen = num_atoms;
 5079|  59.9k|        pAATG->nNumFound = 0;
 5080|  59.9k|    }
 5081|       |
 5082|       |    /* o TECHMAN-5.1. Remove protons from charged heteroatoms */
 5083|       |
 5084|       |    /* (TECHMAN-5.1a) Simple remove of protons from N, P, and O,S,Se,Te */
 5085|  59.9k|    if ((num = pAATG->nAtTypeTotals[ATTOT_NUM_NP_Proton] + pAATG->nAtTypeTotals[ATTOT_NUM_OH_Plus])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (5085:9): [True: 665, False: 59.2k]
  ------------------
 5086|    665|    {
 5087|    665|        ret = SimpleRemoveHplusNPO( at, num_atoms, pAATG->nAtTypeTotals, t_group_info );
 5088|    665|        if (ret != num)
  ------------------
  |  Branch (5088:13): [True: 0, False: 665]
  ------------------
 5089|      0|        {
 5090|      0|            bError = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 5091|      0|            goto exit_function;
 5092|      0|        }
 5093|       |        /*t_group_info->nNumRemovedProtons  += ret;*/
 5094|    665|        t_group_info->tni.bNormalizationFlags |= ( ret > 0 ) ? FLAG_PROTON_NPO_SIMPLE_REMOVED : 0;
  ------------------
  |  |  146|    665|#define FLAG_PROTON_NPO_SIMPLE_REMOVED 0x0001
  ------------------
  |  Branch (5094:50): [True: 665, False: 0]
  ------------------
 5095|    665|    }
 5096|       |
 5097|  59.9k|    if (( num = pAATG->nAtTypeTotals[ATTOT_NUM_NP_Plus] ) && bAllowHardRemove) /* djb-rwth: ignoring LLVM warning: variable used */
  ------------------
  |  Branch (5097:9): [True: 2.88k, False: 57.0k]
  |  Branch (5097:62): [True: 2.88k, False: 0]
  ------------------
 5098|  2.88k|    {
 5099|       |        /* [TECHMAN-5.1b] Hard removing more protons from cationic N; charges may be canceled */
 5100|  2.88k|        ret = HardRemoveHplusNP( pCG, at, num_atoms, 1, &nNumCanceledCharges, pAATG, pBNS, pBD );
 5101|  2.88k|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  2.88k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  2.88k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  2.88k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  2.88k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 2.88k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 2.88k]
  |  |  ------------------
  ------------------
 5102|      0|        {
 5103|      0|            bError = ret;
 5104|      0|            goto exit_function;
 5105|      0|        }
 5106|       |        /* djb-rwth: removing redundant code */
 5107|       |        /*t_group_info->nNumRemovedProtons  += ret;*/
 5108|  2.88k|        t_group_info->tni.bNormalizationFlags |= ( ret > 0 ) ? FLAG_PROTON_NP_HARD_REMOVED : 0;
  ------------------
  |  |  147|     95|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  ------------------
  |  Branch (5108:50): [True: 95, False: 2.78k]
  ------------------
 5109|  2.88k|    }
 5110|       |
 5111|  59.9k|    if (pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] > 0)
  ------------------
  |  Branch (5111:9): [True: 41.8k, False: 18.0k]
  ------------------
 5112|  41.8k|    {
 5113|       |        /* o TECHMAN-5.2. Remove protons from neutral heteroatoms */
 5114|       |
 5115|       |        /* (TECHMAN-5.2a) Simple removal */
 5116|  41.8k|        ret = SimpleRemoveAcidicProtons( at, num_atoms, pAATG, pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] );
 5117|  41.8k|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  41.8k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  41.8k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  41.8k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  41.8k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 41.8k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 41.8k]
  |  |  ------------------
  ------------------
 5118|      0|        {
 5119|      0|            bError = ret;
 5120|      0|            goto exit_function;
 5121|      0|        }
 5122|       |
 5123|       |        /*t_group_info->nNumRemovedProtons  += ret;*/
 5124|  41.8k|        t_group_info->tni.bNormalizationFlags |= ( ret > 0 ) ? FLAG_PROTON_AC_SIMPLE_REMOVED : 0;
  ------------------
  |  |  149|     92|#define FLAG_PROTON_AC_SIMPLE_REMOVED  0x0008
  ------------------
  |  Branch (5124:50): [True: 92, False: 41.7k]
  ------------------
 5125|       |
 5126|       |        
 5127|  41.8k|        if (pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] > 0 && bAllowHardRemove)
  ------------------
  |  Branch (5127:13): [True: 41.7k, False: 87]
  |  Branch (5127:59): [True: 41.7k, False: 0]
  ------------------
 5128|  41.7k|        {
 5129|       |            /* (TECHMAN-5.2b) Hard removal */
 5130|  41.7k|            ret = HardRemoveAcidicProtons(pCG, at, num_atoms, pAATG, pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE], &nNumCanceledCharges, pBNS, pBD);
 5131|  41.7k|            if (IS_BNS_ERROR(ret))
  ------------------
  |  |   67|  41.7k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  41.7k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  41.7k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  41.7k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 41.7k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 41.7k]
  |  |  ------------------
  ------------------
 5132|      0|            {
 5133|      0|                bError = ret;
 5134|      0|                goto exit_function;
 5135|      0|            }
 5136|  41.7k|            if (ret > 0)
  ------------------
  |  Branch (5136:17): [True: 11, False: 41.7k]
  ------------------
 5137|     11|            {
 5138|     11|                int ret2 = SimpleRemoveAcidicProtons(at, num_atoms, pAATG, ret);
 5139|     11|                if (ret2 != ret)
  ------------------
  |  Branch (5139:21): [True: 0, False: 11]
  ------------------
 5140|      0|                {
 5141|      0|                    bError = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 5142|      0|                    goto exit_function;
 5143|      0|                }
 5144|       |                /*t_group_info->nNumRemovedProtons  += ret;*/
 5145|     11|                t_group_info->tni.bNormalizationFlags |= (ret > 0) ? FLAG_PROTON_AC_HARD_REMOVED : 0;
  ------------------
  |  |  150|     11|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  ------------------
  |  Branch (5145:58): [True: 11, False: 0]
  ------------------
 5146|       |                /* djb-rwth: removing redundant code */
 5147|     11|            }
 5148|  41.7k|        }
 5149|       |
 5150|       |
 5151|  41.8k|    }
 5152|  18.0k|    else
 5153|  18.0k|    {
 5154|  18.0k|        if (pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] < 0)
  ------------------
  |  Branch (5154:13): [True: 10.7k, False: 7.27k]
  ------------------
 5155|  10.7k|        {
 5156|  10.7k|            ret = SimpleAddAcidicProtons( at, num_atoms, pAATG, -pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] );
 5157|  10.7k|            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  10.7k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  10.7k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  10.7k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  10.7k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 10.7k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 10.7k]
  |  |  ------------------
  ------------------
 5158|      0|            {
 5159|      0|                bError = ret;
 5160|      0|                goto exit_function;
 5161|      0|            }
 5162|       |            /*t_group_info->nNumRemovedProtons  -= ret;*/
 5163|       |            /*
 5164|       |            CHECK_TACN == 1 prohibits replacing (-) on N with H unless H can be moved to N
 5165|       |            along an alternating path from another heteroatom (t-group will be detected).
 5166|       |            */
 5167|  10.7k|            t_group_info->tni.bNormalizationFlags |= ( ret > 0 ) ? FLAG_PROTON_AC_SIMPLE_ADDED : 0;
  ------------------
  |  |  148|  3.86k|#define FLAG_PROTON_AC_SIMPLE_ADDED    0x0004
  ------------------
  |  Branch (5167:54): [True: 3.86k, False: 6.88k]
  ------------------
 5168|  10.7k|            if (pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] < 0 && bAllowHardRemove)
  ------------------
  |  Branch (5168:17): [True: 7.15k, False: 3.60k]
  |  Branch (5168:63): [True: 7.15k, False: 0]
  ------------------
 5169|  7.15k|            {
 5170|  7.15k|                ret = HardAddAcidicProtons( pCG, at, num_atoms, pAATG, -pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE], &nNumCanceledCharges, pBNS, pBD );
 5171|  7.15k|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  7.15k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  7.15k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  7.15k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  7.15k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 7.15k, False: 0]
  |  |  |  Branch (67:44): [True: 3, False: 7.15k]
  |  |  ------------------
  ------------------
 5172|      3|                {
 5173|      3|                    bError = ret;
 5174|      3|                    goto exit_function;
 5175|      3|                }
 5176|  7.15k|                if (ret > 0)
  ------------------
  |  Branch (5176:21): [True: 69, False: 7.08k]
  ------------------
 5177|     69|                {
 5178|     69|                    int ret2 = SimpleAddAcidicProtons( at, num_atoms, pAATG, ret );
 5179|     69|                    if (ret2 != ret)
  ------------------
  |  Branch (5179:25): [True: 0, False: 69]
  ------------------
 5180|      0|                    {
 5181|      0|                        bError = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 5182|      0|                        goto exit_function;
 5183|      0|                    }
 5184|       |                    /*t_group_info->nNumRemovedProtons  -= ret;*/
 5185|     69|                    t_group_info->tni.bNormalizationFlags |= FLAG_PROTON_AC_HARD_ADDED; /* djb-rwth: fixing coverity ID #499527 */
  ------------------
  |  |  151|     69|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  ------------------
 5186|       |                    /* djb-rwth: removing redundant code */
 5187|     69|                }
 5188|  7.15k|            }
 5189|  10.7k|        }
 5190|  18.0k|    }
 5191|       |
 5192|  59.8k|    t_group_info->tni.bNormalizationFlags |= nNumCanceledCharges ? FLAG_PROTON_CHARGE_CANCEL : 0;
  ------------------
  |  |  152|     19|#define FLAG_PROTON_CHARGE_CANCEL      0x0040
  ------------------
  |  Branch (5192:46): [True: 19, False: 59.8k]
  ------------------
 5193|       |
 5194|  59.9k|exit_function:
 5195|  59.9k|    if (bError)
  ------------------
  |  Branch (5195:9): [True: 3, False: 59.8k]
  ------------------
 5196|      3|    {
 5197|      3|        ret = IS_BNS_ERROR( bError ) ? bError : BNS_PROGRAM_ERR;
  ------------------
  |  |   67|      3|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      3|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      3|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      3|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 3, False: 0]
  |  |  |  Branch (67:44): [True: 3, False: 0]
  |  |  ------------------
  ------------------
                      ret = IS_BNS_ERROR( bError ) ? bError : BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      3|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 5198|      3|    }
 5199|       |
 5200|  59.9k|    return ret;
 5201|  59.8k|}
mark_alt_bonds_and_taut_groups:
 5220|   288k|{
 5221|   288k|    BN_STRUCT *pBNS = NULL;
 5222|   288k|    BN_DATA   *pBD = NULL;
 5223|   288k|    int bError, nChanges, taut_found, salt_found, salt_pass, salt_step, ret, ret2, num, num_changed_bonds; /* djb-rwth: removing redundant variables */
 5224|   288k|    int max_altp = BN_MAX_ALTP;
  ------------------
  |  |   17|   288k|#define BN_MAX_ALTP  16
  ------------------
 5225|   288k|    int bChangeFlow = ( BNS_EF_CHNG_RSTR | BNS_EF_ALTR_BONDS );
  ------------------
  |  |  372|   288k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|   288k|#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)
  |  |  ------------------
  |  |  |  |  371|   288k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
                  int bChangeFlow = ( BNS_EF_CHNG_RSTR | BNS_EF_ALTR_BONDS );
  ------------------
  |  |  374|   288k|#define BNS_EF_ALTR_BONDS     8  /* make altern. bonds in the structure if the flow has changed */
  ------------------
 5226|   288k|    BNS_FLOW_CHANGES fcd[BNS_MAX_NUM_FLOW_CHANGES + 1];
 5227|   288k|    C_GROUP_INFO CGroupInfo;
 5228|   288k|    C_GROUP_INFO *c_group_info = &CGroupInfo;
 5229|   288k|    S_GROUP_INFO SGroupInfo;
 5230|   288k|    S_GROUP_INFO *s_group_info = &SGroupInfo;
 5231|   288k|    INCHI_MODE    *pbTautFlags = t_group_info ? &t_group_info->bTautFlags : inpbTautFlags;
  ------------------
  |  Branch (5231:34): [True: 252k, False: 36.3k]
  ------------------
 5232|   288k|    INCHI_MODE    *pbTautFlagsDone = t_group_info ? &t_group_info->bTautFlagsDone : inpbTautFlagsDone;
  ------------------
  |  Branch (5232:38): [True: 252k, False: 36.3k]
  ------------------
 5233|       |
 5234|   288k|    int nAtTypeTotals[ATTOT_ARRAY_LEN];
 5235|   288k|    int nNumOrigTotAtoms;
 5236|       |
 5237|   288k|    BN_AATG  aatg;
 5238|   288k|    BN_AATG *pAATG = &aatg;
 5239|       |
 5240|   288k|#ifdef FIX_AROM_RADICAL        /* Added 2011-05-09 IPl */
 5241|   288k|    int i, n_arom_radicals = 0, *stored_radicals = NULL;
 5242|   288k|#endif
 5243|   288k|    int at_prot;  /* moved from below 2024-09-01 DT */
 5244|       |
 5245|   288k|    nChanges = 0;
 5246|   288k|    bError = 0;
 5247|       |
 5248|   288k|    memset( c_group_info, 0, sizeof( *c_group_info ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5249|   288k|    memset( s_group_info, 0, sizeof( *s_group_info ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5250|   288k|    memset( pAATG, 0, sizeof( *pAATG ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5251|       |
 5252|       |    /*(@nnuk : Nauman Ullah Khan) :: Variable for checking (De)protonation status */
 5253|   288k|    LOG_NO_ARGS("\n############# Initial state before (De)Protonation (L5373:ichi_bns.c) ###############\n");
 5254|  1.38M|    for (at_prot = 0; at_prot < num_atoms; at_prot++)
  ------------------
  |  Branch (5254:23): [True: 1.09M, False: 288k]
  ------------------
 5255|  1.09M|    {
 5256|  1.09M|        LOG_MULT_ARGS("Atom %d: Element: %s, Num_H: %d, Charge: %hhd, Radical: %d\n", at_prot, at[at_prot].elname, at[at_prot].num_H, at[at_prot].charge, at[at_prot].radical);
 5257|  1.09M|    }
 5258|   288k|    LOG_NO_ARGS("\n#####################################################################################\n");
 5259|       |
 5260|       |
 5261|   288k|#ifdef FIX_AROM_RADICAL        /* Added 2011-05-09 IPl */
 5262|  1.38M|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5262:17): [True: 1.09M, False: 288k]
  ------------------
 5263|  1.09M|    {
 5264|  1.09M|        if (( at[i].radical == RADICAL_DOUBLET ) && ( at[i].valence == 2 ) &&
  ------------------
  |  |   76|  1.09M|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (5264:13): [True: 17.6k, False: 1.07M]
  |  Branch (5264:53): [True: 4.66k, False: 13.0k]
  ------------------
 5265|  4.66k|            ( at[i].bond_type[0] == BOND_ALTERN ) && ( at[i].bond_type[1] == BOND_ALTERN ))
  ------------------
  |  |  180|  4.66k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|  4.66k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                          ( at[i].bond_type[0] == BOND_ALTERN ) && ( at[i].bond_type[1] == BOND_ALTERN ))
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (5265:13): [True: 0, False: 4.66k]
  |  Branch (5265:54): [True: 0, False: 0]
  ------------------
 5266|      0|        {
 5267|      0|            n_arom_radicals++;
 5268|      0|            if (!stored_radicals)
  ------------------
  |  Branch (5268:17): [True: 0, False: 0]
  ------------------
 5269|      0|            {
 5270|      0|                stored_radicals = (int *) inchi_calloc( num_atoms, sizeof( int ) );
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 5271|       |                /* 2011-08-05 explicit cast added due to Evan Bolton */
 5272|      0|                if (!stored_radicals)
  ------------------
  |  Branch (5272:21): [True: 0, False: 0]
  ------------------
 5273|      0|                {
 5274|      0|                    bError = BNS_OUT_OF_RAM;
  ------------------
  |  |   49|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 5275|      0|                    goto exit_function;
 5276|      0|                }
 5277|      0|                stored_radicals[i] = RADICAL_DOUBLET;
  ------------------
  |  |   76|      0|#define RADICAL_DOUBLET 2
  ------------------
 5278|      0|                at[i].radical = 0;
 5279|      0|                at[i].num_H++;
 5280|      0|            }
 5281|      0|        }
 5282|  1.09M|    }
 5283|       |
 5284|   288k|#endif
 5285|       |
 5286|   288k|    if (( *pbTautFlags & TG_FLAG_MOVE_POS_CHARGES ) && num_atoms > 1)
  ------------------
  |  |  921|   288k|#define TG_FLAG_MOVE_POS_CHARGES         0x00000008   /* MOVE_CHARGES allow long-range movement of N(+), P(+) charges           */
  ------------------
  |  Branch (5286:9): [True: 288k, False: 0]
  |  Branch (5286:56): [True: 103k, False: 184k]
  ------------------
 5287|   103k|    {
 5288|       |        /* Charge groups memory allocation */
 5289|   103k|        c_group_info->c_group = (C_GROUP *) inchi_calloc( num_atoms / 2, sizeof( c_group_info->c_group[0] ) );
  ------------------
  |  | 1146|   103k|#define inchi_calloc   calloc
  ------------------
 5290|   103k|        c_group_info->c_candidate = (C_CANDIDATE*) inchi_calloc( num_atoms, sizeof( c_group_info->c_candidate[0] ) );
  ------------------
  |  | 1146|   103k|#define inchi_calloc   calloc
  ------------------
 5291|   103k|        if (c_group_info->c_group && c_group_info->c_candidate)
  ------------------
  |  Branch (5291:13): [True: 103k, False: 0]
  |  Branch (5291:38): [True: 103k, False: 0]
  ------------------
 5292|   103k|        {
 5293|   103k|            c_group_info->max_num_c_groups = num_atoms / 2;
 5294|   103k|            c_group_info->max_num_candidates = num_atoms;
 5295|   103k|        }
 5296|      0|        else
 5297|      0|        {
 5298|      0|            bError = BNS_OUT_OF_RAM; /* error: out of RAM */
  ------------------
  |  |   49|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 5299|       |                                     /*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);*/
 5300|      0|            goto exit_function;
 5301|      0|        }
 5302|   103k|    }
 5303|       |
 5304|   288k|    if (*pbTautFlags & TG_FLAG_TEST_TAUT__SALTS)
  ------------------
  |  |  920|   288k|#define TG_FLAG_TEST_TAUT__SALTS         0x00000004   /* DISCONNECT_SALTS if possible find long-range H/(-) taut. on =C-OH, >C=O    */
  ------------------
  |  Branch (5304:9): [True: 252k, False: 36.3k]
  ------------------
 5305|   252k|    {
 5306|   252k|        if (t_group_info)
  ------------------
  |  Branch (5306:13): [True: 252k, False: 0]
  ------------------
 5307|   252k|        {
 5308|       |            /* Salt groups memory allocation */
 5309|   252k|            s_group_info->s_candidate =
 5310|   252k|                (S_CANDIDATE*) inchi_calloc( num_atoms,
  ------------------
  |  | 1146|   252k|#define inchi_calloc   calloc
  ------------------
 5311|   252k|                                             sizeof( s_group_info->s_candidate[0] ) );
 5312|   252k|            if (s_group_info->s_candidate)
  ------------------
  |  Branch (5312:17): [True: 252k, False: 0]
  ------------------
 5313|   252k|            {
 5314|   252k|                s_group_info->max_num_candidates = num_atoms;
 5315|   252k|            }
 5316|      0|            else
 5317|      0|            {
 5318|      0|                bError = BNS_OUT_OF_RAM; /* error: out of RAM */
  ------------------
  |  |   49|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 5319|       |                                         /*printf("BNS_OUT_OF_RAM-2\n");*/
 5320|      0|                goto exit_function;
 5321|      0|            }
 5322|   252k|        }
 5323|   252k|    }
 5324|       |
 5325|   288k|    if (t_group_info)
  ------------------
  |  Branch (5325:9): [True: 252k, False: 36.3k]
  ------------------
 5326|   252k|    {
 5327|   252k|        if (t_group_info->tGroupNumber)
  ------------------
  |  Branch (5327:13): [True: 0, False: 252k]
  ------------------
 5328|      0|        {
 5329|      0|            inchi_free( t_group_info->tGroupNumber );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5330|      0|        }
 5331|   252k|        t_group_info->tGroupNumber = (AT_NUMB *) inchi_calloc( 2 * (long long)num_atoms + 1, sizeof( t_group_info->tGroupNumber[0] ) ); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|   252k|#define inchi_calloc   calloc
  ------------------
 5332|   252k|        if (!t_group_info->tGroupNumber)
  ------------------
  |  Branch (5332:13): [True: 0, False: 252k]
  ------------------
 5333|      0|        {
 5334|       |            /*printf("BNS_OUT_OF_RAM-9\n");*/
 5335|      0|            bError = BNS_OUT_OF_RAM; /* error: out of RAM */
  ------------------
  |  |   49|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 5336|      0|            goto exit_function;
 5337|      0|        }
 5338|   252k|        num = t_group_info->tni.nNumRemovedExplicitH;
 5339|   252k|        memset( &t_group_info->tni, 0, sizeof( t_group_info->tni ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5340|   252k|        t_group_info->tni.nNumRemovedExplicitH = num;
 5341|   252k|    }
 5342|       |
 5343|       |    /*
 5344|       |    again:
 5345|       |    */
 5346|       |
 5347|       |    /* Allocate Balanced Network Data Strucures; replace Alternating bonds with Single */
 5348|   288k|    if (( pBNS = AllocateAndInitBnStruct( at, num_atoms,
  ------------------
  |  Branch (5348:9): [True: 288k, False: 0]
  ------------------
 5349|   288k|                                          BNS_ADD_ATOMS, BNS_ADD_EDGES,
  ------------------
  |  |   88|   288k|#define BNS_ADD_ATOMS        2  /* max. number of fictitious atoms to add (except t-gtoups) */
  ------------------
                                                        BNS_ADD_ATOMS, BNS_ADD_EDGES,
  ------------------
  |  |   89|   288k|#define BNS_ADD_EDGES        1  /* max. number of edges to add to each atom (except edges to a t-group or c-group) */
  ------------------
 5350|   288k|                                          max_altp, &num_changed_bonds ) )
 5351|   288k|         &&
 5352|   288k|         ( pBD = AllocateAndInitBnData( pBNS->max_vertices ) ))
  ------------------
  |  Branch (5352:10): [True: 288k, False: 0]
  ------------------
 5353|   288k|    {
 5354|       |
 5355|       |
 5356|   288k|        pBNS->pbTautFlags = pbTautFlags;     /* carry through all functions */
 5357|   288k|        pBNS->pbTautFlagsDone = pbTautFlagsDone;  /* carry through all functions */
 5358|       |
 5359|   288k|        pBNS->ulTimeOutTime = ulTimeOutTime;    /* v. 1.05 */
 5360|   288k|        pBNS->ic = ic;    /* v. 1.05 */
 5361|       |
 5362|   288k|#if ( BNS_PROTECT_FROM_TAUT == 1 )
 5363|       |                          /* Protect bonds to acetyl and nitro */
 5364|   288k|        SetForbiddenEdges( pBNS, at, num_atoms, BNS_EDGE_FORBIDDEN_MASK, nebend, ebend );
  ------------------
  |  |   39|   288k|#define BNS_EDGE_FORBIDDEN_MASK  1
  ------------------
 5365|   288k|#endif
 5366|       |
 5367|       |        /* Set bonds in case of input "aromatic" bonds or multiple radicals */
 5368|   288k|#ifdef FIX_AROM_RADICAL        /* Added 2011-05-09 IPl */
 5369|   288k|        if (n_arom_radicals)
  ------------------
  |  Branch (5369:13): [True: 0, False: 288k]
  ------------------
 5370|      0|        {
 5371|      0|            ret = BnsAdjustFlowBondsRad( pBNS, pBD, at, num_atoms );
 5372|      0|            if (stored_radicals)
  ------------------
  |  Branch (5372:17): [True: 0, False: 0]
  ------------------
 5373|      0|            {
 5374|      0|                for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5374:29): [True: 0, False: 0]
  ------------------
 5375|      0|                {
 5376|      0|                    if (stored_radicals[i])
  ------------------
  |  Branch (5376:25): [True: 0, False: 0]
  ------------------
 5377|      0|                    {
 5378|      0|                        at[i].radical = stored_radicals[i];
 5379|      0|                        at[i].num_H--;
 5380|      0|                    }
 5381|      0|                }
 5382|      0|            }
 5383|      0|            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 0, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5384|      0|            {
 5385|      0|                bError = ret;
 5386|      0|                goto exit_function;
 5387|      0|            }
 5388|      0|        }
 5389|   288k|#endif
 5390|       |
 5391|   288k|        ret = BnsAdjustFlowBondsRad( pBNS, pBD, at, num_atoms );
 5392|       |
 5393|       |        /* (here pair(s) of radicals could have disappeared from the atoms) */
 5394|   288k|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|   288k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   288k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   288k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   288k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 288k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 288k]
  |  |  ------------------
  ------------------
 5395|      0|        {
 5396|      0|            bError = ret;
 5397|      0|            goto exit_function;
 5398|      0|        }
 5399|   288k|        pBNS->tot_st_flow += 2 * ret;
 5400|       |
 5401|       |        /*return 0;*/ /* debug */
 5402|       |        /* djb-rwth: removing redundant code */
 5403|       |
 5404|   288k|        if (pBNS->tot_st_cap > pBNS->tot_st_flow)
  ------------------
  |  Branch (5404:13): [True: 11.8k, False: 276k]
  ------------------
 5405|  11.8k|        {
 5406|       |            /* has radical */
 5407|  11.8k|            bChangeFlow |= BNS_EF_SET_NOSTEREO;
  ------------------
  |  |  377|  11.8k|#define BNS_EF_SET_NOSTEREO  32  /* in combination with BNS_EF_ALTR_BONDS only:
  ------------------
 5408|  11.8k|        }
 5409|       |
 5410|       |        /********************************************************************
 5411|       |        *  Remove protons from NH(+), but not PH(+)
 5412|       |        *  Add protons to COO(-) etc.
 5413|       |        *  or remove protons from COOH etc to make the organic part neutral
 5414|       |        *  Note: for now (-) from N(-) can be only canceled or moved to -C=O
 5415|       |        ********************************************************************/
 5416|   288k|        if (( *pbTautFlags & TG_FLAG_VARIABLE_PROTONS ) &&
  ------------------
  |  |  935|   288k|#define TG_FLAG_VARIABLE_PROTONS         0x00000800   /* add/remove protons to neutralize */
  ------------------
  |  Branch (5416:13): [True: 288k, False: 0]
  ------------------
 5417|   288k|             t_group_info &&
  ------------------
  |  Branch (5417:14): [True: 252k, False: 36.3k]
  ------------------
 5418|   252k|             mark_at_type( at, num_atoms, nAtTypeTotals ) &&
  ------------------
  |  Branch (5418:14): [True: 59.9k, False: 192k]
  ------------------
 5419|  59.9k|             nAtTypeTotals[ATTOT_NUM_CHARGES])
  ------------------
  |  Branch (5419:14): [True: 59.9k, False: 0]
  ------------------
 5420|  59.9k|        {
 5421|       |            /*
 5422|       |            the structure is simple to neutralize if it yields exactly
 5423|       |            num[H(+)]     = num[N,P H(+)]
 5424|       |            num[N,S,O(-)] = num[=C-O(-)] + num[C-S(-)] + num[N(-)] + num[other O(-), S(-)]
 5425|       |
 5426|       |            and n(p) = num[H(+)] - num[N,S,O(-)] (no protons, no negative N,O,S condition)
 5427|       |
 5428|       |            Additional check is needed if:
 5429|       |            min{num[N,PH], num[N,P(+), not onium]} > 0
 5430|       |            => possibility to yield more H(+)
 5431|       |
 5432|       |            min_charge = orig_charge(P,N,O,S) - n(p) - n(OH,SH)
 5433|       |            max_charge = orig_charge(P,N,O,S) - n(p) + n(O,S,N(-))
 5434|       |            */
 5435|       |
 5436|  59.9k|            nNumOrigTotAtoms = t_group_info->tni.nNumRemovedExplicitH + num_atoms;
 5437|  59.9k|            pAATG->nAtTypeTotals = nAtTypeTotals;
 5438|  59.9k|            pAATG->t_group_info = t_group_info;
 5439|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5440|       |            pBNS->edge_forbidden_mask |= BNS_EDGE_FORBIDDEN_TEMP;
 5441|       |#endif
 5442|       |
 5443|       |            /***********************************************************/
 5444|       |            /*                                                         */
 5445|       |            /*          ( D E ) P R O T O N A T I O N                  */
 5446|       |            /*                                                         */
 5447|       |            /***********************************************************/
 5448|       |
 5449|  59.9k|            ret = RemoveNPProtonsAndAcidCharges( pCG, at, num_atoms, pAATG, pBNS, pBD );
 5450|       |
 5451|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5452|       |            pBNS->edge_forbidden_mask &= ~BNS_EDGE_FORBIDDEN_TEMP;
 5453|       |#endif
 5454|  59.9k|            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  59.9k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  59.9k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  59.9k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  59.9k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 59.9k, False: 0]
  |  |  |  Branch (67:44): [True: 3, False: 59.8k]
  |  |  ------------------
  ------------------
 5455|      3|            {
 5456|      3|                bError = ret;
 5457|      3|                goto exit_function;
 5458|      3|            }
 5459|       |
 5460|  59.8k|            if (t_group_info->tni.bNormalizationFlags)
  ------------------
  |  Branch (5460:17): [True: 4.60k, False: 55.2k]
  ------------------
 5461|  4.60k|            {
 5462|  4.60k|                SetInitCapFlowToCurrent( pBNS );
 5463|  4.60k|                if (at_fixed_bonds_out)
  ------------------
  |  Branch (5463:21): [True: 4.60k, False: 0]
  ------------------
 5464|  4.60k|                {
 5465|       |                    /* Copy modified initial tautomeric structure for displaying
 5466|       |                    Warning: implicit H counts in at_fixed_bonds_out include explicit Hs */
 5467|       |
 5468|  4.60k|                    memcpy(at_fixed_bonds_out, at, nNumOrigTotAtoms * sizeof(at_fixed_bonds_out[0]));
 5469|       |
 5470|       |                    /* -- will be done in FillOutInputInfAtom() --
 5471|       |                    RemoveExcessiveImplicitH( num_atoms, t_group_info->tni.nNumRemovedExplicitH, at_fixed_bonds_out );
 5472|       |                    */
 5473|  4.60k|                }
 5474|  4.60k|            }
 5475|  59.8k|        }
 5476|       |
 5477|       |        /****************** Initial bonds normalization ***************/
 5478|       |
 5479|   288k|        if (*pbTautFlags & TG_FLAG_MOVE_POS_CHARGES)
  ------------------
  |  |  921|   288k|#define TG_FLAG_MOVE_POS_CHARGES         0x00000008   /* MOVE_CHARGES allow long-range movement of N(+), P(+) charges           */
  ------------------
  |  Branch (5479:13): [True: 288k, False: 0]
  ------------------
 5480|   288k|        {
 5481|       |            /******************* Find moveable positive charges **********************/
 5482|   288k|            do
 5483|   289k|            {
 5484|       |                /* Cycling while ret>0 added 2004-06-04 */
 5485|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5486|       |                pBNS->edge_forbidden_mask |= BNS_EDGE_FORBIDDEN_TEMP;
 5487|       |                CorrectFixing_NH_NH_Bonds( pBNS, at, num_atoms );
 5488|       |#endif
 5489|   289k|                ret = MarkChargeGroups( pCG, at, num_atoms,
 5490|   289k|                                        c_group_info, t_group_info,
 5491|   289k|                                        pBNS, pBD );
 5492|       |
 5493|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5494|       |                pBNS->edge_forbidden_mask &= ~BNS_EDGE_FORBIDDEN_TEMP;
 5495|       |#endif
 5496|   289k|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|   289k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   289k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   289k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   289k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 289k, False: 0]
  |  |  |  Branch (67:44): [True: 1, False: 289k]
  |  |  ------------------
  ------------------
 5497|      1|                {
 5498|      1|                    bError = ret;
 5499|      1|                    goto exit_function;
 5500|      1|                }
 5501|   289k|                if (ret)
  ------------------
  |  Branch (5501:21): [True: 862, False: 288k]
  ------------------
 5502|    862|                {
 5503|    862|                    nChanges += ret;
 5504|    862|                    ret2 = AddCGroups2BnStruct( pCG, pBNS, at, num_atoms, c_group_info );
 5505|    862|                    if (IS_BNS_ERROR( ret2 ))
  ------------------
  |  |   67|    862|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|    862|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|    862|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    862|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 862, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 862]
  |  |  ------------------
  ------------------
 5506|      0|                    {
 5507|      0|                        bError = ret2;
 5508|      0|                        goto exit_function;
 5509|      0|                    }
 5510|    862|                    *pbTautFlagsDone |= TG_FLAG_MOVE_POS_CHARGES_DONE;
  ------------------
  |  |  966|    862|#define TG_FLAG_MOVE_POS_CHARGES_DONE    0x00000010
  ------------------
 5511|    862|                }
 5512|   289k|            } while (ret > 0);
  ------------------
  |  Branch (5512:22): [True: 862, False: 288k]
  ------------------
 5513|       |
 5514|       |
 5515|   288k|#if ( BNS_RAD_SEARCH == 1 )
 5516|       |#else
 5517|       |            /* moveable charges may allow to cancel radicals -- check it */
 5518|       |            if (pBNS->tot_st_cap > pBNS->tot_st_flow)
 5519|       |            {
 5520|       |                ret = BnsAdjustFlowBondsRad( pBNS, pBD, at, num_atoms );
 5521|       |                if (IS_BNS_ERROR( ret ))
 5522|       |                {
 5523|       |                    bError = ret;
 5524|       |                    goto exit_function;
 5525|       |                }
 5526|       |                if (ret > 0)
 5527|       |                {
 5528|       |                    /*
 5529|       |                    pBNS->tot_st_flow += 2*ret;
 5530|       |                    ret = ReInitBnStruct( pBNS, at, num_atoms, 1 );
 5531|       |                    if ( IS_BNS_ERROR( ret ) ) {
 5532|       |                    bError = ret;
 5533|       |                    goto exit_function;
 5534|       |                    }
 5535|       |                    */
 5536|       |                    bError = BNS_RADICAL_ERR;
 5537|       |                    goto exit_function;
 5538|       |                }
 5539|       |            }
 5540|       |#endif
 5541|   288k|        }
 5542|       |
 5543|       |        /************************************************************************/
 5544|       |        /********          Test bonds for bond tautomerism         **************/
 5545|       |        /******** replace moveable bonds with "alternating" bonds  **************/
 5546|       |        /************************************************************************/
 5547|   288k|        ret = BnsTestAndMarkAltBonds( pBNS, pBD, at, num_atoms, fcd, bChangeFlow, 0 );
 5548|       |
 5549|   288k|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|   288k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   288k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   288k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   288k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 288k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 288k]
  |  |  ------------------
  ------------------
 5550|      0|        {
 5551|      0|            bError = ret;
 5552|      0|            goto exit_function;
 5553|      0|        }
 5554|       |        /* djb-rwth: removing redundant code */
 5555|       |
 5556|       |        /*********************** End of initial bonds normalization *************/
 5557|       |
 5558|       |        /* djb-rwth: removing redundant code */
 5559|       |
 5560|       |        /* Check for tautomerism */
 5561|       |        /* find new tautomer groups */
 5562|   288k|        salt_pass = 0;
 5563|   288k|        salt_step = 0;
 5564|   288k|        salt_found = 0;
 5565|       |
 5566|       |        /*************************************************************/
 5567|       |        /*                                                           */
 5568|       |        /*           M A I N   C Y C L E   B E G I N                 */
 5569|       |        /*                                                           */
 5570|       |        /*************************************************************/
 5571|       |
 5572|   288k|        do
 5573|   288k|        {
 5574|       |            /* djb-rwth: removing redundant code */
 5575|   288k|            nChanges = 0;
 5576|       |            /* djb-rwth: removing redundant code */
 5577|       |
 5578|       |            /**************** Regular bond/H/(-)/positive charges tautomerism cycle begin **************/
 5579|   288k|            do
 5580|   294k|            {
 5581|       |                /* djb-rwth: removing redundant code */
 5582|   294k|                for (taut_found = 0;
 5583|   299k|                      0 < ( ret = MarkTautomerGroups( pCG, at, num_atoms,
  ------------------
  |  Branch (5583:23): [True: 5.55k, False: 294k]
  ------------------
 5584|   299k|                                                      t_group_info, c_group_info,
 5585|   299k|                                                      pBNS, pBD ) );
 5586|   294k|                      taut_found++)
 5587|  5.55k|                {
 5588|  5.55k|                    ;
 5589|  5.55k|                }
 5590|   294k|                if (ret < 0)
  ------------------
  |  Branch (5590:21): [True: 3, False: 294k]
  ------------------
 5591|      3|                {
 5592|      3|                    bError = ret;
 5593|      3|                }
 5594|   294k|                if (taut_found && !salt_pass)
  ------------------
  |  Branch (5594:21): [True: 5.38k, False: 288k]
  |  Branch (5594:35): [True: 5.34k, False: 41]
  ------------------
 5595|  5.34k|                {
 5596|  5.34k|                    *pbTautFlagsDone |= TG_FLAG_TEST_TAUT__ATOMS_DONE;
  ------------------
  |  |  963|  5.34k|#define TG_FLAG_TEST_TAUT__ATOMS_DONE    0x00000002
  ------------------
 5597|  5.34k|                }
 5598|       |
 5599|   294k|                if (taut_found || salt_found)
  ------------------
  |  Branch (5599:21): [True: 5.38k, False: 288k]
  |  Branch (5599:35): [True: 98, False: 288k]
  ------------------
 5600|  5.48k|                {
 5601|       |                    /****************** repeat bonds normalization ***************/
 5602|  5.48k|                    ret = ReInitBnStructAddGroups( pCG, pBNS, at, num_atoms,
 5603|  5.48k|                                                   t_group_info, c_group_info );
 5604|  5.48k|                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  5.48k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  5.48k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  5.48k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  5.48k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 5.48k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 5.48k]
  |  |  ------------------
  ------------------
 5605|      0|                    {
 5606|      0|                        bError = ret;
 5607|      0|                        goto exit_function;
 5608|      0|                    }
 5609|  5.48k|#if ( BNS_RAD_SEARCH == 1 )
 5610|       |#else
 5611|       |                    /* discovered moveable charges and H-atoms may allow to cancel radicals */
 5612|       |                    if (pBNS->tot_st_cap > pBNS->tot_st_flow)
 5613|       |                    {
 5614|       |                        ret = BnsAdjustFlowBondsRad( pBNS, pBD, at, num_atoms );
 5615|       |                        if (IS_BNS_ERROR( ret ))
 5616|       |                        {
 5617|       |                            bError = ret;
 5618|       |                            goto exit_function;
 5619|       |                        }
 5620|       |                        if (ret > 0)
 5621|       |                        {
 5622|       |                            /*
 5623|       |                            pBNS->tot_st_flow += 2*ret;
 5624|       |                            ret = ReInitBnStruct( pBNS, at, num_atoms, 1 );
 5625|       |                            if ( IS_BNS_ERROR( ret ) ) {
 5626|       |                            bError = ret;
 5627|       |                            goto exit_function;
 5628|       |                            }
 5629|       |                            */
 5630|       |                            bError = BNS_RADICAL_ERR;
 5631|       |                            goto exit_function;
 5632|       |                        }
 5633|       |                    }
 5634|       |#endif
 5635|       |                    /****************** Update bonds normalization ***************/
 5636|  5.48k|                    if (*pbTautFlags & TG_FLAG_MOVE_POS_CHARGES)
  ------------------
  |  |  921|  5.48k|#define TG_FLAG_MOVE_POS_CHARGES         0x00000008   /* MOVE_CHARGES allow long-range movement of N(+), P(+) charges           */
  ------------------
  |  Branch (5636:25): [True: 5.48k, False: 0]
  ------------------
 5637|  5.48k|                    {
 5638|       |                        /******************* Find moveable charges ***************/
 5639|  5.48k|                        do
 5640|  5.55k|                        {
 5641|       |                            /* Cycling while ret>0 added 2004-06-04 */
 5642|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5643|       |                            pBNS->edge_forbidden_mask |= BNS_EDGE_FORBIDDEN_TEMP;
 5644|       |                            CorrectFixing_NH_NH_Bonds( pBNS, at, num_atoms );
 5645|       |#endif
 5646|       |
 5647|  5.55k|                            ret = MarkChargeGroups( pCG, at, num_atoms,
 5648|  5.55k|                                                    c_group_info, t_group_info,
 5649|  5.55k|                                                    pBNS, pBD );
 5650|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5651|       |                            pBNS->edge_forbidden_mask &= ~BNS_EDGE_FORBIDDEN_TEMP;
 5652|       |#endif
 5653|  5.55k|                            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  5.55k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  5.55k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  5.55k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  5.55k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 5.55k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 5.55k]
  |  |  ------------------
  ------------------
 5654|      0|                            {
 5655|      0|                                bError = ret;
 5656|      0|                                goto exit_function;
 5657|      0|                            }
 5658|  5.55k|                            nChanges += ret;
 5659|  5.55k|                            if (ret > 0)
  ------------------
  |  Branch (5659:33): [True: 63, False: 5.48k]
  ------------------
 5660|     63|                            {
 5661|     63|                                ret2 = ReInitBnStructAddGroups( pCG, pBNS,
 5662|     63|                                                                at, num_atoms,
 5663|     63|                                                                t_group_info,
 5664|     63|                                                                c_group_info );
 5665|     63|                                if (IS_BNS_ERROR( ret2 ))
  ------------------
  |  |   67|     63|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|     63|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|     63|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|     63|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 63, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 63]
  |  |  ------------------
  ------------------
 5666|      0|                                {
 5667|      0|                                    bError = ret2;
 5668|      0|                                    goto exit_function;
 5669|      0|                                }
 5670|     63|                                *pbTautFlagsDone |= TG_FLAG_MOVE_POS_CHARGES_DONE;
  ------------------
  |  |  966|     63|#define TG_FLAG_MOVE_POS_CHARGES_DONE    0x00000010
  ------------------
 5671|     63|                            }
 5672|  5.55k|                        } while (ret > 0);
  ------------------
  |  Branch (5672:34): [True: 63, False: 5.48k]
  ------------------
 5673|  5.48k|                    }
 5674|       |
 5675|       |                    /************************************************************************/
 5676|       |                    /********             Find moveable bonds:                 **************/
 5677|       |                    /********          test bonds for bond tautomerism         **************/
 5678|       |                    /******** replace moveable bonds with "alternating" bonds  **************/
 5679|       |                    /************************************************************************/
 5680|  5.48k|                    ret = BnsTestAndMarkAltBonds( pBNS, pBD, at, num_atoms, fcd, bChangeFlow, 0 );
 5681|  5.48k|                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  5.48k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  5.48k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  5.48k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  5.48k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 5.48k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 5.48k]
  |  |  ------------------
  ------------------
 5682|      0|                    {
 5683|      0|                        bError = ret;
 5684|      0|                        goto exit_function;
 5685|      0|                    }
 5686|  5.48k|                    nChanges += ret;
 5687|       |                    /****************** End of update bonds normalization ***************/
 5688|       |
 5689|  5.48k|                }
 5690|   294k|                salt_found = 0;
 5691|   294k|            } while (taut_found && !bError);
  ------------------
  |  Branch (5691:22): [True: 5.38k, False: 288k]
  |  Branch (5691:36): [True: 5.38k, False: 0]
  ------------------
 5692|       |
 5693|       |
 5694|       |            /**************** Regular bond/H/(-)/positive charges tautomerism cycle end **************/
 5695|       |
 5696|   288k|            if (bError)
  ------------------
  |  Branch (5696:17): [True: 3, False: 288k]
  ------------------
 5697|      3|            {
 5698|      3|                break;
 5699|      3|            }
 5700|       |
 5701|       |
 5702|       |            /******************* 'Salt' tautomerism permitted *************************/
 5703|   288k|            if (*pbTautFlags & TG_FLAG_TEST_TAUT__SALTS)
  ------------------
  |  |  920|   288k|#define TG_FLAG_TEST_TAUT__SALTS         0x00000004   /* DISCONNECT_SALTS if possible find long-range H/(-) taut. on =C-OH, >C=O    */
  ------------------
  |  Branch (5703:17): [True: 252k, False: 36.3k]
  ------------------
 5704|   252k|            {
 5705|       |
 5706|   252k|                if (*pbTautFlags & TG_FLAG_TEST_TAUT2_SALTS)
  ------------------
  |  |  922|   252k|#define TG_FLAG_TEST_TAUT2_SALTS         0x00000010   /* TEST_REMOVE_S_ATOMS multi-attachement long-range H/(-) taut. on =C-OH, >C=O   */
  ------------------
  |  Branch (5706:21): [True: 252k, False: 0]
  ------------------
 5707|   252k|                {
 5708|       |                    /*********** Requested one or more "salt" attachement migrartion test ********/
 5709|   252k|                    if (!nChanges && salt_pass && salt_step)
  ------------------
  |  Branch (5709:25): [True: 247k, False: 5.24k]
  |  Branch (5709:38): [True: 125, False: 246k]
  |  Branch (5709:51): [True: 13, False: 112]
  ------------------
 5710|     13|                    {
 5711|     13|                        break;  /* done */
 5712|     13|                    }
 5713|   252k|                    if (!salt_step)
  ------------------
  |  Branch (5713:25): [True: 252k, False: 4]
  ------------------
 5714|   252k|                    {
 5715|       |                        /* Salt step 0: process one attachment migrartion */
 5716|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5717|       |                        pBNS->edge_forbidden_mask |= BNS_EDGE_FORBIDDEN_TEMP;
 5718|       |                        CorrectFixing_NH_NH_Bonds( pBNS, at, num_atoms );
 5719|       |#endif
 5720|   252k|                        salt_found = MarkSaltChargeGroups( pCG, at, num_atoms,
 5721|   252k|                                                           s_group_info,
 5722|   252k|                                                           t_group_info,
 5723|   252k|                                                           c_group_info,
 5724|   252k|                                                           pBNS, pBD );
 5725|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5726|       |                        pBNS->edge_forbidden_mask &= ~BNS_EDGE_FORBIDDEN_TEMP;
 5727|       |#endif
 5728|   252k|                        if (salt_found < 0)
  ------------------
  |  Branch (5728:29): [True: 0, False: 252k]
  ------------------
 5729|      0|                        {
 5730|      0|                            bError = salt_found;
 5731|      0|                            break;
 5732|      0|                        }
 5733|   252k|                        else
 5734|   252k|                        {
 5735|   252k|                            if (salt_found > 0)
  ------------------
  |  Branch (5735:33): [True: 118, False: 252k]
  ------------------
 5736|    118|                            {
 5737|    118|                                *pbTautFlagsDone |= TG_FLAG_TEST_TAUT__SALTS_DONE;
  ------------------
  |  |  965|    118|#define TG_FLAG_TEST_TAUT__SALTS_DONE    0x00000008   /* multiple H tautomerism */
  ------------------
 5738|    118|                            }
 5739|   252k|                        }
 5740|   252k|                        salt_step = !salt_found;
 5741|       |                        /* if new 'salt' atoms have been found then repeat regular taut. search
 5742|       |                        *      MarkTautomerGroups() and do not perform salt step 1
 5743|       |                        * if new 'salt' atoms have NOT been found then switch to salt step 1
 5744|       |                        *      and never repeat salt step 0 for the current structure
 5745|       |                        */
 5746|   252k|                    }
 5747|       |
 5748|   252k|                    if (salt_step /*||
  ------------------
  |  Branch (5748:25): [True: 252k, False: 118]
  ------------------
 5749|   252k|                                  (t_group_info->tni.bNormalizationFlags & FLAG_NORM_CONSIDER_TAUT)*/)
 5750|   252k|                    {
 5751|       |                        /* Salt step 1: process more than one attachment migration */
 5752|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5753|       |                        pBNS->edge_forbidden_mask |= BNS_EDGE_FORBIDDEN_TEMP;
 5754|       |                        CorrectFixing_NH_NH_Bonds( pBNS, at, num_atoms );
 5755|       |#endif
 5756|   252k|                        salt_found = MarkSaltChargeGroups2( pCG, at, num_atoms,
 5757|   252k|                                                            s_group_info,
 5758|   252k|                                                            t_group_info,
 5759|   252k|                                                            c_group_info,
 5760|   252k|                                                            pBNS, pBD );
 5761|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5762|       |                        pBNS->edge_forbidden_mask &= ~BNS_EDGE_FORBIDDEN_TEMP;
 5763|       |#endif
 5764|   252k|                        if (salt_found < 0)
  ------------------
  |  Branch (5764:29): [True: 0, False: 252k]
  ------------------
 5765|      0|                        {
 5766|      0|                            bError = salt_found;
 5767|      0|                            break;
 5768|      0|                        }
 5769|   252k|                        else
 5770|   252k|                        {
 5771|   252k|                            if (salt_found == 1 || salt_found == 5)
  ------------------
  |  Branch (5771:33): [True: 0, False: 252k]
  |  Branch (5771:52): [True: 17, False: 252k]
  ------------------
 5772|     17|                            {
 5773|     17|                                *pbTautFlagsDone |= TG_FLAG_TEST_TAUT2_SALTS_DONE;
  ------------------
  |  |  967|     17|#define TG_FLAG_TEST_TAUT2_SALTS_DONE    0x00000020   /* merged t-groups */
  ------------------
 5774|     17|                                if (salt_found == 5)
  ------------------
  |  Branch (5774:37): [True: 17, False: 0]
  ------------------
 5775|     17|                                {
 5776|     17|                                    *pbTautFlagsDone |= TG_FLAG_TEST_TAUT3_SALTS_DONE;
  ------------------
  |  |  979|     17|#define TG_FLAG_TEST_TAUT3_SALTS_DONE    0x00001000   /* merged t-groups + non-O taut atoms */
  ------------------
 5777|     17|                                }
 5778|       |                                /* salt_found == 2 => only negative charges involved */
 5779|     17|                            }
 5780|   252k|                        }
 5781|   252k|                    }
 5782|       |
 5783|   252k|                    salt_pass++;
 5784|   252k|                }
 5785|      0|                else
 5786|      0|                {
 5787|       |                    /* !( *pbTautFlags & TG_FLAG_TEST_TAUT2_SALTS ) */
 5788|       |                    /*************** Requested only one attachement migration test **********/
 5789|      0|                    if (!nChanges && salt_pass)
  ------------------
  |  Branch (5789:25): [True: 0, False: 0]
  |  Branch (5789:38): [True: 0, False: 0]
  ------------------
 5790|      0|                    {
 5791|       |                        /* One attachment migration */
 5792|      0|                        break;
 5793|      0|                    }
 5794|       |                    /* Salt step 0: process one attachment migration */
 5795|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5796|       |                    pBNS->edge_forbidden_mask |= BNS_EDGE_FORBIDDEN_TEMP;
 5797|       |                    CorrectFixing_NH_NH_Bonds( pBNS, at, num_atoms );
 5798|       |#endif
 5799|      0|                    salt_found = MarkSaltChargeGroups( pCG, at, num_atoms,
 5800|      0|                                                       s_group_info,
 5801|      0|                                                       t_group_info,
 5802|      0|                                                       c_group_info,
 5803|      0|                                                       pBNS, pBD );
 5804|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5805|       |                    pBNS->edge_forbidden_mask &= ~BNS_EDGE_FORBIDDEN_TEMP;
 5806|       |#endif
 5807|      0|                    if (salt_found < 0)
  ------------------
  |  Branch (5807:25): [True: 0, False: 0]
  ------------------
 5808|      0|                    {
 5809|      0|                        bError = salt_found;
 5810|      0|                        break;
 5811|      0|                    }
 5812|      0|                    else
 5813|      0|                    {
 5814|      0|                        if (salt_found > 0)
  ------------------
  |  Branch (5814:29): [True: 0, False: 0]
  ------------------
 5815|      0|                        {
 5816|      0|                            *pbTautFlagsDone |= TG_FLAG_TEST_TAUT__SALTS_DONE;
  ------------------
  |  |  965|      0|#define TG_FLAG_TEST_TAUT__SALTS_DONE    0x00000008   /* multiple H tautomerism */
  ------------------
 5817|      0|                        }
 5818|      0|                    }
 5819|      0|                    salt_pass++;
 5820|      0|                } /* ( *pbTautFlags & TG_FLAG_TEST_TAUT2_SALTS ) */
 5821|   252k|            } /* ( *pbTautFlags & TG_FLAG_TEST_TAUT__SALTS ) */
 5822|   288k|        } while (salt_found && !bError);
  ------------------
  |  Branch (5822:18): [True: 135, False: 288k]
  |  Branch (5822:32): [True: 135, False: 0]
  ------------------
 5823|       |
 5824|       |        /*************************************************************/
 5825|       |        /*                                                           */
 5826|       |        /*           M A I N   C Y C L E   E N D                     */
 5827|       |        /*                                                           */
 5828|       |        /*************************************************************/
 5829|       |
 5830|       |
 5831|   288k|        if (*pbTautFlags & TG_FLAG_MERGE_TAUT_SALTS)
  ------------------
  |  |  924|   288k|#define TG_FLAG_MERGE_TAUT_SALTS         0x00000040   /* DISCONNECT_SALTS merge all "salt"-t-groups and other =C-OH into one t-group */
  ------------------
  |  Branch (5831:13): [True: 252k, False: 36.3k]
  ------------------
 5832|   252k|        {
 5833|   252k|            if (!bError && s_group_info /*&& s_group_info->num_candidates > 0*/)
  ------------------
  |  Branch (5833:17): [True: 252k, False: 3]
  |  Branch (5833:28): [True: 252k, False: 0]
  ------------------
 5834|   252k|            {
 5835|   252k|                ret = MergeSaltTautGroups( pCG, at, num_atoms, s_group_info,
 5836|   252k|                                           t_group_info, c_group_info, pBNS );
 5837|   252k|                if (ret < 0)
  ------------------
  |  Branch (5837:21): [True: 5, False: 252k]
  ------------------
 5838|      5|                {
 5839|      5|                    bError = ret;
 5840|      5|                }
 5841|   252k|                else
 5842|   252k|                {
 5843|   252k|                    if (ret > 0)
  ------------------
  |  Branch (5843:25): [True: 262, False: 251k]
  ------------------
 5844|    262|                    {
 5845|    262|                        *pbTautFlagsDone |= TG_FLAG_MERGE_TAUT_SALTS_DONE;
  ------------------
  |  |  969|    262|#define TG_FLAG_MERGE_TAUT_SALTS_DONE    0x00000080   /* added non-taut O to taut groups */
  ------------------
 5846|    262|                    }
 5847|   252k|                }
 5848|   252k|            }
 5849|   252k|        }
 5850|       |
 5851|   288k|        if (!bError && t_group_info &&
  ------------------
  |  Branch (5851:13): [True: 288k, False: 8]
  |  Branch (5851:24): [True: 252k, False: 36.3k]
  ------------------
 5852|   252k|            ( t_group_info->bTautFlags & TG_FLAG_VARIABLE_PROTONS ) &&
  ------------------
  |  |  935|   252k|#define TG_FLAG_VARIABLE_PROTONS         0x00000800   /* add/remove protons to neutralize */
  ------------------
  |  Branch (5852:13): [True: 252k, False: 0]
  ------------------
 5853|   252k|             ( t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE | TG_FLAG_FOUND_ISOTOPIC_H_DONE ) ))
  ------------------
  |  |  982|   252k|#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 ) ))
  ------------------
  |  |  981|   252k|#define TG_FLAG_FOUND_ISOTOPIC_H_DONE    0x00004000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  |  Branch (5853:14): [True: 4.89k, False: 247k]
  ------------------
 5854|  4.89k|        {
 5855|  4.89k|            ret = MakeIsotopicHGroup( at, num_atoms, s_group_info, t_group_info );
 5856|  4.89k|            if (ret < 0)
  ------------------
  |  Branch (5856:17): [True: 0, False: 4.89k]
  ------------------
 5857|      0|            {
 5858|      0|                bError = ret;
 5859|      0|            }
 5860|  4.89k|        }
 5861|       |
 5862|       |        /* Success */
 5863|       |
 5864|   288k|        remove_alt_bond_marks( at, num_atoms );
 5865|       |
 5866|       |        /************************************************
 5867|       |        *  Temporarily ignore all non-alternating bonds
 5868|       |        *  and mark non-ring alt bonds non-stereogenic
 5869|       |        ************************************************/
 5870|       |
 5871|   288k|        ReInitBnStructForAltBns( pBNS, at, num_atoms, 0 );
 5872|   288k|        MarkRingSystemsAltBns( pBNS, 0 );
 5873|   288k|        MarkNonStereoAltBns( pBNS, at, num_atoms, 0 );
 5874|       |#if ( FIX_EITHER_DB_AS_NONSTEREO == 1 )
 5875|       |        /* second time unknown ("Either") alternating bonds are treated as non-stereogenic */
 5876|       |        /* stereobonds bonds that lost stereo get "Either" stereo_type */
 5877|       |        ReInitBnStructForAltBns( pBNS, at, num_atoms, 1 );
 5878|       |        MarkRingSystemsAltBns( pBNS, 1 );
 5879|       |        MarkNonStereoAltBns( pBNS, at, num_atoms, 1 );
 5880|       |#endif
 5881|   288k|    }
 5882|      0|    else
 5883|      0|    {
 5884|      0|        bError = BNS_OUT_OF_RAM;
  ------------------
  |  |   49|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 5885|       |        /*printf("BNS_OUT_OF_RAM-3\n");*/
 5886|      0|    }
 5887|       |
 5888|       |    /*(@nnuk : Nauman Ullah Khan) */
 5889|   288k|    LOG_NO_ARGS("\n################# Modified state after (De)Protonation (L6014:ichi_bns.c) ################\n");
 5890|  1.38M|    for (at_prot = 0; at_prot < num_atoms; at_prot++)
  ------------------
  |  Branch (5890:23): [True: 1.09M, False: 288k]
  ------------------
 5891|  1.09M|    {
 5892|  1.09M|        LOG_MULT_ARGS("Atom %d: Element: %s, Num_H: %d, Charge: %hhd, Radical: %d\n", at_prot, at[at_prot].elname, at[at_prot].num_H, at[at_prot].charge, at[at_prot].radical);
 5893|  1.09M|    }
 5894|   288k|    LOG_NO_ARGS("\n##########################################################################################\n");
 5895|       |
 5896|   288k|exit_function:
 5897|       |
 5898|       |    /* djb-rwth: ignoring LLVM warning: variables used to store functions return values */
 5899|   288k|    pBNS = DeAllocateBnStruct(pBNS);
 5900|   288k|    pBD = DeAllocateBnData(pBD);
 5901|       |    /*#if ( MOVE_CHARGES == 1 )*/
 5902|   288k|    if (c_group_info)
  ------------------
  |  Branch (5902:9): [True: 288k, False: 0]
  ------------------
 5903|   288k|    {
 5904|   288k|        if (c_group_info->c_group)
  ------------------
  |  Branch (5904:13): [True: 103k, False: 184k]
  ------------------
 5905|   103k|        {
 5906|   103k|            inchi_free( c_group_info->c_group );
  ------------------
  |  | 1152|   103k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 103k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 103k]
  |  |  ------------------
  ------------------
 5907|   103k|        }
 5908|   288k|        if (c_group_info->c_candidate)
  ------------------
  |  Branch (5908:13): [True: 103k, False: 184k]
  ------------------
 5909|   103k|        {
 5910|   103k|            inchi_free( c_group_info->c_candidate );
  ------------------
  |  | 1152|   103k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 103k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 103k]
  |  |  ------------------
  ------------------
 5911|   103k|        }
 5912|   288k|    }
 5913|       |    /*#endif*/
 5914|   288k|    if (s_group_info && s_group_info->s_candidate)
  ------------------
  |  Branch (5914:9): [True: 288k, False: 0]
  |  Branch (5914:25): [True: 252k, False: 36.3k]
  ------------------
 5915|   252k|    {
 5916|   252k|        inchi_free( s_group_info->s_candidate );
  ------------------
  |  | 1152|   252k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 252k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 252k]
  |  |  ------------------
  ------------------
 5917|   252k|    }
 5918|   288k|    if (pAATG && pAATG->nMarkedAtom)
  ------------------
  |  Branch (5918:9): [True: 288k, False: 0]
  |  Branch (5918:18): [True: 59.9k, False: 228k]
  ------------------
 5919|  59.9k|    {
 5920|  59.9k|        inchi_free( pAATG->nMarkedAtom );
  ------------------
  |  | 1152|  59.9k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 59.9k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 59.9k]
  |  |  ------------------
  ------------------
 5921|  59.9k|        qzfree( pAATG->nEndPoint );
  ------------------
  |  | 1176|  59.9k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 0, False: 59.9k]
  |  |  |  Branch (1176:61): [Folded, False: 59.9k]
  |  |  ------------------
  ------------------
 5922|       |        /*qzfree( pAATG->nAtTypeTotals );*/ /* nAtTypeTotals is a stack array */
 5923|  59.9k|    }
 5924|   288k|    if (t_group_info && t_group_info->tGroupNumber)
  ------------------
  |  Branch (5924:9): [True: 252k, False: 36.3k]
  |  Branch (5924:25): [True: 252k, False: 0]
  ------------------
 5925|   252k|    {
 5926|   252k|        inchi_free( t_group_info->tGroupNumber );
  ------------------
  |  | 1152|   252k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 252k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 252k]
  |  |  ------------------
  ------------------
 5927|   252k|        t_group_info->tGroupNumber = NULL;
 5928|   252k|    }
 5929|       |
 5930|   288k|    if (!bError && num_atoms == 1 && at[0].at_type == ATT_PROTON && t_group_info && !t_group_info->tni.nNumRemovedExplicitH)
  ------------------
  |  |   43|   473k|#define ATT_PROTON 0x1000
  ------------------
  |  Branch (5930:9): [True: 288k, False: 12]
  |  Branch (5930:20): [True: 184k, False: 103k]
  |  Branch (5930:38): [True: 35.0k, False: 149k]
  |  Branch (5930:69): [True: 35.0k, False: 0]
  |  Branch (5930:85): [True: 35.0k, False: 0]
  ------------------
 5931|  35.0k|    {
 5932|       |        /* remove single isolated proton */
 5933|  35.0k|        t_group_info->tni.nNumRemovedProtons = 1;
 5934|  35.0k|        t_group_info->tni.bNormalizationFlags |= FLAG_PROTON_SINGLE_REMOVED;
  ------------------
  |  |  153|  35.0k|#define FLAG_PROTON_SINGLE_REMOVED     0x0080
  ------------------
 5935|  35.0k|        if (at[0].iso_atw_diff) 
  ------------------
  |  Branch (5935:13): [True: 586, False: 34.4k]
  ------------------
 5936|    586|        {
 5937|    586|#if ( FIX_CURE53_ISSUE_NULL_DEREFERENCE_MAKE_A_COPY_OF_T_GROUP_INFO==1 || defined(FIX_IMPOSSIBLE_H_ISOTOPE_BUG) )
 5938|    586|            if (0 < at[0].iso_atw_diff &&
  ------------------
  |  Branch (5938:17): [True: 584, False: 2]
  ------------------
 5939|    584|                at[0].iso_atw_diff <= NUM_H_ISOTOPES)
  ------------------
  |  |   25|    584|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (5939:17): [True: 584, False: 0]
  ------------------
 5940|    584|            {
 5941|    584|                t_group_info->tni.nNumRemovedProtonsIsotopic[at[0].iso_atw_diff - 1] ++;
 5942|    584|            }
 5943|       |#else
 5944|       |            t_group_info->tni.nNumRemovedProtonsIsotopic[at[0].iso_atw_diff - 1] ++;
 5945|       |#endif
 5946|    586|        }
 5947|  35.0k|        if (at_fixed_bonds_out)
  ------------------
  |  Branch (5947:13): [True: 35.0k, False: 0]
  ------------------
 5948|  35.0k|        {
 5949|  35.0k|            memcpy(at_fixed_bonds_out, at, num_atoms * sizeof(at_fixed_bonds_out[0]));
 5950|  35.0k|        }
 5951|       |        /*num_atoms --;*/
 5952|  35.0k|    }
 5953|       |
 5954|       |
 5955|       |    /*
 5956|       |    Additional currently unused info:
 5957|       |
 5958|       |    nOrigDelta > 0: original structure has been changed
 5959|       |    due to fiund augmenting path(s)
 5960|       |    nChanges   > 0: either alt. bonds or taut. groups have been found
 5961|       |    */
 5962|       |
 5963|   288k|#ifdef FIX_AROM_RADICAL        /* Added 2011-05-09 IPl */
 5964|   288k|    if (stored_radicals)
  ------------------
  |  Branch (5964:9): [True: 0, False: 288k]
  ------------------
 5965|      0|    {
 5966|      0|        inchi_free( stored_radicals );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5967|      0|    }
 5968|   288k|#endif
 5969|       |
 5970|   288k|    return bError ? bError : num_atoms;  /* ret = 0 => success, any other => error */
  ------------------
  |  Branch (5970:12): [True: 12, False: 288k]
  ------------------
 5971|   288k|}
nMaxFlow2Check:
 5976|   261k|{
 5977|   261k|    BNS_EDGE *pEdge = pBNS->edge + iedge;
 5978|   261k|    int       nMaxFlow = ( pEdge->cap & EDGE_FLOW_MASK ); /* edge cap */
  ------------------
  |  |  133|   261k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 5979|       |
 5980|   261k|    if (nMaxFlow > MAX_BOND_EDGE_CAP)
  ------------------
  |  |  123|   261k|#define MAX_BOND_EDGE_CAP           2  /* triple bond */
  ------------------
  |  Branch (5980:9): [True: 0, False: 261k]
  ------------------
 5981|      0|    {
 5982|      0|        nMaxFlow = MAX_BOND_EDGE_CAP;
  ------------------
  |  |  123|      0|#define MAX_BOND_EDGE_CAP           2  /* triple bond */
  ------------------
 5983|      0|    }
 5984|   261k|    return nMaxFlow;
 5985|   261k|}
nCurFlow2Check:
 5990|   261k|{
 5991|   261k|    BNS_EDGE *pEdge = pBNS->edge + iedge;
 5992|   261k|    int       nCurFlow = ( pEdge->flow & EDGE_FLOW_MASK ); /* edge flow */
  ------------------
  |  |  133|   261k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 5993|   261k|    return    nCurFlow;
 5994|   261k|}
nMinFlow2Check:
 5999|   261k|{
 6000|   261k|    BNS_EDGE *pEdge = pBNS->edge + iedge;
 6001|   261k|    Vertex    v1 = pEdge->neighbor1;
 6002|   261k|    Vertex    v2 = v1 ^ pEdge->neighbor12;
 6003|   261k|    int       f12 = ( pEdge->flow & EDGE_FLOW_MASK );
  ------------------
  |  |  133|   261k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6004|   261k|    int       rescap1, rescap2, rescap12, i, iedge_i;
 6005|       |
 6006|   261k|    if (f12 > 0)
  ------------------
  |  Branch (6006:9): [True: 90.7k, False: 170k]
  ------------------
 6007|  90.7k|    {
 6008|   262k|        for (i = 0, rescap1 = 0; i < pBNS->vert[v1].num_adj_edges; i++)
  ------------------
  |  Branch (6008:34): [True: 171k, False: 90.7k]
  ------------------
 6009|   171k|        {
 6010|   171k|            iedge_i = pBNS->vert[v1].iedge[i];
 6011|   171k|            if (iedge_i == iedge)
  ------------------
  |  Branch (6011:17): [True: 90.7k, False: 80.5k]
  ------------------
 6012|  90.7k|            {
 6013|  90.7k|                continue;
 6014|  90.7k|            }
 6015|  80.5k|            rescap1 += ( pBNS->edge[iedge_i].cap & EDGE_FLOW_MASK ) - ( pBNS->edge[iedge_i].flow & EDGE_FLOW_MASK );
  ------------------
  |  |  133|  80.5k|#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 );
  ------------------
  |  |  133|  80.5k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6016|  80.5k|        }
 6017|   311k|        for (i = 0, rescap2 = 0; i < pBNS->vert[v2].num_adj_edges; i++)
  ------------------
  |  Branch (6017:34): [True: 220k, False: 90.7k]
  ------------------
 6018|   220k|        {
 6019|   220k|            iedge_i = pBNS->vert[v2].iedge[i];
 6020|   220k|            if (iedge_i == iedge)
  ------------------
  |  Branch (6020:17): [True: 90.7k, False: 130k]
  ------------------
 6021|  90.7k|            {
 6022|  90.7k|                continue;
 6023|  90.7k|            }
 6024|   130k|            rescap2 += ( pBNS->edge[iedge_i].cap & EDGE_FLOW_MASK ) - ( pBNS->edge[iedge_i].flow & EDGE_FLOW_MASK );
  ------------------
  |  |  133|   130k|#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 );
  ------------------
  |  |  133|   130k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6025|   130k|        }
 6026|  90.7k|        rescap12 = inchi_min( rescap1, rescap2 );
  ------------------
  |  |  139|  90.7k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 28.9k, False: 61.8k]
  |  |  ------------------
  ------------------
 6027|  90.7k|        rescap12 = inchi_min( rescap12, f12 );
  ------------------
  |  |  139|  90.7k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 72.8k, False: 17.9k]
  |  |  ------------------
  ------------------
 6028|  90.7k|        return f12 - rescap12;
 6029|  90.7k|    }
 6030|       |
 6031|   170k|    return 0;
 6032|   261k|}
bSetBondsAfterCheckOneBond:
 6042|  27.7k|{
 6043|  27.7k|    int    ifcd, iedge, new_flow, ret_val, nChanges = 0, bError = 0;
 6044|  27.7k|    int    bChangeFlow;
 6045|  27.7k|    Vertex v1, v2;
 6046|  27.7k|    int    ineigh1, ineigh2;
 6047|  27.7k|    BNS_EDGE *pEdge;
 6048|       |
 6049|  27.7k|    bChangeFlow0 &= ~BNS_EF_CHNG_RSTR;  /* do not change pEdge flow in SetBondType */
  ------------------
  |  |  372|  27.7k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  27.7k|#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)
  |  |  ------------------
  |  |  |  |  371|  27.7k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
 6050|  27.7k|    if (!bChangeFlow0)
  ------------------
  |  Branch (6050:9): [True: 7.54k, False: 20.1k]
  ------------------
 6051|  7.54k|    {
 6052|  7.54k|        return 0;
 6053|  7.54k|    }
 6054|       |
 6055|  20.1k|    bChangeFlow = ( bChangeFlow0 & ~BNS_EF_SET_NOSTEREO );
  ------------------
  |  |  377|  20.1k|#define BNS_EF_SET_NOSTEREO  32  /* in combination with BNS_EF_ALTR_BONDS only:
  ------------------
 6056|       |
 6057|       |    /* Find the next to the last changed */
 6058|  20.1k|    if (bChangeFlow0 & BNS_EF_SET_NOSTEREO)
  ------------------
  |  |  377|  20.1k|#define BNS_EF_SET_NOSTEREO  32  /* in combination with BNS_EF_ALTR_BONDS only:
  ------------------
  |  Branch (6058:9): [True: 11.0k, False: 9.18k]
  ------------------
 6059|  11.0k|    {
 6060|  28.9k|        for (ifcd = 0; NO_VERTEX != ( iedge = fcd[ifcd].iedge ); ifcd++) /* djb-rwth: ignoring LLVM warning: variable used */
  ------------------
  |  |  118|  28.9k|#define NO_VERTEX    -2
  ------------------
  |  Branch (6060:24): [True: 17.9k, False: 11.0k]
  ------------------
 6061|  17.9k|        {
 6062|  17.9k|            iedge = fcd[ifcd].iedge;
 6063|  17.9k|            pEdge = pBNS->edge + iedge;
 6064|  17.9k|            if (!pEdge->pass)
  ------------------
  |  Branch (6064:17): [True: 0, False: 17.9k]
  ------------------
 6065|      0|            {
 6066|      0|                continue;
 6067|      0|            }
 6068|       |
 6069|  17.9k|            if (!ifcd && nTestFlow >= 0)
  ------------------
  |  Branch (6069:17): [True: 10.8k, False: 7.12k]
  |  Branch (6069:26): [True: 10.8k, False: 0]
  ------------------
 6070|  10.8k|            {
 6071|  10.8k|                new_flow = nTestFlow;
 6072|  10.8k|            }
 6073|  7.12k|            else
 6074|  7.12k|            {
 6075|  7.12k|                new_flow = (int) pEdge->flow;
 6076|  7.12k|            }
 6077|       |
 6078|  17.9k|            v1 = pEdge->neighbor1;
 6079|  17.9k|            v2 = pEdge->neighbor12 ^ v1;
 6080|  17.9k|            if (v1 < num_atoms && v2 < num_atoms && new_flow != pEdge->flow0)
  ------------------
  |  Branch (6080:17): [True: 17.9k, False: 0]
  |  Branch (6080:35): [True: 17.1k, False: 806]
  |  Branch (6080:53): [True: 16.9k, False: 130]
  ------------------
 6081|  16.9k|            {
 6082|  16.9k|                if (( pBNS->vert[v1].st_edge.cap0 == pBNS->vert[v1].st_edge.flow0 ) !=
  ------------------
  |  Branch (6082:21): [True: 6.24k, False: 10.7k]
  ------------------
 6083|  16.9k|                    ( pBNS->vert[v1].st_edge.cap == pBNS->vert[v1].st_edge.flow ) ||
 6084|  10.7k|                     ( pBNS->vert[v2].st_edge.cap0 == pBNS->vert[v2].st_edge.flow0 ) !=
  ------------------
  |  Branch (6084:22): [True: 2.59k, False: 8.15k]
  ------------------
 6085|  10.7k|                     ( pBNS->vert[v2].st_edge.cap == pBNS->vert[v2].st_edge.flow ))
 6086|  8.84k|                {
 6087|  8.84k|                    bChangeFlow |= BNS_EF_SET_NOSTEREO;
  ------------------
  |  |  377|  8.84k|#define BNS_EF_SET_NOSTEREO  32  /* in combination with BNS_EF_ALTR_BONDS only:
  ------------------
 6088|  8.84k|                    nChanges |= BNS_EF_SET_NOSTEREO;
  ------------------
  |  |  377|  8.84k|#define BNS_EF_SET_NOSTEREO  32  /* in combination with BNS_EF_ALTR_BONDS only:
  ------------------
 6089|  8.84k|                }
 6090|  16.9k|            }
 6091|  17.9k|        }
 6092|  11.0k|    }
 6093|  9.18k|    else
 6094|  9.18k|    {
 6095|  23.7k|        for (ifcd = 0; NO_VERTEX != ( iedge = fcd[ifcd].iedge ); ifcd++) /* djb-rwth: ignoring LLVM warning: variable used */
  ------------------
  |  |  118|  23.7k|#define NO_VERTEX    -2
  ------------------
  |  Branch (6095:24): [True: 14.5k, False: 9.18k]
  ------------------
 6096|  14.5k|        {
 6097|  14.5k|            ;
 6098|  14.5k|        }
 6099|  9.18k|    }
 6100|       |
 6101|       |    /* restore in reversed order to correctly handle vertex changed more than once */
 6102|  52.6k|    for (ifcd -= 1; 0 <= ifcd; ifcd--)
  ------------------
  |  Branch (6102:21): [True: 32.4k, False: 20.1k]
  ------------------
 6103|  32.4k|    {
 6104|       |
 6105|  32.4k|        iedge = fcd[ifcd].iedge;
 6106|  32.4k|        pEdge = pBNS->edge + iedge;
 6107|  32.4k|        if (!pEdge->pass)
  ------------------
  |  Branch (6107:13): [True: 1, False: 32.4k]
  ------------------
 6108|      1|        {
 6109|      1|            continue;
 6110|      1|        }
 6111|       |
 6112|  32.4k|        if (!ifcd && nTestFlow >= 0)
  ------------------
  |  Branch (6112:13): [True: 18.5k, False: 13.8k]
  |  Branch (6112:22): [True: 18.5k, False: 87]
  ------------------
 6113|  18.5k|        {
 6114|  18.5k|            new_flow = nTestFlow;
 6115|  18.5k|        }
 6116|  13.9k|        else
 6117|  13.9k|        {
 6118|  13.9k|            new_flow = (int) pEdge->flow;
 6119|  13.9k|        }
 6120|       |
 6121|  32.4k|        v1 = pEdge->neighbor1;
 6122|  32.4k|        v2 = pEdge->neighbor12 ^ v1;
 6123|  32.4k|        if (v1 < num_atoms && v2 < num_atoms && bChangeFlow && new_flow != pEdge->flow0)
  ------------------
  |  Branch (6123:13): [True: 32.4k, False: 0]
  |  Branch (6123:31): [True: 28.9k, False: 3.48k]
  |  Branch (6123:49): [True: 28.9k, False: 0]
  |  Branch (6123:64): [True: 28.6k, False: 298]
  ------------------
 6124|  28.6k|        {
 6125|  28.6k|            ineigh1 = pEdge->neigh_ord[0];
 6126|  28.6k|            ineigh2 = pEdge->neigh_ord[1];
 6127|  28.6k|            ret_val = SetAtomBondType( pEdge, &at[v1].bond_type[ineigh1], &at[v2].bond_type[ineigh2], new_flow - pEdge->flow0, bChangeFlow );
 6128|  28.6k|            if (!IS_BNS_ERROR( ret_val ))
  ------------------
  |  |   67|  28.6k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  28.6k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  28.6k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  28.6k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 28.6k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 28.6k]
  |  |  ------------------
  ------------------
 6129|  28.6k|            {
 6130|  28.6k|                nChanges |= ( ret_val > 0 );
 6131|  28.6k|            }
 6132|      0|            else
 6133|      0|            {
 6134|      0|                bError = ret_val;
 6135|      0|            }
 6136|  28.6k|        }
 6137|  32.4k|        pEdge->pass = 0;
 6138|  32.4k|    }
 6139|       |
 6140|  20.1k|    return bError ? bError : nChanges;
  ------------------
  |  Branch (6140:12): [True: 0, False: 20.1k]
  ------------------
 6141|  27.7k|}
bRestoreFlowAfterCheckOneBond:
 6146|  86.8k|{
 6147|  86.8k|    int ifcd, iedge;
 6148|  86.8k|    Vertex v1, v2;
 6149|  86.8k|    BNS_EDGE *pEdge;
 6150|       |
 6151|       |    /* Find the next to the last changed */
 6152|   228k|    for (ifcd = 0; NO_VERTEX != ( iedge = fcd[ifcd].iedge ); ifcd++) /* djb-rwth: ignoring LLVM warning: variable used */
  ------------------
  |  |  118|   228k|#define NO_VERTEX    -2
  ------------------
  |  Branch (6152:20): [True: 141k, False: 86.8k]
  ------------------
 6153|   141k|    {
 6154|   141k|        ;
 6155|   141k|    }
 6156|       |
 6157|       |    /* Restore in reversed order to correctly handle vertex changed more than once */
 6158|   228k|    for (ifcd -= 1; 0 <= ifcd; ifcd--)
  ------------------
  |  Branch (6158:21): [True: 141k, False: 86.8k]
  ------------------
 6159|   141k|    {
 6160|       |        /* Restore edge flow & cap */
 6161|   141k|        iedge = fcd[ifcd].iedge;
 6162|   141k|        pEdge = pBNS->edge + iedge;
 6163|   141k|        pEdge->flow = fcd[ifcd].flow;
 6164|   141k|        pEdge->cap = fcd[ifcd].cap;
 6165|   141k|        pEdge->pass = 0;
 6166|       |
 6167|       |        /* Restore st-flow, cap */
 6168|   141k|        if (NO_VERTEX != ( v1 = fcd[ifcd].v1 ))
  ------------------
  |  |  118|   141k|#define NO_VERTEX    -2
  ------------------
  |  Branch (6168:13): [True: 141k, False: 0]
  ------------------
 6169|   141k|        {
 6170|   141k|            pBNS->vert[v1].st_edge.flow = fcd[ifcd].flow_st1;
 6171|   141k|            pBNS->vert[v1].st_edge.cap = fcd[ifcd].cap_st1;
 6172|   141k|            pBNS->vert[v1].st_edge.pass = 0;
 6173|   141k|        }
 6174|   141k|        if (NO_VERTEX != ( v2 = fcd[ifcd].v2 ))
  ------------------
  |  |  118|   141k|#define NO_VERTEX    -2
  ------------------
  |  Branch (6174:13): [True: 66.2k, False: 75.2k]
  ------------------
 6175|  66.2k|        {
 6176|  66.2k|            pBNS->vert[v2].st_edge.flow = fcd[ifcd].flow_st2;
 6177|  66.2k|            pBNS->vert[v2].st_edge.cap = fcd[ifcd].cap_st2;
 6178|  66.2k|            pBNS->vert[v2].st_edge.pass = 0;
 6179|  66.2k|        }
 6180|   141k|    }
 6181|       |
 6182|  86.8k|    return 0;
 6183|  86.8k|}
bSetFlowToCheckOneBond:
 6191|  69.5k|{
 6192|  69.5k|    BNS_EDGE *pEdge = pBNS->edge + iedge;
 6193|  69.5k|    int       f12 = ( pEdge->flow & EDGE_FLOW_MASK ); /* the original flow */
  ------------------
  |  |  133|  69.5k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6194|  69.5k|    int       ifcd = 0;
 6195|  69.5k|    int       nDots = 0;
 6196|  69.5k|    int       i, iedge_i;
 6197|       |
 6198|  69.5k|    fcd[ifcd].iedge = NO_VERTEX;
  ------------------
  |  |  118|  69.5k|#define NO_VERTEX    -2
  ------------------
 6199|       |
 6200|  69.5k|    if (f12 < flow)
  ------------------
  |  Branch (6200:9): [True: 42.0k, False: 27.4k]
  ------------------
 6201|  42.0k|    {
 6202|       |        /* Increase edge flow: Grab flow from the neighbors and delete it: set flow12=cap12 = 0 */
 6203|       |        /************************************************************************************/
 6204|       |        /* For example, simulate a new fixed double bond in place of a single bond and      */
 6205|       |        /* creates ONE or NONE (in case of a radical on adjacent atom) augmenting paths and */
 6206|       |        /* makes it impossible for the BNS to set same flow as it originally was            */
 6207|       |        /************************************************************************************/
 6208|  42.0k|        Vertex    v1 = pEdge->neighbor1;
 6209|  42.0k|        Vertex    v2 = v1 ^ pEdge->neighbor12;
 6210|  42.0k|        Vertex    v_i;        /* neighbor of v1 or v2 */
 6211|  42.0k|        BNS_EDGE *pEdge_i;
 6212|  42.0k|        int       delta1, delta2, f, st_edge_rescap;
 6213|       |
 6214|  42.0k|        if (( pBNS->vert[v1].st_edge.cap  & EDGE_FLOW_ST_MASK ) < flow ||
  ------------------
  |  |  128|  42.0k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (6214:13): [True: 1.72k, False: 40.3k]
  ------------------
 6215|  40.3k|            ( pBNS->vert[v2].st_edge.cap  & EDGE_FLOW_ST_MASK ) < flow)
  ------------------
  |  |  128|  40.3k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (6215:13): [True: 1.53k, False: 38.8k]
  ------------------
 6216|  3.25k|        {
 6217|  3.25k|            return BNS_CANT_SET_BOND;
  ------------------
  |  |   57|  3.25k|#define BNS_CANT_SET_BOND  (BNS_ERR +  9) /*(-9990)*/
  |  |  ------------------
  |  |  |  |   47|  3.25k|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6218|  3.25k|        }
 6219|  38.8k|        if (( pBNS->vert[v1].st_edge.flow & EDGE_FLOW_ST_MASK ) < f12 ||
  ------------------
  |  |  128|  38.8k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (6219:13): [True: 0, False: 38.8k]
  ------------------
 6220|  38.8k|            ( pBNS->vert[v2].st_edge.flow & EDGE_FLOW_ST_MASK ) < f12)
  ------------------
  |  |  128|  38.8k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (6220:13): [True: 0, False: 38.8k]
  ------------------
 6221|      0|        {
 6222|      0|            return BNS_CAP_FLOW_ERR;
  ------------------
  |  |   58|      0|#define BNS_CAP_FLOW_ERR   (BNS_ERR + 10) /*(-9989)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6223|      0|        }
 6224|       |
 6225|  38.8k|        fcd[ifcd].iedge = iedge;
 6226|  38.8k|        fcd[ifcd].flow = pEdge->flow;
 6227|  38.8k|        fcd[ifcd].cap = pEdge->cap;
 6228|       |
 6229|  38.8k|        fcd[ifcd].v1 = v1;
 6230|  38.8k|        fcd[ifcd].flow_st1 = pBNS->vert[v1].st_edge.flow;
 6231|  38.8k|        fcd[ifcd].cap_st1 = pBNS->vert[v1].st_edge.cap;
 6232|       |
 6233|  38.8k|        fcd[ifcd].v2 = v2;
 6234|  38.8k|        fcd[ifcd].flow_st2 = pBNS->vert[v2].st_edge.flow;
 6235|  38.8k|        fcd[ifcd].cap_st2 = pBNS->vert[v2].st_edge.cap;
 6236|       |
 6237|  38.8k|        fcd[++ifcd].iedge = NO_VERTEX; /* mark the end of the fcd[] data */
  ------------------
  |  |  118|  38.8k|#define NO_VERTEX    -2
  ------------------
 6238|  38.8k|        pEdge->pass |= 64;
 6239|       |
 6240|  38.8k|        delta1 = delta2 = flow - f12;
 6241|       |
 6242|  38.8k|        if (f12 > 0)
  ------------------
  |  Branch (6242:13): [True: 3.37k, False: 35.4k]
  ------------------
 6243|  3.37k|        {
 6244|       |            /* Remove old edge flow from the flow and cap of the adjacent vertices' st-edges */
 6245|  3.37k|            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 );
  ------------------
  |  |  128|  3.37k|#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 );
  ------------------
  |  |  128|  3.37k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6246|  3.37k|            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 );
  ------------------
  |  |  128|  3.37k|#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 );
  ------------------
  |  |  128|  3.37k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6247|  3.37k|            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 );
  ------------------
  |  |  128|  3.37k|#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 );
  ------------------
  |  |  128|  3.37k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6248|  3.37k|            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 );
  ------------------
  |  |  128|  3.37k|#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 );
  ------------------
  |  |  128|  3.37k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6249|       |            /* Delete current edge flow and capacity */
 6250|  3.37k|            pEdge->flow = ( pEdge->flow & ~EDGE_FLOW_MASK );
  ------------------
  |  |  133|  3.37k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6251|  3.37k|        }
 6252|  38.8k|        pEdge->cap = ( pEdge->cap  & ~EDGE_FLOW_MASK );
  ------------------
  |  |  133|  38.8k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6253|       |
 6254|       |        /* Grab the adjacent vertex1 radical (st_edge_rescap) if it exists */
 6255|  38.8k|        st_edge_rescap = ( pBNS->vert[v1].st_edge.cap & EDGE_FLOW_ST_MASK ) - ( pBNS->vert[v1].st_edge.flow & EDGE_FLOW_ST_MASK );
  ------------------
  |  |  128|  38.8k|#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 );
  ------------------
  |  |  128|  38.8k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6256|  39.6k|        while (st_edge_rescap && delta1)
  ------------------
  |  Branch (6256:16): [True: 855, False: 38.8k]
  |  Branch (6256:34): [True: 855, False: 0]
  ------------------
 6257|    855|        {
 6258|    855|            st_edge_rescap--;  /* grab the radical */
 6259|    855|            delta1--;
 6260|    855|            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 );
  ------------------
  |  |  128|    855|#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 );
  ------------------
  |  |  128|    855|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6261|    855|            nDots--;
 6262|    855|        }
 6263|       |
 6264|       |        /* Grab the adjacent vertex2 radical (st_edge_rescap) if it exists */
 6265|  38.8k|        st_edge_rescap = ( pBNS->vert[v2].st_edge.cap & EDGE_FLOW_ST_MASK ) - ( pBNS->vert[v2].st_edge.flow & EDGE_FLOW_ST_MASK );
  ------------------
  |  |  128|  38.8k|#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 );
  ------------------
  |  |  128|  38.8k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6266|  39.8k|        while (st_edge_rescap && delta2)
  ------------------
  |  Branch (6266:16): [True: 1.05k, False: 38.8k]
  |  Branch (6266:34): [True: 1.05k, False: 0]
  ------------------
 6267|  1.05k|        {
 6268|  1.05k|            st_edge_rescap--;  /* grab the radical */
 6269|  1.05k|            delta2--;
 6270|  1.05k|            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 );
  ------------------
  |  |  128|  1.05k|#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 );
  ------------------
  |  |  128|  1.05k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6271|  1.05k|            nDots--;
 6272|  1.05k|        }
 6273|       |
 6274|       |        /* Grab flows from v1 neighbors */
 6275|  96.3k|        for (i = 0; delta1 && i < pBNS->vert[v1].num_adj_edges; i++)
  ------------------
  |  Branch (6275:21): [True: 58.3k, False: 37.9k]
  |  Branch (6275:31): [True: 57.5k, False: 868]
  ------------------
 6276|  57.5k|        {
 6277|  57.5k|            iedge_i = pBNS->vert[v1].iedge[i];
 6278|  57.5k|            if (iedge_i == iedge)
  ------------------
  |  Branch (6278:17): [True: 12.6k, False: 44.9k]
  ------------------
 6279|  12.6k|            {
 6280|  12.6k|                continue;
 6281|  12.6k|            }
 6282|  44.9k|            pEdge_i = pBNS->edge + iedge_i;
 6283|  44.9k|            if (IS_FORBIDDEN( pEdge_i->forbidden, pBNS ))
  ------------------
  |  |   41|  44.9k|#define IS_FORBIDDEN(EDGE_FORBIDDEN, PBNS)     (EDGE_FORBIDDEN)
  |  |  ------------------
  |  |  |  Branch (41:48): [True: 941, False: 43.9k]
  |  |  ------------------
  ------------------
 6284|    941|            {
 6285|    941|                continue;
 6286|    941|            }
 6287|  43.9k|            f = ( pEdge_i->flow & EDGE_FLOW_MASK );
  ------------------
  |  |  133|  43.9k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6288|  43.9k|            if (f)
  ------------------
  |  Branch (6288:17): [True: 37.4k, False: 6.49k]
  ------------------
 6289|  37.4k|            {
 6290|  37.4k|                v_i = pEdge_i->neighbor12 ^ v1;
 6291|       |
 6292|  37.4k|                fcd[ifcd].iedge = iedge_i;
 6293|  37.4k|                fcd[ifcd].flow = pEdge_i->flow;
 6294|  37.4k|                fcd[ifcd].cap = pEdge_i->cap;
 6295|       |
 6296|  37.4k|                fcd[ifcd].v1 = v_i;
 6297|  37.4k|                fcd[ifcd].flow_st1 = pBNS->vert[v_i].st_edge.flow;
 6298|  37.4k|                fcd[ifcd].cap_st1 = pBNS->vert[v_i].st_edge.cap;
 6299|       |
 6300|  37.4k|                fcd[ifcd].v2 = NO_VERTEX;
  ------------------
  |  |  118|  37.4k|#define NO_VERTEX    -2
  ------------------
 6301|  37.4k|                fcd[ifcd].flow_st2 = 0;
 6302|  37.4k|                fcd[ifcd].cap_st2 = 0;
 6303|       |
 6304|  37.4k|                fcd[++ifcd].iedge = NO_VERTEX; /* mark the end of the fcd[] data */
  ------------------
  |  |  118|  37.4k|#define NO_VERTEX    -2
  ------------------
 6305|  37.4k|                pEdge_i->pass |= 64;
 6306|       |
 6307|  79.2k|                while (f && delta1)
  ------------------
  |  Branch (6307:24): [True: 50.4k, False: 28.8k]
  |  Branch (6307:29): [True: 41.7k, False: 8.64k]
  ------------------
 6308|  41.7k|                {
 6309|  41.7k|                    f--;
 6310|  41.7k|                    delta1--;
 6311|  41.7k|                    pEdge_i->flow = ( ( pEdge_i->flow & EDGE_FLOW_MASK ) - 1 ) | ( pEdge_i->flow & ~EDGE_FLOW_MASK );
  ------------------
  |  |  133|  41.7k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
                                  pEdge_i->flow = ( ( pEdge_i->flow & EDGE_FLOW_MASK ) - 1 ) | ( pEdge_i->flow & ~EDGE_FLOW_MASK );
  ------------------
  |  |  133|  41.7k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6312|  41.7k|                    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 );
  ------------------
  |  |  128|  41.7k|#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 );
  ------------------
  |  |  128|  41.7k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6313|       |                    /* next 2 lines added 01-22-2002 */
 6314|  41.7k|                    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 );
  ------------------
  |  |  128|  41.7k|#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 );
  ------------------
  |  |  128|  41.7k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6315|  41.7k|                    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 );
  ------------------
  |  |  128|  41.7k|#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 );
  ------------------
  |  |  128|  41.7k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6316|       |
 6317|  41.7k|                    nDots++;
 6318|  41.7k|                }
 6319|  37.4k|            }
 6320|  43.9k|        }
 6321|       |
 6322|       |        /* Grab flows from v2 neighbors */
 6323|   109k|        for (i = 0; delta2 && i < pBNS->vert[v2].num_adj_edges; i++)
  ------------------
  |  Branch (6323:21): [True: 72.1k, False: 37.6k]
  |  Branch (6323:31): [True: 70.9k, False: 1.18k]
  ------------------
 6324|  70.9k|        {
 6325|  70.9k|            iedge_i = pBNS->vert[v2].iedge[i];
 6326|  70.9k|            if (iedge_i == iedge)
  ------------------
  |  Branch (6326:17): [True: 21.1k, False: 49.8k]
  ------------------
 6327|  21.1k|            {
 6328|  21.1k|                continue;
 6329|  21.1k|            }
 6330|  49.8k|            pEdge_i = pBNS->edge + iedge_i;
 6331|  49.8k|            if (IS_FORBIDDEN( pEdge_i->forbidden, pBNS ))
  ------------------
  |  |   41|  49.8k|#define IS_FORBIDDEN(EDGE_FORBIDDEN, PBNS)     (EDGE_FORBIDDEN)
  |  |  ------------------
  |  |  |  Branch (41:48): [True: 1.37k, False: 48.4k]
  |  |  ------------------
  ------------------
 6332|  1.37k|            {
 6333|  1.37k|                continue;
 6334|  1.37k|            }
 6335|  48.4k|            f = ( pEdge_i->flow & EDGE_FLOW_MASK );
  ------------------
  |  |  133|  48.4k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6336|  48.4k|            if (f)
  ------------------
  |  Branch (6336:17): [True: 37.8k, False: 10.6k]
  ------------------
 6337|  37.8k|            {
 6338|  37.8k|                v_i = pEdge_i->neighbor12 ^ v2;
 6339|       |
 6340|  37.8k|                fcd[ifcd].iedge = iedge_i;
 6341|  37.8k|                fcd[ifcd].flow = pEdge_i->flow;
 6342|  37.8k|                fcd[ifcd].cap = pEdge_i->cap;
 6343|       |
 6344|  37.8k|                fcd[ifcd].v1 = v_i;
 6345|  37.8k|                fcd[ifcd].flow_st1 = pBNS->vert[v_i].st_edge.flow;
 6346|  37.8k|                fcd[ifcd].cap_st1 = pBNS->vert[v_i].st_edge.cap;
 6347|       |
 6348|  37.8k|                fcd[ifcd].v2 = NO_VERTEX;
  ------------------
  |  |  118|  37.8k|#define NO_VERTEX    -2
  ------------------
 6349|  37.8k|                fcd[ifcd].flow_st2 = 0;
 6350|  37.8k|                fcd[ifcd].cap_st2 = 0;
 6351|       |
 6352|  37.8k|                fcd[++ifcd].iedge = NO_VERTEX; /* mark the end of the fcd[] data */
  ------------------
  |  |  118|  37.8k|#define NO_VERTEX    -2
  ------------------
 6353|  37.8k|                pEdge_i->pass |= 64;
 6354|       |
 6355|  79.0k|                while (f && delta2)
  ------------------
  |  Branch (6355:24): [True: 49.1k, False: 29.9k]
  |  Branch (6355:29): [True: 41.2k, False: 7.90k]
  ------------------
 6356|  41.2k|                {
 6357|  41.2k|                    f--;
 6358|  41.2k|                    delta2--;
 6359|  41.2k|                    pEdge_i->flow = ( ( pEdge_i->flow & EDGE_FLOW_MASK ) - 1 ) | ( pEdge_i->flow & ~EDGE_FLOW_MASK );
  ------------------
  |  |  133|  41.2k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
                                  pEdge_i->flow = ( ( pEdge_i->flow & EDGE_FLOW_MASK ) - 1 ) | ( pEdge_i->flow & ~EDGE_FLOW_MASK );
  ------------------
  |  |  133|  41.2k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6360|  41.2k|                    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 );
  ------------------
  |  |  128|  41.2k|#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 );
  ------------------
  |  |  128|  41.2k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6361|       |                    /* next 2 lines added 01-22-2002 */
 6362|  41.2k|                    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 );
  ------------------
  |  |  128|  41.2k|#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 );
  ------------------
  |  |  128|  41.2k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6363|  41.2k|                    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 );
  ------------------
  |  |  128|  41.2k|#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 );
  ------------------
  |  |  128|  41.2k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6364|       |
 6365|  41.2k|                    nDots++;
 6366|  41.2k|                }
 6367|  37.8k|            }
 6368|  48.4k|        }
 6369|  38.8k|        if (delta1 || delta2)
  ------------------
  |  Branch (6369:13): [True: 868, False: 37.9k]
  |  Branch (6369:23): [True: 1.04k, False: 36.9k]
  ------------------
 6370|  1.91k|        {
 6371|  1.91k|            return BNS_CANT_SET_BOND;
  ------------------
  |  |   57|  1.91k|#define BNS_CANT_SET_BOND  (BNS_ERR +  9) /*(-9990)*/
  |  |  ------------------
  |  |  |  |   47|  1.91k|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6372|  1.91k|        }
 6373|  38.8k|    }
 6374|       |
 6375|  64.3k|    if (f12 >= flow)
  ------------------
  |  Branch (6375:9): [True: 27.4k, False: 36.9k]
  ------------------
 6376|  27.4k|    {
 6377|       |        /* Decrease edge flow: Redirect flow to the neighbors and delete it on the edge: set flow12=cap12 = 0 */
 6378|       |        /* f12==flow fixes flow through the edge so that BNS cannot change it */
 6379|       |        /**********************************************************************************************/
 6380|       |        /* For example, simulate a removal of a double bond and create ONE or NONE augmenting path    */
 6381|       |        /* Make it impossible for BNS to set same flow as it originally was                           */
 6382|       |        /**********************************************************************************************/
 6383|  27.4k|        Vertex    v1 = pEdge->neighbor1;
 6384|  27.4k|        Vertex    v2 = ( v1 ^ pEdge->neighbor12 );
 6385|  27.4k|        int       delta;
 6386|       |        /* if NOT (st-cap >= st-flow >= f12 >= flow) then error in the BN structure */
 6387|  27.4k|        if (( pBNS->vert[v1].st_edge.flow & EDGE_FLOW_ST_MASK ) < f12 ||
  ------------------
  |  |  128|  27.4k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (6387:13): [True: 0, False: 27.4k]
  ------------------
 6388|  27.4k|            ( pBNS->vert[v2].st_edge.flow & EDGE_FLOW_ST_MASK ) < f12 ||
  ------------------
  |  |  128|  27.4k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (6388:13): [True: 0, False: 27.4k]
  ------------------
 6389|  27.4k|             ( pBNS->vert[v1].st_edge.cap  & EDGE_FLOW_ST_MASK ) < flow ||
  ------------------
  |  |  128|  27.4k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (6389:14): [True: 0, False: 27.4k]
  ------------------
 6390|  27.4k|             ( pBNS->vert[v2].st_edge.cap  & EDGE_FLOW_ST_MASK ) < flow)
  ------------------
  |  |  128|  27.4k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (6390:14): [True: 0, False: 27.4k]
  ------------------
 6391|      0|        {
 6392|      0|            return BNS_CAP_FLOW_ERR;
  ------------------
  |  |   58|      0|#define BNS_CAP_FLOW_ERR   (BNS_ERR + 10) /*(-9989)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6393|      0|        }
 6394|  27.4k|        fcd[ifcd].iedge = iedge;
 6395|  27.4k|        fcd[ifcd].flow = pEdge->flow;
 6396|  27.4k|        fcd[ifcd].cap = pEdge->cap;
 6397|       |
 6398|  27.4k|        fcd[ifcd].v1 = v1;
 6399|  27.4k|        fcd[ifcd].flow_st1 = pBNS->vert[v1].st_edge.flow;
 6400|  27.4k|        fcd[ifcd].cap_st1 = pBNS->vert[v1].st_edge.cap;
 6401|       |
 6402|  27.4k|        fcd[ifcd].v2 = v2;
 6403|  27.4k|        fcd[ifcd].flow_st2 = pBNS->vert[v2].st_edge.flow;
 6404|  27.4k|        fcd[ifcd].cap_st2 = pBNS->vert[v2].st_edge.cap;
 6405|       |
 6406|  27.4k|        fcd[++ifcd].iedge = NO_VERTEX; /* mark the end of the fcd[] data */
  ------------------
  |  |  118|  27.4k|#define NO_VERTEX    -2
  ------------------
 6407|  27.4k|        pEdge->pass |= 64;
 6408|       |
 6409|  27.4k|        delta = f12 - flow;
 6410|       |
 6411|       |        /* Remove current edge flow from st-edges */
 6412|       |        /* -- seem to be a bug --
 6413|       |        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);
 6414|       |        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);
 6415|       |        */
 6416|       |
 6417|       |        /* Replacement to the above 2 lines 01-16-2002 */
 6418|       |        /* Remove old edge flow from the flow of the adjacent vertices' st-edges */
 6419|       |
 6420|  27.4k|        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 );
  ------------------
  |  |  128|  27.4k|#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 );
  ------------------
  |  |  128|  27.4k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6421|  27.4k|        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 );
  ------------------
  |  |  128|  27.4k|#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 );
  ------------------
  |  |  128|  27.4k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6422|       |
 6423|       |        /* Sdded 01-16-2002: reduce st-cap if new flow > 0  */
 6424|       |        /* Remove new edge flow from the cap of the adjacent vertices' st-edges */
 6425|  27.4k|        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 );
  ------------------
  |  |  128|  27.4k|#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 );
  ------------------
  |  |  128|  27.4k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6426|  27.4k|        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 );
  ------------------
  |  |  128|  27.4k|#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 );
  ------------------
  |  |  128|  27.4k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6427|       |
 6428|       |        /* delete current edge flow and capacity */
 6429|  27.4k|        pEdge->flow = ( pEdge->flow & ~EDGE_FLOW_MASK );
  ------------------
  |  |  133|  27.4k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6430|  27.4k|        pEdge->cap = ( pEdge->cap  & ~EDGE_FLOW_MASK );
  ------------------
  |  |  133|  27.4k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6431|  27.4k|        nDots = 2 * delta;
 6432|  27.4k|    }
 6433|       |
 6434|  64.3k|    return nDots;
 6435|  64.3k|}
bAddNewVertex:
 6453|  29.3k|{
 6454|  29.3k|    Vertex      vlast = pBNS->num_vertices - 1;
 6455|  29.3k|    Vertex      vnew = pBNS->num_vertices;
 6456|  29.3k|    Vertex      v2 = nVertDoubleBond;
 6457|  29.3k|    BNS_VERTEX *pVert2 = pBNS->vert + v2;   /* pointer to an old vertex */
 6458|  29.3k|    BNS_VERTEX *pNewVert = pBNS->vert + vnew; /* pointer to a new vertex */
 6459|       |
 6460|  29.3k|    EdgeIndex   iedge = pBNS->num_edges;
 6461|  29.3k|    BNS_EDGE   *pEdge = pBNS->edge + iedge; /* pointer to a new edge */
 6462|       |
 6463|  29.3k|    if (iedge >= pBNS->max_edges || vnew >= pBNS->max_vertices)
  ------------------
  |  Branch (6463:9): [True: 0, False: 29.3k]
  |  Branch (6463:37): [True: 0, False: 29.3k]
  ------------------
 6464|      0|    {
 6465|      0|        return BNS_VERT_EDGE_OVFL; /* edges or vertices overflow */
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6466|      0|    }
 6467|  29.3k|    if (( pBNS->vert[vlast].iedge - pBNS->iedge ) + pBNS->vert[vlast].max_adj_edges + nMaxAdjEdges >= pBNS->max_iedges)
  ------------------
  |  Branch (6467:9): [True: 0, False: 29.3k]
  ------------------
 6468|      0|    {
 6469|      0|        return BNS_VERT_EDGE_OVFL; /* iedges overflow */
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6470|      0|    }
 6471|  29.3k|    if (pVert2->num_adj_edges >= pVert2->max_adj_edges || nMaxAdjEdges <= 0)
  ------------------
  |  Branch (6471:9): [True: 4, False: 29.3k]
  |  Branch (6471:59): [True: 0, False: 29.3k]
  ------------------
 6472|      4|    {
 6473|      4|        return BNS_VERT_EDGE_OVFL; /* neighbors overflow */
  ------------------
  |  |   54|      4|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      4|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6474|      4|    }
 6475|       |
 6476|       |    /* Fill out the new edge, set its cap and flow, connect */
 6477|       |    /* memset( pEdge, 0, sizeof(*pEdge) ); */
 6478|  29.3k|    pEdge->cap = pEdge->cap0 = nCap;
 6479|  29.3k|    pEdge->flow = pEdge->flow0 = nFlow;
 6480|  29.3k|    pEdge->pass = 0;
 6481|  29.3k|    pEdge->neighbor1 = v2;
 6482|  29.3k|    pEdge->neighbor12 = v2 ^ vnew;
 6483|  29.3k|    pEdge->forbidden = 0;
 6484|       |
 6485|       |    /* Fill out the new vertex */
 6486|       |    /* memset( pNewVert, 0, sizeof(*pNewVert) ); */
 6487|  29.3k|    pNewVert->max_adj_edges = nMaxAdjEdges;
 6488|  29.3k|    pNewVert->num_adj_edges = 0;
 6489|  29.3k|    pNewVert->st_edge.cap0 = pNewVert->st_edge.cap = nCap;
 6490|  29.3k|    pNewVert->st_edge.flow0 = pNewVert->st_edge.flow = nFlow;
 6491|  29.3k|    pNewVert->st_edge.pass = 0; /* add initialization; added 2006-03-25 */
 6492|  29.3k|    pNewVert->iedge = pBNS->vert[vlast].iedge + pBNS->vert[vlast].max_adj_edges;
 6493|  29.3k|    pNewVert->type = BNS_VERT_TYPE_TEMP;
  ------------------
  |  |   51|  29.3k|#define BNS_VERT_TYPE_TEMP          0x0040
  ------------------
 6494|  29.3k|    *nDots += nCap - nFlow;
 6495|       |
 6496|  29.3k|    pEdge->neigh_ord[v2 > vnew] = pVert2->num_adj_edges;
 6497|  29.3k|    pEdge->neigh_ord[v2 < vnew] = pNewVert->num_adj_edges;
 6498|       |
 6499|       |    /* Connect new edge to v2 */
 6500|  29.3k|    pVert2->iedge[pVert2->num_adj_edges++] = iedge;
 6501|       |    /* Connect new edge to vnew */
 6502|  29.3k|    pNewVert->iedge[pNewVert->num_adj_edges++] = iedge;
 6503|       |
 6504|       |    /* Fix v2 flow and cap */
 6505|  29.3k|    *nDots -= (int) pVert2->st_edge.cap - (int) pVert2->st_edge.flow;
 6506|  29.3k|    pVert2->st_edge.flow += nFlow;
 6507|  29.3k|    if (pVert2->st_edge.cap < pVert2->st_edge.flow)
  ------------------
  |  Branch (6507:9): [True: 0, False: 29.3k]
  ------------------
 6508|      0|    {
 6509|      0|        pVert2->st_edge.cap = pVert2->st_edge.flow;
 6510|      0|    }
 6511|  29.3k|    *nDots += (int) pVert2->st_edge.cap - (int) pVert2->st_edge.flow;
 6512|       |
 6513|  29.3k|    pBNS->num_edges++;
 6514|  29.3k|    pBNS->num_vertices++;
 6515|       |
 6516|  29.3k|    return vnew;
 6517|  29.3k|}
AddNewEdge:
 6526|  9.17k|{
 6527|  9.17k|    int ip1 = (int) ( p1 - pBNS->vert );
 6528|  9.17k|    int ip2 = (int) ( p2 - pBNS->vert );
 6529|  9.17k|    int ie = pBNS->num_edges;
 6530|  9.17k|    BNS_EDGE *e = pBNS->edge + ie;
 6531|       |
 6532|       |    /* Debug: check bounds */
 6533|  9.17k|    if (ip1 >= pBNS->max_vertices || ip1 < 0 ||
  ------------------
  |  Branch (6533:9): [True: 0, False: 9.17k]
  |  Branch (6533:38): [True: 0, False: 9.17k]
  ------------------
 6534|  9.17k|         ip2 >= pBNS->max_vertices || ip2 < 0 ||
  ------------------
  |  Branch (6534:10): [True: 0, False: 9.17k]
  |  Branch (6534:39): [True: 0, False: 9.17k]
  ------------------
 6535|  9.17k|         ie >= pBNS->max_edges || ie < 0 ||
  ------------------
  |  Branch (6535:10): [True: 0, False: 9.17k]
  |  Branch (6535:35): [True: 0, False: 9.17k]
  ------------------
 6536|  9.17k|         ( p1->iedge - pBNS->iedge ) < 0 ||
  ------------------
  |  Branch (6536:10): [True: 0, False: 9.17k]
  ------------------
 6537|  9.17k|         ( p1->iedge - pBNS->iedge ) + p1->max_adj_edges > pBNS->max_iedges ||
  ------------------
  |  Branch (6537:10): [True: 0, False: 9.17k]
  ------------------
 6538|  9.17k|         ( p2->iedge - pBNS->iedge ) < 0 ||
  ------------------
  |  Branch (6538:10): [True: 0, False: 9.17k]
  ------------------
 6539|  9.17k|         ( p2->iedge - pBNS->iedge ) + p2->max_adj_edges > pBNS->max_iedges ||
  ------------------
  |  Branch (6539:10): [True: 0, False: 9.17k]
  ------------------
 6540|  9.17k|         p1->num_adj_edges >= p1->max_adj_edges ||
  ------------------
  |  Branch (6540:10): [True: 0, False: 9.17k]
  ------------------
 6541|  9.17k|         p2->num_adj_edges >= p2->max_adj_edges)
  ------------------
  |  Branch (6541:10): [True: 0, False: 9.17k]
  ------------------
 6542|      0|    {
 6543|      0|        return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6544|      0|    }
 6545|       |
 6546|       |    /* Clear the edge */
 6547|  9.17k|    memset( e, 0, sizeof( *e ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 6548|       |
 6549|       |    /* Connect */
 6550|  9.17k|    e->neighbor1 = inchi_min( ip1, ip2 );
  ------------------
  |  |  139|  9.17k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 9.17k]
  |  |  ------------------
  ------------------
 6551|  9.17k|    e->neighbor12 = ip1 ^ ip2;
 6552|  9.17k|    p1->iedge[p1->num_adj_edges] = ie;
 6553|  9.17k|    p2->iedge[p2->num_adj_edges] = ie;
 6554|  9.17k|    e->neigh_ord[ip1 > ip2] = p1->num_adj_edges++;
 6555|  9.17k|    e->neigh_ord[ip1 < ip2] = p2->num_adj_edges++;
 6556|  9.17k|    e->cap = e->cap0 = nEdgeCap;
 6557|  9.17k|    e->flow = e->flow0 = nEdgeFlow;
 6558|  9.17k|    p1->st_edge.flow += nEdgeFlow;
 6559|  9.17k|    p2->st_edge.flow += nEdgeFlow;
 6560|  9.17k|    if (p1->st_edge.cap < p1->st_edge.flow)
  ------------------
  |  Branch (6560:9): [True: 610, False: 8.56k]
  ------------------
 6561|    610|    {
 6562|    610|        p1->st_edge.cap = p1->st_edge.flow;
 6563|    610|    }
 6564|  9.17k|    if (p2->st_edge.cap < p2->st_edge.flow)
  ------------------
  |  Branch (6564:9): [True: 0, False: 9.17k]
  ------------------
 6565|      0|    {
 6566|      0|        p2->st_edge.cap = p2->st_edge.flow;
 6567|      0|    }
 6568|  9.17k|    pBNS->num_edges++;
 6569|       |
 6570|  9.17k|    return ie;
 6571|  9.17k|}
GetEdgeToGroupVertex:
 6576|  35.6k|{
 6577|  35.6k|    if (v1 < pBNS->num_atoms)
  ------------------
  |  Branch (6577:9): [True: 35.6k, False: 0]
  ------------------
 6578|  35.6k|    {
 6579|  35.6k|        Vertex      v2;
 6580|  35.6k|        BNS_EDGE   *pEdge1;
 6581|  35.6k|        BNS_VERTEX *pVert1 = pBNS->vert + v1;
 6582|  35.6k|        int         i = pVert1->num_adj_edges - 1;
 6583|       |
 6584|  82.0k|        while (0 <= i)
  ------------------
  |  Branch (6584:16): [True: 49.7k, False: 32.2k]
  ------------------
 6585|  49.7k|        {
 6586|  49.7k|            pEdge1 = pBNS->edge + pVert1->iedge[i];
 6587|  49.7k|            v2 = pEdge1->neighbor12 ^ v1;
 6588|  49.7k|            if (pBNS->vert[v2].type == type)
  ------------------
  |  Branch (6588:17): [True: 3.39k, False: 46.3k]
  ------------------
 6589|  3.39k|            {
 6590|  3.39k|                return IS_FORBIDDEN( pEdge1->forbidden, pBNS ) ? NO_VERTEX : pVert1->iedge[i];
  ------------------
  |  |   41|  3.39k|#define IS_FORBIDDEN(EDGE_FORBIDDEN, PBNS)     (EDGE_FORBIDDEN)
  |  |  ------------------
  |  |  |  Branch (41:48): [True: 0, False: 3.39k]
  |  |  ------------------
  ------------------
                              return IS_FORBIDDEN( pEdge1->forbidden, pBNS ) ? NO_VERTEX : pVert1->iedge[i];
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
 6591|  3.39k|            }
 6592|  46.3k|            i--;
 6593|  46.3k|        }
 6594|  32.2k|        return NO_VERTEX; /* not found t-group */
  ------------------
  |  |  118|  32.2k|#define NO_VERTEX    -2
  ------------------
 6595|  35.6k|    }
 6596|      0|    else
 6597|      0|    {
 6598|      0|        if (v1 < pBNS->num_vertices)
  ------------------
  |  Branch (6598:13): [True: 0, False: 0]
  ------------------
 6599|      0|        {
 6600|      0|            return NO_VERTEX;
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
 6601|      0|        }
 6602|      0|    }
 6603|       |
 6604|      0|    return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6605|  35.6k|}
GetGroupVertex:
 6610|  2.95k|{
 6611|  2.95k|    if (v1 < pBNS->num_atoms)
  ------------------
  |  Branch (6611:9): [True: 2.95k, False: 0]
  ------------------
 6612|  2.95k|    {
 6613|  2.95k|        Vertex      v2;
 6614|  2.95k|        BNS_EDGE   *pEdge1;
 6615|  2.95k|        BNS_VERTEX *pVert1 = pBNS->vert + v1;
 6616|  2.95k|        int         i = pVert1->num_adj_edges - 1;
 6617|       |
 6618|  2.95k|        AT_NUMB type2;
 6619|       |
 6620|  2.95k|        if (type == BNS_VERT_TYPE_ENDPOINT)
  ------------------
  |  |   46|  2.95k|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
  |  Branch (6620:13): [True: 2.95k, False: 0]
  ------------------
 6621|  2.95k|        {
 6622|  2.95k|            type2 = BNS_VERT_TYPE_TGROUP;
  ------------------
  |  |   47|  2.95k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 6623|  2.95k|        }
 6624|      0|        else
 6625|      0|        {
 6626|      0|            if (type == BNS_VERT_TYPE_C_POINT)
  ------------------
  |  |   48|      0|#define BNS_VERT_TYPE_C_POINT       0x0008
  ------------------
  |  Branch (6626:17): [True: 0, False: 0]
  ------------------
 6627|      0|            {
 6628|      0|                type2 = BNS_VERT_TYPE_C_GROUP;
  ------------------
  |  |   49|      0|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
 6629|      0|            }
 6630|      0|            else
 6631|      0|            {
 6632|      0|                type2 = 0;
 6633|      0|            }
 6634|      0|        }
 6635|       |
 6636|  2.95k|        if (( pVert1->type & type ) == type)
  ------------------
  |  Branch (6636:13): [True: 2.95k, False: 0]
  ------------------
 6637|  2.95k|        {
 6638|  4.32k|            while (0 <= i)
  ------------------
  |  Branch (6638:20): [True: 3.63k, False: 695]
  ------------------
 6639|  3.63k|            {
 6640|  3.63k|                pEdge1 = pBNS->edge + pVert1->iedge[i];
 6641|  3.63k|                v2 = pEdge1->neighbor12 ^ v1;
 6642|  3.63k|                if (pBNS->vert[v2].type == type2)
  ------------------
  |  Branch (6642:21): [True: 2.26k, False: 1.36k]
  ------------------
 6643|  2.26k|                {
 6644|  2.26k|                    if (IS_FORBIDDEN( pEdge1->forbidden, pBNS ))
  ------------------
  |  |   41|  2.26k|#define IS_FORBIDDEN(EDGE_FORBIDDEN, PBNS)     (EDGE_FORBIDDEN)
  |  |  ------------------
  |  |  |  Branch (41:48): [True: 0, False: 2.26k]
  |  |  ------------------
  ------------------
 6645|      0|                    {
 6646|      0|                        return NO_VERTEX;
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
 6647|      0|                    }
 6648|  2.26k|                    return v2;
 6649|  2.26k|                }
 6650|  1.36k|                i--;
 6651|  1.36k|            }
 6652|  2.95k|        }
 6653|    695|        return BNS_BOND_ERR; /* not found t-group */
  ------------------
  |  |   52|    695|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   47|    695|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6654|  2.95k|    }
 6655|      0|    else
 6656|      0|    {
 6657|      0|        if (v1 < pBNS->num_vertices)
  ------------------
  |  Branch (6657:13): [True: 0, False: 0]
  ------------------
 6658|      0|        {
 6659|      0|            return NO_VERTEX;
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
 6660|      0|        }
 6661|      0|    }
 6662|       |
 6663|      0|    return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6664|  2.95k|}
bAddStCapToAVertex:
 6674|  20.3k|{
 6675|  20.3k|    BNS_VERTEX *pVert1 = pBNS->vert + v1;
 6676|  20.3k|    BNS_VERTEX *pVert;
 6677|  20.3k|    BNS_EDGE   *pEdge;
 6678|  20.3k|    Vertex      v;
 6679|  20.3k|    int         i, n;
 6680|  20.3k|    VertexFlow  nNewCap;
 6681|       |
 6682|       |    /* Change v1: increment its st-cap */
 6683|  20.3k|    n = 0;
 6684|  20.3k|    nOldCapVertSingleBond[n++] = pVert1->st_edge.cap;
 6685|       |    /*if ( pVert1->st_edge.cap == pVert1->st_edge.flow ) {*/
 6686|  20.3k|    pVert1->st_edge.cap++;
 6687|  20.3k|    *nDots += 1;
 6688|       |
 6689|       |    /*}*/
 6690|       |    /* increment caps of adjacent edges if
 6691|       |    (1) the neighbor has st-cap != 0 and
 6692|       |    (2) (edge cap==0) OR (nSumEdgeCap < pVert1->st_edge.cap && pVert->st_edge.flow > pVert1->st_edge.cap)
 6693|       |    */
 6694|  20.3k|    if (!( pVert1->type & BNS_VERT_TYPE_ANY_GROUP ))
  ------------------
  |  |   59|  20.3k|#define BNS_VERT_TYPE_ANY_GROUP    (BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_SUPER_TGROUP)
  |  |  ------------------
  |  |  |  |   47|  20.3k|#define BNS_VERT_TYPE_TGROUP        0x0004
  |  |  ------------------
  |  |               #define BNS_VERT_TYPE_ANY_GROUP    (BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_SUPER_TGROUP)
  |  |  ------------------
  |  |  |  |   49|  20.3k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |               #define BNS_VERT_TYPE_ANY_GROUP    (BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_SUPER_TGROUP)
  |  |  ------------------
  |  |  |  |   50|  20.3k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  ------------------
  ------------------
  |  Branch (6694:9): [True: 17.7k, False: 2.65k]
  ------------------
 6695|  17.7k|    {
 6696|       |        /*
 6697|       |        AT_NUMB nSumEdgeCap = 0;
 6698|       |        for ( i = 0; i < pVert1->num_adj_edges; i ++ ) {
 6699|       |        pEdge = pBNS->edge + pVert1->iedge[i];
 6700|       |        nSumEdgeCap += pEdge->cap;
 6701|       |        }
 6702|       |        */
 6703|       |        /* do not increment caps of t-group or c-group edges */
 6704|  50.1k|        for (i = 0; i < pVert1->num_adj_edges; i++)
  ------------------
  |  Branch (6704:21): [True: 32.4k, False: 17.7k]
  ------------------
 6705|  32.4k|        {
 6706|  32.4k|            pEdge = pBNS->edge + pVert1->iedge[i];
 6707|  32.4k|            nOldCapVertSingleBond[n++] = pEdge->cap; /* save edge cap */
 6708|  32.4k|            v = pEdge->neighbor12 ^ v1;
 6709|  32.4k|            if (v == v2 && !bAdjacentDonors)
  ------------------
  |  Branch (6709:17): [True: 3.97k, False: 28.4k]
  |  Branch (6709:28): [True: 3.92k, False: 48]
  ------------------
 6710|  3.92k|            {
 6711|  3.92k|                continue;
 6712|  3.92k|            }
 6713|  28.5k|            pVert = pBNS->vert + v;
 6714|  28.5k|            if (pVert->type & BNS_VERT_TYPE_ANY_GROUP)
  ------------------
  |  |   59|  28.5k|#define BNS_VERT_TYPE_ANY_GROUP    (BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_SUPER_TGROUP)
  |  |  ------------------
  |  |  |  |   47|  28.5k|#define BNS_VERT_TYPE_TGROUP        0x0004
  |  |  ------------------
  |  |               #define BNS_VERT_TYPE_ANY_GROUP    (BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_SUPER_TGROUP)
  |  |  ------------------
  |  |  |  |   49|  28.5k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |               #define BNS_VERT_TYPE_ANY_GROUP    (BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_SUPER_TGROUP)
  |  |  ------------------
  |  |  |  |   50|  28.5k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  ------------------
  ------------------
  |  Branch (6714:17): [True: 3.33k, False: 25.1k]
  ------------------
 6715|  3.33k|                continue;
 6716|  25.1k|            nNewCap = inchi_min( pVert->st_edge.cap, pVert1->st_edge.cap );
  ------------------
  |  |  139|  25.1k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 10.4k, False: 14.6k]
  |  |  ------------------
  ------------------
 6717|  25.1k|            nNewCap = inchi_min( nNewCap, MAX_BOND_EDGE_CAP );
  ------------------
  |  |  139|  25.1k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 22.2k, False: 2.94k]
  |  |  ------------------
  ------------------
 6718|  25.1k|            pEdge->cap = nNewCap; /* change edge cap */
 6719|       |                                  /*
 6720|       |                                  if ( pVert->st_edge.cap > 0 && !pEdge->cap ) {
 6721|       |                                  pEdge->cap ++;
 6722|       |                                  } else
 6723|       |                                  if ( pVert->st_edge.flow > pVert1->st_edge.cap &&
 6724|       |                                  pEdge->cap < MAX_BOND_EDGE_CAP &&
 6725|       |                                  nSumEdgeCap < pVert1->st_edge.cap ) {
 6726|       |                                  pEdge->cap ++;
 6727|       |                                  }
 6728|       |                                  */
 6729|  25.1k|        }
 6730|  17.7k|    }
 6731|       |
 6732|  20.3k|    return n; /* number of elements in nOldCapVertSingleBond[*] */
 6733|  20.3k|}
bSetBnsToCheckAltPath:
 6751|  23.6k|{
 6752|       |
 6753|  23.6k|    if (!pBNS->vert[nVertDoubleBond].st_edge.flow &&
  ------------------
  |  Branch (6753:9): [True: 3.01k, False: 20.6k]
  ------------------
 6754|       |
 6755|  3.01k|         !( path_type == ALT_PATH_MODE_REM2H_CHG ||
  ------------------
  |  |  314|  6.02k|#define ALT_PATH_MODE_REM2H_CHG  5   /* remove 2 H along alt. path AH-=-BH => A=-=B and change bonds to alternating */
  ------------------
  |  Branch (6755:13): [True: 22, False: 2.98k]
  ------------------
 6756|  2.98k|            path_type == ALT_PATH_MODE_ADD2H_CHG ||
  ------------------
  |  |  315|  6.00k|#define ALT_PATH_MODE_ADD2H_CHG  6   /* add 2 H along alt. path A=-=B => AH-=-BH    and change bonds to alternating */
  ------------------
  |  Branch (6756:13): [True: 0, False: 2.98k]
  ------------------
 6757|  2.98k|            path_type == ALT_PATH_MODE_REM2H_TST ||
  ------------------
  |  |  316|  6.00k|#define ALT_PATH_MODE_REM2H_TST  7   /* test-remove 2 H along alt. path AH-=-BH => A=-=B; restore changed bonds */
  ------------------
  |  Branch (6757:13): [True: 77, False: 2.91k]
  ------------------
 6758|  2.91k|            path_type == ALT_PATH_MODE_ADD2H_TST )
  ------------------
  |  |  317|  2.91k|#define ALT_PATH_MODE_ADD2H_TST  8   /* test-add 2 H along alt. path A=-=B => AH-=-BH; restore changed bonds */
  ------------------
  |  Branch (6758:13): [True: 0, False: 2.91k]
  ------------------
 6759|  23.6k|         )
 6760|  2.91k|    {
 6761|  2.91k|        return BNS_CHK_ALTP_NO_ALTPATH;
  ------------------
  |  | 6736|  2.91k|#define BNS_CHK_ALTP_NO_ALTPATH  0
  ------------------
 6762|  2.91k|    }
 6763|  20.7k|    else
 6764|  20.7k|    {
 6765|  20.7k|        Vertex      vNew;
 6766|  20.7k|        Vertex      v1 = nVertSingleBond;
 6767|  20.7k|        Vertex      v2 = nVertDoubleBond;
 6768|       |
 6769|  20.7k|        BNS_VERTEX *pVert1 = pBNS->vert + v1;
 6770|  20.7k|        BNS_VERTEX *pVert2 = pBNS->vert + v2;
 6771|  20.7k|        int n, bAdjacentDonors = 0;
 6772|  20.7k|        int ifcd = 0;
 6773|       |
 6774|  20.7k|        Vertex     t1 = NO_VERTEX;
  ------------------
  |  |  118|  20.7k|#define NO_VERTEX    -2
  ------------------
 6775|  20.7k|        Vertex     t2 = NO_VERTEX;
  ------------------
  |  |  118|  20.7k|#define NO_VERTEX    -2
  ------------------
 6776|  20.7k|        int        iapc;
 6777|       |
 6778|       |        /*#if ( TEST_REMOVE_S_ATOMS == 1 )*/ /* && ALT_PATH_MODE_4_SALT == path_type */
 6779|  20.7k|        if (( *pBNS->pbTautFlags & TG_FLAG_TEST_TAUT2_SALTS ) &&
  ------------------
  |  |  922|  20.7k|#define TG_FLAG_TEST_TAUT2_SALTS         0x00000010   /* TEST_REMOVE_S_ATOMS multi-attachement long-range H/(-) taut. on =C-OH, >C=O   */
  ------------------
  |  Branch (6779:13): [True: 19.9k, False: 851]
  ------------------
 6780|  19.9k|             ALT_PATH_MODE_4_SALT2 == path_type &&
  ------------------
  |  |  313|  19.9k|#define ALT_PATH_MODE_4_SALT2    4   /* mark alt bonds along the path, path to taut. group fict. vertex if exists */
  ------------------
  |  Branch (6780:14): [True: 0, False: 19.9k]
  ------------------
 6781|      0|             ( BNS_VERT_TYPE_ENDPOINT & type ))
  ------------------
  |  |   46|      0|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
  |  Branch (6781:14): [True: 0, False: 0]
  ------------------
 6782|      0|        {
 6783|       |            /*
 6784|       |            ---------------------------------------------------------
 6785|       |            \   action |  DB action (v2)   |   SB action (v1)  |
 6786|       |            vertex \        | accept H @ vertex | donate H @ vertex |
 6787|       |            type     \      | nVertDoubleBond   | nVertSingleBond   |
 6788|       |            ----------------+-------------------+-------------------+
 6789|       |            -ZH (v1)    |  error            |   -ZH(.)          |
 6790|       |            (cap>0 on edge  |                   |   increment       |
 6791|       |            except v1-v2)  |                   |   st-cap on Z     |
 6792|       |            ----------------+-------------------+-------------------+
 6793|       |            =Z  (v2)    |  =Z-(.)           |   error           |
 6794|       |            (st-flow>0)   |  add fict vertex  |                   |
 6795|       |            |  with st-cap=1    |                   |
 6796|       |            ----------------+-------------------+-------------------+
 6797|       |            endpoint      |  T(.)             |   T-(.)           |
 6798|       |            of t-group    |  increment        |   add fict vertex |
 6799|       |            represented   |  st-cap on T      |   with st-cap=1   |
 6800|       |            by fictitious |                   |                   |
 6801|       |            vertex T      |                   |                   |
 6802|       |            ---------------------------------------------------------
 6803|       |            */
 6804|       |
 6805|      0|            int         bSet_v1;  /* indicator: v1 has been set */
 6806|      0|            int         bSet_v2;  /* indicator: v2 has been set */
 6807|      0|            int         i;
 6808|       |
 6809|      0|            Vertex      v1t = NO_VERTEX;
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
 6810|      0|            Vertex      v2t = NO_VERTEX;
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
 6811|      0|            Vertex      v1Act, v2Act;
 6812|      0|            Vertex      v;
 6813|       |
 6814|      0|            memset( apc, 0, sizeof( *apc ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 6815|      0|            fcd[ifcd].iedge = NO_VERTEX;
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
 6816|      0|            *nDots = 0;
 6817|       |
 6818|      0|            if (v1 == v2)
  ------------------
  |  Branch (6818:17): [True: 0, False: 0]
  ------------------
 6819|      0|            {
 6820|      0|                return BNS_CHK_ALTP_SAME_VERTEX;
  ------------------
  |  | 6738|      0|#define BNS_CHK_ALTP_SAME_VERTEX 2
  ------------------
 6821|      0|            }
 6822|       |
 6823|       |            /* Check whether v1 has neighbors adjacent to multiple bonds */
 6824|      0|            for (i = 0, n = 0; i < pVert1->num_adj_edges; i++)
  ------------------
  |  Branch (6824:32): [True: 0, False: 0]
  ------------------
 6825|      0|            {
 6826|      0|                v = ( pBNS->edge + pVert1->iedge[i] )->neighbor12 ^ v1; /* v is adjacent to v1 */
 6827|      0|                if (v == v2)
  ------------------
  |  Branch (6827:21): [True: 0, False: 0]
  ------------------
 6828|      0|                {
 6829|      0|                    continue; /* ignore connection to v2 */
 6830|      0|                }
 6831|      0|                n += ( pBNS->vert[v].st_edge.cap > 0 );
 6832|      0|            }
 6833|      0|            if (!n)
  ------------------
  |  Branch (6833:17): [True: 0, False: 0]
  ------------------
 6834|      0|            {
 6835|      0|                return BNS_CHK_ALTP_NO_ALTPATH; /* the vertex cannot have flow */
  ------------------
  |  | 6736|      0|#define BNS_CHK_ALTP_NO_ALTPATH  0
  ------------------
 6836|      0|            }
 6837|       |
 6838|      0|            v1Act = v1;
 6839|      0|            v2Act = v2;
 6840|       |
 6841|       |            /* find t-group that contains v1 */
 6842|      0|            if (( pVert1->type & type ) == type)
  ------------------
  |  Branch (6842:17): [True: 0, False: 0]
  ------------------
 6843|      0|            {
 6844|      0|                v1t = GetGroupVertex( pBNS, v1, type );
 6845|      0|                if (IS_BNS_ERROR( v1t ))
  ------------------
  |  |   67|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 0, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 6846|      0|                {
 6847|      0|                    return v1t;
 6848|      0|                }
 6849|      0|                if (v1t != NO_VERTEX)
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (6849:21): [True: 0, False: 0]
  ------------------
 6850|      0|                {
 6851|      0|                    v1Act = v1t;
 6852|      0|                }
 6853|      0|            }
 6854|       |            /* Find t-group that contains v2 */
 6855|      0|            if (( pVert2->type & type ) == type)
  ------------------
  |  Branch (6855:17): [True: 0, False: 0]
  ------------------
 6856|      0|            {
 6857|      0|                v2t = GetGroupVertex( pBNS, v2, type );
 6858|      0|                if (IS_BNS_ERROR( v2t ))
  ------------------
  |  |   67|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 0, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 6859|      0|                {
 6860|      0|                    return v2t;
 6861|      0|                }
 6862|      0|                if (v2t != NO_VERTEX)
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (6862:21): [True: 0, False: 0]
  ------------------
 6863|      0|                {
 6864|      0|                    v2Act = v2t;
 6865|      0|                }
 6866|      0|            }
 6867|      0|            if (v1t != NO_VERTEX && v1t == v2t)
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (6867:17): [True: 0, False: 0]
  |  Branch (6867:37): [True: 0, False: 0]
  ------------------
 6868|      0|            {
 6869|      0|                return BNS_CHK_ALTP_SAME_TGROUP;
  ------------------
  |  | 6737|      0|#define BNS_CHK_ALTP_SAME_TGROUP 1
  ------------------
 6870|      0|            }
 6871|       |
 6872|      0|            bSet_v1 = bSet_v2 = 0;
 6873|       |            /* create new edges adjacent to v1t or v2 */
 6874|      0|            iapc = 0;
 6875|      0|            if (v1t != NO_VERTEX)
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (6875:17): [True: 0, False: 0]
  ------------------
 6876|      0|            {
 6877|       |                /* Create new edge and vertex, connect to v1t */
 6878|      0|                vNew = bAddNewVertex( pBNS, v1t, 1, 0, 1, nDots );
 6879|      0|                if (IS_BNS_ERROR( vNew ))
  ------------------
  |  |   67|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 0, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 6880|      0|                {
 6881|      0|                    return vNew;
 6882|      0|                }
 6883|      0|                apc->vNewVertex[iapc] = vNew;
 6884|      0|                apc->bSetNew[iapc] = 1;
 6885|      0|                bSet_v1 = 1;
 6886|      0|                iapc++;
 6887|      0|            }
 6888|      0|            if (v2t == NO_VERTEX)
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (6888:17): [True: 0, False: 0]
  ------------------
 6889|      0|            {
 6890|       |                /* Create new edge and vertex, connect to v2 */
 6891|      0|                vNew = bAddNewVertex( pBNS, v2, 1, 0, 1, nDots );
 6892|      0|                if (IS_BNS_ERROR( vNew ))
  ------------------
  |  |   67|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 0, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 6893|      0|                {
 6894|      0|                    return vNew;
 6895|      0|                }
 6896|      0|                apc->vNewVertex[iapc] = vNew;
 6897|      0|                apc->bSetNew[iapc] = 1;
 6898|      0|                bSet_v2 = 1;
 6899|      0|                iapc++;
 6900|      0|            }
 6901|       |
 6902|       |            /* Add st-cap to v1 and/or v2t */
 6903|      0|            iapc = 0;
 6904|      0|            if (!bSet_v1)
  ------------------
  |  Branch (6904:17): [True: 0, False: 0]
  ------------------
 6905|      0|            {
 6906|       |                /* Add st-cap to v1 */
 6907|      0|                if (v1t != NO_VERTEX) /* djb-rwth: addressing coverity ID #499551 -- condition properly written */
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (6907:21): [True: 0, False: 0]
  ------------------
 6908|      0|                {
 6909|      0|                    return BNS_BOND_ERR;
  ------------------
  |  |   52|      0|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6910|      0|                }
 6911|      0|                n = bAddStCapToAVertex( pBNS, v1, v2Act, apc->nOldCapsVert[iapc], nDots, 0 );
 6912|      0|                apc->bSetOldCapsVert[iapc] = n;
 6913|      0|                apc->vOldVert[iapc] = v1;
 6914|      0|                iapc++;
 6915|      0|            }
 6916|      0|            if (!bSet_v2)
  ------------------
  |  Branch (6916:17): [True: 0, False: 0]
  ------------------
 6917|      0|            {
 6918|       |                /* Add st-cap to v2t */
 6919|      0|                if (v2t == NO_VERTEX)
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (6919:21): [True: 0, False: 0]
  ------------------
 6920|      0|                {
 6921|      0|                    return BNS_BOND_ERR;
  ------------------
  |  |   52|      0|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6922|      0|                }
 6923|      0|                n = bAddStCapToAVertex( pBNS, v2t, v1Act, apc->nOldCapsVert[iapc], nDots, 0 );
 6924|      0|                apc->bSetOldCapsVert[iapc] = n;
 6925|      0|                apc->vOldVert[iapc] = v2t;
 6926|      0|                iapc++;
 6927|      0|            }
 6928|      0|            if (*nDots < 0 || *nDots % 2)
  ------------------
  |  Branch (6928:17): [True: 0, False: 0]
  |  Branch (6928:31): [True: 0, False: 0]
  ------------------
 6929|      0|            {
 6930|      0|                return BNS_SET_ALTP_ERR;
  ------------------
  |  |   55|      0|#define BNS_SET_ALTP_ERR   (BNS_ERR +  7) /*(-9992)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6931|      0|            }
 6932|      0|            return BNS_CHK_ALTP_SET_SUCCESS;
  ------------------
  |  | 6739|      0|#define BNS_CHK_ALTP_SET_SUCCESS 4
  ------------------
 6933|      0|        }
 6934|       |
 6935|       |        /* ( *pBNS->pbTautFlags & TG_FLAG_TEST_TAUT2_SALTS ) */
 6936|       |
 6937|       |        /*#endif*/
 6938|       |
 6939|       |        /*  ( TEST_REMOVE_S_ATOMS == 1 && ALT_PATH_MODE_4_SALT == path_type ) */
 6940|       |
 6941|  20.7k|        if (path_type == ALT_PATH_MODE_REM2H_CHG ||
  ------------------
  |  |  314|  41.5k|#define ALT_PATH_MODE_REM2H_CHG  5   /* remove 2 H along alt. path AH-=-BH => A=-=B and change bonds to alternating */
  ------------------
  |  Branch (6941:13): [True: 32, False: 20.7k]
  ------------------
 6942|  20.7k|             path_type == ALT_PATH_MODE_ADD2H_CHG ||
  ------------------
  |  |  315|  41.4k|#define ALT_PATH_MODE_ADD2H_CHG  6   /* add 2 H along alt. path A=-=B => AH-=-BH    and change bonds to alternating */
  ------------------
  |  Branch (6942:14): [True: 69, False: 20.6k]
  ------------------
 6943|  20.6k|             path_type == ALT_PATH_MODE_REM2H_TST ||
  ------------------
  |  |  316|  41.4k|#define ALT_PATH_MODE_REM2H_TST  7   /* test-remove 2 H along alt. path AH-=-BH => A=-=B; restore changed bonds */
  ------------------
  |  Branch (6943:14): [True: 593, False: 20.0k]
  ------------------
 6944|  20.0k|             path_type == ALT_PATH_MODE_ADD2H_TST)
  ------------------
  |  |  317|  20.0k|#define ALT_PATH_MODE_ADD2H_TST  8   /* test-add 2 H along alt. path A=-=B => AH-=-BH; restore changed bonds */
  ------------------
  |  Branch (6944:14): [True: 919, False: 19.1k]
  ------------------
 6945|  1.61k|        {
 6946|       |            /* added 2004-03-18 */
 6947|       |
 6948|  1.61k|            int bDonors = ( path_type == ALT_PATH_MODE_REM2H_CHG ) || ( path_type == ALT_PATH_MODE_REM2H_TST );
  ------------------
  |  |  314|  1.61k|#define ALT_PATH_MODE_REM2H_CHG  5   /* remove 2 H along alt. path AH-=-BH => A=-=B and change bonds to alternating */
  ------------------
                          int bDonors = ( path_type == ALT_PATH_MODE_REM2H_CHG ) || ( path_type == ALT_PATH_MODE_REM2H_TST );
  ------------------
  |  |  316|  1.58k|#define ALT_PATH_MODE_REM2H_TST  7   /* test-remove 2 H along alt. path AH-=-BH => A=-=B; restore changed bonds */
  ------------------
  |  Branch (6948:27): [True: 32, False: 1.58k]
  |  Branch (6948:71): [True: 593, False: 988]
  ------------------
 6949|       |
 6950|  1.61k|            int         bSet_v1;  /* indicator: v1 has been set */
 6951|  1.61k|            int         bSet_v2;  /* indicator: v2 has been set */
 6952|  1.61k|            int         i, cap = 1;
 6953|  1.61k|            Vertex      v1t = NO_VERTEX;
  ------------------
  |  |  118|  1.61k|#define NO_VERTEX    -2
  ------------------
 6954|  1.61k|            Vertex      v2t = NO_VERTEX;
  ------------------
  |  |  118|  1.61k|#define NO_VERTEX    -2
  ------------------
 6955|  1.61k|            Vertex      v1Act, v2Act;
 6956|  1.61k|            Vertex      v;
 6957|       |
 6958|  1.61k|            memset( apc, 0, sizeof( *apc ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 6959|  1.61k|            fcd[ifcd].iedge = NO_VERTEX;
  ------------------
  |  |  118|  1.61k|#define NO_VERTEX    -2
  ------------------
 6960|  1.61k|            *nDots = 0;
 6961|       |            /*
 6962|       |            if ( v1 == v2 ) {
 6963|       |            return BNS_CHK_ALTP_SAME_VERTEX;
 6964|       |            }
 6965|       |            */
 6966|       |
 6967|       |            /* Check whether v1 and v2 have proper neighbors  */
 6968|  5.49k|            for (i = 0, n = bAdjacentDonors = 0; i < pVert1->num_adj_edges; i++)
  ------------------
  |  Branch (6968:50): [True: 3.87k, False: 1.61k]
  ------------------
 6969|  3.87k|            {
 6970|  3.87k|                v = ( pBNS->edge + pVert1->iedge[i] )->neighbor12 ^ v1; /* v is adjacent to v1 */
 6971|       |                                                                        /* do not ignore connection to v2
 6972|       |                                                                        if ( v == v2 )
 6973|       |                                                                        continue;
 6974|       |                                                                        */
 6975|  3.87k|                n += bDonors ? ( pBNS->vert[v].st_edge.cap > 0 )
  ------------------
  |  Branch (6975:22): [True: 1.53k, False: 2.34k]
  ------------------
 6976|  3.87k|                    : ( ( pBNS->edge + pVert1->iedge[i] )->flow > 0 );
 6977|  3.87k|                bAdjacentDonors += bDonors ? ( v == v2 ) && ( ( pBNS->edge + pVert1->iedge[i] )->flow < MAX_BOND_EDGE_CAP ) : 0;
  ------------------
  |  |  123|     62|#define MAX_BOND_EDGE_CAP           2  /* triple bond */
  ------------------
  |  Branch (6977:36): [True: 1.53k, False: 2.34k]
  |  Branch (6977:46): [True: 62, False: 1.47k]
  |  Branch (6977:61): [True: 62, False: 0]
  ------------------
 6978|       |                /* two donors connected by a single or double bond */
 6979|  3.87k|            }
 6980|       |
 6981|  1.61k|            if (!n && !bAdjacentDonors)
  ------------------
  |  Branch (6981:17): [True: 26, False: 1.58k]
  |  Branch (6981:23): [True: 9, False: 17]
  ------------------
 6982|      9|            {
 6983|      9|                return BNS_CHK_ALTP_NO_ALTPATH; /* the vertex cannot have flow */
  ------------------
  |  | 6736|      9|#define BNS_CHK_ALTP_NO_ALTPATH  0
  ------------------
 6984|      9|            }
 6985|  5.19k|            for (i = 0, n = bAdjacentDonors = 0; i < pVert2->num_adj_edges; i++)
  ------------------
  |  Branch (6985:50): [True: 3.58k, False: 1.60k]
  ------------------
 6986|  3.58k|            {
 6987|  3.58k|                v = ( pBNS->edge + pVert2->iedge[i] )->neighbor12 ^ v2; /* v is adjacent to v2 */
 6988|       |                                                                        /* do not ignore connection to v1
 6989|       |                                                                        if ( v == v1 )
 6990|       |                                                                        continue;
 6991|       |                                                                        */
 6992|  3.58k|                n += bDonors ? ( pBNS->vert[v].st_edge.cap > 0 ) : ( ( pBNS->edge + pVert2->iedge[i] )->flow > 0 );
  ------------------
  |  Branch (6992:22): [True: 1.45k, False: 2.13k]
  ------------------
 6993|  3.58k|                bAdjacentDonors += bDonors ? ( v == v1 ) && ( ( pBNS->edge + pVert2->iedge[i] )->flow < MAX_BOND_EDGE_CAP ) : 0;
  ------------------
  |  |  123|     62|#define MAX_BOND_EDGE_CAP           2  /* triple bond */
  ------------------
  |  Branch (6993:36): [True: 1.45k, False: 2.13k]
  |  Branch (6993:46): [True: 62, False: 1.39k]
  |  Branch (6993:61): [True: 62, False: 0]
  ------------------
 6994|       |                /* two donors connected by a single or double bond */
 6995|  3.58k|            }
 6996|       |
 6997|  1.60k|            if (!n && !bAdjacentDonors)
  ------------------
  |  Branch (6997:17): [True: 25, False: 1.57k]
  |  Branch (6997:23): [True: 4, False: 21]
  ------------------
 6998|      4|            {
 6999|      4|                return BNS_CHK_ALTP_NO_ALTPATH; /* the vertex cannot have flow */
  ------------------
  |  | 6736|      4|#define BNS_CHK_ALTP_NO_ALTPATH  0
  ------------------
 7000|      4|            }
 7001|       |
 7002|  1.60k|            v1Act = v1;
 7003|  1.60k|            v2Act = v2;
 7004|       |
 7005|       |            /* Find t-group that contains v1 */
 7006|  1.60k|            if (( pVert1->type & type ) == type)
  ------------------
  |  Branch (7006:17): [True: 1.52k, False: 79]
  ------------------
 7007|  1.52k|            {
 7008|  1.52k|                v1t = GetGroupVertex( pBNS, v1, type );
 7009|  1.52k|                if (BNS_BOND_ERR == v1t)
  ------------------
  |  |   52|  1.52k|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   47|  1.52k|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
  |  Branch (7009:21): [True: 290, False: 1.23k]
  ------------------
 7010|    290|                {
 7011|    290|                    v1t = NO_VERTEX;
  ------------------
  |  |  118|    290|#define NO_VERTEX    -2
  ------------------
 7012|    290|                }
 7013|  1.23k|                else
 7014|  1.23k|                {
 7015|  1.23k|                    if (IS_BNS_ERROR( v1t ))
  ------------------
  |  |   67|  1.23k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  1.23k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  1.23k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  1.23k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 1.23k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 1.23k]
  |  |  ------------------
  ------------------
 7016|      0|                    {
 7017|      0|                        return v1t;
 7018|      0|                    }
 7019|  1.23k|                    else
 7020|  1.23k|                    {
 7021|  1.23k|                        if (v1t != NO_VERTEX)
  ------------------
  |  |  118|  1.23k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7021:29): [True: 1.23k, False: 0]
  ------------------
 7022|  1.23k|                        {
 7023|  1.23k|                            v1Act = v1t;
 7024|  1.23k|                        }
 7025|  1.23k|                    }
 7026|  1.23k|                }
 7027|  1.52k|            }
 7028|       |
 7029|       |            /* Find t-group that contains v2 */
 7030|  1.60k|            if (( pVert2->type & type ) == type)
  ------------------
  |  Branch (7030:17): [True: 1.43k, False: 163]
  ------------------
 7031|  1.43k|            {
 7032|  1.43k|                v2t = GetGroupVertex( pBNS, v2, type );
 7033|  1.43k|                if (BNS_BOND_ERR == v2t)
  ------------------
  |  |   52|  1.43k|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   47|  1.43k|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
  |  Branch (7033:21): [True: 405, False: 1.03k]
  ------------------
 7034|    405|                {
 7035|    405|                    v2t = NO_VERTEX;
  ------------------
  |  |  118|    405|#define NO_VERTEX    -2
  ------------------
 7036|    405|                }
 7037|  1.03k|                else
 7038|  1.03k|                {
 7039|  1.03k|                    if (IS_BNS_ERROR( v2t ))
  ------------------
  |  |   67|  1.03k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  1.03k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  1.03k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  1.03k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 1.03k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 1.03k]
  |  |  ------------------
  ------------------
 7040|      0|                    {
 7041|      0|                        return v2t;
 7042|      0|                    }
 7043|  1.03k|                    else
 7044|  1.03k|                    {
 7045|  1.03k|                        if (v2t != NO_VERTEX)
  ------------------
  |  |  118|  1.03k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7045:29): [True: 1.03k, False: 0]
  ------------------
 7046|  1.03k|                        {
 7047|  1.03k|                            v2Act = v2t;
 7048|  1.03k|                        }
 7049|  1.03k|                    }
 7050|  1.03k|                }
 7051|  1.43k|            }
 7052|       |
 7053|  1.60k|            if (v1t != NO_VERTEX && v1t == v2t)
  ------------------
  |  |  118|  3.20k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7053:17): [True: 1.23k, False: 369]
  |  Branch (7053:37): [True: 934, False: 297]
  ------------------
 7054|    934|            {
 7055|    934|                cap = 2; /* same t-group */
 7056|    934|            }
 7057|       |
 7058|       |            /*  bAddNewVertex: (bDonors != 0) == (vit != NO_VERTEX), i=1,2 */
 7059|  1.60k|            bSet_v1 = bSet_v2 = 0;
 7060|       |            /* create new edges adjacent to v1t or v2 */
 7061|  1.60k|            iapc = 0;
 7062|  1.60k|            if (( bDonors != 0 ) == ( v1t != NO_VERTEX ))
  ------------------
  |  |  118|  1.60k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7062:17): [True: 891, False: 709]
  ------------------
 7063|    891|            {
 7064|       |                /* Create new edge and vertex, connect to v1Act */
 7065|    891|                vNew = bAddNewVertex( pBNS, v1Act, cap, 0, 1, nDots );
 7066|    891|                if (IS_BNS_ERROR( vNew ))
  ------------------
  |  |   67|    891|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|    891|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|    891|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    891|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 891, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 891]
  |  |  ------------------
  ------------------
 7067|      0|                {
 7068|      0|                    return vNew;
 7069|      0|                }
 7070|    891|                apc->vNewVertex[iapc] = vNew;
 7071|    891|                apc->bSetNew[iapc] = 1;
 7072|    891|                bSet_v1 = 1;
 7073|    891|                iapc++;
 7074|    891|            }
 7075|  1.60k|            if (( bDonors != 0 ) == ( v2t != NO_VERTEX ) && cap == 1)
  ------------------
  |  |  118|  1.60k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7075:17): [True: 988, False: 612]
  |  Branch (7075:61): [True: 521, False: 467]
  ------------------
 7076|    521|            {
 7077|       |                /* Create new edge and vertex, connect to v2Act; do not do it if cap==2 */
 7078|    521|                vNew = bAddNewVertex( pBNS, v2Act, cap, 0, 1, nDots );
 7079|    521|                if (IS_BNS_ERROR( vNew ))
  ------------------
  |  |   67|    521|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|    521|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|    521|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    521|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 521, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 521]
  |  |  ------------------
  ------------------
 7080|      0|                {
 7081|      0|                    return vNew;
 7082|      0|                }
 7083|    521|                apc->vNewVertex[iapc] = vNew;
 7084|    521|                apc->bSetNew[iapc] = 1;
 7085|    521|                bSet_v2 = 1;
 7086|    521|                iapc++;
 7087|    521|            }
 7088|  1.07k|            else
 7089|  1.07k|            {
 7090|  1.07k|                if (( bDonors != 0 ) == ( v2t != NO_VERTEX ))
  ------------------
  |  |  118|  1.07k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7090:21): [True: 467, False: 612]
  ------------------
 7091|    467|                {
 7092|    467|                    bSet_v2 = 1;
 7093|    467|                }
 7094|  1.07k|            }
 7095|       |
 7096|       |            /* Add st-cap to v1 and/or v2t */
 7097|  1.60k|            iapc = 0;
 7098|       |            /* If cap=2 then just increment st_cap 2 times */
 7099|  1.60k|            if (!bSet_v1)
  ------------------
  |  Branch (7099:17): [True: 709, False: 891]
  ------------------
 7100|    709|            {
 7101|       |                /* Add st-cap to v1 */
 7102|    709|                if (( bDonors != 0 ) == ( v1t != NO_VERTEX ))
  ------------------
  |  |  118|    709|#define NO_VERTEX    -2
  ------------------
  |  Branch (7102:21): [True: 0, False: 709]
  ------------------
 7103|      0|                {
 7104|      0|                    return BNS_BOND_ERR;
  ------------------
  |  |   52|      0|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 7105|      0|                }
 7106|    709|                n = bAddStCapToAVertex( pBNS, v1Act, v2Act, apc->nOldCapsVert[iapc], nDots, bAdjacentDonors );
 7107|    709|                apc->bSetOldCapsVert[iapc] = n;
 7108|    709|                apc->vOldVert[iapc] = v1Act;
 7109|    709|                iapc++;
 7110|    709|            }
 7111|  1.60k|            if (!bSet_v2)
  ------------------
  |  Branch (7111:17): [True: 612, False: 988]
  ------------------
 7112|    612|            {
 7113|       |                /* Add st-cap to v2t */
 7114|    612|                if (( bDonors != 0 ) == ( v2t != NO_VERTEX ))
  ------------------
  |  |  118|    612|#define NO_VERTEX    -2
  ------------------
  |  Branch (7114:21): [True: 0, False: 612]
  ------------------
 7115|      0|                {
 7116|      0|                    return BNS_BOND_ERR;
  ------------------
  |  |   52|      0|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 7117|      0|                }
 7118|    612|                n = bAddStCapToAVertex( pBNS, v2Act, v1Act, apc->nOldCapsVert[iapc], nDots, bAdjacentDonors );
 7119|    612|                apc->bSetOldCapsVert[iapc] = n;
 7120|    612|                apc->vOldVert[iapc] = v2Act;
 7121|    612|                iapc++;
 7122|    612|            }
 7123|  1.60k|            if (*nDots < 0 || *nDots % 2)
  ------------------
  |  Branch (7123:17): [True: 0, False: 1.60k]
  |  Branch (7123:31): [True: 0, False: 1.60k]
  ------------------
 7124|      0|            {
 7125|      0|                return BNS_SET_ALTP_ERR;
  ------------------
  |  |   55|      0|#define BNS_SET_ALTP_ERR   (BNS_ERR +  7) /*(-9992)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 7126|      0|            }
 7127|  1.60k|            return BNS_CHK_ALTP_SET_SUCCESS;
  ------------------
  |  | 6739|  1.60k|#define BNS_CHK_ALTP_SET_SUCCESS 4
  ------------------
 7128|  1.60k|        }
 7129|       |
 7130|  19.1k|        if (path_type == ALT_PATH_MODE_REM_PROTON)
  ------------------
  |  |  318|  19.1k|#define ALT_PATH_MODE_REM_PROTON 9   /* remove proton, adjust bonds, charges, H-counts 2004-03-05 */
  ------------------
  |  Branch (7130:13): [True: 1.47k, False: 17.6k]
  ------------------
 7131|  1.47k|        {
 7132|       |            /* added 2004-03-05 */
 7133|  1.47k|            if (v1 >= 0 && v2 >= 0 &&
  ------------------
  |  Branch (7133:17): [True: 1.47k, False: 0]
  |  Branch (7133:28): [True: 1.47k, False: 0]
  ------------------
 7134|  1.47k|                ( pVert1->type & BNS_VERT_TYPE_ANY_GROUP ) &&
  ------------------
  |  |   59|  1.47k|#define BNS_VERT_TYPE_ANY_GROUP    (BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_SUPER_TGROUP)
  |  |  ------------------
  |  |  |  |   47|  1.47k|#define BNS_VERT_TYPE_TGROUP        0x0004
  |  |  ------------------
  |  |               #define BNS_VERT_TYPE_ANY_GROUP    (BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_SUPER_TGROUP)
  |  |  ------------------
  |  |  |  |   49|  1.47k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |               #define BNS_VERT_TYPE_ANY_GROUP    (BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_SUPER_TGROUP)
  |  |  ------------------
  |  |  |  |   50|  1.47k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  ------------------
  ------------------
  |  Branch (7134:17): [True: 1.47k, False: 0]
  ------------------
 7135|  1.47k|                 ( pVert2->type & BNS_VERT_TYPE_ANY_GROUP ))
  ------------------
  |  |   59|  1.47k|#define BNS_VERT_TYPE_ANY_GROUP    (BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_SUPER_TGROUP)
  |  |  ------------------
  |  |  |  |   47|  1.47k|#define BNS_VERT_TYPE_TGROUP        0x0004
  |  |  ------------------
  |  |               #define BNS_VERT_TYPE_ANY_GROUP    (BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_SUPER_TGROUP)
  |  |  ------------------
  |  |  |  |   49|  1.47k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |               #define BNS_VERT_TYPE_ANY_GROUP    (BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_SUPER_TGROUP)
  |  |  ------------------
  |  |  |  |   50|  1.47k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  ------------------
  ------------------
  |  Branch (7135:18): [True: 1.47k, False: 0]
  ------------------
 7136|  1.47k|            {
 7137|       |                /* Create new edge and vertex, connect to v2 */
 7138|  1.47k|                if (( pBNS->vert[v1].type & BNS_VERT_TYPE_C_GROUP ) &&
  ------------------
  |  |   49|  1.47k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
  |  Branch (7138:21): [True: 1.45k, False: 13]
  ------------------
 7139|  1.45k|                    ( pBNS->vert[v1].st_edge.flow == 2 * pBNS->vert[v1].num_adj_edges ))
  ------------------
  |  Branch (7139:21): [True: 0, False: 1.45k]
  ------------------
 7140|      0|                {
 7141|       |                    /* so far in a charge group max edge flow = 1 2004-03-08 */
 7142|      0|                    return BNS_CHK_ALTP_NO_ALTPATH;
  ------------------
  |  | 6736|      0|#define BNS_CHK_ALTP_NO_ALTPATH  0
  ------------------
 7143|      0|                }
 7144|  1.47k|                memset( apc, 0, sizeof( *apc ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 7145|  1.47k|                fcd[ifcd].iedge = NO_VERTEX;
  ------------------
  |  |  118|  1.47k|#define NO_VERTEX    -2
  ------------------
 7146|  1.47k|                *nDots = 0;
 7147|  1.47k|                iapc = 0;
 7148|       |
 7149|  1.47k|                vNew = bAddNewVertex( pBNS, v2, 1, 0, 1, nDots );
 7150|  1.47k|                if (IS_BNS_ERROR( vNew ))
  ------------------
  |  |   67|  1.47k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  1.47k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  1.47k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  1.47k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 1.47k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 1.47k]
  |  |  ------------------
  ------------------
 7151|      0|                {
 7152|      0|                    return vNew;
 7153|      0|                }
 7154|  1.47k|                apc->vNewVertex[iapc] = vNew;
 7155|  1.47k|                apc->bSetNew[iapc] = 1;
 7156|       |                /*iapc ++;*/
 7157|       |                /* add st-cap (dot) to v1 */
 7158|  1.47k|                n = bAddStCapToAVertex( pBNS, v1, v2, apc->nOldCapsVert[iapc], nDots, 0 );
 7159|  1.47k|                apc->bSetOldCapsVert[iapc] = n;
 7160|  1.47k|                apc->vOldVert[iapc] = v1;
 7161|  1.47k|                iapc++;
 7162|  1.47k|                return BNS_CHK_ALTP_SET_SUCCESS;
  ------------------
  |  | 6739|  1.47k|#define BNS_CHK_ALTP_SET_SUCCESS 4
  ------------------
 7163|  1.47k|            }
 7164|  1.47k|        }
 7165|       |
 7166|  17.6k|#if ( NEUTRALIZE_ENDPOINTS == 1 ) /* { */
 7167|       |
 7168|  17.6k|        *nDots = 0;
 7169|  17.6k|        memset( apc, 0, sizeof( *apc ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 7170|  17.6k|        fcd[ifcd].iedge = NO_VERTEX;
  ------------------
  |  |  118|  17.6k|#define NO_VERTEX    -2
  ------------------
 7171|       |
 7172|  17.6k|        if (type & BNS_VERT_TYPE_ENDPOINT)
  ------------------
  |  |   46|  17.6k|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
  |  Branch (7172:13): [True: 8.94k, False: 8.72k]
  ------------------
 7173|  8.94k|        {
 7174|  8.94k|            BNS_IEDGE  iedge;
 7175|  8.94k|            AT_NUMB    type2;
 7176|  8.94k|            int ret2;
 7177|       |            /* prohibit charge movement */
 7178|  8.94k|            type2 = BNS_VERT_TYPE_C_GROUP;
  ------------------
  |  |   49|  8.94k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
 7179|  8.94k|            iedge = GetEdgeToGroupVertex( pBNS, v1, type2 );
 7180|  8.94k|            if (iedge != NO_VERTEX)
  ------------------
  |  |  118|  8.94k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7180:17): [True: 395, False: 8.55k]
  ------------------
 7181|    395|            {
 7182|       |                /*  Set flow=1 on an edge to a c-group vertex to make sure
 7183|       |                there is no positive charge when moving tautomeric H-atoms */
 7184|    395|                ret2 = bSetFlowToCheckOneBond( pBNS, iedge, 1, fcd + ifcd );
 7185|    395|                if (IS_BNS_ERROR( ret2 ))
  ------------------
  |  |   67|    395|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|    395|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|    395|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    395|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 395, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 395]
  |  |  ------------------
  ------------------
 7186|      0|                {
 7187|      0|                    return ret2;
 7188|      0|                }
 7189|    395|                *nDots += ret2;
 7190|    940|                while (fcd[ifcd].iedge != NO_VERTEX)
  ------------------
  |  |  118|    940|#define NO_VERTEX    -2
  ------------------
  |  Branch (7190:24): [True: 545, False: 395]
  ------------------
 7191|    545|                {
 7192|    545|                    ifcd++;
 7193|    545|                }
 7194|    395|            }
 7195|       |
 7196|  8.94k|            iedge = GetEdgeToGroupVertex( pBNS, v2, type2 );
 7197|       |
 7198|  8.94k|            if (iedge != NO_VERTEX)
  ------------------
  |  |  118|  8.94k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7198:17): [True: 427, False: 8.52k]
  ------------------
 7199|    427|            {
 7200|       |                /*  Set flow=1 on an edge to a c-group vertex to make sure
 7201|       |                there is no positive charge when moving tautomeric H-atoms */
 7202|       |
 7203|    427|                ret2 = bSetFlowToCheckOneBond( pBNS, iedge, 1, fcd + ifcd );
 7204|       |
 7205|    427|                if (IS_BNS_ERROR( ret2 ))
  ------------------
  |  |   67|    427|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|    427|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|    427|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    427|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 427, False: 0]
  |  |  |  Branch (67:44): [True: 82, False: 345]
  |  |  ------------------
  ------------------
 7206|     82|                {
 7207|     82|                    return ret2;
 7208|     82|                }
 7209|    345|                *nDots += ret2;
 7210|    990|                while (fcd[ifcd].iedge != NO_VERTEX)
  ------------------
  |  |  118|    990|#define NO_VERTEX    -2
  ------------------
  |  Branch (7210:24): [True: 645, False: 345]
  ------------------
 7211|    645|                {
 7212|    645|                    ifcd++;
 7213|    645|                }
 7214|    345|            }
 7215|       |
 7216|       |            /* Set hydrogen counts */
 7217|  8.86k|            type2 = BNS_VERT_TYPE_TGROUP;
  ------------------
  |  |   47|  8.86k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 7218|  8.86k|            iedge = GetEdgeToGroupVertex( pBNS, v1, type2 );
 7219|  8.86k|            if (iedge != NO_VERTEX)
  ------------------
  |  |  118|  8.86k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7219:17): [True: 1.76k, False: 7.09k]
  ------------------
 7220|  1.76k|            {
 7221|       |                /*  Set flow=1 on an edge to a t-group vertex to make sure there is
 7222|       |                a moveable hydrogen atom or (-) on v1 when moving tautomeric H-atoms */
 7223|  1.76k|#if ( FIX_H_CHECKING_TAUT == 1 )
 7224|  1.76k|                ret2 = bSetFlowToCheckOneBond( pBNS, iedge, 1, fcd + ifcd );
 7225|  1.76k|                if (IS_BNS_ERROR( ret2 ))
  ------------------
  |  |   67|  1.76k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  1.76k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  1.76k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  1.76k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 1.76k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 1.76k]
  |  |  ------------------
  ------------------
 7226|      0|                {
 7227|      0|                    return ret2;
 7228|      0|                }
 7229|  1.76k|                *nDots += ret2;
 7230|  5.50k|                while (fcd[ifcd].iedge != NO_VERTEX)
  ------------------
  |  |  118|  5.50k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7230:24): [True: 3.73k, False: 1.76k]
  ------------------
 7231|  3.73k|                {
 7232|  3.73k|                    ifcd++;
 7233|  3.73k|                }
 7234|       |#else
 7235|       |                t1 = pBNS->edge[iedge].neighbor12 ^ v1;
 7236|       |#endif
 7237|  1.76k|            }
 7238|       |
 7239|  8.86k|            iedge = GetEdgeToGroupVertex( pBNS, v2, type2 );
 7240|  8.86k|            if (iedge != NO_VERTEX)
  ------------------
  |  |  118|  8.86k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7240:17): [True: 808, False: 8.05k]
  ------------------
 7241|    808|            {
 7242|       |                /*  Set flow=0 on an edge to a t-group vertex to make sure there is
 7243|       |                no moveable hydrogen atom or (-) on v2 when moving tautomeric H-atoms  */
 7244|    808|#if ( FIX_H_CHECKING_TAUT == 1 )
 7245|    808|                ret2 = bSetFlowToCheckOneBond( pBNS, iedge, 0, fcd + ifcd );
 7246|    808|                if (IS_BNS_ERROR( ret2 ))
  ------------------
  |  |   67|    808|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|    808|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|    808|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    808|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 808, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 808]
  |  |  ------------------
  ------------------
 7247|      0|                {
 7248|      0|                    return ret2;
 7249|      0|                }
 7250|    808|                *nDots += ret2;
 7251|  1.61k|                while (fcd[ifcd].iedge != NO_VERTEX)
  ------------------
  |  |  118|  1.61k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7251:24): [True: 808, False: 808]
  ------------------
 7252|    808|                {
 7253|    808|                    ifcd++;
 7254|    808|                }
 7255|       |#else
 7256|       |                t2 = pBNS->edge[iedge].neighbor12 ^ v2;
 7257|       |#endif
 7258|    808|            }
 7259|       |
 7260|  8.86k|#if ( FIX_H_CHECKING_TAUT == 1 )
 7261|       |#else
 7262|       |            if (t1 == t2 && t1 != NO_VERTEX)
 7263|       |            {
 7264|       |                return BNS_CHK_ALTP_SAME_TGROUP;
 7265|       |            }
 7266|       |#endif
 7267|       |
 7268|  8.86k|            iapc = 0;
 7269|       |            /* Create new edge and vertex with cap=1 at v2 and/or t1 */
 7270|  8.86k|            if (t1 != NO_VERTEX)
  ------------------
  |  |  118|  8.86k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7270:17): [True: 0, False: 8.86k]
  ------------------
 7271|      0|            {
 7272|       |                /* Create new edge and vertex, connect to t1 */
 7273|      0|                vNew = bAddNewVertex( pBNS, t1, 1/*cap*/, 0/*flow*/, 1/*max_adj_edges*/, nDots ); /* djb-rwth: addressing coverity ID #499581 -- condition works as expected for t1 == -2 */
 7274|      0|                if (IS_BNS_ERROR( vNew ))
  ------------------
  |  |   67|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 0, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 7275|      0|                {
 7276|      0|                    return vNew;
 7277|      0|                }
 7278|      0|                apc->vNewVertex[iapc] = vNew;
 7279|      0|                apc->bSetNew[iapc] = 1;
 7280|      0|                iapc++;
 7281|      0|            }
 7282|  8.86k|            if (t2 == NO_VERTEX)
  ------------------
  |  |  118|  8.86k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7282:17): [True: 8.86k, False: 0]
  ------------------
 7283|  8.86k|            {
 7284|       |                /* Create new edge and vertex, connect to v2 */
 7285|  8.86k|                vNew = bAddNewVertex( pBNS, v2, 1/*cap*/, 0/*flow*/, 1/*max_adj_edges*/, nDots );
 7286|  8.86k|                if (IS_BNS_ERROR( vNew ))
  ------------------
  |  |   67|  8.86k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  8.86k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  8.86k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  8.86k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 8.86k, False: 0]
  |  |  |  Branch (67:44): [True: 3, False: 8.86k]
  |  |  ------------------
  ------------------
 7287|      3|                {
 7288|      3|                    return vNew;
 7289|      3|                }
 7290|  8.86k|                apc->vNewVertex[iapc] = vNew;
 7291|  8.86k|                apc->bSetNew[iapc] = 1;
 7292|  8.86k|                iapc++;
 7293|  8.86k|            }
 7294|       |
 7295|       |            /* Add st-cap to v1 and/or v2t */
 7296|  8.86k|            iapc = 0;
 7297|  8.86k|            if (t1 == NO_VERTEX)
  ------------------
  |  |  118|  8.86k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7297:17): [True: 8.86k, False: 0]
  ------------------
 7298|  8.86k|            {
 7299|       |                /* Add st-cap to v1 */
 7300|  8.86k|                n = bAddStCapToAVertex(pBNS, v1, (Vertex)(t2 == NO_VERTEX ? v2 : t2), apc->nOldCapsVert[iapc], nDots, 0); /* djb-rwth: addressing coverity ID #499501 -- condition works as expected for t2 == -2 */
  ------------------
  |  |  118|  8.86k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7300:59): [True: 8.86k, False: 0]
  ------------------
 7301|  8.86k|                apc->bSetOldCapsVert[iapc] = n;
 7302|  8.86k|                apc->vOldVert[iapc] = v1;
 7303|  8.86k|                iapc++;
 7304|  8.86k|            }
 7305|  8.86k|            if (t2 != NO_VERTEX)
  ------------------
  |  |  118|  8.86k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7305:17): [True: 0, False: 8.86k]
  ------------------
 7306|      0|            {
 7307|       |                /* Add st-cap to t2 */
 7308|      0|                n = bAddStCapToAVertex( pBNS, t2, (Vertex) ( t1 == NO_VERTEX ? v1 : t1 ), apc->nOldCapsVert[iapc], nDots, 0 );
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (7308:62): [True: 0, False: 0]
  ------------------
 7309|      0|                apc->bSetOldCapsVert[iapc] = n;
 7310|      0|                apc->vOldVert[iapc] = t2;
 7311|      0|                iapc++;
 7312|      0|            }
 7313|  8.86k|        }
 7314|  8.72k|        else
 7315|  8.72k|        {
 7316|       |            /* Create new edge and vertex, connect to v2 */
 7317|  8.72k|            vNew = bAddNewVertex( pBNS, v2, 1 /* cap*/, 0 /* flow */, 1 /* max_adj_edges */, nDots );
 7318|  8.72k|            if (IS_BNS_ERROR( vNew ))
  ------------------
  |  |   67|  8.72k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  8.72k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  8.72k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  8.72k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 8.72k, False: 0]
  |  |  |  Branch (67:44): [True: 1, False: 8.72k]
  |  |  ------------------
  ------------------
 7319|      1|            {
 7320|      1|                return vNew;
 7321|      1|            }
 7322|  8.72k|            apc->vNewVertex[0] = vNew;
 7323|  8.72k|            apc->bSetNew[0] = 1;
 7324|       |
 7325|       |            /* add st-cap to v1 */
 7326|  8.72k|            n = bAddStCapToAVertex( pBNS, v1, v2, apc->nOldCapsVert[0], nDots, 0 );
 7327|  8.72k|            apc->bSetOldCapsVert[0] = n;
 7328|  8.72k|            apc->vOldVert[0] = v1;
 7329|  8.72k|        }
 7330|       |#else  /* } NEUTRALIZE_ENDPOINTS == 0 {*/
 7331|       |
 7332|       |        *nDots = 0;
 7333|       |        memset( apc, 0, sizeof( *apc ) );
 7334|       |        fcd[ifcd].iedge = NO_VERTEX;
 7335|       |
 7336|       |        /* Create new edge and vertex, connect to v2 */
 7337|       |        vNew = bAddNewVertex( pBNS, v2, 1 /* cap*/, 0 /* flow */, 1 /* max_adj_edges */, nDots, 0 );
 7338|       |        if (IS_BNS_ERROR( vNew ))
 7339|       |        {
 7340|       |            return vNew;
 7341|       |        }
 7342|       |        apc->vNewVertex[0] = vNew;
 7343|       |        apc->bSetNew[0] = 1;
 7344|       |
 7345|       |        /* Add st-cap to v1 */
 7346|       |        n = bAddStCapToAVertex( pBNS, v1, v2, apc->nOldCapsVert[0], nDots );
 7347|       |        apc->bSetOldCapsVert[0] = n;
 7348|       |        apc->vOldVert[0] = v1;
 7349|       |#endif /* } NEUTRALIZE_ENDPOINTS */
 7350|       |
 7351|  17.5k|        if (*nDots < 0 || *nDots % 2)
  ------------------
  |  Branch (7351:13): [True: 0, False: 17.5k]
  |  Branch (7351:27): [True: 0, False: 17.5k]
  ------------------
 7352|      0|        {
 7353|      0|            return BNS_SET_ALTP_ERR;
  ------------------
  |  |   55|      0|#define BNS_SET_ALTP_ERR   (BNS_ERR +  7) /*(-9992)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 7354|      0|        }
 7355|  17.5k|        return BNS_CHK_ALTP_SET_SUCCESS;
  ------------------
  |  | 6739|  17.5k|#define BNS_CHK_ALTP_SET_SUCCESS 4
  ------------------
 7356|  17.5k|    }
 7357|       |
 7358|       |    /*return BNS_CHK_ALTP_NO_ALTPATH;*/
 7359|  23.6k|}
bRestoreBnsAfterCheckAltPath:
 7367|  20.7k|{
 7368|  20.7k|    BNS_EDGE   *pEdge;
 7369|  20.7k|    Vertex      vNew;
 7370|  20.7k|    Vertex      vOld;
 7371|  20.7k|    BNS_VERTEX *pOldVert;
 7372|  20.7k|    BNS_VERTEX *pNewVert;
 7373|  20.7k|    int i, j, n; /* djb-rwth: removing redundant variables */
 7374|       |
 7375|       |    /* djb-rwth: removing redundant code */
 7376|       |
 7377|  20.7k|    if (bChangeFlow & BNS_EF_UPD_H_CHARGE)
  ------------------
  |  |  379|  20.7k|#define BNS_EF_UPD_H_CHARGE  64  /* update charges and H-counts according to change flow to c- and t-group vertices */
  ------------------
  |  Branch (7377:9): [True: 1.47k, False: 19.2k]
  ------------------
 7378|  1.47k|    {
 7379|       |        /* Remove new temp. vertices and edges connectong them to the structure */
 7380|  4.41k|        for (i = sizeof( apc->bSetNew ) / sizeof( apc->bSetNew[0] ) - 1; 0 <= i; i--)
  ------------------
  |  Branch (7380:74): [True: 2.94k, False: 1.47k]
  ------------------
 7381|  2.94k|        {
 7382|  2.94k|            if (apc->bSetNew[i])
  ------------------
  |  Branch (7382:17): [True: 1.47k, False: 1.47k]
  ------------------
 7383|  1.47k|            {
 7384|  1.47k|                vNew = apc->vNewVertex[i];
 7385|  1.47k|                pNewVert = pBNS->vert + vNew;
 7386|  2.94k|                for (j = 0; j < pNewVert->num_adj_edges; j++)
  ------------------
  |  Branch (7386:29): [True: 1.47k, False: 1.47k]
  ------------------
 7387|  1.47k|                {
 7388|  1.47k|                    pEdge = pBNS->edge + pNewVert->iedge[j];
 7389|  1.47k|                    vOld = pEdge->neighbor12 ^ vNew;
 7390|  1.47k|                    pOldVert = pBNS->vert + vOld;
 7391|  1.47k|                    pOldVert->st_edge.flow -= pEdge->flow;
 7392|  1.47k|                    pOldVert->st_edge.cap -= pEdge->flow;
 7393|       |                    /* disconnect new edge from pOldVert */
 7394|  1.47k|                    pOldVert->iedge[--pOldVert->num_adj_edges] = 0;
 7395|       |                    /* clear the new edge */
 7396|  1.47k|                    memset( pEdge, 0, sizeof( *pEdge ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 7397|       |                    /* and decrement the total number of edges */
 7398|  1.47k|                    pBNS->num_edges--;
 7399|  1.47k|                }
 7400|       |                /* Clear the new vertex */
 7401|  1.47k|                memset( pNewVert, 0, sizeof( *pNewVert ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 7402|       |                /*  and decrement the total number of vertices
 7403|       |                (new vertice ids are contiguous)            */
 7404|  1.47k|                pBNS->num_vertices--;
 7405|       |                /* djb-rwth: removing redundant code */
 7406|  1.47k|            }
 7407|  2.94k|        }
 7408|       |
 7409|       |        /* Restore changed caps of old vertices */
 7410|  1.47k|        for (i = sizeof( apc->bSetOldCapsVert ) / sizeof( apc->bSetOldCapsVert[0] ) - 1;
 7411|  4.41k|              0 <= i;
  ------------------
  |  Branch (7411:15): [True: 2.94k, False: 1.47k]
  ------------------
 7412|  2.94k|              i--)
 7413|  2.94k|        {
 7414|  2.94k|            if ((n = apc->bSetOldCapsVert[i])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (7414:17): [True: 1.47k, False: 1.47k]
  ------------------
 7415|  1.47k|            {
 7416|  1.47k|                pOldVert = pBNS->vert + apc->vOldVert[i];
 7417|  1.47k|                if (pOldVert->st_edge.flow <= apc->nOldCapsVert[i][0])
  ------------------
  |  Branch (7417:21): [True: 1.27k, False: 199]
  ------------------
 7418|  1.27k|                {
 7419|  1.27k|                    pOldVert->st_edge.cap = apc->nOldCapsVert[i][0];
 7420|  1.27k|                    n--;
 7421|       |                    /* djb-rwth: removing redundant code */
 7422|  1.27k|                    for (j = 0; j < n && j < pOldVert->num_adj_edges; j++)
  ------------------
  |  Branch (7422:33): [True: 0, False: 1.27k]
  |  Branch (7422:42): [True: 0, False: 0]
  ------------------
 7423|      0|                    {
 7424|      0|                        pEdge = pBNS->edge + pOldVert->iedge[j];
 7425|      0|                        pEdge->cap = apc->nOldCapsVert[i][j + 1];
 7426|      0|                    }
 7427|  1.27k|                }
 7428|  1.47k|            }
 7429|  2.94k|        }
 7430|  1.47k|    }
 7431|  19.2k|    else
 7432|  19.2k|    {
 7433|       |        /* Restore changed caps of old vertices */
 7434|  57.8k|        for (i = sizeof( apc->bSetOldCapsVert ) / sizeof( apc->bSetOldCapsVert[0] ) - 1; 0 <= i; i--)
  ------------------
  |  Branch (7434:90): [True: 38.5k, False: 19.2k]
  ------------------
 7435|  38.5k|        {
 7436|  38.5k|            if ((n = apc->bSetOldCapsVert[i])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (7436:17): [True: 18.9k, False: 19.6k]
  ------------------
 7437|  18.9k|            {
 7438|  18.9k|                pOldVert = pBNS->vert + apc->vOldVert[i];
 7439|  18.9k|                pOldVert->st_edge.cap = apc->nOldCapsVert[i][0];
 7440|  18.9k|                n--;
 7441|       |                /* djb-rwth: removing redundant code */
 7442|  51.3k|                for (j = 0; j < n && j < pOldVert->num_adj_edges; j++)
  ------------------
  |  Branch (7442:29): [True: 32.4k, False: 18.9k]
  |  Branch (7442:38): [True: 32.4k, False: 0]
  ------------------
 7443|  32.4k|                {
 7444|  32.4k|                    pEdge = pBNS->edge + pOldVert->iedge[j];
 7445|  32.4k|                    pEdge->cap = apc->nOldCapsVert[i][j + 1];
 7446|  32.4k|                }
 7447|  18.9k|            }
 7448|  38.5k|        }
 7449|       |
 7450|       |        /* Remove new temp. vertices and edges connectong them to the structure */
 7451|  57.8k|        for (i = sizeof( apc->bSetNew ) / sizeof( apc->bSetNew[0] ) - 1; 0 <= i; i--)
  ------------------
  |  Branch (7451:74): [True: 38.5k, False: 19.2k]
  ------------------
 7452|  38.5k|        {
 7453|  38.5k|            if (apc->bSetNew[i])
  ------------------
  |  Branch (7453:17): [True: 18.9k, False: 19.5k]
  ------------------
 7454|  18.9k|            {
 7455|  18.9k|                vNew = apc->vNewVertex[i];
 7456|  18.9k|                pNewVert = pBNS->vert + vNew;
 7457|  37.9k|                for (j = 0; j < pNewVert->num_adj_edges; j++)
  ------------------
  |  Branch (7457:29): [True: 18.9k, False: 18.9k]
  ------------------
 7458|  18.9k|                {
 7459|  18.9k|                    pEdge = pBNS->edge + pNewVert->iedge[j];
 7460|  18.9k|                    vOld = pEdge->neighbor12 ^ vNew;
 7461|  18.9k|                    pOldVert = pBNS->vert + vOld;
 7462|       |                    /* disconnect new edge from pOldVert */
 7463|  18.9k|                    pOldVert->iedge[--pOldVert->num_adj_edges] = 0;
 7464|       |                    /* clear the new edge */
 7465|  18.9k|                    memset( pEdge, 0, sizeof( *pEdge ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 7466|       |                    /* and decrement the total number of edges */
 7467|  18.9k|                    pBNS->num_edges--;
 7468|  18.9k|                }
 7469|       |                /* Clear the new vertex */
 7470|  18.9k|                memset( pNewVert, 0, sizeof( *pNewVert ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 7471|       |                /* and decrement the total number of vertices (new vertice ids are contiguous */
 7472|  18.9k|                pBNS->num_vertices--;
 7473|       |                /* djb-rwth: removing redundant code */
 7474|  18.9k|            }
 7475|  38.5k|        }
 7476|  19.2k|    }
 7477|       |
 7478|  20.7k|    return 0;
 7479|  20.7k|}
bExistsAnyAltPath:
 7491|  8.13k|{
 7492|  8.13k|    int nRet1, nRet2;
 7493|       |
 7494|  8.13k|    nRet1 = bExistsAltPath( pCG, pBNS, pBD, NULL, at, num_atoms, nVert2, nVert1, path_type );
 7495|       |
 7496|  8.13k|    if (nRet1 > 0)
  ------------------
  |  Branch (7496:9): [True: 4.45k, False: 3.68k]
  ------------------
 7497|  4.45k|    {
 7498|  4.45k|        return nRet1;
 7499|  4.45k|    }
 7500|       |
 7501|  3.68k|    nRet2 = bExistsAltPath( pCG, pBNS, pBD, NULL, at, num_atoms, nVert1, nVert2, path_type );
 7502|       |
 7503|  3.68k|    if (nRet2 > 0)
  ------------------
  |  Branch (7503:9): [True: 2.78k, False: 898]
  ------------------
 7504|  2.78k|    {
 7505|  2.78k|        return nRet2;
 7506|  2.78k|    }
 7507|    898|    if (IS_BNS_ERROR( nRet1 ))
  ------------------
  |  |   67|    898|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|    898|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|    898|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    898|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 898, False: 0]
  |  |  |  Branch (67:44): [True: 1, False: 897]
  |  |  ------------------
  ------------------
 7508|      1|    {
 7509|      1|        return nRet1;
 7510|      1|    }
 7511|    897|    if (IS_BNS_ERROR( nRet2 ))
  ------------------
  |  |   67|    897|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|    897|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|    897|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    897|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 897, False: 0]
  |  |  |  Branch (67:44): [True: 2, False: 895]
  |  |  ------------------
  ------------------
 7512|      2|    {
 7513|      2|        return nRet2;
 7514|      2|    }
 7515|       |
 7516|    895|    return 0;
 7517|    897|}
bIsBnsEndpoint:
 7527|  6.30k|{
 7528|  6.30k|    int i, vt;
 7529|  6.30k|    BNS_VERTEX    *pVert;  /* vertices */
 7530|  6.30k|    BNS_EDGE      *pEdge;  /* edges */
 7531|       |
 7532|  6.30k|    if (0 <= v && v < pBNS->num_atoms && ( pVert = pBNS->vert + v ) && ( pVert->type & BNS_VERT_TYPE_ENDPOINT ))
  ------------------
  |  |   46|  6.30k|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
  |  Branch (7532:9): [True: 6.30k, False: 0]
  |  Branch (7532:19): [True: 6.30k, False: 0]
  |  Branch (7532:42): [True: 6.30k, False: 0]
  |  Branch (7532:72): [True: 5.52k, False: 789]
  ------------------
 7533|  5.52k|    {
 7534|  8.13k|        for (i = pVert->num_adj_edges - 1; 0 <= i; i--)
  ------------------
  |  Branch (7534:44): [True: 6.62k, False: 1.51k]
  ------------------
 7535|  6.62k|        {
 7536|  6.62k|            pEdge = pBNS->edge + pVert->iedge[i];
 7537|  6.62k|            vt = pEdge->neighbor12 ^ v;
 7538|  6.62k|            if (pBNS->vert[vt].type & BNS_VERT_TYPE_TGROUP)
  ------------------
  |  |   47|  6.62k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
  |  Branch (7538:17): [True: 4.00k, False: 2.61k]
  ------------------
 7539|  4.00k|            {
 7540|  4.00k|                return !IS_FORBIDDEN( pEdge->forbidden, pBNS );
  ------------------
  |  |   41|  4.00k|#define IS_FORBIDDEN(EDGE_FORBIDDEN, PBNS)     (EDGE_FORBIDDEN)
  ------------------
 7541|  4.00k|            }
 7542|  6.62k|        }
 7543|  5.52k|    }
 7544|       |
 7545|  2.30k|    return 0;
 7546|  6.30k|}
bRadChangesAtomType:
 7558|  1.48k|{
 7559|       |
 7560|  1.48k|    EdgeIndex iuv;
 7561|  1.48k|    Vertex v_O, v_ChgOrH;
 7562|       |
 7563|       |    /* The previous atom along the path: should be a terminal atom */
 7564|  1.48k|    if (v_1 == NO_VERTEX)
  ------------------
  |  |  118|  1.48k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7564:9): [True: 1.48k, False: 0]
  ------------------
 7565|  1.48k|    {
 7566|  1.48k|        v_1 = GetPrevVertex( pBNS, v, pBD->SwitchEdge, &iuv );
 7567|  1.48k|    }
 7568|  1.48k|    v_O = v_1 / 2 - 1;
 7569|       |
 7570|  1.48k|    if (v_O < 0 || v_O >= pBNS->num_atoms)
  ------------------
  |  Branch (7570:9): [True: 0, False: 1.48k]
  |  Branch (7570:20): [True: 0, False: 1.48k]
  ------------------
 7571|      0|    {
 7572|      0|        return 0;
 7573|      0|    }
 7574|       |
 7575|       |    /* Make sure v_O is a terminal atom: its second neighbor is not an atom */
 7576|  1.48k|    if (pBNS->vert[pBNS->edge[pBNS->vert[v_O].iedge[1]].neighbor12 ^ v_O].type & BNS_VERT_TYPE_ATOM)
  ------------------
  |  |   45|  1.48k|#define BNS_VERT_TYPE_ATOM          0x0001
  ------------------
  |  Branch (7576:9): [True: 1.48k, False: 0]
  ------------------
 7577|  1.48k|    {
 7578|  1.48k|        return 0;
 7579|  1.48k|    }
 7580|       |
 7581|       |    /* The next to previous vertex vertex along the path: should be a Charge or Taut group vertex */
 7582|      0|    if (v_2 == NO_VERTEX)
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (7582:9): [True: 0, False: 0]
  ------------------
 7583|      0|    {
 7584|      0|        v_2 = GetPrevVertex( pBNS, v_1, pBD->SwitchEdge, &iuv );
 7585|      0|    }
 7586|       |
 7587|      0|    v_ChgOrH = v_2 / 2 - 1;
 7588|      0|    if (v_ChgOrH < pBNS->num_atoms)
  ------------------
  |  Branch (7588:9): [True: 0, False: 0]
  ------------------
 7589|      0|    {
 7590|      0|        return 0;
 7591|      0|    }
 7592|       |
 7593|       |    /* Make sure v_ChgOrH is a charge or taut_group */
 7594|      0|    if (pBNS->vert[v_ChgOrH].type & ( BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP ))
  ------------------
  |  |   47|      0|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
                  if (pBNS->vert[v_ChgOrH].type & ( BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP ))
  ------------------
  |  |   49|      0|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
  |  Branch (7594:9): [True: 0, False: 0]
  ------------------
 7595|      0|    {
 7596|      0|        return 1;
 7597|      0|    }
 7598|       |
 7599|      0|    return 0;
 7600|      0|}
RegisterRadEndpoint:
 7605|  25.7k|{
 7606|  25.7k|    EdgeIndex iuv;
 7607|  25.7k|    int       i, num_found;
 7608|  25.7k|    Vertex    v, w;
 7609|  25.7k|    Vertex    u_last, v2;
 7610|  25.7k|    switch (pBD->bRadSrchMode)
  ------------------
  |  Branch (7610:13): [True: 25.7k, False: 0]
  ------------------
 7611|  25.7k|    {
 7612|  10.6k|        case  RAD_SRCH_NORM:
  ------------------
  |  Branch (7612:9): [True: 10.6k, False: 15.0k]
  ------------------
 7613|       |            /* Go backwards along alt path and stop at the 1st found atom (not a fictitious vertex) */
 7614|       |            /* we need only vertices where a radical may be moved, therefore exclude u%2=1 (odd) vertices */
 7615|       |            /* atom number = u/2-1; u = 0 or 1 is 's' or 't' vertices, respectively, they are not atoms  */
 7616|  10.6k|            num_found = 0;
 7617|  14.1k|            while (u > Vertex_t && ( u % 2 || u / 2 > pBNS->num_atoms ))
  ------------------
  |  |  116|  28.2k|#define Vertex_t 1
  ------------------
  |  Branch (7617:20): [True: 14.1k, False: 0]
  |  Branch (7617:38): [True: 2.70k, False: 11.4k]
  |  Branch (7617:47): [True: 729, False: 10.6k]
  ------------------
 7618|  3.43k|            {
 7619|  3.43k|                u = GetPrevVertex( pBNS, u, pBD->SwitchEdge, &iuv );
 7620|  3.43k|            }
 7621|  10.6k|            w = u / 2 - 1; /* Check whether u is a radical endpoint */
 7622|  10.6k|            if (Vertex_t < u && w < pBNS->num_atoms &&
  ------------------
  |  |  116|  10.6k|#define Vertex_t 1
  ------------------
  |  Branch (7622:17): [True: 10.6k, False: 0]
  |  Branch (7622:33): [True: 10.6k, False: 0]
  ------------------
 7623|  10.6k|                 pBNS->vert[w].st_edge.cap == ( pBNS->vert[w].st_edge.flow & EDGE_FLOW_ST_MASK ))
  ------------------
  |  |  128|  10.6k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (7623:18): [True: 5.83k, False: 4.86k]
  ------------------
 7624|  5.83k|            {
 7625|       |                /* u is an atom; it is not a radical atom */
 7626|       |                /* now search for the starting radical atom by following the path back from u */
 7627|  5.83k|                v = u_last = u;
 7628|  31.0k|                while (v > Vertex_t)
  ------------------
  |  |  116|  31.0k|#define Vertex_t 1
  ------------------
  |  Branch (7628:24): [True: 25.2k, False: 5.83k]
  ------------------
 7629|  25.2k|                {
 7630|  25.2k|                    u = v;
 7631|  25.2k|                    v = GetPrevVertex( pBNS, u, pBD->SwitchEdge, &iuv ); /* Radical endpoint */
 7632|  25.2k|                }
 7633|       |                /* Check whether u is a radical atom */
 7634|  5.83k|                if (!( u % 2 ) && Vertex_t < u &&
  ------------------
  |  |  116|  5.83k|#define Vertex_t 1
  ------------------
  |  Branch (7634:21): [True: 5.83k, False: 0]
  |  Branch (7634:35): [True: 5.83k, False: 0]
  ------------------
 7635|  5.83k|                    ( u = u / 2 - 1 ) < pBNS->num_atoms &&
  ------------------
  |  Branch (7635:21): [True: 5.83k, False: 0]
  ------------------
 7636|  5.83k|                     pBNS->vert[u].st_edge.cap > ( pBNS->vert[u].st_edge.flow & EDGE_FLOW_ST_MASK ))
  ------------------
  |  |  128|  5.83k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (7636:22): [True: 5.83k, False: 0]
  ------------------
 7637|  5.83k|                {
 7638|       |                    /* at pBNS->vert[u] we have found the radical that originated the path */
 7639|       |                    /* pBD->RadEndpoints[2k] is the radical, pBD->RadEndpoints[2k+1] is the farthest atom */
 7640|       |                    /* to which the radical may be moved (farthest reachable atom) */
 7641|       |
 7642|       |                    /* add *all* atoms that may receive radical from u_rad */
 7643|       |                    /* exception: at2 in: ==(+/-/H)---at1==at2(possible rad endpoint) if pBNS->type_TACN */
 7644|  31.0k|                    for (v = u_last; v > Vertex_t; v = GetPrevVertex( pBNS, v, pBD->SwitchEdge, &iuv ))
  ------------------
  |  |  116|  31.0k|#define Vertex_t 1
  ------------------
  |  Branch (7644:38): [True: 25.2k, False: 5.83k]
  ------------------
 7645|  25.2k|                    {
 7646|  25.2k|                        if (!( v % 2 ) && ( v2 = v / 2 - 1 ) < pBNS->num_atoms &&
  ------------------
  |  Branch (7646:29): [True: 15.5k, False: 9.70k]
  |  Branch (7646:43): [True: 14.2k, False: 1.25k]
  ------------------
 7647|  14.2k|                             pBNS->vert[v2].st_edge.cap == ( pBNS->vert[v2].st_edge.flow & EDGE_FLOW_ST_MASK ))
  ------------------
  |  |  128|  14.2k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (7647:30): [True: 8.44k, False: 5.83k]
  ------------------
 7648|  8.44k|                        {
 7649|       |                            /* Check exception */
 7650|  8.44k|                            if (pBNS->type_TACN &&
  ------------------
  |  Branch (7650:33): [True: 1.48k, False: 6.95k]
  ------------------
 7651|  1.48k|                                 bRadChangesAtomType( pBNS, pBD, v, NO_VERTEX, NO_VERTEX ))
  ------------------
  |  |  118|  1.48k|#define NO_VERTEX    -2
  ------------------
                                               bRadChangesAtomType( pBNS, pBD, v, NO_VERTEX, NO_VERTEX ))
  ------------------
  |  |  118|  1.48k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7651:34): [True: 0, False: 1.48k]
  ------------------
 7652|      0|                            {
 7653|      0|                                continue;
 7654|      0|                            }
 7655|       |                            /* Add */
 7656|  15.8k|                            for (i = 0; i < pBD->nNumRadEndpoints; i += 2)
  ------------------
  |  Branch (7656:41): [True: 9.28k, False: 6.58k]
  ------------------
 7657|  9.28k|                            {
 7658|       |                                /* Check whether this pair, (u,w), has already been saved */
 7659|  9.28k|                                if (u == pBD->RadEndpoints[i] &&
  ------------------
  |  Branch (7659:37): [True: 9.28k, False: 0]
  ------------------
 7660|  9.28k|                                     v2 == pBD->RadEndpoints[i + 1])
  ------------------
  |  Branch (7660:38): [True: 1.85k, False: 7.42k]
  ------------------
 7661|  1.85k|                                {
 7662|  1.85k|                                    break;
 7663|  1.85k|                                }
 7664|  9.28k|                            }
 7665|  8.44k|                            if (i >= pBD->nNumRadEndpoints)
  ------------------
  |  Branch (7665:33): [True: 6.58k, False: 1.85k]
  ------------------
 7666|  6.58k|                            {
 7667|       |                                /* Add new (u,w) pair */
 7668|  6.58k|                                if (pBD->nNumRadEndpoints + 2 <= pBD->max_num_vertices)
  ------------------
  |  Branch (7668:37): [True: 6.58k, False: 0]
  ------------------
 7669|  6.58k|                                {
 7670|       |                                    /* add */
 7671|  6.58k|                                    pBD->RadEndpoints[pBD->nNumRadEndpoints++] = u; /* radical */
 7672|  6.58k|                                    pBD->RadEndpoints[pBD->nNumRadEndpoints++] = v2; /* endpoint */
 7673|  6.58k|                                    num_found++;
 7674|       |                                    /*return 1;*/ /* registered */
 7675|  6.58k|                                }
 7676|      0|                                else
 7677|      0|                                {
 7678|      0|                                    return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 7679|      0|                                }
 7680|  6.58k|                            }
 7681|  8.44k|                        }
 7682|  25.2k|                    }
 7683|  5.83k|                    if (num_found)
  ------------------
  |  Branch (7683:25): [True: 5.20k, False: 621]
  ------------------
 7684|  5.20k|                    {
 7685|  5.20k|                        return 1;
 7686|  5.20k|                    }
 7687|  5.83k|                }
 7688|  5.83k|            }
 7689|  5.48k|            break;
 7690|       |
 7691|  15.0k|        case RAD_SRCH_FROM_FICT:
  ------------------
  |  Branch (7691:9): [True: 15.0k, False: 10.6k]
  ------------------
 7692|       |            /* Find the nearest atom accessible from a fictitious vertex */
 7693|       |            /* go backwards along alt path and stop at the 1st found atom (not a fictitious vertex) */
 7694|       |
 7695|  15.0k|            v = u;
 7696|  15.0k|            w = NO_VERTEX; /* the nearest atom -- radical-endpoint */
  ------------------
  |  |  118|  15.0k|#define NO_VERTEX    -2
  ------------------
 7697|  15.0k|            u = NO_VERTEX; /* fictitious vertex carrying a radical */
  ------------------
  |  |  118|  15.0k|#define NO_VERTEX    -2
  ------------------
 7698|       |
 7699|   149k|            while (v > Vertex_t)
  ------------------
  |  |  116|   149k|#define Vertex_t 1
  ------------------
  |  Branch (7699:20): [True: 134k, False: 15.0k]
  ------------------
 7700|   134k|            {
 7701|   134k|                u = v;
 7702|   134k|                if (!( v % 2 ) && v / 2 <= pBNS->num_atoms &&
  ------------------
  |  Branch (7702:21): [True: 70.7k, False: 64.1k]
  |  Branch (7702:35): [True: 14.6k, False: 56.0k]
  ------------------
 7703|  14.6k|                     pBNS->vert[v / 2 - 1].st_edge.cap - pBNS->vert[v / 2 - 1].st_edge.flow < 2)
  ------------------
  |  Branch (7703:22): [True: 14.6k, False: 0]
  ------------------
 7704|  14.6k|                {
 7705|  14.6k|                    w = v; /* vertex w is atom that may be singlet or doublet but not triplet */
 7706|  14.6k|                }
 7707|   134k|                v = GetPrevVertex( pBNS, u, pBD->SwitchEdge, &iuv );
 7708|   134k|            }
 7709|  15.0k|            v = u / 2 - 1; /* vertex u may be the radical from which the path originated; w is the nearest atom */
 7710|  15.0k|            if (w == NO_VERTEX || u == NO_VERTEX || w % 2 || u == w || v < pBNS->num_atoms ||
  ------------------
  |  |  118|  30.1k|#define NO_VERTEX    -2
  ------------------
                          if (w == NO_VERTEX || u == NO_VERTEX || w % 2 || u == w || v < pBNS->num_atoms ||
  ------------------
  |  |  118|  25.5k|#define NO_VERTEX    -2
  ------------------
  |  Branch (7710:17): [True: 4.62k, False: 10.4k]
  |  Branch (7710:35): [True: 0, False: 10.4k]
  |  Branch (7710:53): [True: 0, False: 10.4k]
  |  Branch (7710:62): [True: 0, False: 10.4k]
  |  Branch (7710:72): [True: 0, False: 10.4k]
  ------------------
 7711|  10.4k|                 pBNS->vert[v].st_edge.cap == pBNS->vert[v].st_edge.flow ||
  ------------------
  |  Branch (7711:18): [True: 0, False: 10.4k]
  ------------------
 7712|  10.4k|                 ( w = w / 2 - 1 ) >= pBNS->num_atoms)
  ------------------
  |  Branch (7712:18): [True: 0, False: 10.4k]
  ------------------
 7713|  4.62k|            {
 7714|  4.62k|                break; /* reject */
 7715|  4.62k|            }
 7716|  10.4k|            u = v;
 7717|       |            /* At pBNS->vert[u] we have found the radical that originated the path, w is the nearest atom */
 7718|  18.0k|            for (i = 0; i < pBD->nNumRadEndpoints; i += 2)
  ------------------
  |  Branch (7718:25): [True: 15.1k, False: 2.92k]
  ------------------
 7719|  15.1k|            {
 7720|  15.1k|                if (u == pBD->RadEndpoints[i] &&
  ------------------
  |  Branch (7720:21): [True: 15.0k, False: 62]
  ------------------
 7721|  15.0k|                     w == pBD->RadEndpoints[i + 1])
  ------------------
  |  Branch (7721:22): [True: 7.54k, False: 7.50k]
  ------------------
 7722|  7.54k|                {
 7723|  7.54k|                    break; /* this pair has already been stored */
 7724|  7.54k|                }
 7725|  15.1k|            }
 7726|  10.4k|            if (i >= pBD->nNumRadEndpoints)
  ------------------
  |  Branch (7726:17): [True: 2.92k, False: 7.54k]
  ------------------
 7727|  2.92k|            {
 7728|       |                /* A new pair has been found */
 7729|  2.92k|                if (pBD->nNumRadEndpoints + 2 <= pBD->max_num_vertices)
  ------------------
  |  Branch (7729:21): [True: 2.92k, False: 0]
  ------------------
 7730|  2.92k|                {
 7731|       |                    /* Add */
 7732|  2.92k|                    pBD->RadEndpoints[pBD->nNumRadEndpoints++] = u; /* radical */
 7733|  2.92k|                    pBD->RadEndpoints[pBD->nNumRadEndpoints++] = w; /* endpoint */
 7734|  2.92k|                    return 1; /* registered */
 7735|  2.92k|                }
 7736|      0|                else
 7737|      0|                {
 7738|      0|                    return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 7739|      0|                }
 7740|  2.92k|            }
 7741|  7.54k|            break;
 7742|  25.7k|    }
 7743|       |
 7744|  17.6k|    return 0; /* rejected */
 7745|  25.7k|}
cmp_rad_endpoints:
 7750|  6.07k|{
 7751|       |    /* Vertex radical_vertex, radical_endpoint */
 7752|  6.07k|    const Vertex *p1 = (const Vertex *) a1;
 7753|  6.07k|    const Vertex *p2 = (const Vertex *) a2;
 7754|       |
 7755|  6.07k|    if (p1[0] < p2[0])
  ------------------
  |  Branch (7755:9): [True: 18, False: 6.05k]
  ------------------
 7756|     18|    {
 7757|     18|        return -1;
 7758|     18|    }
 7759|  6.05k|    if (p1[0] > p2[0])
  ------------------
  |  Branch (7759:9): [True: 6, False: 6.04k]
  ------------------
 7760|      6|    {
 7761|      6|        return 1;
 7762|      6|    }
 7763|  6.04k|    if (p1[1] < p2[1])
  ------------------
  |  Branch (7763:9): [True: 3.01k, False: 3.02k]
  ------------------
 7764|  3.01k|    {
 7765|  3.01k|        return -1;
 7766|  3.01k|    }
 7767|  3.02k|    if (p1[1] > p2[1])
  ------------------
  |  Branch (7767:9): [True: 3.02k, False: 0]
  ------------------
 7768|  3.02k|    {
 7769|  3.02k|        return 1;
 7770|  3.02k|    }
 7771|       |
 7772|      0|    return 0;
 7773|  3.02k|}
RemoveRadEndpoints:
 7778|  25.1k|{
 7779|  25.1k|    BNS_EDGE   *e;
 7780|  25.1k|    EdgeIndex   ie;
 7781|  25.1k|    BNS_VERTEX *p1, *p2;
 7782|  25.1k|    Vertex      v1, v2;
 7783|  25.1k|    int         i, delta, rad;
 7784|       |
 7785|  43.1k|    for (i = pBD->nNumRadEdges - 1; 0 <= i; i--)
  ------------------
  |  Branch (7785:37): [True: 18.0k, False: 25.1k]
  ------------------
 7786|  18.0k|    {
 7787|  18.0k|        ie = pBD->RadEdges[i];
 7788|  18.0k|        if (ie < 0 || ie >= pBNS->num_edges)
  ------------------
  |  Branch (7788:13): [True: 0, False: 18.0k]
  |  Branch (7788:23): [True: 0, False: 18.0k]
  ------------------
 7789|      0|        {
 7790|      0|            goto error_exit;
 7791|      0|        }
 7792|  18.0k|        e = pBNS->edge + ie;
 7793|  18.0k|        v1 = e->neighbor1;
 7794|  18.0k|        v2 = e->neighbor12 ^ v1;   /* v2 > v1 <=> v2 was added later */
 7795|  18.0k|        if (ie + 1 != pBNS->num_edges ||
  ------------------
  |  Branch (7795:13): [True: 0, False: 18.0k]
  ------------------
 7796|  18.0k|             v1 < 0 || v1 >= pBNS->num_vertices ||
  ------------------
  |  Branch (7796:14): [True: 0, False: 18.0k]
  |  Branch (7796:24): [True: 0, False: 18.0k]
  ------------------
 7797|  18.0k|             v2 < 0 || v2 >= pBNS->num_vertices)
  ------------------
  |  Branch (7797:14): [True: 0, False: 18.0k]
  |  Branch (7797:24): [True: 0, False: 18.0k]
  ------------------
 7798|      0|        {
 7799|      0|            goto error_exit;
 7800|      0|        }
 7801|  18.0k|        p1 = pBNS->vert + v1;
 7802|  18.0k|        p2 = pBNS->vert + v2;
 7803|       |
 7804|  18.0k|        if (p2->iedge[p2->num_adj_edges - 1] != ie ||
  ------------------
  |  Branch (7804:13): [True: 0, False: 18.0k]
  ------------------
 7805|  18.0k|             p1->iedge[p1->num_adj_edges - 1] != ie)
  ------------------
  |  Branch (7805:14): [True: 0, False: 18.0k]
  ------------------
 7806|      0|        {
 7807|      0|            goto error_exit;
 7808|      0|        }
 7809|       |
 7810|  18.0k|        p2->num_adj_edges--;
 7811|  18.0k|        p1->num_adj_edges--;
 7812|  18.0k|        p2->iedge[p2->num_adj_edges] = 0;
 7813|  18.0k|        p1->iedge[p1->num_adj_edges] = 0;
 7814|  18.0k|        p2->st_edge.flow -= e->flow;
 7815|  18.0k|        p1->st_edge.flow -= e->flow;
 7816|       |
 7817|  18.0k|        if (!p2->num_adj_edges && v2 >= pBNS->num_atoms)
  ------------------
  |  Branch (7817:13): [True: 8.84k, False: 9.17k]
  |  Branch (7817:35): [True: 8.84k, False: 0]
  ------------------
 7818|  8.84k|        {
 7819|  8.84k|            if (v2 + 1 != pBNS->num_vertices)
  ------------------
  |  Branch (7819:17): [True: 0, False: 8.84k]
  ------------------
 7820|      0|            {
 7821|      0|                goto error_exit;
 7822|      0|            }
 7823|  8.84k|            memset( p2, 0, sizeof( *p2 ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 7824|  8.84k|            pBNS->num_vertices--;
 7825|  8.84k|        }
 7826|       |
 7827|  18.0k|        if (!p1->num_adj_edges && v1 >= pBNS->num_atoms)
  ------------------
  |  Branch (7827:13): [True: 0, False: 18.0k]
  |  Branch (7827:35): [True: 0, False: 0]
  ------------------
 7828|      0|        {
 7829|      0|            if (v1 + 1 != pBNS->num_vertices)
  ------------------
  |  Branch (7829:17): [True: 0, False: 0]
  ------------------
 7830|      0|            {
 7831|      0|                goto error_exit;
 7832|      0|            }
 7833|      0|            memset( p1, 0, sizeof( *p1 ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 7834|      0|            pBNS->num_vertices--;
 7835|      0|        }
 7836|       |
 7837|  18.0k|        if (at && v1 < pBNS->num_atoms)
  ------------------
  |  Branch (7837:13): [True: 833, False: 17.1k]
  |  Branch (7837:19): [True: 833, False: 0]
  ------------------
 7838|    833|        {
 7839|    833|            delta = p1->st_edge.cap - p1->st_edge.flow;
 7840|    833|            rad = at[v1].radical;
 7841|    833|            switch (delta)
  ------------------
  |  Branch (7841:21): [True: 833, False: 0]
  ------------------
 7842|    833|            {
 7843|    334|                case 0:
  ------------------
  |  Branch (7843:17): [True: 334, False: 499]
  ------------------
 7844|    334|                    if (rad == RADICAL_DOUBLET)
  ------------------
  |  |   76|    334|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (7844:25): [True: 1, False: 333]
  ------------------
 7845|      1|                    {
 7846|      1|                        rad = 0;
 7847|      1|                    }
 7848|    334|                    break;
 7849|    499|                case 1:
  ------------------
  |  Branch (7849:17): [True: 499, False: 334]
  ------------------
 7850|    499|                    if (rad != RADICAL_DOUBLET)
  ------------------
  |  |   76|    499|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (7850:25): [True: 0, False: 499]
  ------------------
 7851|      0|                    {
 7852|      0|                        rad = RADICAL_DOUBLET;
  ------------------
  |  |   76|      0|#define RADICAL_DOUBLET 2
  ------------------
 7853|      0|                    }
 7854|    833|            }
 7855|    833|            at[v1].radical = rad;
 7856|    833|        }
 7857|  18.0k|        memset( e, 0, sizeof( *e ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 7858|  18.0k|        pBNS->num_edges--;
 7859|  18.0k|    }
 7860|  25.1k|    pBD->nNumRadEdges = 0;
 7861|  25.1k|    pBD->nNumRadicals = 0;
 7862|  25.1k|    pBD->bRadSrchMode = RAD_SRCH_NORM;
 7863|  25.1k|    return 0;
 7864|       |
 7865|      0|error_exit:
 7866|       |
 7867|      0|    return BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 7868|  25.1k|}
RestoreRadicalsOnly:
 7873|    197|{
 7874|    197|    BNS_EDGE   *e;
 7875|    197|    EdgeIndex   ie;
 7876|    197|    BNS_VERTEX *p1, *p2;
 7877|    197|    Vertex      v1, v2;
 7878|    197|    int         i, delta, rad;
 7879|    197|    int         p1_num_adj_edges, p2_num_adj_edges;
 7880|       |
 7881|    290|    for (i = pBD->nNumRadEdges - 1; 0 <= i; i--)
  ------------------
  |  Branch (7881:37): [True: 93, False: 197]
  ------------------
 7882|     93|    {
 7883|     93|        ie = pBD->RadEdges[i];
 7884|     93|        if (ie < 0 || ie >= pBNS->num_edges)
  ------------------
  |  Branch (7884:13): [True: 0, False: 93]
  |  Branch (7884:23): [True: 0, False: 93]
  ------------------
 7885|      0|        {
 7886|      0|            goto error_exit;
 7887|      0|        }
 7888|     93|        e = pBNS->edge + ie;
 7889|     93|        v1 = e->neighbor1;         /* atom */
 7890|     93|        v2 = e->neighbor12 ^ v1;   /* v2 > v1 <=> v2 was added later */
 7891|     93|        if (v1 < 0 || v1 >= pBNS->num_atoms ||
  ------------------
  |  Branch (7891:13): [True: 0, False: 93]
  |  Branch (7891:23): [True: 0, False: 93]
  ------------------
 7892|     93|             v2 < pBNS->num_atoms || v2 >= pBNS->num_vertices)
  ------------------
  |  Branch (7892:14): [True: 0, False: 93]
  |  Branch (7892:38): [True: 0, False: 93]
  ------------------
 7893|      0|        {
 7894|      0|            goto error_exit;
 7895|      0|        }
 7896|     93|        p1 = pBNS->vert + v1;
 7897|     93|        p2 = pBNS->vert + v2;
 7898|       |
 7899|     93|        p1_num_adj_edges = e->neigh_ord[0];
 7900|     93|        p2_num_adj_edges = e->neigh_ord[1];
 7901|       |
 7902|     93|        if (p2->iedge[p2_num_adj_edges] != ie ||
  ------------------
  |  Branch (7902:13): [True: 0, False: 93]
  ------------------
 7903|     93|             p1->iedge[p1_num_adj_edges] != ie)
  ------------------
  |  Branch (7903:14): [True: 0, False: 93]
  ------------------
 7904|      0|        {
 7905|      0|            goto error_exit;
 7906|      0|        }
 7907|       |
 7908|     93|        if (at && v1 < pBNS->num_atoms)
  ------------------
  |  Branch (7908:13): [True: 93, False: 0]
  |  Branch (7908:19): [True: 93, False: 0]
  ------------------
 7909|     93|        {
 7910|     93|            delta = p1->st_edge.cap - p1->st_edge.flow + e->flow;
 7911|     93|            rad = at[v1].radical;
 7912|     93|            switch (delta)
  ------------------
  |  Branch (7912:21): [True: 93, False: 0]
  ------------------
 7913|     93|            {
 7914|     41|                case 0:
  ------------------
  |  Branch (7914:17): [True: 41, False: 52]
  ------------------
 7915|     41|                    if (rad == RADICAL_DOUBLET)
  ------------------
  |  |   76|     41|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (7915:25): [True: 11, False: 30]
  ------------------
 7916|     11|                        rad = 0;
 7917|     41|                    break;
 7918|     52|                case 1:
  ------------------
  |  Branch (7918:17): [True: 52, False: 41]
  ------------------
 7919|     52|                    if (rad != RADICAL_DOUBLET)
  ------------------
  |  |   76|     52|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (7919:25): [True: 11, False: 41]
  ------------------
 7920|     11|                        rad = RADICAL_DOUBLET;
  ------------------
  |  |   76|     11|#define RADICAL_DOUBLET 2
  ------------------
 7921|     93|            }
 7922|     93|            at[v1].radical = rad;
 7923|     93|        }
 7924|     93|    }
 7925|    197|    return 0;
 7926|       |
 7927|      0|error_exit:
 7928|       |
 7929|      0|    return BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 7930|    197|}
SetRadEndpoints:
 7935|  3.08k|{
 7936|  3.08k|    int ret, i, j, k, delta; /* djb-rwth: removing redundant variables */
 7937|  3.08k|    BNS_VERTEX *pRad, *pEndp;
 7938|  3.08k|    Vertex     wRad, vRad, vEndp, nNumRadicals;
 7939|  3.08k|    int        nDots = 0 /* added initialization, 2006-03 */, nNumEdges;
 7940|       |
 7941|  3.08k|    if (pBNS->tot_st_cap <= pBNS->tot_st_flow)
  ------------------
  |  Branch (7941:9): [True: 0, False: 3.08k]
  ------------------
 7942|      0|    {
 7943|      0|        return 0;
 7944|      0|    }
 7945|       |
 7946|  3.08k|    pBD->nNumRadEndpoints = 0;
 7947|  3.08k|    pBD->nNumRadEdges = 0;
 7948|  3.08k|    pBD->bRadSrchMode = bRadSrchMode;
 7949|  3.08k|    pBNS->alt_path = pBNS->altp[0];
 7950|  3.08k|    pBNS->bChangeFlow = 0;
 7951|  3.08k|    ret = BalancedNetworkSearch( pBNS, pBD, BNS_EF_RAD_SRCH );
  ------------------
  |  |  384|  3.08k|#define BNS_EF_RAD_SRCH     128  /* search for rafical paths closures */
  ------------------
 7952|  3.08k|    ReInitBnData( pBD );
 7953|  3.08k|    ReInitBnStructAltPaths( pBNS );
 7954|  3.08k|    if (!ret && pBD->nNumRadEndpoints >= 2)
  ------------------
  |  Branch (7954:9): [True: 3.08k, False: 0]
  |  Branch (7954:17): [True: 1.43k, False: 1.65k]
  ------------------
 7955|  1.43k|    {
 7956|       |        /* Sort by radical locations */
 7957|  1.43k|        qsort( pBD->RadEndpoints, pBD->nNumRadEndpoints / 2, 2 * sizeof( pBD->RadEndpoints[0] ), cmp_rad_endpoints );
 7958|       |        /* djb-rwth: removing redundant code */
 7959|  1.43k|        nNumRadicals = 0;
 7960|       |
 7961|       |        /* Create new vertices (type=BNS_VERT_TYPE_TEMP) and edges with flow=cap=1 */
 7962|       |        /* connecting the new vertices radical vertices */
 7963|  2.89k|        for (i = 0; i < pBD->nNumRadEndpoints; i = j)
  ------------------
  |  Branch (7963:21): [True: 1.45k, False: 1.43k]
  ------------------
 7964|  1.45k|        {
 7965|  1.45k|            wRad = pBD->RadEndpoints[i];
 7966|  1.45k|            pRad = pBNS->vert + wRad;
 7967|  1.45k|            delta = pRad->st_edge.cap - ( pRad->st_edge.flow & EDGE_FLOW_ST_MASK );
  ------------------
  |  |  128|  1.45k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 7968|  1.45k|            if (delta <= 0)
  ------------------
  |  Branch (7968:17): [True: 0, False: 1.45k]
  ------------------
 7969|      0|            {
 7970|      0|                delta = 1;
 7971|      0|            }
 7972|  1.45k|            nNumEdges = 0;
 7973|  4.37k|            for (j = i; j < pBD->nNumRadEndpoints && wRad == pBD->RadEndpoints[j]; j += 2)
  ------------------
  |  Branch (7973:25): [True: 2.93k, False: 1.43k]
  |  Branch (7973:54): [True: 2.92k, False: 15]
  ------------------
 7974|  2.92k|            {
 7975|  2.92k|                nNumEdges++;
 7976|  2.92k|            }
 7977|       |            /* Add new aux vertex to the radical atom/vertex */
 7978|  1.45k|            vRad = bAddNewVertex( pBNS, wRad, delta, delta, nNumEdges + 1, &nDots );
 7979|  1.45k|            if (IS_BNS_ERROR( vRad ))
  ------------------
  |  |   67|  1.45k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  1.45k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  1.45k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  1.45k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 1.45k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 1.45k]
  |  |  ------------------
  ------------------
 7980|      0|            {
 7981|      0|                ret = vRad;
 7982|      0|                goto error_exit;
 7983|      0|            }
 7984|  1.45k|            pRad = pBNS->vert + vRad;
 7985|  1.45k|            pBD->RadEdges[pBD->nNumRadEdges++] = pRad->iedge[pRad->num_adj_edges - 1];
 7986|       |            /* Replace references to vertex wRad with vRad */
 7987|  4.37k|            for (k = i, nNumEdges = 0; k < j; k += 2) /* djb-rwth: ignoring LLVM warning: variable used */
  ------------------
  |  Branch (7987:40): [True: 2.92k, False: 1.45k]
  ------------------
 7988|  2.92k|            {
 7989|  2.92k|                pBD->RadEndpoints[k] = vRad;
 7990|  2.92k|            }
 7991|  1.45k|            nNumRadicals++;
 7992|  1.45k|        }
 7993|       |        /* All vRad vertex indices should be in the range vFirstNewVertex...vFirstNewVertex+nNumRadicals-1 */
 7994|       |        /* connect new vertices to the radical endpoints thus replacing radicals with even-length alternating cycles */
 7995|  2.89k|        for (i = 0; i < pBD->nNumRadEndpoints; i = j)
  ------------------
  |  Branch (7995:21): [True: 1.45k, False: 1.43k]
  ------------------
 7996|  1.45k|        {
 7997|  1.45k|            vRad = pBD->RadEndpoints[i];
 7998|  1.45k|            pRad = pBNS->vert + vRad;
 7999|  4.37k|            for (j = i; j < pBD->nNumRadEndpoints && vRad == pBD->RadEndpoints[j]; j += 2)
  ------------------
  |  Branch (7999:25): [True: 2.93k, False: 1.43k]
  |  Branch (7999:54): [True: 2.92k, False: 15]
  ------------------
 8000|  2.92k|            {
 8001|       |                /* Connect vew vertex pRad to radical endpoints */
 8002|  2.92k|                vEndp = pBD->RadEndpoints[j + 1];
 8003|  2.92k|                pEndp = pBNS->vert + vEndp;
 8004|  2.92k|                ret = AddNewEdge( pRad, pEndp, pBNS, 1, 0 );
 8005|  2.92k|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  2.92k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  2.92k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  2.92k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  2.92k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 2.92k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 2.92k]
  |  |  ------------------
  ------------------
 8006|      0|                {
 8007|      0|                    goto error_exit;
 8008|      0|                }
 8009|  2.92k|                pBD->RadEdges[pBD->nNumRadEdges++] = ret;
 8010|  2.92k|            }
 8011|  1.45k|        }
 8012|  1.43k|        pBD->nNumRadicals = nNumRadicals;
 8013|  1.43k|        return nNumRadicals; /* done */
 8014|  1.43k|    }
 8015|       |
 8016|  1.65k|    return 0; /* nothing to do */
 8017|       |
 8018|      0|error_exit:
 8019|      0|    RemoveRadEndpoints( pBNS, pBD, NULL );
 8020|       |
 8021|      0|    return ret;
 8022|  3.08k|}
SetRadEndpoints2:
 8033|  23.6k|{
 8034|  23.6k|    int ret = 0, i, j, k, n, delta = 1; /* djb-rwth: removing redundant variables */
 8035|  23.6k|    BNS_VERTEX *pRad, *pEndp;
 8036|  23.6k|    Vertex     wRad, vRad, vEndp, nNumRadicals;
 8037|  23.6k|    Vertex     vRadList[MAX_NUM_RAD], vRadEqul[MAX_NUM_RAD];
 8038|  23.6k|    int        nNumRad = 0;
 8039|  23.6k|    int        edge_flow;
 8040|  23.6k|    int        nDots = 0 /* added initialization, 2006-03 */, nNumEdges;
 8041|  23.6k|    NodeSet    VertSet;
 8042|       |
 8043|  23.6k|    if (pBNS->tot_st_cap <= pBNS->tot_st_flow)
  ------------------
  |  Branch (8043:9): [True: 17.2k, False: 6.40k]
  ------------------
 8044|  17.2k|    {
 8045|  17.2k|        return 0;
 8046|  17.2k|    }
 8047|       |
 8048|       |    /* Find all radicals: their vertices have st_cap-st_flow=delta */
 8049|       |    /* save radical atom numbers in vRadList[] and remove radical by making st_cap=st_flow */
 8050|  45.6k|    for (i = 0; i < pBNS->num_atoms; i++)
  ------------------
  |  Branch (8050:17): [True: 39.2k, False: 6.40k]
  ------------------
 8051|  39.2k|    {
 8052|  39.2k|        if (pBNS->vert[i].st_edge.cap - delta == ( pBNS->vert[i].st_edge.flow & EDGE_FLOW_ST_MASK ))
  ------------------
  |  |  128|  39.2k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (8052:13): [True: 8.00k, False: 31.2k]
  ------------------
 8053|  8.00k|        {
 8054|  8.00k|            if (nNumRad < MAX_NUM_RAD)
  ------------------
  |  | 8025|  8.00k|#define MAX_NUM_RAD  256
  ------------------
  |  Branch (8054:17): [True: 8.00k, False: 0]
  ------------------
 8055|  8.00k|            {
 8056|  8.00k|                pBNS->vert[i].st_edge.cap -= delta;
 8057|  8.00k|                pBNS->tot_st_cap -= delta;
 8058|  8.00k|                vRadList[nNumRad] = i;       /* radical position; i > j <=> vRadList[i] > vRadList[j]  */
 8059|  8.00k|                vRadEqul[nNumRad] = nNumRad; /* the smallest radical atom that has reachable
 8060|       |                                             * atoms in common with this radical atom
 8061|       |                                             * always keep vRadEqul[nNumRad] <= nNumRad */
 8062|  8.00k|                nNumRad++;
 8063|  8.00k|            }
 8064|  8.00k|        }
 8065|  39.2k|    }
 8066|       |
 8067|  6.40k|    if (pBNS->tot_st_cap - pBNS->tot_st_flow > nNumRad)
  ------------------
  |  Branch (8067:9): [True: 0, False: 6.40k]
  ------------------
 8068|      0|    {
 8069|      0|        return BNS_CAP_FLOW_ERR; /* extra st_cap on non-atoms or program error */
  ------------------
  |  |   58|      0|#define BNS_CAP_FLOW_ERR   (BNS_ERR + 10) /*(-9989)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 8070|      0|    }
 8071|       |
 8072|  6.40k|    memset( &VertSet, 0, sizeof( VertSet ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 8073|       |
 8074|       |    /* Find reachable atoms by enabling each radical separately */
 8075|  14.4k|    for (j = 0; j < nNumRad; j++)
  ------------------
  |  Branch (8075:17): [True: 8.00k, False: 6.40k]
  ------------------
 8076|  8.00k|    {
 8077|  8.00k|        i = vRadList[j];
 8078|  8.00k|        pBD->nNumRadEndpoints = 0;
 8079|  8.00k|        pBD->nNumRadEdges = 0;
 8080|  8.00k|        pBD->bRadSrchMode = bRadSrchMode;
 8081|  8.00k|        pBNS->alt_path = pBNS->altp[0];
 8082|  8.00k|        pBNS->bChangeFlow = 0;
 8083|  8.00k|        pBNS->vert[i].st_edge.cap += delta; /* enable single radical */
 8084|  8.00k|        pBNS->tot_st_cap += delta;
 8085|  8.00k|        ret = BalancedNetworkSearch( pBNS, pBD, BNS_EF_RAD_SRCH ); /* find reachable atoms */
  ------------------
  |  |  384|  8.00k|#define BNS_EF_RAD_SRCH     128  /* search for rafical paths closures */
  ------------------
 8086|  8.00k|        ReInitBnData( pBD );
 8087|  8.00k|        ReInitBnStructAltPaths( pBNS );
 8088|  8.00k|        pBD->bRadSrchMode = RAD_SRCH_NORM;
 8089|  8.00k|        pBNS->vert[i].st_edge.cap -= delta; /* disable single radical */
 8090|  8.00k|        pBNS->tot_st_cap -= delta;
 8091|  8.00k|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  8.00k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  8.00k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  8.00k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  8.00k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 8.00k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 8.00k]
  |  |  ------------------
  ------------------
 8092|      0|        {
 8093|      0|            goto error_exit;
 8094|      0|        }
 8095|  8.00k|        else
 8096|  8.00k|        {
 8097|  8.00k|            if (ret)
  ------------------
  |  Branch (8097:17): [True: 0, False: 8.00k]
  ------------------
 8098|      0|            {
 8099|      0|                ret = BNS_RADICAL_ERR; /* found augmenting path: should not happen since only one radical was enabled */
  ------------------
  |  |   59|      0|#define BNS_RADICAL_ERR    (BNS_ERR + 11) /*(-9988)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 8100|      0|                goto error_exit;
 8101|      0|            }
 8102|  8.00k|        }
 8103|  8.00k|        if (!ret && pBD->nNumRadEndpoints >= 2)
  ------------------
  |  Branch (8103:13): [True: 8.00k, False: 0]
  |  Branch (8103:21): [True: 3.63k, False: 4.36k]
  ------------------
 8104|  3.63k|        {
 8105|       |            /* Sort by: primary_key=radical locations, secondary_key=radical endoint */
 8106|       |
 8107|  3.63k|            qsort( pBD->RadEndpoints, pBD->nNumRadEndpoints / 2, 2 * sizeof( pBD->RadEndpoints[0] ), cmp_rad_endpoints );
 8108|       |
 8109|  3.63k|            if (pBD->RadEndpoints[0] != i || pBD->RadEndpoints[pBD->nNumRadEndpoints - 2] != i)
  ------------------
  |  Branch (8109:17): [True: 0, False: 3.63k]
  |  Branch (8109:46): [True: 0, False: 3.63k]
  ------------------
 8110|      0|            {
 8111|      0|                ret = BNS_RADICAL_ERR; /* more than one radical vertex */
  ------------------
  |  |   59|      0|#define BNS_RADICAL_ERR    (BNS_ERR + 11) /*(-9988)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 8112|      0|                goto error_exit;
 8113|      0|            }
 8114|  3.63k|            if (nNumRad > 1)
  ------------------
  |  Branch (8114:17): [True: 1.76k, False: 1.87k]
  ------------------
 8115|  1.76k|            {
 8116|       |                /* If more than one radical then save reachable atoms in bitmaps to allow */
 8117|       |                /* faster finding whether same atoms are reachable by two or more radicals */
 8118|       |                /* Later merge such sets */
 8119|  1.76k|                if (NULL == VertSet.bitword)
  ------------------
  |  Branch (8119:21): [True: 1.10k, False: 655]
  ------------------
 8120|  1.10k|                {
 8121|  1.10k|                    SetBitCreate( pCG );
 8122|  1.10k|                    if (!NodeSetCreate( pCG, &VertSet, pBNS->num_atoms, nNumRad ))
  ------------------
  |  Branch (8122:25): [True: 0, False: 1.10k]
  ------------------
 8123|      0|                    {
 8124|      0|                        ret = BNS_OUT_OF_RAM; /* out of RAM */
  ------------------
  |  |   49|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 8125|      0|                        goto error_exit;
 8126|      0|                    }
 8127|  1.10k|                }
 8128|       |
 8129|  1.76k|                NodeSetFromRadEndpoints( pCG, &VertSet, j, pBD->RadEndpoints, pBD->nNumRadEndpoints );
 8130|       |
 8131|       |                /* Do not allow any radical center be treated as a reachable atom: */
 8132|       |
 8133|  1.76k|                RemoveFromNodeSet( pCG, &VertSet, j, vRadList, nNumRad );
 8134|  1.76k|            }
 8135|  3.63k|        }
 8136|  8.00k|    }
 8137|       |
 8138|       |    /* Restore radical st_cap so that st_cap-st_flow=delta */
 8139|  14.4k|    for (j = 0; j < nNumRad; j++)
  ------------------
  |  Branch (8139:17): [True: 8.00k, False: 6.40k]
  ------------------
 8140|  8.00k|    {
 8141|  8.00k|        i = vRadList[j];
 8142|  8.00k|        pBNS->vert[i].st_edge.cap += delta;
 8143|  8.00k|        pBNS->tot_st_cap += delta;
 8144|  8.00k|    }
 8145|       |
 8146|       |    /* Merge lists that have common radical endpoints */
 8147|       |    /* defect: if vertex sets i and j do not intersect they will be compared 2 times */
 8148|       |    /* total up to nNumRad*(nNumRad-1)/2 calls to DoNodeSetsIntersect() */
 8149|  6.40k|    if (nNumRad > 1)
  ------------------
  |  Branch (8149:9): [True: 1.48k, False: 4.92k]
  ------------------
 8150|  1.48k|    {
 8151|  4.56k|        for (i = 0; i < nNumRad; i++)
  ------------------
  |  Branch (8151:21): [True: 3.07k, False: 1.48k]
  ------------------
 8152|  3.07k|        {
 8153|  3.07k|            if (vRadEqul[i] != i)
  ------------------
  |  Branch (8153:17): [True: 610, False: 2.46k]
  ------------------
 8154|    610|            {
 8155|    610|                continue;
 8156|    610|            }
 8157|  2.46k|            do
 8158|  3.06k|            {
 8159|  3.06k|                n = 0;
 8160|  5.36k|                for (j = i + 1; j < nNumRad; j++)
  ------------------
  |  Branch (8160:33): [True: 2.30k, False: 3.06k]
  ------------------
 8161|  2.30k|                {
 8162|  2.30k|                    if (vRadEqul[j] != j)
  ------------------
  |  Branch (8162:25): [True: 611, False: 1.69k]
  ------------------
 8163|    611|                    {
 8164|    611|                        continue;
 8165|    611|                    }
 8166|  1.69k|                    if (DoNodeSetsIntersect( &VertSet, i, j ))
  ------------------
  |  Branch (8166:25): [True: 610, False: 1.08k]
  ------------------
 8167|    610|                    {
 8168|    610|                        AddNodeSet2ToNodeSet1( &VertSet, i, j );
 8169|    610|                        vRadEqul[j] = i; /* Set j was copied to set i; i < j */
 8170|    610|                        n++;
 8171|    610|                    }
 8172|  1.69k|                }
 8173|  3.06k|            } while (n);
  ------------------
  |  Branch (8173:22): [True: 595, False: 2.46k]
  ------------------
 8174|  2.46k|        }
 8175|       |        /* Fill out pBD->RadEndpoints[] */
 8176|  4.56k|        for (i = 0, n = 0; i < nNumRad; i++)
  ------------------
  |  Branch (8176:28): [True: 3.07k, False: 1.48k]
  ------------------
 8177|  3.07k|        {
 8178|  3.07k|            if (i == vRadEqul[i])
  ------------------
  |  Branch (8178:17): [True: 2.46k, False: 610]
  ------------------
 8179|  2.46k|            {
 8180|  2.46k|                if (!IsNodeSetEmpty( &VertSet, i ))
  ------------------
  |  Branch (8180:21): [True: 1.08k, False: 1.38k]
  ------------------
 8181|  1.08k|                {
 8182|       |                    /* Store equivalent radicals */
 8183|  1.77k|                    for (j = i + 1; j < nNumRad; j++)
  ------------------
  |  Branch (8183:37): [True: 694, False: 1.08k]
  ------------------
 8184|    694|                    {
 8185|    694|                        if (i == vRadEqul[j])
  ------------------
  |  Branch (8185:29): [True: 610, False: 84]
  ------------------
 8186|    610|                        {
 8187|    610|                            pBD->RadEndpoints[n++] = vRadList[i];
 8188|    610|                            pBD->RadEndpoints[n++] = -vRadList[j] - 2; /* equivalent radical, alvays not zero */
 8189|    610|                        }
 8190|    694|                    }
 8191|       |                    /* Store endpoints */
 8192|  1.08k|                    n = AddNodesToRadEndpoints( pCG, &VertSet, i, pBD->RadEndpoints, vRadList[i], n, pBD->max_len_Pu_Pv );
 8193|  1.08k|                    if (n < 0)
  ------------------
  |  Branch (8193:25): [True: 0, False: 1.08k]
  ------------------
 8194|      0|                    {
 8195|      0|                        ret = BNS_RADICAL_ERR; /* pBD->RadEndpoints overflow */
  ------------------
  |  |   59|      0|#define BNS_RADICAL_ERR    (BNS_ERR + 11) /*(-9988)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 8196|      0|                        goto error_exit;
 8197|      0|                    }
 8198|  1.08k|                }
 8199|  1.38k|                else
 8200|  1.38k|                {
 8201|  1.38k|                    pBD->RadEndpoints[n++] = vRadList[i];
 8202|  1.38k|                    pBD->RadEndpoints[n++] = -1; /* immobile radical, only one edge to add */
 8203|  1.38k|                }
 8204|  2.46k|            }
 8205|  3.07k|        }
 8206|  1.48k|        pBD->nNumRadEndpoints = n;
 8207|  1.48k|        NodeSetFree( pCG, &VertSet );
 8208|  1.48k|    }
 8209|  4.92k|    else
 8210|  4.92k|    {
 8211|  4.92k|        if (nNumRad == 1 && !pBD->nNumRadEndpoints)
  ------------------
  |  Branch (8211:13): [True: 4.92k, False: 0]
  |  Branch (8211:29): [True: 3.04k, False: 1.87k]
  ------------------
 8212|  3.04k|        {
 8213|       |            /* 2006-07-30: a single radical; no possible endpoint found */
 8214|  6.08k|            for (i = 0, n = 0; i < nNumRad; i++)
  ------------------
  |  Branch (8214:32): [True: 3.04k, False: 3.04k]
  ------------------
 8215|  3.04k|            {
 8216|  3.04k|                pBD->RadEndpoints[n++] = vRadList[i];
 8217|  3.04k|                pBD->RadEndpoints[n++] = -1; /* immobile radical, only one edge to add */
 8218|  3.04k|            }
 8219|  3.04k|            pBD->nNumRadEndpoints = n;
 8220|  3.04k|        }
 8221|  4.92k|    }
 8222|       |
 8223|  6.40k|    if (!ret && pBD->nNumRadEndpoints >= 2)
  ------------------
  |  Branch (8223:9): [True: 6.40k, False: 0]
  |  Branch (8223:17): [True: 6.40k, False: 0]
  ------------------
 8224|  6.40k|    {
 8225|       |        /* Already sorted by radical locations */
 8226|       |        /* djb-rwth: removing redundant code */
 8227|  6.40k|        nNumRadicals = 0;
 8228|       |        /**************************************************************************
 8229|       |        * Create new vertices (type=BNS_VERT_TYPE_TEMP) and edges with flow=cap=1
 8230|       |        * connecting the new vertices radical vertices
 8231|       |        *
 8232|       |        *
 8233|       |        * Original structure:    atom A is a radical center    A==B--C*--D==E
 8234|       |        *   A*--B==C--D==E       atoms C and E are reachable:  A==B--C===D--E*
 8235|       |        *
 8236|       |        * Resultant temporary structure:
 8237|       |        *   A---B==C--D==E
 8238|       |        *  ||     /     /
 8239|       |        *  ||    /    /          The additional new vertex (*) and its
 8240|       |        *  ||   /   /            3 edges replace the radical with alternating
 8241|       |        *  ||  /  /              circuits that allow same bond changes
 8242|       |        *  || / /                as moving the radical to atoms C or E.
 8243|       |        *  ||//                  "Double bonds" here have edge cap=1, flow=1
 8244|       |        *  (*)                   "Single bonds" have edge cap=1, flow=0
 8245|       |        *
 8246|       |        *   The "equivalent radical centers" (which have at least one reachable atom
 8247|       |        *   in common) are connected to (*) with "double bonds" (edge cap=1, flow=1).
 8248|       |        *   Reachable non-radical atoms are connected by edges with cap=1, flow=0
 8249|       |        *   After running BNS to find alt.path a "double bond" from (*) may move
 8250|       |        *   to another atom thus muving the radical.
 8251|       |        *
 8252|       |        *   Number of additional (*) vertices = number of sets of
 8253|       |        *   "equivalent radical centers".
 8254|       |        *   Each such a set may include one or more radical centers.
 8255|       |        *
 8256|       |        *   The radicals will be re-created in RemoveRadEndpoints()
 8257|       |        ***************************************************************************/
 8258|  13.7k|        for (i = 0; i < pBD->nNumRadEndpoints; i = j)
  ------------------
  |  Branch (8258:21): [True: 7.39k, False: 6.40k]
  ------------------
 8259|  7.39k|        {
 8260|  7.39k|            wRad = pBD->RadEndpoints[i];
 8261|  7.39k|            pRad = pBNS->vert + wRad;
 8262|  7.39k|            delta = pRad->st_edge.cap - ( pRad->st_edge.flow & EDGE_FLOW_ST_MASK );
  ------------------
  |  |  128|  7.39k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 8263|  7.39k|            if (delta <= 0)
  ------------------
  |  Branch (8263:17): [True: 0, False: 7.39k]
  ------------------
 8264|      0|            {
 8265|      0|                delta = 1;
 8266|      0|            }
 8267|  7.39k|            nNumEdges = 0;
 8268|  18.0k|            for (j = i; j < pBD->nNumRadEndpoints && wRad == pBD->RadEndpoints[j]; j += 2)
  ------------------
  |  Branch (8268:25): [True: 11.6k, False: 6.40k]
  |  Branch (8268:54): [True: 10.6k, False: 983]
  ------------------
 8269|  10.6k|            {
 8270|  10.6k|                nNumEdges += ( pBD->RadEndpoints[j + 1] != -1 ); /* immobile radicals have one edge only */
 8271|  10.6k|            }
 8272|       |            /* Add new aux vertex to the radical atom/vertex making st_cap-st_flow=0 */
 8273|       |            /* in case of immobile radical there will be no additional eddges since nNumEdges=0 */
 8274|  7.39k|            vRad = bAddNewVertex( pBNS, wRad, delta, delta, nNumEdges + 1, &nDots );
 8275|  7.39k|            if (IS_BNS_ERROR( vRad ))
  ------------------
  |  |   67|  7.39k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  7.39k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  7.39k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  7.39k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 7.39k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 7.39k]
  |  |  ------------------
  ------------------
 8276|      0|            {
 8277|      0|                ret = vRad;
 8278|      0|                goto error_exit;
 8279|      0|            }
 8280|  7.39k|            pRad = pBNS->vert + vRad;
 8281|  7.39k|            pBD->RadEdges[pBD->nNumRadEdges++] = pRad->iedge[pRad->num_adj_edges - 1];
 8282|       |            /* replace references to vertex wRad with vRad */
 8283|  18.0k|            for (k = i, nNumEdges = 0; k < j; k += 2) /* djb-rwth: ignoring LLVM warning: variable used */
  ------------------
  |  Branch (8283:40): [True: 10.6k, False: 7.39k]
  ------------------
 8284|  10.6k|            {
 8285|  10.6k|                pBD->RadEndpoints[k] = vRad;
 8286|  10.6k|            }
 8287|  7.39k|            nNumRadicals++;
 8288|  7.39k|        }
 8289|       |        /* All vRad vertex indices should be in the range vFirstNewVertex...vFirstNewVertex+nNumRadicals-1 */
 8290|       |        /* connect new vertices to the radical endpoints thus replacing radicals with even-length alternating cycles */
 8291|  13.7k|        for (i = 0; i < pBD->nNumRadEndpoints; i = j)
  ------------------
  |  Branch (8291:21): [True: 7.39k, False: 6.40k]
  ------------------
 8292|  7.39k|        {
 8293|  7.39k|            vRad = pBD->RadEndpoints[i];
 8294|  7.39k|            pRad = pBNS->vert + vRad;
 8295|  18.0k|            for (j = i; j < pBD->nNumRadEndpoints && vRad == pBD->RadEndpoints[j]; j += 2)
  ------------------
  |  Branch (8295:25): [True: 11.6k, False: 6.40k]
  |  Branch (8295:54): [True: 10.6k, False: 983]
  ------------------
 8296|  10.6k|            {
 8297|       |                /* connect vew vertex pRad to radical endpoints */
 8298|  10.6k|                vEndp = pBD->RadEndpoints[j + 1];
 8299|  10.6k|                if (vEndp == -1)
  ------------------
  |  Branch (8299:21): [True: 4.42k, False: 6.24k]
  ------------------
 8300|  4.42k|                    continue;
 8301|  6.24k|                if (vEndp < 0)
  ------------------
  |  Branch (8301:21): [True: 610, False: 5.63k]
  ------------------
 8302|    610|                {
 8303|    610|                    edge_flow = 1;
 8304|    610|                    vEndp = -vEndp - 2; /* equivalent radical centers */
 8305|    610|                }
 8306|  5.63k|                else
 8307|  5.63k|                {
 8308|  5.63k|                    edge_flow = 0;
 8309|  5.63k|                }
 8310|  6.24k|                pEndp = pBNS->vert + vEndp;
 8311|  6.24k|                ret = AddNewEdge( pRad, pEndp, pBNS, 1, edge_flow );
 8312|  6.24k|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  6.24k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  6.24k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  6.24k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  6.24k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 6.24k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 6.24k]
  |  |  ------------------
  ------------------
 8313|      0|                {
 8314|      0|                    goto error_exit;
 8315|      0|                }
 8316|  6.24k|                pBD->RadEdges[pBD->nNumRadEdges++] = ret;
 8317|  6.24k|            }
 8318|  7.39k|        }
 8319|  6.40k|        pBD->nNumRadicals = nNumRadicals;
 8320|  6.40k|        return nNumRadicals; /* done */
 8321|  6.40k|    }
 8322|      0|    return 0; /* nothing to do */
 8323|       |
 8324|      0|error_exit:
 8325|      0|    RemoveRadEndpoints( pBNS, pBD, NULL );
 8326|      0|    NodeSetFree( pCG, &VertSet );
 8327|       |
 8328|      0|    return ret;
 8329|  6.40k|}
bExistsAltPath:
 8367|  28.1k|{
 8368|  28.1k|    ALT_PATH_CHANGES apc;
 8369|  28.1k|    int ret, ret_val, bError, bSuccess, bChangeFlow = 0, nDots, nDelta, bDoMarkChangedBonds = 1;
 8370|  28.1k|    int bAdjustRadicals = 0;
 8371|  28.1k|    AT_NUMB          type;
 8372|  28.1k|    BNS_FLOW_CHANGES fcd[4 * BNS_MAX_NUM_FLOW_CHANGES + 1];
 8373|  28.1k|    ENDPOINT_INFO    eif;
 8374|  28.1k|#if ( KETO_ENOL_TAUT == 1 )
 8375|  28.1k|    ENDPOINT_INFO    eif2;
 8376|  28.1k|#endif
 8377|       |
 8378|       |    /* Initialize */
 8379|  28.1k|    switch (path_type)
 8380|  28.1k|    {
 8381|  11.8k|        case ALT_PATH_MODE_TAUTOM:
  ------------------
  |  |  310|  11.8k|#define ALT_PATH_MODE_TAUTOM     1
  ------------------
  |  Branch (8381:9): [True: 11.8k, False: 16.2k]
  ------------------
 8382|       |            /* Check for alt path allowing to move H and (-). Purpose: confirm possible tautomerism */
 8383|  11.8k|            type = BNS_VERT_TYPE_ENDPOINT;
  ------------------
  |  |   46|  11.8k|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 8384|  11.8k|            bChangeFlow = BNS_EF_CHNG_RSTR;
  ------------------
  |  |  372|  11.8k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  11.8k|#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)
  |  |  ------------------
  |  |  |  |  371|  11.8k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
 8385|  11.8k|            if (!at[nVertSingleBond].endpoint &&
  ------------------
  |  Branch (8385:17): [True: 10.9k, False: 829]
  ------------------
 8386|  10.9k|                ( !nGetEndpointInfo( at, nVertSingleBond, &eif ) || !eif.cDonor ))
  ------------------
  |  Branch (8386:19): [True: 0, False: 10.9k]
  |  Branch (8386:69): [True: 3.50k, False: 7.48k]
  ------------------
 8387|  3.50k|            {
 8388|  3.50k|                return 0;
 8389|  3.50k|            }
 8390|  8.31k|            if (!at[nVertDoubleBond].endpoint &&
  ------------------
  |  Branch (8390:17): [True: 8.20k, False: 112]
  ------------------
 8391|  8.20k|                ( !nGetEndpointInfo( at, nVertDoubleBond, &eif ) || !eif.cAcceptor ))
  ------------------
  |  Branch (8391:19): [True: 0, False: 8.20k]
  |  Branch (8391:69): [True: 800, False: 7.40k]
  ------------------
 8392|    800|            {
 8393|    800|                return 0;
 8394|    800|            }
 8395|  7.51k|            break;
 8396|       |
 8397|  7.51k|#if ( TAUT_PT_22_00 == 1 )	
 8398|  7.51k|        case ALT_PATH_MODE_TAUTOM_PT_22_00:
  ------------------
  |  |  324|      0|#define ALT_PATH_MODE_TAUTOM_PT_22_00 11
  ------------------
  |  Branch (8398:9): [True: 0, False: 28.1k]
  ------------------
 8399|       |            /* Check for alt path allowing to move H and (-). Purpose: confirm possible tautomerism */
 8400|      0|            type = BNS_VERT_TYPE_ENDPOINT;
  ------------------
  |  |   46|      0|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 8401|      0|            bChangeFlow = BNS_EF_CHNG_RSTR;
  ------------------
  |  |  372|      0|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|      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)
  |  |  ------------------
  |  |  |  |  371|      0|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
 8402|      0|            if (!at[nVertSingleBond].endpoint &&
  ------------------
  |  Branch (8402:17): [True: 0, False: 0]
  ------------------
 8403|      0|                (!nGetEndpointInfo_PT_22_00(at, nVertSingleBond, &eif) || !eif.cDonor))
  ------------------
  |  Branch (8403:18): [True: 0, False: 0]
  |  Branch (8403:75): [True: 0, False: 0]
  ------------------
 8404|      0|                return 0;
 8405|      0|            if (!at[nVertDoubleBond].endpoint &&
  ------------------
  |  Branch (8405:17): [True: 0, False: 0]
  ------------------
 8406|      0|                (!nGetEndpointInfo_PT_22_00(at, nVertDoubleBond, &eif) || !eif.cAcceptor))
  ------------------
  |  Branch (8406:18): [True: 0, False: 0]
  |  Branch (8406:75): [True: 0, False: 0]
  ------------------
 8407|      0|                return 0;
 8408|      0|            break;
 8409|      0|#endif	
 8410|       |
 8411|      0|#if ( TAUT_PT_16_00 == 1 )	
 8412|      0|        case ALT_PATH_MODE_TAUTOM_PT_16_00:
  ------------------
  |  |  327|      0|#define ALT_PATH_MODE_TAUTOM_PT_16_00 12
  ------------------
  |  Branch (8412:9): [True: 0, False: 28.1k]
  ------------------
 8413|       |            /* Check for alt path allowing to move H and (-). Purpose: confirm possible tautomerism */
 8414|      0|            type = BNS_VERT_TYPE_ENDPOINT;
  ------------------
  |  |   46|      0|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 8415|      0|            bChangeFlow = BNS_EF_CHNG_RSTR;
  ------------------
  |  |  372|      0|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|      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)
  |  |  ------------------
  |  |  |  |  371|      0|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
 8416|      0|            if (!at[nVertSingleBond].endpoint &&
  ------------------
  |  Branch (8416:17): [True: 0, False: 0]
  ------------------
 8417|      0|                (!nGetEndpointInfo_PT_16_00(at, nVertSingleBond, &eif) || !eif.cDonor))
  ------------------
  |  Branch (8417:18): [True: 0, False: 0]
  |  Branch (8417:75): [True: 0, False: 0]
  ------------------
 8418|      0|                return 0;
 8419|      0|            if (!at[nVertDoubleBond].endpoint &&
  ------------------
  |  Branch (8419:17): [True: 0, False: 0]
  ------------------
 8420|      0|                (!nGetEndpointInfo_PT_16_00(at, nVertDoubleBond, &eif) || !eif.cAcceptor))
  ------------------
  |  Branch (8420:18): [True: 0, False: 0]
  |  Branch (8420:75): [True: 0, False: 0]
  ------------------
 8421|      0|                return 0;
 8422|      0|            break;
 8423|      0|#endif
 8424|       |
 8425|      0|#if ( TAUT_PT_06_00 == 1 )	
 8426|      0|        case ALT_PATH_MODE_TAUTOM_PT_06_00:
  ------------------
  |  |  330|      0|#define ALT_PATH_MODE_TAUTOM_PT_06_00 13
  ------------------
  |  Branch (8426:9): [True: 0, False: 28.1k]
  ------------------
 8427|       |            /* Check for alt path allowing to move H and (-). Purpose: confirm possible tautomerism */
 8428|      0|            type = BNS_VERT_TYPE_ENDPOINT;
  ------------------
  |  |   46|      0|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 8429|      0|            bChangeFlow = BNS_EF_CHNG_RSTR;
  ------------------
  |  |  372|      0|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|      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)
  |  |  ------------------
  |  |  |  |  371|      0|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
 8430|      0|            if (!at[nVertSingleBond].endpoint &&
  ------------------
  |  Branch (8430:17): [True: 0, False: 0]
  ------------------
 8431|      0|                (!nGetEndpointInfo_PT_06_00(at, nVertSingleBond, &eif) || !eif.cDonor))
  ------------------
  |  Branch (8431:18): [True: 0, False: 0]
  |  Branch (8431:75): [True: 0, False: 0]
  ------------------
 8432|      0|                return 0;
 8433|      0|            if (!at[nVertDoubleBond].endpoint &&
  ------------------
  |  Branch (8433:17): [True: 0, False: 0]
  ------------------
 8434|      0|                (!nGetEndpointInfo_PT_06_00(at, nVertDoubleBond, &eif) || !eif.cAcceptor))
  ------------------
  |  Branch (8434:18): [True: 0, False: 0]
  |  Branch (8434:75): [True: 0, False: 0]
  ------------------
 8435|      0|                return 0;
 8436|      0|            break;
 8437|      0|#endif
 8438|       |
 8439|      0|#if ( TAUT_PT_39_00 == 1 )	
 8440|      0|        case ALT_PATH_MODE_TAUTOM_PT_39_00:
  ------------------
  |  |  333|      0|#define ALT_PATH_MODE_TAUTOM_PT_39_00 14
  ------------------
  |  Branch (8440:9): [True: 0, False: 28.1k]
  ------------------
 8441|       |            /* Check for alt path allowing to move H and (-). Purpose: confirm possible tautomerism */
 8442|      0|            type = BNS_VERT_TYPE_ENDPOINT;
  ------------------
  |  |   46|      0|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 8443|      0|            bChangeFlow = BNS_EF_CHNG_RSTR;
  ------------------
  |  |  372|      0|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|      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)
  |  |  ------------------
  |  |  |  |  371|      0|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
 8444|      0|            if (!at[nVertSingleBond].endpoint &&
  ------------------
  |  Branch (8444:17): [True: 0, False: 0]
  ------------------
 8445|      0|                (!nGetEndpointInfo_PT_39_00(at, nVertSingleBond, &eif) || !eif.cDonor))
  ------------------
  |  Branch (8445:18): [True: 0, False: 0]
  |  Branch (8445:75): [True: 0, False: 0]
  ------------------
 8446|      0|                return 0;
 8447|      0|            if (!at[nVertDoubleBond].endpoint &&
  ------------------
  |  Branch (8447:17): [True: 0, False: 0]
  ------------------
 8448|      0|                (!nGetEndpointInfo_PT_39_00(at, nVertDoubleBond, &eif) || !eif.cAcceptor))
  ------------------
  |  Branch (8448:18): [True: 0, False: 0]
  |  Branch (8448:75): [True: 0, False: 0]
  ------------------
 8449|      0|                return 0;
 8450|      0|            break;
 8451|      0|#endif		
 8452|       |
 8453|      0|#if ( TAUT_PT_13_00 == 1 )	
 8454|      0|        case ALT_PATH_MODE_TAUTOM_PT_13_00:
  ------------------
  |  |  336|      0|#define ALT_PATH_MODE_TAUTOM_PT_13_00 15
  ------------------
  |  Branch (8454:9): [True: 0, False: 28.1k]
  ------------------
 8455|       |            /* Check for alt path allowing to move H and (-). Purpose: confirm possible tautomerism */
 8456|      0|            type = BNS_VERT_TYPE_ENDPOINT;
  ------------------
  |  |   46|      0|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 8457|      0|            bChangeFlow = BNS_EF_CHNG_RSTR;
  ------------------
  |  |  372|      0|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|      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)
  |  |  ------------------
  |  |  |  |  371|      0|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
 8458|      0|            if (!at[nVertSingleBond].endpoint &&
  ------------------
  |  Branch (8458:17): [True: 0, False: 0]
  ------------------
 8459|      0|                (!nGetEndpointInfo_PT_13_00(at, nVertSingleBond, &eif) || !eif.cDonor))
  ------------------
  |  Branch (8459:18): [True: 0, False: 0]
  |  Branch (8459:75): [True: 0, False: 0]
  ------------------
 8460|      0|                return 0;
 8461|      0|            if (!at[nVertDoubleBond].endpoint &&
  ------------------
  |  Branch (8461:17): [True: 0, False: 0]
  ------------------
 8462|      0|                (!nGetEndpointInfo_PT_13_00(at, nVertDoubleBond, &eif) || !eif.cAcceptor))
  ------------------
  |  Branch (8462:18): [True: 0, False: 0]
  |  Branch (8462:75): [True: 0, False: 0]
  ------------------
 8463|      0|                return 0;
 8464|      0|            break;
 8465|      0|#endif
 8466|       |
 8467|      0|#if ( TAUT_PT_18_00 == 1 )	
 8468|      0|        case ALT_PATH_MODE_TAUTOM_PT_18_00:
  ------------------
  |  |  339|      0|#define ALT_PATH_MODE_TAUTOM_PT_18_00 16
  ------------------
  |  Branch (8468:9): [True: 0, False: 28.1k]
  ------------------
 8469|       |            /* Check for alt path allowing to move H and (-). Purpose: confirm possible tautomerism */
 8470|      0|            type = BNS_VERT_TYPE_ENDPOINT;
  ------------------
  |  |   46|      0|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 8471|      0|            bChangeFlow = BNS_EF_CHNG_RSTR;
  ------------------
  |  |  372|      0|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|      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)
  |  |  ------------------
  |  |  |  |  371|      0|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
 8472|      0|            if (!at[nVertSingleBond].endpoint &&
  ------------------
  |  Branch (8472:17): [True: 0, False: 0]
  ------------------
 8473|      0|                (!nGetEndpointInfo_PT_18_00(at, nVertSingleBond, &eif) || !eif.cDonor))
  ------------------
  |  Branch (8473:18): [True: 0, False: 0]
  |  Branch (8473:75): [True: 0, False: 0]
  ------------------
 8474|      0|                return 0;
 8475|      0|            if (!at[nVertDoubleBond].endpoint &&
  ------------------
  |  Branch (8475:17): [True: 0, False: 0]
  ------------------
 8476|      0|                (!nGetEndpointInfo_PT_18_00(at, nVertDoubleBond, &eif) || !eif.cAcceptor))
  ------------------
  |  Branch (8476:18): [True: 0, False: 0]
  |  Branch (8476:75): [True: 0, False: 0]
  ------------------
 8477|      0|                return 0;
 8478|      0|            break;
 8479|      0|#endif	
 8480|       |
 8481|       |
 8482|      0|#if ( KETO_ENOL_TAUT == 1 )
 8483|      0|        case ALT_PATH_MODE_TAUTOM_KET:
  ------------------
  |  |  320|      0|#define ALT_PATH_MODE_TAUTOM_KET 10  /* same as ALT_PATH_MODE_TAUTOM, applies to C=-OH or CH-=O; H may be (-) */
  ------------------
  |  Branch (8483:9): [True: 0, False: 28.1k]
  ------------------
 8484|       |            /* Check for alt path allowing to move H and (-). Purpose: confirm possible tautomerism */
 8485|      0|            type = BNS_VERT_TYPE_ENDPOINT;
  ------------------
  |  |   46|      0|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 8486|      0|            bChangeFlow = BNS_EF_CHNG_RSTR;
  ------------------
  |  |  372|      0|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|      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)
  |  |  ------------------
  |  |  |  |  371|      0|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
 8487|       |
 8488|      0|            if (!at[nVertSingleBond].endpoint &&
  ------------------
  |  Branch (8488:17): [True: 0, False: 0]
  ------------------
 8489|      0|                ( !nGetEndpointInfo_KET( at, nVertSingleBond, &eif ) || !eif.cDonor ))
  ------------------
  |  Branch (8489:19): [True: 0, False: 0]
  |  Branch (8489:73): [True: 0, False: 0]
  ------------------
 8490|      0|            {
 8491|      0|                return 0;
 8492|      0|            }
 8493|      0|            if (!at[nVertDoubleBond].endpoint &&
  ------------------
  |  Branch (8493:17): [True: 0, False: 0]
  ------------------
 8494|      0|                ( !nGetEndpointInfo_KET( at, nVertDoubleBond, &eif2 ) || !eif2.cAcceptor ))
  ------------------
  |  Branch (8494:19): [True: 0, False: 0]
  |  Branch (8494:74): [True: 0, False: 0]
  ------------------
 8495|      0|            {
 8496|      0|                return 0;
 8497|      0|            }
 8498|       |            /*
 8499|       |            if ( eif.cKetoEnolCode + eif2.cKetoEnolCode != 3 )
 8500|       |            return 0;
 8501|       |            */
 8502|      0|            break;
 8503|       |
 8504|      0|#endif
 8505|  8.72k|        case ALT_PATH_MODE_CHARGE:
  ------------------
  |  |  311|  8.72k|#define ALT_PATH_MODE_CHARGE     2
  ------------------
  |  Branch (8505:9): [True: 8.72k, False: 19.3k]
  ------------------
 8506|       |            /* Find alt path allowing to move (+). Purpose: establish "charge groups",
 8507|       |            mark alt. bonds due to (+) charge movement */
 8508|  8.72k|            type = BNS_VERT_TYPE_C_POINT;
  ------------------
  |  |   48|  8.72k|#define BNS_VERT_TYPE_C_POINT       0x0008
  ------------------
 8509|  8.72k|            bChangeFlow = ( BNS_EF_CHNG_RSTR | BNS_EF_ALTR_BONDS );
  ------------------
  |  |  372|  8.72k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  8.72k|#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)
  |  |  ------------------
  |  |  |  |  371|  8.72k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
                          bChangeFlow = ( BNS_EF_CHNG_RSTR | BNS_EF_ALTR_BONDS );
  ------------------
  |  |  374|  8.72k|#define BNS_EF_ALTR_BONDS     8  /* make altern. bonds in the structure if the flow has changed */
  ------------------
 8510|  8.72k|            break;
 8511|       |
 8512|  1.43k|        case ALT_PATH_MODE_4_SALT:
  ------------------
  |  |  312|  1.43k|#define ALT_PATH_MODE_4_SALT     3   /* mark alt bonds along the path */
  ------------------
  |  Branch (8512:9): [True: 1.43k, False: 26.6k]
  ------------------
 8513|  1.43k|        case ALT_PATH_MODE_4_SALT2:
  ------------------
  |  |  313|  1.43k|#define ALT_PATH_MODE_4_SALT2    4   /* mark alt bonds along the path, path to taut. group fict. vertex if exists */
  ------------------
  |  Branch (8513:9): [True: 0, False: 28.1k]
  ------------------
 8514|       |            /* Find alt paths allowing to move (-) and H between "acidic oxygen atoms".
 8515|       |            Purpose: mark alt bonds due to this "long range" tautomerism. */
 8516|  1.43k|            type = BNS_VERT_TYPE_ENDPOINT;
  ------------------
  |  |   46|  1.43k|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 8517|  1.43k|            bChangeFlow = ( BNS_EF_CHNG_RSTR | BNS_EF_ALTR_BONDS );
  ------------------
  |  |  372|  1.43k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  1.43k|#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)
  |  |  ------------------
  |  |  |  |  371|  1.43k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
                          bChangeFlow = ( BNS_EF_CHNG_RSTR | BNS_EF_ALTR_BONDS );
  ------------------
  |  |  374|  1.43k|#define BNS_EF_ALTR_BONDS     8  /* make altern. bonds in the structure if the flow has changed */
  ------------------
 8518|  1.43k|            if (!bIsBnsEndpoint( pBNS, nVertSingleBond ) /* !at[nVertSingleBond].endpoint*/ &&
  ------------------
  |  Branch (8518:17): [True: 447, False: 992]
  ------------------
 8519|    447|                ( !nGetEndpointInfo( at, nVertSingleBond, &eif ) || !eif.cDonor ))
  ------------------
  |  Branch (8519:19): [True: 0, False: 447]
  |  Branch (8519:69): [True: 6, False: 441]
  ------------------
 8520|      6|            {
 8521|      6|                return 0;
 8522|      6|            }
 8523|  1.43k|            if (!bIsBnsEndpoint( pBNS, nVertDoubleBond ) /* !at[nVertDoubleBond].endpoint*/ &&
  ------------------
  |  Branch (8523:17): [True: 728, False: 705]
  ------------------
 8524|    728|                ( !nGetEndpointInfo( at, nVertDoubleBond, &eif ) || !eif.cAcceptor ))
  ------------------
  |  Branch (8524:19): [True: 0, False: 728]
  |  Branch (8524:69): [True: 0, False: 728]
  ------------------
 8525|      0|            {
 8526|      0|                return 0;
 8527|      0|            }
 8528|  1.43k|            memset( &apc, 0, sizeof( apc ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 8529|  1.43k|            break;
 8530|       |
 8531|     52|        case ALT_PATH_MODE_REM2H_CHG:
  ------------------
  |  |  314|     52|#define ALT_PATH_MODE_REM2H_CHG  5   /* remove 2 H along alt. path AH-=-BH => A=-=B and change bonds to alternating */
  ------------------
  |  Branch (8531:9): [True: 52, False: 28.0k]
  ------------------
 8532|     52|            bChangeFlow |= BNS_EF_ALTR_BONDS; /* fall through */
  ------------------
  |  |  374|     52|#define BNS_EF_ALTR_BONDS     8  /* make altern. bonds in the structure if the flow has changed */
  ------------------
 8533|    663|        case ALT_PATH_MODE_REM2H_TST:
  ------------------
  |  |  316|    663|#define ALT_PATH_MODE_REM2H_TST  7   /* test-remove 2 H along alt. path AH-=-BH => A=-=B; restore changed bonds */
  ------------------
  |  Branch (8533:9): [True: 611, False: 27.4k]
  ------------------
 8534|    663|            bChangeFlow |= BNS_EF_CHNG_RSTR;
  ------------------
  |  |  372|    663|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|    663|#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)
  |  |  ------------------
  |  |  |  |  371|    663|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
 8535|    663|            type = BNS_VERT_TYPE_ENDPOINT;
  ------------------
  |  |   46|    663|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 8536|       |            /* Allow non-tautomeric donors or any tautomeric atom */
 8537|    663|            if (!bIsBnsEndpoint( pBNS, nVertSingleBond ) /* not linked to a t-group or the edge forbidden */ &&
  ------------------
  |  Branch (8537:17): [True: 78, False: 585]
  ------------------
 8538|     78|                ( !nGetEndpointInfo( at, nVertSingleBond, &eif ) || !eif.cDonor )) /* not a donor */
  ------------------
  |  Branch (8538:19): [True: 3, False: 75]
  |  Branch (8538:69): [True: 8, False: 67]
  ------------------
 8539|     11|            {
 8540|     11|                return 0;
 8541|     11|            }
 8542|    652|            if (!bIsBnsEndpoint( pBNS, nVertDoubleBond ) /* not connected to a t-group */ &&
  ------------------
  |  Branch (8542:17): [True: 136, False: 516]
  ------------------
 8543|    136|                ( !nGetEndpointInfo( at, nVertDoubleBond, &eif ) || !eif.cDonor ))
  ------------------
  |  Branch (8543:19): [True: 7, False: 129]
  |  Branch (8543:69): [True: 20, False: 109]
  ------------------
 8544|     27|            {
 8545|     27|                return 0;
 8546|     27|            }
 8547|    625|            memset( &apc, 0, sizeof( apc ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 8548|    625|            break;
 8549|       |
 8550|     74|        case ALT_PATH_MODE_ADD2H_CHG:
  ------------------
  |  |  315|     74|#define ALT_PATH_MODE_ADD2H_CHG  6   /* add 2 H along alt. path A=-=B => AH-=-BH    and change bonds to alternating */
  ------------------
  |  Branch (8550:9): [True: 74, False: 28.0k]
  ------------------
 8551|     74|            bChangeFlow |= BNS_EF_ALTR_BONDS; /* fall through */
  ------------------
  |  |  374|     74|#define BNS_EF_ALTR_BONDS     8  /* make altern. bonds in the structure if the flow has changed */
  ------------------
 8552|  1.07k|        case ALT_PATH_MODE_ADD2H_TST:
  ------------------
  |  |  317|  1.07k|#define ALT_PATH_MODE_ADD2H_TST  8   /* test-add 2 H along alt. path A=-=B => AH-=-BH; restore changed bonds */
  ------------------
  |  Branch (8552:9): [True: 1.00k, False: 27.0k]
  ------------------
 8553|  1.07k|            bChangeFlow |= BNS_EF_CHNG_RSTR;
  ------------------
  |  |  372|  1.07k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  1.07k|#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)
  |  |  ------------------
  |  |  |  |  371|  1.07k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
 8554|  1.07k|            type = BNS_VERT_TYPE_ENDPOINT;
  ------------------
  |  |   46|  1.07k|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 8555|       |            /* Allow non-tautomeric acceptors or any tautomeric atom */
 8556|  1.07k|            if (!bIsBnsEndpoint( pBNS, nVertSingleBond ) /* !at[nVertSingleBond].endpoint*/ &&
  ------------------
  |  Branch (8556:17): [True: 388, False: 689]
  ------------------
 8557|    388|                ( !nGetEndpointInfo( at, nVertSingleBond, &eif ) || !eif.cAcceptor ))
  ------------------
  |  Branch (8557:19): [True: 20, False: 368]
  |  Branch (8557:69): [True: 12, False: 356]
  ------------------
 8558|     32|            {
 8559|     32|                return 0;
 8560|     32|            }
 8561|  1.04k|            if (!bIsBnsEndpoint( pBNS, nVertDoubleBond ) /* !at[nVertSingleBond].endpoint*/ &&
  ------------------
  |  Branch (8561:17): [True: 529, False: 516]
  ------------------
 8562|    529|                ( !nGetEndpointInfo( at, nVertDoubleBond, &eif ) || !eif.cAcceptor ))
  ------------------
  |  Branch (8562:19): [True: 42, False: 487]
  |  Branch (8562:69): [True: 15, False: 472]
  ------------------
 8563|     57|            {
 8564|     57|                return 0;
 8565|     57|            }
 8566|    988|            break;
 8567|       |
 8568|  4.38k|        case ALT_PATH_MODE_REM_PROTON:
  ------------------
  |  |  318|  4.38k|#define ALT_PATH_MODE_REM_PROTON 9   /* remove proton, adjust bonds, charges, H-counts 2004-03-05 */
  ------------------
  |  Branch (8568:9): [True: 4.38k, False: 23.7k]
  ------------------
 8569|       |            /* alt path is between the t-group (nVertDoubleBond) and
 8570|       |            the (+)-charge group (nVertSingleBond) */
 8571|  4.38k|            type = 0;
 8572|       |            /*bDoMarkChangedBonds = 0;*/
 8573|  4.38k|            bChangeFlow = ( BNS_EF_SAVE_ALL | BNS_EF_UPD_H_CHARGE ) | BNS_EF_ALTR_NS; /* added BNS_EF_ALTR_NS: set non-stereo altern non-ring bonds 2004-07-02*/
  ------------------
  |  |  381|  4.38k|#define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  370|  4.38k|#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)
  |  |  ------------------
  |  |  |  |  373|  4.38k|#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)
  |  |  ------------------
  |  |  |  |  375|  4.38k|#define BNS_EF_UPD_RAD_ORI   16  /* update BN flow0 & Atom radical values:
  |  |  ------------------
  ------------------
                          bChangeFlow = ( BNS_EF_SAVE_ALL | BNS_EF_UPD_H_CHARGE ) | BNS_EF_ALTR_NS; /* added BNS_EF_ALTR_NS: set non-stereo altern non-ring bonds 2004-07-02*/
  ------------------
  |  |  379|  4.38k|#define BNS_EF_UPD_H_CHARGE  64  /* update charges and H-counts according to change flow to c- and t-group vertices */
  ------------------
                          bChangeFlow = ( BNS_EF_SAVE_ALL | BNS_EF_UPD_H_CHARGE ) | BNS_EF_ALTR_NS; /* added BNS_EF_ALTR_NS: set non-stereo altern non-ring bonds 2004-07-02*/
  ------------------
  |  |  382|  4.38k|#define BNS_EF_ALTR_NS      (BNS_EF_ALTR_BONDS | BNS_EF_SET_NOSTEREO)
  |  |  ------------------
  |  |  |  |  374|  4.38k|#define BNS_EF_ALTR_BONDS     8  /* make altern. bonds in the structure if the flow has changed */
  |  |  ------------------
  |  |               #define BNS_EF_ALTR_NS      (BNS_EF_ALTR_BONDS | BNS_EF_SET_NOSTEREO)
  |  |  ------------------
  |  |  |  |  377|  4.38k|#define BNS_EF_SET_NOSTEREO  32  /* in combination with BNS_EF_ALTR_BONDS only:
  |  |  ------------------
  ------------------
 8574|  4.38k|            break;
 8575|      0|        default:
  ------------------
  |  Branch (8575:9): [True: 0, False: 28.1k]
  ------------------
 8576|      0|            type = 0;
 8577|      0|            bChangeFlow = BNS_EF_CHNG_RSTR;
  ------------------
  |  |  372|      0|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|      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)
  |  |  ------------------
  |  |  |  |  371|      0|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
 8578|      0|            break;
 8579|  28.1k|    }
 8580|       |
 8581|  23.6k|    bError = 0;
 8582|  23.6k|    bSuccess = 0;
 8583|  23.6k|    nDelta = 0;
 8584|       |
 8585|  23.6k|    ret = SetRadEndpoints2( pCG, pBNS, pBD, RAD_SRCH_NORM );
 8586|  23.6k|    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  23.6k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  23.6k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  23.6k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  23.6k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 23.6k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 23.6k]
  |  |  ------------------
  ------------------
 8587|      0|    {
 8588|      0|        return ret;
 8589|      0|    }
 8590|       |
 8591|       |    /* Set BNS to check alt path */
 8592|  23.6k|    ret = bSetBnsToCheckAltPath( pBNS, nVertDoubleBond, nVertSingleBond, type, path_type, &apc, fcd, &nDots );
 8593|  23.6k|    switch (ret)
 8594|  23.6k|    {
 8595|  2.92k|        case  BNS_CHK_ALTP_NO_ALTPATH:
  ------------------
  |  | 6736|  2.92k|#define BNS_CHK_ALTP_NO_ALTPATH  0
  ------------------
  |  Branch (8595:9): [True: 2.92k, False: 20.7k]
  ------------------
 8596|  2.92k|            ret = RemoveRadEndpoints( pBNS, pBD, NULL );
 8597|  2.92k|            return ret;
 8598|      0|        case BNS_CHK_ALTP_SAME_TGROUP:
  ------------------
  |  | 6737|      0|#define BNS_CHK_ALTP_SAME_TGROUP 1
  ------------------
  |  Branch (8598:9): [True: 0, False: 23.6k]
  ------------------
 8599|      0|            bSuccess = 1;
 8600|      0|            goto reinit_BNS;
 8601|      0|        case BNS_CHK_ALTP_SAME_VERTEX:
  ------------------
  |  | 6738|      0|#define BNS_CHK_ALTP_SAME_VERTEX 2
  ------------------
  |  Branch (8601:9): [True: 0, False: 23.6k]
  ------------------
 8602|      0|            ret = RemoveRadEndpoints( pBNS, pBD, NULL );
 8603|      0|            return ret ? ret : 1; /* very strange ... set a breakpoint here */
  ------------------
  |  Branch (8603:20): [True: 0, False: 0]
  ------------------
 8604|  20.6k|        case BNS_CHK_ALTP_SET_SUCCESS:
  ------------------
  |  | 6739|  20.6k|#define BNS_CHK_ALTP_SET_SUCCESS 4
  ------------------
  |  Branch (8604:9): [True: 20.6k, False: 3.01k]
  ------------------
 8605|  20.6k|            break;  /* actually check the existence of the altpath */
 8606|     82|        case BNS_CANT_SET_BOND:
  ------------------
  |  |   57|     82|#define BNS_CANT_SET_BOND  (BNS_ERR +  9) /*(-9990)*/
  |  |  ------------------
  |  |  |  |   47|     82|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
  |  Branch (8606:9): [True: 82, False: 23.5k]
  ------------------
 8607|     82|            goto reinit_BNS;
 8608|      4|        default:
  ------------------
  |  Branch (8608:9): [True: 4, False: 23.6k]
  ------------------
 8609|      4|            ret_val = RemoveRadEndpoints( pBNS, pBD, NULL ); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 8610|      4|            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|      4|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      4|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      4|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      4|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 4, False: 0]
  |  |  |  Branch (67:44): [True: 4, False: 0]
  |  |  ------------------
  ------------------
 8611|      4|            {
 8612|      4|                return ret;
 8613|      4|            }
 8614|      0|            return BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 8615|  23.6k|    }
 8616|       |
 8617|  20.6k|    bAdjustRadicals = ( ( bChangeFlow & BNS_EF_UPD_RAD_ORI ) && !( bChangeFlow & BNS_EF_RSTR_FLOW ) );
  ------------------
  |  |  375|  20.6k|#define BNS_EF_UPD_RAD_ORI   16  /* update BN flow0 & Atom radical values:
  ------------------
                  bAdjustRadicals = ( ( bChangeFlow & BNS_EF_UPD_RAD_ORI ) && !( bChangeFlow & BNS_EF_RSTR_FLOW ) );
  ------------------
  |  |  371|  1.47k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  ------------------
  |  Branch (8617:25): [True: 1.47k, False: 19.1k]
  |  Branch (8617:65): [True: 1.47k, False: 0]
  ------------------
 8618|       |
 8619|       |    /*****************************************************************
 8620|       |    * nDots = 2 for ALT_PATH_CHARGE (checking moveable positive charges)
 8621|       |    * Now nDots for ALT_PATH_TAUTOM or ALT_PATH_4_SALT can be greater
 8622|       |    * because some of the bonds are effectively removed and dots
 8623|       |    * (vertex st-caps) may be added
 8624|       |    * -- to make sure there is no (+) charge on a tautomeric endpoint
 8625|       |    * -- to fix positions of moveable tautomeric attachements
 8626|       |    *    (H and (-)-charges) at the ends of an alt path
 8627|       |    */
 8628|       |
 8629|       |    /* Run BNS */
 8630|       |
 8631|  20.6k|    ret = RunBalancedNetworkSearch( pBNS, pBD, bChangeFlow );
 8632|       |
 8633|  20.6k|    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  20.6k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  20.6k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  20.6k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  20.6k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 20.6k, False: 0]
  |  |  |  Branch (67:44): [True: 2, False: 20.6k]
  |  |  ------------------
  ------------------
 8634|      2|    {
 8635|      2|        bError = ret;
 8636|      2|    }
 8637|  20.6k|    else if (ret > 0)
  ------------------
  |  Branch (8637:14): [True: 10.1k, False: 10.5k]
  ------------------
 8638|  10.1k|    {
 8639|  10.1k|        if (2 * ret >= nDots)
  ------------------
  |  Branch (8639:13): [True: 9.22k, False: 876]
  ------------------
 8640|  9.22k|        {
 8641|  9.22k|            nDelta = 2 * ret - nDots;  /* non-zero means augmentation created another alt. path -- between radicals */
 8642|  9.22k|            if (pAATG && pAATG->nMarkedAtom)
  ------------------
  |  Branch (8642:17): [True: 197, False: 9.02k]
  |  Branch (8642:26): [True: 197, False: 0]
  ------------------
 8643|    197|            {
 8644|    197|                if (pAATG->nAtTypeTotals && ( bChangeFlow & BNS_EF_UPD_H_CHARGE ))
  ------------------
  |  |  379|    197|#define BNS_EF_UPD_H_CHARGE  64  /* update charges and H-counts according to change flow to c- and t-group vertices */
  ------------------
  |  Branch (8644:21): [True: 197, False: 0]
  |  Branch (8644:45): [True: 197, False: 0]
  ------------------
 8645|    197|                {
 8646|    197|                    memset( pAATG->nMarkedAtom, 0, num_atoms * sizeof( pAATG->nMarkedAtom[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 8647|       |                    /* Mark atoms that have charge or H changed, check their input types (that is, before changes),
 8648|       |                    and subtract their input charge/H from nAtTypeTotals */
 8649|    197|                    SubtractOrChangeAtHChargeBNS( pBNS, at, num_atoms, pAATG->nAtTypeTotals, pAATG->nMarkedAtom, NULL, 1 );
 8650|       |                    /* ZChange charges and/or H, update t_group_info, do not check types or change nAtTypeTotals */
 8651|       |                    /* Atom types will be checked and nAtTypeTotals will be changed in
 8652|       |                    AddChangedAtHChargeBNS() later */
 8653|    197|                    SubtractOrChangeAtHChargeBNS( pBNS, at, num_atoms, NULL, NULL, pAATG->t_group_info, 0 );
 8654|    197|                }
 8655|      0|                else
 8656|      0|                {
 8657|      0|                    if (!pAATG->nAtTypeTotals)
  ------------------
  |  Branch (8657:25): [True: 0, False: 0]
  ------------------
 8658|      0|                    {
 8659|      0|                        bDoMarkChangedBonds = MarkAtomsAtTautGroups( pBNS, num_atoms, pAATG, nVertSingleBond, nVertDoubleBond );
 8660|      0|                        if (bDoMarkChangedBonds < 0)
  ------------------
  |  Branch (8660:29): [True: 0, False: 0]
  ------------------
 8661|      0|                        {
 8662|      0|                            bError = bDoMarkChangedBonds;
 8663|      0|                            bDoMarkChangedBonds = 0;
 8664|      0|                        }
 8665|      0|                    }
 8666|      0|                }
 8667|    197|            }
 8668|  9.22k|            if (bDoMarkChangedBonds)
  ------------------
  |  Branch (8668:17): [True: 9.22k, False: 0]
  ------------------
 8669|  9.22k|            {
 8670|       |                /* Mark bonds that were changed to configure bond testing */
 8671|  9.22k|                ret_val = bSetBondsAfterCheckOneBond( pBNS, fcd, -1, at, num_atoms, bChangeFlow );
 8672|  9.22k|                if (IS_BNS_ERROR( ret_val ))
  ------------------
  |  |   67|  9.22k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  9.22k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  9.22k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  9.22k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 9.22k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 9.22k]
  |  |  ------------------
  ------------------
 8673|      0|                {
 8674|      0|                    bError = ret_val;
 8675|      0|                }
 8676|       |                /*ret = SetBondsRestoreBnStructFlow( pBNS, at, num_atoms, bChangeFlow );*/
 8677|       |                /* mark all other changed bonds */
 8678|  9.22k|                ret = SetBondsFromBnStructFlow( pBNS, at, num_atoms, bChangeFlow );
 8679|  9.22k|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  9.22k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  9.22k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  9.22k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  9.22k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 9.22k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 9.22k]
  |  |  ------------------
  ------------------
 8680|      0|                {
 8681|      0|                    bError = ret;
 8682|      0|                }
 8683|  9.22k|                else
 8684|  9.22k|                {
 8685|  9.22k|                    if (!( ret & 1 ) && !( ret_val & 1 ))
  ------------------
  |  Branch (8685:25): [True: 7.74k, False: 1.48k]
  |  Branch (8685:41): [True: 7.74k, False: 0]
  ------------------
 8686|  7.74k|                    {
 8687|  7.74k|                        bSuccess = 1;
 8688|  7.74k|                    }
 8689|  1.48k|                    else
 8690|  1.48k|                    {
 8691|  1.48k|                        if ((( ( ret & 1 ) || ( ret_val & 1 ) ) &&
  ------------------
  |  Branch (8691:32): [True: 1.48k, False: 0]
  |  Branch (8691:47): [True: 0, False: 0]
  ------------------
 8692|  1.48k|                            ( bChangeFlow & BNS_EF_ALTR_BONDS )) || ( bChangeFlow & BNS_EF_UPD_H_CHARGE )) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  374|  1.48k|#define BNS_EF_ALTR_BONDS     8  /* make altern. bonds in the structure if the flow has changed */
  ------------------
                                          ( bChangeFlow & BNS_EF_ALTR_BONDS )) || ( bChangeFlow & BNS_EF_UPD_H_CHARGE )) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  379|      0|#define BNS_EF_UPD_H_CHARGE  64  /* update charges and H-counts according to change flow to c- and t-group vertices */
  ------------------
  |  Branch (8692:29): [True: 1.48k, False: 0]
  |  Branch (8692:69): [True: 0, False: 0]
  ------------------
 8693|  1.48k|                        {
 8694|       |                            /* Some bonds have been changed to alternating */
 8695|  1.48k|                            bSuccess = 3;
 8696|  1.48k|                        }
 8697|      0|                        else
 8698|      0|                        {
 8699|      0|                            bError = BNS_BOND_ERR;
  ------------------
  |  |   52|      0|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 8700|      0|                        }
 8701|  1.48k|                    }
 8702|  9.22k|                }
 8703|  9.22k|                if (!bError && pAATG && pAATG->nMarkedAtom && ( bChangeFlow & BNS_EF_UPD_H_CHARGE ))
  ------------------
  |  |  379|    197|#define BNS_EF_UPD_H_CHARGE  64  /* update charges and H-counts according to change flow to c- and t-group vertices */
  ------------------
  |  Branch (8703:21): [True: 9.22k, False: 0]
  |  Branch (8703:32): [True: 197, False: 9.02k]
  |  Branch (8703:41): [True: 197, False: 0]
  |  Branch (8703:63): [True: 197, False: 0]
  ------------------
 8704|    197|                {
 8705|       |                    /* Update radicals to avoid errors in atom type check in AddChangedAtHChargeBNS() */
 8706|    197|                    if (bAdjustRadicals)
  ------------------
  |  Branch (8706:25): [True: 197, False: 0]
  ------------------
 8707|    197|                    {
 8708|    197|                        ret_val = RestoreRadicalsOnly( pBNS, pBD, at );
 8709|    197|                        if (IS_BNS_ERROR( ret_val ))
  ------------------
  |  |   67|    197|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|    197|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|    197|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    197|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 197, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 197]
  |  |  ------------------
  ------------------
 8710|      0|                        {
 8711|      0|                            bError = ret_val;
 8712|      0|                        }
 8713|    197|                    }
 8714|       |                    /* Check atom types of marked atoms and add charge/H changes to nAtTypeTotals */
 8715|       |                    /* Changing atoms were marked in the 1st call to SubtractOrChangeAtHChargeBNS(..., 1) above */
 8716|    197|                    AddChangedAtHChargeBNS( at, num_atoms, pAATG->nAtTypeTotals, pAATG->nMarkedAtom );
 8717|    197|                    if (bChangeFlow & BNS_EF_CHNG_FLOW)
  ------------------
  |  |  370|    197|#define BNS_EF_CHNG_FLOW      1  /* change Balanced Network (BN) flow inside the BNS search */
  ------------------
  |  Branch (8717:25): [True: 197, False: 0]
  ------------------
 8718|    197|                    {
 8719|       |                        /* Eliminate ambiguities in already changed flow:
 8720|       |                        replace (+)--N==(-) with (+)==N--(-) (both represent neutral N) */
 8721|    197|                        EliminatePlusMinusChargeAmbiguity( pBNS, num_atoms );
 8722|    197|                    }
 8723|    197|                }
 8724|  9.22k|            }
 8725|  9.22k|        }
 8726|       |
 8727|  10.1k|        ret = RestoreBnStructFlow( pBNS, bChangeFlow & BNS_EF_CHNG_RSTR );
  ------------------
  |  |  372|  10.1k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  370|  10.1k|#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)
  |  |  ------------------
  |  |  |  |  371|  10.1k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
 8728|       |
 8729|  10.1k|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  10.1k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  10.1k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  10.1k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  10.1k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 10.1k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 10.1k]
  |  |  ------------------
  ------------------
 8730|      0|        {
 8731|      0|            bError = ret;
 8732|      0|        }
 8733|  10.1k|    }
 8734|       |
 8735|  20.7k|reinit_BNS:
 8736|       |
 8737|       |    /* --- Reinitialize to repeat the calculations --- */
 8738|  20.7k|    bRestoreBnsAfterCheckAltPath( pBNS, &apc, bChangeFlow & BNS_EF_UPD_H_CHARGE );
  ------------------
  |  |  379|  20.7k|#define BNS_EF_UPD_H_CHARGE  64  /* update charges and H-counts according to change flow to c- and t-group vertices */
  ------------------
 8739|  20.7k|    bRestoreFlowAfterCheckOneBond( pBNS, fcd );
 8740|  20.7k|    ret_val = RemoveRadEndpoints( pBNS, pBD, bAdjustRadicals ? at : NULL );
  ------------------
  |  Branch (8740:46): [True: 1.47k, False: 19.2k]
  ------------------
 8741|  20.7k|    ReInitBnStructAltPaths( pBNS );
 8742|       |
 8743|  20.7k|    return bError ? bError : ret_val ? ret_val : ( bSuccess + 4 * nDelta );
  ------------------
  |  Branch (8743:12): [True: 2, False: 20.7k]
  |  Branch (8743:30): [True: 0, False: 20.7k]
  ------------------
 8744|  20.6k|}
AllocateAndInitBnStruct:
 8754|   288k|{
 8755|   288k|    BN_STRUCT   *pBNS = NULL;
 8756|   288k|    BNS_VERTEX  *vert;
 8757|       |
 8758|   288k|    int    neigh, num_changed_bonds = 0;
 8759|   288k|    U_CHAR bond_type, bond_mark;
 8760|       |
 8761|   288k|    int i, j, k, n_edges, num_bonds, num_edges, f1, f2, edge_cap, edge_flow, st_flow; /* djb-rwth: removing redundant variables */
 8762|   288k|    int tot_st_cap, tot_st_flow;
 8763|   288k|    int max_tg, max_edges, max_vertices, len_alt_path, max_iedges, num_altp;
 8764|   288k|#if ( BNS_RAD_SEARCH == 1 )
 8765|   288k|    int num_rad = 0;
 8766|       |
 8767|   288k|    nMaxAddEdges += 1;
 8768|   288k|#endif
 8769|       |#if ( FIX_NUM_TG == 1 )
 8770|       |    max_tg = inchi_max( num_atoms / 2, 5 );
 8771|       |#else
 8772|   288k|    max_tg = num_atoms;
 8773|   288k|#endif
 8774|   288k|    num_changed_bonds = 0;
 8775|       |
 8776|  1.38M|    for (i = 0, num_bonds = 0; i < num_atoms; i++)
  ------------------
  |  Branch (8776:32): [True: 1.09M, False: 288k]
  ------------------
 8777|  1.09M|    {
 8778|       |        /*(@nnuk : Nauman Ullah Khan) */
 8779|  1.09M|        LOG_NO_ARGS("\n################# (L8916:ichi_bns.c) ###################\n");
 8780|  1.09M|        LOG_MULT_ARGS("Number of changed bonds (Start): %d\n", num_changed_bonds);
 8781|  1.09M|        LOG_NO_ARGS("\n########################################################\n");
 8782|       |
 8783|  1.09M|        num_bonds += at[i].valence;
 8784|  1.09M|#if ( BNS_RAD_SEARCH == 1 )
 8785|  1.09M|        num_rad += ( at[i].radical == RADICAL_DOUBLET );
  ------------------
  |  |   76|  1.09M|#define RADICAL_DOUBLET 2
  ------------------
 8786|  1.09M|#endif
 8787|  1.09M|    }
 8788|       |    /* Each atom has enough edges to belong to a tautomeric group + nMaxAddEdges */
 8789|       |    /* number of atoms is large enough to accommodate max. possible number of t-groups + nMaxAddAtoms */
 8790|       |    /* max_altp cannot be larger than BN_MAX_ALTP = 16 */
 8791|   288k|    num_edges = ( num_bonds /= 2 );
 8792|       |    /* +1 for a super-tautomeric group */
 8793|   288k|    max_vertices = num_atoms + nMaxAddAtoms + max_tg + 1;
 8794|       |    /* +max_tg for edges between t-groups and super-tautomeric group */
 8795|   288k|    max_edges = num_edges + ( nMaxAddEdges + NUM_KINDS_OF_GROUPS )*max_vertices + max_tg;
  ------------------
  |  |   86|   288k|#define NUM_KINDS_OF_GROUPS  2  /* 1 accounts for t-group kind, one more 1 accounts for c-group kind */
  ------------------
 8796|   288k|#if ( BNS_RAD_SEARCH == 1 )
 8797|   288k|    if (num_rad)
  ------------------
  |  Branch (8797:9): [True: 13.3k, False: 275k]
  ------------------
 8798|  13.3k|    {
 8799|  13.3k|        max_vertices *= 2;
 8800|  13.3k|        max_edges *= 2;
 8801|  13.3k|    }
 8802|   288k|#endif
 8803|   288k|    max_iedges = 2 * max_edges;
 8804|   288k|    len_alt_path = max_vertices + iALTP_HDR_LEN + 1; /* may overflow if an edge is traversed in 2 directions */
 8805|       |
 8806|   288k|    if (!( pBNS = (BN_STRUCT   *) inchi_calloc( 1, sizeof( BN_STRUCT ) ) ) ||
  ------------------
  |  | 1146|   288k|#define inchi_calloc   calloc
  ------------------
  |  Branch (8806:9): [True: 0, False: 288k]
  ------------------
 8807|   288k|         !( pBNS->edge = (BNS_EDGE    *) inchi_calloc( max_edges, sizeof( BNS_EDGE ) ) ) ||
  ------------------
  |  | 1146|   288k|#define inchi_calloc   calloc
  ------------------
  |  Branch (8807:10): [True: 0, False: 288k]
  ------------------
 8808|   288k|         !( pBNS->vert = (BNS_VERTEX  *) inchi_calloc( max_vertices, sizeof( BNS_VERTEX ) ) ) ||
  ------------------
  |  | 1146|   288k|#define inchi_calloc   calloc
  ------------------
  |  Branch (8808:10): [True: 0, False: 288k]
  ------------------
 8809|   288k|         !( pBNS->iedge = (BNS_IEDGE   *) inchi_calloc( max_iedges, sizeof( BNS_IEDGE ) ) ))
  ------------------
  |  | 1146|   288k|#define inchi_calloc   calloc
  ------------------
  |  Branch (8809:10): [True: 0, False: 288k]
  ------------------
 8810|      0|    {
 8811|      0|        return DeAllocateBnStruct( pBNS );
 8812|      0|    }
 8813|       |    /* Alt path init */
 8814|  4.90M|    for (num_altp = 0; num_altp < max_altp && num_altp < BN_MAX_ALTP; num_altp++)
  ------------------
  |  |   17|  4.61M|#define BN_MAX_ALTP  16
  ------------------
  |  Branch (8814:24): [True: 4.61M, False: 288k]
  |  Branch (8814:47): [True: 4.61M, False: 0]
  ------------------
 8815|  4.61M|    {
 8816|  4.61M|        if (!( pBNS->altp[num_altp] = (BNS_ALT_PATH*) inchi_calloc( len_alt_path, sizeof( BNS_ALT_PATH ) ) ))
  ------------------
  |  | 1146|  4.61M|#define inchi_calloc   calloc
  ------------------
  |  Branch (8816:13): [True: 0, False: 4.61M]
  ------------------
 8817|      0|        {
 8818|      0|            return DeAllocateBnStruct( pBNS );
 8819|      0|        }
 8820|  4.61M|        ALTP_ALLOCATED_LEN( pBNS->altp[num_altp] ) = len_alt_path;
  ------------------
  |  |  111|  4.61M|#define ALTP_ALLOCATED_LEN(altp)        (altp)[iALTP_MAX_LEN].number
  ------------------
 8821|  4.61M|        pBNS->len_alt_path = len_alt_path;  /* ??? duplication ??? */
 8822|       |                                            /* re-init */
 8823|  4.61M|        ALTP_DELTA( pBNS->altp[num_altp] ) = 0;
  ------------------
  |  |  112|  4.61M|#define ALTP_DELTA(altp)                 (altp)[iALTP_FLOW].flow[0]
  ------------------
 8824|  4.61M|        ALTP_START_ATOM( pBNS->altp[num_altp] ) = NO_VERTEX;
  ------------------
  |  |  103|  4.61M|#define ALTP_START_ATOM(altp)           (altp)[iALTP_START_ATOM].number
  ------------------
                      ALTP_START_ATOM( pBNS->altp[num_altp] ) = NO_VERTEX;
  ------------------
  |  |  118|  4.61M|#define NO_VERTEX    -2
  ------------------
 8825|  4.61M|        ALTP_END_ATOM( pBNS->altp[num_altp] ) = NO_VERTEX;
  ------------------
  |  |  102|  4.61M|#define ALTP_END_ATOM(altp)             (altp)[iALTP_END_ATOM].number
  ------------------
                      ALTP_END_ATOM( pBNS->altp[num_altp] ) = NO_VERTEX;
  ------------------
  |  |  118|  4.61M|#define NO_VERTEX    -2
  ------------------
 8826|  4.61M|        ALTP_PATH_LEN( pBNS->altp[num_altp] ) = 0;
  ------------------
  |  |  101|  4.61M|#define ALTP_PATH_LEN(altp)             (altp)[iALTP_PATH_LEN].number  /* number of bonds = number of atoms-1*/
  ------------------
 8827|  4.61M|    }
 8828|   288k|    pBNS->alt_path = NULL;
 8829|   288k|    pBNS->num_altp = 0;
 8830|   288k|    pBNS->max_altp = num_altp;
 8831|       |
 8832|       |    /* Fill vertices (no connectivity) */
 8833|   288k|    pBNS->vert[0].iedge = pBNS->iedge;
 8834|  1.38M|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (8834:17): [True: 1.09M, False: 288k]
  ------------------
 8835|  1.09M|    {
 8836|  1.09M|        k = pBNS->vert[i].max_adj_edges = at[i].valence + ( nMaxAddEdges + NUM_KINDS_OF_GROUPS );
  ------------------
  |  |   86|  1.09M|#define NUM_KINDS_OF_GROUPS  2  /* 1 accounts for t-group kind, one more 1 accounts for c-group kind */
  ------------------
 8837|  1.09M|        pBNS->vert[i + 1].iedge = pBNS->vert[i].iedge + k;
 8838|  1.09M|    }
 8839|   288k|    pBNS->num_atoms = num_atoms;      /* number of real atoms */
 8840|   288k|    pBNS->num_added_atoms = 0;
 8841|   288k|    pBNS->num_t_groups = 0;              /* number of added t-groups */
 8842|   288k|    pBNS->num_c_groups = 0;
 8843|   288k|    pBNS->nMaxAddAtoms = nMaxAddAtoms;
 8844|   288k|    pBNS->nMaxAddEdges = nMaxAddEdges;
 8845|       |
 8846|   288k|    pBNS->num_vertices = num_atoms;     /*  current number of vertices, a sum of
 8847|       |                                        pBNS->num_atoms
 8848|       |                                        pBNS->num_t_groups
 8849|       |                                        pBNS->num_added_atoms           */
 8850|   288k|    pBNS->max_vertices = max_vertices;
 8851|       |
 8852|       |
 8853|   288k|    pBNS->num_bonds = num_bonds;        /* number of real edges (bonds)         */
 8854|   288k|    pBNS->max_edges = max_edges;
 8855|   288k|    pBNS->max_iedges = max_iedges;
 8856|       |
 8857|       |    /*
 8858|       |    To remove t-groups and added atoms:
 8859|       |    In atoms i = 0..pBNS->num_atoms-1
 8860|       |    pBNS->vert[i].num_adj_edges = pBNS->vert[i].max_adj_edges - pBNS->nMaxAddEdges - NUM_KINDS_OF_GROUPS;
 8861|       |    pBNS->num_vertices    = pBNS->num_atoms;
 8862|       |    pBNS->num_edges       = pBNS->num_bonds;
 8863|       |    pBNS->num_added_atoms = 0;
 8864|       |    pBNS->num_t_groups    = 0;
 8865|       |    pBNS->num_added_edges = 0;
 8866|       |
 8867|       |    ALTP_DELTA(pBNS->alt_path)      = 0;
 8868|       |    ALTP_START_ATOM(pBNS->alt_path) = NO_VERTEX;
 8869|       |    ALTP_END_ATOM(pBNS->alt_path)   = NO_VERTEX;
 8870|       |    ALTP_PATH_LEN(pBNS->alt_path)   = 0;
 8871|       |    */
 8872|       |
 8873|       |    /* Fill edges and connectivity */
 8874|   288k|    tot_st_cap = tot_st_flow = 0;
 8875|  1.38M|    for (i = 0, n_edges = 0; i < num_atoms; i++)
  ------------------
  |  Branch (8875:30): [True: 1.09M, False: 288k]
  ------------------
 8876|  1.09M|    {
 8877|  1.09M|        vert = &pBNS->vert[i];
 8878|       |        /* djb-rwth: removing redundant code */
 8879|  1.09M|        st_flow = 0;
 8880|       |        /* djb-rwth: removing redundant code */
 8881|  1.57M|        for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (8881:21): [True: 479k, False: 1.09M]
  ------------------
 8882|   479k|        {
 8883|   479k|            neigh = at[i].neighbor[j];
 8884|       |            /* find this bond at the neighbor */
 8885|   780k|            for (k = 0; k < at[neigh].valence; k++)
  ------------------
  |  Branch (8885:25): [True: 780k, False: 0]
  ------------------
 8886|   780k|            {
 8887|   780k|                if (at[neigh].neighbor[k] == i)
  ------------------
  |  Branch (8887:21): [True: 479k, False: 300k]
  ------------------
 8888|   479k|                {
 8889|   479k|                    break;
 8890|   479k|                }
 8891|   780k|            }
 8892|   479k|            bond_type = ( at[i].bond_type[j] & BOND_TYPE_MASK );
  ------------------
  |  |  189|   479k|#define BOND_TYPE_MASK        0x0f
  ------------------
 8893|   479k|            bond_mark = ( at[i].bond_type[j] & ~BOND_TYPE_MASK );
  ------------------
  |  |  189|   479k|#define BOND_TYPE_MASK        0x0f
  ------------------
 8894|   479k|            if (bond_type != BOND_SINGLE && bond_type != BOND_DOUBLE &&
  ------------------
  |  |  177|   479k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|   959k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                          if (bond_type != BOND_SINGLE && bond_type != BOND_DOUBLE &&
  ------------------
  |  |  178|   171k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|   650k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (8894:17): [True: 171k, False: 308k]
  |  Branch (8894:45): [True: 53.6k, False: 117k]
  ------------------
 8895|  53.6k|                 bond_type != BOND_TRIPLE /*&& bond_type != BOND_ALTERN*/)
  ------------------
  |  |  179|  53.6k|#define BOND_TRIPLE BOND_TYPE_TRIPLE  /* 3                                  */
  |  |  ------------------
  |  |  |  |   34|  53.6k|#define BOND_TYPE_TRIPLE    3
  |  |  ------------------
  ------------------
  |  Branch (8895:18): [True: 0, False: 53.6k]
  ------------------
 8896|      0|            {
 8897|       |                /* Make Unknown or Alternating bonds single */
 8898|      0|                bond_type = 1;
 8899|      0|                at[i].bond_type[j] = bond_mark | bond_type;
 8900|      0|                num_changed_bonds++;
 8901|      0|            }
 8902|   479k|            if (neigh > i)
  ------------------
  |  Branch (8902:17): [True: 239k, False: 239k]
  ------------------
 8903|   239k|            {
 8904|       |                /* This is the first time we encounter this bond */
 8905|   239k|                f1 = MAX_AT_FLOW( at[i] );
  ------------------
  |  |  143|   239k|#define MAX_AT_FLOW(X) (((X).chem_bonds_valence - (X).valence)+\
  |  |  144|   239k|                       ((is_centerpoint_elem((X).el_number)||get_endpoint_valence((X).el_number))?\
  |  |  ------------------
  |  |  |  Branch (144:26): [True: 169k, False: 70.6k]
  |  |  |  Branch (144:62): [True: 22.8k, False: 47.7k]
  |  |  ------------------
  |  |  145|   239k|                           (((X).radical==RADICAL_DOUBLET)/*+2*((X).radical==RADICAL_TRIPLET)*/):0))
  |  |  ------------------
  |  |  |  |   76|   192k|#define RADICAL_DOUBLET 2
  |  |  ------------------
  ------------------
 8906|   239k|                f2 = MAX_AT_FLOW( at[neigh] );
  ------------------
  |  |  143|   239k|#define MAX_AT_FLOW(X) (((X).chem_bonds_valence - (X).valence)+\
  |  |  144|   239k|                       ((is_centerpoint_elem((X).el_number)||get_endpoint_valence((X).el_number))?\
  |  |  ------------------
  |  |  |  Branch (144:26): [True: 127k, False: 112k]
  |  |  |  Branch (144:62): [True: 23.5k, False: 88.7k]
  |  |  ------------------
  |  |  145|   239k|                           (((X).radical==RADICAL_DOUBLET)/*+2*((X).radical==RADICAL_TRIPLET)*/):0))
  |  |  ------------------
  |  |  |  |   76|   151k|#define RADICAL_DOUBLET 2
  |  |  ------------------
  ------------------
 8907|   239k|                edge_flow = bond_type - 1;
 8908|   239k|                if (edge_flow > MAX_BOND_EDGE_CAP)
  ------------------
  |  |  123|   239k|#define MAX_BOND_EDGE_CAP           2  /* triple bond */
  ------------------
  |  Branch (8908:21): [True: 0, False: 239k]
  ------------------
 8909|      0|                {
 8910|       |                    /* djb-rwth: removing redundant code */
 8911|      0|                    edge_flow = 0;  /* BNS will determine flows (that is, bonds) */
 8912|      0|                    edge_cap = AROM_BOND_EDGE_CAP;
  ------------------
  |  |  124|      0|#define AROM_BOND_EDGE_CAP          1
  ------------------
 8913|      0|                }
 8914|   239k|                else
 8915|   239k|                {
 8916|       |#if ( 0 && KETO_ENOL_TAUT == 1 )  /* ????? */
 8917|       |                    edge_cap = inchi_max( f1, f2 );
 8918|       |#else
 8919|   239k|                    edge_cap = inchi_min( f1, f2 );
  ------------------
  |  |  139|   239k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 55.5k, False: 184k]
  |  |  ------------------
  ------------------
 8920|   239k|#endif
 8921|   239k|                    edge_cap = inchi_min( edge_cap, MAX_BOND_EDGE_CAP ); /* max capacity = 2 means up to triple bond */
  ------------------
  |  |  139|   239k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 202k, False: 36.8k]
  |  |  ------------------
  ------------------
 8922|   239k|                }
 8923|       |
 8924|   239k|                pBNS->edge[n_edges].neighbor1 = (AT_NUMB) i;
 8925|   239k|                pBNS->edge[n_edges].neighbor12 = (AT_NUMB) ( i ^ neigh );
 8926|   239k|                pBNS->edge[n_edges].flow = pBNS->edge[n_edges].flow0 = edge_flow;
 8927|   239k|                pBNS->edge[n_edges].cap = pBNS->edge[n_edges].cap0 = edge_cap;
 8928|   239k|                pBNS->edge[n_edges].neigh_ord[0] = j;
 8929|   239k|                pBNS->edge[n_edges].neigh_ord[1] = k;
 8930|   239k|                pBNS->edge[n_edges].pass = 0;
 8931|   239k|                pBNS->edge[n_edges].forbidden = 0;
 8932|       |
 8933|   239k|                vert->iedge[j] = pBNS->vert[neigh].iedge[k] = n_edges++;
 8934|   239k|            }
 8935|   239k|            else
 8936|   239k|            {
 8937|       |                /* This is the second time we encounter this bond. It was stored at */
 8938|   239k|                int  iedge = pBNS->vert[neigh].iedge[k];
 8939|   239k|                edge_cap = pBNS->edge[iedge].cap; /* djb-rwth: ignoring LLVM warning: variable used */
 8940|   239k|                edge_flow = pBNS->edge[iedge].flow;
 8941|   239k|            }
 8942|   479k|            st_flow += edge_flow;
 8943|       |            /* djb-rwth: removing redundant code */
 8944|   479k|        }
 8945|  1.09M|        vert->num_adj_edges = j;
 8946|  1.09M|        vert->st_edge.cap =
 8947|  1.09M|            vert->st_edge.cap0 = MAX_AT_FLOW( at[i] );
  ------------------
  |  |  143|  1.09M|#define MAX_AT_FLOW(X) (((X).chem_bonds_valence - (X).valence)+\
  |  |  144|  1.09M|                       ((is_centerpoint_elem((X).el_number)||get_endpoint_valence((X).el_number))?\
  |  |  ------------------
  |  |  |  Branch (144:26): [True: 305k, False: 789k]
  |  |  |  Branch (144:62): [True: 195k, False: 593k]
  |  |  ------------------
  |  |  145|  1.09M|                           (((X).radical==RADICAL_DOUBLET)/*+2*((X).radical==RADICAL_TRIPLET)*/):0))
  |  |  ------------------
  |  |  |  |   76|   501k|#define RADICAL_DOUBLET 2
  |  |  ------------------
  ------------------
 8948|  1.09M|        vert->st_edge.flow =
 8949|  1.09M|            vert->st_edge.flow0 = st_flow;
 8950|  1.09M|        vert->type = BNS_VERT_TYPE_ATOM;
  ------------------
  |  |   45|  1.09M|#define BNS_VERT_TYPE_ATOM          0x0001
  ------------------
 8951|  1.09M|        tot_st_cap += vert->st_edge.cap;
 8952|  1.09M|        tot_st_flow += vert->st_edge.flow;
 8953|  1.09M|    }
 8954|   288k|    *pNum_changed_bonds = num_changed_bonds / 2;
 8955|       |
 8956|   288k|    pBNS->num_edges = n_edges;   /* number of edges */
 8957|   288k|    pBNS->num_added_edges = 0;
 8958|       |
 8959|       |    /*(@nnuk : Nauman Ullah Khan) */
 8960|   288k|    LOG_NO_ARGS("\n################# (L9108:ichi_bns.c) ################\n");
 8961|  1.38M|    for (i = 0, num_bonds = 0; i < num_atoms; i++) {
  ------------------
  |  Branch (8961:32): [True: 1.09M, False: 288k]
  ------------------
 8962|       |
 8963|  1.09M|        LOG_MULT_ARGS("Element : %s, Number of changed bonds (End): %d\n", at[i].elname, *pNum_changed_bonds);
 8964|  1.09M|    }
 8965|   288k|    LOG_NO_ARGS("\n#####################################################\n");
 8966|       |
 8967|   288k|    pBNS->tot_st_cap = tot_st_cap;
 8968|   288k|    pBNS->tot_st_flow = tot_st_flow;
 8969|       |
 8970|   288k|    return pBNS;
 8971|   288k|}
DeAllocateBnStruct:
 8976|   376k|{
 8977|   376k|    int i;
 8978|   376k|    if (pBNS)
  ------------------
  |  Branch (8978:9): [True: 376k, False: 129]
  ------------------
 8979|   376k|    {
 8980|   376k|        if (pBNS->edge)
  ------------------
  |  Branch (8980:13): [True: 376k, False: 0]
  ------------------
 8981|   376k|        {
 8982|   376k|            inchi_free( pBNS->edge );
  ------------------
  |  | 1152|   376k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 376k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 376k]
  |  |  ------------------
  ------------------
 8983|   376k|        }
 8984|  6.39M|        for (i = 0; i < pBNS->max_altp && i < BN_MAX_ALTP; i++)
  ------------------
  |  |   17|  6.02M|#define BN_MAX_ALTP  16
  ------------------
  |  Branch (8984:21): [True: 6.02M, False: 376k]
  |  Branch (8984:43): [True: 6.02M, False: 0]
  ------------------
 8985|  6.02M|        {
 8986|  6.02M|            if (pBNS->altp[i])
  ------------------
  |  Branch (8986:17): [True: 6.02M, False: 0]
  ------------------
 8987|  6.02M|            {
 8988|  6.02M|                inchi_free( pBNS->altp[i] );
  ------------------
  |  | 1152|  6.02M|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 6.02M, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 6.02M]
  |  |  ------------------
  ------------------
 8989|  6.02M|            }
 8990|  6.02M|        }
 8991|   376k|        if (pBNS->vert)
  ------------------
  |  Branch (8991:13): [True: 376k, False: 0]
  ------------------
 8992|   376k|        {
 8993|   376k|            if (pBNS->vert[0].iedge)
  ------------------
  |  Branch (8993:17): [True: 376k, False: 0]
  ------------------
 8994|   376k|            {
 8995|   376k|                inchi_free( pBNS->vert[0].iedge );
  ------------------
  |  | 1152|   376k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 376k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 376k]
  |  |  ------------------
  ------------------
 8996|   376k|            }
 8997|   376k|            inchi_free( pBNS->vert );
  ------------------
  |  | 1152|   376k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 376k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 376k]
  |  |  ------------------
  ------------------
 8998|   376k|        }
 8999|   376k|        inchi_free( pBNS );
  ------------------
  |  | 1152|   376k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 376k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 376k]
  |  |  ------------------
  ------------------
 9000|   376k|    }
 9001|       |
 9002|       |    return NULL;
 9003|   376k|}
ReInitBnStructAltPaths:
 9008|  1.09M|{
 9009|  1.09M|    int i;
 9010|  18.6M|    for (i = 0; i < pBNS->max_altp && i < BN_MAX_ALTP; i++)
  ------------------
  |  |   17|  17.5M|#define BN_MAX_ALTP  16
  ------------------
  |  Branch (9010:17): [True: 17.5M, False: 1.09M]
  |  Branch (9010:39): [True: 17.5M, False: 0]
  ------------------
 9011|  17.5M|    {
 9012|  17.5M|        if (pBNS->altp[i])
  ------------------
  |  Branch (9012:13): [True: 17.5M, False: 0]
  ------------------
 9013|  17.5M|        {
 9014|  17.5M|            ALTP_DELTA( pBNS->altp[i] ) = 0;
  ------------------
  |  |  112|  17.5M|#define ALTP_DELTA(altp)                 (altp)[iALTP_FLOW].flow[0]
  ------------------
 9015|  17.5M|            ALTP_PATH_LEN( pBNS->altp[i] ) = 0;
  ------------------
  |  |  101|  17.5M|#define ALTP_PATH_LEN(altp)             (altp)[iALTP_PATH_LEN].number  /* number of bonds = number of atoms-1*/
  ------------------
 9016|  17.5M|            ALTP_START_ATOM( pBNS->altp[i] ) = NO_VERTEX;
  ------------------
  |  |  103|  17.5M|#define ALTP_START_ATOM(altp)           (altp)[iALTP_START_ATOM].number
  ------------------
                          ALTP_START_ATOM( pBNS->altp[i] ) = NO_VERTEX;
  ------------------
  |  |  118|  17.5M|#define NO_VERTEX    -2
  ------------------
 9017|  17.5M|            ALTP_END_ATOM( pBNS->altp[i] ) = NO_VERTEX;
  ------------------
  |  |  102|  17.5M|#define ALTP_END_ATOM(altp)             (altp)[iALTP_END_ATOM].number
  ------------------
                          ALTP_END_ATOM( pBNS->altp[i] ) = NO_VERTEX;
  ------------------
  |  |  118|  17.5M|#define NO_VERTEX    -2
  ------------------
 9018|  17.5M|        }
 9019|  17.5M|    }
 9020|       |    pBNS->alt_path = NULL;
 9021|  1.09M|    pBNS->num_altp = 0;
 9022|  1.09M|    return i;
 9023|  1.09M|}
ReInitBnStructAddGroups:
 9033|  5.55k|{
 9034|  5.55k|    int ret;
 9035|       |    /* strip all t-groups and c-groups */
 9036|  5.55k|    ret = ReInitBnStruct( pBNS, at, num_atoms, 0 );
 9037|  5.55k|    if (ret)
  ------------------
  |  Branch (9037:9): [True: 0, False: 5.55k]
  ------------------
 9038|      0|    {
 9039|      0|        ret = BNS_REINIT_ERR;
  ------------------
  |  |   60|      0|#define BNS_REINIT_ERR     (BNS_ERR + 12) /*(-9987)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9040|      0|        goto exit_function;
 9041|      0|    }
 9042|       |    /*#if ( MOVE_CHARGES == 1 )*/
 9043|  5.55k|    if (*pBNS->pbTautFlags & TG_FLAG_MOVE_POS_CHARGES)
  ------------------
  |  |  921|  5.55k|#define TG_FLAG_MOVE_POS_CHARGES         0x00000008   /* MOVE_CHARGES allow long-range movement of N(+), P(+) charges           */
  ------------------
  |  Branch (9043:9): [True: 5.55k, False: 0]
  ------------------
 9044|  5.55k|    {
 9045|       |        /* Add c-groups */
 9046|  5.55k|        ret = AddCGroups2BnStruct( pCG, pBNS, at, num_atoms, cgi );
 9047|  5.55k|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  5.55k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  5.55k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  5.55k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  5.55k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 5.55k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 5.55k]
  |  |  ------------------
  ------------------
 9048|      0|        {
 9049|      0|            goto exit_function;
 9050|      0|        }
 9051|  5.55k|    }
 9052|       |    /*#endif*/
 9053|       |    /* Add t-groups */
 9054|  5.55k|    ret = AddTGroups2BnStruct( pCG, pBNS, at, num_atoms, tgi );
 9055|  5.55k|    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  5.55k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  5.55k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  5.55k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  5.55k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 5.55k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 5.55k]
  |  |  ------------------
  ------------------
 9056|      0|    {
 9057|      0|        goto exit_function;
 9058|      0|    }
 9059|       |
 9060|  5.55k|exit_function:
 9061|       |
 9062|  5.55k|    return ret;
 9063|  5.55k|}
ReInitBnStruct:
 9071|   300k|{
 9072|   300k|    int i, vfict, kfict, iedgefict, endpoint, centerpoint, iedge, k;
 9073|   300k|    int ret = 0;
 9074|   300k|    if (pBNS)
  ------------------
  |  Branch (9074:9): [True: 300k, False: 0]
  ------------------
 9075|   300k|    {
 9076|   300k|        if (pBNS->vert && pBNS->edge)
  ------------------
  |  Branch (9076:13): [True: 300k, False: 0]
  |  Branch (9076:27): [True: 300k, False: 0]
  ------------------
 9077|   300k|        {
 9078|       |            /* Debug */
 9079|   642k|            for (k = 0, i = 0; k < pBNS->num_edges; k++)
  ------------------
  |  Branch (9079:32): [True: 341k, False: 300k]
  ------------------
 9080|   341k|            {
 9081|   341k|                if (pBNS->edge[k].pass)
  ------------------
  |  Branch (9081:21): [True: 10, False: 341k]
  ------------------
 9082|     10|                {
 9083|     10|                    i++;
 9084|     10|                }
 9085|   341k|            }
 9086|   300k|            ret += i * 100;
 9087|       |            /* Restore flow and cap on edges to vertices connected to fictitious atoms */
 9088|   314k|            for (vfict = pBNS->num_atoms; vfict < pBNS->num_vertices; vfict++)
  ------------------
  |  Branch (9088:43): [True: 14.1k, False: 300k]
  ------------------
 9089|  14.1k|            {
 9090|  47.9k|                for (kfict = 0; kfict < pBNS->vert[vfict].num_adj_edges; kfict++)
  ------------------
  |  Branch (9090:33): [True: 33.8k, False: 14.1k]
  ------------------
 9091|  33.8k|                {
 9092|  33.8k|                    iedgefict = pBNS->vert[vfict].iedge[kfict]; /* fictitious edge to the endpoint */
 9093|  33.8k|                    endpoint = pBNS->edge[iedgefict].neighbor12 ^ vfict;  /* the endpoint */
 9094|       |                                                                          /* To simlify restore cap and flow in ALL edges to the endpoint */
 9095|  33.8k|                    if (bRemoveGroupsFromAtoms && endpoint < num_at)
  ------------------
  |  Branch (9095:25): [True: 0, False: 33.8k]
  |  Branch (9095:51): [True: 0, False: 0]
  ------------------
 9096|      0|                    {
 9097|      0|                        at[endpoint].c_point = 0;
 9098|      0|                        at[endpoint].endpoint = 0;
 9099|      0|                    }
 9100|   117k|                    for (k = 0; k < pBNS->vert[endpoint].num_adj_edges; k++)
  ------------------
  |  Branch (9100:33): [True: 83.7k, False: 33.8k]
  ------------------
 9101|  83.7k|                    {
 9102|  83.7k|                        iedge = pBNS->vert[endpoint].iedge[k]; /* edge to endpoint */
 9103|  83.7k|                        centerpoint = pBNS->edge[iedge].neighbor12 ^ endpoint;
 9104|  83.7k|                        pBNS->edge[iedge].cap = pBNS->edge[iedge].cap0;
 9105|  83.7k|                        pBNS->edge[iedge].flow = pBNS->edge[iedge].flow0;
 9106|  83.7k|                        pBNS->edge[iedge].pass = 0;
 9107|  83.7k|#if ( RESET_EDGE_FORBIDDEN_MASK == 1 )
 9108|  83.7k|                        pBNS->edge[iedge].forbidden &= pBNS->edge_forbidden_mask;
 9109|  83.7k|#endif
 9110|  83.7k|                        pBNS->vert[centerpoint].st_edge.cap = pBNS->vert[centerpoint].st_edge.cap0;
 9111|  83.7k|                        pBNS->vert[centerpoint].st_edge.flow = pBNS->vert[centerpoint].st_edge.flow0;
 9112|  83.7k|                    }
 9113|  33.8k|                    pBNS->vert[endpoint].st_edge.cap = pBNS->vert[endpoint].st_edge.cap0;
 9114|  33.8k|                    pBNS->vert[endpoint].st_edge.flow = pBNS->vert[endpoint].st_edge.flow0;
 9115|  33.8k|                    pBNS->vert[endpoint].type &= BNS_VERT_TYPE_ATOM;
  ------------------
  |  |   45|  33.8k|#define BNS_VERT_TYPE_ATOM          0x0001
  ------------------
 9116|  33.8k|                }
 9117|  14.1k|            }
 9118|       |            /* Reset number of neighbors */
 9119|   300k|            if (pBNS->num_edges > pBNS->num_bonds)
  ------------------
  |  Branch (9119:17): [True: 12.8k, False: 287k]
  ------------------
 9120|  12.8k|            {
 9121|  94.5k|                for (i = 0; i < pBNS->num_atoms; i++)
  ------------------
  |  Branch (9121:29): [True: 81.6k, False: 12.8k]
  ------------------
 9122|  81.6k|                {
 9123|  81.6k|                    pBNS->vert[i].num_adj_edges =
 9124|  81.6k|                        pBNS->vert[i].max_adj_edges - pBNS->nMaxAddEdges - NUM_KINDS_OF_GROUPS;
  ------------------
  |  |   86|  81.6k|#define NUM_KINDS_OF_GROUPS  2  /* 1 accounts for t-group kind, one more 1 accounts for c-group kind */
  ------------------
 9125|  81.6k|                }
 9126|  12.8k|            }
 9127|   300k|        }
 9128|      0|        else
 9129|      0|        {
 9130|      0|            ret += 2;
 9131|      0|        }
 9132|   300k|        if (!pBNS->edge)
  ------------------
  |  Branch (9132:13): [True: 0, False: 300k]
  ------------------
 9133|      0|        {
 9134|      0|            ret += 4;
 9135|      0|        }
 9136|   300k|        if (!pBNS->iedge)
  ------------------
  |  Branch (9136:13): [True: 0, False: 300k]
  ------------------
 9137|      0|        {
 9138|      0|            ret += 8;
 9139|      0|        }
 9140|       |
 9141|   300k|        ReInitBnStructAltPaths( pBNS );
 9142|       |
 9143|   300k|        pBNS->num_vertices = pBNS->num_atoms;
 9144|   300k|        pBNS->num_edges = pBNS->num_bonds;
 9145|   300k|        pBNS->num_added_atoms = 0;
 9146|   300k|        pBNS->num_t_groups = 0;
 9147|   300k|        pBNS->num_c_groups = 0;
 9148|   300k|        pBNS->num_added_edges = 0;
 9149|   300k|    }
 9150|      0|    else
 9151|      0|    {
 9152|      0|        ret += 1;
 9153|      0|    }
 9154|       |
 9155|   300k|    return ret;
 9156|   300k|}
AddTGroups2BnStruct:
 9179|  12.0k|{
 9180|  12.0k|    int ret = 0;
 9181|       |    /* ret = ReInitBnStruct( pBNS ); */
 9182|  12.0k|    if (tgi && tgi->num_t_groups && tgi->t_group)
  ------------------
  |  Branch (9182:9): [True: 12.0k, False: 0]
  |  Branch (9182:16): [True: 12.0k, False: 0]
  |  Branch (9182:37): [True: 12.0k, False: 0]
  ------------------
 9183|  12.0k|    {
 9184|  12.0k|        int         i, k, endpoint, centerpoint, fictpoint;
 9185|  12.0k|        int         num_tg = tgi->num_t_groups;
 9186|  12.0k|        int         num_edges = pBNS->num_edges;
 9187|  12.0k|        int         num_vertices = pBNS->num_vertices;
 9188|  12.0k|        BNS_VERTEX *vert_ficpoint, *ver_ficpont_prev;  /* fictitious vertex describing t-group */
 9189|  12.0k|        BNS_VERTEX *vert_endpoint;
 9190|  12.0k|        BNS_EDGE   *edge;      /* edge between that vertex and the tautomeric endpoint */
 9191|  12.0k|        int        nMaxTGroupNumber = 0;
 9192|  12.0k|        ENDPOINT_INFO eif;
 9193|       |
 9194|       |        /* Debug: check overflow */
 9195|  12.0k|        if (num_vertices + num_tg >= pBNS->max_vertices)
  ------------------
  |  Branch (9195:13): [True: 0, False: 12.0k]
  ------------------
 9196|      0|        {
 9197|      0|            return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9198|      0|        }
 9199|       |        /* Find the largest t-group ID */
 9200|  24.8k|        for (i = 0; i < num_tg; i++)
  ------------------
  |  Branch (9200:21): [True: 12.7k, False: 12.0k]
  ------------------
 9201|  12.7k|        {
 9202|  12.7k|            if (tgi->t_group[i].nGroupNumber > nMaxTGroupNumber)
  ------------------
  |  Branch (9202:17): [True: 12.7k, False: 0]
  ------------------
 9203|  12.7k|            {
 9204|  12.7k|                nMaxTGroupNumber = tgi->t_group[i].nGroupNumber;
 9205|  12.7k|            }
 9206|  12.7k|        }
 9207|       |        /* Since t-group IDs may be not contiguous, clear all vertices that will be added.
 9208|       |        all-zeroes-vertex will be ignored by the BNS
 9209|       |        */
 9210|  12.0k|        memset( pBNS->vert + num_vertices, 0, nMaxTGroupNumber * sizeof( pBNS->vert[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 9211|       |        /* Make sure the last t-group has the largest t-group ID:
 9212|       |        this is necessary to correctly add new edges
 9213|       |        and vertices for testing augmenting paths            */
 9214|       |#if ( bRELEASE_VERSION != 1 )
 9215|       |        insertions_sort( pCG, tgi->t_group, num_tg, sizeof( tgi->t_group[0] ), CompTGroupNumber );
 9216|       |        for (i = 1; i < num_tg; i++)
 9217|       |        {
 9218|       |            if (1 != tgi->t_group[i].nGroupNumber - tgi->t_group[i - 1].nGroupNumber)
 9219|       |            {
 9220|       |                return BNS_BOND_ERR;
 9221|       |            }
 9222|       |        }
 9223|       |#else
 9224|  12.0k|        if (nMaxTGroupNumber != tgi->t_group[num_tg - 1].nGroupNumber)
  ------------------
  |  Branch (9224:13): [True: 0, False: 12.0k]
  ------------------
 9225|      0|        {
 9226|      0|            insertions_sort( pCG, tgi->t_group, num_tg, sizeof( tgi->t_group[0] ), CompTGroupNumber );
 9227|      0|        }
 9228|  12.0k|#endif
 9229|       |        /* Initialize new fictitious vertices */
 9230|  12.0k|        ver_ficpont_prev = pBNS->vert + num_vertices - 1;
 9231|       |
 9232|  24.8k|        for (i = 0; i < num_tg; i++, ver_ficpont_prev = vert_ficpoint)
  ------------------
  |  Branch (9232:21): [True: 12.7k, False: 12.0k]
  ------------------
 9233|  12.7k|        {
 9234|       |            /*
 9235|       |            vert_ficpoint-1 is the last vertex;
 9236|       |            vert_ficpoint   is the vertex that is being added
 9237|       |            Note: nGroupNumber are not contiguous
 9238|       |            */
 9239|  12.7k|            vert_ficpoint = pBNS->vert + num_vertices + tgi->t_group[i].nGroupNumber - 1;
 9240|  12.7k|            vert_ficpoint->iedge = ver_ficpont_prev->iedge + ver_ficpont_prev->max_adj_edges;
 9241|  12.7k|            vert_ficpoint->max_adj_edges = tgi->t_group[i].nNumEndpoints + BNS_ADD_EDGES + BNS_ADD_SUPER_TGROUP;
  ------------------
  |  |   89|  12.7k|#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;
  ------------------
  |  |   85|  12.7k|#define BNS_ADD_SUPER_TGROUP 1  /* reserve one more edge for a t-group to connect to a single super-t-group */
  ------------------
 9242|  12.7k|            vert_ficpoint->num_adj_edges = 0;
 9243|  12.7k|            vert_ficpoint->st_edge.flow = vert_ficpoint->st_edge.flow0 = 0;
 9244|  12.7k|            vert_ficpoint->st_edge.cap = vert_ficpoint->st_edge.cap0 = 0;
 9245|  12.7k|            vert_ficpoint->type = BNS_VERT_TYPE_TGROUP;
  ------------------
  |  |   47|  12.7k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 9246|  12.7k|        }
 9247|       |
 9248|  88.3k|        for (endpoint = 0; endpoint < num_atoms; endpoint++)
  ------------------
  |  Branch (9248:28): [True: 76.2k, False: 12.0k]
  ------------------
 9249|  76.2k|        {
 9250|  76.2k|            if (!at[endpoint].endpoint)
  ------------------
  |  Branch (9250:17): [True: 46.1k, False: 30.0k]
  ------------------
 9251|  46.1k|            {
 9252|  46.1k|                continue;
 9253|  46.1k|            }
 9254|  30.0k|            fictpoint = at[endpoint].endpoint + num_vertices - 1;
 9255|  30.0k|            vert_ficpoint = pBNS->vert + fictpoint;
 9256|  30.0k|            vert_endpoint = pBNS->vert + endpoint;
 9257|       |            /* Debug: check overflow */
 9258|  30.0k|            if (fictpoint >= pBNS->max_vertices ||
  ------------------
  |  Branch (9258:17): [True: 0, False: 30.0k]
  ------------------
 9259|  30.0k|                 num_edges >= pBNS->max_edges ||
  ------------------
  |  Branch (9259:18): [True: 0, False: 30.0k]
  ------------------
 9260|  30.0k|                 vert_ficpoint->num_adj_edges >= vert_ficpoint->max_adj_edges ||
  ------------------
  |  Branch (9260:18): [True: 0, False: 30.0k]
  ------------------
 9261|  30.0k|                 vert_endpoint->num_adj_edges >= vert_endpoint->max_adj_edges)
  ------------------
  |  Branch (9261:18): [True: 0, False: 30.0k]
  ------------------
 9262|      0|            {
 9263|      0|                ret = BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9264|      0|                break;
 9265|      0|            }
 9266|       |            /* Obtain donor/acceptor info */
 9267|  30.0k|            if (!nGetEndpointInfo(at, endpoint, &eif)
  ------------------
  |  Branch (9267:17): [True: 5, False: 30.0k]
  ------------------
 9268|      5|#if ( TAUT_PT_22_00 == 1 )		 
 9269|      5|                && !((tgi->bTautFlags & TG_FLAG_PT_22_00) && nGetEndpointInfo_PT_22_00(at, endpoint, &eif))
  ------------------
  |  |  953|      5|#define TG_FLAG_PT_22_00                 0x00800000
  ------------------
  |  Branch (9269:22): [True: 0, False: 5]
  |  Branch (9269:62): [True: 0, False: 0]
  ------------------
 9270|      5|#endif
 9271|      5|#if ( TAUT_PT_16_00 == 1 )		 
 9272|      5|                && !((tgi->bTautFlags & TG_FLAG_PT_16_00) && nGetEndpointInfo_PT_16_00(at, endpoint, &eif))
  ------------------
  |  |  954|      5|#define TG_FLAG_PT_16_00                 0x01000000
  ------------------
  |  Branch (9272:22): [True: 0, False: 5]
  |  Branch (9272:62): [True: 0, False: 0]
  ------------------
 9273|      5|#endif
 9274|      5|#if ( TAUT_PT_06_00 == 1 )		 
 9275|      5|                && !((tgi->bTautFlags & TG_FLAG_PT_06_00) && nGetEndpointInfo_PT_06_00(at, endpoint, &eif))
  ------------------
  |  |  955|      5|#define TG_FLAG_PT_06_00                 0x02000000
  ------------------
  |  Branch (9275:22): [True: 0, False: 5]
  |  Branch (9275:62): [True: 0, False: 0]
  ------------------
 9276|      5|#endif
 9277|      5|#if ( TAUT_PT_39_00 == 1 )		 
 9278|      5|                && !((tgi->bTautFlags & TG_FLAG_PT_39_00) && nGetEndpointInfo_PT_39_00(at, endpoint, &eif))
  ------------------
  |  |  956|      5|#define TG_FLAG_PT_39_00                 0x04000000
  ------------------
  |  Branch (9278:22): [True: 0, False: 5]
  |  Branch (9278:62): [True: 0, False: 0]
  ------------------
 9279|      5|#endif
 9280|      5|#if ( TAUT_PT_13_00 == 1 )		 
 9281|      5|                && !((tgi->bTautFlags & TG_FLAG_PT_13_00) && nGetEndpointInfo_PT_13_00(at, endpoint, &eif))
  ------------------
  |  |  957|      5|#define TG_FLAG_PT_13_00                 0x08000000
  ------------------
  |  Branch (9281:22): [True: 0, False: 5]
  |  Branch (9281:62): [True: 0, False: 0]
  ------------------
 9282|      5|#endif
 9283|      5|#if ( TAUT_PT_18_00 == 1 )		 
 9284|      5|                && !((tgi->bTautFlags & TG_FLAG_PT_18_00) && nGetEndpointInfo_PT_18_00(at, endpoint, &eif))
  ------------------
  |  |  958|      5|#define TG_FLAG_PT_18_00                 0x10000000
  ------------------
  |  Branch (9284:22): [True: 0, False: 5]
  |  Branch (9284:62): [True: 0, False: 0]
  ------------------
 9285|  30.0k|#endif		 
 9286|  30.0k|                ) {
 9287|      5|#if ( KETO_ENOL_TAUT == 1 )
 9288|      5|                if (!( ( tgi->bTautFlags & TG_FLAG_KETO_ENOL_TAUT ) &&
  ------------------
  |  |  946|      5|#define TG_FLAG_KETO_ENOL_TAUT           0x00080000   /* turn on keto-enol tautomerism detection */
  ------------------
  |  Branch (9288:24): [True: 0, False: 5]
  ------------------
 9289|      0|                       nGetEndpointInfo_KET( at, endpoint, &eif ) ))
  ------------------
  |  Branch (9289:24): [True: 0, False: 0]
  ------------------
 9290|      5|#endif
 9291|      5|                {
 9292|      5|                    ret = BNS_BOND_ERR;
  ------------------
  |  |   52|      5|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   47|      5|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9293|      5|                    break;
 9294|      5|                }
 9295|      5|            }
 9296|       |
 9297|  30.0k|            vert_endpoint->type |= BNS_VERT_TYPE_ENDPOINT;
  ------------------
  |  |   46|  30.0k|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 9298|       |
 9299|       |            /* Set capacity = 1 to the edges from the endpoint to the centerpoint(s) */
 9300|  70.5k|            for (k = 0; k < vert_endpoint->num_adj_edges; k++)
  ------------------
  |  Branch (9300:25): [True: 40.4k, False: 30.0k]
  ------------------
 9301|  40.4k|            {
 9302|  40.4k|                int iedge = vert_endpoint->iedge[k];
 9303|  40.4k|                if (!pBNS->edge[iedge].cap)
  ------------------
  |  Branch (9303:21): [True: 18.5k, False: 21.9k]
  ------------------
 9304|  18.5k|                {
 9305|       |                    /* Single bond, possibly between endpoint and centerpoint */
 9306|  18.5k|                    centerpoint = ( pBNS->edge[iedge].neighbor12 ^ endpoint );
 9307|  18.5k|                    if (centerpoint < pBNS->num_atoms &&
  ------------------
  |  Branch (9307:25): [True: 18.5k, False: 0]
  ------------------
 9308|  18.5k|                         pBNS->vert[centerpoint].st_edge.cap >= 1)
  ------------------
  |  Branch (9308:26): [True: 13.9k, False: 4.54k]
  ------------------
 9309|  13.9k|                    {
 9310|  13.9k|                        int bond_type = ( at[endpoint].bond_type[k] & BOND_TYPE_MASK );
  ------------------
  |  |  189|  13.9k|#define BOND_TYPE_MASK        0x0f
  ------------------
 9311|  13.9k|                        if (bond_type == BOND_TAUTOM ||
  ------------------
  |  |  185|  27.9k|#define BOND_TAUTOM              8
  ------------------
  |  Branch (9311:29): [True: 7.54k, False: 6.44k]
  ------------------
 9312|  6.44k|                             bond_type == BOND_ALTERN ||
  ------------------
  |  |  180|  6.44k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|  20.4k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (9312:30): [True: 184, False: 6.26k]
  ------------------
 9313|  6.26k|                             bond_type == BOND_ALT12NS ||
  ------------------
  |  |  186|  20.2k|#define BOND_ALT12NS             9
  ------------------
  |  Branch (9313:30): [True: 58, False: 6.20k]
  ------------------
 9314|  6.20k|                             bond_type == BOND_SINGLE)
  ------------------
  |  |  177|  6.20k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|  6.20k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (9314:30): [True: 6.20k, False: 0]
  ------------------
 9315|  13.9k|                        {
 9316|  13.9k|                            pBNS->edge[iedge].cap = 1;
 9317|  13.9k|                        }
 9318|  13.9k|                    }
 9319|  18.5k|                }
 9320|  40.4k|            }
 9321|       |
 9322|       |            /* Create a new edge connecting endpoint to the new fictitious t-group vertex vert_ficpoint */
 9323|  30.0k|            edge = pBNS->edge + num_edges;
 9324|  30.0k|            edge->cap = 1;
 9325|  30.0k|            edge->flow = 0;
 9326|  30.0k|            edge->pass = 0;
 9327|  30.0k|#if ( RESET_EDGE_FORBIDDEN_MASK == 1 )
 9328|  30.0k|            edge->forbidden &= pBNS->edge_forbidden_mask;
 9329|  30.0k|#endif
 9330|       |            /* Later include case when the charge change allows the endpoint to become tautomeric */
 9331|       |            /* mark endoint having moveable H atom with flow=1 */
 9332|       |
 9333|       |            /* -- old "no charges" version -- */
 9334|       |            /* if (at[endpoint].chem_bonds_valence == at[endpoint].valence) */
 9335|       |            /* -- the following line takes charges into account -- */
 9336|  30.0k|            if (eif.cDonor) /* means the endpoint has an H-atom to donate */
  ------------------
  |  Branch (9336:17): [True: 14.8k, False: 15.1k]
  ------------------
 9337|  14.8k|            {
 9338|       |                /* increment edge flow */
 9339|  14.8k|                edge->flow++;
 9340|       |                /* increment one vertex st-flow & cap */
 9341|  14.8k|                vert_ficpoint->st_edge.flow++;
 9342|  14.8k|                vert_ficpoint->st_edge.cap++;
 9343|       |                /* increment another vertex st-flow & cap */
 9344|  14.8k|                vert_endpoint->st_edge.flow++;
 9345|  14.8k|                vert_endpoint->st_edge.cap++;
 9346|  14.8k|            }
 9347|       |            /* Connect edge to endpoint and fictpoint and increment the counters of neighbors and edges */
 9348|  30.0k|            edge->neighbor1 = endpoint; /* the smallest out of v1=endopoint and v2=num_vertices */
 9349|  30.0k|            edge->neighbor12 = endpoint ^ fictpoint; /* v1 ^ v2 */
 9350|  30.0k|            vert_endpoint->iedge[vert_endpoint->num_adj_edges] = num_edges;
 9351|  30.0k|            vert_ficpoint->iedge[vert_ficpoint->num_adj_edges] = num_edges++;
 9352|  30.0k|            edge->neigh_ord[0] = vert_endpoint->num_adj_edges++;
 9353|  30.0k|            edge->neigh_ord[1] = vert_ficpoint->num_adj_edges++;
 9354|  30.0k|            edge->cap0 = edge->cap;
 9355|  30.0k|            edge->flow0 = edge->flow;
 9356|  30.0k|        }
 9357|       |
 9358|  12.0k|        pBNS->num_edges = num_edges;
 9359|  12.0k|        pBNS->num_vertices += nMaxTGroupNumber;
 9360|  12.0k|        pBNS->num_t_groups = num_tg;
 9361|  12.0k|    }
 9362|       |
 9363|  12.0k|    return ret;
 9364|  12.0k|}
AddCGroups2BnStruct:
 9376|  12.9k|{
 9377|  12.9k|    int ret = 0;
 9378|       |    /* ret = ReInitBnStruct( pBNS ); */
 9379|  12.9k|    if (cgi && cgi->num_c_groups && cgi->c_group)
  ------------------
  |  Branch (9379:9): [True: 12.9k, False: 0]
  |  Branch (9379:16): [True: 1.25k, False: 11.7k]
  |  Branch (9379:37): [True: 1.25k, False: 0]
  ------------------
 9380|  1.25k|    {
 9381|  1.25k|        int         i, k, c_point, centerpoint, fictpoint;
 9382|  1.25k|        int         num_cg = cgi->num_c_groups;
 9383|  1.25k|        int         num_edges = pBNS->num_edges;
 9384|  1.25k|        int         num_vertices = pBNS->num_vertices;
 9385|  1.25k|        BNS_VERTEX *vert_ficpoint, *ver_ficpont_prev;  /* fictitious vertex describing charge c-group */
 9386|  1.25k|        BNS_VERTEX *vertex_cpoint;
 9387|  1.25k|        BNS_EDGE   *edge;      /* edge between that vertex and the tautomeric c_point */
 9388|  1.25k|        int        nMaxCGroupNumber = 0;
 9389|       |
 9390|       |        /* Debug: check overflow */
 9391|  1.25k|        if (num_vertices + num_cg >= pBNS->max_vertices)
  ------------------
  |  Branch (9391:13): [True: 0, False: 1.25k]
  ------------------
 9392|      0|        {
 9393|      0|            return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9394|      0|        }
 9395|       |        /* Find the largest t-group ID */
 9396|  2.63k|        for (i = 0; i < num_cg; i++)
  ------------------
  |  Branch (9396:21): [True: 1.38k, False: 1.25k]
  ------------------
 9397|  1.38k|        {
 9398|  1.38k|            if (cgi->c_group[i].nGroupNumber > nMaxCGroupNumber)
  ------------------
  |  Branch (9398:17): [True: 1.38k, False: 0]
  ------------------
 9399|  1.38k|            {
 9400|  1.38k|                nMaxCGroupNumber = cgi->c_group[i].nGroupNumber;
 9401|  1.38k|            }
 9402|  1.38k|        }
 9403|       |        /* Since t-group IDs may be not contiguous, clear all vertices that will be added.
 9404|       |        all-zeroes-vertex will be ignored by the BNS
 9405|       |        */
 9406|  1.25k|        memset( pBNS->vert + num_vertices, 0, nMaxCGroupNumber * sizeof( pBNS->vert[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 9407|       |        /* Make sure the last t-group has the largest t-group ID:
 9408|       |        this is necessary to correctly add new edges and vertices for testing augmenting paths
 9409|       |        */
 9410|       |#if ( bRELEASE_VERSION != 1 )
 9411|       |        insertions_sort( cgi->c_group, num_cg, sizeof( cgi->c_group[0] ), CompCGroupNumber );
 9412|       |        for (i = 1; i < num_cg; i++)
 9413|       |        {
 9414|       |            if (1 != cgi->c_group[i].nGroupNumber - cgi->c_group[i - 1].nGroupNumber)
 9415|       |            {
 9416|       |                return BNS_BOND_ERR;
 9417|       |            }
 9418|       |        }
 9419|       |#else
 9420|  1.25k|        if (nMaxCGroupNumber != cgi->c_group[num_cg - 1].nGroupNumber)
  ------------------
  |  Branch (9420:13): [True: 0, False: 1.25k]
  ------------------
 9421|      0|        {
 9422|      0|            insertions_sort( pCG, cgi->c_group, num_cg,
 9423|      0|                             sizeof( cgi->c_group[0] ),
 9424|      0|                             CompCGroupNumber );
 9425|      0|        }
 9426|  1.25k|#endif
 9427|       |        /**************************************/
 9428|       |        /* initialize new fictitious vertices */
 9429|       |        /* representing c-point groups        */
 9430|       |        /**************************************/
 9431|  1.25k|        ver_ficpont_prev = pBNS->vert + num_vertices - 1;
 9432|       |
 9433|  2.63k|        for (i = 0; i < num_cg; i++, ver_ficpont_prev = vert_ficpoint)
  ------------------
  |  Branch (9433:21): [True: 1.38k, False: 1.25k]
  ------------------
 9434|  1.38k|        {
 9435|       |            /*
 9436|       |            vert_ficpoint-1 is the last vertex;
 9437|       |            vert_ficpoint   is the being added vertex
 9438|       |            Note: nGroupNumber are not contiguous
 9439|       |            */
 9440|  1.38k|            vert_ficpoint = pBNS->vert + num_vertices + cgi->c_group[i].nGroupNumber - 1;
 9441|  1.38k|            vert_ficpoint->iedge = ver_ficpont_prev->iedge + ver_ficpont_prev->max_adj_edges;
 9442|  1.38k|            vert_ficpoint->max_adj_edges = cgi->c_group[i].num_CPoints + BNS_ADD_EDGES;
  ------------------
  |  |   89|  1.38k|#define BNS_ADD_EDGES        1  /* max. number of edges to add to each atom (except edges to a t-group or c-group) */
  ------------------
 9443|  1.38k|            vert_ficpoint->num_adj_edges = 0;
 9444|  1.38k|            vert_ficpoint->st_edge.flow = vert_ficpoint->st_edge.flow0 = 0;
 9445|  1.38k|            vert_ficpoint->st_edge.cap = vert_ficpoint->st_edge.cap0 = 0;
 9446|  1.38k|            vert_ficpoint->type = BNS_VERT_TYPE_C_GROUP;
  ------------------
  |  |   49|  1.38k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
 9447|  1.38k|        }
 9448|       |
 9449|       |        /************************************************/
 9450|       |        /* Connect c-points to the fictitious vertices  */
 9451|       |        /* representing c-point groups; set caps, flows */
 9452|       |        /************************************************/
 9453|  10.1k|        for (c_point = 0; c_point < num_atoms; c_point++)
  ------------------
  |  Branch (9453:27): [True: 8.91k, False: 1.25k]
  ------------------
 9454|  8.91k|        {
 9455|  8.91k|            if (!at[c_point].c_point)
  ------------------
  |  Branch (9455:17): [True: 5.16k, False: 3.74k]
  ------------------
 9456|  5.16k|            {
 9457|  5.16k|                continue;
 9458|  5.16k|            }
 9459|  3.74k|            fictpoint = at[c_point].c_point + num_vertices - 1; /* c-group vertex index */
 9460|  3.74k|            vert_ficpoint = pBNS->vert + fictpoint; /* c-group vertex */
 9461|  3.74k|            vertex_cpoint = pBNS->vert + c_point;   /* c_point vertex */
 9462|       |                                                    /* Debug: check overflow */
 9463|  3.74k|            if (fictpoint >= pBNS->max_vertices ||
  ------------------
  |  Branch (9463:17): [True: 0, False: 3.74k]
  ------------------
 9464|  3.74k|                 num_edges >= pBNS->max_edges ||
  ------------------
  |  Branch (9464:18): [True: 0, False: 3.74k]
  ------------------
 9465|  3.74k|                 vert_ficpoint->num_adj_edges >= vert_ficpoint->max_adj_edges ||
  ------------------
  |  Branch (9465:18): [True: 0, False: 3.74k]
  ------------------
 9466|  3.74k|                 vertex_cpoint->num_adj_edges >= vertex_cpoint->max_adj_edges)
  ------------------
  |  Branch (9466:18): [True: 0, False: 3.74k]
  ------------------
 9467|      0|            {
 9468|      0|                ret = BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9469|      0|                break;
 9470|      0|            }
 9471|  3.74k|            vertex_cpoint->type |= BNS_VERT_TYPE_C_POINT;
  ------------------
  |  |   48|  3.74k|#define BNS_VERT_TYPE_C_POINT       0x0008
  ------------------
 9472|       |#if ( FIX_CPOINT_BOND_CAP != 1 )  /* { */
 9473|       |            /* set capacity = 1 to the edges from the c_point to the centerpoint(s)     */
 9474|       |            /* if their current capacity is zero                                        */
 9475|       |            /* the centerpoint is any adjacent atom that is adjacent to a multiple bond */
 9476|       |            for (k = 0; k < vertex_cpoint->num_adj_edges; k++)
 9477|       |            {
 9478|       |                int iedge = vertex_cpoint->iedge[k];
 9479|       |                if (!pBNS->edge[iedge].cap)
 9480|       |                {
 9481|       |                    /* single bond, possibly between c_point and centerpoint */
 9482|       |                    centerpoint = ( pBNS->edge[iedge].neighbor12 ^ c_point );
 9483|       |                    if (centerpoint < pBNS->num_atoms &&
 9484|       |                         pBNS->vert[centerpoint].st_edge.cap >= 1)
 9485|       |                    {
 9486|       |                        int bond_type = ( at[c_point].bond_type[k] & BOND_TYPE_MASK );
 9487|       |                        if (bond_type == BOND_TAUTOM ||
 9488|       |                             bond_type == BOND_ALTERN ||
 9489|       |                             bond_type == BOND_SINGLE)
 9490|       |                        {
 9491|       |                            pBNS->edge[iedge].cap = 1;
 9492|       |                        }
 9493|       |                    }
 9494|       |                }
 9495|       |            }
 9496|       |#endif /* } FIX_CPOINT_BOND_CAP */
 9497|       |
 9498|       |            /* Create a new edge connecting c_point to the new fictitious c-group vertex vert_ficpoint */
 9499|  3.74k|            edge = pBNS->edge + num_edges;
 9500|  3.74k|            edge->cap = 1;
 9501|  3.74k|            edge->flow = 0;
 9502|  3.74k|            edge->pass = 0;
 9503|  3.74k|#if ( RESET_EDGE_FORBIDDEN_MASK == 1 )
 9504|  3.74k|            edge->forbidden &= pBNS->edge_forbidden_mask;
 9505|  3.74k|#endif
 9506|       |            /* Mark edge to c-point having NO moveable charge with flow=1 */
 9507|  3.74k|            if (!CHARGED_CPOINT( at, c_point ))
  ------------------
  |  |  253|  3.74k|#define CHARGED_CPOINT(X,i) ((X)[i].charge==1)
  ------------------
  |  Branch (9507:17): [True: 2.07k, False: 1.67k]
  ------------------
 9508|  2.07k|            {
 9509|       |                /* Increment edge flow */
 9510|  2.07k|                edge->flow++;
 9511|       |                /* Increment c-group vertex st-flow & cap */
 9512|  2.07k|                vert_ficpoint->st_edge.flow++;
 9513|  2.07k|                vert_ficpoint->st_edge.cap++;
 9514|       |                /* Increment c-point vertex st-flow & cap */
 9515|  2.07k|                vertex_cpoint->st_edge.flow++;
 9516|  2.07k|                vertex_cpoint->st_edge.cap++;
 9517|  2.07k|            }
 9518|       |
 9519|  3.74k|#if ( FIX_CPOINT_BOND_CAP == 1 ) /* { */
 9520|       |
 9521|       |            /* Set capacity = 1 to the edges from the c_point to the centerpoint(s)     */
 9522|       |            /* if their current capacity is zero                                        */
 9523|       |            /* the centerpoint is any adjacent atom that is adjacent to a multiple bond */
 9524|  12.2k|            for (k = 0; k < vertex_cpoint->num_adj_edges; k++)
  ------------------
  |  Branch (9524:25): [True: 8.52k, False: 3.74k]
  ------------------
 9525|  8.52k|            {
 9526|  8.52k|                int iedge = vertex_cpoint->iedge[k];
 9527|  8.52k|                VertexFlow  nNewCap = vertex_cpoint->st_edge.cap;
 9528|  8.52k|                centerpoint = ( pBNS->edge[iedge].neighbor12 ^ c_point );
 9529|  8.52k|                if (!pBNS->edge[iedge].cap)
  ------------------
  |  Branch (9529:21): [True: 2.45k, False: 6.07k]
  ------------------
 9530|  2.45k|                {
 9531|       |                    /* Single bond, possibly between c_point and centerpoint */
 9532|  2.45k|                    if (centerpoint < pBNS->num_atoms &&
  ------------------
  |  Branch (9532:25): [True: 2.45k, False: 0]
  ------------------
 9533|  2.45k|                         pBNS->vert[centerpoint].st_edge.cap >= 1)
  ------------------
  |  Branch (9533:26): [True: 917, False: 1.53k]
  ------------------
 9534|    917|                    {
 9535|    917|                        nNewCap = inchi_min( pBNS->vert[centerpoint].st_edge.cap, nNewCap );
  ------------------
  |  |  139|    917|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 917]
  |  |  ------------------
  ------------------
 9536|    917|                        nNewCap = inchi_min( nNewCap, MAX_BOND_EDGE_CAP );
  ------------------
  |  |  139|    917|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 917, False: 0]
  |  |  ------------------
  ------------------
 9537|    917|                        pBNS->edge[iedge].cap = nNewCap;
 9538|    917|                    }
 9539|       |#if ( FIX_CPOINT_BOND_CAP2 == 1 ) /* multiple bond */
 9540|       |                    else
 9541|       |                        if (centerpoint < pBNS->num_atoms &&
 9542|       |                             edge->flow && pBNS->edge[iedge].cap < MAX_BOND_EDGE_CAP)
 9543|       |                        {
 9544|       |                            pBNS->edge[iedge].cap++;
 9545|       |                        }
 9546|       |#endif
 9547|  2.45k|                }
 9548|  8.52k|            }
 9549|  3.74k|#endif  /* } FIX_CPOINT_BOND_CAP */
 9550|       |
 9551|       |            /* Connect edge to c_point and fictpoint and increment the counters of neighbors and edges */
 9552|  3.74k|            edge->neighbor1 = c_point; /* the smallest out of v1=endopoint and v2=num_vertices */
 9553|  3.74k|            edge->neighbor12 = c_point ^ fictpoint; /* v1 ^ v2 */
 9554|  3.74k|            vertex_cpoint->iedge[vertex_cpoint->num_adj_edges] = num_edges;
 9555|  3.74k|            vert_ficpoint->iedge[vert_ficpoint->num_adj_edges] = num_edges++;
 9556|  3.74k|            edge->neigh_ord[0] = vertex_cpoint->num_adj_edges++;
 9557|  3.74k|            edge->neigh_ord[1] = vert_ficpoint->num_adj_edges++;
 9558|  3.74k|            edge->cap0 = edge->cap;
 9559|  3.74k|            edge->flow0 = edge->flow;
 9560|  3.74k|        }
 9561|       |
 9562|  1.25k|        pBNS->num_edges = num_edges;
 9563|  1.25k|        pBNS->num_vertices += nMaxCGroupNumber;
 9564|  1.25k|        pBNS->num_c_groups = num_cg;
 9565|  1.25k|    }
 9566|       |
 9567|  12.9k|    return ret;
 9568|  12.9k|}
ClearAllBnDataVertices:
 9575|   376k|{
 9576|   376k|    int i;
 9577|  12.6M|    for (i = 0; i < size; i++)
  ------------------
  |  Branch (9577:17): [True: 12.2M, False: 376k]
  ------------------
 9578|  12.2M|    {
 9579|  12.2M|        v[i] = value;
 9580|  12.2M|    }
 9581|   376k|}
ClearAllBnDataEdges:
 9586|   376k|{
 9587|   376k|    int i;
 9588|  12.6M|    for (i = 0; i < size; i++)
  ------------------
  |  Branch (9588:17): [True: 12.2M, False: 376k]
  ------------------
 9589|  12.2M|    {
 9590|  12.2M|        e[i][0] = value;
 9591|  12.2M|    }
 9592|   376k|}
DeAllocateBnData:
 9597|   376k|{
 9598|   376k|    if (pBD)
  ------------------
  |  Branch (9598:9): [True: 376k, False: 129]
  ------------------
 9599|   376k|    {
 9600|   376k|        if (pBD->BasePtr)
  ------------------
  |  Branch (9600:13): [True: 376k, False: 0]
  ------------------
 9601|   376k|        {
 9602|   376k|            inchi_free( pBD->BasePtr );
  ------------------
  |  | 1152|   376k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 376k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 376k]
  |  |  ------------------
  ------------------
 9603|   376k|        }
 9604|   376k|        if (pBD->SwitchEdge)
  ------------------
  |  Branch (9604:13): [True: 376k, False: 0]
  ------------------
 9605|   376k|        {
 9606|   376k|            inchi_free( pBD->SwitchEdge );
  ------------------
  |  | 1152|   376k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 376k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 376k]
  |  |  ------------------
  ------------------
 9607|   376k|        }
 9608|   376k|        if (pBD->Tree)
  ------------------
  |  Branch (9608:13): [True: 376k, False: 0]
  ------------------
 9609|   376k|        {
 9610|   376k|            inchi_free( pBD->Tree );
  ------------------
  |  | 1152|   376k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 376k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 376k]
  |  |  ------------------
  ------------------
 9611|   376k|        }
 9612|   376k|        if (pBD->ScanQ)
  ------------------
  |  Branch (9612:13): [True: 376k, False: 0]
  ------------------
 9613|   376k|        {
 9614|   376k|            inchi_free( pBD->ScanQ );
  ------------------
  |  | 1152|   376k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 376k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 376k]
  |  |  ------------------
  ------------------
 9615|   376k|        }
 9616|   376k|        if (pBD->Pu)
  ------------------
  |  Branch (9616:13): [True: 376k, False: 0]
  ------------------
 9617|   376k|        {
 9618|   376k|            inchi_free( pBD->Pu );
  ------------------
  |  | 1152|   376k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 376k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 376k]
  |  |  ------------------
  ------------------
 9619|   376k|        }
 9620|   376k|        if (pBD->Pv)
  ------------------
  |  Branch (9620:13): [True: 376k, False: 0]
  ------------------
 9621|   376k|        {
 9622|   376k|            inchi_free( pBD->Pv );
  ------------------
  |  | 1152|   376k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 376k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 376k]
  |  |  ------------------
  ------------------
 9623|   376k|        }
 9624|   376k|#if ( BNS_RAD_SEARCH == 1 )
 9625|   376k|        if (pBD->RadEndpoints)
  ------------------
  |  Branch (9625:13): [True: 376k, False: 0]
  ------------------
 9626|   376k|        {
 9627|   376k|            inchi_free( pBD->RadEndpoints );
  ------------------
  |  | 1152|   376k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 376k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 376k]
  |  |  ------------------
  ------------------
 9628|   376k|        }
 9629|   376k|        if (pBD->RadEdges)
  ------------------
  |  Branch (9629:13): [True: 376k, False: 0]
  ------------------
 9630|   376k|        {
 9631|   376k|            inchi_free( pBD->RadEdges );
  ------------------
  |  | 1152|   376k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 376k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 376k]
  |  |  ------------------
  ------------------
 9632|   376k|        }
 9633|   376k|#endif
 9634|   376k|        inchi_free( pBD );
  ------------------
  |  | 1152|   376k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 376k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 376k]
  |  |  ------------------
  ------------------
 9635|   376k|    }
 9636|       |
 9637|       |    return NULL;
 9638|   376k|}
AllocateAndInitBnData:
 9643|   376k|{
 9644|   376k|    BN_DATA *pBD = NULL;
 9645|   376k|    int      max_len_Pu_Pv;
 9646|   376k|    max_num_vertices = 2 * max_num_vertices + 2;
 9647|   376k|    max_len_Pu_Pv = max_num_vertices / 2 + 1;
 9648|   376k|    max_len_Pu_Pv += max_len_Pu_Pv % 2; /* even length */
 9649|   376k|    if (!( pBD = (BN_DATA *) inchi_calloc( 1, sizeof( BN_DATA ) ) ) ||
  ------------------
  |  | 1146|   376k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9649:9): [True: 0, False: 376k]
  ------------------
 9650|   376k|         !( pBD->BasePtr = (Vertex *) inchi_calloc( max_num_vertices, sizeof( Vertex ) ) ) ||
  ------------------
  |  | 1146|   376k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9650:10): [True: 0, False: 376k]
  ------------------
 9651|   376k|         !( pBD->SwitchEdge = (Edge   *) inchi_calloc( max_num_vertices, sizeof( Edge ) ) ) ||
  ------------------
  |  | 1146|   376k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9651:10): [True: 0, False: 376k]
  ------------------
 9652|   376k|         !( pBD->Tree = (S_CHAR *) inchi_calloc( max_num_vertices, sizeof( S_CHAR ) ) ) ||
  ------------------
  |  | 1146|   376k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9652:10): [True: 0, False: 376k]
  ------------------
 9653|   376k|         !( pBD->ScanQ = (Vertex *) inchi_calloc( max_num_vertices, sizeof( Vertex ) ) ) ||
  ------------------
  |  | 1146|   376k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9653:10): [True: 0, False: 376k]
  ------------------
 9654|   376k|         !( pBD->Pu = (Vertex *) inchi_calloc( max_len_Pu_Pv, sizeof( Vertex ) ) ) ||
  ------------------
  |  | 1146|   376k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9654:10): [True: 0, False: 376k]
  ------------------
 9655|   376k|#if ( BNS_RAD_SEARCH == 1 )
 9656|   376k|         !( pBD->RadEndpoints = (Vertex *) inchi_calloc( max_len_Pu_Pv, sizeof( Vertex ) ) ) ||
  ------------------
  |  | 1146|   376k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9656:10): [True: 0, False: 376k]
  ------------------
 9657|   376k|         !( pBD->RadEdges = (EdgeIndex*) inchi_calloc( max_len_Pu_Pv, sizeof( EdgeIndex ) ) ) ||
  ------------------
  |  | 1146|   376k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9657:10): [True: 0, False: 376k]
  ------------------
 9658|   376k|#endif
 9659|   376k|         !( pBD->Pv = (Vertex *) inchi_calloc( max_len_Pu_Pv, sizeof( Vertex ) ) )
  ------------------
  |  | 1146|   376k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9659:10): [True: 0, False: 376k]
  ------------------
 9660|   376k|         )
 9661|      0|    {
 9662|      0|        pBD = DeAllocateBnData( pBD );
 9663|      0|    }
 9664|   376k|    else
 9665|   376k|    {
 9666|       |        /* Initialize data */
 9667|   376k|        ClearAllBnDataEdges( pBD->SwitchEdge, NO_VERTEX, max_num_vertices );
  ------------------
  |  |  118|   376k|#define NO_VERTEX    -2
  ------------------
 9668|   376k|        ClearAllBnDataVertices( pBD->BasePtr, NO_VERTEX, max_num_vertices );
  ------------------
  |  |  118|   376k|#define NO_VERTEX    -2
  ------------------
 9669|   376k|        memset( pBD->Tree, TREE_NOT_IN_M, max_num_vertices ); /* djb-rwth: memset_s C11/Annex K variant? */
  ------------------
  |  |  237|   376k|#define TREE_NOT_IN_M  0  /* not in T or T' */
  ------------------
 9670|   376k|        pBD->QSize = -1;
 9671|   376k|        pBD->max_len_Pu_Pv = max_len_Pu_Pv;
 9672|   376k|        pBD->max_num_vertices = max_num_vertices;
 9673|   376k|#if ( BNS_RAD_SEARCH == 1 )
 9674|   376k|        pBD->nNumRadEndpoints = 0;
 9675|   376k|#endif
 9676|   376k|    }
 9677|       |
 9678|   376k|    return pBD;
 9679|   376k|}
ReInitBnData:
 9684|   942k|{
 9685|   942k|    int i, ret = 0;
 9686|   942k|    Vertex u, v;
 9687|   942k|    if (pBD)
  ------------------
  |  Branch (9687:9): [True: 942k, False: 0]
  ------------------
 9688|   942k|    {
 9689|   942k|        if (!pBD->ScanQ)
  ------------------
  |  Branch (9689:13): [True: 0, False: 942k]
  ------------------
 9690|      0|        {
 9691|      0|            ret += 2;
 9692|      0|        }
 9693|   942k|        if (!pBD->BasePtr)
  ------------------
  |  Branch (9693:13): [True: 0, False: 942k]
  ------------------
 9694|      0|        {
 9695|      0|            ret += 4;
 9696|      0|        }
 9697|   942k|        if (!pBD->SwitchEdge)
  ------------------
  |  Branch (9697:13): [True: 0, False: 942k]
  ------------------
 9698|      0|        {
 9699|      0|            ret += 8;
 9700|      0|        }
 9701|   942k|        if (!pBD->Tree)
  ------------------
  |  Branch (9701:13): [True: 0, False: 942k]
  ------------------
 9702|      0|        {
 9703|      0|            ret += 16;
 9704|      0|        }
 9705|   942k|        if (!ret)
  ------------------
  |  Branch (9705:13): [True: 942k, False: 0]
  ------------------
 9706|   942k|        {
 9707|  6.95M|            for (i = 0; i <= pBD->QSize; i++)
  ------------------
  |  Branch (9707:25): [True: 6.01M, False: 942k]
  ------------------
 9708|  6.01M|            {
 9709|  6.01M|                u = pBD->ScanQ[i];
 9710|  6.01M|                v = prim( u );
  ------------------
  |  |  392|  6.01M|#define prim(v) (Vertex)((v)^1)
  ------------------
 9711|  6.01M|                pBD->BasePtr[u] =
 9712|  6.01M|                    pBD->BasePtr[v] =
 9713|  6.01M|                    pBD->SwitchEdge_Vert1( u ) =
  ------------------
  |  |  395|  6.01M|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
 9714|  6.01M|                    pBD->SwitchEdge_Vert1( v ) = NO_VERTEX;
  ------------------
  |  |  395|  6.01M|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
                                  pBD->SwitchEdge_Vert1( v ) = NO_VERTEX;
  ------------------
  |  |  118|  6.01M|#define NO_VERTEX    -2
  ------------------
 9715|  6.01M|                pBD->Tree[u] =
 9716|  6.01M|                    pBD->Tree[v] = TREE_NOT_IN_M;
  ------------------
  |  |  237|  6.01M|#define TREE_NOT_IN_M  0  /* not in T or T' */
  ------------------
 9717|  6.01M|            }
 9718|   942k|        }
 9719|   942k|        pBD->QSize = -1;
 9720|   942k|        if (!pBD->Pu)
  ------------------
  |  Branch (9720:13): [True: 0, False: 942k]
  ------------------
 9721|      0|        {
 9722|      0|            ret += 32;
 9723|      0|        }
 9724|   942k|        if (!pBD->Pv)
  ------------------
  |  Branch (9724:13): [True: 0, False: 942k]
  ------------------
 9725|      0|        {
 9726|      0|            ret += 64;
 9727|      0|        }
 9728|   942k|    }
 9729|      0|    else
 9730|      0|    {
 9731|      0|        ret += 1;
 9732|      0|    }
 9733|       |
 9734|   942k|    return ret;
 9735|   942k|}
GetVertexDegree:
 9740|  4.64M|{
 9741|  4.64M|    int i = v / 2 - 1;
 9742|  4.64M|    if (i >= 0)
  ------------------
  |  Branch (9742:9): [True: 3.89M, False: 742k]
  ------------------
 9743|  3.89M|    {
 9744|  3.89M|        if (pBNS->vert[i].st_edge.cap > 0)
  ------------------
  |  Branch (9744:13): [True: 3.83M, False: 60.0k]
  ------------------
 9745|  3.83M|        {
 9746|  3.83M|            return pBNS->vert[i].num_adj_edges + 1; /* add 1 neighbor for s or t */
 9747|  3.83M|        }
 9748|  60.0k|        else
 9749|  60.0k|        {
 9750|  60.0k|            return 0;   /* since the edge s-v has zero capacity, we ignore vertex v */
 9751|  60.0k|        }
 9752|  3.89M|    }
 9753|   742k|    else
 9754|   742k|    {
 9755|   742k|        return pBNS->num_vertices;
 9756|   742k|    }
 9757|  4.64M|}
Get2ndEdgeVertex:
 9762|  6.93M|{
 9763|       |    /*
 9764|       |    Vertex ret;
 9765|       |    */
 9766|  6.93M|    if (uv[1] >= 0)
  ------------------
  |  Branch (9766:9): [True: 5.67M, False: 1.25M]
  ------------------
 9767|  5.67M|    {
 9768|       |        /* -- debug --
 9769|       |        if ( uv[1] > pBNS->num_edges || uv[0] > 2*pBNS->num_vertices+3 ) {
 9770|       |        int stop = 1;
 9771|       |        }
 9772|       |        ret = ((uv[0]-2) ^ (2*pBNS->edge[uv[1]].neighbor12+1)) + 2;
 9773|       |        if ( ret > 2*pBNS->num_vertices+3 ) {
 9774|       |        int stop = 1;
 9775|       |        }
 9776|       |        return ret;
 9777|       |        -- end debug -- */
 9778|       |
 9779|  5.67M|        return ( ( uv[0] - 2 ) ^ ( 2 * pBNS->edge[uv[1]].neighbor12 + 1 ) ) + 2;
 9780|       |
 9781|       |        /*short u = uv[0]-FIRST_INDX; */
 9782|       |        /*short t = 2*(((u / 2 - 1) ^ pBNS->edge[uv[1]].neighbor12) + 1) + ((u+1) & 1) + FIRST_INDX; */
 9783|       |        /*return t; */
 9784|  5.67M|    }
 9785|       |
 9786|  1.25M|    if (uv[0] <= 1)
  ------------------
  |  Branch (9786:9): [True: 1.25M, False: 16]
  ------------------
 9787|  1.25M|    {
 9788|  1.25M|        return -( 1 + uv[1] ); /* vertex1 is s or t, return x or y */
 9789|  1.25M|    }
 9790|     16|    else
 9791|     16|    {
 9792|     16|        return uv[0] % 2; /* vertex1 is x or y, return s or t; never happens? -- NSC 3737, 7634,... */
 9793|     16|    }
 9794|       |
 9795|  1.25M|}
GetVertexNeighbor:
 9803|  23.6M|{
 9804|       |    /* neigh = 0 => the neighbor is s or t except case when v is s or t. */
 9805|       |    /* v= FIRST_INDX or FIRST_INDX+1: v is s or t respectively */
 9806|  23.6M|    int i, neighbor;
 9807|  23.6M|    if (( i = v - 2 ) >= 0)
  ------------------
  |  Branch (9807:9): [True: 14.5M, False: 9.04M]
  ------------------
 9808|  14.5M|    {
 9809|       |        /* Neighbor of x or y */
 9810|  14.5M|        if (neigh)
  ------------------
  |  Branch (9810:13): [True: 10.7M, False: 3.83M]
  ------------------
 9811|  10.7M|        {
 9812|  10.7M|            neigh--;
 9813|       |            /* x or y */
 9814|  10.7M|            *iedge = pBNS->vert[i / 2].iedge[neigh];
 9815|  10.7M|            if (!( pBNS->edge[*iedge].cap & EDGE_FLOW_MASK ) || IS_FORBIDDEN( pBNS->edge[*iedge].forbidden, pBNS ))
  ------------------
  |  |  133|  10.7M|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
                          if (!( pBNS->edge[*iedge].cap & EDGE_FLOW_MASK ) || IS_FORBIDDEN( pBNS->edge[*iedge].forbidden, pBNS ))
  ------------------
  |  |   41|  10.4M|#define IS_FORBIDDEN(EDGE_FORBIDDEN, PBNS)     (EDGE_FORBIDDEN)
  |  |  ------------------
  |  |  |  Branch (41:48): [True: 598k, False: 9.83M]
  |  |  ------------------
  ------------------
  |  Branch (9815:17): [True: 299k, False: 10.4M]
  ------------------
 9816|   897k|            {
 9817|   897k|                return NO_VERTEX;
  ------------------
  |  |  118|   897k|#define NO_VERTEX    -2
  ------------------
 9818|   897k|            }
 9819|  9.83M|            neighbor = ( i ^ ( 2 * pBNS->edge[*iedge].neighbor12 + 1 ) ) + 2; /* parity opposite to v parity */
 9820|  9.83M|        }
 9821|  3.83M|        else
 9822|  3.83M|        {
 9823|       |            /* neighbor of x or y is s or t */
 9824|  3.83M|            neighbor = ( v & 1 ); /* s or t, same parity as v */
 9825|  3.83M|            *iedge = -( neighbor + 1 );
 9826|  3.83M|        }
 9827|  14.5M|    }
 9828|  9.04M|    else
 9829|  9.04M|    {
 9830|       |        /* neighbor of s or t: x or y, same parity as v */
 9831|  9.04M|        if (!( pBNS->vert[neigh].st_edge.cap & EDGE_FLOW_ST_MASK ))
  ------------------
  |  |  128|  9.04M|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (9831:13): [True: 2.02M, False: 7.02M]
  ------------------
 9832|  2.02M|        {
 9833|  2.02M|            return NO_VERTEX;
  ------------------
  |  |  118|  2.02M|#define NO_VERTEX    -2
  ------------------
 9834|  2.02M|        }
 9835|  7.02M|        neighbor = 2 * neigh + 2 + ( v & 1 ); /* parity same as the parity of v */
 9836|  7.02M|        *iedge = -( neighbor + 1 );
 9837|  7.02M|    }
 9838|       |
 9839|  20.6M|    return neighbor;
 9840|  23.6M|}
GetEdgePointer:
 9850|  20.1M|{
 9851|  20.1M|    int i = u / 2 - 1;
 9852|  20.1M|    int j = v / 2 - 1;
 9853|  20.1M|    int bBackward = BNS_WRONG_PARMS;
  ------------------
  |  |   48|  20.1M|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   47|  20.1M|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9854|  20.1M|    *uv = NULL;
 9855|  20.1M|    if (i >= 0)
  ------------------
  |  Branch (9855:9): [True: 12.3M, False: 7.80M]
  ------------------
 9856|  12.3M|    {
 9857|       |        /* u is an atom */
 9858|  12.3M|        if (j >= 0)
  ------------------
  |  Branch (9858:13): [True: 9.09M, False: 3.22M]
  ------------------
 9859|  9.09M|        {
 9860|       |            /* v is an atom */
 9861|  9.09M|            if (( u + v ) % 2)
  ------------------
  |  Branch (9861:17): [True: 9.09M, False: 0]
  ------------------
 9862|  9.09M|            {
 9863|  9.09M|                *uv = pBNS->edge + iuv;
 9864|  9.09M|                bBackward = ( u & 1 );
 9865|  9.09M|                *s_or_t = 0;
 9866|  9.09M|            }
 9867|  9.09M|        }
 9868|  3.22M|        else
 9869|  3.22M|        {
 9870|       |            /* v is s or t */
 9871|  3.22M|            if (v >= 0 && !( ( u + v ) % 2 ))
  ------------------
  |  Branch (9871:17): [True: 3.22M, False: 0]
  |  Branch (9871:27): [True: 3.22M, False: 0]
  ------------------
 9872|  3.22M|            {
 9873|  3.22M|                *uv = (BNS_EDGE*) &pBNS->vert[i].st_edge;
 9874|  3.22M|                bBackward = !( v & 1 );
 9875|  3.22M|                *s_or_t = v + 3; /* 3=> v=s, 4=> v=t */
 9876|  3.22M|            }
 9877|  3.22M|        }
 9878|  12.3M|    }
 9879|  7.80M|    else
 9880|  7.80M|    {
 9881|  7.80M|        if (j >= 0)
  ------------------
  |  Branch (9881:13): [True: 7.80M, False: 0]
  ------------------
 9882|  7.80M|        {
 9883|       |            /* u is s or t */
 9884|  7.80M|            if (u >= 0 && !( ( u + v ) % 2 ))
  ------------------
  |  Branch (9884:17): [True: 7.80M, False: 0]
  |  Branch (9884:27): [True: 7.80M, False: 0]
  ------------------
 9885|  7.80M|            {
 9886|       |                /* v is an atom */
 9887|  7.80M|                *uv = (BNS_EDGE*) &pBNS->vert[j].st_edge;
 9888|  7.80M|                bBackward = ( u & 1 );
 9889|  7.80M|                *s_or_t = u + 1; /* 1=> u=s, 2=> u=t */
 9890|  7.80M|            }
 9891|  7.80M|        }
 9892|  7.80M|    }
 9893|       |
 9894|  20.1M|    return bBackward;
 9895|  20.1M|}
AugmentEdge:
 9906|  1.19M|{
 9907|  1.19M|    int f, flow, ret = 0;
 9908|       |
 9909|  1.19M|    BNS_ST_EDGE    *pst_edge;
 9910|  1.19M|    BNS_EDGE       *pedge;
 9911|  1.19M|    S_CHAR          s_or_t;
 9912|  1.19M|    int bBackward = GetEdgePointer( pBNS, u, v, iuv, &pedge, &s_or_t );
 9913|  1.19M|    if (!IS_BNS_ERROR( bBackward ))
  ------------------
  |  |   67|  1.19M|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  1.19M|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  1.19M|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  1.19M|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 1.19M, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 1.19M]
  |  |  ------------------
  ------------------
 9914|  1.19M|    {
 9915|  1.19M|        if (bBackward)
  ------------------
  |  Branch (9915:13): [True: 384k, False: 810k]
  ------------------
 9916|   384k|        {
 9917|   384k|            delta = -delta;
 9918|   384k|        }
 9919|       |
 9920|  1.19M|        if (s_or_t)
  ------------------
  |  Branch (9920:13): [True: 284k, False: 911k]
  ------------------
 9921|   284k|        {
 9922|   284k|            pst_edge = (BNS_ST_EDGE *) pedge;
 9923|   284k|            flow = pst_edge->flow;
 9924|   284k|            f = ( flow & EDGE_FLOW_ST_MASK ) + delta; /* new flow */
  ------------------
  |  |  128|   284k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 9925|   284k|            if (!delta)
  ------------------
  |  Branch (9925:17): [True: 0, False: 284k]
  ------------------
 9926|      0|            {
 9927|       |                /*((BNS_ST_EDGE *)pedge)->flow = pst_edge->flow & ~EDGE_FLOW_ST_PATH;*/
 9928|      0|                pst_edge->flow = pst_edge->flow & ~EDGE_FLOW_ST_PATH;
  ------------------
  |  |  129|      0|#define EDGE_FLOW_ST_PATH       0x4000  /* mark: the edge belongs to the augmenting path */
  ------------------
 9929|      0|            }
 9930|   284k|            else
 9931|   284k|            {
 9932|   284k|                int cap = pst_edge->cap;
 9933|   284k|                if (f < 0 || f > cap)
  ------------------
  |  Branch (9933:21): [True: 0, False: 284k]
  |  Branch (9933:30): [True: 0, False: 284k]
  ------------------
 9934|      0|                {
 9935|      0|                    ret = BNS_WRONG_PARMS;
  ------------------
  |  |   48|      0|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9936|      0|                }
 9937|   284k|                else
 9938|   284k|                {
 9939|   284k|                    if (!( bChangeFlow & BNS_EF_CHNG_FLOW ))
  ------------------
  |  |  370|   284k|#define BNS_EF_CHNG_FLOW      1  /* change Balanced Network (BN) flow inside the BNS search */
  ------------------
  |  Branch (9939:25): [True: 38.2k, False: 245k]
  ------------------
 9940|  38.2k|                    {
 9941|  38.2k|                        f -= delta; /* do not actually change the flow, only find the augmenting path */
 9942|  38.2k|                    }
 9943|   245k|                    else
 9944|   245k|                    {
 9945|   245k|                        if (delta)
  ------------------
  |  Branch (9945:29): [True: 245k, False: 0]
  ------------------
 9946|   245k|                        {
 9947|       |                            /*((BNS_ST_EDGE *)pedge)->pass ++;*/
 9948|   245k|                            pst_edge->pass++;
 9949|   245k|                        }
 9950|   245k|                    }
 9951|   284k|                    flow = ( flow & ~( EDGE_FLOW_ST_PATH | EDGE_FLOW_ST_MASK ) ) + f;
  ------------------
  |  |  129|   284k|#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;
  ------------------
  |  |  128|   284k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 9952|       |                    /*((BNS_ST_EDGE *)pedge)->flow = flow;*/
 9953|   284k|                    pst_edge->flow = flow;
 9954|       |                    /*((BNS_ST_EDGE *)pedge)->delta += delta; */
 9955|   284k|                    if (bReverse)
  ------------------
  |  Branch (9955:25): [True: 142k, False: 142k]
  ------------------
 9956|   142k|                    {
 9957|       |                        /* u <- v; Note: in case of bReverse s_or_t has actually been determined
 9958|       |                        for the u' <- v' pair; therefore s and t should be switched
 9959|       |                        in order to correctly determine the 1st or the last atom
 9960|       |                        on the augmenting path.
 9961|       |                        */
 9962|   142k|                        switch (s_or_t)
 9963|   142k|                        {
 9964|   142k|                            case 1: /* u = t: t<-v, v is the last vertex */
  ------------------
  |  Branch (9964:29): [True: 142k, False: 0]
  ------------------
 9965|   142k|                                ALTP_END_ATOM( pBNS->alt_path ) = v / 2 - 1;
  ------------------
  |  |  102|   142k|#define ALTP_END_ATOM(altp)             (altp)[iALTP_END_ATOM].number
  ------------------
 9966|   142k|                                break;
 9967|      0|                            case 2: /* u = s: s<-v, error */
  ------------------
  |  Branch (9967:29): [True: 0, False: 142k]
  ------------------
 9968|      0|                                ret = BNS_WRONG_PARMS;
  ------------------
  |  |   48|      0|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9969|      0|                                break;
 9970|      0|                            case 3: /* v = t: u<-t, error */
  ------------------
  |  Branch (9970:29): [True: 0, False: 142k]
  ------------------
 9971|      0|                                ret = BNS_WRONG_PARMS;
  ------------------
  |  |   48|      0|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9972|      0|                                break;
 9973|      0|                            case 4: /* v = s: u<-s, u is the first vertex */
  ------------------
  |  Branch (9973:29): [True: 0, False: 142k]
  ------------------
 9974|      0|                                ALTP_START_ATOM( pBNS->alt_path ) = u / 2 - 1;
  ------------------
  |  |  103|      0|#define ALTP_START_ATOM(altp)           (altp)[iALTP_START_ATOM].number
  ------------------
 9975|      0|                                ALTP_DELTA( pBNS->alt_path ) = delta;
  ------------------
  |  |  112|      0|#define ALTP_DELTA(altp)                 (altp)[iALTP_FLOW].flow[0]
  ------------------
 9976|      0|                                break;
 9977|      0|                            default:
  ------------------
  |  Branch (9977:29): [True: 0, False: 142k]
  ------------------
 9978|      0|                                ret = BNS_WRONG_PARMS;
  ------------------
  |  |   48|      0|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9979|      0|                                break;
 9980|   142k|                        }
 9981|   142k|                    }
 9982|   142k|                    else
 9983|   142k|                    {
 9984|       |                        /* u -> v */
 9985|   142k|                        switch (s_or_t)
 9986|   142k|                        {
 9987|   142k|                            case 1: /* u = s: s->v, v is the first vertex */
  ------------------
  |  Branch (9987:29): [True: 142k, False: 8]
  ------------------
 9988|   142k|                                ALTP_START_ATOM( pBNS->alt_path ) = v / 2 - 1;
  ------------------
  |  |  103|   142k|#define ALTP_START_ATOM(altp)           (altp)[iALTP_START_ATOM].number
  ------------------
 9989|   142k|                                ALTP_DELTA( pBNS->alt_path ) = delta;
  ------------------
  |  |  112|   142k|#define ALTP_DELTA(altp)                 (altp)[iALTP_FLOW].flow[0]
  ------------------
 9990|   142k|                                break;
 9991|      0|                            case 2: /* u = t: t->v, error */
  ------------------
  |  Branch (9991:29): [True: 0, False: 142k]
  ------------------
 9992|      0|                                ret = BNS_WRONG_PARMS;
  ------------------
  |  |   48|      0|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9993|      0|                                break;
 9994|      0|                            case 3: /* v = s: u->s, error */
  ------------------
  |  Branch (9994:29): [True: 0, False: 142k]
  ------------------
 9995|      0|                                ret = BNS_WRONG_PARMS;
  ------------------
  |  |   48|      0|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9996|      0|                                break;
 9997|      8|                            case 4: /* v = t: u->t, u is the last vertex */
  ------------------
  |  Branch (9997:29): [True: 8, False: 142k]
  ------------------
 9998|      8|                                ALTP_END_ATOM( pBNS->alt_path ) = u / 2 - 1;
  ------------------
  |  |  102|      8|#define ALTP_END_ATOM(altp)             (altp)[iALTP_END_ATOM].number
  ------------------
 9999|      8|                                break;
10000|      0|                            default:
  ------------------
  |  Branch (10000:29): [True: 0, False: 142k]
  ------------------
10001|      0|                                ret = BNS_WRONG_PARMS;
  ------------------
  |  |   48|      0|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
10002|      0|                                break;
10003|   142k|                        }
10004|   142k|                    }
10005|   284k|                }
10006|   284k|            }
10007|   284k|        }
10008|   911k|        else
10009|   911k|        {
10010|   911k|            f = ( pedge->flow & EDGE_FLOW_MASK ) + delta;
  ------------------
  |  |  133|   911k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
10011|   911k|            if (!delta)
  ------------------
  |  Branch (10011:17): [True: 0, False: 911k]
  ------------------
10012|      0|            {
10013|      0|                pedge->flow &= ~EDGE_FLOW_PATH;
  ------------------
  |  |  134|      0|#define EDGE_FLOW_PATH          0x4000  /* mark: the edge belongs to the augmenting path */
  ------------------
10014|      0|            }
10015|   911k|            else
10016|   911k|            {
10017|   911k|                if (f < 0 || f > pedge->cap)
  ------------------
  |  Branch (10017:21): [True: 0, False: 911k]
  |  Branch (10017:30): [True: 2, False: 911k]
  ------------------
10018|      2|                {
10019|      2|                    ret = BNS_WRONG_PARMS;
  ------------------
  |  |   48|      2|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   47|      2|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
10020|      2|                }
10021|   911k|                else
10022|   911k|                {
10023|   911k|                    AT_NUMB   iu = u / 2 - 1;
10024|   911k|                    AT_NUMB   iv = v / 2 - 1;
10025|   911k|                    int       indx;
10026|   911k|                    if (!( bChangeFlow & BNS_EF_CHNG_FLOW ))
  ------------------
  |  |  370|   911k|#define BNS_EF_CHNG_FLOW      1  /* change Balanced Network (BN) flow inside the BNS search */
  ------------------
  |  Branch (10026:25): [True: 180k, False: 731k]
  ------------------
10027|   180k|                    {
10028|   180k|                        f -= delta; /* do not actually change the flow, only find the augmenting path */
10029|   180k|                    }
10030|   731k|                    else
10031|   731k|                    {
10032|   731k|                        if (delta)
  ------------------
  |  Branch (10032:29): [True: 731k, False: 0]
  ------------------
10033|   731k|                        {
10034|   731k|                            pedge->pass++;
10035|   731k|                        }
10036|   731k|                    }
10037|   911k|                    pedge->flow = ( pedge->flow & ~( EDGE_FLOW_PATH | EDGE_FLOW_MASK ) ) | f;
  ------------------
  |  |  134|   911k|#define EDGE_FLOW_PATH          0x4000  /* mark: the edge belongs to the augmenting path */
  ------------------
                                  pedge->flow = ( pedge->flow & ~( EDGE_FLOW_PATH | EDGE_FLOW_MASK ) ) | f;
  ------------------
  |  |  133|   911k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
10038|   911k|                    if (ALTP_MAY_ADD( pBNS->alt_path ))
  ------------------
  |  |  110|   911k|#define ALTP_MAY_ADD(altp)              (iALTP_NEIGHBOR + (altp)[iALTP_PATH_LEN].number < (altp)[iALTP_MAX_LEN].number)
  |  |  ------------------
  |  |  |  Branch (110:41): [True: 911k, False: 0]
  |  |  ------------------
  ------------------
10039|   911k|                    {
10040|       |                        /* bReverse? u <- v : u -> v */
10041|   911k|                        indx = bReverse ? ( pedge->neighbor1 == iv ) : ( pedge->neighbor1 == iu );
  ------------------
  |  Branch (10041:32): [True: 372k, False: 539k]
  ------------------
10042|   911k|                        ALTP_CUR_THIS_ATOM_NEIGHBOR( pBNS->alt_path ) = pedge->neigh_ord[1 - indx];
  ------------------
  |  |  106|   911k|#define ALTP_CUR_THIS_ATOM_NEIGHBOR(altp) (altp)[iALTP_NEIGHBOR+ALTP_PATH_LEN(altp)].ineigh[0]  /* 0 <= X < path_len */
  |  |  ------------------
  |  |  |  |  101|   911k|#define ALTP_PATH_LEN(altp)             (altp)[iALTP_PATH_LEN].number  /* number of bonds = number of atoms-1*/
  |  |  ------------------
  ------------------
10043|   911k|                        ALTP_CUR_NEXT_ATOM_NEIGHBOR( pBNS->alt_path ) = pedge->neigh_ord[indx];
  ------------------
  |  |  107|   911k|#define ALTP_CUR_NEXT_ATOM_NEIGHBOR(altp) (altp)[iALTP_NEIGHBOR+ALTP_PATH_LEN(altp)].ineigh[1]
  |  |  ------------------
  |  |  |  |  101|   911k|#define ALTP_PATH_LEN(altp)             (altp)[iALTP_PATH_LEN].number  /* number of bonds = number of atoms-1*/
  |  |  ------------------
  ------------------
10044|   911k|                        ALTP_NEXT( pBNS->alt_path );
  ------------------
  |  |  108|   911k|#define ALTP_NEXT(altp)                 (++ALTP_PATH_LEN(altp))
  |  |  ------------------
  |  |  |  |  101|   911k|#define ALTP_PATH_LEN(altp)             (altp)[iALTP_PATH_LEN].number  /* number of bonds = number of atoms-1*/
  |  |  ------------------
  ------------------
10045|   911k|                    }
10046|      0|                    else
10047|      0|                    {
10048|      0|                        ALTP_OVERFLOW( pBNS->alt_path ) = 1;
  ------------------
  |  |  113|      0|#define ALTP_OVERFLOW(altp)             (altp)[iALTP_FLOW].flow[1]
  ------------------
10049|      0|                        ret = BNS_ALTPATH_OVFL;
  ------------------
  |  |   51|      0|#define BNS_ALTPATH_OVFL   (BNS_ERR +  3) /*(-9996)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
10050|      0|                    }
10051|   911k|                }
10052|   911k|            }
10053|   911k|        }
10054|  1.19M|        return ret ? ret : f;
  ------------------
  |  Branch (10054:16): [True: 2, False: 1.19M]
  ------------------
10055|  1.19M|    }
10056|       |
10057|      0|    return bBackward;
10058|  1.19M|}
rescap_mark:
10068|  1.19M|{
10069|  1.19M|    BNS_ST_EDGE    *pst_edge;
10070|  1.19M|    BNS_EDGE       *pedge;
10071|       |
10072|  1.19M|    int    f, flow;
10073|  1.19M|    S_CHAR s_or_t;
10074|  1.19M|    int    bBackward = GetEdgePointer( pBNS, u, v, iuv, &pedge, &s_or_t );
10075|       |
10076|  1.19M|    if (!IS_BNS_ERROR( bBackward ))
  ------------------
  |  |   67|  1.19M|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  1.19M|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  1.19M|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  1.19M|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 1.19M, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 1.19M]
  |  |  ------------------
  ------------------
10077|  1.19M|    {
10078|  1.19M|        if (s_or_t)
  ------------------
  |  Branch (10078:13): [True: 284k, False: 911k]
  ------------------
10079|   284k|        {
10080|   284k|            pst_edge = (BNS_ST_EDGE *) pedge;
10081|   284k|            flow = pst_edge->flow;
10082|   284k|            f = ( flow & EDGE_FLOW_ST_MASK );
  ------------------
  |  |  128|   284k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
10083|   284k|            if (!bBackward)
  ------------------
  |  Branch (10083:17): [True: 284k, False: 0]
  ------------------
10084|   284k|            {
10085|   284k|                f = (int) pst_edge->cap - f;
10086|   284k|            }
10087|   284k|            if (flow & EDGE_FLOW_ST_PATH)
  ------------------
  |  |  129|   284k|#define EDGE_FLOW_ST_PATH       0x4000  /* mark: the edge belongs to the augmenting path */
  ------------------
  |  Branch (10087:17): [True: 14.4k, False: 269k]
  ------------------
10088|  14.4k|            {
10089|  14.4k|                pBNS->bNotASimplePath++;
10090|  14.4k|                f /= 2;   /* this is the second time we pass the same edge: reduce flow by a factor of 2 */
10091|  14.4k|            }
10092|   269k|            else
10093|   269k|            {
10094|   269k|                pst_edge->flow |= EDGE_FLOW_ST_PATH; /* mark the edge */
  ------------------
  |  |  129|   269k|#define EDGE_FLOW_ST_PATH       0x4000  /* mark: the edge belongs to the augmenting path */
  ------------------
10095|   269k|            }
10096|   284k|        }
10097|   911k|        else
10098|   911k|        {
10099|   911k|            flow = pedge->flow;
10100|   911k|            f = flow & EDGE_FLOW_MASK;
  ------------------
  |  |  133|   911k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
10101|   911k|            if (!bBackward)
  ------------------
  |  Branch (10101:17): [True: 526k, False: 384k]
  ------------------
10102|   526k|            {
10103|   526k|                f = (int) pedge->cap - f;
10104|   526k|            }
10105|   911k|            if (flow & EDGE_FLOW_PATH)
  ------------------
  |  |  134|   911k|#define EDGE_FLOW_PATH          0x4000  /* mark: the edge belongs to the augmenting path */
  ------------------
  |  Branch (10105:17): [True: 44.3k, False: 867k]
  ------------------
10106|  44.3k|            {
10107|  44.3k|                f /= 2;    /* this is the second time we pass the same edge: reduce flow by a factor of 2 */
10108|  44.3k|                pBNS->bNotASimplePath++;
10109|  44.3k|            }
10110|   867k|            else
10111|   867k|            {
10112|   867k|                pedge->flow |= EDGE_FLOW_PATH;  /* mark the edge */
  ------------------
  |  |  134|   867k|#define EDGE_FLOW_PATH          0x4000  /* mark: the edge belongs to the augmenting path */
  ------------------
10113|   867k|            }
10114|   911k|        }
10115|  1.19M|        return f;
10116|  1.19M|    }
10117|       |
10118|      0|    return bBackward;
10119|  1.19M|}
GetPrevVertex:
10129|   206k|{
10130|   206k|    Vertex w, z, x2, y2; /* djb-rwth: removing redundant variables */
10131|   206k|    EdgeIndex iwy;
10132|       |
10133|   206k|    w = SwitchEdge_Vert1( y );
  ------------------
  |  |  395|   206k|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
10134|   206k|    z = SwitchEdge_Vert2( y );
  ------------------
  |  |  396|   206k|#define SwitchEdge_Vert2(u) Get2ndEdgeVertex( pBNS, SwitchEdge[u] )
  ------------------
10135|   206k|    iwy = SwitchEdge_IEdge( y );
  ------------------
  |  |  397|   206k|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
10136|   206k|    if (z == y)
  ------------------
  |  Branch (10136:9): [True: 182k, False: 23.2k]
  ------------------
10137|   182k|    {
10138|   182k|        *iuv = iwy;
10139|   182k|        return w;
10140|   182k|    }
10141|  23.2k|    x2 = prim( y );
  ------------------
  |  |  392|  23.2k|#define prim(v) (Vertex)((v)^1)
  ------------------
10142|  23.2k|    y2 = prim( z );
  ------------------
  |  |  392|  23.2k|#define prim(v) (Vertex)((v)^1)
  ------------------
10143|       |    /* djb-rwth: removing redundant code */
10144|  55.6k|    while (y2 != NO_VERTEX)
  ------------------
  |  |  118|  55.6k|#define NO_VERTEX    -2
  ------------------
  |  Branch (10144:12): [True: 55.6k, False: 0]
  ------------------
10145|  55.6k|    {
10146|  55.6k|        w = SwitchEdge_Vert1( y2 );
  ------------------
  |  |  395|  55.6k|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
10147|  55.6k|        z = SwitchEdge_Vert2( y2 );
  ------------------
  |  |  396|  55.6k|#define SwitchEdge_Vert2(u) Get2ndEdgeVertex( pBNS, SwitchEdge[u] )
  ------------------
10148|  55.6k|        iwy = SwitchEdge_IEdge( y2 );
  ------------------
  |  |  397|  55.6k|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
10149|  55.6k|        if (w == x2)
  ------------------
  |  Branch (10149:13): [True: 23.2k, False: 32.4k]
  ------------------
10150|  23.2k|        {
10151|  23.2k|            *iuv = iwy;
10152|       |            /*return z; */
10153|  23.2k|            return ( y + z ) % 2 ? z : prim( z );
  ------------------
  |  |  392|  23.2k|#define prim(v) (Vertex)((v)^1)
  ------------------
  |  Branch (10153:20): [True: 0, False: 23.2k]
  ------------------
10154|  23.2k|        }
10155|       |        /* djb-rwth: removing redundant code */
10156|       |        /*
10157|       |        #ifdef _DEBUG
10158|       |        if ( n ) {
10159|       |        int stop = 1;
10160|       |        }
10161|       |        #endif
10162|       |        */
10163|  32.4k|        if (w == y2)
  ------------------
  |  Branch (10163:13): [True: 0, False: 32.4k]
  ------------------
10164|      0|        {
10165|      0|            return NO_VERTEX;
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
10166|      0|        }
10167|  32.4k|        y2 = w;
10168|  32.4k|    }
10169|       |
10170|      0|    return y2;
10171|  23.2k|}
bIgnoreVertexNonTACN_atom:
10257|  27.3k|{
10258|  27.3k|    int    i, degree, ret, u_is_taut = 0, num_allowed = 0, num_found_groups = 0;
10259|  27.3k|    Vertex w;
10260|  27.3k|    EdgeIndex ivw;
10261|  27.3k|    if (!pBNS->type_TACN || u <= 1 || v <= 1 ||
  ------------------
  |  Branch (10261:9): [True: 0, False: 27.3k]
  |  Branch (10261:29): [True: 5.17k, False: 22.1k]
  |  Branch (10261:39): [True: 5.13k, False: 17.0k]
  ------------------
10262|  17.0k|        ( pBNS->vert[v / 2 - 1].type & pBNS->type_TACN ))
  ------------------
  |  Branch (10262:9): [True: 541, False: 16.5k]
  ------------------
10263|  10.8k|    {
10264|  10.8k|        return 0; /* add/remove H(+) is allowed for acidic atoms */
10265|  10.8k|    }
10266|  16.5k|    if (!pBNS->type_T || !pBNS->type_CN)
  ------------------
  |  Branch (10266:9): [True: 0, False: 16.5k]
  |  Branch (10266:26): [True: 0, False: 16.5k]
  ------------------
10267|      0|    {
10268|      0|        return 0; /* should not happen */
10269|      0|    }
10270|  16.5k|    if (( u_is_taut = ( pBNS->vert[u / 2 - 1].type & pBNS->type_T ) == pBNS->type_T ) ||
  ------------------
  |  Branch (10270:9): [True: 470, False: 16.0k]
  ------------------
10271|  16.0k|        ( ( pBNS->vert[u / 2 - 1].type & pBNS->type_CN ) == pBNS->type_CN ))
  ------------------
  |  Branch (10271:9): [True: 1.26k, False: 14.7k]
  ------------------
10272|  1.73k|    {
10273|       |        /* u is either t-group vertex or (-) c-group */
10274|  1.73k|        degree = GetVertexDegree( pBNS, v );
10275|  11.1k|        for (i = 0; i < degree; i++)
  ------------------
  |  Branch (10275:21): [True: 9.37k, False: 1.73k]
  ------------------
10276|  9.37k|        {
10277|       |            /* v = vert[u].neighbor[i]; */
10278|  9.37k|            w = GetVertexNeighbor( pBNS, v, i, &ivw );
10279|  9.37k|            if (w == NO_VERTEX || w <= 1)
  ------------------
  |  |  118|  18.7k|#define NO_VERTEX    -2
  ------------------
  |  Branch (10279:17): [True: 208, False: 9.16k]
  |  Branch (10279:35): [True: 1.73k, False: 7.43k]
  ------------------
10280|  1.94k|            {
10281|  1.94k|                continue; /* the atom has only single bonds or it is s or t, ignore it */
10282|  1.94k|            }
10283|  7.43k|            if (w != u && ( ret = rescap( pBNS, v, w, ivw ) ) > 0) /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (10283:17): [True: 5.69k, False: 1.73k]
  |  Branch (10283:27): [True: 2.88k, False: 2.81k]
  ------------------
10284|  2.88k|            {
10285|  2.88k|                num_allowed++;
10286|  2.88k|                if (( u_is_taut ? ( ( pBNS->vert[w / 2 - 1].type & pBNS->type_CN ) == pBNS->type_CN ) :
  ------------------
  |  Branch (10286:21): [True: 1.52k, False: 1.35k]
  |  Branch (10286:23): [True: 1.04k, False: 1.83k]
  ------------------
10287|  2.88k|                    ( ( pBNS->vert[w / 2 - 1].type & pBNS->type_T ) == pBNS->type_T ) ))
10288|  1.52k|                {
10289|  1.52k|                    num_found_groups++;
10290|  1.52k|                }
10291|  2.88k|            }
10292|  7.43k|        }
10293|  1.73k|        if (num_found_groups && num_allowed == 1)
  ------------------
  |  Branch (10293:13): [True: 1.52k, False: 213]
  |  Branch (10293:33): [True: 777, False: 745]
  ------------------
10294|    777|        {
10295|    777|            return 1; /* reject */
10296|    777|        }
10297|  1.73k|    }
10298|       |
10299|  15.7k|    return 0;
10300|  16.5k|}
bIgnoreVertexNonTACN_group:
10388|  26.9k|{
10389|  26.9k|    int    u_is_taut = 0, w_is_taut = 0;
10390|  26.9k|    Vertex u;
10391|  26.9k|    EdgeIndex iuv;
10392|  26.9k|    if (v <= 1 || w <= 1)
  ------------------
  |  Branch (10392:9): [True: 5.17k, False: 21.7k]
  |  Branch (10392:19): [True: 5.13k, False: 16.6k]
  ------------------
10393|  10.3k|        return 0;
10394|  16.6k|#if ( CHECK_TACN == 1 )
10395|  16.6k|    if (!pBNS->type_TACN ||
  ------------------
  |  Branch (10395:9): [True: 0, False: 16.6k]
  ------------------
10396|  16.6k|        ( pBNS->vert[v / 2 - 1].type & pBNS->type_TACN ))
  ------------------
  |  Branch (10396:9): [True: 683, False: 15.9k]
  ------------------
10397|    683|    {
10398|    683|        return 0;
10399|    683|    }
10400|  15.9k|    if (!pBNS->type_T || !pBNS->type_CN)
  ------------------
  |  Branch (10400:9): [True: 0, False: 15.9k]
  |  Branch (10400:26): [True: 0, False: 15.9k]
  ------------------
10401|      0|    {
10402|      0|        return 0; /* should not happen */
10403|      0|    }
10404|  15.9k|#endif
10405|  15.9k|    u = GetPrevVertex( pBNS, v, SwitchEdge, &iuv );
10406|       |    /*
10407|       |    u   = SwitchEdge_Vert1(v);
10408|       |    iuv = SwitchEdge_IEdge(v);
10409|       |    */
10410|  15.9k|    if (u == NO_VERTEX || iuv < 0)
  ------------------
  |  |  118|  31.9k|#define NO_VERTEX    -2
  ------------------
  |  Branch (10410:9): [True: 0, False: 15.9k]
  |  Branch (10410:27): [True: 3.94k, False: 12.0k]
  ------------------
10411|  3.94k|    {
10412|  3.94k|        return 0; /* should not happen */
10413|  3.94k|    }
10414|       |    /* check edge adjacency */
10415|  12.0k|    if ((pBNS->edge[iuv].neighbor1 != ( u / 2 - 1 ) && pBNS->edge[iuv].neighbor1 != v / 2 - 1) ||
  ------------------
  |  Branch (10415:10): [True: 7.99k, False: 4.00k]
  |  Branch (10415:56): [True: 0, False: 7.99k]
  ------------------
10416|  12.0k|        (( pBNS->edge[iuv].neighbor12 ^ ( u / 2 - 1 ) ) != ( v / 2 - 1 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (10416:9): [True: 0, False: 12.0k]
  ------------------
10417|      0|    {
10418|      0|        return 0; /* !!! should not happen !!! */
10419|      0|    }
10420|       |
10421|  12.0k|#if ( CHECK_TACN == 1 )
10422|  12.0k|    if (( ( u_is_taut = ( pBNS->vert[u / 2 - 1].type & pBNS->type_T ) == pBNS->type_T ) ||
  ------------------
  |  Branch (10422:11): [True: 832, False: 11.1k]
  ------------------
10423|  11.1k|        ( ( pBNS->vert[u / 2 - 1].type & pBNS->type_CN ) == pBNS->type_CN ) ) &&
  ------------------
  |  Branch (10423:9): [True: 818, False: 10.3k]
  ------------------
10424|  1.65k|          ( ( w_is_taut = ( pBNS->vert[w / 2 - 1].type & pBNS->type_T ) == pBNS->type_T ) ||
  ------------------
  |  Branch (10424:13): [True: 352, False: 1.29k]
  ------------------
10425|  1.29k|         ( ( pBNS->vert[w / 2 - 1].type & pBNS->type_CN ) == pBNS->type_CN ) ) &&
  ------------------
  |  Branch (10425:10): [True: 239, False: 1.05k]
  ------------------
10426|    591|         u_is_taut + w_is_taut == 1)
  ------------------
  |  Branch (10426:10): [True: 589, False: 2]
  ------------------
10427|    589|    {
10428|       |        /* rescap must have already been checked */
10429|    589|        return 1;
10430|    589|    }
10431|  11.4k|#endif
10432|       |
10433|  11.4k|    return 0;
10434|  12.0k|}
rescap:
10610|  17.7M|{
10611|  17.7M|    BNS_ST_EDGE    *pst_edge;
10612|  17.7M|    BNS_EDGE       *pedge;
10613|       |
10614|  17.7M|    int f;
10615|  17.7M|    S_CHAR s_or_t;
10616|  17.7M|    int    bBackward = GetEdgePointer( pBNS, u, v, iuv, &pedge, &s_or_t );
10617|       |
10618|  17.7M|    if (!IS_BNS_ERROR( bBackward ))
  ------------------
  |  |   67|  17.7M|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  17.7M|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  17.7M|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  17.7M|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 17.7M, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 17.7M]
  |  |  ------------------
  ------------------
10619|  17.7M|    {
10620|       |
10621|  17.7M|        if (s_or_t)
  ------------------
  |  Branch (10621:13): [True: 10.4M, False: 7.27M]
  ------------------
10622|  10.4M|        {
10623|  10.4M|            pst_edge = (BNS_ST_EDGE *) pedge;
10624|  10.4M|            f = ( pst_edge->flow & EDGE_FLOW_ST_MASK );
  ------------------
  |  |  128|  10.4M|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
10625|  10.4M|            if (!bBackward)
  ------------------
  |  Branch (10625:17): [True: 9.02M, False: 1.44M]
  ------------------
10626|  9.02M|            {
10627|  9.02M|                f = (int) pst_edge->cap - f;
10628|  9.02M|            }
10629|  10.4M|        }
10630|  7.27M|        else
10631|  7.27M|        {
10632|  7.27M|            f = ( pedge->flow & EDGE_FLOW_MASK );
  ------------------
  |  |  133|  7.27M|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
10633|  7.27M|            if (!bBackward)
  ------------------
  |  Branch (10633:17): [True: 3.86M, False: 3.41M]
  ------------------
10634|  3.86M|            {
10635|  3.86M|                f = (int) pedge->cap - f;
10636|  3.86M|            }
10637|  7.27M|        }
10638|  17.7M|        return f;
10639|  17.7M|    }
10640|       |
10641|      0|    return bBackward; /* error */
10642|  17.7M|}
BalancedNetworkSearch:
10746|   742k|{
10747|   742k|    Vertex          *BasePtr = pBD->BasePtr;
10748|   742k|    Edge            *SwitchEdge = pBD->SwitchEdge;
10749|   742k|    S_CHAR          *Tree = pBD->Tree;
10750|   742k|    Vertex          *ScanQ = pBD->ScanQ;
10751|   742k|    int              QSize = pBD->QSize;
10752|   742k|    Vertex          *Pu = pBD->Pu;
10753|   742k|    Vertex          *Pv = pBD->Pv;
10754|   742k|    int              max_len_Pu_Pv = pBD->max_len_Pu_Pv;
10755|       |
10756|       |    /* added to translate into C */
10757|   742k|    int i, k, degree, delta, ret = 0;
10758|   742k|    Vertex u, b_u, v, b_v, w;
10759|   742k|    EdgeIndex iuv;
10760|   742k|#if ( BNS_RAD_SEARCH == 1 )
10761|   742k|    int              n, bRadSearch = ( BNS_EF_RAD_SRCH & bChangeFlow ) && pBD->RadEndpoints;
  ------------------
  |  |  384|   742k|#define BNS_EF_RAD_SRCH     128  /* search for rafical paths closures */
  ------------------
  |  Branch (10761:38): [True: 11.0k, False: 731k]
  |  Branch (10761:75): [True: 11.0k, False: 0]
  ------------------
10762|   742k|    BRS_MODE         bRadSrchMode = RAD_SRCH_NORM;
10763|   742k|    int              bRadSearchPrelim = 0;
10764|   742k|    if (bRadSearch)
  ------------------
  |  Branch (10764:9): [True: 11.0k, False: 731k]
  ------------------
10765|  11.0k|    {
10766|  11.0k|        pBD->nNumRadEndpoints = 0;
10767|  11.0k|        bRadSrchMode = pBD->bRadSrchMode;
10768|  11.0k|        bRadSearchPrelim = pBNS->type_TACN && bRadSrchMode == RAD_SRCH_NORM;
  ------------------
  |  Branch (10768:28): [True: 2.22k, False: 8.86k]
  |  Branch (10768:47): [True: 2.22k, False: 0]
  ------------------
10769|  11.0k|    }
10770|   742k|#endif
10771|       |
10772|       |    /*  -- Always --
10773|       |    Vertex_s = FIRST_INDX;
10774|       |    Vertex_t = Vertex_s+1;
10775|       |    */
10776|   742k|    QSize = k = 0;     /* put s on ScanQ = set S */
10777|   742k|    ScanQ[QSize] = Vertex_s;
  ------------------
  |  |  115|   742k|#define Vertex_s 0
  ------------------
10778|   742k|    BasePtr[Vertex_t] = Vertex_s;
  ------------------
  |  |  116|   742k|#define Vertex_t 1
  ------------------
                  BasePtr[Vertex_t] = Vertex_s;
  ------------------
  |  |  115|   742k|#define Vertex_s 0
  ------------------
10779|   742k|    BasePtr[Vertex_s] = BLOSSOM_BASE; /* create initial blossom C(Vertex_s) with base s */
  ------------------
  |  |  115|   742k|#define Vertex_s 0
  ------------------
                  BasePtr[Vertex_s] = BLOSSOM_BASE; /* create initial blossom C(Vertex_s) with base s */
  ------------------
  |  |  119|   742k|#define BLOSSOM_BASE -1
  ------------------
10780|   742k|    Tree[Vertex_s] = TREE_IN_1;
  ------------------
  |  |  115|   742k|#define Vertex_s 0
  ------------------
                  Tree[Vertex_s] = TREE_IN_1;
  ------------------
  |  |  240|   742k|#define TREE_IN_1      3  /* in T and is s-reachable */
  ------------------
10781|       |
10782|   742k|    do
10783|  4.63M|    {
10784|  4.63M|        u = ScanQ[k]; /* select u from the head of ScanQ */
10785|       |                      /* since u is on the queue, it has a blossom C(U) with base b_u */
10786|  4.63M|        b_u = FindBase( u, BasePtr );
10787|  4.63M|        degree = GetVertexDegree( pBNS, u );
10788|  4.63M|#if ( BNS_RAD_SEARCH == 1 )
10789|  4.63M|        n = 0;
10790|  4.63M|#endif
10791|  28.1M|        for (i = 0; i < degree; i++)
  ------------------
  |  Branch (10791:21): [True: 23.6M, False: 4.49M]
  ------------------
10792|  23.6M|        {
10793|       |            /* v = vert[u].neighbor[i]; */
10794|  23.6M|            v = GetVertexNeighbor( pBNS, u, i, &iuv );
10795|  23.6M|            if (v == NO_VERTEX)
  ------------------
  |  |  118|  23.6M|#define NO_VERTEX    -2
  ------------------
  |  Branch (10795:17): [True: 2.92M, False: 20.6M]
  ------------------
10796|  2.92M|            {
10797|  2.92M|                continue; /* the atom has only single bonds, ignore it */
10798|  2.92M|            }
10799|  20.6M|#if ( BNS_RAD_SEARCH == 1 )
10800|  20.6M|            if (!k && bRadSrchMode == RAD_SRCH_FROM_FICT && v / 2 <= pBNS->num_atoms)
  ------------------
  |  Branch (10800:17): [True: 7.02M, False: 13.6M]
  |  Branch (10800:23): [True: 43.9k, False: 6.97M]
  |  Branch (10800:61): [True: 10.8k, False: 33.1k]
  ------------------
10801|  10.8k|            {
10802|  10.8k|                continue; /* start from fict. vertices only */
10803|  10.8k|            }
10804|  20.6M|            if (bRadSearchPrelim && v / 2 > pBNS->num_atoms)
  ------------------
  |  Branch (10804:17): [True: 30.6k, False: 20.6M]
  |  Branch (10804:37): [True: 7.19k, False: 23.4k]
  ------------------
10805|  7.19k|            {
10806|  7.19k|                continue; /* during initial add/remove H allow radical movement only through real atoms */
10807|  7.19k|            }
10808|  20.6M|#endif
10809|  20.6M|            if ( /* PrevPt[u] != v ** avoid edges of T */
10810|  20.6M|                ( SwitchEdge_Vert1( u ) != v || SwitchEdge_Vert2( u ) != u )  /* avoid edges of T */
  ------------------
  |  |  395|  20.6M|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
                              ( SwitchEdge_Vert1( u ) != v || SwitchEdge_Vert2( u ) != u )  /* avoid edges of T */
  ------------------
  |  |  396|  3.40M|#define SwitchEdge_Vert2(u) Get2ndEdgeVertex( pBNS, SwitchEdge[u] )
  ------------------
  |  Branch (10810:19): [True: 17.2M, False: 3.40M]
  |  Branch (10810:49): [True: 1.56k, False: 3.40M]
  ------------------
10811|  17.2M|                 && ( ret = rescap( pBNS, u, v, iuv ) ) > 0)
  ------------------
  |  Branch (10811:21): [True: 7.32M, False: 9.93M]
  ------------------
10812|  7.32M|            {
10813|       |                /* Special treatment to prevent H<->(-) replacement on non-acidic atoms */
10814|       |                /*----------------------------------------------------------------------*/
10815|  7.32M|                if (pBNS->type_TACN)
  ------------------
  |  Branch (10815:21): [True: 27.3k, False: 7.29M]
  ------------------
10816|  27.3k|                {
10817|  27.3k|                    if (bIgnoreVertexNonTACN_atom( pBNS, u, v ))
  ------------------
  |  Branch (10817:25): [True: 777, False: 26.5k]
  ------------------
10818|    777|                    {
10819|    777|                        continue;
10820|    777|                    }
10821|  26.5k|                    if (bIgnoreVertexNonTACN_group( pBNS, u, v, SwitchEdge ))
  ------------------
  |  Branch (10821:25): [True: 531, False: 26.0k]
  ------------------
10822|    531|                    {
10823|    531|                        continue;
10824|    531|                    }
10825|       |#if ( FIX_KEEP_H_ON_NH_ANION == 1 )
10826|       |                    if (bIsRemovedHfromNHaion( pBNS, u, v ))
10827|       |                    {
10828|       |                        continue;
10829|       |                    }
10830|       |#endif
10831|       |#if ( FIX_AVOID_ADP == 1 )
10832|       |                    if (bIsAggressiveDeprotonation( pBNS, u, v, SwitchEdge ))
10833|       |                    {
10834|       |                        continue;
10835|       |                    }
10836|       |#endif
10837|  26.5k|                }
10838|       |                /*----------------------------------------------------------------------*/
10839|  7.32M|                b_v = FindBase( v, BasePtr ); /* Notation: b_x is a base of x */
10840|       |
10841|  7.32M|                if (b_v == NO_VERTEX)
  ------------------
  |  |  118|  7.32M|#define NO_VERTEX    -2
  ------------------
  |  Branch (10841:21): [True: 3.48M, False: 3.83M]
  ------------------
10842|  3.48M|                {
10843|       |                    /* Originally 0 instead of NO_VERTEX */
10844|       |
10845|       |                    /* Important note: following "A. Note of Implementing the Algorithm" from the
10846|       |                    article by Kocay and Stone, all references to PrevPt[a] have been
10847|       |                    replaced with SwitchEdge[a][0]=SwitchEdge_Vert1(a); to be on a safe side
10848|       |                    the check whether (SwitchEdge_Vert2(a)==a) has been added.
10849|       |                    */
10850|       |
10851|       |                    /* v is not yet in T or T' -- add it to T and M */
10852|       |                    /*PrevPt[v] = u; ** this effectively adds v to T and v' to T' */
10853|       |
10854|  3.48M|                    QSize++;
10855|  3.48M|                    ScanQ[QSize] = v;
10856|  3.48M|                    TREE_MARK( v, TREE_IN_1 ); /* mark v s-reachable (in T) */
  ------------------
  |  |  245|  3.48M|#define TREE_MARK(X, MARK)           do{ if( Tree[X] < MARK ) Tree[X]=MARK; }while(0)
  |  |  ------------------
  |  |  |  Branch (245:46): [True: 3.48M, False: 0]
  |  |  |  Branch (245:84): [Folded, False: 3.48M]
  |  |  ------------------
  ------------------
10857|  3.48M|                    TREE_MARK( prim( v ), TREE_IN_2 ); /* mark v' in T' */
  ------------------
  |  |  245|  3.48M|#define TREE_MARK(X, MARK)           do{ if( Tree[X] < MARK ) Tree[X]=MARK; }while(0)
  |  |  ------------------
  |  |  |  Branch (245:46): [True: 3.48M, False: 0]
  |  |  |  Branch (245:84): [Folded, False: 3.48M]
  |  |  ------------------
  ------------------
10858|       |
10859|       |                                                       /* Switch Edges: If u in T then Pu (a valid su-path) can be constructed
10860|       |                                                       by successfully executing u=PrevPt[u] until u=s.
10861|       |                                                       For vertices in T' the situation is different.
10862|       |                                                       Suppose uv and v'u' are added to a mirror network M creating a blossom:
10863|       |
10864|       |                                                       s            T    (Note: in the code v' is prim(v),
10865|       |                                                       T             / \                       u' is prim(u), etc.)
10866|       |                                                       /   ...
10867|       |                                                       w=x1
10868|       |                                                       / \          u in T,   v in T'
10869|       |                                                       u=y2   v'=y3
10870|       |                                                       \ /      <--- two added edges uv and (uv)'=v'u'
10871|       |                                                       --------    X   ------------intersection of the edges ------------------------
10872|       |                                                       / \      <--- (the edges intersection in the picture is shown as X)
10873|       |                                                       u'=x2   v=x3      u' it T', v' in T
10874|       |                                                       \ /
10875|       |                                                       T'           w'=y1
10876|       |                                                       \   ...
10877|       |                                                       \ /
10878|       |                                                       t           T'
10879|       |
10880|       |                                                       Vertices v and u' now become s-reachable;
10881|       |                                                       The valid paths to v and u' must use the edges uv and v'u' respectively.
10882|       |
10883|       |                                                       For each vertex z in S we define a switch-edge that allows a valid sz-path
10884|       |                                                       to be constructed, SwitchEdge[v]=uv and SwitchEdge[u']=v'u'. (We don't
10885|       |                                                       know the direction of the edge uv, it may be (u,v) or (v,u). In either case,
10886|       |                                                       the complementary edge is indicated by v'u').
10887|       |
10888|       |                                                       Vertex w' also becomes s-reachable when uv is added to M, and a valid sw'-path
10889|       |                                                       must use one of uv and v'u'. Therefore we choose one of them, say uv (see below
10890|       |                                                       the rule of choosing the switch-edge), and define SwitchEdge[w'] = uv.
10891|       |
10892|       |                                                       When the addition of an edge uv to M causes a vertex z to become s-reachable
10893|       |                                                       (where z was previously non-reachable), z is placed on the ScanQ, that is, into S.
10894|       |                                                       The edge uv is said to be a switch-edge for z.
10895|       |
10896|       |                                                       Rule: We choose the the order of the vertices uv to be such that the valid sz-path
10897|       |                                                       consists of a valid su-path, followed by edge uv, followed by a valid vz-path.
10898|       |
10899|       |                                                       For vertices z in T we can take SwitchEdge[z]=yz where y=PrevPt[z] since
10900|       |                                                       it is the edge yz that allows z to be s-reachable.
10901|       |                                                       For vertices z not in S we take SwitchEdge[z]=NONE.
10902|       |
10903|       |                                                       */
10904|       |
10905|       |                                                       /* v is not yet in T or T' -- add it to T and M */
10906|  3.48M|                    SwitchEdge_Vert1( v ) = u; /* this effectively adds uv and v'u' to M */
  ------------------
  |  |  395|  3.48M|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
10907|  3.48M|                    SwitchEdge_IEdge( v ) = iuv;
  ------------------
  |  |  397|  3.48M|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
10908|       |
10909|  3.48M|                    BasePtr[prim( v )] = v;
  ------------------
  |  |  392|  3.48M|#define prim(v) (Vertex)((v)^1)
  ------------------
10910|  3.48M|                    BasePtr[v] = BLOSSOM_BASE; /* create a trivial blossom C(v) with base v */
  ------------------
  |  |  119|  3.48M|#define BLOSSOM_BASE -1
  ------------------
10911|  3.48M|#if ( BNS_RAD_SEARCH == 1 )
10912|  3.48M|                    n++;
10913|  3.48M|#endif
10914|  3.48M|                }
10915|       |
10916|  3.83M|                else if (TREE_IS_S_REACHABLE( prim( v ) ) /*Is_s_Reachable(prim(v)*/
  ------------------
  |  |  242|  7.67M|#define TREE_IS_S_REACHABLE(X) (Tree[X] >= TREE_IN_2BLOSS)
  |  |  ------------------
  |  |  |  |  239|  3.83M|#define TREE_IN_2BLOSS 2  /* in T' and in a blossom, is s-reachable */
  |  |  ------------------
  |  |  |  Branch (242:32): [True: 1.74M, False: 2.08M]
  |  |  ------------------
  ------------------
10917|  1.74M|                                                          /* if v' is reachable, an st-path is given by P(u)-uv-P'(v') */
10918|  1.74M|                                                          /*&& PrevPt[prim(u)] != prim(v) ** avoid edges of T' */
10919|  1.74M|                          && ( SwitchEdge_Vert1( prim( u ) ) != prim( v ) || SwitchEdge_Vert2( prim( u ) ) != prim( u ) ) /* avoid edges of T' */
  ------------------
  |  |  395|  1.74M|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
                                        && ( SwitchEdge_Vert1( prim( u ) ) != prim( v ) || SwitchEdge_Vert2( prim( u ) ) != prim( u ) ) /* avoid edges of T' */
  ------------------
  |  |  392|  3.49M|#define prim(v) (Vertex)((v)^1)
  ------------------
                                        && ( SwitchEdge_Vert1( prim( u ) ) != prim( v ) || SwitchEdge_Vert2( prim( u ) ) != prim( u ) ) /* avoid edges of T' */
  ------------------
  |  |  396|   868k|#define SwitchEdge_Vert2(u) Get2ndEdgeVertex( pBNS, SwitchEdge[u] )
  ------------------
                                        && ( SwitchEdge_Vert1( prim( u ) ) != prim( v ) || SwitchEdge_Vert2( prim( u ) ) != prim( u ) ) /* avoid edges of T' */
  ------------------
  |  |  392|   868k|#define prim(v) (Vertex)((v)^1)
  ------------------
  |  Branch (10919:32): [True: 879k, False: 868k]
  |  Branch (10919:78): [True: 0, False: 868k]
  ------------------
10920|   879k|                          && b_u != b_v
  ------------------
  |  Branch (10920:30): [True: 484k, False: 394k]
  ------------------
10921|   484k|                          && !( pBNS->type_TACN && bIgnoreVertexNonTACN_group( pBNS, prim( v ), u, SwitchEdge ) )
  ------------------
  |  |  392|    363|#define prim(v) (Vertex)((v)^1)
  ------------------
  |  Branch (10921:33): [True: 363, False: 484k]
  |  Branch (10921:52): [True: 58, False: 305]
  ------------------
10922|       |#if ( FIX_KEEP_H_ON_NH_ANION == 1 )
10923|       |                          && !( pBNS->type_TACN && bIsRemovedHfromNHaion( pBNS, prim( v ), u ) )
10924|       |#endif
10925|  3.83M|                          )
10926|   484k|                {
10927|   484k|#if ( BNS_RAD_SEARCH == 1 )
10928|   484k|                    n++;
10929|   484k|#endif
10930|       |                    /* There is now a valid sv-path via u avoiding b_v (unless v==b_v)
10931|       |                    => u, v, u', and v' now all become part of the same connected component of M[C] */
10932|       |
10933|       |                    /* djb-rwth: addressing coverity ID #499578 -- negative values of b_u handled properly */
10934|   484k|                    w = MakeBlossom( pBNS, ScanQ, &QSize, Pu, Pv, max_len_Pu_Pv, SwitchEdge, BasePtr, u, v, iuv, b_u, b_v, Tree );
10935|       |                    /* this constructed the new blossom and returned its base */
10936|       |
10937|   484k|                    if (IS_BNS_ERROR( w ))
  ------------------
  |  |   67|   484k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   484k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   484k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   484k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 484k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 484k]
  |  |  ------------------
  ------------------
10938|      0|                    {
10939|      0|                        pBD->QSize = QSize;
10940|      0|                        return w; /* error */
10941|      0|                    }
10942|       |
10943|   484k|                    b_u = w; /* the new base of C(u) */
10944|   484k|                    if (prim( w ) == Vertex_t)
  ------------------
  |  |  392|   484k|#define prim(v) (Vertex)((v)^1)
  ------------------
                                  if (prim( w ) == Vertex_t)
  ------------------
  |  |  116|   484k|#define Vertex_t 1
  ------------------
  |  Branch (10944:25): [True: 142k, False: 342k]
  ------------------
10945|   142k|                    {
10946|       |                        /* t is now s-reachable, a valid augmenting path P exists in M */
10947|   142k|                        delta = FindPathCap( pBNS, SwitchEdge, Vertex_s, Vertex_t, 10000 ); /* compute the residual capacity of P + P' */
  ------------------
  |  |  115|   142k|#define Vertex_s 0
  ------------------
                                      delta = FindPathCap( pBNS, SwitchEdge, Vertex_s, Vertex_t, 10000 ); /* compute the residual capacity of P + P' */
  ------------------
  |  |  116|   142k|#define Vertex_t 1
  ------------------
10948|   142k|                        if (IS_BNS_ERROR( delta ))
  ------------------
  |  |   67|   142k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   142k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   142k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   142k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 142k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 142k]
  |  |  ------------------
  ------------------
10949|      0|                        {
10950|      0|                            pBD->QSize = QSize;
10951|      0|                            return delta; /* error */
10952|      0|                        }
10953|       |#if ( ALLOW_ONLY_SIMPLE_ALT_PATH == 1 )
10954|       |                        if (pBNS->bNotASimplePath || abs( delta ) > 1)
10955|       |                        {
10956|       |                            delta = 0;
10957|       |                        }
10958|       |#endif
10959|   142k|                        if (delta)
  ------------------
  |  Branch (10959:29): [True: 142k, False: 0]
  ------------------
10960|   142k|                        {
10961|   142k|                            pBNS->bChangeFlow |= ( bChangeFlow & BNS_EF_CHNG_FLOW );
  ------------------
  |  |  370|   142k|#define BNS_EF_CHNG_FLOW      1  /* change Balanced Network (BN) flow inside the BNS search */
  ------------------
10962|   142k|                        }
10963|   142k|                        ret = PullFlow( pBNS, SwitchEdge, Vertex_s, Vertex_t, delta, 0, bChangeFlow ); /* augment on a pair of valid st-paths */
  ------------------
  |  |  115|   142k|#define Vertex_s 0
  ------------------
                                      ret = PullFlow( pBNS, SwitchEdge, Vertex_s, Vertex_t, delta, 0, bChangeFlow ); /* augment on a pair of valid st-paths */
  ------------------
  |  |  116|   142k|#define Vertex_t 1
  ------------------
10964|   142k|                        pBD->QSize = QSize;
10965|   142k|                        return
10966|   142k|                            ( IS_BNS_ERROR( ret ) ? ret : delta );
  ------------------
  |  |   67|   142k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   142k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   142k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   142k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 142k, False: 0]
  |  |  |  Branch (67:44): [True: 2, False: 142k]
  |  |  ------------------
  ------------------
10967|   142k|                    }
10968|   484k|                }
10969|  7.32M|            }
10970|       |
10971|  13.3M|            else if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  13.3M|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  13.3M|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  13.3M|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  13.3M|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 13.3M, False: 59]
  |  |  |  Branch (67:44): [True: 0, False: 13.3M]
  |  |  ------------------
  ------------------
10972|      0|            {
10973|      0|                pBD->QSize = QSize;
10974|      0|                return ret; /* error */
10975|      0|            }
10976|  20.6M|        }
10977|       |
10978|  4.49M|#if ( BNS_RAD_SEARCH == 1 )
10979|  4.49M|        if (bRadSearch && !n)
  ------------------
  |  Branch (10979:13): [True: 69.3k, False: 4.42M]
  |  Branch (10979:27): [True: 25.7k, False: 43.5k]
  ------------------
10980|  25.7k|        {
10981|       |            /* The BNS stopped at u */
10982|  25.7k|            n = RegisterRadEndpoint( pBNS, pBD, u );
10983|  25.7k|            if (IS_BNS_ERROR( n ))
  ------------------
  |  |   67|  25.7k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  25.7k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  25.7k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  25.7k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 25.7k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 25.7k]
  |  |  ------------------
  ------------------
10984|      0|            {
10985|      0|                pBD->QSize = QSize;
10986|      0|                return n;
10987|      0|            }
10988|  25.7k|        }
10989|  4.49M|#endif
10990|       |
10991|  4.49M|        k++; /* advance ScanQ */
10992|  4.49M|    } while (k <= QSize);
  ------------------
  |  Branch (10992:14): [True: 3.89M, False: 600k]
  ------------------
10993|       |
10994|       |
10995|       |    /* if this point is reached, no valid augmenting path exists, ScanQ contains
10996|       |    the set S of all s-reachable vertices and K=[S,S-] is a minimum balanced edge-cut */
10997|       |    /* ClearFlowMarks( vert, num_vert); */
10998|       |
10999|   600k|    pBD->QSize = QSize;
11000|       |
11001|   600k|    return 0;
11002|   742k|}
FindBase:
11034|  17.9M|{
11035|  17.9M|    if (BasePtr[u] == NO_VERTEX)
  ------------------
  |  |  118|  17.9M|#define NO_VERTEX    -2
  ------------------
  |  Branch (11035:9): [True: 3.48M, False: 14.4M]
  ------------------
11036|  3.48M|    {
11037|  3.48M|        return NO_VERTEX;
  ------------------
  |  |  118|  3.48M|#define NO_VERTEX    -2
  ------------------
11038|  3.48M|    }
11039|  14.4M|    else if (BasePtr[u] == BLOSSOM_BASE)
  ------------------
  |  |  119|  14.4M|#define BLOSSOM_BASE -1
  ------------------
  |  Branch (11039:14): [True: 11.4M, False: 2.99M]
  ------------------
11040|  11.4M|    {
11041|  11.4M|        return u;
11042|  11.4M|    }
11043|  2.99M|    else
11044|  2.99M|    {
11045|  2.99M|        Vertex b;
11046|  2.99M|        b = FindBase( BasePtr[u], BasePtr );
11047|  2.99M|        BasePtr[u] = b; /* path compression */
11048|  2.99M|        return b;
11049|  2.99M|    }
11050|       |
11051|  17.9M|}
FindPathToVertex_s:
11062|   969k|{
11063|       |    /* x is the base of a blossom, construct a valid Path of blossom bases to s */
11064|   969k|    int i = 0;
11065|   969k|    Path[i] = x;
11066|  3.99M|    while (x != Vertex_s)
  ------------------
  |  |  115|  3.99M|#define Vertex_s 0
  ------------------
  |  Branch (11066:12): [True: 3.02M, False: 969k]
  ------------------
11067|  3.02M|    {
11068|  3.02M|        x = FindBase( SwitchEdge_Vert1( x ), BasePtr );
  ------------------
  |  |  395|  3.02M|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
11069|  3.02M|        if (++i < MaxPathLen)
  ------------------
  |  Branch (11069:13): [True: 3.02M, False: 0]
  ------------------
11070|  3.02M|        {
11071|  3.02M|            Path[i] = x;
11072|  3.02M|        }
11073|      0|        else
11074|      0|        {
11075|      0|            return BNS_WRONG_PARMS;
  ------------------
  |  |   48|      0|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
11076|      0|        }
11077|  3.02M|    }
11078|       |
11079|   969k|    return i;
11080|   969k|}
MakeBlossom:
11101|   484k|{
11102|       |    /* In order to find the base of the new blossom, the paths
11103|       |    P(u) and P(v') are constructed and compared in order to
11104|       |    find the last blossom base they have in common which
11105|       |    is reachable on a valid path.
11106|       |
11107|       |    Edge uv connects two blossoms, their bases are b_u and b_v.
11108|       |    */
11109|   484k|    Vertex w, z;
11110|   484k|    int len_Pu, len_Pv;
11111|   484k|    int i, j, k;
11112|   484k|    EdgeIndex izw;
11113|       |
11114|   484k|    len_Pu = FindPathToVertex_s( b_u, SwitchEdge, BasePtr, Pu, max_len_Pu_Pv );
11115|   484k|    if (IS_BNS_ERROR( len_Pu ))
  ------------------
  |  |   67|   484k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   484k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   484k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   484k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 484k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 484k]
  |  |  ------------------
  ------------------
11116|      0|    {
11117|      0|        return len_Pu;
11118|      0|    }
11119|   484k|    len_Pv = FindPathToVertex_s( b_v, SwitchEdge, BasePtr, Pv, max_len_Pu_Pv );
11120|   484k|    if (IS_BNS_ERROR( len_Pv ))
  ------------------
  |  |   67|   484k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   484k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   484k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   484k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 484k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 484k]
  |  |  ------------------
  ------------------
11121|      0|    {
11122|      0|        return len_Pv;
11123|      0|    }
11124|   484k|    i = len_Pu;
11125|   484k|    j = len_Pv;
11126|       |    /* Initially Pu[i] and Pv[j] both equal to s, but their first elements are different */
11127|       |    /* Find the last blossom base common to Pu and Pv */
11128|  1.75M|    while (i >= 0 && j >= 0 && Pu[i] == Pv[j])
  ------------------
  |  Branch (11128:12): [True: 1.57M, False: 173k]
  |  Branch (11128:22): [True: 1.56M, False: 17.1k]
  |  Branch (11128:32): [True: 1.26M, False: 293k]
  ------------------
11129|  1.26M|    {
11130|       |        /* Was (Pu[i]==Pv[j] && i>=0 && j>=0) => tested Pu[-1], Pv[-1] <- pointed by W.Ihlenfeldt 08-26-2004*/
11131|  1.26M|        i--;
11132|  1.26M|        j--;
11133|  1.26M|    }
11134|   484k|    i++;
11135|   484k|    w = Pu[i]; /* w is the last common vertex */
11136|   484k|    z = SwitchEdge_Vert1( w );
  ------------------
  |  |  395|   484k|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
11137|   484k|    izw = SwitchEdge_IEdge( w );
  ------------------
  |  |  397|   484k|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
11138|       |    /* now extend the blossom if rescap(zw) >= 2 */
11139|   619k|    while (w != Vertex_s && rescap( pBNS, z, w, izw ) >= 2)
  ------------------
  |  |  115|  1.23M|#define Vertex_s 0
  ------------------
  |  Branch (11139:12): [True: 477k, False: 142k]
  |  Branch (11139:29): [True: 134k, False: 342k]
  ------------------
11140|   134k|    {
11141|   134k|        i++;
11142|   134k|        w = Pu[i];
11143|   134k|        z = SwitchEdge_Vert1( w );
  ------------------
  |  |  395|   134k|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
11144|   134k|        izw = SwitchEdge_IEdge( w );
  ------------------
  |  |  397|   134k|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
11145|   134k|    }
11146|       |    /* w is the base of the new blossom */
11147|       |    /* first follow the path Pu from w to b_u */
11148|  1.24M|    for (k = i - 1; k >= 0; k--)
  ------------------
  |  Branch (11148:21): [True: 759k, False: 484k]
  ------------------
11149|   759k|    {
11150|   759k|        z = Pu[k];  /* z is the base of the blossom */
11151|   759k|        BasePtr[z] = w;
11152|   759k|        BasePtr[prim( z )] = w; /* w is the new base of the blossom */
  ------------------
  |  |  392|   759k|#define prim(v) (Vertex)((v)^1)
  ------------------
11153|       |                                /* z and z' may already be part of a blossom that is being
11154|       |                                swallowed into a larger blossom.
11155|       |                                We don't want to change the switch edge in that case.
11156|       |                                */
11157|       |
11158|   759k|        if (!TREE_IS_ON_SCANQ( prim( z ) ) /*!IsInScanQ(prim(z)) */)
  ------------------
  |  |  243|   759k|#define TREE_IS_ON_SCANQ TREE_IS_S_REACHABLE
  |  |  ------------------
  |  |  |  |  242|   759k|#define TREE_IS_S_REACHABLE(X) (Tree[X] >= TREE_IN_2BLOSS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  239|   759k|#define TREE_IN_2BLOSS 2  /* in T' and in a blossom, is s-reachable */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (11158:13): [True: 714k, False: 45.2k]
  ------------------
11159|   714k|        {
11160|   714k|            SwitchEdge_Vert1( prim( z ) ) = prim( v );     /* set the switch edge of z' */
  ------------------
  |  |  395|   714k|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
                          SwitchEdge_Vert1( prim( z ) ) = prim( v );     /* set the switch edge of z' */
  ------------------
  |  |  392|   714k|#define prim(v) (Vertex)((v)^1)
  ------------------
11161|       |                                                           /* SwitchEdge[prim(z)][1] = prim(u);  */
11162|   714k|            SwitchEdge_IEdge( prim( z ) ) = iuv;
  ------------------
  |  |  397|   714k|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
11163|   714k|            ( *pQSize )++;
11164|   714k|            ScanQ[*pQSize] = prim( z );    /* add z' to ScanQ */
  ------------------
  |  |  392|   714k|#define prim(v) (Vertex)((v)^1)
  ------------------
11165|   714k|            TREE_MARK( prim( z ), TREE_IN_2BLOSS ); /* mark z' s-reachable */
  ------------------
  |  |  245|   714k|#define TREE_MARK(X, MARK)           do{ if( Tree[X] < MARK ) Tree[X]=MARK; }while(0)
  |  |  ------------------
  |  |  |  Branch (245:46): [True: 714k, False: 0]
  |  |  |  Branch (245:84): [Folded, False: 714k]
  |  |  ------------------
  ------------------
11166|   714k|        }
11167|   759k|    }
11168|       |    /* Now follow the path Pv */
11169|  1.31M|    for (k = j; k >= 0; k--) /* djb-rwth: converting for loop into while loop to avoid LLVM warning */
  ------------------
  |  Branch (11169:17): [True: 832k, False: 484k]
  ------------------
11170|   832k|    {
11171|   832k|        z = Pv[k]; /* z is the base of the blossom */
11172|   832k|        BasePtr[z] = w;
11173|   832k|        BasePtr[prim( z )] = w; /* w is the new base of the blossom */
  ------------------
  |  |  392|   832k|#define prim(v) (Vertex)((v)^1)
  ------------------
11174|       |                                /* z and z' may already be part of a blossom that is being
11175|       |                                swallowed into a larger blossom.
11176|       |                                We don't want to change the switch edge in that case.
11177|       |                                */
11178|       |
11179|   832k|        if (!TREE_IS_ON_SCANQ( prim( z ) ) /*!IsInScanQ(prim(z)) */)
  ------------------
  |  |  243|   832k|#define TREE_IS_ON_SCANQ TREE_IS_S_REACHABLE
  |  |  ------------------
  |  |  |  |  242|   832k|#define TREE_IS_S_REACHABLE(X) (Tree[X] >= TREE_IN_2BLOSS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  239|   832k|#define TREE_IN_2BLOSS 2  /* in T' and in a blossom, is s-reachable */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (11179:13): [True: 808k, False: 23.6k]
  ------------------
11180|   808k|        {
11181|   808k|            SwitchEdge_Vert1( prim( z ) ) = u;     /* set the switch edge of z' */
  ------------------
  |  |  395|   808k|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
11182|       |                                                   /* SwitchEdge[prim(z)][1] = v;  */
11183|   808k|            SwitchEdge_IEdge( prim( z ) ) = iuv;
  ------------------
  |  |  397|   808k|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
11184|   808k|            ( *pQSize )++;
11185|   808k|            ScanQ[*pQSize] = prim( z );    /* add z' to ScanQ */
  ------------------
  |  |  392|   808k|#define prim(v) (Vertex)((v)^1)
  ------------------
11186|   808k|            TREE_MARK( prim( z ), TREE_IN_2BLOSS ); /* mark z' s-reachable */
  ------------------
  |  |  245|   808k|#define TREE_MARK(X, MARK)           do{ if( Tree[X] < MARK ) Tree[X]=MARK; }while(0)
  |  |  ------------------
  |  |  |  Branch (245:46): [True: 808k, False: 0]
  |  |  |  Branch (245:84): [Folded, False: 808k]
  |  |  ------------------
  ------------------
11187|   808k|        }
11188|   832k|    }
11189|       |
11190|   484k|    if (!TREE_IS_ON_SCANQ( prim( w ) ) /* !IsInScanQ(prim(w))*/)
  ------------------
  |  |  243|   484k|#define TREE_IS_ON_SCANQ TREE_IS_S_REACHABLE
  |  |  ------------------
  |  |  |  |  242|   484k|#define TREE_IS_S_REACHABLE(X) (Tree[X] >= TREE_IN_2BLOSS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  239|   484k|#define TREE_IN_2BLOSS 2  /* in T' and in a blossom, is s-reachable */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (11190:9): [True: 254k, False: 230k]
  ------------------
11191|   254k|    {   /* add w' to the blossom */
11192|   254k|        SwitchEdge_Vert1( prim( w ) ) = u;     /* set the switch edge of w' */
  ------------------
  |  |  395|   254k|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
11193|       |                                               /* SwitchEdge[prim(w)][1] = v;  */
11194|   254k|        SwitchEdge_IEdge( prim( w ) ) = iuv;
  ------------------
  |  |  397|   254k|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
11195|   254k|        ( *pQSize )++;
11196|   254k|        ScanQ[*pQSize] = prim( w ); /* add w' to ScanQ */
  ------------------
  |  |  392|   254k|#define prim(v) (Vertex)((v)^1)
  ------------------
11197|   254k|        TREE_MARK( prim( w ), TREE_IN_2BLOSS );  /* mark w' s-reachable */
  ------------------
  |  |  245|   254k|#define TREE_MARK(X, MARK)           do{ if( Tree[X] < MARK ) Tree[X]=MARK; }while(0)
  |  |  ------------------
  |  |  |  Branch (245:46): [True: 254k, False: 0]
  |  |  |  Branch (245:84): [Folded, False: 254k]
  |  |  ------------------
  ------------------
11198|   254k|    }
11199|       |
11200|   484k|    return w;
11201|   484k|}
PullFlow:
11262|  1.19M|{
11263|  1.19M|    Vertex w, z;
11264|  1.19M|    EdgeIndex iwz;
11265|  1.19M|    int ret = 0;
11266|       |
11267|  1.19M|    w = SwitchEdge_Vert1( y );
  ------------------
  |  |  395|  1.19M|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
11268|  1.19M|    z = SwitchEdge_Vert2( y );
  ------------------
  |  |  396|  1.19M|#define SwitchEdge_Vert2(u) Get2ndEdgeVertex( pBNS, SwitchEdge[u] )
  ------------------
11269|  1.19M|    iwz = SwitchEdge_IEdge( y );
  ------------------
  |  |  397|  1.19M|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
11270|  1.19M|    if (bReverse)
  ------------------
  |  Branch (11270:9): [True: 514k, False: 681k]
  ------------------
11271|   514k|    {
11272|       |        /* P consists of a path from x to w, then wz, then a path from z to y.  */
11273|       |        /* z may equal y, in which case z is just PrevPt[y] */
11274|   514k|        if (z != y)
  ------------------
  |  Branch (11274:13): [True: 10.1k, False: 504k]
  ------------------
11275|  10.1k|        {
11276|  10.1k|            ret = PullFlow( pBNS, SwitchEdge, prim( y ), prim( z ), delta, (S_CHAR) ( 1 - bReverse ), bChangeFlow ); /* augment between z and y */
  ------------------
  |  |  392|  10.1k|#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 */
  ------------------
  |  |  392|  10.1k|#define prim(v) (Vertex)((v)^1)
  ------------------
11277|  10.1k|        }
11278|   514k|        if (!IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|   514k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   514k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   514k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   514k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 514k, False: 0]
  |  |  |  Branch (67:44): [True: 1, False: 514k]
  |  |  ------------------
  ------------------
11279|   514k|        {
11280|   514k|            ret = AugmentEdge( pBNS, w, z, iwz, delta, bReverse, bChangeFlow );
11281|   514k|        }
11282|       |        /* Do not augment the complementary path: AugmentEdge( prim(z), prim(w), vert, delta); */
11283|       |        /* w may equal x, in which case there is no need to call PullFlow(x, w) */
11284|   514k|        if (w != x && !IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|   340k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   340k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   340k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   340k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 340k, False: 0]
  |  |  |  Branch (67:44): [True: 1, False: 340k]
  |  |  ------------------
  ------------------
  |  Branch (11284:13): [True: 340k, False: 173k]
  ------------------
11285|   340k|        {
11286|   340k|            ret = PullFlow( pBNS, SwitchEdge, x, w, delta, bReverse, bChangeFlow ); /* augment between x and w */
11287|   340k|        }
11288|   514k|    }
11289|   681k|    else
11290|   681k|    {
11291|       |        /* P consists of a path from x to w, then wz, then a path from z to y.  */
11292|       |        /* w may equal x, in which case there is no need to call PullFlow(x, w) */
11293|   681k|        if (w != x && !IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|   529k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   529k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   529k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   529k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 529k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 529k]
  |  |  ------------------
  ------------------
  |  Branch (11293:13): [True: 529k, False: 152k]
  ------------------
11294|   529k|        {
11295|   529k|            ret = PullFlow( pBNS, SwitchEdge, x, w, delta, bReverse, bChangeFlow ); /* augment between x and w */
11296|   529k|        }
11297|   681k|        if (!IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|   681k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   681k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   681k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   681k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 681k, False: 0]
  |  |  |  Branch (67:44): [True: 1, False: 681k]
  |  |  ------------------
  ------------------
11298|   681k|        {
11299|   681k|            ret = AugmentEdge( pBNS, w, z, iwz, delta, bReverse, bChangeFlow );
11300|   681k|        }
11301|       |        /* z may equal y, in which case z is just PrevPt[y] */
11302|   681k|        if (z != y && !IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|   173k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   173k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   173k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   173k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 173k, False: 0]
  |  |  |  Branch (67:44): [True: 1, False: 173k]
  |  |  ------------------
  ------------------
  |  Branch (11302:13): [True: 173k, False: 507k]
  ------------------
11303|   173k|        {
11304|   173k|            ret = PullFlow( pBNS, SwitchEdge, prim( y ), prim( z ), delta, (S_CHAR) ( 1 - bReverse ), bChangeFlow ); /* augment between z and y */
  ------------------
  |  |  392|   173k|#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 */
  ------------------
  |  |  392|   173k|#define prim(v) (Vertex)((v)^1)
  ------------------
11305|   173k|        }
11306|   681k|    }
11307|       |
11308|  1.19M|    return ret;
11309|  1.19M|}
FindPathCap:
11333|  1.19M|{
11334|       |
11335|  1.19M|    Vertex w, z, iwz;
11336|  1.19M|    int    cap, delta2;
11337|       |
11338|       |    /*    static int level;
11339|       |    if ( level ++ > 50 )
11340|       |    {
11341|       |    #ifdef _DEBUG
11342|       |    int stop = 1;
11343|       |    #else
11344|       |    ;
11345|       |    #endif
11346|       |    }
11347|       |    */
11348|       |
11349|  1.19M|    w = SwitchEdge_Vert1( y );
  ------------------
  |  |  395|  1.19M|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
11350|  1.19M|    z = SwitchEdge_Vert2( y ); /* wz is on the path P */
  ------------------
  |  |  396|  1.19M|#define SwitchEdge_Vert2(u) Get2ndEdgeVertex( pBNS, SwitchEdge[u] )
  ------------------
11351|  1.19M|    iwz = SwitchEdge_IEdge( y ); /* edge index */
  ------------------
  |  |  397|  1.19M|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
11352|       |
11353|       |                                 /* Rescap_mark() detects edges passed 2 times and reduces rescap */
11354|  1.19M|    cap = rescap_mark( pBNS, w, z, iwz );
11355|       |
11356|  1.19M|    if (IS_BNS_ERROR( cap ))
  ------------------
  |  |   67|  1.19M|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  1.19M|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  1.19M|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  1.19M|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 1.19M, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 1.19M]
  |  |  ------------------
  ------------------
11357|      0|    {
11358|       |        /* level --; */
11359|      0|        return cap;
11360|      0|    }
11361|  1.19M|    if (cap < delta)
  ------------------
  |  Branch (11361:9): [True: 240k, False: 955k]
  ------------------
11362|   240k|    {
11363|   240k|        delta = cap;
11364|   240k|    }
11365|       |    /* P consists of a path from x to w, then wz, then a path from z to y */
11366|  1.19M|    if (w != x)
  ------------------
  |  Branch (11366:9): [True: 869k, False: 325k]
  ------------------
11367|   869k|    {
11368|   869k|        delta2 = FindPathCap( pBNS, SwitchEdge, x, w, delta );
11369|   869k|        delta = inchi_min( delta2, delta );
  ------------------
  |  |  139|   869k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 187k, False: 682k]
  |  |  ------------------
  ------------------
11370|   869k|    }
11371|  1.19M|    if (z != y)
  ------------------
  |  Branch (11371:9): [True: 183k, False: 1.01M]
  ------------------
11372|   183k|    {
11373|   183k|        delta2 = FindPathCap( pBNS, SwitchEdge, prim( y ), prim( z ), delta );
  ------------------
  |  |  392|   183k|#define prim(v) (Vertex)((v)^1)
  ------------------
                      delta2 = FindPathCap( pBNS, SwitchEdge, prim( y ), prim( z ), delta );
  ------------------
  |  |  392|   183k|#define prim(v) (Vertex)((v)^1)
  ------------------
11374|   183k|        delta = inchi_min( delta2, delta );
  ------------------
  |  |  139|   183k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 11.5k, False: 172k]
  |  |  ------------------
  ------------------
11375|   183k|    }
11376|       |    /* level --; */
11377|       |
11378|  1.19M|    return delta;
11379|  1.19M|}
MarkRingSystemsAltBns:
11425|   288k|{
11426|   288k|    AT_NUMB   *nStackAtom = NULL;
11427|   288k|    int        nTopStackAtom;
11428|   288k|    AT_NUMB   *nRingStack = NULL;
11429|   288k|    int        nTopRingStack; /* was AT_NUMB */
11430|   288k|    AT_NUMB   *nBondStack = NULL;
11431|   288k|    int        nTopBondStack;
11432|   288k|    AT_NUMB   *nDfsNumber = NULL;
11433|   288k|    AT_NUMB   *nLowNumber = NULL;
11434|   288k|    S_CHAR    *cNeighNumb = NULL;
11435|   288k|    AT_NUMB    nDfs;
11436|   288k|    AT_NUMB    nNumAtInRingSystem;
11437|   288k|    int        i, j, u, w, start, nNumRingSystems; /* djb-rwth: removing redundant variables */
11438|   288k|    BNS_VERTEX *at = pBNS->vert;
11439|   288k|    BNS_EDGE   *bond = pBNS->edge;
11440|   288k|    int        num_atoms = pBNS->num_atoms;
11441|   288k|    int        num_edges = pBNS->num_bonds;
11442|       |
11443|       |    /* Allocate arrays */
11444|   288k|    nStackAtom = (AT_NUMB *) inchi_malloc( num_atoms * sizeof( nStackAtom[0] ) );
  ------------------
  |  | 1143|   288k|#define inchi_malloc   malloc
  ------------------
11445|   288k|    nRingStack = (AT_NUMB *) inchi_malloc( num_atoms * sizeof( nRingStack[0] ) );
  ------------------
  |  | 1143|   288k|#define inchi_malloc   malloc
  ------------------
11446|   288k|    nDfsNumber = (AT_NUMB *) inchi_malloc( num_atoms * sizeof( nDfsNumber[0] ) );
  ------------------
  |  | 1143|   288k|#define inchi_malloc   malloc
  ------------------
11447|   288k|    nLowNumber = (AT_NUMB *) inchi_malloc( num_atoms * sizeof( nLowNumber[0] ) );
  ------------------
  |  | 1143|   288k|#define inchi_malloc   malloc
  ------------------
11448|   288k|    nBondStack = num_edges ? ( (AT_NUMB *) inchi_malloc( num_edges * sizeof( nBondStack[0] ) ) ) : (AT_NUMB *) ( NULL ); /* special case: no bonds 2006-03 */
  ------------------
  |  | 1143|  49.9k|#define inchi_malloc   malloc
  ------------------
  |  Branch (11448:18): [True: 49.9k, False: 238k]
  ------------------
11449|   288k|    cNeighNumb = (S_CHAR  *) inchi_malloc( num_atoms * sizeof( cNeighNumb[0] ) );
  ------------------
  |  | 1143|   288k|#define inchi_malloc   malloc
  ------------------
11450|       |
11451|       |    /* Check allocation */
11452|   288k|    if (!nStackAtom || !nRingStack || !nDfsNumber || !nLowNumber || (!nBondStack && num_edges) || !cNeighNumb
  ------------------
  |  Branch (11452:9): [True: 0, False: 288k]
  |  Branch (11452:24): [True: 0, False: 288k]
  |  Branch (11452:39): [True: 0, False: 288k]
  |  Branch (11452:54): [True: 0, False: 288k]
  |  Branch (11452:70): [True: 238k, False: 49.9k]
  |  Branch (11452:85): [True: 0, False: 238k]
  |  Branch (11452:99): [True: 0, False: 288k]
  ------------------
11453|   288k|         ) /* djb-rwth: addressing LLVM warning */
11454|      0|    {
11455|      0|        nNumRingSystems = CT_OUT_OF_RAM;  /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   21|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
11456|      0|        goto exit_function;
11457|      0|    }
11458|       |
11459|       |    /********************************************
11460|       |    *
11461|       |    * Find Cut-vertices & Blocks
11462|       |    *
11463|       |    *             1\      /5   has 3 blocks (maximal subgraphs that
11464|       |    *  Example:   | >3--4< |   are nonseparable by deleting a single vertex):
11465|       |    *             2/      \6   (1,2,3, has 3 bonds), (3,4, has 1 bond), and (4,5,6, has 3 bonds)
11466|       |    *
11467|       |    *                          Cut-vertices or articulation points are
11468|       |    *                          intersections of the blocks: points 3 and 4.
11469|       |    ********************************************/
11470|       |
11471|       |    /********************************************************
11472|       |
11473|       |    RingSystemAlt are atoms connected by alternating bonds
11474|       |    (as must be indicated in bIsAltBond()):
11475|       |
11476|       |    BOND_ALTERN
11477|       |    BOND_ALT_123
11478|       |    BOND_ALT_13
11479|       |    BOND_ALT_23
11480|       |
11481|       |    Since other bonds may be present, we possibly need
11482|       |    to restart to move to another component
11483|       |    *********************************************************/
11484|       |
11485|   288k|    nNumRingSystems = 0;
11486|   288k|    memset( nDfsNumber, 0, num_atoms * sizeof( nDfsNumber[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
11487|       |
11488|  1.38M|    for (start = 0; start < num_atoms; start++)
  ------------------
  |  Branch (11488:21): [True: 1.09M, False: 288k]
  ------------------
11489|  1.09M|    {
11490|  1.09M|        if (nDfsNumber[start])
  ------------------
  |  Branch (11490:13): [True: 7.52k, False: 1.08M]
  ------------------
11491|  7.52k|        {
11492|  7.52k|            continue;
11493|  7.52k|        }
11494|  1.54M|        for (i = 0; i < at[start].valenceAltBns; i++)
  ------------------
  |  |11420|  1.54M|#define valenceAltBns            num_adj_edges
  ------------------
  |  Branch (11494:21): [True: 459k, False: 1.08M]
  ------------------
11495|   459k|        {
11496|   459k|            if (bond[at[start].iedge[i]].nBondTypeInpAltBns & BT_ALTERN_BOND)
  ------------------
  |  |11408|   459k|#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)
  ------------------
  |  |11387|   459k|#define BT_ALTERN_BOND           1      /* 1-2, possibly stereo */
  ------------------
  |  Branch (11496:17): [True: 2.90k, False: 456k]
  ------------------
11497|  2.90k|                goto found_alt;
11498|   459k|        }
11499|  1.08M|        continue;
11500|       |
11501|  1.08M|    found_alt:
11502|       |
11503|       |        /*  Initiation */
11504|  2.90k|        u = start; /*  start atom */
11505|  2.90k|        nDfs = 0;
11506|  2.90k|        nTopStackAtom = -1;
11507|  2.90k|        nTopRingStack = -1;
11508|  2.90k|        nTopBondStack = -1;
11509|  2.90k|        memset( cNeighNumb, 0, num_atoms * sizeof( cNeighNumb[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
11510|       |        /*  Push the start atom on the stack */
11511|  2.90k|        nLowNumber[u] = nDfsNumber[u] = ++nDfs;
11512|  2.90k|        nStackAtom[++nTopStackAtom] = (AT_NUMB) u;
11513|  2.90k|        nRingStack[++nTopRingStack] = (AT_NUMB) u;
11514|       |
11515|       |        /* djb-rwth: removing redundant code */
11516|       |
11517|  2.90k|        do
11518|  10.6k|        {
11519|       |            /* advance */
11520|       |            /*while ( (int)at[i=nStackAtom[nTopStackAtom]].valenceAltBns > (j = (int)cNeighNumb[i]) )*/
11521|       |            /* replaced due to missing sequence point */
11522|  35.3k|            while (i = (int) nStackAtom[nTopStackAtom], j = (int) cNeighNumb[i], (int) at[i].valenceAltBns > j)
  ------------------
  |  |11420|  35.3k|#define valenceAltBns            num_adj_edges
  ------------------
  |  Branch (11522:20): [True: 24.6k, False: 10.6k]
  ------------------
11523|  24.6k|            {
11524|  24.6k|                cNeighNumb[i] ++;
11525|  24.6k|                if (!( bond[w = at[i].iedge[j]].nBondTypeInpAltBns & BT_ALT_BOND_MASK ))
  ------------------
  |  |11408|  24.6k|#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 ))
  ------------------
  |  |11400|  24.6k|#define BT_ALT_BOND_MASK         (BT_ALTERN_BOND|BT_OTHER_ALTERN_BOND)
  |  |  ------------------
  |  |  |  |11387|  24.6k|#define BT_ALTERN_BOND           1      /* 1-2, possibly stereo */
  |  |  ------------------
  |  |               #define BT_ALT_BOND_MASK         (BT_ALTERN_BOND|BT_OTHER_ALTERN_BOND)
  |  |  ------------------
  |  |  |  |11388|  24.6k|#define BT_OTHER_ALTERN_BOND     2      /* 1-3, 2-3, 1-2-3 alternating non-stereo non-taut bonds */
  |  |  ------------------
  ------------------
  |  Branch (11525:21): [True: 6.09k, False: 18.5k]
  ------------------
11526|  6.09k|                {
11527|  6.09k|                    continue;
11528|  6.09k|                }
11529|  18.5k|                u = (int) ( bond[at[i].iedge[j]].neighbor12 ^ i );
11530|  18.5k|                if (!nDfsNumber[u] && nBondStack) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (11530:21): [True: 7.77k, False: 10.8k]
  |  Branch (11530:39): [True: 7.77k, False: 0]
  ------------------
11531|  7.77k|                {
11532|       |                    /* tree edge, 1st visit -- advance */
11533|  7.77k|                    nStackAtom[++nTopStackAtom] = (AT_NUMB) u;
11534|  7.77k|                    nRingStack[++nTopRingStack] = (AT_NUMB) u;
11535|  7.77k|                    nBondStack[++nTopBondStack] = (AT_NUMB) w;
11536|  7.77k|                    nLowNumber[u] = nDfsNumber[u] = ++nDfs;
11537|       |                    /* djb-rwth: removing redundant code */
11538|  7.77k|                }
11539|  10.8k|                else
11540|  10.8k|                {
11541|  10.8k|                    if (!nTopStackAtom || u != (int) nStackAtom[nTopStackAtom - 1])
  ------------------
  |  Branch (11541:25): [True: 1.38k, False: 9.42k]
  |  Branch (11541:43): [True: 1.64k, False: 7.77k]
  ------------------
11542|  3.02k|                    { /*  may comment out ? */
11543|       |                      /* back edge: u is not a predecessor of i */
11544|  3.02k|                        if ((nDfsNumber[u] < nDfsNumber[i]) && nBondStack) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (11544:29): [True: 1.51k, False: 1.51k]
  |  Branch (11544:64): [True: 1.51k, False: 0]
  ------------------
11545|  1.51k|                        {
11546|       |                            /* Back edge, 1st visit: u is ancestor of i. Save and compare */
11547|  1.51k|                            nBondStack[++nTopBondStack] = (AT_NUMB) w;
11548|  1.51k|                            if (nLowNumber[i] > nDfsNumber[u])
  ------------------
  |  Branch (11548:33): [True: 1.39k, False: 117]
  ------------------
11549|  1.39k|                            {
11550|  1.39k|                                nLowNumber[i] = nDfsNumber[u];
11551|  1.39k|                            }
11552|  1.51k|                        }
11553|  3.02k|                    }
11554|  10.8k|                }
11555|  18.5k|            }
11556|  10.6k|            cNeighNumb[i] = 0;
11557|       |
11558|       |            /* Back up */
11559|  10.6k|            if (i != start)
  ------------------
  |  Branch (11559:17): [True: 7.77k, False: 2.90k]
  ------------------
11560|  7.77k|            {
11561|  7.77k|                u = (int) nStackAtom[nTopStackAtom - 1]; /* predecessor of i */
11562|  7.77k|                if (nLowNumber[i] >= nDfsNumber[u])
  ------------------
  |  Branch (11562:21): [True: 4.32k, False: 3.45k]
  ------------------
11563|  4.32k|                {
11564|       |                    /* Output the block; the block was entered through its first bond u->i */
11565|  4.32k|                    nNumRingSystems++;
11566|       |                    /*at[u].nBlockSystemAltBns = nNumRingSystems;*/ /* mark the atom */
11567|  4.32k|                    nNumAtInRingSystem = 1;
11568|       |                    /*
11569|       |                    if ( u != start || nNumStartChildren > 1 ) {
11570|       |                    at[u].bCutVertexAltBns += 1;  // mark cut-vertex (articulation point)
11571|       |                    }
11572|       |                    */
11573|  7.77k|                    while (nTopRingStack >= 0)
  ------------------
  |  Branch (11573:28): [True: 7.77k, False: 0]
  ------------------
11574|  7.77k|                    {
11575|  7.77k|                        j = nRingStack[nTopRingStack--];
11576|       |                        /*at[j].nBlockSystemAltBns = nNumRingSystems;*/ /*  mark the atom */
11577|  7.77k|                        nNumAtInRingSystem++;
11578|  7.77k|                        if (i == j)
  ------------------
  |  Branch (11578:29): [True: 4.32k, False: 3.45k]
  ------------------
11579|  4.32k|                        {
11580|  4.32k|                            break;
11581|  4.32k|                        }
11582|  7.77k|                    }
11583|  9.29k|                    while (nTopBondStack >= 0)
  ------------------
  |  Branch (11583:28): [True: 9.29k, False: 0]
  ------------------
11584|  9.29k|                    {
11585|  9.29k|                        w = nBondStack[nTopBondStack--];
11586|  9.29k|                        bond[w].nBlockNumberAltBns = nNumRingSystems; /*  mark the bond */
  ------------------
  |  |11406|  9.29k|#define nBlockNumberAltBns   flow   /* internal variable of the DFS traversal: mark traversed bonds */
  ------------------
11587|  9.29k|                        bond[w].nNumAtInBlockAltBns = nNumAtInRingSystem;
  ------------------
  |  |11407|  9.29k|#define nNumAtInBlockAltBns  cap
  ------------------
11588|  9.29k|                        if ((i == bond[w].neighbor1 && u == ( i ^ bond[w].neighbor12 )) ||
  ------------------
  |  Branch (11588:30): [True: 1.46k, False: 7.83k]
  |  Branch (11588:56): [True: 425, False: 1.03k]
  ------------------
11589|  8.86k|                             (u == bond[w].neighbor1 && i == ( u ^ bond[w].neighbor12 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (11589:31): [True: 5.28k, False: 3.58k]
  |  Branch (11589:57): [True: 3.89k, False: 1.38k]
  ------------------
11590|  4.32k|                        {
11591|  4.32k|                            break;
11592|  4.32k|                        }
11593|  9.29k|                    }
11594|  4.32k|                }
11595|  3.45k|                else
11596|  3.45k|                {
11597|  3.45k|                    if (nLowNumber[u] > nLowNumber[i])
  ------------------
  |  Branch (11597:25): [True: 3.33k, False: 120]
  ------------------
11598|  3.33k|                    {
11599|       |                        /* inherit */
11600|  3.33k|                        nLowNumber[u] = nLowNumber[i];
11601|  3.33k|                    }
11602|  3.45k|                }
11603|  7.77k|            }
11604|  10.6k|        } while (--nTopStackAtom >= 0);
  ------------------
  |  Branch (11604:18): [True: 7.77k, False: 2.90k]
  ------------------
11605|  2.90k|    }
11606|       |
11607|       |#if ( BNS_MARK_ONLY_BLOCKS != 1 )  /* { */
11608|       |
11609|       |    /********************************************
11610|       |    *
11611|       |    * Find Ring Systems
11612|       |    * Including chain atoms X: A-X-B, where the bonds (of any kind) are bridges.
11613|       |    *
11614|       |    ********************************************/
11615|       |
11616|       |    /*  Initiation */
11617|       |    nNumRingSystems = 0;
11618|       |    for (start = 0; start < num_atoms; start++)
11619|       |    {
11620|       |        if (at[start].nRingSystemAltBns)
11621|       |        {
11622|       |            continue;
11623|       |        }
11624|       |        for (i = 0; i < at[start].valenceAltBns; i++)
11625|       |        {
11626|       |            if (bond[at[start].iedge[i]].nBondTypeInpAltBns & BT_ALT_BOND_MASK)
11627|       |            {
11628|       |                goto found_alt2;
11629|       |            }
11630|       |        }
11631|       |        continue;
11632|       |
11633|       |    found_alt2:
11634|       |        u = start; /*  start atom */
11635|       |        nDfs = 0;
11636|       |        nTopStackAtom = -1;
11637|       |        nTopRingStack = -1;
11638|       |        memset( nDfsNumber, 0, num_atoms * sizeof( nDfsNumber[0] ) );
11639|       |        memset( cNeighNumb, 0, num_atoms * sizeof( cNeighNumb[0] ) );
11640|       |        /*  push the start atom on the stack */
11641|       |        nLowNumber[u] = nDfsNumber[u] = ++nDfs;
11642|       |        nStackAtom[++nTopStackAtom] = (AT_NUMB) u;
11643|       |        nRingStack[++nTopRingStack] = (AT_NUMB) u;
11644|       |
11645|       |        do
11646|       |        {
11647|       |            /* advance */
11648|       |        advance_ring:
11649|       |            /*if ( (int)at[i=nStackAtom[nTopStackAtom]].valenceAltBns > (j = (int)cNeighNumb[i]) )*/
11650|       |            /* replaced due to missing sequence point */
11651|       |            if (i = (int) nStackAtom[nTopStackAtom], j = (int) cNeighNumb[i], (int) at[i].valenceAltBns > j)
11652|       |            {
11653|       |                cNeighNumb[i] ++;
11654|       |                if (!( bond[at[i].iedge[j]].nBondTypeInpAltBns & BT_ALTERN_BOND ))
11655|       |                {
11656|       |                    goto advance_ring;
11657|       |                }
11658|       |                u = (int) ( bond[at[i].iedge[j]].neighbor12 ^ i );
11659|       |                if (!nDfsNumber[u])
11660|       |                {
11661|       |                    /* tree edge, 1st visit -- advance */
11662|       |                    nStackAtom[++nTopStackAtom] = (AT_NUMB) u;
11663|       |                    nRingStack[++nTopRingStack] = (AT_NUMB) u;
11664|       |                    nLowNumber[u] = nDfsNumber[u] = ++nDfs;
11665|       |                }
11666|       |                else
11667|       |                {
11668|       |                    if (!nTopStackAtom || u != (int) nStackAtom[nTopStackAtom - 1])
11669|       |                    {
11670|       |                        /* back edge: u is not a predecessor of i */
11671|       |                        if (nDfsNumber[u] < nDfsNumber[i])
11672|       |                        {
11673|       |                            /* Back edge, 1st visit: u is ancestor of i. Compare */
11674|       |                            if (nLowNumber[i] > nDfsNumber[u])
11675|       |                            {
11676|       |                                nLowNumber[i] = nDfsNumber[u];
11677|       |                            }
11678|       |                        }
11679|       |                    }
11680|       |                }
11681|       |                goto advance_ring;
11682|       |            }
11683|       |            else
11684|       |            {
11685|       |                cNeighNumb[i] = 0;
11686|       |            }
11687|       |
11688|       |            /* Back up */
11689|       |            if (nDfsNumber[i] == nLowNumber[i])
11690|       |            {
11691|       |                /*  Found a ring system */
11692|       |                nNumRingSystems++;
11693|       |
11694|       |                /*  Unwind nRingStack[] down to i */
11695|       |
11696|       |                /*  Count atoms in a ring system */
11697|       |                for (nNumAtInRingSystem = 0, j = nTopRingStack; 0 <= j; j--)
11698|       |                {
11699|       |                    nNumAtInRingSystem++;
11700|       |                    if (i == (int) nRingStack[j])
11701|       |                    {
11702|       |                        break;
11703|       |                    }
11704|       |                }
11705|       |                while (nTopRingStack >= 0)
11706|       |                {
11707|       |                    j = (int) nRingStack[nTopRingStack--];
11708|       |                    at[j].nRingSystemAltBns = (AT_NUMB) nNumRingSystems; /*  ring system id */
11709|       |                    at[j].nNumAtInRingSystemAltBns = nNumAtInRingSystem;
11710|       |                    if (i == j)
11711|       |                    {
11712|       |                        /*  Reached atom on the top of nStackAtom[] stack  */
11713|       |                        break;
11714|       |                    }
11715|       |                }
11716|       |            }
11717|       |            else
11718|       |            {
11719|       |                if (nTopStackAtom > 0)
11720|       |                {
11721|       |                    j = (int) nStackAtom[nTopStackAtom - 1];
11722|       |                    /* inherit nLowNumber */
11723|       |                    if (nLowNumber[j] > nLowNumber[i])
11724|       |                    {
11725|       |                        nLowNumber[j] = nLowNumber[i];
11726|       |                    }
11727|       |                }
11728|       |            }
11729|       |        } while (--nTopStackAtom >= 0);
11730|       |    }
11731|       |
11732|       |#endif /* }  BNS_MARK_ONLY_BLOCKS != 1 */
11733|       |
11734|   288k|exit_function:
11735|   288k|    if (nStackAtom)
  ------------------
  |  Branch (11735:9): [True: 288k, False: 0]
  ------------------
11736|   288k|    {
11737|   288k|        inchi_free( nStackAtom );
  ------------------
  |  | 1152|   288k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 288k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 288k]
  |  |  ------------------
  ------------------
11738|   288k|    }
11739|   288k|    if (nRingStack)
  ------------------
  |  Branch (11739:9): [True: 288k, False: 0]
  ------------------
11740|   288k|    {
11741|   288k|        inchi_free( nRingStack );
  ------------------
  |  | 1152|   288k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 288k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 288k]
  |  |  ------------------
  ------------------
11742|   288k|    }
11743|   288k|    if (nDfsNumber)
  ------------------
  |  Branch (11743:9): [True: 288k, False: 0]
  ------------------
11744|   288k|    {
11745|   288k|        inchi_free( nDfsNumber );
  ------------------
  |  | 1152|   288k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 288k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 288k]
  |  |  ------------------
  ------------------
11746|   288k|    }
11747|   288k|    if (nLowNumber)
  ------------------
  |  Branch (11747:9): [True: 288k, False: 0]
  ------------------
11748|   288k|    {
11749|   288k|        inchi_free( nLowNumber );
  ------------------
  |  | 1152|   288k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 288k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 288k]
  |  |  ------------------
  ------------------
11750|   288k|    }
11751|   288k|    if (nBondStack)
  ------------------
  |  Branch (11751:9): [True: 49.9k, False: 238k]
  ------------------
11752|  49.9k|    {
11753|  49.9k|        inchi_free( nBondStack );
  ------------------
  |  | 1152|  49.9k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 49.9k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 49.9k]
  |  |  ------------------
  ------------------
11754|  49.9k|    }
11755|   288k|    if (cNeighNumb)
  ------------------
  |  Branch (11755:9): [True: 288k, False: 0]
  ------------------
11756|   288k|    {
11757|   288k|        inchi_free( cNeighNumb );
  ------------------
  |  | 1152|   288k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 288k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 288k]
  |  |  ------------------
  ------------------
11758|   288k|    }
11759|       |
11760|   288k|    return nNumRingSystems;
11761|   288k|}
ReInitBnStructForAltBns:
11769|   288k|{
11770|   288k|    Vertex v, v2;
11771|   288k|    int ret, bond_type, num_to_test, j;
11772|   288k|    BNS_EDGE   *pBond;
11773|   288k|    BNS_VERTEX *pAtom;
11774|       |
11775|       |    /* Strip all t-groups and c-groups */
11776|   288k|    num_to_test = 0;
11777|   288k|    if (bUnknAltAsNoStereo)
  ------------------
  |  Branch (11777:9): [True: 0, False: 288k]
  ------------------
11778|      0|    {
11779|      0|        for (j = 0; j < pBNS->num_edges; j++)
  ------------------
  |  Branch (11779:21): [True: 0, False: 0]
  ------------------
11780|      0|        {
11781|      0|            pBNS->edge[j].pass = 0;
11782|      0|        }
11783|      0|    }
11784|       |
11785|   288k|    ret = ReInitBnStruct( pBNS, at, num_atoms, 0 );
11786|       |
11787|   288k|    if (ret || pBNS->num_atoms != num_atoms || pBNS->num_vertices != num_atoms || pBNS->num_bonds != pBNS->num_edges)
  ------------------
  |  Branch (11787:9): [True: 3, False: 288k]
  |  Branch (11787:16): [True: 0, False: 288k]
  |  Branch (11787:48): [True: 0, False: 288k]
  |  Branch (11787:83): [True: 0, False: 288k]
  ------------------
11788|      3|    {
11789|      3|        ret = BNS_REINIT_ERR;
  ------------------
  |  |   60|      3|#define BNS_REINIT_ERR     (BNS_ERR + 12) /*(-9987)*/
  |  |  ------------------
  |  |  |  |   47|      3|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
11790|      3|        goto exit_function;
11791|      3|    }
11792|       |
11793|       |    /* Eliminate bonds and fix st-caps */
11794|  1.38M|    for (v = 0; v < num_atoms; v++)
  ------------------
  |  Branch (11794:17): [True: 1.09M, False: 288k]
  ------------------
11795|  1.09M|    {
11796|  1.09M|        pAtom = pBNS->vert + v;
11797|  1.57M|        for (j = 0; j < pAtom->valenceAltBns; j++)
  ------------------
  |  |11420|  1.57M|#define valenceAltBns            num_adj_edges
  ------------------
  |  Branch (11797:21): [True: 479k, False: 1.09M]
  ------------------
11798|   479k|        {
11799|   479k|            pBond = pBNS->edge + pAtom->iedge[j];
11800|   479k|            if (pBond->neighbor1 == v)
  ------------------
  |  Branch (11800:17): [True: 239k, False: 239k]
  ------------------
11801|   239k|            {
11802|   239k|                bond_type = ( at[v].bond_type[j] & BOND_TYPE_MASK );
  ------------------
  |  |  189|   239k|#define BOND_TYPE_MASK        0x0f
  ------------------
11803|   239k|                v2 = pBond->neighbor12 ^ v;
11804|   239k|                if (at[v].endpoint || at[v2].endpoint)
  ------------------
  |  Branch (11804:21): [True: 9.09k, False: 230k]
  |  Branch (11804:39): [True: 6.91k, False: 223k]
  ------------------
11805|  16.0k|                {
11806|  16.0k|                    bond_type = 0; /* any bond to an endpoint considered non-stereogenic */
11807|  16.0k|                }
11808|       |#if ( FIX_EITHER_DB_AS_NONSTEREO == 1 )
11809|       |                if (bUnknAltAsNoStereo)
11810|       |                {
11811|       |                    if (bond_type == BOND_ALTERN && at[v].bond_stereo[j] == STEREO_DBLE_EITHER)
11812|       |                    {
11813|       |                        bond_type = 0; /* treat unknown (Either) ALT bond as non-stereo */
11814|       |                    }
11815|       |                }
11816|       |#endif
11817|   239k|                switch (bond_type)
11818|   239k|                {
11819|       |
11820|  7.94k|                    case BOND_ALTERN:
  ------------------
  |  |  180|  7.94k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|  7.94k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (11820:21): [True: 7.94k, False: 231k]
  ------------------
11821|  7.94k|                        pBond->nBondTypeInpAltBns = BT_ALTERN_BOND;
  ------------------
  |  |11408|  7.94k|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                                      pBond->nBondTypeInpAltBns = BT_ALTERN_BOND;
  ------------------
  |  |11387|  7.94k|#define BT_ALTERN_BOND           1      /* 1-2, possibly stereo */
  ------------------
11822|  7.94k|                        num_to_test++;
11823|  7.94k|                        break;
11824|       |
11825|  2.06k|                    case BOND_ALT_123:
  ------------------
  |  |  182|  2.06k|#define BOND_ALT_123             5   /* single/double/triple                */
  ------------------
  |  Branch (11825:21): [True: 2.06k, False: 237k]
  ------------------
11826|  2.06k|                    case BOND_ALT_13:
  ------------------
  |  |  183|  2.06k|#define BOND_ALT_13              6   /* single/triple                       */
  ------------------
  |  Branch (11826:21): [True: 0, False: 239k]
  ------------------
11827|  6.00k|                    case BOND_ALT_23:
  ------------------
  |  |  184|  6.00k|#define BOND_ALT_23              7   /* double/triple                       */
  ------------------
  |  Branch (11827:21): [True: 3.94k, False: 235k]
  ------------------
11828|  6.00k|                        pBond->nBondTypeInpAltBns = BT_OTHER_ALTERN_BOND;
  ------------------
  |  |11408|  6.00k|#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;
  ------------------
  |  |11388|  6.00k|#define BT_OTHER_ALTERN_BOND     2      /* 1-3, 2-3, 1-2-3 alternating non-stereo non-taut bonds */
  ------------------
11829|  6.00k|                        break;
11830|       |
11831|    195|                    case BOND_TAUTOM:
  ------------------
  |  |  185|    195|#define BOND_TAUTOM              8
  ------------------
  |  Branch (11831:21): [True: 195, False: 239k]
  ------------------
11832|    195|                        pBond->nBondTypeInpAltBns = BT_TAUTOM_BOND;
  ------------------
  |  |11408|    195|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                                      pBond->nBondTypeInpAltBns = BT_TAUTOM_BOND;
  ------------------
  |  |11392|    195|#define BT_TAUTOM_BOND           8
  ------------------
11833|    195|                        break;
11834|       |
11835|  10.2k|                    case BOND_ALT12NS:
  ------------------
  |  |  186|  10.2k|#define BOND_ALT12NS             9
  ------------------
  |  Branch (11835:21): [True: 10.2k, False: 229k]
  ------------------
11836|  10.2k|                        pBond->nBondTypeInpAltBns = BT_ALTERN_NS_BOND;
  ------------------
  |  |11408|  10.2k|#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;
  ------------------
  |  |11390|  10.2k|#define BT_ALTERN_NS_BOND        4
  ------------------
11837|  10.2k|                        break;
11838|       |
11839|  16.0k|                    case 0:
  ------------------
  |  Branch (11839:21): [True: 16.0k, False: 223k]
  ------------------
11840|   149k|                    case BOND_SINGLE:
  ------------------
  |  |  177|   149k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|   149k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (11840:21): [True: 133k, False: 106k]
  ------------------
11841|   191k|                    case BOND_DOUBLE:
  ------------------
  |  |  178|   191k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|   191k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (11841:21): [True: 42.3k, False: 197k]
  ------------------
11842|   215k|                    case BOND_TRIPLE:
  ------------------
  |  |  179|   215k|#define BOND_TRIPLE BOND_TYPE_TRIPLE  /* 3                                  */
  |  |  ------------------
  |  |  |  |   34|   215k|#define BOND_TYPE_TRIPLE    3
  |  |  ------------------
  ------------------
  |  Branch (11842:21): [True: 23.6k, False: 216k]
  ------------------
11843|   215k|                        pBond->nBondTypeInpAltBns = BT_IGNORE_BOND;
  ------------------
  |  |11408|   215k|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                                      pBond->nBondTypeInpAltBns = BT_IGNORE_BOND;
  ------------------
  |  |11396|   215k|#define BT_IGNORE_BOND           0
  ------------------
11844|   215k|                        break;
11845|       |
11846|      0|                    default:
  ------------------
  |  Branch (11846:21): [True: 0, False: 239k]
  ------------------
11847|      0|                        pBond->nBondTypeInpAltBns = BT_IGNORE_BOND;
  ------------------
  |  |11408|      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;
  ------------------
  |  |11396|      0|#define BT_IGNORE_BOND           0
  ------------------
11848|      0|                        break;
11849|   239k|                }
11850|   239k|                pBond->nBondNonStereoAltBns = 0; /* djb-rwth: addressing GCC warning -- operations on pBond->cap might be undefined */
  ------------------
  |  |11409|   239k|#define nBondNonStereoAltBns cap     /* 1=>found to be non-stereogenic although BondTypeInp=2; 0=>as in BondTypeInp */
  ------------------
11851|   239k|                pBond->nBlockNumberAltBns = 0;
  ------------------
  |  |11406|   239k|#define nBlockNumberAltBns   flow   /* internal variable of the DFS traversal: mark traversed bonds */
  ------------------
11852|   239k|                pBond->nNumAtInBlockAltBns = 0;
  ------------------
  |  |11407|   239k|#define nNumAtInBlockAltBns  cap
  ------------------
11853|       |
11854|   239k|#if ( RESET_EDGE_FORBIDDEN_MASK == 1 )
11855|   239k|                pBond->forbidden &= pBNS->edge_forbidden_mask;
11856|   239k|#endif
11857|   239k|            }
11858|   479k|        }
11859|  1.09M|        pAtom->bCutVertexAltBns =
  ------------------
  |  |11413|  1.09M|#define bCutVertexAltBns         st_edge.cap0  /* cut-vertex flag */
  ------------------
11860|  1.09M|            pAtom->nRingSystemAltBns =
  ------------------
  |  |11414|  1.09M|#define nRingSystemAltBns        st_edge.cap   /* ordering number of a ring system */
  ------------------
11861|  1.09M|            pAtom->nNumAtInRingSystemAltBns =
  ------------------
  |  |11415|  1.09M|#define nNumAtInRingSystemAltBns st_edge.flow0 /* number of vertices in a ring system */
  ------------------
11862|  1.09M|            pAtom->nBlockSystemAltBns = 0;
  ------------------
  |  |11416|  1.09M|#define nBlockSystemAltBns       st_edge.flow  /* result of the DFS traversal: even cirquit must be within one block */
  ------------------
11863|  1.09M|    }
11864|       |
11865|   288k|    return num_to_test;
11866|       |
11867|      3|exit_function:
11868|       |
11869|      3|    return ret;
11870|   288k|}
MarkNonStereoAltBns:
11878|   288k|{
11879|   288k|    int       num_bonds = pBNS->num_bonds;
11880|   288k|    int       ret;
11881|   288k|    int       ibond, ib1, ib2;
11882|   288k|    BNS_EDGE *pBond;
11883|   288k|    Vertex    iat1, iat2;
11884|       |
11885|   288k|    ret = 0;
11886|       |
11887|   288k|    if (pBNS->num_atoms != num_atoms || pBNS->num_vertices != num_atoms || pBNS->num_bonds != pBNS->num_edges)
  ------------------
  |  Branch (11887:9): [True: 0, False: 288k]
  |  Branch (11887:41): [True: 0, False: 288k]
  |  Branch (11887:76): [True: 0, False: 288k]
  ------------------
11888|      0|    {
11889|      0|        ret = BNS_REINIT_ERR;
  ------------------
  |  |   60|      0|#define BNS_REINIT_ERR     (BNS_ERR + 12) /*(-9987)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
11890|      0|        goto exit_function;
11891|      0|    }
11892|   288k|    if (bUnknAltAsNoStereo)
  ------------------
  |  Branch (11892:9): [True: 0, False: 288k]
  ------------------
11893|      0|    {
11894|      0|        for (ibond = 0; ibond < num_bonds; ibond++)
  ------------------
  |  Branch (11894:25): [True: 0, False: 0]
  ------------------
11895|      0|        {
11896|      0|            pBond = pBNS->edge + ibond;
11897|      0|            if (pBond->nBondTypeInpAltBns != BT_ALTERN_BOND && pBond->nBondTypeInpAltBns != BT_IGNORE_BOND)
  ------------------
  |  |11408|      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)
  ------------------
  |  |11387|      0|#define BT_ALTERN_BOND           1      /* 1-2, possibly stereo */
  ------------------
                          if (pBond->nBondTypeInpAltBns != BT_ALTERN_BOND && pBond->nBondTypeInpAltBns != BT_IGNORE_BOND)
  ------------------
  |  |11408|      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)
  ------------------
  |  |11396|      0|#define BT_IGNORE_BOND           0
  ------------------
  |  Branch (11897:17): [True: 0, False: 0]
  |  Branch (11897:64): [True: 0, False: 0]
  ------------------
11898|      0|            {
11899|      0|                continue;
11900|      0|            }
11901|      0|            iat1 = pBond->neighbor1;
11902|      0|            iat2 = pBond->neighbor12 ^ iat1;
11903|      0|            ib1 = pBond->neigh_ord[0];
11904|      0|            ib2 = pBond->neigh_ord[1];
11905|      0|            if ( /* alt bond non-adjacent to a taut. endpoint: */
11906|      0|                ( pBond->nBondTypeInpAltBns == BT_ALTERN_BOND &&
  ------------------
  |  |11408|      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 &&
  ------------------
  |  |11387|      0|#define BT_ALTERN_BOND           1      /* 1-2, possibly stereo */
  ------------------
  |  Branch (11906:19): [True: 0, False: 0]
  ------------------
11907|      0|                  pBond->nNumAtInBlockAltBns <= 3 )  /* non-ring bond */ ||
  ------------------
  |  |11407|      0|#define nNumAtInBlockAltBns  cap
  ------------------
  |  Branch (11907:19): [True: 0, False: 0]
  ------------------
11908|       |                 /* alt bond adjacent to a taut. endpoint: */
11909|      0|                  ( pBond->nBondTypeInpAltBns == BT_IGNORE_BOND &&
  ------------------
  |  |11408|      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 &&
  ------------------
  |  |11396|      0|#define BT_IGNORE_BOND           0
  ------------------
  |  Branch (11909:21): [True: 0, False: 0]
  ------------------
11910|      0|                 ( at[iat1].bond_type[ib1] & BOND_TYPE_MASK ) == BOND_ALTERN )
  ------------------
  |  |  189|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
                               ( at[iat1].bond_type[ib1] & BOND_TYPE_MASK ) == BOND_ALTERN )
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (11910:18): [True: 0, False: 0]
  ------------------
11911|      0|                 )
11912|      0|            {
11913|      0|                if (( at[iat1].bond_type[ib1] & BOND_TYPE_MASK ) == BOND_ALTERN)
  ------------------
  |  |  189|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
                              if (( at[iat1].bond_type[ib1] & BOND_TYPE_MASK ) == BOND_ALTERN)
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (11913:21): [True: 0, False: 0]
  ------------------
11914|      0|                {
11915|       |                    /* bond_type = BOND_ALT12NS; */
11916|      0|                    at[iat1].bond_stereo[ib1] =
11917|      0|                        at[iat2].bond_stereo[ib2] = STEREO_DBLE_EITHER;
  ------------------
  |  |   40|      0|#define STEREO_DBLE_EITHER   3
  ------------------
11918|      0|                    ret++;
11919|      0|                }
11920|      0|            }
11921|      0|        }
11922|      0|    }
11923|   288k|    else
11924|   288k|    {
11925|   528k|        for (ibond = 0; ibond < num_bonds; ibond++)
  ------------------
  |  Branch (11925:25): [True: 239k, False: 288k]
  ------------------
11926|   239k|        {
11927|   239k|            pBond = pBNS->edge + ibond;
11928|   239k|            if (pBond->nBondTypeInpAltBns != BT_ALTERN_BOND && pBond->nBondTypeInpAltBns != BT_IGNORE_BOND)
  ------------------
  |  |11408|   239k|#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)
  ------------------
  |  |11387|   479k|#define BT_ALTERN_BOND           1      /* 1-2, possibly stereo */
  ------------------
                          if (pBond->nBondTypeInpAltBns != BT_ALTERN_BOND && pBond->nBondTypeInpAltBns != BT_IGNORE_BOND)
  ------------------
  |  |11408|   231k|#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)
  ------------------
  |  |11396|   231k|#define BT_IGNORE_BOND           0
  ------------------
  |  Branch (11928:17): [True: 231k, False: 7.94k]
  |  Branch (11928:64): [True: 16.4k, False: 215k]
  ------------------
11929|  16.4k|            {
11930|  16.4k|                continue;
11931|  16.4k|            }
11932|   223k|            iat1 = pBond->neighbor1;
11933|   223k|            iat2 = pBond->neighbor12 ^ iat1;
11934|   223k|            ib1 = pBond->neigh_ord[0];
11935|   223k|            ib2 = pBond->neigh_ord[1];
11936|   223k|            if ( /* alt bond non-adjacent to a taut. endpoint: */
11937|   223k|                ( pBond->nBondTypeInpAltBns == BT_ALTERN_BOND &&
  ------------------
  |  |11408|   223k|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                              ( pBond->nBondTypeInpAltBns == BT_ALTERN_BOND &&
  ------------------
  |  |11387|   446k|#define BT_ALTERN_BOND           1      /* 1-2, possibly stereo */
  ------------------
  |  Branch (11937:19): [True: 7.94k, False: 215k]
  ------------------
11938|  7.94k|                  pBond->nNumAtInBlockAltBns <= 3 ) /* non-ring bond */ ||
  ------------------
  |  |11407|  7.94k|#define nNumAtInBlockAltBns  cap
  ------------------
  |  Branch (11938:19): [True: 2.29k, False: 5.65k]
  ------------------
11939|       |                 /* alt bond adjacent to a taut. endpoint: */
11940|   221k|                  ( pBond->nBondTypeInpAltBns == BT_IGNORE_BOND &&
  ------------------
  |  |11408|   221k|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                                ( pBond->nBondTypeInpAltBns == BT_IGNORE_BOND &&
  ------------------
  |  |11396|   442k|#define BT_IGNORE_BOND           0
  ------------------
  |  Branch (11940:21): [True: 215k, False: 5.65k]
  ------------------
11941|   215k|                 ( at[iat1].bond_type[ib1] & BOND_TYPE_MASK ) == BOND_ALTERN )
  ------------------
  |  |  189|   215k|#define BOND_TYPE_MASK        0x0f
  ------------------
                               ( at[iat1].bond_type[ib1] & BOND_TYPE_MASK ) == BOND_ALTERN )
  ------------------
  |  |  180|   215k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|   215k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (11941:18): [True: 271, False: 215k]
  ------------------
11942|   223k|                 )
11943|  2.56k|            {
11944|  2.56k|                at[iat1].bond_type[ib1] =
11945|  2.56k|                    at[iat2].bond_type[ib2] = BOND_ALT12NS;
  ------------------
  |  |  186|  2.56k|#define BOND_ALT12NS             9
  ------------------
11946|  2.56k|                ret++;
11947|  2.56k|            }
11948|   223k|        }
11949|   288k|    }
11950|       |
11951|   288k|exit_function:
11952|       |
11953|   288k|    return ret;
11954|   288k|}
bHasChargedNeighbor:
11971|  2.60k|{
11972|  2.60k|    int i;
11973|  4.72k|    for (i = 0; i < at[iat].valence; i++)
  ------------------
  |  Branch (11973:17): [True: 3.65k, False: 1.06k]
  ------------------
11974|  3.65k|    {
11975|  3.65k|        if (at[(int) at[iat].neighbor[i]].charge)
  ------------------
  |  Branch (11975:13): [True: 1.53k, False: 2.12k]
  ------------------
11976|  1.53k|        {
11977|  1.53k|            return 1;
11978|  1.53k|        }
11979|  3.65k|    }
11980|       |
11981|  1.06k|    return 0;
11982|  2.60k|}
AddRemoveProtonsRestr:
12029|  1.16k|{
12030|  1.16k|    int i, j, ret = 0;
12031|  1.16k|    int nAtTypeTotals[ATTOT_ARRAY_LEN];
12032|  1.16k|    int   num_prot = *num_protons_to_add;
12033|  1.16k|    int   type, mask, bSuccess, nTotCharge, nNumSuccess = 0;
12034|  1.16k|    int max_j_Aa = -1, max_j_Ar = -1;
12035|       |
12036|       |    /* for the reference:
12037|       |
12038|       |    #define FLAG_NORM_CONSIDER_TAUT      ( FLAG_PROTON_NPO_SIMPLE_REMOVED | \
12039|       |    FLAG_PROTON_NP_HARD_REMOVED    | \
12040|       |    FLAG_PROTON_AC_SIMPLE_ADDED    | \
12041|       |    FLAG_PROTON_AC_SIMPLE_REMOVED  | \
12042|       |    FLAG_PROTON_AC_HARD_REMOVED    | \
12043|       |    FLAG_PROTON_AC_HARD_ADDED      | \
12044|       |    FLAG_PROTON_SINGLE_REMOVED     | \
12045|       |    FLAG_PROTON_CHARGE_CANCEL    )
12046|       |
12047|       |    #define FLAG_FORCE_SALT_TAUT         ( FLAG_PROTON_NP_HARD_REMOVED  | \
12048|       |    FLAG_PROTON_AC_HARD_REMOVED  | \
12049|       |    FLAG_PROTON_AC_HARD_ADDED    )
12050|       |
12051|       |    */
12052|       |
12053|       |    /* if ChargeRevrs > nChargeInChI then we should prevent proton addition or facilitate proton removal
12054|       |    a typical case is (=) on N or O instead of C(-)
12055|       |
12056|       |    if ChargeRevrs < nChargeInChI then we should prevent proton removal or facilitate proton addition
12057|       |    */
12058|       |
12059|  1.16k|    mark_at_type( at, num_atoms, nAtTypeTotals );
12060|  7.09k|    for (i = nTotCharge = 0; i < num_atoms; i++)
  ------------------
  |  Branch (12060:30): [True: 5.93k, False: 1.16k]
  ------------------
12061|  5.93k|    {
12062|  5.93k|        nTotCharge += at[i].charge;
12063|  5.93k|    }
12064|       |    /* Size for SimpleAddAcidicProtons() */
12065|  3.50k|    for (max_j_Aa = 0; AaTypMask[2 * max_j_Aa]; max_j_Aa++)
  ------------------
  |  Branch (12065:24): [True: 2.33k, False: 1.16k]
  ------------------
12066|  2.33k|    {
12067|  2.33k|        ;
12068|  2.33k|    }
12069|       |    /* Size for SimpleRemoveAcidicProtons */
12070|  2.33k|    for (max_j_Ar = 0; ArTypMask[2 * max_j_Ar]; max_j_Ar++)
  ------------------
  |  Branch (12070:24): [True: 1.16k, False: 1.16k]
  ------------------
12071|  1.16k|    {
12072|  1.16k|        ;
12073|  1.16k|    }
12074|  1.16k|    if (num_prot < 0 && nAtTypeTotals[ATTOT_TOT_CHARGE] - nNumProtAddedByRestr <= 0)
  ------------------
  |  Branch (12074:9): [True: 393, False: 774]
  |  Branch (12074:25): [True: 326, False: 67]
  ------------------
12075|    326|    {
12076|       |        /* Remove proton(s) */
12077|       |        /* use test from SimpleAddAcidicProtons() to test whether removal of H(+) from =C-OH, etc. is correct */
12078|  1.42k|        for (i = 0; i < num_atoms && num_prot; i++)
  ------------------
  |  Branch (12078:21): [True: 1.10k, False: 322]
  |  Branch (12078:38): [True: 1.10k, False: 4]
  ------------------
12079|  1.10k|        {
12080|       |            /* Choose an atom */
12081|  1.10k|            if (at[i].sb_parity[0] || at[i].p_parity || at[i].charge ||
  ------------------
  |  Branch (12081:17): [True: 6, False: 1.09k]
  |  Branch (12081:39): [True: 28, False: 1.06k]
  |  Branch (12081:57): [True: 256, False: 813]
  ------------------
12082|    813|                 !at[i].num_H || at[i].radical || bHasChargedNeighbor( at, i ))
  ------------------
  |  Branch (12082:18): [True: 784, False: 29]
  |  Branch (12082:34): [True: 1, False: 28]
  |  Branch (12082:51): [True: 13, False: 15]
  ------------------
12083|  1.08k|            {
12084|  1.08k|                continue;
12085|  1.08k|            }
12086|       |            /* try to remove a proton and check whether InChI would add it back */
12087|     15|            at[i].charge--;
12088|     15|            at[i].num_H--;
12089|     15|            type = GetAtomChargeType( at, i, NULL, &mask, 0 );
12090|     15|            at[i].charge++;
12091|     15|            at[i].num_H++;
12092|       |
12093|     15|            if (type)
  ------------------
  |  Branch (12093:17): [True: 10, False: 5]
  ------------------
12094|     10|            {
12095|     16|                for (bSuccess = 0, j = 0; j < max_j_Aa; j++)
  ------------------
  |  Branch (12095:43): [True: 13, False: 3]
  ------------------
12096|     13|                {
12097|     13|                    if ((bSuccess = ( type & AaTypMask[2 * j] ) && ( mask && AaTypMask[2 * j + 1] ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (12097:25): [True: 7, False: 6]
  |  Branch (12097:37): [True: 7, False: 6]
  |  Branch (12097:70): [True: 7, False: 0]
  |  Branch (12097:78): [True: 7, False: 0]
  ------------------
12098|      7|                    {
12099|      7|                        break; /* the proton may be added to this atom */
12100|      7|                    }
12101|     13|                }
12102|     10|                if (bSuccess)
  ------------------
  |  Branch (12102:21): [True: 7, False: 3]
  ------------------
12103|      7|                {
12104|       |                    /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
12105|      7|                    type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 1 ); /* subtract at[i] */
12106|      7|                    at[i].charge--;
12107|      7|                    at[i].num_H--;
12108|      7|                    type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 0 ); /* add changed at[i] */
12109|      7|                    num_prot++; /* success */
12110|      7|                    nNumSuccess++;
12111|      7|                }
12112|     10|            }
12113|     15|        }
12114|    326|    }
12115|       |
12116|  1.16k|    if (num_prot < 0 && num_tg && nAtTypeTotals[ATTOT_TOT_CHARGE] - nNumProtAddedByRestr <= 0)
  ------------------
  |  Branch (12116:9): [True: 389, False: 778]
  |  Branch (12116:25): [True: 29, False: 360]
  |  Branch (12116:35): [True: 22, False: 7]
  ------------------
12117|     22|    {
12118|       |        /* Alternative proton removal: O=C-NH => (-)O-C=N, O and N are taut. endpoints */
12119|     22|        int endp2, centp, k, i0, k0;
12120|    182|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (12120:21): [True: 160, False: 22]
  ------------------
12121|    160|        {
12122|       |            /* Choose an atom */
12123|    160|            if (!at[i].endpoint || at[i].sb_parity[0] || at[i].p_parity ||
  ------------------
  |  Branch (12123:17): [True: 119, False: 41]
  |  Branch (12123:36): [True: 0, False: 41]
  |  Branch (12123:58): [True: 0, False: 41]
  ------------------
12124|     41|                 at[i].radical || at[i].charge || bHasChargedNeighbor( at, i ))
  ------------------
  |  Branch (12124:18): [True: 2, False: 39]
  |  Branch (12124:35): [True: 3, False: 36]
  |  Branch (12124:51): [True: 17, False: 19]
  ------------------
12125|    141|            {
12126|    141|                continue;
12127|    141|            }
12128|       |            /* Looking for tautomeric =O */
12129|     19|            if (1 != at[i].valence || BOND_TYPE_DOUBLE != at[i].bond_type[0] || at[i].num_H ||
  ------------------
  |  |   33|     17|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (12129:17): [True: 2, False: 17]
  |  Branch (12129:39): [True: 3, False: 14]
  |  Branch (12129:81): [True: 0, False: 14]
  ------------------
12130|     14|                 2 != get_endpoint_valence( at[i].el_number ))
  ------------------
  |  Branch (12130:18): [True: 0, False: 14]
  ------------------
12131|      5|            {
12132|      5|                continue;
12133|      5|            }
12134|     14|            centp = at[i].neighbor[0];
12135|     14|            if (at[centp].sb_parity[0] || at[centp].p_parity || !is_centerpoint_elem( at[centp].el_number ))
  ------------------
  |  Branch (12135:17): [True: 0, False: 14]
  |  Branch (12135:43): [True: 0, False: 14]
  |  Branch (12135:65): [True: 3, False: 11]
  ------------------
12136|      3|            {
12137|      3|                continue;
12138|      3|            }
12139|       |            /* Found a possible centerpoint, looking for -NH endpoint */
12140|     55|            for (k = 0; k < at[centp].valence; k++)
  ------------------
  |  Branch (12140:25): [True: 44, False: 11]
  ------------------
12141|     44|            {
12142|     44|                if (at[centp].bond_type[k] != BOND_TYPE_SINGLE)
  ------------------
  |  |   32|     44|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (12142:21): [True: 17, False: 27]
  ------------------
12143|     17|                {
12144|     17|                    continue;
12145|     17|                }
12146|     27|                endp2 = at[centp].neighbor[k];
12147|     27|                if (at[endp2].endpoint != at[i].endpoint ||
  ------------------
  |  Branch (12147:21): [True: 20, False: 7]
  ------------------
12148|      7|                     !at[endp2].num_H || at[endp2].charge ||
  ------------------
  |  Branch (12148:22): [True: 3, False: 4]
  |  Branch (12148:42): [True: 0, False: 4]
  ------------------
12149|      4|                     at[endp2].sb_parity[0] || at[endp2].p_parity ||
  ------------------
  |  Branch (12149:22): [True: 0, False: 4]
  |  Branch (12149:48): [True: 0, False: 4]
  ------------------
12150|      4|                     at[endp2].valence != at[endp2].chem_bonds_valence ||
  ------------------
  |  Branch (12150:22): [True: 0, False: 4]
  ------------------
12151|      4|                     3 != at[endp2].chem_bonds_valence + at[endp2].num_H ||
  ------------------
  |  Branch (12151:22): [True: 2, False: 2]
  ------------------
12152|      2|                     3 != get_endpoint_valence( at[endp2].el_number ))
  ------------------
  |  Branch (12152:22): [True: 0, False: 2]
  ------------------
12153|     25|                {
12154|     25|                    continue;
12155|     25|                }
12156|       |                /* Find bonds in reciprocal ajacency lists */
12157|      5|                for (i0 = 0; i0 < at[centp].valence && i != at[centp].neighbor[i0]; i0++)
  ------------------
  |  Branch (12157:30): [True: 5, False: 0]
  |  Branch (12157:56): [True: 3, False: 2]
  ------------------
12158|      3|                {
12159|      3|                    ;
12160|      3|                }
12161|      2|                for (k0 = 0; k0 < at[endp2].valence && centp != at[endp2].neighbor[k0]; k0++)
  ------------------
  |  Branch (12161:30): [True: 2, False: 0]
  |  Branch (12161:56): [True: 0, False: 2]
  ------------------
12162|      0|                {
12163|      0|                    ;
12164|      0|                }
12165|      2|                if (i0 == at[centp].valence || k0 == at[endp2].valence)
  ------------------
  |  Branch (12165:21): [True: 0, False: 2]
  |  Branch (12165:48): [True: 0, False: 2]
  ------------------
12166|      0|                {
12167|      0|                    return RI_ERR_PROGR;
  ------------------
  |  |11963|      0|#define RI_ERR_PROGR   (-3)
  ------------------
12168|      0|                }
12169|       |                /* -NH has been found */
12170|       |                /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
12171|      2|                type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 1 ); /* subtract at[i] */
12172|      2|                type = GetAtomChargeType( at, endp2, nAtTypeTotals, &mask, 1 ); /* subtract at[endp2] */
12173|       |
12174|      2|                at[i].bond_type[0] --;
12175|      2|                at[centp].bond_type[i0] --;
12176|      2|                at[i].chem_bonds_valence--;
12177|      2|                at[i].charge--;
12178|       |
12179|      2|                at[endp2].bond_type[k0] ++;
12180|      2|                at[centp].bond_type[k] ++;
12181|      2|                at[endp2].chem_bonds_valence++;
12182|      2|                at[endp2].num_H--;
12183|       |
12184|      2|                num_prot++;
12185|      2|                nNumSuccess++;
12186|       |
12187|       |                /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
12188|      2|                type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 0 ); /* add at[i] */
12189|      2|                type = GetAtomChargeType( at, endp2, nAtTypeTotals, &mask, 0 ); /* add at[endp2] */
12190|      2|            }
12191|     11|        }
12192|     22|    }
12193|       |
12194|  1.16k|    if (num_prot > 0)
  ------------------
  |  Branch (12194:9): [True: 774, False: 393]
  ------------------
12195|    774|    {
12196|       |        /* Add protons */
12197|       |        /* 1. Use test from SimpleRemoveAcidicProtons() to test whether addition of H(+) to =C-O(-), etc. is correct */
12198|  2.51k|        for (i = 0; i < num_atoms && num_prot && nAtTypeTotals[ATTOT_TOT_CHARGE] - nNumProtAddedByRestr >= 0; i++)
  ------------------
  |  Branch (12198:21): [True: 2.22k, False: 297]
  |  Branch (12198:38): [True: 2.22k, False: 1]
  |  Branch (12198:50): [True: 1.74k, False: 476]
  ------------------
12199|  1.74k|        {
12200|       |            /* Choose an atom */
12201|  1.74k|            if (at[i].sb_parity[0] || at[i].p_parity || at[i].num_H ||
  ------------------
  |  Branch (12201:17): [True: 10, False: 1.73k]
  |  Branch (12201:39): [True: 14, False: 1.72k]
  |  Branch (12201:57): [True: 7, False: 1.71k]
  ------------------
12202|  1.71k|                 at[i].charge != -1 || at[i].radical || bHasChargedNeighbor( at, i ))
  ------------------
  |  Branch (12202:18): [True: 1.41k, False: 302]
  |  Branch (12202:40): [True: 31, False: 271]
  |  Branch (12202:57): [True: 81, False: 190]
  ------------------
12203|  1.55k|            {
12204|  1.55k|                continue;
12205|  1.55k|            }
12206|       |            /* Try to add a proton and check whether InChI would remove it back */
12207|    190|            at[i].charge++;
12208|    190|            at[i].num_H++;
12209|    190|            type = GetAtomChargeType( at, i, NULL, &mask, 0 );
12210|    190|            at[i].charge--;
12211|    190|            at[i].num_H--;
12212|    190|            if (type)
  ------------------
  |  Branch (12212:17): [True: 120, False: 70]
  ------------------
12213|    120|            {
12214|    197|                for (bSuccess = 0, j = 0; j < max_j_Ar; j++)
  ------------------
  |  Branch (12214:43): [True: 120, False: 77]
  ------------------
12215|    120|                {   
12216|    120|                    if ((bSuccess = ( type & ArTypMask[2 * j] ) && ( mask && ArTypMask[2 * j + 1] ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (12216:25): [True: 43, False: 77]
  |  Branch (12216:37): [True: 43, False: 77]
  |  Branch (12216:70): [True: 43, False: 0]
  |  Branch (12216:78): [True: 43, False: 0]
  ------------------
12217|     43|                    {
12218|     43|                        break;
12219|     43|                    }
12220|    120|                }
12221|    120|                if (bSuccess)
  ------------------
  |  Branch (12221:21): [True: 43, False: 77]
  ------------------
12222|     43|                {
12223|       |                    /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
12224|     43|                    type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 1 ); /* subtract at[i] */
12225|     43|                    at[i].charge++;
12226|     43|                    at[i].num_H++;
12227|     43|                    type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 0 ); /* add changed at[i] */
12228|     43|                    num_prot--; /* success */
12229|     43|                    nNumSuccess++;
12230|     43|                }
12231|    120|            }
12232|    190|        }
12233|       |        /* 2. Use test from SimpleRemoveHplusNPO() */
12234|  4.95k|        for (i = 0; i < num_atoms && num_prot; i++)
  ------------------
  |  Branch (12234:21): [True: 4.24k, False: 704]
  |  Branch (12234:38): [True: 4.17k, False: 70]
  ------------------
12235|  4.17k|        {
12236|       |            /* Choose an atom */
12237|  4.17k|            if (at[i].sb_parity[0] || at[i].p_parity ||
  ------------------
  |  Branch (12237:17): [True: 24, False: 4.15k]
  |  Branch (12237:39): [True: 17, False: 4.13k]
  ------------------
12238|  4.13k|                 at[i].charge || at[i].radical || bHasChargedNeighbor( at, i ))
  ------------------
  |  Branch (12238:18): [True: 1.72k, False: 2.41k]
  |  Branch (12238:34): [True: 144, False: 2.26k]
  |  Branch (12238:51): [True: 1.42k, False: 844]
  ------------------
12239|  3.33k|            {
12240|  3.33k|                continue;
12241|  3.33k|            }
12242|       |            /* Try to add a proton and check whether InChI would remove it back */
12243|    844|            at[i].num_H++;
12244|    844|            at[i].charge++;
12245|    844|            bSuccess = ( PR_SIMPLE_TYP & ( type = GetAtomChargeType( at, i, NULL, &mask, 0 ) ) ) &&
  ------------------
  |  |  137|    844|#define PR_SIMPLE_TYP  (ATT_ATOM_N | ATT_ATOM_P | ATT_O_PLUS)
  |  |  ------------------
  |  |  |  |   37|    844|#define ATT_ATOM_N 0x0040
  |  |  ------------------
  |  |               #define PR_SIMPLE_TYP  (ATT_ATOM_N | ATT_ATOM_P | ATT_O_PLUS)
  |  |  ------------------
  |  |  |  |   38|    844|#define ATT_ATOM_P 0x0080
  |  |  ------------------
  |  |               #define PR_SIMPLE_TYP  (ATT_ATOM_N | ATT_ATOM_P | ATT_O_PLUS)
  |  |  ------------------
  |  |  |  |   42|    844|#define ATT_O_PLUS 0x0800   /**< -OH2(+), =OH(+), -OH(+)-, OH3(+), =O(+)-, etc; O=O,S,Se,Te */
  |  |  ------------------
  ------------------
  |  Branch (12245:24): [True: 298, False: 546]
  ------------------
12246|    298|                ( PR_SIMPLE_MSK & mask ); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  |  136|    298|#define PR_SIMPLE_MSK  (ATBIT_NP_Proton | ATBIT_OH_Plus)
  |  |  ------------------
  |  |  |  |   93|    298|#define ATBIT_NP_Proton  (1 << ATTOT_NUM_NP_Proton)
  |  |  ------------------
  |  |               #define PR_SIMPLE_MSK  (ATBIT_NP_Proton | ATBIT_OH_Plus)
  |  |  ------------------
  |  |  |  |  117|    298|#define ATBIT_OH_Plus    (1 << ATTOT_NUM_OH_Plus)
  |  |  ------------------
  ------------------
  |  Branch (12246:17): [True: 298, False: 0]
  ------------------
12247|    844|            at[i].num_H--;  /* failed */
12248|    844|            at[i].charge--;
12249|    844|            if (bSuccess)
  ------------------
  |  Branch (12249:17): [True: 298, False: 546]
  ------------------
12250|    298|            {
12251|       |                /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
12252|    298|                type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 1 ); /* subtract at[i] */
12253|    298|                at[i].num_H++;
12254|    298|                at[i].charge++;
12255|    298|                type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 0 ); /* add changed at[i] */
12256|    298|                num_prot--;     /* succeeded */
12257|    298|                nNumSuccess++;
12258|    298|            }
12259|    844|        }
12260|    774|    }
12261|       |
12262|  1.16k|    if (num_prot < 0 && ( bNormalizationFlags & FLAG_PROTON_AC_HARD_ADDED ) && 1 == num_tg &&
  ------------------
  |  |  151|    388|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  ------------------
  |  Branch (12262:9): [True: 388, False: 779]
  |  Branch (12262:25): [True: 0, False: 388]
  |  Branch (12262:80): [True: 0, False: 0]
  ------------------
12263|      0|         nAtTypeTotals[ATTOT_TOT_CHARGE] - nNumProtAddedByRestr <= 0)
  ------------------
  |  Branch (12263:10): [True: 0, False: 0]
  ------------------
12264|      0|    {
12265|       |        /* Try to remove protons from tautomeric N (specific ADP must be present) */
12266|      0|        int nNumAcceptors_DB_O = 0, nNumDonors_SB_NH = 0, num_max, num_success;
12267|      0|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (12267:21): [True: 0, False: 0]
  ------------------
12268|      0|        {
12269|       |            /* Choose an atom */
12270|      0|            if (!at[i].endpoint || at[i].radical ||
  ------------------
  |  Branch (12270:17): [True: 0, False: 0]
  |  Branch (12270:36): [True: 0, False: 0]
  ------------------
12271|      0|                 at[i].sb_parity[0] || at[i].p_parity || bHasChargedNeighbor( at, i ))
  ------------------
  |  Branch (12271:18): [True: 0, False: 0]
  |  Branch (12271:40): [True: 0, False: 0]
  |  Branch (12271:58): [True: 0, False: 0]
  ------------------
12272|      0|            {
12273|      0|                continue;
12274|      0|            }
12275|      0|            type = GetAtomChargeType( at, i, NULL, &mask, 0 );
12276|      0|            if (( type & AA_HARD_TYP_CO ) && ( mask & AA_HARD_MSK_CO ))
  ------------------
  |  |  222|      0|#define AA_HARD_TYP_CO    (ATT_ACIDIC_CO | ATT_NO)
  |  |  ------------------
  |  |  |  |   31|      0|#define ATT_ACIDIC_CO 0x0001
  |  |  ------------------
  |  |               #define AA_HARD_TYP_CO    (ATT_ACIDIC_CO | ATT_NO)
  |  |  ------------------
  |  |  |  |   35|      0|#define ATT_NO 0x0010
  |  |  ------------------
  ------------------
                          if (( type & AA_HARD_TYP_CO ) && ( mask & AA_HARD_MSK_CO ))
  ------------------
  |  |  221|      0|#define AA_HARD_MSK_CO    (ATBIT_CO | ATBIT_NO )
  |  |  ------------------
  |  |  |  |  105|      0|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  ------------------
  |  |               #define AA_HARD_MSK_CO    (ATBIT_CO | ATBIT_NO )
  |  |  ------------------
  |  |  |  |  107|      0|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  ------------------
  ------------------
  |  Branch (12276:17): [True: 0, False: 0]
  |  Branch (12276:46): [True: 0, False: 0]
  ------------------
12277|      0|            {
12278|      0|                nNumAcceptors_DB_O++;
12279|      0|            }
12280|      0|            else
12281|      0|            {
12282|      0|                if (( type == ATT_ATOM_N ) && ( mask == ATBIT_NP_H ) && !at[i].charge &&
  ------------------
  |  |   37|      0|#define ATT_ATOM_N 0x0040
  ------------------
                              if (( type == ATT_ATOM_N ) && ( mask == ATBIT_NP_H ) && !at[i].charge &&
  ------------------
  |  |   94|      0|#define ATBIT_NP_H       (1 << ATTOT_NUM_NP_H)
  ------------------
  |  Branch (12282:21): [True: 0, False: 0]
  |  Branch (12282:47): [True: 0, False: 0]
  |  Branch (12282:73): [True: 0, False: 0]
  ------------------
12283|      0|                     at[i].valence == at[i].chem_bonds_valence)
  ------------------
  |  Branch (12283:22): [True: 0, False: 0]
  ------------------
12284|      0|                {
12285|      0|                    nNumDonors_SB_NH++;
12286|      0|                }
12287|      0|            }
12288|      0|        }
12289|      0|        num_max = inchi_min( nNumAcceptors_DB_O, nNumDonors_SB_NH );
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
12290|      0|        for (i = 0, num_success = 0; i < num_atoms && num_success < num_max && num_prot < 0; i++)
  ------------------
  |  Branch (12290:38): [True: 0, False: 0]
  |  Branch (12290:55): [True: 0, False: 0]
  |  Branch (12290:80): [True: 0, False: 0]
  ------------------
12291|      0|        {
12292|       |            /* Choose an atom */
12293|      0|            if (!at[i].endpoint || at[i].radical || at[i].sb_parity[0] ||
  ------------------
  |  Branch (12293:17): [True: 0, False: 0]
  |  Branch (12293:36): [True: 0, False: 0]
  |  Branch (12293:53): [True: 0, False: 0]
  ------------------
12294|      0|                 at[i].p_parity || bHasChargedNeighbor( at, i ))
  ------------------
  |  Branch (12294:18): [True: 0, False: 0]
  |  Branch (12294:36): [True: 0, False: 0]
  ------------------
12295|      0|            {
12296|      0|                continue;
12297|      0|            }
12298|      0|            type = GetAtomChargeType( at, i, NULL, &mask, 0 );
12299|      0|            if (( type == ATT_ATOM_N ) && ( mask == ATBIT_NP_H ) && !at[i].charge &&
  ------------------
  |  |   37|      0|#define ATT_ATOM_N 0x0040
  ------------------
                          if (( type == ATT_ATOM_N ) && ( mask == ATBIT_NP_H ) && !at[i].charge &&
  ------------------
  |  |   94|      0|#define ATBIT_NP_H       (1 << ATTOT_NUM_NP_H)
  ------------------
  |  Branch (12299:17): [True: 0, False: 0]
  |  Branch (12299:43): [True: 0, False: 0]
  |  Branch (12299:69): [True: 0, False: 0]
  ------------------
12300|      0|                 at[i].valence == at[i].chem_bonds_valence)
  ------------------
  |  Branch (12300:18): [True: 0, False: 0]
  ------------------
12301|      0|            {
12302|       |                /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
12303|      0|                type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 1 ); /* subtract at[i] */
12304|      0|                at[i].num_H--;
12305|      0|                at[i].charge--;
12306|      0|                type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 0 ); /* add changed at[i] */
12307|      0|                num_prot++;
12308|      0|                num_success++;
12309|      0|                nNumSuccess++;
12310|      0|            }
12311|      0|        }
12312|      0|    }
12313|       |
12314|       |    /*exit_function:*/
12315|       |
12316|  1.16k|    *num_protons_to_add = num_prot;
12317|       |
12318|  1.16k|    return ret < 0 ? ret : nNumSuccess;
  ------------------
  |  Branch (12318:12): [True: 0, False: 1.16k]
  ------------------
12319|  1.16k|}
AddRemoveIsoProtonsRestr:
12329|  1.53k|{
12330|  1.53k|    int i, j, k, n, ret = 0;
12331|  1.53k|    int   nNumSuccess = 0, min_at, max_at, num_H, num_iso_H, num_expl_H, num_expl_iso_H; /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
12332|  1.53k|    int   iCurIso; /* 0=> 1H, 1=> D, 2=> T */
12333|  1.53k|    int   iCurMode, iCurMode1, iCurMode2; /* 0=> Not Endpoints, 1=> Endpoints */
12334|       |
12335|       |                                          /* Distribute isotopes from  heaviest to lightest; pick up atoms in order 1. Not endpoints; 2. Endpoints */
12336|  1.53k|    iCurMode1 = 0;
12337|  1.53k|    iCurMode2 = num_tg ? 1 : 0;
  ------------------
  |  Branch (12337:17): [True: 3, False: 1.52k]
  ------------------
12338|  3.05k|    for (iCurMode = iCurMode1; iCurMode <= iCurMode2; iCurMode++)
  ------------------
  |  Branch (12338:32): [True: 1.53k, False: 1.52k]
  ------------------
12339|  1.53k|    {
12340|  6.11k|        for (iCurIso = 2; 0 <= iCurIso; iCurIso--)
  ------------------
  |  Branch (12340:27): [True: 4.58k, False: 1.52k]
  ------------------
12341|  4.58k|        {
12342|       |            /* check for isotopic H to add */
12343|  4.58k|            if (!num_protons_to_add[iCurIso])
  ------------------
  |  Branch (12343:17): [True: 3.02k, False: 1.56k]
  ------------------
12344|  3.02k|            {
12345|  3.02k|                continue;
12346|  3.02k|            }
12347|  1.56k|            if (0 > num_protons_to_add[iCurIso])
  ------------------
  |  Branch (12347:17): [True: 5, False: 1.55k]
  ------------------
12348|      5|            {
12349|      5|                ret = RI_ERR_PROGR;
  ------------------
  |  |11963|      5|#define RI_ERR_PROGR   (-3)
  ------------------
12350|      5|                goto exit_function;
12351|      5|            }
12352|       |
12353|       |            /* Limits for atom scanning */
12354|  1.55k|            min_at = 0;
12355|  1.55k|            max_at = num_atoms;
12356|       |
12357|       |            /* Cycle withio the limits */
12358|  4.95k|            for (i = min_at; i < max_at && 0 < num_protons_to_add[iCurIso]; i++)
  ------------------
  |  Branch (12358:30): [True: 3.43k, False: 1.52k]
  |  Branch (12358:44): [True: 3.40k, False: 32]
  ------------------
12359|  3.40k|            {
12360|       |                /* Pick an atom */
12361|  3.40k|                if (iCurMode)
  ------------------
  |  Branch (12361:21): [True: 12, False: 3.38k]
  ------------------
12362|     12|                {
12363|     12|                    if (at[i].endpoint)
  ------------------
  |  Branch (12363:25): [True: 3, False: 9]
  ------------------
12364|      3|                    {
12365|      3|                        j = i;  /* atom number */
12366|      3|                    }
12367|      9|                    else
12368|      9|                    {
12369|      9|                        continue;
12370|      9|                    }
12371|     12|                }
12372|  3.38k|                else
12373|  3.38k|                {
12374|  3.38k|                    if (!at[i].endpoint && 1 == bHeteroAtomMayHaveXchgIsoH( at, i ))
  ------------------
  |  Branch (12374:25): [True: 3.38k, False: 4]
  |  Branch (12374:44): [True: 249, False: 3.13k]
  ------------------
12375|    249|                    { /* atom number */
12376|    249|                        j = i;
12377|    249|                    }
12378|  3.14k|                    else
12379|  3.14k|                    {
12380|  3.14k|                        if (at[i].el_number == EL_NUMBER_H && at[i].charge == 1 &&
  ------------------
  |  |   11|  6.28k|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
  |  Branch (12380:29): [True: 1.41k, False: 1.72k]
  |  Branch (12380:63): [True: 651, False: 763]
  ------------------
12381|    651|                             !at[i].valence && !at[i].radical && !at[i].iso_atw_diff)
  ------------------
  |  Branch (12381:30): [True: 651, False: 0]
  |  Branch (12381:48): [True: 651, False: 0]
  |  Branch (12381:66): [True: 584, False: 67]
  ------------------
12382|    584|                        {
12383|       |                            /* proton, not isotopic; make it isotopic */
12384|    584|                            at[i].iso_atw_diff = 1 + iCurIso;
12385|    584|                            num_protons_to_add[iCurIso] --;
12386|    584|                            nNumSuccess++;
12387|    584|                            continue;
12388|    584|                        }
12389|  2.55k|                        else
12390|  2.55k|                        {
12391|  2.55k|                            continue;
12392|  2.55k|                        }
12393|  3.14k|                    }
12394|  3.38k|                }
12395|       |
12396|       |                /* j is the atom number */
12397|       |                /* count implicit H */
12398|    252|                num_H = at[j].num_H;
12399|    252|                num_iso_H = NUM_ISO_H(at, j); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |   55|    252|#define NUM_ISO_H(AT, N) (AT[N].num_iso_H[0] + AT[N].num_iso_H[1] + AT[N].num_iso_H[2])
  ------------------
12400|       |
12401|    456|                while (num_H > 0 && num_protons_to_add[iCurIso] > 0)
  ------------------
  |  Branch (12401:24): [True: 215, False: 241]
  |  Branch (12401:37): [True: 204, False: 11]
  ------------------
12402|    204|                {
12403|       |                    /* Substitute one implicit H with an isotopic atom H */
12404|    204|                    at[j].num_iso_H[iCurIso] ++;
12405|    204|                    at[j].num_H--;
12406|    204|                    num_protons_to_add[iCurIso] --;
12407|    204|                    num_H--;
12408|    204|                    num_iso_H++;
12409|    204|                    nNumSuccess++;
12410|    204|                }
12411|       |                /* Count explicit H */
12412|    252|                num_expl_H = num_expl_iso_H = 0;
12413|    252|                for (k = 0; k < at[j].valence && num_atoms <= ( n = at[j].neighbor[k] ); k++)
  ------------------
  |  Branch (12413:29): [True: 252, False: 0]
  |  Branch (12413:50): [True: 0, False: 252]
  ------------------
12414|      0|                {
12415|      0|                    num_expl_H += ( 0 == at[n].iso_atw_diff );
12416|      0|                    num_expl_iso_H += ( 0 != at[n].iso_atw_diff );
12417|      0|                }
12418|    252|                while (num_expl_H > 0 && num_protons_to_add[iCurIso] > 0)
  ------------------
  |  Branch (12418:24): [True: 0, False: 252]
  |  Branch (12418:42): [True: 0, False: 0]
  ------------------
12419|      0|                {
12420|       |                    /* Substitute one explicit H with an isotopic atom H */
12421|      0|                    n = at[j].neighbor[num_expl_H];
12422|      0|                    if (at[n].iso_atw_diff)
  ------------------
  |  Branch (12422:25): [True: 0, False: 0]
  ------------------
12423|      0|                    {
12424|      0|                        ret = RI_ERR_PROGR;
  ------------------
  |  |11963|      0|#define RI_ERR_PROGR   (-3)
  ------------------
12425|      0|                        goto exit_function;
12426|      0|                    }
12427|      0|                    at[n].iso_atw_diff = 1 + iCurIso;
12428|      0|                    num_expl_H--;
12429|      0|                    num_expl_iso_H++;
12430|      0|                    num_protons_to_add[iCurIso] --;
12431|      0|                    nNumSuccess++;
12432|      0|                }
12433|    252|            }
12434|  1.55k|        }
12435|  1.53k|    }
12436|       |
12437|  1.53k|exit_function:
12438|       |
12439|  1.53k|    return ret < 0 ? ret : nNumSuccess;
  ------------------
  |  Branch (12439:12): [True: 5, False: 1.52k]
  ------------------
12440|  1.53k|}
ichi_bns.c:remove_alt_bond_marks:
 1953|   288k|{
 1954|   288k|    int i, j, val;
 1955|  1.38M|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1955:17): [True: 1.09M, False: 288k]
  ------------------
 1956|  1.09M|    {
 1957|  1.57M|        for (val = at[i].valence, j = 0; j < val; j++)
  ------------------
  |  Branch (1957:42): [True: 479k, False: 1.09M]
  ------------------
 1958|   479k|        {
 1959|   479k|            at[i].bond_type[j] &= BOND_TYPE_MASK;
  ------------------
  |  |  189|   479k|#define BOND_TYPE_MASK        0x0f
  ------------------
 1960|   479k|        }
 1961|  1.09M|    }
 1962|       |
 1963|   288k|}

inchi_ios_init:
   51|  44.5k|{
   52|  44.5k|    memset(ios, 0, sizeof(*ios)); /* djb-rwth: memset_s C11/Annex K variant? */
   53|  44.5k|    switch (io_type)
   54|  44.5k|    {
   55|      0|    case INCHI_IOS_TYPE_FILE:
  ------------------
  |  | 1017|      0|#define INCHI_IOS_TYPE_FILE 2
  ------------------
  |  Branch (55:5): [True: 0, False: 44.5k]
  ------------------
   56|      0|        ios->type = INCHI_IOS_TYPE_FILE;
  ------------------
  |  | 1017|      0|#define INCHI_IOS_TYPE_FILE 2
  ------------------
   57|      0|        break;
   58|  44.5k|    case INCHI_IOS_TYPE_STRING:
  ------------------
  |  | 1016|  44.5k|#define INCHI_IOS_TYPE_STRING 1
  ------------------
  |  Branch (58:5): [True: 44.5k, False: 0]
  ------------------
   59|  44.5k|    default:
  ------------------
  |  Branch (59:5): [True: 0, False: 44.5k]
  ------------------
   60|  44.5k|        ios->type = INCHI_IOS_TYPE_STRING;
  ------------------
  |  | 1016|  44.5k|#define INCHI_IOS_TYPE_STRING 1
  ------------------
   61|  44.5k|        break;
   62|  44.5k|    }
   63|  44.5k|    ios->f = f;
   64|  44.5k|    return;
   65|  44.5k|}
inchi_ios_close:
  195|  31.8k|{
  196|  31.8k|    if (NULL == ios)
  ------------------
  |  Branch (196:9): [True: 0, False: 31.8k]
  ------------------
  197|      0|    {
  198|      0|        return;
  199|      0|    }
  200|  31.8k|    if (ios->s.pStr)
  ------------------
  |  Branch (200:9): [True: 6.28k, False: 25.5k]
  ------------------
  201|  6.28k|    {
  202|  6.28k|        inchi_free(ios->s.pStr);
  ------------------
  |  | 1152|  6.28k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 6.28k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 6.28k]
  |  |  ------------------
  ------------------
  203|  6.28k|    }
  204|  31.8k|    ios->s.pStr = NULL;
  205|  31.8k|    ios->s.nUsedLength = ios->s.nAllocatedLength = ios->s.nPtr = 0;
  206|       |
  207|  31.8k|    if (NULL != ios->f && stdout != ios->f && stderr != ios->f && stdin != ios->f)
  ------------------
  |  Branch (207:9): [True: 0, False: 31.8k]
  |  Branch (207:27): [True: 0, False: 0]
  |  Branch (207:47): [True: 0, False: 0]
  |  Branch (207:67): [True: 0, False: 0]
  ------------------
  208|      0|    {
  209|      0|        fclose(ios->f);
  210|      0|    }
  211|       |
  212|  31.8k|    return;
  213|  31.8k|}
inchi_ios_reset:
  221|  6.37k|{
  222|  6.37k|    ios->s.pStr = NULL;
  223|  6.37k|    ios->s.nUsedLength = ios->s.nAllocatedLength = ios->s.nPtr = 0;
  224|  6.37k|    if (NULL != ios->f && stdout != ios->f && stderr != ios->f && stdin != ios->f)
  ------------------
  |  Branch (224:9): [True: 0, False: 6.37k]
  |  Branch (224:27): [True: 0, False: 0]
  |  Branch (224:47): [True: 0, False: 0]
  |  Branch (224:67): [True: 0, False: 0]
  ------------------
  225|      0|    {
  226|      0|        fclose(ios->f);
  227|      0|    }
  228|       |
  229|  6.37k|    return;
  230|  6.37k|}
inchi_ios_print:
  443|    487|{
  444|    487|    int ret = 0, ret2 = 0;
  445|    487|    va_list argList;
  446|       |
  447|    487|    if (!ios)
  ------------------
  |  Branch (447:9): [True: 0, False: 487]
  ------------------
  448|      0|    {
  449|      0|        return -1;
  450|      0|    }
  451|       |
  452|    487|    if (ios->type == INCHI_IOS_TYPE_STRING)
  ------------------
  |  | 1016|    487|#define INCHI_IOS_TYPE_STRING 1
  ------------------
  |  Branch (452:9): [True: 487, False: 0]
  ------------------
  453|    487|    {
  454|       |        /* output to string buffer */
  455|    487|        int max_len;
  456|    487|        my_va_start(argList, lpszFormat);
  ------------------
  |  |   22|    487|#define my_va_start va_start
  ------------------
  457|    487|        max_len = GetMaxPrintfLength(lpszFormat, argList);
  458|    487|        va_end(argList);
  459|    487|        if (max_len >= 0)
  ------------------
  |  Branch (459:13): [True: 487, False: 0]
  ------------------
  460|    487|        {
  461|       |            /* djb-rwth: fixing oss-fuzz issue #30152 */
  462|    487|            int  nAddLength = inchi_max(INCHI_ADD_STR_LEN, max_len);
  ------------------
  |  |  138|    487|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 469, False: 18]
  |  |  ------------------
  ------------------
  463|    487|            long long new_str_len = (long long)ios->s.nAllocatedLength + (long long)nAddLength;
  464|    487|            if (ios->s.nAllocatedLength - ios->s.nUsedLength <= max_len)
  ------------------
  |  Branch (464:17): [True: 487, False: 0]
  ------------------
  465|    487|            {
  466|       |                /* enlarge output string */
  467|    487|                char* new_str = (char*)inchi_calloc(new_str_len, sizeof(char)); /* djb-rwth: cast operators added */
  ------------------
  |  | 1146|    487|#define inchi_calloc   calloc
  ------------------
  468|    487|                if (new_str)
  ------------------
  |  Branch (468:21): [True: 487, False: 0]
  ------------------
  469|    487|                {
  470|    487|                    if (ios->s.pStr)
  ------------------
  |  Branch (470:25): [True: 0, False: 487]
  ------------------
  471|      0|                    {
  472|      0|                        if (ios->s.nUsedLength > 0)
  ------------------
  |  Branch (472:29): [True: 0, False: 0]
  ------------------
  473|      0|                        {
  474|      0|                            memcpy(new_str, ios->s.pStr, sizeof(new_str[0]) * ios->s.nUsedLength);
  475|      0|                        }
  476|      0|                        inchi_free(ios->s.pStr);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  477|      0|                    }
  478|    487|                    ios->s.pStr = new_str;
  479|    487|                    ios->s.nAllocatedLength += nAddLength;
  480|    487|                }
  481|      0|                else
  482|      0|                {
  483|      0|                    return -1; /* failed */
  484|      0|                }
  485|    487|            }
  486|       |            /* output */
  487|    487|            my_va_start(argList, lpszFormat);
  ------------------
  |  |   22|    487|#define my_va_start va_start
  ------------------
  488|    487|            ret = vsprintf(ios->s.pStr + ios->s.nUsedLength, lpszFormat, argList); /* djb-rwth: not using vsnprintf due to variable length argument */
  489|    487|            va_end(argList);
  490|    487|            if (ret >= 0)
  ------------------
  |  Branch (490:17): [True: 487, False: 0]
  ------------------
  491|    487|            {
  492|    487|                ios->s.nUsedLength += ret;
  493|    487|            }
  494|       |#ifdef TARGET_LIB_FOR_WINCHI
  495|       |#if 0
  496|       |            if (FWPRINT)
  497|       |            {
  498|       |                my_va_start(argList, lpszFormat);
  499|       |                FWPRINT(lpszFormat, argList);
  500|       |                va_end(argList);
  501|       |            }
  502|       |#endif
  503|       |#endif
  504|    487|            return ret;
  505|    487|        }
  506|      0|        return -1;
  507|    487|    }
  508|       |
  509|      0|    else if (ios->type == INCHI_IOS_TYPE_FILE)
  ------------------
  |  | 1017|      0|#define INCHI_IOS_TYPE_FILE 2
  ------------------
  |  Branch (509:14): [True: 0, False: 0]
  ------------------
  510|      0|    {
  511|       |        /* output to file */
  512|      0|        if (ios->f)
  ------------------
  |  Branch (512:13): [True: 0, False: 0]
  ------------------
  513|      0|        {
  514|      0|            my_va_start(argList, lpszFormat);
  ------------------
  |  |   22|      0|#define my_va_start va_start
  ------------------
  515|      0|            ret = vfprintf(ios->f, lpszFormat, argList);
  516|      0|            va_end(argList);
  517|      0|        }
  518|      0|        else
  519|      0|        {
  520|      0|            my_va_start(argList, lpszFormat);
  ------------------
  |  |   22|      0|#define my_va_start va_start
  ------------------
  521|      0|            ret2 = vfprintf(stdout, lpszFormat, argList);
  522|      0|            va_end(argList);
  523|      0|        }
  524|       |#ifdef TARGET_LIB_FOR_WINCHI
  525|       |        if (FWPRINT)
  526|       |        {
  527|       |            my_va_start(argList, lpszFormat);
  528|       |            FWPRINT(lpszFormat, argList);
  529|       |            va_end(argList);
  530|       |        }
  531|       |#endif
  532|      0|        return ret ? ret : ret2;
  ------------------
  |  Branch (532:16): [True: 0, False: 0]
  ------------------
  533|      0|    }
  534|       |
  535|       |    /* no output */
  536|      0|    return 0;
  537|    487|}
inchi_ios_print_nodisplay:
  572|  34.4k|{
  573|  34.4k|    va_list argList;
  574|       |
  575|  34.4k|    if (!ios)
  ------------------
  |  Branch (575:9): [True: 0, False: 34.4k]
  ------------------
  576|      0|    {
  577|      0|        return -1;
  578|      0|    }
  579|       |
  580|  34.4k|    if (ios->type == INCHI_IOS_TYPE_STRING)
  ------------------
  |  | 1016|  34.4k|#define INCHI_IOS_TYPE_STRING 1
  ------------------
  |  Branch (580:9): [True: 34.4k, False: 0]
  ------------------
  581|  34.4k|    {
  582|       |        /* output to string buffer */
  583|  34.4k|        int ret = 0, max_len;
  584|  34.4k|        my_va_start( argList, lpszFormat );
  ------------------
  |  |   22|  34.4k|#define my_va_start va_start
  ------------------
  585|  34.4k|        max_len = GetMaxPrintfLength( lpszFormat, argList );
  586|  34.4k|        va_end( argList );
  587|  34.4k|        if (max_len >= 0)
  ------------------
  |  Branch (587:13): [True: 34.4k, False: 0]
  ------------------
  588|  34.4k|        {
  589|       |            /* djb-rwth: fixing oss-fuzz issue #30163 */
  590|  34.4k|            int  nAddLength = inchi_max(INCHI_ADD_STR_LEN, max_len);
  ------------------
  |  |  138|  34.4k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 34.3k, False: 23]
  |  |  ------------------
  ------------------
  591|  34.4k|            long long new_str_len = (long long)ios->s.nAllocatedLength + (long long)nAddLength;
  592|  34.4k|            if (ios->s.nAllocatedLength - ios->s.nUsedLength <= max_len)
  ------------------
  |  Branch (592:17): [True: 11.3k, False: 23.1k]
  ------------------
  593|  11.3k|            {
  594|       |                /* enlarge output string */
  595|  11.3k|                char* new_str = (char*)inchi_calloc(new_str_len, sizeof(new_str[0])); /* djb-rwth: cast operators added */
  ------------------
  |  | 1146|  11.3k|#define inchi_calloc   calloc
  ------------------
  596|  11.3k|                if (new_str)
  ------------------
  |  Branch (596:21): [True: 11.3k, False: 0]
  ------------------
  597|  11.3k|                {
  598|  11.3k|                    if (ios->s.pStr)
  ------------------
  |  Branch (598:25): [True: 0, False: 11.3k]
  ------------------
  599|      0|                    {
  600|      0|                        if (ios->s.nUsedLength > 0)
  ------------------
  |  Branch (600:29): [True: 0, False: 0]
  ------------------
  601|      0|                        {
  602|      0|                            memcpy( new_str, ios->s.pStr, sizeof( new_str[0] )*ios->s.nUsedLength );
  603|      0|                        }
  604|      0|                        inchi_free( ios->s.pStr );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  605|      0|                    }
  606|  11.3k|                    ios->s.pStr = new_str;
  607|  11.3k|                    ios->s.nAllocatedLength += nAddLength;
  608|  11.3k|                }
  609|      0|                else
  610|      0|                {
  611|      0|                    return -1; /* failed */
  612|      0|                }
  613|  11.3k|            }
  614|       |            /* output */
  615|       |            /* djb-rwth: fixing oss-fuzz issue #67676 */
  616|  34.4k|            my_va_start(argList, lpszFormat);
  ------------------
  |  |   22|  34.4k|#define my_va_start va_start
  ------------------
  617|  34.4k|            size_t remaining_length = (size_t)(ios->s.nAllocatedLength - ios->s.nUsedLength);
  618|  34.4k|            ret = vsnprintf(ios->s.pStr + ios->s.nUsedLength, remaining_length, lpszFormat, argList);
  619|  34.4k|            va_end(argList);
  620|       |
  621|       |            /* djb-rwth: if vsnprintf fails, try again with + 1 */
  622|  34.4k|            if (ret < 0 || (size_t)ret >= remaining_length)
  ------------------
  |  Branch (622:17): [True: 0, False: 34.4k]
  |  Branch (622:28): [True: 23, False: 34.3k]
  ------------------
  623|     23|            {
  624|     23|                long long str_length_extension;
  625|     23|                if (ret >= 0)
  ------------------
  |  Branch (625:21): [True: 23, False: 0]
  ------------------
  626|     23|                {
  627|     23|                    str_length_extension = (long long)ret + 1;
  628|     23|                }
  629|      0|                else
  630|      0|                {
  631|      0|                    str_length_extension = (long long)max_len + 1;
  632|      0|                }
  633|     23|                long long new_str_length = (long long)ios->s.nAllocatedLength + str_length_extension;
  634|     23|                char* new_str = (char*)inchi_calloc(new_str_length, sizeof(new_str[0]));
  ------------------
  |  | 1146|     23|#define inchi_calloc   calloc
  ------------------
  635|     23|                if (!new_str)
  ------------------
  |  Branch (635:21): [True: 0, False: 23]
  ------------------
  636|      0|                {
  637|      0|                    return -1;
  638|      0|                }
  639|     23|                if (ios->s.pStr)
  ------------------
  |  Branch (639:21): [True: 23, False: 0]
  ------------------
  640|     23|                {
  641|     23|                    if (ios->s.nUsedLength > 0)
  ------------------
  |  Branch (641:25): [True: 0, False: 23]
  ------------------
  642|      0|                    {
  643|      0|                        memcpy(new_str, ios->s.pStr, sizeof(new_str[0]) * ios->s.nUsedLength);
  644|      0|                    }
  645|     23|                    inchi_free(ios->s.pStr);
  ------------------
  |  | 1152|     23|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 23, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 23]
  |  |  ------------------
  ------------------
  646|     23|                }
  647|     23|                ios->s.pStr = new_str;
  648|     23|                ios->s.nAllocatedLength += (int)str_length_extension;
  649|       |
  650|       |                // try printing again
  651|     23|                my_va_start(argList, lpszFormat);
  ------------------
  |  |   22|     23|#define my_va_start va_start
  ------------------
  652|     23|                size_t remainingLength2 = (size_t)(ios->s.nAllocatedLength - ios->s.nUsedLength);
  653|     23|                ret = vsnprintf(ios->s.pStr + ios->s.nUsedLength, remainingLength2, lpszFormat, argList);
  654|     23|                va_end(argList);
  655|     23|            }
  656|       |
  657|  34.4k|            if (ret >= 0)
  ------------------
  |  Branch (657:17): [True: 34.4k, False: 0]
  ------------------
  658|  34.4k|            {
  659|  34.4k|                ios->s.nUsedLength += ret;
  660|  34.4k|            }
  661|  34.4k|            return ret;
  662|  34.4k|        }
  663|      0|        return -1;
  664|  34.4k|    }
  665|       |
  666|      0|    else if (ios->type == INCHI_IOS_TYPE_FILE)
  ------------------
  |  | 1017|      0|#define INCHI_IOS_TYPE_FILE 2
  ------------------
  |  Branch (666:14): [True: 0, False: 0]
  ------------------
  667|      0|    {
  668|      0|        my_va_start( argList, lpszFormat );
  ------------------
  |  |   22|      0|#define my_va_start va_start
  ------------------
  669|      0|        inchi_print_nodisplay( ios->f, lpszFormat, argList );
  670|      0|        va_end( argList );
  671|      0|    }
  672|       |
  673|       |    /* no output */
  674|      0|    return 0;
  675|  34.4k|}
inchi_ios_eprint:
  712|   148k|{
  713|   148k|    int ret = 0, ret2 = 0;
  714|   148k|    va_list argList;
  715|       |
  716|   148k|    if (!ios)
  ------------------
  |  Branch (716:9): [True: 9.46k, False: 139k]
  ------------------
  717|  9.46k|    {
  718|  9.46k|        return -1;
  719|  9.46k|    }
  720|       |
  721|   139k|    if (ios->type == INCHI_IOS_TYPE_STRING)
  ------------------
  |  | 1016|   139k|#define INCHI_IOS_TYPE_STRING 1
  ------------------
  |  Branch (721:9): [True: 139k, False: 0]
  ------------------
  722|       |        /* was #if ( defined(TARGET_API_LIB) || defined(INCHI_STANDALONE_EXE) ) */
  723|   139k|    {
  724|       |        /* output to string buffer */
  725|   139k|        int max_len, nAddLength = 0;
  726|   139k|        char* new_str = NULL;
  727|       |
  728|   139k|        my_va_start(argList, lpszFormat);
  ------------------
  |  |   22|   139k|#define my_va_start va_start
  ------------------
  729|   139k|        max_len = GetMaxPrintfLength(lpszFormat, argList);
  730|   139k|        va_end(argList);
  731|       |
  732|   139k|        if (max_len >= 0)
  ------------------
  |  Branch (732:13): [True: 139k, False: 0]
  ------------------
  733|   139k|        {
  734|   139k|            if (ios->s.nAllocatedLength - ios->s.nUsedLength <= max_len)
  ------------------
  |  Branch (734:17): [True: 12.5k, False: 126k]
  ------------------
  735|  12.5k|            {
  736|       |                /* enlarge output string */
  737|  12.5k|                nAddLength = inchi_max(INCHI_ADD_STR_LEN, max_len);
  ------------------
  |  |  138|  12.5k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 12.5k, False: 0]
  |  |  ------------------
  ------------------
  738|  12.5k|                new_str = (char*)inchi_calloc((long long)ios->s.nAllocatedLength + (long long)nAddLength, sizeof(new_str[0])); /* djb-rwth: cast operators added */
  ------------------
  |  | 1146|  12.5k|#define inchi_calloc   calloc
  ------------------
  739|  12.5k|                if (new_str)
  ------------------
  |  Branch (739:21): [True: 12.5k, False: 0]
  ------------------
  740|  12.5k|                {
  741|  12.5k|                    if (ios->s.pStr)
  ------------------
  |  Branch (741:25): [True: 0, False: 12.5k]
  ------------------
  742|      0|                    {
  743|      0|                        if (ios->s.nUsedLength > 0)
  ------------------
  |  Branch (743:29): [True: 0, False: 0]
  ------------------
  744|      0|                        {
  745|      0|                            memcpy(new_str, ios->s.pStr, sizeof(new_str[0]) * ios->s.nUsedLength);
  746|      0|                        }
  747|      0|                        inchi_free(ios->s.pStr);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  748|      0|                    }
  749|  12.5k|                    ios->s.pStr = new_str;
  750|  12.5k|                    ios->s.nAllocatedLength += nAddLength;
  751|  12.5k|                }
  752|      0|                else
  753|      0|                {
  754|      0|                    return -1; /* failed */
  755|      0|                }
  756|  12.5k|            }
  757|       |
  758|       |            /* output */
  759|   139k|            my_va_start(argList, lpszFormat);
  ------------------
  |  |   22|   139k|#define my_va_start va_start
  ------------------
  760|   139k|            ret = vsprintf(ios->s.pStr + ios->s.nUsedLength, lpszFormat, argList);
  761|   139k|            va_end(argList);
  762|   139k|            if (ret >= 0)
  ------------------
  |  Branch (762:17): [True: 139k, False: 0]
  ------------------
  763|   139k|            {
  764|   139k|                ios->s.nUsedLength += ret;
  765|   139k|            }
  766|   139k|            return ret;
  767|   139k|        }
  768|      0|        return -1;
  769|   139k|    }
  770|       |
  771|      0|    else if (ios->type == INCHI_IOS_TYPE_FILE)
  ------------------
  |  | 1017|      0|#define INCHI_IOS_TYPE_FILE 2
  ------------------
  |  Branch (771:14): [True: 0, False: 0]
  ------------------
  772|      0|    {
  773|      0|        if (ios->f)
  ------------------
  |  Branch (773:13): [True: 0, False: 0]
  ------------------
  774|      0|        {
  775|       |            /* output to plain file */
  776|      0|            my_va_start(argList, lpszFormat);
  ------------------
  |  |   22|      0|#define my_va_start va_start
  ------------------
  777|      0|            ret = inchi_vfprintf(ios->f, lpszFormat, argList);
  778|      0|            va_end(argList);
  779|       |            /*  No output to stderr from within dll or GUI program */
  780|       |#if ( !defined(TARGET_API_LIB) && !defined(TARGET_LIB_FOR_WINCHI) )
  781|       |            if (ios->f != stderr)
  782|       |            {
  783|       |                my_va_start(argList, lpszFormat);
  784|       |                ret2 = vfprintf(stderr, lpszFormat, argList);
  785|       |                va_end(argList);
  786|       |            }
  787|       |#endif
  788|      0|            return ret ? ret : ret2;
  ------------------
  |  Branch (788:20): [True: 0, False: 0]
  ------------------
  789|      0|        }
  790|      0|    }
  791|       |
  792|       |    /* no output */
  793|      0|    return 0;
  794|   139k|}
GetMaxPrintfLength:
 1069|   347k|{
 1070|       |    /*ASSERT(AfxIsValidString(lpszFormat, FALSE));*/
 1071|   347k|    const char* lpsz;
 1072|   347k|    int nMaxLen, nWidth, nPrecision, nModifier, nItemLen;
 1073|       |
 1074|   347k|    nMaxLen = 0;
 1075|       |    /* make a guess at the maximum length of the resulting string */
 1076|  5.27M|    for (lpsz = lpszFormat; *lpsz; lpsz++)
  ------------------
  |  Branch (1076:29): [True: 4.92M, False: 347k]
  ------------------
 1077|  4.92M|    {
 1078|       |        /* moved from below for C syntax reason - 2024-09-01 DT */
 1079|       |        /* djb-rwth: return values needed for va_arg; djb-rwth: ignoring LLVM warnings: function returning value */
 1080|  4.92M|        int ivarg;
 1081|  4.92M|        double dvarg;
 1082|  4.92M|        void* ivvarg;
 1083|  4.92M|        int* ipvarg;
 1084|       |
 1085|       |        /* handle '%' character, but watch out for '%%' */
 1086|  4.92M|        if (*lpsz != '%' || *(++lpsz) == '%')
  ------------------
  |  Branch (1086:13): [True: 4.72M, False: 195k]
  |  Branch (1086:29): [True: 0, False: 195k]
  ------------------
 1087|  4.72M|        {
 1088|  4.72M|            nMaxLen += 1;
 1089|  4.72M|            continue;
 1090|  4.72M|        }
 1091|       |
 1092|   195k|        nItemLen = 0;
 1093|       |
 1094|       |        /*  handle '%' character with format */
 1095|   195k|        nWidth = 0;
 1096|   198k|        for (; *lpsz; lpsz++)
  ------------------
  |  Branch (1096:16): [True: 198k, False: 0]
  ------------------
 1097|   198k|        {
 1098|       |            /* check for valid flags */
 1099|   198k|            if (*lpsz == '#')
  ------------------
  |  Branch (1099:17): [True: 0, False: 198k]
  ------------------
 1100|      0|            {
 1101|      0|                nMaxLen += 2;   /* for '0x' */
 1102|      0|            }
 1103|   198k|            else if (*lpsz == '*')
  ------------------
  |  Branch (1103:22): [True: 0, False: 198k]
  ------------------
 1104|      0|            {
 1105|      0|                nWidth = va_arg(argList, int);
 1106|      0|            }
 1107|   198k|            else if (*lpsz == '-' || *lpsz == '+' || *lpsz == '0'
  ------------------
  |  Branch (1107:22): [True: 1.77k, False: 196k]
  |  Branch (1107:38): [True: 393, False: 195k]
  |  Branch (1107:54): [True: 0, False: 195k]
  ------------------
 1108|   195k|                || *lpsz == ' ')
  ------------------
  |  Branch (1108:20): [True: 0, False: 195k]
  ------------------
 1109|  2.16k|            {
 1110|  2.16k|                ;
 1111|  2.16k|            }
 1112|   195k|            else /* hit non-flag character */
 1113|   195k|            {
 1114|   195k|                break;
 1115|   195k|            }
 1116|   198k|        }
 1117|       |        /* get width and skip it */
 1118|   195k|        if (nWidth == 0)
  ------------------
  |  Branch (1118:13): [True: 195k, False: 0]
  ------------------
 1119|   195k|        {
 1120|       |            /* width indicated by */
 1121|   195k|            nWidth = atoi(lpsz);
 1122|   195k|            for (; *lpsz && isdigit(*lpsz); lpsz++)
  ------------------
  |  Branch (1122:20): [True: 195k, False: 0]
  |  Branch (1122:29): [True: 0, False: 195k]
  ------------------
 1123|      0|            {
 1124|      0|                ;
 1125|      0|            }
 1126|   195k|        }
 1127|       |        /*ASSERT(nWidth >= 0);*/
 1128|   195k|        if (nWidth < 0)
  ------------------
  |  Branch (1128:13): [True: 0, False: 195k]
  ------------------
 1129|      0|        {
 1130|      0|            goto exit_error; /* instead of exception */
 1131|      0|        }
 1132|       |
 1133|   195k|        nPrecision = 0;
 1134|   195k|        if (*lpsz == '.')
  ------------------
  |  Branch (1134:13): [True: 0, False: 195k]
  ------------------
 1135|      0|        {
 1136|       |            /* skip past '.' separator (width.precision)*/
 1137|      0|            lpsz++;
 1138|       |
 1139|       |            /* get precision and skip it*/
 1140|      0|            if (*lpsz == '*')
  ------------------
  |  Branch (1140:17): [True: 0, False: 0]
  ------------------
 1141|      0|            {
 1142|      0|                nPrecision = va_arg(argList, int);
 1143|      0|                lpsz++;
 1144|      0|            }
 1145|      0|            else
 1146|      0|            {
 1147|      0|                nPrecision = atoi(lpsz);
 1148|      0|                for (; *lpsz && isdigit(*lpsz); lpsz++)
  ------------------
  |  Branch (1148:24): [True: 0, False: 0]
  |  Branch (1148:33): [True: 0, False: 0]
  ------------------
 1149|      0|                {
 1150|      0|                    ;
 1151|      0|                }
 1152|      0|            }
 1153|      0|            if (nPrecision < 0)
  ------------------
  |  Branch (1153:17): [True: 0, False: 0]
  ------------------
 1154|      0|            {
 1155|      0|                goto exit_error; /* instead of exception */
 1156|      0|            }
 1157|      0|        }
 1158|       |
 1159|       |        /* should be on type modifier or specifier */
 1160|   195k|        nModifier = 0;
 1161|   195k|        switch (*lpsz)
  ------------------
  |  Branch (1161:17): [True: 0, False: 195k]
  ------------------
 1162|   195k|        {
 1163|       |            /* modifiers that affect size */
 1164|      0|        case 'h':
  ------------------
  |  Branch (1164:9): [True: 0, False: 195k]
  ------------------
 1165|      0|            switch (lpsz[1])
 1166|      0|            {
 1167|      0|            case 'd':
  ------------------
  |  Branch (1167:13): [True: 0, False: 0]
  ------------------
 1168|      0|            case 'i':
  ------------------
  |  Branch (1168:13): [True: 0, False: 0]
  ------------------
 1169|      0|            case 'o':
  ------------------
  |  Branch (1169:13): [True: 0, False: 0]
  ------------------
 1170|      0|            case 'x':
  ------------------
  |  Branch (1170:13): [True: 0, False: 0]
  ------------------
 1171|      0|            case 'X':
  ------------------
  |  Branch (1171:13): [True: 0, False: 0]
  ------------------
 1172|      0|            case 'u':
  ------------------
  |  Branch (1172:13): [True: 0, False: 0]
  ------------------
 1173|       |                /* short unsigned, short double, etc. -- added to the original MS example */
 1174|       |                /* ignore the fact that these modifiers do affect size */
 1175|      0|                lpsz++;
 1176|      0|                break;
 1177|      0|            default:
  ------------------
  |  Branch (1177:13): [True: 0, False: 0]
  ------------------
 1178|      0|                nModifier = FORCE_ANSI;
  ------------------
  |  | 1062|      0|#define FORCE_ANSI      0x10000
  ------------------
 1179|      0|                lpsz++;
 1180|      0|                break;
 1181|      0|            }
 1182|      0|            break;
 1183|      0|        case 'l':
  ------------------
  |  Branch (1183:9): [True: 0, False: 195k]
  ------------------
 1184|      0|            switch (lpsz[1])
 1185|      0|            {
 1186|      0|            case 'd':
  ------------------
  |  Branch (1186:13): [True: 0, False: 0]
  ------------------
 1187|      0|            case 'i':
  ------------------
  |  Branch (1187:13): [True: 0, False: 0]
  ------------------
 1188|      0|            case 'o':
  ------------------
  |  Branch (1188:13): [True: 0, False: 0]
  ------------------
 1189|      0|            case 'x':
  ------------------
  |  Branch (1189:13): [True: 0, False: 0]
  ------------------
 1190|      0|            case 'X':
  ------------------
  |  Branch (1190:13): [True: 0, False: 0]
  ------------------
 1191|      0|            case 'u':
  ------------------
  |  Branch (1191:13): [True: 0, False: 0]
  ------------------
 1192|      0|            case 'f': /* long float -- post ANSI C */
  ------------------
  |  Branch (1192:13): [True: 0, False: 0]
  ------------------
 1193|       |                /* long unsigned, long double, etc. -- added to the original MS example */
 1194|       |                /* ignore the fact that these modifiers do affect size */
 1195|      0|                lpsz++;
 1196|      0|                break;
 1197|      0|            default:
  ------------------
  |  Branch (1197:13): [True: 0, False: 0]
  ------------------
 1198|       |                /*
 1199|       |                nModifier = FORCE_UNICODE;
 1200|       |                lpsz ++;
 1201|       |                break;
 1202|       |                */
 1203|      0|                goto exit_error;  /* no UNICODE, please */
 1204|      0|            }
 1205|      0|            break;
 1206|       |            /* modifiers that do not affect size */
 1207|      0|        case 'F':
  ------------------
  |  Branch (1207:9): [True: 0, False: 195k]
  ------------------
 1208|      0|        case 'N':
  ------------------
  |  Branch (1208:9): [True: 0, False: 195k]
  ------------------
 1209|      0|        case 'L':
  ------------------
  |  Branch (1209:9): [True: 0, False: 195k]
  ------------------
 1210|      0|            lpsz++;
 1211|      0|            break;
 1212|   195k|        }
 1213|       |
 1214|       |        /* now should be on specifier */
 1215|       |
 1216|   195k|        switch (*lpsz | nModifier)
  ------------------
  |  Branch (1216:17): [True: 179k, False: 16.8k]
  ------------------
 1217|   195k|        {
 1218|       |            /* single characters*/
 1219|      0|        case 'c':
  ------------------
  |  Branch (1219:9): [True: 0, False: 195k]
  ------------------
 1220|      0|        case 'C':
  ------------------
  |  Branch (1220:9): [True: 0, False: 195k]
  ------------------
 1221|      0|            nItemLen = 2;
 1222|      0|            ivarg = va_arg(argList, int); /* djb-rwth: int return value; ignoring LLVM warning */
 1223|      0|            break;
 1224|      0|        case 'c' | FORCE_ANSI:
  ------------------
  |  | 1062|      0|#define FORCE_ANSI      0x10000
  ------------------
  |  Branch (1224:9): [True: 0, False: 195k]
  ------------------
 1225|      0|        case 'C' | FORCE_ANSI:
  ------------------
  |  | 1062|      0|#define FORCE_ANSI      0x10000
  ------------------
  |  Branch (1225:9): [True: 0, False: 195k]
  ------------------
 1226|      0|            nItemLen = 2;
 1227|      0|            ivarg = va_arg(argList, int); /* djb-rwth: int return value; ignoring LLVM warning */
 1228|      0|            break;
 1229|      0|        case 'c' | FORCE_UNICODE:
  ------------------
  |  | 1063|      0|#define FORCE_UNICODE   0x20000
  ------------------
  |  Branch (1229:9): [True: 0, False: 195k]
  ------------------
 1230|      0|        case 'C' | FORCE_UNICODE:
  ------------------
  |  | 1063|      0|#define FORCE_UNICODE   0x20000
  ------------------
  |  Branch (1230:9): [True: 0, False: 195k]
  ------------------
 1231|      0|            goto exit_error;  /* no UNICODE, please */
 1232|       |            /*
 1233|       |            nItemLen = 2;
 1234|       |            va_arg(argList, wchar_t);
 1235|       |            break;
 1236|       |            */
 1237|       |
 1238|       |            /* strings*/
 1239|   179k|        case 's':
  ------------------
  |  Branch (1239:9): [True: 179k, False: 16.8k]
  ------------------
 1240|   179k|        case 'S':
  ------------------
  |  Branch (1240:9): [True: 0, False: 195k]
  ------------------
 1241|   179k|            nItemLen = (int)strlen(va_arg(argList, char*));
 1242|   179k|            nItemLen = inchi_max(1, nItemLen);
  ------------------
  |  |  138|   179k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 46.5k, False: 132k]
  |  |  ------------------
  ------------------
 1243|   179k|            break;
 1244|      0|        case 's' | FORCE_ANSI:
  ------------------
  |  | 1062|      0|#define FORCE_ANSI      0x10000
  ------------------
  |  Branch (1244:9): [True: 0, False: 195k]
  ------------------
 1245|      0|        case 'S' | FORCE_ANSI:
  ------------------
  |  | 1062|      0|#define FORCE_ANSI      0x10000
  ------------------
  |  Branch (1245:9): [True: 0, False: 195k]
  ------------------
 1246|      0|            nItemLen = (int)strlen(va_arg(argList, char*));
 1247|      0|            nItemLen = inchi_max(1, nItemLen);
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1248|      0|            break;
 1249|       |
 1250|      0|        case 's' | FORCE_UNICODE:
  ------------------
  |  | 1063|      0|#define FORCE_UNICODE   0x20000
  ------------------
  |  Branch (1250:9): [True: 0, False: 195k]
  ------------------
 1251|      0|        case 'S' | FORCE_UNICODE:
  ------------------
  |  | 1063|      0|#define FORCE_UNICODE   0x20000
  ------------------
  |  Branch (1251:9): [True: 0, False: 195k]
  ------------------
 1252|      0|            goto exit_error;  /* no UNICODE, please */
 1253|       |            /*
 1254|       |            nItemLen = wcslen(va_arg(argList, wchar_t*));
 1255|       |            nItemLen = inchi_max(1, nItemLen);
 1256|       |            break;
 1257|       |            */
 1258|   195k|        }
 1259|       |
 1260|       |        /* adjust nItemLen for strings */
 1261|   195k|        if (nItemLen != 0)
  ------------------
  |  Branch (1261:13): [True: 179k, False: 16.8k]
  ------------------
 1262|   179k|        {
 1263|   179k|            nItemLen = inchi_max(nItemLen, nWidth);
  ------------------
  |  |  138|   179k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 179k, False: 0]
  |  |  ------------------
  ------------------
 1264|   179k|            if (nPrecision != 0)
  ------------------
  |  Branch (1264:17): [True: 0, False: 179k]
  ------------------
 1265|      0|            {
 1266|      0|                nItemLen = inchi_min(nItemLen, nPrecision);
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1267|      0|            }
 1268|   179k|        }
 1269|  16.8k|        else
 1270|  16.8k|        {
 1271|  16.8k|            switch (*lpsz)
 1272|  16.8k|            {
 1273|       |                /* integers */
 1274|  16.8k|            case 'd':
  ------------------
  |  Branch (1274:13): [True: 16.8k, False: 0]
  ------------------
 1275|  16.8k|            case 'i':
  ------------------
  |  Branch (1275:13): [True: 0, False: 16.8k]
  ------------------
 1276|  16.8k|            case 'u':
  ------------------
  |  Branch (1276:13): [True: 0, False: 16.8k]
  ------------------
 1277|  16.8k|            case 'x':
  ------------------
  |  Branch (1277:13): [True: 0, False: 16.8k]
  ------------------
 1278|  16.8k|            case 'X':
  ------------------
  |  Branch (1278:13): [True: 0, False: 16.8k]
  ------------------
 1279|  16.8k|            case 'o':
  ------------------
  |  Branch (1279:13): [True: 0, False: 16.8k]
  ------------------
 1280|  16.8k|                ivarg = va_arg(argList, int); /* djb-rwth: int return value; ignoring LLVM warning */
 1281|  16.8k|                nItemLen = 32;
 1282|  16.8k|                nItemLen = inchi_max(nItemLen, nWidth + nPrecision);
  ------------------
  |  |  138|  16.8k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 16.8k, False: 0]
  |  |  ------------------
  ------------------
 1283|  16.8k|                break;
 1284|       |
 1285|      0|            case 'e':
  ------------------
  |  Branch (1285:13): [True: 0, False: 16.8k]
  ------------------
 1286|      0|            case 'f':
  ------------------
  |  Branch (1286:13): [True: 0, False: 16.8k]
  ------------------
 1287|      0|            case 'g':
  ------------------
  |  Branch (1287:13): [True: 0, False: 16.8k]
  ------------------
 1288|      0|            case 'G':
  ------------------
  |  Branch (1288:13): [True: 0, False: 16.8k]
  ------------------
 1289|      0|                dvarg = va_arg(argList, double); /* djb-rwth: double return value; ignoring LLVM warning */
 1290|      0|                nItemLen = 32;
 1291|      0|                nItemLen = inchi_max(nItemLen, nWidth + nPrecision);
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1292|      0|                break;
 1293|       |
 1294|      0|            case 'p':
  ------------------
  |  Branch (1294:13): [True: 0, False: 16.8k]
  ------------------
 1295|      0|                ivvarg = va_arg(argList, void*); /* djb-rwth: void* return value; ignoring LLVM warning */
 1296|      0|                nItemLen = 32;
 1297|      0|                nItemLen = inchi_max(nItemLen, nWidth + nPrecision);
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1298|      0|                break;
 1299|       |
 1300|       |                /* no output */
 1301|      0|            case 'n':
  ------------------
  |  Branch (1301:13): [True: 0, False: 16.8k]
  ------------------
 1302|      0|                ipvarg = va_arg(argList, int*); /* djb-rwth: int* return value; ignoring LLVM warning */
 1303|      0|                break;
 1304|       |
 1305|      0|            default:
  ------------------
  |  Branch (1305:13): [True: 0, False: 16.8k]
  ------------------
 1306|       |                /*ASSERT(FALSE);*/  /* unknown formatting option*/
 1307|      0|                goto exit_error; /* instead of exception */
 1308|  16.8k|            }
 1309|  16.8k|        }
 1310|       |
 1311|       |        /* adjust nMaxLen for output nItemLen */
 1312|   195k|        nMaxLen += nItemLen;
 1313|   195k|    }
 1314|   347k|    return nMaxLen;
 1315|       |
 1316|      0|exit_error:
 1317|      0|    return -1; /* wrong format */
 1318|   347k|}
inchi_strbuf_init:
 1374|  75.8k|{
 1375|  75.8k|    char* new_str = NULL;
 1376|  75.8k|    memset(buf, 0, sizeof(*buf)); /* djb-rwth: memset_s C11/Annex K variant? */
 1377|       |
 1378|  75.8k|    if (start_size <= 0)
  ------------------
  |  Branch (1378:9): [True: 0, False: 75.8k]
  ------------------
 1379|      0|    {
 1380|      0|        start_size = INCHI_STRBUF_INITIAL_SIZE;
  ------------------
  |  |   65|      0|#define INCHI_STRBUF_INITIAL_SIZE 262144
  ------------------
 1381|      0|    }
 1382|  75.8k|    if (incr_size <= 0)
  ------------------
  |  Branch (1382:9): [True: 0, False: 75.8k]
  ------------------
 1383|      0|    {
 1384|      0|        incr_size = INCHI_STRBUF_SIZE_INCREMENT;
  ------------------
  |  |   66|      0|#define INCHI_STRBUF_SIZE_INCREMENT 262144
  ------------------
 1385|      0|    }
 1386|       |
 1387|  75.8k|    new_str = (char*)inchi_calloc(start_size, sizeof(char));
  ------------------
  |  | 1146|  75.8k|#define inchi_calloc   calloc
  ------------------
 1388|       |
 1389|  75.8k|    if (!new_str)
  ------------------
  |  Branch (1389:9): [True: 0, False: 75.8k]
  ------------------
 1390|      0|    {
 1391|      0|        return -1;
 1392|      0|    }
 1393|       |
 1394|  75.8k|    buf->pStr = new_str;
 1395|  75.8k|    buf->nAllocatedLength = start_size;
 1396|  75.8k|    buf->nPtr = incr_size;
 1397|       |
 1398|  75.8k|    return start_size;
 1399|  75.8k|}
inchi_strbuf_reset:
 1407|  23.8k|{
 1408|  23.8k|    if (!buf)
  ------------------
  |  Branch (1408:9): [True: 0, False: 23.8k]
  ------------------
 1409|      0|    {
 1410|      0|        return;
 1411|      0|    }
 1412|  23.8k|    if (buf->pStr)
  ------------------
  |  Branch (1412:9): [True: 23.8k, False: 0]
  ------------------
 1413|  23.8k|    {
 1414|  23.8k|        buf->pStr[0] = '\0';
 1415|  23.8k|    }
 1416|       |
 1417|  23.8k|    buf->nUsedLength = buf->nPtr = 0;
 1418|  23.8k|}
inchi_strbuf_close:
 1426|  76.3k|{
 1427|  76.3k|    if (!buf)
  ------------------
  |  Branch (1427:9): [True: 0, False: 76.3k]
  ------------------
 1428|      0|    {
 1429|      0|        return;
 1430|      0|    }
 1431|  76.3k|    if (buf->pStr)
  ------------------
  |  Branch (1431:9): [True: 76.3k, False: 0]
  ------------------
 1432|  76.3k|    {
 1433|  76.3k|        inchi_free(buf->pStr);
  ------------------
  |  | 1152|  76.3k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 76.3k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 76.3k]
  |  |  ------------------
  ------------------
 1434|  76.3k|    }
 1435|       |
 1436|  76.3k|    memset(buf, 0, sizeof(*buf)); /* djb-rwth: memset_s C11/Annex K variant? */
 1437|  76.3k|}
inchi_strbuf_update:
 1463|   185k|{
 1464|   185k|    int requsted_len;
 1465|       |
 1466|   185k|    if (!buf)
  ------------------
  |  Branch (1466:9): [True: 0, False: 185k]
  ------------------
 1467|      0|    {
 1468|      0|        return -1;
 1469|      0|    }
 1470|       |
 1471|   185k|    if (new_addition_size <= 0)
  ------------------
  |  Branch (1471:9): [True: 0, False: 185k]
  ------------------
 1472|      0|    {
 1473|      0|        return buf->nAllocatedLength;
 1474|      0|    }
 1475|       |
 1476|   185k|    requsted_len = buf->nUsedLength + new_addition_size;
 1477|       |
 1478|   185k|    if (requsted_len >= buf->nAllocatedLength)
  ------------------
  |  Branch (1478:9): [True: 0, False: 185k]
  ------------------
 1479|      0|    {
 1480|       |        /* Expand */
 1481|      0|        int  nAddLength = inchi_max(buf->nPtr, new_addition_size);
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1482|       |        /* buf->nPtr stores size increment for this buffer */
 1483|      0|        char* new_str =
 1484|      0|            (char*)inchi_calloc((long long)buf->nAllocatedLength + (long long)nAddLength,
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 1485|      0|                sizeof(new_str[0])); /* djb-rwth: cast operators added */
 1486|      0|        if (!new_str)
  ------------------
  |  Branch (1486:13): [True: 0, False: 0]
  ------------------
 1487|      0|        {
 1488|      0|            return -1; /* failed */
 1489|      0|        }
 1490|      0|        if (buf->pStr)
  ------------------
  |  Branch (1490:13): [True: 0, False: 0]
  ------------------
 1491|      0|        {
 1492|      0|            if (buf->nUsedLength > 0)
  ------------------
  |  Branch (1492:17): [True: 0, False: 0]
  ------------------
 1493|      0|            {
 1494|      0|                memcpy(new_str, buf->pStr, sizeof(new_str[0]) * buf->nUsedLength);
 1495|      0|            }
 1496|      0|            inchi_free(buf->pStr);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1497|      0|        }
 1498|      0|        buf->pStr = new_str;
 1499|      0|        buf->nAllocatedLength += nAddLength;
 1500|      0|    }
 1501|       |
 1502|   185k|    return buf->nAllocatedLength;
 1503|   185k|}
inchi_strbuf_printf:
 1511|   173k|{
 1512|   173k|    int ret = 0, max_len;
 1513|   173k|    va_list argList;
 1514|       |
 1515|   173k|    if (!buf)
  ------------------
  |  Branch (1515:9): [True: 0, False: 173k]
  ------------------
 1516|      0|    {
 1517|      0|        return -1;
 1518|      0|    }
 1519|       |
 1520|   173k|    my_va_start(argList, lpszFormat);
  ------------------
  |  |   22|   173k|#define my_va_start va_start
  ------------------
 1521|   173k|    max_len = GetMaxPrintfLength(lpszFormat, argList);
 1522|   173k|    va_end(argList);
 1523|   173k|    if (max_len < 0)
  ------------------
  |  Branch (1523:9): [True: 0, False: 173k]
  ------------------
 1524|      0|    {
 1525|      0|        return 0;
 1526|      0|    }
 1527|       |
 1528|   173k|    inchi_strbuf_update(buf, max_len);
 1529|       |
 1530|   173k|    my_va_start(argList, lpszFormat);
  ------------------
  |  |   22|   173k|#define my_va_start va_start
  ------------------
 1531|   173k|    ret = vsprintf(buf->pStr + buf->nUsedLength, lpszFormat, argList);
 1532|   173k|    va_end(argList);
 1533|   173k|    if (ret >= 0)
  ------------------
  |  Branch (1533:9): [True: 173k, False: 0]
  ------------------
 1534|   173k|    {
 1535|   173k|        buf->nUsedLength += ret;
 1536|   173k|    }
 1537|       |
 1538|   173k|    return ret;
 1539|   173k|}

TranspositionCreate:
  660|   330k|{
  661|   330k|    p->nAtNumb = (AT_NUMB*) inchi_calloc( n, sizeof( p->nAtNumb[0] ) );
  ------------------
  |  | 1146|   330k|#define inchi_calloc   calloc
  ------------------
  662|   330k|    if (p->nAtNumb)
  ------------------
  |  Branch (662:9): [True: 330k, False: 0]
  ------------------
  663|   330k|    {
  664|   330k|        return 1;
  665|   330k|    }
  666|       |
  667|      0|    return 0;
  668|   330k|}
TranspositionFree:
  673|   330k|{
  674|   330k|    if (p && p->nAtNumb)
  ------------------
  |  Branch (674:9): [True: 330k, False: 0]
  |  Branch (674:14): [True: 330k, False: 0]
  ------------------
  675|   330k|    {
  676|   330k|        inchi_free( p->nAtNumb );
  ------------------
  |  | 1152|   330k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 330k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 330k]
  |  |  ------------------
  ------------------
  677|       |        p->nAtNumb = NULL;
  678|   330k|    }
  679|   330k|}
NodeSetCreate:
  687|   993k|{
  688|   993k|    int i, len;
  689|       |
  690|   993k|    len = ( n + pCG->m_num_bit - 1 ) / pCG->m_num_bit;
  691|       |
  692|   993k|    pSet->bitword = (bitWord**) inchi_calloc( L, sizeof( pSet->bitword[0] ) );
  ------------------
  |  | 1146|   993k|#define inchi_calloc   calloc
  ------------------
  693|       |
  694|   993k|    if (!pSet->bitword)
  ------------------
  |  Branch (694:9): [True: 0, False: 993k]
  ------------------
  695|      0|    {
  696|      0|        return 0;
  697|      0|    }
  698|   993k|    pSet->bitword[0] = (bitWord*) inchi_calloc( (long long)len * (long long)L, sizeof( pSet->bitword[0][0] ) ); /* djb-rwth: cast operators added */
  ------------------
  |  | 1146|   993k|#define inchi_calloc   calloc
  ------------------
  699|   993k|    if (!pSet->bitword[0])
  ------------------
  |  Branch (699:9): [True: 0, False: 993k]
  ------------------
  700|      0|    {
  701|       |        /* Cleanup */
  702|      0|        inchi_free( pSet->bitword );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  703|      0|        pSet->bitword = NULL;
  704|      0|        return 0; /* failed */
  705|      0|    }
  706|  1.35G|    for (i = 1; i < L; i++)
  ------------------
  |  Branch (706:17): [True: 1.35G, False: 993k]
  ------------------
  707|  1.35G|    {
  708|  1.35G|        pSet->bitword[i] = pSet->bitword[i - 1] + len;
  709|  1.35G|    }
  710|       |
  711|   993k|    pSet->len_set = len;
  712|   993k|    pSet->num_set = L;
  713|       |
  714|   993k|    return 1;
  715|   993k|}
NodeSetFree:
  720|   993k|{
  721|   993k|    if (pSet && pSet->bitword)
  ------------------
  |  Branch (721:9): [True: 993k, False: 0]
  |  Branch (721:17): [True: 993k, False: 380]
  ------------------
  722|   993k|    {
  723|   993k|        if (pSet->bitword[0])
  ------------------
  |  Branch (723:13): [True: 993k, False: 0]
  ------------------
  724|   993k|        {
  725|   993k|            inchi_free( pSet->bitword[0] );
  ------------------
  |  | 1152|   993k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 993k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 993k]
  |  |  ------------------
  ------------------
  726|   993k|        }
  727|   993k|        inchi_free( pSet->bitword );
  ------------------
  |  | 1152|   993k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 993k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 993k]
  |  |  ------------------
  ------------------
  728|       |        pSet->bitword = NULL;
  729|   993k|    }
  730|   993k|}
CTableCreate:
  735|  1.24M|{
  736|  1.24M|    int maxlenCt = pCD->nMaxLenLinearCT + 1; /* add one element for CtPartINCHI_CANON_INFINITY() */
  737|  1.24M|    int maxlenNumH = pCD->NumH ? ( pCD->maxlenNumH + 1 ) : 0;
  ------------------
  |  Branch (737:22): [True: 488k, False: 756k]
  ------------------
  738|  1.24M|    int maxlenNumHfixed = pCD->NumHfixed ? ( pCD->maxlenNumHfixed + 1 ) : 0;
  ------------------
  |  Branch (738:27): [True: 109k, False: 1.13M]
  ------------------
  739|  1.24M|    int maxlenIso = pCD->maxlen_iso_sort_key ? ( pCD->maxlen_iso_sort_key + 1 ) : 0;
  ------------------
  |  Branch (739:21): [True: 2.97k, False: 1.24M]
  ------------------
  740|  1.24M|    int maxlenIsoExchg = pCD->iso_exchg_atnos ? ( pCD->maxlen_iso_exchg_atnos + 1 ) : 0;
  ------------------
  |  Branch (740:26): [True: 277, False: 1.24M]
  ------------------
  741|       |
  742|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
  743|       |    int maxlenIsoHfixed = pCD->maxlen_iso_sort_key_Hfixed ? ( pCD->maxlen_iso_sort_key_Hfixed + 1 ) : 0;
  744|       |#endif
  745|       |
  746|  1.24M|    memset( Ct, 0, sizeof( Ct[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  747|       |
  748|  1.24M|    Ct->maxVert = n;
  749|       |
  750|  1.24M|    n++;
  751|       |
  752|  1.24M|    Ct->Ctbl = (AT_RANK*) inchi_calloc( maxlenCt, sizeof( Ct->Ctbl[0] ) );
  ------------------
  |  | 1146|  1.24M|#define inchi_calloc   calloc
  ------------------
  753|  1.24M|    Ct->nextCtblPos = (AT_NUMB*) inchi_calloc( n, sizeof( Ct->nextCtblPos[0] ) );
  ------------------
  |  | 1146|  1.24M|#define inchi_calloc   calloc
  ------------------
  754|  1.24M|    Ct->nextAtRank = (AT_RANK*) inchi_calloc( n, sizeof( Ct->nextAtRank[0] ) );
  ------------------
  |  | 1146|  1.24M|#define inchi_calloc   calloc
  ------------------
  755|  1.24M|    if (maxlenNumH)
  ------------------
  |  Branch (755:9): [True: 488k, False: 756k]
  ------------------
  756|   488k|    {
  757|   488k|        Ct->NumH = (NUM_H *) inchi_calloc( maxlenNumH, sizeof( Ct->NumH[0] ) );
  ------------------
  |  | 1146|   488k|#define inchi_calloc   calloc
  ------------------
  758|   488k|    }
  759|  1.24M|    if (maxlenNumHfixed)
  ------------------
  |  Branch (759:9): [True: 109k, False: 1.13M]
  ------------------
  760|   109k|    {
  761|   109k|        Ct->NumHfixed = (NUM_H *) inchi_calloc( maxlenNumHfixed, sizeof( Ct->NumH[0] ) );
  ------------------
  |  | 1146|   109k|#define inchi_calloc   calloc
  ------------------
  762|   109k|    }
  763|  1.24M|    if (maxlenIso)
  ------------------
  |  Branch (763:9): [True: 2.97k, False: 1.24M]
  ------------------
  764|  2.97k|    {
  765|  2.97k|        Ct->iso_sort_key = (AT_ISO_SORT_KEY *) inchi_calloc( maxlenIso, sizeof( Ct->iso_sort_key[0] ) );
  ------------------
  |  | 1146|  2.97k|#define inchi_calloc   calloc
  ------------------
  766|  2.97k|    }
  767|  1.24M|    if (maxlenIsoExchg)
  ------------------
  |  Branch (767:9): [True: 277, False: 1.24M]
  ------------------
  768|    277|    {
  769|    277|        Ct->iso_exchg_atnos = (S_CHAR *) inchi_calloc( maxlenIsoExchg, sizeof( Ct->iso_exchg_atnos[0] ) );
  ------------------
  |  | 1146|    277|#define inchi_calloc   calloc
  ------------------
  770|    277|    }
  771|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
  772|       |    if (maxlenIsoHfixed)
  773|       |    {
  774|       |        Ct->iso_sort_key_Hfixed = (AT_ISO_SORT_KEY *) inchi_calloc( maxlenIsoHfixed, sizeof( Ct->iso_sort_key_Hfixed[0] ) );
  775|       |    }
  776|       |#endif
  777|       |#ifdef INCHI_CANON_USE_HASH
  778|       |    Ct->hash = (CtHash*) inchi_calloc( n, sizeof( Ct->hash[0] ) );
  779|       |#endif
  780|       |
  781|  1.24M|    Ct->lenCt = 0;
  782|  1.24M|    Ct->nLenCTAtOnly = pCD->nLenCTAtOnly;
  783|  1.24M|    Ct->maxlenCt = maxlenCt;
  784|  1.24M|    Ct->lenNumH = 0;
  785|  1.24M|    Ct->maxlenNumH = maxlenNumH;
  786|  1.24M|    Ct->len_iso_sort_key = 0;
  787|  1.24M|    Ct->maxlen_iso_sort_key = maxlenIso;
  788|  1.24M|    Ct->len_iso_exchg_atnos = 0;
  789|  1.24M|    Ct->maxlen_iso_exchg_atnos = maxlenIso;
  790|       |
  791|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
  792|       |    Ct->len_iso_sort_key_Hfixed = 0;
  793|       |    Ct->maxlen_iso_sort_key_Hfixed = maxlenIsoHfixed;
  794|       |#endif
  795|       |
  796|  1.24M|    Ct->maxPos = n;
  797|  1.24M|    Ct->lenPos = 0;
  798|       |    /* djb-rwth: fixing a NULL pointer dereferences */
  799|  1.24M|    if (Ct->nextAtRank)
  ------------------
  |  Branch (799:9): [True: 1.24M, False: 0]
  ------------------
  800|  1.24M|        Ct->nextAtRank[0] = 0;
  801|  1.24M|    if (Ct->nextCtblPos)
  ------------------
  |  Branch (801:9): [True: 1.24M, False: 0]
  ------------------
  802|  1.24M|        Ct->nextCtblPos[0] = 0;
  803|       |
  804|  1.24M|    if (Ct->Ctbl && Ct->nextCtblPos &&
  ------------------
  |  Branch (804:9): [True: 1.24M, False: 0]
  |  Branch (804:21): [True: 1.24M, False: 0]
  ------------------
  805|  1.24M|        ( !maxlenNumH || Ct->NumH ) &&
  ------------------
  |  Branch (805:11): [True: 756k, False: 488k]
  |  Branch (805:26): [True: 488k, False: 0]
  ------------------
  806|  1.24M|        ( !maxlenNumHfixed || Ct->NumHfixed ))
  ------------------
  |  Branch (806:11): [True: 1.13M, False: 109k]
  |  Branch (806:31): [True: 109k, False: 0]
  ------------------
  807|  1.24M|    {
  808|  1.24M|        return 1;
  809|  1.24M|    }
  810|       |
  811|      0|    return 0;
  812|  1.24M|}
CTableFree:
  817|  1.24M|{
  818|  1.24M|    if (Ct)
  ------------------
  |  Branch (818:9): [True: 1.24M, False: 0]
  ------------------
  819|  1.24M|    {
  820|  1.24M|        if (Ct->Ctbl)
  ------------------
  |  Branch (820:13): [True: 956k, False: 288k]
  ------------------
  821|   956k|        {
  822|   956k|            inchi_free( Ct->Ctbl );
  ------------------
  |  | 1152|   956k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 956k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 956k]
  |  |  ------------------
  ------------------
  823|   956k|        }
  824|  1.24M|        if (Ct->nextCtblPos)
  ------------------
  |  Branch (824:13): [True: 1.24M, False: 0]
  ------------------
  825|  1.24M|        {
  826|  1.24M|            inchi_free( Ct->nextCtblPos );
  ------------------
  |  | 1152|  1.24M|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 1.24M, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 1.24M]
  |  |  ------------------
  ------------------
  827|  1.24M|        }
  828|  1.24M|        if (Ct->nextAtRank)
  ------------------
  |  Branch (828:13): [True: 1.24M, False: 0]
  ------------------
  829|  1.24M|        {
  830|  1.24M|            inchi_free( Ct->nextAtRank );
  ------------------
  |  | 1152|  1.24M|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 1.24M, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 1.24M]
  |  |  ------------------
  ------------------
  831|  1.24M|        }
  832|  1.24M|        if (Ct->NumH)
  ------------------
  |  Branch (832:13): [True: 200k, False: 1.04M]
  ------------------
  833|   200k|        {
  834|   200k|            inchi_free( Ct->NumH );
  ------------------
  |  | 1152|   200k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 200k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 200k]
  |  |  ------------------
  ------------------
  835|   200k|        }
  836|  1.24M|        if (Ct->NumHfixed)
  ------------------
  |  Branch (836:13): [True: 73.4k, False: 1.17M]
  ------------------
  837|  73.4k|        {
  838|  73.4k|            inchi_free( Ct->NumHfixed );
  ------------------
  |  | 1152|  73.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 73.4k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 73.4k]
  |  |  ------------------
  ------------------
  839|  73.4k|        }
  840|  1.24M|        if (Ct->iso_sort_key)
  ------------------
  |  Branch (840:13): [True: 916, False: 1.24M]
  ------------------
  841|    916|        {
  842|    916|            inchi_free( Ct->iso_sort_key );
  ------------------
  |  | 1152|    916|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 916, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 916]
  |  |  ------------------
  ------------------
  843|    916|        }
  844|  1.24M|        if (Ct->iso_exchg_atnos)
  ------------------
  |  Branch (844:13): [True: 120, False: 1.24M]
  ------------------
  845|    120|        {
  846|    120|            inchi_free( Ct->iso_exchg_atnos );
  ------------------
  |  | 1152|    120|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 120, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 120]
  |  |  ------------------
  ------------------
  847|    120|        }
  848|       |
  849|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
  850|       |        if (Ct->iso_sort_key_Hfixed)
  851|       |        {
  852|       |            inchi_free( Ct->iso_sort_key_Hfixed );
  853|       |        }
  854|       |#endif
  855|       |
  856|       |#ifdef INCHI_CANON_USE_HASH
  857|       |        if (Ct->hash)
  858|       |        {
  859|       |            inchi_free( Ct->hash );
  860|       |        }
  861|       |#endif
  862|       |
  863|  1.24M|        memset( Ct, 0, sizeof( Ct[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  864|  1.24M|    }
  865|  1.24M|}
UnorderedPartitionCreate:
  870|   661k|{
  871|   661k|    p->equ2 = (AT_NUMB*) inchi_calloc( n, sizeof( p->equ2[0] ) );
  ------------------
  |  | 1146|   661k|#define inchi_calloc   calloc
  ------------------
  872|       |    /* p->next = (AT_NUMB*)inchi_calloc( n, sizeof(p->next[0])); */
  873|       |
  874|   661k|    if (p->equ2 /*&& p->next*/)
  ------------------
  |  Branch (874:9): [True: 661k, False: 0]
  ------------------
  875|   661k|    {
  876|   661k|        return 1;
  877|   661k|    }
  878|       |
  879|      0|    return 0;
  880|   661k|}
UnorderedPartitionFree:
  885|   661k|{
  886|   661k|    if (p->equ2)
  ------------------
  |  Branch (886:9): [True: 661k, False: 0]
  ------------------
  887|   661k|    {
  888|   661k|        inchi_free( p->equ2 );
  ------------------
  |  | 1152|   661k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 661k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 661k]
  |  |  ------------------
  ------------------
  889|   661k|    }
  890|       |
  891|       |    /* if (p->next) inchi_free( p->next); */
  892|   661k|    p->equ2 = NULL;
  893|       |    /* p->next = NULL; */
  894|   661k|}
UnorderedPartitionMakeDiscrete:
  899|   330k|{
  900|   330k|    int i;
  901|  1.52M|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (901:17): [True: 1.19M, False: 330k]
  ------------------
  902|  1.19M|    {
  903|  1.19M|        p->equ2[i] = (AT_NUMB) i;
  904|       |        /* p->next[i] = INCHI_CANON_INFINITY; */
  905|  1.19M|    }
  906|   330k|    INCHI_HEAPCHK
  907|   330k|}
PartitionCreate:
  912|   661k|{
  913|   661k|    p->AtNumber = (AT_NUMB*) inchi_calloc( n, sizeof( p->AtNumber[0] ) );
  ------------------
  |  | 1146|   661k|#define inchi_calloc   calloc
  ------------------
  914|   661k|    p->Rank = (AT_RANK*) inchi_calloc( n, sizeof( p->Rank[0] ) );
  ------------------
  |  | 1146|   661k|#define inchi_calloc   calloc
  ------------------
  915|   661k|    if (p->AtNumber && p->Rank)
  ------------------
  |  Branch (915:9): [True: 661k, False: 0]
  |  Branch (915:24): [True: 661k, False: 0]
  ------------------
  916|   661k|    {
  917|   661k|        return 1;
  918|   661k|    }
  919|      0|    return 0;
  920|   661k|}
PartitionFree:
  925|  1.66M|{
  926|  1.66M|    if (p)
  ------------------
  |  Branch (926:9): [True: 1.66M, False: 0]
  ------------------
  927|  1.66M|    {
  928|  1.66M|        if (p->AtNumber)
  ------------------
  |  Branch (928:13): [True: 951k, False: 717k]
  ------------------
  929|   951k|        {
  930|   951k|            inchi_free( p->AtNumber );
  ------------------
  |  | 1152|   951k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 951k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 951k]
  |  |  ------------------
  ------------------
  931|   951k|            p->AtNumber = NULL;
  932|   951k|        }
  933|  1.66M|        if (p->Rank)
  ------------------
  |  Branch (933:13): [True: 951k, False: 717k]
  ------------------
  934|   951k|        {
  935|   951k|            inchi_free( p->Rank );
  ------------------
  |  | 1152|   951k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 951k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 951k]
  |  |  ------------------
  ------------------
  936|       |            p->Rank = NULL;
  937|   951k|        }
  938|  1.66M|    }
  939|  1.66M|}
PartitionIsDiscrete:
  944|  6.52M|{
  945|  6.52M|    int i;
  946|  6.52M|    AT_RANK r;
  947|   636M|    for (i = 0, r = 1; i < n; i++, r++)
  ------------------
  |  Branch (947:24): [True: 635M, False: 717k]
  ------------------
  948|   635M|    {
  949|   635M|        if (r != ( rank_mask_bit & p->Rank[p->AtNumber[i]] ))
  ------------------
  |  Branch (949:13): [True: 5.80M, False: 630M]
  ------------------
  950|  5.80M|        {
  951|  5.80M|            INCHI_HEAPCHK
  952|  5.80M|            return 0;
  953|  5.80M|        }
  954|   635M|    }
  955|       |
  956|       |    INCHI_HEAPCHK
  957|       |
  958|   717k|    return 1;
  959|  6.52M|}
PartitionGetFirstCell:
  964|  5.80M|{
  965|  5.80M|    int i;
  966|  5.80M|    AT_RANK r;
  967|  5.80M|    Cell *W = baseW + k - 1;
  968|       |
  969|  5.80M|    i = ( k > 1 ) ? baseW[k - 2].first + 1 : 0;
  ------------------
  |  Branch (969:9): [True: 5.72M, False: 76.5k]
  ------------------
  970|       |
  971|  5.80M|    if (i < n)
  ------------------
  |  Branch (971:9): [True: 5.80M, False: 0]
  ------------------
  972|  5.80M|    {
  973|       |        /* bypass single vertex cells */
  974|  6.69M|        for (r = (AT_RANK) ( i + 1 ); i < n && r == ( rank_mask_bit & p->Rank[(int) p->AtNumber[i]] ); i++, r++)
  ------------------
  |  Branch (974:39): [True: 6.69M, False: 0]
  |  Branch (974:48): [True: 894k, False: 5.80M]
  ------------------
  975|   894k|        {
  976|   894k|            ;
  977|   894k|        }
  978|  5.80M|    }
  979|  5.80M|    if (i < n)
  ------------------
  |  Branch (979:9): [True: 5.80M, False: 0]
  ------------------
  980|  5.80M|    {
  981|  5.80M|        W->first = i;
  982|  5.80M|        for (r = ( rank_mask_bit & p->Rank[(int) p->AtNumber[i]] ), i++;
  983|   235M|              i < n && r == ( rank_mask_bit & p->Rank[(int) p->AtNumber[i]] );
  ------------------
  |  Branch (983:15): [True: 234M, False: 855k]
  |  Branch (983:24): [True: 229M, False: 4.94M]
  ------------------
  984|   229M|              i++)
  985|   229M|        {
  986|   229M|            ;
  987|   229M|        }
  988|  5.80M|        W->next = i;
  989|       |
  990|       |        INCHI_HEAPCHK
  991|       |
  992|  5.80M|        return ( W->next - W->first );
  993|  5.80M|    }
  994|       |
  995|      0|    W->first = INCHI_CANON_INFINITY;
  ------------------
  |  |   31|      0|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
  996|      0|    W->next = 0;
  997|       |
  998|       |    INCHI_HEAPCHK
  999|       |
 1000|      0|    return 0;
 1001|  5.80M|}
CellMakeEmpty:
 1006|  5.89M|{
 1007|  5.89M|    k--;
 1008|  5.89M|    baseW[k].first = INCHI_CANON_INFINITY;
  ------------------
  |  |   31|  5.89M|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 1009|  5.89M|    baseW[k].next = 0;
 1010|  5.89M|    baseW[k].prev = -1;
 1011|       |
 1012|  5.89M|    INCHI_HEAPCHK
 1013|  5.89M|}
NodeSetFromVertices:
 1018|   121k|{
 1019|   121k|    bitWord *Bits = cur_nodes->bitword[l - 1];
 1020|   121k|    int      len = cur_nodes->len_set * sizeof( bitWord );
 1021|   121k|    int      i, j;
 1022|       |
 1023|   121k|    memset( Bits, 0, len ); /* djb-rwth: memset_s C11/Annex K variant? */
 1024|       |
 1025|  7.91M|    for (i = 0; i < num_v; i++)
  ------------------
  |  Branch (1025:17): [True: 7.79M, False: 121k]
  ------------------
 1026|  7.79M|    {
 1027|  7.79M|        j = (int) v[i] - 1;
 1028|  7.79M|        Bits[j / pCG->m_num_bit] |= pCG->m_bBit[j % pCG->m_num_bit];
 1029|  7.79M|    }
 1030|       |
 1031|   121k|    INCHI_HEAPCHK
 1032|   121k|}
AllNodesAreInSet:
 1037|  8.95M|{
 1038|  8.95M|    int i;
 1039|  8.95M|    int n = cur_nodes->len_set;
 1040|       |
 1041|  8.95M|    bitWord *BitsNode = cur_nodes->bitword[lcur_nodes - 1];
 1042|  8.95M|    bitWord *BitsSet = set->bitword[lset - 1];
 1043|       |
 1044|       |    /* find any BitsNode[i] bit not in BitsSet[i] */
 1045|  43.6M|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (1045:17): [True: 40.6M, False: 2.97M]
  ------------------
 1046|  40.6M|    {
 1047|  40.6M|        if (BitsNode[i] & ~BitsSet[i])
  ------------------
  |  Branch (1047:13): [True: 5.97M, False: 34.7M]
  ------------------
 1048|  5.97M|        {
 1049|       |
 1050|       |            INCHI_HEAPCHK
 1051|       |
 1052|  5.97M|                return 0;
 1053|  5.97M|        }
 1054|  40.6M|    }
 1055|       |
 1056|       |    INCHI_HEAPCHK
 1057|       |
 1058|  2.97M|    return 1;
 1059|  8.95M|}
PartitionGetMcrAndFixSet:
 1069|      4|{
 1070|      4|    int i, j1, j2;
 1071|      4|    AT_RANK r, r1;
 1072|      4|    bitWord *McrBits = Mcr->bitword[l - 1];
 1073|      4|    bitWord *FixBits = Fix->bitword[l - 1];
 1074|      4|    int     len = Mcr->len_set * sizeof( bitWord );
 1075|       |
 1076|      4|    memset( McrBits, 0, len ); /* djb-rwth: memset_s C11/Annex K variant? */
 1077|      4|    memset( FixBits, 0, len ); /* djb-rwth: memset_s C11/Annex K variant? */
 1078|     30|    for (i = 0, r = 1; i < n; i++, r++)
  ------------------
  |  Branch (1078:24): [True: 26, False: 4]
  ------------------
 1079|     26|    {
 1080|     26|        if (r == ( r1 = ( rank_mask_bit&p->Rank[j1 = (int) p->AtNumber[i]] ) ))
  ------------------
  |  Branch (1080:13): [True: 20, False: 6]
  ------------------
 1081|     20|        {
 1082|     20|            FixBits[j1 / pCG->m_num_bit] |= pCG->m_bBit[j1 % pCG->m_num_bit];
 1083|     20|            McrBits[j1 / pCG->m_num_bit] |= pCG->m_bBit[j1 % pCG->m_num_bit];
 1084|     20|        }
 1085|      6|        else
 1086|      6|        {
 1087|     12|            for (r = r1; i + 1 < n && r == ( rank_mask_bit&p->Rank[j2 = (int) p->AtNumber[i + 1]] ); i++)
  ------------------
  |  Branch (1087:26): [True: 11, False: 1]
  |  Branch (1087:39): [True: 6, False: 5]
  ------------------
 1088|      6|            {
 1089|      6|                if (j1 > j2)
  ------------------
  |  Branch (1089:21): [True: 0, False: 6]
  ------------------
 1090|      0|                {
 1091|      0|                    j1 = j2;
 1092|      0|                }
 1093|      6|            }
 1094|      6|            McrBits[j1 / pCG->m_num_bit] |= pCG->m_bBit[j1 % pCG->m_num_bit];
 1095|      6|        }
 1096|     26|    }
 1097|       |
 1098|      4|    INCHI_HEAPCHK
 1099|      4|}
NodeSetFromRadEndpoints:
 1108|  1.76k|{
 1109|  1.76k|    bitWord *Bits = cur_nodes->bitword[k];
 1110|  1.76k|    int      len = cur_nodes->len_set * sizeof( bitWord );
 1111|  1.76k|    int      i, j;
 1112|       |
 1113|  1.76k|    memset( Bits, 0, len ); /* djb-rwth: memset_s C11/Annex K variant? */
 1114|       |
 1115|  4.32k|    for (i = 1; i < num_v; i += 2)
  ------------------
  |  Branch (1115:17): [True: 2.56k, False: 1.76k]
  ------------------
 1116|  2.56k|    {
 1117|  2.56k|        j = (int) RadEndpoints[i];
 1118|  2.56k|        Bits[j / pCG->m_num_bit] |= pCG->m_bBit[j % pCG->m_num_bit];
 1119|  2.56k|    }
 1120|  1.76k|}
RemoveFromNodeSet:
 1126|  1.76k|{
 1127|  1.76k|    if (cur_nodes->bitword)
  ------------------
  |  Branch (1127:9): [True: 1.76k, False: 0]
  ------------------
 1128|  1.76k|    {
 1129|  1.76k|        bitWord *Bits = cur_nodes->bitword[k];
 1130|       |        /*int      len  = cur_nodes->len_set*sizeof(bitWord);*/
 1131|  1.76k|        int      i, j;
 1132|       |
 1133|  5.49k|        for (i = 0; i < num_v; i++)
  ------------------
  |  Branch (1133:21): [True: 3.73k, False: 1.76k]
  ------------------
 1134|  3.73k|        {
 1135|  3.73k|            j = (int) v[i];
 1136|  3.73k|            Bits[j / pCG->m_num_bit] &= ~pCG->m_bBit[j % pCG->m_num_bit];
 1137|  3.73k|        }
 1138|  1.76k|    }
 1139|  1.76k|}
DoNodeSetsIntersect:
 1144|  1.69k|{
 1145|  1.69k|    if (cur_nodes->bitword)
  ------------------
  |  Branch (1145:9): [True: 1.29k, False: 398]
  ------------------
 1146|  1.29k|    {
 1147|  1.29k|        bitWord *Bits1 = cur_nodes->bitword[k1];
 1148|  1.29k|        bitWord *Bits2 = cur_nodes->bitword[k2];
 1149|  1.29k|        int      len = cur_nodes->len_set;
 1150|  1.29k|        int      i;
 1151|       |
 1152|  1.98k|        for (i = 0; i < len; i++)
  ------------------
  |  Branch (1152:21): [True: 1.29k, False: 687]
  ------------------
 1153|  1.29k|        {
 1154|  1.29k|            if (Bits1[i] & Bits2[i])
  ------------------
  |  Branch (1154:17): [True: 610, False: 687]
  ------------------
 1155|    610|            {
 1156|    610|                return 1;
 1157|    610|            }
 1158|  1.29k|        }
 1159|  1.29k|    }
 1160|       |
 1161|  1.08k|    return 0;
 1162|  1.69k|}
IsNodeSetEmpty:
 1167|  2.46k|{
 1168|  2.46k|    if (cur_nodes->bitword)
  ------------------
  |  Branch (1168:9): [True: 1.69k, False: 769]
  ------------------
 1169|  1.69k|    {
 1170|  1.69k|        bitWord *Bits = cur_nodes->bitword[k];
 1171|  1.69k|        int      len = cur_nodes->len_set;
 1172|  1.69k|        int      i;
 1173|       |
 1174|  2.31k|        for (i = 0; i < len; i++)
  ------------------
  |  Branch (1174:21): [True: 1.69k, False: 616]
  ------------------
 1175|  1.69k|        {
 1176|  1.69k|            if (Bits[i])
  ------------------
  |  Branch (1176:17): [True: 1.08k, False: 616]
  ------------------
 1177|  1.08k|            {
 1178|  1.08k|                return 0;
 1179|  1.08k|            }
 1180|  1.69k|        }
 1181|  1.69k|    }
 1182|       |
 1183|  1.38k|    return 1;
 1184|  2.46k|}
AddNodeSet2ToNodeSet1:
 1189|    610|{
 1190|    610|    if (cur_nodes->bitword)
  ------------------
  |  Branch (1190:9): [True: 610, False: 0]
  ------------------
 1191|    610|    {
 1192|    610|        bitWord *Bits1 = cur_nodes->bitword[k1];
 1193|    610|        bitWord *Bits2 = cur_nodes->bitword[k2];
 1194|    610|        int      len = cur_nodes->len_set;
 1195|    610|        int      i;
 1196|       |
 1197|  1.22k|        for (i = 0; i < len; i++)
  ------------------
  |  Branch (1197:21): [True: 610, False: 610]
  ------------------
 1198|    610|        {
 1199|    610|            Bits1[i] |= Bits2[i];
 1200|    610|        }
 1201|    610|    }
 1202|    610|}
AddNodesToRadEndpoints:
 1212|  1.08k|{
 1213|  1.08k|    int n = nStart;
 1214|  1.08k|    if (cur_nodes->bitword)
  ------------------
  |  Branch (1214:9): [True: 1.08k, False: 0]
  ------------------
 1215|  1.08k|    {
 1216|  1.08k|        bitWord *Bits = cur_nodes->bitword[k];
 1217|  1.08k|        int      len = cur_nodes->len_set;
 1218|  1.08k|        int      i, j;
 1219|  1.08k|        Vertex   v;
 1220|       |
 1221|  2.16k|        for (i = 0, v = 0; i < len; i++)
  ------------------
  |  Branch (1221:28): [True: 1.08k, False: 1.08k]
  ------------------
 1222|  1.08k|        {
 1223|  1.08k|            if (Bits[i])
  ------------------
  |  Branch (1223:17): [True: 1.08k, False: 0]
  ------------------
 1224|  1.08k|            {
 1225|  18.4k|                for (j = 0; j < pCG->m_num_bit; j++, v++)
  ------------------
  |  Branch (1225:29): [True: 17.3k, False: 1.08k]
  ------------------
 1226|  17.3k|                {
 1227|  17.3k|                    if (Bits[i] & pCG->m_bBit[j])
  ------------------
  |  Branch (1227:25): [True: 1.61k, False: 15.7k]
  ------------------
 1228|  1.61k|                    {
 1229|  1.61k|                        if (n >= nLen)
  ------------------
  |  Branch (1229:29): [True: 0, False: 1.61k]
  ------------------
 1230|      0|                        {
 1231|      0|                            return -1; /* overflow */
 1232|      0|                        }
 1233|  1.61k|                        RadEndpoints[n++] = vRad;
 1234|  1.61k|                        RadEndpoints[n++] = v;
 1235|  1.61k|                    }
 1236|  17.3k|                }
 1237|  1.08k|            }
 1238|      0|            else
 1239|      0|            {
 1240|      0|                v += pCG->m_num_bit;
 1241|      0|            }
 1242|  1.08k|        }
 1243|  1.08k|    }
 1244|       |
 1245|  1.08k|    return n;
 1246|  1.08k|}
PartitionGetTransposition:
 1254|   386k|{
 1255|   386k|    int i;
 1256|       |
 1257|  13.6M|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (1257:17): [True: 13.2M, False: 386k]
  ------------------
 1258|  13.2M|    {
 1259|  13.2M|        gamma->nAtNumb[(int) pFrom->AtNumber[i]] = pTo->AtNumber[i];
 1260|  13.2M|    }
 1261|       |
 1262|   386k|    INCHI_HEAPCHK
 1263|   386k|}
nGetMcr2:
 1271|  15.4M|{
 1272|  15.4M|    AT_RANK n1, n2, mcr; /*  recursive version is much shorter. */
 1273|       |
 1274|       |    INCHI_HEAPCHK
 1275|       |
 1276|  15.4M|    n1 = nEqArray[(int) n];
 1277|       |
 1278|  15.4M|    if (n == n1)
  ------------------
  |  Branch (1278:9): [True: 7.65M, False: 7.80M]
  ------------------
 1279|  7.65M|    {
 1280|  7.65M|        return n;
 1281|  7.65M|    }
 1282|       |
 1283|       |    /*  1st pass: find mcr */
 1284|  11.0M|    while (n1 != ( n2 = nEqArray[(int) n1] ))
  ------------------
  |  Branch (1284:12): [True: 3.23M, False: 7.80M]
  ------------------
 1285|  3.23M|    {
 1286|  3.23M|        n1 = n2;
 1287|  3.23M|    }
 1288|       |
 1289|       |    /*  2nd pass: copy mcr to each element of the set starting from nEqArray[n] */
 1290|  7.80M|    mcr = n1;
 1291|  7.80M|    n1 = n;
 1292|  11.0M|    while ( /*n1*/ mcr != ( n2 = nEqArray[(int) n1] ))
  ------------------
  |  Branch (1292:20): [True: 3.23M, False: 7.80M]
  ------------------
 1293|  3.23M|    {
 1294|  3.23M|        nEqArray[(int) n1] = mcr;
 1295|  3.23M|        n1 = n2;
 1296|  3.23M|    }
 1297|       |
 1298|       |    INCHI_HEAPCHK
 1299|       |
 1300|  7.80M|    return ( mcr );
 1301|  15.4M|}
nJoin2Mcrs2:
 1308|   391k|{
 1309|   391k|    n1 = nGetMcr2( nEqArray, n1 );
 1310|   391k|    n2 = nGetMcr2( nEqArray, n2 );
 1311|       |
 1312|   391k|    if (n1 < n2)
  ------------------
  |  Branch (1312:9): [True: 80, False: 391k]
  ------------------
 1313|     80|    {
 1314|     80|        nEqArray[n2] = n1;
 1315|       |
 1316|       |        INCHI_HEAPCHK
 1317|       |
 1318|     80|        return 1; /*  a change has been made */
 1319|     80|    }
 1320|       |
 1321|   391k|    if (n2 < n1)
  ------------------
  |  Branch (1321:9): [True: 391k, False: 340]
  ------------------
 1322|   391k|    {
 1323|   391k|        nEqArray[n1] = n2;
 1324|       |
 1325|       |        INCHI_HEAPCHK
 1326|       |
 1327|   391k|        return 1; /*  a change has been made */
 1328|   391k|    }
 1329|       |
 1330|       |    INCHI_HEAPCHK
 1331|       |
 1332|    340|    return 0; /*  no changes */
 1333|   391k|}
GetUnorderedPartitionMcrNode:
 1338|  14.6M|{
 1339|  14.6M|    Node ret = (Node) ( 1 + nGetMcr2( p1->equ2, (AT_RANK) ( v - 1 ) ) );
 1340|       |
 1341|       |    INCHI_HEAPCHK
 1342|       |
 1343|  14.6M|    return ret;
 1344|  14.6M|}
UnorderedPartitionJoin:
 1353|   386k|{
 1354|   386k|    int i, j;
 1355|   386k|    int nNumChanges = 0;
 1356|  13.6M|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (1356:17): [True: 13.2M, False: 386k]
  ------------------
 1357|  13.2M|    {
 1358|  13.2M|        if (( j = (int) p1->equ2[i] ) == i || p2->equ2[(int) i] == p2->equ2[(int) j])
  ------------------
  |  Branch (1358:13): [True: 12.8M, False: 391k]
  |  Branch (1358:47): [True: 44, False: 391k]
  ------------------
 1359|  12.8M|        {
 1360|  12.8M|            continue;
 1361|  12.8M|        }
 1362|   391k|        nNumChanges += nJoin2Mcrs2( p2->equ2, (AT_NUMB) i, (AT_NUMB) j );
 1363|   391k|    }
 1364|       |
 1365|       |    INCHI_HEAPCHK
 1366|       |
 1367|   386k|    return nNumChanges;
 1368|   386k|}
PartitionSatisfiesLemma_2_25:
 1373|  4.68M|{
 1374|  4.68M|    int nPartitionSize = 0;
 1375|  4.68M|    int nNumNonTrivialCells = 0;
 1376|  4.68M|    AT_RANK r;
 1377|  4.68M|    int i, num;
 1378|       |
 1379|   756M|    for (i = num = 0, r = 1; i < n; i++, r++)
  ------------------
  |  Branch (1379:30): [True: 752M, False: 4.68M]
  ------------------
 1380|   752M|    {
 1381|   752M|        if (( rank_mask_bit & p->Rank[(int) p->AtNumber[i]] ) == r)
  ------------------
  |  Branch (1381:13): [True: 507M, False: 244M]
  ------------------
 1382|   507M|        {
 1383|   507M|            nPartitionSize++;
 1384|   507M|            if (num)
  ------------------
  |  Branch (1384:17): [True: 10.8M, False: 496M]
  ------------------
 1385|  10.8M|            {
 1386|       |                /* num+1 = cell size > 1 */
 1387|  10.8M|                nNumNonTrivialCells++;
 1388|  10.8M|                num = 0;
 1389|  10.8M|            }
 1390|   507M|        }
 1391|   244M|        else
 1392|   244M|        {
 1393|   244M|            num++;
 1394|   244M|        }
 1395|   752M|    }
 1396|       |
 1397|       |    /* check Lemma_2_25 conditions */
 1398|  4.68M|    if (n <= nPartitionSize + 4 ||
  ------------------
  |  Branch (1398:9): [True: 1.12M, False: 3.55M]
  ------------------
 1399|  3.55M|         n == nPartitionSize + nNumNonTrivialCells ||
  ------------------
  |  Branch (1399:10): [True: 2.50k, False: 3.55M]
  ------------------
 1400|  3.55M|         n == nPartitionSize + nNumNonTrivialCells + 1)
  ------------------
  |  Branch (1400:10): [True: 15.1k, False: 3.53M]
  ------------------
 1401|  1.14M|    {
 1402|  1.14M|        return 1;
 1403|  1.14M|    }
 1404|       |
 1405|  3.53M|    return 0;
 1406|  4.68M|}
PartitionCopy:
 1411|  6.61M|{
 1412|  6.61M|    int i;
 1413|  6.61M|    memcpy(To->AtNumber, From->AtNumber, n * sizeof(To->AtNumber[0]));
 1414|  6.61M|    memcpy(To->Rank, From->Rank, n * sizeof(To->AtNumber[0]));
 1415|       |
 1416|   960M|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (1416:17): [True: 953M, False: 6.61M]
  ------------------
 1417|   953M|    {
 1418|   953M|        To->Rank[i] &= rank_mask_bit;
 1419|   953M|    }
 1420|       |
 1421|  6.61M|    INCHI_HEAPCHK
 1422|  6.61M|}
PartitionColorVertex:
 1438|  6.20M|{
 1439|  6.20M|    int     nNumNewRanks, i, j;
 1440|  6.20M|    long    lNumNeighListIter = 0;
 1441|  6.20M|    AT_RANK rv, r;
 1442|  6.20M|    AT_NUMB s, sv;
 1443|       |
 1444|  18.6M|    for (i = 1; i <= 2; i++)
  ------------------
  |  Branch (1444:17): [True: 12.4M, False: 6.20M]
  ------------------
 1445|  12.4M|    {
 1446|  12.4M|        if (!p[i].AtNumber)
  ------------------
  |  Branch (1446:13): [True: 434k, False: 11.9M]
  ------------------
 1447|   434k|        {
 1448|   434k|            p[i].AtNumber = (AT_NUMB *) inchi_malloc( n_max * sizeof( p[0].AtNumber[0] ) );
  ------------------
  |  | 1143|   434k|#define inchi_malloc   malloc
  ------------------
 1449|   434k|        }
 1450|  12.4M|        if (!p[i].Rank)
  ------------------
  |  Branch (1450:13): [True: 434k, False: 11.9M]
  ------------------
 1451|   434k|        {
 1452|   434k|            p[i].Rank = (AT_RANK *) inchi_malloc( n_max * sizeof( p[0].Rank[0] ) );
  ------------------
  |  | 1143|   434k|#define inchi_malloc   malloc
  ------------------
 1453|   434k|        }
 1454|  12.4M|        if (!p[i].AtNumber || !p[i].Rank)
  ------------------
  |  Branch (1454:13): [True: 0, False: 12.4M]
  |  Branch (1454:31): [True: 0, False: 12.4M]
  ------------------
 1455|      0|        {
 1456|       |
 1457|       |            INCHI_HEAPCHK
 1458|       |
 1459|      0|            return CT_OUT_OF_RAM;
  ------------------
  |  |   21|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1460|      0|        }
 1461|  12.4M|    }
 1462|       |
 1463|  6.20M|    PartitionCopy( p + 1, p, n_tg );
 1464|       |
 1465|  6.20M|    sv = v - 1;          /* atom number we are looking for */
 1466|  6.20M|    if (sv >= (AT_NUMB) n_tg)
  ------------------
  |  Branch (1466:9): [True: 0, False: 6.20M]
  ------------------
 1467|      0|    {
 1468|       |
 1469|       |        INCHI_HEAPCHK
 1470|       |
 1471|      0|        return CT_CANON_ERR; /* !!! severe program error: sv not found !!! */
  ------------------
  |  |   35|      0|#define CT_CANON_ERR         (CT_ERR_FIRST-16)  /*(-30016) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1472|      0|    }
 1473|       |
 1474|  6.20M|    rv = p[1].Rank[(int) sv];  /* rank of this atom */
 1475|       |
 1476|       |    /* second, locate sv among all vertices that have same rank as v */
 1477|  6.20M|    s = n_max + 1; /* always greater than sv; this initialization is needed only to keep the compiler happy */
 1478|   239M|    for (j = (int) rv - 1; 0 <= j && rv == ( p[1].Rank[(int) ( s = p[1].AtNumber[j] )] ) && s != sv; j--) /* djb-rwth: removing redundant code */
  ------------------
  |  Branch (1478:28): [True: 239M, False: 0]
  |  Branch (1478:38): [True: 239M, False: 0]
  |  Branch (1478:93): [True: 232M, False: 6.20M]
  ------------------
 1479|   232M|    {
 1480|   232M|        ;
 1481|   232M|    }
 1482|       |
 1483|  6.20M|    if (s != sv)
  ------------------
  |  Branch (1483:9): [True: 0, False: 6.20M]
  ------------------
 1484|      0|    {
 1485|      0|        INCHI_HEAPCHK
 1486|      0|        return CT_CANON_ERR; /* !!! severe program error: sv not found !!! */
  ------------------
  |  |   35|      0|#define CT_CANON_ERR         (CT_ERR_FIRST-16)  /*(-30016) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1487|      0|    }
 1488|       |
 1489|       |    /* shift preceding atom numbers to the right to fill the gap after removing sv */
 1490|  6.20M|    r = rv - 1; /* initialization only to keep compiler happy */
 1491|  6.68M|    for (i = j--; 0 <= j && rv == ( r = p[1].Rank[(int) ( s = p[1].AtNumber[j] )] ); i = j, j--)
  ------------------
  |  Branch (1491:19): [True: 6.59M, False: 88.6k]
  |  Branch (1491:29): [True: 477k, False: 6.11M]
  ------------------
 1492|   477k|    {
 1493|   477k|        p[1].AtNumber[i] = s;
 1494|   477k|    }
 1495|       |
 1496|  6.20M|    r = ( i > 0 ) ? ( r + 1 ) : 1;  /* new reduced rank = (next lower rank)+1 or 1 */
  ------------------
  |  Branch (1496:9): [True: 6.11M, False: 88.6k]
  ------------------
 1497|       |    /* insert sv and adjust its rank */
 1498|  6.20M|    p[1].AtNumber[i] = sv;
 1499|  6.20M|    p[1].Rank[(int) sv] = r;
 1500|       |
 1501|       |
 1502|       |    /* make equitable partition */
 1503|  6.20M|    if (bDigraph)
  ------------------
  |  Branch (1503:9): [True: 1.22M, False: 4.98M]
  ------------------
 1504|  1.22M|    {
 1505|       |        /*
 1506|       |        nNumNewRanks = DifferentiateRanks2( pCG, n_tg, G,
 1507|       |                                         nNumPrevRanks+1, p[1].Rank, p[2].Rank,
 1508|       |                                         p[1].AtNumber, &lNumNeighListIter, 1 );
 1509|       |        */
 1510|  1.22M|        nNumNewRanks = DifferentiateRanks4( pCG, n_tg, G,
 1511|  1.22M|                                         nNumPrevRanks + 1, p[1].Rank, p[2].Rank /* temp array */,
 1512|  1.22M|                                         p[1].AtNumber, (AT_RANK) n, &lNumNeighListIter );
 1513|  1.22M|    }
 1514|  4.98M|    else
 1515|  4.98M|    {
 1516|       |         /*
 1517|       |         nNumNewRanks = DifferentiateRanks2( pCG, n_tg, G,
 1518|       |                                          nNumPrevRanks+1, p[1].Rank, p[2].Rank,
 1519|       |                                          p[1].AtNumber, &lNumNeighListIter, 1 );
 1520|       |         */
 1521|  4.98M|        nNumNewRanks = DifferentiateRanks3( pCG, n_tg, G,
 1522|  4.98M|                                         nNumPrevRanks + 1, p[1].Rank, p[2].Rank /* temp array */,
 1523|  4.98M|                                         p[1].AtNumber, &lNumNeighListIter );
 1524|  4.98M|    }
 1525|  6.20M|    INCHI_HEAPCHK
 1526|       |
 1527|  6.20M|    return nNumNewRanks;
 1528|  6.20M|}
CellGetMinNode:
 1552|  10.4M|{
 1553|  10.4M|    AT_NUMB i;
 1554|  10.4M|    AT_NUMB uCurAtNumb, uMinAtNumb = INCHI_CANON_INFINITY;
  ------------------
  |  |   31|  10.4M|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 1555|       |
 1556|       |    /* in case of emty cell:  (W->first=INCHI_CANON_INFINITY) > (W->next=0); returns INCHI_CANON_INFINITY */
 1557|  10.4M|    if (W->first > W->next)
  ------------------
  |  Branch (1557:9): [True: 0, False: 10.4M]
  ------------------
 1558|      0|    {
 1559|      0|        return INCHI_CANON_INFINITY;
  ------------------
  |  |   31|      0|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 1560|      0|    }
 1561|       |
 1562|  10.4M|#if ( USE_AUX_RANKING == 1 )
 1563|  10.4M|    if (pCD && pCD->nAuxRank)
  ------------------
  |  Branch (1563:9): [True: 10.4M, False: 0]
  |  Branch (1563:16): [True: 2.21M, False: 8.21M]
  ------------------
 1564|  2.21M|    {
 1565|  2.21M|        AT_RANK uMinAuxRank, uCurAuxRank;
 1566|  2.21M|        int     nCurAtNumb;
 1567|       |
 1568|  2.21M|#if ( USE_AUX_RANKING_ALL == 1 )
 1569|  2.21M|        AT_RANK uInpAuxRank;
 1570|  2.21M|        int     nInpAtNumb, nMinAtNumb;
 1571|  2.21M|#endif
 1572|       |
 1573|  2.21M|        for (i = W->first; i < W->next; i++)
  ------------------
  |  Branch (1573:28): [True: 2.21M, False: 0]
  ------------------
 1574|  2.21M|        {
 1575|  2.21M|            uCurAtNumb = p->AtNumber[(int) i];
 1576|  2.21M|            if (!( p->Rank[(int) uCurAtNumb] & rank_mark_bit ))
  ------------------
  |  Branch (1576:17): [True: 2.21M, False: 0]
  ------------------
 1577|  2.21M|            {
 1578|  2.21M|                break; /* found the first unmarked yet node */
 1579|  2.21M|            }
 1580|  2.21M|        }
 1581|  2.21M|        if (i == W->next)
  ------------------
  |  Branch (1581:13): [True: 0, False: 2.21M]
  ------------------
 1582|      0|        {
 1583|      0|            return INCHI_CANON_INFINITY;
  ------------------
  |  |   31|      0|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 1584|      0|        }
 1585|       |
 1586|  2.21M|#if ( USE_AUX_RANKING_ALL == 1 )
 1587|       |        /*==== vertex ordering definition ===
 1588|       |         * vertex v1 < v2 <=> (AuxRank(v1)==AuxRank(v2) && AtNumb(v1) < AtNumb(v2)) || (AuxRank(v1) < AuxRank(v2))
 1589|       |         * vertex v1 > v2 <=> (AuxRank(v1)==AuxRank(v2) && AtNumb(v1) > AtNumb(v2)) || (AuxRank(v1) > AuxRank(v2))
 1590|       |         * vertex v1 = v2 <=> (AuxRank(v1)==AuxRank(v2) && AtNumb(v1) == AtNumb(v2))
 1591|       |         */
 1592|       |
 1593|       |        /* set initial vMin so that vMin > any vertex */
 1594|  2.21M|        uMinAuxRank = INCHI_CANON_INFINITY;
  ------------------
  |  |   31|  2.21M|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 1595|  2.21M|        nMinAtNumb = INCHI_CANON_INFINITY;
  ------------------
  |  |   31|  2.21M|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 1596|       |        /* set vInp */
 1597|  2.21M|        if (v)
  ------------------
  |  Branch (1597:13): [True: 999k, False: 1.21M]
  ------------------
 1598|   999k|        {
 1599|   999k|            nInpAtNumb = (int) v - 1; /* previous vertex */
 1600|   999k|            uInpAuxRank = pCD->nAuxRank[nInpAtNumb];
 1601|   999k|        }
 1602|  1.21M|        else
 1603|  1.21M|        {
 1604|  1.21M|            nInpAtNumb = -1; /* less than any vertex */
 1605|  1.21M|            uInpAuxRank = 0;
 1606|  1.21M|        }
 1607|       |        /* find vMin = min { vCur : (vCur > vInp) && (vCur in W) } */
 1608|   142M|        for (; i < W->next; i++)
  ------------------
  |  Branch (1608:16): [True: 140M, False: 2.21M]
  ------------------
 1609|   140M|        {
 1610|   140M|            nCurAtNumb = (int) p->AtNumber[(int) i];
 1611|   140M|            if (!( p->Rank[nCurAtNumb] & rank_mark_bit ))
  ------------------
  |  Branch (1611:17): [True: 137M, False: 3.00M]
  ------------------
 1612|   137M|            {
 1613|       |                /* vertex nCurAtNumb is not marked, find whether it fits the conditions */
 1614|   137M|                uCurAuxRank = pCD->nAuxRank[nCurAtNumb];
 1615|   137M|                if ((uCurAuxRank == uInpAuxRank && nCurAtNumb > nInpAtNumb) || uCurAuxRank > uInpAuxRank) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1615:22): [True: 82.2M, False: 54.9M]
  |  Branch (1615:52): [True: 40.6M, False: 41.6M]
  |  Branch (1615:80): [True: 53.3M, False: 43.1M]
  ------------------
 1616|  93.9M|                {
 1617|       |                    /* here vCur > vInp */
 1618|  93.9M|                    if (uCurAuxRank == uMinAuxRank && nCurAtNumb < nMinAtNumb)
  ------------------
  |  Branch (1618:25): [True: 88.4M, False: 5.52M]
  |  Branch (1618:55): [True: 0, False: 88.4M]
  ------------------
 1619|      0|                    {
 1620|       |                        /* vCur < vMin (1) */
 1621|      0|                        nMinAtNumb = nCurAtNumb;
 1622|      0|                    }
 1623|  93.9M|                    else if (uCurAuxRank < uMinAuxRank)
  ------------------
  |  Branch (1623:30): [True: 2.09M, False: 91.8M]
  ------------------
 1624|  2.09M|                    {
 1625|       |                        /* vCur < vMin (2) */
 1626|  2.09M|                        uMinAuxRank = uCurAuxRank;
 1627|  2.09M|                        nMinAtNumb = nCurAtNumb;
 1628|  2.09M|                    }
 1629|  93.9M|                }
 1630|   137M|            }
 1631|   140M|        }
 1632|       |
 1633|  2.21M|        uMinAtNumb = ( nMinAtNumb == INCHI_CANON_INFINITY ) ? INCHI_CANON_INFINITY : (AT_NUMB) nMinAtNumb;
  ------------------
  |  |   31|  2.21M|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
                      uMinAtNumb = ( nMinAtNumb == INCHI_CANON_INFINITY ) ? INCHI_CANON_INFINITY : (AT_NUMB) nMinAtNumb;
  ------------------
  |  |   31|   146k|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
  |  Branch (1633:22): [True: 146k, False: 2.06M]
  ------------------
 1634|       |
 1635|       |#else
 1636|       |
 1637|       |        if (v)
 1638|       |        {
 1639|       |            nCurAtNumb = (int) v - 1;
 1640|       |            /* any valid found node must have nAuxRank == uMinAuxRank */
 1641|       |            uMinAuxRank = pCD->nAuxRank[nCurAtNumb];
 1642|       |        }
 1643|       |        else
 1644|       |        {
 1645|       |            /* any valid found node must have minimal uMinAuxRank from pCD->nAuxRank[] */
 1646|       |            uMinAuxRank = INCHI_CANON_INFINITY; /* undefined */
 1647|       |        }
 1648|       |
 1649|       |        for (; i < W->next; i++)
 1650|       |        {
 1651|       |            uCurAtNumb = p->AtNumber[(int) i];
 1652|       |            nCurAtNumb = (int) uCurAtNumb;
 1653|       |            if (uCurAtNumb >= v && !( p->Rank[nCurAtNumb] & rank_mark_bit ))
 1654|       |            {
 1655|       |                uCurAuxRank = pCD->nAuxRank[nCurAtNumb];
 1656|       |                if (v)
 1657|       |                {
 1658|       |                    /* get next node */
 1659|       |                    /* find node with smallest uCurAtNumb among nodes with aux. ranks equal to uMinAuxRank */
 1660|       |                    if (uCurAuxRank == uMinAuxRank && uCurAtNumb < uMinAtNumb)
 1661|       |                    {
 1662|       |                        uMinAtNumb = uCurAtNumb;
 1663|       |                    }
 1664|       |                }
 1665|       |                else
 1666|       |                {
 1667|       |                    /* get first node */
 1668|       |                    /* find node with smallest smallest uCurAtNumb among nodes with smallest aux. ranks */
 1669|       |                    if (uMinAuxRank > uCurAuxRank)
 1670|       |                    {
 1671|       |                        uMinAuxRank = uCurAuxRank;
 1672|       |                        uMinAtNumb = uCurAtNumb;
 1673|       |                    }
 1674|       |                    else
 1675|       |                    {
 1676|       |                        if (uMinAuxRank == uCurAuxRank && uCurAtNumb < uMinAtNumb)
 1677|       |                        {
 1678|       |                            uMinAtNumb = uCurAtNumb;
 1679|       |                        }
 1680|       |                    }
 1681|       |                }
 1682|       |            }
 1683|       |        }
 1684|       |#endif
 1685|  2.21M|    }
 1686|       |
 1687|  8.21M|    else
 1688|  8.21M|#endif /* } USE_AUX_RANKING */
 1689|       |
 1690|  8.21M|    {
 1691|   503M|        for (i = W->first; i < W->next; i++)
  ------------------
  |  Branch (1691:28): [True: 495M, False: 8.21M]
  ------------------
 1692|   495M|        {
 1693|   495M|            uCurAtNumb = p->AtNumber[(int) i];
 1694|   495M|            if (uCurAtNumb >= v && !( p->Rank[(int) uCurAtNumb] & rank_mark_bit ) && uCurAtNumb < uMinAtNumb)
  ------------------
  |  Branch (1694:17): [True: 339M, False: 155M]
  |  Branch (1694:36): [True: 339M, False: 0]
  |  Branch (1694:86): [True: 7.84M, False: 331M]
  ------------------
 1695|  7.84M|            {
 1696|  7.84M|                uMinAtNumb = uCurAtNumb;
 1697|  7.84M|            }
 1698|   495M|        }
 1699|  8.21M|    }
 1700|       |
 1701|  10.4M|    if (uMinAtNumb != INCHI_CANON_INFINITY)
  ------------------
  |  |   31|  10.4M|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
  |  Branch (1701:9): [True: 9.91M, False: 510k]
  ------------------
 1702|  9.91M|    {
 1703|  9.91M|        uMinAtNumb++;
 1704|  9.91M|    }
 1705|       |
 1706|       |    INCHI_HEAPCHK
 1707|       |
 1708|  10.4M|    return uMinAtNumb;
 1709|  10.4M|}
CellGetNumberOfNodes:
 1714|   380k|{
 1715|   380k|    int first = W->first;
 1716|   380k|    int next = W->next;
 1717|   380k|    int i, num;
 1718|  4.05M|    for (i = first, num = 0; i < next; i++)
  ------------------
  |  Branch (1718:30): [True: 3.67M, False: 380k]
  ------------------
 1719|  3.67M|    {
 1720|  3.67M|        if (!( rank_mark_bit & p->Rank[(int) p->AtNumber[i]] ))
  ------------------
  |  Branch (1720:13): [True: 3.67M, False: 0]
  ------------------
 1721|  3.67M|        {
 1722|  3.67M|            num++;
 1723|  3.67M|        }
 1724|  3.67M|    }
 1725|       |
 1726|       |    INCHI_HEAPCHK
 1727|       |
 1728|   380k|    return num;
 1729|   380k|}
CellIntersectWithSet:
 1735|  2.97M|{
 1736|  2.97M|    bitWord *McrBits = Mcr->bitword[l - 1];
 1737|  2.97M|    int first = W->first;
 1738|  2.97M|    int next = W->next;
 1739|  2.97M|    int i, j, k;
 1740|       |
 1741|  2.97M|    if (first >= next)
  ------------------
  |  Branch (1741:9): [True: 0, False: 2.97M]
  ------------------
 1742|      0|    {
 1743|       |        /* for testing only */
 1744|      0|        return 0;
 1745|      0|    }
 1746|   136M|    for (i = first, k = 0; i < next; i++)
  ------------------
  |  Branch (1746:28): [True: 133M, False: 2.97M]
  ------------------
 1747|   133M|    {
 1748|   133M|        j = (int) p->AtNumber[i];
 1749|   133M|        if (!( McrBits[j / pCG->m_num_bit] & pCG->m_bBit[j % pCG->m_num_bit] ))
  ------------------
  |  Branch (1749:13): [True: 2.86M, False: 130M]
  ------------------
 1750|  2.86M|        {
 1751|       |            /* BC: reading uninit memory ???-not examined yet */
 1752|  2.86M|            k += !( p->Rank[j] & rank_mark_bit ); /* for testing only */
 1753|  2.86M|            p->Rank[j] |= rank_mark_bit;
 1754|  2.86M|        }
 1755|   133M|    }
 1756|  2.97M|    INCHI_HEAPCHK
 1757|       |
 1758|  2.97M|    return k;
 1759|  2.97M|}
CtPartClear:
 1764|  76.5k|{
 1765|  76.5k|    int start;
 1766|  76.5k|    int len;
 1767|       |    /* connection table */
 1768|  76.5k|    start = k > 1 ? Ct->nextCtblPos[k - 1] : 0;
  ------------------
  |  Branch (1768:13): [True: 0, False: 76.5k]
  ------------------
 1769|  76.5k|    len = Ct->lenCt - start;
 1770|  76.5k|    if (len > 0)
  ------------------
  |  Branch (1770:9): [True: 0, False: 76.5k]
  ------------------
 1771|      0|    {
 1772|      0|        memset( Ct->Ctbl + start, 0, ( (long long)Ct->lenCt - (long long)start ) * sizeof( Ct->Ctbl[0] ) ); /* djb-rwth: cast operators added; memset_s C11/Annex K variant? */
 1773|      0|    }
 1774|  76.5k|    Ct->lenCt = start;
 1775|  76.5k|    Ct->lenPos = k;
 1776|       |
 1777|  76.5k|    INCHI_HEAPCHK
 1778|  76.5k|}
insertions_sort_NeighList_AT_NUMBERS2:
 1787|  8.43M|{
 1788|  8.43M|    AT_NUMB *i, *j, *pk, tmp, rj;
 1789|  8.43M|    int k, num = (int) *base++;
 1790|  8.86M|    for (k = 1, pk = base; k < num; k++, pk++)
  ------------------
  |  Branch (1790:28): [True: 427k, False: 8.43M]
  ------------------
 1791|   427k|    {
 1792|   427k|        i = pk;
 1793|   427k|        j = i + 1;
 1794|   427k|        rj = ( rank_mask_bit & nRank[(int) *j] );
 1795|   427k|        if (rj < max_rj)
  ------------------
  |  Branch (1795:13): [True: 186k, False: 241k]
  ------------------
 1796|   186k|        {
 1797|   217k|            while (j > base && rj < ( rank_mask_bit & nRank[(int) *i] ))
  ------------------
  |  Branch (1797:20): [True: 202k, False: 14.7k]
  |  Branch (1797:32): [True: 31.0k, False: 171k]
  ------------------
 1798|  31.0k|            {
 1799|  31.0k|                tmp = *i;
 1800|  31.0k|                *i = *j;
 1801|  31.0k|                *j = tmp;
 1802|  31.0k|                j = i--;
 1803|  31.0k|            }
 1804|   186k|        }
 1805|   427k|    }
 1806|       |
 1807|  8.43M|    INCHI_HEAPCHK
 1808|  8.43M|}
CtPartFill:
 1823|  6.46M|{
 1824|       |    /*  k = (new index in Ct->nextAtRank[] and Ct->nextCtblPos[]) + 1 */
 1825|       |
 1826|  6.46M|    int     startCtbl;
 1827|  6.46M|    int     startAtOrd;
 1828|  6.46M|    AT_RANK r, rj, nn, j, rj_prev; /* djb-rwth: ignoring LLVM warning as the variable is used */
 1829|  6.46M|    int     i, m, an_sao;
 1830|       |
 1831|       |#ifdef INCHI_CANON_USE_HASH
 1832|       |    CtHash  hash = 0;
 1833|       |#endif
 1834|       |
 1835|       |    /* djb-rwth: removing redundant code */
 1836|       |
 1837|       |    INCHI_HEAPCHK
 1838|       |
 1839|  6.46M|    k--;
 1840|  6.46M|    if (Ct && k) /* djb-rwth: fixing oss-fuzz issue #69612 */
  ------------------
  |  Branch (1840:9): [True: 6.46M, False: 0]
  |  Branch (1840:15): [True: 6.05M, False: 408k]
  ------------------
 1841|  6.05M|    {
 1842|  6.05M|        startCtbl = Ct->nextCtblPos[k - 1];
 1843|  6.05M|        startAtOrd = Ct->nextAtRank[k - 1] - 1;  /* here  p->Rank[p->AtNumber[r-1]] = r */
 1844|  6.05M|    }
 1845|   408k|    else
 1846|   408k|    {
 1847|   408k|        startCtbl = 0;
 1848|   408k|        startAtOrd = 0;
 1849|   408k|    }
 1850|       |
 1851|       |    /******* Well-defined (by fixed ranks) part of the connection table ************/
 1852|       |    /* djb-rwth: fixing oss-fuzz issue #69612 */
 1853|  6.46M|    if (startAtOrd < 0)
  ------------------
  |  Branch (1853:9): [True: 0, False: 6.46M]
  ------------------
 1854|      0|    {
 1855|      0|        return;
 1856|      0|    }
 1857|       |    /* djb-rwth: fixing oss-fuzz issue #391043585 */
 1858|  6.46M|    if (startAtOrd < n_max && Ct)
  ------------------
  |  Branch (1858:9): [True: 6.46M, False: 0]
  |  Branch (1858:31): [True: 6.46M, False: 0]
  ------------------
 1859|  6.46M|    {
 1860|  6.46M|        an_sao = (int)p->AtNumber[startAtOrd];
 1861|  6.46M|        r = (rank_mask_bit & p->Rank[an_sao]);
 1862|       |
 1863|  14.8M|        for (i = startAtOrd; i < n_tg && r == (rank_mask_bit & p->Rank[m = (int)p->AtNumber[i]]); i++, r++)
  ------------------
  |  Branch (1863:30): [True: 14.1M, False: 730k]
  |  Branch (1863:42): [True: 8.43M, False: 5.73M]
  ------------------
 1864|  8.43M|        {
 1865|  8.43M|            Ct->Ctbl[startCtbl++] = r;
 1866|  8.43M|            insertions_sort_NeighList_AT_NUMBERS2(G[m], p->Rank, r);
 1867|  8.43M|            nn = G[m][0];   /* number of neighbors */
 1868|  8.43M|            rj_prev = 0;    /* debug only */ /* djb-rwth: ignoring LLVM warning as the variable is used */
 1869|       |
 1870|       |#ifdef INCHI_CANON_USE_HASH
 1871|       |            hash = add2crc32(hash, (AT_NUMB)(r + n));
 1872|       |#endif
 1873|       |
 1874|  8.90M|            for (j = 1; j <= nn && (rj = (rank_mask_bit & p->Rank[(int)G[m][j]])) < r; j++)
  ------------------
  |  Branch (1874:25): [True: 797k, False: 8.11M]
  |  Branch (1874:36): [True: 471k, False: 325k]
  ------------------
 1875|   471k|            {
 1876|   471k|                Ct->Ctbl[startCtbl++] = rj;
 1877|       |
 1878|       |#ifdef INCHI_CANON_USE_HASH
 1879|       |                hash = add2crc32(hash, rj);
 1880|       |#endif
 1881|       |
 1882|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 1883|       |                /* debug only */
 1884|       |                if (rj < rj_prev)
 1885|       |                {
 1886|       |                    int stop = 1;   /* <BRKPT> */
 1887|       |                }
 1888|       |#endif
 1889|       |
 1890|   471k|                rj_prev = rj; /* djb-rwth: ignoring LLVM warning as the variable is used */
 1891|   471k|            }
 1892|  8.43M|        }
 1893|  6.46M|    }
 1894|      0|    else
 1895|      0|    {
 1896|      0|        return;
 1897|      0|    }
 1898|       |
 1899|       |    INCHI_HEAPCHK
 1900|       |
 1901|       |    /****************** Well-defined part of base hydrogen atoms *******************/
 1902|  6.46M|    if (Ct)
  ------------------
  |  Branch (1902:9): [True: 6.46M, False: 0]
  ------------------
 1903|  6.46M|    {
 1904|  6.46M|        if (pCD->NumH && Ct->NumH)
  ------------------
  |  Branch (1904:13): [True: 1.30M, False: 5.16M]
  |  Branch (1904:26): [True: 1.30M, False: 0]
  ------------------
 1905|  1.30M|        {
 1906|  1.30M|            nn = inchi_min(n, i);
  ------------------
  |  |  139|  1.30M|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 20.1k, False: 1.28M]
  |  |  ------------------
  ------------------
 1907|  2.76M|            for (j = startAtOrd; j < nn; j++)
  ------------------
  |  Branch (1907:34): [True: 1.46M, False: 1.30M]
  ------------------
 1908|  1.46M|            {
 1909|       |                /* atoms */
 1910|  1.46M|                Ct->NumH[j] = pCD->NumH[p->AtNumber[j]];
 1911|  1.46M|            }
 1912|  1.32M|            for (; j < i; j++)
  ------------------
  |  Branch (1912:20): [True: 20.3k, False: 1.30M]
  ------------------
 1913|  20.3k|            {
 1914|       |                /* t-groups */
 1915|  20.3k|                int data_pos = n + T_NUM_NO_ISOTOPIC * ((int)p->AtNumber[j] - n);
  ------------------
  |  |   69|  20.3k|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
 1916|  60.9k|                for (m = 0; m < T_NUM_NO_ISOTOPIC; m++)
  ------------------
  |  |   69|  60.9k|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
  |  Branch (1916:29): [True: 40.6k, False: 20.3k]
  ------------------
 1917|  40.6k|                {
 1918|  40.6k|                    Ct->NumH[nn++] = pCD->NumH[data_pos++];
 1919|  40.6k|                }
 1920|  20.3k|            }
 1921|  1.30M|            Ct->lenNumH = nn;
 1922|  1.30M|        }
 1923|  5.16M|        else
 1924|  5.16M|        {
 1925|  5.16M|            Ct->lenNumH = 0;
 1926|  5.16M|        }
 1927|       |
 1928|       |        INCHI_HEAPCHK
 1929|       |
 1930|       |            /****************** Well-defined part of fixed hydrogen atoms *******************/
 1931|  6.46M|            if (pCD->NumHfixed && Ct->NumHfixed)
  ------------------
  |  Branch (1931:17): [True: 43.4k, False: 6.41M]
  |  Branch (1931:35): [True: 43.4k, False: 0]
  ------------------
 1932|  43.4k|            {
 1933|  43.4k|                nn = inchi_min(n, i);
  ------------------
  |  |  139|  43.4k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 43.4k]
  |  |  ------------------
  ------------------
 1934|   102k|                for (j = startAtOrd; j < nn; j++)
  ------------------
  |  Branch (1934:38): [True: 58.8k, False: 43.4k]
  ------------------
 1935|  58.8k|                {
 1936|  58.8k|                    Ct->NumHfixed[j] = pCD->NumHfixed[p->AtNumber[j]];
 1937|       |
 1938|  58.8k|                    INCHI_HEAPCHK
 1939|  58.8k|                }
 1940|       |                /* Ct->lenNumHfixed = nn; */
 1941|  43.4k|            }
 1942|  6.41M|            else
 1943|  6.41M|            {
 1944|  6.41M|                ;/* Ct->lenNumHfixed = 0; */
 1945|  6.41M|            }
 1946|       |
 1947|       |        INCHI_HEAPCHK
 1948|       |
 1949|       |            /****************** Well-defined part of isotopic keys ***************************/
 1950|  6.46M|            if (pCD->iso_sort_key && Ct->iso_sort_key)
  ------------------
  |  Branch (1950:17): [True: 360k, False: 6.10M]
  |  Branch (1950:38): [True: 360k, False: 0]
  ------------------
 1951|   360k|            {
 1952|   772k|                for (j = startAtOrd; j < i; j++)
  ------------------
  |  Branch (1952:38): [True: 411k, False: 360k]
  ------------------
 1953|   411k|                {
 1954|   411k|                    Ct->iso_sort_key[j] = pCD->iso_sort_key[p->AtNumber[j]];
 1955|   411k|                }
 1956|   360k|                Ct->len_iso_sort_key = i;
 1957|   360k|            }
 1958|  6.10M|            else
 1959|  6.10M|            {
 1960|  6.10M|                Ct->len_iso_sort_key = 0;
 1961|  6.10M|            }
 1962|       |
 1963|       |        INCHI_HEAPCHK
 1964|       |
 1965|       |            /****************** Well-defined part of isotopic iso_exchg_atnos ***************************/
 1966|  6.46M|            if (pCD->iso_exchg_atnos && Ct->iso_exchg_atnos)
  ------------------
  |  Branch (1966:17): [True: 140k, False: 6.32M]
  |  Branch (1966:41): [True: 140k, False: 0]
  ------------------
 1967|   140k|            {
 1968|   291k|                for (j = startAtOrd; j < i; j++)
  ------------------
  |  Branch (1968:38): [True: 151k, False: 140k]
  ------------------
 1969|   151k|                {
 1970|   151k|                    Ct->iso_exchg_atnos[j] = pCD->iso_exchg_atnos[p->AtNumber[j]];
 1971|   151k|                }
 1972|   140k|                Ct->len_iso_exchg_atnos = i;
 1973|   140k|            }
 1974|  6.32M|            else
 1975|  6.32M|            {
 1976|  6.32M|                Ct->len_iso_exchg_atnos = 0;
 1977|  6.32M|            }
 1978|       |
 1979|       |        INCHI_HEAPCHK
 1980|       |
 1981|       |            /******** Well-defined part of isotopic keys for fixed hydrogen atoms ************/
 1982|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 1983|       |            if (pCD->iso_sort_key_Hfixed && Ct->iso_sort_key_Hfixed)
 1984|       |            {
 1985|       |                nn = inchi_min(n, i);
 1986|       |                for (j = startAtOrd; j < nn; j++)
 1987|       |                {
 1988|       |                    Ct->iso_sort_key_Hfixed[j] = pCD->iso_sort_key_Hfixed[p->AtNumber[j]];
 1989|       |                }
 1990|       |                Ct->len_iso_sort_key_Hfixed = nn;
 1991|       |            }
 1992|       |            else
 1993|       |            {
 1994|       |                Ct->len_iso_sort_key_Hfixed = 0;
 1995|       |            }
 1996|       |#endif
 1997|       |
 1998|       |        INCHI_HEAPCHK
 1999|       |
 2000|  6.46M|            Ct->lenCt = startCtbl; /* not aways increases */
 2001|  6.46M|        Ct->nextCtblPos[k] = startCtbl;
 2002|  6.46M|        Ct->nextAtRank[k] = r;
 2003|  6.46M|        Ct->lenPos = k + 1;
 2004|       |
 2005|       |        /* The rest of the CTable */
 2006|       |
 2007|       |#ifdef INCHI_CANON_USE_HASH
 2008|       |        while (i < n)
 2009|       |        {
 2010|       |            r = (rank_mask_bit & p->Rank[m = (int)p->AtNumber[i]]);
 2011|       |            hash = add2crc32(hash, (AT_NUMB)(r + n));
 2012|       |            r++;
 2013|       |            insertions_sort_NeighList_AT_NUMBERS2(G[m], p->Rank, r);
 2014|       |            nn = G[m][0];
 2015|       |            rj_prev = 0; /* debug only */
 2016|       |            for (j = 1; j <= nn && (rj = (rank_mask_bit & p->Rank[(int)G[m][j]])) < r; j++)
 2017|       |            {
 2018|       |                hash = add2crc32(hash, rj);
 2019|       |            }
 2020|       |            i++;
 2021|       |        }
 2022|       |        Ct->hash[k] = hash;
 2023|       |#endif
 2024|  6.46M|    }
 2025|  6.46M|    INCHI_HEAPCHK
 2026|  6.46M|}
CtPartINCHI_CANON_INFINITY:
 2031|   407k|{
 2032|   407k|    int     startCtbl;
 2033|       |    /*int     startAtOrd;*/
 2034|   407k|    k--;
 2035|   407k|    if (k)
  ------------------
  |  Branch (2035:9): [True: 407k, False: 0]
  ------------------
 2036|   407k|    {
 2037|   407k|        startCtbl = Ct->nextCtblPos[k - 1];
 2038|       |        /*startAtOrd = Ct->nextAtRank[k-1]-1;*/  /* here  p->Rank[p->AtNumber[r-1]] = r */
 2039|   407k|        if (cmp)
  ------------------
  |  Branch (2039:13): [True: 0, False: 407k]
  ------------------
 2040|      0|        {
 2041|      0|            memset( cmp, 0, k * sizeof( cmp[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2042|      0|        }
 2043|   407k|    }
 2044|      0|    else
 2045|      0|    {
 2046|      0|        startCtbl = 0;
 2047|       |        /*startAtOrd = 0;*/
 2048|      0|    }
 2049|   407k|    if (!startCtbl || Ct->Ctbl[startCtbl - 1] != EMPTY_CT)
  ------------------
  |  |   35|   407k|#define EMPTY_CT       0
  ------------------
  |  Branch (2049:9): [True: 0, False: 407k]
  |  Branch (2049:23): [True: 407k, False: 0]
  ------------------
 2050|   407k|    {
 2051|   407k|        Ct->Ctbl[startCtbl] = EMPTY_CT;
  ------------------
  |  |   35|   407k|#define EMPTY_CT       0
  ------------------
 2052|   407k|    }
 2053|       |
 2054|   407k|    INCHI_HEAPCHK
 2055|   407k|}
CtPartCompare:
 2095|  12.7M|{
 2096|  12.7M|    int     startCt1, endCt1, startCt2, endCt2; /*endCt,*/
 2097|  12.7M|    int     startAt1, endAt1, startAt2, endAt2; /*endCt,*/
 2098|  12.7M|    int     midCt /* end of atoms only Ct */, midNumH = 0 /* end of atoms only NumH */, maxVert;
 2099|  12.7M|    int     diff, i, k1, k2, lenNumH, /*mid_iso_sort_key,*/ midAt; /* djb-rwth: ignoring LLVM warning: variables used */
 2100|  12.7M|    int     nLayer = 0;
 2101|       |
 2102|  12.7M|    k--;
 2103|  12.7M|    i = -1;
 2104|       |
 2105|       |    /* set kLeastForLayer[nLayer].k = (k+1) or -(k+1)
 2106|       |           kLeastForLayer[nLayer].i = iDiff
 2107|       |        if all the conditions are met:
 2108|       |        1) kLeastForLayer[nLayer].k = 0
 2109|       |        2) diff==0 for all layers < nLayer
 2110|       |
 2111|       |        sign:
 2112|       |        if the final diff < 0 then kLeastForLayer[nLayer].k = -(k+1) else
 2113|       |        if the final diff > 0 then kLeastForLayer[nLayer].k = +(k+1)
 2114|       |
 2115|       |        k+1 instead of k takes into account k--; statememt above)
 2116|       |
 2117|       |        meaning:
 2118|       |        ========
 2119|       |        abs(kLeastForLayer[nLayer].k) is the greatest level k at which
 2120|       |        difference at layer nLayer are zeroes of hidden by differences in smaller nLayer.
 2121|       |
 2122|       |        "Hidden by difference in smaller level" means that nLayer of comparison
 2123|       |        has not been reached because the difference was discovered at a previous layer.
 2124|       |
 2125|       |
 2126|       |        Lambda vs zf_zeta comparison
 2127|       |        =============================================
 2128|       |        accept only diff == 0
 2129|       |
 2130|       |        Lambda vs pzb_rho and pzb_rho_fix comparison
 2131|       |        =============================================
 2132|       |        Maintain kLeastForLayer[] and kLeastForLayerFix[]
 2133|       |
 2134|       |        The algorithm provides that pzb_rho(m-1) < pzb_rho(m) <= pzb_rho_fix
 2135|       |
 2136|       |        Definition: pzb_rho(m-1) < pzb_rho(m) means that
 2137|       |        -----------------------------------------------
 2138|       |        pzb_rho(m-1)[nLayerCurr] == pzb_rho(m)[nLayerCurr] for nLayerCurr = 0..nLayerDiff-1
 2139|       |        pzb_rho(m-1)[nLayerDiff] <  pzb_rho(m)[nLayerDiff]
 2140|       |
 2141|       |        Definition: pzb_rho(m-1)[nLayerDiff] <  pzb_rho(m)[nLayerDiff] means that
 2142|       |        -------------------------------------------------------------------------
 2143|       |        pzb_rho(m-1)[nLayerDiff][i]     == pzb_rho(m)[nLayerDiff][i] for i=0..iDdiff-1
 2144|       |        pzb_rho(m-1)[nLayerDiff][iDdiff] < pzb_rho(m)[nLayerDiff][iDdiff]
 2145|       |
 2146|       |        This defines nLayerDiff(pzb1, pzb2) where pszb1 = pzb_rho(a), pzb2=pzb_rho(b) (a<b) or pzb_rho_fix
 2147|       |               and   iDdiff    (pzb1, pzb2).
 2148|       |        In case pzb_rho(m)[nLayerCurr] == pzb_rho_fix[nLayerCurr] for all non-NULL nLayerCurr in pzb_rho_fix,
 2149|       |           nLayerDiff(pzb_rho(m), pzb_rho_fix) = the first layer in pzb_rho(m) not present in pzb_rho_fix
 2150|       |           iDdiff    (pzb_rho(m), pzb_rho_fix) = -1
 2151|       |        Case when such a layer does not exist means program error
 2152|       |
 2153|       |        Suppose L_rho = nLayerDiff(Lambda, pzb_rho(m))
 2154|       |                L_fix = nLayerDiff(Lambda, pzb_rho_fix)
 2155|       |                I_rho = iDdiff    (Lambda, pzb_rho(m))
 2156|       |                I_fix = iDdiff    (Lambda, pzb_rho_fix)
 2157|       |                kLeastForLayer determined from Lambda vs pzb_rho(m) comparison
 2158|       |        Then:
 2159|       |
 2160|       |        1. Comparison Lambda vs pzb_rho_fix before reaching discrete partition
 2161|       |        ----------------------------------------------------------------------
 2162|       |        a)    0 < abs(kLeastForLayerFix[L_fix].k) <= k-1 (* in this case I_fix >= 0 *)  &&
 2163|       |              ((L_fix < L_rho) || (L_fix == L_rho && I_fix < I_rho))
 2164|       |              =>
 2165|       |              qzb_rho_fix = kLeastForLayerFix[L_fix].k if prevoiusly qzb_rho_fix == 0
 2166|       |
 2167|       |        b)    otherwise do not change qzb_rho_fix, except the following:
 2168|       |
 2169|       |        c)    Special case L_rho == L_fix && I_rho == I_fix. Let L=L_rho, I = I_rho.
 2170|       |
 2171|       |              Compare 3 valirs: Lambda[L][I], pzb_rho(m)[L][I], pzb_rho_fix[L][I]
 2172|       |              The algorithm provides pzb_rho(m)[L][I] < pzb_rho_fix[L][I]
 2173|       |              (pzb_rho(m)[L][I]==pzb_rho_fix[L][I] <=> pzb_rho(m)[L][I]==pzb_rho_fix[L][I]
 2174|       |               is impossible by construction)
 2175|       |              There are 3 possibilities:
 2176|       |              c1) Lambda[L][I]     < pzb_rho(m)[L][I]  < pzb_rho_fix[L][I] <=>
 2177|       |                  kLeastForLayer[L].k  < 0 && kLeastForLayerFix[L].k < 0
 2178|       |                  => qzb_rho := kLeastForLayer[L].k, reject too small Lambda
 2179|       |              c2) pzb_rho(m)[L][I] < Lambda[L][I]      < pzb_rho_fix[L][I]
 2180|       |                  kLeastForLayer[L].k  > 0 && kLeastForLayerFix[L].k < 0
 2181|       |                  => qzb_rho := kLeastForLayer[L].k, accept Lambda, rho:=nu
 2182|       |              c3) pzb_rho(m)[L][I] < pzb_rho_fix[L][I] < Lambda[L][I]
 2183|       |                  kLeastForLayer[L].k  > 0 && kLeastForLayerFix[L].k > 0
 2184|       |                  => qzb_rho_fix := kLeastForLayerFix[L].k, reject too big Lambda
 2185|       |
 2186|       |              Case
 2187|       |                  kLeastForLayer[L].k  < 0 && kLeastForLayerFix[L].k > 0 is impossible
 2188|       |                  because it means
 2189|       |                  pzb_rho_fix < Lambda < pzb_rho(m) <=> pzb_rho_fix < pzb_rho(m)
 2190|       |
 2191|       |
 2192|       |            Case (c3) occurs in case of (a)
 2193|       |            Case (c1)
 2194|       |
 2195|       |        2. Comparison Lambda vs pzb_rho before reaching discrete partition
 2196|       |        ----------------------------------------------------------------------
 2197|       |        a) (L_rho < L_fix) || (L_rho == L_fix && I_rho < I_fix)  =>
 2198|       |
 2199|       |           Lambda differs from pzb_rho(m) in the part of pzb_rho(m) that will never change
 2200|       |           qzb_rho = kLeastForLayer[L_rho].k; reject Labmda or accept pzb_rho(m+1):=Labmda
 2201|       |
 2202|       |        b) (L_rho == L_fix && I_rho > I_fix) && kLeastForLayer[L_rho].k < 0
 2203|       |           Lambda < pzb_rho(m), therefore
 2204|       |           qzb_rho = kLeastForLayer[L_rho].k; reject Labmda
 2205|       |
 2206|       |        c) (L_rho > L_fix) =>
 2207|       |           qzb_rho := 0 because more significant difference may be discovered
 2208|       |           in layer < L_rho later. The final comparison may be needed at the
 2209|       |           level of discrete partition.
 2210|       |
 2211|       |
 2212|       |    */
 2213|       |
 2214|  12.7M|    if (cmp)
  ------------------
  |  Branch (2214:9): [True: 0, False: 12.7M]
  ------------------
 2215|      0|    {
 2216|      0|        for (i = 0; i <= k && !cmp[i]; i++)
  ------------------
  |  Branch (2216:21): [True: 0, False: 0]
  |  Branch (2216:31): [True: 0, False: 0]
  ------------------
 2217|      0|        {
 2218|      0|            ;
 2219|      0|        }
 2220|      0|        if (i < k)
  ------------------
  |  Branch (2220:13): [True: 0, False: 0]
  ------------------
 2221|      0|        {
 2222|      0|            cmp[k] = cmp[i];
 2223|      0|            return (int) cmp[i];
 2224|      0|        }
 2225|      0|    }
 2226|       |
 2227|  12.7M|    k1 = Ct1->lenPos - 1; /* djb-rwth: ignoring LLVM warning: variable used */
 2228|  12.7M|    k2 = Ct2->lenPos - 1; /* djb-rwth: ignoring LLVM warning: variable used */
 2229|       |
 2230|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 2231|       |    if (k > k1 || k > k2)
 2232|       |    {
 2233|       |        int stop = 1;
 2234|       |    }
 2235|       |#endif
 2236|       |
 2237|  12.7M|    diff = 0; /* djb-rwth: ignoring LLVM warning: variable used */
 2238|       |
 2239|  12.7M|    if (k)
  ------------------
  |  Branch (2239:9): [True: 12.6M, False: 167k]
  ------------------
 2240|  12.6M|    {
 2241|  12.6M|        startCt1 = Ct1->nextCtblPos[k - 1];
 2242|  12.6M|        startCt2 = Ct2->nextCtblPos[k - 1];
 2243|  12.6M|        startAt1 = Ct1->nextAtRank[k - 1] - 1;
 2244|  12.6M|        startAt2 = Ct2->nextAtRank[k - 1] - 1;
 2245|  12.6M|    }
 2246|   167k|    else
 2247|   167k|    {
 2248|   167k|        startCt1 = startCt2 = 0;
 2249|   167k|        startAt1 = startAt2 = 0;
 2250|   167k|    }
 2251|       |
 2252|  12.7M|    endCt1 = Ct1->nextCtblPos[k];
 2253|  12.7M|    endCt2 = Ct2->nextCtblPos[k];
 2254|  12.7M|    endAt1 = (int) Ct1->nextAtRank[k] - 1;
 2255|  12.7M|    endAt2 = (int) Ct2->nextAtRank[k] - 1;
 2256|       |
 2257|  12.7M|    maxVert = inchi_min( Ct1->maxVert, Ct2->maxVert );
  ------------------
  |  |  139|  12.7M|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 12.7M]
  |  |  ------------------
  ------------------
 2258|       |
 2259|       |#ifdef INCHI_CANON_USE_HASH
 2260|       |    if (!diff)
 2261|       |    {
 2262|       |        if (Ct1->hash[k] > Ct2->hash[k])
 2263|       |            diff = 1;
 2264|       |        else
 2265|       |            if (Ct1->hash[k] < Ct2->hash[k])
 2266|       |                diff = -1;
 2267|       |    }
 2268|       |    if (diff)
 2269|       |    {
 2270|       |        goto done;
 2271|       |    }
 2272|       |#endif
 2273|       |
 2274|       |    /************************** lengths **************************************************/
 2275|  12.7M|    if ((diff = -( startCt1 - startCt2 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2275:9): [True: 0, False: 12.7M]
  ------------------
 2276|      0|    {
 2277|       |        /* comparing two INCHI_CANON_INFINITY terminations */
 2278|      0|        if (bOnlyCommon &&
  ------------------
  |  Branch (2278:13): [True: 0, False: 0]
  ------------------
 2279|      0|             startCt1 >= Ct1->nLenCTAtOnly && startCt2 >= Ct2->nLenCTAtOnly &&
  ------------------
  |  Branch (2279:14): [True: 0, False: 0]
  |  Branch (2279:47): [True: 0, False: 0]
  ------------------
 2280|      0|             Ct1->Ctbl[startCt1] == EMPTY_CT && Ct2->Ctbl[startCt2] == EMPTY_CT)
  ------------------
  |  |   35|      0|#define EMPTY_CT       0
  ------------------
                           Ct1->Ctbl[startCt1] == EMPTY_CT && Ct2->Ctbl[startCt2] == EMPTY_CT)
  ------------------
  |  |   35|      0|#define EMPTY_CT       0
  ------------------
  |  Branch (2280:14): [True: 0, False: 0]
  |  Branch (2280:49): [True: 0, False: 0]
  ------------------
 2281|      0|        {
 2282|      0|            return 0;
 2283|      0|        }
 2284|      0|        if (bOnlyCommon)
  ------------------
  |  Branch (2284:13): [True: 0, False: 0]
  ------------------
 2285|      0|        {
 2286|      0|            startCt1 = inchi_min( startCt1, startCt2 ); /* djb-rwth: removing redundant code */
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2287|      0|            startAt1 = startAt2 = inchi_min( startAt1, startAt2 );
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2288|      0|            if (Ct1->lenCt == Ct2->lenCt)
  ------------------
  |  Branch (2288:17): [True: 0, False: 0]
  ------------------
 2289|      0|            {
 2290|      0|                endCt1 = endCt2 = inchi_max( endCt1, endCt2 );
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2291|      0|                endAt1 = endAt2 = inchi_max( endAt1, endAt2 );
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2292|      0|            }
 2293|       |
 2294|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 2295|       |            else
 2296|       |            {
 2297|       |                int stop = 1;
 2298|       |            }
 2299|       |#endif
 2300|      0|        }
 2301|      0|        else
 2302|       |        /* comparing (taut tail) vs INCHI_CANON_INFINITY termination -- ??? */
 2303|      0|            if (startCt1 > startCt2 &&
  ------------------
  |  Branch (2303:17): [True: 0, False: 0]
  ------------------
 2304|      0|                 Ct1->maxVert > Ct2->maxVert &&
  ------------------
  |  Branch (2304:18): [True: 0, False: 0]
  ------------------
 2305|      0|                 startAt2 == Ct2->maxVert)
  ------------------
  |  Branch (2305:18): [True: 0, False: 0]
  ------------------
 2306|      0|            {
 2307|      0|                return 0;
 2308|      0|            }
 2309|      0|            else
 2310|      0|            {
 2311|      0|                goto done;
 2312|      0|            }
 2313|      0|    }
 2314|       |
 2315|  12.7M|    lenNumH = Ct1->lenNumH;
 2316|       |    /* djb-rwth: removing redundant code */
 2317|       |
 2318|  12.7M|    if ((diff = -( endCt1 - endCt2 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2318:9): [True: 10.1k, False: 12.7M]
  ------------------
 2319|  10.1k|    {
 2320|       |        /* negative sign reproduces results for NSC=28393 */
 2321|  10.1k|        if (bOnlyCommon)
  ------------------
  |  Branch (2321:13): [True: 10.1k, False: 12]
  ------------------
 2322|  10.1k|        {
 2323|  10.1k|            endCt1 = inchi_min( endCt1, endCt2 ); /* djb-rwth: removing redundant code */
  ------------------
  |  |  139|  10.1k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 10.1k]
  |  |  ------------------
  ------------------
 2324|  10.1k|            endAt1 = endAt2 = inchi_min( endAt1, endAt2 );
  ------------------
  |  |  139|  10.1k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 10.1k]
  |  |  ------------------
  ------------------
 2325|  10.1k|            lenNumH = inchi_min( Ct1->lenNumH, Ct2->lenNumH );
  ------------------
  |  |  139|  10.1k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 10.1k]
  |  |  ------------------
  ------------------
 2326|       |            /* djb-rwth: removing redundant code */
 2327|  10.1k|        }
 2328|     12|        else
 2329|     12|        {
 2330|       |            /* take care of case when comparing tautomeric vs non-tautomeric:
 2331|       |            since (taut)->maxVert > (non-taut)->maxVert, --???
 2332|       |            (taut)->maxlenCt  > (non-taut)->maxlenCt     --!!!
 2333|       |            compare up to min out of the two, ignoring INCHI_CANON_INFINITY in the last position */
 2334|     12|            if (endCt1 > endCt2 && Ct1->maxlenCt > Ct2->maxlenCt)
  ------------------
  |  Branch (2334:17): [True: 5, False: 7]
  |  Branch (2334:36): [True: 0, False: 5]
  ------------------
 2335|      0|            {
 2336|      0|                if (endAt2 == Ct2->maxVert + 1)
  ------------------
  |  Branch (2336:21): [True: 0, False: 0]
  ------------------
 2337|      0|                {
 2338|       |                    /* remove INCHI_CANON_INFINITY termination of the shorter CT */
 2339|       |                    /* should never happen */
 2340|      0|                    endAt2--;
 2341|      0|                    lenNumH = endAt1 = endAt2; /* djb-rwth: removing redundant code */
 2342|      0|                    endCt2--;
 2343|      0|                    endCt1 = endCt2;
 2344|      0|                    diff = 0; /* djb-rwth: ignoring LLVM warning: value used? */
 2345|      0|                }
 2346|      0|                else if (endAt2 == Ct2->maxVert)
  ------------------
  |  Branch (2346:26): [True: 0, False: 0]
  ------------------
 2347|      0|                {
 2348|       |                    /* remove INCHI_CANON_INFINITY termination of CT */
 2349|      0|                    lenNumH = endAt1 = endAt2; /* djb-rwth: removing redundant code */
 2350|      0|                    endCt1 = endCt2;
 2351|      0|                    diff = 0; /* djb-rwth: ignoring LLVM warning: value used? */
 2352|      0|                }
 2353|      0|                else
 2354|      0|                {
 2355|      0|                    goto done;
 2356|      0|                }
 2357|      0|            }
 2358|     12|            else
 2359|     12|            {
 2360|     12|                goto done;
 2361|     12|            }
 2362|     12|        }
 2363|  10.1k|    }
 2364|       |
 2365|  12.7M|    if (bSplitTautCompare)
  ------------------
  |  Branch (2365:9): [True: 3.53M, False: 9.23M]
  ------------------
 2366|  3.53M|    {
 2367|  3.53M|        midCt = inchi_min( Ct1->nLenCTAtOnly, Ct2->nLenCTAtOnly );
  ------------------
  |  |  139|  3.53M|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 3.53M]
  |  |  ------------------
  ------------------
 2368|  3.53M|        if (midCt > endCt1)
  ------------------
  |  Branch (2368:13): [True: 3.44M, False: 97.3k]
  ------------------
 2369|  3.44M|        {
 2370|  3.44M|            midCt = endCt1;
 2371|  3.44M|        }
 2372|  3.53M|        midAt = inchi_min( maxVert, endAt1 );
  ------------------
  |  |  139|  3.53M|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 28.1k, False: 3.51M]
  |  |  ------------------
  ------------------
 2373|  3.53M|    }
 2374|  9.23M|    else
 2375|  9.23M|    {
 2376|  9.23M|        midCt = endCt1;
 2377|  9.23M|        midAt = endAt1;
 2378|  9.23M|    }
 2379|       |
 2380|       |
 2381|       |    /*endCt   = min(endCt1, endCt2);*/
 2382|       |    /*************************************************************************/
 2383|       |    /************ layer 0: connection table without tautomeric groups ********/
 2384|       |    /*************************************************************************/
 2385|       |
 2386|  28.8M|    for (i = startCt1; i < midCt && Ct1->Ctbl[i] == Ct2->Ctbl[i]; i++)
  ------------------
  |  Branch (2386:24): [True: 16.0M, False: 12.7M]
  |  Branch (2386:37): [True: 16.0M, False: 8]
  ------------------
 2387|       |    /*for ( i = startCt1; i < endCt && !(diff = (int)Ct1->Ctbl[i] - (int)Ct2->Ctbl[i]); i ++ )*/
 2388|  16.0M|    {
 2389|  16.0M|        ;
 2390|  16.0M|    }
 2391|       |
 2392|  12.7M|    if (i < midCt)
  ------------------
  |  Branch (2392:9): [True: 8, False: 12.7M]
  ------------------
 2393|      8|    {
 2394|      8|        diff = (int) Ct1->Ctbl[i] - (int) Ct2->Ctbl[i];
 2395|      8|        goto done;
 2396|      8|    }
 2397|       |
 2398|       |    /*************************************************************************/
 2399|       |    /******** layer 1 NumH: H atoms without tautomeric H *********************/
 2400|       |    /*************************************************************************/
 2401|       |
 2402|  12.7M|    nLayer++;
 2403|       |
 2404|       |    /*============= check limits for consistency  ==========*/
 2405|  12.7M|    if ((diff = -( startAt1 - startAt2 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2405:9): [True: 0, False: 12.7M]
  ------------------
 2406|      0|    {
 2407|      0|        goto done;   /* should not happen */
 2408|      0|    }
 2409|  12.7M|    if ((diff = -( endAt1 - endAt2 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2409:9): [True: 0, False: 12.7M]
  ------------------
 2410|      0|    {
 2411|      0|        goto done;   /* should not happen */
 2412|      0|    }
 2413|       |
 2414|       |    /*============= comparison =============================*/
 2415|  12.7M|    if (Ct1->NumH && Ct2->NumH)
  ------------------
  |  Branch (2415:9): [True: 3.53M, False: 9.23M]
  |  Branch (2415:22): [True: 3.09M, False: 443k]
  ------------------
 2416|  3.09M|    {
 2417|  3.09M|        if (endAt1 < maxVert)
  ------------------
  |  Branch (2417:13): [True: 3.00M, False: 89.0k]
  ------------------
 2418|  3.00M|        {
 2419|  3.00M|            midNumH = lenNumH = endAt1;
 2420|  3.00M|        }
 2421|  89.0k|        else if (bSplitTautCompare)
  ------------------
  |  Branch (2421:18): [True: 89.0k, False: 0]
  ------------------
 2422|  89.0k|        {
 2423|  89.0k|            midNumH = maxVert;
 2424|  89.0k|        }
 2425|      0|        else
 2426|      0|        {
 2427|      0|            midNumH = lenNumH;
 2428|      0|        }
 2429|       |
 2430|       |        /* lenNumH = (endAt2 >= maxVert)? lenNumH : endAt2; */
 2431|       |        /* endAt1 = (endAt2 == n)? lenNumH : endAt2; */
 2432|       |
 2433|  6.52M|        for (i = startAt1; i < midNumH && Ct1->NumH[i] == Ct2->NumH[i]; i++)
  ------------------
  |  Branch (2433:28): [True: 3.43M, False: 3.08M]
  |  Branch (2433:43): [True: 3.42M, False: 7.39k]
  ------------------
 2434|  3.42M|        {
 2435|  3.42M|            ;
 2436|  3.42M|        }
 2437|  3.09M|        if (i < midNumH)
  ------------------
  |  Branch (2437:13): [True: 7.39k, False: 3.08M]
  ------------------
 2438|  7.39k|        {
 2439|  7.39k|            diff = (int) Ct1->NumH[i] - (int) Ct2->NumH[i];
 2440|  7.39k|            goto done;
 2441|  7.39k|        }
 2442|  3.09M|    }
 2443|       |
 2444|       |
 2445|       |    /*************************************************************************/
 2446|       |    /************** layer 2: tautomeric part of CT and tautomeric H **********/
 2447|       |    /*************************************************************************/
 2448|  12.7M|    nLayer++;
 2449|  12.8M|    for (i = midCt; i < endCt1 && Ct1->Ctbl[i] == Ct2->Ctbl[i]; i++)
  ------------------
  |  Branch (2449:21): [True: 73.2k, False: 12.7M]
  |  Branch (2449:35): [True: 55.4k, False: 17.7k]
  ------------------
 2450|  55.4k|    {
 2451|  55.4k|        ; /* compare tautomeric groups part of CT */
 2452|  55.4k|    }
 2453|  12.7M|    if (i < endCt1)
  ------------------
  |  Branch (2453:9): [True: 17.7k, False: 12.7M]
  ------------------
 2454|  17.7k|    {
 2455|  17.7k|        diff = (int) Ct1->Ctbl[i] - (int) Ct2->Ctbl[i];
 2456|  17.7k|        goto done;
 2457|  17.7k|    }
 2458|  12.7M|    if (Ct1->NumH && Ct2->NumH)
  ------------------
  |  Branch (2458:9): [True: 3.51M, False: 9.23M]
  |  Branch (2458:22): [True: 3.07M, False: 443k]
  ------------------
 2459|  3.07M|    {
 2460|  3.09M|        for (i = midNumH; i < lenNumH && Ct1->NumH[i] == Ct2->NumH[i]; i++)
  ------------------
  |  Branch (2460:27): [True: 20.9k, False: 3.07M]
  |  Branch (2460:42): [True: 20.9k, False: 2]
  ------------------
 2461|  20.9k|        {
 2462|  20.9k|            ; /* compare tautomeric H */
 2463|  20.9k|        }
 2464|  3.07M|        if (i < lenNumH)
  ------------------
  |  Branch (2464:13): [True: 2, False: 3.07M]
  ------------------
 2465|      2|        {
 2466|      2|            diff = (int) Ct1->NumH[i] - (int) Ct2->NumH[i];
 2467|      2|            i += endCt1 - midCt;
 2468|      2|            goto done;
 2469|      2|        }
 2470|  3.07M|    }
 2471|       |
 2472|       |
 2473|       |    /*************************************************************************/
 2474|       |    /************** layer 3: Fixed H atoms ***********************************/
 2475|       |    /*************************************************************************/
 2476|  12.7M|    nLayer++;
 2477|  12.7M|    if (Ct1->NumHfixed && Ct2->NumHfixed)
  ------------------
  |  Branch (2477:9): [True: 20.6k, False: 12.7M]
  |  Branch (2477:27): [True: 15.7k, False: 4.88k]
  ------------------
 2478|  15.7k|    {
 2479|  42.8k|        for (i = startAt1; i < midAt && Ct1->NumHfixed[i] == Ct2->NumHfixed[i]; i++)
  ------------------
  |  Branch (2479:28): [True: 27.8k, False: 15.0k]
  |  Branch (2479:41): [True: 27.0k, False: 742]
  ------------------
 2480|  27.0k|        {
 2481|  27.0k|            ;
 2482|  27.0k|        }
 2483|  15.7k|        if (i < midAt)
  ------------------
  |  Branch (2483:13): [True: 742, False: 15.0k]
  ------------------
 2484|    742|        {
 2485|    742|            diff = (int) Ct1->NumHfixed[i] - (int) Ct2->NumHfixed[i];
 2486|    742|            goto done;
 2487|    742|        }
 2488|  15.7k|    }
 2489|       |
 2490|       |
 2491|       |    /*************************************************************************/
 2492|       |    /************** layer 4: isotopic atoms H, incl. tautomeric **************/
 2493|       |    /*************************************************************************/
 2494|  12.7M|    nLayer++;
 2495|  12.7M|    if (Ct1->iso_sort_key && Ct2->iso_sort_key)
  ------------------
  |  Branch (2495:9): [True: 962k, False: 11.7M]
  |  Branch (2495:30): [True: 610k, False: 351k]
  ------------------
 2496|   610k|    {
 2497|  1.27M|        for (i = startAt1; i < endAt1 && Ct1->iso_sort_key[i] == Ct2->iso_sort_key[i]; i++)
  ------------------
  |  Branch (2497:28): [True: 665k, False: 607k]
  |  Branch (2497:42): [True: 661k, False: 3.65k]
  ------------------
 2498|   661k|            ;
 2499|   610k|        if (i < endAt1)
  ------------------
  |  Branch (2499:13): [True: 3.65k, False: 607k]
  ------------------
 2500|  3.65k|        {
 2501|  3.65k|            diff = Ct1->iso_sort_key[i] > Ct2->iso_sort_key[i] ? 1 : -1;
  ------------------
  |  Branch (2501:20): [True: 3.31k, False: 338]
  ------------------
 2502|  3.65k|            goto done;
 2503|  3.65k|        }
 2504|   610k|    }
 2505|  12.7M|    if (Ct1->iso_exchg_atnos && Ct2->len_iso_exchg_atnos)
  ------------------
  |  Branch (2505:9): [True: 406k, False: 12.3M]
  |  Branch (2505:33): [True: 267k, False: 139k]
  ------------------
 2506|   267k|    {
 2507|   554k|        for (i = startAt1; i < endAt1 && Ct1->iso_exchg_atnos[i] == Ct2->iso_exchg_atnos[i]; i++)
  ------------------
  |  Branch (2507:28): [True: 287k, False: 266k]
  |  Branch (2507:42): [True: 287k, False: 353]
  ------------------
 2508|   287k|        {
 2509|   287k|            ;
 2510|   287k|        }
 2511|   267k|        if (i < endAt1)
  ------------------
  |  Branch (2511:13): [True: 353, False: 266k]
  ------------------
 2512|    353|        {
 2513|    353|            diff = Ct1->iso_exchg_atnos[i] > Ct2->iso_exchg_atnos[i] ? 1 : -1;
  ------------------
  |  Branch (2513:20): [True: 212, False: 141]
  ------------------
 2514|    353|            goto done;
 2515|    353|        }
 2516|   267k|    }
 2517|       |
 2518|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 2519|       |
 2520|       |    /*************************************************************************/
 2521|       |    /************** layer 6: Fixed isotopic H atoms **************************/
 2522|       |    /*************************************************************************/
 2523|       |    nLayer++;
 2524|       |    if (Ct1->iso_sort_key_Hfixed && Ct2->iso_sort_key_Hfixed)
 2525|       |    {
 2526|       |        for (i = startAt1; i < midAt && Ct1->iso_sort_key_Hfixed[i] == Ct2->iso_sort_key_Hfixed[i]; i++)
 2527|       |        {
 2528|       |            ;
 2529|       |        }
 2530|       |        if (i < midAt)
 2531|       |        {
 2532|       |            diff = Ct1->iso_sort_key_Hfixed[i] > Ct2->iso_sort_key_Hfixed[i] ? 1 : -1;
 2533|       |            goto done;
 2534|       |        }
 2535|       |    }
 2536|       |#endif
 2537|       |
 2538|       |
 2539|       |
 2540|  12.7M|done:
 2541|       |
 2542|  12.7M|#ifdef INCHI_CANON_MIN
 2543|  12.7M|    diff = -diff;
 2544|  12.7M|#endif
 2545|       |
 2546|  12.7M|    if (diff)
  ------------------
  |  Branch (2546:9): [True: 29.9k, False: 12.7M]
  ------------------
 2547|  29.9k|    {
 2548|  29.9k|        diff = ( diff > 0 ) ? ( nLayer + 1 ) : -( nLayer + 1 ); /* return the discovered difference layer number >= 1 */
  ------------------
  |  Branch (2548:16): [True: 1.50k, False: 28.4k]
  ------------------
 2549|  29.9k|        if (kLeastForLayer)
  ------------------
  |  Branch (2549:13): [True: 18.5k, False: 11.3k]
  ------------------
 2550|  18.5k|        {
 2551|       |
 2552|       |#if ( bRELEASE_VERSION != 1 )
 2553|       |            if (abs( kLeastForLayer[nLayer].k ) > k + 1)
 2554|       |            { /* for debug only */
 2555|       |                int stop = 1; /* <BRKPT> */
 2556|       |            }
 2557|       |#endif
 2558|       |
 2559|  18.5k|            if (!kLeastForLayer[nLayer].k)
  ------------------
  |  Branch (2559:17): [True: 18.5k, False: 0]
  ------------------
 2560|  18.5k|            {
 2561|  18.5k|                kLeastForLayer[nLayer].k = ( diff > 0 ) ? ( k + 1 ) : -( k + 1 );
  ------------------
  |  Branch (2561:44): [True: 524, False: 18.0k]
  ------------------
 2562|  18.5k|                kLeastForLayer[nLayer].i = i;
 2563|  18.5k|            }
 2564|  18.5k|            if (nLayer /* && !bOnlyCommon */)
  ------------------
  |  Branch (2564:17): [True: 18.5k, False: 10]
  ------------------
 2565|  18.5k|            {
 2566|  18.5k|                diff = 0;
 2567|  18.5k|            }
 2568|  18.5k|        }
 2569|  29.9k|    }
 2570|       |
 2571|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 2572|       |    else
 2573|       |    {
 2574|       |        int stop = 1;  /* for debug only */
 2575|       |    }
 2576|       |#endif
 2577|       |
 2578|  12.7M|    if (cmp)
  ------------------
  |  Branch (2578:9): [True: 0, False: 12.7M]
  ------------------
 2579|      0|    {
 2580|      0|        cmp[k] = ( diff > 0 ) ? 1 : ( diff < 0 ) ? -1 : 0;
  ------------------
  |  Branch (2580:18): [True: 0, False: 0]
  |  Branch (2580:37): [True: 0, False: 0]
  ------------------
 2581|      0|    }
 2582|       |
 2583|  12.7M|    return diff;
 2584|  12.7M|}
CtFullCompare:
 2592|   471k|{
 2593|   471k|    int     startCt1, endCt1, endCt2; /*endCt,*/
 2594|   471k|    int     startAt1, endAt1, endAt2; /*endCt,*/
 2595|   471k|    int     midCt   /* end of atoms only in Ctbl */,
 2596|   471k|        midNumH = 0 /* end of atoms only NumH */,
 2597|   471k|        midAt   /* end of atoms only */; /* djb-rwth: ignoring LLVM warning: variable used */
 2598|   471k|    int     diff = 0, i, k1, k2, lenNumH1, lenNumH2, maxVert /* min num atoms */;
 2599|   471k|    int     len_iso_sort_key1, len_iso_sort_key2 /*, mid_iso_sort_key*/;
 2600|   471k|    int     nLayer = 0;
 2601|       |
 2602|   471k|    k1 = Ct1->lenPos - 1;
 2603|   471k|    k2 = Ct2->lenPos - 1;
 2604|       |
 2605|       |    /* djb-rwth: removing redundant code */
 2606|       |
 2607|   471k|    startCt1 = 0; /* djb-rwth: removing redundant code */
 2608|   471k|    startAt1 = 0; /* djb-rwth: removing redundant code */
 2609|       |
 2610|   471k|    endCt1 = Ct1->nextCtblPos[k1];
 2611|   471k|    endCt2 = Ct2->nextCtblPos[k2];
 2612|   471k|    endAt1 = (int) Ct1->nextAtRank[k1] - 1;
 2613|   471k|    endAt2 = (int) Ct2->nextAtRank[k2] - 1;
 2614|       |
 2615|   471k|    maxVert = inchi_min( Ct1->maxVert, Ct2->maxVert );
  ------------------
  |  |  139|   471k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 471k]
  |  |  ------------------
  ------------------
 2616|       |
 2617|   471k|    if (bOnlyCommon)
  ------------------
  |  Branch (2617:9): [True: 84.9k, False: 386k]
  ------------------
 2618|  84.9k|    {
 2619|  84.9k|        endCt1 = inchi_min( endCt1, endCt2 );
  ------------------
  |  |  139|  84.9k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 3.46k, False: 81.4k]
  |  |  ------------------
  ------------------
 2620|  84.9k|        endCt1 = endCt2 = inchi_min( endCt1, Ct1->lenCt );
  ------------------
  |  |  139|  84.9k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 2.94k, False: 82.0k]
  |  |  ------------------
  ------------------
 2621|  84.9k|        endAt1 = inchi_min( endAt1, endAt2 ); /* djb-rwth: removing redundant code */
  ------------------
  |  |  139|  84.9k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 3.46k, False: 81.4k]
  |  |  ------------------
  ------------------
 2622|       |
 2623|  84.9k|        if (Ct1->Ctbl[endCt1] == EMPTY_CT || Ct2->Ctbl[endCt1] == EMPTY_CT) /* djb-rwth: redundant conditions removed */
  ------------------
  |  |   35|   169k|#define EMPTY_CT       0
  ------------------
                      if (Ct1->Ctbl[endCt1] == EMPTY_CT || Ct2->Ctbl[endCt1] == EMPTY_CT) /* djb-rwth: redundant conditions removed */
  ------------------
  |  |   35|  2.94k|#define EMPTY_CT       0
  ------------------
  |  Branch (2623:13): [True: 82.0k, False: 2.94k]
  |  Branch (2623:46): [True: 2.94k, False: 0]
  ------------------
 2624|  84.9k|        {
 2625|  84.9k|            endCt1 = endCt2 = endCt1 - 1;
 2626|  84.9k|        }
 2627|       |        /* djb-rwth: removing redundant code */
 2628|  84.9k|        lenNumH1 =
 2629|  84.9k|        lenNumH2 = inchi_min( Ct1->lenNumH, Ct2->lenNumH );
  ------------------
  |  |  139|  84.9k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 4.33k, False: 80.6k]
  |  |  ------------------
  ------------------
 2630|       |
 2631|       |        /* djb-rwth: removing redundant code */
 2632|  84.9k|        len_iso_sort_key1 =
 2633|  84.9k|        len_iso_sort_key2 = inchi_min( Ct1->len_iso_sort_key, Ct1->len_iso_sort_key );
  ------------------
  |  |  139|  84.9k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 84.9k]
  |  |  ------------------
  ------------------
 2634|  84.9k|    }
 2635|   386k|    else
 2636|   386k|    {
 2637|   386k|        if (Ct1->Ctbl[endCt1 - 1] == EMPTY_CT)
  ------------------
  |  |   35|   386k|#define EMPTY_CT       0
  ------------------
  |  Branch (2637:13): [True: 0, False: 386k]
  ------------------
 2638|      0|        {
 2639|      0|            endCt1--;
 2640|      0|        }
 2641|   386k|        if (Ct2->Ctbl[endCt2 - 1] == EMPTY_CT)
  ------------------
  |  |   35|   386k|#define EMPTY_CT       0
  ------------------
  |  Branch (2641:13): [True: 0, False: 386k]
  ------------------
 2642|      0|        {
 2643|      0|            endCt2--;
 2644|      0|        }
 2645|   386k|        lenNumH1 = Ct1->lenNumH;
 2646|   386k|        lenNumH2 = Ct2->lenNumH;
 2647|       |        /* djb-rwth: removing redundant code */
 2648|       |
 2649|   386k|        len_iso_sort_key1 = Ct1->len_iso_sort_key;
 2650|   386k|        len_iso_sort_key2 = Ct2->len_iso_sort_key;
 2651|       |        /* djb-rwth: removing redundant code */
 2652|   386k|    }
 2653|       |
 2654|   471k|    if ((diff = -( endCt1 - endCt2 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2654:9): [True: 0, False: 471k]
  ------------------
 2655|      0|    {
 2656|       |        /* negative sign reproduces results for NSC=28393 */
 2657|      0|        goto done;
 2658|      0|    }
 2659|       |
 2660|   471k|    if (bSplitTautCompare)
  ------------------
  |  Branch (2660:9): [True: 107k, False: 364k]
  ------------------
 2661|   107k|    {
 2662|   107k|        midCt = inchi_min( Ct1->nLenCTAtOnly, Ct2->nLenCTAtOnly );
  ------------------
  |  |  139|   107k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 107k]
  |  |  ------------------
  ------------------
 2663|   107k|        if (midCt > endCt1)
  ------------------
  |  Branch (2663:13): [True: 84.8k, False: 22.2k]
  ------------------
 2664|  84.8k|        {
 2665|  84.8k|            midCt = endCt1;
 2666|  84.8k|        }
 2667|   107k|        midAt = inchi_min( maxVert, endAt1 ); /* djb-rwth: ignoring LLVM warning: variable used? */
  ------------------
  |  |  139|   107k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 5.04k, False: 102k]
  |  |  ------------------
  ------------------
 2668|   107k|    }
 2669|   364k|    else
 2670|   364k|    {
 2671|   364k|        midCt = endCt1;
 2672|   364k|        midAt = endAt1; /* djb-rwth: ignoring LLVM warning: variable used? */
 2673|   364k|    }
 2674|       |
 2675|       |
 2676|       |    /*************************************************************************/
 2677|       |    /************ layer 0: connection table without tautomeric groups ********/
 2678|       |    /*************************************************************************/
 2679|  14.0M|    for (i = startCt1; i < midCt && Ct1->Ctbl[i] == Ct2->Ctbl[i]; i++)
  ------------------
  |  Branch (2679:24): [True: 13.5M, False: 471k]
  |  Branch (2679:37): [True: 13.5M, False: 0]
  ------------------
 2680|  13.5M|    {
 2681|  13.5M|        ;
 2682|  13.5M|    }
 2683|   471k|    if (i < midCt)
  ------------------
  |  Branch (2683:9): [True: 0, False: 471k]
  ------------------
 2684|      0|    {
 2685|      0|        diff = (int) Ct1->Ctbl[i] - (int) Ct2->Ctbl[i];
 2686|      0|        goto done;
 2687|      0|    }
 2688|       |
 2689|       |
 2690|       |    /*************************************************************************/
 2691|       |    /************* layer 1: H atoms without tautomeric H *********************/
 2692|       |    /*************************************************************************/
 2693|   471k|    nLayer++;
 2694|   471k|    if (Ct1->NumH && Ct2->NumH)
  ------------------
  |  Branch (2694:9): [True: 106k, False: 365k]
  |  Branch (2694:22): [True: 105k, False: 868]
  ------------------
 2695|   105k|    {
 2696|   105k|        if ((diff = -( lenNumH1 - lenNumH2 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2696:13): [True: 0, False: 105k]
  ------------------
 2697|      0|        {
 2698|       |            /* negative sign reproduces results for NSC=28393 */
 2699|      0|            goto done;
 2700|      0|        }
 2701|   105k|        if (endAt1 < maxVert)
  ------------------
  |  Branch (2701:13): [True: 0, False: 105k]
  ------------------
 2702|      0|        {
 2703|      0|            midNumH = lenNumH1 = endAt1;
 2704|      0|        }
 2705|   105k|        else if (bSplitTautCompare)
  ------------------
  |  Branch (2705:18): [True: 105k, False: 0]
  ------------------
 2706|   105k|        {
 2707|   105k|            midNumH = maxVert;
 2708|   105k|        }
 2709|      0|        else
 2710|      0|        {
 2711|      0|            midNumH = lenNumH1;
 2712|      0|        }
 2713|       |
 2714|  2.46M|        for (i = startAt1; i < midNumH && Ct1->NumH[i] == Ct2->NumH[i]; i++)
  ------------------
  |  Branch (2714:28): [True: 2.35M, False: 105k]
  |  Branch (2714:43): [True: 2.35M, False: 0]
  ------------------
 2715|  2.35M|        {
 2716|  2.35M|            ;
 2717|  2.35M|        }
 2718|   105k|        if (i < midNumH)
  ------------------
  |  Branch (2718:13): [True: 0, False: 105k]
  ------------------
 2719|      0|        {
 2720|      0|            diff = (int) Ct1->NumH[i] - (int) Ct2->NumH[i];
 2721|      0|            goto done;
 2722|      0|        }
 2723|   105k|    }
 2724|       |
 2725|       |
 2726|       |    /*************************************************************************/
 2727|       |    /************** layer 2: tautomeric part of CT and tautomeric H **********/
 2728|       |    /*************************************************************************/
 2729|   471k|    nLayer++;
 2730|   488k|    for (i = midCt; i < endCt1 && Ct1->Ctbl[i] == Ct2->Ctbl[i]; i++)
  ------------------
  |  Branch (2730:21): [True: 16.8k, False: 471k]
  |  Branch (2730:35): [True: 16.8k, False: 0]
  ------------------
 2731|  16.8k|    {
 2732|  16.8k|        ; /* compare tautomeric groups part of CT */
 2733|  16.8k|    }
 2734|   471k|    if (i < endCt1)
  ------------------
  |  Branch (2734:9): [True: 0, False: 471k]
  ------------------
 2735|      0|    {
 2736|      0|        diff = (int) Ct1->Ctbl[i] - (int) Ct2->Ctbl[i];
 2737|      0|        goto done;
 2738|      0|    }
 2739|   471k|    if (Ct1->NumH && Ct2->NumH)
  ------------------
  |  Branch (2739:9): [True: 106k, False: 365k]
  |  Branch (2739:22): [True: 105k, False: 868]
  ------------------
 2740|   105k|    {
 2741|   115k|        for (i = midNumH; i < lenNumH1 && Ct1->NumH[i] == Ct2->NumH[i]; i++)
  ------------------
  |  Branch (2741:27): [True: 10.2k, False: 105k]
  |  Branch (2741:43): [True: 10.2k, False: 0]
  ------------------
 2742|  10.2k|        {
 2743|  10.2k|            ; /* compare tautomeric H */
 2744|  10.2k|        }
 2745|   105k|        if (i < lenNumH1)
  ------------------
  |  Branch (2745:13): [True: 0, False: 105k]
  ------------------
 2746|      0|        {
 2747|      0|            diff = (int) Ct1->NumH[i] - (int) Ct2->NumH[i];
 2748|      0|            goto done;
 2749|      0|        }
 2750|   105k|    }
 2751|       |
 2752|       |    /*************************************************************************/
 2753|       |    /************** layer 3: Fixed H atoms ***********************************/
 2754|       |    /*************************************************************************/
 2755|   471k|    nLayer++;
 2756|   471k|    if (Ct1->NumHfixed && Ct2->NumHfixed)
  ------------------
  |  Branch (2756:9): [True: 1.86k, False: 469k]
  |  Branch (2756:27): [True: 919, False: 942]
  ------------------
 2757|    919|    {
 2758|  19.1k|        for (i = startAt1; i < endAt1 && Ct1->NumHfixed[i] == Ct2->NumHfixed[i]; i++)
  ------------------
  |  Branch (2758:28): [True: 18.2k, False: 919]
  |  Branch (2758:42): [True: 18.2k, False: 0]
  ------------------
 2759|  18.2k|        {
 2760|  18.2k|            ;
 2761|  18.2k|        }
 2762|    919|        if (i < endAt1)
  ------------------
  |  Branch (2762:13): [True: 0, False: 919]
  ------------------
 2763|      0|        {
 2764|      0|            diff = (int) Ct1->NumHfixed[i] - (int) Ct2->NumHfixed[i];
 2765|      0|            goto done;
 2766|      0|        }
 2767|    919|    }
 2768|       |
 2769|       |
 2770|       |    /*************************************************************************/
 2771|       |    /************** layer 4: isotopic atoms, H and isotopic taut H ***********/
 2772|       |    /*************************************************************************/
 2773|   471k|    nLayer++;
 2774|   471k|    if (Ct1->iso_sort_key && Ct2->iso_sort_key)
  ------------------
  |  Branch (2774:9): [True: 6.22k, False: 465k]
  |  Branch (2774:30): [True: 5.68k, False: 546]
  ------------------
 2775|  5.68k|    {
 2776|  5.68k|        if ((diff = -( len_iso_sort_key1 - len_iso_sort_key2 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2776:13): [True: 0, False: 5.68k]
  ------------------
 2777|      0|        {
 2778|       |            /* negative sign reproduces results for NSC=28393 */
 2779|      0|            goto done;
 2780|      0|        }
 2781|   550k|        for (i = startAt1; i < endAt1 && Ct1->iso_sort_key[i] == Ct2->iso_sort_key[i]; i++)
  ------------------
  |  Branch (2781:28): [True: 545k, False: 5.68k]
  |  Branch (2781:42): [True: 545k, False: 0]
  ------------------
 2782|   545k|        {
 2783|   545k|            ;
 2784|   545k|        }
 2785|  5.68k|        if (i < endAt1)
  ------------------
  |  Branch (2785:13): [True: 0, False: 5.68k]
  ------------------
 2786|      0|        {
 2787|      0|            diff = Ct1->iso_sort_key[i] > Ct2->iso_sort_key[i] ? 1 : -1;
  ------------------
  |  Branch (2787:20): [True: 0, False: 0]
  ------------------
 2788|      0|            goto done;
 2789|      0|        }
 2790|  5.68k|    }
 2791|       |
 2792|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 2793|       |
 2794|       |
 2795|       |    /*************************************************************************/
 2796|       |    /************** layer 6: Fixed isotopic H atoms **************************/
 2797|       |    /*************************************************************************/
 2798|       |    nLayer++;
 2799|       |    if (Ct1->iso_sort_key_Hfixed && Ct2->iso_sort_key_Hfixed)
 2800|       |    {
 2801|       |        for (i = startAt1; i < midAt && Ct1->iso_sort_key_Hfixed[i] == Ct2->iso_sort_key_Hfixed[i]; i++)
 2802|       |            ;
 2803|       |        if (i < midAt)
 2804|       |        {
 2805|       |            diff = Ct1->iso_sort_key_Hfixed[i] > Ct2->iso_sort_key_Hfixed[i] ? 1 : -1;
 2806|       |            goto done;
 2807|       |        }
 2808|       |    }
 2809|       |#endif
 2810|       |
 2811|       |
 2812|   471k|done:
 2813|       |
 2814|   471k|#ifdef INCHI_CANON_MIN
 2815|   471k|    diff = -diff;
 2816|   471k|#endif
 2817|       |
 2818|   471k|    if (diff)
  ------------------
  |  Branch (2818:9): [True: 0, False: 471k]
  ------------------
 2819|      0|    {
 2820|      0|        diff = ( diff > 0 ) ? ( nLayer + 1 ) : -( nLayer + 1 ); /* return the discovered difference layer number >= 1 */
  ------------------
  |  Branch (2820:16): [True: 0, False: 0]
  ------------------
 2821|      0|    }
 2822|       |
 2823|   471k|    return diff;
 2824|   471k|}
CtFullCompareLayers:
 2829|    460|{
 2830|    460|    int iLayer;
 2831|       |    /* check for the rejection condition: Lambda > zb_rho_fix */
 2832|  46.4k|    for (iLayer = 0; iLayer < MAX_LAYERS; iLayer++)
  ------------------
  |  |   27|  46.4k|#define MAX_LAYERS   100
  ------------------
  |  Branch (2832:22): [True: 46.0k, False: 460]
  ------------------
 2833|  46.0k|    {
 2834|  46.0k|        if (kLeastForLayer[iLayer].k)
  ------------------
  |  Branch (2834:13): [True: 0, False: 46.0k]
  ------------------
 2835|      0|        {
 2836|      0|            return ( kLeastForLayer[iLayer].k > 0 ) ? ( iLayer + 1 ) : -( iLayer + 1 );
  ------------------
  |  Branch (2836:20): [True: 0, False: 0]
  ------------------
 2837|      0|        }
 2838|  46.0k|    }
 2839|       |
 2840|    460|    return 0;
 2841|    460|}
CtCompareLayersGetFirstDiff:
 2850|  6.97M|{
 2851|  6.97M|    int iLayer;
 2852|  6.97M|    if (kLeast_rho)
  ------------------
  |  Branch (2852:9): [True: 6.97M, False: 0]
  ------------------
 2853|  6.97M|    {
 2854|   702M|        for (iLayer = 0; iLayer < MAX_LAYERS; iLayer++)
  ------------------
  |  |   27|   702M|#define MAX_LAYERS   100
  ------------------
  |  Branch (2854:26): [True: 695M, False: 6.95M]
  ------------------
 2855|   695M|        {
 2856|   695M|            if (kLeast_rho[iLayer].k)
  ------------------
  |  Branch (2856:17): [True: 18.5k, False: 695M]
  ------------------
 2857|  18.5k|            {
 2858|  18.5k|                *L_rho = iLayer;
 2859|  18.5k|                *I_rho = kLeast_rho[iLayer].i;
 2860|  18.5k|                *k_rho = kLeast_rho[iLayer].k;
 2861|  18.5k|                break;
 2862|  18.5k|            }
 2863|   695M|        }
 2864|  6.97M|        if (iLayer == MAX_LAYERS)
  ------------------
  |  |   27|  6.97M|#define MAX_LAYERS   100
  ------------------
  |  Branch (2864:13): [True: 6.95M, False: 18.5k]
  ------------------
 2865|  6.95M|        {
 2866|  6.95M|            if (nOneAdditionalLayer)
  ------------------
  |  Branch (2866:17): [True: 934k, False: 6.02M]
  ------------------
 2867|   934k|            {
 2868|   934k|                *L_rho = nOneAdditionalLayer;  /* ??? subtract 1 ??? */
 2869|   934k|                *I_rho = -1;
 2870|   934k|                *k_rho = 0;
 2871|   934k|                return 0; /* difference may be in the first additional layer */
 2872|   934k|            }
 2873|  6.02M|            else
 2874|  6.02M|            {
 2875|  6.02M|                *L_rho = INCHI_CANON_INFINITY;
  ------------------
  |  |   31|  6.02M|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 2876|  6.02M|                *I_rho = -1;
 2877|  6.02M|                *k_rho = 0;
 2878|  6.02M|                return 0; /* no difference found */
 2879|  6.02M|            }
 2880|  6.95M|        }
 2881|  18.5k|        else
 2882|  18.5k|        {
 2883|  18.5k|            return 1; /* difference in a real layer */
 2884|  18.5k|        }
 2885|  6.97M|    }
 2886|      0|    else
 2887|      0|    {
 2888|      0|        return -1; /* no input, should not happen */
 2889|      0|    }
 2890|  6.97M|}
CtPartCompareLayers:
 2897|  6.97M|{
 2898|  6.97M|    int L_rho, I_rho, k_rho;
 2899|  6.97M|    if (0 < CtCompareLayersGetFirstDiff( kLeast_rho, nOneAdditionalLayer, &L_rho, &I_rho, &k_rho ) &&
  ------------------
  |  Branch (2899:9): [True: 18.5k, False: 6.95M]
  ------------------
 2900|       |         /* differences has been found in a real layer or all real layers are identical */
 2901|  18.5k|         L_rho <= L_rho_fix_prev)
  ------------------
  |  Branch (2901:10): [True: 18.5k, False: 0]
  ------------------
 2902|  18.5k|    {
 2903|       |        /* in this layer pzb_rho == pzb_rho_fix or in the previous real layer */
 2904|  18.5k|        return k_rho > 0 ? ( L_rho + 1 ) : -( L_rho + 1 );
  ------------------
  |  Branch (2904:16): [True: 522, False: 17.9k]
  ------------------
 2905|  18.5k|    }
 2906|       |
 2907|  6.95M|    return 0;
 2908|  6.97M|}
UpdateCompareLayers:
 2913|   443k|{
 2914|   443k|    int i;
 2915|   443k|    if (kLeastForLayer)
  ------------------
  |  Branch (2915:9): [True: 443k, False: 0]
  ------------------
 2916|   443k|    {
 2917|  44.8M|        for (i = 0; i < MAX_LAYERS; i++)
  ------------------
  |  |   27|  44.8M|#define MAX_LAYERS   100
  ------------------
  |  Branch (2917:21): [True: 44.3M, False: 443k]
  ------------------
 2918|  44.3M|        {
 2919|  44.3M|            if (abs( kLeastForLayer[i].k ) >= hzz)
  ------------------
  |  Branch (2919:17): [True: 15.9k, False: 44.3M]
  ------------------
 2920|  15.9k|            {
 2921|  15.9k|                kLeastForLayer[i].k = 0;
 2922|  15.9k|                kLeastForLayer[i].i = 0;
 2923|  15.9k|            }
 2924|  44.3M|        }
 2925|   443k|    }
 2926|   443k|}
CtPartCopy:
 2933|  1.32M|{
 2934|  1.32M|    int     startCt1, startCt2, endCt2;
 2935|  1.32M|    int     len2, len2H, len2Hfixed = 0, len2iso_sort_key, len2iso_exchg_atnos, i;
 2936|  1.32M|    int     startAt1, startAt2, endAt2; /*endCt,*/
 2937|       |
 2938|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 2939|       |    int     len2iso_sort_key_Hfixed;
 2940|       |#endif
 2941|       |
 2942|  1.32M|    k--;
 2943|       |
 2944|  1.32M|    if (k)
  ------------------
  |  Branch (2944:9): [True: 923k, False: 406k]
  ------------------
 2945|   923k|    {
 2946|   923k|        startCt1 = Ct1->nextCtblPos[k - 1];
 2947|   923k|        startCt2 = Ct2->nextCtblPos[k - 1];
 2948|   923k|        startAt1 = Ct1->nextAtRank[k - 1] - 1;
 2949|   923k|        startAt2 = Ct2->nextAtRank[k - 1] - 1;
 2950|   923k|    }
 2951|   406k|    else
 2952|   406k|    {
 2953|   406k|        startCt1 = startCt2 = 0;
 2954|   406k|        startAt1 = startAt2 = 0;
 2955|   406k|    }
 2956|       |
 2957|       |    /* djb-rwth: removing redundant code */
 2958|  1.32M|    endCt2 = Ct2->nextCtblPos[k];
 2959|       |    /* djb-rwth: removing redundant code */
 2960|  1.32M|    endAt2 = (int) Ct2->nextAtRank[k] - 1;
 2961|       |
 2962|  1.32M|    len2 = endCt2 - startCt2;
 2963|       |    /* len    = min(len1, len2); */
 2964|       |
 2965|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 2966|       |    if (startCt1 != startCt2 || startAt1 != startAt2)
 2967|       |    {
 2968|       |        int stop = 1;
 2969|       |    }
 2970|       |#endif
 2971|       |
 2972|       |    /* copy connection table: Ctbl */
 2973|  4.49M|    for (i = 0; i < len2; i++)
  ------------------
  |  Branch (2973:17): [True: 3.16M, False: 1.32M]
  ------------------
 2974|  3.16M|    {
 2975|  3.16M|        Ct1->Ctbl[startCt1 + i] = Ct2->Ctbl[startCt2 + i];
 2976|  3.16M|    }
 2977|       |
 2978|       |    /* copy number of H: NumH */
 2979|  1.32M|    len2H = 0;
 2980|  1.32M|    if (Ct1->NumH && Ct2->NumH)
  ------------------
  |  Branch (2980:9): [True: 601k, False: 728k]
  |  Branch (2980:22): [True: 63.3k, False: 538k]
  ------------------
 2981|  63.3k|    {
 2982|  63.3k|        len2H = endAt2 - startAt2;
 2983|  63.3k|        if (endAt2 > Ct2->maxVert)
  ------------------
  |  Branch (2983:13): [True: 5.68k, False: 57.7k]
  ------------------
 2984|  5.68k|        {
 2985|  5.68k|            len2H = Ct2->lenNumH - startAt2;
 2986|  5.68k|        }
 2987|   203k|        for (i = 0; i < len2H; i++)
  ------------------
  |  Branch (2987:21): [True: 140k, False: 63.3k]
  ------------------
 2988|   140k|        {
 2989|   140k|            Ct1->NumH[startAt1 + i] = Ct2->NumH[startAt2 + i];
 2990|   140k|        }
 2991|  63.3k|    }
 2992|       |
 2993|       |    /* copy number of fixed H */
 2994|       |    /* djb-rwth: removing redundant code */
 2995|  1.32M|    if (Ct1->NumHfixed && Ct2->NumHfixed)
  ------------------
  |  Branch (2995:9): [True: 3.46k, False: 1.32M]
  |  Branch (2995:27): [True: 3.46k, False: 0]
  ------------------
 2996|  3.46k|    {
 2997|  3.46k|        len2Hfixed = endAt2 - startAt2;
 2998|  19.1k|        for (i = 0; i < len2Hfixed; i++)
  ------------------
  |  Branch (2998:21): [True: 15.6k, False: 3.46k]
  ------------------
 2999|  15.6k|        {
 3000|  15.6k|            Ct1->NumHfixed[startAt1 + i] = Ct2->NumHfixed[startAt2 + i];
 3001|  15.6k|        }
 3002|  3.46k|    }
 3003|       |
 3004|       |    /* copy isotopic keys */
 3005|  1.32M|    len2iso_sort_key = 0;
 3006|  1.32M|    if (Ct1->iso_sort_key && Ct2->iso_sort_key)
  ------------------
  |  Branch (3006:9): [True: 18.6k, False: 1.31M]
  |  Branch (3006:30): [True: 16.5k, False: 2.08k]
  ------------------
 3007|  16.5k|    {
 3008|  16.5k|        len2iso_sort_key = endAt2 - startAt2;
 3009|  36.9k|        for (i = 0; i < len2iso_sort_key; i++)
  ------------------
  |  Branch (3009:21): [True: 20.3k, False: 16.5k]
  ------------------
 3010|  20.3k|        {
 3011|  20.3k|            Ct1->iso_sort_key[startAt1 + i] = Ct2->iso_sort_key[startAt2 + i];
 3012|  20.3k|        }
 3013|  16.5k|    }
 3014|       |
 3015|  1.32M|    len2iso_exchg_atnos = 0;
 3016|  1.32M|    if (Ct1->iso_exchg_atnos && Ct2->iso_exchg_atnos)
  ------------------
  |  Branch (3016:9): [True: 8.74k, False: 1.32M]
  |  Branch (3016:33): [True: 8.22k, False: 516]
  ------------------
 3017|  8.22k|    {
 3018|  8.22k|        len2iso_exchg_atnos = endAt2 - startAt2;
 3019|  17.3k|        for (i = 0; i < len2iso_exchg_atnos; i++)
  ------------------
  |  Branch (3019:21): [True: 9.17k, False: 8.22k]
  ------------------
 3020|  9.17k|        {
 3021|  9.17k|            Ct1->iso_exchg_atnos[startAt1 + i] = Ct2->iso_exchg_atnos[startAt2 + i];
 3022|  9.17k|        }
 3023|  8.22k|    }
 3024|       |
 3025|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 3026|       |    len2iso_sort_key_Hfixed = 0;
 3027|       |    if (Ct1->iso_sort_key_Hfixed && Ct2->iso_sort_key_Hfixed)
 3028|       |    {
 3029|       |        len2iso_sort_key_Hfixed = endAt2 - startAt2;
 3030|       |        for (i = 0; i < len2iso_sort_key; i++)
 3031|       |        {
 3032|       |            Ct1->iso_sort_key_Hfixed[startAt1 + i] = Ct2->iso_sort_key_Hfixed[startAt2 + i];
 3033|       |        }
 3034|       |    }
 3035|       |#endif
 3036|       |
 3037|  1.32M|    Ct1->lenCt = startCt1 + len2;
 3038|  1.32M|    Ct1->nextCtblPos[k] = startCt1 + len2;
 3039|  1.32M|    Ct1->nextAtRank[k] = Ct2->nextAtRank[k];
 3040|  1.32M|    if (len2H)
  ------------------
  |  Branch (3040:9): [True: 63.3k, False: 1.26M]
  ------------------
 3041|  63.3k|    {
 3042|  63.3k|        Ct1->lenNumH = startAt1 + len2H;
 3043|  63.3k|    }
 3044|       |
 3045|       |    /*
 3046|       |    if ( len2Hfixed )
 3047|       |    {
 3048|       |        Ct1->lenNumHfixed   = startAt1 + len2Hfixed;
 3049|       |    }
 3050|       |    */
 3051|       |
 3052|  1.32M|    if (len2iso_sort_key)
  ------------------
  |  Branch (3052:9): [True: 16.5k, False: 1.31M]
  ------------------
 3053|  16.5k|    {
 3054|  16.5k|        Ct1->len_iso_sort_key = startAt1 + len2iso_sort_key;
 3055|  16.5k|    }
 3056|  1.32M|    if (len2iso_exchg_atnos)
  ------------------
  |  Branch (3056:9): [True: 8.22k, False: 1.32M]
  ------------------
 3057|  8.22k|    {
 3058|  8.22k|        Ct1->len_iso_exchg_atnos = startAt1 + len2iso_exchg_atnos;
 3059|  8.22k|    }
 3060|       |
 3061|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 3062|       |    if (len2iso_sort_key_Hfixed)
 3063|       |    {
 3064|       |        Ct1->len_iso_sort_key_Hfixed = startAt1 + len2iso_sort_key_Hfixed;
 3065|       |    }
 3066|       |#endif
 3067|       |
 3068|       |#ifdef INCHI_CANON_USE_HASH
 3069|       |    Ct1->hash[k] = Ct2->hash[k];
 3070|       |#endif
 3071|       |
 3072|  1.32M|    Ct1->lenPos = k + 1;
 3073|  1.32M|    INCHI_HEAPCHK
 3074|  1.32M|}
CtFullCopy:
 3079|   253k|{
 3080|       |    /* Ct1 does not have INCHI_CANON_INFINITY termination */
 3081|   253k|    int k;
 3082|   804k|    for (k = 0; k < Ct2->lenPos; k++)
  ------------------
  |  Branch (3082:17): [True: 551k, False: 253k]
  ------------------
 3083|   551k|    {
 3084|   551k|        CtPartCopy( Ct1 /* to */, Ct2 /* from */, k + 1 );
 3085|   551k|    }
 3086|   253k|}
TranspositionGetMcrAndFixSetAndUnorderedPartition:
 3097|   386k|{
 3098|   386k|    int i, j, k, mcr;
 3099|   386k|    AT_RANK next;
 3100|   386k|    bitWord *McrBits = McrSet->bitword[l - 1];
 3101|   386k|    bitWord *FixBits = FixSet->bitword[l - 1];
 3102|   386k|    int     len = McrSet->len_set * sizeof( bitWord );
 3103|       |
 3104|   386k|    memset( McrBits, 0, len ); /* djb-rwth: memset_s C11/Annex K variant? */
 3105|   386k|    memset( FixBits, 0, len ); /* djb-rwth: memset_s C11/Annex K variant? */
 3106|  13.6M|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (3106:17): [True: 13.2M, False: 386k]
  ------------------
 3107|  13.2M|    {
 3108|  13.2M|        p->equ2[i] = INCHI_CANON_INFINITY; /* for debug only */
  ------------------
  |  |   31|  13.2M|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 3109|  13.2M|    }
 3110|       |
 3111|  13.6M|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (3111:17): [True: 13.2M, False: 386k]
  ------------------
 3112|  13.2M|    {
 3113|  13.2M|        j = (int) ( next = gamma->nAtNumb[i] );
 3114|       |
 3115|  13.2M|        if (j == i)
  ------------------
  |  Branch (3115:13): [True: 12.4M, False: 783k]
  ------------------
 3116|  12.4M|        {
 3117|  12.4M|            FixBits[i / pCG->m_num_bit] |= pCG->m_bBit[i % pCG->m_num_bit];
 3118|  12.4M|            McrBits[i / pCG->m_num_bit] |= pCG->m_bBit[i % pCG->m_num_bit];
 3119|       |            /* p->next[i] = INCHI_CANON_INFINITY; */ /* no link to same orbit points */
 3120|  12.4M|            p->equ2[i] = next;  /* fixed point */
 3121|  12.4M|        }
 3122|   783k|        else if (!( rank_mark_bit & next ))
  ------------------
  |  Branch (3122:18): [True: 391k, False: 391k]
  ------------------
 3123|   391k|        {
 3124|   391k|            gamma->nAtNumb[i] |= rank_mark_bit;
 3125|   391k|            mcr = inchi_min( j, i );
  ------------------
  |  |  139|   391k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 391k]
  |  |  ------------------
  ------------------
 3126|       |            /* djb-rwth: removing redundant code */
 3127|       |            /* mark all nodes in the cycle to ignore later; find mcr */
 3128|   783k|            while (!( rank_mark_bit & ( next = gamma->nAtNumb[j] ) ))
  ------------------
  |  Branch (3128:20): [True: 391k, False: 391k]
  ------------------
 3129|   391k|            {
 3130|   391k|                gamma->nAtNumb[j] |= rank_mark_bit;
 3131|   391k|                j = (int) next;
 3132|   391k|                if (mcr > j)
  ------------------
  |  Branch (3132:21): [True: 0, False: 391k]
  ------------------
 3133|      0|                {
 3134|      0|                    mcr = j;
 3135|      0|                }
 3136|       |                /* djb-rwth: removing redundant code */
 3137|   391k|            }
 3138|   391k|            McrBits[mcr / pCG->m_num_bit] |= pCG->m_bBit[mcr % pCG->m_num_bit]; /* save mcr */
 3139|       |            /* fill out the unordered partition, the mcr first, other in the cycle after that */
 3140|   391k|            p->equ2[mcr] = mcr;
 3141|   783k|            for (k = mcr; mcr != ( j = (int) ( rank_mask_bit & gamma->nAtNumb[k] ) ); k = j)
  ------------------
  |  Branch (3141:27): [True: 391k, False: 391k]
  ------------------
 3142|   391k|            {
 3143|   391k|                p->equ2[j] = mcr;
 3144|   391k|            }
 3145|   391k|        }
 3146|  13.2M|    }
 3147|       |
 3148|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 3149|       |    /* for debug only */
 3150|       |    for (i = 0; i < n; i++)
 3151|       |    {
 3152|       |        if (p->equ2[i] >= n)
 3153|       |        {
 3154|       |            int stop = 1;
 3155|       |        }
 3156|       |    }
 3157|       |#endif
 3158|       |
 3159|       |    /* remove the marks */
 3160|  13.6M|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (3160:17): [True: 13.2M, False: 386k]
  ------------------
 3161|  13.2M|    {
 3162|  13.2M|        gamma->nAtNumb[i] &= rank_mask_bit;
 3163|  13.2M|    }
 3164|       |
 3165|   386k|    INCHI_HEAPCHK
 3166|   386k|}
SetBitCreate:
 3171|   331k|{
 3172|   331k|    bitWord b1 = 1, b2;
 3173|   331k|    AT_NUMB n1, n2;
 3174|       |#ifdef INCHI_CANON_USE_HASH
 3175|       |    CtHash  h1, h2;
 3176|       |#endif
 3177|   331k|    int    i;
 3178|       |
 3179|   331k|    if (pCG->m_bBitInitialized)
  ------------------
  |  Branch (3179:9): [True: 326k, False: 4.87k]
  ------------------
 3180|   326k|    {
 3181|   326k|        INCHI_HEAPCHK
 3182|   326k|        return 0; /* already created */
 3183|   326k|    }
 3184|       |
 3185|       |    /* djb-rwth: removing redundant code */
 3186|  4.87k|    pCG->m_num_bit = 1;
 3187|  77.9k|    for (b1 = 1, pCG->m_num_bit = 1; b1 < ( b2 = (bitWord) ( ( b1 << 1 )& BIT_WORD_MASK ) ); b1 = b2, pCG->m_num_bit++)
  ------------------
  |  |  343|  77.9k|#define BIT_WORD_MASK  ((bitWord)~0)
  ------------------
  |  Branch (3187:38): [True: 73.1k, False: 4.87k]
  ------------------
 3188|  73.1k|    {
 3189|  73.1k|        ;
 3190|  73.1k|    }
 3191|  4.87k|    pCG->m_bBit = (bitWord*) inchi_calloc( pCG->m_num_bit, sizeof( bitWord ) );
  ------------------
  |  | 1146|  4.87k|#define inchi_calloc   calloc
  ------------------
 3192|  4.87k|    if (!pCG->m_bBit)
  ------------------
  |  Branch (3192:9): [True: 0, False: 4.87k]
  ------------------
 3193|      0|    {
 3194|      0|        INCHI_HEAPCHK
 3195|      0|            return -1; /* failed */
 3196|      0|    }
 3197|  82.8k|    for (i = 0, b1 = 1; i < pCG->m_num_bit; i++, b1 <<= 1)
  ------------------
  |  Branch (3197:25): [True: 77.9k, False: 4.87k]
  ------------------
 3198|  77.9k|    {
 3199|  77.9k|        pCG->m_bBit[i] = b1;
 3200|  77.9k|    }
 3201|       |
 3202|  77.9k|    for (n1 = 1; n1 < ( n2 = (AT_RANK) ( ( n1 << 1 )& AT_RANK_MASK ) ); n1 = n2)
  ------------------
  |  |   12|  77.9k|#define AT_RANK_MASK   ((AT_RANK)~0)
  ------------------
  |  Branch (3202:18): [True: 73.1k, False: 4.87k]
  ------------------
 3203|  73.1k|    {
 3204|  73.1k|        ;
 3205|  73.1k|    }
 3206|  4.87k|    rank_mark_bit = n1;
 3207|  4.87k|    rank_mask_bit = ~n1;
 3208|       |
 3209|       |#ifdef INCHI_CANON_USE_HASH
 3210|       |    for (h1 = 1; h1 < ( h2 = ( h1 << 1 ) ); h1 = h2)
 3211|       |    {
 3212|       |        ;
 3213|       |    }
 3214|       |    hash_mark_bit = h1;
 3215|       |#endif
 3216|  4.87k|    pCG->m_bBitInitialized = 1;
 3217|  4.87k|    INCHI_HEAPCHK
 3218|       |
 3219|  4.87k|    return 1;
 3220|  4.87k|}
SetBitFree:
 3225|  12.7k|{
 3226|  12.7k|    if (pCG->m_bBit)
  ------------------
  |  Branch (3226:9): [True: 4.87k, False: 7.86k]
  ------------------
 3227|  4.87k|    {
 3228|  4.87k|        inchi_free( pCG->m_bBit );
  ------------------
  |  | 1152|  4.87k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 4.87k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 4.87k]
  |  |  ------------------
  ------------------
 3229|  4.87k|        pCG->m_bBit = NULL;
 3230|  4.87k|        INCHI_HEAPCHK
 3231|  4.87k|        return 1; /* success */
 3232|  4.87k|    }
 3233|       |
 3234|       |    INCHI_HEAPCHK
 3235|       |
 3236|  7.86k|    return 0; /* already destroyed */
 3237|  12.7k|}
GetOneAdditionalLayer:
 3532|   330k|{
 3533|   330k|    int nLastLayer = -1, nNumLast = 0, nLayer = 0;
 3534|       |
 3535|   330k|    if (!pCD || !pzb_rho_fix)
  ------------------
  |  Branch (3535:9): [True: 0, False: 330k]
  |  Branch (3535:17): [True: 252k, False: 78.5k]
  ------------------
 3536|   252k|    {
 3537|   252k|        return 0;
 3538|   252k|    }
 3539|       |
 3540|  78.5k|    nLayer++; /* 1 */
 3541|  78.5k|    if (pCD->NumH && !pzb_rho_fix->NumH)
  ------------------
  |  Branch (3541:9): [True: 78.5k, False: 0]
  |  Branch (3541:22): [True: 868, False: 77.7k]
  ------------------
 3542|    868|    {
 3543|    868|        nLastLayer = nLayer;
 3544|    868|        nNumLast++;
 3545|    868|    }
 3546|       |
 3547|  78.5k|    nLayer++; /* 2 */
 3548|  78.5k|    if (pCD->nLenCTAtOnly < pCD->nLenLinearCT && pzb_rho_fix->nLenCTAtOnly == pzb_rho_fix->lenCt)
  ------------------
  |  Branch (3548:9): [True: 3.50k, False: 75.0k]
  |  Branch (3548:50): [True: 3.46k, False: 36]
  ------------------
 3549|  3.46k|    {
 3550|  3.46k|        nLastLayer = nLayer;
 3551|  3.46k|        nNumLast++;
 3552|  3.46k|    }
 3553|       |
 3554|  78.5k|    nLayer++; /* 3 */
 3555|  78.5k|    if (pCD->NumHfixed && !pzb_rho_fix->NumHfixed)
  ------------------
  |  Branch (3555:9): [True: 36.4k, False: 42.1k]
  |  Branch (3555:27): [True: 36.3k, False: 37]
  ------------------
 3556|  36.3k|    {
 3557|  36.3k|        nLastLayer = nLayer;
 3558|  36.3k|        nNumLast++;
 3559|  36.3k|    }
 3560|       |
 3561|  78.5k|    nLayer++; /* 4 */
 3562|  78.5k|    if (pCD->iso_sort_key && !pzb_rho_fix->iso_sort_key)
  ------------------
  |  Branch (3562:9): [True: 458, False: 78.1k]
  |  Branch (3562:30): [True: 458, False: 0]
  ------------------
 3563|    458|    {
 3564|    458|        nLastLayer = nLayer;
 3565|    458|        nNumLast++;
 3566|    458|    }
 3567|       |
 3568|       |    /*
 3569|       |    nLayer ++; // 5
 3570|       |    if ( pCD->nLenCTAtOnly < pCD->nLenLinearCT && pCD->iso_sort_key &&
 3571|       |        (pzb_rho_fix->nLenCTAtOnly == pzb_rho_fix->lenCt || !pzb_rho_fix->iso_sort_key ) )
 3572|       |        {
 3573|       |        nLastLayer = nLayer;
 3574|       |        nNumLast ++;
 3575|       |    }
 3576|       |    */
 3577|       |
 3578|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 3579|       |
 3580|       |    nLayer++; /* 6 */
 3581|       |    if (pCD->iso_sort_key_Hfixed && !pzb_rho_fix->iso_sort_key_Hfixed)
 3582|       |    {
 3583|       |        nLastLayer = nLayer;
 3584|       |        nNumLast++;
 3585|       |    }
 3586|       |#endif
 3587|  78.5k|    if (1 == nNumLast)
  ------------------
  |  Branch (3587:9): [True: 41.1k, False: 37.4k]
  ------------------
 3588|  41.1k|    {
 3589|  41.1k|        return nLastLayer;
 3590|  41.1k|    }
 3591|       |
 3592|  37.4k|    return 0;
 3593|  78.5k|}
CanonGraph:
 3643|   330k|{
 3644|       |
 3645|       |    /* bDigraph != 0
 3646|       |       means consider edges from atoms to t-groups
 3647|       |       as directed, that is, do not include
 3648|       |       t-group ranks in comparing neighbors
 3649|       |       when refining partition
 3650|       |    */
 3651|       |
 3652|       |    /* Always set
 3653|       |       lab = true
 3654|       |       dig = true
 3655|       |    */
 3656|       |
 3657|       |    /* in the comments:
 3658|       |        m = |zeta|
 3659|       |        r = |rho|
 3660|       |
 3661|       |        m < n or r < n in case pi[k] in P (i.e. satisfies Lemma 2.25)
 3662|       |
 3663|       |        Just after passing point B:
 3664|       |        ===========================
 3665|       |        K = k-1
 3666|       |        wi = v[i], i = 1..K
 3667|       |        Gamma(0) = Gamma = Aut(G)pi
 3668|       |        Gamma(i) = Gamma(w1,w2,...,wi) pointwise stabilizer for i=1..K
 3669|       |        zeta is a terminal node =>
 3670|       |          the coarsest equitable partition that fixes w1,...,wK is discrete =>
 3671|       |            Gamma(K)=1
 3672|       |        At point A only:
 3673|       |            index = |Gamma(k-1)|/|Gamma(k)|
 3674|       |        At points A and B:
 3675|       |            size  = |Gamma(k-1)|
 3676|       |            theta = theta(Gamma(k-1));
 3677|       |            Gamma(k-1) = <Y>, where Y is the set of all automprhisms output up
 3678|       |              to the present stage (in Step 10 = L10 )
 3679|       |            |Y| <= n - |theta|
 3680|       |    */
 3681|       |
 3682|   330k|    AT_RANK    *pCt = pCD->LinearCT;
 3683|       |    /*int         nMaxLenCt        =  pCD->nMaxLenLinearCT;*/
 3684|   330k|    int        *nLenCt = &pCD->nLenLinearCT;
 3685|   330k|    CANON_DATA *pCD1 = pCD;
 3686|       |
 3687|   330k|    int i, k, k2, index, l, ok, ret = 0, res;
 3688|   330k|    int t_Lemma;   /* hh: if pi[k-1] satisfies Lemma 2-25 then
 3689|       |                          t_Lemma = min{i| i=1..k && pi[i-1] satisfies Lemma 2-25}*/
 3690|       |                   /* otherwise t_Lemma = k --> here this is always the case */
 3691|   330k|    int t_eq_zeta; /* ht: min{i|i=1..m && all terminal modes descended from or equal
 3692|       |                      to zeta(i) have been shown to be equivalent}. */
 3693|   330k|    int h_zeta;    /* h: the longest common ancestor of zeta and nu is nu(h_zeta) */
 3694|   330k|    int h_rho;     /* hb: the longest common ancestor of rho and nu is nu(h_rho) */
 3695|   330k|    int hz_rho;    /* hzb: max{i|i=1..min(k,r) && Lambda(G,pi,nu(i)) == Lambda(G,pi,rho(i))} */
 3696|   330k|    int hz_zeta;   /* hzf: max{i|i=1..min(k,m) && Lambda(G,pi,nu(i)) == Lambda(G,pi,zeta(i))} */
 3697|   330k|    int qzb_rho;   /* Ct(Lambda[k]) - Ct(rho[k]) */
 3698|   330k|    double size;   /* |Aut(G)| */
 3699|       |
 3700|       |
 3701|   330k|    int  nNumLayers = ( NULL != pCD->NumH ) + ( NULL != pCD->NumHfixed ) +
 3702|       |                      /* (bDigraph && pCD->nLenLinearCT > pCD->nLenCTAtOnly)*/ /* ??? tautomeric */
 3703|   330k|                      ( NULL != pCD->iso_sort_key )
 3704|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 3705|       |                    + ( NULL != pCD->iso_sort_key_Hfixed )
 3706|       |#endif
 3707|   330k|                    ;
 3708|       |
 3709|       |
 3710|   330k|    int  dig = ( bDigraph || nNumLayers );
  ------------------
  |  Branch (3710:18): [True: 42.2k, False: 288k]
  |  Branch (3710:30): [True: 36.3k, False: 252k]
  ------------------
 3711|   330k|    int  bSplitTautCompare = ( bDigraph || nNumLayers ); /* compare taut. H and tgroups connections after H */
  ------------------
  |  Branch (3711:32): [True: 42.2k, False: 288k]
  |  Branch (3711:44): [True: 36.3k, False: 252k]
  ------------------
 3712|       |                        /* digraph: 1=>do not use Lemma 2.25, 0 => use */
 3713|   330k|    int  lab = 1;       /* label: 1=>find canonical numbering;
 3714|       |                            0=>do not find canonical numbering, do not use rho */
 3715|   330k|    int  r;             /* |rho| */
 3716|   330k|    int  bZetaEqRho = lab;
 3717|   330k|    int  bZetaIsomorph;
 3718|       |
 3719|       |    /*const int L = MAX_SET_SIZE;*/
 3720|   330k|    int L_curr_max_set_size = MAX_SET_SIZE;
  ------------------
  |  |   25|   330k|#define MAX_SET_SIZE 32766 /*16384*/
  ------------------
 3721|       |
 3722|   330k|    UnorderedPartition theta, theta_from_gamma;
 3723|       |
 3724|   330k|    Cell *W;  /* W[i] is the first non-trivial cell of pi[i+1] */
 3725|   330k|    Node *v;  /* v[i] is in W[i] to create T(G,pi,nu[i+1]) */
 3726|   330k|    Node tvc, tvh;
 3727|   330k|    S_CHAR *e, *qzb = NULL;   /* qzb = NULL always */
 3728|       |
 3729|       |    /* current node CT */
 3730|   330k|    ConTable Lambda;
 3731|       |    /* first leaf CT */
 3732|   330k|    ConTable zf_zeta; /* Ct for zeta,  the first discovered terminal node */
 3733|       |    /* best leaf/node CT: find the greatest pzb_rho possibly subject to pzb_rho[k] <= pzb_rho_fix[k] condition */
 3734|   330k|    ConTable *pzb_rho = NULL;  /* Ct for rho,   the best discovered terminal node */
 3735|       |    /* fixed input CT: for all k pzb_rho[k] <= pzb_rho_fix[k]; at the end pzb_rho == pzb_rho_fix */
 3736|   330k|    ConTable *pzb_rho_fix = ( pp_zb_rho_inp && *pp_zb_rho_inp ) ? *pp_zb_rho_inp : NULL;
  ------------------
  |  Branch (3736:31): [True: 78.5k, False: 252k]
  |  Branch (3736:48): [True: 78.5k, False: 0]
  ------------------
 3737|       |
 3738|   330k|    NodeSet Omega; /* MAX_SET_SIZE */
 3739|   330k|    NodeSet Phi;   /* MAX_SET_SIZE */
 3740|   330k|    NodeSet cur_nodes;   /* 1 each */
 3741|       |
 3742|   330k|    Transposition gamma;
 3743|       |
 3744|   330k|    Partition zeta;      /* the first discovered terminal node */
 3745|   330k|    Partition rho;       /* the best discovered terminal node */
 3746|       |
 3747|   330k|    int nNumFoundGenerators = 0;
 3748|   330k|    int qzb_rho_fix = 0;
 3749|   330k|    int hzb_rho_fix = 0;
 3750|   330k|    int bRhoIsDiscrete = 1;
 3751|   330k|    kLeast kLeast_rho[MAX_LAYERS];
 3752|   330k|    kLeast kLeast_rho_fix[MAX_LAYERS];
 3753|   330k|    int nOneAdditionalLayer;
 3754|   330k|    int pzb_rho_fix_reached = 0;
 3755|   330k|    int L_rho_fix_prev = 0, I_rho_fix_prev = -1, k_rho_fix_prev = 0;
 3756|       |
 3757|   330k|    if (!LargeMolecules)
  ------------------
  |  Branch (3757:9): [True: 330k, False: 0]
  ------------------
 3758|   330k|    {
 3759|   330k|        L_curr_max_set_size = NORMALLY_ALLOWED_MAX_SET_SIZE;
  ------------------
  |  |   26|   330k|#define NORMALLY_ALLOWED_MAX_SET_SIZE 2048
  ------------------
 3760|   330k|    }
 3761|       |
 3762|       |
 3763|       |    /* Note: Layered comparison should be consistent, especially in layer numbers.
 3764|       |             Layered comparison is implemented in:
 3765|       |                     CtFullCompare()
 3766|       |                     CtPartCompare()
 3767|       |                     GetOneAdditionalLayer()
 3768|       |
 3769|       |             The partial comparison results in kLeast[] are used in
 3770|       |                     CtFullCompareLayers()
 3771|       |                     CtPartCompareLayers()
 3772|       |                     CtCompareLayersGetFirstDiff()
 3773|       |                     UpdateCompareLayers()
 3774|       |     */
 3775|       |
 3776|       |
 3777|   330k|    nOneAdditionalLayer = GetOneAdditionalLayer( pCD1, pzb_rho_fix );
 3778|       |
 3779|       |
 3780|       |    /* next 2 lines for debug only */
 3781|       |    /* num_g++;  */
 3782|       |    /* WriteGraph( G, n_tg, num_g, "V:\\IChI_v10\\Gordon-Graphs\\hard\\k06g08v312-alt.dre", "a+" ); */
 3783|       |
 3784|       |    /* memory allocation */
 3785|       |
 3786|   330k|    if (0 > SetBitCreate( pCG ))
  ------------------
  |  Branch (3786:9): [True: 0, False: 330k]
  ------------------
 3787|      0|    {
 3788|      0|        return -1;
 3789|      0|    }
 3790|   330k|    if (pzb_rho_fix && pzb_rho_fix->nLenCTAtOnly != pCD->nLenCTAtOnly)
  ------------------
  |  Branch (3790:9): [True: 78.5k, False: 252k]
  |  Branch (3790:24): [True: 0, False: 78.5k]
  ------------------
 3791|      0|    {
 3792|       |        /* consistency check */
 3793|      0|        return -2;
 3794|      0|    }
 3795|   330k|    ok = 1;
 3796|       |
 3797|   330k|    ok &= UnorderedPartitionCreate( &theta, n_tg );
 3798|   330k|    ok &= UnorderedPartitionCreate( &theta_from_gamma, n_tg );
 3799|       |
 3800|       |    /* djb-rwth: fixing dereferencing NULL pointer and buffer overflows */
 3801|   330k|    W = (Cell*) inchi_calloc( n_tg, sizeof( W[0] ) );
  ------------------
  |  | 1146|   330k|#define inchi_calloc   calloc
  ------------------
 3802|   330k|    v = (Node*) inchi_calloc( n_tg, sizeof( v[0] ) );
  ------------------
  |  | 1146|   330k|#define inchi_calloc   calloc
  ------------------
 3803|   330k|    e = (S_CHAR*) inchi_calloc( n_tg, sizeof( e[0] ) );
  ------------------
  |  | 1146|   330k|#define inchi_calloc   calloc
  ------------------
 3804|       |
 3805|   330k|    if (!W || !v || !e)
  ------------------
  |  Branch (3805:9): [True: 0, False: 330k]
  |  Branch (3805:15): [True: 0, False: 330k]
  |  Branch (3805:21): [True: 0, False: 330k]
  ------------------
 3806|      0|    {
 3807|      0|        ok &= 0;
 3808|      0|    }
 3809|       |
 3810|       |/*
 3811|       |    ok &= ( NULL != ( W = (Cell*) inchi_calloc( n_tg, sizeof( W[0] ) ) ) );
 3812|       |    ok &= ( NULL != ( v = (Node*) inchi_calloc( n_tg, sizeof( v[0] ) ) ) );
 3813|       |    ok &= ( NULL != ( e = (S_CHAR*) inchi_calloc( n_tg, sizeof( e[0] ) ) ) );
 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|   330k|    ok &= CTableCreate( &Lambda, n, pCD );
 3822|   330k|    ok &= CTableCreate( &zf_zeta, n, pCD );
 3823|   330k|    ok &= ( ( pzb_rho = (ConTable *) inchi_calloc( 1, sizeof( *pzb_rho ) ) ) &&
  ------------------
  |  | 1146|   330k|#define inchi_calloc   calloc
  ------------------
  |  Branch (3823:13): [True: 330k, False: 0]
  ------------------
 3824|   330k|            CTableCreate( pzb_rho, n, pCD ) );
  ------------------
  |  Branch (3824:13): [True: 330k, False: 0]
  ------------------
 3825|       |
 3826|   330k|    ok &= NodeSetCreate( pCG, &Omega, n_tg, L_curr_max_set_size );
 3827|   330k|    ok &= NodeSetCreate( pCG, &Phi, n_tg, L_curr_max_set_size );
 3828|   330k|    ok &= NodeSetCreate( pCG, &cur_nodes, n_tg, 1 );
 3829|       |
 3830|   330k|    ok &= PartitionCreate( &zeta, n_tg );
 3831|   330k|    ok &= PartitionCreate( &rho, n_tg );
 3832|   330k|    ok &= TranspositionCreate( &gamma, n_tg );
 3833|       |
 3834|       |    INCHI_HEAPCHK
 3835|       |
 3836|       |/*L1:*/
 3837|   330k|    k = 1;
 3838|   330k|    size = 1.0;
 3839|   330k|    hz_rho = index = l = 0; /* djb-rwth: removing redundant code */
 3840|       |
 3841|   330k|    if (!ok)
  ------------------
  |  Branch (3841:9): [True: 0, False: 330k]
  ------------------
 3842|      0|    {
 3843|      0|        goto exit_function; /* initialization failed */
 3844|      0|    }
 3845|       |
 3846|   330k|    UnorderedPartitionMakeDiscrete( &theta, n_tg );
 3847|   330k|    t_Lemma = 2;
 3848|       |
 3849|   330k|    pCC->lNumBreakTies = 0;
 3850|   330k|    pCC->lNumDecreasedCT = 0;
 3851|   330k|    pCC->lNumRejectedCT = 0;
 3852|   330k|    pCC->lNumEqualCT = 1;
 3853|   330k|    pCC->lNumTotCT = 0;
 3854|       |    /* djb-rwth: removing redundant code */
 3855|       |
 3856|   330k|    hzb_rho_fix = 1;
 3857|       |
 3858|   330k|    memset( kLeast_rho, 0, sizeof( kLeast_rho ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 3859|   330k|    memset( kLeast_rho_fix, 0, sizeof( kLeast_rho_fix ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 3860|       |
 3861|   330k|    if (PartitionIsDiscrete( &pi[k - 1], n_tg ))
  ------------------
  |  Branch (3861:9): [True: 254k, False: 76.5k]
  ------------------
 3862|   254k|    {
 3863|       |        /* added the following 3 lines to the original to create Ct */
 3864|   254k|        PartitionCopy( &rho, &pi[k - 1], n_tg );
 3865|   254k|        CtPartFill( G, pCD, &pi[k - 1], pzb_rho, 1, n, n_tg, n_max );
 3866|   254k|        CtPartINCHI_CANON_INFINITY( pzb_rho, qzb, 2 );
 3867|   254k|        pCC->lNumTotCT++;
 3868|       |        /* djb-rwth: removing redundant code */
 3869|       |        /* goto L18; */
 3870|   254k|        goto exit_function;
 3871|   254k|    }
 3872|       |
 3873|  76.5k|    if (!dig && PartitionSatisfiesLemma_2_25( &pi[0], n ))
  ------------------
  |  Branch (3873:9): [True: 70.6k, False: 5.96k]
  |  Branch (3873:17): [True: 36.7k, False: 33.8k]
  ------------------
 3874|  36.7k|    {
 3875|  36.7k|        t_Lemma = 1;
 3876|  36.7k|    }
 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|  76.5k|    CtPartClear( &Lambda, 1 );
 3885|  76.5k|    INCHI_HEAPCHK
 3886|       |
 3887|       |/* L2: reach the first leaf and save it in zeta and rho */
 3888|   389k|    while (k)
  ------------------
  |  Branch (3888:12): [True: 389k, False: 0]
  ------------------
 3889|   389k|    {
 3890|       |        /* the two next lines intentionally switched */
 3891|       |        /* Create equitable partition in pi[k]  */
 3892|   389k|        PartitionGetFirstCell( &pi[k - 1], W, k, n );
 3893|   389k|        v[k - 1] = CellGetMinNode( &pi[k - 1], &W[k - 1], 0, pCD1 );
 3894|   389k|        e[k - 1] = 0;
 3895|   389k|        if (dig || !PartitionSatisfiesLemma_2_25( &pi[k - 1], n ))
  ------------------
  |  Branch (3895:13): [True: 25.1k, False: 364k]
  |  Branch (3895:20): [True: 146k, False: 217k]
  ------------------
 3896|   172k|        {
 3897|   172k|            t_Lemma = k + 1;
 3898|   172k|        }
 3899|       |        /* e[k-1] = 0; */
 3900|   389k|        {
 3901|   389k|            Node vv = v[k - 1];
 3902|   389k|            if (0 > ( ret = PartitionColorVertex( pCG, G, &pi[k - 1], vv /*v[k-1]*/, n, n_tg, n_max, bDigraph, 0 ) ))
  ------------------
  |  Branch (3902:17): [True: 0, False: 389k]
  ------------------
 3903|      0|            {
 3904|      0|                goto exit_error;
 3905|      0|            }
 3906|   389k|        }
 3907|   389k|        pCC->lNumBreakTies++;
 3908|   389k|        k++;
 3909|       |
 3910|   389k|        CtPartFill( G, pCD, &pi[k - 1], &Lambda, k - 1, n, n_tg, n_max);
 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|   389k|        if (pzb_rho_fix && QZFIX_OK( qzb_rho_fix ))
  ------------------
  |  | 3527|  25.1k|#define QZFIX_OK(X) ((X)<=0)
  |  |  ------------------
  |  |  |  Branch (3527:21): [True: 25.1k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (3916:13): [True: 25.1k, False: 364k]
  ------------------
 3917|  25.1k|        {
 3918|  25.1k|            qzb_rho_fix = CtPartCompare( &Lambda, pzb_rho_fix, qzb, kLeast_rho_fix, k - 1, 1, bSplitTautCompare );
 3919|  25.1k|            if (QZFIX_OK( qzb_rho_fix ))
  ------------------
  |  | 3527|  25.1k|#define QZFIX_OK(X) ((X)<=0)
  |  |  ------------------
  |  |  |  Branch (3527:21): [True: 25.1k, False: 0]
  |  |  ------------------
  ------------------
 3920|  25.1k|            {
 3921|  25.1k|                hzb_rho_fix = k;
 3922|  25.1k|            }
 3923|  25.1k|        }
 3924|       |
 3925|   389k|        if (lab && QZFIX_OK( qzb_rho_fix ))  /* DCh */
  ------------------
  |  | 3527|   389k|#define QZFIX_OK(X) ((X)<=0)
  |  |  ------------------
  |  |  |  Branch (3527:21): [True: 389k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (3925:13): [True: 389k, False: 0]
  ------------------
 3926|   389k|            CtPartCopy( pzb_rho, &Lambda, k - 1 );
 3927|   389k|        CtPartCopy( &zf_zeta, &Lambda, k - 1 );
 3928|       |        /*goto L4; L4:*/
 3929|   389k|        if (PartitionIsDiscrete( &pi[k - 1], n ))
  ------------------
  |  Branch (3929:13): [True: 76.5k, False: 312k]
  ------------------
 3930|  76.5k|        {
 3931|  76.5k|            break;  /* goto L7; */
 3932|  76.5k|        }
 3933|       |        /* goto L2; */
 3934|   389k|    }
 3935|       |
 3936|  76.5k|    pCC->lNumTotCT++;
 3937|       |
 3938|       |    /* L7; L7: */
 3939|       |    /* if ( h_zeta == 0 ) goto L18; L18:*/
 3940|  76.5k|    h_zeta = t_eq_zeta = hz_zeta = k;
 3941|  76.5k|    CtPartINCHI_CANON_INFINITY( &zf_zeta, NULL, k );
 3942|       |    /******************** <<<===== B **************************/
 3943|  76.5k|    PartitionCopy( &zeta, &pi[k - 1], n_tg );
 3944|  76.5k|    if (lab)
  ------------------
  |  Branch (3944:9): [True: 76.5k, False: 0]
  ------------------
 3945|  76.5k|    {
 3946|  76.5k|        if (pzb_rho_fix)
  ------------------
  |  Branch (3946:13): [True: 5.96k, False: 70.6k]
  ------------------
 3947|  5.96k|        {
 3948|  5.96k|            if (0 == qzb_rho_fix)
  ------------------
  |  Branch (3948:17): [True: 5.96k, False: 0]
  ------------------
 3949|  5.96k|            {
 3950|  5.96k|                qzb_rho_fix = CtFullCompare( &Lambda, pzb_rho_fix, 1, bSplitTautCompare );
 3951|  5.96k|                if (qzb_rho_fix > 0)
  ------------------
  |  Branch (3951:21): [True: 0, False: 5.96k]
  ------------------
 3952|      0|                {
 3953|      0|                    hzb_rho_fix = 1;
 3954|      0|                }
 3955|  5.96k|            }
 3956|  5.96k|            if (hzb_rho_fix > 1)
  ------------------
  |  Branch (3956:17): [True: 5.96k, False: 0]
  ------------------
 3957|  5.96k|            {
 3958|  5.96k|                PartitionCopy( &rho, &pi[hzb_rho_fix - 1], n_tg );
 3959|       |                /*CtPartINCHI_CANON_INFINITY( pzb_rho, qzb, k );*/
 3960|  5.96k|            }
 3961|  5.96k|            hz_rho = h_rho = hzb_rho_fix;
 3962|  5.96k|            bRhoIsDiscrete = ( hzb_rho_fix == k );
 3963|  5.96k|            if (bRhoIsDiscrete)
  ------------------
  |  Branch (3963:17): [True: 5.96k, False: 0]
  ------------------
 3964|  5.96k|            {
 3965|  5.96k|                CtPartINCHI_CANON_INFINITY( pzb_rho, qzb, k );
 3966|  5.96k|                pzb_rho_fix_reached = !qzb_rho_fix;
 3967|  5.96k|                CtCompareLayersGetFirstDiff( kLeast_rho_fix, nOneAdditionalLayer,
 3968|  5.96k|                                 &L_rho_fix_prev, &I_rho_fix_prev, &k_rho_fix_prev );
 3969|  5.96k|            }
 3970|       |
 3971|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 3972|       |            else
 3973|       |            {
 3974|       |                int stop = 1;
 3975|       |            }
 3976|       |#endif
 3977|  5.96k|        }
 3978|  70.6k|        else
 3979|  70.6k|        {
 3980|  70.6k|            PartitionCopy( &rho, &pi[k - 1], n_tg );
 3981|  70.6k|            hz_rho = h_rho = k;
 3982|  70.6k|            CtPartINCHI_CANON_INFINITY( pzb_rho, qzb, k );
 3983|  70.6k|        }
 3984|  76.5k|        qzb_rho = 0;
 3985|  76.5k|    }
 3986|       |
 3987|  76.5k|    r = k;
 3988|  76.5k|    v[k - 1] = INCHI_CANON_INFINITY;     /* DCh */
  ------------------
  |  |   31|  76.5k|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 3989|  76.5k|    CellMakeEmpty( W, k ); /* DCh */
 3990|  76.5k|    k--;
 3991|  76.5k|    goto L13;
 3992|       |
 3993|       |
 3994|  5.81M|L2:
 3995|       |    /* the two next lines intentionally switched */
 3996|       |    /* Create equitable partition in pi[k]  */
 3997|  5.81M|    if (0 > ( ret = PartitionColorVertex( pCG, G, &pi[k - 1], v[k - 1],
  ------------------
  |  Branch (3997:9): [True: 0, False: 5.81M]
  ------------------
 3998|  5.81M|        n, n_tg, n_max, bDigraph, 0 ) ))
 3999|      0|    {
 4000|      0|        goto exit_error;
 4001|      0|    }
 4002|  5.81M|    pCC->lNumBreakTies++;
 4003|  5.81M|    k++;
 4004|  5.81M|    CtPartFill( G, pCD, &pi[k - 1], &Lambda, k - 1, n, n_tg, n_max );
 4005|  5.81M|    e[k - 1] = 0;         /* moved  */
 4006|  5.81M|    v[k - 1] = INCHI_CANON_INFINITY;  /* added by DCh. */
  ------------------
  |  |   31|  5.81M|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 4007|  5.81M|    CellMakeEmpty( W, k ); /* DCh */
 4008|       |
 4009|  5.81M|    if (hz_zeta == k - 1 &&
  ------------------
  |  Branch (4009:9): [True: 5.77M, False: 45.3k]
  ------------------
 4010|  5.77M|         0 == CtPartCompare( &Lambda, &zf_zeta, NULL, NULL, k - 1, 0, bSplitTautCompare ))
  ------------------
  |  Branch (4010:10): [True: 5.76M, False: 11.3k]
  ------------------
 4011|  5.76M|    {
 4012|  5.76M|        hz_zeta = k; /* max{k|Lambda(G,pi,nu(k))==Lambda(G,pi,zeta) }  */
 4013|  5.76M|    } /* 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|  5.81M|    if (pzb_rho_fix && !qzb_rho_fix)
  ------------------
  |  Branch (4028:9): [True: 1.20M, False: 4.61M]
  |  Branch (4028:24): [True: 1.20M, False: 0]
  ------------------
 4029|  1.20M|    {
 4030|  1.20M|        qzb_rho_fix = CtPartCompare( &Lambda, pzb_rho_fix, qzb, kLeast_rho_fix, k - 1, 1, bSplitTautCompare );
 4031|  1.20M|        if (!qzb_rho_fix && bRhoIsDiscrete)
  ------------------
  |  Branch (4031:13): [True: 1.20M, False: 0]
  |  Branch (4031:29): [True: 1.20M, False: 0]
  ------------------
 4032|  1.20M|        {
 4033|  1.20M|            qzb_rho_fix = CtPartCompareLayers( kLeast_rho_fix, L_rho_fix_prev, nOneAdditionalLayer );
 4034|       |
 4035|  1.20M|#if ( FIX_ChCh_CONSTIT_CANON_BUG == 1 )
 4036|  1.20M|            if (qzb_rho_fix)
  ------------------
  |  Branch (4036:17): [True: 9.92k, False: 1.19M]
  ------------------
 4037|  9.92k|            {
 4038|  9.92k|                int L_rho_fix_diff = abs( qzb_rho_fix ) - 1;
 4039|  9.92k|                if (L_rho_fix_diff < L_rho_fix_prev ||
  ------------------
  |  Branch (4039:21): [True: 9.92k, False: 0]
  ------------------
 4040|      0|                     (L_rho_fix_diff == (L_rho_fix_prev && kLeast_rho_fix[L_rho_fix_diff].i < I_rho_fix_prev))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4040:22): [True: 0, False: 0]
  |  Branch (4040:42): [True: 0, False: 0]
  |  Branch (4040:60): [True: 0, False: 0]
  ------------------
 4041|  9.92k|                {
 4042|  9.92k|                    qzb_rho_fix = L_rho_fix_diff + 1; /* positive difference will be rejected */
 4043|  9.92k|                }
 4044|  9.92k|            }
 4045|  1.20M|#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|  1.20M|        }
 4054|  1.20M|        if (!QZFIX_OK( qzb_rho_fix ))
  ------------------
  |  | 3527|  1.20M|#define QZFIX_OK(X) ((X)<=0)
  ------------------
  |  Branch (4054:13): [True: 9.92k, False: 1.19M]
  ------------------
 4055|  9.92k|        {
 4056|  9.92k|            pCC->lNumRejectedCT++;
 4057|  9.92k|        }
 4058|  1.20M|    }
 4059|  5.81M|    if (pzb_rho_fix && QZFIX_OK( qzb_rho_fix ))
  ------------------
  |  | 3527|  1.20M|#define QZFIX_OK(X) ((X)<=0)
  |  |  ------------------
  |  |  |  Branch (3527:21): [True: 1.19M, False: 9.92k]
  |  |  ------------------
  ------------------
  |  Branch (4059:9): [True: 1.20M, False: 4.61M]
  ------------------
 4060|  1.19M|    {
 4061|  1.19M|        hzb_rho_fix = k;
 4062|  1.19M|    }
 4063|       |    /* if (!lab) goto L3; */
 4064|  5.81M|    if (lab && QZFIX_OK( qzb_rho_fix ))
  ------------------
  |  | 3527|  5.81M|#define QZFIX_OK(X) ((X)<=0)
  |  |  ------------------
  |  |  |  Branch (3527:21): [True: 5.80M, False: 9.92k]
  |  |  ------------------
  ------------------
  |  Branch (4064:9): [True: 5.81M, False: 0]
  ------------------
 4065|  5.80M|    {
 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|  5.80M|        if (hz_rho == k - 1 && !qzb_rho && bRhoIsDiscrete)
  ------------------
  |  Branch (4068:13): [True: 5.76M, False: 40.6k]
  |  Branch (4068:32): [True: 5.76M, False: 0]
  |  Branch (4068:44): [True: 5.76M, False: 0]
  ------------------
 4069|  5.76M|        {
 4070|  5.76M|            int qzb_rho_temp = 0; /* djb-rwth: ignoring LLVM warning: variable used */
 4071|  5.76M|            qzb_rho = CtPartCompare( &Lambda, pzb_rho, qzb, kLeast_rho, k - 1, 0, bSplitTautCompare );
 4072|       |            /* old code */
 4073|  5.76M|            if (!qzb_rho && pzb_rho_fix_reached &&
  ------------------
  |  Branch (4073:17): [True: 5.76M, False: 10]
  |  Branch (4073:29): [True: 1.15M, False: 4.61M]
  ------------------
 4074|  1.15M|                  nOneAdditionalLayer && 0 > kLeast_rho[nOneAdditionalLayer].k)
  ------------------
  |  Branch (4074:19): [True: 888k, False: 264k]
  |  Branch (4074:42): [True: 8.07k, False: 880k]
  ------------------
 4075|  8.07k|            {
 4076|  8.07k|                qzb_rho_temp = -( nOneAdditionalLayer + 1 ); /* djb-rwth: ignoring LLVM warning: variable used */
 4077|       |                /* qzb_rho = -(nOneAdditionalLayer+1); *//* early rejection */
 4078|  8.07k|            }
 4079|       |            /* new code */
 4080|  5.76M|            if (!qzb_rho && bRhoIsDiscrete)
  ------------------
  |  Branch (4080:17): [True: 5.76M, False: 10]
  |  Branch (4080:29): [True: 5.76M, False: 0]
  ------------------
 4081|  5.76M|            {
 4082|  5.76M|                qzb_rho = CtPartCompareLayers( kLeast_rho, L_rho_fix_prev, 0 );
 4083|  5.76M|#if ( FIX_ChCh_CONSTIT_CANON_BUG == 1 )
 4084|  5.76M|                if (qzb_rho)
  ------------------
  |  Branch (4084:21): [True: 8.59k, False: 5.75M]
  ------------------
 4085|  8.59k|                {
 4086|  8.59k|                    int L_rho_diff = abs( qzb_rho ) - 1;
 4087|  8.59k|                    if (L_rho_diff < L_rho_fix_prev ||
  ------------------
  |  Branch (4087:25): [True: 7, False: 8.58k]
  ------------------
 4088|  8.58k|                         (L_rho_diff == (L_rho_fix_prev && kLeast_rho[L_rho_diff].i < I_rho_fix_prev))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4088:26): [True: 0, False: 8.58k]
  |  Branch (4088:42): [True: 8.58k, False: 0]
  |  Branch (4088:60): [True: 0, False: 8.58k]
  ------------------
 4089|      7|                    {
 4090|      7|                        qzb_rho = -( L_rho_diff + 1 ); /* negative difference will be rejected */
 4091|      7|                    }
 4092|  8.59k|                }
 4093|  5.76M|#endif
 4094|  5.76M|            }
 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|  5.76M|            if (!qzb_rho)
  ------------------
  |  Branch (4102:17): [True: 5.75M, False: 8.60k]
  ------------------
 4103|  5.75M|            {
 4104|  5.75M|                hz_rho = k;
 4105|  5.75M|            }
 4106|  8.60k|            else
 4107|  8.60k|            {
 4108|  8.60k|                if (qzb_rho < 0)
  ------------------
  |  Branch (4108:21): [True: 8.08k, False: 517]
  ------------------
 4109|  8.08k|                {
 4110|  8.08k|                    pCC->lNumRejectedCT++;
 4111|  8.08k|                }
 4112|  8.60k|            }
 4113|  5.76M|        }
 4114|  5.80M|        if (qzb_rho > 0 || (!qzb_rho && !bRhoIsDiscrete)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4114:13): [True: 39.4k, False: 5.76M]
  |  Branch (4114:29): [True: 5.75M, False: 9.72k]
  |  Branch (4114:41): [True: 0, False: 5.75M]
  ------------------
 4115|  39.4k|        {
 4116|       |            /* found better rho */
 4117|  39.4k|            if (!nNumLayers)
  ------------------
  |  Branch (4117:17): [True: 4, False: 39.4k]
  ------------------
 4118|      4|            {
 4119|      4|                CtPartCopy( pzb_rho, &Lambda, k - 1 );
 4120|      4|            }
 4121|  39.4k|        }
 4122|  5.80M|    }
 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|  5.81M|    if (hz_zeta == k || hz_rho == k ||
  ------------------
  |  Branch (4128:9): [True: 5.76M, False: 56.7k]
  |  Branch (4128:25): [True: 64, False: 56.6k]
  ------------------
 4129|  56.6k|        ( lab && qzb_rho >= 0 && QZFIX_OK( qzb_rho_fix ) ))
  ------------------
  |  | 3527|  49.4k|#define QZFIX_OK(X) ((X)<=0)
  |  |  ------------------
  |  |  |  Branch (3527:21): [True: 39.4k, False: 9.92k]
  |  |  ------------------
  ------------------
  |  Branch (4129:11): [True: 56.6k, False: 0]
  |  Branch (4129:18): [True: 49.4k, False: 7.24k]
  ------------------
 4130|  5.80M|    {
 4131|       |        /*L4: check for possible isomorphism or found a better rho */
 4132|  5.80M|        if (PartitionIsDiscrete( &pi[k - 1], n ))
  ------------------
  |  Branch (4132:13): [True: 386k, False: 5.41M]
  ------------------
 4133|   386k|        {
 4134|   386k|            pCC->lNumTotCT++;
 4135|   386k|            goto L7;
 4136|   386k|        }
 4137|  5.41M|        PartitionGetFirstCell( &pi[k - 1], W, k, n );
 4138|  5.41M|        v[k - 1] = CellGetMinNode( &pi[k - 1], &W[k - 1], 0, pCD1 );
 4139|  5.41M|        if (!dig && PartitionSatisfiesLemma_2_25( &pi[k - 1], n ))
  ------------------
  |  Branch (4139:13): [True: 4.25M, False: 1.16M]
  |  Branch (4139:21): [True: 891k, False: 3.35M]
  ------------------
 4140|   891k|        {
 4141|   891k|            ; /* found additional isomprphism */
 4142|   891k|        }
 4143|  4.52M|        else
 4144|  4.52M|        {
 4145|  4.52M|            t_Lemma = k + 1;
 4146|  4.52M|        }
 4147|  5.41M|        e[k - 1] = 0;  /* created new cell W[k-1] */
 4148|  5.41M|        goto L2;
 4149|  5.80M|    }
 4150|       |
 4151|       |
 4152|  17.5k|L6:
 4153|       |    /* a better rho or no good node was found at this level; return to smaller k */
 4154|  17.5k|    k2 = k;
 4155|  17.5k|    k = inchi_min( t_Lemma - 1, inchi_max( t_eq_zeta - 1, hz_rho ) );
  ------------------
  |  |  139|  35.0k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 3.78k, False: 13.7k]
  |  |  |  Branch (139:32): [True: 9.45k, False: 8.06k]
  |  |  |  Branch (139:41): [True: 6.02k, False: 7.71k]
  |  |  ------------------
  ------------------
 4156|  17.5k|    if (k2 == t_Lemma)
  ------------------
  |  Branch (4156:9): [True: 17.5k, False: 4]
  ------------------
 4157|  17.5k|    {
 4158|  17.5k|        goto L13;
 4159|  17.5k|    }
 4160|       |
 4161|       |    /* store isomorphism found from Lemma 2.25. should be dig=0 !!! */
 4162|      4|    if (dig)
  ------------------
  |  Branch (4162:9): [True: 0, False: 4]
  ------------------
 4163|      0|    {
 4164|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 4165|       |        int stop = 1;
 4166|       |#endif
 4167|      0|        goto L13;
 4168|      0|    }
 4169|       |
 4170|      4|    l = inchi_min( l + 1, L_curr_max_set_size );
  ------------------
  |  |  139|      4|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 4, False: 0]
  |  |  ------------------
  ------------------
 4171|      4|    PartitionGetMcrAndFixSet( pCG, &pi[t_Lemma - 1], &Omega, &Phi, n_tg, l );
 4172|      4|    goto L12;
 4173|       |
 4174|       |
 4175|       |
 4176|   386k|L7:
 4177|       |    /* from L4: pi[k-1] is discrete */
 4178|   386k|    if (h_zeta == 0)
  ------------------
  |  Branch (4178:9): [True: 0, False: 386k]
  ------------------
 4179|      0|    {
 4180|       |        /*goto L18;*/  /* error. the first T(nu) leaf was found */
 4181|      0|        ret = CT_CANON_ERR;
  ------------------
  |  |   35|      0|#define CT_CANON_ERR         (CT_ERR_FIRST-16)  /*(-30016) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4182|      0|        goto exit_error;
 4183|      0|    }
 4184|   386k|    if (k != hz_zeta)
  ------------------
  |  Branch (4184:9): [True: 406, False: 386k]
  ------------------
 4185|    406|    {
 4186|    406|        goto L8;
 4187|    406|    }
 4188|       |    /*  here zeta^gamma == nu */
 4189|       |    /*  if ( G^gamma == G ) goto L10; */
 4190|   386k|    if (0 == ( res = CtFullCompare( &Lambda, &zf_zeta, 0, bSplitTautCompare ) )) /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (4190:9): [True: 386k, False: 0]
  ------------------
 4191|   386k|    {
 4192|   386k|        PartitionGetTransposition( &zeta, &pi[k - 1], n_tg, &gamma );
 4193|   386k|        bZetaIsomorph = 1; /* for testing only */
 4194|       |        /* djb-rwth: removing redundant code */
 4195|   386k|        goto L10;
 4196|   386k|    }
 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|    406|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|    406|    if (!lab || (qzb_rho < 0 && ( !pzb_rho_fix || qzb_rho_fix > 0 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4213:9): [True: 0, False: 406]
  |  Branch (4213:18): [True: 0, False: 406]
  |  Branch (4213:35): [True: 0, False: 0]
  |  Branch (4213:51): [True: 0, False: 0]
  ------------------
 4214|      0|    {
 4215|      0|        goto L6;
 4216|      0|    }
 4217|    406|    if (pzb_rho_fix && kLeast_rho_fix && 0 == qzb_rho_fix) /* djb-rwth: addressing of array kLeast_rho_fix will always evaluate to true? */
  ------------------
  |  Branch (4217:9): [True: 403, False: 3]
  |  Branch (4217:24): [True: 403, False: 0]
  |  Branch (4217:42): [True: 403, False: 0]
  ------------------
 4218|    403|    {
 4219|       |        /* check for the rejection condition: Lambda > zb_rho_fix */
 4220|    403|        if (kLeast_rho_fix) /* djb-rwth: addressing of array kLeast_rho_fix will always evaluate to true? */
  ------------------
  |  Branch (4220:13): [True: 403, False: 0]
  ------------------
 4221|    403|        {
 4222|    403|            int qzb_rho_fix_alt;
 4223|    403|            qzb_rho_fix = CtFullCompareLayers( kLeast_rho_fix );
 4224|       |            /* for debug only */
 4225|    403|            qzb_rho_fix_alt = CtFullCompare( &Lambda, pzb_rho_fix, 1, bSplitTautCompare );
 4226|    403|            if (qzb_rho_fix != qzb_rho_fix_alt)
  ------------------
  |  Branch (4226:17): [True: 0, False: 403]
  ------------------
 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|    403|        }
 4235|      0|        else
 4236|      0|        {
 4237|      0|            qzb_rho_fix = CtFullCompare( &Lambda, pzb_rho_fix, 1, bSplitTautCompare );
 4238|      0|        }
 4239|    403|        if (!pzb_rho_fix_reached)
  ------------------
  |  Branch (4239:13): [True: 0, False: 403]
  ------------------
 4240|      0|        {
 4241|      0|            pzb_rho_fix_reached = !qzb_rho_fix;
 4242|      0|        }
 4243|    403|        if (0 < qzb_rho_fix)
  ------------------
  |  Branch (4243:13): [True: 0, False: 403]
  ------------------
 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|    403|        qzb_rho_fix = 0;
 4251|    403|    }
 4252|       |
 4253|    406|    if (qzb_rho < 0)
  ------------------
  |  Branch (4253:9): [True: 0, False: 406]
  ------------------
 4254|      0|    {
 4255|      0|        goto L6;
 4256|      0|    }
 4257|    406|    if (qzb_rho > 0 || !bRhoIsDiscrete)
  ------------------
  |  Branch (4257:9): [True: 348, False: 58]
  |  Branch (4257:24): [True: 0, False: 58]
  ------------------
 4258|    348|    {
 4259|    348|        goto L9; /* note: p67 says k > PartitionSize( &rho, n ) */
 4260|    348|    }
 4261|     58|    if (k < r)
  ------------------
  |  Branch (4261:9): [True: 1, False: 57]
  ------------------
 4262|      1|    {
 4263|      1|        goto L9; /* cannot understand it... */
 4264|      1|    }
 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|     57|    if (kLeast_rho) /* djb-rwth: addressing of array kLeast_rho will always evaluate to true? */
  ------------------
  |  Branch (4269:9): [True: 57, False: 0]
  ------------------
 4270|     57|    {
 4271|     57|        int cur_qzb_alt;
 4272|     57|        qzb_rho = CtFullCompareLayers( kLeast_rho );
 4273|       |        /* for debug only */
 4274|     57|        cur_qzb_alt = CtFullCompare( &Lambda, pzb_rho, 0, bSplitTautCompare );
 4275|     57|        if (qzb_rho != cur_qzb_alt)
  ------------------
  |  Branch (4275:13): [True: 0, False: 57]
  ------------------
 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|     57|    }
 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|     57|    if (0 < qzb_rho)
  ------------------
  |  Branch (4289:9): [True: 0, False: 57]
  ------------------
 4290|      0|    {
 4291|       |        /* CtFullCompare( &Lambda, pzb_rho, 0, bSplitTautCompare ); */
 4292|       |        /* djb-rwth: removing redundant code */
 4293|      0|        goto L9;
 4294|      0|    }
 4295|       |    /* if ( G(nu) < G(rho) ) goto L6; */
 4296|     57|    if (0 > qzb_rho)
  ------------------
  |  Branch (4296:9): [True: 0, False: 57]
  ------------------
 4297|      0|    {
 4298|      0|        qzb_rho = 0;
 4299|      0|        goto L6;
 4300|      0|    }
 4301|       |    /* nu^gamma == rho */
 4302|     57|    if (r != k)
  ------------------
  |  Branch (4302:9): [True: 0, False: 57]
  ------------------
 4303|      0|    {  /* if() is for debug only */
 4304|      0|        r = k;
 4305|      0|    }
 4306|       |
 4307|     57|    PartitionGetTransposition( &pi[k - 1], &rho, n_tg, &gamma );
 4308|     57|    bZetaIsomorph = 0; /* DCh */
 4309|     57|    pCC->lNumEqualCT++;
 4310|     57|    goto L10;
 4311|       |
 4312|    349|L9:
 4313|       |    /* rho := nu; */
 4314|    349|    PartitionCopy( &rho, &pi[k - 1], n_tg );
 4315|    349|    if (nNumLayers)
  ------------------
  |  Branch (4315:9): [True: 346, False: 3]
  ------------------
 4316|    346|    {
 4317|    346|        CtFullCopy( pzb_rho, &Lambda );
 4318|    346|    }
 4319|    349|    bZetaEqRho = 0;
 4320|    349|    qzb_rho = 0;
 4321|    349|    CtCompareLayersGetFirstDiff( kLeast_rho_fix, nOneAdditionalLayer,
 4322|    349|                                 &L_rho_fix_prev, &I_rho_fix_prev,
 4323|    349|                                 &k_rho_fix_prev );
 4324|    349|    memset( kLeast_rho, 0, sizeof( kLeast_rho ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4325|    349|    h_rho = hz_rho = k;
 4326|    349|    CtPartINCHI_CANON_INFINITY( pzb_rho, qzb, k );
 4327|    349|    pCC->lNumDecreasedCT++;
 4328|    349|    pCC->lNumEqualCT = 1;
 4329|    349|    bRhoIsDiscrete = 1;
 4330|    349|    goto L6;
 4331|       |
 4332|   386k|L10: /* discrete pi[k-1] && G^gamma == G */
 4333|   386k|    pCC->lNumEqualCT += bZetaEqRho || !( bZetaIsomorph || qzb_rho );
  ------------------
  |  Branch (4333:25): [True: 385k, False: 908]
  |  Branch (4333:42): [True: 851, False: 57]
  |  Branch (4333:59): [True: 0, False: 57]
  ------------------
 4334|   386k|    l = inchi_min( l + 1, L_curr_max_set_size );
  ------------------
  |  |  139|   386k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 386k, False: 0]
  |  |  ------------------
  ------------------
 4335|       |    /* Omega[l] := mcr(gamma);
 4336|       |       Phi[l]   := fix(gamma);
 4337|       |    */
 4338|       |
 4339|   386k|    TranspositionGetMcrAndFixSetAndUnorderedPartition( pCG, &gamma, &Omega, &Phi,
 4340|   386k|                                                       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|   386k|    if (!UnorderedPartitionJoin( &theta_from_gamma, &theta, n_tg ))
  ------------------
  |  Branch (4347:9): [True: 2, False: 386k]
  ------------------
 4348|      2|    {
 4349|      2|        goto L11; /* no new isomorphism found */
 4350|      2|    }
 4351|       |
 4352|       |    /*  Output gamma (it is the Aut(G) generator) -- omitted -- */
 4353|   386k|    nNumFoundGenerators++;
 4354|       |    /* if ( tvc in mcr(theta) ) goto L11; */
 4355|   386k|    if (tvc == GetUnorderedPartitionMcrNode( &theta, tvc ))
  ------------------
  |  Branch (4355:9): [True: 386k, False: 6]
  ------------------
 4356|   386k|    {
 4357|   386k|        goto L11;
 4358|   386k|    }
 4359|      6|    k = h_zeta;
 4360|      6|    goto L13;
 4361|       |
 4362|   386k|L11:
 4363|   386k|    k = lab ? h_rho : h_zeta; /***Changed*** originally was k = h_rho; */
  ------------------
  |  Branch (4363:9): [True: 386k, False: 0]
  ------------------
 4364|       |
 4365|   386k|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|   386k|    if (e[k - 1] == 1 && v[k - 1] != INCHI_CANON_INFINITY)
  ------------------
  |  |   31|     31|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
  |  Branch (4373:9): [True: 31, False: 386k]
  |  Branch (4373:26): [True: 31, False: 0]
  ------------------
 4374|     31|    {
 4375|       |        /* INCHI_CANON_INFINITY for testing only */
 4376|     31|        CellIntersectWithSet( pCG, &pi[k - 1], &W[k - 1], &Omega, l );
 4377|     31|    }
 4378|       |
 4379|   991k|L13:
 4380|       |
 4381|   991k|    if ((UserAction && USER_ACTION_QUIT == ( *UserAction )( )) ||
  ------------------
  |  |  124|      0|#define USER_ACTION_QUIT   1
  ------------------
  |  Branch (4381:10): [True: 0, False: 991k]
  |  Branch (4381:24): [True: 0, False: 0]
  ------------------
 4382|   991k|         (ConsoleQuit && ( *ConsoleQuit )( ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4382:11): [True: 0, False: 991k]
  |  Branch (4382:26): [True: 0, False: 0]
  ------------------
 4383|      0|    {
 4384|      0|        ret = CT_USER_QUIT_ERR;
  ------------------
  |  |   32|      0|#define CT_USER_QUIT_ERR     (CT_ERR_FIRST-13)  /*(-30013) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4385|      0|        goto exit_error;
 4386|      0|    }
 4387|       |
 4388|   991k|    if (bInchiTimeIsOver( ic, pCD->ulTimeOutTime ))
  ------------------
  |  Branch (4388:9): [True: 0, False: 991k]
  ------------------
 4389|      0|    {
 4390|      0|        ret = CT_TIMEOUT_ERR;
  ------------------
  |  |   27|      0|#define CT_TIMEOUT_ERR       (CT_ERR_FIRST- 8)  /*(-30008) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4391|      0|        goto exit_error;
 4392|      0|    }
 4393|       |
 4394|   991k|    if (k == 0)
  ------------------
  |  Branch (4394:9): [True: 76.5k, False: 914k]
  ------------------
 4395|  76.5k|    {
 4396|  76.5k|        goto exit_function; /* stop */
 4397|  76.5k|    }
 4398|       |
 4399|   914k|    if (lab && k < h_rho)
  ------------------
  |  Branch (4399:9): [True: 914k, False: 0]
  |  Branch (4399:16): [True: 397k, False: 517k]
  ------------------
 4400|   397k|    {
 4401|       |        /***Added***/
 4402|   397k|        h_rho = k;
 4403|   397k|    }
 4404|       |
 4405|   914k|    if (k > h_zeta)
  ------------------
  |  Branch (4405:9): [True: 132k, False: 781k]
  ------------------
 4406|   132k|    {
 4407|   132k|        if (v[k - 1] == INCHI_CANON_INFINITY)
  ------------------
  |  |   31|   132k|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
  |  Branch (4407:13): [True: 0, False: 132k]
  ------------------
 4408|      0|        {
 4409|       |            /*** Added by DCh for testing only ****/
 4410|      0|            k--;
 4411|      0|            goto L13;
 4412|      0|        }
 4413|   132k|        goto L17;
 4414|   132k|    }
 4415|   781k|    if (k == h_zeta)
  ------------------
  |  Branch (4415:9): [True: 392k, False: 389k]
  ------------------
 4416|   392k|    {
 4417|   392k|        goto L14;
 4418|   392k|    }
 4419|   389k|    h_zeta = k;
 4420|   389k|    tvc = tvh = CellGetMinNode( &pi[k - 1], &W[k - 1], 0, pCD1 );
 4421|       |
 4422|  4.10M|L14:
 4423|       |    /* if v[k] and tvh are in the same cell of theta then index ++ */
 4424|  4.10M|    if (GetUnorderedPartitionMcrNode( &theta, v[k - 1] ) ==
  ------------------
  |  Branch (4424:9): [True: 4.01M, False: 87.1k]
  ------------------
 4425|  4.10M|         GetUnorderedPartitionMcrNode( &theta, tvh ))
 4426|  4.01M|    {
 4427|  4.01M|        index++;
 4428|  4.01M|    }
 4429|  4.10M|    v[k - 1] = CellGetMinNode( &pi[k - 1], &W[k - 1], v[k - 1], pCD1 );
 4430|       |
 4431|  4.10M|    if (v[k - 1] == INCHI_CANON_INFINITY)
  ------------------
  |  |   31|  4.10M|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
  |  Branch (4431:9): [True: 389k, False: 3.71M]
  ------------------
 4432|   389k|    {
 4433|   389k|        goto L16;
 4434|   389k|    }
 4435|  3.71M|    if (v[k - 1] != GetUnorderedPartitionMcrNode( &theta, v[k - 1] ))
  ------------------
  |  Branch (4435:9): [True: 3.31M, False: 392k]
  ------------------
 4436|  3.31M|    {
 4437|  3.31M|        goto L14;
 4438|  3.31M|    }
 4439|       |
 4440|   404k|L15:
 4441|   404k|    t_Lemma = inchi_min( t_Lemma, k + 1 );
  ------------------
  |  |  139|   404k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 217k, False: 186k]
  |  |  ------------------
  ------------------
 4442|   404k|    hz_zeta = inchi_min( hz_zeta, k );
  ------------------
  |  |  139|   404k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 6.17k, False: 397k]
  |  |  ------------------
  ------------------
 4443|       |    /*
 4444|       |    if ( lab && hz_rho >= k ) {
 4445|       |        hz_rho = k;
 4446|       |        qzb_rho = 0;
 4447|       |    }
 4448|       |    */
 4449|   404k|    if (lab)
  ------------------
  |  Branch (4449:9): [True: 404k, False: 0]
  ------------------
 4450|   404k|    {
 4451|   404k|        if (hz_rho >= k /*-1*/)
  ------------------
  |  Branch (4451:13): [True: 398k, False: 5.84k]
  ------------------
 4452|   398k|        {
 4453|   398k|            qzb_rho = 0;
 4454|   398k|        }
 4455|   404k|        if (hz_rho > k)
  ------------------
  |  Branch (4455:13): [True: 396k, False: 7.32k]
  ------------------
 4456|   396k|        {
 4457|   396k|            hz_rho = k;
 4458|   396k|        }
 4459|   404k|        UpdateCompareLayers( kLeast_rho, hz_rho );
 4460|   404k|    }
 4461|   404k|    if (pzb_rho_fix)
  ------------------
  |  Branch (4461:9): [True: 39.6k, False: 364k]
  ------------------
 4462|  39.6k|    {
 4463|  39.6k|        if (hzb_rho_fix >= k /*-1*/)
  ------------------
  |  Branch (4463:13): [True: 39.6k, False: 0]
  ------------------
 4464|  39.6k|        {
 4465|  39.6k|            qzb_rho_fix = 0;
 4466|  39.6k|        }
 4467|  39.6k|        if (hzb_rho_fix > k)
  ------------------
  |  Branch (4467:13): [True: 36.6k, False: 2.99k]
  ------------------
 4468|  36.6k|        {
 4469|  36.6k|            hzb_rho_fix = k;
 4470|  36.6k|        }
 4471|  39.6k|        UpdateCompareLayers( kLeast_rho_fix, hzb_rho_fix );
 4472|  39.6k|    }
 4473|       |
 4474|   404k|    goto L2;
 4475|       |
 4476|   389k|L16:
 4477|   389k|    if (t_eq_zeta == k + 1 && index == CellGetNumberOfNodes( &pi[k - 1], &W[k - 1] ))
  ------------------
  |  Branch (4477:9): [True: 380k, False: 9.19k]
  |  Branch (4477:31): [True: 377k, False: 2.51k]
  ------------------
 4478|   377k|    {
 4479|   377k|        t_eq_zeta = k;
 4480|   377k|    }
 4481|       |
 4482|   389k|    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|   389k|    index = 0;
 4488|   389k|    k--;
 4489|   389k|    goto L13;
 4490|       |
 4491|   132k|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|   132k|    if (e[k - 1] == 0 && v[k - 1] != INCHI_CANON_INFINITY) /* Added v[k-1]!=... DCh */
  ------------------
  |  |   31|   121k|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
  |  Branch (4504:9): [True: 121k, False: 11.5k]
  |  Branch (4504:26): [True: 121k, False: 0]
  ------------------
 4505|   121k|    {
 4506|   121k|        NodeSetFromVertices( pCG, &cur_nodes, 1, v, k - 1 );
 4507|  9.07M|        for (i = 1; i <= l; i++)
  ------------------
  |  Branch (4507:21): [True: 8.95M, False: 121k]
  ------------------
 4508|  8.95M|        {
 4509|  8.95M|            if (AllNodesAreInSet( &cur_nodes, 1, &Phi, i ))
  ------------------
  |  Branch (4509:17): [True: 2.97M, False: 5.97M]
  ------------------
 4510|  2.97M|            {
 4511|  2.97M|                CellIntersectWithSet( pCG, &pi[k - 1], &W[k - 1], &Omega, i );
 4512|  2.97M|            }
 4513|  8.95M|        }
 4514|   121k|    }
 4515|       |
 4516|   132k|    e[k - 1] = 1;
 4517|   132k|    v[k - 1] = CellGetMinNode( &pi[k - 1], &W[k - 1], v[k - 1], pCD1 );
 4518|   132k|    if (v[k - 1] != INCHI_CANON_INFINITY)
  ------------------
  |  |   31|   132k|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
  |  Branch (4518:9): [True: 11.5k, False: 121k]
  ------------------
 4519|  11.5k|    {
 4520|  11.5k|        goto L15;
 4521|  11.5k|    }
 4522|   121k|    k--;
 4523|   121k|    goto L13;
 4524|       |/* L18: see above */
 4525|       |
 4526|   330k|exit_function:
 4527|       |    /* CtPartFill( G, pCD, &rho, pzb_rho, 1, n, n_tg ); */
 4528|   330k|    if (!bRhoIsDiscrete)
  ------------------
  |  Branch (4528:9): [True: 0, False: 330k]
  ------------------
 4529|      0|    {
 4530|      0|        ret = CT_CANON_ERR;
  ------------------
  |  |   35|      0|#define CT_CANON_ERR         (CT_ERR_FIRST-16)  /*(-30016) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4531|      0|        goto exit_error;
 4532|      0|    }
 4533|       |
 4534|   330k|    if (pzb_rho_fix)
  ------------------
  |  Branch (4534:9): [True: 78.5k, False: 252k]
  ------------------
 4535|  78.5k|    {
 4536|  78.5k|        qzb_rho_fix = CtFullCompare( pzb_rho_fix, pzb_rho, 1, bSplitTautCompare );
 4537|  78.5k|        if (qzb_rho_fix)
  ------------------
  |  Branch (4537:13): [True: 0, False: 78.5k]
  ------------------
 4538|      0|        {
 4539|      0|            ret = CT_CANON_ERR;
  ------------------
  |  |   35|      0|#define CT_CANON_ERR         (CT_ERR_FIRST-16)  /*(-30016) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4540|      0|            goto exit_error;
 4541|      0|        }
 4542|  78.5k|    }
 4543|       |
 4544|       |    /* SymmRank */
 4545|   330k|    memset( nSymmRank, 0, n_tg * sizeof( nSymmRank[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4546|  1.52M|    for (i = 0; i < n_tg; i++)
  ------------------
  |  Branch (4546:17): [True: 1.19M, False: 330k]
  ------------------
 4547|  1.19M|    {
 4548|  1.19M|        k = rho.AtNumber[i];
 4549|  1.19M|        k2 = (int) GetUnorderedPartitionMcrNode( &theta, (AT_NUMB) ( k + 1 ) ) - 1;
 4550|  1.19M|        if (!nSymmRank[k2] || nSymmRank[k2] > rho.Rank[k])
  ------------------
  |  Branch (4550:13): [True: 800k, False: 391k]
  |  Branch (4550:31): [True: 0, False: 391k]
  ------------------
 4551|   800k|        {
 4552|   800k|            nSymmRank[k2] = rho.Rank[k];
 4553|   800k|        }
 4554|  1.19M|    }
 4555|  1.52M|    for (i = 0; i < n_tg; i++)
  ------------------
  |  Branch (4555:17): [True: 1.19M, False: 330k]
  ------------------
 4556|  1.19M|    {
 4557|  1.19M|        k = rho.AtNumber[i];
 4558|  1.19M|        k2 = (int) GetUnorderedPartitionMcrNode( &theta, (AT_NUMB) ( k + 1 ) ) - 1;
 4559|  1.19M|        nSymmRank[k] = nSymmRank[k2];
 4560|  1.19M|    }
 4561|       |    /* CanonRank, nAtomNumberCanon */
 4562|   330k|    memcpy(nCanonRank, rho.Rank, n_tg * sizeof(nCanonRank[0]));
 4563|   330k|    memcpy(nAtomNumberCanon, rho.AtNumber, n_tg * sizeof(nAtomNumberCanon[0]));
 4564|       |    /* LinearCT */
 4565|   330k|    if (pzb_rho)
  ------------------
  |  Branch (4565:9): [True: 330k, False: 0]
  ------------------
 4566|   330k|    {
 4567|   330k|        *nLenCt = pzb_rho->lenCt - 1;
 4568|   330k|    }
 4569|   330k|    if (pCt && pzb_rho && (*nLenCt > 0)) /* djb-rwth: GHI #164 fix */
  ------------------
  |  Branch (4569:9): [True: 0, False: 330k]
  |  Branch (4569:16): [True: 0, False: 0]
  |  Branch (4569:27): [True: 0, False: 0]
  ------------------
 4570|      0|    {
 4571|      0|        memcpy(pCt, pzb_rho->Ctbl, *nLenCt * sizeof(pCt[0]));
 4572|      0|    }
 4573|   330k|    pCC->lNumTotCT = pCC->lNumDecreasedCT + pCC->lNumRejectedCT + pCC->lNumEqualCT;
 4574|   330k|    pCC->dGroupSize = size;
 4575|   330k|    pCC->lNumGenerators = nNumFoundGenerators;
 4576|   330k|    pCC->lNumStoredIsomorphisms = l;
 4577|       |    /* Note: check nNumFoundGenerators */
 4578|       |
 4579|   330k|    if (pp_zb_rho_out && !*pp_zb_rho_out)
  ------------------
  |  Branch (4579:9): [True: 330k, False: 0]
  |  Branch (4579:26): [True: 330k, False: 0]
  ------------------
 4580|   330k|    {
 4581|   330k|        *pp_zb_rho_out = pzb_rho;
 4582|   330k|        pzb_rho = NULL;
 4583|   330k|    }
 4584|       |
 4585|       |
 4586|       |
 4587|   330k|exit_error:
 4588|   330k|    INCHI_HEAPCHK
 4589|       |
 4590|   330k|    UnorderedPartitionFree( &theta );
 4591|   330k|    UnorderedPartitionFree( &theta_from_gamma );
 4592|   330k|    if (W)
  ------------------
  |  Branch (4592:9): [True: 330k, False: 0]
  ------------------
 4593|   330k|    {
 4594|   330k|        inchi_free( W );
  ------------------
  |  | 1152|   330k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 330k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 330k]
  |  |  ------------------
  ------------------
 4595|   330k|    }
 4596|   330k|    if (v)
  ------------------
  |  Branch (4596:9): [True: 330k, False: 0]
  ------------------
 4597|   330k|    {
 4598|   330k|        inchi_free( v );
  ------------------
  |  | 1152|   330k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 330k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 330k]
  |  |  ------------------
  ------------------
 4599|   330k|    }
 4600|   330k|    if (e)
  ------------------
  |  Branch (4600:9): [True: 330k, False: 0]
  ------------------
 4601|   330k|    {
 4602|   330k|        inchi_free( e );
  ------------------
  |  | 1152|   330k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 330k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 330k]
  |  |  ------------------
  ------------------
 4603|   330k|    }
 4604|   330k|    if (qzb)
  ------------------
  |  Branch (4604:9): [True: 0, False: 330k]
  ------------------
 4605|      0|    {
 4606|      0|        inchi_free( qzb );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4607|      0|    }
 4608|   330k|    CTableFree( &Lambda );
 4609|   330k|    CTableFree( &zf_zeta );
 4610|   330k|    if (pzb_rho)
  ------------------
  |  Branch (4610:9): [True: 0, False: 330k]
  ------------------
 4611|      0|    {
 4612|      0|        CTableFree( pzb_rho );
 4613|      0|        inchi_free( pzb_rho );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4614|      0|        pzb_rho = NULL;
 4615|      0|    }
 4616|       |    /* CTableFree( &zf_zeta2 ); */
 4617|   330k|    NodeSetFree( pCG, &Omega );
 4618|   330k|    NodeSetFree( pCG, &Phi );
 4619|       |    /* NodeSetFree( &mcr_theta, n, 1 ); */
 4620|   330k|    NodeSetFree( pCG, &cur_nodes );
 4621|   330k|    PartitionFree( &zeta );
 4622|       |    /* PartitionFree( &zeta2 ); */
 4623|   330k|    PartitionFree( &rho );
 4624|   330k|    TranspositionFree( &gamma );
 4625|       |
 4626|   330k|    return ret;
 4627|   330k|}
SetInitialRanks2:
 4644|   371k|{
 4645|   371k|    int i, nNumDiffRanks;
 4646|   371k|    AT_RANK nCurrentRank;
 4647|       |
 4648|  1.64M|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (4648:17): [True: 1.27M, False: 371k]
  ------------------
 4649|  1.27M|    {
 4650|  1.27M|        nAtomNumber[i] = (AT_RANK) i;
 4651|  1.27M|    }
 4652|       |
 4653|       |    /* global for qsort */
 4654|   371k|    pCG->m_pAtomInvariant2ForSort = pAtomInvariant2;
 4655|       |
 4656|   371k|    inchi_qsort( pCG, nAtomNumber, num_atoms, sizeof( nAtomNumber[0] ), CompAtomInvariants2 );
 4657|       |
 4658|       |    /* nNewRank[i]: non-decreading order; do not increment nCurrentRank */
 4659|       |    /*           if consecutive sorted atom invariants are identical */
 4660|       |
 4661|       |    /* djb-rwth: fixing oss-fuzz issue #69315 */
 4662|   371k|    nNumDiffRanks = 1;
 4663|   371k|    if (num_atoms > 0)
  ------------------
  |  Branch (4663:9): [True: 371k, False: 0]
  ------------------
 4664|   371k|    {
 4665|   371k|        nCurrentRank = (AT_RANK)num_atoms;
 4666|   371k|        nNewRank[nAtomNumber[num_atoms - 1]] = nCurrentRank;
 4667|  1.27M|        for (i = num_atoms - 1; i > 0; i--)
  ------------------
  |  Branch (4667:33): [True: 898k, False: 371k]
  ------------------
 4668|   898k|        {
 4669|       |            /* Note: CompAtomInvariants2Only() in following line implicitly reads pAtomInvariant2 pointed by pAtomInvariant2ForSort */
 4670|   898k|            if (CompAtomInvariants2Only(&nAtomNumber[i - 1], &nAtomNumber[i], pCG))
  ------------------
  |  Branch (4670:17): [True: 471k, False: 426k]
  ------------------
 4671|   471k|            {
 4672|   471k|                nNumDiffRanks++;
 4673|   471k|                nCurrentRank = (AT_RANK)i;
 4674|   471k|            }
 4675|   898k|            nNewRank[nAtomNumber[i - 1]] = nCurrentRank;
 4676|   898k|        }
 4677|   371k|    }
 4678|       |
 4679|   371k|    return nNumDiffRanks;
 4680|   371k|}
FillOutAtomInvariant2:
 4694|   292k|{
 4695|   292k|    int i, k, j, i_t_group;
 4696|       |    /* tautomers */
 4697|   292k|    T_GROUP          *t_group = NULL;
 4698|   292k|    int               num_t_groups = 0;
 4699|   292k|    int               num_tautomer_iso = 0;
 4700|   292k|#define ELEM_NAME_LEN  2
 4701|   292k|    char ChemElements[ELEM_NAME_LEN*NUM_CHEM_ELEMENTS + ELEM_NAME_LEN];
 4702|   292k|    char CurElement[ELEM_NAME_LEN + ELEM_NAME_LEN], *pCurElem;
 4703|   292k|    int  nNumChemElements = 0;
 4704|   292k|    int  nNumHydrogenAtoms = 0;
 4705|   292k|    int  nNumCarbonAtoms = 0;
 4706|       |    
 4707|   292k|    ChemElements[0] = '\0'; /* djb-rwth: initialisation prevents empty string comparison */
 4708|   292k|    memset( ChemElements, 0, sizeof( ChemElements ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4709|   292k|    memset( CurElement, 0, sizeof( CurElement ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4710|   292k|    nNumChemElements = 0;
 4711|       |
 4712|   292k|    if (num_at_tg > num_atoms && t_group_info)
  ------------------
  |  Branch (4712:9): [True: 3.46k, False: 289k]
  |  Branch (4712:34): [True: 3.46k, False: 0]
  ------------------
 4713|  3.46k|    {
 4714|  3.46k|        t_group = t_group_info->t_group;
 4715|  3.46k|        num_t_groups = t_group_info->num_t_groups;
 4716|  3.46k|        num_tautomer_iso = t_group_info->bIgnoreIsotopic ? 0 : T_NUM_ISOTOPIC;
  ------------------
  |  |   70|      0|#define           T_NUM_ISOTOPIC    NUM_H_ISOTOPES /* was 2, now 3 */
  |  |  ------------------
  |  |  |  |   25|  3.46k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  |  |  ------------------
  ------------------
  |  Branch (4716:28): [True: 3.46k, False: 0]
  ------------------
 4717|  3.46k|    }
 4718|       |
 4719|   292k|    if (!bTautGroupsOnly)
  ------------------
  |  Branch (4719:9): [True: 252k, False: 40.8k]
  ------------------
 4720|   252k|    {
 4721|       |
 4722|  1.30M|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (4722:21): [True: 1.04M, False: 252k]
  ------------------
 4723|  1.04M|        {
 4724|  1.04M|            if (!strcmp( at[i].elname, "C" ))
  ------------------
  |  Branch (4724:17): [True: 106k, False: 943k]
  ------------------
 4725|   106k|            {
 4726|   106k|                nNumCarbonAtoms++;
 4727|   106k|            }
 4728|   943k|            else if (!strcmp( at[i].elname, "H" ) ||
  ------------------
  |  Branch (4728:22): [True: 101k, False: 841k]
  ------------------
 4729|   841k|                 !strcmp( at[i].elname, "D" ) ||
  ------------------
  |  Branch (4729:18): [True: 0, False: 841k]
  ------------------
 4730|   841k|                 !strcmp( at[i].elname, "T" ))
  ------------------
  |  Branch (4730:18): [True: 0, False: 841k]
  ------------------
 4731|   101k|            {
 4732|   101k|                nNumHydrogenAtoms++;
 4733|   101k|            }
 4734|   841k|            else
 4735|   841k|            {
 4736|   841k|                CurElement[0] = at[i].elname[0];
 4737|   841k|                CurElement[1] = at[i].elname[1] ? at[i].elname[1] : ' ';
  ------------------
  |  Branch (4737:33): [True: 175k, False: 665k]
  ------------------
 4738|   841k|                if (!( pCurElem = strstr( ChemElements, CurElement ) )) /* djb-rwth: ignoring LLVM warning: variable used for function return value */
  ------------------
  |  Branch (4738:21): [True: 471k, False: 370k]
  ------------------
 4739|   471k|                {
 4740|   471k|                    strcat(ChemElements, CurElement);
 4741|   471k|                    nNumChemElements++;
 4742|   471k|                }
 4743|   841k|            }
 4744|  1.04M|        }
 4745|   252k|        if (nNumChemElements > 1)
  ------------------
  |  Branch (4745:13): [True: 84.9k, False: 167k]
  ------------------
 4746|  84.9k|        {
 4747|  84.9k|            qsort( ChemElements, nNumChemElements, ELEM_NAME_LEN, CompChemElemLex );
  ------------------
  |  | 4700|  84.9k|#define ELEM_NAME_LEN  2
  ------------------
 4748|  84.9k|        }
 4749|   252k|        if (nNumCarbonAtoms)
  ------------------
  |  Branch (4749:13): [True: 63.2k, False: 188k]
  ------------------
 4750|  63.2k|        {
 4751|  63.2k|            if (nNumChemElements)
  ------------------
  |  Branch (4751:17): [True: 55.1k, False: 8.13k]
  ------------------
 4752|  55.1k|            {
 4753|  55.1k|                memmove(ChemElements + ELEM_NAME_LEN, ChemElements, (long long)ELEM_NAME_LEN * (long long)nNumChemElements); /* djb-rwth: cast operators added */
  ------------------
  |  | 4700|  55.1k|#define ELEM_NAME_LEN  2
  ------------------
                              memmove(ChemElements + ELEM_NAME_LEN, ChemElements, (long long)ELEM_NAME_LEN * (long long)nNumChemElements); /* djb-rwth: cast operators added */
  ------------------
  |  | 4700|  55.1k|#define ELEM_NAME_LEN  2
  ------------------
 4754|  55.1k|            }
 4755|  63.2k|            ChemElements[0] = 'C';
 4756|  63.2k|            ChemElements[1] = ' ';
 4757|  63.2k|            nNumChemElements++;
 4758|  63.2k|        }
 4759|   252k|        if (nNumHydrogenAtoms)
  ------------------
  |  Branch (4759:13): [True: 79.9k, False: 172k]
  ------------------
 4760|  79.9k|        {
 4761|  79.9k|            ChemElements[ELEM_NAME_LEN*nNumChemElements] = 'H';
  ------------------
  |  | 4700|  79.9k|#define ELEM_NAME_LEN  2
  ------------------
 4762|  79.9k|            ChemElements[ELEM_NAME_LEN*nNumChemElements + 1] = ' ';
  ------------------
  |  | 4700|  79.9k|#define ELEM_NAME_LEN  2
  ------------------
 4763|  79.9k|            nNumChemElements++;
 4764|  79.9k|        }
 4765|       |
 4766|       |        /* general */
 4767|  1.30M|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (4767:21): [True: 1.04M, False: 252k]
  ------------------
 4768|  1.04M|        {
 4769|  1.04M|            memset( &pAtomInvariant[i], 0, sizeof( pAtomInvariant[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4770|  1.04M|            CurElement[0] = at[i].elname[0];
 4771|  1.04M|            CurElement[1] = at[i].elname[1] ? at[i].elname[1] : ' ';
  ------------------
  |  Branch (4771:29): [True: 175k, False: 873k]
  ------------------
 4772|  1.04M|            pCurElem = strstr( ChemElements, CurElement );
 4773|  1.04M|            if (pCurElem)
  ------------------
  |  Branch (4773:17): [True: 1.04M, False: 0]
  ------------------
 4774|  1.04M|            {
 4775|  1.04M|                j = (int) ( pCurElem - ChemElements ) / ELEM_NAME_LEN + 1;
  ------------------
  |  | 4700|  1.04M|#define ELEM_NAME_LEN  2
  ------------------
 4776|  1.04M|            }
 4777|      0|            else
 4778|      0|            {
 4779|      0|                j = nNumChemElements; /* must be D or T */
 4780|      0|            }
 4781|       |            /* at[i].hill_type = (U_CHAR) j; */
 4782|  1.04M|            pAtomInvariant[i].val[AT_INV_HILL_ORDER] = j;
 4783|       |
 4784|  1.04M|            pAtomInvariant[i].val[AT_INV_NUM_CONNECTIONS] = at[i].valence;
 4785|  1.04M|            if (bHydrogensInRanks)
  ------------------
  |  Branch (4785:17): [True: 0, False: 1.04M]
  ------------------
 4786|      0|            {
 4787|      0|                pAtomInvariant[i].val[AT_INV_NUM_H] = ( ( t_group && at[i].endpoint > 0 ) ? 0 : at[i].num_H );
  ------------------
  |  Branch (4787:59): [True: 0, False: 0]
  |  Branch (4787:70): [True: 0, False: 0]
  ------------------
 4788|      0|            }
 4789|  1.04M|            if (bHydrogensFixedInRanks)
  ------------------
  |  Branch (4789:17): [True: 0, False: 1.04M]
  ------------------
 4790|      0|            {
 4791|      0|                pAtomInvariant[i].val[AT_INV_NUM_H_FIX] = ( ( t_group && at[i].endpoint > 0 ) ? at[i].num_H : 0 );
  ------------------
  |  Branch (4791:63): [True: 0, False: 0]
  |  Branch (4791:74): [True: 0, False: 0]
  ------------------
 4792|      0|            }
 4793|  1.04M|            if (!bDigraph &&  t_group && ( i_t_group = (int) at[i].endpoint - 1 ) >= 0 && i_t_group < num_t_groups)
  ------------------
  |  Branch (4793:17): [True: 1.04M, False: 0]
  |  Branch (4793:31): [True: 0, False: 1.04M]
  |  Branch (4793:42): [True: 0, False: 0]
  |  Branch (4793:91): [True: 0, False: 0]
  ------------------
 4794|      0|            {
 4795|      0|                pAtomInvariant[i].val[AT_INV_NUM_TG_ENDPOINTS] = t_group[i_t_group].nNumEndpoints;
 4796|      0|                for (j = 0; j < T_NUM_NO_ISOTOPIC; j++)
  ------------------
  |  |   69|      0|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
  |  Branch (4796:29): [True: 0, False: 0]
  ------------------
 4797|      0|                {
 4798|      0|                    pAtomInvariant[i].val[AT_INV_TG_NUMBERS + j] = t_group[i_t_group].num[j];
 4799|      0|                }
 4800|      0|                for (j = 0; j < num_tautomer_iso; j++)
  ------------------
  |  Branch (4800:29): [True: 0, False: 0]
  ------------------
 4801|      0|                {
 4802|      0|                    pAtomInvariant[i].val[AT_INV_TAUT_ISO + j] = t_group[i_t_group].num[j + T_NUM_NO_ISOTOPIC];
  ------------------
  |  |   69|      0|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
 4803|      0|                }
 4804|      0|            }
 4805|  1.04M|            pAtomInvariant[i].iso_sort_key = bIgnoreIsotopic ? 0 : at[i].iso_sort_key;
  ------------------
  |  Branch (4805:46): [True: 1.04M, False: 0]
  ------------------
 4806|  1.04M|        }
 4807|   252k|    }
 4808|  40.8k|    else
 4809|  40.8k|    {
 4810|       |        /* fill tautomeric groups only */
 4811|  40.8k|        memset( pAtomInvariant, 0, num_at_tg * sizeof( pAtomInvariant[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4812|  40.8k|    }
 4813|       |
 4814|       |    /**************************************/
 4815|       |    /*          tautomeric groups         */
 4816|       |    /**************************************/
 4817|   296k|    for (i = num_atoms; i < num_at_tg; i++)
  ------------------
  |  Branch (4817:25): [True: 3.56k, False: 292k]
  ------------------
 4818|  3.56k|    {
 4819|       |
 4820|  3.56k|        k = i - num_atoms;
 4821|  3.56k|        memset( &pAtomInvariant[i], 0, sizeof( pAtomInvariant[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4822|  3.56k|        if (!t_group)
  ------------------
  |  Branch (4822:13): [True: 0, False: 3.56k]
  ------------------
 4823|      0|            continue;
 4824|       |        /* make sure ranks of t-groups are larger than that of any atom */
 4825|       |         /* greater than for any real atom */
 4826|  3.56k|        pAtomInvariant[i].val[AT_INV_HILL_ORDER] = bTautGroupsOnly ? num_at_tg : nNumChemElements + 1;
  ------------------
  |  Branch (4826:52): [True: 3.56k, False: 0]
  ------------------
 4827|       |        /* greater than for any real atom */
 4828|  3.56k|        pAtomInvariant[i].val[AT_INV_NUM_CONNECTIONS] = MAXVAL + 1;
  ------------------
  |  |   60|  3.56k|#define MAXVAL 50       /* maximum valence */ /* @nnuk : Changed from 20 -> 50 for testing purposes, to account for some structures with one atom having more than 20 bonds */
  ------------------
 4829|  3.56k|        if (k < num_t_groups)
  ------------------
  |  Branch (4829:13): [True: 3.56k, False: 0]
  ------------------
 4830|  3.56k|        {
 4831|  3.56k|            pAtomInvariant[i].val[AT_INV_NUM_TG_ENDPOINTS] = t_group[k].nNumEndpoints;
 4832|  10.7k|            for (j = 0; j < T_NUM_NO_ISOTOPIC; j++)
  ------------------
  |  |   69|  10.7k|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
  |  Branch (4832:25): [True: 7.13k, False: 3.56k]
  ------------------
 4833|  7.13k|            {
 4834|  7.13k|                pAtomInvariant[i].val[AT_INV_TAUT_ISO + j] = t_group[k].num[j];
 4835|  7.13k|            }
 4836|  3.56k|            for (j = 0; j < num_tautomer_iso; j++)
  ------------------
  |  Branch (4836:25): [True: 0, False: 3.56k]
  ------------------
 4837|      0|            {
 4838|      0|                pAtomInvariant[i].val[AT_INV_TAUT_ISO + j] = t_group[k].num[j + T_NUM_NO_ISOTOPIC];
  ------------------
  |  |   69|      0|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
 4839|      0|            }
 4840|  3.56k|        }
 4841|  3.56k|    }
 4842|   292k|}
CleanNumH:
 4847|  1.07M|{
 4848|  1.07M|    int i;
 4849|  1.07M|    if (NumH)
  ------------------
  |  Branch (4849:9): [True: 649k, False: 422k]
  ------------------
 4850|   649k|    {
 4851|  3.58M|        for (i = 0; i < len; i++)
  ------------------
  |  Branch (4851:21): [True: 2.93M, False: 649k]
  ------------------
 4852|  2.93M|        {
 4853|  2.93M|            if (NumH[i] == EMPTY_H_NUMBER)
  ------------------
  |  |   36|  2.93M|#define EMPTY_H_NUMBER (INCHI_CANON_INFINITY-1)
  |  |  ------------------
  |  |  |  |   31|  2.93M|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
  |  Branch (4853:17): [True: 2.25M, False: 685k]
  ------------------
 4854|  2.25M|            {
 4855|  2.25M|                NumH[i] = 0;
 4856|  2.25M|            }
 4857|   685k|            else
 4858|   685k|            {
 4859|   685k|                NumH[i] -= BASE_H_NUMBER;
  ------------------
  |  |   37|   685k|#define BASE_H_NUMBER  ((INCHI_CANON_INFINITY-1)/2)
  |  |  ------------------
  |  |  |  |   31|   685k|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
 4860|   685k|            }
 4861|  2.93M|        }
 4862|   649k|    }
 4863|  1.07M|}
CleanCt:
 4868|   288k|{
 4869|   288k|    if (Ct && Ct[len] == EMPTY_CT)
  ------------------
  |  |   35|   288k|#define EMPTY_CT       0
  ------------------
  |  Branch (4869:9): [True: 288k, False: 0]
  |  Branch (4869:15): [True: 288k, False: 0]
  ------------------
 4870|   288k|    {
 4871|   288k|        Ct[len] = 0;
 4872|   288k|        return 1;
 4873|   288k|    }
 4874|       |
 4875|      0|    return 0;
 4876|   288k|}
CleanIsoSortKeys:
 4881|  4.24k|{
 4882|  4.24k|    int i;
 4883|  4.24k|    if (isk)
  ------------------
  |  Branch (4883:9): [True: 4.12k, False: 122]
  ------------------
 4884|  4.12k|    {
 4885|  28.0k|        for (i = 0; i < len; i++)
  ------------------
  |  Branch (4885:21): [True: 23.9k, False: 4.12k]
  ------------------
 4886|  23.9k|        {
 4887|  23.9k|            if (isk[i] == EMPTY_ISO_SORT_KEY)
  ------------------
  |  |   38|  23.9k|#define EMPTY_ISO_SORT_KEY LONG_MAX
  ------------------
  |  Branch (4887:17): [True: 19.0k, False: 4.82k]
  ------------------
 4888|  19.0k|            {
 4889|  19.0k|                isk[i] = 0;
 4890|  19.0k|            }
 4891|  23.9k|        }
 4892|  4.12k|    }
 4893|  4.24k|}
DeAllocBCN:
 4926|   252k|{
 4927|   252k|    int    i, k;
 4928|   252k|    FTCN  *ftcn;
 4929|   252k|    if (!pBCN)
  ------------------
  |  Branch (4929:9): [True: 0, False: 252k]
  ------------------
 4930|      0|    {
 4931|      0|        return;
 4932|      0|    }
 4933|   252k|    if (pBCN->pRankStack)
  ------------------
  |  Branch (4933:9): [True: 252k, False: 38]
  ------------------
 4934|   252k|    {
 4935|  3.01M|        for (i = 0; i < pBCN->nMaxLenRankStack; i++)
  ------------------
  |  Branch (4935:21): [True: 2.76M, False: 252k]
  ------------------
 4936|  2.76M|        {
 4937|  2.76M|            FREE_ARRAY( pBCN->pRankStack[i] )
  ------------------
  |  | 4921|  2.76M|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|   871k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 871k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 871k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4921:28): [True: 871k, False: 1.88M]
  |  |  ------------------
  ------------------
 4938|  2.76M|        }
 4939|   252k|        FREE_ARRAY( pBCN->pRankStack )
  ------------------
  |  | 4921|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|   252k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 252k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 252k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4921:28): [True: 252k, False: 0]
  |  |  ------------------
  ------------------
 4940|   252k|    }
 4941|   756k|    for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  573|   756k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (4941:17): [True: 504k, False: 252k]
  ------------------
 4942|   504k|    {
 4943|   504k|        ftcn = pBCN->ftcn + k;
 4944|   504k|        FreeNeighList( ftcn->NeighList );
 4945|       |
 4946|   504k|        FREE_ARRAY( ftcn->LinearCt )
  ------------------
  |  | 4921|   504k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|   288k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 288k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 288k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4921:28): [True: 288k, False: 215k]
  |  |  ------------------
  ------------------
 4947|       |
 4948|   504k|        PartitionFree( &ftcn->PartitionCt );
 4949|       |
 4950|   504k|        FREE_ARRAY( ftcn->nSymmRankCt )
  ------------------
  |  | 4921|   504k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|   288k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 288k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 288k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4921:28): [True: 288k, False: 215k]
  |  |  ------------------
  ------------------
 4951|   504k|        FREE_ARRAY( ftcn->nNumHOrig )
  ------------------
  |  | 4921|   504k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|   288k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 288k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 288k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4921:28): [True: 288k, False: 215k]
  |  |  ------------------
  ------------------
 4952|   504k|        FREE_ARRAY( ftcn->nNumH )
  ------------------
  |  | 4921|   504k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|   288k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 288k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 288k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4921:28): [True: 288k, False: 215k]
  |  |  ------------------
  ------------------
 4953|   504k|        FREE_ARRAY( ftcn->nNumHOrigFixH )
  ------------------
  |  | 4921|   504k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|  36.3k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 36.3k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 36.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4921:28): [True: 36.3k, False: 467k]
  |  |  ------------------
  ------------------
 4954|   504k|        FREE_ARRAY( ftcn->nNumHFixH )
  ------------------
  |  | 4921|   504k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|  36.3k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 36.3k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 36.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4921:28): [True: 36.3k, False: 467k]
  |  |  ------------------
  ------------------
 4955|       |
 4956|   504k|        PartitionFree( &ftcn->PartitionCtIso );
 4957|       |
 4958|   504k|        FREE_ARRAY( ftcn->nSymmRankCtIso )
  ------------------
  |  | 4921|   504k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|  2.12k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 2.12k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 2.12k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4921:28): [True: 2.12k, False: 502k]
  |  |  ------------------
  ------------------
 4959|   504k|        FREE_ARRAY( ftcn->iso_sort_keys )
  ------------------
  |  | 4921|   504k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|  2.06k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 2.06k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 2.06k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4921:28): [True: 2.06k, False: 502k]
  |  |  ------------------
  ------------------
 4960|   504k|        FREE_ARRAY( ftcn->iso_sort_keysOrig )
  ------------------
  |  | 4921|   504k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|  2.06k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 2.06k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 2.06k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4921:28): [True: 2.06k, False: 502k]
  |  |  ------------------
  ------------------
 4961|   504k|        FREE_ARRAY( ftcn->iso_exchg_atnos )
  ------------------
  |  | 4921|   504k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|    157|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 157, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 157]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4921:28): [True: 157, False: 504k]
  |  |  ------------------
  ------------------
 4962|   504k|        FREE_ARRAY( ftcn->iso_exchg_atnosOrig )
  ------------------
  |  | 4921|   504k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|    157|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 157, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 157]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4921:28): [True: 157, False: 504k]
  |  |  ------------------
  ------------------
 4963|   504k|    }
 4964|   252k|}
GetBaseCanonRanking:
 5081|   252k|{
 5082|   252k|    int ret = 0;
 5083|   252k|    int iBase;                   /* base structure index, always valid; = TAUT_YES except special fully non-taut mode */
 5084|   252k|    int iOther;                  /* other than basic structure index, usually non-taut; may be = iBase */
 5085|   252k|    int bReqNonTaut;             /* 1 => requested non-tautomeric results */
 5086|   252k|    int bReqTaut;                /* 1 => requested tautomeric results and the base structure is tautomeric */
 5087|   252k|    int bChanged;
 5088|       |
 5089|   252k|    sp_ATOM *at_base = NULL;
 5090|   252k|    sp_ATOM *at_other = NULL;
 5091|       |
 5092|   252k|    int bTautIgnoreIsotopic = 0;
 5093|       |    /*int bIgnoreIsotopic     = 0;*/
 5094|   252k|    int nNumCurrRanks = 0;
 5095|   252k|    int nMaxLenRankStack = 0;
 5096|   252k|    int num_max = num_at_tg;
 5097|   252k|    long lCount;
 5098|       |
 5099|       |    /* local allocations */
 5100|   252k|    ATOM_INVARIANT2 *pAtomInvariant = NULL;
 5101|   252k|    NEIGH_LIST     *NeighList[TAUT_NUM];
 5102|   252k|    ConTable *Ct_Temp = NULL;
 5103|       |
 5104|       |    /* initial partition for canonicalization */
 5105|   252k|    AT_RANK *nRank = NULL;
 5106|   252k|    AT_NUMB *nAtomNumber = NULL;
 5107|       |
 5108|       |    /* canonicalization output */
 5109|       |
 5110|   252k|    ConTable *Ct_NoH = NULL;
 5111|   252k|    AT_RANK *nCanonRankNoH = NULL;
 5112|   252k|    AT_NUMB *nAtomNumberCanonNoH = NULL;
 5113|   252k|    AT_RANK *nSymmRankNoH = NULL;
 5114|       |
 5115|   252k|    ConTable *Ct_NoTautH = NULL;
 5116|   252k|    AT_RANK *nSymmRankNoTautH = NULL;
 5117|   252k|    AT_RANK *nCanonRankNoTautH = NULL;
 5118|   252k|    AT_NUMB *nAtomNumberCanonNoTautH = NULL;
 5119|   252k|    NUM_H   *numHNoTautH = NULL;
 5120|   252k|    int      lenNumHNoTautH;
 5121|   252k|    int      maxlenNumHNoTautH;
 5122|       |
 5123|   252k|    ConTable *Ct_Base = NULL;
 5124|   252k|    AT_RANK *nSymmRankBase = NULL;
 5125|   252k|    AT_RANK *nCanonRankBase = NULL;
 5126|   252k|    AT_NUMB *nAtomNumberCanonBase = NULL;
 5127|   252k|    NUM_H   *numH = NULL;
 5128|   252k|    int      lenNumH = num_atoms;
 5129|   252k|    int      maxlenNumH = 0;
 5130|       |
 5131|   252k|#if ( USE_AUX_RANKING == 1 )
 5132|   252k|    AT_RANK *nRankAux = NULL;
 5133|   252k|    AT_NUMB *nAtomNumberAux = NULL;
 5134|   252k|    ATOM_INVARIANT2 *pAtomInvariantAux = NULL;
 5135|   252k|#endif
 5136|       |
 5137|   252k|    ConTable *Ct_FixH = NULL;
 5138|   252k|    AT_RANK *nSymmRankFixH = NULL;
 5139|   252k|    AT_RANK *nCanonRankFixH = NULL;
 5140|   252k|    AT_NUMB *nAtomNumberCanonFixH = NULL;
 5141|   252k|    NUM_H   *NumHfixed = NULL;
 5142|   252k|    int      maxlenNumHfixed;
 5143|       |
 5144|       |    /* isotopic canonicalization */
 5145|       |
 5146|   252k|    ConTable *Ct_NoTautHIso = NULL;
 5147|   252k|    AT_RANK *nSymmRankNoTautHIso = NULL;
 5148|   252k|    AT_RANK *nCanonRankNoTautHIso = NULL;
 5149|   252k|    AT_NUMB *nAtomNumberCanonNoTautHIso = NULL;
 5150|   252k|    AT_ISO_SORT_KEY *iso_sort_key_NoTautH = NULL;
 5151|   252k|    int              maxlen_iso_sort_key_NoTautH = 0;
 5152|   252k|    int              len_iso_sort_key_NoTautH = 0;
 5153|   252k|    int num_iso_NoTautH = 0, num_iso_NoAuxBase;
 5154|       |
 5155|   252k|    ConTable *Ct_BaseIso = NULL;
 5156|   252k|    AT_RANK *nSymmRankBaseIso = NULL;
 5157|   252k|    AT_RANK *nCanonRankBaseIso = NULL;
 5158|   252k|    AT_NUMB *nAtomNumberCanonBaseIso = NULL;
 5159|       |
 5160|   252k|    AT_ISO_SORT_KEY *iso_sort_keyBase = NULL;
 5161|   252k|    int              maxlen_iso_sort_keyBase = 0;
 5162|   252k|    int              len_iso_sort_keyBase = 0;
 5163|       |
 5164|   252k|    int              bUseIsoAuxBase[TAUT_NUM];
 5165|   252k|    S_CHAR          *iso_exchg_atnos = NULL;
 5166|   252k|    int              len_iso_exchg_atnos = 0;
 5167|   252k|    int              maxlen_iso_exchg_atnos = 0;
 5168|   252k|    int num_iso_Base = 0;
 5169|       |
 5170|   252k|    AT_ISO_SORT_KEY  iso_sort_key;
 5171|       |
 5172|   252k|    ConTable *Ct_FixHIso = NULL;
 5173|   252k|    AT_RANK *nSymmRankFixHIso = NULL;
 5174|   252k|    AT_RANK *nCanonRankFixHIso = NULL;
 5175|   252k|    AT_NUMB *nAtomNumberCanonFixHIso = NULL;
 5176|       |
 5177|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5178|       |    AT_ISO_SORT_KEY  iso_sort_key2;
 5179|       |    AT_ISO_SORT_KEY *iso_sort_key_Hfixed = NULL;
 5180|       |    int              maxlen_iso_sort_key_Hfixed;
 5181|       |    int              len_iso_sort_key_Hfixed;
 5182|       |    int num_iso_Hfixed;
 5183|       |#endif
 5184|       |
 5185|   252k|    AT_RANK *nTempRank = NULL;
 5186|       |
 5187|   252k|    CANON_DATA    pCD[3]; /* = &CanonData; */
 5188|   252k|    CANON_COUNTS  CanonCounts;
 5189|   252k|    CANON_COUNTS *pCC = &CanonCounts;
 5190|       |
 5191|   252k|    int i, j, k, m;
 5192|   252k|    int nCanonFlags[2];
 5193|       |
 5194|       |    /* */
 5195|   252k|    int iflag;
 5196|       |
 5197|   252k|    memset( pCD, 0, sizeof( pCD ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5198|   252k|    memset( pCC, 0, sizeof( pCC[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5199|   252k|    memset( bUseIsoAuxBase, 0, sizeof( bUseIsoAuxBase ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5200|   252k|    memset( nCanonFlags, 0, sizeof( nCanonFlags ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5201|   252k|    NeighList[TAUT_NON] = NULL;
  ------------------
  |  |  574|   252k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5202|   252k|    NeighList[TAUT_YES] = NULL;
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5203|       |
 5204|       |    /* select base structure, find whether it is tautomeric or not */
 5205|       |    /* djb-rwth: addressing LLVM warning */
 5206|   252k|    if (at[TAUT_YES] && s[TAUT_YES].nLenCT &&
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  if (at[TAUT_YES] && s[TAUT_YES].nLenCT &&
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5206:9): [True: 252k, False: 0]
  |  Branch (5206:25): [True: 252k, False: 0]
  ------------------
 5207|   252k|         t_group_info && ( s[TAUT_YES].nLenLinearCTTautomer > 0 && /* ordinary tautomerism */
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5207:10): [True: 252k, False: 0]
  |  Branch (5207:28): [True: 40.8k, False: 211k]
  ------------------
 5208|  40.8k|             ((t_group_info->t_group && t_group_info->num_t_groups > 0) ||
  ------------------
  |  Branch (5208:16): [True: 40.8k, False: 0]
  |  Branch (5208:41): [True: 3.46k, False: 37.4k]
  ------------------
 5209|       |             /* protons have been moved */
 5210|  37.4k|             ( t_group_info->tni.bNormalizationFlags & FLAG_NORM_CONSIDER_TAUT ) ||
  ------------------
  |  |  156|  37.4k|#define FLAG_NORM_CONSIDER_TAUT      ( FLAG_PROTON_NPO_SIMPLE_REMOVED | \
  |  |  ------------------
  |  |  |  |  146|  37.4k|#define FLAG_PROTON_NPO_SIMPLE_REMOVED 0x0001
  |  |  ------------------
  |  |  157|  37.4k|                                       FLAG_PROTON_NP_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  147|  37.4k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  158|  37.4k|                                       FLAG_PROTON_AC_SIMPLE_ADDED    | \
  |  |  ------------------
  |  |  |  |  148|  37.4k|#define FLAG_PROTON_AC_SIMPLE_ADDED    0x0004
  |  |  ------------------
  |  |  159|  37.4k|                                       FLAG_PROTON_AC_SIMPLE_REMOVED  | \
  |  |  ------------------
  |  |  |  |  149|  37.4k|#define FLAG_PROTON_AC_SIMPLE_REMOVED  0x0008
  |  |  ------------------
  |  |  160|  37.4k|                                       FLAG_PROTON_AC_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  150|  37.4k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  161|  37.4k|                                       FLAG_PROTON_AC_HARD_ADDED      | \
  |  |  ------------------
  |  |  |  |  151|  37.4k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  |  |  162|  37.4k|                                       FLAG_PROTON_SINGLE_REMOVED     | \
  |  |  ------------------
  |  |  |  |  153|  37.4k|#define FLAG_PROTON_SINGLE_REMOVED     0x0080
  |  |  ------------------
  |  |  163|  37.4k|                                       FLAG_PROTON_CHARGE_CANCEL    )
  |  |  ------------------
  |  |  |  |  152|  37.4k|#define FLAG_PROTON_CHARGE_CANCEL      0x0040
  |  |  ------------------
  ------------------
  |  Branch (5210:14): [True: 37.2k, False: 122]
  ------------------
 5211|       |             /* tautomerism due to possible isotopic proton exchange */
 5212|    122|             (t_group_info->nNumIsotopicEndpoints > 1 &&
  ------------------
  |  Branch (5212:15): [True: 122, False: 0]
  ------------------
 5213|    122|             ( t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE ) ))) ))
  ------------------
  |  |  981|    122|#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 ) ))) ))
  ------------------
  |  |  982|    122|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  |  Branch (5213:14): [True: 122, False: 0]
  ------------------
 5214|  40.8k|    {
 5215|       |        /* tautomeric: (1) has tautomeric atoms OR
 5216|       |                       (2) H-atoms have been rearranged due to proton addition/removal OR
 5217|       |                       (3) Found isotopic H-atoms on tautomeric or hetero atoms
 5218|       |         */
 5219|  40.8k|        iBase = TAUT_YES;
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5220|  40.8k|        bReqTaut = 1;
 5221|  40.8k|        bUseIsoAuxBase[iBase] = ( s[iBase].nLenIsotopicEndpoints > 1 ) &&
  ------------------
  |  Branch (5221:33): [True: 157, False: 40.7k]
  ------------------
 5222|    157|            ( t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE ) );
  ------------------
  |  |  981|    157|#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 ) );
  ------------------
  |  |  982|    157|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  |  Branch (5222:13): [True: 157, False: 0]
  ------------------
 5223|  40.8k|        if (at[TAUT_NON] && s[TAUT_NON].nLenCT)
  ------------------
  |  |  574|  40.8k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      if (at[TAUT_NON] && s[TAUT_NON].nLenCT)
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5223:13): [True: 36.3k, False: 4.50k]
  |  Branch (5223:29): [True: 36.3k, False: 0]
  ------------------
 5224|  36.3k|        {
 5225|  36.3k|            iOther = TAUT_NON; /* tautomeric and non-tautomeric */
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5226|  36.3k|            bReqNonTaut = 1;
 5227|  36.3k|        }
 5228|  4.50k|        else
 5229|  4.50k|        {
 5230|  4.50k|            iOther = iBase; /* tautomeric only */
 5231|  4.50k|            bReqNonTaut = 0;
 5232|  4.50k|        }
 5233|  40.8k|    }
 5234|       |
 5235|   211k|    else if (at[TAUT_NON] && s[TAUT_NON].nLenCT)
  ------------------
  |  |  574|   211k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  else if (at[TAUT_NON] && s[TAUT_NON].nLenCT)
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5235:14): [True: 0, False: 211k]
  |  Branch (5235:30): [True: 0, False: 0]
  ------------------
 5236|      0|    {
 5237|       |        /* force pure non-tautomeric processing; happens for testing only */
 5238|      0|        iBase = TAUT_NON;
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5239|      0|        bReqTaut = 0;
 5240|      0|        iOther = iBase;
 5241|      0|        bReqNonTaut = 1;
 5242|      0|        num_at_tg = num_atoms;
 5243|      0|    }
 5244|       |
 5245|   211k|    else if (at[TAUT_YES] && s[TAUT_YES].nLenCT)
  ------------------
  |  |  575|   211k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  else if (at[TAUT_YES] && s[TAUT_YES].nLenCT)
  ------------------
  |  |  575|   211k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5245:14): [True: 211k, False: 0]
  |  Branch (5245:30): [True: 211k, False: 0]
  ------------------
 5246|   211k|    {
 5247|       |        /* although the user requested tautomeric processing, tautomerism has not been found */
 5248|       |        /* however, the results should be saved in the TAUT_YES elements of the arrays */
 5249|   211k|        iBase = TAUT_YES;
  ------------------
  |  |  575|   211k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5250|   211k|        bReqTaut = 0;
 5251|   211k|        bUseIsoAuxBase[iBase] = ( s[iBase].nLenIsotopicEndpoints > 1 );
 5252|   211k|        iOther = iBase;
 5253|   211k|        bReqNonTaut = 1;
 5254|   211k|        num_at_tg = num_atoms;
 5255|   211k|    }
 5256|      0|    else
 5257|      0|    {
 5258|      0|        ret = CT_UNKNOWN_ERR;
  ------------------
  |  |   38|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 5259|      0|        goto exit_error;
 5260|      0|    }
 5261|       |
 5262|       |
 5263|   252k|    if (bReqTaut)
  ------------------
  |  Branch (5263:9): [True: 40.8k, False: 211k]
  ------------------
 5264|  40.8k|    {
 5265|       |        /* save "process isotopic" mark; temporarily set it to NO */
 5266|  40.8k|        bTautIgnoreIsotopic = t_group_info->bIgnoreIsotopic;
 5267|  40.8k|        t_group_info->bIgnoreIsotopic = 1;
 5268|  40.8k|    }
 5269|       |
 5270|       |    /* djb-rwth: removing redundant code */
 5271|       |
 5272|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5273|       |    num_iso_Hfixed =
 5274|       |        len_iso_sort_key_Hfixed =
 5275|       |        maxlen_iso_sort_key_Hfixed = 0;
 5276|       |#endif
 5277|       |
 5278|       |    /* prepare initial data */
 5279|   252k|    at_base = at[iBase];
 5280|   252k|    at_other = at[iOther];
 5281|   252k|    pAtomInvariant = (ATOM_INVARIANT2 *) inchi_calloc( num_max, sizeof( pAtomInvariant[0] ) );
  ------------------
  |  | 1146|   252k|#define inchi_calloc   calloc
  ------------------
 5282|   252k|    nSymmRankNoH = (AT_RANK *) inchi_calloc( num_max, sizeof( nSymmRankNoH[0] ) );
  ------------------
  |  | 1146|   252k|#define inchi_calloc   calloc
  ------------------
 5283|   252k|    nCanonRankNoH = (AT_RANK *) inchi_calloc( num_max, sizeof( nCanonRankNoH[0] ) );
  ------------------
  |  | 1146|   252k|#define inchi_calloc   calloc
  ------------------
 5284|   252k|    nAtomNumberCanonNoH = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumberCanonNoH[0] ) );
  ------------------
  |  | 1146|   252k|#define inchi_calloc   calloc
  ------------------
 5285|   252k|    nRank = (AT_RANK *) inchi_calloc( num_max, sizeof( nRank[0] ) );
  ------------------
  |  | 1146|   252k|#define inchi_calloc   calloc
  ------------------
 5286|   252k|    nAtomNumber = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumber[0] ) );
  ------------------
  |  | 1146|   252k|#define inchi_calloc   calloc
  ------------------
 5287|   252k|    nTempRank = (AT_RANK *) inchi_calloc( num_max, sizeof( nTempRank[0] ) );
  ------------------
  |  | 1146|   252k|#define inchi_calloc   calloc
  ------------------
 5288|       |
 5289|   252k|    if (!pAtomInvariant ||
  ------------------
  |  Branch (5289:9): [True: 0, False: 252k]
  ------------------
 5290|   252k|         !nSymmRankNoH || !nCanonRankNoH || !nAtomNumberCanonNoH ||
  ------------------
  |  Branch (5290:10): [True: 0, False: 252k]
  |  Branch (5290:27): [True: 0, False: 252k]
  |  Branch (5290:45): [True: 0, False: 252k]
  ------------------
 5291|   252k|         !nRank || !nAtomNumber || !nTempRank)
  ------------------
  |  Branch (5291:10): [True: 0, False: 252k]
  |  Branch (5291:20): [True: 0, False: 252k]
  |  Branch (5291:36): [True: 0, False: 252k]
  ------------------
 5292|      0|    {
 5293|      0|        goto exit_error_alloc;
 5294|      0|    }
 5295|       |
 5296|   252k|#if ( USE_AUX_RANKING == 1 )
 5297|   252k|    nRankAux = (AT_RANK *) inchi_calloc( num_max, sizeof( nRankAux[0] ) );
  ------------------
  |  | 1146|   252k|#define inchi_calloc   calloc
  ------------------
 5298|   252k|    nAtomNumberAux = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumberAux[0] ) );
  ------------------
  |  | 1146|   252k|#define inchi_calloc   calloc
  ------------------
 5299|   252k|    pAtomInvariantAux = (ATOM_INVARIANT2 *) inchi_malloc( num_max * sizeof( pAtomInvariantAux[0] ) );
  ------------------
  |  | 1143|   252k|#define inchi_malloc   malloc
  ------------------
 5300|   252k|    if (!nRankAux || !nAtomNumberAux || !pAtomInvariantAux)
  ------------------
  |  Branch (5300:9): [True: 0, False: 252k]
  |  Branch (5300:22): [True: 0, False: 252k]
  |  Branch (5300:41): [True: 0, False: 252k]
  ------------------
 5301|      0|    {
 5302|      0|        goto exit_error_alloc;
 5303|      0|    }
 5304|   252k|#endif
 5305|       |
 5306|   252k|    if (bReqTaut)
  ------------------
  |  Branch (5306:9): [True: 40.8k, False: 211k]
  ------------------
 5307|  40.8k|    {
 5308|  40.8k|        if (!( NeighList[TAUT_YES] =
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5308:13): [True: 0, False: 40.8k]
  ------------------
 5309|  40.8k|               CreateNeighList( num_atoms, num_at_tg, at_base, 0, t_group_info ) ))
 5310|      0|        {
 5311|      0|            goto exit_error_alloc;
 5312|      0|        }
 5313|       |        /* needed for the hydrogenless structure */
 5314|  40.8k|        if (!( NeighList[TAUT_NON] =
  ------------------
  |  |  574|  40.8k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5314:13): [True: 0, False: 40.8k]
  ------------------
 5315|  40.8k|               CreateNeighList( num_atoms, num_atoms, at_base, 0, NULL ) ))
 5316|      0|        {
 5317|      0|            goto exit_error_alloc;
 5318|      0|        }
 5319|  40.8k|    }
 5320|   211k|    else
 5321|   211k|    {
 5322|   211k|        if (!( NeighList[TAUT_NON] =
  ------------------
  |  |  574|   211k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5322:13): [True: 0, False: 211k]
  ------------------
 5323|   211k|               CreateNeighList( num_atoms, num_atoms, at_base, 0, NULL ) ))
 5324|      0|        {
 5325|      0|            goto exit_error_alloc;
 5326|      0|        }
 5327|   211k|        NeighList[TAUT_YES] = NULL;
  ------------------
  |  |  575|   211k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5328|       |
 5329|   211k|        INCHI_HEAPCHK
 5330|   211k|    }
 5331|       |
 5332|       |
 5333|       |    /* avoid memory leaks in case of error */
 5334|       |    /*
 5335|       |    pBCN->ftcn[TAUT_NON].NeighList          = NeighList[TAUT_NON];
 5336|       |    pBCN->ftcn[TAUT_YES].NeighList          = NeighList[TAUT_YES];
 5337|       |    */
 5338|   252k|    pBCN->nMaxLenRankStack = 0;
 5339|   252k|    pBCN->num_max = num_max;        /* allocated nRank[] arrays lengths in pRankStack */
 5340|   252k|    pBCN->num_at_tg = num_at_tg;  /* all of the following arrays have this length */
 5341|   252k|    pBCN->num_atoms = num_atoms;
 5342|   252k|    pBCN->ulTimeOutTime = ulTimeOutTime;
 5343|       |
 5344|       |    /* initial partitioning of a hydrogenless skeleton: fill out the inveriant */
 5345|   252k|    FillOutAtomInvariant2( at_base,
 5346|   252k|                           num_atoms,
 5347|   252k|                           num_atoms,
 5348|   252k|                           pAtomInvariant,
 5349|   252k|                           1 /*bIgnoreIsotopic*/,
 5350|   252k|                           0 /*bHydrogensInRanks*/,
 5351|   252k|                           0 /*bHydrogensFixedInRanks*/,
 5352|   252k|                           0 /*bTaut=bDigraph*/,
 5353|   252k|                           0 /* bTautGroupsOnly */,
 5354|   252k|                           NULL /*t_group_info*/ );
 5355|       |
 5356|       |    /* initial partitioning of a hydrogenless skeleton: create equitable partition (assign initial ranks) */
 5357|   252k|    nNumCurrRanks = SetInitialRanks2( num_atoms, pAtomInvariant, nRank, nAtomNumber, pCG );
 5358|       |
 5359|   252k|    lCount = 0;
 5360|       |
 5361|       |    /* make equitable partition in pBCN->pRankStack[0,1] */
 5362|   252k|    nNumCurrRanks = DifferentiateRanks2( pCG,
 5363|   252k|                                         num_atoms,
 5364|   252k|                                         NeighList[TAUT_NON],
  ------------------
  |  |  574|   252k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5365|   252k|                                         nNumCurrRanks, nRank,
 5366|   252k|                                         nTempRank,
 5367|   252k|                                         nAtomNumber,
 5368|   252k|                                         &lCount,
 5369|   252k|                                         0 /* 0 means use qsort */ );
 5370|       |
 5371|       |    /* allocate partition stack */
 5372|   252k|    nMaxLenRankStack = 2 * ( num_at_tg - nNumCurrRanks ) + 8;  /* was 2*(...) + 6 */
 5373|   252k|    pBCN->pRankStack = (AT_RANK **) inchi_calloc( nMaxLenRankStack, sizeof( pBCN->pRankStack[0] ) );
  ------------------
  |  | 1146|   252k|#define inchi_calloc   calloc
  ------------------
 5374|   252k|    if (!pBCN->pRankStack)
  ------------------
  |  Branch (5374:9): [True: 0, False: 252k]
  ------------------
 5375|      0|    {
 5376|      0|        pBCN->nMaxLenRankStack = 0; /* avoid memory leaks in case of error */
 5377|      0|        goto exit_error_alloc;
 5378|      0|    }
 5379|   252k|    pBCN->nMaxLenRankStack = nMaxLenRankStack; /* avoid memory leaks in case of error */
 5380|       |    /* init partition stack */
 5381|   252k|    pBCN->pRankStack[0] = nRank;
 5382|   252k|    pBCN->pRankStack[1] = nAtomNumber;
 5383|       |
 5384|       |    /********************************************************************************************/
 5385|       |    /* get NoH/no taut groups  canonical numbering, connection table, and equivalence partition */
 5386|       |    /********************************************************************************************/
 5387|       |
 5388|       |    /* pointers */
 5389|   252k|    pCD[iOther].LinearCT = NULL;
 5390|   252k|    pCD[iOther].NumH = NULL;
 5391|   252k|    pCD[iOther].NumHfixed = NULL;
 5392|   252k|    pCD[iOther].iso_sort_key = NULL;
 5393|   252k|    pCD[iOther].iso_exchg_atnos = NULL;
 5394|       |
 5395|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5396|       |    pCD[iOther].iso_sort_key_Hfixed = NULL;
 5397|       |#endif
 5398|       |
 5399|       |    /* variables - unchanged */
 5400|   252k|    pCD[iOther].ulTimeOutTime = pBCN->ulTimeOutTime;
 5401|   252k|    pCD[iOther].nMaxLenLinearCT = s[iOther].nLenCTAtOnly + 1;
 5402|       |    /* return values & input/output */
 5403|   252k|    pCD[iOther].nLenLinearCT = s[iOther].nLenCTAtOnly;
 5404|   252k|    pCD[iOther].nLenCTAtOnly = s[iOther].nLenCTAtOnly;
 5405|   252k|    pCD[iOther].lenNumH = 0;
 5406|   252k|    pCD[iOther].lenNumHfixed = 0;
 5407|   252k|    pCD[iOther].len_iso_sort_key = 0;
 5408|   252k|    pCD[iOther].maxlen_iso_sort_key = 0;
 5409|   252k|    pCD[iOther].len_iso_exchg_atnos = 0;
 5410|   252k|    pCD[iOther].maxlen_iso_exchg_atnos = 0;
 5411|       |
 5412|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5413|       |    pCD[iOther].len_iso_sort_key_Hfixed = 0;
 5414|       |    pCD[iOther].maxlen_iso_sort_key_Hfixed = 0;
 5415|       |#endif
 5416|       |
 5417|   252k|    ret = CanonGraph01( ic, pCG, num_atoms, num_atoms, num_max, 0,
  ------------------
  |  |  598|   252k|#define CanonGraph01 CanonGraph
  ------------------
 5418|   252k|                        NeighList[TAUT_NON], (Partition *) pBCN->pRankStack,
  ------------------
  |  |  574|   252k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5419|   252k|                        nSymmRankNoH, nCanonRankNoH, nAtomNumberCanonNoH,
 5420|   252k|                        pCD + iOther, pCC, NULL, &Ct_NoH, LargeMolecules );
 5421|       |
 5422|   252k|    if (ret < 0)
  ------------------
  |  Branch (5422:9): [True: 0, False: 252k]
  ------------------
 5423|      0|    {
 5424|      0|        goto exit_error;
 5425|      0|    }
 5426|       |
 5427|       |    /* update initial partitioning */
 5428|   252k|    nNumCurrRanks = FixCanonEquivalenceInfo( pCG, num_atoms, nSymmRankNoH, nRank, nTempRank, nAtomNumber, &bChanged ); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 5429|       |
 5430|       |    /* repartition if necessary */
 5431|   252k|    if (bChanged & 3)
  ------------------
  |  Branch (5431:9): [True: 7, False: 252k]
  ------------------
 5432|      7|    {
 5433|      7|        if (Ct_NoH)
  ------------------
  |  Branch (5433:13): [True: 7, False: 0]
  ------------------
 5434|      7|        {
 5435|      7|            CTableFree( Ct_NoH );
 5436|      7|            inchi_free( Ct_NoH );
  ------------------
  |  | 1152|      7|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 7, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 7]
  |  |  ------------------
  ------------------
 5437|      7|            Ct_NoH = NULL;
 5438|      7|        }
 5439|      7|        pCD[iOther].nCanonFlags |= CANON_FLAG_NO_H_RECANON;
  ------------------
  |  |  206|      7|#define CANON_FLAG_NO_H_RECANON           0x0001  /* iOther: second canonicalization of the no H structure */
  ------------------
 5440|       |
 5441|      7|        ret = CanonGraph02( ic, pCG, num_atoms, num_atoms, num_max, 0,
  ------------------
  |  |  599|      7|#define CanonGraph02 CanonGraph
  ------------------
 5442|      7|                            NeighList[TAUT_NON], (Partition *) pBCN->pRankStack,
  ------------------
  |  |  574|      7|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5443|      7|                            nSymmRankNoH, nCanonRankNoH, nAtomNumberCanonNoH,
 5444|      7|                            pCD + iOther, pCC, NULL, &Ct_NoH, LargeMolecules );
 5445|       |
 5446|      7|        if (ret < 0)
  ------------------
  |  Branch (5446:13): [True: 0, False: 7]
  ------------------
 5447|      0|        {
 5448|      0|            goto exit_error;
 5449|      0|        }
 5450|      7|    }
 5451|       |
 5452|       |
 5453|       |    /********************************************************************************/
 5454|       |    /* get NoTautH canonical numbering, connection table, and equivalence partition */
 5455|       |    /********************************************************************************/
 5456|   252k|    maxlenNumHNoTautH = num_atoms + 1;
 5457|   252k|    nSymmRankNoTautH = (AT_RANK *) inchi_calloc( num_max, sizeof( nSymmRankNoTautH[0] ) );
  ------------------
  |  | 1146|   252k|#define inchi_calloc   calloc
  ------------------
 5458|   252k|    nCanonRankNoTautH = (AT_RANK *) inchi_calloc( num_max, sizeof( nCanonRankNoTautH[0] ) );
  ------------------
  |  | 1146|   252k|#define inchi_calloc   calloc
  ------------------
 5459|   252k|    nAtomNumberCanonNoTautH = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumberCanonNoTautH[0] ) );
  ------------------
  |  | 1146|   252k|#define inchi_calloc   calloc
  ------------------
 5460|   252k|    numHNoTautH = (NUM_H *) inchi_calloc( maxlenNumHNoTautH, sizeof( numHNoTautH[0] ) );
  ------------------
  |  | 1146|   252k|#define inchi_calloc   calloc
  ------------------
 5461|   252k|    if (!numHNoTautH || !nSymmRankNoTautH || !nCanonRankNoTautH || !nAtomNumberCanonNoTautH)
  ------------------
  |  Branch (5461:9): [True: 0, False: 252k]
  |  Branch (5461:25): [True: 0, False: 252k]
  |  Branch (5461:46): [True: 0, False: 252k]
  |  Branch (5461:68): [True: 0, False: 252k]
  ------------------
 5462|      0|    {
 5463|      0|        goto exit_error_alloc;
 5464|      0|    }
 5465|       |
 5466|       |    /* find number of H atoms attached to not-a-tautomeric-endpoint atoms */
 5467|  1.30M|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5467:17): [True: 1.04M, False: 252k]
  ------------------
 5468|  1.04M|    {
 5469|  1.04M|        numHNoTautH[i] = ( !at_base[i].endpoint && at_base[i].num_H ) ? at_base[i].num_H + BASE_H_NUMBER : EMPTY_H_NUMBER;
  ------------------
  |  |   37|  10.7k|#define BASE_H_NUMBER  ((INCHI_CANON_INFINITY-1)/2)
  |  |  ------------------
  |  |  |  |   31|  10.7k|#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;
  ------------------
  |  |   36|  2.08M|#define EMPTY_H_NUMBER (INCHI_CANON_INFINITY-1)
  |  |  ------------------
  |  |  |  |   31|  1.03M|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
  |  Branch (5469:28): [True: 1.03M, False: 13.2k]
  |  Branch (5469:52): [True: 10.7k, False: 1.02M]
  ------------------
 5470|  1.04M|    }
 5471|       |
 5472|       |    /* pointers */
 5473|   252k|    pCD[iOther].LinearCT = NULL;
 5474|   252k|    pCD[iOther].NumH = numHNoTautH;
 5475|   252k|    pCD[iOther].NumHfixed = NULL;
 5476|   252k|    pCD[iOther].iso_sort_key = NULL;
 5477|   252k|    pCD[iOther].iso_exchg_atnos = NULL;
 5478|       |
 5479|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5480|       |    pCD[iOther].iso_sort_key_Hfixed = NULL;
 5481|       |#endif
 5482|       |
 5483|       |    /* variables - unchanged */
 5484|   252k|    pCD[iOther].ulTimeOutTime = pBCN->ulTimeOutTime;
 5485|   252k|    pCD[iOther].nMaxLenLinearCT = s[iOther].nLenCTAtOnly + 1;
 5486|   252k|    pCD[iOther].maxlenNumH = maxlenNumHNoTautH;
 5487|       |    /* return values & input/output */
 5488|   252k|    pCD[iOther].nLenLinearCT = s[iOther].nLenCTAtOnly;
 5489|   252k|    pCD[iOther].nLenCTAtOnly = s[iOther].nLenCTAtOnly;
 5490|   252k|    pCD[iOther].lenNumH = lenNumHNoTautH = num_atoms;
 5491|   252k|    pCD[iOther].lenNumHfixed = 0;
 5492|   252k|    pCD[iOther].len_iso_sort_key = 0;
 5493|   252k|    pCD[iOther].maxlen_iso_sort_key = 0;
 5494|   252k|    pCD[iOther].len_iso_exchg_atnos = 0;
 5495|   252k|    pCD[iOther].maxlen_iso_exchg_atnos = 0;
 5496|       |
 5497|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5498|       |    pCD[iOther].len_iso_sort_key_Hfixed = 0;
 5499|       |    pCD[iOther].maxlen_iso_sort_key_Hfixed = 0;
 5500|       |#endif
 5501|       |
 5502|   252k|    pCD[iOther].nAuxRank = NULL;
 5503|       |
 5504|       |    /* check whether we need NoTautH cononicalization */
 5505|   252k|    memset( nTempRank, 0, num_max * sizeof( nTempRank[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5506|  1.30M|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5506:17): [True: 1.04M, False: 252k]
  ------------------
 5507|  1.04M|    {
 5508|  1.04M|        if (nTempRank[nSymmRankNoH[i] - 1] < i)
  ------------------
  |  Branch (5508:13): [True: 797k, False: 252k]
  ------------------
 5509|   797k|        {
 5510|   797k|            nTempRank[nSymmRankNoH[i] - 1] = i; /* greatest class representative */
 5511|   797k|        }
 5512|  1.04M|    }
 5513|  1.29M|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5513:17): [True: 1.04M, False: 251k]
  ------------------
 5514|  1.04M|    {
 5515|  1.04M|        if (numHNoTautH[i] != numHNoTautH[nTempRank[nSymmRankNoH[i] - 1]])
  ------------------
  |  Branch (5515:13): [True: 868, False: 1.03M]
  ------------------
 5516|    868|        {
 5517|    868|            pCD[iOther].nCanonFlags |= CANON_FLAG_NO_TAUT_H_DIFF;
  ------------------
  |  |  207|    868|#define CANON_FLAG_NO_TAUT_H_DIFF         0x0002  /* iOther: NoTautH eq. partition differs from NoH */
  ------------------
 5518|    868|            break; /* atoms so far found to be equivalent have different number of H; the canonicalization is needed */
 5519|    868|        }
 5520|  1.04M|    }
 5521|       |
 5522|       |    /* i = 0; *//* debug: force to call the canonicalization */
 5523|   252k|    if (i < num_atoms)
  ------------------
  |  Branch (5523:9): [True: 868, False: 251k]
  ------------------
 5524|    868|    {
 5525|       |        /* needs canonicalization */
 5526|       |        /* get aux canonical ranking of the structure with attached H */
 5527|       |
 5528|    868|#if ( USE_AUX_RANKING == 1 )
 5529|       |        /* refine no-H partition according to not-a-taut-H distribution */
 5530|    868|        memset( pAtomInvariantAux, 0, num_max * sizeof( pAtomInvariantAux[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5531|  12.7k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5531:21): [True: 11.8k, False: 868]
  ------------------
 5532|  11.8k|        {
 5533|  11.8k|            pAtomInvariantAux[i].val[0] = nSymmRankNoH[i];
 5534|  11.8k|            pAtomInvariantAux[i].val[1] = numHNoTautH[i]; /* additional differentiation: not-a-taut-H distribution */
 5535|  11.8k|        }
 5536|       |
 5537|       |        /* initial partitioning */
 5538|    868|        nNumCurrRanks = SetInitialRanks2( num_atoms, pAtomInvariantAux, nRankAux, nAtomNumberAux, pCG );
 5539|       |
 5540|       |        /* make equitable partition */
 5541|    868|        nNumCurrRanks = DifferentiateRanks2( pCG, num_atoms, NeighList[TAUT_NON],
  ------------------
  |  |  574|    868|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5542|    868|                                            nNumCurrRanks, nRankAux,
 5543|    868|                                            nTempRank, nAtomNumberAux, &lCount, 0 /* 0 means use qsort */ ); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 5544|       |
 5545|       |        /* to accelerate do not call CanonGraph() to find really equivalent atoms */
 5546|    868|        pCD[iOther].nAuxRank = nRankAux;
 5547|    868|#endif
 5548|       |
 5549|    868|        ret = CanonGraph03( ic, pCG, num_atoms, num_atoms, num_max, 1 /* digraph?? was 0 */,
  ------------------
  |  |  600|    868|#define CanonGraph03 CanonGraph
  ------------------
 5550|    868|                            NeighList[TAUT_NON], (Partition *) pBCN->pRankStack,
  ------------------
  |  |  574|    868|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5551|    868|                            nSymmRankNoTautH, nCanonRankNoTautH, nAtomNumberCanonNoTautH,
 5552|    868|                            pCD + iOther, pCC, &Ct_NoH, &Ct_NoTautH, LargeMolecules );
 5553|       |
 5554|    868|        if (ret < 0)
  ------------------
  |  Branch (5554:13): [True: 0, False: 868]
  ------------------
 5555|      0|        {
 5556|      0|            goto exit_error;
 5557|      0|        }
 5558|       |
 5559|       |        /* in case of non-tautomeric structure the final results are in:
 5560|       |
 5561|       |                   nSymmRankNoTautH
 5562|       |                   nCanonRankNoTautH
 5563|       |                   nAtomNumberCanonNoTautH
 5564|       |                   Ct_NoTautH
 5565|       |                   numHNoTautH (original H positions)
 5566|       |        */
 5567|    868|    } /* if ( i < num_atoms )  */
 5568|       |
 5569|   251k|    else
 5570|       |
 5571|   251k|    {
 5572|       |
 5573|       |        /* copy the results of the previous (no H) canonicalization */
 5574|       |        /* in this case numHNoTautH[] is not needed for the next canonicalization(s) */
 5575|   251k|        if (( Ct_Temp = (ConTable *) inchi_calloc( 1, sizeof( *Ct_Temp ) ) ) &&
  ------------------
  |  | 1146|   251k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5575:13): [True: 251k, False: 0]
  ------------------
 5576|   251k|             CTableCreate( Ct_Temp, num_atoms, pCD + iOther ))
  ------------------
  |  Branch (5576:14): [True: 251k, False: 0]
  ------------------
 5577|   251k|        {
 5578|   251k|            CtFullCopy( Ct_Temp, Ct_NoH );
 5579|       |            /* since Ct_NoH does not have Ct_NoH->NumH we have to fill out Ct_Temp->NumH separately */
 5580|  1.28M|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5580:25): [True: 1.03M, False: 251k]
  ------------------
 5581|  1.03M|            {
 5582|  1.03M|                Ct_Temp->NumH[nCanonRankNoH[i] - 1] = numHNoTautH[i];
 5583|       |                /*Ct_Temp->NumH[i] = numHNoTautH[nAtomNumberCanonNoH[i]]; -- alternative */
 5584|  1.03M|            }
 5585|   251k|            Ct_Temp->lenNumH = num_atoms;
 5586|   251k|        }
 5587|      0|        else
 5588|      0|        {
 5589|      0|            goto exit_error_alloc;
 5590|      0|        }
 5591|       |
 5592|   251k|        Ct_NoTautH = Ct_Temp;
 5593|   251k|        Ct_Temp = NULL;
 5594|       |        /* djb-rwth: functions replaced with their safe C11 variants */
 5595|   251k|        memcpy(nSymmRankNoTautH, nSymmRankNoH, num_atoms * sizeof(nSymmRankNoTautH[0]));
 5596|   251k|        memcpy(nCanonRankNoTautH, nCanonRankNoH, num_atoms * sizeof(nCanonRankNoTautH[0]));
 5597|   251k|        memcpy(nAtomNumberCanonNoTautH, nAtomNumberCanonNoH, num_atoms * sizeof(nAtomNumberCanonNoTautH[0]));
 5598|   251k|    }
 5599|       |
 5600|       |    /* in case of non-tautomeric component this is the final result */
 5601|       |    /* i = CtFullCompare( Ct_NoTautH, Ct_Temp, num_atoms, 0, 0 );*/
 5602|       |
 5603|       |    /*******************************************************************************************/
 5604|       |    /* If only Isotopic atoms and isotopic H, tautomerism has not been found:                  */
 5605|       |    /* get isotopic canonical numbering, connection table, and equivalence partition           */
 5606|       |    /*******************************************************************************************/
 5607|       |
 5608|   252k|    if (s[iOther].num_isotopic_atoms && !s[iOther].bIgnoreIsotopic && !bReqTaut && bReqNonTaut)
  ------------------
  |  Branch (5608:9): [True: 1.41k, False: 250k]
  |  Branch (5608:41): [True: 1.41k, False: 0]
  |  Branch (5608:71): [True: 594, False: 823]
  |  Branch (5608:84): [True: 594, False: 0]
  ------------------
 5609|    594|    {
 5610|       |
 5611|    594|        maxlen_iso_sort_key_NoTautH = num_atoms + 1;
 5612|    594|        nSymmRankNoTautHIso = (AT_RANK *) inchi_calloc( num_max, sizeof( nSymmRankNoTautHIso[0] ) );
  ------------------
  |  | 1146|    594|#define inchi_calloc   calloc
  ------------------
 5613|    594|        nCanonRankNoTautHIso = (AT_RANK *) inchi_calloc( num_max, sizeof( nCanonRankNoTautHIso[0] ) );
  ------------------
  |  | 1146|    594|#define inchi_calloc   calloc
  ------------------
 5614|    594|        nAtomNumberCanonNoTautHIso = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumberCanonNoTautHIso[0] ) );
  ------------------
  |  | 1146|    594|#define inchi_calloc   calloc
  ------------------
 5615|    594|        iso_sort_key_NoTautH = (AT_ISO_SORT_KEY *) inchi_calloc( maxlen_iso_sort_key_NoTautH, sizeof( iso_sort_key_NoTautH[0] ) );
  ------------------
  |  | 1146|    594|#define inchi_calloc   calloc
  ------------------
 5616|       |
 5617|    594|        if (!nSymmRankNoTautHIso || !nCanonRankNoTautHIso || !nAtomNumberCanonNoTautHIso || !iso_sort_key_NoTautH)
  ------------------
  |  Branch (5617:13): [True: 0, False: 594]
  |  Branch (5617:37): [True: 0, False: 594]
  |  Branch (5617:62): [True: 0, False: 594]
  |  Branch (5617:93): [True: 0, False: 594]
  ------------------
 5618|      0|        {
 5619|      0|            goto exit_error_alloc;
 5620|      0|        }
 5621|       |
 5622|       |        /* fill out isotopic non-tautomeric keys */
 5623|    594|        num_iso_NoTautH = 0;
 5624|  5.84k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5624:21): [True: 5.24k, False: 594]
  ------------------
 5625|  5.24k|        {
 5626|  5.24k|            if (at_base[i].endpoint)
  ------------------
  |  Branch (5626:17): [True: 25, False: 5.22k]
  ------------------
 5627|     25|            {
 5628|       |                /* should not happen */
 5629|     25|                iso_sort_key = make_iso_sort_key( at_base[i].iso_atw_diff, 0, 0, 0 );
 5630|     25|            }
 5631|  5.22k|            else
 5632|  5.22k|            {
 5633|  5.22k|                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] );
 5634|  5.22k|            }
 5635|  5.24k|            if (iso_sort_key)
  ------------------
  |  Branch (5635:17): [True: 850, False: 4.39k]
  ------------------
 5636|    850|            {
 5637|    850|                iso_sort_key_NoTautH[i] = iso_sort_key;
 5638|    850|                num_iso_NoTautH++;
 5639|    850|            }
 5640|  4.39k|            else
 5641|  4.39k|            {
 5642|  4.39k|                iso_sort_key_NoTautH[i] = EMPTY_ISO_SORT_KEY;
  ------------------
  |  |   38|  4.39k|#define EMPTY_ISO_SORT_KEY LONG_MAX
  ------------------
 5643|  4.39k|            }
 5644|  5.24k|        }
 5645|       |
 5646|       |        /* pointers */
 5647|    594|        pCD[iOther].LinearCT = NULL; /* LinearCT; */
 5648|    594|        pCD[iOther].NumH = numHNoTautH;
 5649|    594|        pCD[iOther].NumHfixed = NULL;
 5650|    594|        pCD[iOther].iso_sort_key = iso_sort_key_NoTautH;
 5651|    594|        pCD[iOther].iso_exchg_atnos = NULL;
 5652|       |
 5653|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5654|       |        pCD[iOther].iso_sort_key_Hfixed = NULL;
 5655|       |#endif
 5656|       |
 5657|       |        /* variables - unchanged */
 5658|    594|        pCD[iOther].ulTimeOutTime = pBCN->ulTimeOutTime;
 5659|    594|        pCD[iOther].nMaxLenLinearCT = s[iOther].nLenCTAtOnly + 1;
 5660|    594|        pCD[iOther].maxlenNumH = maxlenNumHNoTautH;
 5661|       |        /* return values & input/output */
 5662|    594|        pCD[iOther].nLenLinearCT = s[iOther].nLenCTAtOnly;
 5663|    594|        pCD[iOther].nLenCTAtOnly = s[iOther].nLenCTAtOnly;
 5664|    594|        pCD[iOther].lenNumH = lenNumHNoTautH /*= num_atoms*/;
 5665|    594|        pCD[iOther].lenNumHfixed = 0;
 5666|    594|        pCD[iOther].len_iso_sort_key = len_iso_sort_key_NoTautH = num_atoms;
 5667|    594|        pCD[iOther].maxlen_iso_sort_key = maxlen_iso_sort_key_NoTautH;
 5668|    594|        pCD[iOther].len_iso_exchg_atnos = 0;
 5669|    594|        pCD[iOther].maxlen_iso_exchg_atnos = 0;
 5670|       |
 5671|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5672|       |        pCD[iOther].len_iso_sort_key_Hfixed = 0;
 5673|       |        pCD[iOther].maxlen_iso_sort_key_Hfixed = 0;
 5674|       |#endif
 5675|       |
 5676|    594|        pCD[iOther].nAuxRank = NULL;
 5677|       |
 5678|    594|        if (num_iso_NoTautH)
  ------------------
  |  Branch (5678:13): [True: 594, False: 0]
  ------------------
 5679|    594|        {
 5680|       |            /* check whether we need NoTautH cononicalization */
 5681|    594|            memset( nTempRank, 0, num_max * sizeof( nTempRank[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5682|  5.84k|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5682:25): [True: 5.24k, False: 594]
  ------------------
 5683|  5.24k|            {
 5684|  5.24k|                if (nTempRank[nSymmRankNoTautH[i] - 1] < i)
  ------------------
  |  Branch (5684:21): [True: 4.65k, False: 594]
  ------------------
 5685|  4.65k|                {
 5686|  4.65k|                    nTempRank[nSymmRankNoTautH[i] - 1] = i; /* greatest class representative */
 5687|  4.65k|                }
 5688|  5.24k|            }
 5689|  2.25k|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5689:25): [True: 1.97k, False: 275]
  ------------------
 5690|  1.97k|            {
 5691|  1.97k|                if (iso_sort_key_NoTautH[i] != iso_sort_key_NoTautH[nTempRank[nSymmRankNoTautH[i] - 1]])
  ------------------
  |  Branch (5691:21): [True: 319, False: 1.66k]
  ------------------
 5692|    319|                {
 5693|    319|                    pCD[iOther].nCanonFlags |= CANON_FLAG_ISO_ONLY_NON_TAUT_DIFF;
  ------------------
  |  |  208|    319|#define CANON_FLAG_ISO_ONLY_NON_TAUT_DIFF 0x0004  /* iOther: eq. partition in isotopic only non-taut differs from non-isotopic */
  ------------------
 5694|    319|                    break; /* atoms so far found to be equivalent differ in isotopes; the canonicalization is needed */
 5695|    319|                }
 5696|  1.97k|            }
 5697|    594|        }
 5698|      0|        else
 5699|      0|        {
 5700|      0|            i = num_atoms;
 5701|      0|        }
 5702|       |        /* i = 0; *//* debug: force to call the canonicalization */
 5703|    594|        if (i < num_atoms)
  ------------------
  |  Branch (5703:13): [True: 319, False: 275]
  ------------------
 5704|    319|        {
 5705|       |            /* we need canonicalization */
 5706|       |            /* get aux canonical ranking of the structure with isotopic non-tautomeric H */
 5707|       |
 5708|    319|#if ( USE_AUX_RANKING == 1 )
 5709|       |            /* refine no-taut-H partition according to non-taut H isotopic distribution */
 5710|    319|            memset( pAtomInvariantAux, 0, num_max * sizeof( pAtomInvariantAux[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5711|  4.33k|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5711:25): [True: 4.01k, False: 319]
  ------------------
 5712|  4.01k|            {
 5713|  4.01k|                pAtomInvariantAux[i].val[0] = nSymmRankNoTautH[i];
 5714|  4.01k|                pAtomInvariantAux[i].iso_sort_key = iso_sort_key_NoTautH[i]; /* additional differentiation */
 5715|  4.01k|            }
 5716|       |            /* initial ranks for non-taut H isotopic distribution */
 5717|    319|            nNumCurrRanks = SetInitialRanks2( num_atoms, pAtomInvariantAux, nRankAux, nAtomNumberAux, pCG );
 5718|       |            /* make equitable */
 5719|    319|            nNumCurrRanks = DifferentiateRanks2( pCG, num_atoms, NeighList[TAUT_NON],
  ------------------
  |  |  574|    319|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5720|    319|                                                nNumCurrRanks, nRankAux,
 5721|    319|                                                nTempRank, nAtomNumberAux, &lCount, 0 /* 0 means use qsort */ ); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 5722|       |            /* to accelerate do not call CanonGraph() to find really equivalent atoms */
 5723|    319|            pCD[iOther].nAuxRank = nRankAux;
 5724|    319|#endif
 5725|       |
 5726|    319|            ret = CanonGraph04( ic, pCG,
  ------------------
  |  |  601|    319|#define CanonGraph04 CanonGraph
  ------------------
 5727|    319|                                num_atoms, num_atoms, num_max, 1 /* digraph?? was 0 */,
 5728|    319|                                NeighList[TAUT_NON], (Partition *) pBCN->pRankStack,
  ------------------
  |  |  574|    319|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5729|    319|                                nSymmRankNoTautHIso, nCanonRankNoTautHIso, nAtomNumberCanonNoTautHIso,
 5730|    319|                                pCD + iOther, pCC, &Ct_NoTautH, &Ct_NoTautHIso, LargeMolecules );
 5731|    319|            if (ret < 0)
  ------------------
  |  Branch (5731:17): [True: 0, False: 319]
  ------------------
 5732|      0|            {
 5733|      0|                goto exit_error;
 5734|      0|            }
 5735|       |
 5736|       |            /* in case of non-tautomeric structure the final results are in:
 5737|       |
 5738|       |                       nSymmRankNoTautHIso
 5739|       |                       nCanonRankNoTautHIso
 5740|       |                       nAtomNumberCanonNoTautHIso
 5741|       |                       Ct_NoTautHIso
 5742|       |                       iso_sort_key_NoTautH (original isotopic atom positions)
 5743|       |            */
 5744|    319|        }
 5745|    275|        else
 5746|    275|        {
 5747|       |            /* copy the results of the previous (no taut H) canonicalization */
 5748|       |            /* in this case numHNoTautH[] is not needed for the next canonicalization(s) */
 5749|    275|            if (( Ct_Temp = (ConTable *) inchi_calloc( 1, sizeof( *Ct_Temp ) ) ) &&
  ------------------
  |  | 1146|    275|#define inchi_calloc   calloc
  ------------------
  |  Branch (5749:17): [True: 275, False: 0]
  ------------------
 5750|    275|                 CTableCreate( Ct_Temp, num_atoms, pCD + iOther ))
  ------------------
  |  Branch (5750:18): [True: 275, False: 0]
  ------------------
 5751|    275|            {
 5752|    275|                CtFullCopy( Ct_Temp, Ct_NoTautH );
 5753|       |                /* since Ct_NoTautH does not have Ct_NoTautH->iso_sort_key we have to fill out Ct_Temp->iso_sort_key separately */
 5754|  1.50k|                for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5754:29): [True: 1.23k, False: 275]
  ------------------
 5755|  1.23k|                {
 5756|  1.23k|                    Ct_Temp->iso_sort_key[nCanonRankNoTautH[i] - 1] = iso_sort_key_NoTautH[i];
 5757|  1.23k|                }
 5758|    275|                Ct_Temp->len_iso_sort_key = num_atoms;
 5759|    275|            }
 5760|      0|            else
 5761|      0|            {
 5762|      0|                goto exit_error_alloc;
 5763|      0|            }
 5764|    275|            Ct_NoTautHIso = Ct_Temp;
 5765|    275|            Ct_Temp = NULL;
 5766|    275|            memcpy(nSymmRankNoTautHIso, nSymmRankNoTautH, num_atoms * sizeof(nSymmRankNoTautHIso[0]));
 5767|    275|            memcpy(nCanonRankNoTautHIso, nCanonRankNoTautH, num_atoms * sizeof(nCanonRankNoTautHIso[0]));
 5768|    275|            memcpy(nAtomNumberCanonNoTautHIso, nAtomNumberCanonNoTautH, num_atoms * sizeof(nAtomNumberCanonNoTautHIso[0]));
 5769|    275|        }
 5770|       |        /* in case of non-tautomeric component this is the final result */
 5771|       |        /* i = CtFullCompare( Ct_NoTautHIso, Ct_Temp, num_atoms, 0, 0 );*/
 5772|    594|    }
 5773|       |
 5774|       |
 5775|   252k|    if (bReqTaut)
  ------------------
  |  Branch (5775:9): [True: 40.8k, False: 211k]
  ------------------
 5776|  40.8k|    {
 5777|       |        /*****************************************************************************/
 5778|       |        /* Tautomeric Structure Canonicalizaton:                                     */
 5779|       |        /* get base canonical numbering, connection table, and equivalence partition */
 5780|       |        /*****************************************************************************/
 5781|       |        /* find H atoms attached to non-tautomeric-endpoints and to tautomeric endpoints */
 5782|  40.8k|        maxlenNumH = num_atoms + T_NUM_NO_ISOTOPIC*( num_at_tg - num_atoms ) + 1; /* including negative charges */
  ------------------
  |  |   69|  40.8k|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
 5783|  40.8k|        nSymmRankBase = (AT_RANK *) inchi_calloc( num_max, sizeof( nSymmRankBase[0] ) );
  ------------------
  |  | 1146|  40.8k|#define inchi_calloc   calloc
  ------------------
 5784|  40.8k|        nCanonRankBase = (AT_RANK *) inchi_calloc( num_max, sizeof( nCanonRankBase[0] ) );
  ------------------
  |  | 1146|  40.8k|#define inchi_calloc   calloc
  ------------------
 5785|  40.8k|        nAtomNumberCanonBase = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumberCanonBase[0] ) );
  ------------------
  |  | 1146|  40.8k|#define inchi_calloc   calloc
  ------------------
 5786|  40.8k|        numH = (NUM_H *) inchi_calloc( maxlenNumH, sizeof( numH[0] ) );
  ------------------
  |  | 1146|  40.8k|#define inchi_calloc   calloc
  ------------------
 5787|       |
 5788|  40.8k|        if (!numH || !nSymmRankBase || !nCanonRankBase || !nAtomNumberCanonBase)
  ------------------
  |  Branch (5788:13): [True: 0, False: 40.8k]
  |  Branch (5788:22): [True: 0, False: 40.8k]
  |  Branch (5788:40): [True: 0, False: 40.8k]
  |  Branch (5788:59): [True: 0, False: 40.8k]
  ------------------
 5789|      0|        {
 5790|      0|            goto exit_error_alloc;
 5791|      0|        }
 5792|       |
 5793|       |        /* non-tautomeric H counts */
 5794|   115k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5794:21): [True: 74.5k, False: 40.8k]
  ------------------
 5795|  74.5k|        {
 5796|  74.5k|            numH[i] = ( !at_base[i].endpoint && at_base[i].num_H ) ? at_base[i].num_H + BASE_H_NUMBER : EMPTY_H_NUMBER;
  ------------------
  |  |   37|  3.90k|#define BASE_H_NUMBER  ((INCHI_CANON_INFINITY-1)/2)
  |  |  ------------------
  |  |  |  |   31|  3.90k|#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;
  ------------------
  |  |   36|   145k|#define EMPTY_H_NUMBER (INCHI_CANON_INFINITY-1)
  |  |  ------------------
  |  |  |  |   31|  70.6k|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
  |  Branch (5796:25): [True: 65.7k, False: 8.78k]
  |  Branch (5796:49): [True: 3.90k, False: 61.8k]
  ------------------
 5797|  74.5k|        }
 5798|       |
 5799|       |        /* tautomeric H and negative charge counts */
 5800|  44.4k|        for (i = k = num_atoms; i < num_at_tg; i++)
  ------------------
  |  Branch (5800:33): [True: 3.56k, False: 40.8k]
  ------------------
 5801|  3.56k|        {
 5802|  3.56k|            m = i - num_atoms;
 5803|  10.7k|            for (j = 0; j < T_NUM_NO_ISOTOPIC; j++)
  ------------------
  |  |   69|  10.7k|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
  |  Branch (5803:25): [True: 7.13k, False: 3.56k]
  ------------------
 5804|  7.13k|            {
 5805|       |                /* non-zeroes for j=1 are negative charge counts; T_NUM_NO_ISOTOPIC=2 entry per t-group */
 5806|  7.13k|                numH[k++] = t_group_info->t_group[m].num[j] ? t_group_info->t_group[m].num[j] + BASE_H_NUMBER : EMPTY_H_NUMBER;
  ------------------
  |  |   37|  4.61k|#define BASE_H_NUMBER  ((INCHI_CANON_INFINITY-1)/2)
  |  |  ------------------
  |  |  |  |   31|  4.61k|#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;
  ------------------
  |  |   36|  9.65k|#define EMPTY_H_NUMBER (INCHI_CANON_INFINITY-1)
  |  |  ------------------
  |  |  |  |   31|  2.51k|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
  |  Branch (5806:29): [True: 4.61k, False: 2.51k]
  ------------------
 5807|  7.13k|            }
 5808|  3.56k|        }
 5809|       |
 5810|       |        /* pointers */
 5811|  40.8k|        pCD[iBase].LinearCT = NULL;
 5812|  40.8k|        pCD[iBase].NumH = numH; /* num_atoms non-tautomeric H; num_tg pairs of H and (-) in t-groups */
 5813|  40.8k|        pCD[iBase].NumHfixed = NULL;
 5814|  40.8k|        pCD[iBase].iso_sort_key = NULL;
 5815|  40.8k|        pCD[iBase].iso_exchg_atnos = NULL;
 5816|       |
 5817|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5818|       |        pCD[iBase].iso_sort_key_Hfixed = NULL;
 5819|       |#endif
 5820|       |
 5821|       |        /* variables - unchanged */
 5822|  40.8k|        pCD[iBase].ulTimeOutTime = pBCN->ulTimeOutTime;
 5823|  40.8k|        pCD[iBase].nMaxLenLinearCT = s[iBase].nLenCT + 1;
 5824|  40.8k|        pCD[iBase].maxlenNumH = maxlenNumH;
 5825|       |        /* return values & input/output */
 5826|  40.8k|        pCD[iBase].nLenLinearCT = s[iBase].nLenCT;
 5827|  40.8k|        pCD[iBase].nLenCTAtOnly = s[iBase].nLenCTAtOnly;
 5828|  40.8k|        pCD[iBase].lenNumH = lenNumH = k;
 5829|  40.8k|        pCD[iBase].lenNumHfixed = 0;
 5830|  40.8k|        pCD[iBase].len_iso_sort_key = 0;
 5831|  40.8k|        pCD[iBase].maxlen_iso_sort_key = 0;
 5832|  40.8k|        pCD[iBase].len_iso_exchg_atnos = 0;
 5833|  40.8k|        pCD[iBase].maxlen_iso_exchg_atnos = 0;
 5834|       |
 5835|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5836|       |        pCD[iBase].len_iso_sort_key_Hfixed = 0;
 5837|       |        pCD[iBase].maxlen_iso_sort_key_Hfixed = 0;
 5838|       |#endif
 5839|       |
 5840|  40.8k|        pCD[iBase].nAuxRank = NULL;
 5841|       |
 5842|       |        /* make sure the initial partition is equitable (at this point t-groups do not have ranks yet) */
 5843|  40.8k|        FillOutAtomInvariant2( at_base,
 5844|  40.8k|                               num_atoms,
 5845|  40.8k|                               num_at_tg,
 5846|  40.8k|                               pAtomInvariant,
 5847|  40.8k|                               1 /*bIgnoreIsotopic*/,
 5848|  40.8k|                               0 /*bHydrogensInRanks*/,
 5849|  40.8k|                               0 /*bHydrogensFixedInRanks*/,
 5850|  40.8k|                               1 /*bTaut=bDigraph*/,
 5851|  40.8k|                               1 /* bTautGroupsOnly */,
 5852|  40.8k|                               t_group_info );
 5853|       |
 5854|   115k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5854:21): [True: 74.5k, False: 40.8k]
  ------------------
 5855|  74.5k|        {
 5856|  74.5k|            pAtomInvariant[i].val[0] = pBCN->pRankStack[0][i];
 5857|  74.5k|        }
 5858|       |
 5859|       |        /* initial ranks for t-group(s) only */
 5860|  40.8k|        nNumCurrRanks = SetInitialRanks2( num_at_tg, pAtomInvariant, nRank, nAtomNumber, pCG );
 5861|       |
 5862|       |        /* make equitable, call digraph procedure;
 5863|       |           pBCN->pRankStack[0] is nRank, pBCN->pRankStack[1] is nAtomNumber
 5864|       |           This should only split ranks of tautomeric groups */
 5865|  40.8k|        nNumCurrRanks = DifferentiateRanks4( pCG, num_at_tg, NeighList[TAUT_YES],
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5866|  40.8k|                                         nNumCurrRanks, pBCN->pRankStack[0], nTempRank /* temp array */,
 5867|  40.8k|                                         pBCN->pRankStack[1], (AT_RANK) num_atoms, &lCount ); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 5868|       |
 5869|  40.8k|#if ( USE_AUX_RANKING == 1 )
 5870|       |        /* refine no-H partition according to non-taut H distribution */
 5871|  40.8k|        memset( pAtomInvariantAux, 0, num_max * sizeof( pAtomInvariantAux[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5872|   115k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5872:21): [True: 74.5k, False: 40.8k]
  ------------------
 5873|  74.5k|        {
 5874|  74.5k|            pAtomInvariantAux[i].val[0] = nSymmRankNoTautH[i];
 5875|  74.5k|            pAtomInvariantAux[i].val[1] = numH[i]; /* additional differentiation */
 5876|  74.5k|        }
 5877|       |        /*
 5878|       |        * djb-rwth: original badly written loop
 5879|       |        for (j = i; i < num_at_tg; i++)
 5880|       |        {
 5881|       |            pAtomInvariantAux[i].val[0] = nRank[i];
 5882|       |        }
 5883|       |        */
 5884|  44.4k|        for (j = i; j < num_at_tg; j++) /* djb-rwth: corrected loop */
  ------------------
  |  Branch (5884:21): [True: 3.56k, False: 40.8k]
  ------------------
 5885|  3.56k|        {
 5886|  3.56k|            pAtomInvariantAux[j].val[0] = nRank[j];
 5887|  3.56k|        }
 5888|       |        /* initial ranks for t-group(s) */
 5889|  40.8k|        nNumCurrRanks = SetInitialRanks2( num_at_tg, pAtomInvariantAux, nRankAux, nAtomNumberAux, pCG );
 5890|       |        /* make equitable, call digraph procedure */
 5891|  40.8k|        nNumCurrRanks = DifferentiateRanks4( pCG, num_at_tg, NeighList[TAUT_YES],
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5892|  40.8k|                                         nNumCurrRanks, nRankAux, nTempRank /* temp array */,
 5893|  40.8k|                                         nAtomNumberAux, (AT_RANK) num_atoms, &lCount ); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 5894|       |        /* to accelerate do not call CanonGraph() to find really equivalent atoms */
 5895|  40.8k|        pCD[iBase].nAuxRank = nRankAux;
 5896|  40.8k|#endif
 5897|       |
 5898|  40.8k|        ret = CanonGraph05( ic, pCG, num_atoms, num_at_tg, num_max, 1 /* digraph*/,
  ------------------
  |  |  602|  40.8k|#define CanonGraph05 CanonGraph
  ------------------
 5899|  40.8k|                            NeighList[TAUT_YES], (Partition *) pBCN->pRankStack,
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5900|  40.8k|                            nSymmRankBase, nCanonRankBase, nAtomNumberCanonBase,
 5901|  40.8k|                            pCD + iBase, pCC, &Ct_NoTautH, &Ct_Base, LargeMolecules );
 5902|  40.8k|        if (ret < 0)
  ------------------
  |  Branch (5902:13): [True: 0, False: 40.8k]
  ------------------
 5903|      0|        {
 5904|      0|            goto exit_error;
 5905|      0|        }
 5906|       |
 5907|       |        /* tautomeric isotopic structure */
 5908|       |        /**************************************************************************************/
 5909|       |        /* Isotopic atoms and isotopic H atoms and isotopic tautomeric groups                 */
 5910|       |        /* get isotopic canonical numbering, connection table, and equivalence partition      */
 5911|       |        /**************************************************************************************/
 5912|  40.8k|        if ((s[iBase].num_isotopic_atoms && !s[iBase].bIgnoreIsotopic) ||
  ------------------
  |  Branch (5912:14): [True: 800, False: 40.0k]
  |  Branch (5912:45): [True: 800, False: 0]
  ------------------
 5913|  40.0k|             (s[iBase].bHasIsotopicTautGroups && !bTautIgnoreIsotopic) ||
  ------------------
  |  Branch (5913:15): [True: 91, False: 39.9k]
  |  Branch (5913:50): [True: 91, False: 0]
  ------------------
 5914|  39.9k|             (bUseIsoAuxBase[iBase] && !bTautIgnoreIsotopic)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (5914:15): [True: 0, False: 39.9k]
  |  Branch (5914:40): [True: 0, False: 0]
  ------------------
 5915|    891|        {
 5916|       |
 5917|    891|            t_group_info->bIgnoreIsotopic = bTautIgnoreIsotopic;
 5918|       |
 5919|    891|            nSymmRankBaseIso = (AT_RANK *) inchi_calloc( num_max, sizeof( nSymmRankBaseIso[0] ) );
  ------------------
  |  | 1146|    891|#define inchi_calloc   calloc
  ------------------
 5920|    891|            nCanonRankBaseIso = (AT_RANK *) inchi_calloc( num_max, sizeof( nCanonRankBaseIso[0] ) );
  ------------------
  |  | 1146|    891|#define inchi_calloc   calloc
  ------------------
 5921|    891|            nAtomNumberCanonBaseIso = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumberCanonBaseIso[0] ) );
  ------------------
  |  | 1146|    891|#define inchi_calloc   calloc
  ------------------
 5922|    891|            if (bUseIsoAuxBase[iBase])
  ------------------
  |  Branch (5922:17): [True: 157, False: 734]
  ------------------
 5923|    157|            {
 5924|    157|                maxlen_iso_exchg_atnos = num_max + 1;
 5925|    157|                iso_exchg_atnos = (S_CHAR  *) inchi_calloc( maxlen_iso_exchg_atnos, sizeof( iso_exchg_atnos[0] ) );
  ------------------
  |  | 1146|    157|#define inchi_calloc   calloc
  ------------------
 5926|    157|            }
 5927|    891|            maxlen_iso_sort_keyBase = num_max + 1; /* num_at_tg+1;*/
 5928|    891|            iso_sort_keyBase = (AT_ISO_SORT_KEY *) inchi_calloc( maxlen_iso_sort_keyBase, sizeof( iso_sort_keyBase[0] ) );
  ------------------
  |  | 1146|    891|#define inchi_calloc   calloc
  ------------------
 5929|    891|            if (!nSymmRankBaseIso || !nCanonRankBaseIso || !nAtomNumberCanonBaseIso ||
  ------------------
  |  Branch (5929:17): [True: 0, False: 891]
  |  Branch (5929:38): [True: 0, False: 891]
  |  Branch (5929:60): [True: 0, False: 891]
  ------------------
 5930|    891|                 !iso_sort_keyBase ||
  ------------------
  |  Branch (5930:18): [True: 0, False: 891]
  ------------------
 5931|    891|                 (maxlen_iso_exchg_atnos && !iso_exchg_atnos)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (5931:19): [True: 157, False: 734]
  |  Branch (5931:45): [True: 0, False: 157]
  ------------------
 5932|      0|            {
 5933|      0|                goto exit_error_alloc;
 5934|      0|            }
 5935|       |            /* atoms */
 5936|    891|            num_iso_NoTautH = 0;
 5937|    891|            num_iso_NoAuxBase = 0;
 5938|    891|            if (iso_exchg_atnos)
  ------------------
  |  Branch (5938:17): [True: 157, False: 734]
  ------------------
 5939|    157|            {
 5940|    157|                len_iso_exchg_atnos = num_at_tg;
 5941|    157|            }
 5942|  7.03k|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5942:25): [True: 6.14k, False: 891]
  ------------------
 5943|  6.14k|            {
 5944|  6.14k|                if (at_base[i].endpoint || (iso_exchg_atnos && ( at_base[i].cFlags & AT_FLAG_ISO_H_POINT ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   50|  3.43k|#define AT_FLAG_ISO_H_POINT 0x01 /**< may have isotopic H */
  ------------------
  |  Branch (5944:21): [True: 309, False: 5.83k]
  |  Branch (5944:45): [True: 3.43k, False: 2.39k]
  |  Branch (5944:64): [True: 241, False: 3.19k]
  ------------------
 5945|    550|                {
 5946|       |                    /* tautomeric or may have exchangeable isotopic H */
 5947|    550|                    iso_sort_key = make_iso_sort_key( at_base[i].iso_atw_diff, 0, 0, 0 );
 5948|    550|                    if (iso_exchg_atnos)
  ------------------
  |  Branch (5948:25): [True: 254, False: 296]
  ------------------
 5949|    254|                    {
 5950|    254|                        num_iso_NoAuxBase += !at_base[i].endpoint; /* these non-taut atom may exchange isotopic H as tautomeric atoms do */
 5951|    254|                    }
 5952|    550|                }
 5953|  5.59k|                else
 5954|  5.59k|                {
 5955|       |                    /* non-mobile H */
 5956|  5.59k|                    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] );
 5957|  5.59k|                    if (iso_exchg_atnos)
  ------------------
  |  Branch (5957:25): [True: 3.19k, False: 2.39k]
  ------------------
 5958|  3.19k|                    {
 5959|  3.19k|                        iso_exchg_atnos[i] = 1; /* atom cannot have exchangable isotopic H atom(s) */
 5960|  3.19k|                    }
 5961|  5.59k|                }
 5962|  6.14k|                if (iso_sort_key)
  ------------------
  |  Branch (5962:21): [True: 886, False: 5.25k]
  ------------------
 5963|    886|                {
 5964|    886|                    num_iso_NoTautH++;
 5965|    886|                    iso_sort_keyBase[i] = iso_sort_key;
 5966|    886|                }
 5967|  5.25k|                else
 5968|  5.25k|                {
 5969|  5.25k|                    iso_sort_keyBase[i] = EMPTY_ISO_SORT_KEY;
  ------------------
  |  |   38|  5.25k|#define EMPTY_ISO_SORT_KEY LONG_MAX
  ------------------
 5970|  5.25k|                }
 5971|  6.14k|            }
 5972|       |
 5973|       |            /* check marking and count of non-taut atoms that may exchange isotopic H -- debug only */
 5974|    891|            if (iso_exchg_atnos)
  ------------------
  |  Branch (5974:17): [True: 157, False: 734]
  ------------------
 5975|    157|            {
 5976|    157|                if (num_iso_NoAuxBase != t_group_info->nIsotopicEndpointAtomNumber[0])
  ------------------
  |  Branch (5976:21): [True: 0, False: 157]
  ------------------
 5977|      0|                {
 5978|      0|                    ret = CT_ISOCOUNT_ERR;
  ------------------
  |  |   23|      0|#define CT_ISOCOUNT_ERR      (CT_ERR_FIRST- 4)  /*(-30004) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 5979|      0|                    goto exit_error;
 5980|      0|                }
 5981|    398|                for (i = 1; i <= num_iso_NoAuxBase; i++)
  ------------------
  |  Branch (5981:29): [True: 241, False: 157]
  ------------------
 5982|    241|                {
 5983|    241|                    j = t_group_info->nIsotopicEndpointAtomNumber[i];
 5984|    241|                    if (at_base[j].endpoint || !( at_base[j].cFlags & AT_FLAG_ISO_H_POINT ))
  ------------------
  |  |   50|    241|#define AT_FLAG_ISO_H_POINT 0x01 /**< may have isotopic H */
  ------------------
  |  Branch (5984:25): [True: 0, False: 241]
  |  Branch (5984:48): [True: 0, False: 241]
  ------------------
 5985|      0|                    {
 5986|      0|                        ret = CT_ISOCOUNT_ERR;
  ------------------
  |  |   23|      0|#define CT_ISOCOUNT_ERR      (CT_ERR_FIRST- 4)  /*(-30004) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 5987|      0|                        goto exit_error;
 5988|      0|                    }
 5989|    241|                }
 5990|    157|            }
 5991|       |
 5992|       |            /* t-groups */
 5993|    891|            num_iso_Base = 0;
 5994|    891|            if (iso_exchg_atnos)
  ------------------
  |  Branch (5994:17): [True: 157, False: 734]
  ------------------
 5995|    157|            {
 5996|    161|                for (i = num_atoms; i < num_at_tg; i++)
  ------------------
  |  Branch (5996:37): [True: 4, False: 157]
  ------------------
 5997|      4|                {
 5998|      4|                    iso_sort_keyBase[i] = EMPTY_ISO_SORT_KEY; /* new mode: do not provide info about isotopic tautomeric H */
  ------------------
  |  |   38|      4|#define EMPTY_ISO_SORT_KEY LONG_MAX
  ------------------
 5999|      4|                }
 6000|    157|            }
 6001|    734|            else
 6002|    734|            {
 6003|    878|                for (i = num_atoms; i < num_at_tg; i++)
  ------------------
  |  Branch (6003:37): [True: 144, False: 734]
  ------------------
 6004|    144|                {
 6005|       |                    /* should not happen anymore */
 6006|    144|                    m = i - num_atoms;
 6007|    144|                    if ((iso_sort_key = t_group_info->t_group[m].iWeight)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (6007:25): [True: 0, False: 144]
  ------------------
 6008|      0|                    {
 6009|       |                        /* old approach: each t-group has its own isotopic "weight" */
 6010|      0|                        num_iso_Base++;
 6011|      0|                        iso_sort_keyBase[i] = iso_sort_key;
 6012|      0|                    }
 6013|    144|                    else
 6014|    144|                    {
 6015|    144|                        iso_sort_keyBase[i] = EMPTY_ISO_SORT_KEY;
  ------------------
  |  |   38|    144|#define EMPTY_ISO_SORT_KEY LONG_MAX
  ------------------
 6016|    144|                    }
 6017|    144|                }
 6018|    734|            }
 6019|       |
 6020|    891|            if (!num_iso_NoAuxBase && iso_exchg_atnos)
  ------------------
  |  Branch (6020:17): [True: 734, False: 157]
  |  Branch (6020:39): [True: 0, False: 734]
  ------------------
 6021|      0|            {
 6022|       |                /* all atoms that may exchange isotopic H are either tautomeric or not present */
 6023|      0|                inchi_free( iso_exchg_atnos );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6024|      0|                iso_exchg_atnos = NULL;
 6025|      0|                len_iso_exchg_atnos = 0;
 6026|      0|                maxlen_iso_exchg_atnos = 0;
 6027|      0|            }
 6028|       |
 6029|    891|            if (!num_iso_NoTautH && !num_iso_Base && iso_sort_keyBase)
  ------------------
  |  Branch (6029:17): [True: 91, False: 800]
  |  Branch (6029:37): [True: 91, False: 0]
  |  Branch (6029:54): [True: 91, False: 0]
  ------------------
 6030|     91|            {
 6031|       |                /* no isotopic atoms present */
 6032|     91|                inchi_free( iso_sort_keyBase );
  ------------------
  |  | 1152|     91|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 91, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 91]
  |  |  ------------------
  ------------------
 6033|     91|                iso_sort_keyBase = NULL;
 6034|     91|                maxlen_iso_sort_keyBase = 0;
 6035|     91|            }
 6036|    800|            else
 6037|    800|            {
 6038|    800|                len_iso_sort_keyBase = num_at_tg;
 6039|    800|            }
 6040|       |
 6041|    891|            if (!iso_exchg_atnos && !iso_sort_keyBase)
  ------------------
  |  Branch (6041:17): [True: 734, False: 157]
  |  Branch (6041:37): [True: 30, False: 704]
  ------------------
 6042|     30|            {
 6043|       |                /* no isotopic part at all or only tautomeric groups */
 6044|     30|                inchi_free( nSymmRankBaseIso );        nSymmRankBaseIso = NULL;
  ------------------
  |  | 1152|     30|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 30, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 30]
  |  |  ------------------
  ------------------
 6045|     30|                inchi_free( nCanonRankBaseIso );       nCanonRankBaseIso = NULL;
  ------------------
  |  | 1152|     30|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 30, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 30]
  |  |  ------------------
  ------------------
 6046|     30|                inchi_free( nAtomNumberCanonBaseIso ); nAtomNumberCanonBaseIso = NULL;
  ------------------
  |  | 1152|     30|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 30, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 30]
  |  |  ------------------
  ------------------
 6047|     30|            }
 6048|    861|            else
 6049|    861|            {
 6050|       |                /* proceed with tautomeric isotopic canonicalization */
 6051|       |                /* pointers */
 6052|    861|                pCD[iBase].LinearCT = NULL;
 6053|    861|                pCD[iBase].NumH = numH; /* num_atoms non-tautomeric H; num_tg pairs of H and (-) in t-groups */
 6054|    861|                pCD[iBase].NumHfixed = NULL;
 6055|    861|                pCD[iBase].iso_sort_key = iso_sort_keyBase;
 6056|    861|                pCD[iBase].iso_exchg_atnos = iso_exchg_atnos;
 6057|       |
 6058|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6059|       |                pCD[iBase].iso_sort_key_Hfixed = NULL;
 6060|       |#endif
 6061|       |
 6062|       |                /* variables - unchanged */
 6063|    861|                pCD[iBase].ulTimeOutTime = pBCN->ulTimeOutTime;
 6064|    861|                pCD[iBase].nMaxLenLinearCT = s[iBase].nLenCT + 1;
 6065|    861|                pCD[iBase].maxlenNumH = maxlenNumH;
 6066|       |                /* return values & input/output */
 6067|    861|                pCD[iBase].nLenLinearCT = s[iBase].nLenCT;
 6068|    861|                pCD[iBase].nLenCTAtOnly = s[iBase].nLenCTAtOnly;
 6069|    861|                pCD[iBase].lenNumH = lenNumH /* = k */;
 6070|    861|                pCD[iBase].lenNumHfixed = 0;
 6071|    861|                pCD[iBase].len_iso_sort_key = len_iso_sort_keyBase;
 6072|    861|                pCD[iBase].maxlen_iso_sort_key = maxlen_iso_sort_keyBase;
 6073|    861|                pCD[iBase].len_iso_exchg_atnos = len_iso_exchg_atnos;
 6074|    861|                pCD[iBase].maxlen_iso_exchg_atnos = maxlen_iso_exchg_atnos;
 6075|       |
 6076|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6077|       |                pCD[iBase].len_iso_sort_key_Hfixed = 0;
 6078|       |                pCD[iBase].maxlen_iso_sort_key_Hfixed = 0;
 6079|       |#endif
 6080|       |
 6081|    861|                pCD[iBase].nAuxRank = NULL;
 6082|       |
 6083|    861|                if (num_iso_NoTautH || num_iso_Base || num_iso_NoAuxBase)
  ------------------
  |  Branch (6083:21): [True: 800, False: 61]
  |  Branch (6083:40): [True: 0, False: 61]
  |  Branch (6083:56): [True: 61, False: 0]
  ------------------
 6084|    861|                {
 6085|       |                    /* check whether we need actual canonicalization */
 6086|    861|                    memset( nTempRank, 0, num_max * sizeof( nTempRank[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 6087|  6.90k|                    for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (6087:33): [True: 6.04k, False: 861]
  ------------------
 6088|  6.04k|                    {
 6089|  6.04k|                        if (nTempRank[nSymmRankBase[i] - 1] < i)
  ------------------
  |  Branch (6089:29): [True: 5.18k, False: 861]
  ------------------
 6090|  5.18k|                        {
 6091|  5.18k|                            nTempRank[nSymmRankBase[i] - 1] = i; /* greatest class representative */
 6092|  5.18k|                        }
 6093|  6.04k|                    }
 6094|  2.99k|                    for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (6094:33): [True: 2.24k, False: 754]
  ------------------
 6095|  2.24k|                    {
 6096|  2.24k|                        if (( iso_sort_keyBase ? ( iso_sort_keyBase[i] != iso_sort_keyBase[nTempRank[nSymmRankBase[i] - 1]] ) : 0 ) ||
  ------------------
  |  Branch (6096:29): [True: 75, False: 2.16k]
  |  Branch (6096:31): [True: 1.83k, False: 404]
  ------------------
 6097|  2.16k|                            ( iso_exchg_atnos ? ( iso_exchg_atnos[i] != iso_exchg_atnos[nTempRank[nSymmRankBase[i] - 1]] ) : 0 ))
  ------------------
  |  Branch (6097:29): [True: 32, False: 2.13k]
  |  Branch (6097:31): [True: 933, False: 1.23k]
  ------------------
 6098|    107|                        {
 6099|    107|                            pCD[iBase].nCanonFlags |= CANON_FLAG_ISO_TAUT_DIFF;
  ------------------
  |  |  209|    107|#define CANON_FLAG_ISO_TAUT_DIFF          0x0008  /* iBase:  isotopic eq. partition in isotopic taut differs from non-isotopic taut */
  ------------------
 6100|    107|                            break; /* atoms so far found to be equivalent have different number of H; the canonicalization is needed */
 6101|    107|                        }
 6102|  2.24k|                    }
 6103|    861|                }
 6104|      0|                else
 6105|      0|                {
 6106|      0|                    i = num_at_tg; /* should not happen */
 6107|      0|                }
 6108|       |
 6109|       |                /* i = 0; *//* debug: force to call the canonicalization */
 6110|       |
 6111|    861|                if (i < num_at_tg)
  ------------------
  |  Branch (6111:21): [True: 107, False: 754]
  ------------------
 6112|    107|                {
 6113|       |                    /* we need canonicalization */
 6114|       |                    /* get aux canonical ranking of the structure with isotopic non-tautomeric H */
 6115|       |
 6116|    107|#if ( USE_AUX_RANKING == 1 )
 6117|       |                /* refine no-taut-H partition according to non-taut H + t-groups isotopic distribution */
 6118|    107|                    memset( pAtomInvariantAux, 0, num_max * sizeof( pAtomInvariantAux[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 6119|  4.18k|                    for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (6119:33): [True: 4.08k, False: 107]
  ------------------
 6120|  4.08k|                    {
 6121|  4.08k|                        pAtomInvariantAux[i].val[0] = nSymmRankBase[i];
 6122|  4.08k|                        pAtomInvariantAux[i].iso_sort_key = iso_sort_keyBase ? iso_sort_keyBase[i] : 0; /* additional differentiation */
  ------------------
  |  Branch (6122:61): [True: 3.81k, False: 269]
  ------------------
 6123|  4.08k|                        pAtomInvariantAux[i].iso_aux_key = iso_exchg_atnos ? iso_exchg_atnos[i] : 0;
  ------------------
  |  Branch (6123:60): [True: 2.65k, False: 1.42k]
  ------------------
 6124|  4.08k|                    }
 6125|       |                    /* initial ranks for non-taut H isotopic distribution */
 6126|    107|                    nNumCurrRanks = SetInitialRanks2( num_at_tg, pAtomInvariantAux, nRankAux, nAtomNumberAux, pCG );
 6127|       |                    /* make equitable, not a digraph procedure */
 6128|    107|                    nNumCurrRanks = DifferentiateRanks2( pCG, num_at_tg, NeighList[TAUT_YES],
  ------------------
  |  |  575|    107|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6129|    107|                                                        nNumCurrRanks, nRankAux,
 6130|    107|                                                        nTempRank, nAtomNumberAux, &lCount, 0 /* 0 means first use qsort */ ); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 6131|       |                    /* to accelerate do not call CanonGraph() to find really equivalent atoms */
 6132|    107|                    pCD[iBase].nAuxRank = nRankAux;
 6133|    107|#endif
 6134|       |
 6135|    107|                    ret = CanonGraph06( ic, pCG, num_atoms, num_at_tg, num_max, 1 /* digraph */,
  ------------------
  |  |  603|    107|#define CanonGraph06 CanonGraph
  ------------------
 6136|    107|                                        NeighList[TAUT_YES], (Partition *) pBCN->pRankStack,
  ------------------
  |  |  575|    107|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6137|    107|                                        nSymmRankBaseIso, nCanonRankBaseIso, nAtomNumberCanonBaseIso,
 6138|    107|                                        pCD + iBase, pCC, &Ct_Base, &Ct_BaseIso, LargeMolecules );
 6139|    107|                    if (ret < 0)
  ------------------
  |  Branch (6139:25): [True: 0, False: 107]
  ------------------
 6140|      0|                    {
 6141|      0|                        goto exit_error;
 6142|      0|                    }
 6143|       |                    /* in case of a tautomeric structure the final results are in:
 6144|       |
 6145|       |                               nSymmRankBaseIso
 6146|       |                               nCanonRankBaseIso
 6147|       |                               nAtomNumberCanonBaseIso
 6148|       |                               Ct_BaseIso
 6149|       |                               iso_sort_keyBase (original isotopic atom & t-group positions)
 6150|       |                               Ct_BaseIso->iso_exchg_atnos: 0=>can exchange isotopic H, including tautomeric atoms
 6151|       |                               iso_exchg_atnos            : same, in order of t_group_info->nIsotopicEndpointAtomNumber[]
 6152|       |                    */
 6153|    107|                }
 6154|    754|                else
 6155|    754|                {
 6156|       |                    /* copy the results of the previous (no taut H) canonicalization */
 6157|       |                    /* in this case numHNoTautH[] is not needed for the next canonicalization(s) */
 6158|    754|                    if (( Ct_Temp = (ConTable *) inchi_calloc( 1, sizeof( *Ct_Temp ) ) ) &&
  ------------------
  |  | 1146|    754|#define inchi_calloc   calloc
  ------------------
  |  Branch (6158:25): [True: 754, False: 0]
  ------------------
 6159|    754|                         CTableCreate( Ct_Temp, num_atoms, pCD + iBase ))
  ------------------
  |  Branch (6159:26): [True: 754, False: 0]
  ------------------
 6160|    754|                    {
 6161|    754|                        CtFullCopy( Ct_Temp, Ct_Base );
 6162|       |                        /* since Ct_Base does not have Ct_Base->iso_sort_key we
 6163|       |                           have to fill out Ct_Temp->iso_sort_key separately */
 6164|    754|                        if (iso_sort_keyBase)
  ------------------
  |  Branch (6164:29): [True: 698, False: 56]
  ------------------
 6165|    698|                        {
 6166|  2.26k|                            for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (6166:41): [True: 1.57k, False: 698]
  ------------------
 6167|  1.57k|                            {
 6168|  1.57k|                                Ct_Temp->iso_sort_key[nCanonRankBase[i] - 1] = iso_sort_keyBase[i];
 6169|  1.57k|                            }
 6170|    698|                            Ct_Temp->len_iso_sort_key = num_at_tg;
 6171|    698|                        }
 6172|     56|                        else
 6173|     56|                        {
 6174|     56|                            Ct_Temp->len_iso_sort_key = 0;
 6175|     56|                        }
 6176|    754|                        if (iso_exchg_atnos)
  ------------------
  |  Branch (6176:29): [True: 97, False: 657]
  ------------------
 6177|     97|                        {
 6178|    894|                            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (6178:41): [True: 797, False: 97]
  ------------------
 6179|    797|                            {
 6180|    797|                                Ct_Temp->iso_exchg_atnos[nCanonRankBase[i] - 1] = iso_exchg_atnos[i];
 6181|    797|                            }
 6182|     97|                            Ct_Temp->len_iso_exchg_atnos = num_at_tg;
 6183|     97|                        }
 6184|    657|                        else
 6185|    657|                        {
 6186|    657|                            Ct_Temp->len_iso_exchg_atnos = 0;
 6187|    657|                        }
 6188|    754|                    }
 6189|      0|                    else
 6190|      0|                    {
 6191|      0|                        goto exit_error_alloc;
 6192|      0|                    }
 6193|    754|                    Ct_BaseIso = Ct_Temp;
 6194|    754|                    Ct_Temp = NULL;
 6195|    754|                    memcpy(nSymmRankBaseIso, nSymmRankBase, num_at_tg * sizeof(nSymmRankBaseIso[0]));
 6196|    754|                    memcpy(nCanonRankBaseIso, nCanonRankBase, num_at_tg * sizeof(nCanonRankBaseIso[0]));
 6197|    754|                    memcpy(nAtomNumberCanonBaseIso, nAtomNumberCanonBase, num_at_tg * sizeof(nAtomNumberCanonBaseIso[0]));
 6198|    754|                }
 6199|       |                /* in case of non-tautomeric component this is the final result */
 6200|       |                /* i = CtFullCompare( Ct_BaseIso, Ct_Temp, num_at_tg, 0, 0 );*/
 6201|       |
 6202|    861|                t_group_info->bIgnoreIsotopic = 1;
 6203|    861|            }
 6204|    891|        }
 6205|  40.8k|    }
 6206|       |
 6207|       |    /**********************************************************************************/
 6208|       |    /* get "fixed H" canonical numbering, connection table, and equivalence partition */
 6209|       |    /**********************************************************************************/
 6210|       |
 6211|   252k|    if (bReqTaut && bReqNonTaut)
  ------------------
  |  Branch (6211:9): [True: 40.8k, False: 211k]
  |  Branch (6211:21): [True: 36.3k, False: 4.50k]
  ------------------
 6212|  36.3k|    {
 6213|  36.3k|        maxlenNumHfixed = num_atoms + 1;
 6214|  36.3k|        nSymmRankFixH = (AT_RANK *) inchi_calloc( num_max, sizeof( nSymmRankFixH[0] ) );
  ------------------
  |  | 1146|  36.3k|#define inchi_calloc   calloc
  ------------------
 6215|  36.3k|        nCanonRankFixH = (AT_RANK *) inchi_calloc( num_max, sizeof( nCanonRankFixH[0] ) );
  ------------------
  |  | 1146|  36.3k|#define inchi_calloc   calloc
  ------------------
 6216|  36.3k|        nAtomNumberCanonFixH = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumberCanonFixH[0] ) );
  ------------------
  |  | 1146|  36.3k|#define inchi_calloc   calloc
  ------------------
 6217|  36.3k|        NumHfixed = (NUM_H *) inchi_calloc( maxlenNumHfixed, sizeof( NumHfixed[0] ) );
  ------------------
  |  | 1146|  36.3k|#define inchi_calloc   calloc
  ------------------
 6218|  36.3k|        if (!NumHfixed || !nSymmRankFixH || !nCanonRankFixH || !nAtomNumberCanonFixH)
  ------------------
  |  Branch (6218:13): [True: 0, False: 36.3k]
  |  Branch (6218:27): [True: 0, False: 36.3k]
  |  Branch (6218:45): [True: 0, False: 36.3k]
  |  Branch (6218:64): [True: 0, False: 36.3k]
  ------------------
 6219|      0|        {
 6220|      0|            goto exit_error_alloc;
 6221|      0|        }
 6222|  80.4k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (6222:21): [True: 44.0k, False: 36.3k]
  ------------------
 6223|  44.0k|        {
 6224|       |            /* fixed and non-tautomeric H different in taut and non-taut structures */
 6225|       |
 6226|  44.0k|            if (at_base[i].endpoint)
  ------------------
  |  Branch (6226:17): [True: 2.54k, False: 41.4k]
  ------------------
 6227|  2.54k|            {
 6228|  2.54k|                NumHfixed[i] = at_other[i].num_H ? at_other[i].num_H + BASE_H_NUMBER : EMPTY_H_NUMBER;
  ------------------
  |  |   37|    818|#define BASE_H_NUMBER  ((INCHI_CANON_INFINITY-1)/2)
  |  |  ------------------
  |  |  |  |   31|    818|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
                              NumHfixed[i] = at_other[i].num_H ? at_other[i].num_H + BASE_H_NUMBER : EMPTY_H_NUMBER;
  ------------------
  |  |   36|  4.26k|#define EMPTY_H_NUMBER (INCHI_CANON_INFINITY-1)
  |  |  ------------------
  |  |  |  |   31|  1.72k|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
  |  Branch (6228:32): [True: 818, False: 1.72k]
  ------------------
 6229|  2.54k|            }
 6230|  41.4k|            else if (at_other[i].num_H != at_base[i].num_H)
  ------------------
  |  Branch (6230:22): [True: 539, False: 40.9k]
  ------------------
 6231|    539|            {
 6232|    539|                NumHfixed[i] = (NUM_H) at_other[i].num_H - (NUM_H) at_base[i].num_H + BASE_H_NUMBER;
  ------------------
  |  |   37|    539|#define BASE_H_NUMBER  ((INCHI_CANON_INFINITY-1)/2)
  |  |  ------------------
  |  |  |  |   31|    539|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
 6233|    539|            }
 6234|  40.9k|            else
 6235|  40.9k|            {
 6236|  40.9k|                NumHfixed[i] = EMPTY_H_NUMBER;
  ------------------
  |  |   36|  40.9k|#define EMPTY_H_NUMBER (INCHI_CANON_INFINITY-1)
  |  |  ------------------
  |  |  |  |   31|  40.9k|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
 6237|  40.9k|            }
 6238|  44.0k|        }
 6239|       |
 6240|       |        /* pointers */
 6241|  36.3k|        pCD[iOther].LinearCT = NULL; /* LinearCT; */
 6242|  36.3k|        pCD[iOther].NumH = numHNoTautH;
 6243|  36.3k|        pCD[iOther].NumHfixed = NumHfixed;/* variables - unchanged */
 6244|  36.3k|        pCD[iOther].iso_sort_key = NULL;
 6245|  36.3k|        pCD[iOther].iso_exchg_atnos = NULL;
 6246|       |
 6247|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6248|       |        pCD[iOther].iso_sort_key_Hfixed = NULL;
 6249|       |#endif
 6250|       |
 6251|  36.3k|        pCD[iOther].ulTimeOutTime = pBCN->ulTimeOutTime;
 6252|  36.3k|        pCD[iOther].nMaxLenLinearCT = s[iOther].nLenCTAtOnly + 1;
 6253|  36.3k|        pCD[iOther].maxlenNumH = maxlenNumHNoTautH;
 6254|  36.3k|        pCD[iOther].maxlenNumHfixed = maxlenNumHfixed;
 6255|       |        /* return values & input/output */
 6256|  36.3k|        pCD[iOther].nLenLinearCT = s[iOther].nLenCTAtOnly;
 6257|  36.3k|        pCD[iOther].nLenCTAtOnly = s[iOther].nLenCTAtOnly;
 6258|  36.3k|        pCD[iOther].lenNumH = num_atoms; /* djb-rwth: removing redundant code */
 6259|  36.3k|        pCD[iOther].lenNumHfixed = num_atoms;
 6260|  36.3k|        pCD[iOther].len_iso_sort_key = 0;
 6261|  36.3k|        pCD[iOther].maxlen_iso_sort_key = 0;
 6262|  36.3k|        pCD[iOther].len_iso_exchg_atnos = 0;
 6263|  36.3k|        pCD[iOther].maxlen_iso_exchg_atnos = 0;
 6264|       |
 6265|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6266|       |        pCD[iOther].len_iso_sort_key_Hfixed = 0;
 6267|       |        pCD[iOther].maxlen_iso_sort_key_Hfixed = 0;
 6268|       |#endif
 6269|       |
 6270|  36.3k|        pCD[iOther].nAuxRank = NULL;
 6271|       |
 6272|  36.3k|#if ( USE_AUX_RANKING == 1 )
 6273|  36.3k|        if (!nRankAux)
  ------------------
  |  Branch (6273:13): [True: 0, False: 36.3k]
  ------------------
 6274|      0|        {
 6275|      0|            nRankAux = (AT_RANK *) inchi_calloc( num_max, sizeof( nRankAux[0] ) );
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 6276|      0|        }
 6277|  36.3k|        if (!nAtomNumberAux)
  ------------------
  |  Branch (6277:13): [True: 0, False: 36.3k]
  ------------------
 6278|      0|        {
 6279|      0|            nAtomNumberAux = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumberAux[0] ) );
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 6280|      0|        }
 6281|  36.3k|        if (!pAtomInvariantAux)
  ------------------
  |  Branch (6281:13): [True: 0, False: 36.3k]
  ------------------
 6282|      0|        {
 6283|      0|            pAtomInvariantAux = (ATOM_INVARIANT2 *) inchi_malloc( num_max * sizeof( pAtomInvariantAux[0] ) );
  ------------------
  |  | 1143|      0|#define inchi_malloc   malloc
  ------------------
 6284|      0|        }
 6285|  36.3k|        if (!nRankAux || !nAtomNumberAux || !pAtomInvariantAux)
  ------------------
  |  Branch (6285:13): [True: 0, False: 36.3k]
  |  Branch (6285:26): [True: 0, False: 36.3k]
  |  Branch (6285:45): [True: 0, False: 36.3k]
  ------------------
 6286|      0|        {
 6287|      0|            goto exit_error_alloc;
 6288|      0|        }
 6289|       |
 6290|       |        /* refine no-H partition according to non-taut H distribution */
 6291|  36.3k|        memset( pAtomInvariantAux, 0, num_max * sizeof( pAtomInvariantAux[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 6292|  80.4k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (6292:21): [True: 44.0k, False: 36.3k]
  ------------------
 6293|  44.0k|        {
 6294|  44.0k|            pAtomInvariantAux[i].val[0] = nSymmRankBase[i];
 6295|  44.0k|            pAtomInvariantAux[i].val[1] = NumHfixed[i]; /* additional differentiation */
 6296|  44.0k|        }
 6297|       |
 6298|       |        /* initial ranks for t-group(s) */
 6299|  36.3k|        nNumCurrRanks = SetInitialRanks2( num_atoms, pAtomInvariantAux, nRankAux, nAtomNumberAux, pCG );
 6300|       |
 6301|       |        /* make equitable, digraph procedure */
 6302|  36.3k|        nNumCurrRanks = DifferentiateRanks2( pCG, num_atoms, NeighList[TAUT_NON],
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 6303|  36.3k|                                            nNumCurrRanks, nRankAux,
 6304|  36.3k|                                            nTempRank, nAtomNumberAux, &lCount, 0 /* 0 means use qsort */ ); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 6305|       |        /* to accelerate do not call CanonGraph() to find really equivalent atoms */
 6306|  36.3k|        pCD[iOther].nAuxRank = nRankAux;
 6307|  36.3k|#endif
 6308|       |
 6309|  36.3k|        ret = CanonGraph07( ic, pCG, num_atoms, num_atoms, num_max, 0,
  ------------------
  |  |  604|  36.3k|#define CanonGraph07 CanonGraph
  ------------------
 6310|  36.3k|                            NeighList[TAUT_NON], (Partition *) pBCN->pRankStack,
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 6311|  36.3k|                            nSymmRankFixH, nCanonRankFixH, nAtomNumberCanonFixH,
 6312|  36.3k|                            pCD + iOther, pCC, &Ct_NoTautH, &Ct_FixH, LargeMolecules );
 6313|  36.3k|        if (ret < 0)
  ------------------
  |  Branch (6313:13): [True: 0, False: 36.3k]
  ------------------
 6314|      0|        {
 6315|      0|            goto exit_error;
 6316|      0|        }
 6317|       |
 6318|       |        /*******************************************************************************************/
 6319|       |        /* get "fixed H" isotopic canonical numbering, connection table, and equivalence partition */
 6320|       |        /*******************************************************************************************/
 6321|  36.3k|        iflag = (s[iBase].num_isotopic_atoms && !s[iBase].bIgnoreIsotopic) ||
  ------------------
  |  Branch (6321:18): [True: 643, False: 35.7k]
  |  Branch (6321:49): [True: 643, False: 0]
  ------------------
 6322|  35.7k|            (s[iBase].bHasIsotopicTautGroups && !bTautIgnoreIsotopic); /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (6322:14): [True: 20, False: 35.7k]
  |  Branch (6322:49): [True: 20, False: 0]
  ------------------
 6323|  36.3k|        if (bFixIsoFixedH) /* #if ( FIX_ISO_FIXEDH_BUG == 1 )  */
  ------------------
  |  Branch (6323:13): [True: 36.3k, False: 0]
  ------------------
 6324|       |             /* fix bug when iso H was removed as a proton and fixed-H isotopic layer is missing -  2008-09-24 DT*/
 6325|  36.3k|        {
 6326|  36.3k|            iflag = iflag || (s[iOther].num_isotopic_atoms && !s[iOther].bIgnoreIsotopic); /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (6326:21): [True: 663, False: 35.7k]
  |  Branch (6326:31): [True: 4, False: 35.7k]
  |  Branch (6326:63): [True: 4, False: 0]
  ------------------
 6327|  36.3k|        }
 6328|  36.3k|        if (iflag)
  ------------------
  |  Branch (6328:13): [True: 667, False: 35.7k]
  ------------------
 6329|    667|        {
 6330|       |
 6331|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6332|       |            maxlen_iso_sort_key_Hfixed =
 6333|       |#endif
 6334|    667|            maxlen_iso_sort_key_NoTautH = num_atoms + 1;
 6335|    667|            nSymmRankFixHIso = (AT_RANK *) inchi_calloc( num_max, sizeof( nSymmRankFixHIso[0] ) );
  ------------------
  |  | 1146|    667|#define inchi_calloc   calloc
  ------------------
 6336|    667|            nCanonRankFixHIso = (AT_RANK *) inchi_calloc( num_max, sizeof( nCanonRankFixHIso[0] ) );
  ------------------
  |  | 1146|    667|#define inchi_calloc   calloc
  ------------------
 6337|    667|            nAtomNumberCanonFixHIso = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumberCanonFixHIso[0] ) );
  ------------------
  |  | 1146|    667|#define inchi_calloc   calloc
  ------------------
 6338|       |
 6339|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6340|       |            iso_sort_key_Hfixed = (AT_ISO_SORT_KEY *) inchi_calloc( maxlen_iso_sort_key_Hfixed, sizeof( iso_sort_key_Hfixed[0] ) );
 6341|       |#endif
 6342|       |
 6343|    667|            iso_sort_key_NoTautH = (AT_ISO_SORT_KEY *) inchi_calloc( maxlen_iso_sort_key_NoTautH, sizeof( iso_sort_key_NoTautH[0] ) );
  ------------------
  |  | 1146|    667|#define inchi_calloc   calloc
  ------------------
 6344|       |
 6345|    667|            if (!nSymmRankFixHIso || !nCanonRankFixHIso || !nAtomNumberCanonFixHIso ||
  ------------------
  |  Branch (6345:17): [True: 0, False: 667]
  |  Branch (6345:38): [True: 0, False: 667]
  |  Branch (6345:60): [True: 0, False: 667]
  ------------------
 6346|       |
 6347|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6348|       |                 !iso_sort_key_Hfixed ||
 6349|       |#endif
 6350|       |
 6351|    667|                 !iso_sort_key_NoTautH)
  ------------------
  |  Branch (6351:18): [True: 0, False: 667]
  ------------------
 6352|      0|            {
 6353|      0|                goto exit_error_alloc;
 6354|      0|            }
 6355|       |
 6356|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6357|       |            /* fill out isotopic non-tautomeric keys */
 6358|       |            for (i = 0; i < num_atoms; i++)
 6359|       |            {
 6360|       |                if (at_base[i].endpoint)
 6361|       |                {
 6362|       |                    iso_sort_key = make_iso_sort_key( at_base[i].iso_atw_diff, 0, 0, 0 );
 6363|       |                    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] );
 6364|       |                }
 6365|       |                else
 6366|       |                {
 6367|       |                    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] );
 6368|       |                    iso_sort_key2 = 0;
 6369|       |                }
 6370|       |                if (iso_sort_key)
 6371|       |                {
 6372|       |                    iso_sort_key_NoTautH[i] = iso_sort_key;
 6373|       |                    num_iso_NoTautH++;
 6374|       |                }
 6375|       |                else
 6376|       |                {
 6377|       |                    iso_sort_key_NoTautH[i] = EMPTY_ISO_SORT_KEY;
 6378|       |                }
 6379|       |                if (iso_sort_key2)
 6380|       |                {
 6381|       |                    num_iso_Hfixed++;
 6382|       |                    iso_sort_key_Hfixed[i] = iso_sort_key2;
 6383|       |                }
 6384|       |                else
 6385|       |                {
 6386|       |                    iso_sort_key_Hfixed[i] = EMPTY_ISO_SORT_KEY;
 6387|       |                }
 6388|       |            }
 6389|       |#else
 6390|       |            /* fill out isotopic non-tautomeric keys */
 6391|  1.99k|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (6391:25): [True: 1.32k, False: 667]
  ------------------
 6392|  1.32k|            {
 6393|       |
 6394|  1.32k|                if (bFixIsoFixedH) /* #if ( FIX_ISO_FIXEDH_BUG == 1 )  */
  ------------------
  |  Branch (6394:21): [True: 1.32k, False: 0]
  ------------------
 6395|  1.32k|                {
 6396|       |                    /* fix bug when iso H was removed as a proton and fixed-H isotopic layer is missing -  2008-09-24 DT*/
 6397|  1.32k|                    if (at_other)
  ------------------
  |  Branch (6397:25): [True: 1.32k, False: 0]
  ------------------
 6398|  1.32k|                    {
 6399|  1.32k|                        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] );
 6400|  1.32k|                    }
 6401|      0|                    else
 6402|      0|                    {
 6403|      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] );
 6404|      0|                    }
 6405|  1.32k|                }
 6406|      0|                else
 6407|      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] );
 6408|       |
 6409|  1.32k|                if (iso_sort_key)
  ------------------
  |  Branch (6409:21): [True: 675, False: 654]
  ------------------
 6410|    675|                {
 6411|    675|                    iso_sort_key_NoTautH[i] = iso_sort_key;
 6412|    675|                    num_iso_NoTautH++;
 6413|    675|                }
 6414|    654|                else
 6415|    654|                {
 6416|    654|                    iso_sort_key_NoTautH[i] = EMPTY_ISO_SORT_KEY;
  ------------------
  |  |   38|    654|#define EMPTY_ISO_SORT_KEY LONG_MAX
  ------------------
 6417|    654|                }
 6418|  1.32k|            }
 6419|    667|#endif
 6420|       |
 6421|       |            /* pointers */
 6422|    667|            pCD[iOther].LinearCT = NULL; /* LinearCT; */
 6423|    667|            pCD[iOther].NumH = numHNoTautH;
 6424|    667|            pCD[iOther].NumHfixed = NumHfixed;/* variables - unchanged */
 6425|    667|            pCD[iOther].iso_sort_key = iso_sort_key_NoTautH;
 6426|    667|            pCD[iOther].iso_exchg_atnos = NULL;
 6427|       |
 6428|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6429|       |            pCD[iOther].iso_sort_key_Hfixed = iso_sort_key_Hfixed;
 6430|       |#endif
 6431|       |
 6432|    667|            pCD[iOther].ulTimeOutTime = pBCN->ulTimeOutTime;
 6433|    667|            pCD[iOther].nMaxLenLinearCT = s[iOther].nLenCTAtOnly + 1;
 6434|    667|            pCD[iOther].maxlenNumH = maxlenNumHNoTautH;
 6435|    667|            pCD[iOther].maxlenNumHfixed = maxlenNumHfixed;
 6436|       |            /* return values & input/output */
 6437|    667|            pCD[iOther].nLenLinearCT = s[iOther].nLenCTAtOnly;
 6438|    667|            pCD[iOther].nLenCTAtOnly = s[iOther].nLenCTAtOnly;
 6439|    667|            pCD[iOther].lenNumH = num_atoms; /* djb-rwth: removing redundant code */
 6440|    667|            pCD[iOther].lenNumHfixed = num_atoms;
 6441|    667|            pCD[iOther].len_iso_sort_key = len_iso_sort_key_NoTautH = num_atoms;
 6442|    667|            pCD[iOther].maxlen_iso_sort_key = maxlen_iso_sort_key_NoTautH;
 6443|    667|            pCD[iOther].len_iso_exchg_atnos = 0;
 6444|    667|            pCD[iOther].maxlen_iso_exchg_atnos = 0;
 6445|       |
 6446|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6447|       |            pCD[iOther].len_iso_sort_key_Hfixed = len_iso_sort_key_Hfixed = num_atoms;
 6448|       |            pCD[iOther].maxlen_iso_sort_key_Hfixed = maxlen_iso_sort_key_Hfixed;
 6449|       |#endif
 6450|       |
 6451|    667|            pCD[iOther].nAuxRank = NULL;
 6452|       |
 6453|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6454|       |            if (num_iso_Hfixed || num_iso_NoTautH)
 6455|       |#else
 6456|    667|            if (num_iso_NoTautH)
  ------------------
  |  Branch (6456:17): [True: 666, False: 1]
  ------------------
 6457|    666|#endif
 6458|       |
 6459|    666|            {
 6460|       |                /* check whether we need NoTautH cononicalization */
 6461|    666|                memset( nTempRank, 0, num_max * sizeof( nTempRank[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 6462|  1.99k|                for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (6462:29): [True: 1.32k, False: 666]
  ------------------
 6463|  1.32k|                {
 6464|  1.32k|                    if (nTempRank[nSymmRankFixH[i] - 1] < i)
  ------------------
  |  Branch (6464:25): [True: 661, False: 666]
  ------------------
 6465|    661|                    {
 6466|    661|                        nTempRank[nSymmRankFixH[i] - 1] = i; /* greatest class representative */
 6467|    661|                    }
 6468|  1.32k|                }
 6469|  1.63k|                for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (6469:29): [True: 1.00k, False: 629]
  ------------------
 6470|  1.00k|                {
 6471|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6472|       |                    if (iso_sort_key_Hfixed[i] != iso_sort_key_Hfixed[nTempRank[nSymmRankFixH[i] - 1]])
 6473|       |                        break;
 6474|       |#endif
 6475|  1.00k|                    if (iso_sort_key_NoTautH[i] != iso_sort_key_NoTautH[nTempRank[nSymmRankFixH[i] - 1]])
  ------------------
  |  Branch (6475:25): [True: 37, False: 964]
  ------------------
 6476|     37|                        break; /* atoms so far found to be equivalent have different isotopic shifts; the canonicalization is needed */
 6477|  1.00k|                }
 6478|    666|            }
 6479|      1|            else
 6480|      1|            {
 6481|      1|                i = num_atoms; /* should not happen */
 6482|      1|            }
 6483|       |
 6484|       |            /* i = 0; *//* debug: force to call the canonicalization */
 6485|       |
 6486|    667|            if (i < num_atoms)
  ------------------
  |  Branch (6486:17): [True: 37, False: 630]
  ------------------
 6487|     37|            {
 6488|     37|                pCD[iOther].nCanonFlags |= CANON_FLAG_ISO_FIXED_H_DIFF;
  ------------------
  |  |  210|     37|#define CANON_FLAG_ISO_FIXED_H_DIFF       0x0010  /* iOther: isotopic eq. partition in fixed H non-taut differs from non-isotopic fixed H */
  ------------------
 6489|       |                /* we need canonicalization */
 6490|       |                /* get aux canonical ranking of the structure with isotopic non-tautomeric H */
 6491|       |
 6492|     37|#if ( USE_AUX_RANKING == 1 )
 6493|       |                /* refine fixed-taut-H partition according to the isotopic distribution */
 6494|     37|                memset( pAtomInvariantAux, 0, num_max * sizeof( pAtomInvariantAux[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 6495|    458|                for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (6495:29): [True: 421, False: 37]
  ------------------
 6496|    421|                {
 6497|    421|                    pAtomInvariantAux[i].val[0] = nSymmRankFixH[i];
 6498|       |
 6499|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6500|       |                    iso_sort_key = 0;
 6501|       |                    if (iso_sort_key_NoTautH[i] != EMPTY_ISO_SORT_KEY)
 6502|       |                        iso_sort_key |= iso_sort_key_NoTautH[i];
 6503|       |                    if (iso_sort_key_Hfixed[i] != EMPTY_ISO_SORT_KEY)
 6504|       |                        iso_sort_key |= iso_sort_key_Hfixed[i];
 6505|       |                    if (!iso_sort_key)
 6506|       |                        iso_sort_key = EMPTY_ISO_SORT_KEY;
 6507|       |#else
 6508|    421|                    iso_sort_key = iso_sort_key_NoTautH[i];
 6509|    421|#endif
 6510|       |
 6511|    421|                    pAtomInvariantAux[i].iso_sort_key = iso_sort_key; /* additional differentiation */
 6512|    421|                }
 6513|       |
 6514|       |                /* initial ranks for non-taut H isotopic distribution */
 6515|     37|                nNumCurrRanks = SetInitialRanks2( num_atoms, pAtomInvariantAux, nRankAux, nAtomNumberAux, pCG );
 6516|       |                /* make equitable, digraph procedure */
 6517|     37|                nNumCurrRanks = DifferentiateRanks2( pCG, num_atoms, NeighList[TAUT_NON],
  ------------------
  |  |  574|     37|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 6518|     37|                                                    nNumCurrRanks, nRankAux,
 6519|     37|                                                    nTempRank, nAtomNumberAux, &lCount, 0 /* 0 means use qsort */ ); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 6520|       |
 6521|       |                /* to accelerate do not call CanonGraph() to find really equivalent atoms */
 6522|     37|                pCD[iOther].nAuxRank = nRankAux;
 6523|     37|#endif
 6524|       |
 6525|     37|                ret = CanonGraph08( ic, pCG, num_atoms, num_atoms, num_max, 1 /* digraph?? was 0 */,
  ------------------
  |  |  605|     37|#define CanonGraph08 CanonGraph
  ------------------
 6526|     37|                                    NeighList[TAUT_NON], (Partition *) pBCN->pRankStack,
  ------------------
  |  |  574|     37|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 6527|     37|                                    nSymmRankFixHIso, nCanonRankFixHIso, nAtomNumberCanonFixHIso,
 6528|     37|                                    pCD + iOther, pCC, &Ct_FixH, &Ct_FixHIso, LargeMolecules );
 6529|     37|                if (ret < 0)
  ------------------
  |  Branch (6529:21): [True: 0, False: 37]
  ------------------
 6530|      0|                {
 6531|      0|                    goto exit_error;
 6532|      0|                }
 6533|       |                /* in case of non-tautomeric structure the final results are in:
 6534|       |
 6535|       |                           nSymmRankFixHIso
 6536|       |                           nCanonRankFixHIso
 6537|       |                           nAtomNumberCanonFixHIso
 6538|       |                           Ct_FixHIso
 6539|       |                           iso_sort_keyBase     ([0..num_atoms] original isotopic atom positions)
 6540|       |                           iso_sort_key_Hfixed  (original fixed tautomeric H distribution)
 6541|       |                */
 6542|     37|            }
 6543|    630|            else
 6544|    630|            {
 6545|       |                /* copy the results of the previous (no taut H) canonicalization */
 6546|       |                /* in this case numHNoTautH[] is not needed for the next canonicalization(s) */
 6547|    630|                if (( Ct_Temp = (ConTable *) inchi_calloc( 1, sizeof( *Ct_Temp ) ) ) &&
  ------------------
  |  | 1146|    630|#define inchi_calloc   calloc
  ------------------
  |  Branch (6547:21): [True: 630, False: 0]
  ------------------
 6548|    630|                     CTableCreate( Ct_Temp, num_atoms, pCD + iOther ))
  ------------------
  |  Branch (6548:22): [True: 630, False: 0]
  ------------------
 6549|    630|                {
 6550|    630|                    CtFullCopy( Ct_Temp, Ct_FixH );
 6551|       |                    /* since Ct_FixH does not have Ct_FixH->iso_sort_key and Ct_FixH->iso_sort_key_Hfixed we
 6552|       |                       have to fill out Ct_Temp->iso_sort_key and Ct_Temp->iso_sort_key_Hfixed separately */
 6553|  1.53k|                    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (6553:33): [True: 908, False: 630]
  ------------------
 6554|    908|                    {
 6555|    908|                        Ct_Temp->iso_sort_key[nCanonRankFixH[i] - 1] = iso_sort_key_NoTautH[i];
 6556|       |
 6557|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6558|       |                        Ct_Temp->iso_sort_key_Hfixed[nCanonRankFixH[i] - 1] = iso_sort_key_Hfixed[i];
 6559|       |#endif
 6560|    908|                    }
 6561|    630|                    Ct_Temp->len_iso_sort_key = num_atoms;
 6562|       |
 6563|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6564|       |                    Ct_Temp->len_iso_sort_key_Hfixed = num_atoms;
 6565|       |#endif
 6566|       |
 6567|       |                    /*Ct_Temp->lenNumH = num_atoms;*/
 6568|    630|                }
 6569|      0|                else
 6570|      0|                {
 6571|      0|                    goto exit_error_alloc;
 6572|      0|                }
 6573|    630|                Ct_FixHIso = Ct_Temp;
 6574|    630|                Ct_Temp = NULL;
 6575|    630|                memcpy(nSymmRankFixHIso, nSymmRankFixH, num_atoms * sizeof(nSymmRankFixHIso[0]));
 6576|    630|                memcpy(nCanonRankFixHIso, nCanonRankFixH, num_atoms * sizeof(nCanonRankFixHIso[0]));
 6577|    630|                memcpy(nAtomNumberCanonFixHIso, nAtomNumberCanonFixH, num_atoms * sizeof(nAtomNumberCanonFixHIso[0]));
 6578|    630|            }
 6579|       |            /* in case of non-tautomeric component this is the final result */
 6580|       |            /* i = CtFullCompare( Ct_NoTautHIso, Ct_Temp, num_atoms, 0, 0 );*/
 6581|    667|        }
 6582|  36.3k|    } /* "fixed H" canonical numbering */
 6583|       |
 6584|       |
 6585|       |    /* consistency check: compare canonical connection tables, H-atoms, isotopic H & taut groups */
 6586|   252k|    ret = 0;
 6587|   252k|    ret |= ( Ct_NoH->lenCt != Ct_NoTautH->lenCt ) || memcmp( Ct_NoH->Ctbl, Ct_NoTautH->Ctbl, Ct_NoH->lenCt * sizeof( Ct_NoH->Ctbl[0] ) );
  ------------------
  |  Branch (6587:12): [True: 0, False: 252k]
  |  Branch (6587:54): [True: 0, False: 252k]
  ------------------
 6588|   252k|    if (bReqTaut)
  ------------------
  |  Branch (6588:9): [True: 40.8k, False: 211k]
  ------------------
 6589|  40.8k|    {
 6590|  40.8k|        if (Ct_FixH)
  ------------------
  |  Branch (6590:13): [True: 36.3k, False: 4.50k]
  ------------------
 6591|  36.3k|        {
 6592|  36.3k|            ret |= ( Ct_NoTautH->lenCt != Ct_FixH->lenCt ) || memcmp( Ct_NoTautH->Ctbl, Ct_FixH->Ctbl, Ct_NoTautH->lenCt * sizeof( Ct_NoTautH->Ctbl[0] ) );
  ------------------
  |  Branch (6592:20): [True: 0, False: 36.3k]
  |  Branch (6592:63): [True: 0, False: 36.3k]
  ------------------
 6593|  36.3k|            ret |= ( Ct_NoTautH->lenNumH != Ct_FixH->lenNumH ) || memcmp( Ct_NoTautH->NumH, Ct_FixH->NumH, Ct_NoTautH->lenNumH * sizeof( Ct_Base->NumH[0] ) );
  ------------------
  |  Branch (6593:20): [True: 0, False: 36.3k]
  |  Branch (6593:67): [True: 0, False: 36.3k]
  ------------------
 6594|  36.3k|        }
 6595|  40.8k|        ret |= ( Ct_NoTautH->lenCt > Ct_Base->lenCt ) || memcmp( Ct_NoTautH->Ctbl, Ct_Base->Ctbl, Ct_NoTautH->lenCt * sizeof( Ct_NoTautH->Ctbl[0] ) );
  ------------------
  |  Branch (6595:16): [True: 0, False: 40.8k]
  |  Branch (6595:58): [True: 0, False: 40.8k]
  ------------------
 6596|  40.8k|        ret |= ( Ct_NoTautH->lenNumH > Ct_Base->lenNumH ) || memcmp( Ct_NoTautH->NumH, Ct_Base->NumH, Ct_NoTautH->lenNumH * sizeof( Ct_Base->NumH[0] ) );
  ------------------
  |  Branch (6596:16): [True: 0, False: 40.8k]
  |  Branch (6596:62): [True: 0, False: 40.8k]
  ------------------
 6597|  40.8k|    }
 6598|       |
 6599|       |    /* isotopic canonicalization */
 6600|   252k|    if (Ct_NoTautHIso)
  ------------------
  |  Branch (6600:9): [True: 594, False: 251k]
  ------------------
 6601|    594|    {
 6602|    594|        ret |= ( Ct_NoH->lenCt != Ct_NoTautHIso->lenCt ) || memcmp( Ct_NoH->Ctbl, Ct_NoTautHIso->Ctbl, Ct_NoH->lenCt * sizeof( Ct_NoH->Ctbl[0] ) );
  ------------------
  |  Branch (6602:16): [True: 0, False: 594]
  |  Branch (6602:61): [True: 0, False: 594]
  ------------------
 6603|    594|        ret |= ( Ct_NoTautH->lenNumH != Ct_NoTautHIso->lenNumH ) || memcmp( Ct_NoTautH->NumH, Ct_NoTautHIso->NumH, Ct_NoTautH->lenNumH * sizeof( Ct_Base->NumH[0] ) );
  ------------------
  |  Branch (6603:16): [True: 0, False: 594]
  |  Branch (6603:69): [True: 0, False: 594]
  ------------------
 6604|    594|    }
 6605|   251k|    else if (Ct_BaseIso)
  ------------------
  |  Branch (6605:14): [True: 861, False: 250k]
  ------------------
 6606|    861|    {
 6607|    861|        ret |= ( Ct_BaseIso->lenCt != Ct_Base->lenCt ) || memcmp( Ct_BaseIso->Ctbl, Ct_Base->Ctbl, Ct_BaseIso->lenCt * sizeof( Ct_BaseIso->Ctbl[0] ) );
  ------------------
  |  Branch (6607:16): [True: 0, False: 861]
  |  Branch (6607:59): [True: 0, False: 861]
  ------------------
 6608|    861|        ret |= ( Ct_BaseIso->lenNumH != Ct_Base->lenNumH ) || memcmp( Ct_BaseIso->NumH, Ct_Base->NumH, Ct_BaseIso->lenNumH * sizeof( Ct_BaseIso->NumH[0] ) );
  ------------------
  |  Branch (6608:16): [True: 0, False: 861]
  |  Branch (6608:63): [True: 0, False: 861]
  ------------------
 6609|    861|        if (Ct_FixHIso)
  ------------------
  |  Branch (6609:13): [True: 655, False: 206]
  ------------------
 6610|    655|        {
 6611|    655|            ret |= ( Ct_FixHIso->lenCt > Ct_BaseIso->lenCt ) || memcmp( Ct_FixHIso->Ctbl, Ct_BaseIso->Ctbl, Ct_FixHIso->lenCt * sizeof( Ct_FixHIso->Ctbl[0] ) );
  ------------------
  |  Branch (6611:20): [True: 0, False: 655]
  |  Branch (6611:65): [True: 0, False: 655]
  ------------------
 6612|    655|            ret |= ( Ct_FixHIso->lenNumH > Ct_BaseIso->lenNumH ) || memcmp( Ct_FixHIso->NumH, Ct_BaseIso->NumH, Ct_FixHIso->lenNumH * sizeof( Ct_BaseIso->NumH[0] ) );
  ------------------
  |  Branch (6612:20): [True: 0, False: 655]
  |  Branch (6612:69): [True: 0, False: 655]
  ------------------
 6613|    655|        }
 6614|    861|    }
 6615|       |
 6616|   252k|    if (ret)
  ------------------
  |  Branch (6616:9): [True: 0, False: 252k]
  ------------------
 6617|      0|    {
 6618|      0|        goto exit_error;
 6619|      0|    }
 6620|       |
 6621|   252k|    if (bReqTaut)
  ------------------
  |  Branch (6621:9): [True: 40.8k, False: 211k]
  ------------------
 6622|  40.8k|    {
 6623|       |        /* restore save "process isotopic" mark; temporarily set it to NO */
 6624|  40.8k|        t_group_info->bIgnoreIsotopic = bTautIgnoreIsotopic;
 6625|  40.8k|    }
 6626|       |
 6627|       |
 6628|       |    /* output the canonicalization results */
 6629|   252k|    pBCN->num_max = num_max;
 6630|   252k|    pBCN->num_at_tg = num_at_tg;
 6631|   252k|    pBCN->num_atoms = num_atoms;
 6632|       |
 6633|   252k|    pBCN->ftcn[TAUT_NON].NeighList = NeighList[TAUT_NON]; NeighList[TAUT_NON] = NULL;
  ------------------
  |  |  574|   252k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  pBCN->ftcn[TAUT_NON].NeighList = NeighList[TAUT_NON]; NeighList[TAUT_NON] = NULL;
  ------------------
  |  |  574|   252k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  pBCN->ftcn[TAUT_NON].NeighList = NeighList[TAUT_NON]; NeighList[TAUT_NON] = NULL;
  ------------------
  |  |  574|   252k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 6634|   252k|    pBCN->ftcn[TAUT_YES].NeighList = NeighList[TAUT_YES]; NeighList[TAUT_YES] = NULL;
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  pBCN->ftcn[TAUT_YES].NeighList = NeighList[TAUT_YES]; NeighList[TAUT_YES] = NULL;
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  pBCN->ftcn[TAUT_YES].NeighList = NeighList[TAUT_YES]; NeighList[TAUT_YES] = NULL;
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6635|       |
 6636|   252k|    if (bReqTaut)
  ------------------
  |  Branch (6636:9): [True: 40.8k, False: 211k]
  ------------------
 6637|  40.8k|    {
 6638|       |        /* tautomeric results */
 6639|       |
 6640|       |        /* base tautomeric structure, iBase = TAUT_YES */
 6641|       |
 6642|  40.8k|        pBCN->ftcn[TAUT_YES].num_at_tg = num_at_tg;
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6643|  40.8k|        pBCN->ftcn[TAUT_YES].num_atoms = num_atoms;
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6644|       |
 6645|  40.8k|        pBCN->ftcn[TAUT_YES].LinearCt = Ct_Base->Ctbl;            Ct_Base->Ctbl = NULL;
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6646|  40.8k|        pBCN->ftcn[TAUT_YES].nLenLinearCtAtOnly = s[iBase].nLenCTAtOnly;
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6647|  40.8k|        pBCN->ftcn[TAUT_YES].nMaxLenLinearCt = s[iBase].nLenCT + 1;
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6648|  40.8k|        pBCN->ftcn[TAUT_YES].nLenLinearCt = s[iBase].nLenCT;
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6649|       |
 6650|  40.8k|        pBCN->ftcn[TAUT_YES].PartitionCt.Rank = nCanonRankBase;        nCanonRankBase = NULL;
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6651|  40.8k|        pBCN->ftcn[TAUT_YES].PartitionCt.AtNumber = nAtomNumberCanonBase;  nAtomNumberCanonBase = NULL;
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6652|  40.8k|        pBCN->ftcn[TAUT_YES].nSymmRankCt = nSymmRankBase;         nSymmRankBase = NULL;
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6653|       |
 6654|  40.8k|        pBCN->ftcn[TAUT_YES].nNumHOrig = numH;                 numH = NULL;
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6655|  40.8k|        pBCN->ftcn[TAUT_YES].nNumH = Ct_Base->NumH;        Ct_Base->NumH = NULL;
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6656|  40.8k|        pBCN->ftcn[TAUT_YES].nLenNumH = inchi_min( maxlenNumH, Ct_Base->maxlenNumH );
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      pBCN->ftcn[TAUT_YES].nLenNumH = inchi_min( maxlenNumH, Ct_Base->maxlenNumH );
  ------------------
  |  |  139|  40.8k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 40.8k, False: 0]
  |  |  ------------------
  ------------------
 6657|       |
 6658|       |        /* fixed H structure: exists only if the structure is tautomeric */
 6659|  40.8k|        pBCN->ftcn[TAUT_YES].nNumHOrigFixH = NULL;
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6660|  40.8k|        pBCN->ftcn[TAUT_YES].nNumHFixH = NULL;
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6661|  40.8k|        pBCN->ftcn[TAUT_YES].nLenNumHFixH = 0;
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6662|  40.8k|        pBCN->ftcn[TAUT_YES].nCanonFlags |= pCD[iBase].nCanonFlags;
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6663|       |
 6664|  40.8k|        CleanNumH( pBCN->ftcn[TAUT_YES].nNumHOrig, pBCN->ftcn[TAUT_YES].nLenNumH );
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      CleanNumH( pBCN->ftcn[TAUT_YES].nNumHOrig, pBCN->ftcn[TAUT_YES].nLenNumH );
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6665|  40.8k|        CleanNumH( pBCN->ftcn[TAUT_YES].nNumH, pBCN->ftcn[TAUT_YES].nLenNumH );
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      CleanNumH( pBCN->ftcn[TAUT_YES].nNumH, pBCN->ftcn[TAUT_YES].nLenNumH );
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6666|  40.8k|        CleanCt( pBCN->ftcn[TAUT_YES].LinearCt, pBCN->ftcn[TAUT_YES].nLenLinearCt );
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      CleanCt( pBCN->ftcn[TAUT_YES].LinearCt, pBCN->ftcn[TAUT_YES].nLenLinearCt );
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6667|       |
 6668|       |        /* isotopic canonicalization */
 6669|  40.8k|        if (Ct_BaseIso)
  ------------------
  |  Branch (6669:13): [True: 861, False: 40.0k]
  ------------------
 6670|    861|        {
 6671|    861|            pBCN->ftcn[TAUT_YES].PartitionCtIso.Rank = nCanonRankBaseIso;           nCanonRankBaseIso = NULL;
  ------------------
  |  |  575|    861|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6672|    861|            pBCN->ftcn[TAUT_YES].PartitionCtIso.AtNumber = nAtomNumberCanonBaseIso;     nAtomNumberCanonBaseIso = NULL;
  ------------------
  |  |  575|    861|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6673|    861|            pBCN->ftcn[TAUT_YES].nSymmRankCtIso = nSymmRankBaseIso;            nSymmRankBaseIso = NULL;
  ------------------
  |  |  575|    861|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6674|    861|            pBCN->ftcn[TAUT_YES].iso_sort_keys = Ct_BaseIso->iso_sort_key;    Ct_BaseIso->iso_sort_key = NULL;
  ------------------
  |  |  575|    861|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6675|    861|            pBCN->ftcn[TAUT_YES].iso_sort_keysOrig = iso_sort_keyBase;            iso_sort_keyBase = NULL;
  ------------------
  |  |  575|    861|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6676|    861|            pBCN->ftcn[TAUT_YES].len_iso_sort_keys = len_iso_sort_keyBase;
  ------------------
  |  |  575|    861|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6677|    861|            pBCN->ftcn[TAUT_YES].iso_exchg_atnos = Ct_BaseIso->iso_exchg_atnos; Ct_BaseIso->iso_exchg_atnos = NULL;
  ------------------
  |  |  575|    861|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6678|    861|            pBCN->ftcn[TAUT_YES].iso_exchg_atnosOrig = iso_exchg_atnos;             iso_exchg_atnos = NULL;
  ------------------
  |  |  575|    861|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6679|       |
 6680|    861|            CleanIsoSortKeys( pBCN->ftcn[TAUT_YES].iso_sort_keys, pBCN->ftcn[TAUT_YES].len_iso_sort_keys );
  ------------------
  |  |  575|    861|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          CleanIsoSortKeys( pBCN->ftcn[TAUT_YES].iso_sort_keys, pBCN->ftcn[TAUT_YES].len_iso_sort_keys );
  ------------------
  |  |  575|    861|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6681|    861|            CleanIsoSortKeys( pBCN->ftcn[TAUT_YES].iso_sort_keysOrig, pBCN->ftcn[TAUT_YES].len_iso_sort_keys );
  ------------------
  |  |  575|    861|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          CleanIsoSortKeys( pBCN->ftcn[TAUT_YES].iso_sort_keysOrig, pBCN->ftcn[TAUT_YES].len_iso_sort_keys );
  ------------------
  |  |  575|    861|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6682|    861|        }
 6683|  40.8k|    } /* tautomeric results */
 6684|       |
 6685|       |
 6686|   252k|    if (bReqNonTaut)
  ------------------
  |  Branch (6686:9): [True: 247k, False: 4.50k]
  ------------------
 6687|   247k|    {
 6688|       |        /* non-tautomeric results */
 6689|       |
 6690|       |        /* TAUT_NON if tautomeric + non-tautomeric or special non-taut request
 6691|       |           TAUT_YES if the structure happened to be non-tautomeric while user requested tautomeric processing
 6692|       |           In both cases the correct index is iOther. TAUT_NON replaced with iOther 4-2-2004 */
 6693|       |
 6694|   247k|        if (!bReqTaut)
  ------------------
  |  Branch (6694:13): [True: 211k, False: 36.3k]
  ------------------
 6695|   211k|        {
 6696|       |            /* rearrange the results for a non-tautomeric structure */
 6697|   211k|            nSymmRankFixH = nSymmRankNoTautH;           nSymmRankNoTautH = NULL;
 6698|   211k|            nCanonRankFixH = nCanonRankNoTautH;          nCanonRankNoTautH = NULL;
 6699|   211k|            nAtomNumberCanonFixH = nAtomNumberCanonNoTautH;    nAtomNumberCanonNoTautH = NULL;
 6700|   211k|            Ct_FixH = Ct_NoTautH;                 Ct_NoTautH = NULL;
 6701|       |            /* isotopic canonicalization */
 6702|   211k|            nSymmRankFixHIso = nSymmRankNoTautHIso;        nSymmRankNoTautHIso = NULL;
 6703|   211k|            nCanonRankFixHIso = nCanonRankNoTautHIso;       nCanonRankNoTautHIso = NULL;
 6704|   211k|            nAtomNumberCanonFixHIso = nAtomNumberCanonNoTautHIso; nAtomNumberCanonNoTautHIso = NULL;
 6705|   211k|            Ct_FixHIso = Ct_NoTautHIso;              Ct_NoTautHIso = NULL;
 6706|       |
 6707|   211k|            if (iOther == TAUT_YES && pBCN->ftcn[TAUT_NON].NeighList && !pBCN->ftcn[TAUT_YES].NeighList)
  ------------------
  |  |  575|   422k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          if (iOther == TAUT_YES && pBCN->ftcn[TAUT_NON].NeighList && !pBCN->ftcn[TAUT_YES].NeighList)
  ------------------
  |  |  574|   211k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                          if (iOther == TAUT_YES && pBCN->ftcn[TAUT_NON].NeighList && !pBCN->ftcn[TAUT_YES].NeighList)
  ------------------
  |  |  575|   211k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (6707:17): [True: 211k, False: 0]
  |  Branch (6707:39): [True: 211k, False: 0]
  |  Branch (6707:73): [True: 211k, False: 0]
  ------------------
 6708|   211k|            {
 6709|       |                /* here only non-taut results go to pBCN->ftcn[TAUT_YES]
 6710|       |                   Since non-taut NeighList is always in pBCN->ftcn[TAUT_NON].NeighList, move it to
 6711|       |                   pBCN->ftcn[TAUT_YES].NeighList. 2004-04-02.
 6712|       |                */
 6713|   211k|                pBCN->ftcn[TAUT_YES].NeighList = pBCN->ftcn[TAUT_NON].NeighList;
  ------------------
  |  |  575|   211k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              pBCN->ftcn[TAUT_YES].NeighList = pBCN->ftcn[TAUT_NON].NeighList;
  ------------------
  |  |  574|   211k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 6714|   211k|                pBCN->ftcn[TAUT_NON].NeighList = NULL;
  ------------------
  |  |  574|   211k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 6715|   211k|            }
 6716|   211k|        }
 6717|       |
 6718|   247k|        pBCN->ftcn[iOther].num_at_tg = num_atoms;
 6719|   247k|        pBCN->ftcn[iOther].num_atoms = num_atoms;
 6720|       |
 6721|   247k|        pBCN->ftcn[iOther].LinearCt = Ct_FixH->Ctbl;
 6722|   247k|        Ct_FixH->Ctbl = NULL;
 6723|   247k|        pBCN->ftcn[iOther].nLenLinearCtAtOnly = s[iOther].nLenCTAtOnly;
 6724|   247k|        pBCN->ftcn[iOther].nMaxLenLinearCt = s[iOther].nLenCTAtOnly + 1;
 6725|   247k|        pBCN->ftcn[iOther].nLenLinearCt = s[iOther].nLenCTAtOnly;
 6726|       |
 6727|   247k|        pBCN->ftcn[iOther].PartitionCt.Rank = nCanonRankFixH;
 6728|   247k|        nCanonRankFixH = NULL;
 6729|   247k|        pBCN->ftcn[iOther].PartitionCt.AtNumber = nAtomNumberCanonFixH;
 6730|   247k|        nAtomNumberCanonFixH = NULL;
 6731|   247k|        pBCN->ftcn[iOther].nSymmRankCt = nSymmRankFixH;
 6732|   247k|        nSymmRankFixH = NULL;
 6733|       |
 6734|   247k|        pBCN->ftcn[iOther].nNumHOrig = numHNoTautH;
 6735|   247k|        numHNoTautH = NULL;
 6736|   247k|        pBCN->ftcn[iOther].nNumH = Ct_FixH->NumH;
 6737|   247k|        Ct_FixH->NumH = NULL;
 6738|   247k|        pBCN->ftcn[iOther].nLenNumH = inchi_min( maxlenNumHNoTautH, Ct_FixH->maxlenNumH );
  ------------------
  |  |  139|   247k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 247k, False: 0]
  |  |  ------------------
  ------------------
 6739|       |
 6740|       |        /* fixed H structure: exists only if the structure is tautomeric */
 6741|   247k|        pBCN->ftcn[iOther].nNumHOrigFixH = NumHfixed;
 6742|   247k|        NumHfixed = NULL;
 6743|   247k|        pBCN->ftcn[iOther].nNumHFixH = Ct_FixH->NumHfixed;
 6744|   247k|        Ct_FixH->NumHfixed = NULL;
 6745|   247k|        pBCN->ftcn[iOther].nLenNumHFixH = num_atoms;
 6746|   247k|        pBCN->ftcn[iOther].nCanonFlags |= pCD[iOther].nCanonFlags;
 6747|       |
 6748|       |        /* original H */
 6749|   247k|        CleanNumH( pBCN->ftcn[iOther].nNumHOrig, pBCN->ftcn[iOther].nLenNumH );
 6750|   247k|        CleanNumH( pBCN->ftcn[iOther].nNumHOrigFixH, pBCN->ftcn[iOther].nLenNumH );
 6751|       |        /* canonical H positions */
 6752|   247k|        CleanNumH( pBCN->ftcn[iOther].nNumH, pBCN->ftcn[iOther].nLenNumH );
 6753|   247k|        CleanNumH( pBCN->ftcn[iOther].nNumHFixH, pBCN->ftcn[iOther].nLenNumH );
 6754|       |
 6755|       |        /* connection table */
 6756|   247k|        CleanCt( pBCN->ftcn[iOther].LinearCt, pBCN->ftcn[iOther].nLenLinearCt );
 6757|       |
 6758|       |       /* isotopic canonicalization */
 6759|   247k|        if (Ct_FixHIso)
  ------------------
  |  Branch (6759:13): [True: 1.26k, False: 246k]
  ------------------
 6760|  1.26k|        {
 6761|  1.26k|            pBCN->ftcn[iOther].PartitionCtIso.Rank = nCanonRankFixHIso;        nCanonRankFixHIso = NULL;
 6762|  1.26k|            pBCN->ftcn[iOther].PartitionCtIso.AtNumber = nAtomNumberCanonFixHIso;  nAtomNumberCanonFixHIso = NULL;
 6763|  1.26k|            pBCN->ftcn[iOther].nSymmRankCtIso = nSymmRankFixHIso;         nSymmRankFixHIso = NULL;
 6764|  1.26k|            pBCN->ftcn[iOther].iso_sort_keys = Ct_FixHIso->iso_sort_key; Ct_FixHIso->iso_sort_key = NULL;
 6765|  1.26k|            pBCN->ftcn[iOther].iso_sort_keysOrig = iso_sort_key_NoTautH;     iso_sort_key_NoTautH = NULL;
 6766|  1.26k|            pBCN->ftcn[iOther].len_iso_sort_keys = len_iso_sort_key_NoTautH;
 6767|       |
 6768|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6769|       |            MergeCleanIsoSortKeys( pBCN->ftcn[iOther].iso_sort_keys, Ct_FixHIso->iso_sort_key_Hfixed, pBCN->ftcn[iOther].len_iso_sort_keys );
 6770|       |            MergeCleanIsoSortKeys( pBCN->ftcn[iOther].iso_sort_keysOrig, iso_sort_key_Hfixed, pBCN->ftcn[iOther].len_iso_sort_keys );
 6771|       |#else
 6772|  1.26k|            CleanIsoSortKeys( pBCN->ftcn[iOther].iso_sort_keys, pBCN->ftcn[iOther].len_iso_sort_keys );
 6773|  1.26k|            CleanIsoSortKeys( pBCN->ftcn[iOther].iso_sort_keysOrig, pBCN->ftcn[iOther].len_iso_sort_keys );
 6774|  1.26k|#endif
 6775|  1.26k|        }
 6776|   247k|    }  /* non-tautomeric results */
 6777|       |
 6778|   252k|    goto exit_function;
 6779|       |
 6780|       |
 6781|      0|exit_error_alloc:
 6782|      0|    ret = CT_OUT_OF_RAM;
  ------------------
  |  |   21|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 6783|      0|    goto exit_function;
 6784|       |
 6785|      0|exit_error:
 6786|      0|    if (!RETURNED_ERROR( ret ))
  ------------------
  |  |   44|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 0, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 6787|      0|    {
 6788|      0|        ret = CT_CANON_ERR;
  ------------------
  |  |   35|      0|#define CT_CANON_ERR         (CT_ERR_FIRST-16)  /*(-30016) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 6789|      0|    }
 6790|      0|    goto exit_function;
 6791|       |
 6792|       |
 6793|   252k|exit_function:
 6794|       |
 6795|   252k|#define FREE_CONTABLE( X) if (X) {CTableFree( X);inchi_free( X);}
 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
 6797|       |
 6798|   252k|    FreeNeighList( NeighList[TAUT_NON] );
  ------------------
  |  |  574|   252k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 6799|   252k|    FreeNeighList( NeighList[TAUT_YES] );
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6800|       |
 6801|   252k|    FREE_CONTABLE( Ct_NoH )
  ------------------
  |  | 6795|   252k|#define FREE_CONTABLE( X) if (X) {CTableFree( X);inchi_free( X);}
  |  |  ------------------
  |  |  |  | 1152|   252k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 252k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 252k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6795:31): [True: 252k, False: 0]
  |  |  ------------------
  ------------------
 6802|   252k|        FREE_CONTABLE( Ct_NoTautH )
  ------------------
  |  | 6795|   252k|#define FREE_CONTABLE( X) if (X) {CTableFree( X);inchi_free( X);}
  |  |  ------------------
  |  |  |  | 1152|  40.8k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 40.8k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 40.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6795:31): [True: 40.8k, False: 211k]
  |  |  ------------------
  ------------------
 6803|   252k|        FREE_CONTABLE( Ct_Base )
  ------------------
  |  | 6795|   252k|#define FREE_CONTABLE( X) if (X) {CTableFree( X);inchi_free( X);}
  |  |  ------------------
  |  |  |  | 1152|  40.8k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 40.8k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 40.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6795:31): [True: 40.8k, False: 211k]
  |  |  ------------------
  ------------------
 6804|   252k|        FREE_CONTABLE( Ct_FixH )
  ------------------
  |  | 6795|   252k|#define FREE_CONTABLE( X) if (X) {CTableFree( X);inchi_free( X);}
  |  |  ------------------
  |  |  |  | 1152|   247k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 247k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 247k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6795:31): [True: 247k, False: 4.50k]
  |  |  ------------------
  ------------------
 6805|   252k|        FREE_CONTABLE( Ct_Temp )
  ------------------
  |  | 6795|   252k|#define FREE_CONTABLE( X) if (X) {CTableFree( X);inchi_free( X);}
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6795:31): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6806|       |        /* isotopic canonicalization */
 6807|   252k|        FREE_CONTABLE( Ct_NoTautHIso )
  ------------------
  |  | 6795|   252k|#define FREE_CONTABLE( X) if (X) {CTableFree( X);inchi_free( X);}
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6795:31): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6808|   252k|        FREE_CONTABLE( Ct_BaseIso )
  ------------------
  |  | 6795|   252k|#define FREE_CONTABLE( X) if (X) {CTableFree( X);inchi_free( X);}
  |  |  ------------------
  |  |  |  | 1152|    861|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 861, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 861]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6795:31): [True: 861, False: 251k]
  |  |  ------------------
  ------------------
 6809|   252k|        FREE_CONTABLE( Ct_FixHIso )
  ------------------
  |  | 6795|   252k|#define FREE_CONTABLE( X) if (X) {CTableFree( X);inchi_free( X);}
  |  |  ------------------
  |  |  |  | 1152|  1.26k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 1.26k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 1.26k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6795:31): [True: 1.26k, False: 250k]
  |  |  ------------------
  ------------------
 6810|       |
 6811|       |        /* free the first two pointers from pBCN->pRankStack */
 6812|   252k|        FREE_ARRAY( nRank )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|   252k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 252k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 252k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 252k, False: 0]
  |  |  ------------------
  ------------------
 6813|   252k|        FREE_ARRAY( nAtomNumber )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|   252k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 252k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 252k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 252k, False: 0]
  |  |  ------------------
  ------------------
 6814|       |
 6815|   252k|        if (pBCN->pRankStack)
  ------------------
  |  Branch (6815:13): [True: 252k, False: 0]
  ------------------
 6816|   252k|        {
 6817|   252k|            pBCN->pRankStack[0] =
 6818|   252k|                pBCN->pRankStack[1] = NULL;
 6819|   252k|        }
 6820|       |
 6821|   252k|#if ( USE_AUX_RANKING == 1 )
 6822|   252k|    FREE_ARRAY( nRankAux )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|   252k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 252k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 252k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 252k, False: 0]
  |  |  ------------------
  ------------------
 6823|   252k|        FREE_ARRAY( nAtomNumberAux )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|   252k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 252k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 252k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 252k, False: 0]
  |  |  ------------------
  ------------------
 6824|   252k|        FREE_ARRAY( pAtomInvariantAux )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|   252k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 252k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 252k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 252k, False: 0]
  |  |  ------------------
  ------------------
 6825|   252k|#endif
 6826|       |
 6827|   252k|        FREE_ARRAY( pAtomInvariant )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|   252k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 252k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 252k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 252k, False: 0]
  |  |  ------------------
  ------------------
 6828|       |
 6829|   252k|        FREE_ARRAY( nCanonRankNoH )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|   252k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 252k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 252k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 252k, False: 0]
  |  |  ------------------
  ------------------
 6830|   252k|        FREE_ARRAY( nAtomNumberCanonNoH )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|   252k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 252k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 252k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 252k, False: 0]
  |  |  ------------------
  ------------------
 6831|   252k|        FREE_ARRAY( nSymmRankNoH )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|   252k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 252k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 252k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 252k, False: 0]
  |  |  ------------------
  ------------------
 6832|       |
 6833|   252k|        FREE_ARRAY( nSymmRankNoTautH )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|  40.8k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 40.8k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 40.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 40.8k, False: 211k]
  |  |  ------------------
  ------------------
 6834|   252k|        FREE_ARRAY( nCanonRankNoTautH )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|  40.8k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 40.8k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 40.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 40.8k, False: 211k]
  |  |  ------------------
  ------------------
 6835|   252k|        FREE_ARRAY( nAtomNumberCanonNoTautH )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|  40.8k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 40.8k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 40.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 40.8k, False: 211k]
  |  |  ------------------
  ------------------
 6836|   252k|        FREE_ARRAY( numHNoTautH )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|  4.50k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 4.50k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 4.50k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 4.50k, False: 247k]
  |  |  ------------------
  ------------------
 6837|       |
 6838|   252k|        FREE_ARRAY( nSymmRankBase )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6839|   252k|        FREE_ARRAY( nCanonRankBase )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6840|   252k|        FREE_ARRAY( nAtomNumberCanonBase )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6841|   252k|        FREE_ARRAY( numH )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6842|       |
 6843|   252k|        FREE_ARRAY( nSymmRankFixH )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6844|   252k|        FREE_ARRAY( nCanonRankFixH )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6845|   252k|        FREE_ARRAY( nAtomNumberCanonFixH )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6846|   252k|        FREE_ARRAY( NumHfixed )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6847|       |
 6848|       |        /* isotopic canonicalization */
 6849|       |
 6850|   252k|        FREE_ARRAY( nSymmRankNoTautHIso )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6851|   252k|        FREE_ARRAY( nCanonRankNoTautHIso )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6852|   252k|        FREE_ARRAY( nAtomNumberCanonNoTautHIso )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6853|   252k|        FREE_ARRAY( iso_sort_key_NoTautH )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6854|       |
 6855|   252k|        FREE_ARRAY( nSymmRankBaseIso )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6856|   252k|        FREE_ARRAY( nCanonRankBaseIso )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6857|   252k|        FREE_ARRAY( nAtomNumberCanonBaseIso )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6858|   252k|        FREE_ARRAY( iso_sort_keyBase )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6859|   252k|        FREE_ARRAY( iso_exchg_atnos )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6860|       |
 6861|   252k|        FREE_ARRAY( nSymmRankFixHIso )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6862|   252k|        FREE_ARRAY( nCanonRankFixHIso )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6863|   252k|        FREE_ARRAY( nAtomNumberCanonFixHIso )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 6864|       |
 6865|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6866|       |        FREE_ARRAY( iso_sort_key_Hfixed )
 6867|       |#endif
 6868|       |
 6869|   252k|        FREE_ARRAY( nTempRank )
  ------------------
  |  | 6796|   252k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1152|   252k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 252k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 252k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6796:28): [True: 252k, False: 0]
  |  |  ------------------
  ------------------
 6870|       |
 6871|   252k|#undef FREE_CONTABLE
 6872|   252k|#undef FREE_ARRAY
 6873|       |
 6874|   252k|        return ret;
 6875|   252k|}

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

find_atoms_with_parity:
  124|  7.45k|{
  125|  7.45k|    int i, next_atom;
  126|       |
  127|  7.45k|    if (visited[cur_atom])
  ------------------
  |  Branch (127:9): [True: 842, False: 6.61k]
  ------------------
  128|    842|    {
  129|    842|        return 0;
  130|    842|    }
  131|  6.61k|    if (at[cur_atom].parity)
  ------------------
  |  Branch (131:9): [True: 4.76k, False: 1.85k]
  ------------------
  132|  4.76k|    {
  133|  4.76k|        return 1;
  134|  4.76k|    }
  135|       |
  136|  1.85k|    visited[cur_atom] = 1;
  137|       |
  138|  4.50k|    for (i = 0; i < at[cur_atom].valence; i++)
  ------------------
  |  Branch (138:17): [True: 3.60k, False: 894]
  ------------------
  139|  3.60k|    {
  140|  3.60k|        next_atom = at[cur_atom].neighbor[i];
  141|       |
  142|  3.60k|        if (next_atom != from_atom &&
  ------------------
  |  Branch (142:13): [True: 2.33k, False: 1.27k]
  ------------------
  143|  2.33k|             find_atoms_with_parity( at, visited, cur_atom, next_atom ))
  ------------------
  |  Branch (143:14): [True: 957, False: 1.37k]
  ------------------
  144|    957|        {
  145|    957|            return 1;
  146|    957|        }
  147|  3.60k|    }
  148|       |
  149|    894|    return 0;
  150|  1.85k|}
RemoveHalfStereoBond:
  176|     72|{
  177|     72|    int k2;
  178|     72|    if (k1 < MAX_NUM_STEREO_BOND_NEIGH && at[jn].stereo_bond_neighbor[k1])
  ------------------
  |  |  874|    144|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (178:9): [True: 72, False: 0]
  |  Branch (178:43): [True: 72, False: 0]
  ------------------
  179|     72|    {
  180|    216|        for (k2 = k1; k2 < MAX_NUM_STEREO_BOND_NEIGH - 1; k2++) /* djb-rwth: loop condition corrected (buffer error) */
  ------------------
  |  |  874|    216|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (180:23): [True: 144, False: 72]
  ------------------
  181|    144|        {
  182|    144|            at[jn].stereo_bond_neighbor[k2] = at[jn].stereo_bond_neighbor[k2 + 1];
  183|    144|            at[jn].stereo_bond_ord[k2] = at[jn].stereo_bond_ord[k2 + 1];
  184|    144|            at[jn].stereo_bond_z_prod[k2] = at[jn].stereo_bond_z_prod[k2 + 1];
  185|    144|            at[jn].stereo_bond_parity[k2] = at[jn].stereo_bond_parity[k2 + 1];
  186|    144|        }
  187|     72|        at[jn].stereo_bond_neighbor[k2] = 0;
  188|     72|        at[jn].stereo_bond_ord[k2] = 0;
  189|     72|        at[jn].stereo_bond_z_prod[k2] = 0;
  190|     72|        at[jn].stereo_bond_parity[k2] = 0;
  191|       |
  192|     72|        if (!at[jn].stereo_bond_neighbor[0])
  ------------------
  |  Branch (192:13): [True: 72, False: 0]
  ------------------
  193|     72|        {   /*  curled braces added 6-6-2002 */
  194|     72|            at[jn].parity = 0;
  195|     72|            at[jn].stereo_atom_parity = 0;
  196|     72|            at[jn].final_parity = 0;
  197|       |            /* at[jn].bHasStereoOrEquToStereo = 0; */
  198|     72|        }
  199|     72|        return 1; /*  success            */
  200|     72|    }
  201|       |
  202|      0|    return 0; /*  failed             */
  203|     72|}
RemoveOneStereoBond:
  240|     34|{
  241|     34|    int k1, ret = 0, kn, jn = (int) at[jc].stereo_bond_neighbor[k] - 1;
  242|       |
  243|       |    /*  opposite end */
  244|     34|    for (k1 = ret = 0;
  245|     34|            k1 < MAX_NUM_STEREO_BOND_NEIGH && ( kn = at[jn].stereo_bond_neighbor[k1] );
  ------------------
  |  |  874|     68|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (245:13): [True: 34, False: 0]
  |  Branch (245:47): [True: 34, False: 0]
  ------------------
  246|     34|              k1++) /* djb-rwth: removing redundant code */
  247|     34|    {
  248|     34|        if (kn - 1 == jc)
  ------------------
  |  Branch (248:13): [True: 34, False: 0]
  ------------------
  249|     34|        {
  250|     34|            ret = RemoveHalfStereoBond( at, jn, k1 );
  251|     34|            break;
  252|     34|        }
  253|     34|    }
  254|       |
  255|     34|    if (ret)
  ------------------
  |  Branch (255:9): [True: 34, False: 0]
  ------------------
  256|     34|    {
  257|     34|        ret = RemoveHalfStereoBond( at, jc, k );
  258|     34|    }
  259|       |
  260|     34|    return ret;
  261|     34|}
RemoveOneStereoCenter:
  267|     89|{
  268|     89|    if (at[jc].parity)
  ------------------
  |  Branch (268:9): [True: 89, False: 0]
  ------------------
  269|     89|    {
  270|     89|        at[jc].parity = 0; /*  remove parity */
  271|     89|        at[jc].stereo_atom_parity = 0;
  272|     89|        at[jc].final_parity = 0;
  273|       |        /*  at[jc].bHasStereoOrEquToStereo = 0; */
  274|     89|        return 1;
  275|     89|    }
  276|       |
  277|      0|    return 0; /*  failed: not a stereo center */
  278|     89|}
UnmarkNonStereo:
  293|  1.14k|{
  294|  1.14k|    int i, i1, i2, j, k, k1, k2, kn /* neigh*/, val, ic/* center*/, jc, num_implicit_H;
  295|  1.14k|    int num_neighbors_with_parity, num_no_parity_atoms, num_removed_parities = -1, num_removed_parities0;
  296|  1.14k|    AT_RANK nNeighborNumber[MAX_NUM_STEREO_ATOM_NEIGH];
  297|  1.14k|    AT_RANK nPrevAtomRank, nPrevNeighRank;
  298|  1.14k|#ifdef FIX_OLEAN_SPIRO_CHIRALITY_DETECTION_BUG
  299|  1.14k|    int num_in_same_ring_system = 1, nRingSystem, num_with_eq_neigh_in_same_ring_system = 0; /* djb-rwth: although unlikely to ever occur, uninitialised num_in_same_ring_system variable can lead to garbage value, including 0 which leads to various errors and inconsistency with 1.06 outputs -- function rewriting and discussion required */
  300|  1.14k|#endif
  301|       |
  302|       |
  303|  1.14k|    S_CHAR *visited = (S_CHAR *) inchi_malloc( num_atoms * sizeof( visited[0] ) );
  ------------------
  |  | 1143|  1.14k|#define inchi_malloc   malloc
  ------------------
  304|       |
  305|  1.14k|    if (!visited)
  ------------------
  |  Branch (305:9): [True: 0, False: 1.14k]
  ------------------
  306|      0|    {
  307|      0|        goto exit_function;
  308|      0|    }
  309|       |
  310|  1.14k|    num_removed_parities = 0;
  311|  1.14k|    num_no_parity_atoms = 0;
  312|       |
  313|  1.14k|    do
  314|  1.16k|    {
  315|  1.16k|        num_removed_parities0 = num_removed_parities;
  316|       |
  317|  9.40k|        for (i = i1 = 0, nPrevAtomRank = 0; i <= num_atoms; i++)
  ------------------
  |  Branch (317:45): [True: 8.24k, False: 1.16k]
  ------------------
  318|  8.24k|        {
  319|       |            /*  bounds violation check (i!=num_atoms) added 6-21-2002 */
  320|  8.24k|            if (i == num_atoms || nPrevAtomRank != nRank[j = nAtomNumber[i]]
  ------------------
  |  Branch (320:17): [True: 1.16k, False: 7.07k]
  |  Branch (320:35): [True: 5.00k, False: 2.06k]
  ------------------
  321|  8.24k|                 /* at[j].parity && 1 < at[j].valence && at[j].valence < MAX_NUM_STEREO_ATOM_NEIGH*/)
  322|  6.17k|            {
  323|       |                /*  end of constitutionally equivalent atoms sequence */
  324|       |                /* nPrevRank = nRank[j]; */
  325|  6.17k|                i2 = i;
  326|  6.17k|                if (i2 - i1 > num_no_parity_atoms /*&& at[jc = nAtomNumber[i1]].parity*/)
  ------------------
  |  Branch (326:21): [True: 2.17k, False: 4.00k]
  ------------------
  327|  2.17k|                {
  328|       |                    /*  at[nAtomNumber[i1]]..at[nAtomNumber[i2-1]] are constitutionally equivalent and some of them have parity */
  329|  2.17k|                    jc = nAtomNumber[i1];
  330|  2.17k|                    num_no_parity_atoms = 0;
  331|  2.17k|                    val = at[jc].valence; /*  all equivalent atoms have equal valences, etc. (except parities) */
  332|  2.17k|                    num_implicit_H = at[jc].endpoint ? 0 : at[jc].num_H;
  ------------------
  |  Branch (332:38): [True: 3, False: 2.17k]
  ------------------
  333|       |                    /*  Only atoms with valence <= MAX_NUM_STEREO_ATOM_NEIGH may have parity. However, check: */
  334|  2.17k|                    if (val + num_implicit_H > MAX_NUM_STEREO_ATOM_NEIGH)
  ------------------
  |  |  877|  2.17k|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (334:25): [True: 0, False: 2.17k]
  ------------------
  335|      0|                    {
  336|      0|                        continue;  /*  program error ??? */ /*   <BRKPT> */
  337|      0|                    }
  338|  8.69k|                    for (k = 0; k < val; k++)
  ------------------
  |  Branch (338:33): [True: 6.52k, False: 2.17k]
  ------------------
  339|  6.52k|                    {
  340|  6.52k|                        nNeighborNumber[k] = k; /*  initialize an array of indexes for sorting */
  341|  6.52k|                    }
  342|       |                    /*  check parities */
  343|  5.98k|                    for (ic = i1; ic < i2; ic++)
  ------------------
  |  Branch (343:35): [True: 3.80k, False: 2.17k]
  ------------------
  344|  3.80k|                    {
  345|  3.80k|                        jc = nAtomNumber[ic];
  346|       |                        /*  sort neighbors according to their canon. equivalence ranks */
  347|  3.80k|                        pCG->m_pNeighborsForSort = at[jc].neighbor;
  348|  3.80k|                        pCG->m_pn_RankForSort = nRank;
  349|  3.80k|                        insertions_sort( pCG, nNeighborNumber, val, sizeof( nNeighborNumber[0] ), CompNeighborsAT_NUMBER );
  350|  3.80k|                        num_neighbors_with_parity = -1; /*  non-zero */
  351|  12.5k|                        for (k = k1 = 0, nPrevNeighRank = 0; k <= val; k++)
  ------------------
  |  Branch (351:62): [True: 12.5k, False: 0]
  ------------------
  352|  12.5k|                        {
  353|  12.5k|                            if (k == val || nPrevNeighRank != nRank[at[jc].neighbor[nNeighborNumber[k]]])
  ------------------
  |  Branch (353:33): [True: 1.50k, False: 11.0k]
  |  Branch (353:45): [True: 8.19k, False: 2.87k]
  ------------------
  354|  9.69k|                            {
  355|  9.69k|                                k2 = k;
  356|  9.69k|                                if (k2 - k1 > 1)
  ------------------
  |  Branch (356:37): [True: 2.25k, False: 7.44k]
  ------------------
  357|  2.25k|                                {
  358|       |                                    /*  found 2 or more constitutionally equivalent neighbors */
  359|       |                                    /*  Check if they have only non-stereogenic neighbors */
  360|  2.25k|#ifdef FIX_OLEAN_SPIRO_CHIRALITY_DETECTION_BUG
  361|  2.25k|                                    num_in_same_ring_system = nRingSystem = 0;
  362|  7.37k|                                    for (kn = k1; kn < k2; kn++) /* djb-rwth: removing redundant code */
  ------------------
  |  Branch (362:51): [True: 5.12k, False: 2.25k]
  ------------------
  363|  5.12k|                                    {
  364|  5.12k|                                        int nCurNeighRingSystem = at[(int) at[jc].neighbor[nNeighborNumber[kn]]].nRingSystem;
  365|  5.12k|                                        if (!nRingSystem)
  ------------------
  |  Branch (365:45): [True: 2.25k, False: 2.87k]
  ------------------
  366|  2.25k|                                        {
  367|  2.25k|                                            nRingSystem = nCurNeighRingSystem;
  368|  2.25k|                                        }
  369|  2.87k|                                        else
  370|  2.87k|                                        {
  371|  2.87k|                                            num_in_same_ring_system += ( nRingSystem == nCurNeighRingSystem );
  372|  2.87k|                                        }
  373|  5.12k|                                    }
  374|  2.25k|#endif
  375|       |
  376|  7.37k|                                    for (kn = k1, num_neighbors_with_parity = 0; kn < k2; kn++)
  ------------------
  |  Branch (376:82): [True: 5.12k, False: 2.25k]
  ------------------
  377|  5.12k|                                    {
  378|  5.12k|                                        memset( visited, 0, num_atoms * sizeof( visited[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  379|  5.12k|                                        visited[jc] = 1; /*  starting point; the only atom with parity */
  380|  5.12k|                                        num_neighbors_with_parity +=
  381|  5.12k|                                            find_atoms_with_parity( at, visited, jc, (int) at[jc].neighbor[nNeighborNumber[kn]] );
  382|  5.12k|                                    }
  383|  2.25k|                                }
  384|       |                                /* if ( !num_neighbors_with_parity ) */
  385|  9.69k|#ifdef FIX_OLEAN_SPIRO_CHIRALITY_DETECTION_BUG
  386|  9.69k|                                if (!num_neighbors_with_parity && !num_in_same_ring_system)
  ------------------
  |  Branch (386:37): [True: 170, False: 9.52k]
  |  Branch (386:67): [True: 48, False: 122]
  ------------------
  387|       |#else
  388|       |                                if (!num_neighbors_with_parity)
  389|       |#endif
  390|     48|                                {
  391|     48|                                    break; /*  at[jc] cannot have defined parity */
  392|     48|                                }
  393|  9.64k|                                if (k + 1 < val)
  ------------------
  |  Branch (393:37): [True: 5.88k, False: 3.75k]
  ------------------
  394|  5.88k|                                {
  395|  5.88k|                                    k1 = k; /*  at least 2 more neighbors left */
  396|  5.88k|                                    nPrevNeighRank = nRank[at[jc].neighbor[nNeighborNumber[k]]];
  397|  5.88k|                                }
  398|  3.75k|                                else
  399|  3.75k|                                {
  400|  3.75k|                                    break;
  401|  3.75k|                                }
  402|  9.64k|                            }
  403|  12.5k|                        }
  404|  3.80k|                        if (num_implicit_H > 1)
  ------------------
  |  Branch (404:29): [True: 14, False: 3.79k]
  ------------------
  405|     14|                        {
  406|     14|                            if ((bIsotopic && ( at[jc].num_iso_H[0] > 1 ||
  ------------------
  |  Branch (406:34): [True: 10, False: 4]
  |  Branch (406:49): [True: 0, False: 10]
  ------------------
  407|     10|                                at[jc].num_iso_H[1] > 1 ||
  ------------------
  |  Branch (407:33): [True: 0, False: 10]
  ------------------
  408|     10|                                at[jc].num_iso_H[2] > 1 )) ||
  ------------------
  |  Branch (408:33): [True: 0, False: 10]
  ------------------
  409|     14|                                  num_implicit_H > NUM_H_ISOTOPES ||
  ------------------
  |  |   25|     28|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (409:35): [True: 0, False: 14]
  ------------------
  410|     14|                                  !bIsotopic) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (410:35): [True: 4, False: 10]
  ------------------
  411|      4|                            {
  412|      4|                                num_neighbors_with_parity = 0;
  413|      4|                            }
  414|     14|                        }
  415|       |                        /*  increment if: */
  416|       |                        /*  (a) constitutionally equivalent neighbors do exist, and */
  417|       |                        /*  (b) all constitutionally equivalent neighbors do not have parity, and */
  418|       |                        /*  (c) all constitutionally equivalent neighbors are not connected to atoms with parity */
  419|  3.80k|                        num_no_parity_atoms += !num_neighbors_with_parity;
  420|  3.80k|#ifdef FIX_OLEAN_SPIRO_CHIRALITY_DETECTION_BUG
  421|  3.80k|                        num_with_eq_neigh_in_same_ring_system += ( num_in_same_ring_system != 0 ); /* djb-rwth: initialisation of num_in_same_ring_system is required to avoid garbage value */
  422|  3.80k|#endif
  423|  3.80k|                    }
  424|  2.17k|#ifdef FIX_OLEAN_SPIRO_CHIRALITY_DETECTION_BUG
  425|  2.17k|                    if (num_no_parity_atoms == i2 - i1 && num_with_eq_neigh_in_same_ring_system != i2 - i1)
  ------------------
  |  Branch (425:25): [True: 136, False: 2.03k]
  |  Branch (425:59): [True: 18, False: 118]
  ------------------
  426|       |#else
  427|       |                    if (num_no_parity_atoms == i2 - i1)
  428|       |#endif
  429|       |
  430|     18|                    {
  431|       |                        /*  all atoms at[nAtomNumber[i1]]..at[nAtomNumber[i2-1]] cannot be */
  432|       |                        /*  stereo centers or belong to stereo bonds */
  433|     36|                        for (ic = i1; ic < i2; ic++)
  ------------------
  |  Branch (433:39): [True: 18, False: 18]
  ------------------
  434|     18|                        {
  435|     18|                            int jn;
  436|     18|                            jc = nAtomNumber[ic];
  437|     18|                            at[jc].parity = 0; /*  remove parity */
  438|     18|                            at[jc].stereo_atom_parity = 0;
  439|     18|                            at[jc].final_parity = 0;
  440|     18|                            at[jc].bHasStereoOrEquToStereo = 0;
  441|       |                            /*  remove stereo bonds */
  442|     22|                            for (k = 0; k < MAX_NUM_STEREO_BOND_NEIGH && ( jn = at[jc].stereo_bond_neighbor[k] ); k++)
  ------------------
  |  |  874|     44|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (442:41): [True: 22, False: 0]
  |  Branch (442:74): [True: 4, False: 18]
  ------------------
  443|      4|                            {
  444|      4|                                jn--; /*  stereo bond neighbor */
  445|       |                                /*  opposite end */
  446|      4|                                for (k1 = 0; k1 < MAX_NUM_STEREO_BOND_NEIGH && ( kn = at[jn].stereo_bond_neighbor[k1] ); k1++)
  ------------------
  |  |  874|      8|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (446:46): [True: 4, False: 0]
  |  Branch (446:80): [True: 4, False: 0]
  ------------------
  447|      4|                                {
  448|      4|                                    if (kn - 1 == jc)
  ------------------
  |  Branch (448:41): [True: 4, False: 0]
  ------------------
  449|      4|                                    {
  450|      4|                                        RemoveHalfStereoBond( at, jn, k1 );
  451|      4|                                        break;
  452|      4|                                    }
  453|      4|                                }
  454|       |                                /*  at at[jc] stereo bond end; since references to all at[jc] */
  455|       |                                /*  stereo bond neighbors are to be removed, do not shift them */
  456|      4|                                at[jc].stereo_bond_neighbor[k] = 0;
  457|      4|                                at[jc].stereo_bond_ord[k] = 0;
  458|      4|                                at[jc].stereo_bond_z_prod[k] = 0;
  459|      4|                                at[jc].stereo_bond_parity[k] = 0;
  460|      4|                            }
  461|     18|                        }
  462|     18|                        num_removed_parities += num_no_parity_atoms;
  463|     18|                    }
  464|  2.17k|                }
  465|  6.17k|                if (i < num_atoms)
  ------------------
  |  Branch (465:21): [True: 5.00k, False: 1.16k]
  ------------------
  466|  5.00k|                {
  467|  5.00k|                    nPrevAtomRank = nRank[j];
  468|  5.00k|                    i1 = i;
  469|  5.00k|                }
  470|  6.17k|                num_no_parity_atoms = 0;
  471|  6.17k|            }
  472|  8.24k|            num_no_parity_atoms += ( i < num_atoms && !at[j].parity );
  ------------------
  |  Branch (472:38): [True: 7.07k, False: 1.16k]
  |  Branch (472:55): [True: 3.47k, False: 3.59k]
  ------------------
  473|  8.24k|        }
  474|  1.16k|    }
  475|  1.16k|    while (num_removed_parities != num_removed_parities0);
  ------------------
  |  Branch (475:12): [True: 18, False: 1.14k]
  ------------------
  476|       |
  477|  1.14k|exit_function:
  478|  1.14k|    if (visited)
  ------------------
  |  Branch (478:9): [True: 1.14k, False: 0]
  ------------------
  479|  1.14k|    {
  480|  1.14k|        inchi_free( visited );
  ------------------
  |  | 1152|  1.14k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 1.14k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 1.14k]
  |  |  ------------------
  ------------------
  481|  1.14k|    }
  482|       |
  483|  1.14k|    return num_removed_parities;
  484|  1.14k|}
FillSingleStereoDescriptors:
  502|  13.8k|{
  503|       |
  504|  13.8k|    if (!LinearCTStereoDble && !LinearCTStereoCarb)
  ------------------
  |  Branch (504:9): [True: 8.49k, False: 5.39k]
  |  Branch (504:32): [True: 0, False: 8.49k]
  ------------------
  505|      0|    {
  506|      0|        return 0; /*  return immediately if no stereo have been requested */
  507|      0|    }
  508|       |
  509|       |    /***************************************************
  510|       |    add stereo centers and stereo bonds to the CT
  511|       |    ***************************************************/
  512|  13.8k|    if (at[i].parity || at[i].stereo_bond_neighbor[0])
  ------------------
  |  Branch (512:9): [True: 7.12k, False: 6.75k]
  |  Branch (512:25): [True: 0, False: 6.75k]
  ------------------
  513|  7.12k|    {
  514|  7.12k|        AT_RANK r_neigh, rank = nRank[i];
  515|  7.12k|        AT_NUMB nNeighborNumber2[MAXVAL];
  516|  7.12k|        unsigned parity;
  517|  7.12k|        int      k;
  518|  7.12k|        int num_allene = 0;
  519|       |
  520|  7.12k|        if (ATOM_PARITY_WELL_DEF( at[i].parity ) && num_trans < 0)
  ------------------
  |  |  259|  14.2k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  7.12k|#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)
  |  |  ------------------
  |  |  |  |  236|  7.12k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 7.12k, False: 0]
  |  |  |  Branch (259:75): [True: 2.40k, False: 4.72k]
  |  |  ------------------
  ------------------
  |  Branch (520:53): [True: 2.40k, False: 0]
  ------------------
  521|  2.40k|        {
  522|       |            /*  number of neighbors transpositions to the sorted order is unknown. Find it. */
  523|       |            /*  If parity is not well-defined then doing this is a waste of time */
  524|  2.40k|            int num_neigh = at[i].valence;
  525|  9.56k|            for (k = 0; k < num_neigh; k++)
  ------------------
  |  Branch (525:25): [True: 7.15k, False: 2.40k]
  ------------------
  526|  7.15k|            {
  527|  7.15k|                nNeighborNumber2[k] = k;
  528|  7.15k|            }
  529|       |
  530|  2.40k|            pCG->m_pNeighborsForSort = at[i].neighbor;
  531|  2.40k|            pCG->m_pn_RankForSort = nRank;
  532|  2.40k|            num_trans = insertions_sort( pCG, nNeighborNumber2, num_neigh, sizeof( nNeighborNumber2[0] ), CompNeighborsAT_NUMBER );
  533|       |
  534|       |#ifndef CT_NEIGH_INCREASE
  535|       |            num_trans += ( ( num_neigh*( num_neigh - 1 ) ) / 2 ) % 2;  /*  get correct parity for ascending order */
  536|       |#endif
  537|  2.40k|        }
  538|       |
  539|       |        /*  stereo bonds */
  540|  7.12k|        if (LinearCTStereoDble && at[i].stereo_bond_neighbor[0])
  ------------------
  |  Branch (540:13): [True: 3.54k, False: 3.58k]
  |  Branch (540:35): [True: 3.48k, False: 60]
  ------------------
  541|  3.48k|        {
  542|       |
  543|       |            /* HalfStereoBondParity( sp_ATOM *at, int at_no1, int i_sb_neigh, AT_RANK *nRank ) */
  544|  3.48k|            AT_NUMB nStereoNeighNumber[MAX_NUM_STEREO_BONDS], nStereoNeigh[MAX_NUM_STEREO_BONDS], n;
  545|  3.48k|            int       num_stereo, stereo_neigh, stereo_neigh_ord, stereo_bond_parity;
  546|  3.48k|            for (num_stereo = 0;
  547|  8.84k|                      num_stereo < MAX_NUM_STEREO_BONDS &&
  ------------------
  |  |  873|  17.6k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (547:23): [True: 8.84k, False: 0]
  ------------------
  548|  8.84k|                      ( n = at[i].stereo_bond_neighbor[num_stereo] ); num_stereo++)
  ------------------
  |  Branch (548:23): [True: 5.35k, False: 3.48k]
  ------------------
  549|  5.35k|            {
  550|  5.35k|                nStereoNeighNumber[num_stereo] = num_stereo;
  551|  5.35k|                nStereoNeigh[num_stereo] = n - 1;
  552|  5.35k|                num_allene += IS_ALLENE_CHAIN( at[i].stereo_bond_parity[num_stereo] );
  ------------------
  |  |  215|  5.35k|#define IS_ALLENE_CHAIN(X)          ((GET_BITS_CUMULENE_LEN(X)/MULT_STEREOBOND)%2)
  |  |  ------------------
  |  |  |  |  213|  5.35k|#define GET_BITS_CUMULENE_LEN(X)    ((X)&MASK_CUMULENE_LEN)
  |  |  |  |  ------------------
  |  |  |  |  |  |  205|  5.35k|#define MASK_CUMULENE_LEN  0x38  /* mask to retrieve (cumulene chain length - 1)*MULT_STEREOBOND    */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define IS_ALLENE_CHAIN(X)          ((GET_BITS_CUMULENE_LEN(X)/MULT_STEREOBOND)%2)
  |  |  ------------------
  |  |  |  |  209|  5.35k|#define MULT_STEREOBOND    0x08  /* multiplier for cumulene chain length
  |  |  ------------------
  ------------------
  553|  5.35k|            }
  554|  3.48k|            if ((bAllene > 0 && !num_allene) || (bAllene == 0 && num_allene)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (554:18): [True: 1.74k, False: 1.74k]
  |  Branch (554:33): [True: 1.72k, False: 20]
  |  Branch (554:50): [True: 1.74k, False: 20]
  |  Branch (554:66): [True: 20, False: 1.72k]
  ------------------
  555|  1.74k|            {
  556|  1.74k|                return 0;
  557|  1.74k|            }
  558|       |
  559|       |            /*  sort stereo bonds according to the ranks of the neighbors */
  560|  1.74k|            pCG->m_pNeighborsForSort = nStereoNeigh;
  561|  1.74k|            pCG->m_pn_RankForSort = nRank;
  562|  1.74k|            insertions_sort( pCG, nStereoNeighNumber, num_stereo, sizeof( nStereoNeighNumber[0] ), CompNeighborsAT_NUMBER );
  563|       |
  564|       |            /*  process stereo bonds one by one */
  565|  4.42k|            for (k = 0; k < num_stereo; k++)
  ------------------
  |  Branch (565:25): [True: 2.67k, False: 1.74k]
  ------------------
  566|  2.67k|            {
  567|  2.67k|                stereo_neigh = nStereoNeigh[stereo_neigh_ord = (int) nStereoNeighNumber[k]];
  568|       |
  569|  2.67k|                if (( r_neigh = (AT_NUMB) nRank[stereo_neigh] ) CT_NEIGH_SMALLER_THAN rank)
  ------------------
  |  Branch (569:21): [True: 1.33k, False: 1.33k]
  ------------------
  570|  1.33k|                {
  571|       |                    /* accept only neighbors that have smaller ranks */
  572|  1.33k|                    stereo_bond_parity = PARITY_VAL( at[i].stereo_bond_parity[stereo_neigh_ord] );
  ------------------
  |  |  262|  1.33k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|  1.33k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
  573|  1.33k|                    if (stereo_bond_parity == AB_PARITY_NONE)
  ------------------
  |  |  218|  1.33k|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (573:25): [True: 0, False: 1.33k]
  ------------------
  574|      0|                    {
  575|      0|                        continue;
  576|      0|                    }
  577|       |
  578|       |                    /* stereo_neigh      = at[i].stereo_bond_neighbor[nStereoNeighNumber[k]]-1; */
  579|  1.33k|                    if (ATOM_PARITY_KNOWN( stereo_bond_parity ))
  ------------------
  |  |  258|  1.33k|#define ATOM_PARITY_KNOWN(X)        (AB_MIN_KNOWN_PARITY <= (X) && (X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|  1.33k|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define ATOM_PARITY_KNOWN(X)        (AB_MIN_KNOWN_PARITY <= (X) && (X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|  1.33k|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (258:38): [True: 1.33k, False: 0]
  |  |  |  Branch (258:68): [True: 1.07k, False: 269]
  |  |  ------------------
  ------------------
  580|  1.07k|                    {
  581|  1.07k|                        parity = stereo_bond_parity;
  582|  1.07k|                    }
  583|    269|                    else if (ATOM_PARITY_WELL_DEF( at[i].parity ) &&
  ------------------
  |  |  259|    538|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    269|#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)
  |  |  ------------------
  |  |  |  |  236|    269|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 269, False: 0]
  |  |  |  Branch (259:75): [True: 269, False: 0]
  |  |  ------------------
  ------------------
  584|    269|                              ATOM_PARITY_WELL_DEF( at[stereo_neigh].parity ) &&
  ------------------
  |  |  259|    538|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    269|#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)
  |  |  ------------------
  |  |  |  |  236|    269|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 269, False: 0]
  |  |  |  Branch (259:75): [True: 269, False: 0]
  |  |  ------------------
  ------------------
  585|    269|                              MIN_DOT_PROD <= abs( at[i].stereo_bond_z_prod[stereo_neigh_ord] ))
  ------------------
  |  |  253|    269|#define MIN_DOT_PROD 50          /* min value of at->stereo_bond_z_prod[i] to define parity */
  ------------------
  |  Branch (585:31): [True: 269, False: 0]
  ------------------
  586|    269|                    {
  587|       |                        /*  bond parity can be calculated */
  588|    269|                        int half_parity1, half_parity2, j, nn, stereo_neigh_ord2;
  589|    269|                        stereo_neigh_ord2 = -1;
  590|    368|                        for (j = 0; j < MAX_NUM_STEREO_BONDS &&
  ------------------
  |  |  873|    736|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (590:37): [True: 368, False: 0]
  ------------------
  591|    368|                            ( nn = (int) at[stereo_neigh].stereo_bond_neighbor[j] );
  ------------------
  |  Branch (591:29): [True: 368, False: 0]
  ------------------
  592|    269|                                       j++)
  593|    368|                        {
  594|    368|                            if (i + 1 == nn)
  ------------------
  |  Branch (594:33): [True: 269, False: 99]
  ------------------
  595|    269|                            {
  596|       |                                /* found the opposite end of the stereo bond */
  597|    269|                                stereo_neigh_ord2 = j;
  598|    269|                                break;
  599|    269|                            }
  600|    368|                        }
  601|    269|                        if (stereo_neigh_ord2 >= 0)
  ------------------
  |  Branch (601:29): [True: 269, False: 0]
  ------------------
  602|    269|                        {
  603|    269|                            half_parity1 = HalfStereoBondParity( at, i, stereo_neigh_ord, nRank );
  604|    269|                            half_parity2 = HalfStereoBondParity( at, stereo_neigh, stereo_neigh_ord2, nRank );
  605|    269|                            if (ATOM_PARITY_WELL_DEF( half_parity1 ) &&
  ------------------
  |  |  259|    538|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    269|#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)
  |  |  ------------------
  |  |  |  |  236|    269|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 269, False: 0]
  |  |  |  Branch (259:75): [True: 269, False: 0]
  |  |  ------------------
  ------------------
  606|    269|                                 ATOM_PARITY_WELL_DEF( half_parity2 ))
  ------------------
  |  |  259|    269|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    269|#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)
  |  |  ------------------
  |  |  |  |  236|    269|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 269, False: 0]
  |  |  |  Branch (259:75): [True: 269, False: 0]
  |  |  ------------------
  ------------------
  607|    269|                            {
  608|    269|                                parity = 2 - ( half_parity1 + half_parity2
  609|    269|                                         + ( at[i].stereo_bond_z_prod[stereo_neigh_ord] < 0 ) ) % 2;
  610|    269|                            }
  611|      0|                            else
  612|      0|                            {
  613|      0|                                return CT_STEREOBOND_ERROR;  /*   <BRKPT> */
  ------------------
  |  |   31|      0|#define CT_STEREOBOND_ERROR  (CT_ERR_FIRST-12)  /*(-30012) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  614|      0|                            }
  615|    269|                        }
  616|      0|                        else
  617|      0|                        {
  618|      0|                            return CT_STEREOBOND_ERROR;  /*   <BRKPT> */
  ------------------
  |  |   31|      0|#define CT_STEREOBOND_ERROR  (CT_ERR_FIRST-12)  /*(-30012) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  619|      0|                        }
  620|    269|                    }
  621|      0|                    else
  622|      0|                    {
  623|       |                        /*  parity cannot be calculated: not enough info or 'unknown' */
  624|      0|                        if (AB_PARITY_NONE == ( parity = inchi_max( at[i].parity, at[stereo_neigh].parity ) ))
  ------------------
  |  |  218|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
                                      if (AB_PARITY_NONE == ( parity = inchi_max( at[i].parity, at[stereo_neigh].parity ) ))
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (624:29): [True: 0, False: 0]
  ------------------
  625|      0|                        {
  626|      0|                            continue;
  627|      0|                        }
  628|      0|                        if (ATOM_PARITY_WELL_DEF( parity ))
  ------------------
  |  |  259|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      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)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 0, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  629|      0|                        {
  630|      0|                            parity = AB_PARITY_UNDF; /*  should not happen */
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  631|      0|                        }
  632|      0|                    }
  633|  1.33k|                    if (CHECK_OVERFLOW( *nStereoDbleLen, nMaxStereoDbleLen ))
  ------------------
  |  |   43|  1.33k|#define CHECK_OVERFLOW(Len, Maxlen) ( (Len) >= (Maxlen) )
  |  |  ------------------
  |  |  |  Branch (43:37): [True: 0, False: 1.33k]
  |  |  ------------------
  ------------------
  634|      0|                        return CT_OVERFLOW;  /*   <BRKPT> */
  ------------------
  |  |   19|      0|#define CT_OVERFLOW          (CT_ERR_FIRST- 0)  /*(-30000) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  635|       |                    /*  first stereo bond atom */
  636|  1.33k|                    LinearCTStereoDble[*nStereoDbleLen].at_num1 = rank;
  637|       |                    /*  second stereo bond atom (opposite end) */
  638|  1.33k|                    LinearCTStereoDble[*nStereoDbleLen].at_num2 = r_neigh;
  639|       |                    /*  bond parity */
  640|  1.33k|                    LinearCTStereoDble[*nStereoDbleLen].parity = parity;
  641|  1.33k|                    ( *nStereoDbleLen )++;
  642|  1.33k|                }
  643|  2.67k|            }
  644|  1.74k|        }
  645|       |
  646|       |        /*  stereo carbon */
  647|  5.38k|        if (bAllene > 0)
  ------------------
  |  Branch (647:13): [True: 1.84k, False: 3.54k]
  ------------------
  648|  1.84k|        {
  649|  1.84k|            return 0;
  650|  1.84k|        }
  651|       |
  652|  3.54k|        if (LinearCTStereoCarb && !at[i].stereo_bond_neighbor[0])
  ------------------
  |  Branch (652:13): [True: 1.93k, False: 1.61k]
  |  Branch (652:35): [True: 1.82k, False: 110]
  ------------------
  653|  1.82k|        {
  654|  1.82k|            if (CHECK_OVERFLOW( *nStereoCarbLen, nMaxStereoCarbLen ))
  ------------------
  |  |   43|  1.82k|#define CHECK_OVERFLOW(Len, Maxlen) ( (Len) >= (Maxlen) )
  |  |  ------------------
  |  |  |  Branch (43:37): [True: 0, False: 1.82k]
  |  |  ------------------
  ------------------
  655|      0|                return CT_OVERFLOW;  /*   <BRKPT> */
  ------------------
  |  |   19|      0|#define CT_OVERFLOW          (CT_ERR_FIRST- 0)  /*(-30000) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  656|       |            /*  stereo atom rank */
  657|  1.82k|            LinearCTStereoCarb[*nStereoCarbLen].at_num = rank;
  658|       |            /*  stereo atom parity */
  659|  1.82k|            parity = ATOM_PARITY_WELL_DEF( at[i].parity ) ? ( 2 - ( at[i].parity + num_trans ) % 2 ) : at[i].parity;
  ------------------
  |  |  259|  1.82k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  1.82k|#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)
  |  |  ------------------
  |  |  |  |  236|  1.82k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 1.82k, False: 0]
  |  |  |  Branch (259:75): [True: 678, False: 1.14k]
  |  |  ------------------
  ------------------
  660|  1.82k|            LinearCTStereoCarb[*nStereoCarbLen].parity = parity;
  661|  1.82k|            ( *nStereoCarbLen )++;
  662|  1.82k|        }
  663|  3.54k|    }
  664|       |
  665|  10.3k|    return 0;
  666|  13.8k|}
SwitchAtomStereoAndIsotopicStereo:
  673|    502|{
  674|    502|    int i;
  675|       |    /*  switch atom stereo data */
  676|  3.68k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (676:17): [True: 3.18k, False: 502]
  ------------------
  677|  3.18k|    {
  678|  3.18k|        inchi_swap( (char*) &at[i].parity, (char*) &at[i].parity2, sizeof( at[i].parity ) );
  679|  3.18k|        inchi_swap( (char*) &at[i].final_parity, (char*) &at[i].final_parity2, sizeof( at[i].final_parity ) );
  680|  3.18k|        inchi_swap( (char*) &at[i].stereo_atom_parity, (char*) &at[i].stereo_atom_parity2, sizeof( at[i].stereo_atom_parity ) );
  681|  3.18k|        inchi_swap( (char*) &at[i].bHasStereoOrEquToStereo, (char*) &at[i].bHasStereoOrEquToStereo2, sizeof( at[i].bHasStereoOrEquToStereo ) );
  682|       |
  683|  3.18k|        inchi_swap( (char*) at[i].stereo_bond_neighbor, (char*) at[i].stereo_bond_neighbor2, sizeof( at[i].stereo_bond_neighbor ) );
  684|  3.18k|        inchi_swap( (char*) at[i].stereo_bond_ord, (char*) at[i].stereo_bond_ord2, sizeof( at[i].stereo_bond_ord ) );
  685|  3.18k|        inchi_swap( (char*) at[i].stereo_bond_z_prod, (char*) at[i].stereo_bond_z_prod2, sizeof( at[i].stereo_bond_z_prod ) );
  686|  3.18k|        inchi_swap( (char*) at[i].stereo_bond_parity, (char*) at[i].stereo_bond_parity2, sizeof( at[i].stereo_bond_parity ) );
  687|  3.18k|    }
  688|       |
  689|    502|    *bSwitched = !*bSwitched;
  690|    502|}
SetCtToIsotopicStereo:
  696|    251|{
  697|    251|    pCS->LinearCTStereoDble = pCS2->LinearCTIsotopicStereoDble; /*  enable stereo */
  698|    251|    pCS->LinearCTStereoCarb = pCS2->LinearCTIsotopicStereoCarb;
  699|       |
  700|    251|    pCS->LinearCTStereoDbleInv = pCS2->LinearCTIsotopicStereoDbleInv; /*  enable inv. stereo */
  701|    251|    pCS->LinearCTStereoCarbInv = pCS2->LinearCTIsotopicStereoCarbInv;
  702|    251|    pCS->nMaxLenLinearCTStereoDble = pCS2->nMaxLenLinearCTIsotopicStereoDble;
  703|    251|    pCS->nMaxLenLinearCTStereoCarb = pCS2->nMaxLenLinearCTIsotopicStereoCarb;
  704|       |
  705|    251|    pCS->nLenLinearCTStereoDble = pCS2->nLenLinearCTIsotopicStereoDble;
  706|    251|    pCS->nLenLinearCTStereoCarb = pCS2->nLenLinearCTIsotopicStereoCarb;
  707|    251|}
SetCtToNonIsotopicStereo:
  713|    251|{
  714|    251|    pCS->LinearCTStereoDble = pCS2->LinearCTStereoDble; /*  enable stereo */
  715|    251|    pCS->LinearCTStereoCarb = pCS2->LinearCTStereoCarb;
  716|       |
  717|    251|    pCS->LinearCTStereoDbleInv = pCS2->LinearCTStereoDbleInv; /*  enable inv. stereo */
  718|    251|    pCS->LinearCTStereoCarbInv = pCS2->LinearCTStereoCarbInv;
  719|    251|    pCS->nMaxLenLinearCTStereoDble = pCS2->nMaxLenLinearCTStereoDble;
  720|    251|    pCS->nMaxLenLinearCTStereoCarb = pCS2->nMaxLenLinearCTStereoCarb;
  721|       |
  722|    251|    pCS->nLenLinearCTStereoDble = pCS2->nLenLinearCTStereoDble;
  723|    251|    pCS->nLenLinearCTStereoCarb = pCS2->nLenLinearCTStereoCarb;
  724|       |
  725|    251|    pCS->nLenLinearCTIsotopicStereoDble = pCS2->nLenLinearCTIsotopicStereoDble;
  726|    251|    pCS->nLenLinearCTIsotopicStereoCarb = pCS2->nLenLinearCTIsotopicStereoCarb;
  727|    251|}
FillAllStereoDescriptors:
  737|  1.14k|{
  738|  1.14k|    int ret = 0, i;
  739|       |    /*  initialize zero lengths */
  740|  1.14k|    pCS->nLenLinearCTStereoCarb = 0;
  741|  1.14k|    pCS->nLenLinearCTStereoDble = 0;
  742|       |
  743|       |    /*  fill atom by atom */
  744|  8.08k|    for (i = 0; !ret && i < num_atoms; i++)
  ------------------
  |  Branch (744:17): [True: 8.08k, False: 0]
  |  Branch (744:25): [True: 6.94k, False: 1.14k]
  ------------------
  745|  6.94k|    {
  746|  6.94k|        ret = FillSingleStereoDescriptors( pCG, at, (int) nAtomNumberCanon[i], -1, nCanonRank
  747|  6.94k|                          , pCS->LinearCTStereoCarb, &pCS->nLenLinearCTStereoCarb, pCS->nMaxLenLinearCTStereoCarb
  748|  6.94k|                          , pCS->LinearCTStereoDble, &pCS->nLenLinearCTStereoDble, pCS->nMaxLenLinearCTStereoDble
  749|  6.94k|                          , 0 /* bAllene */ );
  750|  6.94k|    }
  751|  8.08k|    for (i = 0; !ret && i < num_atoms; i++)
  ------------------
  |  Branch (751:17): [True: 8.08k, False: 0]
  |  Branch (751:25): [True: 6.94k, False: 1.14k]
  ------------------
  752|  6.94k|    {
  753|  6.94k|        ret = FillSingleStereoDescriptors( pCG, at, (int) nAtomNumberCanon[i], -1, nCanonRank
  754|  6.94k|                          , pCS->LinearCTStereoCarb, &pCS->nLenLinearCTStereoCarb, pCS->nMaxLenLinearCTStereoCarb
  755|  6.94k|                          , pCS->LinearCTStereoDble, &pCS->nLenLinearCTStereoDble, pCS->nMaxLenLinearCTStereoDble
  756|  6.94k|                          , 1 /* bAllene */ );
  757|  6.94k|    }
  758|       |
  759|  1.14k|    return ret;
  760|  1.14k|}
SetKnownStereoBondParities:
  772|  1.14k|{
  773|  1.14k|    int i, j, n, m, j1, k, num_neigh1, num_neigh2, iMax1, parity;
  774|  1.14k|    int trans_i1, trans_i2, trans_k1, trans_k2, prev_trans, trans_k, num_set;
  775|  1.14k|    int i1, i2, k1, k2, n1, n2, m1, m2, /*stereo_bond_parity,*/ cumulene_len;
  776|       |
  777|  1.14k|    AT_RANK nAtomRank1, nAtomRank2, nAtom1NeighRank;
  778|  1.14k|    AT_RANK nNeighRank1[MAX_NUM_STEREO_BONDS],
  779|  1.14k|        nNeighRank2[MAX_NUM_STEREO_BONDS];
  780|  1.14k|    AT_RANK nNeighCanonRank1[MAX_NUM_STEREO_BONDS],
  781|  1.14k|        nNeighCanonRank2[MAX_NUM_STEREO_BONDS];
  782|       |
  783|  8.08k|    for (i1 = 0, num_set = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (783:31): [True: 6.94k, False: 1.14k]
  ------------------
  784|  6.94k|    {
  785|  6.94k|        if (!at[i1].parity || !at[i1].stereo_bond_neighbor[0])
  ------------------
  |  Branch (785:13): [True: 3.37k, False: 3.56k]
  |  Branch (785:31): [True: 1.82k, False: 1.74k]
  ------------------
  786|  5.19k|        {
  787|  5.19k|            continue;
  788|  5.19k|        }
  789|       |
  790|  1.74k|        if (!PARITY_WELL_DEF( at[i1].parity ))
  ------------------
  |  |  266|  1.74k|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  1.74k|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|  3.48k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  1.74k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|  1.74k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  1.74k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|  1.74k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 1.74k, False: 0]
  |  |  |  Branch (266:85): [True: 526, False: 1.21k]
  |  |  ------------------
  ------------------
  791|  1.21k|        {
  792|  1.21k|            continue;
  793|  1.21k|        }
  794|       |
  795|    526|        nAtomRank1 = nRank[i1];
  796|    526|        iMax1 = (int) nAtomRank1 - 1;
  797|    526|        num_neigh1 = at[i1].valence;
  798|       |
  799|  1.33k|        for (n1 = 0;    n1 < MAX_NUM_STEREO_BONDS &&
  ------------------
  |  |  873|  2.66k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (799:25): [True: 1.33k, False: 0]
  ------------------
  800|  1.33k|            ( i2 = (int) at[i1].stereo_bond_neighbor[n1] );
  ------------------
  |  Branch (800:13): [True: 808, False: 526]
  ------------------
  801|    808|                           n1++)
  802|    808|        {
  803|    808|            i2--;
  804|       |
  805|       |            /*  found a stereo bond at[i1]-at[i2] adjacent to at[i1] */
  806|    808|            for (n2 = 0, m = 0;
  807|  1.02k|                    n2 < MAX_NUM_STEREO_BONDS &&
  ------------------
  |  |  873|  2.04k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (807:21): [True: 1.02k, False: 0]
  ------------------
  808|  1.02k|                    ( m = (int) at[i2].stereo_bond_neighbor[n2] ) && m - 1 != i1;
  ------------------
  |  Branch (808:21): [True: 1.02k, False: 0]
  |  Branch (808:70): [True: 213, False: 808]
  ------------------
  809|    808|                        n2++)
  810|    213|                ; /* locate stereo bond (#n2) at the opposite atom at[i2] */
  811|       |
  812|    808|            if (m - 1 != i1 || at[i1].stereo_bond_parity[n1] != at[i2].stereo_bond_parity[n2])
  ------------------
  |  Branch (812:17): [True: 0, False: 808]
  |  Branch (812:32): [True: 0, False: 808]
  ------------------
  813|      0|            {
  814|      0|                return CT_STEREOCOUNT_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  815|      0|            }
  816|    808|            if (i1 < i2)
  ------------------
  |  Branch (816:17): [True: 436, False: 372]
  ------------------
  817|    436|            {
  818|    436|                continue; /* do not process same bond 2 times */
  819|    436|            }
  820|    372|            if (PARITY_KNOWN( at[i1].stereo_bond_parity[n1] ) ||
  ------------------
  |  |  265|    744|#define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|    372|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|    744|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    372|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|    372|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    372|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|    372|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (265:38): [True: 372, False: 0]
  |  |  |  Branch (265:78): [True: 103, False: 269]
  |  |  ------------------
  ------------------
  821|    269|                !PARITY_VAL( at[i1].stereo_bond_parity[n1] ))
  ------------------
  |  |  262|    269|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|    269|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
  |  Branch (821:17): [True: 0, False: 269]
  ------------------
  822|    103|            {
  823|    103|                continue;
  824|    103|            }
  825|    269|            if (!PARITY_WELL_DEF( at[i1].parity ) ||
  ------------------
  |  |  266|    538|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    269|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|    538|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    269|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|    269|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    269|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|    269|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 269, False: 0]
  |  |  |  Branch (266:85): [True: 269, False: 0]
  |  |  ------------------
  ------------------
  826|    269|                 !PARITY_WELL_DEF( at[i2].parity ))
  ------------------
  |  |  266|    269|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    269|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|    538|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    269|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|    269|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    269|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|    269|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 269, False: 0]
  |  |  |  Branch (266:85): [True: 269, False: 0]
  |  |  ------------------
  ------------------
  827|      0|            {
  828|      0|                continue;
  829|      0|            }
  830|    269|            if (PARITY_VAL( at[i1].stereo_bond_parity[n1] ) != AB_PARITY_CALC)
  ------------------
  |  |  262|    269|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|    269|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
                          if (PARITY_VAL( at[i1].stereo_bond_parity[n1] ) != AB_PARITY_CALC)
  ------------------
  |  |  224|    269|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  ------------------
  |  Branch (830:17): [True: 0, False: 269]
  ------------------
  831|      0|            {
  832|      0|                continue;  /*  ?? program error ?? should not happen */ /*   <BRKPT> */
  833|      0|            }
  834|       |
  835|       |            /*stereo_bond_parity = PARITY_VAL(at[i1].stereo_bond_parity[n1]);*/
  836|    269|            cumulene_len = BOND_CHAIN_LEN( at[i1].stereo_bond_parity[n1] );
  ------------------
  |  |  214|    269|#define BOND_CHAIN_LEN(X)           (GET_BITS_CUMULENE_LEN(X)/MULT_STEREOBOND) /* 0 => double bond, 1 => allene, 2 => cumulene,..*/
  |  |  ------------------
  |  |  |  |  213|    269|#define GET_BITS_CUMULENE_LEN(X)    ((X)&MASK_CUMULENE_LEN)
  |  |  |  |  ------------------
  |  |  |  |  |  |  205|    269|#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,..*/
  |  |  ------------------
  |  |  |  |  209|    269|#define MULT_STEREOBOND    0x08  /* multiplier for cumulene chain length
  |  |  ------------------
  ------------------
  837|    269|            nAtomRank2 = nRank[i2];
  838|    269|            nAtom1NeighRank = nRank[(int) at[i1].neighbor[(int) at[i1].stereo_bond_ord[n1]]];
  839|    269|            num_neigh2 = at[i2].valence;
  840|       |
  841|       |            /*  store ranks of at[i1] stereo bond neighbors except one connected by a stereo bond */
  842|    269|            k = (int) at[i1].stereo_bond_ord[n1];
  843|    269|            trans_i1 = 0;
  844|    816|            for (i = j = 0; i < num_neigh1; i++)
  ------------------
  |  Branch (844:29): [True: 547, False: 269]
  ------------------
  845|    547|            {
  846|    547|                if (i != k)
  ------------------
  |  Branch (846:21): [True: 278, False: 269]
  ------------------
  847|    278|                {
  848|    278|                    nNeighRank1[j] = nRank[(int) at[i1].neighbor[i]];
  849|    278|                    j++;
  850|    278|                }
  851|    547|            }
  852|    269|            if (j == 2)
  ------------------
  |  Branch (852:17): [True: 23, False: 246]
  ------------------
  853|     23|            {
  854|     23|                if (nNeighRank1[0] == nNeighRank1[1])
  ------------------
  |  Branch (854:21): [True: 13, False: 10]
  ------------------
  855|     13|                {
  856|       |                    /*  neighbors are constitutionally identical, can't find bond parity */
  857|     13|                    continue;
  858|     13|                }
  859|     10|                trans_i1 = insertions_sort( pCG, nNeighRank1, j, sizeof( nNeighRank1[0] ), comp_AT_RANK );
  860|     10|            }
  861|       |
  862|       |            /*  store ranks of at[i2] stereo bond neighbors except one connected by a stereo bond */
  863|    256|            k = (int) at[i2].stereo_bond_ord[n2];
  864|    256|            trans_i2 = 0;
  865|    781|            for (i = j = 0; i < num_neigh2; i++)
  ------------------
  |  Branch (865:29): [True: 525, False: 256]
  ------------------
  866|    525|            {
  867|    525|                if (i != k)
  ------------------
  |  Branch (867:21): [True: 269, False: 256]
  ------------------
  868|    269|                {
  869|    269|                    nNeighRank2[j] = nRank[(int) at[i2].neighbor[i]];
  870|    269|                    j++;
  871|    269|                }
  872|    525|            }
  873|       |
  874|    256|            if (j == 2)
  ------------------
  |  Branch (874:17): [True: 26, False: 230]
  ------------------
  875|     26|            {
  876|     26|                if (nNeighRank2[0] == nNeighRank2[1])
  ------------------
  |  Branch (876:21): [True: 1, False: 25]
  ------------------
  877|      1|                {
  878|       |                    /*  neighbors are constitutionally identical, can't find bond parity */
  879|      1|                    continue;
  880|      1|                }
  881|     25|                trans_i2 = insertions_sort( pCG, nNeighRank2, j, sizeof( nNeighRank2[0] ), comp_AT_RANK );
  882|     25|            }
  883|       |
  884|    255|            prev_trans = -1;
  885|    255|            trans_k1 = -2; /* djb-rwth: ignoring LLVM warning: value used */
  886|    255|            trans_k = -4; /* 2004-04-28 */
  887|       |
  888|       |            /*  find all pairs of atoms that can be mapped on at[i1], at[i2] pair */
  889|    255|            for (j1 = 0;
  890|  1.41k|                    j1 <= iMax1 && nAtomRank1 == nRank[k1 = (int) nAtomNumber[iMax1 - j1]];
  ------------------
  |  Branch (890:21): [True: 1.27k, False: 145]
  |  Branch (890:36): [True: 1.16k, False: 110]
  ------------------
  891|  1.16k|                        j1++)
  892|  1.16k|            {
  893|       |                /*  at[k1] is constitutionally equivalent to at[i1] */
  894|       |                /*  find all at[k1] neighbors that have rank nAtomRank2; */
  895|       |                /*  then find at[k2] constitutionally equivalent at at[i2] */
  896|  1.16k|                if (at[k1].valence != num_neigh1)
  ------------------
  |  Branch (896:21): [True: 0, False: 1.16k]
  ------------------
  897|      0|                {
  898|      0|                    return CT_STEREOCOUNT_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  899|      0|                }
  900|  3.47k|                for (m1 = 0; m1 < num_neigh1; m1++)
  ------------------
  |  Branch (900:30): [True: 2.31k, False: 1.16k]
  ------------------
  901|  2.31k|                {
  902|  2.31k|                    int prev, next, len;
  903|  2.31k|                    if (nAtom1NeighRank != nRank[k2 = (int) at[k1].neighbor[m1]])
  ------------------
  |  Branch (903:25): [True: 180, False: 2.13k]
  ------------------
  904|    180|                    {
  905|    180|                        continue;
  906|    180|                    }
  907|  2.13k|                    m2 = -1; /*  undefined yet */
  908|  2.13k|                    prev = k1;
  909|       |                    /* djb-rwth: removing redundant code */
  910|  2.13k|                    if (cumulene_len)
  ------------------
  |  Branch (910:25): [True: 3, False: 2.13k]
  ------------------
  911|      3|                    {
  912|      6|                        for (len = 0, next = (int) at[k1].neighbor[m1]; len < cumulene_len; len++)
  ------------------
  |  Branch (912:73): [True: 3, False: 3]
  ------------------
  913|      3|                        {
  914|      3|                            if (at[next].valence == 2 && !at[next].num_H)
  ------------------
  |  Branch (914:33): [True: 3, False: 0]
  |  Branch (914:58): [True: 3, False: 0]
  ------------------
  915|      3|                            {
  916|      3|                                j = ( (int) at[next].neighbor[0] == prev );
  917|      3|                                prev = next;
  918|      3|                                next = at[next].neighbor[j];
  919|      3|                            }
  920|      0|                            else
  921|      0|                            {
  922|      0|                                break; /*  cannot continue */
  923|      0|                            }
  924|      3|                        }
  925|      3|                        if (len != cumulene_len || nAtomRank2 != nRank[next])
  ------------------
  |  Branch (925:29): [True: 0, False: 3]
  |  Branch (925:52): [True: 0, False: 3]
  ------------------
  926|      0|                        {
  927|      0|                            continue;  /*  not found */
  928|      0|                        }
  929|      3|                        k2 = next;
  930|      3|                    }
  931|  2.13k|                    if (at[k2].valence != num_neigh2)
  ------------------
  |  Branch (931:25): [True: 0, False: 2.13k]
  ------------------
  932|      0|                    {
  933|      0|                        return CT_STEREOCOUNT_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  934|      0|                    }
  935|       |
  936|       |                    /*  store canon. ranks of at[k1] neighbors */ /*  use i,j,k,m,n */
  937|  6.39k|                    for (n = j = 0; n < num_neigh1; n++)
  ------------------
  |  Branch (937:37): [True: 4.26k, False: 2.13k]
  ------------------
  938|  4.26k|                    {
  939|  4.26k|                        if (n != m1)
  ------------------
  |  Branch (939:29): [True: 2.12k, False: 2.13k]
  ------------------
  940|  2.12k|                        {
  941|  2.12k|                            i = (int) at[k1].neighbor[n];
  942|  2.13k|                            for (m = 0; m < num_neigh1 - 1; m++)
  ------------------
  |  Branch (942:41): [True: 2.13k, False: 0]
  ------------------
  943|  2.13k|                            {
  944|  2.13k|                                if (nRank[i] == nNeighRank1[m])
  ------------------
  |  Branch (944:37): [True: 2.12k, False: 11]
  ------------------
  945|  2.12k|                                {
  946|  2.12k|                                    nNeighCanonRank1[m] = nCanonRank[i];
  947|  2.12k|                                    j++;
  948|  2.12k|                                    break;
  949|  2.12k|                                }
  950|  2.13k|                            }
  951|  2.12k|                        }
  952|  4.26k|                    }
  953|  2.13k|                    if (j != num_neigh1 - 1)
  ------------------
  |  Branch (953:25): [True: 0, False: 2.13k]
  ------------------
  954|      0|                    {
  955|      0|                        return CT_STEREOCOUNT_ERR;  /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  956|      0|                    }
  957|  2.13k|                    if (j == 2)
  ------------------
  |  Branch (957:25): [True: 11, False: 2.12k]
  ------------------
  958|     11|                    {
  959|     11|                        trans_k1 = insertions_sort( pCG, nNeighCanonRank1, j, sizeof( nNeighCanonRank1[0] ), comp_AT_RANK );
  960|     11|                    }
  961|  2.12k|                    else
  962|  2.12k|                    {
  963|  2.12k|                        trans_k1 = 0;
  964|  2.12k|                    }
  965|       |
  966|       |                    /*  store canon. ranks of at[k2] neighbors */ /*  use i,j,k,m,n */
  967|  6.41k|                    for (n = j = 0; n < num_neigh2; n++)
  ------------------
  |  Branch (967:37): [True: 4.27k, False: 2.13k]
  ------------------
  968|  4.27k|                    {
  969|  4.27k|                        i = (int) at[k2].neighbor[n];
  970|  4.27k|                        if (i == prev)
  ------------------
  |  Branch (970:29): [True: 2.13k, False: 2.14k]
  ------------------
  971|  2.13k|                        {
  972|       |                            /* neighbor belongs to the stereobond */
  973|  2.13k|                            m2 = n;
  974|  2.13k|                        }
  975|  2.14k|                        else
  976|  2.14k|                        {
  977|  2.16k|                            for (m = 0; m < num_neigh2 - 1; m++)
  ------------------
  |  Branch (977:41): [True: 2.16k, False: 0]
  ------------------
  978|  2.16k|                            {
  979|  2.16k|                                if (nRank[i] == nNeighRank2[m])
  ------------------
  |  Branch (979:37): [True: 2.14k, False: 26]
  ------------------
  980|  2.14k|                                {
  981|  2.14k|                                    nNeighCanonRank2[m] = nCanonRank[i];
  982|  2.14k|                                    j++;
  983|  2.14k|                                    break;
  984|  2.14k|                                }
  985|  2.16k|                            }
  986|  2.14k|                        }
  987|  4.27k|                    }
  988|  2.13k|                    if (j != num_neigh2 - 1 || m2 < 0)
  ------------------
  |  Branch (988:25): [True: 0, False: 2.13k]
  |  Branch (988:48): [True: 0, False: 2.13k]
  ------------------
  989|      0|                    {
  990|      0|                        return CT_STEREOCOUNT_ERR;  /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  991|      0|                    }
  992|  2.13k|                    if (j == 2)
  ------------------
  |  Branch (992:25): [True: 26, False: 2.10k]
  ------------------
  993|     26|                    {
  994|     26|                        trans_k2 = insertions_sort( pCG, nNeighCanonRank2, j, sizeof( nNeighCanonRank2[0] ), comp_AT_RANK );
  995|     26|                    }
  996|  2.10k|                    else
  997|  2.10k|                    {
  998|  2.10k|                        trans_k2 = 0;
  999|  2.10k|                    }
 1000|  2.13k|                    trans_k = ( trans_k1 + trans_k2 ) % 2;
 1001|  2.13k|                    if (prev_trans < 0)
  ------------------
  |  Branch (1001:25): [True: 255, False: 1.87k]
  ------------------
 1002|    255|                    {
 1003|    255|                        prev_trans = trans_k;
 1004|    255|                    }
 1005|  1.87k|                    else if (prev_trans != trans_k)
  ------------------
  |  Branch (1005:30): [True: 0, False: 1.87k]
  ------------------
 1006|      0|                    {
 1007|       |                        /* was != trans_k1, changed 9-23-2003 */
 1008|      0|                        break; /*  different number of transpositions */
 1009|      0|                    }
 1010|  2.13k|                } /* end of the second atom mapping cycle */
 1011|  1.16k|                if (prev_trans >= 0 && prev_trans != trans_k)
  ------------------
  |  Branch (1011:21): [True: 1.16k, False: 0]
  |  Branch (1011:40): [True: 0, False: 1.16k]
  ------------------
 1012|      0|                { /* was != trans_k1, changed 9-23-2003 */
 1013|      0|                    break;
 1014|      0|                }
 1015|  1.16k|            } /* end of the first atom mapping cycle */
 1016|       |
 1017|    255|            if (prev_trans == trans_k)
  ------------------
  |  Branch (1017:17): [True: 255, False: 0]
  ------------------
 1018|    255|            {
 1019|       |                /* was == trans_k1, changed 9-23-2003 */
 1020|    255|                int z_prod;
 1021|       |
 1022|       |                /*  all mappings of canonical numbers on the */
 1023|       |                /*  stereo bond at[i1]-at[i2] produce equivalent numberings. */
 1024|       |                /*  Therefore the stereo bond parity is known at this time. */
 1025|       |                /*  parity_1 = at[i1].parity + (trans_i1 + trans_k1 + num_neigh1 - 1) + (int)at[i1].stereo_bond_ord[n1] */
 1026|       |                /*  expression in parentheses is equivalent to rank[first neigh] > rank[second neigh] */
 1027|       |                /*  same for parity_2. */
 1028|       |                /*  parity_2 = at[i2].parity + (trans_i2 + trans_k2 + num_neigh2 - 1) + (int)at[i2].stereo_bond_ord[n2] */
 1029|       |                /*  Sum of the two parities (without stereo_bond_z_prod) is: */
 1030|       |
 1031|    255|                parity = ( at[i1].parity + at[i2].parity + prev_trans + trans_i1 + trans_i2
 1032|    255|                              + num_neigh1 + num_neigh2
 1033|    255|                              + (int) at[i1].stereo_bond_ord[n1] + (int) at[i2].stereo_bond_ord[n2] ) % 2;
 1034|       |
 1035|    255|                z_prod = at[i1].stereo_bond_z_prod[n1];
 1036|    255|                if (MIN_DOT_PROD > abs( z_prod ))
  ------------------
  |  |  253|    255|#define MIN_DOT_PROD 50          /* min value of at->stereo_bond_z_prod[i] to define parity */
  ------------------
  |  Branch (1036:21): [True: 0, False: 255]
  ------------------
 1037|      0|                {
 1038|      0|                    parity = AB_PARITY_UNDF; /*  undefined because of geometry */
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 1039|      0|                }
 1040|    255|                else
 1041|    255|                {
 1042|    255|                    parity = ( z_prod > 0 ) ? 2 - parity : 1 + parity;
  ------------------
  |  Branch (1042:30): [True: 255, False: 0]
  ------------------
 1043|    255|                }
 1044|    255|                at[i1].stereo_bond_parity[n1] = ALL_BUT_PARITY( at[i1].stereo_bond_parity[n1] ) | parity;
  ------------------
  |  |  270|    255|#define ALL_BUT_PARITY(X)           ((X)&~BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|    255|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
 1045|    255|                at[i2].stereo_bond_parity[n2] = ALL_BUT_PARITY( at[i2].stereo_bond_parity[n2] ) | parity;
  ------------------
  |  |  270|    255|#define ALL_BUT_PARITY(X)           ((X)&~BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|    255|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
 1046|    255|                num_set++;
 1047|    255|            }
 1048|    255|        }
 1049|    526|    }
 1050|       |
 1051|  1.14k|    return num_set;
 1052|  1.14k|}
MarkKnownEqualStereoBondParities:
 1062|  1.14k|{
 1063|  1.14k|    int j, n, m, j1, num_neigh1, num_neigh2, iMax1;
 1064|  1.14k|    int num_set, /*num_sb1, num_sb2,*/ bDifferentParities;
 1065|  1.14k|    int i1, i2, k1, k2, n1, n2, m1, m2, s1, s2, stereo_bond_parity, stereo_bond_parity2, cumulene_len;
 1066|  1.14k|    AT_RANK nAtomRank1, nAtomRank2, nAtom1NeighRank, nAtom2NeighRank;
 1067|       |
 1068|       |    /* djb-rwth: removing redundant code */
 1069|       |
 1070|  8.08k|    for (i1 = 0, num_set = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (1070:31): [True: 6.94k, False: 1.14k]
  ------------------
 1071|  6.94k|    {
 1072|  6.94k|        if (!at[i1].parity || !at[i1].stereo_bond_neighbor[0])
  ------------------
  |  Branch (1072:13): [True: 3.37k, False: 3.56k]
  |  Branch (1072:31): [True: 1.82k, False: 1.74k]
  ------------------
 1073|  5.19k|        {
 1074|  5.19k|            continue;
 1075|  5.19k|        }
 1076|       |
 1077|  1.74k|        nAtomRank1 = nRank[i1];
 1078|  1.74k|        iMax1 = (int) nAtomRank1 - 1;
 1079|  1.74k|        num_neigh1 = at[i1].valence;
 1080|       |
 1081|       |        /*  count stereogenic bonds adjacent to at[i1] */
 1082|  1.74k|        for (n1 = 0;
 1083|  4.42k|                n1 < MAX_NUM_STEREO_BONDS && at[i1].stereo_bond_neighbor[n1];
  ------------------
  |  |  873|  8.84k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1083:17): [True: 4.42k, False: 0]
  |  Branch (1083:46): [True: 2.67k, False: 1.74k]
  ------------------
 1084|  2.67k|                    n1++);
 1085|       |
 1086|       |
 1087|       |        /*num_sb1 = n1;*/
 1088|       |        /*  search for bonds possibly constitutionally equivalent to each of the adjacent bonds */
 1089|       |        /*  and find if all of them have same already known parity */
 1090|       |
 1091|  1.74k|        for (n1 = 0;
 1092|  4.42k|                n1 < MAX_NUM_STEREO_BONDS && ( i2 = (int) at[i1].stereo_bond_neighbor[n1] );
  ------------------
  |  |  873|  8.84k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1092:17): [True: 4.42k, False: 0]
  |  Branch (1092:46): [True: 2.67k, False: 1.74k]
  ------------------
 1093|  2.67k|                    n1++) /* djb-rwth: removing redundant code */
 1094|  2.67k|        {
 1095|  2.67k|            i2--;
 1096|       |
 1097|  2.67k|            nAtomRank2 = nRank[i2];
 1098|  2.67k|            if (nAtomRank2 < nAtomRank1 || (nAtomRank2 == nAtomRank1 && i1 < i2)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1098:17): [True: 624, False: 2.05k]
  |  Branch (1098:45): [True: 1.43k, False: 624]
  |  Branch (1098:73): [True: 715, False: 715]
  ------------------
 1099|  1.33k|            {
 1100|       |                /*  An attempt to reduce unnecessary repetitions. */
 1101|       |                /*  We still have repetitions because we do not accumulate a list of */
 1102|       |                /*  processed (nAtomRank2, nAtomRank1) pairs. */
 1103|  1.33k|                continue;
 1104|  1.33k|            }
 1105|       |
 1106|  1.33k|            bDifferentParities = -1;   /*  parities have not been compared yet */
 1107|       |
 1108|       |            /*  found a stereo bond at[i1]-at[i2] (adjacent to at[i1]) */
 1109|       |            /*
 1110|       |            if ( !PARITY_KNOWN(at[i1].stereo_bond_parity[n1]) || (at[i1].stereo_bond_parity[n1] & KNOWN_PARITIES_EQL) )
 1111|       |            {
 1112|       |                continue;
 1113|       |            }
 1114|       |            */
 1115|  1.33k|            if (at[i1].stereo_bond_parity[n1] & KNOWN_PARITIES_EQL)
  ------------------
  |  |  206|  1.33k|#define KNOWN_PARITIES_EQL 0x40  /* parity is same for all pairs of constit. equivalent atoms       */
  ------------------
  |  Branch (1115:17): [True: 149, False: 1.19k]
  ------------------
 1116|    149|            {
 1117|    149|                continue;
 1118|    149|            }
 1119|       |
 1120|       |
 1121|       |            /*  stereo bond has known or unknown parity; we have not checked it yet */
 1122|       |
 1123|  1.19k|            for (n2 = 0;
 1124|  3.19k|                 n2 < MAX_NUM_STEREO_BONDS && at[i2].stereo_bond_neighbor[n2];
  ------------------
  |  |  873|  6.38k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1124:18): [True: 3.19k, False: 0]
  |  Branch (1124:47): [True: 2.00k, False: 1.19k]
  ------------------
 1125|  2.00k|                 n2++)
 1126|  2.00k|            {
 1127|  2.00k|                ;
 1128|  2.00k|            }
 1129|       |
 1130|       |            /*num_sb2 = n2;*/
 1131|  1.19k|            for (n2 = 0, m = 0;
 1132|  1.75k|                 n2 < MAX_NUM_STEREO_BONDS &&
  ------------------
  |  |  873|  3.51k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1132:18): [True: 1.75k, False: 0]
  ------------------
 1133|  1.75k|                 ( m = (int) at[i2].stereo_bond_neighbor[n2] ) &&
  ------------------
  |  Branch (1133:18): [True: 1.75k, False: 0]
  ------------------
 1134|  1.75k|                    m - 1 != i1;
  ------------------
  |  Branch (1134:21): [True: 565, False: 1.19k]
  ------------------
 1135|  1.19k|                 n2++)
 1136|    565|            {
 1137|    565|                ;
 1138|    565|            }
 1139|       |
 1140|  1.19k|            if (m - 1 != i1 || at[i1].stereo_bond_parity[n1] != at[i2].stereo_bond_parity[n2])
  ------------------
  |  Branch (1140:17): [True: 0, False: 1.19k]
  |  Branch (1140:32): [True: 0, False: 1.19k]
  ------------------
 1141|      0|            {
 1142|      0|                return CT_STEREOCOUNT_ERR; /*  program error: stereo bonds data in two directions are different */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1143|      0|            }
 1144|       |
 1145|  1.19k|            stereo_bond_parity = PARITY_VAL( at[i1].stereo_bond_parity[n1] );
  ------------------
  |  |  262|  1.19k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|  1.19k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
 1146|  1.19k|            cumulene_len = BOND_CHAIN_LEN( at[i1].stereo_bond_parity[n1] );
  ------------------
  |  |  214|  1.19k|#define BOND_CHAIN_LEN(X)           (GET_BITS_CUMULENE_LEN(X)/MULT_STEREOBOND) /* 0 => double bond, 1 => allene, 2 => cumulene,..*/
  |  |  ------------------
  |  |  |  |  213|  1.19k|#define GET_BITS_CUMULENE_LEN(X)    ((X)&MASK_CUMULENE_LEN)
  |  |  |  |  ------------------
  |  |  |  |  |  |  205|  1.19k|#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,..*/
  |  |  ------------------
  |  |  |  |  209|  1.19k|#define MULT_STEREOBOND    0x08  /* multiplier for cumulene chain length
  |  |  ------------------
  ------------------
 1147|  1.19k|            nAtom1NeighRank = nRank[(int) at[i1].neighbor[(int) at[i1].stereo_bond_ord[n1]]];
 1148|  1.19k|            nAtom2NeighRank = nRank[(int) at[i2].neighbor[(int) at[i2].stereo_bond_ord[n2]]];
 1149|  1.19k|            num_neigh2 = at[i2].valence;
 1150|       |
 1151|       |            /*  find all pairs of atoms that possibly can be mapped on at[i1], at[i2] pair */
 1152|       |            /*  (we may also find pairs that cannot be mapped, but we cannot miss any pair */
 1153|       |            /*  that can be mapped) */
 1154|       |
 1155|  7.15k|            for (j1 = 0; j1 <= iMax1 && nAtomRank1 == nRank[k1 = (int) nAtomNumber[iMax1 - j1]]; j1++)
  ------------------
  |  Branch (1155:26): [True: 6.23k, False: 917]
  |  Branch (1155:41): [True: 5.96k, False: 273]
  ------------------
 1156|  5.96k|            {
 1157|       |                /*  at[k1] is constitutionally equivalent to at[i1] */
 1158|       |                /*  find all at[k1] stereo bond neighbors at[k2] that have rank nAtomRank2; */
 1159|       |                /*  then find at[k2] constitutionally equivalent at at[i2] */
 1160|       |
 1161|  5.96k|                if (at[k1].valence != num_neigh1)
  ------------------
  |  Branch (1161:21): [True: 0, False: 5.96k]
  ------------------
 1162|      0|                {
 1163|      0|                    return CT_STEREOCOUNT_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1164|      0|                }
 1165|       |
 1166|  5.96k|                if (!at[k1].bHasStereoOrEquToStereo)
  ------------------
  |  Branch (1166:21): [True: 629, False: 5.33k]
  ------------------
 1167|    629|                {
 1168|    629|                    at[k1].bHasStereoOrEquToStereo = 1;
 1169|    629|                }
 1170|       |
 1171|       |                /* -- do not check number of stereo bonds, check bonds themselves --
 1172|       |                for ( s1 = 0; s1 < MAX_NUM_STEREO_BONDS && at[k1].stereo_bond_neighbor[s1]; s1++ )
 1173|       |                {
 1174|       |                    ;
 1175|       |                }
 1176|       |                if ( num_sb1 != s1 )
 1177|       |                {
 1178|       |                    bDifferentParities = 1;
 1179|       |                }
 1180|       |                */
 1181|       |
 1182|  17.9k|                for (m1 = 0; m1 < num_neigh1; m1++)
  ------------------
  |  Branch (1182:30): [True: 11.9k, False: 5.96k]
  ------------------
 1183|  11.9k|                {
 1184|       |                    /*  Looking for at[k1] neighbor with nRank=nAtom1NeighRank. */
 1185|       |                    /*  This neighbor may be on the bond constit. equivalent to at[i1]-at[i2] stereo bond */
 1186|       |                    /*  (or may be constit. equivalent an adjacent to at[i1] atom in a stereogenic cumulene chain) */
 1187|  11.9k|                    int prev, next, len;
 1188|  11.9k|                    if (nAtom1NeighRank != nRank[k2 = (int) at[k1].neighbor[m1]])
  ------------------
  |  Branch (1188:25): [True: 742, False: 11.2k]
  ------------------
 1189|    742|                        continue;
 1190|       |
 1191|       |                    /*  found at[k1] neighbor with nRank=nAtom1NeighRank */
 1192|       |
 1193|  11.2k|                    m2 = -1; /*  undefined yet */
 1194|  11.2k|                    prev = k1;
 1195|       |                    /* djb-rwth: removing redundant code */
 1196|       |
 1197|       |                    /*  if cumulene then bypass the cumulene chain */
 1198|       |
 1199|  11.2k|                    if (cumulene_len)
  ------------------
  |  Branch (1199:25): [True: 15, False: 11.2k]
  ------------------
 1200|     15|                    {
 1201|       |
 1202|     30|                        for (len = 0, next = (int) at[k1].neighbor[m1]; len < cumulene_len; len++)
  ------------------
  |  Branch (1202:73): [True: 15, False: 15]
  ------------------
 1203|     15|                        {
 1204|     15|                            if (at[next].valence == 2 && !at[next].num_H)
  ------------------
  |  Branch (1204:33): [True: 15, False: 0]
  |  Branch (1204:58): [True: 15, False: 0]
  ------------------
 1205|     15|                            {
 1206|     15|                                j = ( (int) at[next].neighbor[0] == prev );
 1207|     15|                                prev = next;
 1208|     15|                                next = at[next].neighbor[j];
 1209|     15|                            }
 1210|      0|                            else
 1211|      0|                            {
 1212|      0|                                break; /*  cannot continue: end of cumulene chain */
 1213|      0|                            }
 1214|     15|                        }
 1215|       |
 1216|     15|                        if (len != cumulene_len || nAtomRank2 != nRank[next])
  ------------------
  |  Branch (1216:29): [True: 0, False: 15]
  |  Branch (1216:52): [True: 0, False: 15]
  ------------------
 1217|      0|                        {
 1218|      0|                            continue;  /*  cumulene chain not found at this neighbor */
 1219|      0|                        }
 1220|       |
 1221|     15|                        if (nAtom2NeighRank != nRank[prev])
  ------------------
  |  Branch (1221:29): [True: 0, False: 15]
  ------------------
 1222|      0|                        {
 1223|       |                            /* continue; */ /*  ??? program error ??? If not, must be a very rare event */
 1224|      0|                            return CT_STEREOCOUNT_ERR;  /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1225|      0|                        }
 1226|       |
 1227|     15|                        k2 = next;
 1228|     15|                    }
 1229|       |
 1230|       |                    /*  a connected pair of constit. equivalent atoms found */
 1231|       |
 1232|  11.2k|                    if (at[k2].valence != num_neigh2)
  ------------------
  |  Branch (1232:25): [True: 0, False: 11.2k]
  ------------------
 1233|      0|                    {
 1234|      0|                        return CT_STEREOCOUNT_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1235|      0|                    }
 1236|       |
 1237|  16.6k|                    for (n = 0; n < num_neigh2; n++)
  ------------------
  |  Branch (1237:33): [True: 16.6k, False: 0]
  ------------------
 1238|  16.6k|                    {
 1239|  16.6k|                        if (prev == (int) at[k2].neighbor[n])
  ------------------
  |  Branch (1239:29): [True: 11.2k, False: 5.40k]
  ------------------
 1240|  11.2k|                        {
 1241|  11.2k|                            m2 = n; /*  found bond from the opposite end of a possibly stereogenic bond */
 1242|  11.2k|                            break;
 1243|  11.2k|                        }
 1244|  16.6k|                    }
 1245|       |
 1246|  11.2k|                    if (m2 < 0)
  ------------------
  |  Branch (1246:25): [True: 0, False: 11.2k]
  ------------------
 1247|      0|                    {
 1248|      0|                        return CT_STEREOCOUNT_ERR; /*  program error: opposite direction bond not found */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1249|      0|                    }
 1250|       |
 1251|  11.2k|                    if (!at[k2].bHasStereoOrEquToStereo)
  ------------------
  |  Branch (1251:25): [True: 1.18k, False: 10.0k]
  ------------------
 1252|  1.18k|                    {
 1253|  1.18k|                        at[k2].bHasStereoOrEquToStereo = 1;
 1254|  1.18k|                    }
 1255|       |
 1256|       |
 1257|       |                    /*  check if atoms at[k1] and at[k2] are connected by a stereo bond */
 1258|  11.2k|                    for (s1 = 0, m = 0;
 1259|  16.5k|                         s1 < MAX_NUM_STEREO_BONDS &&
  ------------------
  |  |  873|  33.0k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1259:26): [True: 16.5k, False: 0]
  ------------------
 1260|  16.5k|                         ( m = (int) at[k1].stereo_bond_neighbor[s1] ) &&
  ------------------
  |  Branch (1260:26): [True: 15.8k, False: 701]
  ------------------
 1261|  15.8k|                                    m - 1 != k2;
  ------------------
  |  Branch (1261:37): [True: 5.28k, False: 10.5k]
  ------------------
 1262|  11.2k|                         s1++)
 1263|  5.28k|                    {
 1264|  5.28k|                        ;
 1265|  5.28k|                    }
 1266|  11.2k|                    if (m - 1 != k2)
  ------------------
  |  Branch (1266:25): [True: 701, False: 10.5k]
  ------------------
 1267|    701|                    {
 1268|    701|                        bDifferentParities = 1; /*  cannot find the stereo bond */
 1269|    701|                        at[k1].bHasStereoOrEquToStereo =
 1270|    701|                            at[k2].bHasStereoOrEquToStereo = 2;
 1271|    701|                        continue;
 1272|    701|                    }
 1273|       |
 1274|       |                    /*  -- do not check number of stereo bonds, check bonds themselves --
 1275|       |                    for ( s2 = 0; s2 < MAX_NUM_STEREO_BONDS && at[k2].stereo_bond_neighbor[s2]; s2++ )
 1276|       |                     {
 1277|       |                        ;
 1278|       |                     }
 1279|       |                    if ( num_sb2 != s2 )
 1280|       |                    {
 1281|       |                        bDifferentParities = 1;
 1282|       |                        continue;
 1283|       |                    }
 1284|       |                    */
 1285|       |
 1286|  10.5k|                    for (s2 = 0, m = 0;
 1287|  15.3k|                         s2 < MAX_NUM_STEREO_BONDS &&
  ------------------
  |  |  873|  30.7k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1287:26): [True: 15.3k, False: 0]
  ------------------
 1288|  15.3k|                         ( m = (int) at[k2].stereo_bond_neighbor[s2] ) &&
  ------------------
  |  Branch (1288:26): [True: 15.3k, False: 0]
  ------------------
 1289|  15.3k|                                    m - 1 != k1;
  ------------------
  |  Branch (1289:37): [True: 4.83k, False: 10.5k]
  ------------------
 1290|  10.5k|                         s2++)
 1291|  4.83k|                    {
 1292|  4.83k|                        ;
 1293|  4.83k|                    }
 1294|       |
 1295|  10.5k|                    if (m - 1 != k1)
  ------------------
  |  Branch (1295:25): [True: 0, False: 10.5k]
  ------------------
 1296|      0|                    {
 1297|       |                        /*
 1298|       |                        bDifferentParities = 1; // cannot find the stereo bond
 1299|       |                        continue;
 1300|       |                        */
 1301|      0|                        return CT_STEREOCOUNT_ERR; /*  program error: opposite direction bond not found */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1302|      0|                    }
 1303|       |
 1304|  10.5k|                    if (at[k1].stereo_bond_parity[s1] != at[k2].stereo_bond_parity[s2])
  ------------------
  |  Branch (1304:25): [True: 0, False: 10.5k]
  ------------------
 1305|      0|                    {
 1306|      0|                        bDifferentParities = 1;
 1307|      0|                        continue;
 1308|      0|                    }
 1309|  10.5k|                    stereo_bond_parity2 = PARITY_VAL( at[k1].stereo_bond_parity[s1] );
  ------------------
  |  |  262|  10.5k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|  10.5k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
 1310|  10.5k|                    if (stereo_bond_parity2 != stereo_bond_parity)
  ------------------
  |  Branch (1310:25): [True: 2.92k, False: 7.61k]
  ------------------
 1311|  2.92k|                    {
 1312|  2.92k|                        bDifferentParities = 1;
 1313|  2.92k|                        continue;
 1314|  2.92k|                    }
 1315|  7.61k|                    if (stereo_bond_parity2 == stereo_bond_parity && bDifferentParities < 0)
  ------------------
  |  Branch (1315:25): [True: 7.61k, False: 0]
  |  Branch (1315:70): [True: 917, False: 6.69k]
  ------------------
 1316|    917|                    {
 1317|    917|                        bDifferentParities = 0;
 1318|    917|                    }
 1319|  7.61k|                }
 1320|  5.96k|            }
 1321|       |
 1322|       |            /*  mark equal parities */
 1323|  1.19k|            if (0 == bDifferentParities && PARITY_KNOWN( stereo_bond_parity ))
  ------------------
  |  |  265|    442|#define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|    442|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|    884|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    442|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|    442|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    442|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|    442|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (265:38): [True: 442, False: 0]
  |  |  |  Branch (265:78): [True: 428, False: 14]
  |  |  ------------------
  ------------------
  |  Branch (1323:17): [True: 442, False: 748]
  ------------------
 1324|    428|            {
 1325|    428|                for (j1 = 0;
 1326|  1.01k|                        j1 <= iMax1 && nAtomRank1 == nRank[k1 = (int) nAtomNumber[iMax1 - j1]];
  ------------------
  |  Branch (1326:25): [True: 791, False: 219]
  |  Branch (1326:40): [True: 582, False: 209]
  ------------------
 1327|    582|                            j1++)
 1328|    582|                {
 1329|       |                    /*  at[k1] is constitutionally equivalent to at[i1] */
 1330|  1.44k|                    for (s1 = 0; s1 < MAX_NUM_STEREO_BONDS && ( k2 = (int) at[k1].stereo_bond_neighbor[s1] ); s1++) /* djb-rwth: removing redundant code */
  ------------------
  |  |  873|  2.89k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1330:34): [True: 1.44k, False: 0]
  |  Branch (1330:63): [True: 863, False: 582]
  ------------------
 1331|    863|                    {
 1332|    863|                        k2--;
 1333|    863|                        if (nRank[k2] == nAtomRank2)
  ------------------
  |  Branch (1333:29): [True: 640, False: 223]
  ------------------
 1334|    640|                        {
 1335|    640|                            int b1, b2;
 1336|    640|                            for (s2 = 0, m = 0;
 1337|    778|                                 s2 < MAX_NUM_STEREO_BONDS &&
  ------------------
  |  |  873|  1.55k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1337:34): [True: 778, False: 0]
  ------------------
 1338|    778|                                    ( m = (int) at[k2].stereo_bond_neighbor[s2] ) &&
  ------------------
  |  Branch (1338:37): [True: 778, False: 0]
  ------------------
 1339|    778|                                    m - 1 != k1;
  ------------------
  |  Branch (1339:37): [True: 138, False: 640]
  ------------------
 1340|    640|                                 s2++)
 1341|    138|                            {
 1342|    138|                                ;
 1343|    138|                            }
 1344|       |
 1345|    640|                            if (m - 1 != k1)
  ------------------
  |  Branch (1345:33): [True: 0, False: 640]
  ------------------
 1346|      0|                            {
 1347|      0|                                return CT_STEREOCOUNT_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1348|      0|                            }
 1349|       |                            /*  mark the stereo bonds */
 1350|    640|                            b1 = !( at[k1].stereo_bond_parity[s1] & KNOWN_PARITIES_EQL );
  ------------------
  |  |  206|    640|#define KNOWN_PARITIES_EQL 0x40  /* parity is same for all pairs of constit. equivalent atoms       */
  ------------------
 1351|    640|                            b2 = !( at[k2].stereo_bond_parity[s2] & KNOWN_PARITIES_EQL );
  ------------------
  |  |  206|    640|#define KNOWN_PARITIES_EQL 0x40  /* parity is same for all pairs of constit. equivalent atoms       */
  ------------------
 1352|    640|                            if (2 == b1 + b2)
  ------------------
  |  Branch (1352:33): [True: 577, False: 63]
  ------------------
 1353|    577|                            {
 1354|    577|                                at[k1].stereo_bond_parity[s1] |= KNOWN_PARITIES_EQL;
  ------------------
  |  |  206|    577|#define KNOWN_PARITIES_EQL 0x40  /* parity is same for all pairs of constit. equivalent atoms       */
  ------------------
 1355|    577|                                at[k2].stereo_bond_parity[s2] |= KNOWN_PARITIES_EQL;
  ------------------
  |  |  206|    577|#define KNOWN_PARITIES_EQL 0x40  /* parity is same for all pairs of constit. equivalent atoms       */
  ------------------
 1356|    577|                                num_set++;
 1357|    577|                            }
 1358|     63|                            else if (b1 || b2)
  ------------------
  |  Branch (1358:38): [True: 0, False: 63]
  |  Branch (1358:44): [True: 0, False: 63]
  ------------------
 1359|      0|                            {
 1360|      0|                                return CT_STEREOCOUNT_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1361|      0|                            }
 1362|    640|                        }
 1363|    863|                    }
 1364|    582|                }
 1365|    428|            }
 1366|  1.19k|        }
 1367|  1.74k|    }
 1368|       |
 1369|  1.14k|    return num_set;
 1370|  1.14k|}
PathsHaveIdenticalKnownParities:
 1505|     34|{
 1506|     34|    int k;
 1507|     34|    AT_RANK n1, n2;
 1508|       |
 1509|     34|    nLength++;   /*  number of successfully traversed pairs of atoms */
 1510|     34|    nVisited1[cur1] = nLength;
 1511|     34|    nVisited2[cur2] = nLength;
 1512|       |
 1513|       |    /*  the atoms must be either both stereogenic and have well-defined parities or non-stereogenic at all. */
 1514|     34|    if (at[cur1].stereo_atom_parity != at[cur2].stereo_atom_parity ||
  ------------------
  |  Branch (1514:9): [True: 0, False: 34]
  ------------------
 1515|     34|         (at[cur1].stereo_atom_parity && !PARITY_WELL_DEF( at[cur1].stereo_atom_parity )) ) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  266|      0|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|      0|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      0|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|      0|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      0|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 0, False: 0]
  |  |  |  Branch (266:85): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1515:11): [True: 0, False: 34]
  ------------------
 1516|      0|    {
 1517|      0|        return 0;  /*  Reject: Different or unknown in advance parities */
 1518|      0|    }
 1519|       |
 1520|     34|    if (at[cur1].valence != at[cur2].valence)
  ------------------
  |  Branch (1520:9): [True: 0, False: 34]
  ------------------
 1521|      0|    {
 1522|      0|        return 0;  /*  program error */ /*   <BRKPT> */
 1523|      0|    }
 1524|       |
 1525|     34|    if (at[cur1].valence == 1)
  ------------------
  |  Branch (1525:9): [True: 34, False: 0]
  ------------------
 1526|     34|    {
 1527|     34|        return nLength; /*  so far success */
 1528|     34|    }
 1529|       |
 1530|       |
 1531|      0|    for (k = 1, n1 = MAX_ATOMS + 1, n2 = MAX_ATOMS + 1; k < at[cur1].valence; k++)
  ------------------
  |  |   15|      0|#define MAX_ATOMS  32766
  ------------------
                  for (k = 1, n1 = MAX_ATOMS + 1, n2 = MAX_ATOMS + 1; k < at[cur1].valence; k++)
  ------------------
  |  |   15|      0|#define MAX_ATOMS  32766
  ------------------
  |  Branch (1531:57): [True: 0, False: 0]
  ------------------
 1532|      0|    {
 1533|       |        /*  start from 1: since we do not go back, we have only (at[cur1].valence-1) bonds to try */
 1534|       |
 1535|      0|        if (!GetAndCheckNextNeighbors( at, cur1, prev1, cur2, prev2,
  ------------------
  |  Branch (1535:13): [True: 0, False: 0]
  ------------------
 1536|      0|            &n1, &n2, nVisited1, nVisited2,
 1537|      0|            nRank, nCanonRank ))
 1538|      0|        {
 1539|      0|            return 0; /*  different neighbors                       */
 1540|      0|        }
 1541|       |
 1542|       |        /*  In a DFS we do not traverse already visited atoms */
 1543|      0|        if (!nVisited1[n1])
  ------------------
  |  Branch (1543:13): [True: 0, False: 0]
  ------------------
 1544|      0|        {
 1545|       |            /*  recursion */
 1546|      0|            if (!( nLength = PathsHaveIdenticalKnownParities( at, cur1, n1, cur2, n2, nVisited1, nVisited2, nRank, nCanonRank, nLength ) ))
  ------------------
  |  Branch (1546:17): [True: 0, False: 0]
  ------------------
 1547|      0|            {
 1548|      0|                return 0;
 1549|      0|            }
 1550|      0|        }
 1551|      0|    }
 1552|       |
 1553|       |    /*  To be on a safe side, recheck after all nVisited[] have been set */
 1554|      0|    for (k = 1, n1 = MAX_ATOMS + 1, n2 = MAX_ATOMS + 1; k < at[cur1].valence; k++)
  ------------------
  |  |   15|      0|#define MAX_ATOMS  32766
  ------------------
                  for (k = 1, n1 = MAX_ATOMS + 1, n2 = MAX_ATOMS + 1; k < at[cur1].valence; k++)
  ------------------
  |  |   15|      0|#define MAX_ATOMS  32766
  ------------------
  |  Branch (1554:57): [True: 0, False: 0]
  ------------------
 1555|      0|    {
 1556|       |        /*  start from 1: since we do not go back, we have only (at[cur1].valence-1) bonds to try */
 1557|      0|        if (!GetAndCheckNextNeighbors( at, cur1, prev1, cur2, prev2,
  ------------------
  |  Branch (1557:13): [True: 0, False: 0]
  ------------------
 1558|      0|            &n1, &n2, nVisited1, nVisited2,
 1559|      0|            nRank, nCanonRank ))
 1560|      0|        {
 1561|      0|            return 0; /*  different neighbors */
 1562|      0|        }
 1563|      0|    }
 1564|       |
 1565|      0|    return nLength;
 1566|      0|}
RemoveKnownNonStereoBondParities:
 1578|  1.18k|{
 1579|  1.18k|    int j, n, m, ret;
 1580|       |
 1581|  1.18k|    int i1, n1, s2;
 1582|  1.18k|    AT_RANK nAtomRank1, nAtomRank2, neigh[3], opposite_atom, *nVisited = NULL;
 1583|  1.18k|    ret = 0;
 1584|  8.39k|    for (i1 = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (1584:18): [True: 7.21k, False: 1.18k]
  ------------------
 1585|  7.21k|    {
 1586|  7.21k|        if (at[i1].valence != 3 || !at[i1].stereo_bond_neighbor[0])
  ------------------
  |  Branch (1586:13): [True: 6.05k, False: 1.15k]
  |  Branch (1586:36): [True: 1.01k, False: 139]
  ------------------
 1587|  7.07k|        {
 1588|  7.07k|            continue;
 1589|  7.07k|        }
 1590|    281|        for (n1 = 0; n1 < MAX_NUM_STEREO_BONDS && ( s2 = at[i1].stereo_bond_neighbor[n1] ); n1++)
  ------------------
  |  |  873|    562|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1590:22): [True: 281, False: 0]
  |  Branch (1590:51): [True: 142, False: 139]
  ------------------
 1591|    142|        {
 1592|    142|            if (!PARITY_CALCULATE( at[i1].stereo_bond_parity[n1] ) && PARITY_WELL_DEF( at[i1].stereo_bond_parity[n1] ))
  ------------------
  |  |  267|    284|#define PARITY_CALCULATE(X)         (AB_PARITY_CALC == PARITY_VAL(X))
  |  |  ------------------
  |  |  |  |  224|    142|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  |  |  ------------------
  |  |               #define PARITY_CALCULATE(X)         (AB_PARITY_CALC == PARITY_VAL(X))
  |  |  ------------------
  |  |  |  |  262|    142|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    142|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          if (!PARITY_CALCULATE( at[i1].stereo_bond_parity[n1] ) && PARITY_WELL_DEF( at[i1].stereo_bond_parity[n1] ))
  ------------------
  |  |  266|    115|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    115|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|    230|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    115|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|    115|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    115|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|    115|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 115, False: 0]
  |  |  |  Branch (266:85): [True: 35, False: 80]
  |  |  ------------------
  ------------------
  |  Branch (1592:17): [True: 115, False: 27]
  ------------------
 1593|     35|            {
 1594|     35|                continue;
 1595|     35|            }
 1596|    107|            opposite_atom = (AT_RANK) ( s2 - 1 );
 1597|       |            /* s2 = at[i1].neighbor[m=(int)at[i1].stereo_bond_ord[n1]]; */
 1598|    107|            m = (int) at[i1].stereo_bond_ord[n1];
 1599|    428|            for (j = 0, n = 0; j < at[i1].valence; j++)
  ------------------
  |  Branch (1599:32): [True: 321, False: 107]
  ------------------
 1600|    321|            {
 1601|       |                /* if ( at[i1].neighbor[j] != s2 ) */
 1602|    321|                if (j != m)
  ------------------
  |  Branch (1602:21): [True: 214, False: 107]
  ------------------
 1603|    214|                {
 1604|    214|                    neigh[n++] = at[i1].neighbor[j];
 1605|    214|                }
 1606|    321|            }
 1607|    107|            if (n > 2)
  ------------------
  |  Branch (1607:17): [True: 0, False: 107]
  ------------------
 1608|      0|            {
 1609|      0|                ret = CT_STEREOBOND_ERROR;  /*   <BRKPT> */
  ------------------
  |  |   31|      0|#define CT_STEREOBOND_ERROR  (CT_ERR_FIRST-12)  /*(-30012) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1610|      0|                goto exit_function;
 1611|      0|            }
 1612|    107|            if (n != 2 || nRank[(int) neigh[0]] != nRank[(int) neigh[1]])
  ------------------
  |  Branch (1612:17): [True: 0, False: 107]
  |  Branch (1612:27): [True: 69, False: 38]
  ------------------
 1613|     69|            {
 1614|     69|                continue; /*  may happen if another half-bond has not a defined parity */
 1615|     69|            }
 1616|     38|            if (at[i1].nRingSystem == at[(int) neigh[0]].nRingSystem)
  ------------------
  |  Branch (1616:17): [True: 18, False: 20]
  ------------------
 1617|     18|            {
 1618|     18|                continue;  /*  no more ring system membership check is necessary because     */
 1619|     18|            }              /*  the two neighbors are to be constitutionally equivalent atoms */
 1620|     20|            if (!nVisited && !( nVisited = (AT_RANK*) inchi_malloc( sizeof( nVisited[0] )*num_atoms ) ))
  ------------------
  |  | 1143|     20|#define inchi_malloc   malloc
  ------------------
  |  Branch (1620:17): [True: 20, False: 0]
  |  Branch (1620:30): [True: 0, False: 20]
  ------------------
 1621|      0|            {
 1622|      0|                ret = CT_OUT_OF_RAM;  /*   <BRKPT> */
  ------------------
  |  |   21|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1623|      0|                goto exit_function;
 1624|      0|            }
 1625|     20|            memset( nVisited, 0, sizeof( nVisited[0] )*num_atoms ); /* djb-rwth: memset_s C11/Annex K variant? */
 1626|     20|            nVisited[i1] = 1;
 1627|     20|            if (PathsHaveIdenticalKnownParities( at, (AT_RANK) i1, neigh[0], (AT_RANK) i1, neigh[1], nVisited, nVisited, nRank, nCanonRank, 1 ))
  ------------------
  |  Branch (1627:17): [True: 20, False: 0]
  ------------------
 1628|     20|            {
 1629|     20|                if (!RemoveOneStereoBond( at, i1, /* atom number*/ n1 /* stereo bond number*/ ))
  ------------------
  |  Branch (1629:21): [True: 0, False: 20]
  ------------------
 1630|      0|                {
 1631|      0|                    ret = CT_STEREOBOND_ERROR;  /*   <BRKPT> */
  ------------------
  |  |   31|      0|#define CT_STEREOBOND_ERROR  (CT_ERR_FIRST-12)  /*(-30012) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1632|      0|                    goto exit_function;
 1633|      0|                }
 1634|     20|                n1--; /*  cycle counter may temporarily become negative */
 1635|       |                /*  Remove from pCS */
 1636|     20|                nAtomRank1 = inchi_max( nCanonRank[i1], nCanonRank[opposite_atom] );
  ------------------
  |  |  138|     20|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 20, False: 0]
  |  |  ------------------
  ------------------
 1637|     20|                nAtomRank2 = inchi_min( nCanonRank[i1], nCanonRank[opposite_atom] );
  ------------------
  |  |  139|     20|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 20]
  |  |  ------------------
  ------------------
 1638|     20|                for (n = 0, m = pCS->nLenLinearCTStereoDble - 1; n <= m; n++)
  ------------------
  |  Branch (1638:66): [True: 20, False: 0]
  ------------------
 1639|     20|                {
 1640|     20|                    if (pCS->LinearCTStereoDble[n].at_num1 == nAtomRank1 &&
  ------------------
  |  Branch (1640:25): [True: 20, False: 0]
  ------------------
 1641|     20|                         pCS->LinearCTStereoDble[n].at_num2 == nAtomRank2)
  ------------------
  |  Branch (1641:26): [True: 20, False: 0]
  ------------------
 1642|     20|                    {
 1643|     20|                        if (n < m)
  ------------------
  |  Branch (1643:29): [True: 0, False: 20]
  ------------------
 1644|      0|                        { /*  remove pCS->LinearCTStereoDble[n] */
 1645|      0|                            memmove( pCS->LinearCTStereoDble + n, pCS->LinearCTStereoDble + n + 1, ( (long long)m - (long long)n ) * sizeof( pCS->LinearCTStereoDble[0] ) ); /* djb-rwth: cast operators added */
 1646|      0|                        }
 1647|     20|                        pCS->nLenLinearCTStereoDble--;
 1648|       |#if ( bRELEASE_VERSION == 0 )
 1649|       |                        pCS->bExtract |= EXTR_KNOWN_USED_TO_REMOVE_PARITY;
 1650|       |#endif
 1651|     20|                        m = -1;   /*  set flag "found" */
 1652|     20|                        break;
 1653|     20|                    }
 1654|     20|                }
 1655|     20|                if (m >= 0)
  ------------------
  |  Branch (1655:21): [True: 0, False: 20]
  ------------------
 1656|      0|                {
 1657|      0|                    ret = CT_STEREOCOUNT_ERR;  /*  bond not found  <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1658|      0|                    goto exit_function;
 1659|      0|                }
 1660|     20|                ret++;  /*  number of removed known in advance non-stereo bonds */
 1661|     20|            }
 1662|     20|        }
 1663|    139|    }
 1664|       |
 1665|  1.18k|exit_function:
 1666|  1.18k|    if (nVisited)
  ------------------
  |  Branch (1666:9): [True: 20, False: 1.16k]
  ------------------
 1667|     20|    {
 1668|     20|        inchi_free( nVisited );
  ------------------
  |  | 1152|     20|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 20, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 20]
  |  |  ------------------
  ------------------
 1669|     20|    }
 1670|       |
 1671|  1.18k|    return ret;
 1672|  1.18k|}
SetKnownStereoCenterParities:
 1685|  1.14k|{
 1686|  1.14k|    int i, j, n, m, j1, k, num_neigh, iMax, trans_i, trans_k, prev_trans, num_set;
 1687|  1.14k|    AT_RANK nAtomRank;
 1688|  1.14k|    AT_RANK nNeighRank[MAX_NUM_STEREO_ATOM_NEIGH];
 1689|  1.14k|    AT_RANK nNeighCanonRank[MAX_NUM_STEREO_ATOM_NEIGH];
 1690|       |
 1691|  8.08k|    for (i = 0, num_set = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1691:30): [True: 6.94k, False: 1.14k]
  ------------------
 1692|  6.94k|    {
 1693|  6.94k|        if (!at[i].parity || at[i].stereo_bond_neighbor[0])
  ------------------
  |  Branch (1693:13): [True: 3.37k, False: 3.56k]
  |  Branch (1693:30): [True: 1.74k, False: 1.82k]
  ------------------
 1694|  5.12k|        {
 1695|  5.12k|            continue;
 1696|  5.12k|        }
 1697|  1.82k|        if (at[i].stereo_atom_parity != AB_PARITY_CALC ||
  ------------------
  |  |  224|  3.64k|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  ------------------
  |  Branch (1697:13): [True: 1.14k, False: 678]
  ------------------
 1698|    678|             !PARITY_WELL_DEF( at[i].parity ))
  ------------------
  |  |  266|    678|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    678|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|  1.35k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    678|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|    678|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    678|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|    678|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 678, False: 0]
  |  |  |  Branch (266:85): [True: 678, False: 0]
  |  |  ------------------
  ------------------
 1699|  1.14k|        {
 1700|  1.14k|            continue;
 1701|  1.14k|        }
 1702|    678|        num_neigh = at[i].valence;
 1703|  3.17k|        for (j = 0; j < num_neigh; j++)
  ------------------
  |  Branch (1703:21): [True: 2.49k, False: 678]
  ------------------
 1704|  2.49k|        {
 1705|  2.49k|            nNeighRank[j] = nRank[(int) at[i].neighbor[j]];
 1706|  2.49k|        }
 1707|    678|        nAtomRank = nRank[i];
 1708|    678|        if (num_neigh == 1)
  ------------------
  |  Branch (1708:13): [True: 0, False: 678]
  ------------------
 1709|      0|        {
 1710|       |            /* other neighbors must be implicit H */
 1711|      0|            at[i].stereo_atom_parity = at[i].parity;
 1712|      0|            trans_i = 0;
 1713|      0|        }
 1714|    678|        else
 1715|    678|        {
 1716|       |            /* sort constitutional equivalence ranks of the neighbors */
 1717|    678|            trans_i = insertions_sort( pCG, nNeighRank, num_neigh, sizeof( nNeighRank[0] ), comp_AT_RANK );
 1718|  1.38k|            for (j = 1; j < num_neigh; j++)
  ------------------
  |  Branch (1718:25): [True: 1.18k, False: 206]
  ------------------
 1719|  1.18k|            {
 1720|  1.18k|                if (nNeighRank[j - 1] == nNeighRank[j])
  ------------------
  |  Branch (1720:21): [True: 472, False: 709]
  ------------------
 1721|    472|                {
 1722|    472|                    break; /* at[i] has consitutionally identical neighbors */
 1723|    472|                }
 1724|  1.18k|            }
 1725|    678|            if (j < num_neigh)
  ------------------
  |  Branch (1725:17): [True: 472, False: 206]
  ------------------
 1726|    472|            {
 1727|       |                /*  at least 2 neighbors are const. identical; parity cannot be calculated at this time */
 1728|    472|                continue; /*  try next stereo atom */
 1729|    472|            }
 1730|    678|        }
 1731|    206|        prev_trans = -1;
 1732|    206|        trans_k = 0;
 1733|       |        /*  find neighbors of constitutionally equivalent stereo centers */
 1734|       |        /*  and at[i] parities in case those centers are mapped on at[i] */
 1735|    206|        for (iMax = (int) nAtomRank - 1, j1 = 0;
 1736|    471|                j1 <= iMax && nAtomRank == nRank[k = (int) nAtomNumber[iMax - j1]];
  ------------------
  |  Branch (1736:17): [True: 446, False: 25]
  |  Branch (1736:31): [True: 265, False: 181]
  ------------------
 1737|    265|                    j1++)
 1738|    265|        {
 1739|       |            /*  at[k] is constitutionally equivalent to at[i] */
 1740|    265|            if ((int) at[k].valence != num_neigh)
  ------------------
  |  Branch (1740:17): [True: 0, False: 265]
  ------------------
 1741|      0|            {
 1742|      0|                return CT_STEREOCOUNT_ERR;  /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1743|      0|            }
 1744|       |            /* -- commented out to accept  non-stereogenic atoms since     --
 1745|       |               -- they may participate in mapping stereocenters 12-16-2003 --
 1746|       |            if ( !PARITY_VAL(at[k].parity) ) {
 1747|       |                continue; // not a stereogenic atom
 1748|       |            }
 1749|       |            */
 1750|  1.19k|            for (j = 0, m = 0; m < num_neigh; m++)
  ------------------
  |  Branch (1750:32): [True: 931, False: 265]
  ------------------
 1751|    931|            {
 1752|  2.13k|                for (n = 0; n < num_neigh; n++)
  ------------------
  |  Branch (1752:29): [True: 2.13k, False: 0]
  ------------------
 1753|  2.13k|                {
 1754|  2.13k|                    if (nRank[(int) at[k].neighbor[n]] == nNeighRank[m])
  ------------------
  |  Branch (1754:25): [True: 931, False: 1.20k]
  ------------------
 1755|    931|                    {
 1756|       |                        /* save canonical numbers (ranks) of the neighbors in
 1757|       |                         * order of increasing constit. equivalence ranks */
 1758|    931|                        nNeighCanonRank[m] = nCanonRank[(int) at[k].neighbor[n]];
 1759|    931|                        j++;
 1760|    931|                        break;
 1761|    931|                    }
 1762|  2.13k|                }
 1763|    931|            }
 1764|    265|            if (j != num_neigh)
  ------------------
  |  Branch (1764:17): [True: 0, False: 265]
  ------------------
 1765|      0|            {
 1766|      0|                return CT_STEREOCOUNT_ERR;  /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1767|      0|            }
 1768|    265|            trans_k = insertions_sort( pCG, nNeighCanonRank, num_neigh, sizeof( nNeighCanonRank[0] ), comp_AT_RANK );
 1769|    265|            trans_k %= 2;
 1770|    265|            if (prev_trans < 0)
  ------------------
  |  Branch (1770:17): [True: 206, False: 59]
  ------------------
 1771|    206|            {
 1772|    206|                prev_trans = trans_k;
 1773|    206|            }
 1774|     59|            else if (trans_k != prev_trans)
  ------------------
  |  Branch (1774:22): [True: 0, False: 59]
  ------------------
 1775|      0|            {
 1776|       |                /*  different mappings may produce different parities. Cannot find the parity at this time */
 1777|       |                /*  this may happen when a set of constit. equivalent atoms has non-contiguous canonical numbers */
 1778|      0|                break;
 1779|      0|            }
 1780|    265|        }
 1781|    206|        if (trans_k == prev_trans)
  ------------------
  |  Branch (1781:13): [True: 206, False: 0]
  ------------------
 1782|    206|        {
 1783|    206|            at[i].stereo_atom_parity = 2 - ( at[i].parity + trans_i + prev_trans ) % 2;
 1784|    206|            num_set++;
 1785|    206|        }
 1786|    206|    }
 1787|       |
 1788|  1.14k|    return num_set;
 1789|  1.14k|}
RemoveKnownNonStereoCenterParities:
 1804|  1.18k|{
 1805|  1.18k|    int i, j, n, m, k, num_neigh, ret = 0;
 1806|       |    /*AT_RANK nAtomRank;*/
 1807|  1.18k|    AT_RANK nNeighRank[MAX_NUM_STEREO_ATOM_NEIGH], nNeighOrd[MAX_NUM_STEREO_ATOM_NEIGH];
 1808|  1.18k|    AT_RANK *nVisited = NULL;
 1809|       |
 1810|  8.39k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1810:17): [True: 7.21k, False: 1.18k]
  ------------------
 1811|  7.21k|    {
 1812|  7.21k|        if (!at[i].parity || at[i].stereo_bond_neighbor[0])
  ------------------
  |  Branch (1812:13): [True: 3.61k, False: 3.59k]
  |  Branch (1812:30): [True: 1.74k, False: 1.84k]
  ------------------
 1813|  5.36k|        {
 1814|  5.36k|            continue;
 1815|  5.36k|        }
 1816|  1.84k|        if (!PARITY_CALCULATE( at[i].stereo_atom_parity ) && PARITY_WELL_DEF( at[i].stereo_atom_parity ))
  ------------------
  |  |  267|  3.69k|#define PARITY_CALCULATE(X)         (AB_PARITY_CALC == PARITY_VAL(X))
  |  |  ------------------
  |  |  |  |  224|  1.84k|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  |  |  ------------------
  |  |               #define PARITY_CALCULATE(X)         (AB_PARITY_CALC == PARITY_VAL(X))
  |  |  ------------------
  |  |  |  |  262|  1.84k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  1.84k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                      if (!PARITY_CALCULATE( at[i].stereo_atom_parity ) && PARITY_WELL_DEF( at[i].stereo_atom_parity ))
  ------------------
  |  |  266|  1.37k|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  1.37k|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|  2.75k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  1.37k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|  1.37k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  1.37k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|  1.37k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 1.37k, False: 0]
  |  |  |  Branch (266:85): [True: 230, False: 1.14k]
  |  |  ------------------
  ------------------
  |  Branch (1816:13): [True: 1.37k, False: 472]
  ------------------
 1817|    230|        {
 1818|    230|            continue;
 1819|    230|        }
 1820|  1.61k|        num_neigh = at[i].valence;
 1821|  7.63k|        for (j = 0; j < num_neigh; j++)
  ------------------
  |  Branch (1821:21): [True: 6.02k, False: 1.61k]
  ------------------
 1822|  6.02k|        {
 1823|  6.02k|            nNeighRank[j] = nRank[(int) at[i].neighbor[j]];
 1824|  6.02k|            nNeighOrd[j] = j;
 1825|  6.02k|        }
 1826|       |        /*nAtomRank = nRank[i];*/
 1827|  1.61k|        if (num_neigh == 1)
  ------------------
  |  Branch (1827:13): [True: 0, False: 1.61k]
  ------------------
 1828|      0|        {
 1829|      0|            continue;
 1830|      0|        }
 1831|  1.61k|        pCG->m_pn_RankForSort = nNeighRank;
 1832|  1.61k|        insertions_sort( pCG, nNeighOrd, num_neigh, sizeof( nNeighRank[0] ), CompRanksOrd );
 1833|  6.01k|        for (j = k = 1; k && j < num_neigh; j++)
  ------------------
  |  Branch (1833:25): [True: 5.99k, False: 14]
  |  Branch (1833:30): [True: 4.39k, False: 1.60k]
  ------------------
 1834|  4.39k|        {
 1835|  4.39k|            if (at[i].nRingSystem != at[(int) at[i].neighbor[(int) nNeighOrd[j]]].nRingSystem &&
  ------------------
  |  Branch (1835:17): [True: 307, False: 4.08k]
  ------------------
 1836|       |                 /*  no more ring system membership check is necessary because */
 1837|       |                 /*  the two neighbors are to be constitutionally equivalent atoms: */
 1838|    307|                nNeighRank[nNeighOrd[j - 1]] == nNeighRank[nNeighOrd[j]])
  ------------------
  |  Branch (1838:17): [True: 14, False: 293]
  ------------------
 1839|     14|            {
 1840|     14|                k = j;
 1841|     14|                do
 1842|     14|                {
 1843|     14|                    if (!nVisited && !( nVisited = (AT_RANK*) inchi_malloc( sizeof( nVisited[0] )*num_atoms ) ))
  ------------------
  |  | 1143|     14|#define inchi_malloc   malloc
  ------------------
  |  Branch (1843:25): [True: 14, False: 0]
  |  Branch (1843:38): [True: 0, False: 14]
  ------------------
 1844|      0|                    {
 1845|      0|                        ret = CT_OUT_OF_RAM;  /*   <BRKPT> */
  ------------------
  |  |   21|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1846|      0|                        goto exit_function;
 1847|      0|                    }
 1848|     14|                    memset( nVisited, 0, sizeof( nVisited[0] )*num_atoms ); /* djb-rwth: memset_s C11/Annex K variant? */
 1849|     14|                    nVisited[i] = 1;
 1850|     14|                    if (PathsHaveIdenticalKnownParities( at, (AT_RANK) i, at[i].neighbor[(int) nNeighOrd[j - 1]],
  ------------------
  |  Branch (1850:25): [True: 14, False: 0]
  ------------------
 1851|     14|                        (AT_RANK) i, at[i].neighbor[(int) nNeighOrd[k]],
 1852|     14|                        nVisited, nVisited, nRank, nCanonRank, 1 ))
 1853|     14|                    {
 1854|     14|                        at[i].parity = 0; /*  remove parity */
 1855|     14|                        at[i].stereo_atom_parity = 0;
 1856|     14|                        at[i].final_parity = 0;
 1857|       |                        /* at[i].bHasStereoOrEquToStereo = 0; */
 1858|     28|                        for (n = 0, m = pCS->nLenLinearCTStereoCarb - 1; n <= m; n++)
  ------------------
  |  Branch (1858:74): [True: 28, False: 0]
  ------------------
 1859|     28|                        {
 1860|     28|                            if (pCS->LinearCTStereoCarb[n].at_num == nCanonRank[i])
  ------------------
  |  Branch (1860:33): [True: 14, False: 14]
  ------------------
 1861|     14|                            {
 1862|     14|                                if (n < m)
  ------------------
  |  Branch (1862:37): [True: 3, False: 11]
  ------------------
 1863|      3|                                {    /*  remove pCS->LinearCTStereoCarb[n] */
 1864|      3|                                    memmove( pCS->LinearCTStereoCarb + n, pCS->LinearCTStereoCarb + n + 1, ( (long long)m - (long long)n ) * sizeof( pCS->LinearCTStereoCarb[0] ) ); /* djb-rwth: cast operators added */
 1865|      3|                                }
 1866|     14|                                pCS->nLenLinearCTStereoCarb--;
 1867|     14|                                k = 0;
 1868|       |
 1869|       |#if ( bRELEASE_VERSION == 0 )
 1870|       |                                pCS->bExtract |= EXTR_KNOWN_USED_TO_REMOVE_PARITY;
 1871|       |#endif
 1872|       |
 1873|     14|                                break;
 1874|     14|                            }
 1875|     28|                        }
 1876|     14|                        if (k)
  ------------------
  |  Branch (1876:29): [True: 0, False: 14]
  ------------------
 1877|      0|                        {
 1878|      0|                            ret = CT_STEREOCOUNT_ERR;  /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1879|      0|                            goto exit_function;
 1880|      0|                        }
 1881|     14|                        ret++;
 1882|     14|                        break;
 1883|     14|                    }
 1884|     14|                }
 1885|     14|                while (++k < num_neigh && nNeighRank[nNeighOrd[j - 1]] == nNeighRank[nNeighOrd[k]]);
  ------------------
  |  Branch (1885:24): [True: 0, False: 0]
  |  Branch (1885:43): [True: 0, False: 0]
  ------------------
 1886|     14|            }
 1887|  4.39k|        }
 1888|  1.61k|    }
 1889|       |
 1890|  1.18k|exit_function:
 1891|  1.18k|    if (nVisited)
  ------------------
  |  Branch (1891:9): [True: 14, False: 1.16k]
  ------------------
 1892|     14|    {
 1893|     14|        inchi_free( nVisited );
  ------------------
  |  | 1152|     14|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 14, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 14]
  |  |  ------------------
  ------------------
 1894|     14|    }
 1895|       |
 1896|  1.18k|    return ret;
 1897|  1.18k|}
MarkKnownEqualStereoCenterParities:
 1911|  1.14k|{
 1912|  1.14k|    int i, j1, k, num_centers, iMax, bDifferentParities;
 1913|  1.14k|    AT_RANK nAtomRank;
 1914|  1.14k|    int  parity, parity_k;
 1915|       |
 1916|  1.14k|    num_centers = 0;
 1917|  8.08k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1917:17): [True: 6.94k, False: 1.14k]
  ------------------
 1918|  6.94k|    {
 1919|  6.94k|        if (!at[i].parity || at[i].stereo_bond_neighbor[0])
  ------------------
  |  Branch (1919:13): [True: 3.37k, False: 3.56k]
  |  Branch (1919:30): [True: 1.74k, False: 1.82k]
  ------------------
 1920|  5.12k|        {
 1921|  5.12k|            continue;
 1922|  5.12k|        }
 1923|  1.82k|        if (at[i].bHasStereoOrEquToStereo)
  ------------------
  |  Branch (1923:13): [True: 584, False: 1.23k]
  ------------------
 1924|    584|        {
 1925|    584|            continue; /* already marked */
 1926|    584|        }
 1927|  1.23k|        if ( /*!PARITY_KNOWN(at[i].stereo_atom_parity) ||*/ ( at[i].stereo_atom_parity & KNOWN_PARITIES_EQL ))
  ------------------
  |  |  206|  1.23k|#define KNOWN_PARITIES_EQL 0x40  /* parity is same for all pairs of constit. equivalent atoms       */
  ------------------
  |  Branch (1927:61): [True: 0, False: 1.23k]
  ------------------
 1928|      0|        {
 1929|      0|            continue;
 1930|      0|        }
 1931|  1.23k|        parity = PARITY_VAL( at[i].stereo_atom_parity );
  ------------------
  |  |  262|  1.23k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|  1.23k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
 1932|  1.23k|        if (parity == AB_PARITY_NONE)
  ------------------
  |  |  218|  1.23k|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (1932:13): [True: 0, False: 1.23k]
  ------------------
 1933|      0|        {
 1934|      0|            continue;
 1935|      0|        }
 1936|  1.23k|        nAtomRank = nRank[i];
 1937|  1.23k|        bDifferentParities = -1;
 1938|       |        /*  find constitutionally equivalent stereo centers and compare their known at this time parities */
 1939|  3.19k|        for (iMax = (int) nAtomRank - 1, j1 = 0; j1 <= iMax && nAtomRank == nRank[k = (int) nAtomNumber[iMax - j1]]; j1++)
  ------------------
  |  Branch (1939:50): [True: 2.93k, False: 257]
  |  Branch (1939:64): [True: 1.95k, False: 979]
  ------------------
 1940|  1.95k|        {
 1941|       |            /*  at[k] is constitutionally equivalent to at[i] */
 1942|  1.95k|            parity_k = PARITY_VAL( at[k].stereo_atom_parity );
  ------------------
  |  |  262|  1.95k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|  1.95k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
 1943|  1.95k|            if (parity_k != parity)
  ------------------
  |  Branch (1943:17): [True: 405, False: 1.54k]
  ------------------
 1944|    405|            {
 1945|    405|                bDifferentParities = 1;
 1946|    405|            }
 1947|  1.54k|            else if (parity_k == parity && bDifferentParities < 0)
  ------------------
  |  Branch (1947:22): [True: 1.54k, False: 0]
  |  Branch (1947:44): [True: 1.02k, False: 526]
  ------------------
 1948|  1.02k|            {
 1949|  1.02k|                bDifferentParities = 0;
 1950|  1.02k|            }
 1951|  1.95k|            if (!parity_k)
  ------------------
  |  Branch (1951:17): [True: 134, False: 1.82k]
  ------------------
 1952|    134|            {
 1953|    134|                at[k].bHasStereoOrEquToStereo = 2;
 1954|    134|            }
 1955|  1.82k|            else if (!at[k].bHasStereoOrEquToStereo)
  ------------------
  |  Branch (1955:22): [True: 1.82k, False: 0]
  ------------------
 1956|  1.82k|            {
 1957|  1.82k|                at[k].bHasStereoOrEquToStereo = 1;
 1958|  1.82k|            }
 1959|  1.95k|        }
 1960|  1.23k|        if (0 == bDifferentParities && PARITY_KNOWN( parity ))
  ------------------
  |  |  265|    950|#define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|    950|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|  1.90k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    950|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|    950|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    950|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|    950|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (265:38): [True: 950, False: 0]
  |  |  |  Branch (265:78): [True: 731, False: 219]
  |  |  ------------------
  ------------------
  |  Branch (1960:13): [True: 950, False: 286]
  ------------------
 1961|    731|        {
 1962|  1.64k|            for (iMax = (int) nAtomRank - 1, j1 = 0; j1 <= iMax && nAtomRank == nRank[k = (int) nAtomNumber[iMax - j1]]; j1++)
  ------------------
  |  Branch (1962:54): [True: 1.55k, False: 86]
  |  Branch (1962:68): [True: 911, False: 645]
  ------------------
 1963|    911|            {
 1964|       |                /*  at[k] is constitutionally equivalent to at[i] */
 1965|    911|                at[k].stereo_atom_parity |= KNOWN_PARITIES_EQL;
  ------------------
  |  |  206|    911|#define KNOWN_PARITIES_EQL 0x40  /* parity is same for all pairs of constit. equivalent atoms       */
  ------------------
 1966|    911|                num_centers++;
 1967|    911|            }
 1968|    731|        }
 1969|  1.23k|    }
 1970|       |
 1971|  1.14k|    return num_centers;
 1972|  1.14k|}
InvertStereo:
 1987|  1.56k|{
 1988|  1.56k|    int i, j, j1, j2, num_changes, parity, cumulene_len;
 1989|       |
 1990|  1.56k|    num_changes = 0;
 1991|  11.1k|    for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (1991:17): [True: 9.55k, False: 1.56k]
  ------------------
 1992|  9.55k|    {
 1993|  9.55k|        nAtomNumberCanon[(int) nCanonRank[i] - 1] = i;
 1994|  9.55k|    }
 1995|  4.52k|    for (i = 0; i < pCS->nLenLinearCTStereoCarb; i++)
  ------------------
  |  Branch (1995:17): [True: 2.96k, False: 1.56k]
  ------------------
 1996|  2.96k|    {
 1997|  2.96k|        parity = pCS->LinearCTStereoCarb[i].parity;
 1998|  2.96k|        if (ATOM_PARITY_WELL_DEF( parity ))
  ------------------
  |  |  259|  2.96k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  2.96k|#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)
  |  |  ------------------
  |  |  |  |  236|  2.96k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 2.96k, False: 0]
  |  |  |  Branch (259:75): [True: 1.14k, False: 1.82k]
  |  |  ------------------
  ------------------
 1999|  1.14k|        {
 2000|  1.14k|            j = nAtomNumberCanon[(int) pCS->LinearCTStereoCarb[i].at_num - 1];
 2001|  1.14k|            if (PARITY_WELL_DEF( at[j].parity ))
  ------------------
  |  |  266|  1.14k|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  1.14k|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|  2.28k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  1.14k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|  1.14k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  1.14k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|  1.14k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 1.14k, False: 0]
  |  |  |  Branch (266:85): [True: 1.14k, False: 1]
  |  |  ------------------
  ------------------
 2002|  1.14k|            {
 2003|  1.14k|                at[j].parity ^= AB_INV_PARITY_BITS;
  ------------------
  |  |  227|  1.14k|#define AB_INV_PARITY_BITS (AB_PARITY_ODD ^ AB_PARITY_EVEN)
  |  |  ------------------
  |  |  |  |  219|  1.14k|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  |  |  ------------------
  |  |               #define AB_INV_PARITY_BITS (AB_PARITY_ODD ^ AB_PARITY_EVEN)
  |  |  ------------------
  |  |  |  |  220|  1.14k|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  |  |  ------------------
  ------------------
 2004|  1.14k|            }
 2005|      1|            else
 2006|      1|            {
 2007|      1|                goto exit_error; /* inconsistency */
 2008|      1|            }
 2009|  1.14k|            if (bInvertLinearCTStereo)
  ------------------
  |  Branch (2009:17): [True: 572, False: 570]
  ------------------
 2010|    572|            {
 2011|    572|#ifdef FIX_STEREOCOUNT_ERR
 2012|    572|                pCS->LinearCTStereoCarb[i].parity = AB_PARITY_EVEN; /* deliberately worse */
  ------------------
  |  |  220|    572|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
 2013|       |#else
 2014|       |                pCS->LinearCTStereoCarb[i].parity ^= AB_INV_PARITY_BITS;
 2015|       |#endif
 2016|    572|            }
 2017|  1.14k|            num_changes++;
 2018|  1.14k|            if (PARITY_WELL_DEF( at[j].stereo_atom_parity ))
  ------------------
  |  |  266|  1.14k|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  1.14k|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|  2.28k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  1.14k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|  1.14k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  1.14k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|  1.14k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 1.14k, False: 0]
  |  |  |  Branch (266:85): [True: 412, False: 730]
  |  |  ------------------
  ------------------
 2019|    412|            {
 2020|    412|                at[j].stereo_atom_parity ^= AB_INV_PARITY_BITS;
  ------------------
  |  |  227|    412|#define AB_INV_PARITY_BITS (AB_PARITY_ODD ^ AB_PARITY_EVEN)
  |  |  ------------------
  |  |  |  |  219|    412|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  |  |  ------------------
  |  |               #define AB_INV_PARITY_BITS (AB_PARITY_ODD ^ AB_PARITY_EVEN)
  |  |  ------------------
  |  |  |  |  220|    412|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  |  |  ------------------
  ------------------
 2021|    412|            }
 2022|  1.14k|            if (PARITY_WELL_DEF( at[j].final_parity ))
  ------------------
  |  |  266|  1.14k|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  1.14k|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|  2.28k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  1.14k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|      0|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      0|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 0, False: 1.14k]
  |  |  |  Branch (266:85): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2023|      0|            {
 2024|      0|                at[j].final_parity ^= AB_INV_PARITY_BITS;
  ------------------
  |  |  227|      0|#define AB_INV_PARITY_BITS (AB_PARITY_ODD ^ AB_PARITY_EVEN)
  |  |  ------------------
  |  |  |  |  219|      0|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  |  |  ------------------
  |  |               #define AB_INV_PARITY_BITS (AB_PARITY_ODD ^ AB_PARITY_EVEN)
  |  |  ------------------
  |  |  |  |  220|      0|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  |  |  ------------------
  ------------------
 2025|      0|            }
 2026|  1.14k|        }
 2027|  2.96k|    }
 2028|  2.87k|    for (i = 0; i < pCS->nLenLinearCTStereoDble; i++)
  ------------------
  |  Branch (2028:17): [True: 1.31k, False: 1.56k]
  ------------------
 2029|  1.31k|    {
 2030|  1.31k|        parity = pCS->LinearCTStereoDble[i].parity;
 2031|  1.31k|        if (ATOM_PARITY_WELL_DEF( parity ))
  ------------------
  |  |  259|  1.31k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  1.31k|#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)
  |  |  ------------------
  |  |  |  |  236|  1.31k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 1.31k, False: 0]
  |  |  |  Branch (259:75): [True: 257, False: 1.05k]
  |  |  ------------------
  ------------------
 2032|    257|        {
 2033|    257|            j1 = nAtomNumberCanon[(int) pCS->LinearCTStereoDble[i].at_num1 - 1];
 2034|    257|            cumulene_len = BOND_CHAIN_LEN( at[j1].stereo_bond_parity[0] );
  ------------------
  |  |  214|    257|#define BOND_CHAIN_LEN(X)           (GET_BITS_CUMULENE_LEN(X)/MULT_STEREOBOND) /* 0 => double bond, 1 => allene, 2 => cumulene,..*/
  |  |  ------------------
  |  |  |  |  213|    257|#define GET_BITS_CUMULENE_LEN(X)    ((X)&MASK_CUMULENE_LEN)
  |  |  |  |  ------------------
  |  |  |  |  |  |  205|    257|#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,..*/
  |  |  ------------------
  |  |  |  |  209|    257|#define MULT_STEREOBOND    0x08  /* multiplier for cumulene chain length
  |  |  ------------------
  ------------------
 2035|    257|            if (cumulene_len % 2)
  ------------------
  |  Branch (2035:17): [True: 4, False: 253]
  ------------------
 2036|      4|            {
 2037|       |                /* invert only in case of allene */
 2038|      4|                j2 = nAtomNumberCanon[(int) pCS->LinearCTStereoDble[i].at_num2 - 1];
 2039|       |                /* checks for debug only */
 2040|      4|                if (1 < MAX_NUM_STEREO_BONDS)
  ------------------
  |  |  873|      4|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2040:21): [True: 4, Folded]
  ------------------
 2041|      4|                {
 2042|      4|                    if (at[j1].stereo_bond_neighbor[1] ||
  ------------------
  |  Branch (2042:25): [True: 0, False: 4]
  ------------------
 2043|      4|                         at[j2].stereo_bond_neighbor[1])
  ------------------
  |  Branch (2043:26): [True: 0, False: 4]
  ------------------
 2044|      0|                    {
 2045|      0|                        goto exit_error; /* inconsitency: atom has more than one cumulene bond */
 2046|      0|                    }
 2047|      4|                }
 2048|      4|                if (cumulene_len != BOND_CHAIN_LEN( at[j2].stereo_bond_parity[0] ) ||
  ------------------
  |  |  214|      8|#define BOND_CHAIN_LEN(X)           (GET_BITS_CUMULENE_LEN(X)/MULT_STEREOBOND) /* 0 => double bond, 1 => allene, 2 => cumulene,..*/
  |  |  ------------------
  |  |  |  |  213|      4|#define GET_BITS_CUMULENE_LEN(X)    ((X)&MASK_CUMULENE_LEN)
  |  |  |  |  ------------------
  |  |  |  |  |  |  205|      4|#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,..*/
  |  |  ------------------
  |  |  |  |  209|      4|#define MULT_STEREOBOND    0x08  /* multiplier for cumulene chain length
  |  |  ------------------
  ------------------
  |  Branch (2048:21): [True: 0, False: 4]
  ------------------
 2049|      4|                     j1 + 1 != at[j2].stereo_bond_neighbor[0] ||
  ------------------
  |  Branch (2049:22): [True: 0, False: 4]
  ------------------
 2050|      4|                     j2 + 1 != at[j1].stereo_bond_neighbor[0])
  ------------------
  |  Branch (2050:22): [True: 0, False: 4]
  ------------------
 2051|      0|                {
 2052|      0|                    goto exit_error; /* inconsitency: atoms should refer to each other */
 2053|      0|                }
 2054|       |                /* invert parities */
 2055|      4|                if (PARITY_WELL_DEF( at[j1].parity ) && PARITY_WELL_DEF( at[j2].parity ))
  ------------------
  |  |  266|      8|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      4|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|      8|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      4|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|      4|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      4|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|      4|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 4, False: 0]
  |  |  |  Branch (266:85): [True: 4, False: 0]
  |  |  ------------------
  ------------------
                              if (PARITY_WELL_DEF( at[j1].parity ) && PARITY_WELL_DEF( at[j2].parity ))
  ------------------
  |  |  266|      4|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      4|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|      8|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      4|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|      4|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      4|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|      4|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 4, False: 0]
  |  |  |  Branch (266:85): [True: 4, False: 0]
  |  |  ------------------
  ------------------
 2056|      4|                {
 2057|      4|                    j = inchi_min( j1, j2 );
  ------------------
  |  |  139|      4|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 2, False: 2]
  |  |  ------------------
  ------------------
 2058|      4|                    at[j].parity ^= AB_INV_PARITY_BITS; /* for reversability always invert only atom with the smaller number */
  ------------------
  |  |  227|      4|#define AB_INV_PARITY_BITS (AB_PARITY_ODD ^ AB_PARITY_EVEN)
  |  |  ------------------
  |  |  |  |  219|      4|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  |  |  ------------------
  |  |               #define AB_INV_PARITY_BITS (AB_PARITY_ODD ^ AB_PARITY_EVEN)
  |  |  ------------------
  |  |  |  |  220|      4|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  |  |  ------------------
  ------------------
 2059|      4|                }
 2060|      0|                else
 2061|      0|                {
 2062|      0|                    goto exit_error; /* inconsistency */
 2063|      0|                }
 2064|      4|                if (bInvertLinearCTStereo)
  ------------------
  |  Branch (2064:21): [True: 2, False: 2]
  ------------------
 2065|      2|                {
 2066|      2|                    pCS->LinearCTStereoDble[i].parity ^= AB_INV_PARITY_BITS;
  ------------------
  |  |  227|      2|#define AB_INV_PARITY_BITS (AB_PARITY_ODD ^ AB_PARITY_EVEN)
  |  |  ------------------
  |  |  |  |  219|      2|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  |  |  ------------------
  |  |               #define AB_INV_PARITY_BITS (AB_PARITY_ODD ^ AB_PARITY_EVEN)
  |  |  ------------------
  |  |  |  |  220|      2|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  |  |  ------------------
  ------------------
 2067|      2|                }
 2068|      4|                num_changes++;
 2069|      4|                if (PARITY_WELL_DEF( at[j1].stereo_bond_parity[0] ))
  ------------------
  |  |  266|      4|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      4|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|      8|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      4|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|      4|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      4|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|      4|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 4, False: 0]
  |  |  |  Branch (266:85): [True: 4, False: 0]
  |  |  ------------------
  ------------------
 2070|      4|                {
 2071|      4|                    at[j1].stereo_bond_parity[0] ^= AB_INV_PARITY_BITS;
  ------------------
  |  |  227|      4|#define AB_INV_PARITY_BITS (AB_PARITY_ODD ^ AB_PARITY_EVEN)
  |  |  ------------------
  |  |  |  |  219|      4|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  |  |  ------------------
  |  |               #define AB_INV_PARITY_BITS (AB_PARITY_ODD ^ AB_PARITY_EVEN)
  |  |  ------------------
  |  |  |  |  220|      4|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  |  |  ------------------
  ------------------
 2072|      4|                }
 2073|      4|                if (PARITY_WELL_DEF( at[j2].stereo_bond_parity[0] ))
  ------------------
  |  |  266|      4|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      4|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|      8|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      4|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|      4|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      4|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|      4|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 4, False: 0]
  |  |  |  Branch (266:85): [True: 4, False: 0]
  |  |  ------------------
  ------------------
 2074|      4|                {
 2075|      4|                    at[j2].stereo_bond_parity[0] ^= AB_INV_PARITY_BITS;
  ------------------
  |  |  227|      4|#define AB_INV_PARITY_BITS (AB_PARITY_ODD ^ AB_PARITY_EVEN)
  |  |  ------------------
  |  |  |  |  219|      4|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  |  |  ------------------
  |  |               #define AB_INV_PARITY_BITS (AB_PARITY_ODD ^ AB_PARITY_EVEN)
  |  |  ------------------
  |  |  |  |  220|      4|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  |  |  ------------------
  ------------------
 2076|      4|                }
 2077|      4|            }
 2078|    257|        }
 2079|  1.31k|    }
 2080|       |
 2081|  1.56k|    return num_changes;
 2082|       |
 2083|      1|exit_error:
 2084|      1|    return CT_STEREOCOUNT_ERR;
  ------------------
  |  |   29|      1|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      1|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 2085|  1.56k|}
FillOutStereoParities:
 2101|  1.14k|{
 2102|  1.14k|    int ret;
 2103|       |    /*  unmark atoms with 2 or more constitutionally equivalent neighbors */
 2104|       |    /*  such that there is no path through them to an atom with parity */
 2105|  1.14k|    ret = UnmarkNonStereo( pCG, at, num_atoms, nRank, nAtomNumber, bIsotopic );
 2106|  1.14k|    if (ret < 0)
  ------------------
  |  Branch (2106:9): [True: 0, False: 1.14k]
  ------------------
 2107|      0|        return ret;  /*  program error? */ /*   <BRKPT> */
 2108|  1.14k|    ret = FillAllStereoDescriptors( pCG, at, num_atoms, nCanonRank, nAtomNumberCanon, pCS ); /*  ret<0: error */
 2109|  1.14k|    if (!ret)
  ------------------
  |  Branch (2109:9): [True: 1.14k, False: 0]
  ------------------
 2110|  1.14k|    {
 2111|  1.14k|        ret = pCS->nLenLinearCTStereoCarb + pCS->nLenLinearCTStereoDble;
 2112|  1.14k|    }
 2113|  1.14k|    if (ret < 0)
  ------------------
  |  Branch (2113:9): [True: 0, False: 1.14k]
  ------------------
 2114|      0|    {
 2115|      0|        return ret; /*  program error? */ /*   <BRKPT> */
 2116|      0|    }
 2117|       |
 2118|  1.14k|    if (ret >= 0)
  ------------------
  |  Branch (2118:9): [True: 1.14k, False: 0]
  ------------------
 2119|  1.14k|    {
 2120|  1.14k|        int ret2;
 2121|  1.14k|        ret2 = SetKnownStereoCenterParities( pCG, at, num_atoms, nCanonRank, nRank, nAtomNumber );
 2122|  1.14k|        if (ret2 >= 0)
  ------------------
  |  Branch (2122:13): [True: 1.14k, False: 0]
  ------------------
 2123|  1.14k|        {
 2124|  1.14k|            ret2 = MarkKnownEqualStereoCenterParities( at, num_atoms, nRank, nAtomNumber );
 2125|  1.14k|        }
 2126|  1.14k|        if (ret2 >= 0)
  ------------------
  |  Branch (2126:13): [True: 1.14k, False: 0]
  ------------------
 2127|  1.14k|        {
 2128|  1.14k|            ret2 = SetKnownStereoBondParities( pCG, at, num_atoms, nCanonRank, nRank, nAtomNumber );
 2129|  1.14k|            if (ret2 >= 0)
  ------------------
  |  Branch (2129:17): [True: 1.14k, False: 0]
  ------------------
 2130|  1.14k|            {
 2131|  1.14k|                ret2 = MarkKnownEqualStereoBondParities( at, num_atoms, nRank, nAtomNumber );
 2132|  1.14k|            }
 2133|  1.14k|        }
 2134|  1.14k|#if ( REMOVE_KNOWN_NONSTEREO == 1 ) /* { */
 2135|  1.14k|        if (ret2 >= 0)
  ------------------
  |  Branch (2135:13): [True: 1.14k, False: 0]
  ------------------
 2136|  1.14k|        {
 2137|  1.14k|            int ret3;
 2138|  1.14k|            do
 2139|  1.18k|            {
 2140|  1.18k|                ret2 = RemoveKnownNonStereoCenterParities( pCG, at, num_atoms, nCanonRank, nRank, pCS );
 2141|  1.18k|                if (ret2 >= 0)
  ------------------
  |  Branch (2141:21): [True: 1.18k, False: 0]
  ------------------
 2142|  1.18k|                {
 2143|  1.18k|                    ret3 = RemoveKnownNonStereoBondParities( at, num_atoms, nCanonRank, nRank, pCS );
 2144|  1.18k|                    ret2 = ret3 >= 0 ? ret2 + ret3 : ret3;
  ------------------
  |  Branch (2144:28): [True: 1.18k, False: 0]
  ------------------
 2145|  1.18k|                }
 2146|  1.18k|            }
 2147|  1.18k|            while (ret2 > 0);
  ------------------
  |  Branch (2147:20): [True: 34, False: 1.14k]
  ------------------
 2148|  1.14k|        }
 2149|  1.14k|        if (RETURNED_ERROR( ret2 ))
  ------------------
  |  |   44|  1.14k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  1.14k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  1.14k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  1.14k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  1.14k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  1.14k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 1.14k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 1.14k]
  |  |  ------------------
  ------------------
 2150|      0|        {
 2151|      0|            ret = ret2;
 2152|      0|        }
 2153|  1.14k|#endif /* } REMOVE_KNOWN_NONSTEREO */
 2154|  1.14k|    }
 2155|       |
 2156|  1.14k|    return ret; /*  non-zero means error */
 2157|  1.14k|}
GetStereoNeighborPos:
 2165|     34|{
 2166|     34|    int k1;
 2167|     34|    AT_RANK sNeigh = (AT_RANK) ( iAt2 + 1 );
 2168|     34|    AT_RANK s;
 2169|     47|    for (k1 = 0; k1 < MAX_NUM_STEREO_BONDS && ( s = at[iAt1].stereo_bond_neighbor[k1] ); k1++)
  ------------------
  |  |  873|     94|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2169:18): [True: 47, False: 0]
  |  Branch (2169:47): [True: 47, False: 0]
  ------------------
 2170|     47|    {
 2171|     47|        if (s == sNeigh)
  ------------------
  |  Branch (2171:13): [True: 34, False: 13]
  ------------------
 2172|     34|        {
 2173|     34|            return k1;
 2174|     34|        }
 2175|     47|    }
 2176|       |
 2177|      0|    return -1; /*  neighbor not found */
 2178|     34|}
GetStereoBondParity:
 2188|     68|{
 2189|     68|    int k1, k2, s, parity;
 2190|       |
 2191|     68|    if (at[i].stereo_bond_neighbor[0])
  ------------------
  |  Branch (2191:9): [True: 68, False: 0]
  ------------------
 2192|     68|    {
 2193|     94|        for (k1 = 0; k1 < MAX_NUM_STEREO_BONDS && ( s = (int) at[i].stereo_bond_neighbor[k1] ); k1++)
  ------------------
  |  |  873|    188|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2193:22): [True: 94, False: 0]
  |  Branch (2193:51): [True: 94, False: 0]
  ------------------
 2194|     94|        {
 2195|     94|            if (--s == n)
  ------------------
  |  Branch (2195:17): [True: 68, False: 26]
  ------------------
 2196|     68|            {
 2197|     68|                goto neigh1_found;
 2198|     68|            }
 2199|     94|        }
 2200|      0|        return -1; /*  error: not a stereo neighbor */
 2201|     68|    neigh1_found:
 2202|     68|        if (PARITY_KNOWN( at[i].stereo_bond_parity[k1] ))
  ------------------
  |  |  265|     68|#define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|     68|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|    136|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|     68|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|     68|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|     68|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|     68|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (265:38): [True: 68, False: 0]
  |  |  |  Branch (265:78): [True: 68, False: 0]
  |  |  ------------------
  ------------------
 2203|     68|        {
 2204|     68|            return PARITY_VAL( at[i].stereo_bond_parity[k1] );
  ------------------
  |  |  262|     68|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|     68|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
 2205|     68|        }
 2206|      0|        for (k2 = 0; k2 < MAX_NUM_STEREO_BONDS && ( s = (int) at[n].stereo_bond_neighbor[k2] ); k2++)
  ------------------
  |  |  873|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2206:22): [True: 0, False: 0]
  |  Branch (2206:51): [True: 0, False: 0]
  ------------------
 2207|      0|        {
 2208|      0|            if (--s == i)
  ------------------
  |  Branch (2208:17): [True: 0, False: 0]
  ------------------
 2209|      0|            {
 2210|      0|                goto neigh2_found;
 2211|      0|            }
 2212|      0|        }
 2213|      0|        return -1; /*  error: not a stereo neighbor */
 2214|      0|    neigh2_found:;
 2215|      0|    }
 2216|      0|    else
 2217|      0|    {
 2218|      0|        return -1; /*  error: not a stereo bond */
 2219|      0|    }
 2220|       |
 2221|      0|    if (ATOM_PARITY_WELL_DEF( at[i].parity ) &&
  ------------------
  |  |  259|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      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)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 0, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2222|      0|         ATOM_PARITY_WELL_DEF( at[n].parity ) &&
  ------------------
  |  |  259|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      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)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 0, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2223|      0|         MIN_DOT_PROD <= abs( at[i].stereo_bond_z_prod[k1] ))
  ------------------
  |  |  253|      0|#define MIN_DOT_PROD 50          /* min value of at->stereo_bond_z_prod[i] to define parity */
  ------------------
  |  Branch (2223:10): [True: 0, False: 0]
  ------------------
 2224|      0|    {
 2225|       |        /*  bond parity can be calculated */
 2226|      0|        int half_parity1, half_parity2;
 2227|       |        /*  check whether all neighbors are defined */
 2228|       |
 2229|       |
 2230|      0|        half_parity1 = HalfStereoBondParity( at, i, k1, nRank );
 2231|      0|        half_parity2 = HalfStereoBondParity( at, n, k2, nRank );
 2232|      0|        if (!half_parity1 || !half_parity2)
  ------------------
  |  Branch (2232:13): [True: 0, False: 0]
  |  Branch (2232:30): [True: 0, False: 0]
  ------------------
 2233|      0|            return 0; /*  ranks undefined or not a stereo bond */
 2234|      0|        if (ATOM_PARITY_WELL_DEF( half_parity1 ) &&
  ------------------
  |  |  259|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      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)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 0, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2235|      0|             ATOM_PARITY_WELL_DEF( half_parity2 ))
  ------------------
  |  |  259|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      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)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 0, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2236|      0|        {
 2237|      0|            parity = 2 - ( half_parity1 + half_parity2
 2238|      0|                     + ( at[i].stereo_bond_z_prod[k1] < 0 ) ) % 2;
 2239|      0|        }
 2240|      0|        else
 2241|      0|        {
 2242|      0|            return CT_STEREOBOND_ERROR;  /*   <BRKPT> */
  ------------------
  |  |   31|      0|#define CT_STEREOBOND_ERROR  (CT_ERR_FIRST-12)  /*(-30012) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 2243|      0|        }
 2244|      0|    }
 2245|      0|    else
 2246|      0|    {
 2247|       |        /*  parity cannot be calculated: not enough info or 'unknown' */
 2248|      0|        if (AB_PARITY_NONE != ( parity = inchi_max( at[i].parity, at[n].parity ) ))
  ------------------
  |  |  218|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
                      if (AB_PARITY_NONE != ( parity = inchi_max( at[i].parity, at[n].parity ) ))
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2248:13): [True: 0, False: 0]
  ------------------
 2249|      0|        {
 2250|      0|            parity = AB_PARITY_UNDF; /*  should not happen */
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 2251|      0|        }
 2252|      0|    }
 2253|       |
 2254|      0|    return parity;
 2255|      0|}
GetPermutationParity:
 2265|  16.8k|{
 2266|  16.8k|    AT_RANK nNeighRank[MAX_NUM_STEREO_ATOM_NEIGH];
 2267|  16.8k|    int     j, k, parity;
 2268|  16.8k|    if (at->valence > MAX_NUM_STEREO_ATOM_NEIGH)
  ------------------
  |  |  877|  16.8k|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (2268:9): [True: 0, False: 16.8k]
  ------------------
 2269|      0|    {
 2270|      0|        parity = -1; /*  error */
 2271|      0|    }
 2272|  16.8k|    else
 2273|  16.8k|    {
 2274|  82.8k|        for (j = k = 0; j < at->valence; j++)
  ------------------
  |  Branch (2274:25): [True: 66.0k, False: 16.8k]
  ------------------
 2275|  66.0k|        {
 2276|  66.0k|            if (at->neighbor[j] != nAvoidNeighbor)
  ------------------
  |  Branch (2276:17): [True: 66.0k, False: 0]
  ------------------
 2277|  66.0k|            {
 2278|  66.0k|                nNeighRank[k++] = nCanonRank[(int) at->neighbor[j]];
 2279|  66.0k|            }
 2280|  66.0k|        }
 2281|  16.8k|        if (k)
  ------------------
  |  Branch (2281:13): [True: 16.8k, False: 0]
  ------------------
 2282|  16.8k|        {
 2283|  16.8k|            parity = insertions_sort( pCG, nNeighRank, k, sizeof( nNeighRank[0] ), comp_AT_RANK );
 2284|  16.8k|            if (nNeighRank[0])
  ------------------
  |  Branch (2284:17): [True: 16.8k, False: 0]
  ------------------
 2285|  16.8k|            {
 2286|  16.8k|                parity = 2 - parity % 2;
 2287|  16.8k|            }
 2288|      0|            else
 2289|      0|            {
 2290|      0|                parity = 0; /*  not all ranks are known */
 2291|      0|            }
 2292|  16.8k|        }
 2293|      0|        else
 2294|      0|        {
 2295|       |            /* special case: HX= with implicit H */
 2296|      0|            parity = 2;
 2297|      0|        }
 2298|  16.8k|    }
 2299|       |
 2300|  16.8k|    return parity;
 2301|  16.8k|}
GetStereoCenterParity:
 2309|  10.0k|{
 2310|  10.0k|    AT_NUMB  nNeighborNumber2[MAXVAL];
 2311|  10.0k|    int      parity;
 2312|  10.0k|    int      k, num_trans;
 2313|       |
 2314|  10.0k|    if (!at[i].parity)
  ------------------
  |  Branch (2314:9): [True: 0, False: 10.0k]
  ------------------
 2315|      0|    {
 2316|      0|        return 0;   /*  not a stereo center                     */
 2317|      0|    }
 2318|  10.0k|    if (at[i].stereo_bond_neighbor[0])
  ------------------
  |  Branch (2318:9): [True: 0, False: 10.0k]
  ------------------
 2319|      0|    {
 2320|      0|        return -1;  /*  a stereo bond atom, not a stereo center */
 2321|      0|    }
 2322|       |
 2323|  10.0k|    if (ATOM_PARITY_WELL_DEF( at[i].parity ))
  ------------------
  |  |  259|  10.0k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  10.0k|#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)
  |  |  ------------------
  |  |  |  |  236|  10.0k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 10.0k, False: 0]
  |  |  |  Branch (259:75): [True: 3.99k, False: 6.09k]
  |  |  ------------------
  ------------------
 2324|  3.99k|    {
 2325|       |        /*  number of neighbors transpositions to the sorted order is unknown. Find it. */
 2326|       |        /*  If parity is not well-defined then doing this is a waste of time            */
 2327|  3.99k|        int num_neigh = at[i].valence;
 2328|  19.5k|        for (k = 0; k < num_neigh; k++)
  ------------------
  |  Branch (2328:21): [True: 15.5k, False: 3.99k]
  ------------------
 2329|  15.5k|        {
 2330|  15.5k|            if (!nRank[(int) at[i].neighbor[k]])
  ------------------
  |  Branch (2330:17): [True: 0, False: 15.5k]
  ------------------
 2331|      0|                return 0; /*  stereo at[i] does not belong to the traversed part of the structure */
 2332|  15.5k|            nNeighborNumber2[k] = k;
 2333|  15.5k|        }
 2334|  3.99k|        pCG->m_pNeighborsForSort = at[i].neighbor;
 2335|  3.99k|        pCG->m_pn_RankForSort = nRank;
 2336|  3.99k|        num_trans = insertions_sort( pCG, nNeighborNumber2, num_neigh, sizeof( nNeighborNumber2[0] ), CompNeighborsAT_NUMBER );
 2337|       |#ifndef CT_NEIGH_INCREASE
 2338|       |        num_trans += ( ( num_neigh*( num_neigh - 1 ) ) / 2 ) % 2;  /*  get correct parity for ascending order */
 2339|       |#endif
 2340|  3.99k|        parity = 2 - ( at[i].parity + num_trans ) % 2;
 2341|  3.99k|    }
 2342|  6.09k|    else
 2343|  6.09k|    {
 2344|  6.09k|        parity = at[i].parity;
 2345|  6.09k|    }
 2346|       |
 2347|  10.0k|    return parity;
 2348|  10.0k|}

ErrMsg:
   20|      4|{
   21|      4|    const char *p;
   22|      4|    static char szErrMsg[64];
   23|      4|    switch (nErrorCode)
   24|      4|    {
   25|      0|        case 0:                      p = "";                      break;
  ------------------
  |  Branch (25:9): [True: 0, False: 4]
  ------------------
   26|      0|        case CT_OVERFLOW:            p = "ARRAY OVERFLOW";        break;
  ------------------
  |  |   19|      0|#define CT_OVERFLOW          (CT_ERR_FIRST- 0)  /*(-30000) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (26:9): [True: 0, False: 4]
  ------------------
   27|      0|        case CT_LEN_MISMATCH:        p = "LENGTH_MISMATCH";       break;
  ------------------
  |  |   20|      0|#define CT_LEN_MISMATCH      (CT_ERR_FIRST- 1)  /*(-30001) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (27:9): [True: 0, False: 4]
  ------------------
   28|      2|        case CT_OUT_OF_RAM:          p = "Out of RAM";            break;
  ------------------
  |  |   21|      2|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      2|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (28:9): [True: 2, False: 2]
  ------------------
   29|      0|        case CT_RANKING_ERR:         p = "RANKING_ERR";           break;
  ------------------
  |  |   22|      0|#define CT_RANKING_ERR       (CT_ERR_FIRST- 3)  /*(-30003) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (29:9): [True: 0, False: 4]
  ------------------
   30|      0|        case CT_ISOCOUNT_ERR:        p = "ISOCOUNT_ERR";          break;
  ------------------
  |  |   23|      0|#define CT_ISOCOUNT_ERR      (CT_ERR_FIRST- 4)  /*(-30004) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (30:9): [True: 0, False: 4]
  ------------------
   31|      0|        case CT_TAUCOUNT_ERR:        p = "TAUCOUNT_ERR";          break;
  ------------------
  |  |   24|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (31:9): [True: 0, False: 4]
  ------------------
   32|      0|        case CT_ISOTAUCOUNT_ERR:     p = "ISOTAUCOUNT_ERR";       break;
  ------------------
  |  |   25|      0|#define CT_ISOTAUCOUNT_ERR   (CT_ERR_FIRST- 6)  /*(-30006) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (32:9): [True: 0, False: 4]
  ------------------
   33|      0|        case CT_MAPCOUNT_ERR:        p = "MAPCOUNT_ERR";          break;
  ------------------
  |  |   26|      0|#define CT_MAPCOUNT_ERR      (CT_ERR_FIRST- 7)  /*(-30007) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (33:9): [True: 0, False: 4]
  ------------------
   34|      0|        case CT_TIMEOUT_ERR:         p = "Time limit exceeded";   break;
  ------------------
  |  |   27|      0|#define CT_TIMEOUT_ERR       (CT_ERR_FIRST- 8)  /*(-30008) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (34:9): [True: 0, False: 4]
  ------------------
   35|      0|        case CT_ISO_H_ERR:           p = "ISO_H_ERR";             break;
  ------------------
  |  |   28|      0|#define CT_ISO_H_ERR         (CT_ERR_FIRST- 9)  /*(-30009) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (35:9): [True: 0, False: 4]
  ------------------
   36|      0|        case CT_STEREOCOUNT_ERR:     p = "STEREOCOUNT_ERR";       break;
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (36:9): [True: 0, False: 4]
  ------------------
   37|      0|        case CT_ATOMCOUNT_ERR:       p = "ATOMCOUNT_ERR";         break;
  ------------------
  |  |   30|      0|#define CT_ATOMCOUNT_ERR     (CT_ERR_FIRST-11)  /*(-30011) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (37:9): [True: 0, False: 4]
  ------------------
   38|      0|        case CT_STEREOBOND_ERROR:    p = "STEREOBOND_ERR";        break;
  ------------------
  |  |   31|      0|#define CT_STEREOBOND_ERROR  (CT_ERR_FIRST-12)  /*(-30012) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (38:9): [True: 0, False: 4]
  ------------------
   39|      0|        case CT_USER_QUIT_ERR:       p = "User requested termination"; break;
  ------------------
  |  |   32|      0|#define CT_USER_QUIT_ERR     (CT_ERR_FIRST-13)  /*(-30013) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (39:9): [True: 0, False: 4]
  ------------------
   40|      0|        case CT_REMOVE_STEREO_ERR:   p = "REMOVE_STEREO_ERR";     break;
  ------------------
  |  |   33|      0|#define CT_REMOVE_STEREO_ERR (CT_ERR_FIRST-14)  /*(-30014) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (40:9): [True: 0, False: 4]
  ------------------
   41|      1|        case CT_CALC_STEREO_ERR:     p = "CALC_STEREO_ERR";       break;
  ------------------
  |  |   34|      1|#define CT_CALC_STEREO_ERR   (CT_ERR_FIRST-15)  /*(-30015) */
  |  |  ------------------
  |  |  |  |   18|      1|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (41:9): [True: 1, False: 3]
  ------------------
   42|      0|        case CT_STEREO_CANON_ERR:    p = "STEREO_CANON_ERR";      break;
  ------------------
  |  |   36|      0|#define CT_STEREO_CANON_ERR  (CT_ERR_FIRST-17)  /*(-30017) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (42:9): [True: 0, False: 4]
  ------------------
   43|      0|        case CT_CANON_ERR:           p = "CANON_ERR";             break;
  ------------------
  |  |   35|      0|#define CT_CANON_ERR         (CT_ERR_FIRST-16)  /*(-30016) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (43:9): [True: 0, False: 4]
  ------------------
   44|      0|        case CT_WRONG_FORMULA:       p = "Wrong or missing chemical formula";  break;
  ------------------
  |  |   37|      0|#define CT_WRONG_FORMULA     (CT_ERR_FIRST-18)  /*(-30017) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (44:9): [True: 0, False: 4]
  ------------------
   45|       |        /*case CT_CANON_ERR2:          p = "CT_CANON_ERR2";         break;*/
   46|      0|        case CT_UNKNOWN_ERR:         p = "UNKNOWN_ERR";           break;
  ------------------
  |  |   38|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (46:9): [True: 0, False: 4]
  ------------------
   47|      0|        case BNS_RADICAL_ERR:        p = "Cannot process free radical center"; break;
  ------------------
  |  |   59|      0|#define BNS_RADICAL_ERR    (BNS_ERR + 11) /*(-9988)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
  |  Branch (47:9): [True: 0, False: 4]
  ------------------
   48|      0|        case BNS_ALTBOND_ERR:        p = "Cannot process aromatic bonds";      break;
  ------------------
  |  |   61|      0|#define BNS_ALTBOND_ERR    (BNS_ERR + 13) /*(-9986)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
  |  Branch (48:9): [True: 0, False: 4]
  ------------------
   49|       |        /* v. 1.05 */
   50|      0|        case BNS_TIMEOUT:             p = "Structure normalization timeout";      break;
  ------------------
  |  |   63|      0|#define BNS_TIMEOUT        (BNS_ERR + 14) /*(-9985)*/ /* v. 1.05 */
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
  |  Branch (50:9): [True: 0, False: 4]
  ------------------
   51|       |
   52|      1|        default:
  ------------------
  |  Branch (52:9): [True: 1, False: 3]
  ------------------
   53|      1|            if (nErrorCode > CT_UNKNOWN_ERR)
  ------------------
  |  |   38|      1|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  ------------------
  |  |  |  |   18|      1|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (53:17): [True: 1, False: 0]
  ------------------
   54|      1|            {
   55|      1|                sprintf(szErrMsg, "No description(%d)", nErrorCode);
   56|      1|                p = szErrMsg;
   57|      1|            }
   58|      0|            else
   59|      0|            {
   60|      0|                sprintf(szErrMsg, "UNKNOWN_ERR(%d)", CT_UNKNOWN_ERR - nErrorCode);
  ------------------
  |  |   38|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
   61|      0|                p = szErrMsg;
   62|      0|            }
   63|      1|            break;
   64|      4|    }
   65|       |
   66|      4|    return p;
   67|      4|}
AddErrorMessage:
   72|  67.3k|{
   73|  67.3k|    int len_all, len;
   74|       |
   75|  67.3k|    if (!all_messages)
  ------------------
  |  Branch (75:9): [True: 0, False: 67.3k]
  ------------------
   76|      0|    {
   77|      0|        return 0;
   78|      0|    }
   79|  67.3k|    if (!new_message)
  ------------------
  |  Branch (79:9): [True: 0, False: 67.3k]
  ------------------
   80|      0|    {
   81|      0|        return 0;
   82|      0|    }
   83|  67.3k|    if (!new_message[0])
  ------------------
  |  Branch (83:9): [True: 0, False: 67.3k]
  ------------------
   84|      0|    {
   85|      0|        return 0;
   86|      0|    }
   87|  67.3k|    if (already_have_this_message( all_messages, new_message ))
  ------------------
  |  Branch (87:9): [True: 40.8k, False: 26.5k]
  ------------------
   88|  40.8k|    {
   89|  40.8k|        return 1;
   90|  40.8k|    }
   91|       |
   92|  26.5k|    len_all = (int) strlen( all_messages );
   93|  26.5k|    len = (int) strlen( new_message );
   94|       |
   95|  26.5k|    if (len_all + len + 2 * ( len_all > 0 ) < STR_ERR_LEN)
  ------------------
  |  |  126|  26.5k|#define STR_ERR_LEN 256
  ------------------
  |  Branch (95:9): [True: 26.5k, False: 0]
  ------------------
   96|  26.5k|    {
   97|       |        /* enough room... add message and return */
   98|  26.5k|        if (len_all > 0)
  ------------------
  |  Branch (98:13): [True: 13.4k, False: 13.0k]
  ------------------
   99|  13.4k|        {
  100|  13.4k|            if (all_messages[len_all - 1] != ':')
  ------------------
  |  Branch (100:17): [True: 4.91k, False: 8.55k]
  ------------------
  101|  4.91k|            {
  102|  4.91k|                strcat(all_messages, ";");
  103|  4.91k|            }
  104|  13.4k|            strcat(all_messages, " ");
  105|  13.4k|        }
  106|  26.5k|        strcat(all_messages, new_message);
  107|  26.5k|        return 1;
  108|  26.5k|    }
  109|       |
  110|       |    /*  not enough room... add no-room marker if not yet added */
  111|      0|    if (strstr( all_messages, "..." ))
  ------------------
  |  Branch (111:9): [True: 0, False: 0]
  ------------------
  112|      0|    {
  113|      0|        return 0;
  114|      0|    }
  115|      0|    if (len_all + 3 < STR_ERR_LEN)
  ------------------
  |  |  126|      0|#define STR_ERR_LEN 256
  ------------------
  |  Branch (115:9): [True: 0, False: 0]
  ------------------
  116|      0|    {
  117|      0|        strcat(all_messages, "...");
  118|      0|    }
  119|       |
  120|      0|    return 0;
  121|      0|}
ichierr.c:already_have_this_message:
  126|  67.3k|{
  127|  67.3k|    int have = 0;
  128|       |
  129|  67.3k|    char *p = strstr( prev_messages, new_message );
  130|       |
  131|  67.3k|    if (p)
  ------------------
  |  Branch (131:9): [True: 40.8k, False: 26.5k]
  ------------------
  132|  40.8k|    {
  133|  40.8k|        have = ( p == prev_messages || (*( p - 1 ) == ' ' && ( *( p - 2 ) == ';' || *( p - 2 ) == ':' )) ); /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (133:18): [True: 39.5k, False: 1.33k]
  |  Branch (133:41): [True: 1.33k, False: 0]
  |  Branch (133:64): [True: 522, False: 810]
  |  Branch (133:85): [True: 810, False: 0]
  ------------------
  134|  40.8k|        if (have)
  ------------------
  |  Branch (134:13): [True: 40.8k, False: 0]
  ------------------
  135|  40.8k|        {
  136|  40.8k|            int len_prev = (int) strlen( prev_messages );
  137|  40.8k|            int len = (int) strlen( new_message );
  138|  40.8k|            have = ( p + len == prev_messages + len_prev || (p[len] == ';' && p[len + 1] == ' ') || (p[len - 1] == ':' && p[len] == ' ') ); /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (138:22): [True: 35.9k, False: 4.84k]
  |  Branch (138:62): [True: 74, False: 4.77k]
  |  Branch (138:79): [True: 74, False: 0]
  |  Branch (138:102): [True: 4.77k, False: 0]
  |  Branch (138:123): [True: 4.77k, False: 0]
  ------------------
  139|  40.8k|        }
  140|  40.8k|    }
  141|       |
  142|  67.3k|    return have;
  143|  67.3k|}

make_iso_sort_key:
   13|  1.10M|{
   14|  1.10M|    AT_ISO_SORT_KEY iso_sort_key = 0, mult = 1;
   15|       |
   16|  1.10M|    iso_sort_key += mult * num_1H;
   17|  1.10M|    mult *= AT_ISO_SORT_KEY_MULT;
  ------------------
  |  |   30|  1.10M|#define         AT_ISO_SORT_KEY_MULT  32    /* up to 32 identical hydrogen isotopes         */
  ------------------
   18|  1.10M|    iso_sort_key += mult * num_2H;
   19|  1.10M|    mult *= AT_ISO_SORT_KEY_MULT;
  ------------------
  |  |   30|  1.10M|#define         AT_ISO_SORT_KEY_MULT  32    /* up to 32 identical hydrogen isotopes         */
  ------------------
   20|  1.10M|    iso_sort_key += mult * num_3H;
   21|  1.10M|    mult *= AT_ISO_SORT_KEY_MULT;
  ------------------
  |  |   30|  1.10M|#define         AT_ISO_SORT_KEY_MULT  32    /* up to 32 identical hydrogen isotopes         */
  ------------------
   22|  1.10M|    iso_sort_key += mult * iso_atw_diff;
   23|       |
   24|  1.10M|    return iso_sort_key;
   25|  1.10M|}
set_atom_iso_sort_keys:
   36|   288k|{
   37|   288k|    int             i, num_isotopic = 0, bMergedTgroup;
   38|   288k|    AT_ISO_SORT_KEY iso_sort_key;
   39|   288k|    T_GROUP        *t_group =
   40|   288k|        ( t_group_info &&
  ------------------
  |  Branch (40:11): [True: 252k, False: 36.3k]
  ------------------
   41|   252k|         t_group_info->t_group &&
  ------------------
  |  Branch (41:10): [True: 252k, False: 0]
  ------------------
   42|   288k|         t_group_info->num_t_groups > 0 ) ? t_group_info->t_group : NULL;
  ------------------
  |  Branch (42:10): [True: 5.45k, False: 246k]
  ------------------
   43|       |
   44|   288k|    if (bHasIsotopicInTautomerGroups)
  ------------------
  |  Branch (44:9): [True: 252k, False: 36.3k]
  ------------------
   45|   252k|    {
   46|   252k|        *bHasIsotopicInTautomerGroups = 0;
   47|   252k|    }
   48|  1.38M|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (48:17): [True: 1.09M, False: 288k]
  ------------------
   49|  1.09M|    {
   50|  1.09M|        bMergedTgroup = ( t_group_info && t_group_info->nIsotopicEndpointAtomNumber && ( at[i].cFlags & AT_FLAG_ISO_H_POINT ) );
  ------------------
  |  |   50|  5.34k|#define AT_FLAG_ISO_H_POINT 0x01 /**< may have isotopic H */
  ------------------
  |  Branch (50:27): [True: 1.04M, False: 44.0k]
  |  Branch (50:43): [True: 5.34k, False: 1.04M]
  |  Branch (50:88): [True: 539, False: 4.80k]
  ------------------
   51|  1.09M|        if (( !at[i].endpoint || !t_group ) && !bMergedTgroup)
  ------------------
  |  Branch (51:15): [True: 1.08M, False: 13.2k]
  |  Branch (51:34): [True: 0, False: 13.2k]
  |  Branch (51:48): [True: 1.08M, False: 242]
  ------------------
   52|  1.08M|        {
   53|  1.08M|            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] );
   54|  1.08M|        }
   55|  13.5k|        else
   56|  13.5k|        {
   57|       |             /*  H isotopes go to the tautomer part of the CT (name) */
   58|       |             /*  if (at[i].endpoint && t_group) ... */
   59|  13.5k|            iso_sort_key = make_iso_sort_key( at[i].iso_atw_diff, 0, 0, 0 );
   60|  13.5k|            if (bHasIsotopicInTautomerGroups)
  ------------------
  |  Branch (60:17): [True: 13.5k, False: 0]
  ------------------
   61|  13.5k|            {
   62|  13.5k|                *bHasIsotopicInTautomerGroups += ( at[i].num_iso_H[0] || at[i].num_iso_H[1] || at[i].num_iso_H[2] || bMergedTgroup );
  ------------------
  |  Branch (62:52): [True: 62, False: 13.4k]
  |  Branch (62:74): [True: 12, False: 13.4k]
  |  Branch (62:96): [True: 28, False: 13.4k]
  |  Branch (62:118): [True: 438, False: 12.9k]
  ------------------
   63|  13.5k|            }
   64|  13.5k|        }
   65|  1.09M|        at[i].iso_sort_key = iso_sort_key;
   66|  1.09M|        num_isotopic += ( iso_sort_key != 0 );
   67|  1.09M|    }
   68|       |
   69|   288k|    return num_isotopic;
   70|   288k|}

MakeHillFormulaString:
   89|  5.62k|{
   90|  5.62k|    int nUsedLength0 = strbuf->nUsedLength;
   91|  5.62k|    if (szHillFormula && !*bOverflow)
  ------------------
  |  Branch (91:9): [True: 5.62k, False: 0]
  |  Branch (91:26): [True: 5.62k, False: 0]
  ------------------
   92|  5.62k|    {
   93|  5.62k|        if (-1 == inchi_strbuf_printf( strbuf, "%s", szHillFormula ))
  ------------------
  |  Branch (93:13): [True: 0, False: 5.62k]
  ------------------
   94|      0|        {
   95|      0|            *bOverflow |= 1;
   96|      0|            return  nUsedLength0 + 1;
   97|      0|        }
   98|  5.62k|    }
   99|  5.62k|    return ( strbuf->nUsedLength - nUsedLength0 );
  100|  5.62k|}
GetHillFormulaIndexLength:
  110|  1.14M|{
  111|  1.14M|    char szCount[16];
  112|  1.14M|    if (count > 1)
  ------------------
  |  Branch (112:9): [True: 374k, False: 774k]
  ------------------
  113|   374k|    {
  114|   374k|        return sprintf(szCount, "%d", count);
  115|   374k|    }
  116|       |
  117|   774k|    return 0;
  118|  1.14M|}
GetHillFormulaCounts:
  133|   385k|{
  134|   385k|    char szElement[4];
  135|   385k|    U_CHAR nPrevAtom = (U_CHAR) -2;
  136|   385k|    int  bCarbon, bHydrogen, nElemLen, nFormLen, nNumNonHAtoms;
  137|   385k|    int  mult, i, num_H, num_C;
  138|       |
  139|   385k|    num_H = 0;
  140|   385k|    num_C = 0;
  141|   385k|    bCarbon = 0;
  142|   385k|    bHydrogen = 0;
  143|   385k|    nElemLen = 0;
  144|   385k|    nFormLen = 0;
  145|   385k|    mult = 0;
  146|   385k|    nNumNonHAtoms = num_atoms;
  147|       |
  148|  2.97M|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (148:17): [True: 2.59M, False: 385k]
  ------------------
  149|  2.59M|    {
  150|  2.59M|        if (nPrevAtom != nAtom[i])
  ------------------
  |  Branch (150:13): [True: 1.17M, False: 1.42M]
  ------------------
  151|  1.17M|        {
  152|  1.17M|            if (mult)
  ------------------
  |  Branch (152:17): [True: 785k, False: 385k]
  ------------------
  153|   785k|            {
  154|   785k|                if (bHydrogen)
  ------------------
  |  Branch (154:21): [True: 5.78k, False: 780k]
  ------------------
  155|  5.78k|                {
  156|  5.78k|                    num_H += mult;
  157|  5.78k|                }
  158|   780k|                else if (bCarbon)
  ------------------
  |  Branch (158:26): [True: 133k, False: 646k]
  ------------------
  159|   133k|                {
  160|   133k|                    num_C += mult;
  161|   133k|                }
  162|   646k|                else
  163|   646k|                {
  164|   646k|                    nFormLen += nElemLen;
  165|   646k|                    nFormLen += GetHillFormulaIndexLength( mult );
  166|   646k|                }
  167|   785k|            }
  168|       |            /*if (-1 == get_element_chemical_symbol( (int) nAtom[i], szElement ))*/
  169|  1.17M|            if (-1 == get_element_or_pseudoelement_symbol( (int) nAtom[i], szElement ))
  ------------------
  |  Branch (169:17): [True: 0, False: 1.17M]
  ------------------
  170|      0|            {
  171|      0|                return -1;
  172|      0|            }
  173|  1.17M|            mult = 1;
  174|  1.17M|            nElemLen = (int) strlen( szElement );
  175|  1.17M|            nPrevAtom = nAtom[i];
  176|  1.17M|            bCarbon = !strcmp( szElement, "C" );
  177|  1.17M|            bHydrogen = !strcmp( szElement, "H" );
  178|  1.17M|            if (bHydrogen)
  ------------------
  |  Branch (178:17): [True: 145k, False: 1.02M]
  ------------------
  179|   145k|            {
  180|   145k|                nNumNonHAtoms = i;
  181|   145k|            }
  182|  1.17M|        }
  183|  1.42M|        else
  184|  1.42M|        {
  185|  1.42M|            mult++;
  186|  1.42M|        }
  187|       |
  188|  2.59M|        num_H += nNum_H[i];
  189|  2.59M|    }
  190|       |
  191|       |    /* NumGroups; ((NumAt+1, NumH, At1..AtNumAt),...) */
  192|       |
  193|   385k|    if (nTautomer && lenTautomer > 0)
  ------------------
  |  Branch (193:9): [True: 289k, False: 96.3k]
  |  Branch (193:22): [True: 42.1k, False: 247k]
  ------------------
  194|  42.1k|    {
  195|  42.1k|        int num_groups = nTautomer[0];
  196|       |
  197|  47.9k|        for (i = 1; i < lenTautomer && num_groups > 0; i += nTautomer[i] + 1, num_groups--)
  ------------------
  |  Branch (197:21): [True: 5.85k, False: 42.1k]
  |  Branch (197:40): [True: 5.85k, False: 0]
  ------------------
  198|  5.85k|        {
  199|  5.85k|            num_H += nTautomer[i + 1];
  200|  5.85k|        }
  201|  42.1k|    }
  202|       |
  203|   385k|    if (mult)
  ------------------
  |  Branch (203:9): [True: 385k, False: 0]
  ------------------
  204|   385k|    {
  205|   385k|        if (bHydrogen)
  ------------------
  |  Branch (205:13): [True: 140k, False: 245k]
  ------------------
  206|   140k|        {
  207|   140k|            num_H += mult;
  208|   140k|        }
  209|   245k|        else if (bCarbon)
  ------------------
  |  Branch (209:18): [True: 8.31k, False: 237k]
  ------------------
  210|  8.31k|        {
  211|  8.31k|            num_C += mult;
  212|  8.31k|        }
  213|   237k|        else
  214|   237k|        {
  215|   237k|            nFormLen += nElemLen;
  216|   237k|            nFormLen += GetHillFormulaIndexLength( mult );
  217|   237k|        }
  218|   385k|    }
  219|       |
  220|   385k|    if (num_C)
  ------------------
  |  Branch (220:9): [True: 112k, False: 273k]
  ------------------
  221|   112k|    {
  222|   112k|        nFormLen += (int) strlen( "C" );
  223|   112k|        nFormLen += GetHillFormulaIndexLength( num_C );
  224|   112k|    }
  225|       |
  226|   385k|    if (num_H)
  ------------------
  |  Branch (226:9): [True: 151k, False: 234k]
  ------------------
  227|   151k|    {
  228|   151k|        nFormLen += (int) strlen( "H" );
  229|   151k|        nFormLen += GetHillFormulaIndexLength( num_H );
  230|   151k|    }
  231|       |
  232|   385k|    *pnum_C = num_C;
  233|   385k|    *pnum_H = num_H;
  234|   385k|    *pnLen = nFormLen;
  235|   385k|    *pnNumNonHAtoms = nNumNonHAtoms;
  236|       |
  237|   385k|    return 0;
  238|   385k|}
AddElementAndCount:
  245|  1.02M|{
  246|  1.02M|    char szMult[16];
  247|  1.02M|    int len1, len2;
  248|  1.02M|    if (mult > 0 && !*bOverflow && 0 < ( len1 = strlen( szElement ) ))
  ------------------
  |  Branch (248:9): [True: 1.02M, False: 14]
  |  Branch (248:21): [True: 1.02M, False: 0]
  |  Branch (248:36): [True: 1.02M, False: 0]
  ------------------
  249|  1.02M|    {
  250|  1.02M|        if (mult > 1)
  ------------------
  |  Branch (250:13): [True: 313k, False: 716k]
  ------------------
  251|   313k|        {
  252|   313k|            len2 = sprintf(szMult, "%d", mult);
  253|   313k|        }
  254|   716k|        else
  255|   716k|        {
  256|   716k|            len2 = 0;
  257|   716k|            szMult[0] = '\0';
  258|   716k|        }
  259|  1.02M|        if (len1 + len2 < nLenLinearCT)
  ------------------
  |  Branch (259:13): [True: 1.02M, False: 0]
  ------------------
  260|  1.02M|        {
  261|  1.02M|            memcpy(szLinearCT, szElement, len1);
  262|  1.02M|            memcpy(szLinearCT + len1, szMult, (long long)len2 + 1); /*  adding zero termination */ /* djb-rwth: added cast operator */
  263|  1.02M|            return len1 + len2;
  264|  1.02M|        }
  265|      0|        else
  266|      0|        {
  267|      0|            ( *bOverflow )++;
  268|      0|        }
  269|  1.02M|    }
  270|       |
  271|     14|    return 0;
  272|  1.02M|}
MakeHillFormula:
  288|   385k|{
  289|   385k|    char szElement[4];
  290|   385k|    int  mult, compare2H;
  291|   385k|    int  i, nLen, bOvfl;
  292|   385k|    U_CHAR nPrevAtom;
  293|       |
  294|   385k|    nLen = 0;
  295|   385k|    mult = 0;
  296|   385k|    bOvfl = 0;
  297|   385k|    nPrevAtom = (U_CHAR) -2; /*  non-existent number */
  298|   385k|    memset(szElement, '\0', sizeof(szElement)); /* djb-rwth: fixing coverity ID #499542 */
  299|       |
  300|   385k|    if (num_C)
  ------------------
  |  Branch (300:9): [True: 112k, False: 273k]
  ------------------
  301|   112k|    {
  302|   112k|        nLen += AddElementAndCount( "C", num_C, szLinearCT + nLen, nLen_szLinearCT - nLen, &bOvfl );
  303|   112k|        if (num_H)
  ------------------
  |  Branch (303:13): [True: 25.6k, False: 86.9k]
  ------------------
  304|  25.6k|        {
  305|  25.6k|            nLen += AddElementAndCount( "H", num_H, szLinearCT + nLen, nLen_szLinearCT - nLen, &bOvfl );
  306|  25.6k|            num_H = 0;
  307|  25.6k|        }
  308|   112k|    }
  309|       |
  310|  2.01M|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (310:17): [True: 1.65M, False: 352k]
  ------------------
  311|  1.65M|    {
  312|       |
  313|  1.65M|        if (nPrevAtom != nAtom[i])
  ------------------
  |  Branch (313:13): [True: 799k, False: 858k]
  ------------------
  314|   799k|        {
  315|   799k|            if (mult)
  ------------------
  |  Branch (315:17): [True: 514k, False: 284k]
  ------------------
  316|   514k|            {
  317|   514k|                nLen += AddElementAndCount( szElement, mult, szLinearCT + nLen, nLen_szLinearCT - nLen, &bOvfl );
  318|   514k|            }
  319|   799k|            mult = 1;
  320|       |            /*if (-1 == get_element_chemical_symbol( (int) nAtom[i], szElement ))*/
  321|   799k|            if (-1 == get_element_or_pseudoelement_symbol( (int) nAtom[i], szElement ))
  ------------------
  |  Branch (321:17): [True: 0, False: 799k]
  ------------------
  322|      0|            {
  323|      0|                return -1; /*  wrong element */
  324|      0|            }
  325|       |
  326|   799k|            nPrevAtom = nAtom[i];
  327|   799k|            if (!strcmp( "C", szElement ))
  ------------------
  |  Branch (327:17): [True: 31.1k, False: 768k]
  ------------------
  328|  31.1k|            {
  329|  31.1k|                return -1;
  330|  31.1k|            }
  331|   768k|            compare2H = strcmp( "H", szElement );
  332|   768k|            if (!compare2H)
  ------------------
  |  Branch (332:17): [True: 2.28k, False: 765k]
  ------------------
  333|  2.28k|            {
  334|  2.28k|                return -1;
  335|  2.28k|            }
  336|   765k|            if (compare2H < 0 && num_H)
  ------------------
  |  Branch (336:17): [True: 675k, False: 90.2k]
  |  Branch (336:34): [True: 32.1k, False: 643k]
  ------------------
  337|  32.1k|            {
  338|       |                /*   H-atom should be located in front of szElement */
  339|  32.1k|                nLen += AddElementAndCount( "H", num_H, szLinearCT + nLen, nLen_szLinearCT - nLen, &bOvfl );
  340|  32.1k|                num_H = 0;
  341|  32.1k|            }
  342|   765k|        }
  343|   858k|        else
  344|   858k|        {
  345|   858k|            mult++;
  346|   858k|        }
  347|  1.65M|    }
  348|   352k|    if (mult)
  ------------------
  |  Branch (348:9): [True: 251k, False: 101k]
  ------------------
  349|   251k|    {
  350|       |        /*  the last element if any */
  351|   251k|        nLen += AddElementAndCount( szElement, mult, szLinearCT + nLen, nLen_szLinearCT - nLen, &bOvfl );
  352|   251k|    }
  353|   352k|    if (num_H)
  ------------------
  |  Branch (353:9): [True: 93.2k, False: 259k]
  ------------------
  354|  93.2k|    {
  355|       |        /*  if H has not been output... */
  356|  93.2k|        nLen += AddElementAndCount( "H", num_H, szLinearCT + nLen, nLen_szLinearCT - nLen, &bOvfl );
  357|  93.2k|    }
  358|   352k|    *bOverflow |= ( 0 != bOvfl );
  359|       |
  360|   352k|    return bOvfl ? nLen_szLinearCT + 1 : nLen;
  ------------------
  |  Branch (360:12): [True: 0, False: 352k]
  ------------------
  361|   385k|}
AllocateAndFillHillFormula:
  368|   385k|{
  369|   385k|    int num_C, num_H, nLen, nNumNonHAtoms, ret, bOverflow;
  370|   385k|    char *pHillFormula = NULL;
  371|       |
  372|   385k|    bOverflow = 0;
  373|       |
  374|   385k|    if (!GetHillFormulaCounts( pINChI->nAtom,
  ------------------
  |  Branch (374:9): [True: 385k, False: 0]
  ------------------
  375|   385k|        pINChI->nNum_H,
  376|   385k|        pINChI->nNumberOfAtoms,
  377|   385k|        pINChI->nTautomer,
  378|   385k|        pINChI->lenTautomer,
  379|   385k|        &num_C, &num_H,
  380|   385k|        &nLen,
  381|   385k|        &nNumNonHAtoms ))
  382|   385k|    {
  383|       |
  384|   385k|#if ( FIX_GAF_2019_2==1 )
  385|   385k|        pHillFormula = (char*)inchi_calloc((long long )nLen + 1, sizeof(char)); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|   385k|#define inchi_calloc   calloc
  ------------------
  386|       |#else
  387|       |        pHillFormula = (char*)inchi_malloc(nLen + 1);
  388|       |#endif
  389|       |
  390|   385k|        if (pHillFormula)
  ------------------
  |  Branch (390:13): [True: 385k, False: 0]
  ------------------
  391|   385k|        {
  392|       |
  393|   385k|            ret = MakeHillFormula( pINChI->nAtom + num_C,
  394|   385k|                                   nNumNonHAtoms - num_C,
  395|   385k|                                   pHillFormula,
  396|   385k|                                   nLen + 1,
  397|   385k|                                   num_C, num_H,
  398|   385k|                                   &bOverflow );
  399|       |
  400|   385k|            if (ret != nLen || bOverflow)
  ------------------
  |  Branch (400:17): [True: 35.3k, False: 350k]
  |  Branch (400:32): [True: 0, False: 350k]
  ------------------
  401|  35.3k|            {
  402|  35.3k|                inchi_free( pHillFormula );
  ------------------
  |  | 1152|  35.3k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 35.3k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 35.3k]
  |  |  ------------------
  ------------------
  403|  35.3k|                pHillFormula = NULL;
  404|  35.3k|            }
  405|   385k|        }
  406|   385k|    }
  407|       |
  408|   385k|    return pHillFormula;
  409|   385k|}
Copy2StereoBondOrAllene:
  424|  2.61k|{
  425|  2.61k|    int cumulene_len,
  426|  2.61k|        j,
  427|  2.61k|        next_j = 0 /* ordering number of the central allene atom */,
  428|  2.61k|        next_neigh;
  429|  2.61k|    AT_RANK
  430|  2.61k|        at_num;
  431|  2.61k|    int parity;
  432|       |
  433|  2.61k|    if (pCanonOrd && pCanonRank)
  ------------------
  |  Branch (433:9): [True: 2.61k, False: 0]
  |  Branch (433:22): [True: 2.61k, False: 0]
  ------------------
  434|  2.61k|    {
  435|  2.61k|        j = pCanonOrd[(int) LinearCTStereoDble->at_num1 - 1];
  436|       |
  437|       |        /* if allene then find the central atom, at[next_j] */
  438|       |
  439|  2.61k|        if (bIsotopic)
  ------------------
  |  Branch (439:13): [True: 336, False: 2.27k]
  ------------------
  440|    336|        {
  441|    336|            cumulene_len = BOND_CHAIN_LEN( at[j].stereo_bond_parity2[0] );
  ------------------
  |  |  214|    336|#define BOND_CHAIN_LEN(X)           (GET_BITS_CUMULENE_LEN(X)/MULT_STEREOBOND) /* 0 => double bond, 1 => allene, 2 => cumulene,..*/
  |  |  ------------------
  |  |  |  |  213|    336|#define GET_BITS_CUMULENE_LEN(X)    ((X)&MASK_CUMULENE_LEN)
  |  |  |  |  ------------------
  |  |  |  |  |  |  205|    336|#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,..*/
  |  |  ------------------
  |  |  |  |  209|    336|#define MULT_STEREOBOND    0x08  /* multiplier for cumulene chain length
  |  |  ------------------
  ------------------
  442|       |
  443|    336|            if (cumulene_len % 2 && ( 1 >= MAX_NUM_STEREO_BONDS || !at[j].stereo_bond_neighbor2[1] ))
  ------------------
  |  |  873|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (443:17): [True: 0, False: 336]
  |  Branch (443:39): [Folded, False: 0]
  |  Branch (443:68): [True: 0, False: 0]
  ------------------
  444|      0|            {
  445|      0|                next_j = at[j].neighbor[(int) at[j].stereo_bond_ord2[0]];
  446|       |
  447|      0|                for (cumulene_len = ( cumulene_len - 1 ) / 2; cumulene_len && 2 == at[next_j].valence; cumulene_len--)
  ------------------
  |  Branch (447:63): [True: 0, False: 0]
  |  Branch (447:79): [True: 0, False: 0]
  ------------------
  448|      0|                {
  449|      0|                    next_neigh = ( j == at[next_j].neighbor[0] );
  450|      0|                    j = next_j;
  451|      0|                    next_j = at[next_j].neighbor[next_neigh];
  452|      0|                }
  453|       |                /* next_j is the central atom */
  454|      0|            }
  455|    336|            else
  456|    336|            {
  457|    336|                cumulene_len = -1; /* not an allene */
  458|    336|            }
  459|    336|        }
  460|  2.27k|        else
  461|  2.27k|        {
  462|  2.27k|            cumulene_len = BOND_CHAIN_LEN( at[j].stereo_bond_parity[0] );
  ------------------
  |  |  214|  2.27k|#define BOND_CHAIN_LEN(X)           (GET_BITS_CUMULENE_LEN(X)/MULT_STEREOBOND) /* 0 => double bond, 1 => allene, 2 => cumulene,..*/
  |  |  ------------------
  |  |  |  |  213|  2.27k|#define GET_BITS_CUMULENE_LEN(X)    ((X)&MASK_CUMULENE_LEN)
  |  |  |  |  ------------------
  |  |  |  |  |  |  205|  2.27k|#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,..*/
  |  |  ------------------
  |  |  |  |  209|  2.27k|#define MULT_STEREOBOND    0x08  /* multiplier for cumulene chain length
  |  |  ------------------
  ------------------
  463|       |
  464|  2.27k|            if (cumulene_len % 2 && ( 1 >= MAX_NUM_STEREO_BONDS || !at[j].stereo_bond_neighbor[1] ))
  ------------------
  |  |  873|     12|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (464:17): [True: 6, False: 2.26k]
  |  Branch (464:39): [Folded, False: 6]
  |  Branch (464:68): [True: 6, False: 0]
  ------------------
  465|      6|            {
  466|      6|                next_j = at[j].neighbor[(int) at[j].stereo_bond_ord[0]];
  467|       |
  468|      6|                for (cumulene_len = ( cumulene_len - 1 ) / 2; cumulene_len && 2 == at[next_j].valence; cumulene_len--)
  ------------------
  |  Branch (468:63): [True: 0, False: 6]
  |  Branch (468:79): [True: 0, False: 0]
  ------------------
  469|      0|                {
  470|      0|                    next_neigh = ( j == at[next_j].neighbor[0] );
  471|      0|                    j = next_j;
  472|      0|                    next_j = at[next_j].neighbor[next_neigh];
  473|      0|                }
  474|      6|            }
  475|  2.26k|            else
  476|  2.26k|            {
  477|  2.26k|                cumulene_len = -1; /* not an allene */
  478|  2.26k|            }
  479|  2.27k|        }
  480|       |
  481|  2.61k|        if (!cumulene_len)
  ------------------
  |  Branch (481:13): [True: 6, False: 2.60k]
  ------------------
  482|      6|        {
  483|       |            /* allene has been found; insert new stereocenter and parity */
  484|       |
  485|      6|            AT_NUMB *nNumber;
  486|      6|            S_CHAR  *t_parity;
  487|       |
  488|      6|            nNumber = nNumberOfStereoBonds ? Stereo->nNumber : Stereo->nNumberInv;
  ------------------
  |  Branch (488:23): [True: 3, False: 3]
  ------------------
  489|      6|            t_parity = nNumberOfStereoBonds ? Stereo->t_parity : Stereo->t_parityInv;
  ------------------
  |  Branch (489:24): [True: 3, False: 3]
  ------------------
  490|       |
  491|      6|            at_num = pCanonRank[next_j];
  492|      6|            parity = LinearCTStereoDble->parity;
  493|       |
  494|       |            /* free room for the new stereocenter */
  495|      6|            for (j = 0; j < *nNumberOfStereoCenters && Stereo->nNumber[j] < at_num; j++)
  ------------------
  |  Branch (495:25): [True: 0, False: 6]
  |  Branch (495:56): [True: 0, False: 0]
  ------------------
  496|      0|            {
  497|      0|                ;
  498|      0|            }
  499|       |
  500|      6|            if (j < *nNumberOfStereoCenters)
  ------------------
  |  Branch (500:17): [True: 0, False: 6]
  ------------------
  501|      0|            {
  502|      0|                memmove(nNumber + j + 1, nNumber + j, (*nNumberOfStereoCenters - (long long)j) * sizeof(nNumber[0])); /* djb-rwth: cast operator added */
  503|      0|                memmove(t_parity + j + 1, t_parity + j, (*nNumberOfStereoCenters - (long long)j) * sizeof(t_parity[0])); /* djb-rwth: cast operator added */
  504|      0|            }
  505|       |
  506|       |            /* fill the new stereo center info */
  507|       |
  508|      6|            nNumber[j] = at_num;
  509|      6|            t_parity[j] = parity;
  510|      6|            ( *nNumberOfStereoCenters )++;
  511|      6|            return 1;
  512|      6|        }
  513|  2.61k|    }
  514|       |
  515|       |    /* Save the stereo bond info */
  516|       |
  517|  2.60k|    if (nNumberOfStereoBonds)
  ------------------
  |  Branch (517:9): [True: 1.30k, False: 1.30k]
  ------------------
  518|  1.30k|    {
  519|  1.30k|        j = *nNumberOfStereoBonds;
  520|  1.30k|        Stereo->b_parity[j] = LinearCTStereoDble->parity;
  521|  1.30k|        Stereo->nBondAtom1[j] = LinearCTStereoDble->at_num1;
  522|  1.30k|        Stereo->nBondAtom2[j] = LinearCTStereoDble->at_num2;
  523|  1.30k|        ( *nNumberOfStereoBonds )++;
  524|  1.30k|    }
  525|       |
  526|  2.60k|    return 0;
  527|  2.61k|}
CopyLinearCTStereoToINChIStereo:
  542|  1.01k|{
  543|  1.01k|    int n, i, nErrorCode = 0, len;
  544|  1.01k|    int bAllene;
  545|  1.01k|    int diff;
  546|  1.01k|    int lenInv, bAlleneInv;
  547|       |
  548|       |    /* Stereo centers */
  549|       |
  550|       |    /* djb-rwth: fixing oss-fuzz issue #68271 */
  551|  1.01k|    if (Stereo)
  ------------------
  |  Branch (551:9): [True: 1.01k, False: 3]
  ------------------
  552|  1.01k|    {
  553|  1.01k|        n = Stereo->nNumberOfStereoCenters = nLenLinearCTStereoCarb;
  554|       |
  555|  2.71k|        for (i = 0; i < n; i++)
  ------------------
  |  Branch (555:21): [True: 1.70k, False: 1.01k]
  ------------------
  556|  1.70k|        {
  557|  1.70k|            if (LinearCTStereoCarb) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (557:17): [True: 1.70k, False: 0]
  ------------------
  558|  1.70k|            {
  559|  1.70k|                Stereo->nNumber[i] = LinearCTStereoCarb[i].at_num;
  560|  1.70k|                Stereo->t_parity[i] = LinearCTStereoCarb[i].parity;
  561|  1.70k|            }
  562|  1.70k|            if (LinearCTStereoCarbInv) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (562:17): [True: 1.70k, False: 0]
  ------------------
  563|  1.70k|            {
  564|  1.70k|                Stereo->nNumberInv[i] = LinearCTStereoCarbInv[i].at_num;
  565|  1.70k|                Stereo->t_parityInv[i] = LinearCTStereoCarbInv[i].parity;
  566|  1.70k|            }
  567|  1.70k|        }
  568|       |
  569|       |        /* Stereo bonds */
  570|       |
  571|  1.01k|        n = nLenLinearCTStereoDble;
  572|  1.01k|        lenInv = Stereo->nNumberOfStereoCenters;
  573|       |
  574|  2.31k|        for (i = len = 0; i < n; i++)
  ------------------
  |  Branch (574:27): [True: 1.30k, False: 1.01k]
  ------------------
  575|  1.30k|        {
  576|  1.30k|            bAllene =
  577|  1.30k|                Copy2StereoBondOrAllene(Stereo,
  578|  1.30k|                    &Stereo->nNumberOfStereoCenters,
  579|  1.30k|                    &len,
  580|  1.30k|                    LinearCTStereoDble + i,
  581|  1.30k|                    pCanonOrd, pCanonRank,
  582|  1.30k|                    at,
  583|  1.30k|                    bIsotopic);
  584|       |
  585|  1.30k|            bAlleneInv =
  586|  1.30k|                Copy2StereoBondOrAllene(Stereo,
  587|  1.30k|                    &lenInv,
  588|  1.30k|                    NULL,
  589|  1.30k|                    LinearCTStereoDbleInv + i,
  590|  1.30k|                    pCanonOrdInv, pCanonRankInv,
  591|  1.30k|                    at,
  592|  1.30k|                    bIsotopic);
  593|       |
  594|       |            /* make sure double bond stereo is identical in original and inverted geometry */
  595|       |            /* Note: all allenes are AFTER double bonds in LinearCTStereoDble... */
  596|  1.30k|            if (bAllene != bAlleneInv || (!bAllene &&
  ------------------
  |  Branch (596:17): [True: 0, False: 1.30k]
  |  Branch (596:43): [True: 1.30k, False: 3]
  ------------------
  597|  1.30k|                CompareLinCtStereoDble(LinearCTStereoDble + i, 1,
  ------------------
  |  Branch (597:17): [True: 0, False: 1.30k]
  ------------------
  598|  1.30k|                    LinearCTStereoDbleInv + i, 1))) /* djb-rwth: addressing LLVM warning */
  599|      0|            {
  600|       |                /* double bond stereo Inv is NOT identical to Abs */
  601|      0|                nErrorCode = -4;
  602|      0|                goto exit_function;
  603|      0|            }
  604|  1.30k|        }
  605|       |
  606|  1.01k|        Stereo->nNumberOfStereoBonds = len;
  607|       |
  608|  1.01k|        if (lenInv != Stereo->nNumberOfStereoCenters)
  ------------------
  |  Branch (608:13): [True: 0, False: 1.01k]
  ------------------
  609|      0|        {
  610|      0|            nErrorCode = -5; /* different number of stereo centers in Abs and Inv */
  611|      0|            goto exit_function;
  612|      0|        }
  613|       |
  614|       |
  615|       |        /* compare inverted stereocenters to absolute */
  616|       |
  617|  1.01k|        n = Stereo->nNumberOfStereoCenters;
  618|       |        /* djb-rwth: removing redundant code */
  619|       |
  620|  2.37k|        for (i = 0, diff = 0; i < n; i++)
  ------------------
  |  Branch (620:31): [True: 1.60k, False: 768]
  ------------------
  621|  1.60k|        {
  622|  1.60k|            if (Stereo->nNumberInv[i] != Stereo->nNumber[i])
  ------------------
  |  Branch (622:17): [True: 27, False: 1.57k]
  ------------------
  623|     27|            {
  624|     27|                diff = (Stereo->nNumberInv[i] > Stereo->nNumber[i]) ? 2 : -2;
  ------------------
  |  Branch (624:24): [True: 8, False: 19]
  ------------------
  625|     27|                break; /* Abs != Inv */
  626|     27|            }
  627|  1.57k|            if (Stereo->t_parityInv[i] != Stereo->t_parity[i])
  ------------------
  |  Branch (627:17): [True: 218, False: 1.35k]
  ------------------
  628|    218|            {
  629|    218|                diff = (Stereo->t_parityInv[i] > Stereo->t_parity[i]) ? 1 : -1;
  ------------------
  |  Branch (629:24): [True: 93, False: 125]
  ------------------
  630|    218|                break; /* Abs != Inv */
  631|    218|            }
  632|  1.57k|        }
  633|       |
  634|  1.01k|        Stereo->nCompInv2Abs =
  635|  1.01k|            (diff > 0) ? 1 : (diff < 0) ? -1 : 0;
  ------------------
  |  Branch (635:13): [True: 101, False: 912]
  |  Branch (635:30): [True: 144, False: 768]
  ------------------
  636|       |
  637|  1.01k|        if (diff == -1 || diff == 1)
  ------------------
  |  Branch (637:13): [True: 125, False: 888]
  |  Branch (637:27): [True: 93, False: 795]
  ------------------
  638|    218|        {
  639|       |            /* The first found difference was in parities */
  640|    391|            for (i = 0, diff = 0; i < n; i++)
  ------------------
  |  Branch (640:35): [True: 280, False: 111]
  ------------------
  641|    280|            {
  642|    280|                if (Stereo->nNumberInv[i] != Stereo->nNumber[i])
  ------------------
  |  Branch (642:21): [True: 0, False: 280]
  ------------------
  643|      0|                {
  644|      0|                    diff = 2; /* difference in stereo center numbering */
  645|      0|                    break;
  646|      0|                }
  647|       |
  648|       |                /*  Parities can be only 1, 2, 3, 4. Therefore only mutually inverted pairs
  649|       |                 *  (t_parityInv, t_parity) = (1,2) or (2,1) statisfy conditions
  650|       |                 *  (t_parityInv != t_parity) && (t_parityInv + t_parity == 3)
  651|       |                 */
  652|       |
  653|    280|                if (Stereo->t_parityInv[i] == Stereo->t_parity[i] ||
  ------------------
  |  Branch (653:21): [True: 107, False: 173]
  ------------------
  654|    173|                    Stereo->t_parityInv[i] + Stereo->t_parity[i] != 3)
  ------------------
  |  Branch (654:21): [True: 0, False: 173]
  ------------------
  655|    107|                {
  656|    107|                    diff = 1; /* parities are same or different and cannot be obtained by simple inversion */
  657|    107|                    break;
  658|    107|                }
  659|    280|            }
  660|    218|            Stereo->bTrivialInv = !diff;
  661|    218|        }
  662|    795|        else
  663|    795|        {
  664|    795|            Stereo->bTrivialInv = 0;
  665|    795|        }
  666|  1.01k|    }
  667|      3|    else
  668|      3|    {
  669|      3|        nErrorCode = 1;
  670|      3|    }
  671|       |
  672|  1.01k|exit_function:
  673|  1.01k|    return nErrorCode;
  674|  1.01k|}
MarkAmbiguousStereo:
  686|   290k|{
  687|   290k|    int n, i, j1, j2, num, mark_atom, mark_bond;
  688|       |
  689|   290k|    if (!pCanonOrd)
  ------------------
  |  Branch (689:9): [True: 0, False: 290k]
  ------------------
  690|      0|    {
  691|      0|        return -1;
  692|      0|    }
  693|       |
  694|   290k|    num = 0;
  695|       |
  696|   290k|    n = nLenLinearCTStereoCarb;
  697|       |
  698|   290k|    mark_atom = bIsotopic ? AMBIGUOUS_STEREO_ATOM_ISO : AMBIGUOUS_STEREO_ATOM;
  ------------------
  |  |  248|  2.10k|#define AMBIGUOUS_STEREO_ATOM_ISO  8
  ------------------
                  mark_atom = bIsotopic ? AMBIGUOUS_STEREO_ATOM_ISO : AMBIGUOUS_STEREO_ATOM;
  ------------------
  |  |  246|   578k|#define AMBIGUOUS_STEREO_ATOM      2
  ------------------
  |  Branch (698:17): [True: 2.10k, False: 288k]
  ------------------
  699|       |
  700|   292k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (700:17): [True: 1.70k, False: 290k]
  ------------------
  701|  1.70k|    {
  702|       |        /*  Mark ambiguous stereo centers (for displaying and "Ambiguous stereo" message) */
  703|  1.70k|        if (ATOM_PARITY_NOT_UNKN( LinearCTStereoCarb[i].parity ) &&
  ------------------
  |  |  260|  3.40k|#define ATOM_PARITY_NOT_UNKN(X)     (ATOM_PARITY_KNOWN(X) && (X) != AB_PARITY_UNKN)
  |  |  ------------------
  |  |  |  |  258|  3.40k|#define ATOM_PARITY_KNOWN(X)        (AB_MIN_KNOWN_PARITY <= (X) && (X) <= AB_MAX_KNOWN_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  231|  1.70k|#define AB_MIN_KNOWN_PARITY        1
  |  |  |  |  ------------------
  |  |  |  |               #define ATOM_PARITY_KNOWN(X)        (AB_MIN_KNOWN_PARITY <= (X) && (X) <= AB_MAX_KNOWN_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  230|  1.70k|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (258:38): [True: 1.70k, False: 0]
  |  |  |  |  |  Branch (258:68): [True: 1.70k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ATOM_PARITY_NOT_UNKN(X)     (ATOM_PARITY_KNOWN(X) && (X) != AB_PARITY_UNKN)
  |  |  ------------------
  |  |  |  |  221|  1.70k|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  |  |  ------------------
  |  |  |  Branch (260:62): [True: 1.66k, False: 44]
  |  |  ------------------
  ------------------
  704|  1.66k|             at[j1 = pCanonOrd[(int) LinearCTStereoCarb[i].at_num - 1]].bAmbiguousStereo)
  ------------------
  |  Branch (704:14): [True: 0, False: 1.66k]
  ------------------
  705|      0|        {
  706|      0|            at[j1].bAmbiguousStereo |= mark_atom;
  707|      0|            norm_at[j1].bAmbiguousStereo |= mark_atom;
  708|      0|            num++;
  709|      0|        }
  710|  1.70k|    }
  711|       |
  712|   290k|    n = nLenLinearCTStereoDble;
  713|       |
  714|   290k|    mark_bond = bIsotopic ? AMBIGUOUS_STEREO_BOND_ISO : AMBIGUOUS_STEREO_BOND;
  ------------------
  |  |  249|  2.10k|#define AMBIGUOUS_STEREO_BOND_ISO  16
  ------------------
                  mark_bond = bIsotopic ? AMBIGUOUS_STEREO_BOND_ISO : AMBIGUOUS_STEREO_BOND;
  ------------------
  |  |  247|   578k|#define AMBIGUOUS_STEREO_BOND      4
  ------------------
  |  Branch (714:17): [True: 2.10k, False: 288k]
  ------------------
  715|       |
  716|   291k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (716:17): [True: 1.30k, False: 290k]
  ------------------
  717|  1.30k|    {
  718|       |        /*  Mark ambiguous stereo bonds or allenes (for displaying and "Ambiguous stereo" message) */
  719|       |
  720|  1.30k|        if (ATOM_PARITY_WELL_DEF( LinearCTStereoDble[i].parity ))
  ------------------
  |  |  259|  1.30k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  1.30k|#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)
  |  |  ------------------
  |  |  |  |  236|  1.30k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 1.30k, False: 0]
  |  |  |  Branch (259:75): [True: 255, False: 1.05k]
  |  |  ------------------
  ------------------
  721|    255|        {
  722|    255|            j1 = pCanonOrd[(int) LinearCTStereoDble[i].at_num1 - 1];
  723|    255|            j2 = pCanonOrd[(int) LinearCTStereoDble[i].at_num2 - 1];
  724|       |
  725|    255|            if (at[j1].bAmbiguousStereo || at[j2].bAmbiguousStereo)
  ------------------
  |  Branch (725:17): [True: 0, False: 255]
  |  Branch (725:44): [True: 0, False: 255]
  ------------------
  726|      0|            {
  727|       |                /* If it is an allene then mark the central atom only
  728|       |                   because the bonds should not be marked to avoid misleading
  729|       |                   message "Ambiguous stereo: bond(s)": Allene makes a stereocenter
  730|       |                */
  731|       |
  732|      0|                int j1_parity = bIsotopic ? at[j1].stereo_bond_parity2[0] : at[j1].stereo_bond_parity[0];
  ------------------
  |  Branch (732:33): [True: 0, False: 0]
  ------------------
  733|       |
  734|      0|                int cumulene_len = BOND_CHAIN_LEN( j1_parity ); /* 0 => double bond, 1 => allene, 2 => cumulene,..*/
  ------------------
  |  |  214|      0|#define BOND_CHAIN_LEN(X)           (GET_BITS_CUMULENE_LEN(X)/MULT_STEREOBOND) /* 0 => double bond, 1 => allene, 2 => cumulene,..*/
  |  |  ------------------
  |  |  |  |  213|      0|#define GET_BITS_CUMULENE_LEN(X)    ((X)&MASK_CUMULENE_LEN)
  |  |  |  |  ------------------
  |  |  |  |  |  |  205|      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,..*/
  |  |  ------------------
  |  |  |  |  209|      0|#define MULT_STEREOBOND    0x08  /* multiplier for cumulene chain length
  |  |  ------------------
  ------------------
  735|       |
  736|      0|                if (cumulene_len % 2 && ( 1 >= MAX_NUM_STEREO_BONDS ||
  ------------------
  |  |  873|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (736:21): [True: 0, False: 0]
  |  Branch (736:43): [Folded, False: 0]
  ------------------
  737|      0|                    !( bIsotopic ? at[j1].stereo_bond_neighbor2[1] : at[j1].stereo_bond_neighbor[1] ) )
  ------------------
  |  Branch (737:21): [True: 0, False: 0]
  |  Branch (737:24): [True: 0, False: 0]
  ------------------
  738|      0|                    )
  739|      0|                {
  740|       |                    /*  found an allene; locate its central atom */
  741|       |
  742|      0|                    int next_j, next_neigh;
  743|      0|                    int j = j1;
  744|       |
  745|      0|                    next_j = at[j].neighbor[bIsotopic ? at[j].stereo_bond_ord2[0] : at[j].stereo_bond_ord[0]];
  ------------------
  |  Branch (745:45): [True: 0, False: 0]
  ------------------
  746|       |
  747|      0|                    for (cumulene_len = ( cumulene_len - 1 ) / 2;
  748|      0|                         cumulene_len && 2 == at[next_j].valence;
  ------------------
  |  Branch (748:26): [True: 0, False: 0]
  |  Branch (748:42): [True: 0, False: 0]
  ------------------
  749|      0|                         cumulene_len--)
  750|      0|                    {
  751|      0|                        next_neigh = ( j == at[next_j].neighbor[0] );
  752|      0|                        j = next_j;
  753|      0|                        next_j = at[next_j].neighbor[next_neigh];
  754|      0|                    }
  755|       |                    /* next_j is the central atom */
  756|      0|                    if (2 == at[next_j].valence)
  ------------------
  |  Branch (756:25): [True: 0, False: 0]
  ------------------
  757|      0|                    {
  758|      0|                        at[next_j].bAmbiguousStereo |= mark_atom;
  759|      0|                        norm_at[next_j].bAmbiguousStereo |= mark_atom;
  760|      0|                        num++;
  761|      0|                        continue; /* do not mark the cumulene "bond" endpoints */
  762|      0|                    }
  763|      0|                }
  764|       |
  765|       |                /* Not an allene, mark double bond or cumulene end atoms */
  766|      0|                if (at[j1].bAmbiguousStereo)
  ------------------
  |  Branch (766:21): [True: 0, False: 0]
  ------------------
  767|      0|                {
  768|      0|                    at[j1].bAmbiguousStereo |= mark_bond; /*  ??? */
  769|      0|                    norm_at[j1].bAmbiguousStereo |= mark_bond;
  770|      0|                    num++;
  771|      0|                }
  772|       |
  773|      0|                if (at[j2].bAmbiguousStereo)
  ------------------
  |  Branch (773:21): [True: 0, False: 0]
  ------------------
  774|      0|                {
  775|      0|                    at[j2].bAmbiguousStereo |= mark_bond; /*  ??? */
  776|      0|                    norm_at[j2].bAmbiguousStereo |= mark_bond;
  777|      0|                    num++;
  778|      0|                }
  779|      0|            }
  780|    255|        }
  781|  1.30k|    }
  782|       |
  783|   290k|    return num;
  784|   290k|}
UnmarkAllUndefinedUnknownStereo:
  790|   290k|{
  791|   290k|    INCHI_MODE nRet = 0;
  792|   290k|    int   i, n;
  793|       |
  794|   290k|    if (!Stereo || (Stereo && !Stereo->nNumberOfStereoCenters && !Stereo->nNumberOfStereoBonds)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (794:9): [True: 0, False: 290k]
  |  Branch (794:21): [True: 290k, False: 0]
  |  Branch (794:31): [True: 289k, False: 665]
  |  Branch (794:66): [True: 289k, False: 348]
  ------------------
  795|   289k|    {
  796|   289k|        return nRet;
  797|   289k|    }
  798|       |
  799|       |    /* Stereocenters */
  800|  1.01k|    if (!Stereo->nCompInv2Abs &&
  ------------------
  |  Branch (800:9): [True: 768, False: 245]
  ------------------
  801|    768|        ( n = Stereo->nNumberOfStereoCenters ) > 0 && ( nUserMode & REQ_MODE_SC_IGN_ALL_UU ))
  ------------------
  |  |   30|    420|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  |  Branch (801:9): [True: 420, False: 348]
  |  Branch (801:55): [True: 349, False: 71]
  ------------------
  802|    349|    {
  803|       |
  804|    837|        for (i = 0; i < n && !ATOM_PARITY_WELL_DEF( Stereo->t_parity[i] ); i++)
  ------------------
  |  |  259|    676|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    676|#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)
  |  |  ------------------
  |  |  |  |  236|    676|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 676, False: 0]
  |  |  |  Branch (259:75): [True: 188, False: 488]
  |  |  ------------------
  ------------------
  |  Branch (804:21): [True: 676, False: 161]
  ------------------
  805|    488|        {
  806|    488|            ;
  807|    488|        }
  808|       |
  809|    349|        if (i == n)
  ------------------
  |  Branch (809:13): [True: 161, False: 188]
  ------------------
  810|    161|        {
  811|    161|            Stereo->nNumberOfStereoCenters = 0;
  812|       |
  813|    519|            for (i = 0; i < n; i++)
  ------------------
  |  Branch (813:25): [True: 358, False: 161]
  ------------------
  814|    358|            {
  815|    358|                Stereo->t_parity[i] = 0;
  816|    358|                Stereo->nNumber[i] = 0;
  817|    358|                Stereo->t_parityInv[i] = 0;
  818|    358|                Stereo->nNumberInv[i] = 0;
  819|    358|            }
  820|       |
  821|    161|            nRet |= REQ_MODE_SC_IGN_ALL_UU;
  ------------------
  |  |   30|    161|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  822|    161|        }
  823|    349|    }
  824|       |
  825|       |    /* Stereobonds */
  826|       |
  827|  1.01k|    if (( n = Stereo->nNumberOfStereoBonds ) > 0 && ( nUserMode & REQ_MODE_SB_IGN_ALL_UU ))
  ------------------
  |  |   32|    363|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
  |  Branch (827:9): [True: 363, False: 650]
  |  Branch (827:53): [True: 265, False: 98]
  ------------------
  828|    265|    {
  829|    459|        for (i = 0; i < n && !ATOM_PARITY_WELL_DEF( Stereo->b_parity[i] ); i++)
  ------------------
  |  |  259|    383|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    383|#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)
  |  |  ------------------
  |  |  |  |  236|    383|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 383, False: 0]
  |  |  |  Branch (259:75): [True: 189, False: 194]
  |  |  ------------------
  ------------------
  |  Branch (829:21): [True: 383, False: 76]
  ------------------
  830|    194|        {
  831|    194|            ;
  832|    194|        }
  833|       |
  834|    265|        if (i == n)
  ------------------
  |  Branch (834:13): [True: 76, False: 189]
  ------------------
  835|     76|        {
  836|     76|            Stereo->nNumberOfStereoBonds = 0;
  837|    231|            for (i = 0; i < n; i++)
  ------------------
  |  Branch (837:25): [True: 155, False: 76]
  ------------------
  838|    155|            {
  839|    155|                Stereo->b_parity[i] = 0;
  840|    155|                Stereo->nBondAtom1[i] = 0;
  841|    155|                Stereo->nBondAtom2[i] = 0;
  842|    155|            }
  843|     76|            nRet |= REQ_MODE_SB_IGN_ALL_UU;
  ------------------
  |  |   32|     76|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
  844|     76|        }
  845|    265|    }
  846|       |
  847|  1.01k|    return nRet;
  848|   290k|}
FillOutINChI:
 1050|   288k|{
 1051|   288k|    int i, j, m, n, g, len, ii, ret = 0;
 1052|       |
 1053|   288k|    AT_NUMB   *pSymmRank, *pOrigNosInCanonOrd, *pConstitEquNumb, *pCanonOrd = NULL, *pCanonOrdInv = NULL, *pCanonOrdTaut;
 1054|   288k|    T_GROUP_INFO     *t_group_info = pCS->t_group_info;
 1055|   288k|    T_GROUP *t_group;
 1056|       |
 1057|   288k|    int nErrorCode = 0;
 1058|   288k|    AT_NUMB *pCanonRank, *pCanonRankInv; /* canonical ranks of the atoms or tautomeric groups */
 1059|   288k|    AT_NUMB *pCanonRankAtoms = NULL, *pSortOrd = NULL;
 1060|   288k|    AT_RANK nMinOrd;
 1061|       |
 1062|   288k|    INChI_Stereo *Stereo;
 1063|   288k|    int          bUseNumberingInv = 0, bUseIsotopicNumberingInv = 0;
 1064|       |
 1065|   288k|    INCHI_MODE    nStereoUnmarkMode;
 1066|       |
 1067|       |    /*AT_NUMB  *pCanonOrdNonIso = NULL, *pCanonOrdIso = NULL;*/
 1068|       |    /*AT_NUMB  *nOrigAtNosInCanonOrdNonIso = NULL, *nOrigAtNosInCanonOrdIso = NULL;*/
 1069|       |
 1070|       |
 1071|       |    /*  Check for warnings */
 1072|   288k|    if (pCS->nLenLinearCTStereoCarb < 0 || pCS->nLenLinearCTStereoDble < 0 ||
  ------------------
  |  Branch (1072:9): [True: 0, False: 288k]
  |  Branch (1072:44): [True: 0, False: 288k]
  ------------------
 1073|   288k|         pCS->nLenCanonOrdStereo < 0 || pCS->nLenCanonOrdStereoTaut < 0)
  ------------------
  |  Branch (1073:10): [True: 0, False: 288k]
  |  Branch (1073:41): [True: 0, False: 288k]
  ------------------
 1074|      0|    {
 1075|      0|        nErrorCode |= WARN_FAILED_STEREO;
  ------------------
  |  |   48|      0|#define WARN_FAILED_STEREO          0x0001
  ------------------
 1076|      0|    }
 1077|   288k|    if (pCS->nLenLinearCTIsotopic < 0 || pCS->nLenLinearCTIsotopicTautomer < 0 ||
  ------------------
  |  Branch (1077:9): [True: 0, False: 288k]
  |  Branch (1077:42): [True: 0, False: 288k]
  ------------------
 1078|   288k|         pCS->nLenCanonOrdIsotopic < 0 || pCS->nLenCanonOrdIsotopicTaut < 0)
  ------------------
  |  Branch (1078:10): [True: 0, False: 288k]
  |  Branch (1078:43): [True: 0, False: 288k]
  ------------------
 1079|      0|    {
 1080|      0|        nErrorCode |= WARN_FAILED_ISOTOPIC;
  ------------------
  |  |   49|      0|#define WARN_FAILED_ISOTOPIC        0x0002
  ------------------
 1081|      0|    }
 1082|   288k|    if (pCS->nLenLinearCTIsotopicStereoCarb < 0 || pCS->nLenLinearCTIsotopicStereoDble < 0 ||
  ------------------
  |  Branch (1082:9): [True: 0, False: 288k]
  |  Branch (1082:52): [True: 0, False: 288k]
  ------------------
 1083|   288k|         pCS->nLenCanonOrdIsotopicStereo < 0 || pCS->nLenCanonOrdIsotopicStereoTaut < 0)
  ------------------
  |  Branch (1083:10): [True: 0, False: 288k]
  |  Branch (1083:49): [True: 0, False: 288k]
  ------------------
 1084|      0|    {
 1085|      0|        nErrorCode |= WARN_FAILED_ISOTOPIC_STEREO;
  ------------------
  |  |   50|      0|#define WARN_FAILED_ISOTOPIC_STEREO 0x0004
  ------------------
 1086|      0|    }
 1087|       |
 1088|   288k|    pCanonRankAtoms = (AT_NUMB *) inchi_calloc( (long long)num_at_tg + 1, sizeof( pCanonRankAtoms[0] ) ); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|   288k|#define inchi_calloc   calloc
  ------------------
 1089|       |
 1090|   288k|    pSortOrd = (AT_NUMB *) inchi_calloc( (long long)num_at_tg + 1, sizeof( pSortOrd[0] ) ); /*  must have more than num_atoms */ /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|   288k|#define inchi_calloc   calloc
  ------------------
 1091|       |
 1092|   288k|    if (!pCanonRankAtoms || !pSortOrd)
  ------------------
  |  Branch (1092:9): [True: 0, False: 288k]
  |  Branch (1092:29): [True: 0, False: 288k]
  ------------------
 1093|      0|    {
 1094|      0|        nErrorCode = 0;
 1095|      0|        ret = CT_OUT_OF_RAM;  /*   <BRKPT> */
  ------------------
  |  |   21|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1096|      0|        pINChI->nErrorCode = pINChI_Aux->nErrorCode = CT_OUT_OF_RAM;
  ------------------
  |  |   21|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1097|      0|        goto exit_function;
 1098|      0|    }
 1099|       |
 1100|       |    /*  Total charge */
 1101|       |    /* djb-rwth: fixing oss-fuzz issue #69656 */
 1102|  1.38M|    for (i = 0, n = 0; i < num_atoms + num_removed_H; i++)
  ------------------
  |  Branch (1102:24): [True: 1.10M, False: 288k]
  ------------------
 1103|  1.10M|    {
 1104|  1.10M|        n += at[i].charge;
 1105|  1.10M|    }
 1106|   288k|    pINChI->nTotalCharge = n;
 1107|       |
 1108|       |    /*  Number of atoms */
 1109|   288k|    pINChI->nNumberOfAtoms = num_atoms;
 1110|   288k|    pINChI_Aux->nNumberOfAtoms = num_atoms;
 1111|       |
 1112|       |    /* Removed protons and detachable isotopic H */
 1113|   288k|    if (bTautomeric && t_group_info)
  ------------------
  |  Branch (1113:9): [True: 252k, False: 36.3k]
  |  Branch (1113:24): [True: 252k, False: 0]
  ------------------
 1114|   252k|    {
 1115|   252k|        pINChI_Aux->nNumRemovedProtons = t_group_info->tni.nNumRemovedProtons;
 1116|       |
 1117|  1.00M|        for (i = 0; i < NUM_H_ISOTOPES; i++)
  ------------------
  |  |   25|  1.00M|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (1117:21): [True: 756k, False: 252k]
  ------------------
 1118|   756k|        {
 1119|   756k|            pINChI_Aux->nNumRemovedIsotopicH[i] = t_group_info->num_iso_H[i]
 1120|   756k|                + t_group_info->tni.nNumRemovedProtonsIsotopic[i];
 1121|   756k|        }
 1122|       |
 1123|   252k|        if (pINChI_Aux->bNormalizationFlags & FLAG_FORCE_SALT_TAUT)
  ------------------
  |  |  172|   252k|#define FLAG_FORCE_SALT_TAUT         ( FLAG_PROTON_NP_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  147|   252k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  173|   252k|                                       FLAG_PROTON_AC_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  150|   252k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  174|   252k|                                       FLAG_PROTON_AC_HARD_ADDED    )
  |  |  ------------------
  |  |  |  |  151|   252k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  ------------------
  |  Branch (1123:13): [True: 172, False: 251k]
  ------------------
 1124|    172|        {
 1125|    172|            pINChI->nFlags |= INCHI_FLAG_HARD_ADD_REM_PROTON;
  ------------------
  |  |  127|    172|#define INCHI_FLAG_HARD_ADD_REM_PROTON  0x0080   /* in normalization a proton has been added or removed along alt path */
  ------------------
 1126|    172|        }
 1127|   252k|        if (pINChI_Aux->bNormalizationFlags & ( FLAG_NORM_CONSIDER_TAUT &~FLAG_PROTON_CHARGE_CANCEL ))
  ------------------
  |  |  156|   252k|#define FLAG_NORM_CONSIDER_TAUT      ( FLAG_PROTON_NPO_SIMPLE_REMOVED | \
  |  |  ------------------
  |  |  |  |  146|   252k|#define FLAG_PROTON_NPO_SIMPLE_REMOVED 0x0001
  |  |  ------------------
  |  |  157|   252k|                                       FLAG_PROTON_NP_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  147|   252k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  158|   252k|                                       FLAG_PROTON_AC_SIMPLE_ADDED    | \
  |  |  ------------------
  |  |  |  |  148|   252k|#define FLAG_PROTON_AC_SIMPLE_ADDED    0x0004
  |  |  ------------------
  |  |  159|   252k|                                       FLAG_PROTON_AC_SIMPLE_REMOVED  | \
  |  |  ------------------
  |  |  |  |  149|   252k|#define FLAG_PROTON_AC_SIMPLE_REMOVED  0x0008
  |  |  ------------------
  |  |  160|   252k|                                       FLAG_PROTON_AC_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  150|   252k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  161|   252k|                                       FLAG_PROTON_AC_HARD_ADDED      | \
  |  |  ------------------
  |  |  |  |  151|   252k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  |  |  162|   252k|                                       FLAG_PROTON_SINGLE_REMOVED     | \
  |  |  ------------------
  |  |  |  |  153|   252k|#define FLAG_PROTON_SINGLE_REMOVED     0x0080
  |  |  ------------------
  |  |  163|   252k|                                       FLAG_PROTON_CHARGE_CANCEL    )
  |  |  ------------------
  |  |  |  |  152|   252k|#define FLAG_PROTON_CHARGE_CANCEL      0x0040
  |  |  ------------------
  ------------------
                      if (pINChI_Aux->bNormalizationFlags & ( FLAG_NORM_CONSIDER_TAUT &~FLAG_PROTON_CHARGE_CANCEL ))
  ------------------
  |  |  152|   252k|#define FLAG_PROTON_CHARGE_CANCEL      0x0040
  ------------------
  |  Branch (1127:13): [True: 39.6k, False: 212k]
  ------------------
 1128|  39.6k|        {
 1129|  39.6k|            if (!bNoWarnings)
  ------------------
  |  Branch (1129:17): [True: 39.6k, False: 0]
  ------------------
 1130|  39.6k|            {
 1131|  39.6k|                WarningMessage( pStrErrStruct, "Proton(s) added/removed" );
  ------------------
  |  |  132|  39.6k|#define WarningMessage AddErrorMessage
  ------------------
 1132|  39.6k|            }
 1133|  39.6k|        }
 1134|   252k|        if (pINChI_Aux->bNormalizationFlags & FLAG_PROTON_CHARGE_CANCEL)
  ------------------
  |  |  152|   252k|#define FLAG_PROTON_CHARGE_CANCEL      0x0040
  ------------------
  |  Branch (1134:13): [True: 19, False: 252k]
  ------------------
 1135|     19|        {
 1136|     19|            if (!bNoWarnings)
  ------------------
  |  Branch (1136:17): [True: 19, False: 0]
  ------------------
 1137|     19|            {
 1138|     19|                WarningMessage( pStrErrStruct, "Charges neutralized" );
  ------------------
  |  |  132|     19|#define WarningMessage AddErrorMessage
  ------------------
 1139|     19|            }
 1140|     19|        }
 1141|   252k|    }
 1142|       |
 1143|       |    /* Abs or rel stereo may establish one of two canonical numberings */
 1144|   288k|    if (( pCS->nLenLinearCTStereoCarb > 0 || pCS->nLenLinearCTStereoDble > 0 ) &&
  ------------------
  |  Branch (1144:11): [True: 498, False: 287k]
  |  Branch (1144:46): [True: 299, False: 287k]
  ------------------
 1145|    797|          pCS->nLenCanonOrdStereo > 0 &&
  ------------------
  |  Branch (1145:11): [True: 797, False: 0]
  ------------------
 1146|    797|          ( (pCS->LinearCTStereoCarb && pCS->LinearCTStereoCarbInv) ||
  ------------------
  |  Branch (1146:14): [True: 501, False: 296]
  |  Branch (1146:41): [True: 501, False: 0]
  ------------------
 1147|    296|              (pCS->LinearCTStereoDble && pCS->LinearCTStereoDbleInv) ) &&
  ------------------
  |  Branch (1147:16): [True: 296, False: 0]
  |  Branch (1147:43): [True: 296, False: 0]
  ------------------
 1148|    797|          pCS->nCanonOrdStereo && pCS->nCanonOrdStereoInv
  ------------------
  |  Branch (1148:11): [True: 797, False: 0]
  |  Branch (1148:35): [True: 797, False: 0]
  ------------------
 1149|   288k|       ) /* djb-rwth: addressing LLVM warning */
 1150|    797|    {
 1151|    797|        pCanonRank = pCanonRankAtoms;
 1152|    797|        pCanonOrd = pCS->nCanonOrdStereo;
 1153|    797|        pCanonRankInv = pSortOrd;
 1154|    797|        pCanonOrdInv = pCS->nCanonOrdStereoInv;
 1155|    797|        Stereo = pINChI->Stereo;
 1156|       |
 1157|  5.66k|        for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (1157:21): [True: 4.86k, False: 797]
  ------------------
 1158|  4.86k|        {
 1159|  4.86k|            pCanonRankInv[pCanonOrdInv[i]] =
 1160|  4.86k|                pCanonRank[pCanonOrd[i]] = (AT_NUMB) ( i + 1 );
 1161|  4.86k|        }
 1162|       |
 1163|       |        /********************************************************************/
 1164|       |        /* Copy stereo bonds and stereo centers; compare Inv and Abs stereo */
 1165|       |        /********************************************************************/
 1166|       |
 1167|    797|        nErrorCode = CopyLinearCTStereoToINChIStereo( Stereo,
 1168|    797|                                                      pCS->LinearCTStereoCarb,
 1169|    797|                                                      pCS->nLenLinearCTStereoCarb,
 1170|    797|                                                      pCS->LinearCTStereoDble,
 1171|    797|                                                      pCS->nLenLinearCTStereoDble,
 1172|    797|                                                      pCanonOrd, pCanonRank,
 1173|    797|                                                      at, 0 /* non-isotopic */,
 1174|    797|                                                      pCS->LinearCTStereoCarbInv,
 1175|    797|                                                      pCS->LinearCTStereoDbleInv,
 1176|    797|                                                      pCanonOrdInv, pCanonRankInv );
 1177|       |
 1178|       |        /* djb-rwth: fixing oss-fuzz issue #68271 */
 1179|    797|        if (nErrorCode == 1)
  ------------------
  |  Branch (1179:13): [True: 0, False: 797]
  ------------------
 1180|      0|        {
 1181|      0|            nErrorCode = 0;
 1182|      0|            ret = CT_OUT_OF_RAM;  /*   <BRKPT> */
  ------------------
  |  |   21|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1183|      0|            pINChI->nErrorCode = pINChI_Aux->nErrorCode = CT_OUT_OF_RAM;
  ------------------
  |  |   21|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1184|      0|            goto exit_function;
 1185|      0|        }
 1186|       |
 1187|    797|        if (Stereo->t_parityInv && Stereo->nNumberInv)
  ------------------
  |  Branch (1187:13): [True: 797, False: 0]
  |  Branch (1187:36): [True: 797, False: 0]
  ------------------
 1188|    797|        {
 1189|    797|            if (nUserMode & REQ_MODE_RELATIVE_STEREO)
  ------------------
  |  |   26|    797|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
  |  Branch (1189:17): [True: 34, False: 763]
  ------------------
 1190|     34|            {
 1191|     34|                pINChI->nFlags |= INCHI_FLAG_REL_STEREO;
  ------------------
  |  |  121|     34|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
 1192|     34|            }
 1193|    797|            if (nUserMode & REQ_MODE_RACEMIC_STEREO)
  ------------------
  |  |   28|    797|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  |  Branch (1193:17): [True: 27, False: 770]
  ------------------
 1194|     27|            {
 1195|     27|                pINChI->nFlags |= INCHI_FLAG_RAC_STEREO;
  ------------------
  |  |  122|     27|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
 1196|     27|            }
 1197|    797|            if (Stereo->nCompInv2Abs)
  ------------------
  |  Branch (1197:17): [True: 180, False: 617]
  ------------------
 1198|    180|            {
 1199|    180|                if (Stereo->nCompInv2Abs == -1)
  ------------------
  |  Branch (1199:21): [True: 94, False: 86]
  ------------------
 1200|     94|                {
 1201|       |                    /* switch pointers in Stereo so that the stereo becomes the smallest (relative)  */
 1202|       |                    /* flag Stereo->nCompInv2Abs == -1 will keep track of this exchange */
 1203|     94|                    AT_NUMB    *nNumberInv = Stereo->nNumberInv;
 1204|     94|                    S_CHAR     *t_parityInv = Stereo->t_parityInv;
 1205|     94|                    Stereo->nNumberInv = Stereo->nNumber;
 1206|     94|                    Stereo->t_parityInv = Stereo->t_parity;
 1207|     94|                    Stereo->nNumber = nNumberInv;
 1208|     94|                    Stereo->t_parity = t_parityInv;
 1209|       |                    /* switch pointers to set rel. stereo to pINChI_Aux->nOrigAtNosInCanonOrd
 1210|       |                                       and inv. stereo to pINChI_Aux->nOrigAtNosInCanonOrdInv */
 1211|     94|                    switch_ptrs( &pCanonRank, &pCanonRankInv );
 1212|     94|                    switch_ptrs( &pCanonOrd, &pCanonOrdInv );
 1213|     94|                    bUseNumberingInv = 1; /* use inverted stereo numbering instead of normal */
 1214|     94|                }
 1215|    180|            }
 1216|    797|        }
 1217|       |
 1218|    797|        LOG_NO_ARGS("************************** Canonical Ordering with Stereo (L1183:ichimak2.c) ***************************\n");
 1219|  5.61k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1219:21): [True: 4.82k, False: 797]
  ------------------
 1220|  4.82k|        {
 1221|  4.82k|            pINChI_Aux->nOrigAtNosInCanonOrdInv[i] = at[pCanonOrdInv[i]].orig_at_number;
 1222|  4.82k|            pINChI_Aux->nOrigAtNosInCanonOrd[i] = at[pCanonOrd[i]].orig_at_number;
 1223|  4.82k|            LOG_MULT_ARGS("Atom Nr: %d, Canonical Numbering Normal: %d, Element Name: %s\n", i + 1, at[pCanonOrd[i]].orig_at_number, at[i].elname);
 1224|  4.82k|        }
 1225|       |
 1226|    797|        LOG_NO_ARGS("\n******************************************************************************************************\n");
 1227|       |
 1228|    797|        if (bUseNumberingInv)
  ------------------
  |  Branch (1228:13): [True: 94, False: 703]
  ------------------
 1229|     94|        {
 1230|       |            /* switch ptrs back to avoid confusion */
 1231|     94|            switch_ptrs( &pCanonRank, &pCanonRankInv );
 1232|     94|            switch_ptrs( &pCanonOrd, &pCanonOrdInv );
 1233|       |            /* save inverted stereo ranks & order because it represents the smallest (relative) */
 1234|     94|            memcpy(pCanonRank, pCanonRankInv, num_at_tg * sizeof(pCanonRank[0]));
 1235|       |            /* change pCS->nCanonOrdStereo[] to inverted: */
 1236|     94|            memcpy(pCanonOrd, pCanonOrdInv, num_at_tg * sizeof(pCanonOrd[0]));
 1237|     94|        }
 1238|       |
 1239|    797|        pCanonRankInv = NULL;
 1240|    797|        pCanonOrdInv = NULL;
 1241|    797|        pOrigNosInCanonOrd = NULL;
 1242|    797|    }
 1243|   287k|    else
 1244|   287k|    {
 1245|       |        /*------------------------------ no stereo */
 1246|   287k|        pCanonOrd = pCS->nLenCanonOrdStereo > 0 ? pCS->nCanonOrdStereo
  ------------------
  |  Branch (1246:21): [True: 98, False: 287k]
  ------------------
 1247|   287k|                                                : pCS->nLenCanonOrd > 0  ? pCS->nCanonOrd
  ------------------
  |  Branch (1247:51): [True: 287k, False: 0]
  ------------------
 1248|   287k|                                                                         : NULL;
 1249|   287k|        pCanonRank = pCanonRankAtoms;
 1250|   287k|        pOrigNosInCanonOrd = pINChI_Aux->nOrigAtNosInCanonOrd;
 1251|       |
 1252|   287k|        if (pCanonOrd && pCanonRank)
  ------------------
  |  Branch (1252:13): [True: 287k, False: 0]
  |  Branch (1252:26): [True: 287k, False: 0]
  ------------------
 1253|   287k|        {
 1254|  1.37M|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1254:25): [True: 1.08M, False: 287k]
  ------------------
 1255|  1.08M|            {
 1256|  1.08M|                pCanonRank[pCanonOrd[i]] = (AT_NUMB) ( i + 1 );
 1257|  1.08M|                pOrigNosInCanonOrd[i] = at[pCanonOrd[i]].orig_at_number;
 1258|  1.08M|            }
 1259|   291k|            for (; i < num_at_tg; i++)
  ------------------
  |  Branch (1259:20): [True: 3.52k, False: 287k]
  ------------------
 1260|  3.52k|            {
 1261|  3.52k|                pCanonRank[pCanonOrd[i]] = (AT_NUMB) ( i + 1 );
 1262|  3.52k|            }
 1263|   287k|        }
 1264|   287k|    }
 1265|       |    /*pCanonOrdNonIso = pCanonOrd;*/  /* save for aux info */
 1266|       |
 1267|       |
 1268|   288k|    if (pINChI_Aux->OrigInfo)
  ------------------
  |  Branch (1268:9): [True: 288k, False: 0]
  ------------------
 1269|   288k|    {
 1270|       |        /* charges, radicals, valences */
 1271|  1.38M|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1271:21): [True: 1.09M, False: 288k]
  ------------------
 1272|  1.09M|        {
 1273|  1.09M|            if (pCanonOrd) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (1273:17): [True: 1.09M, False: 0]
  ------------------
 1274|  1.09M|            {
 1275|  1.09M|                ii = pCanonOrd[i]; 
 1276|  1.09M|                if (norm_at[ii].valence || norm_at[ii].num_H)
  ------------------
  |  Branch (1276:21): [True: 261k, False: 831k]
  |  Branch (1276:44): [True: 1.84k, False: 829k]
  ------------------
 1277|   263k|                {
 1278|   263k|                    pINChI_Aux->OrigInfo[i].cCharge = norm_at[ii].charge;
 1279|       |
 1280|   263k|                    pINChI_Aux->OrigInfo[i].cRadical = (norm_at[ii].radical == RADICAL_SINGLET) ? 0 :
  ------------------
  |  |   75|   263k|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (1280:56): [True: 0, False: 263k]
  ------------------
 1281|   263k|                        (norm_at[ii].radical == RADICAL_DOUBLET) ? 1 :
  ------------------
  |  |   76|   263k|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (1281:25): [True: 17.6k, False: 245k]
  ------------------
 1282|   263k|                        (norm_at[ii].radical == RADICAL_TRIPLET) ? 2 :
  ------------------
  |  |   77|   245k|#define RADICAL_TRIPLET 3
  ------------------
  |  Branch (1282:25): [True: 5.78k, False: 240k]
  ------------------
 1283|   245k|                        norm_at[ii].radical ? 3 : 0;
  ------------------
  |  Branch (1283:25): [True: 668, False: 239k]
  ------------------
 1284|       |
 1285|   263k|                    pINChI_Aux->OrigInfo[i].cUnusualValence =
 1286|   263k|                        get_unusual_el_valence(norm_at[ii].el_number, norm_at[ii].charge, norm_at[ii].radical,
 1287|   263k|                            norm_at[ii].chem_bonds_valence, norm_at[ii].num_H, norm_at[ii].valence);
 1288|   263k|                }
 1289|   829k|                else
 1290|   829k|                {
 1291|       |                    /* charge of a single atom component is in the INChI; valence = 0 is standard */
 1292|   829k|                    pINChI_Aux->OrigInfo[i].cRadical = (norm_at[ii].radical == RADICAL_SINGLET) ? 0 :
  ------------------
  |  |   75|   829k|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (1292:56): [True: 0, False: 829k]
  ------------------
 1293|   829k|                        (norm_at[ii].radical == RADICAL_DOUBLET) ? 1 :
  ------------------
  |  |   76|   829k|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (1293:25): [True: 0, False: 829k]
  ------------------
 1294|   829k|                        (norm_at[ii].radical == RADICAL_TRIPLET) ? 2 :
  ------------------
  |  |   77|   829k|#define RADICAL_TRIPLET 3
  ------------------
  |  Branch (1294:25): [True: 0, False: 829k]
  ------------------
 1295|   829k|                        norm_at[ii].radical ? 3 : 0;
  ------------------
  |  Branch (1295:25): [True: 0, False: 829k]
  ------------------
 1296|   829k|                }
 1297|  1.09M|            }
 1298|  1.09M|        }
 1299|   288k|    }
 1300|       |
 1301|       |    /* Non-isotopic canonical numbers and equivalence of atoms (Aux) */
 1302|   288k|    pConstitEquNumb = pINChI_Aux->nConstitEquNumbers;  /*  contitutional equivalence */
 1303|   288k|    pSymmRank = pCS->nSymmRank;
 1304|       |
 1305|   288k|    if (pCanonOrd && pCanonRank && pSymmRank && pConstitEquNumb)
  ------------------
  |  Branch (1305:9): [True: 288k, False: 0]
  |  Branch (1305:22): [True: 288k, False: 0]
  |  Branch (1305:36): [True: 288k, False: 0]
  |  Branch (1305:49): [True: 288k, False: 0]
  ------------------
 1306|   288k|    {
 1307|  1.38M|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1307:21): [True: 1.09M, False: 288k]
  ------------------
 1308|  1.09M|        {
 1309|  1.09M|            pConstitEquNumb[i] = pSymmRank[pCanonOrd[i]]; /*  constit. equ. ranks in order of canonical numbers */
 1310|  1.09M|            pSortOrd[i] = i;
 1311|  1.09M|        }
 1312|   292k|        for (; i < num_at_tg; i++)
  ------------------
  |  Branch (1312:16): [True: 3.56k, False: 288k]
  ------------------
 1313|  3.56k|        {
 1314|  3.56k|            pSortOrd[i] = MAX_ATOMS; /* for debugging only */
  ------------------
  |  |   15|  3.56k|#define MAX_ATOMS  32766
  ------------------
 1315|  3.56k|        }
 1316|       |
 1317|   288k|        pCG->m_pn_RankForSort = pConstitEquNumb;
 1318|   288k|        inchi_qsort( pCG, pSortOrd, num_atoms, sizeof( pSortOrd[0] ), CompRanksOrd );
 1319|       |
 1320|  1.38M|        for (i = 0, nMinOrd = pSortOrd[0], j = 1; j <= num_atoms; j++)
  ------------------
  |  Branch (1320:51): [True: 1.09M, False: 288k]
  ------------------
 1321|  1.09M|        {
 1322|  1.09M|            if (j == num_atoms || pConstitEquNumb[pSortOrd[i]] != pConstitEquNumb[pSortOrd[j]])
  ------------------
  |  Branch (1322:17): [True: 288k, False: 805k]
  |  Branch (1322:35): [True: 437k, False: 367k]
  ------------------
 1323|   726k|            {
 1324|   726k|                nMinOrd++;
 1325|   726k|                if (j - i > 1)
  ------------------
  |  Branch (1325:21): [True: 171k, False: 554k]
  ------------------
 1326|   171k|                {
 1327|       |                    /*  found a sequence of equivalent atoms: i..j-1 */
 1328|   710k|                    while (i < j)
  ------------------
  |  Branch (1328:28): [True: 538k, False: 171k]
  ------------------
 1329|   538k|                    {
 1330|   538k|                        pConstitEquNumb[pSortOrd[i++]] = nMinOrd; /*  = min. canon. rank in the group of equ. atoms */
 1331|   538k|                    }
 1332|       |                    /*  at this point j == i */
 1333|   171k|                }
 1334|   554k|                else
 1335|   554k|                {
 1336|   554k|                    pConstitEquNumb[pSortOrd[i++]] = 0; /*  means the atom is not equivalent to any other */
 1337|   554k|                }
 1338|   726k|                nMinOrd = pSortOrd[j]; /*  at the end j = num_atoms */
 1339|   726k|            }
 1340|  1.09M|        }
 1341|   288k|    }
 1342|       |
 1343|      0|    else
 1344|      0|    {
 1345|      0|        nErrorCode |= ERR_NO_CANON_RESULTS;
  ------------------
  |  |   51|      0|#define ERR_NO_CANON_RESULTS        0x0008
  ------------------
 1346|      0|        ret = -1;  /*  program error; no breakpoint here */
 1347|      0|        goto exit_function;
 1348|      0|    }
 1349|       |
 1350|       |
 1351|       |    /*  Atomic numbers from the Periodic Table */
 1352|  1.38M|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1352:17): [True: 1.09M, False: 288k]
  ------------------
 1353|  1.09M|    {
 1354|  1.09M|        pINChI->nAtom[i] = (int) at[pCanonOrd[i]].el_number;
 1355|  1.09M|    }
 1356|       |
 1357|       |
 1358|       |    /*  Connection table: atoms only (before 7-29-2003 pCS->LinearCT2 contained non-isotopic CT) */
 1359|   288k|    if (pCS->nLenLinearCTAtOnly <= 0 || !pCS->LinearCT || !pINChI->nConnTable)
  ------------------
  |  Branch (1359:9): [True: 0, False: 288k]
  |  Branch (1359:41): [True: 0, False: 288k]
  |  Branch (1359:59): [True: 0, False: 288k]
  ------------------
 1360|      0|    {
 1361|      0|        nErrorCode |= ERR_NO_CANON_RESULTS;
  ------------------
  |  |   51|      0|#define ERR_NO_CANON_RESULTS        0x0008
  ------------------
 1362|      0|        ret = -2;
 1363|      0|        goto exit_function;
 1364|      0|    }
 1365|       |
 1366|   288k|    memcpy(pINChI->nConnTable, pCS->LinearCT, sizeof(pINChI->nConnTable[0]) * pCS->nLenLinearCTAtOnly);
 1367|       |
 1368|   288k|    pINChI->lenConnTable = pCS->nLenLinearCTAtOnly;
 1369|       |
 1370|       |    /*  Tautomeric group(s) canonical representation */
 1371|   288k|    len = 0;
 1372|   288k|    if (bTautomeric && 0 < ( n = SortTautomerGroupsAndEndpoints(
  ------------------
  |  Branch (1372:9): [True: 252k, False: 36.3k]
  |  Branch (1372:24): [True: 3.46k, False: 248k]
  ------------------
 1373|   252k|        pCG, t_group_info,
 1374|   252k|        num_atoms, num_at_tg, pCanonRank ) ))
 1375|  3.46k|    {
 1376|       |        /* SortTautomerGroupsAndEndpoints() produces canonically ordered t-groups */
 1377|  3.46k|        pINChI->nFlags |=
 1378|  3.46k|            ( t_group_info->bTautFlagsDone & TG_FLAG_ALL_SALT_DONE ) ? INCHI_FLAG_ACID_TAUT
  ------------------
  |  |  971|  3.46k|#define TG_FLAG_ALL_SALT_DONE          (TG_FLAG_TEST_TAUT__SALTS_DONE | \
  |  |  ------------------
  |  |  |  |  965|  3.46k|#define TG_FLAG_TEST_TAUT__SALTS_DONE    0x00000008   /* multiple H tautomerism */
  |  |  ------------------
  |  |  972|  3.46k|                                        TG_FLAG_TEST_TAUT2_SALTS_DONE | \
  |  |  ------------------
  |  |  |  |  967|  3.46k|#define TG_FLAG_TEST_TAUT2_SALTS_DONE    0x00000020   /* merged t-groups */
  |  |  ------------------
  |  |  973|  3.46k|                                        TG_FLAG_MERGE_TAUT_SALTS_DONE )
  |  |  ------------------
  |  |  |  |  969|  3.46k|#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
  ------------------
  |  |  120|    322|#define INCHI_FLAG_ACID_TAUT            0x0001   /* tautomerism of dissociated acid invoked */
  ------------------
  |  Branch (1378:13): [True: 322, False: 3.14k]
  ------------------
 1379|  3.46k|            : 0;
 1380|       |
 1381|       |        /*  number of tautomeric groups */
 1382|  3.46k|        pINChI->nTautomer[len++] = (AT_NUMB) n;
 1383|       |
 1384|       |        /* store each tautomeric group, one by one */
 1385|  7.03k|        for (i = 0; i < n; i++)
  ------------------
  |  Branch (1385:21): [True: 3.56k, False: 3.46k]
  ------------------
 1386|  3.56k|        {
 1387|  3.56k|            g = (int) t_group_info->tGroupNumber[i]; /* original group numbers in sorted order */
 1388|  3.56k|            t_group = t_group_info->t_group + g;    /* pointer to the tautomeric group */
 1389|       |
 1390|       |            /*  NumAt+INCHI_T_NUM_MOVABLE (group length excluding this number) */
 1391|       |
 1392|  3.56k|            pINChI->nTautomer[len++] = t_group->nNumEndpoints + INCHI_T_NUM_MOVABLE;
  ------------------
  |  |  749|  3.56k|#define INCHI_T_NUM_MOVABLE  2
  ------------------
 1393|       |
 1394|       |            /*  Num(H), Num(-) */
 1395|       |
 1396|  10.7k|            for (j = 0; j < INCHI_T_NUM_MOVABLE; j++) /* djb-rwth: redundant condition; && j < T_NUM_NO_ISOTOPIC part should be checked; can INCHI_T_NUM_MOVABLE and T_NUM_NO_ISOTOPIC change values from 2? */
  ------------------
  |  |  749|  10.7k|#define INCHI_T_NUM_MOVABLE  2
  ------------------
  |  Branch (1396:25): [True: 7.13k, False: 3.56k]
  ------------------
 1397|  7.13k|            {
 1398|  7.13k|                pINChI->nTautomer[len++] = t_group->num[j];
 1399|  7.13k|            }
 1400|       |            
 1401|       |            
 1402|       |            /* djb-rwth: erroneous loop execution condition
 1403|       |            
 1404|       |            for (j = T_NUM_NO_ISOTOPIC; j < INCHI_T_NUM_MOVABLE; j++)
 1405|       |            {
 1406|       |                pINChI->nTautomer[len++] = 0; // should not happen 
 1407|       |            }
 1408|       |            
 1409|       |            */
 1410|       |
 1411|       |            /* tautomeric group endpoint canonical numbers, pre-sorted in ascending order */
 1412|       |
 1413|  3.56k|            for (j = (int) t_group->nFirstEndpointAtNoPos,
 1414|  12.1k|                  m = j + (int) t_group->nNumEndpoints; j < m; j++)
  ------------------
  |  Branch (1414:57): [True: 8.58k, False: 3.56k]
  ------------------
 1415|  8.58k|            {
 1416|  8.58k|                pINChI->nTautomer[len++] = pCanonRank[(int) t_group_info->nEndpointAtomNumber[j]]; /*  At[j] */
 1417|  8.58k|            }
 1418|  3.56k|        }
 1419|       |
 1420|  3.46k|        pINChI->lenTautomer = len;
 1421|  3.46k|        pINChI_Aux->nNumberOfTGroups = n;
 1422|  3.46k|    }
 1423|   284k|    else
 1424|   284k|    {
 1425|   284k|        pINChI->lenTautomer = 0;
 1426|   284k|        pINChI_Aux->nNumberOfTGroups = 0;
 1427|       |
 1428|   284k|        if (t_group_info && ( ( t_group_info->tni.bNormalizationFlags & FLAG_NORM_CONSIDER_TAUT ) ||
  ------------------
  |  |  156|   248k|#define FLAG_NORM_CONSIDER_TAUT      ( FLAG_PROTON_NPO_SIMPLE_REMOVED | \
  |  |  ------------------
  |  |  |  |  146|   248k|#define FLAG_PROTON_NPO_SIMPLE_REMOVED 0x0001
  |  |  ------------------
  |  |  157|   248k|                                       FLAG_PROTON_NP_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  147|   248k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  158|   248k|                                       FLAG_PROTON_AC_SIMPLE_ADDED    | \
  |  |  ------------------
  |  |  |  |  148|   248k|#define FLAG_PROTON_AC_SIMPLE_ADDED    0x0004
  |  |  ------------------
  |  |  159|   248k|                                       FLAG_PROTON_AC_SIMPLE_REMOVED  | \
  |  |  ------------------
  |  |  |  |  149|   248k|#define FLAG_PROTON_AC_SIMPLE_REMOVED  0x0008
  |  |  ------------------
  |  |  160|   248k|                                       FLAG_PROTON_AC_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  150|   248k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  161|   248k|                                       FLAG_PROTON_AC_HARD_ADDED      | \
  |  |  ------------------
  |  |  |  |  151|   248k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  |  |  162|   248k|                                       FLAG_PROTON_SINGLE_REMOVED     | \
  |  |  ------------------
  |  |  |  |  153|   248k|#define FLAG_PROTON_SINGLE_REMOVED     0x0080
  |  |  ------------------
  |  |  163|   248k|                                       FLAG_PROTON_CHARGE_CANCEL    )
  |  |  ------------------
  |  |  |  |  152|   248k|#define FLAG_PROTON_CHARGE_CANCEL      0x0040
  |  |  ------------------
  ------------------
  |  Branch (1428:13): [True: 248k, False: 36.3k]
  |  Branch (1428:31): [True: 37.2k, False: 211k]
  ------------------
 1429|   211k|            (t_group_info->nNumIsotopicEndpoints > 1 &&
  ------------------
  |  Branch (1429:14): [True: 122, False: 211k]
  ------------------
 1430|    122|            ( t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE ) )) )
  ------------------
  |  |  981|    122|#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 ) )) )
  ------------------
  |  |  982|    122|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  |  Branch (1430:13): [True: 122, False: 0]
  ------------------
 1431|   284k|           ) /* djb-rwth: addressing LLVM warning */
 1432|  37.4k|        {
 1433|       |            /* only protons (re)moved or added */
 1434|  37.4k|            pINChI->lenTautomer = 1;
 1435|  37.4k|            pINChI->nTautomer[0] = 0;
 1436|  37.4k|        }
 1437|   284k|    }
 1438|       |
 1439|       |    /*  Number of H (excluding tautomeric) */
 1440|   288k|    if (pCS->nNum_H)
  ------------------
  |  Branch (1440:9): [True: 288k, False: 0]
  ------------------
 1441|   288k|    {
 1442|  1.38M|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1442:21): [True: 1.09M, False: 288k]
  ------------------
 1443|  1.09M|        {
 1444|  1.09M|            pINChI->nNum_H[i] = pCS->nNum_H[i];
 1445|  1.09M|        }
 1446|   288k|    }
 1447|       |
 1448|       |
 1449|       |    /*  Number of fixed H (tautomeric H in non-tautomeric representation) */
 1450|   288k|    if (pCS->nNum_H_fixed && !pINChI->lenTautomer)
  ------------------
  |  Branch (1450:9): [True: 288k, False: 0]
  |  Branch (1450:30): [True: 247k, False: 40.8k]
  ------------------
 1451|   247k|    {
 1452|  1.26M|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1452:21): [True: 1.01M, False: 247k]
  ------------------
 1453|  1.01M|        {
 1454|  1.01M|            pINChI->nNum_H_fixed[i] = pCS->nNum_H_fixed[i];
 1455|  1.01M|            pINChI->nNum_H[i] += pCS->nNum_H_fixed[i];
 1456|  1.01M|        }
 1457|   247k|    }
 1458|       |
 1459|       |
 1460|       |    /***********************************************************
 1461|       |     *  Tautomeric group(s) numbering and symmetry;
 1462|       |     *  should not depend on switching to rel. stereo numbering
 1463|       |     */
 1464|   288k|    if (pINChI->lenTautomer && ( n = pINChI_Aux->nNumberOfTGroups ))
  ------------------
  |  Branch (1464:9): [True: 40.8k, False: 247k]
  |  Branch (1464:32): [True: 3.46k, False: 37.4k]
  ------------------
 1465|  3.46k|    {
 1466|  3.46k|        pCanonOrdTaut = pCS->nLenCanonOrdStereoTaut > 0 ? pCS->nCanonOrdStereoTaut :
  ------------------
  |  Branch (1466:25): [True: 35, False: 3.43k]
  ------------------
 1467|  3.46k|            pCS->nLenCanonOrdTaut > 0 ? pCS->nCanonOrdTaut : NULL;
  ------------------
  |  Branch (1467:13): [True: 3.43k, False: 0]
  ------------------
 1468|  3.46k|        pConstitEquNumb = pINChI_Aux->nConstitEquTGroupNumbers;
 1469|  3.46k|        pSymmRank = pCS->nSymmRankTaut;
 1470|       |
 1471|  3.46k|        if (pCanonOrdTaut && pSymmRank && pConstitEquNumb)
  ------------------
  |  Branch (1471:13): [True: 3.46k, False: 0]
  |  Branch (1471:30): [True: 3.46k, False: 0]
  |  Branch (1471:43): [True: 3.46k, False: 0]
  ------------------
 1472|  3.46k|        {
 1473|  7.03k|            for (i = 0; i < n; i++)
  ------------------
  |  Branch (1473:25): [True: 3.56k, False: 3.46k]
  ------------------
 1474|  3.56k|            {
 1475|  3.56k|                pConstitEquNumb[i] = pSymmRank[pCanonOrdTaut[i]];
 1476|  3.56k|                pSortOrd[i] = i;
 1477|  3.56k|            }
 1478|  3.46k|            pCG->m_pn_RankForSort = pConstitEquNumb;
 1479|  3.46k|            inchi_qsort( pCG, pSortOrd, n, sizeof( pSortOrd[0] ), CompRanksOrd );
 1480|  7.03k|            for (i = 0, nMinOrd = pSortOrd[0], j = 1; j <= n; j++)
  ------------------
  |  Branch (1480:55): [True: 3.56k, False: 3.46k]
  ------------------
 1481|  3.56k|            {
 1482|  3.56k|                if (j == n || pConstitEquNumb[pSortOrd[i]] != pConstitEquNumb[pSortOrd[j]])
  ------------------
  |  Branch (1482:21): [True: 3.46k, False: 101]
  |  Branch (1482:31): [True: 100, False: 1]
  ------------------
 1483|  3.56k|                {
 1484|  3.56k|                    nMinOrd++; /* make is start from 1, not from zero */
 1485|  3.56k|                    if (j - i > 1)
  ------------------
  |  Branch (1485:25): [True: 1, False: 3.56k]
  ------------------
 1486|      1|                    {
 1487|       |                        /*  found a sequence of more than one equivalent t-groups: i..j-1 */
 1488|      3|                        while (i < j)
  ------------------
  |  Branch (1488:32): [True: 2, False: 1]
  ------------------
 1489|      2|                        {
 1490|      2|                            pConstitEquNumb[pSortOrd[i++]] = nMinOrd;
 1491|      2|                        }
 1492|      1|                    }
 1493|  3.56k|                    else
 1494|  3.56k|                    {
 1495|  3.56k|                        pConstitEquNumb[pSortOrd[i++]] = 0;
 1496|  3.56k|                    }
 1497|  3.56k|                    nMinOrd = pSortOrd[j]; /*  at the end j == n */
 1498|  3.56k|                }
 1499|  3.56k|            }
 1500|  3.46k|        }
 1501|  3.46k|    }
 1502|       |
 1503|       |
 1504|       |    /*  Allocate and fill Hill formula */
 1505|       |
 1506|   288k|    pINChI->szHillFormula = AllocateAndFillHillFormula( pINChI );
 1507|       |
 1508|   288k|    if (!pINChI->szHillFormula)
  ------------------
  |  Branch (1508:9): [True: 14, False: 288k]
  ------------------
 1509|     14|    {
 1510|     14|        nErrorCode = 0;
 1511|     14|        ret = CT_WRONG_FORMULA; /* CT_OUT_OF_RAM;*/  /*   <BRKPT> */
  ------------------
  |  |   37|     14|#define CT_WRONG_FORMULA     (CT_ERR_FIRST-18)  /*(-30017) */
  |  |  ------------------
  |  |  |  |   18|     14|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1512|     14|        pINChI->nErrorCode = pINChI_Aux->nErrorCode = ret;
 1513|     14|        goto exit_function;
 1514|     14|    }
 1515|       |
 1516|   288k|    nStereoUnmarkMode = UnmarkAllUndefinedUnknownStereo( pINChI->Stereo, nUserMode );
 1517|       |
 1518|   288k|    if (nStereoUnmarkMode)
  ------------------
  |  Branch (1518:9): [True: 186, False: 288k]
  ------------------
 1519|    186|    {
 1520|    186|        pINChI->nFlags |=
 1521|    186|            ( nStereoUnmarkMode & REQ_MODE_SC_IGN_ALL_UU ) ? INCHI_FLAG_SC_IGN_ALL_UU
  ------------------
  |  |   30|    186|#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
  ------------------
  |  |  123|    130|#define INCHI_FLAG_SC_IGN_ALL_UU        0x0008   /* ignored all undefined/unknown stereocenters, non-isotopic */
  ------------------
  |  Branch (1521:13): [True: 130, False: 56]
  ------------------
 1522|    186|            : 0;
 1523|    186|        pINChI->nFlags |=
 1524|    186|            ( nStereoUnmarkMode & REQ_MODE_SB_IGN_ALL_UU ) ? INCHI_FLAG_SB_IGN_ALL_UU
  ------------------
  |  |   32|    186|#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
  ------------------
  |  |  124|     56|#define INCHI_FLAG_SB_IGN_ALL_UU        0x0010   /* ignored all undefined/unknown stereocenters, non-isotopic */
  ------------------
  |  Branch (1524:13): [True: 56, False: 130]
  ------------------
 1525|    186|            : 0;
 1526|       |
 1527|    186|        if (( nStereoUnmarkMode & REQ_MODE_SC_IGN_ALL_UU ) ||
  ------------------
  |  |   30|    186|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  |  Branch (1527:13): [True: 130, False: 56]
  ------------------
 1528|     56|            ( nStereoUnmarkMode & REQ_MODE_SB_IGN_ALL_UU ))
  ------------------
  |  |   32|     56|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
  |  Branch (1528:13): [True: 56, False: 0]
  ------------------
 1529|    186|        {
 1530|    186|            if (!bNoWarnings)
  ------------------
  |  Branch (1530:17): [True: 186, False: 0]
  ------------------
 1531|    186|            {
 1532|    186|                WarningMessage( pStrErrStruct, "Omitted undefined stereo" );
  ------------------
  |  |  132|    186|#define WarningMessage AddErrorMessage
  ------------------
 1533|    186|            }
 1534|    186|        }
 1535|    186|    }
 1536|       |
 1537|       |    /*************************/
 1538|       |    /* Mark ambiguous stereo */
 1539|       |    /*************************/
 1540|       |
 1541|   288k|    MarkAmbiguousStereo( at, norm_at, 0 /* non-isotopic */, pCanonOrd,
 1542|   288k|                         pCS->LinearCTStereoCarb, pCS->nLenLinearCTStereoCarb,
 1543|   288k|                         pCS->LinearCTStereoDble, pCS->nLenLinearCTStereoDble );
 1544|       |
 1545|       |
 1546|       |    /************************************************************************
 1547|       |     *
 1548|       |     *  Isotopic part
 1549|       |     */
 1550|       |
 1551|       |    /* abs or rel stereo may establish one of two canonical numberings */
 1552|       |
 1553|   288k|    if (( pCS->nLenLinearCTIsotopicStereoCarb > 0 || pCS->nLenLinearCTIsotopicStereoDble > 0 ) &&
  ------------------
  |  Branch (1553:11): [True: 182, False: 288k]
  |  Branch (1553:54): [True: 52, False: 288k]
  ------------------
 1554|    234|          pCS->nLenCanonOrdIsotopicStereo > 0 &&
  ------------------
  |  Branch (1554:11): [True: 219, False: 15]
  ------------------
 1555|    219|          ( (pCS->LinearCTIsotopicStereoCarb && pCS->LinearCTIsotopicStereoCarbInv) ||
  ------------------
  |  Branch (1555:14): [True: 167, False: 52]
  |  Branch (1555:49): [True: 167, False: 0]
  ------------------
 1556|     52|              (pCS->LinearCTIsotopicStereoDble && pCS->LinearCTIsotopicStereoDbleInv) ) &&
  ------------------
  |  Branch (1556:16): [True: 52, False: 0]
  |  Branch (1556:51): [True: 52, False: 0]
  ------------------
 1557|    219|          pCS->nCanonOrdIsotopicStereo && pCS->nCanonOrdIsotopicStereoInv
  ------------------
  |  Branch (1557:11): [True: 219, False: 0]
  |  Branch (1557:43): [True: 219, False: 0]
  ------------------
 1558|   288k|          ) /* djb-rwth: addressing LLVM warning */
 1559|    219|    {
 1560|       |        /* found isotopic stereo */
 1561|       |
 1562|    219|        pCanonRank = pCanonRankAtoms;
 1563|    219|        pCanonOrd = pCS->nCanonOrdIsotopicStereo;
 1564|    219|        pCanonRankInv = pSortOrd;
 1565|    219|        pCanonOrdInv = pCS->nCanonOrdIsotopicStereoInv;
 1566|    219|        Stereo = pINChI->StereoIsotopic;
 1567|       |
 1568|  1.63k|        for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (1568:21): [True: 1.41k, False: 219]
  ------------------
 1569|  1.41k|        {
 1570|  1.41k|            pCanonRankInv[pCanonOrdInv[i]] =
 1571|  1.41k|                pCanonRank[pCanonOrd[i]] = (AT_NUMB) ( i + 1 );
 1572|  1.41k|        }
 1573|       |
 1574|       |
 1575|       |        /********************************************************************/
 1576|       |        /* copy stereo bonds and stereo centers; compare Inv and Abs stereo */
 1577|       |        /********************************************************************/
 1578|       |
 1579|    219|        nErrorCode = CopyLinearCTStereoToINChIStereo( Stereo,
 1580|    219|                                                      pCS->LinearCTIsotopicStereoCarb,
 1581|    219|                                                      pCS->nLenLinearCTIsotopicStereoCarb,
 1582|    219|                                                      pCS->LinearCTIsotopicStereoDble,
 1583|    219|                                                      pCS->nLenLinearCTIsotopicStereoDble,
 1584|    219|                                                      pCanonOrd, pCanonRank, at, 1 /* isotopic */,
 1585|    219|                                                      pCS->LinearCTIsotopicStereoCarbInv,
 1586|    219|                                                      pCS->LinearCTIsotopicStereoDbleInv,
 1587|    219|                                                      pCanonOrdInv, pCanonRankInv );
 1588|       |
 1589|       |        /* djb-rwth: fixing oss-fuzz issue #68271 */
 1590|    219|        if (nErrorCode == 1)
  ------------------
  |  Branch (1590:13): [True: 3, False: 216]
  ------------------
 1591|      3|        {
 1592|      3|            nErrorCode = 0;
 1593|      3|            ret = CT_OUT_OF_RAM;  /*   <BRKPT> */
  ------------------
  |  |   21|      3|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      3|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1594|      3|            pINChI->nErrorCode = pINChI_Aux->nErrorCode = CT_OUT_OF_RAM;
  ------------------
  |  |   21|      3|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      3|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1595|      3|            goto exit_function;
 1596|      3|        }
 1597|       |        
 1598|    216|        if (Stereo->t_parityInv && Stereo->nNumberInv)
  ------------------
  |  Branch (1598:13): [True: 216, False: 0]
  |  Branch (1598:36): [True: 216, False: 0]
  ------------------
 1599|    216|        {
 1600|    216|            if (nUserMode & REQ_MODE_RELATIVE_STEREO)
  ------------------
  |  |   26|    216|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
  |  Branch (1600:17): [True: 3, False: 213]
  ------------------
 1601|      3|            {
 1602|      3|                pINChI->nFlags |= INCHI_FLAG_REL_STEREO;
  ------------------
  |  |  121|      3|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
 1603|      3|            }
 1604|       |
 1605|    216|            if (nUserMode & REQ_MODE_RACEMIC_STEREO)
  ------------------
  |  |   28|    216|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  |  Branch (1605:17): [True: 3, False: 213]
  ------------------
 1606|      3|            {
 1607|      3|                pINChI->nFlags |= INCHI_FLAG_RAC_STEREO;
  ------------------
  |  |  122|      3|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
 1608|      3|            }
 1609|       |
 1610|    216|            if (Stereo->nCompInv2Abs)
  ------------------
  |  Branch (1610:17): [True: 65, False: 151]
  ------------------
 1611|     65|            {
 1612|     65|                if (Stereo->nCompInv2Abs == -1)
  ------------------
  |  Branch (1612:21): [True: 50, False: 15]
  ------------------
 1613|     50|                {
 1614|       |                    /* switch pointers so that the stereo becomes the smallest (relative)  */
 1615|       |                    /* flag Stereo->nCompInv2Abs == -1 will keep track of this exchange */
 1616|     50|                    AT_NUMB    *nNumberInv = Stereo->nNumberInv;
 1617|     50|                    S_CHAR     *t_parityInv = Stereo->t_parityInv;
 1618|     50|                    Stereo->nNumberInv = Stereo->nNumber;
 1619|     50|                    Stereo->t_parityInv = Stereo->t_parity;
 1620|     50|                    Stereo->nNumber = nNumberInv;
 1621|     50|                    Stereo->t_parity = t_parityInv;
 1622|     50|                    switch_ptrs( &pCanonRank, &pCanonRankInv );
 1623|     50|                    switch_ptrs( &pCanonOrd, &pCanonOrdInv );
 1624|     50|                    bUseIsotopicNumberingInv = 1;
 1625|     50|                }
 1626|     65|            }
 1627|    216|        }
 1628|       |
 1629|  1.58k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1629:21): [True: 1.37k, False: 216]
  ------------------
 1630|  1.37k|        {
 1631|  1.37k|            pINChI_Aux->nIsotopicOrigAtNosInCanonOrdInv[i] = at[pCanonOrdInv[i]].orig_at_number;
 1632|  1.37k|            pINChI_Aux->nIsotopicOrigAtNosInCanonOrd[i] = at[pCanonOrd[i]].orig_at_number;
 1633|  1.37k|        }
 1634|       |
 1635|    216|        if (bUseIsotopicNumberingInv)
  ------------------
  |  Branch (1635:13): [True: 50, False: 166]
  ------------------
 1636|     50|        {
 1637|     50|            switch_ptrs( &pCanonRank, &pCanonRankInv );
 1638|     50|            switch_ptrs( &pCanonOrd, &pCanonOrdInv );
 1639|     50|            memcpy(pCanonRank, pCanonRankInv, num_at_tg * sizeof(pCanonRank[0]));
 1640|     50|            memcpy(pCanonOrd, pCanonOrdInv, num_at_tg * sizeof(pCanonOrd[0]));
 1641|     50|        }
 1642|       |
 1643|    216|        pCanonRankInv = NULL;
 1644|    216|        pCanonOrdInv = NULL;
 1645|    216|        pOrigNosInCanonOrd = NULL;
 1646|    216|    }
 1647|   288k|    else
 1648|   288k|    {
 1649|       |        /* no isotopic stereo */
 1650|       |
 1651|   288k|        pCanonOrd = pCS->nLenCanonOrdIsotopicStereo > 0 ? pCS->nCanonOrdIsotopicStereo
  ------------------
  |  Branch (1651:21): [True: 11, False: 288k]
  ------------------
 1652|   288k|            : pCS->nLenCanonOrdIsotopic > 0 ? pCS->nCanonOrdIsotopic
  ------------------
  |  Branch (1652:15): [True: 1.88k, False: 286k]
  ------------------
 1653|   288k|            : NULL;
 1654|   288k|        pCanonRank = pCanonRankAtoms;
 1655|   288k|        pOrigNosInCanonOrd = pINChI_Aux->nIsotopicOrigAtNosInCanonOrd;
 1656|       |
 1657|       |        /* djb-rwth: fixing oss-fuzz issue #30496 */
 1658|   288k|        if (pCanonOrd && pCanonRank && pOrigNosInCanonOrd)
  ------------------
  |  Branch (1658:13): [True: 1.90k, False: 286k]
  |  Branch (1658:26): [True: 1.90k, False: 0]
  |  Branch (1658:40): [True: 1.88k, False: 16]
  ------------------
 1659|  1.88k|        {
 1660|  12.8k|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1660:25): [True: 10.9k, False: 1.88k]
  ------------------
 1661|  10.9k|            {
 1662|       |                /* Fix13 -- out of bounds */
 1663|  10.9k|                pCanonRank[pCanonOrd[i]] = (AT_NUMB) ( i + 1 );
 1664|  10.9k|                pOrigNosInCanonOrd[i] = at[pCanonOrd[i]].orig_at_number;
 1665|  10.9k|            }
 1666|  1.96k|            for (; i < num_at_tg; i++)
  ------------------
  |  Branch (1666:20): [True: 76, False: 1.88k]
  ------------------
 1667|     76|            {
 1668|       |                /* Fix13 -- out of bounds */
 1669|     76|                pCanonRank[pCanonOrd[i]] = (AT_NUMB) ( i + 1 );
 1670|     76|            }
 1671|  1.88k|        }
 1672|   288k|    }
 1673|       |    /*pCanonOrdIso = pCanonOrd;*/
 1674|       |
 1675|       |
 1676|   288k|    pConstitEquNumb = pINChI_Aux->nConstitEquIsotopicNumbers;
 1677|   288k|    pSymmRank = pCS->nSymmRankIsotopic;
 1678|       |
 1679|   288k|    if (pCanonOrd && pCanonRank && pConstitEquNumb && pSymmRank)
  ------------------
  |  Branch (1679:9): [True: 2.11k, False: 286k]
  |  Branch (1679:22): [True: 2.11k, False: 0]
  |  Branch (1679:36): [True: 2.10k, False: 16]
  |  Branch (1679:55): [True: 2.10k, False: 0]
  ------------------
 1680|  2.10k|    {
 1681|  14.4k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1681:21): [True: 12.3k, False: 2.10k]
  ------------------
 1682|  12.3k|        {
 1683|  12.3k|            pConstitEquNumb[i] = pSymmRank[pCanonOrd[i]];
 1684|  12.3k|            pSortOrd[i] = i;
 1685|  12.3k|        }
 1686|       |
 1687|  2.19k|        for (; i < num_at_tg; i++)
  ------------------
  |  Branch (1687:16): [True: 98, False: 2.10k]
  ------------------
 1688|     98|        {
 1689|     98|            pSortOrd[i] = i;
 1690|     98|        }
 1691|       |
 1692|  2.10k|        pCG->m_pn_RankForSort = pConstitEquNumb;
 1693|  2.10k|        inchi_qsort( pCG, pSortOrd, num_atoms, sizeof( pSortOrd[0] ), CompRanksOrd );
 1694|       |
 1695|  14.4k|        for (i = 0, nMinOrd = pSortOrd[0], j = 1; j <= num_atoms; j++)
  ------------------
  |  Branch (1695:51): [True: 12.3k, False: 2.10k]
  ------------------
 1696|  12.3k|        {
 1697|  12.3k|            if (j == num_atoms || pConstitEquNumb[pSortOrd[i]] != pConstitEquNumb[pSortOrd[j]])
  ------------------
  |  Branch (1697:17): [True: 2.10k, False: 10.2k]
  |  Branch (1697:35): [True: 3.44k, False: 6.80k]
  ------------------
 1698|  5.54k|            {
 1699|  5.54k|                nMinOrd++;
 1700|       |
 1701|  5.54k|                if (j - i > 1)
  ------------------
  |  Branch (1701:21): [True: 858, False: 4.68k]
  ------------------
 1702|    858|                {
 1703|       |                    /*  found a sequence of equivalent atoms: i..j-1 */
 1704|  8.52k|                    while (i < j)
  ------------------
  |  Branch (1704:28): [True: 7.66k, False: 858]
  ------------------
 1705|  7.66k|                    {
 1706|  7.66k|                        pConstitEquNumb[pSortOrd[i++]] = nMinOrd;
 1707|  7.66k|                    }
 1708|    858|                }
 1709|  4.68k|                else
 1710|  4.68k|                {
 1711|  4.68k|                    pConstitEquNumb[pSortOrd[i++]] = 0; /* nMinOrd; */
 1712|  4.68k|                }
 1713|  5.54k|                nMinOrd = pSortOrd[j];
 1714|  5.54k|            }
 1715|  12.3k|        }
 1716|  2.10k|    }
 1717|   286k|    else
 1718|   286k|    {
 1719|   286k|        goto exit_function; /*  no isotopic info available */
 1720|   286k|    }
 1721|       |
 1722|       |
 1723|       |    /*  Isotopic atoms */
 1724|       |
 1725|  2.10k|    n = pINChI->nNumberOfIsotopicAtoms = pCS->nLenLinearCTIsotopic;
 1726|       |
 1727|  4.49k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (1727:17): [True: 2.39k, False: 2.10k]
  ------------------
 1728|  2.39k|    {
 1729|  2.39k|        pINChI->IsotopicAtom[i].nAtomNumber = pCS->LinearCTIsotopic[i].at_num;
 1730|  2.39k|        pINChI->IsotopicAtom[i].nIsoDifference = pCS->LinearCTIsotopic[i].iso_atw_diff;
 1731|  2.39k|        pINChI->IsotopicAtom[i].nNum_H = pCS->LinearCTIsotopic[i].num_1H;
 1732|  2.39k|        pINChI->IsotopicAtom[i].nNum_D = pCS->LinearCTIsotopic[i].num_D;
 1733|  2.39k|        pINChI->IsotopicAtom[i].nNum_T = pCS->LinearCTIsotopic[i].num_T;
 1734|  2.39k|    }
 1735|       |
 1736|       |    /*  Isotopic tautomeric groups */
 1737|       |
 1738|  2.10k|    n = pINChI->nNumberOfIsotopicTGroups = pCS->nLenLinearCTIsotopicTautomer;
 1739|       |
 1740|  2.10k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (1740:17): [True: 0, False: 2.10k]
  ------------------
 1741|      0|    {
 1742|      0|        pINChI->IsotopicTGroup[i].nTGroupNumber = pCS->LinearCTIsotopicTautomer[i].tgroup_num;
 1743|      0|        pINChI->IsotopicTGroup[i].nNum_H = pCS->LinearCTIsotopicTautomer[i].num[2];
 1744|      0|        pINChI->IsotopicTGroup[i].nNum_D = pCS->LinearCTIsotopicTautomer[i].num[1];
 1745|      0|        pINChI->IsotopicTGroup[i].nNum_T = pCS->LinearCTIsotopicTautomer[i].num[0];
 1746|      0|    }
 1747|       |
 1748|       |    /* Atoms that may exchange isotopic H-atoms */
 1749|       |
 1750|  2.10k|    if (pCS->nExchgIsoH && pINChI->nPossibleLocationsOfIsotopicH)
  ------------------
  |  Branch (1750:9): [True: 2.10k, False: 0]
  |  Branch (1750:28): [True: 2.10k, False: 0]
  ------------------
 1751|  2.10k|    {
 1752|  14.4k|        for (i = 0, j = 1; i < num_atoms; i++)
  ------------------
  |  Branch (1752:28): [True: 12.3k, False: 2.10k]
  ------------------
 1753|  12.3k|        {
 1754|  12.3k|            if (pCS->nExchgIsoH[i])
  ------------------
  |  Branch (1754:17): [True: 254, False: 12.0k]
  ------------------
 1755|    254|            {
 1756|    254|                pINChI->nPossibleLocationsOfIsotopicH[j++] = (AT_NUMB) ( i + 1 ); /* canonical number */
 1757|    254|            }
 1758|  12.3k|        }
 1759|  2.10k|        pINChI->nPossibleLocationsOfIsotopicH[0] = (AT_NUMB) j; /* length including the 0th element */
 1760|  2.10k|    }
 1761|       |
 1762|  2.10k|    if ((nStereoUnmarkMode = UnmarkAllUndefinedUnknownStereo( pINChI->StereoIsotopic, nUserMode ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1762:9): [True: 51, False: 2.04k]
  ------------------
 1763|     51|    {
 1764|     51|        pINChI->nFlags |=
 1765|     51|            ( nStereoUnmarkMode & REQ_MODE_SC_IGN_ALL_UU ) ? INCHI_FLAG_SC_IGN_ALL_ISO_UU
  ------------------
  |  |   30|     51|#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
  ------------------
  |  |  125|     31|#define INCHI_FLAG_SC_IGN_ALL_ISO_UU    0x0020   /* ignored all undefined/unknown stereocenters, isotopic */
  ------------------
  |  Branch (1765:13): [True: 31, False: 20]
  ------------------
 1766|     51|            : 0;
 1767|     51|        pINChI->nFlags |=
 1768|     51|            ( nStereoUnmarkMode & REQ_MODE_SB_IGN_ALL_UU ) ? INCHI_FLAG_SC_IGN_ALL_ISO_UU
  ------------------
  |  |   32|     51|#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
  ------------------
  |  |  125|     20|#define INCHI_FLAG_SC_IGN_ALL_ISO_UU    0x0020   /* ignored all undefined/unknown stereocenters, isotopic */
  ------------------
  |  Branch (1768:13): [True: 20, False: 31]
  ------------------
 1769|     51|            : 0;
 1770|     51|        if (( nStereoUnmarkMode & REQ_MODE_SC_IGN_ALL_UU ) ||
  ------------------
  |  |   30|     51|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  |  Branch (1770:13): [True: 31, False: 20]
  ------------------
 1771|     20|            ( nStereoUnmarkMode & REQ_MODE_SB_IGN_ALL_UU ))
  ------------------
  |  |   32|     20|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
  |  Branch (1771:13): [True: 20, False: 0]
  ------------------
 1772|     51|        {
 1773|     51|            if (!bNoWarnings)
  ------------------
  |  Branch (1773:17): [True: 51, False: 0]
  ------------------
 1774|     51|            {
 1775|     51|                WarningMessage( pStrErrStruct, "Omitted undefined stereo" );
  ------------------
  |  |  132|     51|#define WarningMessage AddErrorMessage
  ------------------
 1776|     51|            }
 1777|     51|        }
 1778|     51|    }
 1779|       |
 1780|       |    /* Mark ambiguous stereo */
 1781|       |
 1782|  2.10k|    MarkAmbiguousStereo( at, norm_at, 1 /* isotopic */, pCanonOrd,
 1783|  2.10k|                         pCS->LinearCTIsotopicStereoCarb, pCS->nLenLinearCTIsotopicStereoCarb,
 1784|  2.10k|                         pCS->LinearCTIsotopicStereoDble, pCS->nLenLinearCTIsotopicStereoDble );
 1785|       |
 1786|       |
 1787|       |    /***********************************************************
 1788|       |     *  Isotopic tautomeric group(s) numbering and symmetry;
 1789|       |     *  should not depend on switching to rel. stereo numbering
 1790|       |     */
 1791|       |
 1792|  2.10k|    if (pINChI->lenTautomer &&
  ------------------
  |  Branch (1792:9): [True: 851, False: 1.24k]
  ------------------
 1793|    851|         pINChI_Aux->nConstitEquIsotopicTGroupNumbers &&
  ------------------
  |  Branch (1793:10): [True: 851, False: 0]
  ------------------
 1794|    851|         pCS->nSymmRankIsotopicTaut &&
  ------------------
  |  Branch (1794:10): [True: 85, False: 766]
  ------------------
 1795|     85|         ( pCS->nLenLinearCTIsotopic || pCS->nLenLinearCTIsotopicTautomer ) &&
  ------------------
  |  Branch (1795:12): [True: 81, False: 4]
  |  Branch (1795:41): [True: 0, False: 4]
  ------------------
 1796|     81|         t_group_info && t_group_info->num_t_groups > 0)
  ------------------
  |  Branch (1796:10): [True: 81, False: 0]
  |  Branch (1796:26): [True: 81, False: 0]
  ------------------
 1797|     81|    {
 1798|       |
 1799|       |        /* djb-rwth: removing redundant code */
 1800|       |
 1801|     81|        pCanonOrdTaut =
 1802|     81|            pCS->nLenCanonOrdIsotopicStereoTaut > 0 ? ( n = pCS->nLenCanonOrdIsotopicStereoTaut, pCS->nCanonOrdIsotopicStereoTaut )
  ------------------
  |  Branch (1802:13): [True: 17, False: 64]
  ------------------
 1803|     81|            : pCS->nLenCanonOrdIsotopicTaut > 0 ? ( n = pCS->nLenCanonOrdIsotopicTaut, pCS->nCanonOrdIsotopicTaut )
  ------------------
  |  Branch (1803:15): [True: 64, False: 0]
  ------------------
 1804|     64|            : ( n = 0, (AT_RANK*) NULL );
 1805|       |
 1806|     81|        pConstitEquNumb = pINChI_Aux->nConstitEquIsotopicTGroupNumbers;
 1807|       |
 1808|     81|        pSymmRank = pCS->nSymmRankIsotopicTaut;
 1809|       |
 1810|     81|        if (pCanonOrdTaut && pSymmRank && pConstitEquNumb && n > 0)
  ------------------
  |  Branch (1810:13): [True: 81, False: 0]
  |  Branch (1810:30): [True: 81, False: 0]
  |  Branch (1810:43): [True: 81, False: 0]
  |  Branch (1810:62): [True: 81, False: 0]
  ------------------
 1811|     81|        {
 1812|    175|            for (i = 0; i < n; i++)
  ------------------
  |  Branch (1812:25): [True: 94, False: 81]
  ------------------
 1813|     94|            {
 1814|     94|                pConstitEquNumb[i] = pSymmRank[pCanonOrdTaut[i]];
 1815|     94|                pSortOrd[i] = i;
 1816|     94|            }
 1817|       |
 1818|     81|            pCG->m_pn_RankForSort = pConstitEquNumb;
 1819|     81|            inchi_qsort( pCG, pSortOrd, n, sizeof( pSortOrd[0] ), CompRanksOrd );
 1820|    175|            for (i = 0, nMinOrd = pSortOrd[0], j = 1; j <= n; j++)
  ------------------
  |  Branch (1820:55): [True: 94, False: 81]
  ------------------
 1821|     94|            {
 1822|     94|                if (j == n || pConstitEquNumb[pSortOrd[i]] != pConstitEquNumb[pSortOrd[j]])
  ------------------
  |  Branch (1822:21): [True: 81, False: 13]
  |  Branch (1822:31): [True: 13, False: 0]
  ------------------
 1823|     94|                {
 1824|     94|                    nMinOrd++;
 1825|     94|                    if (j - i > 1)
  ------------------
  |  Branch (1825:25): [True: 0, False: 94]
  ------------------
 1826|      0|                    {
 1827|       |                        /*  found a sequence of equivalent t-groups: i..j-1 */
 1828|      0|                        while (i < j)
  ------------------
  |  Branch (1828:32): [True: 0, False: 0]
  ------------------
 1829|      0|                        {
 1830|      0|                            pConstitEquNumb[pSortOrd[i++]] = nMinOrd;
 1831|      0|                        }
 1832|      0|                    }
 1833|     94|                    else
 1834|     94|                    {
 1835|     94|                        pConstitEquNumb[pSortOrd[i++]] = 0; /*  nMinOrd; */
 1836|     94|                    }
 1837|     94|                    nMinOrd = pSortOrd[j]; /*  at the end j = n */
 1838|     94|                }
 1839|     94|            }
 1840|     81|        }
 1841|     81|    }
 1842|       |
 1843|       |
 1844|   288k|exit_function:
 1845|       |
 1846|   288k|    if (pCanonRankAtoms)
  ------------------
  |  Branch (1846:9): [True: 288k, False: 0]
  ------------------
 1847|   288k|    {
 1848|   288k|        inchi_free( pCanonRankAtoms );
  ------------------
  |  | 1152|   288k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 288k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 288k]
  |  |  ------------------
  ------------------
 1849|   288k|    }
 1850|   288k|    if (pSortOrd)
  ------------------
  |  Branch (1850:9): [True: 288k, False: 0]
  ------------------
 1851|   288k|    {
 1852|   288k|        inchi_free( pSortOrd );
  ------------------
  |  | 1152|   288k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 288k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 288k]
  |  |  ------------------
  ------------------
 1853|   288k|    }
 1854|       |
 1855|   288k|    pINChI->nErrorCode |= nErrorCode;
 1856|   288k|    pINChI_Aux->nErrorCode |= nErrorCode;
 1857|       |
 1858|   288k|    return ret;
 1859|  2.10k|}

inp2spATOM:
   85|   288k|{
   86|   288k|    int i, j, val, elname_len;
   87|       |
   88|   288k|    memset(at, 0, sizeof(at[0]) * num_inp_at); /* djb-rwth: memset_s C11/Annex K variant? */
   89|       |
   90|  1.38M|    for (i = 0; i < num_inp_at; i++)
  ------------------
  |  Branch (90:17): [True: 1.10M, False: 288k]
  ------------------
   91|  1.10M|    {
   92|  1.10M|        elname_len = sizeof(at[0].elname) - 1; /* djb-rwth: fixing coverity ID #499609 */
   93|  1.10M|        strncpy(at[i].elname, inp_at[i].elname, elname_len);
   94|  1.10M|        at[i].elname[elname_len] = '\0';
   95|  1.10M|        at[i].el_number = (U_CHAR)get_periodic_table_number(at[i].elname);
   96|  1.10M|        val = at[i].valence = inp_at[i].valence;
   97|  1.58M|        for (j = 0; j < val; j++)
  ------------------
  |  Branch (97:21): [True: 486k, False: 1.10M]
  ------------------
   98|   486k|        {
   99|   486k|            at[i].neighbor[j] = inp_at[i].neighbor[j];
  100|   486k|            at[i].bond_type[j] = inp_at[i].bond_type[j];
  101|   486k|        }
  102|  1.10M|        at[i].chem_bonds_valence = inp_at[i].chem_bonds_valence;
  103|  1.10M|        at[i].orig_at_number = inp_at[i].orig_at_number;
  104|  1.10M|        at[i].orig_compt_at_numb = inp_at[i].orig_compt_at_numb;
  105|  1.10M|        at[i].endpoint = inp_at[i].endpoint;
  106|  1.10M|        at[i].iso_atw_diff = inp_at[i].iso_atw_diff;
  107|  1.10M|        at[i].num_H = inp_at[i].num_H;
  108|  1.10M|        at[i].cFlags = inp_at[i].cFlags;
  109|  4.40M|        for (j = 0; j < NUM_H_ISOTOPES; j++)
  ------------------
  |  |   72|  4.40M|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (109:21): [True: 3.30M, False: 1.10M]
  ------------------
  110|  3.30M|        {
  111|  3.30M|            at[i].num_iso_H[j] = inp_at[i].num_iso_H[j];
  112|  3.30M|        }
  113|  1.10M|        at[i].charge = inp_at[i].charge;
  114|  1.10M|        at[i].radical = inp_at[i].radical;
  115|       |
  116|  1.10M|#if ( FIND_RING_SYSTEMS == 1 )
  117|  1.10M|        at[i].nBlockSystem = inp_at[i].nBlockSystem;
  118|  1.10M|        at[i].bCutVertex = inp_at[i].bCutVertex;
  119|  1.10M|        at[i].nRingSystem = inp_at[i].nRingSystem;
  120|  1.10M|        at[i].nNumAtInRingSystem = inp_at[i].nNumAtInRingSystem;
  121|       |#if ( FIND_RINS_SYSTEMS_DISTANCES == 1 )
  122|       |        at[i].nDistanceFromTerminal = inp_at[i].nDistanceFromTerminal;
  123|       |#endif
  124|  1.10M|#endif
  125|       |
  126|       |        /*
  127|       |                at[i].x                  = inp_at[i].x;
  128|       |                at[i].y                  = inp_at[i].y;
  129|       |                at[i].z                  = inp_at[i].z;
  130|       |        */
  131|  1.10M|    }
  132|       |
  133|   288k|    return 0;
  134|   288k|}
GetElementAndCount:
  139|  16.1M|{
  140|  16.1M|    const char* p = *f;
  141|  16.1M|    char* q;
  142|  16.1M|    int   i = 0;
  143|       |
  144|       |    /* djb-rwth: fixing oss-fuzz issue #37224 */
  145|  16.1M|    if (p && *p)
  ------------------
  |  Branch (145:9): [True: 14.4M, False: 1.64M]
  |  Branch (145:14): [True: 9.83M, False: 4.63M]
  ------------------
  146|  9.83M|    {
  147|  9.83M|        if (isupper(UCINT * p))
  ------------------
  |  Branch (147:13): [True: 9.83M, False: 0]
  ------------------
  148|  9.83M|        {
  149|  9.83M|            szEl[i++] = *p++;
  150|  9.83M|            if (*p && islower(UCINT * p))
  ------------------
  |  Branch (150:17): [True: 5.87M, False: 3.96M]
  |  Branch (150:23): [True: 1.74M, False: 4.12M]
  ------------------
  151|  1.74M|            {
  152|  1.74M|                szEl[i++] = *p++;
  153|  1.74M|            }
  154|  9.83M|            szEl[i] = '\0';
  155|  9.83M|            if (1 == i && szEl[0] == 'C')
  ------------------
  |  Branch (155:17): [True: 8.09M, False: 1.74M]
  |  Branch (155:27): [True: 471k, False: 7.61M]
  ------------------
  156|   471k|            {
  157|   471k|                szEl[0] = 'A'; /*  less than any element: */
  158|       |                /*  carbon-containing compounds should be first */
  159|   471k|            }
  160|  9.83M|            if (*p && isdigit(UCINT * p))
  ------------------
  |  Branch (160:17): [True: 5.67M, False: 4.16M]
  |  Branch (160:23): [True: 2.09M, False: 3.58M]
  ------------------
  161|  2.09M|            {
  162|  2.09M|                *count = strtol(p, &q, 10);
  163|  2.09M|                p = q;
  164|  2.09M|            }
  165|  7.74M|            else
  166|  7.74M|            {
  167|  7.74M|                *count = 1;
  168|  7.74M|            }
  169|  9.83M|            *f = p; /*  next element; */
  170|  9.83M|            return 1;
  171|  9.83M|        }
  172|      0|        return -1; /*  not a chemical formula */
  173|  9.83M|    }
  174|       |    /* v. 1.06 Changed "Zz" to "Zzz" as "Zz" is valid symbol now */
  175|  6.28M|    strcpy(szEl, "Zzz");
  176|       |    /*strcpy( szEl, "Zz" );*/
  177|       |    /*  zero termination 'element' is larger than any other element */
  178|  6.28M|    *count = 99999;         /* zero termination 'element count' is larger than any other count */
  179|  6.28M|    return 0;
  180|  16.1M|}
CompareHillFormulas:
  207|   450k|{
  208|   450k|    char szEl1[4], szEl2[4];
  209|   450k|    int  count1, count2, ret1, ret2, ret;
  210|       |
  211|   450k|    do
  212|   900k|    {
  213|   900k|        ret1 = GetElementAndCount(&f1, szEl1, &count1);
  214|   900k|        ret2 = GetElementAndCount(&f2, szEl2, &count2);
  215|   900k|        if (0 <= ret1 && 0 <= ret2)
  ------------------
  |  Branch (215:13): [True: 900k, False: 0]
  |  Branch (215:26): [True: 900k, False: 0]
  ------------------
  216|   900k|        {
  217|   900k|            if ((ret = strcmp(szEl1, szEl2))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (217:17): [True: 0, False: 900k]
  ------------------
  218|      0|            {
  219|      0|                return ret; /*  lexicographic order, string termination > any character */
  220|      0|            }
  221|   900k|            if ((ret = count2 - count1)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (221:17): [True: 0, False: 900k]
  ------------------
  222|      0|            {
  223|      0|                return ret; /*  inverse atom count order */
  224|      0|            }
  225|   900k|        }
  226|      0|        else
  227|      0|        {
  228|      0|            return 0; /*  program error <BRKPT> */
  229|      0|        }
  230|   900k|    } while (0 < ret1 && 0 < ret2);
  ------------------
  |  Branch (230:14): [True: 450k, False: 450k]
  |  Branch (230:26): [True: 450k, False: 0]
  ------------------
  231|       |
  232|   450k|    return 0;
  233|   450k|}
CompareHillFormulasNoH:
  241|  2.77M|{
  242|  2.77M|    char szEl1[4], szEl2[4];
  243|  2.77M|    int  count1, count2, ret1, ret2, ret;
  244|       |
  245|  2.77M|    do
  246|  5.88M|    {
  247|  5.88M|        ret1 = GetElementAndCount(&f1, szEl1, &count1);
  248|  5.88M|        if (0 < ret1 && szEl1[0] == 'H' && !szEl1[1])
  ------------------
  |  Branch (248:13): [True: 4.22M, False: 1.66M]
  |  Branch (248:25): [True: 1.31M, False: 2.90M]
  |  Branch (248:44): [True: 1.29M, False: 22.3k]
  ------------------
  249|  1.29M|        {
  250|  1.29M|            *num_H1 += count1;
  251|  1.29M|            ret1 = GetElementAndCount(&f1, szEl1, &count1);
  252|  1.29M|        }
  253|  5.88M|        ret2 = GetElementAndCount(&f2, szEl2, &count2);
  254|  5.88M|        if (0 < ret2 && szEl2[0] == 'H' && !szEl2[1])
  ------------------
  |  Branch (254:13): [True: 4.23M, False: 1.64M]
  |  Branch (254:25): [True: 1.27M, False: 2.96M]
  |  Branch (254:44): [True: 1.25M, False: 22.3k]
  ------------------
  255|  1.25M|        {
  256|  1.25M|            *num_H2 += count2;
  257|  1.25M|            ret2 = GetElementAndCount(&f2, szEl2, &count2);
  258|  1.25M|        }
  259|  5.88M|        if (0 <= ret1 && 0 <= ret2)
  ------------------
  |  Branch (259:13): [True: 5.88M, False: 0]
  |  Branch (259:26): [True: 5.88M, False: 0]
  ------------------
  260|  5.88M|        {
  261|  5.88M|            if ((ret = strcmp(szEl1, szEl2))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (261:17): [True: 77.2k, False: 5.80M]
  ------------------
  262|  77.2k|            {
  263|  77.2k|                return ret; /*  lexicographic order, string termination > any character */
  264|  77.2k|            }
  265|  5.80M|            if ((ret = count2 - count1)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (265:17): [True: 22.4k, False: 5.78M]
  ------------------
  266|  22.4k|            {
  267|  22.4k|                return ret; /*  inverse atom count order */
  268|  22.4k|            }
  269|  5.80M|        }
  270|      0|        else
  271|      0|        {
  272|      0|            return 0; /*  program error <BRKPT> */
  273|      0|        }
  274|  5.88M|    } while (0 < ret1 && 0 < ret2);
  ------------------
  |  Branch (274:14): [True: 3.11M, False: 2.67M]
  |  Branch (274:26): [True: 3.11M, False: 0]
  ------------------
  275|       |
  276|  2.67M|    return 0;
  277|  2.77M|}
CompareTautNonIsoPartOfINChI:
  282|  2.56M|{
  283|  2.56M|    int len1, len2, ret, i;
  284|       |
  285|  2.56M|    len1 = i1->lenTautomer > 0 && i1->nTautomer[0] ? i1->lenTautomer : 0;
  ------------------
  |  Branch (285:12): [True: 901k, False: 1.66M]
  |  Branch (285:35): [True: 589, False: 900k]
  ------------------
  286|  2.56M|    len2 = i2->lenTautomer > 0 && i2->nTautomer[0] ? i2->lenTautomer : 0;
  ------------------
  |  Branch (286:12): [True: 901k, False: 1.66M]
  |  Branch (286:35): [True: 589, False: 900k]
  ------------------
  287|  2.56M|    if ((ret = len2 - len1)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (287:9): [True: 0, False: 2.56M]
  ------------------
  288|      0|    {
  289|      0|        return ret;
  290|      0|    }
  291|  2.57M|    for (i = 0; i < len1; i++)
  ------------------
  |  Branch (291:17): [True: 14.0k, False: 2.56M]
  ------------------
  292|  14.0k|    {
  293|  14.0k|        if ((ret = (int)i2->nTautomer[i] - (int)i1->nTautomer[i])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (293:13): [True: 0, False: 14.0k]
  ------------------
  294|      0|            return ret;
  295|  14.0k|    }
  296|  2.56M|    return 0;
  297|  2.56M|}
CompINChITautVsNonTaut:
  309|  97.5k|{
  310|  97.5k|    int ret, num, i, num_H1, num_H2;
  311|       |
  312|  97.5k|    const INChI* i1 = NULL; /* Mobile-H layers in Mobile-H sorting order */
  313|  97.5k|    const INChI* i2 = NULL; /* Fixed-H  layers in Fixed-H  sorting order */
  314|       |
  315|  97.5k|    int   n1;               /* TAUT_YES if tautomeric i1 exists, otherwise TAUT_NON */
  316|       |
  317|       |    /* INChI_Stereo *Stereo1, *Stereo2; */
  318|       |
  319|  97.5k|    n1 = (p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n1 = (p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n1 = (p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n1 = (p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  574|  97.5k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (319:11): [True: 97.5k, False: 0]
  |  Branch (319:35): [True: 97.5k, False: 0]
  ------------------
  320|       |
  321|  97.5k|    i1 = p1->pINChI[n1];
  322|  97.5k|    i2 = (n1 == TAUT_YES && p2->pINChI[TAUT_NON] &&
  ------------------
  |  |  575|   195k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  i2 = (n1 == TAUT_YES && p2->pINChI[TAUT_NON] &&
  ------------------
  |  |  574|  97.5k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (322:11): [True: 97.5k, False: 0]
  |  Branch (322:29): [True: 0, False: 97.5k]
  ------------------
  323|  97.5k|        p2->pINChI[TAUT_NON]->nNumberOfAtoms) ? p2->pINChI[TAUT_NON] : (const INChI*)NULL;
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      p2->pINChI[TAUT_NON]->nNumberOfAtoms) ? p2->pINChI[TAUT_NON] : (const INChI*)NULL;
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (323:9): [True: 0, False: 0]
  ------------------
  324|       |
  325|       |    /* non-deleted-non-empty < deleted < empty */
  326|  97.5k|    if (i1 && !i2)
  ------------------
  |  Branch (326:9): [True: 97.5k, False: 0]
  |  Branch (326:15): [True: 97.5k, False: 0]
  ------------------
  327|  97.5k|        return 0;   /* non-empty is the smallest (first) */
  328|      0|    if (!i1 && i2)
  ------------------
  |  Branch (328:9): [True: 0, False: 0]
  |  Branch (328:16): [True: 0, False: 0]
  ------------------
  329|      0|        return 0;
  330|      0|    if (!i1 && !i2)
  ------------------
  |  Branch (330:9): [True: 0, False: 0]
  |  Branch (330:16): [True: 0, False: 0]
  ------------------
  331|      0|        return 0;
  332|      0|    if (i1->bDeleted)
  ------------------
  |  Branch (332:9): [True: 0, False: 0]
  ------------------
  333|      0|        return 1;    /* deleted is the largest (last) among non-empty */
  334|      0|    if (i2->bDeleted)
  ------------------
  |  Branch (334:9): [True: 0, False: 0]
  ------------------
  335|      0|        return -1;
  336|       |
  337|      0|    if (i1->nNumberOfAtoms > 0 && !i2->nNumberOfAtoms)
  ------------------
  |  Branch (337:9): [True: 0, False: 0]
  |  Branch (337:35): [True: 0, False: 0]
  ------------------
  338|      0|        return 0;
  339|       |
  340|       |    /* i2 = i2;         djb-rwth: an obviously useless statement */
  341|       |
  342|      0|    num_H1 = num_H2 = 0;
  343|       |
  344|       |    /* do not compare terminal H */
  345|      0|    if ((ret = CompareHillFormulasNoH(i1->szHillFormula, i2->szHillFormula, &num_H1, &num_H2))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (345:9): [True: 0, False: 0]
  ------------------
  346|      0|    {
  347|      0|        return ret;  /* lexicographic order except the shorter one is greater (last): CH2O < CH2; C3XX < C2XX */
  348|      0|    }
  349|       |
  350|       |    /*
  351|       |        compare non-isotopic non-tautomeric part
  352|       |    */
  353|       |
  354|       |    /* compare number of atoms (excluding terminal H) */
  355|      0|    if ((ret = i2->nNumberOfAtoms - i1->nNumberOfAtoms)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (355:9): [True: 0, False: 0]
  ------------------
  356|      0|        return ret; /*  more atoms first */
  357|       |
  358|       |    /*  compare elements  (excluding terminal H) */
  359|      0|    num = i1->nNumberOfAtoms;
  360|      0|    for (i = 0; i < num; i++)
  ------------------
  |  Branch (360:17): [True: 0, False: 0]
  ------------------
  361|      0|    { /* should always be equal if Hill formulas are same */
  362|      0|        if ((ret = (int)i2->nAtom[i] - (int)i1->nAtom[i])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (362:13): [True: 0, False: 0]
  ------------------
  363|      0|            return ret; /* greater periodic number first */
  364|      0|    }
  365|       |    /*
  366|       |        compare connection tables
  367|       |    */
  368|      0|    if ((ret = i2->lenConnTable - i1->lenConnTable)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (368:9): [True: 0, False: 0]
  ------------------
  369|      0|        return ret; /* longer connection table first */
  370|      0|    num = i2->lenConnTable;
  371|      0|    for (i = 0; i < num; i++)
  ------------------
  |  Branch (371:17): [True: 0, False: 0]
  ------------------
  372|      0|    {
  373|      0|        if ((ret = (int)i2->nConnTable[i] - (int)i1->nConnTable[i])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (373:13): [True: 0, False: 0]
  ------------------
  374|      0|            return ret; /* greater connection table first */
  375|      0|    }
  376|       |    /*
  377|       |      compare total number of H (inverse: H3 < H2 )
  378|       |    */
  379|      0|    if ((ret = num_H2 - num_H1)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (379:9): [True: 0, False: 0]
  ------------------
  380|      0|        return ret;
  381|       |    /*
  382|       |      compare non-tautomeric num_H: N < NH3 < NH2 < NH
  383|       |    */
  384|      0|    num = i1->nNumberOfAtoms;
  385|      0|    for (i = 0; i < num; i++)
  ------------------
  |  Branch (385:17): [True: 0, False: 0]
  ------------------
  386|      0|    {
  387|      0|        if (i2->nNum_H[i] != i1->nNum_H[i])
  ------------------
  |  Branch (387:13): [True: 0, False: 0]
  ------------------
  388|      0|        {
  389|      0|            return !i2->nNum_H[i] ? 1 :  /* no H first */
  ------------------
  |  Branch (389:20): [True: 0, False: 0]
  ------------------
  390|      0|                !i1->nNum_H[i] ? -1 :
  ------------------
  |  Branch (390:17): [True: 0, False: 0]
  ------------------
  391|      0|                (int)i2->nNum_H[i] - (int)i1->nNum_H[i];
  392|      0|        }
  393|      0|    }
  394|       |    /*
  395|       |        compare non-isotopic tautomeric part
  396|       |    */
  397|      0|    if ((ret = CompareTautNonIsoPartOfINChI(i1, i2))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (397:9): [True: 0, False: 0]
  ------------------
  398|      0|    {
  399|      0|        return ret;
  400|      0|    }
  401|       |    /*
  402|       |    if ( ret = i2->lenTautomer - i1->lenTautomer )
  403|       |        return ret;
  404|       |    num = inchi_min( i2->lenTautomer, i1->lenTautomer );
  405|       |    for ( i = 0; i < num; i ++ ) {
  406|       |        if ( ret = (int)i2->nTautomer[i] - (int)i1->nTautomer[i] )
  407|       |            return ret;
  408|       |    }
  409|       |    */
  410|       |
  411|       |    /*
  412|       |        at this point both components are either tautomeric
  413|       |        or non-tautomeric
  414|       |     */
  415|       |
  416|       |     /*
  417|       |         non-tautomeric "fixed H" specific
  418|       |     */
  419|      0|    if ( /*TAUT_NON == bTaut && (i2 &&*/ i2->nNum_H_fixed) /* djb-rwth: fixing coverity ID #499493 */
  ------------------
  |  Branch (419:42): [True: 0, False: 0]
  ------------------
  420|      0|    {
  421|       |        /* first, compare non-tautomeric chem. formulas -- they may be different */
  422|       |        /* secondly, compare fixed-H distribution */
  423|      0|        if (i2->nNum_H_fixed)
  ------------------
  |  Branch (423:13): [True: 0, False: 0]
  ------------------
  424|      0|        {
  425|      0|            num = i2->nNumberOfAtoms;
  426|      0|            for (i = 0; i < num; i++)
  ------------------
  |  Branch (426:25): [True: 0, False: 0]
  ------------------
  427|      0|            {
  428|      0|                if (i2->nNum_H_fixed[i] != 0)
  ------------------
  |  Branch (428:21): [True: 0, False: 0]
  ------------------
  429|      0|                {
  430|      0|                    return 1;
  431|      0|                }
  432|      0|            }
  433|      0|        }
  434|      0|    }
  435|       |    /*
  436|       |        compare non-isotopic stereo
  437|       |    */
  438|      0|    ret = CompareInchiStereo(i1->Stereo, i1->nFlags, i2->Stereo, i2->nFlags);
  439|      0|    if (ret)
  ------------------
  |  Branch (439:9): [True: 0, False: 0]
  ------------------
  440|      0|    {
  441|      0|        return ret;
  442|      0|    }
  443|       |
  444|       |    /*
  445|       |        do not switch back to tautomeric i1, i2
  446|       |    */
  447|       |
  448|       |    /* -- how to switch back --
  449|       |    if ( i1t ) {
  450|       |        i1  = i1t;
  451|       |        i1t = NULL;
  452|       |    }
  453|       |    if ( i2t ) {
  454|       |        i2  = i2t;
  455|       |        i2t = NULL;
  456|       |    }
  457|       |    */
  458|       |
  459|       |    /*
  460|       |         compare isotopic non-tautomeric part
  461|       |    */
  462|      0|    if (bCompareIsotopic)
  ------------------
  |  Branch (462:9): [True: 0, False: 0]
  ------------------
  463|      0|    {
  464|      0|        if ((ret = i2->nNumberOfIsotopicAtoms - i1->nNumberOfIsotopicAtoms)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (464:13): [True: 0, False: 0]
  ------------------
  465|      0|            return ret;
  466|      0|        num = i1->nNumberOfIsotopicAtoms;
  467|       |
  468|       |        /*  compare isotopic atoms */
  469|      0|        for (i = 0; i < num; i++)
  ------------------
  |  Branch (469:21): [True: 0, False: 0]
  ------------------
  470|      0|        {
  471|      0|            if ((ret = (int)i2->IsotopicAtom[i].nAtomNumber - (int)i1->IsotopicAtom[i].nAtomNumber)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (471:17): [True: 0, False: 0]
  ------------------
  472|      0|                return ret;
  473|      0|            if ((ret = (int)i2->IsotopicAtom[i].nIsoDifference - (int)i1->IsotopicAtom[i].nIsoDifference)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (473:17): [True: 0, False: 0]
  ------------------
  474|      0|                return ret;
  475|      0|        }
  476|       |
  477|       |        /* compare isotopic H */
  478|       |        /* if tautomeric comparison mode then here are compared only non-tautomeric H */
  479|      0|        for (i = 0; i < num; i++)
  ------------------
  |  Branch (479:21): [True: 0, False: 0]
  ------------------
  480|      0|        {
  481|      0|            if ((ret = (int)i2->IsotopicAtom[i].nNum_T - (int)i1->IsotopicAtom[i].nNum_T)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (481:17): [True: 0, False: 0]
  ------------------
  482|      0|                return ret;
  483|      0|            if ((ret = (int)i2->IsotopicAtom[i].nNum_D - (int)i1->IsotopicAtom[i].nNum_D)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (483:17): [True: 0, False: 0]
  ------------------
  484|      0|                return ret;
  485|      0|            if ((ret = (int)i2->IsotopicAtom[i].nNum_H - (int)i1->IsotopicAtom[i].nNum_H)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (485:17): [True: 0, False: 0]
  ------------------
  486|      0|                return ret;
  487|      0|        }
  488|       |
  489|       |        /* compare isotopic tautomeric part */
  490|      0|        if ((ret = i2->nNumberOfIsotopicTGroups || i1->nNumberOfIsotopicTGroups)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (490:13): [True: 0, False: 0]
  |  Branch (490:20): [True: 0, False: 0]
  |  Branch (490:52): [True: 0, False: 0]
  ------------------
  491|      0|            return ret;
  492|       |
  493|       |        /*
  494|       |        num = i1->nNumberOfIsotopicTGroups;
  495|       |        for ( i = 0; i < num; i ++ ) {
  496|       |            if ( ret = (int)i2->IsotopicTGroup[i].nTGroupNumber - (int)i1->IsotopicTGroup[i].nTGroupNumber )
  497|       |                return ret;
  498|       |            if ( ret = (int)i2->IsotopicTGroup[i].nNum_T - (int)i1->IsotopicTGroup[i].nNum_T )
  499|       |                return ret;
  500|       |            if ( ret = (int)i2->IsotopicTGroup[i].nNum_D - (int)i1->IsotopicTGroup[i].nNum_D )
  501|       |                return ret;
  502|       |            if ( ret = (int)i2->IsotopicTGroup[i].nNum_H - (int)i1->IsotopicTGroup[i].nNum_H )
  503|       |                return ret;
  504|       |        }
  505|       |        */
  506|       |
  507|       |        /* compare isotopic stereo */
  508|      0|        ret = CompareInchiStereo(i1->StereoIsotopic, i1->nFlags,
  509|      0|            i2->StereoIsotopic, i2->nFlags);
  510|      0|        if (ret)
  ------------------
  |  Branch (510:13): [True: 0, False: 0]
  ------------------
  511|      0|        {
  512|      0|            return ret;
  513|      0|        }
  514|      0|    }
  515|       |
  516|       |    /*
  517|       |        compare charges: non-charged first, then in order of
  518|       |        ascending charges (negative first)
  519|       |    */
  520|       |
  521|      0|    if (i2->nTotalCharge && i1->nTotalCharge)
  ------------------
  |  Branch (521:9): [True: 0, False: 0]
  |  Branch (521:29): [True: 0, False: 0]
  ------------------
  522|      0|    {
  523|       |        /*  both are charged; smaller charges first */
  524|      0|        ret = (int)i1->nTotalCharge - (int)i2->nTotalCharge;
  525|      0|        return ret;
  526|      0|    }
  527|      0|    if ((ret = (i1->nTotalCharge ? 1 : 0) - (i2->nTotalCharge ? 1 : 0))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (527:9): [True: 0, False: 0]
  |  Branch (527:17): [True: 0, False: 0]
  |  Branch (527:46): [True: 0, False: 0]
  ------------------
  528|      0|    {
  529|       |        /*  only one is charged; uncharged first */
  530|      0|        return ret;
  531|      0|    }
  532|       |    /* stable sort */
  533|       |    /*ret = p1->ord_number - p2->ord_number;*/
  534|       |
  535|      0|    return ret;
  536|      0|}
GetSp3RelRacAbs:
  559|   390k|{
  560|   390k|    int nRet = SP3_NONE;
  561|   390k|    if (pINChI && !pINChI->bDeleted && Stereo && 0 < Stereo->nNumberOfStereoCenters)
  ------------------
  |  Branch (561:9): [True: 195k, False: 195k]
  |  Branch (561:19): [True: 195k, False: 12]
  |  Branch (561:40): [True: 10.3k, False: 184k]
  |  Branch (561:50): [True: 508, False: 9.81k]
  ------------------
  562|    508|    {
  563|    508|        if (0 != Stereo->nCompInv2Abs)
  ------------------
  |  Branch (563:13): [True: 41, False: 467]
  ------------------
  564|     41|        {
  565|     41|            if (pINChI->nFlags & INCHI_FLAG_REL_STEREO)
  ------------------
  |  |  121|     41|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
  |  Branch (565:17): [True: 15, False: 26]
  ------------------
  566|     15|            {
  567|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
  568|       |                if (1 < Stereo->nNumberOfStereoCenters)
  569|       |                {
  570|       |                    nRet = SP3_REL;
  571|       |                }
  572|       |#else
  573|     15|                nRet = SP3_REL;
  574|     15|#endif
  575|     15|            }
  576|     26|            else if (pINChI->nFlags & INCHI_FLAG_RAC_STEREO)
  ------------------
  |  |  122|     26|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (576:22): [True: 21, False: 5]
  ------------------
  577|     21|            {
  578|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
  579|       |                if (1 < Stereo->nNumberOfStereoCenters)
  580|       |                {
  581|       |                    nRet = SP3_REL;
  582|       |                }
  583|       |#else
  584|     21|                nRet = SP3_RAC;
  585|     21|#endif
  586|     21|            }
  587|      5|            else
  588|      5|            {
  589|      5|                nRet = SP3_ABS;
  590|      5|            }
  591|     41|        }
  592|    467|        else
  593|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
  594|       |            if (!((pINChI->nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)) && 1 == Stereo->nNumberOfStereoCenters))
  595|       |#endif
  596|    467|            {
  597|    467|                nRet = SP3_ONLY; /*  SP3_NONE if relative stereo and 1 stereocenter */
  598|    467|            }
  599|    508|    }
  600|   390k|    return nRet;
  601|   390k|}
CompINChILayers:
  613|  97.5k|{
  614|  97.5k|    int ret = 0, num, i, num_H1, num_H2;
  615|       |
  616|  97.5k|    const INChI* i1 = NULL; /* Mobile-H layers in Mobile-H sorting order */
  617|  97.5k|    const INChI* i2 = NULL; /* Fixed-H  layers in Fixed-H  sorting order */
  618|       |
  619|  97.5k|    int   n1;               /* TAUT_YES if tautomeric i1 exists, otherwise TAUT_NON */
  620|       |
  621|  97.5k|    INChI_Stereo* Stereo1, * Stereo2;
  622|  97.5k|    INChI_Stereo* IsoStereo1, * IsoStereo2;
  623|  97.5k|    int bRelRac[DIFL_LENGTH];
  624|  97.5k|    char* psDifSegs;
  625|       |
  626|  97.5k|    n1 = (p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n1 = (p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n1 = (p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n1 = (p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  574|  97.5k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (626:11): [True: 97.5k, False: 0]
  |  Branch (626:35): [True: 97.5k, False: 0]
  ------------------
  627|       |
  628|  97.5k|    i1 = p1->pINChI[n1];
  629|  97.5k|    i2 = (n1 == TAUT_YES && p2->pINChI[TAUT_NON] &&
  ------------------
  |  |  575|   195k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  i2 = (n1 == TAUT_YES && p2->pINChI[TAUT_NON] &&
  ------------------
  |  |  574|  97.5k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (629:11): [True: 97.5k, False: 0]
  |  Branch (629:29): [True: 0, False: 97.5k]
  ------------------
  630|  97.5k|        p2->pINChI[TAUT_NON]->nNumberOfAtoms) ? p2->pINChI[TAUT_NON] : (const INChI*)NULL;
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      p2->pINChI[TAUT_NON]->nNumberOfAtoms) ? p2->pINChI[TAUT_NON] : (const INChI*)NULL;
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (630:9): [True: 0, False: 0]
  ------------------
  631|       |
  632|  97.5k|    num_H1 = num_H2 = 0;
  633|  97.5k|    memset(bRelRac, DIFV_BOTH_EMPTY, sizeof(bRelRac)); /* djb-rwth: memset_s C11/Annex K variant? */
  634|       |    /*=====================*/
  635|       |    /*====     /f    ======*/
  636|       |    /*=====================*/
  637|  97.5k|    if (i1 && !i1->bDeleted && i1->szHillFormula && i1->szHillFormula[0])
  ------------------
  |  Branch (637:9): [True: 97.5k, False: 0]
  |  Branch (637:15): [True: 97.5k, False: 6]
  |  Branch (637:32): [True: 62.2k, False: 35.2k]
  |  Branch (637:53): [True: 62.2k, False: 0]
  ------------------
  638|  62.2k|    {
  639|  62.2k|        sDifSegs[DIFL_M][DIFS_f_FORMULA] |= DIFV_NEQ2PRECED;
  640|  62.2k|        if (i2 && !i2->bDeleted && i2->szHillFormula && i2->szHillFormula[0])
  ------------------
  |  Branch (640:13): [True: 0, False: 62.2k]
  |  Branch (640:19): [True: 0, False: 0]
  |  Branch (640:36): [True: 0, False: 0]
  |  Branch (640:57): [True: 0, False: 0]
  ------------------
  641|      0|        {
  642|      0|            if (!CompareHillFormulasNoH(i1->szHillFormula, i2->szHillFormula, &num_H1, &num_H2) &&
  ------------------
  |  Branch (642:17): [True: 0, False: 0]
  ------------------
  643|      0|                num_H1 == num_H2)
  ------------------
  |  Branch (643:17): [True: 0, False: 0]
  ------------------
  644|      0|            {
  645|      0|                sDifSegs[DIFL_F][DIFS_f_FORMULA] |= DIFV_EQL2PRECED;
  646|      0|            }
  647|      0|            else
  648|      0|            {
  649|      0|                sDifSegs[DIFL_F][DIFS_f_FORMULA] |= DIFV_NEQ2PRECED;
  650|      0|            }
  651|      0|        }
  652|  62.2k|        else
  653|  62.2k|        {
  654|  62.2k|            sDifSegs[DIFL_F][DIFS_f_FORMULA] |= i2 ? DIFV_IS_EMPTY : DIFV_EQL2PRECED;
  ------------------
  |  Branch (654:49): [True: 0, False: 62.2k]
  ------------------
  655|  62.2k|        }
  656|  62.2k|    }
  657|  35.3k|    else
  658|  35.3k|    {
  659|  35.3k|        sDifSegs[DIFL_M][DIFS_f_FORMULA] |= DIFV_BOTH_EMPTY;
  660|  35.3k|        if (i2 && !i2->bDeleted && i2->szHillFormula && i2->szHillFormula[0])
  ------------------
  |  Branch (660:13): [True: 0, False: 35.3k]
  |  Branch (660:19): [True: 0, False: 0]
  |  Branch (660:36): [True: 0, False: 0]
  |  Branch (660:57): [True: 0, False: 0]
  ------------------
  661|      0|        {
  662|      0|            sDifSegs[DIFL_F][DIFS_f_FORMULA] |= DIFV_NEQ2PRECED;
  663|      0|        }
  664|  35.3k|        else
  665|  35.3k|        {
  666|  35.3k|            sDifSegs[DIFL_F][DIFS_f_FORMULA] |= DIFV_BOTH_EMPTY;
  667|  35.3k|        }
  668|  35.3k|    }
  669|       |    /*=====================*/
  670|       |    /*====     /c    ======*/
  671|       |    /*=====================*/
  672|  97.5k|    if (i1 && !i1->bDeleted && i1->lenConnTable > 1)
  ------------------
  |  Branch (672:9): [True: 97.5k, False: 0]
  |  Branch (672:15): [True: 97.5k, False: 6]
  |  Branch (672:32): [True: 34.2k, False: 63.2k]
  ------------------
  673|  34.2k|    {
  674|  34.2k|        sDifSegs[DIFL_M][DIFS_f_FORMULA] |= DIFV_NEQ2PRECED;
  675|  34.2k|    }
  676|  63.2k|    else
  677|  63.2k|    {
  678|  63.2k|        sDifSegs[DIFL_M][DIFS_f_FORMULA] |= DIFV_BOTH_EMPTY;
  679|  63.2k|    }
  680|       |    /*=====================*/
  681|       |    /*====     /h    ======*/
  682|       |    /*=====================*/
  683|       |    /* M: H atoms */
  684|  97.5k|    if (i1 && !i1->bDeleted)
  ------------------
  |  Branch (684:9): [True: 97.5k, False: 0]
  |  Branch (684:15): [True: 97.5k, False: 6]
  ------------------
  685|  97.5k|    {
  686|  97.5k|        num_H1 = (i1->lenTautomer > 0 && i1->nTautomer && i1->nTautomer[0]) ? 1 : 0; /* number of t-groups */
  ------------------
  |  Branch (686:19): [True: 1.23k, False: 96.2k]
  |  Branch (686:42): [True: 1.23k, False: 0]
  |  Branch (686:59): [True: 1.23k, False: 0]
  ------------------
  687|  97.5k|        if (!num_H1 && i1->nNum_H)
  ------------------
  |  Branch (687:13): [True: 96.2k, False: 1.23k]
  |  Branch (687:24): [True: 96.2k, False: 0]
  ------------------
  688|  96.2k|        {
  689|  1.30M|            for (i = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (689:25): [True: 1.21M, False: 95.5k]
  ------------------
  690|  1.21M|            { /* immobile H */
  691|  1.21M|                if (i1->nNum_H[i])
  ------------------
  |  Branch (691:21): [True: 704, False: 1.21M]
  ------------------
  692|    704|                {
  693|    704|                    num_H1 = 1;
  694|    704|                    break;
  695|    704|                }
  696|  1.21M|            }
  697|  96.2k|        }
  698|  97.5k|        sDifSegs[DIFL_M][DIFS_h_H_ATOMS] |= num_H1 ? DIFV_NEQ2PRECED : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (698:45): [True: 1.94k, False: 95.5k]
  ------------------
  699|  97.5k|    }
  700|      6|    else
  701|      6|    {
  702|      6|        sDifSegs[DIFL_M][DIFS_h_H_ATOMS] |= DIFV_BOTH_EMPTY;
  703|      6|    }
  704|       |    /* F: fixed mobile H */
  705|  97.5k|    if (i2 && !i2->bDeleted && i2->nNum_H_fixed)
  ------------------
  |  Branch (705:9): [True: 0, False: 97.5k]
  |  Branch (705:15): [True: 0, False: 0]
  |  Branch (705:32): [True: 0, False: 0]
  ------------------
  706|      0|    {
  707|      0|        num_H2 = 0;
  708|      0|        if (i1 && !i1->bDeleted)
  ------------------
  |  Branch (708:13): [True: 0, False: 0]
  |  Branch (708:19): [True: 0, False: 0]
  ------------------
  709|      0|        {
  710|      0|            for (i = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (710:25): [True: 0, False: 0]
  ------------------
  711|      0|            {
  712|      0|                if (i2->nNum_H_fixed[i])
  ------------------
  |  Branch (712:21): [True: 0, False: 0]
  ------------------
  713|      0|                {
  714|      0|                    num_H2 = 1;
  715|      0|                    break;
  716|      0|                }
  717|      0|            }
  718|      0|        }
  719|      0|        sDifSegs[DIFL_F][DIFS_h_H_ATOMS] |= num_H2 ? DIFV_NEQ2PRECED : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (719:45): [True: 0, False: 0]
  ------------------
  720|      0|    }
  721|  97.5k|    else
  722|  97.5k|    {
  723|  97.5k|        sDifSegs[DIFL_F][DIFS_h_H_ATOMS] |= DIFV_BOTH_EMPTY;
  724|  97.5k|    }
  725|       |    /* MI: exchangable isotopic H: see OutputINChI1(), num_iso_H[] */
  726|       |
  727|       |    /*=====================*/
  728|       |    /*====     /q    ======*/
  729|       |    /*=====================*/
  730|  97.5k|    psDifSegs = &sDifSegs[DIFL_F][DIFS_q_CHARGE];
  731|  97.5k|    if (i1 && !i1->bDeleted)
  ------------------
  |  Branch (731:9): [True: 97.5k, False: 0]
  |  Branch (731:15): [True: 97.5k, False: 6]
  ------------------
  732|  97.5k|    {
  733|  97.5k|        if (i1->nTotalCharge)
  ------------------
  |  Branch (733:13): [True: 253, False: 97.2k]
  ------------------
  734|    253|        {
  735|    253|            sDifSegs[DIFL_M][DIFS_q_CHARGE] |= DIFV_NEQ2PRECED;
  736|    253|        }
  737|  97.2k|        else
  738|  97.2k|        {
  739|  97.2k|            sDifSegs[DIFL_M][DIFS_q_CHARGE] |= DIFV_BOTH_EMPTY;
  740|  97.2k|        }
  741|  97.5k|        if (i2 && !i2->bDeleted)
  ------------------
  |  Branch (741:13): [True: 0, False: 97.5k]
  |  Branch (741:19): [True: 0, False: 0]
  ------------------
  742|      0|        {
  743|      0|            if (i1->nTotalCharge)
  ------------------
  |  Branch (743:17): [True: 0, False: 0]
  ------------------
  744|      0|            {
  745|      0|                if (i1->nTotalCharge == i2->nTotalCharge)
  ------------------
  |  Branch (745:21): [True: 0, False: 0]
  ------------------
  746|      0|                {
  747|      0|                    *psDifSegs |= DIFV_EQL2PRECED;
  748|      0|                }
  749|      0|                else
  750|      0|                {
  751|      0|                    if (i2->nTotalCharge)
  ------------------
  |  Branch (751:25): [True: 0, False: 0]
  ------------------
  752|      0|                    {
  753|      0|                        *psDifSegs |= DIFV_NEQ2PRECED;
  754|      0|                    }
  755|      0|                    else
  756|      0|                    {
  757|      0|                        *psDifSegs |= DIFV_IS_EMPTY;
  758|      0|                    }
  759|      0|                }
  760|      0|            }
  761|      0|            else
  762|      0|            {
  763|      0|                if (i2->nTotalCharge)
  ------------------
  |  Branch (763:21): [True: 0, False: 0]
  ------------------
  764|      0|                {
  765|      0|                    *psDifSegs |= DIFV_NEQ2PRECED;
  766|      0|                }
  767|      0|                else
  768|      0|                {
  769|      0|                    *psDifSegs |= DIFV_BOTH_EMPTY;
  770|      0|                }
  771|      0|            }
  772|      0|        }
  773|  97.5k|        else
  774|  97.5k|        {
  775|  97.5k|            if (!i2)
  ------------------
  |  Branch (775:17): [True: 97.5k, False: 0]
  ------------------
  776|  97.5k|            {
  777|  97.5k|                if (bFixTranspChargeBug == 1)
  ------------------
  |  Branch (777:21): [True: 97.5k, False: 0]
  ------------------
  778|  97.5k|                {
  779|       |                    /* bug explanation:
  780|       |
  781|       |                    component #1 is tautomeric, component #2 is not
  782|       |                    Mobile-H(#2) > Mobile-H(#1)
  783|       |                    Fixed-H(#2) = Mobile-H(#2) < Fixed-H(#1)
  784|       |
  785|       |                    Layer       first_charge   second_charge
  786|       |
  787|       |                    Mobile-H    0    (comp#1)  -1 (comp#2)
  788|       |                    Fixed-H     none (comp#2)  -1 (comp#1)
  789|       |
  790|       |                    v1.01 charge compared decided that charge layers are same and omitted Fixed-H /q layer
  791|       |
  792|       |                    Solution: when component permutation is detected AND fixed-H component does not exist,
  793|       |                    compare Mobile-H charge [0 (comp#1) in the example] to the charge of Mobile-H [-1 (comp#2)]
  794|       |                    of the component that has none Fixed-H charge
  795|       |                    */
  796|       |
  797|       |                    /* Fixed-H i2 is empty because Fixed-H struct is same as Mobile-H */
  798|  97.5k|                    if (p1->ord_number != p2->ord_number && /* component order in Fixed-H is different from Mobile-H */
  ------------------
  |  Branch (798:25): [True: 0, False: 97.5k]
  ------------------
  799|      0|                        n1 == TAUT_YES && p2->pINChI[TAUT_YES] && !p2->pINChI[TAUT_YES]->bDeleted &&
  ------------------
  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                      n1 == TAUT_YES && p2->pINChI[TAUT_YES] && !p2->pINChI[TAUT_YES]->bDeleted &&
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                      n1 == TAUT_YES && p2->pINChI[TAUT_YES] && !p2->pINChI[TAUT_YES]->bDeleted &&
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (799:25): [True: 0, False: 0]
  |  Branch (799:43): [True: 0, False: 0]
  |  Branch (799:67): [True: 0, False: 0]
  ------------------
  800|      0|                        p2->pINChI[TAUT_YES]->nNumberOfAtoms)
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (800:25): [True: 0, False: 0]
  ------------------
  801|      0|                    {
  802|      0|                        int i2_nTotalCharge = p2->pINChI[TAUT_YES]->nTotalCharge;
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  803|       |
  804|      0|                        if (i1->nTotalCharge)
  ------------------
  |  Branch (804:29): [True: 0, False: 0]
  ------------------
  805|      0|                        {
  806|      0|                            if (i1->nTotalCharge == i2_nTotalCharge)
  ------------------
  |  Branch (806:33): [True: 0, False: 0]
  ------------------
  807|      0|                            {
  808|      0|                                *psDifSegs |= DIFV_EQL2PRECED;
  809|      0|                            }
  810|      0|                            else
  811|      0|                            {
  812|      0|                                if (i2_nTotalCharge)
  ------------------
  |  Branch (812:37): [True: 0, False: 0]
  ------------------
  813|      0|                                {
  814|      0|                                    *psDifSegs |= DIFV_NEQ2PRECED;
  815|      0|                                }
  816|      0|                                else
  817|      0|                                {
  818|      0|                                    *psDifSegs |= DIFV_IS_EMPTY;
  819|      0|                                }
  820|      0|                            }
  821|      0|                        }
  822|      0|                        else
  823|      0|                        {
  824|      0|                            if (i2_nTotalCharge)
  ------------------
  |  Branch (824:33): [True: 0, False: 0]
  ------------------
  825|      0|                            {
  826|      0|                                *psDifSegs |= DIFV_NEQ2PRECED;
  827|      0|                            }
  828|      0|                            else
  829|      0|                            {
  830|      0|                                *psDifSegs |= DIFV_BOTH_EMPTY;
  831|      0|                            }
  832|      0|                        }
  833|      0|                    }
  834|  97.5k|                    else
  835|  97.5k|                    {
  836|  97.5k|                        *psDifSegs |= i1->nTotalCharge ? DIFV_EQL2PRECED : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (836:39): [True: 253, False: 97.2k]
  ------------------
  837|  97.5k|                    }
  838|  97.5k|                }
  839|      0|                else /* if (bFixTranspChargeBug==1) */
  840|      0|                {
  841|      0|                    *psDifSegs |= i1->nTotalCharge ? DIFV_EQL2PRECED : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (841:35): [True: 0, False: 0]
  ------------------
  842|      0|                }
  843|  97.5k|            }
  844|      0|            else /* if ( !i2 ) { */
  845|      0|            {
  846|       |                /* i2 && i2->bDeleted */
  847|      0|                *psDifSegs |= i1->nTotalCharge ? DIFV_IS_EMPTY : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (847:31): [True: 0, False: 0]
  ------------------
  848|      0|            }
  849|  97.5k|        }
  850|  97.5k|    }
  851|      6|    else
  852|      6|    {
  853|      6|        sDifSegs[DIFL_M][DIFS_q_CHARGE] |= DIFV_BOTH_EMPTY;
  854|      6|        if (i2 && !i2->bDeleted)
  ------------------
  |  Branch (854:13): [True: 0, False: 6]
  |  Branch (854:19): [True: 0, False: 0]
  ------------------
  855|      0|        {
  856|      0|            if (i2->nTotalCharge)
  ------------------
  |  Branch (856:17): [True: 0, False: 0]
  ------------------
  857|      0|            {
  858|      0|                sDifSegs[DIFL_F][DIFS_q_CHARGE] |= DIFV_NEQ2PRECED;
  859|      0|            }
  860|      0|            else
  861|      0|            {
  862|      0|                sDifSegs[DIFL_F][DIFS_q_CHARGE] |= DIFV_BOTH_EMPTY;
  863|      0|            }
  864|      0|        }
  865|      6|    }
  866|       |
  867|       |
  868|       |    /*************** stereo *****************/
  869|       |
  870|  97.5k|    if (i1 && !i1->bDeleted)
  ------------------
  |  Branch (870:9): [True: 97.5k, False: 0]
  |  Branch (870:15): [True: 97.5k, False: 6]
  ------------------
  871|  97.5k|    {
  872|  97.5k|        Stereo1 = i1->Stereo;
  873|  97.5k|        IsoStereo1 = i1->StereoIsotopic;
  874|  97.5k|    }
  875|      6|    else
  876|      6|    {
  877|      6|        Stereo1 = NULL;
  878|      6|        IsoStereo1 = NULL;
  879|      6|    }
  880|  97.5k|    if (i2 && !i2->bDeleted)
  ------------------
  |  Branch (880:9): [True: 0, False: 97.5k]
  |  Branch (880:15): [True: 0, False: 0]
  ------------------
  881|      0|    {
  882|      0|        Stereo2 = i2->Stereo;
  883|      0|        IsoStereo2 = i2->StereoIsotopic;
  884|      0|    }
  885|  97.5k|    else
  886|  97.5k|    {
  887|  97.5k|        Stereo2 = NULL;
  888|  97.5k|        IsoStereo2 = NULL;
  889|  97.5k|    }
  890|       |
  891|       |    /*=====================*/
  892|       |    /*====     /b    ======*/
  893|       |    /*=====================*/
  894|       |    /* M double bond stereo */
  895|  97.5k|    psDifSegs = &sDifSegs[DIFL_M][DIFS_b_SBONDS];
  896|  97.5k|    if (Stereo1 && Stereo1->nNumberOfStereoBonds)
  ------------------
  |  Branch (896:9): [True: 10.0k, False: 87.5k]
  |  Branch (896:20): [True: 411, False: 9.59k]
  ------------------
  897|    411|    {
  898|    411|        *psDifSegs |= DIFV_NEQ2PRECED;
  899|    411|    }
  900|  97.0k|    else
  901|  97.0k|    {
  902|  97.0k|        *psDifSegs |= DIFV_BOTH_EMPTY;
  903|  97.0k|    }
  904|       |    /* F double bond stereo */
  905|  97.5k|    psDifSegs = &sDifSegs[DIFL_F][DIFS_b_SBONDS];
  906|  97.5k|    if (Stereo2 && Stereo2->nNumberOfStereoBonds)
  ------------------
  |  Branch (906:9): [True: 0, False: 97.5k]
  |  Branch (906:20): [True: 0, False: 0]
  ------------------
  907|      0|    {
  908|      0|        if (Stereo1 && Stereo1->nNumberOfStereoBonds)
  ------------------
  |  Branch (908:13): [True: 0, False: 0]
  |  Branch (908:24): [True: 0, False: 0]
  ------------------
  909|      0|        {
  910|      0|            if (Eql_INChI_Stereo(Stereo1, EQL_SP2, Stereo2, EQL_SP2, 0))
  ------------------
  |  |  477|      0|#define EQL_SP2 8
  ------------------
                          if (Eql_INChI_Stereo(Stereo1, EQL_SP2, Stereo2, EQL_SP2, 0))
  ------------------
  |  |  477|      0|#define EQL_SP2 8
  ------------------
  |  Branch (910:17): [True: 0, False: 0]
  ------------------
  911|      0|            {
  912|      0|                *psDifSegs |= DIFV_EQL2PRECED;
  913|      0|            }
  914|      0|            else
  915|      0|            {
  916|      0|                *psDifSegs |= DIFV_NEQ2PRECED;
  917|      0|            }
  918|      0|        }
  919|      0|        else
  920|      0|        {
  921|      0|            *psDifSegs |= DIFV_NEQ2PRECED;
  922|      0|        }
  923|      0|    }
  924|  97.5k|    else
  925|  97.5k|    {
  926|  97.5k|        if (Stereo1 && Stereo1->nNumberOfStereoBonds)
  ------------------
  |  Branch (926:13): [True: 10.0k, False: 87.5k]
  |  Branch (926:24): [True: 411, False: 9.59k]
  ------------------
  927|    411|        {
  928|    411|            *psDifSegs |= i2 ? DIFV_IS_EMPTY : DIFV_EQL2PRECED;
  ------------------
  |  Branch (928:27): [True: 0, False: 411]
  ------------------
  929|    411|        }
  930|  97.0k|        else
  931|  97.0k|        {
  932|  97.0k|            *psDifSegs |= DIFV_BOTH_EMPTY;
  933|  97.0k|        }
  934|  97.5k|    }
  935|       |
  936|       |    /* MI double bond stereo */
  937|  97.5k|    psDifSegs = &sDifSegs[DIFL_MI][DIFS_b_SBONDS];
  938|  97.5k|    if (IsoStereo1 && IsoStereo1->nNumberOfStereoBonds)
  ------------------
  |  Branch (938:9): [True: 320, False: 97.1k]
  |  Branch (938:23): [True: 81, False: 239]
  ------------------
  939|     81|    {
  940|     81|        if (Eql_INChI_Stereo(IsoStereo1, EQL_SP2, Stereo1, EQL_SP2, 0))
  ------------------
  |  |  477|     81|#define EQL_SP2 8
  ------------------
                      if (Eql_INChI_Stereo(IsoStereo1, EQL_SP2, Stereo1, EQL_SP2, 0))
  ------------------
  |  |  477|     81|#define EQL_SP2 8
  ------------------
  |  Branch (940:13): [True: 41, False: 40]
  ------------------
  941|     41|        {
  942|     41|            *psDifSegs |= DIFV_EQL2PRECED;
  943|     41|        }
  944|     40|        else
  945|     40|        {
  946|     40|            *psDifSegs |= DIFV_NEQ2PRECED;
  947|     40|        }
  948|     81|    }
  949|  97.4k|    else
  950|  97.4k|    {
  951|  97.4k|        if (Stereo1 && Stereo1->nNumberOfStereoBonds)
  ------------------
  |  Branch (951:13): [True: 9.96k, False: 87.4k]
  |  Branch (951:24): [True: 368, False: 9.59k]
  ------------------
  952|    368|        {
  953|    368|            *psDifSegs |= DIFV_EQL2PRECED; /* isotopic is missing because there is no isotopes */
  954|    368|        }
  955|  97.0k|        else
  956|  97.0k|        {
  957|  97.0k|            *psDifSegs |= DIFV_BOTH_EMPTY;
  958|  97.0k|        }
  959|  97.4k|    }
  960|       |
  961|       |    /* FI double bond stereo */
  962|  97.5k|    psDifSegs = &sDifSegs[DIFL_FI][DIFS_b_SBONDS];
  963|  97.5k|    if (IsoStereo2 && IsoStereo2->nNumberOfStereoBonds)
  ------------------
  |  Branch (963:9): [True: 0, False: 97.5k]
  |  Branch (963:23): [True: 0, False: 0]
  ------------------
  964|      0|    {
  965|      0|        if (Eql_INChI_Stereo(IsoStereo2, EQL_SP2, Stereo2, EQL_SP2, 0))
  ------------------
  |  |  477|      0|#define EQL_SP2 8
  ------------------
                      if (Eql_INChI_Stereo(IsoStereo2, EQL_SP2, Stereo2, EQL_SP2, 0))
  ------------------
  |  |  477|      0|#define EQL_SP2 8
  ------------------
  |  Branch (965:13): [True: 0, False: 0]
  ------------------
  966|      0|        {
  967|      0|            *psDifSegs |= DIFV_EQL2PRECED;
  968|      0|        }
  969|      0|        else
  970|      0|        {
  971|      0|            if (!(Stereo1 && Stereo1->nNumberOfStereoBonds) &&
  ------------------
  |  Branch (971:19): [True: 0, False: 0]
  |  Branch (971:30): [True: 0, False: 0]
  ------------------
  972|      0|                !(Stereo2 && Stereo2->nNumberOfStereoBonds) &&
  ------------------
  |  Branch (972:19): [True: 0, False: 0]
  |  Branch (972:30): [True: 0, False: 0]
  ------------------
  973|      0|                Eql_INChI_Stereo(IsoStereo2, EQL_SP2, IsoStereo1, EQL_SP2, 0))
  ------------------
  |  |  477|      0|#define EQL_SP2 8
  ------------------
                              Eql_INChI_Stereo(IsoStereo2, EQL_SP2, IsoStereo1, EQL_SP2, 0))
  ------------------
  |  |  477|      0|#define EQL_SP2 8
  ------------------
  |  Branch (973:17): [True: 0, False: 0]
  ------------------
  974|      0|            {
  975|      0|                *psDifSegs |= DIFV_FI_EQ_MI;
  976|      0|            }
  977|      0|            else
  978|      0|            {
  979|      0|                *psDifSegs |= DIFV_NEQ2PRECED;
  980|      0|            }
  981|      0|        }
  982|      0|    }
  983|  97.5k|    else
  984|  97.5k|    {
  985|       |        /* the solution table for FI stereo,
  986|       |           in case of FI stereo is empty
  987|       |           E = segment is empty, NE = not empty
  988|       |           +==============================+
  989|       |           | M   | MI  | F   |  result    |
  990|       |           +=====+=====+=====+============+
  991|       |           | E   | E   | E   | both empty |
  992|       |           +-----+-----+-----+------------+
  993|       |           | NE  | E   | E   | both empty |
  994|       |           +-----+-----+-----+------------+
  995|       |           | E   | NE  | E   | is empty   |
  996|       |           +-----+-----+-----+------------+
  997|       |           | NE  | NE  | E   | both empty |
  998|       |           +-----+-----+-----+------------+
  999|       |           | E   | E   | NE  | is empty   |
 1000|       |           +-----+-----+-----+------------+
 1001|       |           | NE  | E   | NE  | is empty   |
 1002|       |           +-----+-----+-----+------------+
 1003|       |           | E   | NE  | NE  | is empty   |
 1004|       |           +-----+-----+-----+------------+
 1005|       |           | NE  | NE  | ME  | is empty   |
 1006|       |           +==============================+
 1007|       |        */
 1008|  97.5k|        if (Stereo2 && Stereo2->nNumberOfStereoBonds)
  ------------------
  |  Branch (1008:13): [True: 0, False: 97.5k]
  |  Branch (1008:24): [True: 0, False: 0]
  ------------------
 1009|      0|        {
 1010|      0|            *psDifSegs |= DIFV_EQL2PRECED; /* isotopic is missing because there is no isotopes */
 1011|      0|        }
 1012|  97.5k|        else
 1013|  97.5k|            if (IsoStereo1 && IsoStereo1->nNumberOfStereoBonds &&
  ------------------
  |  Branch (1013:17): [True: 320, False: 97.1k]
  |  Branch (1013:31): [True: 81, False: 239]
  ------------------
 1014|     81|                !(Stereo1 && Stereo1->nNumberOfStereoBonds)
  ------------------
  |  Branch (1014:19): [True: 43, False: 38]
  |  Branch (1014:30): [True: 43, False: 0]
  ------------------
 1015|  97.5k|                )
 1016|     38|            {
 1017|     38|                *psDifSegs |= i2 ? DIFV_IS_EMPTY : DIFV_EQL2PRECED;
  ------------------
  |  Branch (1017:31): [True: 0, False: 38]
  ------------------
 1018|     38|            }
 1019|  97.4k|            else
 1020|  97.4k|            {
 1021|  97.4k|                *psDifSegs |= DIFV_BOTH_EMPTY;
 1022|  97.4k|            }
 1023|  97.5k|    }
 1024|       |
 1025|       |    /*==================================*/
 1026|       |    /*====     /t, /m, /s for M   ======*/
 1027|       |    /*==================================*/
 1028|       |    /* M sp3 stereo */
 1029|  97.5k|    bRelRac[DIFL_M] = GetSp3RelRacAbs(i1, Stereo1);       /* Mobile-H */
 1030|  97.5k|    bRelRac[DIFL_MI] = GetSp3RelRacAbs(i1, IsoStereo1);
 1031|  97.5k|    bRelRac[DIFL_F] = GetSp3RelRacAbs(i2, Stereo2);       /* Fixed-H */
 1032|  97.5k|    bRelRac[DIFL_FI] = GetSp3RelRacAbs(i2, IsoStereo2);
 1033|  97.5k|    if (SP3_NONE != bRelRac[DIFL_M])
  ------------------
  |  Branch (1033:9): [True: 382, False: 97.1k]
  ------------------
 1034|    382|    {
 1035|    382|        sDifSegs[DIFL_M][DIFS_t_SATOMS] |= (bRelRac[DIFL_M] & SP3_ANY) ? DIFV_NEQ2PRECED : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (1035:44): [True: 382, False: 0]
  ------------------
 1036|    382|        sDifSegs[DIFL_M][DIFS_m_SP3INV] |= (bRelRac[DIFL_M] & SP3_ABS) ? DIFV_NEQ2PRECED : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (1036:44): [True: 3, False: 379]
  ------------------
 1037|    382|        sDifSegs[DIFL_M][DIFS_s_STYPE] |= (bRelRac[DIFL_M] & SP3_TYPE) ? DIFV_NEQ2PRECED : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (1037:43): [True: 15, False: 367]
  ------------------
 1038|    382|    }
 1039|  97.1k|    else
 1040|  97.1k|    {
 1041|  97.1k|        sDifSegs[DIFL_M][DIFS_t_SATOMS] |= DIFV_BOTH_EMPTY;
 1042|  97.1k|        sDifSegs[DIFL_M][DIFS_m_SP3INV] |= DIFV_BOTH_EMPTY;
 1043|  97.1k|        sDifSegs[DIFL_M][DIFS_s_STYPE] |= DIFV_BOTH_EMPTY;
 1044|  97.1k|    }
 1045|       |
 1046|       |    /*=====================*/
 1047|       |    /*====     /t    ======*/
 1048|       |    /*=====================*/
 1049|       |    /* F sp3 stereo */
 1050|  97.5k|    psDifSegs = &sDifSegs[DIFL_F][DIFS_t_SATOMS];
 1051|  97.5k|    if (SP3_ANY & bRelRac[DIFL_F])
  ------------------
  |  Branch (1051:9): [True: 0, False: 97.5k]
  ------------------
 1052|      0|    {
 1053|      0|        if (Eql_INChI_Stereo(Stereo2, EQL_SP3, Stereo1, EQL_SP3, 0))
  ------------------
  |  |  475|      0|#define EQL_SP3 2
  ------------------
                      if (Eql_INChI_Stereo(Stereo2, EQL_SP3, Stereo1, EQL_SP3, 0))
  ------------------
  |  |  475|      0|#define EQL_SP3 2
  ------------------
  |  Branch (1053:13): [True: 0, False: 0]
  ------------------
 1054|      0|        {
 1055|      0|            *psDifSegs |= DIFV_EQL2PRECED;
 1056|      0|        }
 1057|      0|        else
 1058|      0|        {
 1059|      0|            *psDifSegs |= DIFV_NEQ2PRECED;
 1060|      0|        }
 1061|      0|    }
 1062|  97.5k|    else
 1063|  97.5k|    {
 1064|  97.5k|        if (SP3_ANY & bRelRac[DIFL_M])
  ------------------
  |  Branch (1064:13): [True: 382, False: 97.1k]
  ------------------
 1065|    382|        {
 1066|    382|            *psDifSegs |= i2 ? DIFV_IS_EMPTY : DIFV_EQL2PRECED;
  ------------------
  |  Branch (1066:27): [True: 0, False: 382]
  ------------------
 1067|    382|        }
 1068|  97.1k|        else
 1069|  97.1k|        {
 1070|  97.1k|            *psDifSegs |= DIFV_BOTH_EMPTY;
 1071|  97.1k|        }
 1072|  97.5k|    }
 1073|       |
 1074|       |    /* MI sp3 stereo */
 1075|  97.5k|    psDifSegs = &sDifSegs[DIFL_MI][DIFS_t_SATOMS];
 1076|  97.5k|    if (SP3_ANY & bRelRac[DIFL_MI])
  ------------------
  |  Branch (1076:9): [True: 126, False: 97.3k]
  ------------------
 1077|    126|    {
 1078|    126|        if (Eql_INChI_Stereo(IsoStereo1, EQL_SP3, Stereo1, EQL_SP3, 0))
  ------------------
  |  |  475|    126|#define EQL_SP3 2
  ------------------
                      if (Eql_INChI_Stereo(IsoStereo1, EQL_SP3, Stereo1, EQL_SP3, 0))
  ------------------
  |  |  475|    126|#define EQL_SP3 2
  ------------------
  |  Branch (1078:13): [True: 47, False: 79]
  ------------------
 1079|     47|        {
 1080|     47|            *psDifSegs |= DIFV_EQL2PRECED;
 1081|     47|        }
 1082|     79|        else
 1083|     79|        {
 1084|     79|            *psDifSegs |= DIFV_NEQ2PRECED;
 1085|     79|        }
 1086|    126|    }
 1087|  97.3k|    else
 1088|  97.3k|    {
 1089|  97.3k|        if (SP3_ANY & bRelRac[DIFL_M])
  ------------------
  |  Branch (1089:13): [True: 324, False: 97.0k]
  ------------------
 1090|    324|        {
 1091|    324|            *psDifSegs |= DIFV_EQL2PRECED; /* isotopic is missing because there is no isotopes */
 1092|    324|        }
 1093|  97.0k|        else
 1094|  97.0k|        {
 1095|  97.0k|            *psDifSegs |= DIFV_BOTH_EMPTY;
 1096|  97.0k|        }
 1097|  97.3k|    }
 1098|       |
 1099|       |    /* FI sp3 stereo */
 1100|  97.5k|    psDifSegs = &sDifSegs[DIFL_FI][DIFS_t_SATOMS];
 1101|  97.5k|    if (SP3_ANY & bRelRac[DIFL_FI])
  ------------------
  |  Branch (1101:9): [True: 0, False: 97.5k]
  ------------------
 1102|      0|    {
 1103|      0|        if (Eql_INChI_Stereo(IsoStereo2, EQL_SP3, Stereo2, EQL_SP3, 0))
  ------------------
  |  |  475|      0|#define EQL_SP3 2
  ------------------
                      if (Eql_INChI_Stereo(IsoStereo2, EQL_SP3, Stereo2, EQL_SP3, 0))
  ------------------
  |  |  475|      0|#define EQL_SP3 2
  ------------------
  |  Branch (1103:13): [True: 0, False: 0]
  ------------------
 1104|      0|        {
 1105|      0|            *psDifSegs |= DIFV_EQL2PRECED;
 1106|      0|        }
 1107|      0|        else
 1108|      0|        {
 1109|      0|            if (!(SP3_ANY & bRelRac[DIFL_M]) &&
  ------------------
  |  Branch (1109:17): [True: 0, False: 0]
  ------------------
 1110|      0|                !(SP3_ANY & bRelRac[DIFL_F]) &&
  ------------------
  |  Branch (1110:17): [True: 0, False: 0]
  ------------------
 1111|      0|                Eql_INChI_Stereo(IsoStereo2, EQL_SP3, IsoStereo1, EQL_SP3, 0))
  ------------------
  |  |  475|      0|#define EQL_SP3 2
  ------------------
                              Eql_INChI_Stereo(IsoStereo2, EQL_SP3, IsoStereo1, EQL_SP3, 0))
  ------------------
  |  |  475|      0|#define EQL_SP3 2
  ------------------
  |  Branch (1111:17): [True: 0, False: 0]
  ------------------
 1112|      0|            {
 1113|      0|                *psDifSegs |= DIFV_FI_EQ_MI;
 1114|      0|            }
 1115|      0|            else
 1116|      0|            {
 1117|      0|                *psDifSegs |= DIFV_NEQ2PRECED;
 1118|      0|            }
 1119|      0|        }
 1120|      0|    }
 1121|  97.5k|    else /* similar to /b */
 1122|  97.5k|        if ((SP3_ANY & bRelRac[DIFL_F]))
  ------------------
  |  Branch (1122:13): [True: 0, False: 97.5k]
  ------------------
 1123|      0|        {
 1124|      0|            *psDifSegs |= DIFV_EQL2PRECED; /* isotopic is missing because there is no isotopes */
 1125|      0|        }
 1126|  97.5k|        else
 1127|  97.5k|        {
 1128|  97.5k|            if ((SP3_ANY & bRelRac[DIFL_MI]) && !(SP3_ANY & bRelRac[DIFL_M]))
  ------------------
  |  Branch (1128:17): [True: 126, False: 97.3k]
  |  Branch (1128:49): [True: 68, False: 58]
  ------------------
 1129|     68|            {
 1130|     68|                *psDifSegs |= i2 ? DIFV_IS_EMPTY : DIFV_EQL2PRECED;
  ------------------
  |  Branch (1130:31): [True: 0, False: 68]
  ------------------
 1131|     68|            }
 1132|  97.4k|            else
 1133|  97.4k|            {
 1134|  97.4k|                *psDifSegs |= DIFV_BOTH_EMPTY;
 1135|  97.4k|            }
 1136|  97.5k|        }
 1137|       |
 1138|       |    /*=====================*/
 1139|       |    /*====     /m    ======*/
 1140|       |    /*=====================*/
 1141|       |    /* F sp3 abs stereo inversion */
 1142|  97.5k|    psDifSegs = &sDifSegs[DIFL_F][DIFS_m_SP3INV];
 1143|  97.5k|    if (bRelRac[DIFL_F] & SP3_ABS)
  ------------------
  |  Branch (1143:9): [True: 0, False: 97.5k]
  ------------------
 1144|      0|    {
 1145|       |        /* the order of || operands below is critically important: || is not a commutative operation */
 1146|      0|        if (!(bRelRac[DIFL_M] & SP3_ABS) || Stereo2->nCompInv2Abs != Stereo1->nCompInv2Abs)
  ------------------
  |  Branch (1146:13): [True: 0, False: 0]
  |  Branch (1146:45): [True: 0, False: 0]
  ------------------
 1147|      0|        {
 1148|      0|            *psDifSegs |= DIFV_NEQ2PRECED;
 1149|      0|        }
 1150|      0|        else
 1151|      0|        {
 1152|      0|            *psDifSegs |= DIFV_EQL2PRECED;
 1153|      0|        }
 1154|      0|    }
 1155|  97.5k|    else
 1156|  97.5k|    {
 1157|  97.5k|        if (bRelRac[DIFL_M] & SP3_ABS)
  ------------------
  |  Branch (1157:13): [True: 3, False: 97.5k]
  ------------------
 1158|      3|        {
 1159|      3|            *psDifSegs |= i2 ? DIFV_IS_EMPTY : DIFV_EQL2PRECED;
  ------------------
  |  Branch (1159:27): [True: 0, False: 3]
  ------------------
 1160|      3|        }
 1161|  97.5k|        else
 1162|  97.5k|        {
 1163|  97.5k|            *psDifSegs |= DIFV_BOTH_EMPTY;
 1164|  97.5k|        }
 1165|  97.5k|    }
 1166|       |
 1167|       |    /* MI sp3 abs stereo inversion */
 1168|  97.5k|    psDifSegs = &sDifSegs[DIFL_MI][DIFS_m_SP3INV];
 1169|  97.5k|    if (SP3_ABS & bRelRac[DIFL_MI])
  ------------------
  |  Branch (1169:9): [True: 2, False: 97.5k]
  ------------------
 1170|      2|    {
 1171|      2|        if ((SP3_ABS & bRelRac[DIFL_M]) && IsoStereo1->nCompInv2Abs == Stereo1->nCompInv2Abs)
  ------------------
  |  Branch (1171:13): [True: 0, False: 2]
  |  Branch (1171:44): [True: 0, False: 0]
  ------------------
 1172|      0|        {
 1173|      0|            *psDifSegs |= DIFV_EQL2PRECED;
 1174|      0|        }
 1175|      2|        else
 1176|      2|        {
 1177|      2|            *psDifSegs |= DIFV_NEQ2PRECED;
 1178|      2|        }
 1179|      2|    }
 1180|  97.5k|    else
 1181|  97.5k|    {
 1182|  97.5k|        if (SP3_ABS & bRelRac[DIFL_M])
  ------------------
  |  Branch (1182:13): [True: 3, False: 97.5k]
  ------------------
 1183|      3|        {
 1184|      3|            *psDifSegs |= DIFV_EQL2PRECED; /* isotopic is missing because there is no isotopes */
 1185|      3|        }
 1186|  97.5k|        else
 1187|  97.5k|        {
 1188|  97.5k|            *psDifSegs |= DIFV_BOTH_EMPTY;
 1189|  97.5k|        }
 1190|  97.5k|    }
 1191|       |
 1192|       |    /* FI sp3 abs stereo inversion */
 1193|  97.5k|    psDifSegs = &sDifSegs[DIFL_FI][DIFS_m_SP3INV];
 1194|  97.5k|    if (SP3_ABS & bRelRac[DIFL_FI])
  ------------------
  |  Branch (1194:9): [True: 0, False: 97.5k]
  ------------------
 1195|      0|    {
 1196|      0|        if ((SP3_ABS & bRelRac[DIFL_F]) && IsoStereo2->nCompInv2Abs == Stereo2->nCompInv2Abs)
  ------------------
  |  Branch (1196:13): [True: 0, False: 0]
  |  Branch (1196:44): [True: 0, False: 0]
  ------------------
 1197|      0|        {
 1198|      0|            *psDifSegs |= DIFV_EQL2PRECED;
 1199|      0|        }
 1200|      0|        else
 1201|      0|        {
 1202|      0|            if (!(SP3_ABS & bRelRac[DIFL_M]) &&
  ------------------
  |  Branch (1202:17): [True: 0, False: 0]
  ------------------
 1203|      0|                !(SP3_ABS & bRelRac[DIFL_F]) &&
  ------------------
  |  Branch (1203:17): [True: 0, False: 0]
  ------------------
 1204|      0|                (SP3_ABS & bRelRac[DIFL_MI]) && /* make sure IsoStereo1 != NULL */
  ------------------
  |  Branch (1204:17): [True: 0, False: 0]
  ------------------
 1205|      0|                IsoStereo2->nCompInv2Abs == IsoStereo1->nCompInv2Abs)
  ------------------
  |  Branch (1205:17): [True: 0, False: 0]
  ------------------
 1206|      0|            {
 1207|      0|                *psDifSegs |= DIFV_FI_EQ_MI;
 1208|      0|            }
 1209|      0|            else
 1210|      0|            {
 1211|      0|                *psDifSegs |= DIFV_NEQ2PRECED;
 1212|      0|            }
 1213|      0|        }
 1214|      0|    }
 1215|       |
 1216|  97.5k|    else
 1217|  97.5k|    {
 1218|       |        /* similar to /b */
 1219|       |        /* the order of || operands below is critically important: || is no a commutative operation */
 1220|  97.5k|        if ((SP3_ABS & bRelRac[DIFL_F]))
  ------------------
  |  Branch (1220:13): [True: 0, False: 97.5k]
  ------------------
 1221|      0|        {
 1222|      0|            *psDifSegs |= DIFV_EQL2PRECED; /* isotopic is missing because there is no isotopes */
 1223|      0|        }
 1224|  97.5k|        else
 1225|  97.5k|        {
 1226|  97.5k|            if ((SP3_ABS & bRelRac[DIFL_MI]) && !(SP3_ABS & bRelRac[DIFL_M]))
  ------------------
  |  Branch (1226:17): [True: 2, False: 97.5k]
  |  Branch (1226:49): [True: 2, False: 0]
  ------------------
 1227|      2|            {
 1228|      2|                *psDifSegs |= i2 ? DIFV_IS_EMPTY : DIFV_EQL2PRECED;
  ------------------
  |  Branch (1228:31): [True: 0, False: 2]
  ------------------
 1229|      2|            }
 1230|  97.5k|            else
 1231|  97.5k|            {
 1232|  97.5k|                *psDifSegs |= DIFV_BOTH_EMPTY;
 1233|  97.5k|            }
 1234|  97.5k|        }
 1235|  97.5k|    }
 1236|       |
 1237|       |    /*=====================*/
 1238|       |    /*====     /s    ======*/
 1239|       |    /*=====================*/
 1240|       |    /* F sp3 stereo type */
 1241|  97.5k|    psDifSegs = &sDifSegs[DIFL_F][DIFS_s_STYPE];
 1242|  97.5k|    if (bRelRac[DIFL_F] & SP3_TYPE)
  ------------------
  |  Branch (1242:9): [True: 0, False: 97.5k]
  ------------------
 1243|      0|    {
 1244|      0|        if ((bRelRac[DIFL_F] & SP3_TYPE) == (bRelRac[DIFL_M] & SP3_TYPE))
  ------------------
  |  Branch (1244:13): [True: 0, False: 0]
  ------------------
 1245|      0|        {
 1246|      0|            *psDifSegs |= DIFV_EQL2PRECED;
 1247|      0|        }
 1248|      0|        else
 1249|      0|        {
 1250|      0|            *psDifSegs |= DIFV_NEQ2PRECED;
 1251|      0|        }
 1252|      0|    }
 1253|  97.5k|    else
 1254|  97.5k|    {
 1255|  97.5k|        if (bRelRac[DIFL_M] & SP3_TYPE)
  ------------------
  |  Branch (1255:13): [True: 15, False: 97.4k]
  ------------------
 1256|     15|        {
 1257|     15|            *psDifSegs |= i2 ? DIFV_IS_EMPTY : DIFV_EQL2PRECED;
  ------------------
  |  Branch (1257:27): [True: 0, False: 15]
  ------------------
 1258|     15|        }
 1259|  97.4k|        else
 1260|  97.4k|        {
 1261|  97.4k|            *psDifSegs |= DIFV_BOTH_EMPTY;
 1262|  97.4k|        }
 1263|  97.5k|    }
 1264|       |
 1265|       |    /* MI sp3 stereo type */
 1266|  97.5k|    psDifSegs = &sDifSegs[DIFL_MI][DIFS_s_STYPE];
 1267|  97.5k|    if (SP3_TYPE & bRelRac[DIFL_MI])
  ------------------
  |  Branch (1267:9): [True: 26, False: 97.4k]
  ------------------
 1268|     26|    {
 1269|     26|        if ((SP3_TYPE & bRelRac[DIFL_MI]) == (SP3_TYPE & bRelRac[DIFL_M]))
  ------------------
  |  Branch (1269:13): [True: 0, False: 26]
  ------------------
 1270|      0|        {
 1271|      0|            *psDifSegs |= DIFV_EQL2PRECED;
 1272|      0|        }
 1273|     26|        else
 1274|     26|        {
 1275|     26|            *psDifSegs |= DIFV_NEQ2PRECED;
 1276|     26|        }
 1277|     26|    }
 1278|  97.4k|    else
 1279|  97.4k|    {
 1280|  97.4k|        if (SP3_TYPE & bRelRac[DIFL_M])
  ------------------
  |  Branch (1280:13): [True: 15, False: 97.4k]
  ------------------
 1281|     15|        {
 1282|     15|            *psDifSegs |= DIFV_EQL2PRECED; /* isotopic is missing because there is no isotopes */
 1283|     15|        }
 1284|  97.4k|        else
 1285|  97.4k|        {
 1286|  97.4k|            *psDifSegs |= DIFV_BOTH_EMPTY;
 1287|  97.4k|        }
 1288|  97.4k|    }
 1289|       |
 1290|       |    /* FI sp3 stereo type */
 1291|  97.5k|    psDifSegs = &sDifSegs[DIFL_FI][DIFS_s_STYPE];
 1292|  97.5k|    if (SP3_TYPE & bRelRac[DIFL_FI])
  ------------------
  |  Branch (1292:9): [True: 0, False: 97.5k]
  ------------------
 1293|      0|    {
 1294|      0|        if ((SP3_TYPE & bRelRac[DIFL_FI]) == (SP3_TYPE & bRelRac[DIFL_F]))
  ------------------
  |  Branch (1294:13): [True: 0, False: 0]
  ------------------
 1295|      0|        {
 1296|      0|            *psDifSegs |= DIFV_EQL2PRECED;
 1297|      0|        }
 1298|      0|        else
 1299|      0|        {
 1300|      0|            if (!(SP3_TYPE & bRelRac[DIFL_M]) &&
  ------------------
  |  Branch (1300:17): [True: 0, False: 0]
  ------------------
 1301|      0|                !(SP3_TYPE & bRelRac[DIFL_F]) &&
  ------------------
  |  Branch (1301:17): [True: 0, False: 0]
  ------------------
 1302|      0|                (SP3_TYPE & bRelRac[DIFL_MI]))
  ------------------
  |  Branch (1302:17): [True: 0, False: 0]
  ------------------
 1303|      0|            {
 1304|      0|                *psDifSegs |= DIFV_FI_EQ_MI;
 1305|      0|            }
 1306|      0|            else
 1307|      0|            {
 1308|      0|                *psDifSegs |= DIFV_NEQ2PRECED;
 1309|      0|            }
 1310|      0|        }
 1311|      0|    }
 1312|  97.5k|    else
 1313|  97.5k|    {
 1314|       |        /* similar to /b */
 1315|       |        /* the order of || operands below is critically important: || is not a commutative operation */
 1316|  97.5k|        if ((SP3_TYPE & bRelRac[DIFL_F]))
  ------------------
  |  Branch (1316:13): [True: 0, False: 97.5k]
  ------------------
 1317|      0|        {
 1318|      0|            *psDifSegs |= DIFV_EQL2PRECED; /* isotopic is missing because there is no isotopes */
 1319|      0|        }
 1320|  97.5k|        else
 1321|  97.5k|        {
 1322|  97.5k|            if ((SP3_TYPE & bRelRac[DIFL_MI]) && !(SP3_TYPE & bRelRac[DIFL_M]))
  ------------------
  |  Branch (1322:17): [True: 26, False: 97.4k]
  |  Branch (1322:50): [True: 26, False: 0]
  ------------------
 1323|     26|            {
 1324|     26|                *psDifSegs |= i2 ? DIFV_IS_EMPTY : DIFV_EQL2PRECED;
  ------------------
  |  Branch (1324:31): [True: 0, False: 26]
  ------------------
 1325|     26|            }
 1326|  97.4k|            else
 1327|  97.4k|            {
 1328|  97.4k|                *psDifSegs |= DIFV_BOTH_EMPTY;
 1329|  97.4k|            }
 1330|  97.5k|        }
 1331|  97.5k|    }
 1332|       |
 1333|       |    /*=====================*/
 1334|       |    /*====     /o    ======*/
 1335|       |    /*=====================*/
 1336|  97.5k|    if (p1 && p2 && p1->ord_number != p2->ord_number)
  ------------------
  |  Branch (1336:9): [True: 97.5k, False: 0]
  |  Branch (1336:15): [True: 97.5k, False: 0]
  |  Branch (1336:21): [True: 0, False: 97.5k]
  ------------------
 1337|      0|    {
 1338|      0|        sDifSegs[DIFL_F][DIFS_o_TRANSP] |= DIFV_NEQ2PRECED;
 1339|      0|    }
 1340|       |    /*=====================*/
 1341|       |    /*====     /i    ======*/
 1342|       |    /*=====================*/
 1343|       |
 1344|       |    /* M isotopic atoms */
 1345|  97.5k|    psDifSegs = &sDifSegs[DIFL_MI][DIFS_i_IATOMS];
 1346|  97.5k|    if (i1 && !i1->bDeleted && (i1->nNumberOfIsotopicAtoms || i1->nNumberOfIsotopicTGroups))
  ------------------
  |  Branch (1346:9): [True: 97.5k, False: 0]
  |  Branch (1346:15): [True: 97.5k, False: 6]
  |  Branch (1346:33): [True: 628, False: 96.8k]
  |  Branch (1346:63): [True: 0, False: 96.8k]
  ------------------
 1347|    628|    {
 1348|    628|        *psDifSegs |= DIFV_NEQ2PRECED;
 1349|    628|    }
 1350|  96.8k|    else
 1351|  96.8k|    {
 1352|  96.8k|        *psDifSegs |= DIFV_BOTH_EMPTY;
 1353|  96.8k|    }
 1354|       |    /* F isotopic atoms */
 1355|  97.5k|    psDifSegs = &sDifSegs[DIFL_FI][DIFS_i_IATOMS];
 1356|  97.5k|    if (i2 && !i2->bDeleted)
  ------------------
  |  Branch (1356:9): [True: 0, False: 97.5k]
  |  Branch (1356:15): [True: 0, False: 0]
  ------------------
 1357|      0|    {
 1358|      0|        if (i2->nNumberOfIsotopicAtoms || i2->nNumberOfIsotopicTGroups)
  ------------------
  |  Branch (1358:13): [True: 0, False: 0]
  |  Branch (1358:43): [True: 0, False: 0]
  ------------------
 1359|      0|        {
 1360|      0|            if (!i1 || i1->bDeleted ||
  ------------------
  |  Branch (1360:17): [True: 0, False: 0]
  |  Branch (1360:24): [True: 0, False: 0]
  ------------------
 1361|      0|                i2->nNumberOfIsotopicAtoms != i1->nNumberOfIsotopicAtoms ||
  ------------------
  |  Branch (1361:17): [True: 0, False: 0]
  ------------------
 1362|      0|                i2->nNumberOfIsotopicTGroups != i1->nNumberOfIsotopicTGroups)
  ------------------
  |  Branch (1362:17): [True: 0, False: 0]
  ------------------
 1363|      0|            {
 1364|      0|                *psDifSegs |= DIFV_NEQ2PRECED;
 1365|      0|            }
 1366|      0|            else
 1367|      0|            {
 1368|      0|                int diff;
 1369|      0|                num = i1->nNumberOfIsotopicAtoms;
 1370|      0|                diff = 0;
 1371|      0|                for (i = 0; i < num; i++)
  ------------------
  |  Branch (1371:29): [True: 0, False: 0]
  ------------------
 1372|      0|                {
 1373|       |                    /* compare isotopic atoms */
 1374|      0|                    if ((diff = (int)i2->IsotopicAtom[i].nAtomNumber - (int)i1->IsotopicAtom[i].nAtomNumber)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1374:25): [True: 0, False: 0]
  ------------------
 1375|      0|                    {
 1376|      0|                        break;
 1377|      0|                    }
 1378|      0|                    if ((diff = (int)i2->IsotopicAtom[i].nIsoDifference - (int)i1->IsotopicAtom[i].nIsoDifference)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1378:25): [True: 0, False: 0]
  ------------------
 1379|      0|                    {
 1380|      0|                        break;
 1381|      0|                    }
 1382|       |                    /* compare isotopic H */
 1383|      0|                    if ((diff = (int)i2->IsotopicAtom[i].nNum_T - (int)i1->IsotopicAtom[i].nNum_T)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1383:25): [True: 0, False: 0]
  ------------------
 1384|      0|                    {
 1385|      0|                        break;
 1386|      0|                    }
 1387|      0|                    if ((diff = (int)i2->IsotopicAtom[i].nNum_D - (int)i1->IsotopicAtom[i].nNum_D)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1387:25): [True: 0, False: 0]
  ------------------
 1388|      0|                    {
 1389|      0|                        break;
 1390|      0|                    }
 1391|      0|                    if ((diff = (int)i2->IsotopicAtom[i].nNum_H - (int)i1->IsotopicAtom[i].nNum_H)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1391:25): [True: 0, False: 0]
  ------------------
 1392|      0|                    {
 1393|      0|                        break;
 1394|      0|                    }
 1395|      0|                }
 1396|      0|                if (!diff)
  ------------------
  |  Branch (1396:21): [True: 0, False: 0]
  ------------------
 1397|      0|                {
 1398|      0|                    num = i1->nNumberOfIsotopicTGroups;
 1399|      0|                    for (i = 0; i < num; i++)
  ------------------
  |  Branch (1399:33): [True: 0, False: 0]
  ------------------
 1400|      0|                    {
 1401|      0|                        if ((diff = (int)i2->IsotopicTGroup[i].nTGroupNumber - (int)i1->IsotopicTGroup[i].nTGroupNumber)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1401:29): [True: 0, False: 0]
  ------------------
 1402|      0|                        {
 1403|      0|                            break;
 1404|      0|                        }
 1405|      0|                        if ((diff = (int)i2->IsotopicTGroup[i].nNum_T - (int)i1->IsotopicTGroup[i].nNum_T)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1405:29): [True: 0, False: 0]
  ------------------
 1406|      0|                        {
 1407|      0|                            break;
 1408|      0|                        }
 1409|      0|                        if ((diff = (int)i2->IsotopicTGroup[i].nNum_D - (int)i1->IsotopicTGroup[i].nNum_D)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1409:29): [True: 0, False: 0]
  ------------------
 1410|      0|                        {
 1411|      0|                            return diff;
 1412|      0|                        }
 1413|      0|                        if ((diff = (int)i2->IsotopicTGroup[i].nNum_H - (int)i1->IsotopicTGroup[i].nNum_H)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1413:29): [True: 0, False: 0]
  ------------------
 1414|      0|                        {
 1415|      0|                            break;
 1416|      0|                        }
 1417|      0|                    }
 1418|      0|                }
 1419|      0|                *psDifSegs |= diff ? DIFV_NEQ2PRECED : DIFV_FI_EQ_MI;
  ------------------
  |  Branch (1419:31): [True: 0, False: 0]
  ------------------
 1420|      0|            }
 1421|      0|        }
 1422|      0|        else
 1423|      0|        {
 1424|      0|            if (i1 && !i1->bDeleted && (i1->nNumberOfIsotopicAtoms || i1->nNumberOfIsotopicTGroups))
  ------------------
  |  Branch (1424:17): [True: 0, False: 0]
  |  Branch (1424:23): [True: 0, False: 0]
  |  Branch (1424:41): [True: 0, False: 0]
  |  Branch (1424:71): [True: 0, False: 0]
  ------------------
 1425|      0|            {
 1426|      0|                *psDifSegs |= DIFV_IS_EMPTY;
 1427|      0|            }
 1428|      0|        }
 1429|      0|    }
 1430|  97.5k|    else
 1431|  97.5k|    {
 1432|  97.5k|        if (!i2)
  ------------------
  |  Branch (1432:13): [True: 97.5k, False: 0]
  ------------------
 1433|  97.5k|        {
 1434|  97.5k|            if (i1 && !i1->bDeleted && (i1->nNumberOfIsotopicAtoms || i1->nNumberOfIsotopicTGroups))
  ------------------
  |  Branch (1434:17): [True: 97.5k, False: 0]
  |  Branch (1434:23): [True: 97.5k, False: 6]
  |  Branch (1434:41): [True: 628, False: 96.8k]
  |  Branch (1434:71): [True: 0, False: 96.8k]
  ------------------
 1435|    628|            {
 1436|    628|                *psDifSegs |= DIFV_EQL2PRECED;
 1437|    628|            }
 1438|  96.8k|            else
 1439|  96.8k|            {
 1440|  96.8k|                *psDifSegs |= DIFV_BOTH_EMPTY;
 1441|  96.8k|            }
 1442|  97.5k|        }
 1443|  97.5k|    }
 1444|       |
 1445|  97.5k|    return ret;
 1446|  97.5k|}
INChI_SegmentAction:
 1451|  44.8k|{
 1452|  44.8k|    if (!(cDifSegs & DIFV_OUTPUT_OMIT_F))
  ------------------
  |  Branch (1452:9): [True: 39.6k, False: 5.20k]
  ------------------
 1453|  39.6k|    {
 1454|  39.6k|        return INCHI_SEGM_OMIT;
 1455|  39.6k|    }
 1456|  5.20k|    if ((cDifSegs & DIFV_OUTPUT_EMPTY_T) && !(cDifSegs & DIFV_OUTPUT_EMPTY_F))
  ------------------
  |  Branch (1456:9): [True: 188, False: 5.01k]
  |  Branch (1456:45): [True: 188, False: 0]
  ------------------
 1457|    188|    {
 1458|    188|        return INCHI_SEGM_EMPTY;
 1459|    188|    }
 1460|  5.01k|    if ((cDifSegs & DIFV_OUTPUT_FILL_T))
  ------------------
  |  Branch (1460:9): [True: 5.01k, False: 0]
  ------------------
 1461|  5.01k|    {
 1462|  5.01k|        return INCHI_SEGM_FILL;
 1463|  5.01k|    }
 1464|       |
 1465|      0|    return INCHI_SEGM_OMIT; /* the control flow shoul never reach this point */
 1466|  5.01k|}
MarkUnusedAndEmptyLayers:
 1490|  5.02k|{
 1491|  5.02k|    int i, nLayer, sBits, nFirstSegm;
 1492|  5.02k|#define nFirstFmlSegm   DIFS_f_FORMULA
 1493|  5.02k|#define nFirstIsoSegm   DIFS_i_IATOMS
 1494|       |    /* FI */
 1495|  5.02k|    nLayer = DIFL_FI;
 1496|  5.02k|    nFirstSegm = nFirstIsoSegm;
  ------------------
  |  | 1493|  5.02k|#define nFirstIsoSegm   DIFS_i_IATOMS
  ------------------
 1497|  5.02k|    sBits = 0;
 1498|  60.3k|    for (i = 0; i < DIFS_idf_LENGTH; i++)
  ------------------
  |  Branch (1498:17): [True: 55.2k, False: 5.02k]
  ------------------
 1499|  55.2k|    {
 1500|  55.2k|        sBits |= sDifSegs[nLayer][i];
 1501|  55.2k|    }
 1502|  5.02k|    if (!(sBits & DIFV_OUTPUT_OMIT_F))
  ------------------
  |  Branch (1502:9): [True: 5.02k, False: 0]
  ------------------
 1503|  5.02k|    {
 1504|       |        /* Omit the FI layer */
 1505|  5.02k|        memset(sDifSegs[nLayer], DIFV_BOTH_EMPTY, DIFS_idf_LENGTH); /* djb-rwth: memset_s C11/Annex K variant? */
 1506|  5.02k|    }
 1507|      0|    else
 1508|      0|    {
 1509|      0|        if (sDifSegs[nLayer][nFirstSegm] == DIFV_BOTH_EMPTY ||
  ------------------
  |  Branch (1509:13): [True: 0, False: 0]
  ------------------
 1510|      0|            !(sDifSegs[nLayer][nFirstSegm] & DIFV_OUTPUT_OMIT_F))
  ------------------
  |  Branch (1510:13): [True: 0, False: 0]
  ------------------
 1511|      0|        {
 1512|      0|            sDifSegs[nLayer][nFirstSegm] = DIFV_IS_EMPTY;
 1513|      0|        }
 1514|      0|    }
 1515|       |
 1516|       |    /* MI */
 1517|  5.02k|    nLayer = DIFL_MI;
 1518|  5.02k|    nFirstSegm = nFirstIsoSegm;
  ------------------
  |  | 1493|  5.02k|#define nFirstIsoSegm   DIFS_i_IATOMS
  ------------------
 1519|  5.02k|    sBits = 0;
 1520|  60.3k|    for (i = 0; i < DIFS_idf_LENGTH; i++)
  ------------------
  |  Branch (1520:17): [True: 55.2k, False: 5.02k]
  ------------------
 1521|  55.2k|    {
 1522|  55.2k|        sBits |= sDifSegs[nLayer][i];
 1523|  55.2k|    }
 1524|  5.02k|    if (!(sBits & DIFV_OUTPUT_OMIT_F))
  ------------------
  |  Branch (1524:9): [True: 4.48k, False: 545]
  ------------------
 1525|  4.48k|    {
 1526|       |        /* Omit the MI layer */
 1527|  4.48k|        memset(sDifSegs[nLayer], DIFV_BOTH_EMPTY, DIFS_idf_LENGTH); /* djb-rwth: memset_s C11/Annex K variant? */
 1528|  4.48k|    }
 1529|    545|    else
 1530|    545|    {
 1531|    545|        if (sDifSegs[nLayer][nFirstSegm] == DIFV_BOTH_EMPTY ||
  ------------------
  |  Branch (1531:13): [True: 94, False: 451]
  ------------------
 1532|    451|            !(sDifSegs[nLayer][nFirstSegm] & DIFV_OUTPUT_OMIT_F))
  ------------------
  |  Branch (1532:13): [True: 0, False: 451]
  ------------------
 1533|     94|        {
 1534|     94|            sDifSegs[nLayer][nFirstSegm] = DIFV_IS_EMPTY;
 1535|     94|        }
 1536|    545|    }
 1537|       |
 1538|       |    /* F */
 1539|  5.02k|    nLayer = DIFL_F;
 1540|  5.02k|    nFirstSegm = nFirstFmlSegm;
  ------------------
  |  | 1492|  5.02k|#define nFirstFmlSegm   DIFS_f_FORMULA
  ------------------
 1541|  5.02k|    sBits = 0;
 1542|  60.3k|    for (i = 0; i < DIFS_idf_LENGTH; i++)
  ------------------
  |  Branch (1542:17): [True: 55.2k, False: 5.02k]
  ------------------
 1543|  55.2k|    {
 1544|  55.2k|        sBits |= sDifSegs[nLayer][i];
 1545|  55.2k|    }
 1546|  5.02k|    if (!(sBits & DIFV_OUTPUT_OMIT_F) &&
  ------------------
  |  Branch (1546:9): [True: 5.02k, False: 0]
  ------------------
 1547|  5.02k|        sDifSegs[DIFL_FI][nFirstIsoSegm] == DIFV_BOTH_EMPTY)
  ------------------
  |  | 1493|  5.02k|#define nFirstIsoSegm   DIFS_i_IATOMS
  ------------------
  |  Branch (1547:9): [True: 5.02k, False: 0]
  ------------------
 1548|  5.02k|    {
 1549|       |        /* Omit the F layer: no non-iotopic and no isotopic segments */
 1550|  5.02k|        memset(sDifSegs[nLayer], DIFV_BOTH_EMPTY, DIFS_idf_LENGTH); /* djb-rwth: memset_s C11/Annex K variant? */
 1551|  5.02k|    }
 1552|      0|    else
 1553|      0|    {    /* do not omit fixed-H layer */
 1554|      0|        if (sDifSegs[nLayer][nFirstSegm] == DIFV_BOTH_EMPTY ||
  ------------------
  |  Branch (1554:13): [True: 0, False: 0]
  ------------------
 1555|      0|            !(sDifSegs[nLayer][nFirstSegm] & DIFV_OUTPUT_OMIT_F))
  ------------------
  |  Branch (1555:13): [True: 0, False: 0]
  ------------------
 1556|      0|        {
 1557|      0|            sDifSegs[nLayer][nFirstSegm] = DIFV_IS_EMPTY;
 1558|      0|        }
 1559|      0|    }
 1560|       |
 1561|       |    /* M -- leave as it is */
 1562|       |
 1563|  5.02k|    return 0;
 1564|       |
 1565|  5.02k|#undef nFirstFmlSegm
 1566|  5.02k|#undef nFirstIsoSegm
 1567|  5.02k|}
CompareInchiStereo:
 1575|  5.12M|{
 1576|  5.12M|    int i, num, ret;
 1577|  5.12M|    if (Stereo2 && Stereo1)
  ------------------
  |  Branch (1577:9): [True: 1.16M, False: 3.96M]
  |  Branch (1577:20): [True: 1.16M, False: 0]
  ------------------
 1578|  1.16M|    {
 1579|       |        /*  compare stereogenic bonds */
 1580|  1.16M|        num = inchi_min(Stereo2->nNumberOfStereoBonds, Stereo1->nNumberOfStereoBonds);
  ------------------
  |  |  139|  1.16M|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 1.16M]
  |  |  ------------------
  ------------------
 1581|  1.16M|        for (i = 0; i < num; i++)
  ------------------
  |  Branch (1581:21): [True: 4, False: 1.16M]
  ------------------
 1582|      4|        {
 1583|      4|            if ((ret = (int)Stereo2->nBondAtom1[i] - (int)Stereo1->nBondAtom1[i])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1583:17): [True: 0, False: 4]
  ------------------
 1584|      0|            {
 1585|      0|                return ret;
 1586|      0|            }
 1587|      4|            if ((ret = (int)Stereo2->nBondAtom2[i] - (int)Stereo1->nBondAtom2[i])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1587:17): [True: 0, False: 4]
  ------------------
 1588|      0|            {
 1589|      0|                return ret;
 1590|      0|            }
 1591|      4|            if ((ret = (int)Stereo2->b_parity[i] - (int)Stereo1->b_parity[i])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1591:17): [True: 0, False: 4]
  ------------------
 1592|      0|            {
 1593|      0|                return ret;
 1594|      0|            }
 1595|      4|        }
 1596|  1.16M|        if ((ret = (int)Stereo2->nNumberOfStereoBonds - (int)Stereo1->nNumberOfStereoBonds)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1596:13): [True: 0, False: 1.16M]
  ------------------
 1597|      0|        {
 1598|      0|            return ret;
 1599|      0|        }
 1600|       |
 1601|       |        /*  compare stereogenic atoms */
 1602|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
 1603|       |        if (((nFlags1 | nFlags2) & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)) &&
 1604|       |            1 == Stereo2->nNumberOfStereoCenters &&
 1605|       |            1 == Stereo1->nNumberOfStereoCenters)
 1606|       |        {
 1607|       |            ; /*  do not compare single stereocenters in case of relative stereo */
 1608|       |        }
 1609|       |        else
 1610|       |#endif
 1611|  1.16M|        {
 1612|  1.16M|            num = inchi_min(Stereo2->nNumberOfStereoCenters, Stereo1->nNumberOfStereoCenters);
  ------------------
  |  |  139|  1.16M|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 18, False: 1.16M]
  |  |  ------------------
  ------------------
 1613|  1.16M|            for (i = 0; i < num; i++)
  ------------------
  |  Branch (1613:25): [True: 78, False: 1.16M]
  ------------------
 1614|     78|            {
 1615|     78|                if ((ret = (int)Stereo2->nNumber[i] - (int)Stereo1->nNumber[i])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1615:21): [True: 48, False: 30]
  ------------------
 1616|     48|                {
 1617|     48|                    return ret;
 1618|     48|                }
 1619|     30|                if ((ret = (int)Stereo2->t_parity[i] - (int)Stereo1->t_parity[i])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1619:21): [True: 16, False: 14]
  ------------------
 1620|     16|                {
 1621|     16|                    return ret;
 1622|     16|                }
 1623|     30|            }
 1624|  1.16M|            if ((ret = (int)Stereo2->nNumberOfStereoCenters - (int)Stereo1->nNumberOfStereoCenters)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1624:17): [True: 20, False: 1.16M]
  ------------------
 1625|     20|                return ret;
 1626|       |            /*  compare stereo-abs-is-inverted flags  for non-relative, non-racemic */
 1627|  1.16M|            if (!((nFlags1 | nFlags2) & (INCHI_FLAG_RAC_STEREO | INCHI_FLAG_REL_STEREO)))
  ------------------
  |  |  122|  1.16M|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
                          if (!((nFlags1 | nFlags2) & (INCHI_FLAG_RAC_STEREO | INCHI_FLAG_REL_STEREO)))
  ------------------
  |  |  121|  1.16M|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
  |  Branch (1627:17): [True: 1.16M, False: 6]
  ------------------
 1628|  1.16M|            {
 1629|  1.16M|                if ((ret = (Stereo2->nCompInv2Abs < 0) - (Stereo1->nCompInv2Abs < 0))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1629:21): [True: 0, False: 1.16M]
  ------------------
 1630|      0|                {
 1631|      0|                    return ret;
 1632|      0|                }
 1633|  1.16M|            }
 1634|  1.16M|        }
 1635|  1.16M|    }
 1636|  3.96M|    else
 1637|  3.96M|    {
 1638|  3.96M|        if (Stereo2 && (Stereo2->nNumberOfStereoBonds > 0 || Stereo2->nNumberOfStereoCenters > 0
  ------------------
  |  Branch (1638:13): [True: 0, False: 3.96M]
  |  Branch (1638:25): [True: 0, False: 0]
  |  Branch (1638:62): [True: 0, False: 0]
  ------------------
 1639|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
 1640|       |            && /*  do not compare single stereocenters in case of relative stereo */
 1641|       |            !((nFlags2 & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)) &&
 1642|       |                1 == Stereo2->nNumberOfStereoCenters
 1643|       |                )
 1644|       |#endif
 1645|      0|            ))
 1646|      0|        {
 1647|      0|            return 1;
 1648|      0|        }
 1649|  3.96M|        else
 1650|  3.96M|        {
 1651|  3.96M|            if (Stereo1 && (Stereo1->nNumberOfStereoBonds > 0 || Stereo1->nNumberOfStereoCenters > 0
  ------------------
  |  Branch (1651:17): [True: 0, False: 3.96M]
  |  Branch (1651:29): [True: 0, False: 0]
  |  Branch (1651:66): [True: 0, False: 0]
  ------------------
 1652|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
 1653|       |                && /*  do not compare single stereocenters in case of relative stereo */
 1654|       |                !((nFlags1 & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)) &&
 1655|       |                    1 == Stereo1->nNumberOfStereoCenters
 1656|       |                    )
 1657|       |#endif
 1658|      0|                ))
 1659|      0|            {
 1660|      0|                return -1;
 1661|      0|            }
 1662|  3.96M|        }
 1663|  3.96M|    }
 1664|       |
 1665|  5.12M|    return 0;
 1666|  5.12M|}
CompINChI2:
 1680|  2.67M|{
 1681|  2.67M|    int ret, num, i, num_H1, num_H2;
 1682|       |
 1683|  2.67M|    const INChI* i1 = NULL; /* tautomeric if exists, otherwise non-tautomeric */
 1684|  2.67M|    const INChI* i2 = NULL; /* tautomeric if exists, otherwise non-tautomeric */
 1685|       |
 1686|  2.67M|    int   n1;               /* TAUT_YES if tautomeric i1 exists, otherwise TAUT_NON */
 1687|  2.67M|    int   n2;               /* TAUT_YES if tautomeric i2 exists, otherwise TAUT_NON */
 1688|       |
 1689|  2.67M|    const INChI* i1n = NULL; /* non-tautomeric if both tautomeric AND non-tautomeric exist */
 1690|  2.67M|    const INChI* i2n = NULL; /* non-tautomeric if both tautomeric AND non-tautomeric exist */
 1691|       |
 1692|       |    /*const INChI *i1t = NULL;*/ /* temp for i1 if both tautomeric AND non-tautomeric exist */
 1693|       |    /*const INChI *i2t = NULL;*/ /* temp for i2 if both tautomeric AND non-tautomeric exist */
 1694|       |
 1695|       |    /* INChI_Stereo *Stereo1, *Stereo2; */
 1696|       |
 1697|  2.67M|    n1 = (p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  575|  2.67M|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n1 = (p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  575|  2.67M|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n1 = (p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  575|  2.67M|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n1 = (p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  574|  2.67M|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1697:11): [True: 2.67M, False: 0]
  |  Branch (1697:35): [True: 2.67M, False: 0]
  ------------------
 1698|  2.67M|    n2 = (p2->pINChI[TAUT_YES] && p2->pINChI[TAUT_YES]->nNumberOfAtoms) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  575|  2.67M|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n2 = (p2->pINChI[TAUT_YES] && p2->pINChI[TAUT_YES]->nNumberOfAtoms) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  575|  2.67M|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n2 = (p2->pINChI[TAUT_YES] && p2->pINChI[TAUT_YES]->nNumberOfAtoms) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  575|  2.67M|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n2 = (p2->pINChI[TAUT_YES] && p2->pINChI[TAUT_YES]->nNumberOfAtoms) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  574|  2.67M|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1698:11): [True: 2.67M, False: 0]
  |  Branch (1698:35): [True: 2.67M, False: 0]
  ------------------
 1699|       |
 1700|  2.67M|    i1 = p1->pINChI[n1];
 1701|  2.67M|    i1n = (n1 == TAUT_YES && p1->pINChI[TAUT_NON] &&
  ------------------
  |  |  575|  5.34M|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  i1n = (n1 == TAUT_YES && p1->pINChI[TAUT_NON] &&
  ------------------
  |  |  574|  2.67M|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1701:12): [True: 2.67M, False: 0]
  |  Branch (1701:30): [True: 900k, False: 1.77M]
  ------------------
 1702|  1.77M|        p1->pINChI[TAUT_NON]->nNumberOfAtoms) ? p1->pINChI[TAUT_NON] : (const INChI*)NULL;
  ------------------
  |  |  574|   900k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      p1->pINChI[TAUT_NON]->nNumberOfAtoms) ? p1->pINChI[TAUT_NON] : (const INChI*)NULL;
  ------------------
  |  |  574|   900k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1702:9): [True: 900k, False: 24]
  ------------------
 1703|       |
 1704|  2.67M|    i2 = p2->pINChI[n2];
 1705|  2.67M|    i2n = (n2 == TAUT_YES && p2->pINChI[TAUT_NON] &&
  ------------------
  |  |  575|  5.34M|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  i2n = (n2 == TAUT_YES && p2->pINChI[TAUT_NON] &&
  ------------------
  |  |  574|  2.67M|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1705:12): [True: 2.67M, False: 0]
  |  Branch (1705:30): [True: 900k, False: 1.77M]
  ------------------
 1706|  1.77M|        p2->pINChI[TAUT_NON]->nNumberOfAtoms) ? p2->pINChI[TAUT_NON] : (const INChI*)NULL;
  ------------------
  |  |  574|   900k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      p2->pINChI[TAUT_NON]->nNumberOfAtoms) ? p2->pINChI[TAUT_NON] : (const INChI*)NULL;
  ------------------
  |  |  574|   900k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1706:9): [True: 900k, False: 42]
  ------------------
 1707|       |
 1708|       |    /* non-deleted-non-empty < deleted < empty */
 1709|  2.67M|    if (i1 && !i2)
  ------------------
  |  Branch (1709:9): [True: 2.67M, False: 0]
  |  Branch (1709:15): [True: 0, False: 2.67M]
  ------------------
 1710|      0|        return -1;   /* non-empty is the smallest (first) */
 1711|  2.67M|    if (!i1 && i2)
  ------------------
  |  Branch (1711:9): [True: 0, False: 2.67M]
  |  Branch (1711:16): [True: 0, False: 0]
  ------------------
 1712|      0|        return 1;
 1713|  2.67M|    if (!i1 && !i2)
  ------------------
  |  Branch (1713:9): [True: 0, False: 2.67M]
  |  Branch (1713:16): [True: 0, False: 0]
  ------------------
 1714|      0|        return 0;
 1715|  2.67M|    if (i1->bDeleted && !i2->bDeleted)
  ------------------
  |  Branch (1715:9): [True: 900k, False: 1.77M]
  |  Branch (1715:25): [True: 0, False: 900k]
  ------------------
 1716|      0|        return 1;    /* deleted is the largest (last) among non-empty */
 1717|  2.67M|    if (!i1->bDeleted && i2->bDeleted)
  ------------------
  |  Branch (1717:9): [True: 1.77M, False: 900k]
  |  Branch (1717:26): [True: 0, False: 1.77M]
  ------------------
 1718|      0|        return -1;
 1719|       |
 1720|  2.67M|    num_H1 = num_H2 = 0;
 1721|       |
 1722|       |    /* do not compare terminal H */
 1723|  2.67M|    if ((ret = CompareHillFormulasNoH(i1->szHillFormula, i2->szHillFormula, &num_H1, &num_H2))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1723:9): [True: 88.0k, False: 2.58M]
  ------------------
 1724|  88.0k|    {
 1725|  88.0k|        return ret;  /* lexicographic order except the shorter one is greater (last): CH2O < CH2; C3XX < C2XX */
 1726|  88.0k|    }
 1727|       |
 1728|       |    /*********************************************************
 1729|       |            compare non-isotopic non-tautomeric part
 1730|       |     *********************************************************/
 1731|       |
 1732|       |     /* compare number of atoms (excluding terminal H) */
 1733|  2.58M|    if ((ret = i2->nNumberOfAtoms - i1->nNumberOfAtoms)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1733:9): [True: 20.1k, False: 2.56M]
  ------------------
 1734|  20.1k|        return ret; /*  more atoms first */
 1735|       |
 1736|       |    /*  compare elements  (excluding terminal H) */
 1737|  2.56M|    num = i1->nNumberOfAtoms;
 1738|  18.6M|    for (i = 0; i < num; i++)
  ------------------
  |  Branch (1738:17): [True: 16.1M, False: 2.56M]
  ------------------
 1739|  16.1M|    {
 1740|       |        /* should always be equal if Hill formulas are same */
 1741|  16.1M|        if ((ret = (int)i2->nAtom[i] - (int)i1->nAtom[i])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1741:13): [True: 1.18k, False: 16.1M]
  ------------------
 1742|  1.18k|            return ret; /* greater periodic number first */
 1743|  16.1M|    }
 1744|       |
 1745|       |    /**********************************************************
 1746|       |        compare connection tables
 1747|       |    ***********************************************************/
 1748|  2.56M|    if ((ret = i2->lenConnTable - i1->lenConnTable)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1748:9): [True: 140, False: 2.56M]
  ------------------
 1749|    140|        return ret; /* longer connection table first */
 1750|  2.56M|    num = i2->lenConnTable;
 1751|  8.54M|    for (i = 0; i < num; i++)
  ------------------
  |  Branch (1751:17): [True: 5.98M, False: 2.56M]
  ------------------
 1752|  5.98M|    {
 1753|  5.98M|        if ((ret = (int)i2->nConnTable[i] - (int)i1->nConnTable[i])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1753:13): [True: 208, False: 5.98M]
  ------------------
 1754|    208|            return ret; /* greater connection table first */
 1755|  5.98M|    }
 1756|       |
 1757|       |    /*********************************************************
 1758|       |      compare compare total number of H (inverse: H3 < H2 )
 1759|       |    **********************************************************/
 1760|  2.56M|    if ((ret = num_H2 - num_H1)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1760:9): [True: 0, False: 2.56M]
  ------------------
 1761|      0|    {
 1762|      0|        return ret;
 1763|      0|    }
 1764|       |
 1765|       |    /*********************************************************
 1766|       |      compare non-tautomeric num_H: N < NH3 < NH2 < NH
 1767|       |    **********************************************************/
 1768|  2.56M|    num = i1->nNumberOfAtoms;
 1769|  18.6M|    for (i = 0; i < num; i++)
  ------------------
  |  Branch (1769:17): [True: 16.1M, False: 2.56M]
  ------------------
 1770|  16.1M|    {
 1771|  16.1M|        if (i2->nNum_H[i] != i1->nNum_H[i])
  ------------------
  |  Branch (1771:13): [True: 0, False: 16.1M]
  ------------------
 1772|      0|        {
 1773|      0|            return !i2->nNum_H[i] ? 1 :  /* no H first */
  ------------------
  |  Branch (1773:20): [True: 0, False: 0]
  ------------------
 1774|      0|                !i1->nNum_H[i] ? -1 :
  ------------------
  |  Branch (1774:17): [True: 0, False: 0]
  ------------------
 1775|      0|                (int)i2->nNum_H[i] - (int)i1->nNum_H[i];
 1776|      0|        }
 1777|  16.1M|    }
 1778|       |
 1779|       |    /*********************************************************
 1780|       |         compare non-isotopic tautomeric part
 1781|       |     *********************************************************/
 1782|  2.56M|    if ((ret = CompareTautNonIsoPartOfINChI(i1, i2))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1782:9): [True: 0, False: 2.56M]
  ------------------
 1783|      0|    {
 1784|      0|        return ret;
 1785|      0|    }
 1786|       |    /*
 1787|       |    if ( ret = i2->lenTautomer - i1->lenTautomer )
 1788|       |        return ret;
 1789|       |    num = inchi_min( i2->lenTautomer, i1->lenTautomer );
 1790|       |    for ( i = 0; i < num; i ++ ) {
 1791|       |        if ( ret = (int)i2->nTautomer[i] - (int)i1->nTautomer[i] )
 1792|       |           return ret;
 1793|       |    }
 1794|       |    */
 1795|       |
 1796|       |    /*********************************************************
 1797|       |     *                                                       *
 1798|       |     *  at this point both components are either tautomeric  *
 1799|       |     *  or non-tautomeric                                    *
 1800|       |     *                                                       *
 1801|       |     *********************************************************/
 1802|       |
 1803|       |     /*********************************************************
 1804|       |        non-tautomeric "fixed H" specific
 1805|       |      *********************************************************/
 1806|  2.56M|    if (TAUT_NON == bTaut && ((i1n && i1n->nNum_H_fixed) || (i2n && i2n->nNum_H_fixed))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  574|  2.56M|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1806:9): [True: 1.28M, False: 1.28M]
  |  Branch (1806:32): [True: 450k, False: 831k]
  |  Branch (1806:39): [True: 450k, False: 0]
  |  Branch (1806:62): [True: 0, False: 831k]
  |  Branch (1806:69): [True: 0, False: 0]
  ------------------
 1807|   450k|    {
 1808|       |        /* first, compare non-tautomeric chem. formulas -- they may be different */
 1809|   450k|        const char* f1 = (i1n /*&& i1n->nNum_H_fixed*/) ? i1n->szHillFormula : i1->szHillFormula;
  ------------------
  |  Branch (1809:26): [True: 450k, False: 0]
  ------------------
 1810|   450k|        const char* f2 = (i2n /*&& i2n->nNum_H_fixed*/) ? i2n->szHillFormula : i2->szHillFormula;
  ------------------
  |  Branch (1810:26): [True: 450k, False: 0]
  ------------------
 1811|   450k|        if (f1 && f2 && (ret = CompareHillFormulas(f1, f2)))
  ------------------
  |  Branch (1811:13): [True: 450k, False: 0]
  |  Branch (1811:19): [True: 450k, False: 0]
  |  Branch (1811:25): [True: 0, False: 450k]
  ------------------
 1812|      0|        {
 1813|      0|            return ret;
 1814|      0|        }
 1815|       |        /* secondly, compare fixed-H distribution */
 1816|   450k|        if (i1n && i1n->nNum_H_fixed && i2n && i2n->nNum_H_fixed)
  ------------------
  |  Branch (1816:13): [True: 450k, False: 0]
  |  Branch (1816:20): [True: 450k, False: 0]
  |  Branch (1816:41): [True: 450k, False: 0]
  |  Branch (1816:48): [True: 450k, False: 0]
  ------------------
 1817|   450k|        {
 1818|   450k|            num = inchi_min(i1n->nNumberOfAtoms, i2n->nNumberOfAtoms);
  ------------------
  |  |  139|   450k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 450k]
  |  |  ------------------
  ------------------
 1819|   900k|            for (i = 0; i < num; i++)
  ------------------
  |  Branch (1819:25): [True: 450k, False: 450k]
  ------------------
 1820|   450k|            {
 1821|   450k|                if (i2n->nNum_H_fixed[i] != i1n->nNum_H_fixed[i])
  ------------------
  |  Branch (1821:21): [True: 0, False: 450k]
  ------------------
 1822|      0|                {
 1823|      0|                    return !i2n->nNum_H_fixed[i] ? 1 : /* no fixed H first */
  ------------------
  |  Branch (1823:28): [True: 0, False: 0]
  ------------------
 1824|      0|                        !i1n->nNum_H_fixed[i] ? -1 :
  ------------------
  |  Branch (1824:25): [True: 0, False: 0]
  ------------------
 1825|      0|                        (int)i2n->nNum_H_fixed[i] - (int)i1n->nNum_H_fixed[i];
 1826|      0|                }
 1827|   450k|            }
 1828|   450k|            if ((ret = (int)i2n->nNumberOfAtoms - (int)i1n->nNumberOfAtoms)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1828:17): [True: 0, False: 450k]
  ------------------
 1829|      0|            {
 1830|      0|                return ret; /* should not happen <BRKPT> */
 1831|      0|            }
 1832|   450k|        }
 1833|      0|        else
 1834|      0|        {
 1835|      0|            if (i1n && i1n->nNum_H_fixed)
  ------------------
  |  Branch (1835:17): [True: 0, False: 0]
  |  Branch (1835:24): [True: 0, False: 0]
  ------------------
 1836|      0|            {
 1837|      0|                num = i1n->nNumberOfAtoms;
 1838|      0|                for (i = 0; i < num; i++)
  ------------------
  |  Branch (1838:29): [True: 0, False: 0]
  ------------------
 1839|      0|                {
 1840|       |                    /* added 2004-05-04 */
 1841|      0|                    if (i1n->nNum_H_fixed[i])
  ------------------
  |  Branch (1841:25): [True: 0, False: 0]
  ------------------
 1842|      0|                    {
 1843|      0|                        return -1; /* i1n->nNum_H_fixed[i] > 0? -1:1;*/
 1844|      0|                    }
 1845|      0|                }
 1846|       |                /* p1 is tautomeric, p2 is not tautomeric; this must have been detected earlier */
 1847|       |                /*return -1;*/ /* has fixed H first *//* <BRKPT> */ /* removed 2004-05-04 */
 1848|      0|            }
 1849|      0|            else
 1850|      0|            {
 1851|      0|                num = i2n->nNumberOfAtoms;
 1852|      0|                for (i = 0; i < num; i++)
  ------------------
  |  Branch (1852:29): [True: 0, False: 0]
  ------------------
 1853|      0|                {
 1854|       |                    /* added 2004-05-04 */
 1855|      0|                    if (i2n->nNum_H_fixed[i])
  ------------------
  |  Branch (1855:25): [True: 0, False: 0]
  ------------------
 1856|      0|                    {
 1857|      0|                        return 1; /* i2n->nNum_H_fixed[i] > 0? 1:-1;*/
 1858|      0|                    }
 1859|      0|                }
 1860|       |                /* p2 is tautomeric, p1 is not tautomeric; this must have been detected earlier */
 1861|       |                /*return 1; */ /* has fixed H first *//* <BRKPT> */ /* removed 2004-05-04 */
 1862|      0|            }
 1863|      0|        }
 1864|   450k|    }
 1865|       |
 1866|       |    /*************************************************************************
 1867|       |              if requested non-tautomeric comparison then
 1868|       |              prepare to compare non-taut non-isotopic stereo, etc.
 1869|       |     *************************************************************************/
 1870|  2.56M|    if (TAUT_NON == bTaut)
  ------------------
  |  |  574|  2.56M|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1870:9): [True: 1.28M, False: 1.28M]
  ------------------
 1871|  1.28M|    {
 1872|  1.28M|        if (i1n)
  ------------------
  |  Branch (1872:13): [True: 450k, False: 831k]
  ------------------
 1873|   450k|        {
 1874|       |            /*i1t = i1;*/
 1875|   450k|            i1 = i1n;
 1876|   450k|        }
 1877|  1.28M|        if (i2n)
  ------------------
  |  Branch (1877:13): [True: 450k, False: 831k]
  ------------------
 1878|   450k|        {
 1879|       |            /*i2t = i2;*/
 1880|   450k|            i2 = i2n;
 1881|   450k|        }
 1882|  1.28M|    }
 1883|       |
 1884|       |    /*********************************************************
 1885|       |        compare non-isotopic stereo
 1886|       |     *********************************************************/
 1887|  2.56M|    ret = CompareInchiStereo(i1->Stereo, i1->nFlags, i2->Stereo, i2->nFlags);
 1888|  2.56M|    if (ret)
  ------------------
  |  Branch (1888:9): [True: 62, False: 2.56M]
  ------------------
 1889|     62|    {
 1890|     62|        return ret;
 1891|     62|    }
 1892|       |    /*******************************************************
 1893|       |        do not switch back to tautomeric i1, i2
 1894|       |     *******************************************************/
 1895|       |     /* -- how to switch back --
 1896|       |     if ( i1t ) {
 1897|       |         i1  = i1t;
 1898|       |         i1t = NULL;
 1899|       |     }
 1900|       |     if ( i2t ) {
 1901|       |         i2  = i2t;
 1902|       |         i2t = NULL;
 1903|       |     }
 1904|       |     */
 1905|       |
 1906|       |     /******************************************************
 1907|       |          compare isotopic non-tautomeric part
 1908|       |      ******************************************************/
 1909|  2.56M|    if (bCompareIsotopic)
  ------------------
  |  Branch (1909:9): [True: 2.56M, False: 0]
  ------------------
 1910|  2.56M|    {
 1911|  2.56M|        if ((ret = i2->nNumberOfIsotopicAtoms - i1->nNumberOfIsotopicAtoms)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1911:13): [True: 196, False: 2.56M]
  ------------------
 1912|    196|        {
 1913|    196|            return ret;
 1914|    196|        }
 1915|  2.56M|        num = i1->nNumberOfIsotopicAtoms;
 1916|       |        /*  compare isotopic atoms */
 1917|  2.57M|        for (i = 0; i < num; i++)
  ------------------
  |  Branch (1917:21): [True: 10.7k, False: 2.56M]
  ------------------
 1918|  10.7k|        {
 1919|  10.7k|            if ((ret = (int)i2->IsotopicAtom[i].nAtomNumber - (int)i1->IsotopicAtom[i].nAtomNumber)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1919:17): [True: 8, False: 10.7k]
  ------------------
 1920|      8|            {
 1921|      8|                return ret;
 1922|      8|            }
 1923|  10.7k|            if ((ret = (int)i2->IsotopicAtom[i].nIsoDifference - (int)i1->IsotopicAtom[i].nIsoDifference)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1923:17): [True: 24, False: 10.7k]
  ------------------
 1924|     24|            {
 1925|     24|                return ret;
 1926|     24|            }
 1927|  10.7k|        }
 1928|       |
 1929|       |        /* compare isotopic H */
 1930|       |        /* if tautomeric comparison mode then here are compared only non-tautomeric H */
 1931|  2.57M|        for (i = 0; i < num; i++)
  ------------------
  |  Branch (1931:21): [True: 10.7k, False: 2.56M]
  ------------------
 1932|  10.7k|        {
 1933|  10.7k|            if ((ret = (int)i2->IsotopicAtom[i].nNum_T - (int)i1->IsotopicAtom[i].nNum_T)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1933:17): [True: 0, False: 10.7k]
  ------------------
 1934|      0|            {
 1935|      0|                return ret;
 1936|      0|            }
 1937|  10.7k|            if ((ret = (int)i2->IsotopicAtom[i].nNum_D - (int)i1->IsotopicAtom[i].nNum_D)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1937:17): [True: 0, False: 10.7k]
  ------------------
 1938|      0|            {
 1939|      0|                return ret;
 1940|      0|            }
 1941|  10.7k|            if ((ret = (int)i2->IsotopicAtom[i].nNum_H - (int)i1->IsotopicAtom[i].nNum_H)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1941:17): [True: 0, False: 10.7k]
  ------------------
 1942|      0|            {
 1943|      0|                return ret;
 1944|      0|            }
 1945|  10.7k|        }
 1946|       |
 1947|       |        /*****************************************************
 1948|       |             compare isotopic tautomeric part
 1949|       |         *****************************************************/
 1950|  2.56M|        if ((ret = i2->nNumberOfIsotopicTGroups - i1->nNumberOfIsotopicTGroups)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1950:13): [True: 0, False: 2.56M]
  ------------------
 1951|      0|            return ret;
 1952|  2.56M|        num = i1->nNumberOfIsotopicTGroups;
 1953|  2.56M|        for (i = 0; i < num; i++)
  ------------------
  |  Branch (1953:21): [True: 0, False: 2.56M]
  ------------------
 1954|      0|        {
 1955|      0|            if ((ret = (int)i2->IsotopicTGroup[i].nTGroupNumber - (int)i1->IsotopicTGroup[i].nTGroupNumber)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1955:17): [True: 0, False: 0]
  ------------------
 1956|      0|            {
 1957|      0|                return ret;
 1958|      0|            }
 1959|      0|            if ((ret = (int)i2->IsotopicTGroup[i].nNum_T - (int)i1->IsotopicTGroup[i].nNum_T)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1959:17): [True: 0, False: 0]
  ------------------
 1960|      0|            {
 1961|      0|                return ret;
 1962|      0|            }
 1963|      0|            if ((ret = (int)i2->IsotopicTGroup[i].nNum_D - (int)i1->IsotopicTGroup[i].nNum_D)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1963:17): [True: 0, False: 0]
  ------------------
 1964|      0|            {
 1965|      0|                return ret;
 1966|      0|            }
 1967|      0|            if ((ret = (int)i2->IsotopicTGroup[i].nNum_H - (int)i1->IsotopicTGroup[i].nNum_H)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1967:17): [True: 0, False: 0]
  ------------------
 1968|      0|            {
 1969|      0|                return ret;
 1970|      0|            }
 1971|      0|        }
 1972|       |
 1973|       |        /****************************************************
 1974|       |            compare isotopic stereo
 1975|       |         ****************************************************/
 1976|  2.56M|        ret = CompareInchiStereo(i1->StereoIsotopic, i1->nFlags, i2->StereoIsotopic, i2->nFlags);
 1977|  2.56M|        if (ret)
  ------------------
  |  Branch (1977:13): [True: 22, False: 2.56M]
  ------------------
 1978|     22|        {
 1979|     22|            return ret;
 1980|     22|        }
 1981|  2.56M|    }
 1982|       |
 1983|       |    /**********************************************************
 1984|       |        compare charges: non-charged first, then in order of
 1985|       |        ascending charges (negative first)
 1986|       |    ***********************************************************/
 1987|  2.56M|    if (i2->nTotalCharge && i1->nTotalCharge)
  ------------------
  |  Branch (1987:9): [True: 900k, False: 1.66M]
  |  Branch (1987:29): [True: 900k, False: 0]
  ------------------
 1988|   900k|    {
 1989|       |        /*  both are charged; smaller charges first */
 1990|   900k|        ret = (int)i1->nTotalCharge - (int)i2->nTotalCharge;
 1991|   900k|        return ret;
 1992|   900k|    }
 1993|  1.66M|    if ((ret = (i1->nTotalCharge ? 1 : 0) - (i2->nTotalCharge ? 1 : 0))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1993:9): [True: 6, False: 1.66M]
  |  Branch (1993:17): [True: 6, False: 1.66M]
  |  Branch (1993:46): [True: 0, False: 1.66M]
  ------------------
 1994|      6|    {
 1995|       |        /*  only one is charged; uncharged first */
 1996|      6|        return ret;
 1997|      6|    }
 1998|       |    /* stable sort */
 1999|       |    /*ret = p1->ord_number - p2->ord_number;*/
 2000|       |
 2001|  1.66M|    return ret;
 2002|  1.66M|}
CompINChINonTaut2:
 2007|   695k|{
 2008|   695k|    int ret;
 2009|   695k|    ret = CompINChI2((const INCHI_SORT*)p1, (const INCHI_SORT*)p2, TAUT_NON, 1);
  ------------------
  |  |  574|   695k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 2010|   695k|#if ( CANON_FIXH_TRANS == 1 )
 2011|   695k|    if (!ret)
  ------------------
  |  Branch (2011:9): [True: 640k, False: 55.0k]
  ------------------
 2012|   640k|    {
 2013|       |        /* to obtain canonical transposition 2004-05-10 */
 2014|   640k|        ret = CompINChI2((const INCHI_SORT*)p1, (const INCHI_SORT*)p2, TAUT_YES, 1);
  ------------------
  |  |  575|   640k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2015|   640k|    }
 2016|   695k|#endif
 2017|   695k|    if (!ret)
  ------------------
  |  Branch (2017:9): [True: 640k, False: 55.0k]
  ------------------
 2018|   640k|    {
 2019|       |        /* stable sort */
 2020|   640k|        ret = ((const INCHI_SORT*)p1)->ord_number - ((const INCHI_SORT*)p2)->ord_number;
 2021|   640k|    }
 2022|       |
 2023|   695k|    return ret;
 2024|   695k|}
CompINChITaut2:
 2029|   695k|{
 2030|   695k|    int ret;
 2031|   695k|    ret = CompINChI2((const INCHI_SORT*)p1, (const INCHI_SORT*)p2, TAUT_YES, 1);
  ------------------
  |  |  575|   695k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2032|   695k|#if ( CANON_FIXH_TRANS == 1 )
 2033|   695k|    if (!ret)
  ------------------
  |  Branch (2033:9): [True: 640k, False: 55.0k]
  ------------------
 2034|   640k|    {
 2035|       |        /* to obtain canonical transposition 2004-05-10 */
 2036|   640k|        ret = CompINChI2((const INCHI_SORT*)p1, (const INCHI_SORT*)p2, TAUT_NON, 1);
  ------------------
  |  |  574|   640k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 2037|   640k|    }
 2038|   695k|#endif
 2039|   695k|    if (!ret)
  ------------------
  |  Branch (2039:9): [True: 640k, False: 55.0k]
  ------------------
 2040|   640k|    {
 2041|       |        /* stable sort */
 2042|   640k|        ret = ((const INCHI_SORT*)p1)->ord_number - ((const INCHI_SORT*)p2)->ord_number;
 2043|   640k|    }
 2044|       |
 2045|   695k|    return ret;
 2046|   695k|}
mystrrev:
 2055|  56.9k|{
 2056|  56.9k|    char c, * q = p;
 2057|   121k|    while (*q++)
  ------------------
  |  Branch (2057:12): [True: 64.6k, False: 56.9k]
  ------------------
 2058|  64.6k|    {
 2059|  64.6k|        ;
 2060|  64.6k|    }
 2061|  56.9k|    q -= 2; /*  pointer to the last character */
 2062|  62.1k|    while (p < q)
  ------------------
  |  Branch (2062:12): [True: 5.27k, False: 56.9k]
  ------------------
 2063|  5.27k|    {
 2064|  5.27k|        c = *q;  /*  swap */
 2065|  5.27k|        *q-- = *p;
 2066|  5.27k|        *p++ = c;
 2067|  5.27k|    }
 2068|  56.9k|}
GetDfsOrder4CT:
 2124|  4.30k|{
 2125|  4.30k|    AT_NUMB* nStackAtom = NULL;
 2126|  4.30k|    int         nTopStackAtom = -1;
 2127|  4.30k|    AT_NUMB* nNumDescendants = NULL; /*  number of descendants incl. closures and the atom itself */
 2128|  4.30k|    AT_NUMB* nDfsNumber = NULL;
 2129|  4.30k|    S_CHAR* cNeighNumb = NULL;
 2130|  4.30k|    NEIGH_LIST* nl = NULL;
 2131|  4.30k|    AT_NUMB     nDfs;
 2132|  4.30k|    int         i, j, u, k, start, num_rings, nTotOutputStringLen;
 2133|  4.30k|    AT_NUMB* nOutputString = NULL, cDelim;
 2134|  4.30k|    int         bCtPredecessors = (nCtMode & CT_MODE_PREDECESSORS);
  ------------------
  |  |   28|  4.30k|#define CT_MODE_PREDECESSORS      8
  ------------------
 2135|  4.30k|    OrderStruct os;
 2136|       |
 2137|       |    /*  allocate arrays */
 2138|  4.30k|    nStackAtom = (AT_NUMB*)inchi_malloc(num_atoms * sizeof(nStackAtom[0]));
  ------------------
  |  | 1143|  4.30k|#define inchi_malloc   malloc
  ------------------
 2139|  4.30k|    nNumDescendants = (AT_NUMB*)inchi_malloc(num_atoms * sizeof(nNumDescendants[0]));
  ------------------
  |  | 1143|  4.30k|#define inchi_malloc   malloc
  ------------------
 2140|  4.30k|    nDfsNumber = (AT_NUMB*)inchi_malloc(num_atoms * sizeof(nDfsNumber[0]));
  ------------------
  |  | 1143|  4.30k|#define inchi_malloc   malloc
  ------------------
 2141|  4.30k|    cNeighNumb = (S_CHAR*)inchi_malloc(num_atoms * sizeof(cNeighNumb[0]));
  ------------------
  |  | 1143|  4.30k|#define inchi_malloc   malloc
  ------------------
 2142|  4.30k|    nl = CreateNeighListFromLinearCT(LinearCT, nLenCT, num_atoms);
 2143|       |
 2144|       |    /*  check allocation */
 2145|  4.30k|    if (!nStackAtom || !nNumDescendants || !nDfsNumber || !cNeighNumb || !nl)
  ------------------
  |  Branch (2145:9): [True: 0, False: 4.30k]
  |  Branch (2145:24): [True: 0, False: 4.30k]
  |  Branch (2145:44): [True: 0, False: 4.30k]
  |  Branch (2145:59): [True: 0, False: 4.30k]
  |  Branch (2145:74): [True: 0, False: 4.30k]
  ------------------
 2146|      0|    {
 2147|       |        /* ret = CT_OUT_OF_RAM; */ /*  program error */ /*   <BRKPT> */
 2148|      0|        goto exit_function;
 2149|      0|    }
 2150|  4.30k|    if (bCtPredecessors)
  ------------------
  |  Branch (2150:9): [True: 0, False: 4.30k]
  ------------------
 2151|      0|    {
 2152|      0|        start = 0;
 2153|      0|    }
 2154|  4.30k|    else
 2155|  4.30k|    {
 2156|       |        /*  find DFS start vertex (atom) */
 2157|  26.7k|        for (i = 1, start = 0; i < num_atoms; i++)
  ------------------
  |  Branch (2157:32): [True: 22.4k, False: 4.30k]
  ------------------
 2158|  22.4k|        {
 2159|  22.4k|            if (nl[i][0] < nl[start][0])
  ------------------
  |  Branch (2159:17): [True: 2.93k, False: 19.4k]
  ------------------
 2160|  2.93k|            { /*  index = nRank-1 */
 2161|  2.93k|                start = i;
 2162|  2.93k|            }
 2163|  22.4k|        }
 2164|  4.30k|    }
 2165|       |
 2166|       |    /*
 2167|       |      vertex information:
 2168|       |        1. Number of (forward edges) + (back edges, first visit -- ring closures): nl[i][0]
 2169|       |        2. Number of vertices traversed from this vertex, including the vertex:    nNumDescendants[i]
 2170|       |        3. Each edge information:
 2171|       |           a. forward edge (0) or back edge (1) indicator: nDfsNumber[i] > nDfsNumber[neigh]
 2172|       |           b. neighbor at another end of the edge neigh = nl[i][k+1], k < i
 2173|       |
 2174|       |        Total per edge: 2 + 2*(number of edges)
 2175|       |    */
 2176|       |
 2177|       |    /* DFS initiation */
 2178|  4.30k|    u = start; /* start atom */
 2179|  4.30k|    nDfs = 0;
 2180|  4.30k|    nTopStackAtom = -1;
 2181|  4.30k|    memset(nDfsNumber, 0, num_atoms * sizeof(nDfsNumber[0])); /* djb-rwth: memset_s C11/Annex K variant? */
 2182|  4.30k|    memset(nNumDescendants, 0, num_atoms * sizeof(nNumDescendants[0])); /* djb-rwth: memset_s C11/Annex K variant? */
 2183|  4.30k|    memset(cNeighNumb, 0, num_atoms * sizeof(cNeighNumb[0])); /* djb-rwth: memset_s C11/Annex K variant? */
 2184|       |    /*  push the start atom on the stack */
 2185|  4.30k|    nDfsNumber[u] = ++nDfs;
 2186|  4.30k|    if (bCtPredecessors)
  ------------------
  |  Branch (2186:9): [True: 0, False: 4.30k]
  ------------------
 2187|      0|    {
 2188|      0|        nNumDescendants[u] = 0; /* atom #1 has no predecessor */
 2189|      0|    }
 2190|  4.30k|    else
 2191|  4.30k|    {
 2192|  4.30k|        nNumDescendants[u] = 1; /* count itself as a descendant */
 2193|  4.30k|    }
 2194|  4.30k|    nStackAtom[++nTopStackAtom] = (AT_NUMB)u;
 2195|       |    /* nNumStartChildren = 0; */
 2196|  4.30k|    num_rings = 0;
 2197|       |
 2198|       |    /* DFS */
 2199|  4.30k|    do
 2200|  26.7k|    {
 2201|       |        /* advance */
 2202|  79.2k|        while (i = (int)nStackAtom[nTopStackAtom], j = (int)cNeighNumb[i] + 1, (int)nl[i][0] >= j)
  ------------------
  |  Branch (2202:16): [True: 52.5k, False: 26.7k]
  ------------------
 2203|       |            /*while ( (int)nl[i=nStackAtom[nTopStackAtom]][0] >= (j = (int)cNeighNumb[i]+1) )*/
 2204|       |
 2205|       |            /* replaced due to missing sequence point; undefined behavior, pointed by Geoffrey Hutchison */
 2206|  52.5k|        {
 2207|  52.5k|            cNeighNumb[i]++;
 2208|  52.5k|            u = (int)nl[i][j]; /*  jth neighbor of the vertex i */
 2209|  52.5k|            if (!nDfsNumber[u])
  ------------------
  |  Branch (2209:17): [True: 22.4k, False: 30.1k]
  ------------------
 2210|  22.4k|            {
 2211|       |                /* tree edge, 1st visit -- advance */
 2212|       |                /* put unexplored vertex u on the stack for further examination */
 2213|  22.4k|                nStackAtom[++nTopStackAtom] = (AT_NUMB)u;
 2214|  22.4k|                nDfsNumber[u] = ++nDfs;
 2215|  22.4k|                if (bCtPredecessors)
  ------------------
  |  Branch (2215:21): [True: 0, False: 22.4k]
  ------------------
 2216|      0|                {
 2217|      0|                    nNumDescendants[u] = i + 1; /* predecessor's rank */
 2218|      0|                }
 2219|  22.4k|                else
 2220|  22.4k|                {
 2221|  22.4k|                    nNumDescendants[u]++; /* count atom u as its descendant */
 2222|  22.4k|                }
 2223|  22.4k|            }
 2224|  30.1k|            else
 2225|  30.1k|            {
 2226|  30.1k|                if (nTopStackAtom && u != (int)nStackAtom[nTopStackAtom - 1] &&
  ------------------
  |  Branch (2226:21): [True: 29.2k, False: 964]
  |  Branch (2226:38): [True: 6.79k, False: 22.4k]
  ------------------
 2227|       |                    /* back edge: u is not a predecessor of i */
 2228|  6.79k|                    nDfsNumber[u] < nDfsNumber[i])
  ------------------
  |  Branch (2228:21): [True: 3.87k, False: 2.91k]
  ------------------
 2229|  3.87k|                {
 2230|       |                    /* Back edge, 1st visit: u is an ancestor of i (ring closure) */
 2231|  3.87k|                    if (!bCtPredecessors)
  ------------------
  |  Branch (2231:25): [True: 3.87k, False: 0]
  ------------------
 2232|  3.87k|                    {
 2233|  3.87k|                        nNumDescendants[i]++; /* count closures as descendants */
 2234|  3.87k|                    }
 2235|  3.87k|                    num_rings++;          /* count ring closures */
 2236|  3.87k|                }
 2237|  26.2k|                else
 2238|  26.2k|                {
 2239|  26.2k|                    nl[i][j] = MAX_ATOMS + 1; /* back edge, 2nd visit: mark as deleted */
  ------------------
  |  |   15|  26.2k|#define MAX_ATOMS  32766
  ------------------
 2240|  26.2k|                }
 2241|  30.1k|            }
 2242|  52.5k|        }
 2243|  26.7k|        cNeighNumb[i] = 0; /* all neighbors of the ith atom have been
 2244|       |                              traversed; resore the neighbor counter */
 2245|       |                              /* back up */
 2246|  26.7k|        if (!bCtPredecessors && nTopStackAtom /* that is, i != start */)
  ------------------
  |  Branch (2246:13): [True: 26.7k, False: 0]
  |  Branch (2246:33): [True: 22.4k, False: 4.30k]
  ------------------
 2247|  22.4k|        {
 2248|  22.4k|            u = (int)nStackAtom[nTopStackAtom - 1]; /* predecessor of i */
 2249|  22.4k|            nNumDescendants[u] += nNumDescendants[i]; /* add descendants */
 2250|  22.4k|        }
 2251|  26.7k|    } while (--nTopStackAtom >= 0);
  ------------------
  |  Branch (2251:14): [True: 22.4k, False: 4.30k]
  ------------------
 2252|       |
 2253|       |    /* Sort the neighbors in ascending order so that:
 2254|       |       primary key   = number of descendants in the DFS tree; closure neighbor is 0
 2255|       |       secondary key = canonical number (here vertex number = canonical number - 1)
 2256|       |     */
 2257|       |
 2258|  4.30k|    os.m_gDfs4CT_nDfsNumber = nDfsNumber;
 2259|  4.30k|    os.m_gDfs4CT_nNumDescendants = nNumDescendants;
 2260|  4.30k|    os.m_gDfs4CT_nCurrentAtom = -1;
 2261|       |
 2262|       |    /* sorting; deleted will be the last neighbors */
 2263|  31.0k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (2263:17): [True: 26.7k, False: 4.30k]
  ------------------
 2264|  26.7k|    {
 2265|  26.7k|        if (nl[i][0] > 1)
  ------------------
  |  Branch (2265:13): [True: 17.3k, False: 9.39k]
  ------------------
 2266|  17.3k|        {
 2267|  17.3k|            os.m_gDfs4CT_nCurrentAtom = i;
 2268|  17.3k|            insertions_sort(&os, &nl[i][1], nl[i][0], sizeof(nl[i][1]), CompareDfsDescendants4CT);
 2269|  17.3k|        }
 2270|       |        /* reduce number of neighbors to exclude deleted */
 2271|  53.0k|        for (k = 0; k < nl[i][0] && nl[i][k + 1] <= MAX_ATOMS; k++)
  ------------------
  |  |   15|  49.4k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (2271:21): [True: 49.4k, False: 3.52k]
  |  Branch (2271:37): [True: 26.2k, False: 23.1k]
  ------------------
 2272|  26.2k|        {
 2273|  26.2k|            ;
 2274|  26.2k|        }
 2275|  26.7k|        nl[i][0] = k;
 2276|  26.7k|    }
 2277|       |
 2278|  4.30k|    nTotOutputStringLen = 3 * (num_atoms + num_rings + 1); /*  last 3 elements are a 'zero termination' */
 2279|       |
 2280|  4.30k|    if (bCtPredecessors)
  ------------------
  |  Branch (2280:9): [True: 0, False: 4.30k]
  ------------------
 2281|      0|    {
 2282|      0|        if ((nOutputString = (AT_RANK*)inchi_calloc(nTotOutputStringLen, sizeof(nOutputString[0])))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (2282:13): [True: 0, False: 0]
  ------------------
 2283|      0|        {
 2284|      0|            cDelim = '-';
 2285|      0|            for (u = 0, k = -3; u < num_atoms; u++)
  ------------------
  |  Branch (2285:33): [True: 0, False: 0]
  ------------------
 2286|      0|            {
 2287|      0|                k += 3;
 2288|      0|                if (k + 6 > nTotOutputStringLen)
  ------------------
  |  Branch (2288:21): [True: 0, False: 0]
  ------------------
 2289|      0|                {
 2290|      0|                    goto exit_error;  /* program error */
 2291|      0|                }
 2292|      0|                nOutputString[k] = nNumDescendants[u] ? nNumDescendants[u] : MAX_ATOMS + 1;
  ------------------
  |  |   15|      0|#define MAX_ATOMS  32766
  ------------------
  |  Branch (2292:36): [True: 0, False: 0]
  ------------------
 2293|      0|                nOutputString[k + 1] = nNum_H ? 16 + nNum_H[u] : 0;
  ------------------
  |  Branch (2293:40): [True: 0, False: 0]
  ------------------
 2294|      0|                nOutputString[k + 2] = k ? ',' : '\0';
  ------------------
  |  Branch (2294:40): [True: 0, False: 0]
  ------------------
 2295|      0|                for (j = 1; j <= nl[u][0] && nDfsNumber[u] > nDfsNumber[i = nl[u][j]]; j++)
  ------------------
  |  Branch (2295:29): [True: 0, False: 0]
  |  Branch (2295:46): [True: 0, False: 0]
  ------------------
 2296|      0|                {
 2297|       |                    /* closures */
 2298|      0|                    k += 3;
 2299|      0|                    if (k + 6 > nTotOutputStringLen)
  ------------------
  |  Branch (2299:25): [True: 0, False: 0]
  ------------------
 2300|      0|                    {
 2301|      0|                        goto exit_error;  /* program error */
 2302|      0|                    }
 2303|      0|                    nOutputString[k] = i + 1;  /* closure */
 2304|      0|                    nOutputString[k + 1] = 0;
 2305|      0|                    nOutputString[k + 2] = cDelim;
 2306|      0|                }
 2307|      0|            }
 2308|      0|        }
 2309|      0|    }
 2310|  4.30k|    else
 2311|  4.30k|    {
 2312|  4.30k|        if (nNumDescendants)
  ------------------
  |  Branch (2312:13): [True: 4.30k, False: 0]
  ------------------
 2313|  4.30k|        {  /* do not need anymore */
 2314|  4.30k|            inchi_free(nNumDescendants);
  ------------------
  |  | 1152|  4.30k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 4.30k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 4.30k]
  |  |  ------------------
  ------------------
 2315|  4.30k|            nNumDescendants = NULL;
 2316|  4.30k|        }
 2317|       |
 2318|       |        /*
 2319|       |            the output string contains:
 2320|       |              (num_atoms) atoms for the DFS (spanning) tree
 2321|       |              (num_atoms-1) delimiters for the DFS (spanning) tree
 2322|       |              1 character for each atom that has 1 terminal hydrogen atoms
 2323|       |              2 characters  for each atom that has 2-9 terminal hydrogen atoms
 2324|       |              3 characters  for each atom that has 10-99 terminal hydrogen atoms, etc.
 2325|       |              (num_rings) atoms for the ring closures
 2326|       |              (num_rings) delimiters for the ring closures
 2327|       |        */
 2328|       |
 2329|  4.30k|        if ((nOutputString = (AT_RANK*)inchi_calloc(nTotOutputStringLen, sizeof(nOutputString[0])))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 1146|  4.30k|#define inchi_calloc   calloc
  ------------------
  |  Branch (2329:13): [True: 4.30k, False: 0]
  ------------------
 2330|  4.30k|        {
 2331|  4.30k|            u = start; /*  start atom */
 2332|  4.30k|            nTopStackAtom = -1;
 2333|  4.30k|            memset(cNeighNumb, 0, num_atoms * sizeof(cNeighNumb[0])); /* djb-rwth: memset_s C11/Annex K variant? */
 2334|       |            /*  push the start atom on the stack */
 2335|  4.30k|            nStackAtom[++nTopStackAtom] = (AT_NUMB)u;
 2336|       |            /*  output the starting atom */
 2337|  4.30k|            k = 0;
 2338|  4.30k|            nOutputString[k] = u + 1;
 2339|  4.30k|            nOutputString[k + 1] = nNum_H ? 16 + nNum_H[u] : 0;
  ------------------
  |  Branch (2339:36): [True: 0, False: 4.30k]
  ------------------
 2340|  4.30k|            nOutputString[k + 2] = '\0';
 2341|       |
 2342|  4.30k|            do
 2343|  26.7k|            {
 2344|       |                /* advance */
 2345|  53.0k|                while (i = (int)nStackAtom[nTopStackAtom], j = (int)cNeighNumb[i] + 1, i < num_atoms && (int)nl[i][0] >= j) /* djb-rwth: additional condition to avoid buffer overruns */
  ------------------
  |  Branch (2345:24): [True: 26.2k, False: 26.7k]
  |  Branch (2345:88): [True: 53.0k, False: 0]
  |  Branch (2345:105): [True: 26.2k, False: 26.7k]
  ------------------
 2346|       |                    /*while ( (int)nl[i=nStackAtom[nTopStackAtom]][0] >= (j = (int)cNeighNumb[i]+1) )*/
 2347|       |                    /* replaced due to missing sequence point; undefined behavior, reported by Geoffrey Hutchison */
 2348|  26.2k|                {
 2349|  26.2k|                    k += 3;
 2350|  26.2k|                    if (k + 6 > nTotOutputStringLen)
  ------------------
  |  Branch (2350:25): [True: 0, False: 26.2k]
  ------------------
 2351|      0|                    {
 2352|      0|                        goto exit_error;  /* program error */
 2353|      0|                    }
 2354|  26.2k|                    cNeighNumb[i]++;
 2355|  26.2k|                    u = (int)nl[i][j]; /* neighbor */
 2356|       |
 2357|       |                    /* output neighbor's canonical number */
 2358|  26.2k|                    nOutputString[k] = u + 1;
 2359|       |
 2360|  26.2k|                    if (nDfsNumber[u] > nDfsNumber[i])
  ------------------
  |  Branch (2360:25): [True: 22.4k, False: 3.87k]
  ------------------
 2361|  22.4k|                    {
 2362|       |                        /* tree edge, 1st visit -- advance */
 2363|       |                        /* put 'unexplored' vertex u on the stack */
 2364|  22.4k|                        nStackAtom[++nTopStackAtom] = (AT_NUMB)u;
 2365|       |
 2366|       |                        /* output neighbor's number of H */
 2367|  22.4k|                        nOutputString[k + 1] = nNum_H ? 16 + nNum_H[u] : 0;
  ------------------
  |  Branch (2367:48): [True: 0, False: 22.4k]
  ------------------
 2368|  22.4k|                    }
 2369|  3.87k|                    else
 2370|  3.87k|                    {
 2371|  3.87k|                        nOutputString[k + 1] = 0;
 2372|  3.87k|                    }
 2373|       |                    /* output a delimiter preceding the neighbor */
 2374|  26.2k|                    if (1 < nl[i][0])
  ------------------
  |  Branch (2374:25): [True: 9.58k, False: 16.7k]
  ------------------
 2375|  9.58k|                    {
 2376|  9.58k|                        if (j == 1)
  ------------------
  |  Branch (2376:29): [True: 4.12k, False: 5.45k]
  ------------------
 2377|  4.12k|                        {
 2378|  4.12k|                            cDelim = '(';
 2379|  4.12k|                        }
 2380|  5.45k|                        else
 2381|  5.45k|                        {
 2382|  5.45k|                            if (j == nl[i][0])
  ------------------
  |  Branch (2382:33): [True: 4.12k, False: 1.32k]
  ------------------
 2383|  4.12k|                            {
 2384|  4.12k|                                cDelim = ')';
 2385|  4.12k|                            }
 2386|  1.32k|                            else
 2387|  1.32k|                            {
 2388|  1.32k|                                cDelim = ',';
 2389|  1.32k|                            }
 2390|  5.45k|                        }
 2391|  9.58k|                    }
 2392|  16.7k|                    else
 2393|  16.7k|                    {
 2394|  16.7k|                        cDelim = '-';
 2395|  16.7k|                    }
 2396|  26.2k|                    nOutputString[k + 2] = cDelim;
 2397|  26.2k|                }
 2398|       |
 2399|  26.7k|                if ((i >= 0) && (i < num_atoms)) /* djb-rwth: fixing coverity ID #499483 */
  ------------------
  |  Branch (2399:21): [True: 26.7k, False: 0]
  |  Branch (2399:33): [True: 26.7k, False: 0]
  ------------------
 2400|  26.7k|                {
 2401|  26.7k|                    cNeighNumb[i] = 0;
 2402|  26.7k|                }
 2403|       |
 2404|       |                /* back up: nothing else to do */
 2405|  26.7k|            } while (--nTopStackAtom >= 0);
  ------------------
  |  Branch (2405:22): [True: 22.4k, False: 4.30k]
  ------------------
 2406|  4.30k|        }
 2407|  4.30k|    }
 2408|  4.30k|    goto exit_function;
 2409|       |
 2410|  4.30k|exit_error:
 2411|      0|    if (nOutputString)
  ------------------
  |  Branch (2411:9): [True: 0, False: 0]
  ------------------
 2412|      0|    {
 2413|      0|        inchi_free(nOutputString);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2414|      0|        nOutputString = NULL;
 2415|      0|    }
 2416|       |
 2417|  4.30k|exit_function:
 2418|  4.30k|    if (nStackAtom)
  ------------------
  |  Branch (2418:9): [True: 4.30k, False: 0]
  ------------------
 2419|  4.30k|    {
 2420|  4.30k|        inchi_free(nStackAtom);
  ------------------
  |  | 1152|  4.30k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 4.30k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 4.30k]
  |  |  ------------------
  ------------------
 2421|  4.30k|    }
 2422|  4.30k|    if (nNumDescendants)
  ------------------
  |  Branch (2422:9): [True: 0, False: 4.30k]
  ------------------
 2423|      0|    {
 2424|      0|        inchi_free(nNumDescendants);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2425|      0|    }
 2426|  4.30k|    if (nDfsNumber)
  ------------------
  |  Branch (2426:9): [True: 4.30k, False: 0]
  ------------------
 2427|  4.30k|    {
 2428|  4.30k|        inchi_free(nDfsNumber);
  ------------------
  |  | 1152|  4.30k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 4.30k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 4.30k]
  |  |  ------------------
  ------------------
 2429|  4.30k|    }
 2430|  4.30k|    if (cNeighNumb)
  ------------------
  |  Branch (2430:9): [True: 4.30k, False: 0]
  ------------------
 2431|  4.30k|    {
 2432|  4.30k|        inchi_free(cNeighNumb);
  ------------------
  |  | 1152|  4.30k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 4.30k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 4.30k]
  |  |  ------------------
  ------------------
 2433|  4.30k|    }
 2434|  4.30k|    if (nl)
  ------------------
  |  Branch (2434:9): [True: 4.30k, False: 0]
  ------------------
 2435|  4.30k|    {
 2436|  4.30k|        FreeNeighList(nl);
 2437|  4.30k|    }
 2438|       |
 2439|  4.30k|    return nOutputString;
 2440|      0|}
CompareReversedStereoINChI:
 2522|  61.0k|{
 2523|  61.0k|    if (s1 == NULL && s2 == NULL)
  ------------------
  |  Branch (2523:9): [True: 60.7k, False: 344]
  |  Branch (2523:23): [True: 30.4k, False: 30.2k]
  ------------------
 2524|  30.4k|    {
 2525|  30.4k|        return 0;
 2526|  30.4k|    }
 2527|  30.5k|    if ((s1 == NULL) ^ (s2 == NULL))
  ------------------
  |  Branch (2527:9): [True: 30.2k, False: 306]
  ------------------
 2528|  30.2k|    {
 2529|  30.2k|        INChI_Stereo* s = s1 ? s1 : s2;
  ------------------
  |  Branch (2529:27): [True: 38, False: 30.2k]
  ------------------
 2530|  30.2k|        if (s->nNumberOfStereoCenters || s->nNumberOfStereoBonds)
  ------------------
  |  Branch (2530:13): [True: 63, False: 30.2k]
  |  Branch (2530:42): [True: 33, False: 30.1k]
  ------------------
 2531|     96|        {
 2532|     96|            return 20; /* Diff: Missing Stereo */
 2533|     96|        }
 2534|  30.1k|        else
 2535|  30.1k|        {
 2536|  30.1k|            return 0;
 2537|  30.1k|        }
 2538|  30.2k|    }
 2539|       |
 2540|    306|    if (s1->nNumberOfStereoCenters != s2->nNumberOfStereoCenters)
  ------------------
  |  Branch (2540:9): [True: 81, False: 225]
  ------------------
 2541|     81|    {
 2542|     81|        return 21;      /* Diff: Number of sp3 stereocenters */
 2543|     81|    }
 2544|    225|    if (s1->nNumberOfStereoCenters > 0)
  ------------------
  |  Branch (2544:9): [True: 89, False: 136]
  ------------------
 2545|     89|    {
 2546|     89|        if (memcmp(s1->nNumber, s2->nNumber, s1->nNumberOfStereoCenters * sizeof(s1->nNumber[0])))
  ------------------
  |  Branch (2546:13): [True: 27, False: 62]
  ------------------
 2547|     27|        {
 2548|     27|            return 22;  /* Diff: sp3 stereocenter locations */
 2549|     27|        }
 2550|     62|        if (memcmp(s1->t_parity, s2->t_parity, s1->nNumberOfStereoCenters * sizeof(s1->t_parity[0])))
  ------------------
  |  Branch (2550:13): [True: 11, False: 51]
  ------------------
 2551|     11|        {
 2552|     11|            return 23;  /* Diff: sp3 stereocenter parities */
 2553|     11|        }
 2554|     51|        if (s1->nCompInv2Abs != s2->nCompInv2Abs && s1->nCompInv2Abs && s2->nCompInv2Abs)
  ------------------
  |  Branch (2554:13): [True: 8, False: 43]
  |  Branch (2554:53): [True: 2, False: 6]
  |  Branch (2554:73): [True: 0, False: 2]
  ------------------
 2555|      0|        {
 2556|      0|            return 24;  /* Diff: sp3 inversion */
 2557|      0|        }
 2558|       |        /*
 2559|       |        if ( s1->nNumberInv && s2->nNumberInv ) {
 2560|       |            if ( memcmp( s1->nNumberInv, s2->nNumberInv, s1->nNumberOfStereoCenters*sizeof(s1->nNumber[0]) ) )
 2561|       |                return 25;
 2562|       |            if ( memcmp( s1->t_parityInv, s2->t_parityInv, s1->nNumberOfStereoCenters*sizeof(s1->t_parity[0]) ) )
 2563|       |                return 26;
 2564|       |            if ( s1->nCompInv2Abs != s2->nCompInv2Abs ||
 2565|       |                 s1->bTrivialInv  != s2->bTrivialInv ) {
 2566|       |                return 27;
 2567|       |            }
 2568|       |        } else
 2569|       |        if ( s1->nNumberInv || s2->nNumberInv ) {
 2570|       |            return 28;
 2571|       |        }
 2572|       |        */
 2573|     51|    }
 2574|    187|    if (s1->nNumberOfStereoBonds != s2->nNumberOfStereoBonds)
  ------------------
  |  Branch (2574:9): [True: 60, False: 127]
  ------------------
 2575|     60|    {
 2576|     60|        return 25;      /* Diff: Number of stereobonds */
 2577|     60|    }
 2578|    127|    if (s1->nNumberOfStereoBonds > 0)
  ------------------
  |  Branch (2578:9): [True: 12, False: 115]
  ------------------
 2579|     12|    {
 2580|     12|        if (memcmp(s1->nBondAtom1, s2->nBondAtom1, s1->nNumberOfStereoBonds * sizeof(s1->nBondAtom1[0])))
  ------------------
  |  Branch (2580:13): [True: 0, False: 12]
  ------------------
 2581|      0|        {
 2582|      0|            return 26; /* Diff: Stereobond 1st atom locations */
 2583|      0|        }
 2584|     12|        if (memcmp(s1->nBondAtom2, s2->nBondAtom2, s1->nNumberOfStereoBonds * sizeof(s1->nBondAtom2[0])))
  ------------------
  |  Branch (2584:13): [True: 0, False: 12]
  ------------------
 2585|      0|        {
 2586|      0|            return 27; /* Diff: Stereobond 2nd atom locations */
 2587|      0|        }
 2588|     12|        if (memcmp(s1->b_parity, s2->b_parity, s1->nNumberOfStereoBonds * sizeof(s1->b_parity[0])))
  ------------------
  |  Branch (2588:13): [True: 0, False: 12]
  ------------------
 2589|      0|        {
 2590|      0|            return 28; /* Diff: Stereobond parities */
 2591|      0|        }
 2592|     12|    }
 2593|       |
 2594|    127|    return 0;
 2595|    127|}
CompareReversedStereoINChI2:
 2602|  41.3k|{
 2603|  41.3k|    int ret = 0;
 2604|  41.3k|    int j1, j2, num_dif, num_extra_undf, num_miss_undf, num_in1_only, num_in2_only; /* djb-rwth: removing redundant variables */
 2605|  41.3k|    int bAddSb = !(picr->num_sb_undef_in1_only + picr->num_sb_in1_only + picr->num_sb_in2_only);
 2606|  41.3k|    int bAddSc = !(picr->num_sc_undef_in1_only + picr->num_sc_in1_only + picr->num_sc_in2_only);
 2607|       |
 2608|  41.3k|    int nNumSc1 = s1 ? s1->nNumberOfStereoCenters : 0;
  ------------------
  |  Branch (2608:19): [True: 41.3k, False: 0]
  ------------------
 2609|  41.3k|    int nNumSc2 = s2 ? s2->nNumberOfStereoCenters : 0;
  ------------------
  |  Branch (2609:19): [True: 1.84k, False: 39.4k]
  ------------------
 2610|  41.3k|    int nNumSb1 = s1 ? s1->nNumberOfStereoBonds : 0;
  ------------------
  |  Branch (2610:19): [True: 41.3k, False: 0]
  ------------------
 2611|  41.3k|    int nNumSb2 = s2 ? s2->nNumberOfStereoBonds : 0;
  ------------------
  |  Branch (2611:19): [True: 1.84k, False: 39.4k]
  ------------------
 2612|       |
 2613|       |    /* djb-rwth: redundant part of the condition corrected; fixing a NULL pointer dereference */
 2614|  41.3k|    if (s1 && s2 && (nNumSc1 || nNumSc2) && (nNumSc1 != nNumSc2 ||
  ------------------
  |  Branch (2614:9): [True: 41.3k, False: 0]
  |  Branch (2614:15): [True: 1.84k, False: 39.4k]
  |  Branch (2614:22): [True: 338, False: 1.51k]
  |  Branch (2614:33): [True: 186, False: 1.32k]
  |  Branch (2614:46): [True: 433, False: 91]
  ------------------
 2615|     91|        memcmp(s1->nNumber, s2->nNumber, nNumSc1 * sizeof(s1->nNumber[0])) ||
  ------------------
  |  Branch (2615:9): [True: 16, False: 75]
  ------------------
 2616|     75|        memcmp(s1->t_parity, s2->t_parity, nNumSc1 * sizeof(s1->t_parity[0]))))
  ------------------
  |  Branch (2616:9): [True: 36, False: 39]
  ------------------
 2617|    485|    {
 2618|    485|        num_dif = num_extra_undf = num_miss_undf = num_in1_only = num_in2_only = 0;
 2619|  1.19k|        for (j1 = j2 = 0; j1 < nNumSc1 && j2 < nNumSc2; )
  ------------------
  |  Branch (2619:27): [True: 883, False: 311]
  |  Branch (2619:43): [True: 709, False: 174]
  ------------------
 2620|    709|        {
 2621|    709|            if (s1->nNumber[j1] == s2->nNumber[j2])
  ------------------
  |  Branch (2621:17): [True: 433, False: 276]
  ------------------
 2622|    433|            {
 2623|    433|                if (s1->t_parity[j1] != s2->t_parity[j2]) /* djb-rwth: removing redundant code */
  ------------------
  |  Branch (2623:21): [True: 267, False: 166]
  ------------------
 2624|    267|                {
 2625|    267|                    num_dif++;
 2626|    267|                }
 2627|    433|                j1++;
 2628|    433|                j2++;
 2629|    433|            }
 2630|    276|            else
 2631|    276|            {
 2632|    276|                if (s1->nNumber[j1] < s2->nNumber[j2])
  ------------------
  |  Branch (2632:21): [True: 254, False: 22]
  ------------------
 2633|    254|                {
 2634|    254|                    num_in1_only++;
 2635|    254|                    if (s1->t_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  222|    254|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2635:25): [True: 168, False: 86]
  ------------------
 2636|    168|                    {
 2637|    168|                        num_extra_undf++;
 2638|    168|                    }
 2639|    254|                    if (bAddSc)
  ------------------
  |  Branch (2639:25): [True: 254, False: 0]
  ------------------
 2640|    254|                    {
 2641|    254|                        if (picr->num_sc_in1_only < ICR_MAX_SC_IN1_ONLY)
  ------------------
  |  |  375|    254|#define ICR_MAX_SC_IN1_ONLY 32
  ------------------
  |  Branch (2641:29): [True: 254, False: 0]
  ------------------
 2642|    254|                        {
 2643|    254|                            picr->sc_in1_only[picr->num_sc_in1_only++] = j1;
 2644|    254|                        }
 2645|    254|                        if (s1->t_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  222|    254|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2645:29): [True: 168, False: 86]
  ------------------
 2646|    168|                        {
 2647|    168|                            if (picr->num_sc_undef_in1_only < ICR_MAX_SC_UNDF)
  ------------------
  |  |  378|    168|#define ICR_MAX_SC_UNDF 32
  ------------------
  |  Branch (2647:33): [True: 168, False: 0]
  ------------------
 2648|    168|                            {
 2649|    168|                                picr->sc_undef_in1_only[picr->num_sc_undef_in1_only++] = j1;
 2650|    168|                            }
 2651|    168|                        }
 2652|    254|                    }
 2653|    254|                    j1++;
 2654|    254|                }
 2655|     22|                else
 2656|     22|                {
 2657|     22|                    num_in2_only++;
 2658|     22|                    if (s2->t_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  222|     22|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2658:25): [True: 4, False: 18]
  ------------------
 2659|      4|                    {
 2660|      4|                        num_miss_undf++;
 2661|      4|                    }
 2662|     22|                    if (bAddSc)
  ------------------
  |  Branch (2662:25): [True: 22, False: 0]
  ------------------
 2663|     22|                    {
 2664|     22|                        if (picr->num_sc_in2_only < ICR_MAX_SC_IN2_ONLY)
  ------------------
  |  |  376|     22|#define ICR_MAX_SC_IN2_ONLY 32
  ------------------
  |  Branch (2664:29): [True: 22, False: 0]
  ------------------
 2665|     22|                        {
 2666|     22|                            picr->sc_in2_only[picr->num_sc_in2_only++] = j2;
 2667|     22|                        }
 2668|     22|                        if (s2->t_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  222|     22|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2668:29): [True: 4, False: 18]
  ------------------
 2669|      4|                        {
 2670|      4|                            if (picr->num_sc_undef_in2_only < ICR_MAX_SC_UNDF)
  ------------------
  |  |  378|      4|#define ICR_MAX_SC_UNDF 32
  ------------------
  |  Branch (2670:33): [True: 4, False: 0]
  ------------------
 2671|      4|                            {
 2672|      4|                                picr->sc_undef_in2_only[picr->num_sc_undef_in2_only++] = j1;
 2673|      4|                            }
 2674|      4|                        }
 2675|     22|                    }
 2676|     22|                    j2++;
 2677|     22|                }
 2678|    276|            }
 2679|    709|        }
 2680|    734|        while (j1 < nNumSc1)
  ------------------
  |  Branch (2680:16): [True: 249, False: 485]
  ------------------
 2681|    249|        {
 2682|    249|            if (s1->t_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  222|    249|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2682:17): [True: 233, False: 16]
  ------------------
 2683|    233|            {
 2684|    233|                num_extra_undf++;
 2685|    233|            }
 2686|    249|            num_in1_only++;
 2687|    249|            if (bAddSc)
  ------------------
  |  Branch (2687:17): [True: 249, False: 0]
  ------------------
 2688|    249|            {
 2689|    249|                if (picr->num_sc_in1_only < ICR_MAX_SC_IN1_ONLY)
  ------------------
  |  |  375|    249|#define ICR_MAX_SC_IN1_ONLY 32
  ------------------
  |  Branch (2689:21): [True: 249, False: 0]
  ------------------
 2690|    249|                {
 2691|    249|                    picr->sc_in1_only[picr->num_sc_in1_only++] = j1;
 2692|    249|                }
 2693|    249|                if (s1->t_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  222|    249|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2693:21): [True: 233, False: 16]
  ------------------
 2694|    233|                {
 2695|    233|                    if (picr->num_sc_undef_in1_only < ICR_MAX_SC_UNDF)
  ------------------
  |  |  378|    233|#define ICR_MAX_SC_UNDF 32
  ------------------
  |  Branch (2695:25): [True: 233, False: 0]
  ------------------
 2696|    233|                    {
 2697|    233|                        picr->sc_undef_in1_only[picr->num_sc_undef_in1_only++] = j1;
 2698|    233|                    }
 2699|    233|                }
 2700|    249|            }
 2701|    249|            j1++;
 2702|    249|        }
 2703|    790|        while (j2 < nNumSc2)
  ------------------
  |  Branch (2703:16): [True: 305, False: 485]
  ------------------
 2704|    305|        {
 2705|    305|            if (s2->t_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  222|    305|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2705:17): [True: 43, False: 262]
  ------------------
 2706|     43|            {
 2707|     43|                num_miss_undf++;
 2708|     43|            }
 2709|    305|            num_in2_only++;
 2710|    305|            if (bAddSc)
  ------------------
  |  Branch (2710:17): [True: 305, False: 0]
  ------------------
 2711|    305|            {
 2712|    305|                if (picr->num_sc_in2_only < ICR_MAX_SC_IN2_ONLY)
  ------------------
  |  |  376|    305|#define ICR_MAX_SC_IN2_ONLY 32
  ------------------
  |  Branch (2712:21): [True: 305, False: 0]
  ------------------
 2713|    305|                {
 2714|    305|                    picr->sc_in2_only[picr->num_sc_in2_only++] = j2;
 2715|    305|                }
 2716|    305|            }
 2717|    305|            j2++;
 2718|    305|        }
 2719|    485|        if (num_dif)
  ------------------
  |  Branch (2719:13): [True: 216, False: 269]
  ------------------
 2720|    216|        {
 2721|    216|            ret |= IDIF_SC_PARITY;
 2722|    216|        }
 2723|    485|        if (num_in1_only)
  ------------------
  |  Branch (2723:13): [True: 246, False: 239]
  ------------------
 2724|    246|        {
 2725|    246|            if (num_extra_undf)
  ------------------
  |  Branch (2725:17): [True: 200, False: 46]
  ------------------
 2726|    200|            {
 2727|    200|                ret |= IDIF_SC_EXTRA_UNDF;
 2728|    200|            }
 2729|    246|            if (num_in1_only != num_extra_undf)
  ------------------
  |  Branch (2729:17): [True: 95, False: 151]
  ------------------
 2730|     95|            {
 2731|     95|                ret |= IDIF_SC_EXTRA;
 2732|     95|            }
 2733|    246|        }
 2734|    485|        if (num_in2_only)
  ------------------
  |  Branch (2734:13): [True: 240, False: 245]
  ------------------
 2735|    240|        {
 2736|    240|            if (num_miss_undf)
  ------------------
  |  Branch (2736:17): [True: 44, False: 196]
  ------------------
 2737|     44|            {
 2738|     44|                ret |= IDIF_SC_MISS_UNDF;
 2739|     44|            }
 2740|    240|            if (num_in2_only != num_miss_undf)
  ------------------
  |  Branch (2740:17): [True: 206, False: 34]
  ------------------
 2741|    206|            {
 2742|    206|                ret |= IDIF_SC_MISS;
 2743|    206|            }
 2744|    240|        }
 2745|    485|    }
 2746|  41.3k|    if (s1 && s2 && s1->nCompInv2Abs != s2->nCompInv2Abs && s1->nCompInv2Abs && s2->nCompInv2Abs)
  ------------------
  |  Branch (2746:9): [True: 41.3k, False: 0]
  |  Branch (2746:15): [True: 1.84k, False: 39.4k]
  |  Branch (2746:21): [True: 156, False: 1.69k]
  |  Branch (2746:61): [True: 148, False: 8]
  |  Branch (2746:81): [True: 5, False: 143]
  ------------------
 2747|      5|    {
 2748|      5|        ret |= IDIF_SC_INV;
 2749|      5|    }
 2750|       |
 2751|  41.3k|    if ((nNumSb1 || nNumSb2) &&
  ------------------
  |  Branch (2751:10): [True: 317, False: 41.0k]
  |  Branch (2751:21): [True: 570, False: 40.4k]
  ------------------
 2752|    887|        (nNumSb1 != nNumSb2 ||
  ------------------
  |  Branch (2752:10): [True: 760, False: 127]
  ------------------
 2753|    127|            memcmp(s1->nBondAtom1, s2->nBondAtom1, nNumSb1 * sizeof(s1->nBondAtom1[0])) ||
  ------------------
  |  Branch (2753:13): [True: 41, False: 86]
  ------------------
 2754|     86|            memcmp(s1->nBondAtom2, s2->nBondAtom2, nNumSb1 * sizeof(s1->nBondAtom2[0])) ||
  ------------------
  |  Branch (2754:13): [True: 0, False: 86]
  ------------------
 2755|     86|            memcmp(s1->b_parity, s2->b_parity, nNumSb1 * sizeof(s1->b_parity[0]))))
  ------------------
  |  Branch (2755:13): [True: 6, False: 80]
  ------------------
 2756|    807|    {
 2757|    807|        num_dif = num_extra_undf = num_miss_undf = num_in1_only = num_in2_only = 0; /* djb-rwth: removing redundant code */
 2758|  1.39k|        for (j1 = j2 = 0; j1 < nNumSb1 && j2 < nNumSb2; )
  ------------------
  |  Branch (2758:27): [True: 747, False: 652]
  |  Branch (2758:43): [True: 592, False: 155]
  ------------------
 2759|    592|        {
 2760|    592|            if (s1->nBondAtom1[j1] == s2->nBondAtom1[j2] &&
  ------------------
  |  Branch (2760:17): [True: 225, False: 367]
  ------------------
 2761|    225|                s1->nBondAtom2[j1] == s2->nBondAtom2[j2])
  ------------------
  |  Branch (2761:17): [True: 195, False: 30]
  ------------------
 2762|    195|            {
 2763|    195|                if (s1->b_parity[j1] != s2->b_parity[j2]) /* djb-rwth: removing redundant code */
  ------------------
  |  Branch (2763:21): [True: 78, False: 117]
  ------------------
 2764|     78|                {
 2765|     78|                    num_dif++;
 2766|     78|                }
 2767|    195|                j1++;
 2768|    195|                j2++;
 2769|    195|            }
 2770|    397|            else
 2771|    397|            {
 2772|    397|                if (s1->nBondAtom1[j1] < s2->nBondAtom1[j2] ||
  ------------------
  |  Branch (2772:21): [True: 337, False: 60]
  ------------------
 2773|     60|                    (s1->nBondAtom1[j1] == s2->nBondAtom1[j2] && s1->nBondAtom2[j1] < s2->nBondAtom2[j2])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2773:22): [True: 30, False: 30]
  |  Branch (2773:66): [True: 30, False: 0]
  ------------------
 2774|    367|                {
 2775|    367|                    num_in1_only++;
 2776|    367|                    if (s1->b_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  222|    367|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2776:25): [True: 282, False: 85]
  ------------------
 2777|    282|                    {
 2778|    282|                        num_extra_undf++;
 2779|    282|                    }
 2780|    367|                    if (bAddSb)
  ------------------
  |  Branch (2780:25): [True: 367, False: 0]
  ------------------
 2781|    367|                    {
 2782|    367|                        if (picr->num_sb_in1_only < ICR_MAX_SB_IN1_ONLY)
  ------------------
  |  |  373|    367|#define ICR_MAX_SB_IN1_ONLY 32
  ------------------
  |  Branch (2782:29): [True: 367, False: 0]
  ------------------
 2783|    367|                        {
 2784|    367|                            picr->sb_in1_only[picr->num_sb_in1_only++] = j1;
 2785|    367|                        }
 2786|    367|                        if (s1->b_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  222|    367|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2786:29): [True: 282, False: 85]
  ------------------
 2787|    282|                        {
 2788|    282|                            if (picr->num_sb_undef_in1_only < ICR_MAX_SB_UNDF)
  ------------------
  |  |  377|    282|#define ICR_MAX_SB_UNDF 32
  ------------------
  |  Branch (2788:33): [True: 282, False: 0]
  ------------------
 2789|    282|                            {
 2790|    282|                                picr->sb_undef_in1_only[picr->num_sb_undef_in1_only++] = j1;
 2791|    282|                            }
 2792|    282|                        }
 2793|    367|                    }
 2794|    367|                    j1++;
 2795|    367|                }
 2796|     30|                else
 2797|     30|                {
 2798|     30|                    num_in2_only++;
 2799|     30|                    if (s2->b_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  222|     30|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2799:25): [True: 24, False: 6]
  ------------------
 2800|     24|                    {
 2801|     24|                        num_miss_undf++;
 2802|     24|                    }
 2803|     30|                    if (bAddSb)
  ------------------
  |  Branch (2803:25): [True: 30, False: 0]
  ------------------
 2804|     30|                    {
 2805|     30|                        if (picr->num_sb_in2_only < ICR_MAX_SB_IN2_ONLY)
  ------------------
  |  |  374|     30|#define ICR_MAX_SB_IN2_ONLY 32
  ------------------
  |  Branch (2805:29): [True: 30, False: 0]
  ------------------
 2806|     30|                        {
 2807|     30|                            picr->sb_in2_only[picr->num_sb_in2_only++] = j2;
 2808|     30|                        }
 2809|     30|                        if (s2->b_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  222|     30|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2809:29): [True: 24, False: 6]
  ------------------
 2810|     24|                        {
 2811|     24|                            if (picr->num_sb_undef_in2_only < ICR_MAX_SB_UNDF)
  ------------------
  |  |  377|     24|#define ICR_MAX_SB_UNDF 32
  ------------------
  |  Branch (2811:33): [True: 24, False: 0]
  ------------------
 2812|     24|                            {
 2813|     24|                                picr->sb_undef_in2_only[picr->num_sb_undef_in2_only++] = j1;
 2814|     24|                            }
 2815|     24|                        }
 2816|     30|                    }
 2817|     30|                    j2++;
 2818|     30|                }
 2819|    397|            }
 2820|    592|        }
 2821|  1.40k|        while (j1 < nNumSb1)
  ------------------
  |  Branch (2821:16): [True: 597, False: 807]
  ------------------
 2822|    597|        {
 2823|    597|            num_in1_only++;
 2824|    597|            if (s1->b_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  222|    597|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2824:17): [True: 549, False: 48]
  ------------------
 2825|    549|            {
 2826|    549|                num_extra_undf++;
 2827|    549|            }
 2828|    597|            if (bAddSb)
  ------------------
  |  Branch (2828:17): [True: 597, False: 0]
  ------------------
 2829|    597|            {
 2830|    597|                if (picr->num_sb_in1_only < ICR_MAX_SB_IN1_ONLY)
  ------------------
  |  |  373|    597|#define ICR_MAX_SB_IN1_ONLY 32
  ------------------
  |  Branch (2830:21): [True: 597, False: 0]
  ------------------
 2831|    597|                {
 2832|    597|                    picr->sb_in1_only[picr->num_sb_in1_only++] = j1;
 2833|    597|                }
 2834|    597|                if (s1->b_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  222|    597|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2834:21): [True: 549, False: 48]
  ------------------
 2835|    549|                {
 2836|    549|                    if (picr->num_sb_undef_in1_only < ICR_MAX_SB_UNDF)
  ------------------
  |  |  377|    549|#define ICR_MAX_SB_UNDF 32
  ------------------
  |  Branch (2836:25): [True: 549, False: 0]
  ------------------
 2837|    549|                    {
 2838|    549|                        picr->sb_undef_in1_only[picr->num_sb_undef_in1_only++] = j1;
 2839|    549|                    }
 2840|    549|                }
 2841|    597|            }
 2842|    597|            j1++;
 2843|    597|        }
 2844|  1.69k|        while (j2 < nNumSb2)
  ------------------
  |  Branch (2844:16): [True: 885, False: 807]
  ------------------
 2845|    885|        {
 2846|    885|            num_in2_only++;
 2847|    885|            if (s2->b_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  222|    885|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2847:17): [True: 148, False: 737]
  ------------------
 2848|    148|            {
 2849|    148|                num_miss_undf++;
 2850|    148|            }
 2851|    885|            if (bAddSb)
  ------------------
  |  Branch (2851:17): [True: 885, False: 0]
  ------------------
 2852|    885|            {
 2853|    885|                if (picr->num_sb_in2_only < ICR_MAX_SB_IN2_ONLY)
  ------------------
  |  |  374|    885|#define ICR_MAX_SB_IN2_ONLY 32
  ------------------
  |  Branch (2853:21): [True: 885, False: 0]
  ------------------
 2854|    885|                {
 2855|    885|                    picr->sb_in2_only[picr->num_sb_in2_only++] = j2;
 2856|    885|                }
 2857|    885|                if (s2->b_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  222|    885|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2857:21): [True: 148, False: 737]
  ------------------
 2858|    148|                {
 2859|    148|                    if (picr->num_sb_undef_in2_only < ICR_MAX_SB_UNDF)
  ------------------
  |  |  377|    148|#define ICR_MAX_SB_UNDF 32
  ------------------
  |  Branch (2859:25): [True: 148, False: 0]
  ------------------
 2860|    148|                    {
 2861|    148|                        picr->sb_undef_in2_only[picr->num_sb_undef_in2_only++] = j1;
 2862|    148|                    }
 2863|    148|                }
 2864|    885|            }
 2865|    885|            j2++;
 2866|    885|        }
 2867|    807|        if (num_dif)
  ------------------
  |  Branch (2867:13): [True: 60, False: 747]
  ------------------
 2868|     60|        {
 2869|     60|            ret |= IDIF_SB_PARITY;
 2870|     60|        }
 2871|    807|        if (num_in1_only)
  ------------------
  |  Branch (2871:13): [True: 225, False: 582]
  ------------------
 2872|    225|        {
 2873|    225|            if (num_extra_undf)
  ------------------
  |  Branch (2873:17): [True: 208, False: 17]
  ------------------
 2874|    208|            {
 2875|    208|                ret |= IDIF_SB_EXTRA_UNDF;
 2876|    208|            }
 2877|    225|            if (num_in1_only != num_extra_undf)
  ------------------
  |  Branch (2877:17): [True: 102, False: 123]
  ------------------
 2878|    102|            {
 2879|    102|                ret |= IDIF_SB_EXTRA;
 2880|    102|            }
 2881|    225|        }
 2882|    807|        if (num_in2_only)
  ------------------
  |  Branch (2882:13): [True: 637, False: 170]
  ------------------
 2883|    637|        {
 2884|    637|            if (num_miss_undf)
  ------------------
  |  Branch (2884:17): [True: 151, False: 486]
  ------------------
 2885|    151|            {
 2886|    151|                ret |= IDIF_SB_MISS_UNDF;
 2887|    151|            }
 2888|    637|            if (num_in2_only != num_miss_undf)
  ------------------
  |  Branch (2888:17): [True: 541, False: 96]
  ------------------
 2889|    541|            {
 2890|    541|                ret |= IDIF_SB_MISS;
 2891|    541|            }
 2892|    637|        }
 2893|    807|    }
 2894|       |
 2895|  41.3k|    return ret;
 2896|  41.3k|}
CompareReversedINChI:
 2904|  31.7k|{
 2905|  31.7k|    int ret;
 2906|       |
 2907|  31.7k|    if (i1 == NULL && i2 == NULL)
  ------------------
  |  Branch (2907:9): [True: 0, False: 31.7k]
  |  Branch (2907:23): [True: 0, False: 0]
  ------------------
 2908|      0|    {
 2909|      0|        return 0;
 2910|      0|    }
 2911|  31.7k|    if ((i1 == NULL) ^ (i2 == NULL))
  ------------------
  |  Branch (2911:9): [True: 0, False: 31.7k]
  ------------------
 2912|      0|    {
 2913|      0|        return 1; /* Diff: Missing InChI */
 2914|      0|    }
 2915|       |
 2916|  31.7k|    if (i1->nErrorCode == i2->nErrorCode)
  ------------------
  |  Branch (2916:9): [True: 31.7k, False: 0]
  ------------------
 2917|  31.7k|    {
 2918|  31.7k|        if (i1->nErrorCode)
  ------------------
  |  Branch (2918:13): [True: 0, False: 31.7k]
  ------------------
 2919|      0|        {
 2920|      0|            return 0;
 2921|      0|        }
 2922|  31.7k|    }
 2923|      0|    else
 2924|      0|    {
 2925|      0|        return 2; /* Diff: Error codes */
 2926|      0|    }
 2927|  31.7k|    if (i1->bDeleted != i2->bDeleted)
  ------------------
  |  Branch (2927:9): [True: 0, False: 31.7k]
  ------------------
 2928|      0|    {
 2929|      0|        return 1; /* Diff: Missing InChI */
 2930|      0|    }
 2931|  31.7k|    if (i1->nNumberOfAtoms != i2->nNumberOfAtoms)
  ------------------
  |  Branch (2931:9): [True: 0, False: 31.7k]
  ------------------
 2932|      0|    {
 2933|      0|        return 3;  /* Diff: Num. atoms */
 2934|      0|    }
 2935|       |
 2936|  31.7k|    if (i1->nNumberOfAtoms > 0)
  ------------------
  |  Branch (2936:9): [True: 31.7k, False: 0]
  ------------------
 2937|  31.7k|    {
 2938|  31.7k|        if (memcmp(i1->nAtom, i2->nAtom, i1->nNumberOfAtoms * sizeof(i1->nAtom[0])))
  ------------------
  |  Branch (2938:13): [True: 0, False: 31.7k]
  ------------------
 2939|      0|        {
 2940|      0|            return 4; /* Diff: Elements */
 2941|      0|        }
 2942|  31.7k|        if (strcmp(i1->szHillFormula, i2->szHillFormula))
  ------------------
  |  Branch (2942:13): [True: 286, False: 31.4k]
  ------------------
 2943|    286|        {
 2944|    286|            return 7; /* Diff: Hill Formulas */
 2945|    286|        }
 2946|  31.4k|        if (memcmp(i1->nNum_H, i2->nNum_H, i1->nNumberOfAtoms * sizeof(i1->nNum_H[0])))
  ------------------
  |  Branch (2946:13): [True: 554, False: 30.8k]
  ------------------
 2947|    554|        {
 2948|    554|            if (i1->lenConnTable > 1 || i2->lenConnTable > 1)
  ------------------
  |  Branch (2948:17): [True: 547, False: 7]
  |  Branch (2948:41): [True: 0, False: 7]
  ------------------
 2949|    547|            {
 2950|    547|                return 5; /* Diff: H Locations (mobile H present) */
 2951|    547|            }
 2952|      7|            else
 2953|      7|            {
 2954|      7|                return 6; /* Diff: H Locations (no mobile H) */
 2955|      7|            }
 2956|    554|        }
 2957|       |
 2958|       |        /* fixed H */
 2959|  30.8k|        if (i1->nNum_H_fixed || i2->nNum_H_fixed)
  ------------------
  |  Branch (2959:13): [True: 0, False: 30.8k]
  |  Branch (2959:33): [True: 108, False: 30.7k]
  ------------------
 2960|    108|        {
 2961|    108|            int bHasFixedH1 = 0, bHasFixedH2 = 0, i, j1, j2;
 2962|    108|            if (i1->nNum_H_fixed)
  ------------------
  |  Branch (2962:17): [True: 0, False: 108]
  ------------------
 2963|      0|            {
 2964|      0|                for (i = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (2964:29): [True: 0, False: 0]
  ------------------
 2965|      0|                {
 2966|      0|                    if (i1->nNum_H_fixed[i])
  ------------------
  |  Branch (2966:25): [True: 0, False: 0]
  ------------------
 2967|      0|                    {
 2968|      0|                        bHasFixedH1++;
 2969|      0|                    }
 2970|      0|                }
 2971|      0|            }
 2972|    108|            if (i2->nNum_H_fixed)
  ------------------
  |  Branch (2972:17): [True: 108, False: 0]
  ------------------
 2973|    108|            {
 2974|    650|                for (i = 0; i < i2->nNumberOfAtoms; i++)
  ------------------
  |  Branch (2974:29): [True: 542, False: 108]
  ------------------
 2975|    542|                {
 2976|    542|                    if (i2->nNum_H_fixed[i])
  ------------------
  |  Branch (2976:25): [True: 0, False: 542]
  ------------------
 2977|      0|                    {
 2978|      0|                        bHasFixedH2++;
 2979|      0|                    }
 2980|    542|                }
 2981|    108|            }
 2982|       |
 2983|       |            /* count the differences */
 2984|    108|            j1 = j2 = 0;
 2985|    108|            if (bHasFixedH1 && !bHasFixedH2)
  ------------------
  |  Branch (2985:17): [True: 0, False: 108]
  |  Branch (2985:32): [True: 0, False: 0]
  ------------------
 2986|      0|            {
 2987|      0|                for (i = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (2987:29): [True: 0, False: 0]
  ------------------
 2988|      0|                {
 2989|      0|                    if (i1->nNum_H_fixed[i] > 0)
  ------------------
  |  Branch (2989:25): [True: 0, False: 0]
  ------------------
 2990|      0|                    {
 2991|      0|                        j1++;
 2992|      0|                    }
 2993|      0|                    else
 2994|      0|                        if (i1->nNum_H_fixed[i] < 0)
  ------------------
  |  Branch (2994:29): [True: 0, False: 0]
  ------------------
 2995|      0|                        {
 2996|      0|                            j2++;
 2997|      0|                        }
 2998|      0|                }
 2999|      0|                return 18; /* Diff: Extra Fixed-H */
 3000|      0|            }
 3001|    108|            else
 3002|    108|            {
 3003|    108|                if (!bHasFixedH1 && bHasFixedH2)
  ------------------
  |  Branch (3003:21): [True: 108, False: 0]
  |  Branch (3003:37): [True: 0, False: 108]
  ------------------
 3004|      0|                {
 3005|      0|                    for (i = j1 = j2 = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (3005:43): [True: 0, False: 0]
  ------------------
 3006|      0|                    {
 3007|      0|                        if (0 > i2->nNum_H_fixed[i])
  ------------------
  |  Branch (3007:29): [True: 0, False: 0]
  ------------------
 3008|      0|                        {
 3009|      0|                            j1++;
 3010|      0|                        }
 3011|      0|                        else
 3012|      0|                            if (0 < i2->nNum_H_fixed[i])
  ------------------
  |  Branch (3012:33): [True: 0, False: 0]
  ------------------
 3013|      0|                            {
 3014|      0|                                j2++;
 3015|      0|                            }
 3016|      0|                    }
 3017|      0|                    return 19; /* Diff: Missed Fixed-H */
 3018|      0|                }
 3019|    108|                else
 3020|    108|                {
 3021|    108|                    if (bHasFixedH1 && bHasFixedH2 &&
  ------------------
  |  Branch (3021:25): [True: 0, False: 108]
  |  Branch (3021:40): [True: 0, False: 0]
  ------------------
 3022|      0|                        memcmp(i1->nNum_H_fixed, i2->nNum_H_fixed, i1->nNumberOfAtoms * sizeof(i1->nNum_H_fixed[0])))
  ------------------
  |  Branch (3022:25): [True: 0, False: 0]
  ------------------
 3023|      0|                    {
 3024|      0|                        for (i = j1 = j2 = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (3024:47): [True: 0, False: 0]
  ------------------
 3025|      0|                        {
 3026|      0|                            if (i1->nNum_H_fixed[i] > i2->nNum_H_fixed[i])
  ------------------
  |  Branch (3026:33): [True: 0, False: 0]
  ------------------
 3027|      0|                            {
 3028|      0|                                j1++;
 3029|      0|                            }
 3030|      0|                            else
 3031|      0|                            {
 3032|      0|                                if (i1->nNum_H_fixed[i] < i2->nNum_H_fixed[i])
  ------------------
  |  Branch (3032:37): [True: 0, False: 0]
  ------------------
 3033|      0|                                {
 3034|      0|                                    j2++;
 3035|      0|                                }
 3036|      0|                            }
 3037|      0|                        }
 3038|      0|                    }
 3039|    108|                }
 3040|    108|            }
 3041|    108|            ret = (j1 && j2) ? 20 : j1 ? 18 : j2 ? 19 : 0;
  ------------------
  |  Branch (3041:20): [True: 0, False: 108]
  |  Branch (3041:26): [True: 0, False: 0]
  |  Branch (3041:37): [True: 0, False: 108]
  |  Branch (3041:47): [True: 0, False: 108]
  ------------------
 3042|    108|            if (ret)
  ------------------
  |  Branch (3042:17): [True: 0, False: 108]
  ------------------
 3043|      0|            {
 3044|      0|                return ret; /* 20 => Diff: NotEql Fixed-H */
 3045|       |                /* 19 => Diff: Missed Fixed-H (i1 has less) */
 3046|       |                /* 18 => Diff: Extra Fixed-H  (i1 has more) */
 3047|      0|            }
 3048|    108|        }
 3049|  30.8k|    }
 3050|       |
 3051|  30.8k|    if (i1->lenConnTable != i2->lenConnTable)
  ------------------
  |  Branch (3051:9): [True: 0, False: 30.8k]
  ------------------
 3052|      0|    {
 3053|      0|        return 8; /* Diff: Connections length */
 3054|      0|    }
 3055|  30.8k|    if (i1->lenConnTable > 0 && memcmp(i1->nConnTable, i2->nConnTable, i1->lenConnTable * sizeof(i1->nConnTable[0])))
  ------------------
  |  Branch (3055:9): [True: 30.8k, False: 0]
  |  Branch (3055:33): [True: 1, False: 30.8k]
  ------------------
 3056|      1|    {
 3057|      1|        return 9; /* Diff: Connections */
 3058|      1|    }
 3059|       |
 3060|       |    /* output special cases: different number of t-groups, different sizes of t-groups, different endpoints */
 3061|  30.8k|    if (i1->lenTautomer != i2->lenTautomer && (i1->lenTautomer > 1 || i2->lenTautomer > 1))
  ------------------
  |  Branch (3061:9): [True: 150, False: 30.7k]
  |  Branch (3061:48): [True: 150, False: 0]
  |  Branch (3061:71): [True: 0, False: 0]
  ------------------
 3062|    150|    {
 3063|    150|        return 10; /* Diff: Mobile groups length */ /* in isotopic or deprotonated cases i1->lenTautomer == 1 && i1->nTautomer[0] = 0 */
 3064|    150|    }
 3065|  30.7k|    if ((i1->lenTautomer > 1 && i2->lenTautomer > 1) &&
  ------------------
  |  Branch (3065:10): [True: 0, False: 30.7k]
  |  Branch (3065:33): [True: 0, False: 0]
  ------------------
 3066|      0|        memcmp(i1->nTautomer, i2->nTautomer, i1->lenTautomer * sizeof(i1->nTautomer[0])))
  ------------------
  |  Branch (3066:9): [True: 0, False: 0]
  ------------------
 3067|      0|    {
 3068|      0|        return 11; /* Diff: Mobile groups */
 3069|      0|    }
 3070|       |
 3071|  30.7k|    if (i1->nNumberOfIsotopicAtoms != i2->nNumberOfIsotopicAtoms)
  ------------------
  |  Branch (3071:9): [True: 67, False: 30.6k]
  ------------------
 3072|     67|    {
 3073|     67|        return 12; /* Diff: Isotopic atoms number */
 3074|     67|    }
 3075|  30.6k|    if (i1->nNumberOfIsotopicAtoms > 0 && memcmp(i1->IsotopicAtom, i2->IsotopicAtom, i1->nNumberOfIsotopicAtoms * sizeof(i1->IsotopicAtom[0])))
  ------------------
  |  Branch (3075:9): [True: 49, False: 30.5k]
  |  Branch (3075:43): [True: 1, False: 48]
  ------------------
 3076|      1|    {
 3077|      1|        return 13; /* Diff: Isotopic atoms */
 3078|      1|    }
 3079|  30.6k|    if (i1->nTotalCharge != i2->nTotalCharge)
  ------------------
  |  Branch (3079:9): [True: 0, False: 30.6k]
  ------------------
 3080|      0|    {
 3081|      0|        return 14; /* Diff: Charge */
 3082|      0|    }
 3083|       |
 3084|       |    /*
 3085|       |        if ( i1->nNumberOfIsotopicTGroups != i2->nNumberOfIsotopicTGroups )
 3086|       |        {
 3087|       |            return 14;
 3088|       |        }
 3089|       |        if ( i1->nNumberOfIsotopicTGroups > 0 && memcmp( i1->IsotopicTGroup, i2->IsotopicTGroup, i1->nNumberOfIsotopicTGroups*sizeof(i1->IsotopicTGroup[0]) ) )
 3090|       |        {
 3091|       |            return 15;
 3092|       |            }
 3093|       |    */
 3094|       |
 3095|  30.6k|    if (a1 && a2)
  ------------------
  |  Branch (3095:9): [True: 0, False: 30.6k]
  |  Branch (3095:15): [True: 0, False: 0]
  ------------------
 3096|      0|    {
 3097|      0|        if (a1->nNumRemovedProtons != a2->nNumRemovedProtons)
  ------------------
  |  Branch (3097:13): [True: 0, False: 0]
  ------------------
 3098|      0|        {
 3099|      0|            return 16; /* Diff: Number of removed protons */
 3100|      0|        }
 3101|      0|        if (memcmp(a1->nNumRemovedIsotopicH, a2->nNumRemovedIsotopicH, sizeof(a1->nNumRemovedIsotopicH)))
  ------------------
  |  Branch (3101:13): [True: 0, False: 0]
  ------------------
 3102|      0|        {
 3103|      0|            return 17; /* Diff: Removed isotopic H */
 3104|      0|        }
 3105|      0|    }
 3106|       |
 3107|       |    /*
 3108|       |        if ( i1->nPossibleLocationsOfIsotopicH && i2->nPossibleLocationsOfIsotopicH ) {
 3109|       |        {
 3110|       |            if ( i1->nPossibleLocationsOfIsotopicH[0] != i2->nPossibleLocationsOfIsotopicH[0] ||
 3111|       |                 memcmp(i1->nPossibleLocationsOfIsotopicH, i2->nPossibleLocationsOfIsotopicH,
 3112|       |                        sizeof(i1->nPossibleLocationsOfIsotopicH[0])*i1->nPossibleLocationsOfIsotopicH[0]) )
 3113|       |            {
 3114|       |                return 18;
 3115|       |            }
 3116|       |        }
 3117|       |        } else
 3118|       |        {
 3119|       |            if ( !i1->nPossibleLocationsOfIsotopicH != !i2->nPossibleLocationsOfIsotopicH ) {
 3120|       |            {
 3121|       |                return 19;}
 3122|       |            }
 3123|       |        }
 3124|       |    */
 3125|       |
 3126|       |    /* ret = 20..31 => 40..51 */
 3127|  30.6k|    if ((ret = CompareReversedStereoINChI(i1->Stereo, i2->Stereo))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3127:9): [True: 238, False: 30.4k]
  ------------------
 3128|    238|    {
 3129|    238|        return ret + 20;
 3130|    238|    }
 3131|       |    /* ret = 40..51 => 60..71 */
 3132|       |
 3133|  30.4k|    if (!i2->StereoIsotopic && i2->Stereo && i1->StereoIsotopic &&
  ------------------
  |  Branch (3133:9): [True: 202, False: 30.2k]
  |  Branch (3133:32): [True: 84, False: 118]
  |  Branch (3133:46): [True: 23, False: 61]
  ------------------
 3134|     23|        0 < (i1->StereoIsotopic->nNumberOfStereoBonds + i1->StereoIsotopic->nNumberOfStereoCenters) &&
  ------------------
  |  Branch (3134:9): [True: 10, False: 13]
  ------------------
 3135|     10|        0 == CompareReversedStereoINChI(i1->StereoIsotopic, i2->Stereo))
  ------------------
  |  Branch (3135:9): [True: 6, False: 4]
  ------------------
 3136|      6|    {
 3137|       |        /* InChI from reversed structure does not contain fully duplicated isotopic stereo */
 3138|      6|        ;
 3139|      6|    }
 3140|  30.3k|    else
 3141|  30.3k|    {
 3142|  30.3k|        if ((ret = CompareReversedStereoINChI(i1->StereoIsotopic, i2->StereoIsotopic))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3142:13): [True: 33, False: 30.3k]
  ------------------
 3143|     33|        {
 3144|     33|            return ret + 40;
 3145|     33|        }
 3146|  30.3k|    }
 3147|       |
 3148|  30.3k|    return 0;
 3149|  30.4k|}
CompareIcr:
 3158|     76|{
 3159|     76|    int nNumExtraBits1 = 0, nNumExtraBits2 = 0, bit1, bit2;
 3160|     76|    INCHI_MODE Flg1 = picr1->flags, Flg2 = picr2->flags, cur_bit = 1, in1, in2;
 3161|     76|    int i, ret;
 3162|       |
 3163|       |    /* compare flags */
 3164|     76|    in1 = in2 = 0;
 3165|  2.04k|    for (i = 0; Flg1 || Flg2; i++, Flg1 >>= 1, Flg2 >>= 1, cur_bit <<= 1)
  ------------------
  |  Branch (3165:17): [True: 1.83k, False: 218]
  |  Branch (3165:25): [True: 142, False: 76]
  ------------------
 3166|  1.97k|    {
 3167|  1.97k|        if (!(mask & cur_bit))
  ------------------
  |  Branch (3167:13): [True: 1.02k, False: 948]
  ------------------
 3168|  1.02k|        {
 3169|  1.02k|            continue;
 3170|  1.02k|        }
 3171|    948|        bit1 = Flg1 & 1;
 3172|    948|        bit2 = Flg2 & 1;
 3173|    948|        if (bit1 && !bit2)
  ------------------
  |  Branch (3173:13): [True: 114, False: 834]
  |  Branch (3173:21): [True: 21, False: 93]
  ------------------
 3174|     21|        {
 3175|     21|            in1 |= 1 << i;
 3176|     21|            nNumExtraBits1++;
 3177|     21|        }
 3178|    927|        else
 3179|    927|        {
 3180|    927|            if (!bit1 && bit2)
  ------------------
  |  Branch (3180:17): [True: 834, False: 93]
  |  Branch (3180:26): [True: 24, False: 810]
  ------------------
 3181|     24|            {
 3182|     24|                in2 |= 1 << i;
 3183|     24|                nNumExtraBits2++;
 3184|     24|            }
 3185|    927|        }
 3186|    948|    }
 3187|     76|    if (nNumExtraBits1 && !nNumExtraBits2)
  ------------------
  |  Branch (3187:9): [True: 8, False: 68]
  |  Branch (3187:27): [True: 6, False: 2]
  ------------------
 3188|      6|    {
 3189|      6|        ret = 1;
 3190|      6|    }
 3191|     70|    else
 3192|     70|    {
 3193|     70|        if (!nNumExtraBits1 && nNumExtraBits2)
  ------------------
  |  Branch (3193:13): [True: 68, False: 2]
  |  Branch (3193:32): [True: 7, False: 61]
  ------------------
 3194|      7|        {
 3195|      7|            ret = -1;
 3196|      7|        }
 3197|     63|        else
 3198|     63|        {
 3199|     63|            if (!in1 && !in2)
  ------------------
  |  Branch (3199:17): [True: 61, False: 2]
  |  Branch (3199:25): [True: 61, False: 0]
  ------------------
 3200|     61|            {
 3201|     61|                ret = 0;
 3202|     61|            }
 3203|      2|            else
 3204|      2|            {
 3205|      2|                ret = 2; /* compare produced undefined results */
 3206|      2|            }
 3207|     63|        }
 3208|     70|    }
 3209|       |
 3210|     76|    if (pin1)
  ------------------
  |  Branch (3210:9): [True: 0, False: 76]
  ------------------
 3211|      0|    {
 3212|      0|        *pin1 = in1;
 3213|      0|    }
 3214|     76|    if (pin2)
  ------------------
  |  Branch (3214:9): [True: 0, False: 76]
  ------------------
 3215|      0|    {
 3216|      0|        *pin2 = in2;
 3217|      0|    }
 3218|       |
 3219|       |    /* more detailed compare not implemented */
 3220|       |
 3221|     76|    return ret;
 3222|     76|}
CompareReversedINChI2:
 3232|   115k|{
 3233|   115k|    INCHI_MODE ret = 0;
 3234|   115k|    INChI_Stereo* Stereo1 = NULL, * Stereo2 = NULL;
 3235|   115k|    int  n1, n2, m, j, j1, j2, ret2, num_H1, num_H2;
 3236|       |
 3237|   115k|    *err = 0;
 3238|       |
 3239|   115k|    memset(picr, 0, sizeof(*picr)); /* djb-rwth: memset_s C11/Annex K variant? */
 3240|       |
 3241|   115k|    if (i1 == NULL && i2 == NULL)
  ------------------
  |  Branch (3241:9): [True: 22, False: 115k]
  |  Branch (3241:23): [True: 0, False: 22]
  ------------------
 3242|      0|    {
 3243|      0|        return 0;
 3244|      0|    }
 3245|   115k|    if ((i1 == NULL) ^ (i2 == NULL))
  ------------------
  |  Branch (3245:9): [True: 22, False: 115k]
  ------------------
 3246|     22|    {
 3247|     22|        ret |= IDIF_PROBLEM; /* one InChI exists while another doesn't */
 3248|     22|        goto exit_function;
 3249|     22|    }
 3250|       |
 3251|   115k|    if (i1->nErrorCode == i2->nErrorCode)
  ------------------
  |  Branch (3251:9): [True: 115k, False: 0]
  ------------------
 3252|   115k|    {
 3253|   115k|        if (i1->nErrorCode)
  ------------------
  |  Branch (3253:13): [True: 0, False: 115k]
  ------------------
 3254|      0|        {
 3255|      0|            ret |= IDIF_PROBLEM; /* both InChI have same error codes */
 3256|      0|            goto exit_function;
 3257|      0|        }
 3258|   115k|    }
 3259|      0|    else
 3260|      0|    {
 3261|      0|        ret |= IDIF_PROBLEM; /* at least one InChI has an error code */
 3262|      0|        goto exit_function;
 3263|      0|    }
 3264|       |
 3265|   115k|    if (i1->nNumberOfAtoms != i2->nNumberOfAtoms)
  ------------------
  |  Branch (3265:9): [True: 0, False: 115k]
  ------------------
 3266|      0|    {
 3267|      0|        ret |= IDIF_NUM_AT;
 3268|      0|        goto exit_function;
 3269|      0|    }
 3270|   115k|    if (i1->nNumberOfAtoms > 0)
  ------------------
  |  Branch (3270:9): [True: 115k, False: 0]
  ------------------
 3271|   115k|    {
 3272|   115k|        if (memcmp(i1->nAtom, i2->nAtom, i1->nNumberOfAtoms * sizeof(i1->nAtom[0])))
  ------------------
  |  Branch (3272:13): [True: 57.4k, False: 58.3k]
  ------------------
 3273|  57.4k|        {
 3274|  57.4k|            ret |= IDIF_ATOMS;
 3275|  57.4k|            goto exit_function;
 3276|  57.4k|        }
 3277|       |        /* IDIF_NON_TAUT_H,  IDIF_MORE_FH, IDIF_LESS_FH */
 3278|  58.3k|        if (memcmp(i1->nNum_H, i2->nNum_H, i1->nNumberOfAtoms * sizeof(i1->nNum_H[0])))
  ------------------
  |  Branch (3278:13): [True: 3.51k, False: 54.8k]
  ------------------
 3279|  3.51k|        {
 3280|  3.51k|            ret |= IDIF_POSITION_H;
 3281|  26.0k|            for (j1 = 0; j1 < i1->nNumberOfAtoms; j1++)
  ------------------
  |  Branch (3281:26): [True: 22.4k, False: 3.51k]
  ------------------
 3282|  22.4k|            {
 3283|  22.4k|                if (i1->nNum_H[j1] != i2->nNum_H[j1] && picr->num_diff_pos_H < ICR_MAX_DIFF_FIXED_H)
  ------------------
  |  |  372|  5.03k|#define ICR_MAX_DIFF_FIXED_H 32
  ------------------
  |  Branch (3283:21): [True: 5.03k, False: 17.4k]
  |  Branch (3283:57): [True: 5.03k, False: 0]
  ------------------
 3284|  5.03k|                {
 3285|  5.03k|                    picr->diff_pos_H_at[picr->num_diff_pos_H] = j1;
 3286|  5.03k|                    picr->diff_pos_H_nH[picr->num_diff_pos_H] = i1->nNum_H[j1] - i2->nNum_H[j1];
 3287|  5.03k|                    picr->num_diff_pos_H++;
 3288|  5.03k|                }
 3289|  22.4k|            }
 3290|  3.51k|        }
 3291|       |        /* fixed H */
 3292|  58.3k|        if (i1->nNum_H_fixed || i2->nNum_H_fixed)
  ------------------
  |  Branch (3292:13): [True: 58.3k, False: 0]
  |  Branch (3292:33): [True: 0, False: 0]
  ------------------
 3293|  58.3k|        {
 3294|  58.3k|            int bHasFixedH1 = 0, bHasFixedH2 = 0, i;
 3295|  58.3k|            if (i1->nNum_H_fixed)
  ------------------
  |  Branch (3295:17): [True: 58.3k, False: 0]
  ------------------
 3296|  58.3k|            {
 3297|   358k|                for (i = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (3297:29): [True: 300k, False: 58.3k]
  ------------------
 3298|   300k|                {
 3299|   300k|                    if (i1->nNum_H_fixed[i])
  ------------------
  |  Branch (3299:25): [True: 655, False: 299k]
  ------------------
 3300|    655|                    {
 3301|    655|                        bHasFixedH1++;
 3302|    655|                    }
 3303|   300k|                }
 3304|  58.3k|            }
 3305|  58.3k|            if (i2->nNum_H_fixed)
  ------------------
  |  Branch (3305:17): [True: 888, False: 57.5k]
  ------------------
 3306|    888|            {
 3307|  7.27k|                for (i = 0; i < i2->nNumberOfAtoms; i++)
  ------------------
  |  Branch (3307:29): [True: 6.38k, False: 888]
  ------------------
 3308|  6.38k|                {
 3309|  6.38k|                    if (i2->nNum_H_fixed[i])
  ------------------
  |  Branch (3309:25): [True: 1.64k, False: 4.74k]
  ------------------
 3310|  1.64k|                    {
 3311|  1.64k|                        bHasFixedH2++;
 3312|  1.64k|                    }
 3313|  6.38k|                }
 3314|    888|            }
 3315|  58.3k|            if (bHasFixedH1 && !bHasFixedH2)
  ------------------
  |  Branch (3315:17): [True: 532, False: 57.8k]
  |  Branch (3315:32): [True: 135, False: 397]
  ------------------
 3316|    135|            {
 3317|    846|                for (i = j = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (3317:33): [True: 711, False: 135]
  ------------------
 3318|    711|                {
 3319|    711|                    if (i1->nNum_H_fixed[i])
  ------------------
  |  Branch (3319:25): [True: 170, False: 541]
  ------------------
 3320|    170|                    {
 3321|    170|                        if (j < ICR_MAX_DIFF_FIXED_H)
  ------------------
  |  |  372|    170|#define ICR_MAX_DIFF_FIXED_H 32
  ------------------
  |  Branch (3321:29): [True: 170, False: 0]
  ------------------
 3322|    170|                        {
 3323|    170|                            picr->fixed_H_at1_more[j] = i;
 3324|    170|                            picr->fixed_H_nH1_more[j] = i1->nNum_H_fixed[i];
 3325|    170|                            j++;
 3326|    170|                        }
 3327|    170|                    }
 3328|    711|                }
 3329|    135|                picr->num_fixed_H1_more = j;
 3330|    135|                ret |= IDIF_MORE_FH; /* Extra Fixed-H */
 3331|    135|            }
 3332|  58.2k|            else
 3333|  58.2k|            {
 3334|  58.2k|                if (!bHasFixedH1 && bHasFixedH2)
  ------------------
  |  Branch (3334:21): [True: 57.8k, False: 397]
  |  Branch (3334:37): [True: 360, False: 57.4k]
  ------------------
 3335|    360|                {
 3336|  3.00k|                    for (i = j = 0; i < i2->nNumberOfAtoms; i++)
  ------------------
  |  Branch (3336:37): [True: 2.64k, False: 360]
  ------------------
 3337|  2.64k|                    {
 3338|  2.64k|                        if (i2->nNum_H_fixed[i])
  ------------------
  |  Branch (3338:29): [True: 768, False: 1.87k]
  ------------------
 3339|    768|                        {
 3340|    768|                            if (j < ICR_MAX_DIFF_FIXED_H)
  ------------------
  |  |  372|    768|#define ICR_MAX_DIFF_FIXED_H 32
  ------------------
  |  Branch (3340:33): [True: 768, False: 0]
  ------------------
 3341|    768|                            {
 3342|    768|                                picr->fixed_H_at2_more[j] = i;
 3343|    768|                                picr->fixed_H_nH2_more[j] = i2->nNum_H_fixed[i];
 3344|    768|                                j++;
 3345|    768|                            }
 3346|    768|                        }
 3347|  2.64k|                    }
 3348|    360|                    picr->num_fixed_H2_more = j;
 3349|    360|                    ret |= IDIF_LESS_FH; /* Missed Fixed-H */
 3350|    360|                }
 3351|  57.8k|                else
 3352|  57.8k|                {
 3353|  57.8k|                    if (bHasFixedH1 && bHasFixedH2 &&
  ------------------
  |  Branch (3353:25): [True: 397, False: 57.4k]
  |  Branch (3353:40): [True: 397, False: 0]
  ------------------
 3354|    397|                        memcmp(i1->nNum_H_fixed, i2->nNum_H_fixed, i1->nNumberOfAtoms * sizeof(i1->nNum_H_fixed[0])))
  ------------------
  |  Branch (3354:25): [True: 385, False: 12]
  ------------------
 3355|    385|                    {
 3356|  3.25k|                        for (i = j1 = j2 = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (3356:47): [True: 2.87k, False: 385]
  ------------------
 3357|  2.87k|                        {
 3358|  2.87k|                            if (i1->nNum_H_fixed[i] > i2->nNum_H_fixed[i])
  ------------------
  |  Branch (3358:33): [True: 503, False: 2.36k]
  ------------------
 3359|    503|                            {
 3360|    503|                                if (j1 < ICR_MAX_DIFF_FIXED_H)
  ------------------
  |  |  372|    503|#define ICR_MAX_DIFF_FIXED_H 32
  ------------------
  |  Branch (3360:37): [True: 503, False: 0]
  ------------------
 3361|    503|                                {
 3362|    503|                                    picr->fixed_H_at1_more[j1] = i;
 3363|    503|                                    picr->fixed_H_nH1_more[j1] = i1->nNum_H_fixed[i] - i2->nNum_H_fixed[i];
 3364|    503|                                    j1++;
 3365|    503|                                }
 3366|    503|                            }
 3367|  2.36k|                            else
 3368|  2.36k|                            {
 3369|  2.36k|                                if (i1->nNum_H_fixed[i] < i2->nNum_H_fixed[i])
  ------------------
  |  Branch (3369:37): [True: 239, False: 2.13k]
  ------------------
 3370|    239|                                {
 3371|    239|                                    if (j2 < ICR_MAX_DIFF_FIXED_H)
  ------------------
  |  |  372|    239|#define ICR_MAX_DIFF_FIXED_H 32
  ------------------
  |  Branch (3371:41): [True: 239, False: 0]
  ------------------
 3372|    239|                                    {
 3373|    239|                                        picr->fixed_H_at2_more[j2] = i;
 3374|    239|                                        picr->fixed_H_nH2_more[j2] = i2->nNum_H_fixed[i] - i1->nNum_H_fixed[i];
 3375|    239|                                        j2++;
 3376|    239|                                    }
 3377|    239|                                }
 3378|  2.36k|                            }
 3379|  2.87k|                        }
 3380|    385|                        ret |= (j1 ? IDIF_MORE_FH : 0) | (j2 ? IDIF_LESS_FH : 0);
  ------------------
  |  Branch (3380:33): [True: 363, False: 22]
  |  Branch (3380:59): [True: 191, False: 194]
  ------------------
 3381|    385|                        picr->num_fixed_H1_more = j1;
 3382|    385|                        picr->num_fixed_H2_more = j2;
 3383|    385|                    }
 3384|  57.8k|                }
 3385|  58.2k|            }
 3386|  58.3k|        }
 3387|  58.3k|    }
 3388|       |
 3389|       |    /* compare formulas and H */
 3390|  58.3k|    num_H1 = 0;
 3391|  58.3k|    num_H2 = 0;
 3392|  58.3k|    ret2 = CompareHillFormulasNoH(i1->szHillFormula, i2->szHillFormula, &num_H1, &num_H2);
 3393|  58.3k|    picr->tot_num_H1 = num_H1;
 3394|  58.3k|    picr->tot_num_H2 = num_H2;
 3395|  58.3k|    if (ret2)
  ------------------
  |  Branch (3395:9): [True: 8.62k, False: 49.7k]
  ------------------
 3396|  8.62k|    {
 3397|  8.62k|        ret |= IDIF_NUM_EL;
 3398|  8.62k|        goto exit_function;
 3399|  8.62k|    }
 3400|  49.7k|    if (num_H1 > num_H2)
  ------------------
  |  Branch (3400:9): [True: 31.1k, False: 18.6k]
  ------------------
 3401|  31.1k|    {
 3402|  31.1k|        ret |= IDIF_MORE_H;
 3403|  31.1k|    }
 3404|  49.7k|    if (num_H1 < num_H2)
  ------------------
  |  Branch (3404:9): [True: 1.07k, False: 48.6k]
  ------------------
 3405|  1.07k|    {
 3406|  1.07k|        ret |= IDIF_LESS_H;
 3407|  1.07k|    }
 3408|  49.7k|    if (i1->lenConnTable != i2->lenConnTable)
  ------------------
  |  Branch (3408:9): [True: 1.18k, False: 48.5k]
  ------------------
 3409|  1.18k|    {
 3410|  1.18k|        ret |= IDIF_CON_LEN;
 3411|  1.18k|        goto exit_function;
 3412|  1.18k|    }
 3413|  48.5k|    else
 3414|  48.5k|    {
 3415|  48.5k|        if (i1->lenConnTable > 0 && memcmp(i1->nConnTable, i2->nConnTable, i1->lenConnTable * sizeof(i1->nConnTable[0])))
  ------------------
  |  Branch (3415:13): [True: 48.5k, False: 0]
  |  Branch (3415:37): [True: 7.26k, False: 41.3k]
  ------------------
 3416|  7.26k|        {
 3417|  7.26k|            ret |= IDIF_CON_TBL;
 3418|  7.26k|            goto exit_function;
 3419|  7.26k|        }
 3420|  48.5k|    }
 3421|       |
 3422|       |    /* output special cases: different number of t-groups, different sizes of t-groups, different endpoints */
 3423|       |    /* in isotopic or deprotonated cases i1->lenTautomer == 1 && i1->nTautomer[0] = 0 */
 3424|       |
 3425|       |    /*
 3426|       |        if ( i1->lenTautomer != i2->lenTautomer && (i1->lenTautomer > 1 || i2->lenTautomer > 1) ) {
 3427|       |            ret |=  IDIF_TAUT_LEN;
 3428|       |        }
 3429|       |    */
 3430|       |
 3431|       |    /* compare number of t-groups */
 3432|  41.3k|    n1 = i1->lenTautomer ? i1->nTautomer[0] : 0;
  ------------------
  |  Branch (3432:10): [True: 3.35k, False: 37.9k]
  ------------------
 3433|  41.3k|    n2 = i2->lenTautomer ? i2->nTautomer[0] : 0;
  ------------------
  |  Branch (3433:10): [True: 1.68k, False: 39.6k]
  ------------------
 3434|  41.3k|    if (!n1 && n2)
  ------------------
  |  Branch (3434:9): [True: 39.7k, False: 1.59k]
  |  Branch (3434:16): [True: 1.12k, False: 38.6k]
  ------------------
 3435|  1.12k|    {
 3436|  1.12k|        ret |= IDIF_NO_TAUT;
 3437|  1.12k|    }
 3438|  40.1k|    else
 3439|  40.1k|    {
 3440|  40.1k|        if (n1 && !n2)
  ------------------
  |  Branch (3440:13): [True: 1.59k, False: 38.6k]
  |  Branch (3440:19): [True: 1.02k, False: 562]
  ------------------
 3441|  1.02k|        {
 3442|  1.02k|            ret |= IDIF_WRONG_TAUT;
 3443|  1.02k|        }
 3444|  39.1k|        else
 3445|  39.1k|        {
 3446|  39.1k|            if (n1 == 1 && n2 > 1)
  ------------------
  |  Branch (3446:17): [True: 526, False: 38.6k]
  |  Branch (3446:28): [True: 46, False: 480]
  ------------------
 3447|     46|            {
 3448|     46|                ret |= IDIF_SINGLE_TG;
 3449|     46|            }
 3450|  39.1k|            else
 3451|  39.1k|            {
 3452|  39.1k|                if (n1 > 1 && n2 == 1)
  ------------------
  |  Branch (3452:21): [True: 36, False: 39.0k]
  |  Branch (3452:31): [True: 21, False: 15]
  ------------------
 3453|     21|                {
 3454|     21|                    ret |= IDIF_MULTIPLE_TG;
 3455|     21|                }
 3456|  39.1k|                else
 3457|  39.1k|                {
 3458|  39.1k|                    if (n1 != n2)
  ------------------
  |  Branch (3458:25): [True: 6, False: 39.0k]
  ------------------
 3459|      6|                    {
 3460|      6|                        ret |= IDIF_NUM_TG;
 3461|      6|                    }
 3462|  39.1k|                }
 3463|  39.1k|            }
 3464|  39.1k|        }
 3465|  40.1k|    }
 3466|       |
 3467|  41.3k|    if (n1 || n2)
  ------------------
  |  Branch (3467:9): [True: 1.59k, False: 39.7k]
  |  Branch (3467:15): [True: 1.12k, False: 38.6k]
  ------------------
 3468|  2.71k|    {
 3469|       |        /* number of endpoints */
 3470|  2.71k|        int num1 = 0, num2 = 0, num_M1 = 0, num_M2 = 0;
 3471|  2.71k|        int len, num_eq, num_in1_only, num_in2_only;
 3472|  2.71k|        AT_NUMB* pe1 = (AT_NUMB*)inchi_malloc(((long long)i1->lenTautomer + 1) * sizeof(pe1[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1143|  2.71k|#define inchi_malloc   malloc
  ------------------
 3473|  2.71k|        AT_NUMB* pe2 = (AT_NUMB*)inchi_malloc(((long long)i2->lenTautomer + 1) * sizeof(pe2[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1143|  2.71k|#define inchi_malloc   malloc
  ------------------
 3474|  2.71k|        num_H1 = num_H2 = 0;
 3475|       |        /* collect endpoints, H, (-) */
 3476|  2.71k|        if (!pe1 || !pe2)
  ------------------
  |  Branch (3476:13): [True: 0, False: 2.71k]
  |  Branch (3476:21): [True: 0, False: 2.71k]
  ------------------
 3477|      0|        {
 3478|      0|            if (pe1)
  ------------------
  |  Branch (3478:17): [True: 0, False: 0]
  ------------------
 3479|      0|            {
 3480|      0|                inchi_free(pe1);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3481|      0|            }
 3482|      0|            if (pe2)
  ------------------
  |  Branch (3482:17): [True: 0, False: 0]
  ------------------
 3483|      0|            {
 3484|      0|                inchi_free(pe2);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3485|      0|            }
 3486|      0|            *err = -1; /* allocation error */
 3487|      0|            goto exit_function;
 3488|      0|        }
 3489|  4.39k|        for (m = 1; m < i1->lenTautomer; m += len)
  ------------------
  |  Branch (3489:21): [True: 1.68k, False: 2.71k]
  ------------------
 3490|  1.68k|        {
 3491|  1.68k|            len = i1->nTautomer[m++];
 3492|  1.68k|            num_H1 += i1->nTautomer[m];
 3493|  1.68k|            num_M1 += i1->nTautomer[m + 1];
 3494|  5.85k|            for (j = 2; j < len; j++)
  ------------------
  |  Branch (3494:25): [True: 4.16k, False: 1.68k]
  ------------------
 3495|  4.16k|            {
 3496|  4.16k|                pe1[num1++] = i1->nTautomer[m + j];
 3497|  4.16k|            }
 3498|  1.68k|        }
 3499|  4.49k|        for (m = 1; m < i2->lenTautomer; m += len)
  ------------------
  |  Branch (3499:21): [True: 1.78k, False: 2.71k]
  ------------------
 3500|  1.78k|        {
 3501|  1.78k|            len = i2->nTautomer[m++];
 3502|  1.78k|            num_H2 += i2->nTautomer[m];
 3503|  1.78k|            num_M2 += i2->nTautomer[m + 1];
 3504|  5.78k|            for (j = 2; j < len; j++)
  ------------------
  |  Branch (3504:25): [True: 4.00k, False: 1.78k]
  ------------------
 3505|  4.00k|            {
 3506|  4.00k|                pe2[num2++] = i2->nTautomer[m + j];
 3507|  4.00k|            }
 3508|  1.78k|        }
 3509|  2.71k|        picr->num_taut_H1 = num_H1;
 3510|  2.71k|        picr->num_taut_H2 = num_H2;
 3511|  2.71k|        picr->num_taut_M1 = num_M1;
 3512|  2.71k|        picr->num_taut_M2 = num_M2;
 3513|       |        /* sort endpoints */
 3514|  2.71k|        insertions_sort_AT_RANK(pe1, num1);
 3515|  2.71k|        insertions_sort_AT_RANK(pe2, num2);
 3516|       |        /* compare */
 3517|       |        /*
 3518|       |        if ( num1 < num2 ) {
 3519|       |            ret |= IDIF_LESS_TG_ENDP;
 3520|       |        } else
 3521|       |        if ( num1 > num2 ) {
 3522|       |            ret |= IDIF_MORE_TG_ENDP;
 3523|       |        }
 3524|       |        */
 3525|       |        /* compare all */
 3526|  2.71k|        num_eq = num_in1_only = num_in2_only = 0;
 3527|  4.55k|        for (j1 = j2 = 0; j1 < num1 && j2 < num2; )
  ------------------
  |  Branch (3527:27): [True: 3.06k, False: 1.48k]
  |  Branch (3527:40): [True: 1.83k, False: 1.22k]
  ------------------
 3528|  1.83k|        {
 3529|  1.83k|            if (pe1[j1] == pe2[j2])
  ------------------
  |  Branch (3529:17): [True: 611, False: 1.22k]
  ------------------
 3530|    611|            {
 3531|    611|                j1++;
 3532|    611|                j2++;
 3533|    611|                num_eq++;
 3534|    611|            }
 3535|  1.22k|            else
 3536|  1.22k|            {
 3537|  1.22k|                if (pe1[j1] < pe2[j2])
  ------------------
  |  Branch (3537:21): [True: 464, False: 763]
  ------------------
 3538|    464|                { /* BC: fixed, was pe2[j1] 2006-03-27 */
 3539|    464|                    if (picr->num_endp_in1_only < ICR_MAX_ENDP_IN1_ONLY)
  ------------------
  |  |  370|    464|#define ICR_MAX_ENDP_IN1_ONLY 32
  ------------------
  |  Branch (3539:25): [True: 464, False: 0]
  ------------------
 3540|    464|                    {
 3541|    464|                        picr->endp_in1_only[picr->num_endp_in1_only++] = pe1[j1];
 3542|    464|                    }
 3543|    464|                    j1++;
 3544|    464|                    num_in1_only++;
 3545|    464|                }
 3546|    763|                else
 3547|    763|                {
 3548|    763|                    if (picr->num_endp_in2_only < ICR_MAX_ENDP_IN2_ONLY)
  ------------------
  |  |  371|    763|#define ICR_MAX_ENDP_IN2_ONLY 32
  ------------------
  |  Branch (3548:25): [True: 763, False: 0]
  ------------------
 3549|    763|                    {
 3550|    763|                        picr->endp_in2_only[picr->num_endp_in2_only++] = pe2[j2];
 3551|    763|                    }
 3552|    763|                    j2++;
 3553|    763|                    num_in2_only++;
 3554|    763|                }
 3555|  1.22k|            }
 3556|  1.83k|        }
 3557|  5.80k|        while (j1 < num1)
  ------------------
  |  Branch (3557:16): [True: 3.08k, False: 2.71k]
  ------------------
 3558|  3.08k|        {
 3559|  3.08k|            if (picr->num_endp_in1_only < ICR_MAX_ENDP_IN1_ONLY)
  ------------------
  |  |  370|  3.08k|#define ICR_MAX_ENDP_IN1_ONLY 32
  ------------------
  |  Branch (3559:17): [True: 3.08k, False: 0]
  ------------------
 3560|  3.08k|            {
 3561|  3.08k|                picr->endp_in1_only[picr->num_endp_in1_only++] = pe1[j1];
 3562|  3.08k|            }
 3563|  3.08k|            j1++;
 3564|  3.08k|            num_in1_only++;
 3565|  3.08k|        }
 3566|  5.34k|        while (j2 < num2)
  ------------------
  |  Branch (3566:16): [True: 2.63k, False: 2.71k]
  ------------------
 3567|  2.63k|        {
 3568|  2.63k|            if (picr->num_endp_in2_only < ICR_MAX_ENDP_IN2_ONLY)
  ------------------
  |  |  371|  2.63k|#define ICR_MAX_ENDP_IN2_ONLY 32
  ------------------
  |  Branch (3568:17): [True: 2.63k, False: 0]
  ------------------
 3569|  2.63k|            {
 3570|  2.63k|                picr->endp_in2_only[picr->num_endp_in2_only++] = pe2[j2];
 3571|  2.63k|            }
 3572|  2.63k|            j2++;
 3573|  2.63k|            num_in2_only++;
 3574|  2.63k|        }
 3575|  2.71k|        if (num_in1_only)
  ------------------
  |  Branch (3575:13): [True: 1.51k, False: 1.20k]
  ------------------
 3576|  1.51k|        {
 3577|  1.51k|            ret |= IDIF_EXTRA_TG_ENDP;
 3578|  1.51k|        }
 3579|  2.71k|        if (num_in2_only)
  ------------------
  |  Branch (3579:13): [True: 1.55k, False: 1.15k]
  ------------------
 3580|  1.55k|        {
 3581|  1.55k|            ret |= IDIF_MISS_TG_ENDP;
 3582|  1.55k|        }
 3583|  2.71k|        if (!num_in1_only && !num_in2_only && num_eq)
  ------------------
  |  Branch (3583:13): [True: 1.20k, False: 1.51k]
  |  Branch (3583:30): [True: 31, False: 1.17k]
  |  Branch (3583:47): [True: 31, False: 0]
  ------------------
 3584|     31|        {
 3585|     31|            ; /* same t-groups endpoints */
 3586|     31|        }
 3587|  2.68k|        else
 3588|  2.68k|        {
 3589|  2.68k|            ret |= IDIF_DIFF_TG_ENDP;
 3590|  2.68k|        }
 3591|  2.71k|        inchi_free(pe1);
  ------------------
  |  | 1152|  2.71k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 2.71k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 2.71k]
  |  |  ------------------
  ------------------
 3592|  2.71k|        inchi_free(pe2);
  ------------------
  |  | 1152|  2.71k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 2.71k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 2.71k]
  |  |  ------------------
  ------------------
 3593|  2.71k|    }
 3594|       |
 3595|  41.3k|    if ((i1->lenTautomer > 1 && i2->lenTautomer > 1) &&
  ------------------
  |  Branch (3595:10): [True: 1.59k, False: 39.7k]
  |  Branch (3595:33): [True: 562, False: 1.02k]
  ------------------
 3596|    562|        (i1->lenTautomer != i2->lenTautomer ||
  ------------------
  |  Branch (3596:10): [True: 416, False: 146]
  ------------------
 3597|    146|            memcmp(i1->nTautomer, i2->nTautomer, i1->lenTautomer * sizeof(i1->nTautomer[0]))))
  ------------------
  |  Branch (3597:13): [True: 143, False: 3]
  ------------------
 3598|    559|    {
 3599|    559|        ret |= IDIF_TG;
 3600|    559|    }
 3601|       |
 3602|  41.3k|    if (i1->nNumberOfIsotopicAtoms != i2->nNumberOfIsotopicAtoms)
  ------------------
  |  Branch (3602:9): [True: 127, False: 41.1k]
  ------------------
 3603|    127|    {
 3604|    127|        ret |= IDIF_NUM_ISO_AT;
 3605|    127|    }
 3606|  41.1k|    else
 3607|  41.1k|    {
 3608|  41.1k|        if (i1->nNumberOfIsotopicAtoms > 0 && memcmp(i1->IsotopicAtom, i2->IsotopicAtom, i1->nNumberOfIsotopicAtoms * sizeof(i1->IsotopicAtom[0])))
  ------------------
  |  Branch (3608:13): [True: 516, False: 40.6k]
  |  Branch (3608:47): [True: 310, False: 206]
  ------------------
 3609|    310|        {
 3610|    310|            ret |= IDIF_ISO_AT;
 3611|    310|        }
 3612|  41.1k|    }
 3613|  41.3k|    if (i1->nTotalCharge != i2->nTotalCharge)
  ------------------
  |  Branch (3613:9): [True: 3.26k, False: 38.0k]
  ------------------
 3614|  3.26k|    {
 3615|  3.26k|        ret |= IDIF_CHARGE;
 3616|  3.26k|    }
 3617|  41.3k|    if (a1 && a1->nNumRemovedProtons && (!a2 || a2->nNumRemovedProtons != a1->nNumRemovedProtons))
  ------------------
  |  Branch (3617:9): [True: 41.3k, False: 0]
  |  Branch (3617:15): [True: 2.71k, False: 38.6k]
  |  Branch (3617:42): [True: 2.71k, False: 0]
  |  Branch (3617:49): [True: 0, False: 0]
  ------------------
 3618|  2.71k|    {
 3619|  2.71k|        ret |= IDIF_REM_PROT;
 3620|  2.71k|    }
 3621|  41.3k|    if (a1 && (!a2 ||
  ------------------
  |  Branch (3621:9): [True: 41.3k, False: 0]
  |  Branch (3621:16): [True: 41.3k, False: 0]
  ------------------
 3622|      0|        a2->nNumRemovedIsotopicH[0] != a1->nNumRemovedIsotopicH[0] ||
  ------------------
  |  Branch (3622:9): [True: 0, False: 0]
  ------------------
 3623|      0|        a2->nNumRemovedIsotopicH[1] != a1->nNumRemovedIsotopicH[1] ||
  ------------------
  |  Branch (3623:9): [True: 0, False: 0]
  ------------------
 3624|      0|        a2->nNumRemovedIsotopicH[2] != a1->nNumRemovedIsotopicH[2]))
  ------------------
  |  Branch (3624:9): [True: 0, False: 0]
  ------------------
 3625|  41.3k|    {
 3626|  41.3k|        ret |= IDIF_REM_ISO_H;
 3627|  41.3k|    }
 3628|       |
 3629|       |    /*
 3630|       |    if ( i1->nPossibleLocationsOfIsotopicH && i2->nPossibleLocationsOfIsotopicH ) {
 3631|       |        if ( i1->nPossibleLocationsOfIsotopicH[0] != i2->nPossibleLocationsOfIsotopicH[0] ||
 3632|       |             memcmp(i1->nPossibleLocationsOfIsotopicH, i2->nPossibleLocationsOfIsotopicH,
 3633|       |                    sizeof(i1->nPossibleLocationsOfIsotopicH[0])*i1->nPossibleLocationsOfIsotopicH[0]) )
 3634|       |            return 18;
 3635|       |    } else
 3636|       |    if ( !i1->nPossibleLocationsOfIsotopicH != !i2->nPossibleLocationsOfIsotopicH ) {
 3637|       |        return 19;
 3638|       |    }
 3639|       |    */
 3640|       |
 3641|  41.3k|    if (i1->StereoIsotopic &&
  ------------------
  |  Branch (3641:9): [True: 619, False: 40.7k]
  ------------------
 3642|    619|        i1->StereoIsotopic->nNumberOfStereoBonds + i1->StereoIsotopic->nNumberOfStereoCenters)
  ------------------
  |  Branch (3642:9): [True: 170, False: 449]
  ------------------
 3643|    170|    {
 3644|    170|        Stereo1 = i1->StereoIsotopic;
 3645|    170|    }
 3646|  41.1k|    else
 3647|  41.1k|    {
 3648|  41.1k|        Stereo1 = i1->Stereo;
 3649|  41.1k|    }
 3650|  41.3k|    if (i2->StereoIsotopic &&
  ------------------
  |  Branch (3650:9): [True: 552, False: 40.7k]
  ------------------
 3651|    552|        i2->StereoIsotopic->nNumberOfStereoBonds + i2->StereoIsotopic->nNumberOfStereoCenters)
  ------------------
  |  Branch (3651:9): [True: 313, False: 239]
  ------------------
 3652|    313|    {
 3653|    313|        Stereo2 = i2->StereoIsotopic;
 3654|    313|    }
 3655|  41.0k|    else
 3656|  41.0k|    {
 3657|  41.0k|        Stereo2 = i2->Stereo;
 3658|  41.0k|    }
 3659|  41.3k|    ret |= CompareReversedStereoINChI2(Stereo1, Stereo2, picr);
 3660|       |
 3661|   115k|exit_function:
 3662|       |
 3663|   115k|    picr->flags = ret;
 3664|       |
 3665|   115k|    return ret;
 3666|  41.3k|}
Create_INChI:
 3687|   252k|{
 3688|       |    /*
 3689|       |    #define NON_TAUT 0
 3690|       |    #define TAUT     1
 3691|       |    */
 3692|   252k|    int nebend = 0, * ebend = NULL;
 3693|       |
 3694|   252k|    sp_ATOM* at[TAUT_NUM]; /* at[0]=>non-tautomeric, at[1]=>tautomeric */
 3695|   252k|    int                       i, n1, n2, num_atoms, num_at_tg, num_removed_H, num_removed_H_taut = 0, ret = 0, ret2 = 0;
 3696|   252k|    INCHI_MODE                 nMode = 0;
 3697|   252k|    T_GROUP_INFO              vt_group_info;
 3698|   252k|    T_GROUP_INFO              vt_group_info_orig;
 3699|   252k|    T_GROUP_INFO* /*const*/  t_group_info = &vt_group_info;
 3700|   252k|    T_GROUP_INFO* /*const*/  t_group_info_orig = &vt_group_info_orig;
 3701|       |
 3702|   252k|    CANON_STAT  CS, CS2;
 3703|   252k|    CANON_STAT* pCS = &CS;
 3704|   252k|    CANON_STAT* pCS2 = &CS2;  /*  save all allocations to avoid memory leaks in case Canon_INChI() removes the pointer */
 3705|       |
 3706|   252k|    ATOM_SIZES  s[TAUT_NUM];
 3707|       |
 3708|   252k|    BCN Bcn;
 3709|   252k|    BCN* pBCN = &Bcn;
 3710|       |
 3711|   252k|    int bHasIsotopicAtoms = 0;
 3712|   252k|    int bMayHaveStereo = 0;
 3713|   252k|    int num_taut_at = 0;
 3714|       |
 3715|   252k|    inp_ATOM* out_at = NULL;     /*, *norm_at_fixed_bonds[TAUT_NUM]; */ /*  = {out_norm_nontaut_at, out_norm_taut_at} ; */
 3716|   252k|    INChI* pINChI = NULL;      /* added initialization 2006-03 */
 3717|   252k|    INChI_Aux* pINChI_Aux = NULL;  /* added initialization 2006-03 */
 3718|   252k|    int        bPointedEdgeStereo = ((TG_FLAG_POINTED_EDGE_STEREO & *pbTautFlags) ? PES_BIT_POINT_EDGE_STEREO : 0)
  ------------------
  |  |  937|   252k|#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)
  ------------------
  |  |   44|   252k|#define PES_BIT_POINT_EDGE_STEREO    1
  ------------------
  |  Branch (3718:38): [True: 252k, False: 0]
  ------------------
 3719|   252k|        | ((TG_FLAG_PHOSPHINE_STEREO & *pbTautFlags) ? PES_BIT_PHOSPHINE_STEREO : 0)
  ------------------
  |  |  941|   252k|#define TG_FLAG_PHOSPHINE_STEREO         0x00008000   /* add phosphine sp3 stereo */
  ------------------
                      | ((TG_FLAG_PHOSPHINE_STEREO & *pbTautFlags) ? PES_BIT_PHOSPHINE_STEREO : 0)
  ------------------
  |  |   45|    116|#define PES_BIT_PHOSPHINE_STEREO     2
  ------------------
  |  Branch (3719:12): [True: 116, False: 252k]
  ------------------
 3720|   252k|        | ((TG_FLAG_ARSINE_STEREO & *pbTautFlags) ? PES_BIT_ARSINE_STEREO : 0)
  ------------------
  |  |  942|   252k|#define TG_FLAG_ARSINE_STEREO            0x00010000   /* add arsine sp3 stereo */
  ------------------
                      | ((TG_FLAG_ARSINE_STEREO & *pbTautFlags) ? PES_BIT_ARSINE_STEREO : 0)
  ------------------
  |  |   46|      3|#define PES_BIT_ARSINE_STEREO        4
  ------------------
  |  Branch (3720:12): [True: 3, False: 252k]
  ------------------
 3721|   252k|        | ((TG_FLAG_FIX_SP3_BUG & *pbTautFlags) ? PES_BIT_FIX_SP3_BUG : 0);
  ------------------
  |  |  944|   252k|#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);
  ------------------
  |  |   47|      0|#define PES_BIT_FIX_SP3_BUG          8
  ------------------
  |  Branch (3721:12): [True: 0, False: 252k]
  ------------------
 3722|   252k|    INCHI_MODE bTautFlags = (*pbTautFlags & (~(INCHI_MODE)TG_FLAG_ALL_TAUTOMERIC));
  ------------------
  |  |  926|   252k|#define TG_FLAG_ALL_TAUTOMERIC          (TG_FLAG_TEST_TAUT__ATOMS| \
  |  |  ------------------
  |  |  |  |  918|   252k|#define TG_FLAG_TEST_TAUT__ATOMS         0x00000001   /* find regular tautomerism */
  |  |  ------------------
  |  |  927|   252k|                                         TG_FLAG_TEST_TAUT__SALTS| \
  |  |  ------------------
  |  |  |  |  920|   252k|#define TG_FLAG_TEST_TAUT__SALTS         0x00000004   /* DISCONNECT_SALTS if possible find long-range H/(-) taut. on =C-OH, >C=O    */
  |  |  ------------------
  |  |  928|   252k|                                         TG_FLAG_TEST_TAUT2_SALTS| \
  |  |  ------------------
  |  |  |  |  922|   252k|#define TG_FLAG_TEST_TAUT2_SALTS         0x00000010   /* TEST_REMOVE_S_ATOMS multi-attachement long-range H/(-) taut. on =C-OH, >C=O   */
  |  |  ------------------
  |  |  929|   252k|                                         TG_FLAG_MERGE_TAUT_SALTS)
  |  |  ------------------
  |  |  |  |  924|   252k|#define TG_FLAG_MERGE_TAUT_SALTS         0x00000040   /* DISCONNECT_SALTS merge all "salt"-t-groups and other =C-OH into one t-group */
  |  |  ------------------
  ------------------
 3723|   252k|    INCHI_MODE bTautFlagsDone = (*pbTautFlagsDone /*& (~(INCHI_MODE)TG_FLAG_ALL_TAUTOMERIC) */);
 3724|       |#if ( bRELEASE_VERSION == 0 )
 3725|       |    int bExtract = 0; /*  EXTR_HAS_ATOM_WITH_DEFINED_PARITY; */
 3726|       |#endif
 3727|       |
 3728|       |#ifdef GHI100_FIX
 3729|       |#if ((SPRINTF_FLAG != 1) && (SPRINTF_FLAG != 2))
 3730|       |    setlocale(LC_ALL, "en-US"); /* djb-rwth: setting all locales to "en-US" */
 3731|       |#endif
 3732|       |#endif
 3733|       |
 3734|       |    /* */
 3735|   252k|    int bFixIsoFixedH = 0;
 3736|   252k|    int bFixTermHChrg = 0;
 3737|       |
 3738|   252k|    int LargeMolecules = ip->bLargeMolecules;
 3739|       |    /* djb-rwth: removing redundant variables */
 3740|       |
 3741|       |    /*    vABParityUnknown holds actual value of an internal constant signifying
 3742|       |        unknown parity: either the same as for undefined parity (default==standard)
 3743|       |        or a specific one (non-std; requested by SLUUD switch).                 */
 3744|   252k|    int vABParityUnknown = AB_PARITY_UNDF;
  ------------------
  |  |  222|   252k|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 3745|   252k|    if (0 != (nUserMode & REQ_MODE_DIFF_UU_STEREO))
  ------------------
  |  |   40|   252k|#define REQ_MODE_DIFF_UU_STEREO     0x004000    /* SLUUD Make labels for unknown and undefined stereo different */
  ------------------
  |  Branch (3745:9): [True: 0, False: 252k]
  ------------------
 3746|      0|    {
 3747|       |        /* Make labels for unknown and undefined stereo different */
 3748|      0|        vABParityUnknown = AB_PARITY_UNKN;
  ------------------
  |  |  221|      0|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
 3749|      0|    }
 3750|       |
 3751|       |    /* djb-rwth: removing redundant code */
 3752|       |
 3753|   252k|#if ( FIX_ISO_FIXEDH_BUG == 1 )
 3754|   252k|    if (TG_FLAG_FIX_ISO_FIXEDH_BUG & *pbTautFlags)
  ------------------
  |  |  950|   252k|#define TG_FLAG_FIX_ISO_FIXEDH_BUG       0x00200000   /* fix bug found after v.102b (isotopic H representation)  */
  ------------------
  |  Branch (3754:9): [True: 252k, False: 0]
  ------------------
 3755|   252k|        bFixIsoFixedH = 1;
 3756|   252k|#endif
 3757|   252k|#if ( FIX_TERM_H_CHRG_BUG == 1 )
 3758|   252k|    if (TG_FLAG_FIX_TERM_H_CHRG_BUG & *pbTautFlags)
  ------------------
  |  |  951|   252k|#define TG_FLAG_FIX_TERM_H_CHRG_BUG      0x00400000   /* fix bug found after v.102b (moving H charge in 'remove_terminal_HDT') */
  ------------------
  |  Branch (3758:9): [True: 252k, False: 0]
  ------------------
 3759|   252k|        bFixTermHChrg = 1;
 3760|   252k|#endif
 3761|       |
 3762|       |#ifdef FIX_SRU_CYCLIZING_PS_BONDS_IN_BNS
 3763|       |    /* Polymer related */
 3764|       |    if (orig_inp_data && orig_inp_data->polymer && orig_inp_data->polymer->n > 0 && orig_inp_data->polymer->valid)
 3765|       |    {
 3766|       |        int j, jj;
 3767|       |        nebend = 0;
 3768|       |        for (j = 0; j < orig_inp_data->polymer->n; j++)
 3769|       |            if (orig_inp_data->polymer->units[j]->cyclized == 1)
 3770|       |                nebend++;
 3771|       |        if (nebend)
 3772|       |        {
 3773|       |            nebend *= 2;
 3774|       |            ebend = inchi_calloc(2 * nebend, sizeof(int));
 3775|       |            if (!ebend)
 3776|       |            {
 3777|       |                ret = CT_OUT_OF_RAM; goto exit_function;
 3778|       |            }
 3779|       |            jj = 0;
 3780|       |            for (j = 0; j < orig_inp_data->polymer->n; j++)
 3781|       |            {
 3782|       |                if (orig_inp_data->polymer->units[j]->cyclized == 1)
 3783|       |                {
 3784|       |                    ebend[jj] = orig_inp_data->polymer->units[j]->end_atom1;
 3785|       |                    ebend[jj + 1] = orig_inp_data->polymer->units[j]->end_atom2;
 3786|       |                    jj += 2;
 3787|       |                }
 3788|       |            }
 3789|       |        }
 3790|       |    }
 3791|       |#endif
 3792|       |
 3793|   252k|    memset(s, 0, sizeof(s)); /* djb-rwth: memset_s C11/Annex K variant? */
 3794|   252k|    if (pBCN)
  ------------------
  |  Branch (3794:9): [True: 252k, False: 0]
  ------------------
 3795|   252k|    {
 3796|   252k|        memset(pBCN, 0, sizeof(pBCN[0])); /* djb-rwth: memset_s C11/Annex K variant? */
 3797|   252k|    }
 3798|   252k|    memset(t_group_info, 0, sizeof(*t_group_info)); /* djb-rwth: memset_s C11/Annex K variant? */
 3799|   252k|    memset(t_group_info_orig, 0, sizeof(*t_group_info_orig)); /* djb-rwth: memset_s C11/Annex K variant? */
 3800|       |    /*norm_at[TAUT_NON] = out_norm_data[TAUT_NON]->at; *//* output normalized non-tautomeric component */
 3801|       |    /*norm_at[TAUT_YES] = out_norm_data[TAUT_YES]->at; *//* output normalized tautomeric component */
 3802|       |    /*norm_at_fixed_bonds[TAUT_NON] = NULL;*/
 3803|       |    /*norm_at_fixed_bonds[TAUT_YES] = out_norm_data[TAUT_YES]->at_fixed_bonds;*/
 3804|   756k|    for (i = 0; i < TAUT_NUM; i++)
  ------------------
  |  |  573|   756k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3804:17): [True: 504k, False: 252k]
  ------------------
 3805|   504k|    {
 3806|   504k|        if (out_norm_data[i]->at)
  ------------------
  |  Branch (3806:13): [True: 289k, False: 214k]
  ------------------
 3807|   289k|        {
 3808|   289k|            if (!(at[i] = (sp_ATOM*)inchi_malloc(num_inp_at * sizeof(*at[0]))))
  ------------------
  |  | 1143|   289k|#define inchi_malloc   malloc
  ------------------
  |  Branch (3808:17): [True: 0, False: 289k]
  ------------------
 3809|      0|            {
 3810|      0|                ret = -1;
 3811|      0|            }
 3812|   289k|        }
 3813|   214k|        else
 3814|   214k|        {
 3815|   214k|            at[i] = NULL;
 3816|   214k|        }
 3817|   504k|    }
 3818|       |
 3819|   252k|    if ((!out_norm_data[TAUT_NON]->at && !out_norm_data[TAUT_YES]->at)
  ------------------
  |  |  574|   252k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  if ((!out_norm_data[TAUT_NON]->at && !out_norm_data[TAUT_YES]->at)
  ------------------
  |  |  575|   214k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3819:10): [True: 214k, False: 37.6k]
  |  Branch (3819:42): [True: 0, False: 214k]
  ------------------
 3820|   252k|        || !inp_at || ret) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3820:12): [True: 0, False: 252k]
  |  Branch (3820:23): [True: 0, False: 252k]
  ------------------
 3821|      0|    {
 3822|      0|        ret = -1;
 3823|      0|        goto exit_function;
 3824|      0|    }
 3825|       |
 3826|       |    /* the first struct to process: tautomeric if exists else non-tautomeric */
 3827|   252k|    out_at = out_norm_data[TAUT_YES]->at ? out_norm_data[TAUT_YES]->at : out_norm_data[TAUT_NON]->at;
  ------------------
  |  |  575|   252k|#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;
  ------------------
  |  |  575|   252k|#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;
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3827:14): [True: 252k, False: 0]
  ------------------
 3828|       |    /* copy the input structure to be normalized to the buffer for the normalization data */
 3829|   252k|    memcpy(out_at, inp_at, num_inp_at * sizeof(out_at[0]));
 3830|       |    /*  tautomeric groups setting */
 3831|   252k|    t_group_info->bIgnoreIsotopic = 0;   /*  include tautomeric group isotopic info in MarkTautomerGroups() */
 3832|   252k|    t_group_info->bTautFlags = *pbTautFlags;
 3833|   252k|    t_group_info->bTautFlagsDone = *pbTautFlagsDone;
 3834|   252k|    t_group_info->t_group = NULL; /* djb-rwth: fixing oss-fuzz issue #70475 */
 3835|       |
 3836|       |    /*
 3837|       |        Preprocess the structure
 3838|       |        (here THE NUMBER OF ATOMS MAY BE REDUCED)
 3839|       |    */
 3840|       |
 3841|       |    /*  ??? Ambiguity: H-D may become HD or DH
 3842|       |        (that is, H+implicit D or D+implicit H)    */
 3843|   252k|    if (TG_FLAG_H_ALREADY_REMOVED & bTautFlags)
  ------------------
  |  |  943|   252k|#define TG_FLAG_H_ALREADY_REMOVED        0x00020000   /* processing structure restored from InChI */
  ------------------
  |  Branch (3843:9): [True: 146k, False: 106k]
  ------------------
 3844|   146k|    {
 3845|   146k|        INP_ATOM_DATA* out_norm_data1 = out_norm_data[TAUT_YES]->at ? out_norm_data[TAUT_YES] :
  ------------------
  |  |  575|   146k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      INP_ATOM_DATA* out_norm_data1 = out_norm_data[TAUT_YES]->at ? out_norm_data[TAUT_YES] :
  ------------------
  |  |  575|   146k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3845:41): [True: 146k, False: 0]
  ------------------
 3846|   146k|            out_norm_data[TAUT_NON]->at ? out_norm_data[TAUT_NON] : NULL;
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                          out_norm_data[TAUT_NON]->at ? out_norm_data[TAUT_NON] : NULL;
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3846:13): [True: 0, False: 0]
  ------------------
 3847|   146k|        if (out_norm_data1)
  ------------------
  |  Branch (3847:13): [True: 146k, False: 0]
  ------------------
 3848|   146k|        {
 3849|   146k|            num_at_tg =
 3850|   146k|                num_atoms = out_norm_data1->num_at - out_norm_data1->num_removed_H;
 3851|   146k|            num_removed_H = out_norm_data1->num_removed_H;
 3852|   146k|            t_group_info->tni.nNumRemovedExplicitH = num_removed_H;
 3853|   146k|        }
 3854|      0|        else
 3855|      0|        {
 3856|      0|            ret = -1;
 3857|      0|            goto exit_function;
 3858|      0|        }
 3859|   146k|    }
 3860|   106k|    else
 3861|   106k|    {
 3862|   106k|        num_at_tg = num_atoms = remove_terminal_HDT(num_inp_at, out_at, bFixTermHChrg, keep_explicit_HDT);
 3863|   106k|        num_removed_H = num_inp_at - num_atoms;
 3864|   106k|        t_group_info->tni.nNumRemovedExplicitH = num_removed_H;
 3865|   106k|        add_DT_to_num_H(num_atoms, out_at);
 3866|   106k|    }
 3867|       |    /*fix_odd_things( num_atoms, out_at );*/
 3868|   252k|#if ( FIND_RING_SYSTEMS == 1 )
 3869|   252k|    MarkRingSystemsInp(out_at, num_atoms, 0);
 3870|   252k|#endif
 3871|       |    /*  duplicate the preprocessed structure so that all supplied out_norm_data[]->at buffers are filled */
 3872|   252k|    if (out_at != out_norm_data[TAUT_YES]->at && out_norm_data[TAUT_YES]->at)
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  if (out_at != out_norm_data[TAUT_YES]->at && out_norm_data[TAUT_YES]->at)
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3872:9): [True: 0, False: 252k]
  |  Branch (3872:50): [True: 0, False: 0]
  ------------------
 3873|      0|    {
 3874|      0|        memcpy(out_norm_data[TAUT_YES]->at, out_at, num_inp_at * sizeof(out_at[0]));
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3875|      0|    }
 3876|   252k|    if (out_norm_data[TAUT_YES]->at_fixed_bonds && out_norm_data[TAUT_YES]->at)
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  if (out_norm_data[TAUT_YES]->at_fixed_bonds && out_norm_data[TAUT_YES]->at)
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3876:9): [True: 252k, False: 0]
  |  Branch (3876:52): [True: 252k, False: 0]
  ------------------
 3877|   252k|    {
 3878|   252k|        memcpy(out_norm_data[TAUT_YES]->at_fixed_bonds, out_at, num_inp_at * sizeof(out_at[0]));
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3879|   252k|    }
 3880|   252k|    if (out_at != out_norm_data[TAUT_NON]->at && out_norm_data[TAUT_NON]->at)
  ------------------
  |  |  574|   252k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  if (out_at != out_norm_data[TAUT_NON]->at && out_norm_data[TAUT_NON]->at)
  ------------------
  |  |  574|   252k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3880:9): [True: 252k, False: 0]
  |  Branch (3880:50): [True: 37.6k, False: 214k]
  ------------------
 3881|  37.6k|    {
 3882|  37.6k|        memcpy(out_norm_data[TAUT_NON]->at, out_at, num_inp_at * sizeof(out_at[0]));
  ------------------
  |  |  574|  37.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 3883|  37.6k|    }
 3884|       |
 3885|       |    /*
 3886|       |      ??? not true ??? duplicate inp_at and keep inp_at[] unchanged after terminal hydrogens removal
 3887|       |      set stereo parities in taut_at[], non_taut_at[]
 3888|       |      obtain max. lenghts of the name stereo parts
 3889|       |      Ignore absence/presence of isotopic stereo for now
 3890|       |      mark isotopic atoms
 3891|       |    */
 3892|   252k|    if (out_norm_data[TAUT_YES]->at && at[TAUT_YES])
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  if (out_norm_data[TAUT_YES]->at && at[TAUT_YES])
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3892:9): [True: 252k, False: 0]
  |  Branch (3892:40): [True: 252k, False: 0]
  ------------------
 3893|   252k|    {
 3894|       |        /* final normalization of possibly tautomeric structure */
 3895|   252k|        ret = mark_alt_bonds_and_taut_groups(ic, pCG,
 3896|   252k|            out_norm_data[TAUT_YES]->at,
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3897|   252k|            out_norm_data[TAUT_YES]->at_fixed_bonds,
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3898|   252k|            num_atoms, ulMaxTime, t_group_info,
 3899|   252k|            NULL, NULL,
 3900|   252k|            nebend, ebend);
 3901|   252k|        if (ret < 0)
  ------------------
  |  Branch (3901:13): [True: 12, False: 252k]
  ------------------
 3902|     12|        {
 3903|     12|            goto exit_function;/*  out of RAM or other normalization problem */
 3904|     12|        }
 3905|   252k|        num_taut_at = ret; /* number of atoms without removed H? */
 3906|   252k|        num_removed_H_taut = t_group_info->tni.nNumRemovedExplicitH;
 3907|   252k|        out_norm_data[TAUT_YES]->num_at = num_atoms + num_removed_H_taut; /* protons might have been removed */
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3908|   252k|        out_norm_data[TAUT_YES]->num_removed_H = num_removed_H_taut;
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3909|   252k|        out_norm_data[TAUT_YES]->nNumRemovedProtons += t_group_info->tni.nNumRemovedProtons;
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3910|  1.00M|        for (i = 0; i < NUM_H_ISOTOPES; i++)
  ------------------
  |  |   72|  1.00M|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (3910:21): [True: 756k, False: 252k]
  ------------------
 3911|   756k|        {
 3912|   756k|            out_norm_data[TAUT_YES]->nNumRemovedProtonsIsotopic[i] +=
  ------------------
  |  |  575|   756k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3913|   756k|                t_group_info->tni.nNumRemovedProtonsIsotopic[i] /*+ t_group_info->num_iso_H[i]*/;
 3914|   756k|            out_norm_data[TAUT_YES]->num_iso_H[i] +=
  ------------------
  |  |  575|   756k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3915|   756k|                t_group_info->num_iso_H[i];
 3916|   756k|        }
 3917|       |        /* mark deleted isolated tautomeric H(+) */
 3918|   252k|        if (num_taut_at == 1 &&
  ------------------
  |  Branch (3918:13): [True: 149k, False: 102k]
  ------------------
 3919|   149k|            out_norm_data[TAUT_YES]->at[0].at_type == ATT_PROTON &&
  ------------------
  |  |  575|   149k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          out_norm_data[TAUT_YES]->at[0].at_type == ATT_PROTON &&
  ------------------
  |  |   43|   401k|#define ATT_PROTON 0x1000
  ------------------
  |  Branch (3919:13): [True: 35.0k, False: 114k]
  ------------------
 3920|  35.0k|            t_group_info && t_group_info->tni.nNumRemovedProtons == 1)
  ------------------
  |  Branch (3920:13): [True: 35.0k, False: 0]
  |  Branch (3920:29): [True: 35.0k, False: 0]
  ------------------
 3921|  35.0k|        {
 3922|  35.0k|            out_norm_data[TAUT_YES]->bDeleted = 1;
  ------------------
  |  |  575|  35.0k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3923|  35.0k|            FreeInpAtom(&out_norm_data[TAUT_YES]->at_fixed_bonds);
  ------------------
  |  |  575|  35.0k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3924|  35.0k|        }
 3925|   217k|        else
 3926|   217k|        {
 3927|   217k|            if ((t_group_info->tni.bNormalizationFlags & FLAG_NORM_CONSIDER_TAUT) &&
  ------------------
  |  |  156|   217k|#define FLAG_NORM_CONSIDER_TAUT      ( FLAG_PROTON_NPO_SIMPLE_REMOVED | \
  |  |  ------------------
  |  |  |  |  146|   217k|#define FLAG_PROTON_NPO_SIMPLE_REMOVED 0x0001
  |  |  ------------------
  |  |  157|   217k|                                       FLAG_PROTON_NP_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  147|   217k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  158|   217k|                                       FLAG_PROTON_AC_SIMPLE_ADDED    | \
  |  |  ------------------
  |  |  |  |  148|   217k|#define FLAG_PROTON_AC_SIMPLE_ADDED    0x0004
  |  |  ------------------
  |  |  159|   217k|                                       FLAG_PROTON_AC_SIMPLE_REMOVED  | \
  |  |  ------------------
  |  |  |  |  149|   217k|#define FLAG_PROTON_AC_SIMPLE_REMOVED  0x0008
  |  |  ------------------
  |  |  160|   217k|                                       FLAG_PROTON_AC_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  150|   217k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  161|   217k|                                       FLAG_PROTON_AC_HARD_ADDED      | \
  |  |  ------------------
  |  |  |  |  151|   217k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  |  |  162|   217k|                                       FLAG_PROTON_SINGLE_REMOVED     | \
  |  |  ------------------
  |  |  |  |  153|   217k|#define FLAG_PROTON_SINGLE_REMOVED     0x0080
  |  |  ------------------
  |  |  163|   217k|                                       FLAG_PROTON_CHARGE_CANCEL    )
  |  |  ------------------
  |  |  |  |  152|   217k|#define FLAG_PROTON_CHARGE_CANCEL      0x0040
  |  |  ------------------
  ------------------
  |  Branch (3927:17): [True: 4.59k, False: 212k]
  ------------------
 3928|  4.59k|                out_norm_data[TAUT_YES]->at_fixed_bonds)
  ------------------
  |  |  575|  4.59k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3928:17): [True: 4.59k, False: 0]
  ------------------
 3929|  4.59k|            {
 3930|  4.59k|                out_norm_data[TAUT_YES]->bTautPreprocessed = 1;
  ------------------
  |  |  575|  4.59k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3931|  4.59k|            }
 3932|   217k|        }
 3933|       |
 3934|       |        /*
 3935|       |            if ( !(t_group_info->tni.bNormalizationFlags & (FLAG_NORM_CONSIDER_TAUT & ~FLAG_PROTON_SINGLE_REMOVED)) &&
 3936|       |                 out_norm_data[TAUT_YES]->at_fixed_bonds) {
 3937|       |                 FreeInpAtom( &out_norm_data[TAUT_YES]->at_fixed_bonds );
 3938|       |            }
 3939|       |        */
 3940|       |
 3941|       |        /*out_norm_data[TAUT_YES]->num_removed_H = num_removed_H_taut;*/
 3942|       |
 3943|   252k|        out_norm_data[TAUT_YES]->bTautFlags = *pbTautFlags = t_group_info->bTautFlags;
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3944|   252k|        out_norm_data[TAUT_YES]->bTautFlagsDone = *pbTautFlagsDone = t_group_info->bTautFlagsDone;
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3945|   252k|        out_norm_data[TAUT_YES]->bNormalizationFlags = t_group_info->tni.bNormalizationFlags;
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3946|       |
 3947|       |        /* create internal sp_ATOM at[] out of out_norm_data[]->at */
 3948|   252k|        inp2spATOM(out_norm_data[TAUT_YES]->at, num_inp_at, at[TAUT_YES]);
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      inp2spATOM(out_norm_data[TAUT_YES]->at, num_inp_at, at[TAUT_YES]);
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3949|       |
 3950|       |        /* set stereo parities to at[]; nUserMode: accept alt. stereo bonds, min ring size */
 3951|   252k|        ret = set_stereo_parity(pCG, out_norm_data[TAUT_YES]->at, at[TAUT_YES],
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      ret = set_stereo_parity(pCG, out_norm_data[TAUT_YES]->at, at[TAUT_YES],
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3952|   252k|            num_taut_at, num_removed_H_taut,
 3953|   252k|            &s[TAUT_YES].nMaxNumStereoAtoms,
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3954|   252k|            &s[TAUT_YES].nMaxNumStereoBonds,
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3955|   252k|            nUserMode, bPointedEdgeStereo,
 3956|   252k|            vABParityUnknown, ip->bLooseTSACheck, ip->bStereoAtZz);
 3957|       |
 3958|       |#if ( bRELEASE_VERSION == 0 )
 3959|       |        if (0 < ret)
 3960|       |        {
 3961|       |            bExtract |= EXTR_HAS_ATOM_WITH_DEFINED_PARITY;
 3962|       |        }
 3963|       |        if (t_group_info->tni.bNormalizationFlags & FLAG_NORM_CONSIDER_TAUT)
 3964|       |        {
 3965|       |            bExtract |= EXTR_TAUT_TREATMENT_CHARGES;
 3966|       |        }
 3967|       |#endif
 3968|       |
 3969|   252k|        if (RETURNED_ERROR(ret))
  ------------------
  |  |   44|   252k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|   252k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|   252k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|   252k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|   252k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|   252k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 252k, False: 0]
  |  |  |  Branch (44:53): [True: 16, False: 252k]
  |  |  ------------------
  ------------------
 3970|     16|        {
 3971|     16|            goto exit_function; /*  stereo bond error */
 3972|     16|        }
 3973|       |
 3974|   252k|        s[TAUT_YES].bMayHaveStereo =
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3975|   252k|            (s[TAUT_YES].nMaxNumStereoAtoms ||
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3975:14): [True: 6.77k, False: 245k]
  ------------------
 3976|   245k|                s[TAUT_YES].nMaxNumStereoBonds);
  ------------------
  |  |  575|   245k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3976:17): [True: 3.86k, False: 241k]
  ------------------
 3977|       |
 3978|       |        /*
 3979|       |            mark isotopic atoms and atoms that have non-tautomeric
 3980|       |            isotopic terminal hydrogen atoms 1H, 2H(D), 3H(T)
 3981|       |        */
 3982|       |
 3983|   252k|        s[TAUT_YES].num_isotopic_atoms =
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3984|   252k|            set_atom_iso_sort_keys(num_taut_at,
 3985|   252k|                at[TAUT_YES],
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3986|   252k|                t_group_info,
 3987|   252k|                &s[TAUT_YES].bHasIsotopicTautGroups);
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3988|       |
 3989|       |        /*
 3990|       |            Prepare tautomeric (if no tautomerism found then prepare non-tautomeric)
 3991|       |            structure for canonicalizaton:
 3992|       |
 3993|       |                remove t-groups that have no H,
 3994|       |                remove charges from t-groups if requested
 3995|       |                renumber t-groups and find final t_group_info->num_t_groups
 3996|       |                add to t-groups lists of endpoints tgroup->nEndpointAtomNumber[]
 3997|       |                calculate length of the t-group part of the connection table
 3998|       |         */
 3999|       |
 4000|   252k|        s[TAUT_YES].nLenLinearCTTautomer = CountTautomerGroups(at[TAUT_YES], num_taut_at, t_group_info);
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      s[TAUT_YES].nLenLinearCTTautomer = CountTautomerGroups(at[TAUT_YES], num_taut_at, t_group_info);
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4001|       |
 4002|   252k|        if (RETURNED_ERROR(s[TAUT_YES].nLenLinearCTTautomer))
  ------------------
  |  |   44|   252k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|   252k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|   252k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|   252k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|   252k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|   252k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 252k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 252k]
  |  |  ------------------
  ------------------
 4003|      0|        {
 4004|       |            /* added error treatment 9-11-2003 */
 4005|      0|            ret = s[TAUT_YES].nLenLinearCTTautomer;
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4006|      0|            goto exit_function;
 4007|       |            /*  error has happened; no breakpoint here
 4008|       |            s[TAUT_YES].nLenLinearCTTautomer = 0;
 4009|       |            */
 4010|      0|        }
 4011|       |
 4012|   252k|        else if (s[TAUT_YES].nLenLinearCTTautomer > 0)
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4012:18): [True: 40.8k, False: 211k]
  ------------------
 4013|  40.8k|        {
 4014|  40.8k|            num_at_tg = num_taut_at + t_group_info->num_t_groups;
 4015|       |            /*  ??? -not true- create t_group_info_orig for multiple calls with atom renumbering */
 4016|  40.8k|            make_a_copy_of_t_group_info(t_group_info_orig /* dest*/, t_group_info /* source*/); /* djb-rwth: addressing coverity ID #499544 -- properly used sequence of arguments according to the comment in previous line */
 4017|       |            /*  mark isotopic tautomer groups: calculate t_group->iWeight */
 4018|  40.8k|            s[TAUT_YES].nLenLinearCTIsotopicTautomer = set_tautomer_iso_sort_keys(t_group_info);
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4019|  40.8k|            if (s[TAUT_YES].nLenLinearCTIsotopicTautomer < 0)
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4019:17): [True: 0, False: 40.8k]
  ------------------
 4020|      0|            {
 4021|       |                /* ??? -error cannot happen- error has happened; no breakpoint here */
 4022|      0|                s[TAUT_YES].nLenLinearCTIsotopicTautomer = 0;
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4023|      0|            }
 4024|  40.8k|            out_norm_data[TAUT_YES]->bTautomeric = s[TAUT_YES].nLenLinearCTTautomer;
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          out_norm_data[TAUT_YES]->bTautomeric = s[TAUT_YES].nLenLinearCTTautomer;
  ------------------
  |  |  575|  40.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4025|  40.8k|        }
 4026|       |
 4027|       |        /*  new variable: s[TAUT_YES].nLenCT introduced 7-22-2002 */
 4028|   252k|        GetCanonLengths(num_taut_at, at[TAUT_YES], &s[TAUT_YES], t_group_info);
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      GetCanonLengths(num_taut_at, at[TAUT_YES], &s[TAUT_YES], t_group_info);
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4029|   252k|    }
 4030|       |
 4031|   252k|    if (out_norm_data[TAUT_NON]->at &&
  ------------------
  |  |  574|   252k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4031:9): [True: 37.6k, False: 214k]
  ------------------
 4032|  37.6k|        out_norm_data[TAUT_YES]->at &&
  ------------------
  |  |  575|  37.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4032:9): [True: 37.6k, False: 0]
  ------------------
 4033|  37.6k|        at[TAUT_NON] &&
  ------------------
  |  |  574|  37.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4033:9): [True: 37.6k, False: 0]
  ------------------
 4034|  37.6k|        !s[TAUT_YES].nLenLinearCTTautomer)
  ------------------
  |  |  575|  37.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4034:9): [True: 1.23k, False: 36.3k]
  ------------------
 4035|  1.23k|    {
 4036|       |        /* the structure is non-tautomeric: use tautomeric treatment results only for it */
 4037|  1.23k|        inchi_free(at[TAUT_NON]);
  ------------------
  |  | 1152|  1.23k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 1.23k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 1.23k]
  |  |  ------------------
  ------------------
 4038|  1.23k|        at[TAUT_NON] = NULL;
  ------------------
  |  |  574|  1.23k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4039|  1.23k|    }
 4040|       |
 4041|   250k|    else if (!out_norm_data[TAUT_NON]->at &&
  ------------------
  |  |  574|   250k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4041:14): [True: 214k, False: 36.3k]
  ------------------
 4042|   214k|        out_norm_data[TAUT_YES]->at &&
  ------------------
  |  |  575|   214k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4042:9): [True: 214k, False: 0]
  ------------------
 4043|   214k|        !at[TAUT_NON] &&
  ------------------
  |  |  574|   214k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4043:9): [True: 214k, False: 0]
  ------------------
 4044|   214k|        at[TAUT_YES] &&
  ------------------
  |  |  575|   214k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4044:9): [True: 214k, False: 0]
  ------------------
 4045|   214k|        !s[TAUT_YES].nLenLinearCTTautomer)
  ------------------
  |  |  575|   214k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4045:9): [True: 209k, False: 4.50k]
  ------------------
 4046|   209k|    {
 4047|       |        /* requested tautomeric; found non-tautomeric; it is located in out_norm_data[TAUT_YES]->at */
 4048|   209k|        out_norm_data[TAUT_YES]->bTautomeric = 0;
  ------------------
  |  |  575|   209k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4049|   209k|    }
 4050|       |
 4051|  40.8k|    else if (out_norm_data[TAUT_NON]->at && at[TAUT_NON])
  ------------------
  |  |  574|  40.8k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  else if (out_norm_data[TAUT_NON]->at && at[TAUT_NON])
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4051:14): [True: 36.3k, False: 4.50k]
  |  Branch (4051:45): [True: 36.3k, False: 0]
  ------------------
 4052|  36.3k|    {
 4053|       |        /* the structure needs non-tautomeric treatment:
 4054|       |        final normalization of non-tautomeric structure */
 4055|  36.3k|        ret = mark_alt_bonds_and_taut_groups(ic, pCG,
 4056|  36.3k|            out_norm_data[TAUT_NON]->at,
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4057|  36.3k|            NULL,
 4058|  36.3k|            num_atoms,
 4059|  36.3k|            ulMaxTime,
 4060|  36.3k|            NULL,
 4061|  36.3k|            &bTautFlags,
 4062|  36.3k|            &bTautFlagsDone,
 4063|  36.3k|            nebend, ebend);
 4064|  36.3k|        if (ret < 0)
  ------------------
  |  Branch (4064:13): [True: 0, False: 36.3k]
  ------------------
 4065|      0|        {
 4066|      0|            goto exit_function;  /*  out of RAM or other normalization problem */
 4067|      0|        }
 4068|  36.3k|        out_norm_data[TAUT_NON]->num_at = num_atoms + num_removed_H;
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4069|  36.3k|        out_norm_data[TAUT_NON]->num_removed_H = num_removed_H;
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4070|  36.3k|        out_norm_data[TAUT_NON]->bTautFlags = *pbTautFlags;
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4071|  36.3k|        out_norm_data[TAUT_NON]->bTautFlagsDone = *pbTautFlagsDone;
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4072|  36.3k|        out_norm_data[TAUT_NON]->bNormalizationFlags = 0;
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4073|       |
 4074|       |        /* create internal sp_ATOM at[] out of out_norm_data[]->at */
 4075|  36.3k|        inp2spATOM(out_norm_data[TAUT_NON]->at, num_inp_at, at[TAUT_NON]);
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      inp2spATOM(out_norm_data[TAUT_NON]->at, num_inp_at, at[TAUT_NON]);
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4076|       |
 4077|       |        /* set stereo parities to at[]; nUserMode: accept alt. stereo bonds, min ring size */
 4078|  36.3k|        ret = set_stereo_parity(pCG, out_norm_data[TAUT_NON]->at,
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4079|  36.3k|            at[TAUT_NON], num_atoms, num_removed_H,
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4080|  36.3k|            &s[TAUT_NON].nMaxNumStereoAtoms,
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4081|  36.3k|            &s[TAUT_NON].nMaxNumStereoBonds, nUserMode,
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4082|  36.3k|            bPointedEdgeStereo, vABParityUnknown,
 4083|  36.3k|            ip->bLooseTSACheck, ip->bStereoAtZz);
 4084|       |#if ( bRELEASE_VERSION == 0 )
 4085|       |        if (0 < ret)
 4086|       |        {
 4087|       |            bExtract |= EXTR_HAS_ATOM_WITH_DEFINED_PARITY;
 4088|       |        }
 4089|       |#endif
 4090|  36.3k|        if (RETURNED_ERROR(ret))
  ------------------
  |  |   44|  36.3k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  36.3k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  36.3k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  36.3k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  36.3k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  36.3k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 36.3k, False: 0]
  |  |  |  Branch (44:53): [True: 10, False: 36.3k]
  |  |  ------------------
  ------------------
 4091|     10|        {
 4092|     10|            goto exit_function; /*  stereo bond error */
 4093|     10|        }
 4094|  36.3k|        s[TAUT_NON].bMayHaveStereo = (s[TAUT_NON].nMaxNumStereoAtoms ||
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      s[TAUT_NON].bMayHaveStereo = (s[TAUT_NON].nMaxNumStereoAtoms ||
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4094:39): [True: 306, False: 36.0k]
  ------------------
 4095|  36.0k|            s[TAUT_NON].nMaxNumStereoBonds);
  ------------------
  |  |  574|  36.0k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4095:13): [True: 259, False: 35.8k]
  ------------------
 4096|       |
 4097|       |        /*
 4098|       |         * mark isotopic atoms and atoms that have non-tautomeric
 4099|       |         * isotopic terminal hydrogen atoms 1H, 2H(D), 3H(T)
 4100|       |         */
 4101|  36.3k|        s[TAUT_NON].num_isotopic_atoms = set_atom_iso_sort_keys(num_atoms, at[TAUT_NON], NULL, NULL);
  ------------------
  |  |  574|  36.3k|#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);
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4102|  36.3k|        GetCanonLengths(num_atoms, at[TAUT_NON], &s[TAUT_NON], NULL);
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      GetCanonLengths(num_atoms, at[TAUT_NON], &s[TAUT_NON], NULL);
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4103|  36.3k|        out_norm_data[TAUT_NON]->bTautomeric = 0;
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4104|  36.3k|    }
 4105|       |
 4106|       |    /* common  */
 4107|   252k|    bMayHaveStereo = s[TAUT_YES].bMayHaveStereo || s[TAUT_NON].bMayHaveStereo;
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  bMayHaveStereo = s[TAUT_YES].bMayHaveStereo || s[TAUT_NON].bMayHaveStereo;
  ------------------
  |  |  574|   241k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4107:22): [True: 10.6k, False: 241k]
  |  Branch (4107:52): [True: 118, False: 241k]
  ------------------
 4108|   252k|    bHasIsotopicAtoms = s[TAUT_NON].num_isotopic_atoms > 0 || s[TAUT_NON].bHasIsotopicTautGroups > 0 ||
  ------------------
  |  |  574|   252k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  bHasIsotopicAtoms = s[TAUT_NON].num_isotopic_atoms > 0 || s[TAUT_NON].bHasIsotopicTautGroups > 0 ||
  ------------------
  |  |  574|   251k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4108:25): [True: 666, False: 251k]
  |  Branch (4108:63): [True: 0, False: 251k]
  ------------------
 4109|   251k|        s[TAUT_YES].num_isotopic_atoms > 0 || s[TAUT_YES].bHasIsotopicTautGroups > 0;
  ------------------
  |  |  575|   251k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      s[TAUT_YES].num_isotopic_atoms > 0 || s[TAUT_YES].bHasIsotopicTautGroups > 0;
  ------------------
  |  |  575|   250k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4109:9): [True: 751, False: 250k]
  |  Branch (4109:47): [True: 73, False: 250k]
  ------------------
 4110|   252k|    if (bFixIsoFixedH)
  ------------------
  |  Branch (4110:9): [True: 252k, False: 0]
  ------------------
 4111|   252k|    {
 4112|       |        /* 2008-03-21 DT */
 4113|   252k|        bHasIsotopicAtoms = bHasIsotopicAtoms
  ------------------
  |  Branch (4113:29): [True: 1.49k, False: 250k]
  ------------------
 4114|   250k|            ||
 4115|   250k|            (s[TAUT_YES].nLenLinearCTTautomer > 0 && t_group_info &&
  ------------------
  |  |  575|   250k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4115:14): [True: 39.9k, False: 210k]
  |  Branch (4115:54): [True: 39.9k, False: 0]
  ------------------
 4116|  39.9k|                ((0 < NUM_H_ISOTOPES && t_group_info->tni.nNumRemovedProtonsIsotopic[0]) ||
  ------------------
  |  |   72|  79.9k|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (4116:19): [True: 39.9k, Folded]
  |  Branch (4116:41): [True: 2, False: 39.9k]
  ------------------
 4117|  39.9k|                    (1 < NUM_H_ISOTOPES && t_group_info->tni.nNumRemovedProtonsIsotopic[1]) ||
  ------------------
  |  |   72|  79.9k|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (4117:22): [True: 39.9k, Folded]
  |  Branch (4117:44): [True: 3, False: 39.9k]
  ------------------
 4118|  39.9k|                    (2 < NUM_H_ISOTOPES && t_group_info->tni.nNumRemovedProtonsIsotopic[2])
  ------------------
  |  |   72|  79.9k|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (4118:22): [True: 39.9k, Folded]
  |  Branch (4118:44): [True: 3, False: 39.9k]
  ------------------
 4119|  39.9k|                    )); /* djb-rwth: addressing LLVM warning */
 4120|   252k|    }
 4121|   252k|    bHasIsotopicAtoms = bHasIsotopicAtoms
  ------------------
  |  Branch (4121:25): [True: 1.49k, False: 250k]
  ------------------
 4122|   250k|        ||
 4123|   250k|        (s[TAUT_YES].nLenIsotopicEndpoints > 1 && t_group_info &&
  ------------------
  |  |  575|   250k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4123:10): [True: 0, False: 250k]
  |  Branch (4123:51): [True: 0, False: 0]
  ------------------
 4124|      0|            (t_group_info->bTautFlagsDone & (TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE))); /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  981|      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))); /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  982|      0|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  |  Branch (4124:13): [True: 0, False: 0]
  ------------------
 4125|       |
 4126|       |    /* default mode */
 4127|   252k|    if (!(nUserMode & REQ_MODE_DEFAULT))
  ------------------
  |  |   46|   252k|#define REQ_MODE_DEFAULT  (REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_NON_ISO | REQ_MODE_STEREO)
  |  |  ------------------
  |  |  |  |   15|   252k|#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)
  |  |  ------------------
  |  |  |  |   16|   252k|#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)
  |  |  ------------------
  |  |  |  |   17|   252k|#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)
  |  |  ------------------
  |  |  |  |   18|   252k|#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)
  |  |  ------------------
  |  |  |  |   19|   252k|#define REQ_MODE_STEREO             0x000010    /* S    */
  |  |  ------------------
  ------------------
  |  Branch (4127:9): [True: 0, False: 252k]
  ------------------
 4128|      0|    {
 4129|       |        /*  default */
 4130|      0|        nUserMode |= REQ_MODE_DEFAULT;
  ------------------
  |  |   46|      0|#define REQ_MODE_DEFAULT  (REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_NON_ISO | REQ_MODE_STEREO)
  |  |  ------------------
  |  |  |  |   15|      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)
  |  |  ------------------
  |  |  |  |   16|      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)
  |  |  ------------------
  |  |  |  |   17|      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)
  |  |  ------------------
  |  |  |  |   18|      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)
  |  |  ------------------
  |  |  |  |   19|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  |  |  ------------------
  ------------------
 4131|      0|    }
 4132|       |
 4133|       |    /* adjust the mode to the reality */
 4134|   252k|    if ((nUserMode & REQ_MODE_ISO) && !bHasIsotopicAtoms)
  ------------------
  |  |   17|   252k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
  |  Branch (4134:9): [True: 252k, False: 0]
  |  Branch (4134:39): [True: 250k, False: 1.49k]
  ------------------
 4135|   250k|    {
 4136|   250k|        nUserMode ^= REQ_MODE_ISO;
  ------------------
  |  |   17|   250k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
 4137|   250k|        nUserMode |= REQ_MODE_NON_ISO;  /*  at least one is needed */
  ------------------
  |  |   18|   250k|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
 4138|   250k|    }
 4139|   252k|    if ((nUserMode & REQ_MODE_STEREO) && (nUserMode & REQ_MODE_ISO))
  ------------------
  |  |   19|   252k|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                  if ((nUserMode & REQ_MODE_STEREO) && (nUserMode & REQ_MODE_ISO))
  ------------------
  |  |   17|  8.26k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
  |  Branch (4139:9): [True: 8.26k, False: 243k]
  |  Branch (4139:42): [True: 363, False: 7.90k]
  ------------------
 4140|    363|    {
 4141|    363|        nUserMode |= REQ_MODE_ISO_STEREO;
  ------------------
  |  |   20|    363|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
 4142|    363|    }
 4143|   252k|    if ((nUserMode & REQ_MODE_STEREO) && !(nUserMode & REQ_MODE_NON_ISO))
  ------------------
  |  |   19|   252k|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                  if ((nUserMode & REQ_MODE_STEREO) && !(nUserMode & REQ_MODE_NON_ISO))
  ------------------
  |  |   18|  8.26k|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
  |  Branch (4143:9): [True: 8.26k, False: 243k]
  |  Branch (4143:42): [True: 0, False: 8.26k]
  ------------------
 4144|      0|    {
 4145|      0|        nUserMode ^= REQ_MODE_STEREO;
  ------------------
  |  |   19|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
 4146|      0|    }
 4147|   252k|    if (!bMayHaveStereo)
  ------------------
  |  Branch (4147:9): [True: 241k, False: 10.7k]
  ------------------
 4148|   241k|    {
 4149|   241k|        if (nUserMode & REQ_MODE_STEREO)
  ------------------
  |  |   19|   241k|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
  |  Branch (4149:13): [True: 7.35k, False: 233k]
  ------------------
 4150|  7.35k|            nUserMode ^= REQ_MODE_STEREO;
  ------------------
  |  |   19|  7.35k|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
 4151|   241k|        if (nUserMode & REQ_MODE_ISO_STEREO)
  ------------------
  |  |   20|   241k|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
  |  Branch (4151:13): [True: 7.35k, False: 233k]
  ------------------
 4152|  7.35k|            nUserMode ^= REQ_MODE_ISO_STEREO;
  ------------------
  |  |   20|  7.35k|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
 4153|   241k|    }
 4154|       |
 4155|   252k|    if ((nUserMode & REQ_MODE_BASIC) &&
  ------------------
  |  |   15|   252k|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (4155:9): [True: 37.6k, False: 214k]
  ------------------
 4156|  37.6k|        (!out_norm_data[TAUT_NON]->at || !ppINChI[TAUT_NON] ||
  ------------------
  |  |  574|  37.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      (!out_norm_data[TAUT_NON]->at || !ppINChI[TAUT_NON] ||
  ------------------
  |  |  574|  37.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4156:10): [True: 0, False: 37.6k]
  |  Branch (4156:42): [True: 0, False: 37.6k]
  ------------------
 4157|  37.6k|            !ppINChI_Aux[TAUT_NON] || !at[TAUT_NON]))
  ------------------
  |  |  574|  37.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                          !ppINChI_Aux[TAUT_NON] || !at[TAUT_NON]))
  ------------------
  |  |  574|  37.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4157:13): [True: 0, False: 37.6k]
  |  Branch (4157:39): [True: 1.23k, False: 36.3k]
  ------------------
 4158|  1.23k|    {
 4159|  1.23k|        nUserMode ^= REQ_MODE_BASIC;
  ------------------
  |  |   15|  1.23k|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
 4160|  1.23k|    }
 4161|   252k|    if ((nUserMode & REQ_MODE_TAUT) &&
  ------------------
  |  |   16|   252k|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  |  Branch (4161:9): [True: 252k, False: 0]
  ------------------
 4162|   252k|        (!out_norm_data[TAUT_YES]->at || !ppINChI[TAUT_YES] ||
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      (!out_norm_data[TAUT_YES]->at || !ppINChI[TAUT_YES] ||
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4162:10): [True: 0, False: 252k]
  |  Branch (4162:42): [True: 0, False: 252k]
  ------------------
 4163|   252k|            !ppINChI_Aux[TAUT_YES] || !at[TAUT_YES]))
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          !ppINChI_Aux[TAUT_YES] || !at[TAUT_YES]))
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4163:13): [True: 0, False: 252k]
  |  Branch (4163:39): [True: 0, False: 252k]
  ------------------
 4164|      0|    {
 4165|      0|        nUserMode ^= REQ_MODE_TAUT;
  ------------------
  |  |   16|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
 4166|      0|    }
 4167|       |
 4168|   252k|    switch ((int)nUserMode & (REQ_MODE_BASIC | REQ_MODE_TAUT))
  ------------------
  |  |   15|   252k|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
                  switch ((int)nUserMode & (REQ_MODE_BASIC | REQ_MODE_TAUT))
  ------------------
  |  |   16|   252k|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
 4169|   252k|    {
 4170|      0|    case REQ_MODE_BASIC:
  ------------------
  |  |   15|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (4170:5): [True: 0, False: 252k]
  ------------------
 4171|      0|        n1 = TAUT_NON;
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4172|      0|        n2 = TAUT_NON;
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4173|      0|        break;
 4174|   215k|    case REQ_MODE_TAUT:
  ------------------
  |  |   16|   215k|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  |  Branch (4174:5): [True: 215k, False: 36.3k]
  ------------------
 4175|   215k|        n1 = TAUT_YES;
  ------------------
  |  |  575|   215k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4176|   215k|        n2 = TAUT_YES;
  ------------------
  |  |  575|   215k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4177|   215k|        break;
 4178|  36.3k|    case (REQ_MODE_BASIC | REQ_MODE_TAUT):
  ------------------
  |  |   15|  36.3k|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
                  case (REQ_MODE_BASIC | REQ_MODE_TAUT):
  ------------------
  |  |   16|  36.3k|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  |  Branch (4178:5): [True: 36.3k, False: 215k]
  ------------------
 4179|  36.3k|        n1 = TAUT_NON;
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4180|  36.3k|        n2 = TAUT_YES;
  ------------------
  |  |  575|  36.3k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4181|  36.3k|        break;
 4182|      0|    default:
  ------------------
  |  Branch (4182:5): [True: 0, False: 252k]
  ------------------
 4183|      0|        ret = -3;
 4184|      0|        goto exit_function; /*  program error: inconsistent nUserMode or missing taut/non-taut allocation */ /*   <BRKPT> */
 4185|   252k|    }
 4186|       |
 4187|       |    /*
 4188|       |        Obtain all non-stereo canonical numberings
 4189|       |    */
 4190|       |
 4191|   252k|    if ((nUserMode & REQ_MODE_NON_ISO) && !(nUserMode & REQ_MODE_ISO))
  ------------------
  |  |   18|   252k|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
                  if ((nUserMode & REQ_MODE_NON_ISO) && !(nUserMode & REQ_MODE_ISO))
  ------------------
  |  |   17|   252k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
  |  Branch (4191:9): [True: 252k, False: 0]
  |  Branch (4191:43): [True: 250k, False: 1.49k]
  ------------------
 4192|   250k|    {
 4193|       |        /* added for special non-isotopic test mode 2004-10-04 */
 4194|   250k|        if (t_group_info)
  ------------------
  |  Branch (4194:13): [True: 250k, False: 0]
  ------------------
 4195|   250k|        {
 4196|   250k|            t_group_info->bIgnoreIsotopic = 1;
 4197|   250k|            if (t_group_info->nIsotopicEndpointAtomNumber)
  ------------------
  |  Branch (4197:17): [True: 0, False: 250k]
  ------------------
 4198|      0|            {
 4199|      0|                t_group_info->nIsotopicEndpointAtomNumber[0] = inchi_min(1, t_group_info->nIsotopicEndpointAtomNumber[0]);
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4200|      0|            }
 4201|   250k|            memset(t_group_info->num_iso_H, 0, sizeof(t_group_info->num_iso_H)); /* djb-rwth: memset_s C11/Annex K variant? */
 4202|   250k|            memset(t_group_info->tni.nNumRemovedProtonsIsotopic, 0, sizeof(t_group_info->tni.nNumRemovedProtonsIsotopic)); /* djb-rwth: memset_s C11/Annex K variant? */
 4203|   250k|            t_group_info->bTautFlagsDone &= ~(TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE);
  ------------------
  |  |  981|   250k|#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);
  ------------------
  |  |  982|   250k|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
 4204|   250k|        }
 4205|   751k|        for (i = 0; i < TAUT_NUM; i++)
  ------------------
  |  |  573|   751k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (4205:21): [True: 501k, False: 250k]
  ------------------
 4206|   501k|        {
 4207|   501k|            s[i].bHasIsotopicTautGroups = 0;
 4208|   501k|            s[i].bIgnoreIsotopic = 1;
 4209|   501k|            s[i].nLenIsotopic = 0;
 4210|   501k|            s[i].nLenIsotopicEndpoints = 0;
 4211|   501k|            s[i].nLenLinearCTIsotopicTautomer = 0;
 4212|   501k|            s[i].num_isotopic_atoms = 0;
 4213|   501k|        }
 4214|   250k|        bHasIsotopicAtoms = 0;
 4215|   250k|    }
 4216|       |
 4217|   252k|    ret = GetBaseCanonRanking(ic, num_atoms, num_at_tg, at,
 4218|   252k|        t_group_info, s, pBCN, ulMaxTime,
 4219|   252k|        pCG, bFixIsoFixedH, LargeMolecules);
 4220|       |
 4221|   252k|    if (ret < 0)
  ------------------
  |  Branch (4221:9): [True: 0, False: 252k]
  ------------------
 4222|      0|    {
 4223|      0|        goto exit_function; /*  program error */
 4224|      0|    }
 4225|       |#if ( bRELEASE_VERSION == 0 && FIND_CANON_NE_EQUITABLE == 1 )
 4226|       |    /* Debug only: find whether canonical equivalence is different from equitable partition */
 4227|       |    if (bCanonIsFinerThanEquitablePartition(num_atoms, at[n1], pBCN->ftcn[TAUT_NON].nSymmRankCt))
 4228|       |    {
 4229|       |        bExtract |= EXTR_CANON_NE_EQUITABLE;
 4230|       |    }
 4231|       |#endif
 4232|       |
 4233|       |    /* added for special non-isotopic test mode 2004-10-04 */
 4234|   252k|    if (!pBCN->ftcn[n1].PartitionCt.Rank)
  ------------------
  |  Branch (4234:9): [True: 0, False: 252k]
  ------------------
 4235|      0|    {
 4236|      0|        n1 = ALT_TAUT(n1);
  ------------------
  |  |  577|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4237|      0|    }
 4238|   252k|    if (!pBCN->ftcn[n2].PartitionCt.Rank)
  ------------------
  |  Branch (4238:9): [True: 0, False: 252k]
  ------------------
 4239|      0|    {
 4240|      0|        n2 = ALT_TAUT(n2);
  ------------------
  |  |  577|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4241|      0|    }
 4242|   252k|    if (n1 > n2)
  ------------------
  |  Branch (4242:9): [True: 0, False: 252k]
  ------------------
 4243|      0|    {
 4244|      0|        ret = CT_TAUCOUNT_ERR;
  ------------------
  |  |   24|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4245|      0|        goto exit_function; /*  program error */
 4246|      0|    }
 4247|       |
 4248|       |    /*
 4249|       |        Obtain stereo canonical numberings
 4250|       |    */
 4251|       |
 4252|   540k|    for (i = n2; i >= n1 && !RETURNED_ERROR(ret); i--)
  ------------------
  |  |   44|   288k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|   288k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|   288k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|   288k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|   288k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|   288k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 288k, False: 0]
  |  |  |  Branch (44:53): [True: 14, False: 288k]
  |  |  ------------------
  ------------------
  |  Branch (4252:18): [True: 288k, False: 252k]
  ------------------
 4253|   288k|    {
 4254|   288k|        memset(pCS, 0, sizeof(*pCS)); /* djb-rwth: memset_s C11/Annex K variant? */
 4255|       |
 4256|   288k|        switch (i)
  ------------------
  |  Branch (4256:17): [True: 288k, False: 0]
  ------------------
 4257|   288k|        {
 4258|  36.3k|        case TAUT_NON:
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4258:9): [True: 36.3k, False: 252k]
  ------------------
 4259|       |            /*  non-tautomeric */
 4260|       |            /* djb-rwth: removing redundant code */
 4261|  36.3k|            nMode = (s[i].nLenLinearCTTautomer == 0) ? CANON_MODE_CT : CANON_MODE_TAUT;
  ------------------
  |  |  786|  36.3k|#define CANON_MODE_CT         (CMODE_CT)
  |  |  ------------------
  |  |  |  |  769|  36.3k|#define CMODE_CT                 0x000001
  |  |  ------------------
  ------------------
                          nMode = (s[i].nLenLinearCTTautomer == 0) ? CANON_MODE_CT : CANON_MODE_TAUT;
  ------------------
  |  |  787|  36.3k|#define CANON_MODE_TAUT       (CMODE_CT|CMODE_TAUT)
  |  |  ------------------
  |  |  |  |  769|      0|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_TAUT       (CMODE_CT|CMODE_TAUT)
  |  |  ------------------
  |  |  |  |  774|      0|#define CMODE_TAUT               0x000020
  |  |  ------------------
  ------------------
  |  Branch (4261:21): [True: 36.3k, False: 0]
  ------------------
 4262|  36.3k|            nMode |= (bHasIsotopicAtoms && (nUserMode & REQ_MODE_ISO)) ? CANON_MODE_ISO : 0;
  ------------------
  |  |   17|    666|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
                          nMode |= (bHasIsotopicAtoms && (nUserMode & REQ_MODE_ISO)) ? CANON_MODE_ISO : 0;
  ------------------
  |  |  788|    666|#define CANON_MODE_ISO        (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT)
  |  |  ------------------
  |  |  |  |  769|    666|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_ISO        (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT)
  |  |  ------------------
  |  |  |  |  770|    666|#define CMODE_ISO                0x000002
  |  |  ------------------
  |  |               #define CANON_MODE_ISO        (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT)
  |  |  ------------------
  |  |  |  |  771|    666|#define CMODE_ISO_OUT            0x000004 /* obsolete ? */
  |  |  ------------------
  ------------------
  |  Branch (4262:23): [True: 666, False: 35.6k]
  |  Branch (4262:44): [True: 666, False: 0]
  ------------------
 4263|  36.3k|            nMode |= (s[TAUT_NON].bMayHaveStereo && (nUserMode & REQ_MODE_STEREO)) ? CANON_MODE_STEREO : 0;
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                          nMode |= (s[TAUT_NON].bMayHaveStereo && (nUserMode & REQ_MODE_STEREO)) ? CANON_MODE_STEREO : 0;
  ------------------
  |  |   19|    563|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                          nMode |= (s[TAUT_NON].bMayHaveStereo && (nUserMode & REQ_MODE_STEREO)) ? CANON_MODE_STEREO : 0;
  ------------------
  |  |  789|     86|#define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  769|     86|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  772|     86|#define CMODE_STEREO             0x000008
  |  |  ------------------
  ------------------
  |  Branch (4263:23): [True: 563, False: 35.7k]
  |  Branch (4263:53): [True: 86, False: 477]
  ------------------
 4264|  36.3k|            nMode |= (bHasIsotopicAtoms && s[TAUT_NON].bMayHaveStereo && (nUserMode & REQ_MODE_ISO_STEREO)) ? CANON_MODE_ISO_STEREO : 0;
  ------------------
  |  |  574|    666|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                          nMode |= (bHasIsotopicAtoms && s[TAUT_NON].bMayHaveStereo && (nUserMode & REQ_MODE_ISO_STEREO)) ? CANON_MODE_ISO_STEREO : 0;
  ------------------
  |  |   20|     54|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
                          nMode |= (bHasIsotopicAtoms && s[TAUT_NON].bMayHaveStereo && (nUserMode & REQ_MODE_ISO_STEREO)) ? CANON_MODE_ISO_STEREO : 0;
  ------------------
  |  |  790|     39|#define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  769|     39|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  770|     39|#define CMODE_ISO                0x000002
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  771|     39|#define CMODE_ISO_OUT            0x000004 /* obsolete ? */
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  773|     39|#define CMODE_ISO_STEREO         0x000010
  |  |  ------------------
  ------------------
  |  Branch (4264:23): [True: 666, False: 35.6k]
  |  Branch (4264:44): [True: 54, False: 612]
  |  Branch (4264:74): [True: 39, False: 15]
  ------------------
 4265|  36.3k|            nMode |= (nUserMode & REQ_MODE_NOEQ_STEREO) ? CMODE_NOEQ_STEREO : 0;
  ------------------
  |  |   21|  36.3k|#define REQ_MODE_NOEQ_STEREO        0x000040    /* SS   */
  ------------------
                          nMode |= (nUserMode & REQ_MODE_NOEQ_STEREO) ? CMODE_NOEQ_STEREO : 0;
  ------------------
  |  |  775|      0|#define CMODE_NOEQ_STEREO        0x000040 /* 5-24-2002: do not use stereo equivalence to accelerate */
  ------------------
  |  Branch (4265:22): [True: 0, False: 36.3k]
  ------------------
 4266|  36.3k|            nMode |= (nUserMode & REQ_MODE_REDNDNT_STEREO) ? CMODE_REDNDNT_STEREO : 0;
  ------------------
  |  |   22|  36.3k|#define REQ_MODE_REDNDNT_STEREO     0x000080    /* RS   */
  ------------------
                          nMode |= (nUserMode & REQ_MODE_REDNDNT_STEREO) ? CMODE_REDNDNT_STEREO : 0;
  ------------------
  |  |  776|      0|#define CMODE_REDNDNT_STEREO     0x000080 /* 6-11-2002: do not check for redundant stereo elements */
  ------------------
  |  Branch (4266:22): [True: 0, False: 36.3k]
  ------------------
 4267|  36.3k|            nMode |= (nUserMode & REQ_MODE_NO_ALT_SBONDS) ? CMODE_NO_ALT_SBONDS : 0;
  ------------------
  |  |   23|  36.3k|#define REQ_MODE_NO_ALT_SBONDS      0x000100    /* NASB */
  ------------------
                          nMode |= (nUserMode & REQ_MODE_NO_ALT_SBONDS) ? CMODE_NO_ALT_SBONDS : 0;
  ------------------
  |  |  777|      0|#define CMODE_NO_ALT_SBONDS      0x000100 /* 6-14-2002: do not assign stereo to alternating bonds */
  ------------------
  |  Branch (4267:22): [True: 0, False: 36.3k]
  ------------------
 4268|  36.3k|            if ((nMode & CANON_MODE_STEREO) == CANON_MODE_STEREO ||
  ------------------
  |  |  789|  36.3k|#define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  769|  36.3k|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  772|  36.3k|#define CMODE_STEREO             0x000008
  |  |  ------------------
  ------------------
                          if ((nMode & CANON_MODE_STEREO) == CANON_MODE_STEREO ||
  ------------------
  |  |  789|  72.7k|#define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  769|  36.3k|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  772|  36.3k|#define CMODE_STEREO             0x000008
  |  |  ------------------
  ------------------
  |  Branch (4268:17): [True: 86, False: 36.2k]
  ------------------
 4269|  36.2k|                (nMode & CANON_MODE_ISO_STEREO) == CANON_MODE_ISO_STEREO)
  ------------------
  |  |  790|  36.2k|#define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  769|  36.2k|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  770|  36.2k|#define CMODE_ISO                0x000002
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  771|  36.2k|#define CMODE_ISO_OUT            0x000004 /* obsolete ? */
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  773|  36.2k|#define CMODE_ISO_STEREO         0x000010
  |  |  ------------------
  ------------------
                              (nMode & CANON_MODE_ISO_STEREO) == CANON_MODE_ISO_STEREO)
  ------------------
  |  |  790|  36.2k|#define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  769|  36.2k|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  770|  36.2k|#define CMODE_ISO                0x000002
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  771|  36.2k|#define CMODE_ISO_OUT            0x000004 /* obsolete ? */
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  773|  36.2k|#define CMODE_ISO_STEREO         0x000010
  |  |  ------------------
  ------------------
  |  Branch (4269:17): [True: 0, False: 36.2k]
  ------------------
 4270|     86|            {
 4271|     86|                nMode |= (nUserMode & REQ_MODE_RELATIVE_STEREO) ? CMODE_RELATIVE_STEREO : 0;
  ------------------
  |  |   26|     86|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
                              nMode |= (nUserMode & REQ_MODE_RELATIVE_STEREO) ? CMODE_RELATIVE_STEREO : 0;
  ------------------
  |  |  779|      0|#define CMODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
  |  Branch (4271:26): [True: 0, False: 86]
  ------------------
 4272|     86|                nMode |= (nUserMode & REQ_MODE_RACEMIC_STEREO) ? CMODE_RACEMIC_STEREO : 0;
  ------------------
  |  |   28|     86|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
                              nMode |= (nUserMode & REQ_MODE_RACEMIC_STEREO) ? CMODE_RACEMIC_STEREO : 0;
  ------------------
  |  |  780|      0|#define CMODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  |  Branch (4272:26): [True: 0, False: 86]
  ------------------
 4273|     86|                nMode |= (nUserMode & REQ_MODE_SC_IGN_ALL_UU) ? CMODE_SC_IGN_ALL_UU : 0;
  ------------------
  |  |   30|     86|#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;
  ------------------
  |  |  781|     78|#define CMODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  |  Branch (4273:26): [True: 78, False: 8]
  ------------------
 4274|     86|                nMode |= (nUserMode & REQ_MODE_SB_IGN_ALL_UU) ? CMODE_SB_IGN_ALL_UU : 0;
  ------------------
  |  |   32|     86|#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;
  ------------------
  |  |  782|     72|#define CMODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
  |  Branch (4274:26): [True: 72, False: 14]
  ------------------
 4275|     86|            }
 4276|  36.3k|            if ((ret = AllocateCS(pCS, num_atoms, num_atoms, s[TAUT_NON].nLenCT, s[TAUT_NON].nLenCTAtOnly,
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                          if ((ret = AllocateCS(pCS, num_atoms, num_atoms, s[TAUT_NON].nLenCT, s[TAUT_NON].nLenCTAtOnly,
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4276:17): [True: 0, False: 36.3k]
  ------------------
 4277|  36.3k|                s[TAUT_NON].nLenLinearCTStereoDble, s[TAUT_NON].nMaxNumStereoBonds,
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                              s[TAUT_NON].nLenLinearCTStereoDble, s[TAUT_NON].nMaxNumStereoBonds,
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4278|  36.3k|                s[TAUT_NON].nLenLinearCTStereoCarb, s[TAUT_NON].nMaxNumStereoAtoms,
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                              s[TAUT_NON].nLenLinearCTStereoCarb, s[TAUT_NON].nMaxNumStereoAtoms,
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4279|  36.3k|                0, 0, s[TAUT_NON].nLenIsotopic, nMode, pBCN))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  574|  36.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4280|      0|            {
 4281|      0|                goto exit_function;
 4282|      0|            }
 4283|  36.3k|            *pCS2 = *pCS;
 4284|  36.3k|            break;
 4285|   252k|        case TAUT_YES: /*  tautomeric */
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4285:9): [True: 252k, False: 36.3k]
  ------------------
 4286|       |            /* djb-rwth: removing redundant code */
 4287|   252k|            nMode = (s[i].nLenLinearCTTautomer == 0) ? CANON_MODE_CT : CANON_MODE_TAUT;
  ------------------
  |  |  786|   211k|#define CANON_MODE_CT         (CMODE_CT)
  |  |  ------------------
  |  |  |  |  769|   211k|#define CMODE_CT                 0x000001
  |  |  ------------------
  ------------------
                          nMode = (s[i].nLenLinearCTTautomer == 0) ? CANON_MODE_CT : CANON_MODE_TAUT;
  ------------------
  |  |  787|   292k|#define CANON_MODE_TAUT       (CMODE_CT|CMODE_TAUT)
  |  |  ------------------
  |  |  |  |  769|  40.8k|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_TAUT       (CMODE_CT|CMODE_TAUT)
  |  |  ------------------
  |  |  |  |  774|  40.8k|#define CMODE_TAUT               0x000020
  |  |  ------------------
  ------------------
  |  Branch (4287:21): [True: 211k, False: 40.8k]
  ------------------
 4288|   252k|            nMode |= (bHasIsotopicAtoms && (nUserMode & REQ_MODE_ISO)) ? CANON_MODE_ISO : 0;
  ------------------
  |  |   17|  1.49k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
                          nMode |= (bHasIsotopicAtoms && (nUserMode & REQ_MODE_ISO)) ? CANON_MODE_ISO : 0;
  ------------------
  |  |  788|  1.49k|#define CANON_MODE_ISO        (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT)
  |  |  ------------------
  |  |  |  |  769|  1.49k|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_ISO        (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT)
  |  |  ------------------
  |  |  |  |  770|  1.49k|#define CMODE_ISO                0x000002
  |  |  ------------------
  |  |               #define CANON_MODE_ISO        (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT)
  |  |  ------------------
  |  |  |  |  771|  1.49k|#define CMODE_ISO_OUT            0x000004 /* obsolete ? */
  |  |  ------------------
  ------------------
  |  Branch (4288:23): [True: 1.49k, False: 250k]
  |  Branch (4288:44): [True: 1.49k, False: 0]
  ------------------
 4289|   252k|            nMode |= (s[TAUT_YES].bMayHaveStereo && (nUserMode & REQ_MODE_STEREO)) ? CANON_MODE_STEREO : 0;
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          nMode |= (s[TAUT_YES].bMayHaveStereo && (nUserMode & REQ_MODE_STEREO)) ? CANON_MODE_STEREO : 0;
  ------------------
  |  |   19|  10.6k|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                          nMode |= (s[TAUT_YES].bMayHaveStereo && (nUserMode & REQ_MODE_STEREO)) ? CANON_MODE_STEREO : 0;
  ------------------
  |  |  789|    903|#define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  769|    903|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  772|    903|#define CMODE_STEREO             0x000008
  |  |  ------------------
  ------------------
  |  Branch (4289:23): [True: 10.6k, False: 241k]
  |  Branch (4289:53): [True: 903, False: 9.74k]
  ------------------
 4290|   252k|            nMode |= (bHasIsotopicAtoms && s[TAUT_YES].bMayHaveStereo && (nUserMode & REQ_MODE_ISO_STEREO)) ? CANON_MODE_ISO_STEREO : 0;
  ------------------
  |  |  575|  1.49k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          nMode |= (bHasIsotopicAtoms && s[TAUT_YES].bMayHaveStereo && (nUserMode & REQ_MODE_ISO_STEREO)) ? CANON_MODE_ISO_STEREO : 0;
  ------------------
  |  |   20|    319|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
                          nMode |= (bHasIsotopicAtoms && s[TAUT_YES].bMayHaveStereo && (nUserMode & REQ_MODE_ISO_STEREO)) ? CANON_MODE_ISO_STEREO : 0;
  ------------------
  |  |  790|    227|#define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  769|    227|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  770|    227|#define CMODE_ISO                0x000002
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  771|    227|#define CMODE_ISO_OUT            0x000004 /* obsolete ? */
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  773|    227|#define CMODE_ISO_STEREO         0x000010
  |  |  ------------------
  ------------------
  |  Branch (4290:23): [True: 1.49k, False: 250k]
  |  Branch (4290:44): [True: 319, False: 1.17k]
  |  Branch (4290:74): [True: 227, False: 92]
  ------------------
 4291|   252k|            nMode |= (nUserMode & REQ_MODE_NOEQ_STEREO) ? CMODE_NOEQ_STEREO : 0;
  ------------------
  |  |   21|   252k|#define REQ_MODE_NOEQ_STEREO        0x000040    /* SS   */
  ------------------
                          nMode |= (nUserMode & REQ_MODE_NOEQ_STEREO) ? CMODE_NOEQ_STEREO : 0;
  ------------------
  |  |  775|      0|#define CMODE_NOEQ_STEREO        0x000040 /* 5-24-2002: do not use stereo equivalence to accelerate */
  ------------------
  |  Branch (4291:22): [True: 0, False: 252k]
  ------------------
 4292|   252k|            nMode |= (nUserMode & REQ_MODE_REDNDNT_STEREO) ? CMODE_REDNDNT_STEREO : 0;
  ------------------
  |  |   22|   252k|#define REQ_MODE_REDNDNT_STEREO     0x000080    /* RS   */
  ------------------
                          nMode |= (nUserMode & REQ_MODE_REDNDNT_STEREO) ? CMODE_REDNDNT_STEREO : 0;
  ------------------
  |  |  776|      0|#define CMODE_REDNDNT_STEREO     0x000080 /* 6-11-2002: do not check for redundant stereo elements */
  ------------------
  |  Branch (4292:22): [True: 0, False: 252k]
  ------------------
 4293|   252k|            nMode |= (nUserMode & REQ_MODE_NO_ALT_SBONDS) ? CMODE_NO_ALT_SBONDS : 0;
  ------------------
  |  |   23|   252k|#define REQ_MODE_NO_ALT_SBONDS      0x000100    /* NASB */
  ------------------
                          nMode |= (nUserMode & REQ_MODE_NO_ALT_SBONDS) ? CMODE_NO_ALT_SBONDS : 0;
  ------------------
  |  |  777|      0|#define CMODE_NO_ALT_SBONDS      0x000100 /* 6-14-2002: do not assign stereo to alternating bonds */
  ------------------
  |  Branch (4293:22): [True: 0, False: 252k]
  ------------------
 4294|   252k|            if ((nMode & CANON_MODE_STEREO) == CANON_MODE_STEREO ||
  ------------------
  |  |  789|   252k|#define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  769|   252k|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  772|   252k|#define CMODE_STEREO             0x000008
  |  |  ------------------
  ------------------
                          if ((nMode & CANON_MODE_STEREO) == CANON_MODE_STEREO ||
  ------------------
  |  |  789|   504k|#define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  769|   252k|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  772|   252k|#define CMODE_STEREO             0x000008
  |  |  ------------------
  ------------------
  |  Branch (4294:17): [True: 903, False: 251k]
  ------------------
 4295|   251k|                (nMode & CANON_MODE_ISO_STEREO) == CANON_MODE_ISO_STEREO)
  ------------------
  |  |  790|   251k|#define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  769|   251k|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  770|   251k|#define CMODE_ISO                0x000002
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  771|   251k|#define CMODE_ISO_OUT            0x000004 /* obsolete ? */
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  773|   251k|#define CMODE_ISO_STEREO         0x000010
  |  |  ------------------
  ------------------
                              (nMode & CANON_MODE_ISO_STEREO) == CANON_MODE_ISO_STEREO)
  ------------------
  |  |  790|   251k|#define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  769|   251k|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  770|   251k|#define CMODE_ISO                0x000002
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  771|   251k|#define CMODE_ISO_OUT            0x000004 /* obsolete ? */
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  773|   251k|#define CMODE_ISO_STEREO         0x000010
  |  |  ------------------
  ------------------
  |  Branch (4295:17): [True: 0, False: 251k]
  ------------------
 4296|    903|            {
 4297|    903|                nMode |= (nUserMode & REQ_MODE_RELATIVE_STEREO) ? CMODE_RELATIVE_STEREO : 0;
  ------------------
  |  |   26|    903|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
                              nMode |= (nUserMode & REQ_MODE_RELATIVE_STEREO) ? CMODE_RELATIVE_STEREO : 0;
  ------------------
  |  |  779|     36|#define CMODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
  |  Branch (4297:26): [True: 36, False: 867]
  ------------------
 4298|    903|                nMode |= (nUserMode & REQ_MODE_RACEMIC_STEREO) ? CMODE_RACEMIC_STEREO : 0;
  ------------------
  |  |   28|    903|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
                              nMode |= (nUserMode & REQ_MODE_RACEMIC_STEREO) ? CMODE_RACEMIC_STEREO : 0;
  ------------------
  |  |  780|     43|#define CMODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  |  Branch (4298:26): [True: 43, False: 860]
  ------------------
 4299|    903|                nMode |= (nUserMode & REQ_MODE_SC_IGN_ALL_UU) ? CMODE_SC_IGN_ALL_UU : 0;
  ------------------
  |  |   30|    903|#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;
  ------------------
  |  |  781|    838|#define CMODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  |  Branch (4299:26): [True: 838, False: 65]
  ------------------
 4300|    903|                nMode |= (nUserMode & REQ_MODE_SB_IGN_ALL_UU) ? CMODE_SB_IGN_ALL_UU : 0;
  ------------------
  |  |   32|    903|#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;
  ------------------
  |  |  782|    799|#define CMODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
  |  Branch (4300:26): [True: 799, False: 104]
  ------------------
 4301|    903|            }
 4302|   252k|            if ((ret = AllocateCS(pCS, num_atoms, num_at_tg, s[TAUT_YES].nLenCT, s[TAUT_YES].nLenCTAtOnly,
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          if ((ret = AllocateCS(pCS, num_atoms, num_at_tg, s[TAUT_YES].nLenCT, s[TAUT_YES].nLenCTAtOnly,
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4302:17): [True: 0, False: 252k]
  ------------------
 4303|   252k|                s[TAUT_YES].nLenLinearCTStereoDble, s[TAUT_YES].nMaxNumStereoBonds,
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              s[TAUT_YES].nLenLinearCTStereoDble, s[TAUT_YES].nMaxNumStereoBonds,
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4304|   252k|                s[TAUT_YES].nLenLinearCTStereoCarb, s[TAUT_YES].nMaxNumStereoAtoms,
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              s[TAUT_YES].nLenLinearCTStereoCarb, s[TAUT_YES].nMaxNumStereoAtoms,
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4305|   252k|                s[TAUT_YES].nLenLinearCTTautomer, s[TAUT_YES].nLenLinearCTIsotopicTautomer,
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              s[TAUT_YES].nLenLinearCTTautomer, s[TAUT_YES].nLenLinearCTIsotopicTautomer,
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4306|   252k|                s[TAUT_YES].nLenIsotopic, nMode, pBCN))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4307|      0|            {
 4308|      0|                goto exit_function;
 4309|      0|            }
 4310|   252k|            *pCS2 = *pCS;
 4311|   252k|            break;
 4312|   288k|        }
 4313|       |
 4314|       |        /* 2009-12-05 */
 4315|   288k|        nMode |= (nUserMode & REQ_MODE_DIFF_UU_STEREO) ? REQ_MODE_DIFF_UU_STEREO : 0;
  ------------------
  |  |   40|   288k|#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;
  ------------------
  |  |   40|      0|#define REQ_MODE_DIFF_UU_STEREO     0x004000    /* SLUUD Make labels for unknown and undefined stereo different */
  ------------------
  |  Branch (4315:18): [True: 0, False: 288k]
  ------------------
 4316|       |        /* 2009-12-05 */
 4317|       |
 4318|       |        /*  settings */
 4319|   288k|        pCS->lNumDecreasedCT = -1;
 4320|   288k|        pCS->bDoubleBondSquare = DOUBLE_BOND_NEIGH_LIST ? 2 : 0;  /*  2 => special mode */
  ------------------
  |  |  810|   288k|#define DOUBLE_BOND_NEIGH_LIST    0  /* 1 => include double bond neighbor in NeighList 2 times */
  |  |  ------------------
  |  |  |  Branch (810:35): [Folded, False: 288k]
  |  |  ------------------
  ------------------
 4321|   288k|        pCS->bIgnoreIsotopic = !((s[TAUT_NON].num_isotopic_atoms ||
  ------------------
  |  |  574|   288k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4321:35): [True: 1.33k, False: 287k]
  ------------------
 4322|   287k|            s[TAUT_YES].num_isotopic_atoms ||
  ------------------
  |  |  575|   287k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4322:13): [True: 751, False: 286k]
  ------------------
 4323|   286k|            s[TAUT_YES].bHasIsotopicTautGroups) ||
  ------------------
  |  |  575|   286k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4323:13): [True: 74, False: 286k]
  ------------------
 4324|   286k|            (nUserMode & REQ_MODE_NON_ISO) ||
  ------------------
  |  |   18|   286k|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
  |  Branch (4324:13): [True: 286k, False: 0]
  ------------------
 4325|      0|            !(nUserMode & REQ_MODE_ISO));
  ------------------
  |  |   17|      0|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
  |  Branch (4325:13): [True: 0, False: 0]
  ------------------
 4326|       |
 4327|   288k|        if ((nUserMode & REQ_MODE_NON_ISO) && !(nUserMode & REQ_MODE_ISO))
  ------------------
  |  |   18|   288k|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
                      if ((nUserMode & REQ_MODE_NON_ISO) && !(nUserMode & REQ_MODE_ISO))
  ------------------
  |  |   17|   288k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
  |  Branch (4327:13): [True: 288k, False: 0]
  |  Branch (4327:47): [True: 286k, False: 2.16k]
  ------------------
 4328|   286k|        {
 4329|   286k|            pCS->bIgnoreIsotopic = 1; /* 10-04-2004 */
 4330|   286k|        }
 4331|       |
 4332|   288k|        if (i == TAUT_YES)
  ------------------
  |  |  575|   288k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4332:13): [True: 252k, False: 36.3k]
  ------------------
 4333|   252k|        {
 4334|       |            /* tautomeric */
 4335|   252k|            pCS->t_group_info = t_group_info; /*  ??? make a copy or reuse ???  */
 4336|   252k|            pCS->t_group_info->bIgnoreIsotopic = !(s[TAUT_YES].bHasIsotopicTautGroups ||
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4336:52): [True: 269, False: 251k]
  ------------------
 4337|   251k|                (nUserMode & REQ_MODE_NON_ISO) ||
  ------------------
  |  |   18|   251k|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
  |  Branch (4337:17): [True: 251k, False: 0]
  ------------------
 4338|      0|                !(nUserMode & REQ_MODE_ISO));
  ------------------
  |  |   17|      0|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
  |  Branch (4338:17): [True: 0, False: 0]
  ------------------
 4339|   252k|            if ((nUserMode & REQ_MODE_NON_ISO) && !(nUserMode & REQ_MODE_ISO))
  ------------------
  |  |   18|   252k|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
                          if ((nUserMode & REQ_MODE_NON_ISO) && !(nUserMode & REQ_MODE_ISO))
  ------------------
  |  |   17|   252k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
  |  Branch (4339:17): [True: 252k, False: 0]
  |  Branch (4339:51): [True: 250k, False: 1.49k]
  ------------------
 4340|   250k|            {
 4341|   250k|                pCS->t_group_info->bIgnoreIsotopic = 1; /* 10-04-2004 */
 4342|   250k|            }
 4343|   252k|        }
 4344|       |
 4345|   288k|        pCS->ulTimeOutTime = pBCN->ulTimeOutTime;
 4346|       |        /*=========== Obsolete Mode Bits (bit 0 is Least Significant Bit) ===========
 4347|       |         *
 4348|       |         *  Mode      Bits       Description
 4349|       |         *   '0' c    0          Only one connection table canonicalization
 4350|       |         *   '1' C    1          Recalculate CT using fixed nSymmRank
 4351|       |         *   '2' i    1|2        Isotopic canonicalization (internal)
 4352|       |         *   '3' I    1|2|4      Isotopic canonicalization (output)
 4353|       |         *   '4' s    1|8        Stereo canonicalization
 4354|       |         *   '5' S    1|2|4|16   Stereo isotopic canonicalization
 4355|       |         *   '6' A    1|2|4|8|16 Output All
 4356|       |         */
 4357|       |
 4358|       |         /*
 4359|       |             The last canonicalization step
 4360|       |         */
 4361|       |
 4362|   288k|        if (pBCN)
  ------------------
  |  Branch (4362:13): [True: 288k, False: 0]
  ------------------
 4363|   288k|        {
 4364|       |            /* USE_CANON2 == 1 */
 4365|   288k|            pCS->NeighList = NULL;
 4366|   288k|            pCS->pBCN = pBCN;
 4367|       |
 4368|   288k|            ret = Canon_INChI(ic,
 4369|   288k|                num_atoms,
 4370|   288k|                i ? num_at_tg : num_atoms,
  ------------------
  |  Branch (4370:17): [True: 252k, False: 36.3k]
  ------------------
 4371|   288k|                at[i], pCS,
 4372|   288k|                pCG,
 4373|   288k|                nMode, i);
 4374|   288k|        }
 4375|      0|        else
 4376|      0|        {
 4377|       |            /* old way */
 4378|      0|            pCS->NeighList = CreateNeighList(num_atoms,
 4379|      0|                i ? num_at_tg : num_atoms,
  ------------------
  |  Branch (4379:17): [True: 0, False: 0]
  ------------------
 4380|      0|                at[i],
 4381|      0|                pCS->bDoubleBondSquare,
 4382|      0|                pCS->t_group_info);
 4383|      0|            pCS->pBCN = NULL;
 4384|       |
 4385|      0|            ret = Canon_INChI(ic,
 4386|      0|                num_atoms,
 4387|      0|                i ? num_at_tg : num_atoms,
  ------------------
  |  Branch (4387:17): [True: 0, False: 0]
  ------------------
 4388|      0|                at[i], pCS,
 4389|      0|                pCG,
 4390|      0|                nMode, i);
 4391|      0|        }
 4392|       |
 4393|   288k|        pINChI = ppINChI[i];      /* pointers to already allocated still empty InChI */
 4394|   288k|        pINChI_Aux = ppINChI_Aux[i];
 4395|       |
 4396|   288k|        if (ret <= 0)
  ------------------
  |  Branch (4396:13): [True: 1, False: 288k]
  ------------------
 4397|      1|        {
 4398|       |            /*
 4399|       |                Failure in Canon_INChI()
 4400|       |            */
 4401|      1|            pINChI->nErrorCode = ret;
 4402|      1|            pINChI_Aux->nErrorCode = ret;
 4403|      1|        }
 4404|   288k|        else
 4405|   288k|        {
 4406|       |            /*
 4407|       |                Success Canon_INChI()
 4408|       |
 4409|       |                save canonicalization results in
 4410|       |                pINChI and pINChI_Aux
 4411|       |            */
 4412|   288k|            pINChI->nErrorCode = 0;
 4413|   288k|            pINChI_Aux->nErrorCode = 0;
 4414|   288k|            pINChI->bDeleted = pINChI_Aux->bDeleted = out_norm_data[i]->bDeleted;
 4415|   288k|            pINChI_Aux->nCanonFlags = pCS->nCanonFlags;
 4416|   288k|            pINChI_Aux->bTautFlags = out_norm_data[i]->bTautFlags;
 4417|   288k|            pINChI_Aux->bTautFlagsDone = out_norm_data[i]->bTautFlagsDone;
 4418|   288k|            pINChI_Aux->bNormalizationFlags = out_norm_data[i]->bNormalizationFlags;
 4419|       |
 4420|       |            /*  may return an error or a warning */
 4421|   288k|            ret = FillOutINChI(pINChI, pINChI_Aux,
 4422|   288k|                num_atoms, i ? num_at_tg : num_atoms,
  ------------------
  |  Branch (4422:28): [True: 252k, False: 36.3k]
  ------------------
 4423|   288k|                i ? num_removed_H_taut : num_removed_H, at[i],
  ------------------
  |  Branch (4423:17): [True: 252k, False: 36.3k]
  ------------------
 4424|   288k|                out_norm_data[i]->at, pCS,
 4425|   288k|                pCG,
 4426|   288k|                i, nUserMode,
 4427|   288k|                pStrErrStruct, ip->bNoWarnings);
 4428|       |
 4429|   288k|            if (RETURNED_ERROR(ret))
  ------------------
  |  |   44|   288k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|   288k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|   288k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|   288k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|   288k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|   288k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 288k, False: 0]
  |  |  |  Branch (44:53): [True: 17, False: 288k]
  |  |  ------------------
  ------------------
 4430|     17|            {
 4431|       |                /* Failure in FillOutINChI() */
 4432|     17|                pINChI->nErrorCode = ret;
 4433|     17|                pINChI_Aux->nErrorCode = ret;
 4434|     17|            }
 4435|   288k|            else
 4436|   288k|            {
 4437|       |                /* Success in FillOutINChI() */
 4438|       |
 4439|       |#if ( bRELEASE_VERSION == 0 )
 4440|       |                if (pINChI->Stereo &&
 4441|       |                    (pINChI->Stereo->nCompInv2Abs && !pINChI->Stereo->bTrivialInv) ||
 4442|       |                    pINChI->StereoIsotopic &&
 4443|       |                    (pINChI->StereoIsotopic->nCompInv2Abs && !pINChI->StereoIsotopic->bTrivialInv))
 4444|       |                {
 4445|       |                    bExtract |= EXTR_NON_TRIVIAL_STEREO;
 4446|       |                }
 4447|       |#endif
 4448|       |                /*    Mark non-tautomeric representation as having
 4449|       |                    another, tautomeric representation */
 4450|   288k|                if (pINChI_Aux && s[TAUT_YES].nLenLinearCTTautomer)
  ------------------
  |  |  575|   288k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4450:21): [True: 288k, False: 0]
  |  Branch (4450:35): [True: 77.2k, False: 211k]
  ------------------
 4451|  77.2k|                {
 4452|  77.2k|                    pINChI_Aux->bIsTautomeric = s[TAUT_YES].nLenLinearCTTautomer;
  ------------------
  |  |  575|  77.2k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4453|  77.2k|                }
 4454|       |#if ( bRELEASE_VERSION == 0 )
 4455|       |                pCS->bExtract |= bExtract;
 4456|       |                pINChI->bExtract |= pCS->bExtract;
 4457|       |#endif
 4458|       |
 4459|   288k|                ret2 = CheckCanonNumberingCorrectness(num_atoms,
 4460|   288k|                    i ? num_at_tg : num_atoms,
  ------------------
  |  Branch (4460:21): [True: 252k, False: 36.3k]
  ------------------
 4461|   288k|                    at[i], pCS,
 4462|   288k|                    pCG,
 4463|   288k|                    i, pStrErrStruct);
 4464|   288k|                if (ret2 && pINChI_Aux) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (4464:21): [True: 0, False: 288k]
  |  Branch (4464:29): [True: 0, False: 0]
  ------------------
 4465|      0|                {
 4466|      0|                    pINChI->nErrorCode = ret2;
 4467|      0|                    pINChI_Aux->nErrorCode = ret2;
 4468|      0|                    ret = ret2;
 4469|      0|                }
 4470|   288k|            }
 4471|   288k|        }
 4472|       |
 4473|   288k|        FreeNeighList(pCS->NeighList);
 4474|   288k|        DeAllocateCS(pCS2);
 4475|       |
 4476|   288k|        pINChI = NULL;      /* avoid dangling pointers */
 4477|   288k|        pINChI_Aux = NULL;  /* avoid dangling pointers */
 4478|   288k|    }
 4479|       |
 4480|   252k|    if (ret == 0)
  ------------------
  |  Branch (4480:9): [True: 252k, False: 18]
  ------------------
 4481|   252k|    {
 4482|   252k|        ret = num_atoms;
 4483|   252k|    }
 4484|       |    /*  treat the results later */
 4485|       |
 4486|   252k|exit_function:
 4487|       |
 4488|   252k|    DeAllocBCN(pBCN);
 4489|   252k|    if (at[TAUT_YES])
  ------------------
  |  |  575|   252k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4489:9): [True: 252k, False: 0]
  ------------------
 4490|   252k|    {
 4491|   252k|        inchi_free(at[TAUT_YES]);
  ------------------
  |  | 1152|   252k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 252k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 252k]
  |  |  ------------------
  ------------------
 4492|   252k|    }
 4493|   252k|    if (at[TAUT_NON])
  ------------------
  |  |  574|   252k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4493:9): [True: 36.4k, False: 215k]
  ------------------
 4494|  36.4k|    {
 4495|  36.4k|        inchi_free(at[TAUT_NON]);
  ------------------
  |  | 1152|  36.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 36.4k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 36.4k]
  |  |  ------------------
  ------------------
 4496|  36.4k|    }
 4497|   252k|    if (ti_out)
  ------------------
  |  Branch (4497:9): [True: 146k, False: 106k]
  ------------------
 4498|   146k|    {
 4499|   146k|        *ti_out = *t_group_info;
 4500|   146k|    }
 4501|   106k|    else
 4502|   106k|    {
 4503|       |        /* free_t_group_info(t_group_info); */
 4504|   106k|        if (t_group_info) /* djb-rwth: fixing oss-fuzz issue #42537161/70475 */
  ------------------
  |  Branch (4504:13): [True: 106k, False: 0]
  ------------------
 4505|   106k|        {
 4506|   106k|            if (t_group_info->nEndpointAtomNumber)
  ------------------
  |  Branch (4506:17): [True: 1.02k, False: 105k]
  ------------------
 4507|  1.02k|            {
 4508|  1.02k|                inchi_free(t_group_info->nEndpointAtomNumber);
  ------------------
  |  | 1152|  1.02k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 1.02k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 1.02k]
  |  |  ------------------
  ------------------
 4509|  1.02k|            }
 4510|   106k|            if (t_group_info->tGroupNumber)
  ------------------
  |  Branch (4510:17): [True: 1.02k, False: 105k]
  ------------------
 4511|  1.02k|            {
 4512|  1.02k|                inchi_free(t_group_info->tGroupNumber);
  ------------------
  |  | 1152|  1.02k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 1.02k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 1.02k]
  |  |  ------------------
  ------------------
 4513|  1.02k|            }
 4514|   106k|            if (t_group_info->nIsotopicEndpointAtomNumber)
  ------------------
  |  Branch (4514:17): [True: 81, False: 105k]
  ------------------
 4515|     81|            {
 4516|     81|                inchi_free(t_group_info->nIsotopicEndpointAtomNumber);
  ------------------
  |  | 1152|     81|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 81, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 81]
  |  |  ------------------
  ------------------
 4517|     81|            }
 4518|   106k|            if (t_group_info->t_group)
  ------------------
  |  Branch (4518:17): [True: 106k, False: 1]
  ------------------
 4519|   106k|            {
 4520|   106k|                inchi_free(t_group_info->t_group);
  ------------------
  |  | 1152|   106k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 106k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 106k]
  |  |  ------------------
  ------------------
 4521|   106k|            }
 4522|   106k|            memset(t_group_info, 0, sizeof(*t_group_info)); /* djb-rwth: memset_s C11/Annex K variant? */
 4523|   106k|        }
 4524|   106k|    }
 4525|   252k|    free_t_group_info(t_group_info_orig);
 4526|       |
 4527|   252k|    if (ebend)
  ------------------
  |  Branch (4527:9): [True: 0, False: 252k]
  ------------------
 4528|      0|    {
 4529|      0|        inchi_free(ebend);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4530|      0|    }
 4531|       |
 4532|   252k|    return ret;
 4533|   252k|}
CheckCanonNumberingCorrectness:
 6206|   288k|{
 6207|   288k|    int i, ret = 0;
 6208|   288k|    AT_NUMB* pCanonOrd = NULL;
 6209|   288k|    int nErrorCode = 0;
 6210|   288k|    AT_NUMB* pCanonRank; /* canonical ranks of the atoms or tautomeric groups */
 6211|   288k|    AT_NUMB* pCanonRankAtoms = NULL;
 6212|       |
 6213|       |    /* djb-rwth: removing redundant code */
 6214|       |
 6215|   288k|    pCanonRankAtoms = (AT_NUMB*)inchi_calloc((long long)num_at_tg + 1, sizeof(pCanonRankAtoms[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|   288k|#define inchi_calloc   calloc
  ------------------
 6216|       |
 6217|       |    /*
 6218|       |        Non-isotopic part
 6219|       |    */
 6220|       |
 6221|   288k|    pCanonOrd = pCS->nLenCanonOrdStereo > 0 ? pCS->nCanonOrdStereo :
  ------------------
  |  Branch (6221:17): [True: 892, False: 287k]
  ------------------
 6222|   288k|        pCS->nLenCanonOrd > 0 ? pCS->nCanonOrd : NULL;
  ------------------
  |  Branch (6222:9): [True: 287k, False: 0]
  ------------------
 6223|   288k|    pCanonRank = pCanonRankAtoms;
 6224|   288k|    if (pCanonOrd && pCanonRank)
  ------------------
  |  Branch (6224:9): [True: 288k, False: 0]
  |  Branch (6224:22): [True: 288k, False: 0]
  ------------------
 6225|   288k|    {
 6226|  1.38M|        for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (6226:21): [True: 1.09M, False: 288k]
  ------------------
 6227|  1.09M|        {
 6228|  1.09M|            pCanonRank[pCanonOrd[i]] = (AT_NUMB)(i + 1);
 6229|  1.09M|        }
 6230|   288k|        ret = UpdateFullLinearCT(num_atoms, num_at_tg, at, pCanonRank, pCanonOrd, pCS,
 6231|   288k|            pCG,
 6232|   288k|            0);
 6233|   288k|        if (ret /*|| memcmp(pCS->LinearCT, pCS->LinearCT2, sizeof(AT_RANK) * pCS->nLenLinearCT )*/)
  ------------------
  |  Branch (6233:13): [True: 0, False: 288k]
  ------------------
 6234|      0|        {
 6235|      0|            nErrorCode |= WARN_FAILED_STEREO;
  ------------------
  |  |   48|      0|#define WARN_FAILED_STEREO          0x0001
  ------------------
 6236|      0|        }
 6237|   288k|    }
 6238|      0|    else
 6239|      0|    {
 6240|      0|        nErrorCode |= ERR_NO_CANON_RESULTS;
  ------------------
  |  |   51|      0|#define ERR_NO_CANON_RESULTS        0x0008
  ------------------
 6241|      0|        goto exit_function;
 6242|      0|    }
 6243|       |
 6244|       |    /*
 6245|       |        Isotopic part
 6246|       |    */
 6247|       |
 6248|   288k|    pCanonOrd = pCS->nLenCanonOrdIsotopicStereo > 0 ? pCS->nCanonOrdIsotopicStereo :
  ------------------
  |  Branch (6248:17): [True: 227, False: 288k]
  ------------------
 6249|   288k|        pCS->nLenCanonOrdIsotopic > 0 ? pCS->nCanonOrdIsotopic : NULL;
  ------------------
  |  Branch (6249:9): [True: 1.88k, False: 286k]
  ------------------
 6250|   288k|    pCanonRank = pCanonRankAtoms;
 6251|       |
 6252|   288k|    if (pCanonOrd && pCanonRank)
  ------------------
  |  Branch (6252:9): [True: 2.11k, False: 286k]
  |  Branch (6252:22): [True: 2.11k, False: 0]
  ------------------
 6253|  2.11k|    {
 6254|  14.6k|        for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (6254:21): [True: 12.5k, False: 2.11k]
  ------------------
 6255|  12.5k|        {
 6256|  12.5k|            pCanonRank[pCanonOrd[i]] = (AT_NUMB)(i + 1);
 6257|  12.5k|        }
 6258|  2.11k|        ret = UpdateFullLinearCT(num_atoms, num_at_tg, at, pCanonRank, pCanonOrd, pCS,
 6259|  2.11k|            pCG,
 6260|  2.11k|            0);
 6261|  2.11k|        if (ret /*|| memcmp(pCS->LinearCT, pCS->LinearCT2, sizeof(AT_RANK) * pCS->nLenLinearCT )*/)
  ------------------
  |  Branch (6261:13): [True: 0, False: 2.11k]
  ------------------
 6262|      0|        {
 6263|      0|            nErrorCode |= (pCS->nLenCanonOrdIsotopicStereo ? WARN_FAILED_ISOTOPIC_STEREO : WARN_FAILED_ISOTOPIC);
  ------------------
  |  |   50|      0|#define WARN_FAILED_ISOTOPIC_STEREO 0x0004
  ------------------
                          nErrorCode |= (pCS->nLenCanonOrdIsotopicStereo ? WARN_FAILED_ISOTOPIC_STEREO : WARN_FAILED_ISOTOPIC);
  ------------------
  |  |   49|      0|#define WARN_FAILED_ISOTOPIC        0x0002
  ------------------
  |  Branch (6263:28): [True: 0, False: 0]
  ------------------
 6264|      0|        }
 6265|  2.11k|    }
 6266|       |
 6267|   288k|exit_function:
 6268|   288k|    if (pCanonRankAtoms)
  ------------------
  |  Branch (6268:9): [True: 288k, False: 0]
  ------------------
 6269|   288k|    {
 6270|   288k|        inchi_free(pCanonRankAtoms);
  ------------------
  |  | 1152|   288k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 288k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 288k]
  |  |  ------------------
  ------------------
 6271|   288k|    }
 6272|       |
 6273|   288k|    if (nErrorCode)
  ------------------
  |  Branch (6273:9): [True: 0, False: 288k]
  ------------------
 6274|      0|    {
 6275|      0|        return CT_CANON_ERR;
  ------------------
  |  |   35|      0|#define CT_CANON_ERR         (CT_ERR_FIRST-16)  /*(-30016) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 6276|      0|    }
 6277|       |
 6278|   288k|    return 0;
 6279|   288k|}
ichimake.c:CompareDfsDescendants4CT:
 2084|  31.5k|{
 2085|  31.5k|    OrderStruct* os = (OrderStruct*)p;
 2086|  31.5k|    int neigh1 = (int)*(const AT_RANK*)a1;
 2087|  31.5k|    int neigh2 = (int)*(const AT_RANK*)a2;
 2088|  31.5k|    if (neigh1 > MAX_ATOMS)
  ------------------
  |  |   15|  31.5k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (2088:9): [True: 17.3k, False: 14.2k]
  ------------------
 2089|  17.3k|    {
 2090|  17.3k|        if (neigh2 > MAX_ATOMS)
  ------------------
  |  |   15|  17.3k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (2090:13): [True: 3.09k, False: 14.2k]
  ------------------
 2091|  3.09k|        {
 2092|  3.09k|            return 0;
 2093|  3.09k|        }
 2094|  14.2k|        return 1;
 2095|  17.3k|    }
 2096|  14.2k|    else if (neigh2 > MAX_ATOMS)
  ------------------
  |  |   15|  14.2k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (2096:14): [True: 8.03k, False: 6.16k]
  ------------------
 2097|  8.03k|    {
 2098|  8.03k|        return -1;
 2099|  8.03k|    }
 2100|  6.16k|    else
 2101|  6.16k|    {
 2102|  6.16k|        AT_RANK nCurDfsNumber = os->m_gDfs4CT_nDfsNumber[os->m_gDfs4CT_nCurrentAtom];
 2103|  6.16k|        int nDesc1 = nCurDfsNumber > os->m_gDfs4CT_nDfsNumber[neigh1] ?
  ------------------
  |  Branch (2103:22): [True: 1.37k, False: 4.79k]
  ------------------
 2104|  4.79k|            0 : (int)os->m_gDfs4CT_nNumDescendants[neigh1];
 2105|  6.16k|        int nDesc2 = nCurDfsNumber > os->m_gDfs4CT_nDfsNumber[neigh2] ?
  ------------------
  |  Branch (2105:22): [True: 850, False: 5.31k]
  ------------------
 2106|  5.31k|            0 : (int)os->m_gDfs4CT_nNumDescendants[neigh2];
 2107|  6.16k|        int ret;
 2108|  6.16k|        if ((ret = nDesc1 - nDesc2)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2108:13): [True: 3.84k, False: 2.32k]
  ------------------
 2109|  3.84k|        {
 2110|  3.84k|            return ret;
 2111|  3.84k|        }
 2112|  2.32k|        return  (int)neigh1 - (int)neigh2; /*  canon. numbers difference */
 2113|  6.16k|    }
 2114|  31.5k|}

All_SC_Same:
   23|  2.06k|{
   24|  2.06k|    int     n1 = (int) nAtomNumberCanonFrom[(int) canon_rank1 - 1];
   25|  2.06k|    AT_RANK r1 = pRankStack1[0][n1];
   26|  2.06k|    int     iMax1 = (int) r1;
   27|  2.06k|    int     i1, s1;
   28|  2.06k|    int     bFound = 0, stereo_atom_parity = -1;
   29|       |
   30|       |    /*  find one stereo atom such that canon_rank1 can be mapped on it */
   31|  4.10k|    for (i1 = 1; i1 <= iMax1 && r1 == pRankStack2[0][s1 = (int) pRankStack2[1][iMax1 - i1]]; i1++)
  ------------------
  |  Branch (31:18): [True: 4.08k, False: 22]
  |  Branch (31:33): [True: 2.29k, False: 1.79k]
  ------------------
   32|  2.29k|    {
   33|  2.29k|        if (at[s1].stereo_bond_neighbor[0])
  ------------------
  |  Branch (33:13): [True: 0, False: 2.29k]
  ------------------
   34|      0|        {
   35|      0|            bFound = 0; /* at[s1] is not sp3-stereogenic: it belongs to a stereobond */
   36|      0|            break;
   37|      0|        }
   38|  2.29k|        else
   39|  2.29k|            if (i1 == 1)
  ------------------
  |  Branch (39:17): [True: 2.06k, False: 235]
  ------------------
   40|  2.06k|            {
   41|  2.06k|                stereo_atom_parity = PARITY_VAL( at[s1].stereo_atom_parity );
  ------------------
  |  |  262|  2.06k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|  2.06k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
   42|  2.06k|                if (!ATOM_PARITY_KNOWN( stereo_atom_parity ))
  ------------------
  |  |  258|  2.06k|#define ATOM_PARITY_KNOWN(X)        (AB_MIN_KNOWN_PARITY <= (X) && (X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|  2.06k|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define ATOM_PARITY_KNOWN(X)        (AB_MIN_KNOWN_PARITY <= (X) && (X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|  1.93k|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (258:38): [True: 1.93k, False: 127]
  |  |  |  Branch (258:68): [True: 1.93k, False: 0]
  |  |  ------------------
  ------------------
   43|    127|                {
   44|    127|                    bFound = 0;  /* at[s1] does not have a KNOWN parity */
   45|    127|                    break;
   46|    127|                }
   47|  2.06k|            }
   48|    235|            else
   49|    235|                if (stereo_atom_parity != PARITY_VAL( at[s1].stereo_atom_parity ))
  ------------------
  |  |  262|    235|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|    235|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
  |  Branch (49:21): [True: 119, False: 116]
  ------------------
   50|    119|                {
   51|    119|                    bFound = 0; /* two equivalent atoms have different parities */
   52|    119|                    break;
   53|    119|                }
   54|  2.04k|        bFound++;
   55|  2.04k|    }
   56|       |
   57|  2.06k|    return bFound;
   58|  2.06k|}
Next_SC_At_CanonRank2:
   73|  6.15k|{
   74|  6.15k|    AT_RANK canon_rank1_inp = *canon_rank1;
   75|  6.15k|    AT_RANK cr1;  /*  canonical rank (canonical number) */
   76|  6.15k|    AT_RANK r1;   /*  mapping rank */
   77|  6.15k|    int     n1;   /*  ord. number of an atom with the canon. number */
   78|  6.15k|    int     s1;   /*  ord. number of an atom with stereo */
   79|  6.15k|    int     i1, bFound = 0;
   80|  6.15k|    int     iMax1;
   81|       |
   82|  6.15k|    if (canon_rank1_inp < *canon_rank1_min)
  ------------------
  |  Branch (82:9): [True: 0, False: 6.15k]
  ------------------
   83|      0|    {
   84|      0|        canon_rank1_inp = *canon_rank1_min;
   85|      0|    }
   86|  6.15k|    else
   87|  6.15k|    {
   88|  6.15k|        if (canon_rank1_inp < 1)
  ------------------
  |  Branch (88:13): [True: 1.25k, False: 4.89k]
  ------------------
   89|  1.25k|        {
   90|  1.25k|            canon_rank1_inp = 1;
   91|  1.25k|        }
   92|  4.89k|        else
   93|  4.89k|        {
   94|  4.89k|            canon_rank1_inp++; /*  next canonical rank */
   95|  4.89k|        }
   96|  6.15k|    }
   97|  6.15k|    cr1 = canon_rank1_inp;
   98|       |
   99|  8.26k|    while ((int) cr1 <= num_atoms)
  ------------------
  |  Branch (99:12): [True: 8.26k, False: 0]
  ------------------
  100|  8.26k|    {
  101|  8.26k|        n1 = (int) nAtomNumberCanonFrom[(int) cr1 - 1]; /*  atom1 (which has canon. rank cr1) ord. number */
  102|  8.26k|        iMax1 = (int) ( r1 = pRankStack1[0][n1] ); /*  mapping rank of atom1 */
  103|       |        /*  find atoms "to" to which the canon. number can be mapped; they have mapping rank r1, number s1 */
  104|  10.8k|        for (i1 = 1; i1 <= iMax1 && r1 == pRankStack2[0][s1 = (int) pRankStack2[1][iMax1 - i1]]; i1++)
  ------------------
  |  Branch (104:22): [True: 9.97k, False: 894]
  |  Branch (104:37): [True: 8.76k, False: 1.21k]
  ------------------
  105|  8.76k|        {
  106|       |            /*  looking for a stereo center atom that has mapping rank r1 */
  107|  8.76k|            if (bAtomUsedForStereo[s1] == STEREO_AT_MARK)
  ------------------
  |  |  878|  8.76k|#define STEREO_AT_MARK            8 /* > MAX_NUM_STEREO_BONDS */
  ------------------
  |  Branch (107:17): [True: 6.15k, False: 2.61k]
  ------------------
  108|  6.15k|            {
  109|       |                /*  found a sterogenic atom that has not been mapped yet */
  110|  6.15k|                bFound = 1;
  111|  6.15k|                break;
  112|  6.15k|            }
  113|  8.76k|        }
  114|  8.26k|        if (bFound)
  ------------------
  |  Branch (114:13): [True: 6.15k, False: 2.10k]
  ------------------
  115|  6.15k|        {
  116|       |            /*  one sterogenic not mapped yet atom "to" has been found */
  117|  6.15k|            if (*bFirstTime)
  ------------------
  |  Branch (117:17): [True: 6.15k, False: 0]
  ------------------
  118|  6.15k|            {
  119|  6.15k|                *canon_rank1_min = cr1;
  120|  6.15k|                *bFirstTime = 0;
  121|  6.15k|            }
  122|  6.15k|            break;
  123|  6.15k|        }
  124|  2.10k|        else
  125|  2.10k|        {
  126|       |             /*  a not mapped yet stereogenic atom has not found */
  127|       |             /*  for the mapping rank r1 defined by the canonical rank cr1; try next cr1 */
  128|  2.10k|            cr1++;
  129|  2.10k|        }
  130|  8.26k|    }
  131|  6.15k|    if (bFound)
  ------------------
  |  Branch (131:9): [True: 6.15k, False: 0]
  ------------------
  132|  6.15k|    {
  133|       |        /*  success */
  134|  6.15k|        *canon_rank1 = cr1;
  135|  6.15k|        return 1;
  136|  6.15k|    }
  137|       |
  138|      0|    return 0;
  139|  6.15k|}
CompareLinCtStereoDble:
  147|  1.73k|{
  148|  1.73k|    int i, num, ret = 0;
  149|       |
  150|       |    /* compare double bonds */
  151|  1.73k|    if (LinearCTStereoDble1 && LinearCTStereoDble2)
  ------------------
  |  Branch (151:9): [True: 1.31k, False: 419]
  |  Branch (151:32): [True: 1.31k, False: 0]
  ------------------
  152|  1.31k|    {
  153|  1.31k|        num = inchi_min( nLenLinearCTStereoDble1, nLenLinearCTStereoDble2 );
  ------------------
  |  |  139|  1.31k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 1.31k]
  |  |  ------------------
  ------------------
  154|  2.62k|        for (i = 0; i < num; i++)
  ------------------
  |  Branch (154:21): [True: 1.30k, False: 1.31k]
  ------------------
  155|  1.30k|        {
  156|  1.30k|            if ((ret = (int) LinearCTStereoDble1[i].at_num1 - (int) LinearCTStereoDble2[i].at_num1)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (156:17): [True: 0, False: 1.30k]
  ------------------
  157|      0|                break;
  158|  1.30k|            if ((ret = (int) LinearCTStereoDble1[i].at_num2 - (int) LinearCTStereoDble2[i].at_num2)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (158:17): [True: 0, False: 1.30k]
  ------------------
  159|      0|                break;
  160|  1.30k|            if ((ret = (int) LinearCTStereoDble1[i].parity - (int) LinearCTStereoDble2[i].parity)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (160:17): [True: 2, False: 1.30k]
  ------------------
  161|      2|                break;
  162|  1.30k|        }
  163|  1.31k|        if (!ret)
  ------------------
  |  Branch (163:13): [True: 1.31k, False: 2]
  ------------------
  164|  1.31k|        {
  165|  1.31k|            ret = nLenLinearCTStereoDble1 - nLenLinearCTStereoDble2;
  166|  1.31k|        }
  167|  1.31k|    }
  168|    419|    else
  169|    419|    {
  170|    419|        if (LinearCTStereoDble1 && nLenLinearCTStereoDble1 > 0)
  ------------------
  |  Branch (170:13): [True: 0, False: 419]
  |  Branch (170:36): [True: 0, False: 0]
  ------------------
  171|      0|        {
  172|      0|            ret = 1;
  173|      0|        }
  174|    419|        else
  175|    419|        {
  176|    419|            if (LinearCTStereoDble2 && nLenLinearCTStereoDble2 > 0)
  ------------------
  |  Branch (176:17): [True: 0, False: 419]
  |  Branch (176:40): [True: 0, False: 0]
  ------------------
  177|      0|            {
  178|      0|                ret = -1;
  179|      0|            }
  180|    419|        }
  181|    419|    }
  182|       |
  183|  1.73k|    return ret;
  184|  1.73k|}
CompareLinCtStereoCarb:
  192|    434|{
  193|    434|    int i, num, ret = 0;
  194|       |
  195|       |    /* compare stereocenters */
  196|    434|    if (LinearCTStereoCarb1 && LinearCTStereoCarb2)
  ------------------
  |  Branch (196:9): [True: 434, False: 0]
  |  Branch (196:32): [True: 434, False: 0]
  ------------------
  197|    434|    {
  198|    434|        num = inchi_min( nLenLinearCTStereoCarb1, nLenLinearCTStereoCarb2 );
  ------------------
  |  |  139|    434|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 434]
  |  |  ------------------
  ------------------
  199|  1.33k|        for (i = 0; i < num; i++)
  ------------------
  |  Branch (199:21): [True: 1.14k, False: 191]
  ------------------
  200|  1.14k|        {
  201|  1.14k|            if ((ret = (int) LinearCTStereoCarb1[i].at_num - (int) LinearCTStereoCarb2[i].at_num)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (201:17): [True: 27, False: 1.11k]
  ------------------
  202|     27|                break;
  203|  1.11k|            if ((ret = (int) LinearCTStereoCarb1[i].parity - (int) LinearCTStereoCarb2[i].parity)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (203:17): [True: 216, False: 900]
  ------------------
  204|    216|                break;
  205|  1.11k|        }
  206|    434|        if (!ret)
  ------------------
  |  Branch (206:13): [True: 191, False: 243]
  ------------------
  207|    191|        {
  208|    191|            ret = nLenLinearCTStereoCarb1 - nLenLinearCTStereoCarb2;
  209|    191|        }
  210|    434|    }
  211|      0|    else
  212|      0|        if (LinearCTStereoCarb1 && nLenLinearCTStereoCarb1 > 0)
  ------------------
  |  Branch (212:13): [True: 0, False: 0]
  |  Branch (212:36): [True: 0, False: 0]
  ------------------
  213|      0|        {
  214|      0|            ret = 1;
  215|      0|        }
  216|      0|        else
  217|      0|            if (LinearCTStereoCarb2 && nLenLinearCTStereoCarb2 > 0)
  ------------------
  |  Branch (217:17): [True: 0, False: 0]
  |  Branch (217:40): [True: 0, False: 0]
  ------------------
  218|      0|            {
  219|      0|                ret = -1;
  220|      0|            }
  221|       |
  222|    434|    return ret;
  223|    434|}
CompareLinCtStereo:
  235|    436|{
  236|    436|    int ret;
  237|       |
  238|       |    /* compare double bonds */
  239|    436|    ret = CompareLinCtStereoDble( LinearCTStereoDble1, nLenLinearCTStereoDble1,
  240|    436|                                   LinearCTStereoDble2, nLenLinearCTStereoDble2 );
  241|    436|    if (!ret)
  ------------------
  |  Branch (241:9): [True: 434, False: 2]
  ------------------
  242|    434|    {
  243|    434|        ret = CompareLinCtStereoCarb( LinearCTStereoCarb1, nLenLinearCTStereoCarb1,
  244|       |
  245|    434|                                      LinearCTStereoCarb2, nLenLinearCTStereoCarb2 );
  246|    434|    }
  247|    436|    return ret;
  248|    436|}
CompareLinCtStereoAtomToValues:
  255|  14.4k|{
  256|  14.4k|    if (LinearCTStereoCarb->at_num CT_GREATER_THAN at_rank_canon1)
  ------------------
  |  Branch (256:9): [True: 409, False: 14.0k]
  ------------------
  257|    409|    {
  258|    409|        return 1;
  259|    409|    }
  260|  14.0k|    if (LinearCTStereoCarb->at_num != at_rank_canon1)
  ------------------
  |  Branch (260:9): [True: 172, False: 13.8k]
  ------------------
  261|    172|    {
  262|    172|        return -1;
  263|    172|    }
  264|  13.8k|    if (LinearCTStereoCarb->parity CT_GREATER_THAN parity)
  ------------------
  |  Branch (264:9): [True: 1.91k, False: 11.9k]
  ------------------
  265|  1.91k|    {
  266|  1.91k|        return 1;
  267|  1.91k|    }
  268|  11.9k|    if (LinearCTStereoCarb->parity != parity)
  ------------------
  |  Branch (268:9): [True: 3.69k, False: 8.27k]
  ------------------
  269|  3.69k|    {
  270|  3.69k|        return -1;
  271|  3.69k|    }
  272|       |
  273|  8.27k|    return 0;
  274|  11.9k|}
bUniqueAtNbrFromMappingRank:
  282|  3.33k|{
  283|  3.33k|    int       r = (int) nAtRank - 1;
  284|  3.33k|    AT_NUMB   i = pRankStack[1][r];
  285|  3.33k|    if (nAtRank == pRankStack[0][(int) i] &&
  ------------------
  |  Branch (285:9): [True: 3.33k, False: 5]
  ------------------
  286|  3.33k|        ( !r || nAtRank != pRankStack[0][pRankStack[1][r - 1]] )
  ------------------
  |  Branch (286:11): [True: 560, False: 2.77k]
  |  Branch (286:17): [True: 2.76k, False: 5]
  ------------------
  287|  3.33k|       )
  288|  3.32k|    {
  289|  3.32k|        *nAtNumber = i;
  290|  3.32k|        return 1;
  291|  3.32k|    }
  292|       |
  293|     10|    return 0;
  294|  3.33k|}
nGetMcr:
  302|  4.69k|{
  303|  4.69k|    AT_RANK n1, n2, mcr; /*  recursive version is much shorter. */
  304|       |
  305|  4.69k|    n1 = nEqArray[(int) n];
  306|  4.69k|    if (n == n1)
  ------------------
  |  Branch (306:9): [True: 3.11k, False: 1.57k]
  ------------------
  307|  3.11k|    {
  308|  3.11k|        return n;
  309|  3.11k|    }
  310|       |    /*  1st pass: find mcr */
  311|  1.67k|    while (n1 != ( n2 = nEqArray[(int) n1] ))
  ------------------
  |  Branch (311:12): [True: 96, False: 1.57k]
  ------------------
  312|     96|    {
  313|     96|        n1 = n2;
  314|     96|    }
  315|       |    /*  2nd pass: copy mcr to each element of the set starting from nEqArray[n] */
  316|  1.57k|    mcr = n1;
  317|  1.57k|    n1 = n;
  318|  1.67k|    while ( /*n1*/ mcr != ( n2 = nEqArray[(int) n1] ))
  ------------------
  |  Branch (318:20): [True: 96, False: 1.57k]
  ------------------
  319|     96|    {
  320|     96|        nEqArray[(int) n1] = mcr;
  321|     96|        n1 = n2;
  322|     96|    }
  323|       |
  324|  1.57k|    return ( mcr );
  325|  4.69k|}
nJoin2Mcrs:
  332|  1.66k|{
  333|  1.66k|    n1 = nGetMcr( nEqArray, n1 );
  334|  1.66k|    n2 = nGetMcr( nEqArray, n2 );
  335|  1.66k|    if (n1 < n2)
  ------------------
  |  Branch (335:9): [True: 93, False: 1.57k]
  ------------------
  336|     93|    {
  337|     93|        nEqArray[n2] = n1;
  338|     93|        return 1; /*  a change has been made */
  339|     93|    }
  340|  1.57k|    if (n2 < n1)
  ------------------
  |  Branch (340:9): [True: 508, False: 1.06k]
  ------------------
  341|    508|    {
  342|    508|        nEqArray[n1] = n2;
  343|    508|        return 1; /*  a change has been made */
  344|    508|    }
  345|       |
  346|  1.06k|    return 0; /*  no changes */
  347|  1.57k|}
All_SB_Same:
  364|  2.10k|{
  365|  2.10k|    int     n1 = (int) nAtomNumberCanonFrom[(int) canon_rank1 - 1]; /* at1 has canon_rank1 */
  366|  2.10k|    int     n2 = (int) nAtomNumberCanonFrom[(int) canon_rank2 - 1]; /* at2 has canon_rank2 */
  367|  2.10k|    AT_RANK r1 = pRankStack1[0][n1]; /* at1 mapping rank */
  368|  2.10k|    AT_RANK r2 = pRankStack1[0][n2]; /* at2 mapping rank */
  369|  2.10k|    AT_RANK rNeigh1, rNeigh2;
  370|  2.10k|    int     iMax1 = (int) r1;
  371|       |    /* int     iMax2 = (int)r2; */
  372|  2.10k|    int     i1, i2, s1 = 0, s2 = 0, k1 = 0, k2, m, k, num_equal;
  373|  2.10k|    int     bNotFound = 1, cumulene_len, stereo_bond_parity;
  374|       |
  375|       |    /*  at the first atom that possibly may have canon_rank1 find one stereo bond such that */
  376|       |    /*  canon_rank1-canon_rank2 possibly may be mapped on it */
  377|  2.19k|    for (i1 = 1; i1 <= iMax1 && r1 == pRankStack2[0][s1 = (int) pRankStack2[1][iMax1 - i1]]; i1++)
  ------------------
  |  Branch (377:18): [True: 2.19k, False: 0]
  |  Branch (377:33): [True: 2.19k, False: 0]
  ------------------
  378|  2.19k|    {
  379|       |        /* at[n1] may be possible to map on at[s1] */
  380|  2.19k|        for (k1 = 0, s2 = 0, bNotFound = 1;
  381|  2.76k|              k1 < MAX_NUM_STEREO_BONDS && ( s2 = (int) at[s1].stereo_bond_neighbor[k1] ) &&
  ------------------
  |  |  873|  5.53k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (381:15): [True: 2.76k, False: 0]
  |  Branch (381:44): [True: 2.67k, False: 94]
  ------------------
  382|  2.67k|              ( bNotFound = ( r2 != pRankStack2[0][--s2] ) ); k1++)
  ------------------
  |  Branch (382:15): [True: 569, False: 2.10k]
  ------------------
  383|    569|            ; /* continue until the 1st at[s2] (to which at[n2] may be mapped) have been found */
  384|  2.19k|        if (!bNotFound)
  ------------------
  |  Branch (384:13): [True: 2.10k, False: 94]
  ------------------
  385|  2.10k|        {
  386|  2.10k|            break; /* stop at 1st found */
  387|  2.10k|        }
  388|  2.19k|    }
  389|  2.10k|    if (bNotFound)
  ------------------
  |  Branch (389:9): [True: 0, False: 2.10k]
  ------------------
  390|      0|    {
  391|      0|        return -1; /*  error: no mapping exists */
  392|      0|    }
  393|  3.24k|    for (k2 = 0, m = 0; k2 < MAX_NUM_STEREO_BONDS && ( m = (int) at[s2].stereo_bond_neighbor[k2] ) && m - 1 != s1; k2++)
  ------------------
  |  |  873|  6.48k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (393:25): [True: 3.24k, False: 0]
  |  Branch (393:54): [True: 3.24k, False: 0]
  |  Branch (393:103): [True: 1.13k, False: 2.10k]
  ------------------
  394|  1.13k|        ;
  395|  2.10k|    if (m - 1 != s1)
  ------------------
  |  Branch (395:9): [True: 0, False: 2.10k]
  ------------------
  396|      0|    {
  397|      0|        return -1; /*  program error: stereo bond in opposite direction not found */
  398|      0|    }
  399|  2.10k|    stereo_bond_parity = at[s1].stereo_bond_parity[k1];
  400|  2.10k|    if (!PARITY_KNOWN( stereo_bond_parity ))
  ------------------
  |  |  265|  2.10k|#define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|  2.10k|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|  4.21k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  2.10k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|  2.10k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  2.10k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|  2.10k|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (265:38): [True: 2.10k, False: 0]
  |  |  |  Branch (265:78): [True: 2.10k, False: 3]
  |  |  ------------------
  ------------------
  401|      3|    {
  402|      3|        return 0;
  403|      3|    }
  404|  2.10k|    cumulene_len = BOND_CHAIN_LEN( stereo_bond_parity );
  ------------------
  |  |  214|  2.10k|#define BOND_CHAIN_LEN(X)           (GET_BITS_CUMULENE_LEN(X)/MULT_STEREOBOND) /* 0 => double bond, 1 => allene, 2 => cumulene,..*/
  |  |  ------------------
  |  |  |  |  213|  2.10k|#define GET_BITS_CUMULENE_LEN(X)    ((X)&MASK_CUMULENE_LEN)
  |  |  |  |  ------------------
  |  |  |  |  |  |  205|  2.10k|#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,..*/
  |  |  ------------------
  |  |  |  |  209|  2.10k|#define MULT_STEREOBOND    0x08  /* multiplier for cumulene chain length
  |  |  ------------------
  ------------------
  405|  2.10k|    rNeigh1 = pRankStack2[0][(int) at[s1].neighbor[(int) at[s1].stereo_bond_ord[k1]]];
  406|  2.10k|    rNeigh2 = pRankStack2[0][(int) at[s2].neighbor[(int) at[s2].stereo_bond_ord[k2]]];
  407|       |
  408|  2.10k|    num_equal = 0;
  409|       |    /*  Search among ALL neighbors because sometimes a stereo bond may be mapped on a non-stereo bond. */
  410|       |    /*  If is so then return 0: not all mappings are stereo-equivalent */
  411|  4.02k|    for (s1 = 1; s1 <= iMax1 && r1 == pRankStack2[0][i1 = (int) pRankStack2[1][iMax1 - s1]]; s1++)
  ------------------
  |  Branch (411:18): [True: 3.93k, False: 87]
  |  Branch (411:33): [True: 2.38k, False: 1.55k]
  ------------------
  412|  2.38k|    {
  413|  6.49k|        for (k = 0; k < at[i1].valence; k++)
  ------------------
  |  Branch (413:21): [True: 4.57k, False: 1.92k]
  ------------------
  414|  4.57k|        {
  415|  4.57k|            n1 = at[i1].neighbor[k];
  416|  4.57k|            if (rNeigh1 != pRankStack2[0][n1])
  ------------------
  |  Branch (416:17): [True: 1.73k, False: 2.83k]
  ------------------
  417|  1.73k|            {
  418|  1.73k|                continue; /*  wrong neighbor */
  419|  1.73k|            }
  420|  2.83k|            if (cumulene_len)
  ------------------
  |  Branch (420:17): [True: 0, False: 2.83k]
  ------------------
  421|      0|            {
  422|      0|                int prev, next, len, j;
  423|      0|                for (prev = i1, len = 0, next = n1; len < cumulene_len; len++)
  ------------------
  |  Branch (423:53): [True: 0, False: 0]
  ------------------
  424|      0|                {
  425|      0|                    if (at[next].valence == 2 && !at[next].num_H)
  ------------------
  |  Branch (425:25): [True: 0, False: 0]
  |  Branch (425:50): [True: 0, False: 0]
  ------------------
  426|      0|                    {
  427|      0|                        j = ( (int) at[next].neighbor[0] == prev );
  428|      0|                        prev = next;
  429|      0|                        next = at[next].neighbor[j];
  430|      0|                    }
  431|      0|                    else
  432|      0|                    {
  433|      0|                        break; /*  cannot continue */
  434|      0|                    }
  435|      0|                }
  436|      0|                if (len != cumulene_len ||
  ------------------
  |  Branch (436:21): [True: 0, False: 0]
  ------------------
  437|      0|                     r2 != pRankStack2[0][next] ||
  ------------------
  |  Branch (437:22): [True: 0, False: 0]
  ------------------
  438|      0|                     rNeigh2 != pRankStack2[0][prev])
  ------------------
  |  Branch (438:22): [True: 0, False: 0]
  ------------------
  439|      0|                {
  440|       |                    /*  cumulene chain not found */
  441|      0|                    continue;
  442|      0|                }
  443|      0|                i2 = next;
  444|      0|            }
  445|  2.83k|            else
  446|  2.83k|            {
  447|  2.83k|                i2 = n1;
  448|  2.83k|            }
  449|       |            /*  find if a stereogenic bond between at[i1]-at[i2] exists */
  450|  4.04k|            for (k1 = 0; k1 < MAX_NUM_STEREO_BONDS &&
  ------------------
  |  |  873|  8.08k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (450:26): [True: 4.04k, False: 0]
  ------------------
  451|  4.04k|                ( m = (int) at[i1].stereo_bond_neighbor[k1] ) && m - 1 != i2; k1++)
  ------------------
  |  Branch (451:17): [True: 3.75k, False: 286]
  |  Branch (451:66): [True: 1.20k, False: 2.54k]
  ------------------
  452|  1.20k|                ;
  453|  2.83k|            if (m - 1 != i2)
  ------------------
  |  Branch (453:17): [True: 286, False: 2.54k]
  ------------------
  454|    286|            {
  455|    286|                return 0;
  456|    286|            }
  457|  3.83k|            for (k2 = 0; k2 < MAX_NUM_STEREO_BONDS &&
  ------------------
  |  |  873|  7.67k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (457:26): [True: 3.83k, False: 0]
  ------------------
  458|  3.83k|                ( m = (int) at[i2].stereo_bond_neighbor[k2] ) && m - 1 != i1; k2++)
  ------------------
  |  Branch (458:17): [True: 3.83k, False: 0]
  |  Branch (458:66): [True: 1.28k, False: 2.54k]
  ------------------
  459|  1.28k|                ;
  460|  2.54k|            if (m - 1 != i1)
  ------------------
  |  Branch (460:17): [True: 0, False: 2.54k]
  ------------------
  461|      0|            {
  462|      0|                return 0;
  463|      0|            }
  464|  2.54k|            if (at[i1].stereo_bond_parity[k1] != at[i2].stereo_bond_parity[k2])
  ------------------
  |  Branch (464:17): [True: 0, False: 2.54k]
  ------------------
  465|      0|            {
  466|      0|                return -1; /*  program error */
  467|      0|            }
  468|  2.54k|            if (stereo_bond_parity != at[i1].stereo_bond_parity[k1])
  ------------------
  |  Branch (468:17): [True: 179, False: 2.36k]
  ------------------
  469|    179|            {
  470|    179|                return 0;
  471|    179|            }
  472|  2.36k|            num_equal++;
  473|  2.36k|        }
  474|  2.38k|    }
  475|       |
  476|  1.63k|    return num_equal;
  477|  2.10k|}
Next_SB_At_CanonRanks2:
  496|  2.38k|{
  497|  2.38k|    AT_RANK canon_rank1_inp = *canon_rank1;
  498|  2.38k|    AT_RANK canon_rank2_inp = *canon_rank2;
  499|  2.38k|    AT_RANK cr1, cr2; /*  canonical ranks (canonical numbers) */
  500|  2.38k|    AT_RANK r1, r2;   /*  mapping ranks */
  501|  2.38k|    int     n1, n2;   /*  ord. numbers of atoms with stereo */
  502|  2.38k|    int     s1, s2;   /*  ord. numbers of atoms with canon. numbers */
  503|  2.38k|    int     i1, i2, k, m;
  504|  2.38k|    int     iMax1, iMax2;
  505|       |
  506|  2.38k|    if (canon_rank1_inp < *canon_rank1_min ||
  ------------------
  |  Branch (506:9): [True: 0, False: 2.38k]
  ------------------
  507|  2.38k|         (canon_rank1_inp == *canon_rank1_min &&
  ------------------
  |  Branch (507:11): [True: 413, False: 1.97k]
  ------------------
  508|    413|         canon_rank2_inp < *canon_rank2_min)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (508:10): [True: 0, False: 413]
  ------------------
  509|      0|    {
  510|       |
  511|      0|        canon_rank1_inp = *canon_rank1_min;
  512|      0|        canon_rank2_inp = *canon_rank2_min;
  513|      0|    }
  514|  2.38k|    else
  515|  2.38k|        if (canon_rank1_inp < 2)
  ------------------
  |  Branch (515:13): [True: 409, False: 1.97k]
  ------------------
  516|    409|        {
  517|    409|            canon_rank1_inp = 2;
  518|    409|            canon_rank2_inp = 0;
  519|    409|        }
  520|  2.38k|    cr1 = canon_rank1_inp;
  521|  2.38k|    cr2 = num_atoms; /* initialize. 1/8/2002 */
  522|  4.84k|    while ((int) cr1 <= num_atoms)
  ------------------
  |  Branch (522:12): [True: 4.80k, False: 34]
  ------------------
  523|  4.80k|    {
  524|  4.80k|        cr2 = cr1;
  525|  4.80k|        n1 = (int) nAtomNumberCanonFrom[(int) cr1 - 1]; /*  atom1=at[n1] (which has canon. rank) ord. number */
  526|  4.80k|        iMax1 = (int) ( r1 = pRankStack1[0][n1] ); /*  mapping rank of atom1 */
  527|  11.6k|        for (i1 = 1; i1 <= iMax1 && r1 == pRankStack2[0][s1 = (int) pRankStack2[1][iMax1 - i1]]; i1++)
  ------------------
  |  Branch (527:22): [True: 11.0k, False: 565]
  |  Branch (527:37): [True: 6.81k, False: 4.24k]
  ------------------
  528|  6.81k|        {
  529|       |            /*  looking for a stereo bond atom that has mapping rank r1 */
  530|       |            /*  found at[s1] such that rank cr1 can be mapped on at[s1] because cr1 and s1 have equal */
  531|       |            /*  mapping rank = r1. Check at[s1] stereo bonds */
  532|  6.81k|            if (bAtomUsedForStereo[s1] && bAtomUsedForStereo[s1] < STEREO_AT_MARK)
  ------------------
  |  |  878|  6.14k|#define STEREO_AT_MARK            8 /* > MAX_NUM_STEREO_BONDS */
  ------------------
  |  Branch (532:17): [True: 6.14k, False: 670]
  |  Branch (532:43): [True: 6.14k, False: 0]
  ------------------
  533|  6.14k|            {
  534|  17.0k|                for (k = 0; k < MAX_NUM_STEREO_BONDS && ( s2 = (int) at[s1].stereo_bond_neighbor[k] ); k++) /* djb-rwth: removing redundant code */
  ------------------
  |  |  873|  34.0k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (534:29): [True: 17.0k, False: 0]
  |  Branch (534:57): [True: 10.9k, False: 6.14k]
  ------------------
  535|  10.9k|                {
  536|       |                    /*  stereo bond at[s1]-at[s2] has been found */
  537|  10.9k|                    if (bAtomUsedForStereo[--s2])
  ------------------
  |  Branch (537:25): [True: 10.8k, False: 59]
  ------------------
  538|  10.8k|                    {
  539|       |                        /*  stereo bonds have not been mapped. however, this check is not needed */
  540|  10.8k|                        int cumulene_len = BOND_CHAIN_LEN( at[s1].stereo_bond_parity[k] );
  ------------------
  |  |  214|  10.8k|#define BOND_CHAIN_LEN(X)           (GET_BITS_CUMULENE_LEN(X)/MULT_STEREOBOND) /* 0 => double bond, 1 => allene, 2 => cumulene,..*/
  |  |  ------------------
  |  |  |  |  213|  10.8k|#define GET_BITS_CUMULENE_LEN(X)    ((X)&MASK_CUMULENE_LEN)
  |  |  |  |  ------------------
  |  |  |  |  |  |  205|  10.8k|#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,..*/
  |  |  ------------------
  |  |  |  |  209|  10.8k|#define MULT_STEREOBOND    0x08  /* multiplier for cumulene chain length
  |  |  ------------------
  ------------------
  541|  10.8k|                        if ((cumulene_len % 2 && !bAllene) || /* 09-26-2003 */
  ------------------
  |  Branch (541:30): [True: 70, False: 10.7k]
  |  Branch (541:50): [True: 35, False: 35]
  ------------------
  542|  10.8k|                             (!( cumulene_len % 2 ) && bAllene)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (542:31): [True: 10.7k, False: 35]
  |  Branch (542:56): [True: 67, False: 10.7k]
  ------------------
  543|    102|                        { /* 08-17-2003 Fix05 */
  544|    102|                            continue;
  545|    102|                        }
  546|  10.7k|                        iMax2 = (int) ( r2 = pRankStack2[0][s2] ); /*  mapping rank of atom2 */
  547|       |                        /*  Go back to canonical ranks and find an atom that has mapping rank r2 */
  548|       |                        /*  and is connected to the atom with canonical rank cr1 (possibly by cumulene chain) */
  549|       |                        /*  These cr1-cr2 canon. ranks possibly can be mapped on at[s1]-at[s2] stereo bond */
  550|  40.4k|                        for (i2 = 1; i2 <= iMax2 && r2 == pRankStack1[0][n2 = (int) pRankStack1[1][iMax2 - i2]]; i2++)
  ------------------
  |  Branch (550:38): [True: 36.9k, False: 3.42k]
  |  Branch (550:53): [True: 29.6k, False: 7.31k]
  ------------------
  551|  29.6k|                        {
  552|  29.6k|                            if (cumulene_len)
  ------------------
  |  Branch (552:33): [True: 59, False: 29.6k]
  ------------------
  553|     59|                            {
  554|     59|                                int prev, next, len, j;
  555|    145|                                for (m = 0; m < at[n1].valence; m++)
  ------------------
  |  Branch (555:45): [True: 121, False: 24]
  ------------------
  556|    121|                                {
  557|    242|                                    for (prev = n1, len = 0, next = (int) at[n1].neighbor[m]; len < cumulene_len; len++)
  ------------------
  |  Branch (557:95): [True: 121, False: 121]
  ------------------
  558|    121|                                    {
  559|    121|                                        if (at[next].valence == 2 && !at[next].num_H)
  ------------------
  |  Branch (559:45): [True: 121, False: 0]
  |  Branch (559:70): [True: 121, False: 0]
  ------------------
  560|    121|                                        {
  561|    121|                                            j = ( (int) at[next].neighbor[0] == prev );
  562|    121|                                            prev = next;
  563|    121|                                            next = at[next].neighbor[j];
  564|    121|                                        }
  565|      0|                                        else
  566|      0|                                        {
  567|      0|                                            break; /*  cannot continue */
  568|      0|                                        }
  569|    121|                                    }
  570|    121|                                    if (len == cumulene_len && n2 == next)
  ------------------
  |  Branch (570:41): [True: 121, False: 0]
  |  Branch (570:64): [True: 35, False: 86]
  ------------------
  571|     35|                                    {
  572|     35|                                        break;
  573|     35|                                    }
  574|    121|                                }
  575|     59|                            }
  576|  29.6k|                            else
  577|  29.6k|                            {
  578|  68.6k|                                for (m = 0; m < at[n1].valence && n2 != (int) at[n1].neighbor[m]; m++)
  ------------------
  |  Branch (578:45): [True: 52.3k, False: 16.2k]
  |  Branch (578:67): [True: 39.0k, False: 13.3k]
  ------------------
  579|  39.0k|                                    ;
  580|  29.6k|                            }
  581|  29.6k|                            if (m < at[n1].valence &&
  ------------------
  |  Branch (581:33): [True: 13.3k, False: 16.3k]
  ------------------
  582|  13.3k|                                 nCanonRankFrom[n2] < cr2 &&
  ------------------
  |  Branch (582:34): [True: 5.13k, False: 8.22k]
  ------------------
  583|  5.13k|                                 nCanonRankFrom[n2] > canon_rank2_inp)
  ------------------
  |  Branch (583:34): [True: 2.44k, False: 2.68k]
  ------------------
  584|  2.44k|                            {
  585|       |
  586|  2.44k|                                cr2 = nCanonRankFrom[n2]; /*  found a candidate for cr2 */
  587|  2.44k|                            }
  588|  29.6k|                        }
  589|  10.7k|                    }
  590|  10.9k|                }
  591|  6.14k|            }
  592|  6.81k|        }
  593|  4.80k|        if (cr2 >= cr1)
  ------------------
  |  Branch (593:13): [True: 2.45k, False: 2.35k]
  ------------------
  594|  2.45k|        {
  595|       |            /*  not found for this r1 */
  596|  2.45k|            cr1++;
  597|  2.45k|            canon_rank2_inp = 0;
  598|  2.45k|        }
  599|  2.35k|        else
  600|  2.35k|        {
  601|       |             /* found cr2 < cr1 */
  602|  2.35k|            if (*bFirstTime)
  ------------------
  |  Branch (602:17): [True: 2.34k, False: 4]
  ------------------
  603|  2.34k|            {
  604|  2.34k|                *canon_rank1_min = cr1;
  605|  2.34k|                *canon_rank2_min = cr2;
  606|  2.34k|                *bFirstTime = 0;
  607|  2.34k|            }
  608|  2.35k|            break;
  609|  2.35k|        }
  610|  4.80k|    }
  611|  2.38k|    if (cr1 > cr2 && cr1 <= num_atoms)
  ------------------
  |  Branch (611:9): [True: 2.38k, False: 0]
  |  Branch (611:22): [True: 2.35k, False: 34]
  ------------------
  612|  2.35k|    {
  613|       |        /*  success */
  614|  2.35k|        *canon_rank1 = cr1;
  615|  2.35k|        *canon_rank2 = cr2;
  616|  2.35k|        return 1;
  617|  2.35k|    }
  618|       |
  619|     34|    return 0;
  620|  2.38k|}
NextStereoParity2Test:
  632|  2.38k|{
  633|       |    /* sequence of (stereo_bond_parity, sb_parity_calc) pairs:
  634|       |
  635|       |          (BEST_PARITY, BEST_PARITY)  <calc>
  636|       |                      |
  637|       |          (BEST_PARITY, WORSE_PARITY) <known>
  638|       |                      |
  639|       |          (WORSE_PARITY, WORSE_PARITY) <calc>                (BEST_PARITY, 0) <known>
  640|       |                       \___________________________________________/
  641|       |                                              |
  642|       |                                       (WORSE_PARITY, 0)   <known>
  643|       |                                              |
  644|       |                                       (AB_PARITY_UNKN, 0) <known>
  645|       |                                              |
  646|       |                                       (AB_PARITY_UNDF, 0) <known>
  647|       |                                              |
  648|       |                                       <next pair of ranks>
  649|       |      Meaning:
  650|       |      stereo_bond_parity is the parity we are looking for
  651|       |      stereo_bond_parity==sb_parity_calc  => parity to be calculated from canonical numbers
  652|       |      stereo_bond_parity!=sb_parity_calc  => parity is already known
  653|       |     */
  654|  4.71k|get_next_parity:
  655|  4.71k|    switch (*stereo_bond_parity)
  ------------------
  |  Branch (655:13): [True: 4.71k, False: 0]
  ------------------
  656|  4.71k|    {
  657|  3.11k|        case BEST_PARITY:
  ------------------
  |  |  828|  3.11k|#define BEST_PARITY        1  /* odd */
  ------------------
  |  Branch (657:9): [True: 3.11k, False: 1.59k]
  ------------------
  658|  3.11k|            switch (*sb_parity_calc)
  ------------------
  |  Branch (658:21): [True: 3.11k, False: 0]
  ------------------
  659|  3.11k|            {
  660|      7|                case 0:                                 /*  BEST_PARITY(known) : (BEST_PARITY, 0) -> */
  ------------------
  |  Branch (660:17): [True: 7, False: 3.11k]
  ------------------
  661|      7|                    *stereo_bond_parity = WORSE_PARITY;  /*  WORSE_PARITY(known): (WORSE_PARITY, 0) */
  ------------------
  |  |  829|      7|#define WORSE_PARITY       2
  ------------------
  662|      7|                    if (!nNumWorse)
  ------------------
  |  Branch (662:25): [True: 7, False: 0]
  ------------------
  663|      7|                    {
  664|      7|                        goto get_next_parity;
  665|      7|                    }
  666|      0|                    break;
  667|  1.55k|                case BEST_PARITY:                       /*  BEST_PARITY(calc) : (BEST_PARITY, BEST_PARITY) -> */
  ------------------
  |  |  828|  1.55k|#define BEST_PARITY        1  /* odd */
  ------------------
  |  Branch (667:17): [True: 1.55k, False: 1.56k]
  ------------------
  668|  1.55k|                    *sb_parity_calc = WORSE_PARITY;      /*  BEST_PARITY(known): (BEST_PARITY, WORSE_PARITY) */
  ------------------
  |  |  829|  1.55k|#define WORSE_PARITY       2
  ------------------
  669|  1.55k|                    if (!nNumBest)
  ------------------
  |  Branch (669:25): [True: 1.55k, False: 0]
  ------------------
  670|  1.55k|                    {
  671|  1.55k|                        goto get_next_parity;
  672|  1.55k|                    }
  673|      0|                    break;
  674|  1.55k|                case WORSE_PARITY:                      /*  BEST_PARITY(known): (BEST_PARITY, WORSE_PARITY)-> */
  ------------------
  |  |  829|  1.55k|#define WORSE_PARITY       2
  ------------------
  |  Branch (674:17): [True: 1.55k, False: 1.56k]
  ------------------
  675|  1.55k|                    *stereo_bond_parity = WORSE_PARITY;  /*  WORSE_PARITY(calc): (WORSE_PARITY,WORSE_PARITY) */
  ------------------
  |  |  829|  1.55k|#define WORSE_PARITY       2
  ------------------
  676|  1.55k|                    if (!nNumCalc)
  ------------------
  |  Branch (676:25): [True: 0, False: 1.55k]
  ------------------
  677|      0|                    { /* added 12-17-2003 */
  678|      0|                        goto get_next_parity;
  679|      0|                    }
  680|  1.55k|                    break;
  681|  3.11k|            }
  682|  1.55k|            break;
  683|  1.55k|        case WORSE_PARITY:
  ------------------
  |  |  829|    773|#define WORSE_PARITY       2
  ------------------
  |  Branch (683:9): [True: 773, False: 3.94k]
  ------------------
  684|    773|            switch (*sb_parity_calc)
  ------------------
  |  Branch (684:21): [True: 773, False: 0]
  ------------------
  685|    773|            {
  686|    390|                case 0:                                 /*  WORSE_PARITY(known)  : (WORSE_PARITY, 0) -> */
  ------------------
  |  Branch (686:17): [True: 390, False: 383]
  ------------------
  687|    390|                    *stereo_bond_parity = vABParityUnknown /* AB_PARITY_UNKN */;/*  AB_PARITY_UNKN(known): (AB_PARITY_UNKN, 0) */
  688|    390|                    if (!nNumUnkn)
  ------------------
  |  Branch (688:25): [True: 389, False: 1]
  ------------------
  689|    389|                    {
  690|    389|                        goto get_next_parity;
  691|    389|                    }
  692|      1|                    break;
  693|      1|                case BEST_PARITY:                       /*  error */
  ------------------
  |  |  828|      0|#define BEST_PARITY        1  /* odd */
  ------------------
  |  Branch (693:17): [True: 0, False: 773]
  ------------------
  694|      0|                    return CT_STEREOCOUNT_ERR;          /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  695|    383|                case WORSE_PARITY:                      /*  WORSE_PARITY(calc) : (WORSE_PARITY,WORSE_PARITY)-> */
  ------------------
  |  |  829|    383|#define WORSE_PARITY       2
  ------------------
  |  Branch (695:17): [True: 383, False: 390]
  ------------------
  696|    383|                    *sb_parity_calc = 0;                 /*  WORSE_PARITY(known): (WORSE_PARITY, 0) */
  697|    383|                    if (!nNumWorse)
  ------------------
  |  Branch (697:25): [True: 383, False: 0]
  ------------------
  698|    383|                    {
  699|    383|                        goto get_next_parity;
  700|    383|                    }
  701|      0|                    break;
  702|    773|            }
  703|      1|            break;
  704|       |
  705|     28|        case AB_PARITY_UNKN:                        /* AB_PARITY_UNKN(known): (AB_PARITY_UNKN, 0) -> */
  ------------------
  |  |  221|     28|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
  |  Branch (705:9): [True: 28, False: 4.69k]
  ------------------
  706|     28|            if (*sb_parity_calc)                 /*  error */
  ------------------
  |  Branch (706:17): [True: 0, False: 28]
  ------------------
  707|      0|            {
  708|      0|                return CT_STEREOCOUNT_ERR;          /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  709|      0|            }
  710|     28|            *stereo_bond_parity = AB_PARITY_UNDF;    /* AB_PARITY_UNDF(known): (AB_PARITY_UNDF, 0) */
  ------------------
  |  |  222|     28|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  711|     28|            if (!nNumUndf)
  ------------------
  |  Branch (711:17): [True: 28, False: 0]
  ------------------
  712|     28|            {
  713|     28|                return 1; /*goto next_canon_ranks;*/
  714|     28|            }
  715|      0|            break;
  716|       |
  717|    798|        case AB_PARITY_UNDF:                        /*  AB_PARITY_UNDF(known): (AB_PARITY_UNDF, 0) -> */
  ------------------
  |  |  222|    798|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (717:9): [True: 798, False: 3.92k]
  ------------------
  718|    798|            if (*sb_parity_calc)
  ------------------
  |  Branch (718:17): [True: 0, False: 798]
  ------------------
  719|      0|            {                /*  error */
  720|      0|                return CT_STEREOCOUNT_ERR;          /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  721|      0|            }
  722|    798|            return 1; /*goto next_canon_ranks;*/     /*  next canon ranks */
  723|  4.71k|    }
  724|  1.55k|    return 0;
  725|  4.71k|}
CompareLinCtStereoDoubleToValues:
  733|  4.23k|{
  734|  4.23k|    if (LinearCTStereoDble->at_num1 CT_GREATER_THAN at_rank_canon1)
  ------------------
  |  Branch (734:9): [True: 163, False: 4.07k]
  ------------------
  735|    163|    {
  736|    163|        return 1;
  737|    163|    }
  738|  4.07k|    if (LinearCTStereoDble->at_num1 != at_rank_canon1)
  ------------------
  |  Branch (738:9): [True: 34, False: 4.03k]
  ------------------
  739|     34|    {
  740|     34|        return -1;
  741|     34|    }
  742|  4.03k|    if (LinearCTStereoDble->at_num2 CT_GREATER_THAN at_rank_canon2)
  ------------------
  |  Branch (742:9): [True: 14, False: 4.02k]
  ------------------
  743|     14|    {
  744|     14|        return 1;
  745|     14|    }
  746|  4.02k|    if (LinearCTStereoDble->at_num2 != at_rank_canon2)
  ------------------
  |  Branch (746:9): [True: 10, False: 4.01k]
  ------------------
  747|     10|    {
  748|     10|        return -1;
  749|     10|    }
  750|  4.01k|    if (LinearCTStereoDble->parity CT_GREATER_THAN bond_parity)
  ------------------
  |  Branch (750:9): [True: 183, False: 3.83k]
  ------------------
  751|    183|    {
  752|    183|        return 1;
  753|    183|    }
  754|  3.83k|    if (LinearCTStereoDble->parity != bond_parity)
  ------------------
  |  Branch (754:9): [True: 141, False: 3.69k]
  ------------------
  755|    141|    {
  756|    141|        return -1;
  757|    141|    }
  758|       |
  759|  3.69k|    return 0;
  760|  3.83k|}
SetUseAtomForStereo:
  770|  1.73k|{
  771|  1.73k|    int i, k;
  772|  1.73k|    memset( bAtomUsedForStereo, 0, sizeof( bAtomUsedForStereo[0] )*num_atoms ); /* djb-rwth: memset_s C11/Annex K variant? */
  773|  12.0k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (773:17): [True: 10.3k, False: 1.73k]
  ------------------
  774|  10.3k|    {
  775|  10.3k|        if (at[i].parity)
  ------------------
  |  Branch (775:13): [True: 4.99k, False: 5.35k]
  ------------------
  776|  4.99k|        {
  777|  7.64k|            for (k = 0; k < MAX_NUM_STEREO_BONDS && at[i].stereo_bond_neighbor[k]; k++)
  ------------------
  |  |  873|  15.2k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (777:25): [True: 7.64k, False: 0]
  |  Branch (777:53): [True: 2.65k, False: 4.99k]
  ------------------
  778|  2.65k|            {
  779|  2.65k|                ;
  780|  2.65k|            }
  781|  4.99k|            bAtomUsedForStereo[i] = k ? k : STEREO_AT_MARK;
  ------------------
  |  |  878|  8.27k|#define STEREO_AT_MARK            8 /* > MAX_NUM_STEREO_BONDS */
  ------------------
  |  Branch (781:37): [True: 1.71k, False: 3.28k]
  ------------------
  782|  4.99k|        }
  783|  10.3k|    }
  784|  1.73k|}
CurTreeAlloc:
  789|  1.14k|{
  790|  1.14k|    if (cur_tree)
  ------------------
  |  Branch (790:9): [True: 1.14k, False: 0]
  ------------------
  791|  1.14k|    {
  792|  1.14k|        if (cur_tree->tree && cur_tree->max_len > 0 && !( cur_tree->max_len % num_atoms ))
  ------------------
  |  Branch (792:13): [True: 221, False: 926]
  |  Branch (792:31): [True: 221, False: 0]
  |  Branch (792:56): [True: 221, False: 0]
  ------------------
  793|    221|        {
  794|       |            /*  do not reallocate */
  795|    221|            cur_tree->cur_len = 0;
  796|    221|            cur_tree->incr_len = num_atoms;
  797|    221|            memset( cur_tree->tree, 0, cur_tree->max_len * sizeof( cur_tree->tree[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  798|    221|            return 0; /*  ok */
  799|    221|        }
  800|    926|        inchi_free( cur_tree->tree );
  ------------------
  |  | 1152|    926|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 926]
  |  |  |  Branch (1152:50): [Folded, False: 926]
  |  |  ------------------
  ------------------
  801|    926|        memset( cur_tree, 0, sizeof( *cur_tree ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  802|    926|        if ((cur_tree->tree = (AT_NUMB *) inchi_calloc( num_atoms, sizeof( cur_tree->tree[0] ) ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 1146|    926|#define inchi_calloc   calloc
  ------------------
  |  Branch (802:13): [True: 926, False: 0]
  ------------------
  803|    926|        {
  804|    926|            cur_tree->incr_len =
  805|    926|                cur_tree->max_len = num_atoms;
  806|    926|            return 0; /*  ok */
  807|    926|        }
  808|    926|    }
  809|       |
  810|      0|    return -1; /*  error */ /*   <BRKPT> */
  811|  1.14k|}
CurTreeReAlloc:
  816|    201|{
  817|    201|    if (cur_tree)
  ------------------
  |  Branch (817:9): [True: 201, False: 0]
  ------------------
  818|    201|    {
  819|    201|        if (cur_tree->tree && cur_tree->max_len > 0 && cur_tree->incr_len > 0)
  ------------------
  |  Branch (819:13): [True: 201, False: 0]
  |  Branch (819:31): [True: 201, False: 0]
  |  Branch (819:56): [True: 201, False: 0]
  ------------------
  820|    201|        {
  821|    201|            void *p = cur_tree->tree;
  822|    201|            if ((cur_tree->tree = (AT_NUMB *) inchi_calloc( (long long)cur_tree->max_len + (long long)cur_tree->incr_len, sizeof( cur_tree->tree[0] ) ))) /* djb-rwth: cast operators added; addressing LLVM warning */
  ------------------
  |  | 1146|    201|#define inchi_calloc   calloc
  ------------------
  |  Branch (822:17): [True: 201, False: 0]
  ------------------
  823|    201|            {
  824|    201|                memcpy(cur_tree->tree, p, cur_tree->cur_len * sizeof(cur_tree->tree[0]));
  825|    201|                inchi_free( p );
  ------------------
  |  | 1152|    201|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 201, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 201]
  |  |  ------------------
  ------------------
  826|    201|                cur_tree->max_len += cur_tree->incr_len;
  827|    201|                return 0; /*  ok */
  828|    201|            }
  829|    201|        }
  830|    201|    }
  831|       |
  832|      0|    return -1; /*  error */ /*   <BRKPT> */
  833|    201|}
CurTreeFree:
  837|   288k|{
  838|   288k|    if (cur_tree)
  ------------------
  |  Branch (838:9): [True: 926, False: 287k]
  ------------------
  839|    926|    {
  840|    926|        inchi_free( cur_tree->tree );
  ------------------
  |  | 1152|    926|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 926, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 926]
  |  |  ------------------
  ------------------
  841|    926|        memset( cur_tree, 0, sizeof( *cur_tree ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  842|    926|    }
  843|   288k|}
CurTreeAddRank:
  847|  6.15k|{
  848|  6.15k|    if (cur_tree)
  ------------------
  |  Branch (848:9): [True: 6.15k, False: 0]
  ------------------
  849|  6.15k|    {
  850|  6.15k|        if (cur_tree->cur_len + 2 > cur_tree->max_len)
  ------------------
  |  Branch (850:13): [True: 47, False: 6.10k]
  ------------------
  851|     47|        {
  852|     47|            if (CurTreeReAlloc( cur_tree ))
  ------------------
  |  Branch (852:17): [True: 0, False: 47]
  ------------------
  853|      0|            {
  854|      0|                return -1; /*  error */ /*   <BRKPT> */
  855|      0|            }
  856|     47|        }
  857|  6.15k|        cur_tree->tree[cur_tree->cur_len++] = rank;
  858|  6.15k|        cur_tree->tree[cur_tree->cur_len++] = 1;
  859|  6.15k|        return 0;
  860|  6.15k|    }
  861|       |
  862|      0|    return -1;  /*  error  */ /*   <BRKPT> */
  863|  6.15k|}
CurTreeIsLastRank:
  868|  16.8k|{
  869|  16.8k|    if (cur_tree && cur_tree->cur_len > 0)
  ------------------
  |  Branch (869:9): [True: 16.8k, False: 0]
  |  Branch (869:21): [True: 16.8k, False: 0]
  ------------------
  870|  16.8k|    {
  871|  16.8k|        int rank_pos;
  872|  16.8k|        rank_pos = cur_tree->cur_len - 1;
  873|  16.8k|        rank_pos -= cur_tree->tree[rank_pos];
  874|  16.8k|        if (rank_pos >= 0)
  ------------------
  |  Branch (874:13): [True: 16.8k, False: 0]
  ------------------
  875|  16.8k|        {
  876|  16.8k|            return ( rank == cur_tree->tree[rank_pos] );
  877|  16.8k|        }
  878|  16.8k|    }
  879|       |
  880|      0|    return 0;  /*  not found */
  881|  16.8k|}
CurTreeRemoveLastRankIfNoAtoms:
  886|  2.98k|{
  887|  2.98k|    if (cur_tree && cur_tree->tree && cur_tree->cur_len >= 2)
  ------------------
  |  Branch (887:9): [True: 2.98k, False: 0]
  |  Branch (887:21): [True: 2.98k, False: 0]
  |  Branch (887:39): [True: 2.98k, False: 0]
  ------------------
  888|  2.98k|    {
  889|  2.98k|        if (1 == cur_tree->tree[cur_tree->cur_len - 1])
  ------------------
  |  Branch (889:13): [True: 2.60k, False: 379]
  ------------------
  890|  2.60k|        {
  891|  2.60k|            return CurTreeRemoveLastRank( cur_tree ); /*  0=> success, -1=>failed */
  892|  2.60k|        }
  893|    379|        return 1; /*  cannot remove */
  894|  2.98k|    }
  895|      0|    return -1; /*  error */ /*   <BRKPT> */
  896|  2.98k|}
CurTreeAddAtom:
  901|  7.19k|{
  902|  7.19k|    if (cur_tree)
  ------------------
  |  Branch (902:9): [True: 7.19k, False: 0]
  ------------------
  903|  7.19k|    {
  904|  7.19k|        if (cur_tree->cur_len + 1 > cur_tree->max_len)
  ------------------
  |  Branch (904:13): [True: 154, False: 7.03k]
  ------------------
  905|    154|        {
  906|    154|            if (CurTreeReAlloc( cur_tree ))
  ------------------
  |  Branch (906:17): [True: 0, False: 154]
  ------------------
  907|      0|            {
  908|      0|                return -1; /*  error */ /*   <BRKPT> */
  909|      0|            }
  910|    154|        }
  911|  7.19k|        if (cur_tree->cur_len > 0)
  ------------------
  |  Branch (911:13): [True: 7.19k, False: 0]
  ------------------
  912|  7.19k|        {
  913|  7.19k|            AT_NUMB new_len = cur_tree->tree[--cur_tree->cur_len] + 1;
  914|  7.19k|            cur_tree->tree[cur_tree->cur_len++] = (AT_NUMB) at_no;
  915|  7.19k|            cur_tree->tree[cur_tree->cur_len++] = new_len;
  916|  7.19k|            return 0;
  917|  7.19k|        }
  918|  7.19k|    }
  919|       |
  920|      0|    return -1;
  921|  7.19k|}
CurTreeKeepLastAtomsOnly:
  926|  4.44k|{   /*  on first entry: shift = 1; other values may occur in subsequent recursion */
  927|       |    /*  cur_tree[cur_tree->cur_len - shift] is the length of a segment */
  928|       |    /*  action: remove all atoms except the last from all segments
  929|       |                that have length value positon to the right from tpos */
  930|  4.44k|    int cur_length_pos;
  931|  4.44k|    if (cur_tree && cur_tree->tree && ( cur_length_pos = cur_tree->cur_len - shift ) > tpos)
  ------------------
  |  Branch (931:9): [True: 4.44k, False: 0]
  |  Branch (931:21): [True: 4.44k, False: 0]
  |  Branch (931:39): [True: 1.95k, False: 2.49k]
  ------------------
  932|  1.95k|    {
  933|  1.95k|        if (cur_tree->tree[cur_length_pos] > 2)
  ------------------
  |  Branch (933:13): [True: 155, False: 1.79k]
  ------------------
  934|    155|        {
  935|       |            /*  current segment contains more than 1 atom. Leave in the segment: rank, the last atom, length value */
  936|       |            /*  subtract (old segment length)-(new segment length) from the tree length  */
  937|       |            /*  actual segment length including segment length value = (cur_tree->tree[cur_length_pos]+1) */
  938|    155|            cur_tree->cur_len -= (int) cur_tree->tree[cur_length_pos] - 2;
  939|    155|            memmove(cur_tree->tree + cur_length_pos - cur_tree->tree[cur_length_pos] + 1, /*  1st atom pos */
  940|    155|                cur_tree->tree + cur_length_pos - 1,  /*  last atom in the current segment position */
  941|    155|                ((long long)shift + 1) * sizeof(cur_tree->tree[0])); /* djb-rwth: cast operator added */
  942|       |            /*  (current segment length) distance from the last tree element has not changed */
  943|    155|            cur_tree->tree[cur_tree->cur_len - shift] = 2;
  944|       |            /*  add 3 to move to the previous segment length position */
  945|    155|            shift += 3; /*  lenghth = 3 accounts for 3 currently present. segment items:
  946|       |                            (1) the last atom, (2) rank, (3) length value */
  947|    155|        }
  948|  1.79k|        else
  949|  1.79k|        {
  950|  1.79k|            shift += (int) cur_tree->tree[cur_length_pos] + 1; /*  cur_tree->cur_len - (previous segment length position) */
  951|  1.79k|        }
  952|  1.95k|        CurTreeKeepLastAtomsOnly( cur_tree, tpos, shift );
  953|  1.95k|    }
  954|  4.44k|}
CurTreeRemoveIfLastAtom:
  959|  2.98k|{
  960|  2.98k|    if (cur_tree && cur_tree->tree && cur_tree->cur_len > 2)
  ------------------
  |  Branch (960:9): [True: 2.98k, False: 0]
  |  Branch (960:21): [True: 2.98k, False: 0]
  |  Branch (960:39): [True: 2.98k, False: 0]
  ------------------
  961|  2.98k|    {
  962|  2.98k|        AT_NUMB len = cur_tree->tree[cur_tree->cur_len - 1];
  963|  2.98k|        if (len >= 2 && (int) cur_tree->tree[cur_tree->cur_len - 2] == at_no)
  ------------------
  |  Branch (963:13): [True: 2.98k, False: 0]
  |  Branch (963:25): [True: 2.79k, False: 182]
  ------------------
  964|  2.79k|        {
  965|  2.79k|            cur_tree->tree[--cur_tree->cur_len - 1] = len - 1;
  966|  2.79k|            return 0;
  967|  2.79k|        }
  968|    182|        return 1; /*  not found */
  969|  2.98k|    }
  970|       |
  971|      0|    return -1; /*  error */ /*   <BRKPT> */
  972|  2.98k|}
CurTreeGetPos:
  977|  56.2k|{
  978|  56.2k|    if (cur_tree)
  ------------------
  |  Branch (978:9): [True: 56.2k, False: 0]
  ------------------
  979|  56.2k|    {
  980|  56.2k|        return cur_tree->cur_len;
  981|  56.2k|    }
  982|       |
  983|      0|    return -1;
  984|  56.2k|}
CurTreeSetPos:
  989|  21.1k|{
  990|  21.1k|    if (cur_tree)
  ------------------
  |  Branch (990:9): [True: 21.1k, False: 0]
  ------------------
  991|  21.1k|    {
  992|  21.1k|        cur_tree->cur_len = len;
  993|  21.1k|        return 0;
  994|  21.1k|    }
  995|       |
  996|      0|    return -1;
  997|  21.1k|}
CurTreeRemoveLastRank:
 1002|  5.95k|{
 1003|  5.95k|    if (cur_tree && cur_tree->cur_len > 0)
  ------------------
  |  Branch (1003:9): [True: 5.95k, False: 0]
  |  Branch (1003:21): [True: 5.95k, False: 0]
  ------------------
 1004|  5.95k|    {
 1005|  5.95k|        cur_tree->cur_len -= cur_tree->tree[cur_tree->cur_len - 1] + 1;
 1006|  5.95k|        if (cur_tree->cur_len >= 0)
  ------------------
  |  Branch (1006:13): [True: 5.95k, False: 0]
  ------------------
 1007|  5.95k|        {
 1008|  5.95k|            return 0;
 1009|  5.95k|        }
 1010|  5.95k|    }
 1011|       |
 1012|      0|    return -1;
 1013|  5.95k|}
CurTreeIsLastAtomEqu:
 1020|  1.50k|{
 1021|  1.50k|    if (cur_tree && cur_tree->tree && nSymmStereo && cur_tree->cur_len > 1)
  ------------------
  |  Branch (1021:9): [True: 1.50k, False: 0]
  |  Branch (1021:21): [True: 1.50k, False: 0]
  |  Branch (1021:39): [True: 1.50k, False: 0]
  |  Branch (1021:54): [True: 1.50k, False: 0]
  ------------------
 1022|  1.50k|    {
 1023|  1.50k|        AT_NUMB nEq = nSymmStereo[at_no];
 1024|  1.50k|        int end = cur_tree->cur_len - 1;
 1025|  1.50k|        int len = cur_tree->tree[end] - 1;
 1026|  2.82k|        for (; len > 0; len--)
  ------------------
  |  Branch (1026:16): [True: 1.60k, False: 1.21k]
  ------------------
 1027|  1.60k|        {
 1028|  1.60k|            if (nSymmStereo[(int) cur_tree->tree[end - len]] == nEq)
  ------------------
  |  Branch (1028:17): [True: 286, False: 1.32k]
  ------------------
 1029|    286|                return 1;
 1030|  1.60k|        }
 1031|  1.21k|        return 0;
 1032|  1.50k|    }
 1033|       |
 1034|      0|    return -1; /*  error */ /*   <BRKPT> */
 1035|  1.50k|}

SortedEquInfoToRanks:
  114|   262k|{
  115|       |    /* v. 1.05 - changed declaration of nNumDiffRanks as suggested by Burt Leland
  116|       |                 to avoid the problem arising on compilation with VS2015
  117|       |
  118|       |    AT_RANK        rNew, rOld, nNumDiffRanks;*/
  119|   262k|    AT_RANK        rNew, rOld;
  120|   262k|    int            nNumDiffRanks = 1;
  121|       |
  122|       |
  123|   262k|    int            i, j, nNumChanges = 0, i_init;
  124|       |
  125|   262k|    i_init = num_atoms - 1;
  126|       |    /* djb-rwth: fixing oss-fuzz issue #69965 */
  127|   262k|    if (i_init >= 0)
  ------------------
  |  Branch (127:9): [True: 262k, False: 0]
  ------------------
  128|   262k|    {
  129|   262k|        j = (int)nAtomNumber[i_init];
  130|   262k|        rOld = nSymmRank[j];
  131|   262k|        rNew = (AT_RANK)num_atoms;
  132|   262k|        nRank[j] = (AT_RANK)num_atoms;
  133|   262k|        nNumDiffRanks = 1;
  134|  1.10M|        for (i = i_init; i > 0; i--)
  ------------------
  |  Branch (134:26): [True: 843k, False: 262k]
  ------------------
  135|   843k|        {
  136|   843k|            j = (int)nAtomNumber[i - 1];
  137|       |
  138|   843k|            if (nSymmRank[j] != rOld)
  ------------------
  |  Branch (138:17): [True: 440k, False: 403k]
  ------------------
  139|   440k|            {
  140|   440k|                nNumDiffRanks++;
  141|   440k|                rNew = (AT_RANK)i;
  142|   440k|                nNumChanges += (rOld != rNew + 1);
  143|   440k|                rOld = nSymmRank[j];
  144|   440k|            }
  145|       |
  146|   843k|            nRank[j] = rNew;
  147|   843k|        }
  148|   262k|    }
  149|   262k|    if (bChanged)
  ------------------
  |  Branch (149:9): [True: 253k, False: 9.73k]
  ------------------
  150|   253k|    {
  151|   253k|        *bChanged = ( 0 != nNumChanges );
  152|   253k|    }
  153|       |
  154|   262k|    return nNumDiffRanks;
  155|   262k|}
SortedRanksToEquInfo:
  165|      7|{
  166|       |    /* v. 1.05 - changed declaration of nNumDiffRanks as suggested by Burt Leland
  167|       |                 to avoid the problem arising on compilation with VS2015
  168|       |
  169|       |    AT_RANK        rNew, rOld, nNumDiffRanks;*/
  170|      7|    AT_RANK        rNew, rOld;
  171|      7|    int nNumDiffRanks = 1;
  172|       |
  173|      7|    int            i, j;
  174|      7|    for (i = 1, j = (int) nAtomNumber[0],
  175|      7|          rOld = nRank[j], rNew = nSymmRank[j] = 1,
  176|      7|          nNumDiffRanks = 1;
  177|     56|            i < num_atoms;
  ------------------
  |  Branch (177:13): [True: 49, False: 7]
  ------------------
  178|     49|                        i++)
  179|     49|    {
  180|     49|        j = (int) nAtomNumber[i];
  181|     49|        if (nRank[j] != rOld)
  ------------------
  |  Branch (181:13): [True: 16, False: 33]
  ------------------
  182|     16|        {
  183|     16|            nNumDiffRanks++;
  184|     16|            rNew = (AT_RANK) ( i + 1 );
  185|     16|            rOld = nRank[j];
  186|     16|        }
  187|     49|        nSymmRank[j] = rNew;
  188|     49|    }
  189|       |
  190|      7|    return nNumDiffRanks;
  191|      7|}
switch_ptrs:
  196|  6.71M|{
  197|  6.71M|    AT_RANK *tmp = *p1;
  198|  6.71M|    *p1 = *p2;
  199|  6.71M|    *p2 = tmp;
  200|  6.71M|}
SetNewRanksFromNeighLists3:
  212|  4.99M|{
  213|  4.99M|    int     i, j, k, nNumDiffRanks, nNumNewRanks;
  214|  4.99M|    AT_RANK r1, r2;
  215|       |
  216|       |    /*  -- nAtomNumber[] is already properly set --
  217|       |    for ( i = 0; i < num_atoms; i++ ) {
  218|       |        nAtomNumber[i] = (AT_RANK)i;
  219|       |    }
  220|       |    */
  221|       |    /*  set globals for qsort */
  222|       |
  223|  4.99M|    pCG->m_pNeighList_RankForSort = NeighList;
  224|  4.99M|    pCG->m_pn_RankForSort = nRank;
  225|  4.99M|    nNumDiffRanks = 0;
  226|  4.99M|    nNumNewRanks = 0;
  227|       |
  228|  4.99M|    memset( nNewRank, 0, num_atoms * sizeof( nNewRank[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  229|       |
  230|       |    /*  sorting */
  231|   524M|    for (i = 0, r1 = 1; i < num_atoms; r1++)
  ------------------
  |  Branch (231:25): [True: 519M, False: 4.99M]
  ------------------
  232|   519M|    {
  233|   519M|        j = (int)nAtomNumber[i];
  234|   519M|        r2 = nRank[j];
  235|   519M|        if (r1 == r2)
  ------------------
  |  Branch (235:13): [True: 508M, False: 10.5M]
  ------------------
  236|   508M|        {
  237|   508M|            nNewRank[j] = r2;
  238|   508M|            nNumDiffRanks++;
  239|   508M|            i++;
  240|   508M|            continue;
  241|   508M|        }
  242|  10.5M|        r1 = r2;
  243|  10.5M|        insertions_sort_AT_NUMBERS( pCG, nAtomNumber + i, (int) r2 - i, CompNeighLists );
  244|       |        /*insertions_sort( nAtomNumber+i, r2-i, sizeof( nAtomNumber[0] ), CompNeighLists );*/
  245|  10.5M|        j = r2 - 1;
  246|  10.5M|        k = (int)nAtomNumber[j];
  247|  10.5M|        nNewRank[k] = r2;
  248|  10.5M|        nNumDiffRanks++;
  249|   254M|        while (j > i)
  ------------------
  |  Branch (249:16): [True: 243M, False: 10.5M]
  ------------------
  250|   243M|        {
  251|   243M|            if (CompareNeighListLex( NeighList[(int) nAtomNumber[j - 1]],
  ------------------
  |  Branch (251:17): [True: 11.1k, False: 243M]
  ------------------
  252|   243M|                NeighList[(int) nAtomNumber[j]], nRank ))
  253|  11.1k|            {
  254|  11.1k|                r2 = j;
  255|  11.1k|                nNumDiffRanks++;
  256|  11.1k|                nNumNewRanks++;
  257|  11.1k|            }
  258|   243M|            j--;
  259|   243M|            nNewRank[(int) nAtomNumber[j]] = r2;
  260|   243M|        }
  261|  10.5M|        i = r1;
  262|  10.5M|    }
  263|       |
  264|  4.99M|    return nNumNewRanks ? -nNumDiffRanks : nNumDiffRanks;
  ------------------
  |  Branch (264:12): [True: 11.0k, False: 4.98M]
  ------------------
  265|  4.99M|}
SetNewRanksFromNeighLists4:
  280|  1.30M|{
  281|  1.30M|    int     i, j, nNumDiffRanks, nNumNewRanks;
  282|  1.30M|    AT_RANK r1, r2;
  283|       |    /*  -- nAtomNumber[] is already properly set --
  284|       |    for ( i = 0; i < num_atoms; i++ ) {
  285|       |        nAtomNumber[i] = (AT_RANK)i;
  286|       |    }
  287|       |    */
  288|       |
  289|       |    /*  set globals for CompNeighListsUpToMaxRank */
  290|  1.30M|    pCG->m_pNeighList_RankForSort = NeighList;
  291|  1.30M|    pCG->m_pn_RankForSort = nRank;
  292|  1.30M|    nNumDiffRanks = 0;
  293|  1.30M|    nNumNewRanks = 0;
  294|  1.30M|    pCG->m_nMaxAtNeighRankForSort = nMaxAtRank;
  295|       |
  296|  1.30M|    memset( nNewRank, 0, num_atoms * sizeof( nNewRank[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  297|       |
  298|       |    /*  sorting */
  299|   131M|    for (i = 0, r1 = 1; i < num_atoms; r1++)
  ------------------
  |  Branch (299:25): [True: 129M, False: 1.30M]
  ------------------
  300|   129M|    {
  301|   129M|        if (r1 == ( r2 = nRank[j = (int) nAtomNumber[i]] ))
  ------------------
  |  Branch (301:13): [True: 126M, False: 2.82M]
  ------------------
  302|   126M|        {
  303|       |            /* non-tied rank: singleton */
  304|   126M|            nNewRank[j] = r2;
  305|   126M|            nNumDiffRanks++;
  306|   126M|            i++;
  307|   126M|            continue;
  308|   126M|        }
  309|       |        /* tied rank r2
  310|       |           r2-i atoms have rank r2
  311|       |           next atom after them is in position r2
  312|       |        */
  313|  2.82M|        r1 = r2;
  314|       |
  315|  2.82M|        insertions_sort_AT_NUMBERS( pCG, nAtomNumber + i,
  316|  2.82M|            (int) r2 - i, CompNeighListsUpToMaxRank );
  317|       |        /*insertions_sort( nAtomNumber+i, r2-i, sizeof( nAtomNumber[0] ),  CompNeighListsUpToMaxRank );*/
  318|       |
  319|  2.82M|        j = r2 - 1; /* prepare cycle backward, from j to i step -1 */
  320|  2.82M|        nNewRank[(int) nAtomNumber[j]] = r2;
  321|  2.82M|        nNumDiffRanks++;
  322|  62.6M|        while (j > i)
  ------------------
  |  Branch (322:16): [True: 59.7M, False: 2.82M]
  ------------------
  323|  59.7M|        {
  324|  59.7M|            if (CompareNeighListLexUpToMaxRank( NeighList[nAtomNumber[j - 1]],
  ------------------
  |  Branch (324:17): [True: 3.74k, False: 59.7M]
  ------------------
  325|  59.7M|                NeighList[nAtomNumber[j]], nRank, nMaxAtRank ))
  326|  3.74k|            {
  327|  3.74k|                r2 = j;
  328|  3.74k|                nNumDiffRanks++;
  329|  3.74k|                nNumNewRanks++;
  330|  3.74k|            }
  331|  59.7M|            j--;
  332|  59.7M|            nNewRank[(int) nAtomNumber[j]] = r2;
  333|  59.7M|        }
  334|  2.82M|        i = r1;
  335|  2.82M|    }
  336|       |
  337|  1.30M|    return nNumNewRanks ? -nNumDiffRanks : nNumDiffRanks;
  ------------------
  |  Branch (337:12): [True: 3.73k, False: 1.30M]
  ------------------
  338|  1.30M|}
SetNewRanksFromNeighLists:
  353|   406k|{
  354|   406k|    int     i, nNumDiffRanks, j;
  355|   406k|    AT_RANK nCurrentRank;
  356|       |    /*  -- nAtomNumber[] is already properly set --
  357|       |    for ( i = 0; i < num_atoms; i++ ) {
  358|       |        nAtomNumber[i] = (AT_RANK)i;
  359|       |    }
  360|       |    */
  361|       |
  362|       |    /*  set globals for qsort */
  363|   406k|    pCG->m_pNeighList_RankForSort = NeighList;
  364|   406k|    pCG->m_pn_RankForSort = nRank;
  365|       |
  366|       |    /*  sorting */
  367|   406k|    if (bUseAltSort & 1)
  ------------------
  |  Branch (367:9): [True: 406k, False: 0]
  ------------------
  368|   406k|        tsort( pCG, nAtomNumber, num_atoms, sizeof( nAtomNumber[0] ), comp /*CompNeighListRanksOrd*/ );
  ------------------
  |  |   18|   406k|#define tsort insertions_sort
  ------------------
  369|      0|    else
  370|      0|        inchi_qsort( pCG, nAtomNumber, num_atoms, sizeof( nAtomNumber[0] ), comp /*CompNeighListRanksOrd*/ );
  371|       |
  372|       |    /* djb-rwth: fixing oss-fuzz issue #69315 */
  373|   406k|    nNumDiffRanks = 1;
  374|   406k|    if (num_atoms > 0)
  ------------------
  |  Branch (374:9): [True: 406k, False: 0]
  ------------------
  375|   406k|    {
  376|   406k|        nCurrentRank = (AT_RANK)num_atoms;
  377|   406k|        j = num_atoms - 1;
  378|   406k|        nNewRank[(int)nAtomNumber[j]] = nCurrentRank;
  379|       |        
  380|  1.73M|        for (i = num_atoms - 1; i > 0; i--)
  ------------------
  |  Branch (380:33): [True: 1.33M, False: 406k]
  ------------------
  381|  1.33M|        {
  382|       |            /*  Note: CompNeighListRanks() in following line implicitly reads nRank pointed by pn_RankForSort */
  383|  1.33M|            if (CompNeighListRanks(&nAtomNumber[i - 1], &nAtomNumber[i], pCG))
  ------------------
  |  Branch (383:17): [True: 799k, False: 531k]
  ------------------
  384|   799k|            {
  385|   799k|                nNumDiffRanks++;
  386|   799k|                nCurrentRank = (AT_RANK)i;
  387|   799k|            }
  388|  1.33M|            nNewRank[(int)nAtomNumber[i - 1]] = nCurrentRank;
  389|  1.33M|        }
  390|   406k|    }
  391|       |
  392|   406k|    return nNumDiffRanks;
  393|   406k|}
SortNeighListsBySymmAndCanonRank:
  403|  25.2k|{
  404|  25.2k|    int i;
  405|   159k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (405:17): [True: 134k, False: 25.2k]
  ------------------
  406|   134k|    {
  407|   134k|        insertions_sort_NeighListBySymmAndCanonRank( NeighList[i], nSymmRank, nCanonRank );
  408|   134k|    }
  409|  25.2k|}
SortNeighLists2:
  417|   406k|{
  418|   406k|    int k, i;
  419|   406k|    AT_RANK nPrevRank = 0; /* djb-rwth: ignoring LLVM warning: variable used */
  420|       |    /*
  421|       |     * on entry nRank[nAtomNumber[k]] <= nRank[nAtomNumber[k+1]]  ( k < num_atoms-1 )
  422|       |     *          nRank[nAtomNumber[k]] >= k+1                      ( k < num_atoms )
  423|       |     *          nRank[nAtomNumber[k]] == k+1 if this nRank value is not tied OR if
  424|       |     *                nRank[nAtomNumber[k]] < nRank[nAtomNumber[k+1]] OR if k = num_atoms-1.
  425|       |     *
  426|       |     */
  427|  2.14M|    for (k = 0; k < num_atoms; k++)
  ------------------
  |  Branch (427:17): [True: 1.73M, False: 406k]
  ------------------
  428|  1.73M|    {
  429|  1.73M|        i = nAtomNumber[k];
  430|  1.73M|#ifdef FIX_STEREOCOUNT_ERR
  431|  1.73M|        if (NeighList[i][0] > 1)
  ------------------
  |  Branch (431:13): [True: 730k, False: 1.00M]
  ------------------
  432|       |#else
  433|       |        if (( nRank[i] != k + 1 || nRank[i] == nPrevRank ) && NeighList[i][0] > 1)
  434|       |#endif
  435|   730k|        {
  436|       |            /*  nRank[i] is tied (duplicated) */
  437|   730k|            insertions_sort_NeighList_AT_NUMBERS( NeighList[i], nRank );
  438|   730k|        }
  439|  1.73M|        nPrevRank = nRank[i]; /* djb-rwth: ignoring LLVM warning: variable used */
  440|  1.73M|    }
  441|       |
  442|   406k|    return 0;
  443|   406k|}
SortNeighLists3:
  451|  6.30M|{
  452|  6.30M|    int k, i;
  453|  6.30M|    AT_RANK nPrevRank = 0;
  454|       |    /*
  455|       |     * on entry nRank[nAtomNumber[k]] <= nRank[nAtomNumber[k+1]]  ( k < num_atoms-1 )
  456|       |     *          nRank[nAtomNumber[k]] >= k+1                      ( k < num_atoms )
  457|       |     *          nRank[nAtomNumber[k]] == k+1 if this nRank value is not tied OR if
  458|       |     *                nRank[nAtomNumber[k]] < nRank[nAtomNumber[k+1]] OR if k = num_atoms-1.
  459|       |     *
  460|       |     */
  461|   958M|    for (k = 0; k < num_atoms; k++)
  ------------------
  |  Branch (461:17): [True: 952M, False: 6.30M]
  ------------------
  462|   952M|    {
  463|   952M|        i = nAtomNumber[k];
  464|   952M|        if (( nRank[i] != k + 1 || nRank[i] == nPrevRank ) && NeighList[i][0] > 1)
  ------------------
  |  Branch (464:15): [True: 303M, False: 648M]
  |  Branch (464:36): [True: 13.3M, False: 635M]
  |  Branch (464:63): [True: 77.8k, False: 316M]
  ------------------
  465|  77.8k|        {
  466|       |            /*  nRank[i] is tied (duplicated) */
  467|  77.8k|            insertions_sort_NeighList_AT_NUMBERS3( NeighList[i], nRank );
  468|  77.8k|        }
  469|   952M|        nPrevRank = nRank[i];
  470|   952M|    }
  471|  6.30M|    return 0;
  472|  6.30M|}
DifferentiateRanks2:
  492|   304k|{
  493|       |    /*int nNumPrevRanks;*/
  494|       |
  495|       |    /*  SortNeighLists2 needs sorted ranks */
  496|   304k|    pCG->m_pn_RankForSort = pnCurrRank;
  497|   304k|    if (bUseAltSort & 1)
  ------------------
  |  Branch (497:9): [True: 14.5k, False: 289k]
  ------------------
  498|  14.5k|        tsort( pCG, nAtomNumber, num_atoms, sizeof( nAtomNumber[0] ), CompRank /* CompRanksOrd*/ );
  ------------------
  |  |   18|  14.5k|#define tsort insertions_sort
  ------------------
  499|   289k|    else
  500|   289k|        inchi_qsort( pCG, nAtomNumber, num_atoms, sizeof( nAtomNumber[0] ), CompRanksOrd );
  501|       |
  502|   304k|    do
  503|   327k|    {
  504|   327k|        *lNumIter += 1;
  505|       |        /*nNumPrevRanks = nNumCurrRanks;*/
  506|   327k|        switch_ptrs( &pnCurrRank, &pnPrevRank );
  507|   327k|        SortNeighLists2( num_atoms, pnPrevRank, NeighList, nAtomNumber );
  508|       |        /*  the following call creates pnCurrRank out of pnPrevRank */
  509|   327k|        nNumCurrRanks = SetNewRanksFromNeighLists( pCG, num_atoms, NeighList, pnPrevRank, pnCurrRank, nAtomNumber,
  510|   327k|                                                 1, CompNeighListRanksOrd );
  511|   327k|    }
  512|   327k|    while ( /*nNumPrevRanks != nNumCurrRanks ||*/ memcmp( pnPrevRank, pnCurrRank, num_atoms * sizeof( pnCurrRank[0] ) ));
  ------------------
  |  Branch (512:51): [True: 23.1k, False: 304k]
  ------------------
  513|       |
  514|   304k|    return nNumCurrRanks;
  515|   304k|}
DifferentiateRanks3:
  534|  4.98M|{
  535|       |    /*
  536|       |        static long count = 0;
  537|       |        count ++;
  538|       |        if ( count == 103 ) {
  539|       |            int stop=1;
  540|       |        }
  541|       |    */
  542|       |
  543|       |    /*  SortNeighLists3 needs sorted ranks: ranks/atnumbers must have been already sorted */
  544|  4.98M|    do
  545|  4.99M|    {
  546|  4.99M|        *lNumIter += 1;
  547|  4.99M|        switch_ptrs( &pnCurrRank, &pnPrevRank );
  548|  4.99M|        SortNeighLists3( num_atoms, pnPrevRank, NeighList, nAtomNumber );
  549|       |        /*  the following call creates pnCurrRank out of pnPrevRank */
  550|  4.99M|        nNumCurrRanks = SetNewRanksFromNeighLists3( pCG, num_atoms, NeighList, pnPrevRank,
  551|  4.99M|                                                    pnCurrRank, nAtomNumber );
  552|  4.99M|    }
  553|  4.99M|    while (nNumCurrRanks < 0 /* memcmp( pnPrevRank, pnCurrRank, num_atoms*sizeof(pnCurrRank[0]) )*/);
  ------------------
  |  Branch (553:12): [True: 11.0k, False: 4.98M]
  ------------------
  554|       |
  555|  4.98M|    return nNumCurrRanks;
  556|  4.98M|}
DifferentiateRanks4:
  570|  1.30M|{
  571|       |    /*
  572|       |        static long count = 0;
  573|       |        count ++;
  574|       |        if ( count == 103 ) {
  575|       |            int stop=1;
  576|       |        }
  577|       |    */
  578|       |    /*  SortNeighLists4 needs sorted ranks: ranks/atnumbers must have been already sorted */
  579|  1.30M|    do
  580|  1.30M|    {
  581|  1.30M|        *lNumIter += 1;
  582|  1.30M|        switch_ptrs( &pnCurrRank, &pnPrevRank );
  583|  1.30M|        SortNeighLists3( num_atoms, pnPrevRank, NeighList, nAtomNumber );
  584|       |        /*  the following call creates pnCurrRank out of pnPrevRank */
  585|  1.30M|        nNumCurrRanks = SetNewRanksFromNeighLists4( pCG, num_atoms, NeighList, pnPrevRank,
  586|  1.30M|                                                    pnCurrRank, nAtomNumber, nMaxAtRank );
  587|  1.30M|    }
  588|  1.30M|    while (nNumCurrRanks < 0 /* memcmp( pnPrevRank, pnCurrRank, num_atoms*sizeof(pnCurrRank[0]) )*/);
  ------------------
  |  Branch (588:12): [True: 3.73k, False: 1.30M]
  ------------------
  589|       |
  590|  1.30M|    return nNumCurrRanks;
  591|  1.30M|}
DifferentiateRanksBasic:
  605|  39.2k|{
  606|  39.2k|    int nNumPrevRanks;
  607|       |
  608|       |    /*  SortNeighLists2 needs sorted ranks */
  609|  39.2k|    pCG->m_pn_RankForSort = pnCurrRank;
  610|  39.2k|    if (bUseAltSort & 1)
  ------------------
  |  Branch (610:9): [True: 39.2k, False: 0]
  ------------------
  611|  39.2k|    {
  612|  39.2k|        tsort( pCG, nAtomNumber, num_atoms, sizeof( nAtomNumber[0] ), CompRank );
  ------------------
  |  |   18|  39.2k|#define tsort insertions_sort
  ------------------
  613|  39.2k|    }
  614|      0|    else
  615|      0|    {
  616|      0|        inchi_qsort( pCG, nAtomNumber, num_atoms, sizeof( nAtomNumber[0] ), CompRank );
  617|      0|    }
  618|       |
  619|  39.2k|    do
  620|  78.6k|    {
  621|  78.6k|        *lNumIter += 1;
  622|  78.6k|        nNumPrevRanks = nNumCurrRanks;
  623|  78.6k|        switch_ptrs( &pnCurrRank, &pnPrevRank );
  624|  78.6k|        SortNeighLists2( num_atoms, pnPrevRank, NeighList, nAtomNumber );
  625|       |        /*  the following call creates pnCurrRank out of pnPrevRank */
  626|  78.6k|        nNumCurrRanks = SetNewRanksFromNeighLists( pCG, num_atoms, NeighList, pnPrevRank, pnCurrRank, nAtomNumber, bUseAltSort, CompNeighListRanks );
  627|  78.6k|    }
  628|  78.6k|    while (nNumPrevRanks != nNumCurrRanks || memcmp( pnPrevRank, pnCurrRank, num_atoms * sizeof( pnCurrRank[0] ) ));
  ------------------
  |  Branch (628:12): [True: 39.4k, False: 39.2k]
  |  Branch (628:46): [True: 0, False: 39.2k]
  ------------------
  629|  39.2k|    return nNumCurrRanks;
  630|  39.2k|}
NumberOfTies:
  653|  8.98k|{
  654|       |
  655|  8.98k|    AT_RANK *nRank1 = *pRankStack1++;
  656|  8.98k|    AT_RANK *nAtomNumber1 = *pRankStack1++;  /*  ranks for mapping "1", "from" */
  657|       |
  658|  8.98k|    AT_RANK *nRank2 = *pRankStack2++;
  659|  8.98k|    AT_RANK *nAtomNumber2 = *pRankStack2++;  /*  ranks for mapping "2", "to" */
  660|       |
  661|  8.98k|    AT_RANK r, *pTempArray;
  662|       |
  663|  8.98k|    int iMax, i, i1, i2;
  664|       |
  665|  8.98k|    *bAddStack = 0;
  666|  8.98k|    *bMapped1 = 0;
  667|  8.98k|    *nNewRank = 0;
  668|  8.98k|    r = nRank1[at_no1];
  669|       |
  670|  8.98k|    if (r != nRank2[at_no2])
  ------------------
  |  Branch (670:9): [True: 0, False: 8.98k]
  ------------------
  671|      0|    {
  672|      0|        return CT_MAPCOUNT_ERR; /*  atoms cannot be mapped onto each other: they have different ranks */ /*   <BRKPT> */
  ------------------
  |  |   26|      0|#define CT_MAPCOUNT_ERR      (CT_ERR_FIRST- 7)  /*(-30007) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  673|      0|    }
  674|  8.98k|    iMax = r - 1;
  675|       |    /*  find i1 and i2 = numbers of ranks in nRank1[] and nRank2[] equal to r:  */
  676|  21.1k|    for (i1 = 1; i1 <= iMax && r == nRank1[nAtomNumber1[iMax - i1]]; i1++)
  ------------------
  |  Branch (676:18): [True: 20.3k, False: 851]
  |  Branch (676:32): [True: 12.1k, False: 8.13k]
  ------------------
  677|  12.1k|    {
  678|  12.1k|        ;
  679|  12.1k|    }
  680|  21.1k|    for (i2 = 1; i2 <= iMax && r == nRank2[nAtomNumber2[iMax - i2]]; i2++)
  ------------------
  |  Branch (680:18): [True: 20.3k, False: 851]
  |  Branch (680:32): [True: 12.1k, False: 8.13k]
  ------------------
  681|  12.1k|    {
  682|  12.1k|        ;
  683|  12.1k|    }
  684|  8.98k|    if (i2 != i1)
  ------------------
  |  Branch (684:9): [True: 0, False: 8.98k]
  ------------------
  685|      0|        return CT_MAPCOUNT_ERR; /*  program error: must be identical number of equal ranks */ /*   <BRKPT> */
  ------------------
  |  |   26|      0|#define CT_MAPCOUNT_ERR      (CT_ERR_FIRST- 7)  /*(-30007) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  686|       |    /*  found i1 equal rank(s); preceding (smaller) non-equal rank is r-i1 */
  687|       |    /*  To break the tie we have to reduce the rank r to r-i1+1 */
  688|       |
  689|       |    /************ Note *******************************
  690|       |     * IF ( i=r-1 && 0 <= i && i < num_atoms AND
  691|       |     *      nRank[nAtomNumber1[i]] == r )
  692|       |     * THEN:
  693|       |     * nRank[nAtomNumber1[i+1]] >  r; (if i+1 < num_atoms)
  694|       |     * nRank[nAtomNumber1[i-1]] <= r; (if i > 0)
  695|       |     *
  696|       |     * IF r = nRank[i] THEN
  697|       |     * nRank[nAtomNumber1[r-1]] == r
  698|       |     * nRank[nAtomNumber1[r-i-1]] <= nRank[nAtomNumber1[r-i]] (for 1 <= i < r )
  699|       |     */
  700|  8.98k|    if (i1 > 1)
  ------------------
  |  Branch (700:9): [True: 7.20k, False: 1.78k]
  ------------------
  701|  7.20k|    {
  702|       |        /* int bAtFromHasAlreadyBeenMapped = 0; */
  703|  7.20k|        *nNewRank = r - i1 + 1;
  704|       |        /*  grab an existing or allocate a new array */
  705|       |        /*  we need 4 arrays: 2 for ranks + 2 for numbers */
  706|  36.0k|        for (i = 0; i < 4; i++)
  ------------------
  |  Branch (706:21): [True: 28.8k, False: 7.20k]
  ------------------
  707|  28.8k|        {
  708|  28.8k|            if (i < 2)
  ------------------
  |  Branch (708:17): [True: 14.4k, False: 14.4k]
  ------------------
  709|  14.4k|            {
  710|  14.4k|                pTempArray = *pRankStack1;
  711|  14.4k|                *bMapped1 += ( pTempArray && pTempArray[0] );
  ------------------
  |  Branch (711:32): [True: 14.0k, False: 395]
  |  Branch (711:46): [True: 4.97k, False: 9.03k]
  ------------------
  712|  14.4k|            }
  713|  14.4k|            else
  714|  14.4k|            {
  715|  14.4k|                pTempArray = *pRankStack2;
  716|  14.4k|            }
  717|  28.8k|            if (!pTempArray && !( pTempArray = (AT_RANK *) inchi_malloc( length ) ))
  ------------------
  |  | 1143|    790|#define inchi_malloc   malloc
  ------------------
  |  Branch (717:17): [True: 790, False: 28.0k]
  |  Branch (717:32): [True: 0, False: 790]
  ------------------
  718|      0|                return CT_OUT_OF_RAM;  /*  out of RAM */ /*   <BRKPT> */
  ------------------
  |  |   21|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  719|       |            /*  copy "to" contents */
  720|  28.8k|            switch (i)
  ------------------
  |  Branch (720:21): [True: 14.4k, False: 14.4k]
  ------------------
  721|  28.8k|            {
  722|  7.20k|                case 2:
  ------------------
  |  Branch (722:17): [True: 7.20k, False: 21.6k]
  ------------------
  723|  7.20k|                    memcpy(pTempArray, nRank2, length);
  724|  7.20k|                    break;
  725|  7.20k|                case 3:
  ------------------
  |  Branch (725:17): [True: 7.20k, False: 21.6k]
  ------------------
  726|  7.20k|                    memcpy(pTempArray, nAtomNumber2, length);
  727|  7.20k|                    break;
  728|  28.8k|            }
  729|  28.8k|            if (i < 2)
  ------------------
  |  Branch (729:17): [True: 14.4k, False: 14.4k]
  ------------------
  730|  14.4k|                *pRankStack1++ = pTempArray;
  731|  14.4k|            else
  732|  14.4k|            {
  733|  14.4k|                *pRankStack2++ = pTempArray;
  734|  14.4k|            }
  735|  28.8k|        }
  736|  7.20k|        *bAddStack = 2; /*  to break the tie we added 2 more arrays to pRankStack1 and pRankStack2 */
  737|  7.20k|    }
  738|       |
  739|  8.98k|    return i1;
  740|  8.98k|}
HalfStereoBondParity:
  771|    538|{
  772|       |    /*
  773|       |       Suppose neighbors #0,#1,#2 have ranks a, b, c. Remove rank of the neighbor connected
  774|       |       by the stereogenic bond (NCSB) from the a, b, c list and denote the two left as r[0], r[1],
  775|       |       in the same order. Let iNCSB be an ordering number (0,1,or 2) of the NCSB.
  776|       |       Assume the neighbor connected by the stereogenic bond has infinite positive rank.
  777|       |       Position the half-bond so that the stereogenic bond neighbor is to the right from the atom (see below)
  778|       |
  779|       |       Definition.
  780|       |       ===========
  781|       |                       if rank(X) != rank(Y) then Half-bond parity = (rank(X) > rank(Y)), that is,
  782|       |        Y
  783|       |         \             if ( rank(X) < rank(Y) ) then Half-bond parity is Even
  784|       |          C==NCSB      if ( rank(X) > rank(Y) ) then Half-bond parity is Odd
  785|       |         /             if ( rank(X) = rank(Y) ) then Half-bond parity cannot be defined
  786|       |        X
  787|       |
  788|       |        1                          2             1
  789|       |         \                          \             \
  790|       |          C==NCSB       C==NCSB      C==NCSB       C==NCSB
  791|       |         /             /            /
  792|       |        2             1            1
  793|       |
  794|       |        Parity = 1    Parity = 1   Parity = 2    Parity = 2
  795|       |        (Odd)         (Odd)       (Even) or 0   (Even) or 0
  796|       |
  797|       |       Half-bond parity =  (iNCSB + (r[0] > r[1]) + (Atom C geometric parity))%2
  798|       |
  799|       |       Consider the following cases to prove the formula:
  800|       |
  801|       |       Case 1: 3 explicit neighbors
  802|       |       ============================
  803|       |       If  (1) atom's geometric parity = even (which means neighbors #0, #1, #2 are located clockwise),
  804|       |       and (2) neighbors other than NCSB have different ranks, then,
  805|       |       assuming that NCSB always has the largest (infinite) rank (this is consistent with
  806|       |       the assumption that implicit hydrogens have smallest ranks), we have 3 possibilities:
  807|       |
  808|       |                                 c         a          b
  809|       |                                  \         \          \
  810|       |                                   C==a      C==b       C==c
  811|       |                                  /         /          /
  812|       |                                 b         c          a
  813|       |
  814|       |                iNCSB      =      0          1          2
  815|       |           Half-bond parity =     b>c        a<c        a>b     (0=even, 1=odd)
  816|       |                               r[0]>r[1]  r[0]<r[1]  r[0]>r[1]
  817|       |           Half-bond parity
  818|       |           for all 3 cases      =    (iNCSB + (r[0] > r[1]))%2
  819|       |
  820|       |           The following slight modification will work for both odd and even geometric parity:
  821|       |
  822|       |           Half-bond parity     =    (iNCSB + (r[0] > r[1]) + (Atom C geometric parity))%2
  823|       |
  824|       |           even parity (0) => atom above the bond has lower rank than the atom below the bond.
  825|       |
  826|       |
  827|       |       Case 2: 2 explicit neighbors
  828|       |       ============================
  829|       |       One implicit hydrogen atom H or hydrogen isotope (implicit rank=0). Assume r[1]=0
  830|       |
  831|       |                                 H         a            Note. The same method
  832|       |                                  \         \                 works for
  833|       |                                   C==a      C==b
  834|       |                                  /         /             N==a   and   a
  835|       |                                 b         H             /              \
  836|       |                                                        b                N==b
  837|       |                iNCSB       =      0         1
  838|       |           Half-bond parity =     b>0       a<0
  839|       |           (r[1]=0, r[0]>0)    r[0]>r[1]  r[0]<r[1]
  840|       |
  841|       |           Half-bond parity =  (iNCSB + (r[0] > r[1]) + (Atom C geometric parity))%2
  842|       |
  843|       |       Case 3: 1 explicit neighbor (NCSB)
  844|       |       ==================================
  845|       |       Two implicit hydrogens, (number of neighbors on non-streogenic bonds)==0:
  846|       |
  847|       |       Atom C geometric parity:  Even               Odd          Note. The same method
  848|       |                                                                       works for
  849|       |                                 D                  H
  850|       |                                  \                  \           Even   and   Odd
  851|       |                                   C==a               C==a
  852|       |                                  /                  /           H               N==a
  853|       |                                 H                  D             \             /
  854|       |                                                                   N==a        H
  855|       |                iNCSB =           0                0
  856|       |           Half-bond parity =    (0<0)=0         (0<0)+1 = 1
  857|       |           (r[1]=0, r[0]=0)    r[1]<r[0]         (r[1]<r[0])+atom_parity
  858|       |
  859|       |           Half-parity
  860|       |           for this case  =    (iNCSB + (r[0] > r[1]) + (Atom C geometric parity))%2
  861|       |
  862|       |    */
  863|    538|    int i, j, k, iNeigh, parity, at1_parity, at_no2;
  864|    538|    AT_RANK r[MAX_NUM_STEREO_BOND_NEIGH];
  865|       |
  866|    538|    if (at[at_no1].valence > MAX_NUM_STEREO_BOND_NEIGH || ( at1_parity = at[at_no1].parity ) <= 0)
  ------------------
  |  |  874|  1.07k|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (866:9): [True: 0, False: 538]
  |  Branch (866:59): [True: 0, False: 538]
  ------------------
  867|      0|    {
  868|      0|        return 0;
  869|      0|    }
  870|    538|    if (!PARITY_WELL_DEF( at1_parity ))
  ------------------
  |  |  266|    538|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    538|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|  1.07k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    538|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|    538|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    538|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|    538|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 538, False: 0]
  |  |  |  Branch (266:85): [True: 538, False: 0]
  |  |  ------------------
  ------------------
  871|      0|    {
  872|      0|        if (PARITY_KNOWN( at1_parity ))
  ------------------
  |  |  265|      0|#define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|      0|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|      0|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      0|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|      0|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      0|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|      0|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (265:38): [True: 0, False: 0]
  |  |  |  Branch (265:78): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  873|      0|        {
  874|      0|            return at1_parity;
  875|      0|        }
  876|      0|        return -at1_parity;
  877|      0|    }
  878|    538|    if (0 > i_sb_neigh || i_sb_neigh >= MAX_NUM_STEREO_BOND_NEIGH)
  ------------------
  |  |  874|    538|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (878:9): [True: 0, False: 538]
  |  Branch (878:27): [True: 0, False: 538]
  ------------------
  879|      0|    {
  880|      0|        return CT_STEREOBOND_ERROR;  /*   <BRKPT> */
  ------------------
  |  |   31|      0|#define CT_STEREOBOND_ERROR  (CT_ERR_FIRST-12)  /*(-30012) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  881|      0|    }
  882|  1.21k|    for (i = 0; i <= i_sb_neigh; i++)
  ------------------
  |  Branch (882:17): [True: 677, False: 538]
  ------------------
  883|    677|    {
  884|    677|        if (!at[at_no1].stereo_bond_neighbor[i])
  ------------------
  |  Branch (884:13): [True: 0, False: 677]
  ------------------
  885|      0|        {
  886|      0|            return CT_STEREOBOND_ERROR;  /*   <BRKPT> */
  ------------------
  |  |   31|      0|#define CT_STEREOBOND_ERROR  (CT_ERR_FIRST-12)  /*(-30012) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  887|      0|        }
  888|    677|    }
  889|    538|    at_no2 = at[at_no1].neighbor[(int) at[at_no1].stereo_bond_ord[i_sb_neigh]];
  890|    538|    memset( r, 0, sizeof( r ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  891|  1.64k|    for (i = j = 0, iNeigh = -1; i < at[at_no1].valence; i++)
  ------------------
  |  Branch (891:34): [True: 1.11k, False: 538]
  ------------------
  892|  1.11k|    {
  893|  1.11k|        if (( k = (int) at[at_no1].neighbor[i] ) == at_no2)
  ------------------
  |  Branch (893:13): [True: 538, False: 573]
  ------------------
  894|    538|        {
  895|    538|            iNeigh = i;
  896|    538|        }
  897|    573|        else
  898|    573|        {
  899|    573|            r[j++] = nRank[k];
  900|    573|        }
  901|  1.11k|    }
  902|    538|    if (iNeigh < 0 || iNeigh != at[at_no1].stereo_bond_ord[i_sb_neigh])
  ------------------
  |  Branch (902:9): [True: 0, False: 538]
  |  Branch (902:23): [True: 0, False: 538]
  ------------------
  903|      0|    {
  904|      0|        return CT_STEREOBOND_ERROR;  /*   <BRKPT> */
  ------------------
  |  |   31|      0|#define CT_STEREOBOND_ERROR  (CT_ERR_FIRST-12)  /*(-30012) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  905|      0|    }
  906|    538|    if ((j > 0 && !r[0]) || (j > 1 && !r[1])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (906:10): [True: 511, False: 27]
  |  Branch (906:19): [True: 0, False: 511]
  |  Branch (906:30): [True: 62, False: 476]
  |  Branch (906:39): [True: 0, False: 62]
  ------------------
  907|      0|        return 0; /*  undefined ranks */
  908|       |
  909|    538|    if ((j == 2 && r[0] == r[1]) || iNeigh < 0) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (909:10): [True: 62, False: 476]
  |  Branch (909:20): [True: 0, False: 62]
  |  Branch (909:37): [True: 0, False: 538]
  ------------------
  910|      0|    {
  911|      0|        parity = AB_PARITY_CALC;  /*  cannot calculate bond parity without additional breaking ties. */
  ------------------
  |  |  224|      0|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  ------------------
  912|      0|    }
  913|    538|    else
  914|    538|    {
  915|    538|        parity = 2 - ( at[at_no1].parity + iNeigh + ( r[1] < r[0] ) ) % 2;
  916|    538|    }
  917|       |
  918|    538|    return parity;
  919|    538|}
parity_of_mapped_half_bond:
  932|     27|{
  933|     27|    int     i, j, k, num_neigh;
  934|     27|    int     to_sb_neigh_ord, from_sb_neigh_ord, parity;
  935|     27|    AT_RANK r_to[MAX_NUM_STEREO_BOND_NEIGH], at_no_to[MAX_NUM_STEREO_BOND_NEIGH];
  936|     27|    AT_RANK r_canon_from[MAX_NUM_STEREO_BOND_NEIGH], at_no_from[MAX_NUM_STEREO_BOND_NEIGH];
  937|     27|    AT_RANK r, r_sb_neigh;
  938|       |
  939|    108|    for (i = 0; i < MAX_NUM_STEREO_BOND_NEIGH; i++)
  ------------------
  |  |  874|    108|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (939:17): [True: 81, False: 27]
  ------------------
  940|     81|    {
  941|     81|        r_to[i] = r_canon_from[i] = 0;
  942|     81|    }
  943|       |
  944|     27|    if (pEN)
  ------------------
  |  Branch (944:9): [True: 27, False: 0]
  ------------------
  945|     27|    {
  946|     27|        memset( pEN, 0, sizeof( *pEN ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  947|     27|    }
  948|       |
  949|       |    /*  for debug only */
  950|     27|    if (nRankFrom[from_at] != nRankTo[to_at] ||
  ------------------
  |  Branch (950:9): [True: 0, False: 27]
  ------------------
  951|     27|         nRankFrom[from_neigh] != nRankTo[to_neigh] ||
  ------------------
  |  Branch (951:10): [True: 0, False: 27]
  ------------------
  952|     27|         at[to_at].valence != at[from_at].valence)
  ------------------
  |  Branch (952:10): [True: 0, False: 27]
  ------------------
  953|      0|    {
  954|      0|        return 0;  /*  program error: both atoms must be mapped */ /*   <BRKPT> */
  955|      0|    }
  956|       |
  957|     27|    parity = PARITY_VAL( at[to_at].parity );
  ------------------
  |  |  262|     27|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|     27|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
  958|     27|    num_neigh = at[to_at].valence;
  959|       |
  960|     27|    if (num_neigh > MAX_NUM_STEREO_BOND_NEIGH || num_neigh < MIN_NUM_STEREO_BOND_NEIGH)
  ------------------
  |  |  874|     54|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
                  if (num_neigh > MAX_NUM_STEREO_BOND_NEIGH || num_neigh < MIN_NUM_STEREO_BOND_NEIGH)
  ------------------
  |  |  875|     27|#define MIN_NUM_STEREO_BOND_NEIGH 2
  ------------------
  |  Branch (960:9): [True: 0, False: 27]
  |  Branch (960:50): [True: 0, False: 27]
  ------------------
  961|      0|    {
  962|       |        /*  2 neighbors are possible in case of stereo bond with implicit H */
  963|       |        /*  or a stereocenter -CHD- with an implicit H */
  964|      0|        if (num_neigh == 1 && at[to_at].stereo_bond_neighbor[0])
  ------------------
  |  Branch (964:13): [True: 0, False: 0]
  |  Branch (964:31): [True: 0, False: 0]
  ------------------
  965|      0|        {
  966|       |            /*  1 neighbor can happen in case of a terminal =CHD */
  967|      0|            if (PARITY_WELL_DEF( parity ))
  ------------------
  |  |  266|      0|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|      0|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      0|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|      0|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      0|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 0, False: 0]
  |  |  |  Branch (266:85): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  968|      0|            {
  969|      0|                return 2 - parity % 2;
  970|      0|            }
  971|      0|            else
  972|      0|            {
  973|      0|                if (parity)
  ------------------
  |  Branch (973:21): [True: 0, False: 0]
  ------------------
  974|      0|                {
  975|      0|                    return parity;
  976|      0|                }
  977|      0|                else
  978|      0|                {
  979|      0|                    return AB_PARITY_UNDF; /*  undefined parity */
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  980|      0|                }
  981|      0|            }
  982|      0|        }
  983|      0|        return 0;  /*  program error */ /*   <BRKPT> */
  984|      0|    }
  985|       |
  986|     27|    if (ATOM_PARITY_KNOWN( parity ))
  ------------------
  |  |  258|     27|#define ATOM_PARITY_KNOWN(X)        (AB_MIN_KNOWN_PARITY <= (X) && (X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|     27|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define ATOM_PARITY_KNOWN(X)        (AB_MIN_KNOWN_PARITY <= (X) && (X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|     27|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (258:38): [True: 27, False: 0]
  |  |  |  Branch (258:68): [True: 27, False: 0]
  |  |  ------------------
  ------------------
  987|     27|    {
  988|     27|        if (!ATOM_PARITY_WELL_DEF( parity ))
  ------------------
  |  |  259|     27|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|     27|#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)
  |  |  ------------------
  |  |  |  |  236|     27|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 27, False: 0]
  |  |  |  Branch (259:75): [True: 27, False: 0]
  |  |  ------------------
  ------------------
  989|      0|        {
  990|      0|            return parity;
  991|      0|        }
  992|     27|    }
  993|      0|    else
  994|      0|    {
  995|      0|        if (parity)
  ------------------
  |  Branch (995:13): [True: 0, False: 0]
  ------------------
  996|      0|        {
  997|      0|            return 0; /* parity; */
  998|      0|        }
  999|      0|        else
 1000|      0|        {
 1001|      0|            return 0; /* AB_PARITY_UNDF; */ /*  possibly program error: undefined parity */
 1002|      0|        }
 1003|      0|    }
 1004|       |
 1005|       |    /*  locate at[to_at].stereo_bond_neighbor[] ordering numbers */
 1006|     27|    for (i = 0, to_sb_neigh_ord = -1; i < MAX_NUM_STEREO_BONDS && ( k = (int) at[to_at].stereo_bond_neighbor[i] ); i++)
  ------------------
  |  |  873|     54|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1006:39): [True: 27, False: 0]
  |  Branch (1006:67): [True: 27, False: 0]
  ------------------
 1007|     27|    {
 1008|     27|        if (k == to_neigh + 1)
  ------------------
  |  Branch (1008:13): [True: 27, False: 0]
  ------------------
 1009|     27|        {
 1010|     27|            to_sb_neigh_ord = i;
 1011|     27|            break;
 1012|     27|        }
 1013|     27|    }
 1014|     27|    if (to_sb_neigh_ord < 0)
  ------------------
  |  Branch (1014:9): [True: 0, False: 27]
  ------------------
 1015|      0|    {
 1016|      0|        return 0;  /*  program error: not a stereo bond */ /*   <BRKPT> */
 1017|      0|    }
 1018|     27|    to_sb_neigh_ord = (int) at[to_at].stereo_bond_ord[to_sb_neigh_ord];
 1019|     27|    r_sb_neigh = nRankTo[(int) at[to_at].neighbor[to_sb_neigh_ord]];
 1020|    107|    for (i = j = 0; i < num_neigh; i++)
  ------------------
  |  Branch (1020:21): [True: 80, False: 27]
  ------------------
 1021|     80|    {
 1022|     80|        if (i != to_sb_neigh_ord)
  ------------------
  |  Branch (1022:13): [True: 53, False: 27]
  ------------------
 1023|     53|        {
 1024|     53|            r_to[j] = nRankTo[(int) ( at_no_to[j] = at[to_at].neighbor[i] )];
 1025|     53|            if (r_sb_neigh == r_to[j])
  ------------------
  |  Branch (1025:17): [True: 0, False: 53]
  ------------------
 1026|      0|            {
 1027|      0|                return 0; /*  stereo bond atoms are not fully mapped */
 1028|      0|            }
 1029|     53|            j++;
 1030|     53|        }
 1031|     80|    }
 1032|     27|    if (j + 1 != num_neigh)
  ------------------
  |  Branch (1032:9): [True: 0, False: 27]
  ------------------
 1033|      0|    {
 1034|      0|        return 0; /*  program error */ /*   <BRKPT> */
 1035|      0|    }
 1036|     27|    if (j == 1)
  ------------------
  |  Branch (1036:9): [True: 1, False: 26]
  ------------------
 1037|      1|    {
 1038|       |        /*  only one neighbor; no mapping needed */
 1039|      1|        return 2 - ( parity + 1 + to_sb_neigh_ord ) % 2;
 1040|      1|    }
 1041|     26|    if (j != 2)
  ------------------
  |  Branch (1041:9): [True: 0, False: 26]
  ------------------
 1042|      0|    {
 1043|      0|        return 0; /*  program error: j can be only 0, 1, or 2 */ /*   <BRKPT> */ /* djb-rwth: addressing coverity ID #499526 -- refer to the first comment in this line */
 1044|      0|    }
 1045|       |
 1046|     26|    if (r_to[0] == r_to[1])
  ------------------
  |  Branch (1046:9): [True: 10, False: 16]
  ------------------
 1047|     10|    {
 1048|       |        /*  double bond neighbors need to be mapped */
 1049|     10|        j = 0;
 1050|     10|        from_sb_neigh_ord = -1;
 1051|     40|        for (i = 0; i < num_neigh; i++)
  ------------------
  |  Branch (1051:21): [True: 30, False: 10]
  ------------------
 1052|     30|        {
 1053|     30|            k = at[from_at].neighbor[i];
 1054|     30|            r = nRankFrom[k];
 1055|     30|            if (r == r_sb_neigh)
  ------------------
  |  Branch (1055:17): [True: 10, False: 20]
  ------------------
 1056|     10|            {
 1057|     10|                from_sb_neigh_ord = i;   /*  we need this value only for error-checking */
 1058|     10|            }
 1059|     20|            else
 1060|     20|            {
 1061|     20|                if (r == r_to[0])
  ------------------
  |  Branch (1061:21): [True: 20, False: 0]
  ------------------
 1062|     20|                {
 1063|     20|                    r_canon_from[j] = nCanonRankFrom[k];
 1064|     20|                    at_no_from[j] = (AT_RANK) k;
 1065|     20|                    j++;
 1066|     20|                }
 1067|      0|                else
 1068|      0|                {
 1069|      0|                    return 0; /*  program error: unexpected rank, not fully mapped adjacent to the stereo bond atoms */ /*   <BRKPT> */
 1070|      0|                }
 1071|     20|            }
 1072|     30|        }
 1073|     10|        if (from_sb_neigh_ord < 0 || j != 2)
  ------------------
  |  Branch (1073:13): [True: 0, False: 10]
  |  Branch (1073:38): [True: 0, False: 10]
  ------------------
 1074|      0|        {
 1075|      0|            return 0; /*  program error: rank of a neighbor not found */ /*   <BRKPT> */
 1076|      0|        }
 1077|     10|        if (pEN)
  ------------------
  |  Branch (1077:13): [True: 10, False: 0]
  ------------------
 1078|     10|        {
 1079|       |            /*  j == 2 */
 1080|     10|            pEN->to_at[0] = at_no_to[0];
 1081|     10|            pEN->to_at[1] = at_no_to[1];
 1082|     10|            pEN->num_to = 2;           /*  number of stored in pEN->to_at[] central atom neighbors */
 1083|     10|            pEN->rank = r_to[0];     /*  mapping rank of the tied neighbors */
 1084|       |             /*  i := index of the smaller out of r_canon_from[1] and r_canon_from[0] */
 1085|     10|            i = ( r_canon_from[1] < r_canon_from[0] );
 1086|     10|            pEN->from_at = at_no_from[i];
 1087|     10|            pEN->canon_rank = r_canon_from[i];
 1088|     10|        }
 1089|     10|        return -( (int) r_to[0] );
 1090|     10|    }
 1091|       |    /*  double bond neighbors a mapped: r_to[0] != r_to[1] */
 1092|     16|    from_sb_neigh_ord = -1;
 1093|     64|    for (i = 0; i < num_neigh; i++)
  ------------------
  |  Branch (1093:17): [True: 48, False: 16]
  ------------------
 1094|     48|    {
 1095|     48|        k = at[from_at].neighbor[i];
 1096|     48|        r = nRankFrom[k];
 1097|     48|        if (r == r_sb_neigh)
  ------------------
  |  Branch (1097:13): [True: 16, False: 32]
  ------------------
 1098|     16|        {
 1099|     16|            from_sb_neigh_ord = i;  /*  we need this value only for error-checking */
 1100|     16|        }
 1101|     32|        else
 1102|     32|        {
 1103|     32|            if (r == r_to[0])
  ------------------
  |  Branch (1103:17): [True: 16, False: 16]
  ------------------
 1104|     16|            {
 1105|     16|                r_canon_from[0] = nCanonRankFrom[k];
 1106|       |                /* at_no_from[0]   = (AT_RANK)k; */
 1107|     16|            }
 1108|     16|            else
 1109|     16|            {
 1110|     16|                if (r == r_to[1])
  ------------------
  |  Branch (1110:21): [True: 16, False: 0]
  ------------------
 1111|     16|                {
 1112|     16|                    r_canon_from[1] = nCanonRankFrom[k];
 1113|       |                    /* at_no_from[1]   = (AT_RANK)k; */
 1114|     16|                }
 1115|      0|                else
 1116|      0|                {
 1117|      0|                    return 0; /*  program error: unexpected rank, not fully mapped adjacent to the stereo bond atoms */ /*   <BRKPT> */
 1118|      0|                }
 1119|     16|            }
 1120|     32|        }
 1121|     48|    }
 1122|       |
 1123|     16|    if (!r_canon_from[0] || !r_canon_from[1] || from_sb_neigh_ord < 0)
  ------------------
  |  Branch (1123:9): [True: 0, False: 16]
  |  Branch (1123:29): [True: 0, False: 16]
  |  Branch (1123:49): [True: 0, False: 16]
  ------------------
 1124|      0|    {
 1125|      0|        return 0; /*  program error: neighbor rank not found */ /*   <BRKPT> */
 1126|      0|    }
 1127|       |
 1128|     16|    return 2 - ( parity + to_sb_neigh_ord + ( r_canon_from[1] < r_canon_from[0] ) ) % 2;
 1129|     16|}
parity_of_mapped_atom2:
 1141|  7.96k|{
 1142|  7.96k|    AT_RANK nNeighRankFrom[4], nNeighNumberFrom[4], nNeighRankTo[4], nNeighNumberTo[4];
 1143|  7.96k|    AT_RANK nNeighRankFromCanon[4], nNeighRankToCanon[4];
 1144|  7.96k|    int     i, j, k, num_neigh;
 1145|  7.96k|    int     r1, r2, r, r_canon_from_min, neigh_canon_from_min = 0, r_canon_from; /* djb-rwth: proper initialisation required */
 1146|  7.96k|    int     num_trans_to, num_trans_from, neigh1, neigh2; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 1147|       |
 1148|  7.96k|    num_neigh = at[to_at].valence;
 1149|       |
 1150|  7.96k|    if (pEN)
  ------------------
  |  Branch (1150:9): [True: 7.96k, False: 0]
  ------------------
 1151|  7.96k|    {
 1152|  7.96k|        memset( pEN, 0, sizeof( *pEN ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 1153|  7.96k|    }
 1154|       |
 1155|       |    /*  for debug only */
 1156|  7.96k|    if (nRankFrom[from_at] != nRankTo[to_at])
  ------------------
  |  Branch (1156:9): [True: 0, False: 7.96k]
  ------------------
 1157|      0|    {
 1158|      0|        return 0;  /*  program error */ /*   <BRKPT> */
 1159|      0|    }
 1160|  7.96k|    if (num_neigh > MAX_NUM_STEREO_ATOM_NEIGH || num_neigh < 2)
  ------------------
  |  |  877|  15.9k|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (1160:9): [True: 0, False: 7.96k]
  |  Branch (1160:50): [True: 0, False: 7.96k]
  ------------------
 1161|      0|    {
 1162|       |        /*  2 neighbors are possible in case of stereo bond with implicit H */
 1163|       |        /*  or a stereocenter >CHD with two implicit H */
 1164|      0|        if (num_neigh == 1)
  ------------------
  |  Branch (1164:13): [True: 0, False: 0]
  ------------------
 1165|      0|        {
 1166|       |            /*  1 neighbor can happen in case of a terminal -CHDT or =CHD */
 1167|      0|            if (at[to_at].parity)
  ------------------
  |  Branch (1167:17): [True: 0, False: 0]
  ------------------
 1168|      0|            {
 1169|      0|                return at[to_at].parity;
 1170|      0|            }
 1171|      0|            else
 1172|      0|            {
 1173|      0|                return AB_PARITY_UNDF; /*  undefined parity */
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 1174|      0|            }
 1175|      0|        }
 1176|      0|        return 0;  /*  program error */ /*   <BRKPT> */
 1177|      0|    }
 1178|  38.7k|    for (i = 0; i < num_neigh; i++)
  ------------------
  |  Branch (1178:17): [True: 30.7k, False: 7.96k]
  ------------------
 1179|  30.7k|    { /*  initialization of locals */
 1180|  30.7k|        nNeighNumberTo[i] =
 1181|  30.7k|            nNeighNumberFrom[i] = i;
 1182|  30.7k|        nNeighRankTo[i] = nRankTo[(int) at[to_at].neighbor[i]];       /* mapping rank */
 1183|  30.7k|        nNeighRankFrom[i] = nRankFrom[j = (int) at[from_at].neighbor[i]]; /* mapping rank */
 1184|  30.7k|        nNeighRankFromCanon[i] = nCanonRankFrom[j];                     /* canonical number */
 1185|  30.7k|    }
 1186|       |
 1187|  7.96k|    pCG->m_pn_RankForSort = nNeighRankFrom;
 1188|  7.96k|    pCG->m_nNumCompNeighborsRanksCountEql = 0; /*  sort mapping ranks-from */
 1189|  7.96k|    num_trans_from = insertions_sort( pCG, nNeighNumberFrom, num_neigh, sizeof( nNeighNumberFrom[0] ), CompNeighborsRanksCountEql ); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 1190|       |
 1191|  7.96k|    if (pCG->m_nNumCompNeighborsRanksCountEql)
  ------------------
  |  Branch (1191:9): [True: 2.66k, False: 5.30k]
  ------------------
 1192|  2.66k|    {
 1193|       |        /*  At least 2 neighbors have equal mapping ranks (are tied). */
 1194|       |        /*  Find tied from-neighbors with minimal canonical rank (nCanonRankFrom[]) */
 1195|  2.66k|        r_canon_from_min = MAX_ATOMS + 1; /*  max possible rank + 1 */
  ------------------
  |  |   15|  2.66k|#define MAX_ATOMS  32766
  ------------------
 1196|  10.2k|        for (i = 1, r = 0, r1 = nNeighRankFrom[neigh1 = nNeighNumberFrom[0]]; i < num_neigh; i++, r1 = r2, neigh1 = neigh2)
  ------------------
  |  Branch (1196:79): [True: 7.61k, False: 2.66k]
  ------------------
 1197|  7.61k|        {
 1198|  7.61k|            r2 = nNeighRankFrom[neigh2 = nNeighNumberFrom[i]];
 1199|  7.61k|            if (r2 == r1)
  ------------------
  |  Branch (1199:17): [True: 3.50k, False: 4.10k]
  ------------------
 1200|  3.50k|            {
 1201|       |                /*  found neighbors with tied ranks */
 1202|  3.50k|                if (r != r2)
  ------------------
  |  Branch (1202:21): [True: 2.71k, False: 795]
  ------------------
 1203|  2.71k|                {
 1204|       |                     /*  the 1st pair of neighbor with this rank */
 1205|  2.71k|                    r = r2;
 1206|  2.71k|                    if (( r_canon_from = nNeighRankFromCanon[neigh1] ) < r_canon_from_min)
  ------------------
  |  Branch (1206:25): [True: 2.66k, False: 52]
  ------------------
 1207|  2.66k|                    {
 1208|  2.66k|                        r_canon_from_min = r_canon_from; /*  min canon rank */
 1209|  2.66k|                        neigh_canon_from_min = neigh1;       /*  neighbor number */
 1210|  2.66k|                    }
 1211|  2.71k|                }
 1212|  3.50k|                if (( r_canon_from = nNeighRankFromCanon[neigh2] ) < r_canon_from_min)
  ------------------
  |  Branch (1212:21): [True: 1, False: 3.50k]
  ------------------
 1213|      1|                {
 1214|      1|                    r_canon_from_min = r_canon_from;
 1215|      1|                    neigh_canon_from_min = neigh2;
 1216|      1|                }
 1217|  3.50k|            }
 1218|  7.61k|        }
 1219|  2.66k|        if (r)
  ------------------
  |  Branch (1219:13): [True: 2.66k, False: 0]
  ------------------
 1220|  2.66k|        {
 1221|       |            /*  neighbors with tied ranks have been found => parity cannot be determined without additional mapping */
 1222|       |            /*  find to-neighbors on which neigh_canon_from_min can be mapped */
 1223|  2.66k|            r1 = nNeighRankFrom[neigh_canon_from_min];
 1224|  2.66k|            if (pEN)
  ------------------
  |  Branch (1224:17): [True: 2.66k, False: 0]
  ------------------
 1225|  2.66k|            {
 1226|  12.9k|                for (i = j = 0; i < num_neigh; i++)
  ------------------
  |  Branch (1226:33): [True: 10.2k, False: 2.66k]
  ------------------
 1227|  10.2k|                {
 1228|  10.2k|                    if (r1 == nNeighRankTo[i])
  ------------------
  |  Branch (1228:25): [True: 6.11k, False: 4.15k]
  ------------------
 1229|  6.11k|                    {
 1230|  6.11k|                        pEN->to_at[j++] = at[to_at].neighbor[i];
 1231|  6.11k|                    }
 1232|  10.2k|                }
 1233|  2.66k|                insertions_sort( pCG, pEN->to_at, j, sizeof( pEN->to_at[0] ), CompRanksInvOrd );
 1234|  2.66k|                pEN->num_to = j;  /*  number of stored in pEN->to_at[] central atom neighbors */
 1235|  2.66k|                pEN->from_at = at[from_at].neighbor[neigh_canon_from_min]; /*  neighbor with min. canon number */
 1236|  2.66k|                pEN->rank = r1; /*  mapping rank of the tied neighbors */
 1237|  2.66k|                pEN->canon_rank = r_canon_from_min;  /*  canon. rank of the pEN->from_at */
 1238|  2.66k|            }
 1239|      0|            else
 1240|      0|            {
 1241|       |                /*  debug only */
 1242|      0|                for (i = j = 0; i < num_neigh; i++)
  ------------------
  |  Branch (1242:33): [True: 0, False: 0]
  ------------------
 1243|      0|                {
 1244|      0|                    if (r1 == nNeighRankTo[i])
  ------------------
  |  Branch (1244:25): [True: 0, False: 0]
  ------------------
 1245|      0|                    {
 1246|      0|                        j++;
 1247|      0|                    }
 1248|      0|                }
 1249|      0|            }
 1250|       |            /*  debug only */
 1251|  2.66k|            if (j <= 1 || !r1 || r_canon_from_min > MAX_ATOMS)
  ------------------
  |  |   15|  2.66k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (1251:17): [True: 0, False: 2.66k]
  |  Branch (1251:27): [True: 0, False: 2.66k]
  |  Branch (1251:34): [True: 0, False: 2.66k]
  ------------------
 1252|      0|            {
 1253|      0|                return 0; /*  program error */ /*   <BRKPT> */
 1254|      0|            }
 1255|  2.66k|            return -r; /*  means parity cannot be determined */
 1256|  2.66k|        }
 1257|      0|        return 0; /* program error */
 1258|  2.66k|    }
 1259|       |
 1260|       |    /*  All neighbors have different mapping ranks; */
 1261|       |    /*  therefore no additional mapping of the neighbors is necessary */
 1262|  5.30k|    if (!ATOM_PARITY_WELL_DEF( at[to_at].parity ))
  ------------------
  |  |  259|  5.30k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  5.30k|#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)
  |  |  ------------------
  |  |  |  |  236|  5.30k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 5.30k, False: 0]
  |  |  |  Branch (259:75): [True: 5.30k, False: 0]
  |  |  ------------------
  ------------------
 1263|      0|    {
 1264|      0|        return at[to_at].parity; /*  unknown parity or cannot be determined */
 1265|      0|    }
 1266|       |
 1267|  5.30k|    pCG->m_pn_RankForSort = nNeighRankTo;
 1268|  5.30k|    num_trans_to = insertions_sort( pCG, nNeighNumberTo, num_neigh, sizeof( nNeighNumberTo[0] ), CompNeighborsRanksCountEql );
 1269|       |
 1270|       |    /*  Map canonical ranks of neighbors. Mapped on each other "to" and "from" atoms have equal mapping ranks */
 1271|  25.7k|    for (i = 0; i < num_neigh; i++)
  ------------------
  |  Branch (1271:17): [True: 20.4k, False: 5.30k]
  ------------------
 1272|  20.4k|    {
 1273|  20.4k|        if (nNeighRankTo[j = nNeighNumberTo[i]] != nNeighRankFrom[k = nNeighNumberFrom[i]])
  ------------------
  |  Branch (1273:13): [True: 0, False: 20.4k]
  ------------------
 1274|      0|        {
 1275|      0|            return 0; /*  program error: mapping ranks not equal, from_at neigborhood cannot be mapped on to_at neighbood. */ /*   <BRKPT> */
 1276|      0|        }
 1277|  20.4k|        nNeighRankToCanon[j] = nNeighRankFromCanon[k]; /*  potential problem: other atom(s) may have same mapping rank and */
 1278|       |                                                       /*  different canon. rank(s). */
 1279|       |        /*  we may save some memory by eliminating nNeighRankFromCanon[]: */
 1280|       |        /*  nNeighRankToCanon[j] = nCanonRankFrom[at[from_at].neighbor[k]] */
 1281|  20.4k|    }
 1282|       |
 1283|  5.30k|    pCG->m_pn_RankForSort = nNeighRankToCanon;
 1284|  5.30k|    num_trans_to += insertions_sort( pCG, nNeighNumberTo, num_neigh, sizeof( nNeighNumberTo[0] ), CompNeighborsRanksCountEql );
 1285|       |#ifndef CT_NEIGH_INCREASE
 1286|       |    num_trans_to += ( ( num_neigh*( num_neigh - 1 ) ) / 2 ) % 2;  /*  get correct parity for ascending order of canon. numbers */
 1287|       |#endif
 1288|       |
 1289|  5.30k|    return 2 - ( num_trans_to + at[to_at].parity ) % 2;
 1290|  5.30k|}
ClearPreviousMappings:
 1300|  5.59k|{
 1301|  5.59k|    int i;
 1302|  16.4k|    for (i = 0; pRankStack1[i]; i++)
  ------------------
  |  Branch (1302:17): [True: 10.8k, False: 5.59k]
  ------------------
 1303|  10.8k|    {
 1304|  10.8k|        pRankStack1[i][0] = 0;
 1305|  10.8k|    }
 1306|       |
 1307|  5.59k|    return i;
 1308|  5.59k|}
map_an_atom2:
 1328|  8.98k|{
 1329|  8.98k|    AT_RANK *nRank1, *nAtomNumber1;  /*  ranks for mapping "1", "from" */
 1330|  8.98k|    AT_RANK *nRank2, *nAtomNumber2;  /*  ranks for mapping "2", "to" */
 1331|  8.98k|    AT_RANK *nNewRank1 = NULL, *nNewAtomNumber1 = NULL;  /*  ranks for mapping "1", "from" */
 1332|  8.98k|    AT_RANK *nNewRank2 = NULL, *nNewAtomNumber2 = NULL;  /*  ranks for mapping "2", "to" */
 1333|  8.98k|    int     length = num_max * sizeof( AT_RANK );
 1334|  8.98k|    int     nNewNumRanks2, nNewNumRanks1;
 1335|  8.98k|    int     i, bAtFromHasAlreadyBeenMapped, nNumTies;
 1336|  8.98k|    AT_RANK nNewRank;
 1337|       |
 1338|  8.98k|    nNumTies = NumberOfTies( pRankStack1, pRankStack2, length, at_no1, at_no2, &nNewRank, bAddStack, &bAtFromHasAlreadyBeenMapped );
 1339|       |
 1340|  8.98k|    if (RETURNED_ERROR( nNumTies ))
  ------------------
  |  |   44|  8.98k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  8.98k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  8.98k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  8.98k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  8.98k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  8.98k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 8.98k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 8.98k]
  |  |  ------------------
  ------------------
 1341|      0|    {
 1342|      0|        return nNumTies;  /*  error */
 1343|      0|    }
 1344|       |
 1345|  8.98k|    nRank1 = *pRankStack1++;
 1346|  8.98k|    nAtomNumber1 = *pRankStack1++;  /*  ranks for mapping "1", "from" */
 1347|       |
 1348|  8.98k|    nRank2 = *pRankStack2++;
 1349|  8.98k|    nAtomNumber2 = *pRankStack2++;  /*  ranks for mapping "2", "to" */
 1350|       |
 1351|  8.98k|    if (nNumTies > 1)
  ------------------
  |  Branch (1351:9): [True: 7.20k, False: 1.78k]
  ------------------
 1352|  7.20k|    {
 1353|       |
 1354|  7.20k|        nNewRank1 = *pRankStack1++;
 1355|  7.20k|        nNewAtomNumber1 = *pRankStack1++;  /*  ranks for mapping "1", "from" */
 1356|       |
 1357|  7.20k|        nNewRank2 = *pRankStack2++;
 1358|  7.20k|        nNewAtomNumber2 = *pRankStack2++;  /*  ranks for mapping "2", "to" */
 1359|       |        /*  break a tie for "to" */
 1360|  7.20k|        memcpy(nNewRank2, nRank2, length);
 1361|  7.20k|        memcpy(nNewAtomNumber2, nAtomNumber2, length);
 1362|  7.20k|        nNewRank2[at_no2] = nNewRank;
 1363|  7.20k|        nNewNumRanks2 = DifferentiateRanks2( pCG, num_atoms, NeighList,
 1364|  7.20k|                                         nNumMappedRanks, nNewRank2, nTempRank,
 1365|  7.20k|                                         nNewAtomNumber2, &pCS->lNumNeighListIter, 1 );
 1366|  7.20k|        pCS->lNumBreakTies++;
 1367|       |
 1368|       |        /*  Check whether the old mapping can be reused */
 1369|  7.20k|        if (2 == bAtFromHasAlreadyBeenMapped && nNewRank == nNewRank1[at_no1])
  ------------------
  |  Branch (1369:13): [True: 1.05k, False: 6.14k]
  |  Branch (1369:49): [True: 1.05k, False: 2]
  ------------------
 1370|  1.05k|        {
 1371|  7.64k|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1371:25): [True: 6.59k, False: 1.05k]
  ------------------
 1372|  6.59k|            {
 1373|  6.59k|                if (nNewRank1[nNewAtomNumber1[i]] != nNewRank2[nNewAtomNumber2[i]])
  ------------------
  |  Branch (1373:21): [True: 0, False: 6.59k]
  ------------------
 1374|      0|                {
 1375|      0|                    bAtFromHasAlreadyBeenMapped = 0; /*  It cannot. */
 1376|      0|                    break;
 1377|      0|                }
 1378|  6.59k|            }
 1379|  1.05k|        }
 1380|  6.15k|        else
 1381|  6.15k|        {
 1382|  6.15k|            bAtFromHasAlreadyBeenMapped = 0;
 1383|  6.15k|        }
 1384|  7.20k|        if (2 != bAtFromHasAlreadyBeenMapped)
  ------------------
  |  Branch (1384:13): [True: 6.15k, False: 1.05k]
  ------------------
 1385|  6.15k|        {
 1386|       |            /*  break a tie for "from" */
 1387|  21.4k|            for (i = 0; pRankStack1[i]; i++)
  ------------------
  |  Branch (1387:25): [True: 15.2k, False: 6.15k]
  ------------------
 1388|  15.2k|            {
 1389|  15.2k|                pRankStack1[i][0] = 0;
 1390|  15.2k|            }
 1391|  6.15k|            memcpy(nNewRank1, nRank1, length);
 1392|  6.15k|            memcpy(nNewAtomNumber1, nAtomNumber1, length);  /* GPF: bad nAtomNumber1 */
 1393|  6.15k|            nNewRank1[at_no1] = nNewRank;
 1394|  6.15k|            nNewNumRanks1 = DifferentiateRanks2( pCG, num_atoms, NeighList,
 1395|  6.15k|                                             nNumMappedRanks, nNewRank1, nTempRank,
 1396|  6.15k|                                             nNewAtomNumber1, &pCS->lNumNeighListIter, 1 );
 1397|  6.15k|            pCS->lNumBreakTies++;
 1398|  6.15k|        }
 1399|  1.05k|        else
 1400|  1.05k|        {
 1401|  1.05k|            nNewNumRanks1 = nNewNumRanks2;
 1402|  1.05k|        }
 1403|       |
 1404|  7.20k|        if (nNewNumRanks1 != nNewNumRanks2)
  ------------------
  |  Branch (1404:13): [True: 0, False: 7.20k]
  ------------------
 1405|      0|            return CT_MAPCOUNT_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   26|      0|#define CT_MAPCOUNT_ERR      (CT_ERR_FIRST- 7)  /*(-30007) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1406|  7.20k|        *pnNewNumMappedRanks = nNewNumRanks2;
 1407|       |        /*  debug only */
 1408|  46.2k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1408:21): [True: 39.0k, False: 7.20k]
  ------------------
 1409|  39.0k|        {
 1410|  39.0k|            if (nNewRank1[nNewAtomNumber1[i]] != nNewRank2[nNewAtomNumber2[i]])
  ------------------
  |  Branch (1410:17): [True: 0, False: 39.0k]
  ------------------
 1411|      0|            {
 1412|      0|                return CT_MAPCOUNT_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   26|      0|#define CT_MAPCOUNT_ERR      (CT_ERR_FIRST- 7)  /*(-30007) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1413|      0|            }
 1414|  39.0k|        }
 1415|  7.20k|    }
 1416|  1.78k|    else
 1417|  1.78k|    {
 1418|  1.78k|        *pnNewNumMappedRanks = nNumMappedRanks;
 1419|  1.78k|    }
 1420|       |
 1421|  8.98k|    return ( nNewRank1 ) ? nNewRank1[at_no1] : nRank1[at_no1]; /*  mapping rank value */
  ------------------
  |  Branch (1421:12): [True: 7.20k, False: 1.78k]
  ------------------
 1422|  8.98k|}
DeAllocateForNonStereoRemoval:
 1476|  4.02k|{
 1477|  4.02k|    if (*nAtomNumberCanon1)
  ------------------
  |  Branch (1477:9): [True: 2.01k, False: 2.01k]
  ------------------
 1478|  2.01k|    {
 1479|  2.01k|        inchi_free( *nAtomNumberCanon1 );
  ------------------
  |  | 1152|  2.01k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 2.01k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 2.01k]
  |  |  ------------------
  ------------------
 1480|  2.01k|        *nAtomNumberCanon1 = NULL;
 1481|  2.01k|    }
 1482|  4.02k|    if (*nAtomNumberCanon2)
  ------------------
  |  Branch (1482:9): [True: 2.01k, False: 2.01k]
  ------------------
 1483|  2.01k|    {
 1484|  2.01k|        inchi_free( *nAtomNumberCanon2 );
  ------------------
  |  | 1152|  2.01k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 2.01k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 2.01k]
  |  |  ------------------
  ------------------
 1485|  2.01k|        *nAtomNumberCanon2 = NULL;
 1486|  2.01k|    }
 1487|  4.02k|    if (*nl)
  ------------------
  |  Branch (1487:9): [True: 2.01k, False: 2.01k]
  ------------------
 1488|  2.01k|    {
 1489|  2.01k|        FreeNeighList( *nl );
 1490|  2.01k|        *nl = 0;
 1491|  2.01k|    }
 1492|  4.02k|    if (*nl1)
  ------------------
  |  Branch (1492:9): [True: 2.01k, False: 2.01k]
  ------------------
 1493|  2.01k|    {
 1494|  2.01k|        FreeNeighList( *nl1 );
 1495|  2.01k|        *nl1 = 0;
 1496|  2.01k|    }
 1497|  4.02k|    if (*nl2)
  ------------------
  |  Branch (1497:9): [True: 2.01k, False: 2.01k]
  ------------------
 1498|  2.01k|    {
 1499|  2.01k|        FreeNeighList( *nl2 );
 1500|  2.01k|        *nl2 = 0;
 1501|  2.01k|    }
 1502|  4.02k|    if (*nVisited1)
  ------------------
  |  Branch (1502:9): [True: 2.01k, False: 2.01k]
  ------------------
 1503|  2.01k|    {
 1504|  2.01k|        inchi_free( *nVisited1 );
  ------------------
  |  | 1152|  2.01k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 2.01k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 2.01k]
  |  |  ------------------
  ------------------
 1505|  2.01k|        *nVisited1 = NULL;
 1506|  2.01k|    }
 1507|  4.02k|    if (*nVisited2)
  ------------------
  |  Branch (1507:9): [True: 2.01k, False: 2.01k]
  ------------------
 1508|  2.01k|    {
 1509|  2.01k|        inchi_free( *nVisited2 );
  ------------------
  |  | 1152|  2.01k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 2.01k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 2.01k]
  |  |  ------------------
  ------------------
 1510|       |        *nVisited2 = NULL;
 1511|  2.01k|    }
 1512|  4.02k|}
AllocateForNonStereoRemoval:
 1527|  2.01k|{
 1528|  2.01k|    DeAllocateForNonStereoRemoval( nAtomNumberCanon1, nAtomNumberCanon2, nl, nl1, nl2, nVisited1, nVisited2 );
 1529|  2.01k|    *nAtomNumberCanon1 = (AT_RANK *) inchi_malloc( num_atoms * sizeof( **nAtomNumberCanon1 ) );
  ------------------
  |  | 1143|  2.01k|#define inchi_malloc   malloc
  ------------------
 1530|  2.01k|    *nAtomNumberCanon2 = (AT_RANK *) inchi_malloc( num_atoms * sizeof( **nAtomNumberCanon2 ) );
  ------------------
  |  | 1143|  2.01k|#define inchi_malloc   malloc
  ------------------
 1531|  2.01k|    *nl = CreateNeighList( num_atoms, num_atoms, at, 0, NULL );
 1532|  2.01k|    *nl1 = CreateNeighList( num_atoms, num_atoms, at, 0, NULL );
 1533|  2.01k|    *nl2 = CreateNeighList( num_atoms, num_atoms, at, 0, NULL );
 1534|  2.01k|    *nVisited1 = (AT_RANK *) inchi_malloc( num_atoms * sizeof( **nVisited1 ) );
  ------------------
  |  | 1143|  2.01k|#define inchi_malloc   malloc
  ------------------
 1535|  2.01k|    *nVisited2 = (AT_RANK *) inchi_malloc( num_atoms * sizeof( **nVisited2 ) );
  ------------------
  |  | 1143|  2.01k|#define inchi_malloc   malloc
  ------------------
 1536|       |
 1537|  2.01k|    if (!*nl || !*nl1 || !*nl2 || !*nVisited1 || !*nVisited2 || !*nAtomNumberCanon1 || !*nAtomNumberCanon2)
  ------------------
  |  Branch (1537:9): [True: 0, False: 2.01k]
  |  Branch (1537:17): [True: 0, False: 2.01k]
  |  Branch (1537:26): [True: 0, False: 2.01k]
  |  Branch (1537:35): [True: 0, False: 2.01k]
  |  Branch (1537:50): [True: 0, False: 2.01k]
  |  Branch (1537:65): [True: 0, False: 2.01k]
  |  Branch (1537:88): [True: 0, False: 2.01k]
  ------------------
 1538|      0|    {
 1539|      0|        DeAllocateForNonStereoRemoval( nAtomNumberCanon1, nAtomNumberCanon2, nl, nl1, nl2, nVisited1, nVisited2 );
 1540|      0|        return 0;
 1541|      0|    }
 1542|       |    /*  Sort neighbors according to symm. ranks (primary key) and canon. ranks (secondary key), in descending order */
 1543|  2.01k|    SortNeighListsBySymmAndCanonRank( num_atoms, *nl, nSymmRank, nCanonRank );
 1544|  2.01k|    SortNeighListsBySymmAndCanonRank( num_atoms, *nl1, nSymmRank, nCanonRank );
 1545|  2.01k|    SortNeighListsBySymmAndCanonRank( num_atoms, *nl2, nSymmRank, nCanonRank );
 1546|       |
 1547|  2.01k|    return 1;
 1548|  2.01k|}
GetMinNewRank:
 1553|  9.61k|{
 1554|  9.61k|    int i;
 1555|  9.61k|    AT_RANK nRank2 = 0;
 1556|  42.2k|    for (i = (int) nRank1 - 1; 0 <= i && nRank1 == ( nRank2 = nAtomRank[(int) nAtomNumb[i]] ); i--)
  ------------------
  |  Branch (1556:32): [True: 41.8k, False: 429]
  |  Branch (1556:42): [True: 32.6k, False: 9.18k]
  ------------------
 1557|  32.6k|    {
 1558|  32.6k|        ;
 1559|  32.6k|    }
 1560|  9.61k|    if (i >= 0)
  ------------------
  |  Branch (1560:9): [True: 9.18k, False: 429]
  ------------------
 1561|  9.18k|    {
 1562|  9.18k|        nRank2++;
 1563|  9.18k|    }
 1564|    429|    else
 1565|    429|    {
 1566|    429|        nRank2 = 1;
 1567|    429|    }
 1568|       |
 1569|  9.61k|    return nRank2;
 1570|  9.61k|}
BreakNeighborsTie:
 1593|  9.73k|{
 1594|  9.73k|    AT_RANK nRank1, nRank2;
 1595|  9.73k|    int     nNumDiffRanks, nNumDiffRanks1, nNumDiffRanks2, i;
 1596|  9.73k|    int n1 = (int) neigh_num[in1];
 1597|  9.73k|    int n2 = (int) neigh_num[in2];
 1598|  9.73k|    int other_neigh[2] = {0}, other_neig_ord[2] = {0}, num_other_neigh; /* djb-rwth: initialisations added */
 1599|       |
 1600|       |    /*  asymmetric calculation */
 1601|       |
 1602|  9.73k|    if ((mode == MAP_MODE_S4  && in1) || /* for S4 we need only (in1,in2) = (0,1) (0,2) (0,3) pairs of neighbors */
  ------------------
  |  |   17|  19.4k|#define MAP_MODE_S4   3 /* Check for S4 rotation/reflection leading to parity inversion */
  ------------------
  |  Branch (1602:10): [True: 0, False: 9.73k]
  |  Branch (1602:34): [True: 0, False: 0]
  ------------------
 1603|  9.73k|         (mode != MAP_MODE_STD && at[ia].valence != MAX_NUM_STEREO_ATOM_NEIGH) ||
  ------------------
  |  |   14|  19.4k|#define MAP_MODE_STD  0 /* Standard approach: switch 2 neighbors */
  ------------------
                       (mode != MAP_MODE_STD && at[ia].valence != MAX_NUM_STEREO_ATOM_NEIGH) ||
  ------------------
  |  |  877|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (1603:11): [True: 0, False: 9.73k]
  |  Branch (1603:35): [True: 0, False: 0]
  ------------------
 1604|  9.73k|         (mode != MAP_MODE_STD && nSymmRank[n1] != nSymmRank[n2])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   14|  19.4k|#define MAP_MODE_STD  0 /* Standard approach: switch 2 neighbors */
  ------------------
  |  Branch (1604:11): [True: 0, False: 9.73k]
  |  Branch (1604:35): [True: 0, False: 0]
  ------------------
 1605|      0|    {
 1606|      0|        return 0;
 1607|      0|    }
 1608|       |
 1609|       |    /*  1. Create initial ranks from equivalence information stored in nSymmRank */
 1610|  9.73k|    memcpy(pRankStack1[0], nSymmRank, num_at_tg * sizeof(pRankStack1[0][0]));
 1611|  9.73k|    pCG->m_pn_RankForSort = pRankStack1[0];
 1612|  9.73k|    tsort( pCG, pRankStack1[1], num_at_tg, sizeof( pRankStack1[1][0] ), CompRanksOrd );
  ------------------
  |  |   18|  9.73k|#define tsort insertions_sort
  ------------------
 1613|  9.73k|    nNumDiffRanks = SortedEquInfoToRanks( pRankStack1[0]/*inp*/, pRankStack1[0]/*out*/, pRankStack1[1], num_at_tg, NULL );
 1614|       |
 1615|       |    /* other neighbors */
 1616|  9.73k|    num_other_neigh = 0;
 1617|  9.73k|    if (at[ia].valence <= MAX_NUM_STEREO_ATOM_NEIGH && mode)
  ------------------
  |  |  877|  19.4k|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (1617:9): [True: 9.73k, False: 0]
  |  Branch (1617:56): [True: 0, False: 9.73k]
  ------------------
 1618|      0|    {
 1619|      0|        for (i = 0; i < at[ia].valence; i++)
  ------------------
  |  Branch (1619:21): [True: 0, False: 0]
  ------------------
 1620|      0|        {
 1621|      0|            if (i != in1 && i != in2)
  ------------------
  |  Branch (1621:17): [True: 0, False: 0]
  |  Branch (1621:29): [True: 0, False: 0]
  ------------------
 1622|      0|            {
 1623|      0|                other_neigh[num_other_neigh] = (int) neigh_num[i];
 1624|      0|                other_neig_ord[num_other_neigh] = i;
 1625|      0|                num_other_neigh++;
 1626|      0|            }
 1627|      0|        }
 1628|      0|    }
 1629|  9.73k|    if ((mode != MAP_MODE_STD && nSymmRank[other_neigh[0]] != nSymmRank[other_neigh[1]]) ||
  ------------------
  |  |   14|  19.4k|#define MAP_MODE_STD  0 /* Standard approach: switch 2 neighbors */
  ------------------
  |  Branch (1629:10): [True: 0, False: 9.73k]
  |  Branch (1629:34): [True: 0, False: 0]
  ------------------
 1630|  9.73k|         (mode == MAP_MODE_S4 && nSymmRank[n1] != nSymmRank[other_neigh[1]])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   17|  19.4k|#define MAP_MODE_S4   3 /* Check for S4 rotation/reflection leading to parity inversion */
  ------------------
  |  Branch (1630:11): [True: 0, False: 9.73k]
  |  Branch (1630:34): [True: 0, False: 0]
  ------------------
 1631|      0|    {
 1632|      0|        return 0;
 1633|      0|    }
 1634|       |
 1635|       |    /*  2. Fix at[ia] */
 1636|  9.73k|    if (pRankStack1[0][ia] != nSymmRank[ia])
  ------------------
  |  Branch (1636:9): [True: 8.48k, False: 1.25k]
  ------------------
 1637|  8.48k|    {
 1638|       |        /*  at[ia] is constitutionally equivalent to some other atom. Fix at[ia]. */
 1639|  8.48k|        pRankStack1[0][ia] = nSymmRank[ia];
 1640|  8.48k|        nNumDiffRanks = DifferentiateRanksBasic( pCG, num_at_tg, NeighList,
 1641|  8.48k|                                     nNumDiffRanks, pRankStack1[0], nTempRank,
 1642|  8.48k|                                     pRankStack1[1], lNumIter, 1 );
 1643|  8.48k|    }
 1644|       |    /*  3. In case of a double bond/cumulene only: */
 1645|       |    /*     fix at[ib] -- the opposite double bond/cumulene atom */
 1646|  9.73k|    if (ib < num_atoms)
  ------------------
  |  Branch (1646:9): [True: 14, False: 9.71k]
  ------------------
 1647|     14|    {
 1648|       |        /*  find the smallest possible rank */
 1649|     14|        nRank1 = pRankStack1[0][ib];
 1650|     14|        nRank2 = GetMinNewRank( pRankStack1[0], pRankStack1[1], nRank1 );
 1651|       |        /*  if the rank is smaller than pRankStack1[0][ib] then fix at[ib] */
 1652|     14|        if (nRank2 != nRank1)
  ------------------
  |  Branch (1652:13): [True: 0, False: 14]
  ------------------
 1653|      0|        {
 1654|      0|            pRankStack1[0][ib] = nRank2;
 1655|      0|            nNumDiffRanks = DifferentiateRanksBasic( pCG, num_at_tg, NeighList,
 1656|      0|                                         nNumDiffRanks, pRankStack1[0], nTempRank,
 1657|      0|                                         pRankStack1[1], lNumIter, 1 );
 1658|      0|        }
 1659|     14|    }
 1660|       |
 1661|       |    /**************************************************************************************
 1662|       |     * Note: It may (or may not?) make sense to fix "other neighbors":
 1663|       |     *       in case of a stereo center fix neighbors other than n1, n2
 1664|       |     *       in case of a double bond/cumulene fix the opposite atom neighbors
 1665|       |     *       The ranks assigned to the other neighbors in case of their equivalence
 1666|       |     *       should be in the ascending order of their canonical ranks ????
 1667|       |     *       *** For now we do not fix other neighbors ***
 1668|       |     **************************************************************************************/
 1669|       |
 1670|       |    /*  4. Check whether the neighbors still have equal ranks */
 1671|  9.73k|    if (pRankStack1[0][n1] != pRankStack1[0][n2])
  ------------------
  |  Branch (1671:9): [True: 127, False: 9.60k]
  ------------------
 1672|    127|    {
 1673|    127|        return 0; /*  the two neighbors are not constitutionally equivalent */
 1674|    127|    }
 1675|       |    /*  5. Find new smallest possible rank for n1 and n2 */
 1676|  9.60k|    nRank1 = pRankStack1[0][n1];
 1677|  9.60k|    nRank2 = GetMinNewRank( pRankStack1[0], pRankStack1[1], nRank1 );
 1678|       |
 1679|       |    /*  6. Copy the results to the 2nd eq. rank arrays */
 1680|  9.60k|    memcpy(pRankStack2[0], pRankStack1[0], num_at_tg * sizeof(pRankStack2[0][0]));
 1681|  9.60k|    memcpy(pRankStack2[1], pRankStack1[1], num_at_tg * sizeof(pRankStack2[0][0]));
 1682|       |    /*  7. Break neighbor tie: map n1(1) <--> n2(2) */
 1683|       |    /*  7. Break neighbor tie: map n1(1) <--> n2(2) */
 1684|  9.60k|    pRankStack1[0][n1] = nRank2;
 1685|  9.60k|    nNumDiffRanks1 = DifferentiateRanksBasic( pCG, num_at_tg, NeighList,
 1686|  9.60k|                                 nNumDiffRanks, pRankStack1[0], nTempRank,
 1687|  9.60k|                                 pRankStack1[1], lNumIter, 1 );
 1688|       |
 1689|  9.60k|    pRankStack2[0][n2] = nRank2;
 1690|  9.60k|    nNumDiffRanks2 = DifferentiateRanksBasic( pCG, num_at_tg, NeighList,
 1691|  9.60k|                                 nNumDiffRanks, pRankStack2[0], nTempRank,
 1692|  9.60k|                                 pRankStack2[1], lNumIter, 1 );
 1693|       |
 1694|  9.60k|    if (nNumDiffRanks1 != nNumDiffRanks2)
  ------------------
  |  Branch (1694:9): [True: 0, False: 9.60k]
  ------------------
 1695|      0|    {
 1696|      0|        return -1; /*  <BRKPT> */
 1697|      0|    }
 1698|       |
 1699|  9.60k|    if (mode == MAP_MODE_C2v || mode == MAP_MODE_C2)
  ------------------
  |  |   15|  19.2k|#define MAP_MODE_C2v  1 /* Check for C2v reflection leading to parity inversion */
  ------------------
                  if (mode == MAP_MODE_C2v || mode == MAP_MODE_C2)
  ------------------
  |  |   16|  9.60k|#define MAP_MODE_C2   2 /* Check for C2 rotation preserving parities */
  ------------------
  |  Branch (1699:9): [True: 0, False: 9.60k]
  |  Branch (1699:33): [True: 0, False: 9.60k]
  ------------------
 1700|      0|    {
 1701|       |        /* Check for C2v reflection leading to parity inversion (mode=1) or C2 rotation (mode=2) */
 1702|      0|        AT_RANK nRank10, nRank20;
 1703|      0|        int     nn1, nn2;
 1704|       |        /*
 1705|       |         * C2v & C2: map
 1706|       |         * n1(1) <--> n2(2) -- at this point already done
 1707|       |         * n1(2) <--> n2(1) --> do at i = 0
 1708|       |         *
 1709|       |         * C2v: other neighbors must be unmoved: map
 1710|       |         * other_neigh[0](1) <--> other_neigh[0](2)
 1711|       |         * other_neigh[1](1) <--> other_neigh[1](2)
 1712|       |         *
 1713|       |         * C2:  other neighbors should be mapped on each other
 1714|       |         * other_neigh[0](1) <--> other_neigh[1](2)
 1715|       |         * other_neigh[1](1) <--> other_neigh[0](2)
 1716|       |         */
 1717|      0|        for (i = 0; i <= 2; i++)
  ------------------
  |  Branch (1717:21): [True: 0, False: 0]
  ------------------
 1718|      0|        {
 1719|      0|            if (i == 0)
  ------------------
  |  Branch (1719:17): [True: 0, False: 0]
  ------------------
 1720|      0|            {
 1721|       |                /* C2v & C2. Map n2(1) <--> n1(2) */
 1722|      0|                nn1 = n2;
 1723|      0|                nn2 = n1;
 1724|      0|            }
 1725|      0|            else
 1726|      0|            {
 1727|      0|                if (mode == MAP_MODE_C2v)
  ------------------
  |  |   15|      0|#define MAP_MODE_C2v  1 /* Check for C2v reflection leading to parity inversion */
  ------------------
  |  Branch (1727:21): [True: 0, False: 0]
  ------------------
 1728|      0|                {   /* was '=', pointed by WDI */
 1729|       |                    /* i = 1 or 2
 1730|       |                     * C2v. Other neighbors must be unmoved: map
 1731|       |                     * i=1: other_neigh[0](1) <--> other_neigh[0](2)
 1732|       |                     * i=2: other_neigh[1](1) <--> other_neigh[1](2)
 1733|       |                     */
 1734|      0|                    nn1 = other_neigh[i - 1]; /* 0 or 1 */
 1735|      0|                    nn2 = other_neigh[i - 1]; /* 0 or 1 */
 1736|      0|                }
 1737|      0|                else
 1738|      0|                {
 1739|      0|                    if (mode == MAP_MODE_C2)
  ------------------
  |  |   16|      0|#define MAP_MODE_C2   2 /* Check for C2 rotation preserving parities */
  ------------------
  |  Branch (1739:25): [True: 0, False: 0]
  ------------------
 1740|      0|                    {
 1741|       |                        /* was '=', pointed by WDI */
 1742|       |                        /* i = 1 or 2
 1743|       |                         * C2.  Other neighbors should be mapped on each other
 1744|       |                         * i=1: other_neigh[0](1) <--> other_neigh[1](2)
 1745|       |                         * i=2: other_neigh[1](1) <--> other_neigh[0](2)
 1746|       |                         */
 1747|      0|                        nn1 = other_neigh[i - 1]; /* 0 or 1 */
 1748|      0|                        nn2 = other_neigh[2 - i]; /* 1 or 0 */
 1749|      0|                    }
 1750|      0|                    else
 1751|      0|                    {
 1752|      0|                        return -1; /* program error */
 1753|      0|                    }
 1754|      0|                }
 1755|      0|            }
 1756|       |
 1757|       |            /* map nn1(1) <--> nn2(2) */
 1758|      0|            nRank10 = pRankStack1[0][nn1];
 1759|      0|            nRank20 = pRankStack2[0][nn2];
 1760|      0|            nRank1 = GetMinNewRank( pRankStack1[0], pRankStack1[1], nRank10 );
 1761|      0|            nRank2 = GetMinNewRank( pRankStack2[0], pRankStack2[1], nRank20 );
 1762|      0|            if (nRank10 == nRank20 && nRank1 == nRank2)
  ------------------
  |  Branch (1762:17): [True: 0, False: 0]
  |  Branch (1762:39): [True: 0, False: 0]
  ------------------
 1763|      0|            {
 1764|      0|                if (nRank10 == nRank1)
  ------------------
  |  Branch (1764:21): [True: 0, False: 0]
  ------------------
 1765|      0|                {
 1766|      0|                    ; /* atoms are already mapped */
 1767|      0|                }
 1768|      0|                else
 1769|      0|                {
 1770|       |                    /* need additional mapping: ranks are not fixed yet */
 1771|      0|                    pRankStack1[0][nn1] = nRank1;
 1772|      0|                    nNumDiffRanks1 = DifferentiateRanksBasic( pCG, num_at_tg, NeighList,
 1773|      0|                                                 nNumDiffRanks, pRankStack1[0], nTempRank,
 1774|      0|                                                 pRankStack1[1], lNumIter, 1 );
 1775|      0|                    pRankStack2[0][nn2] = nRank2;
 1776|      0|                    nNumDiffRanks2 = DifferentiateRanksBasic( pCG, num_at_tg, NeighList,
 1777|      0|                                                 nNumDiffRanks, pRankStack2[0], nTempRank,
 1778|      0|                                                 pRankStack2[1], lNumIter, 1 );
 1779|      0|                    if (nNumDiffRanks1 != nNumDiffRanks2)
  ------------------
  |  Branch (1779:25): [True: 0, False: 0]
  ------------------
 1780|      0|                    {
 1781|      0|                        return -1; /*  <BRKPT> */
 1782|      0|                    }
 1783|      0|                }
 1784|      0|            }
 1785|      0|            else
 1786|      0|            {
 1787|      0|                return 0;  /* mapping is not possible */
 1788|      0|            }
 1789|      0|        }
 1790|      0|    }
 1791|       |
 1792|  9.60k|    if (mode == MAP_MODE_S4)
  ------------------
  |  |   17|  9.60k|#define MAP_MODE_S4   3 /* Check for S4 rotation/reflection leading to parity inversion */
  ------------------
  |  Branch (1792:9): [True: 0, False: 9.60k]
  ------------------
 1793|      0|    {
 1794|       |        /*
 1795|       |         *  Check for S4 reflection/rotation leading to parity inversion (mode=3)
 1796|       |         *
 1797|       |         * At this point n1(1) <--> n2(2) have been mapped and n1 has index in1 = 0
 1798|       |         * Below indexes in neigh_num[] are in brackets; [i] means neigh_num[i].
 1799|       |         * Numbers (#) in parentheses refer to pRankStack#
 1800|       |         *
 1801|       |         * in2=1: [0](1) <--> [1](2)  mapping has been done; add more mappings:
 1802|       |         *        [1](1) <--> [2](2)  [x]=[2]
 1803|       |         *        [2](1) <--> [3](2)  [y]=[3]
 1804|       |         *        [3](1) <--> [0](2)
 1805|       |         *        this will succeed if C2 axis crosses middle of [0]-[2] and [1]-[3] lines
 1806|       |         *
 1807|       |         * in2=2: [0](1) <--> [2](2) mapping has been done; add more mappings:
 1808|       |         *        [2](1) <--> [3](2)  [x]=[3]
 1809|       |         *        [3](1) <--> [1](2)  [y]=[1]
 1810|       |         *        [1](1) <--> [0](2)
 1811|       |         *        this will succeed if C2 axis crosses middle of [0]-[3] and [1]-[2] lines
 1812|       |         *
 1813|       |         * in2=3: [0](1) <--> [3](2) mapping has been done; add more mappings:
 1814|       |         *        [3](1) <--> [1](2)  [x]=[1]
 1815|       |         *        [1](1) <--> [2](2)  [y]=[2]
 1816|       |         *        [2](1) <--> [0](2)
 1817|       |         *        this will succeed if C2 axis crosses middle of [0]-[1] and [2]-[3] lines
 1818|       |         *
 1819|       |         * In general:
 1820|       |         *        [in1](1) <--> [in2](2)
 1821|       |         *        [in2](1) <--> [x]  (2)  i=0
 1822|       |         *        [x]  (1) <--> [y]  (2)  i=1
 1823|       |         *        [y]  (1) <--> [in1](2)  i=2
 1824|       |         *
 1825|       |         *    in1=0    always
 1826|       |         *    ===== how to find x, y from in2 ====
 1827|       |         *    in2=1 => x,y = 2, 3  or [x] = other_neigh[0], [y] = other_neigh[1]
 1828|       |         *    in2=2 => x,y = 3, 1  or [x] = other_neigh[1], [y] = other_neigh[0]
 1829|       |         *    in2=3 => x,y = 1, 2  or [x] = other_neigh[0], [y] = other_neigh[1]
 1830|       |         *    ====================================
 1831|       |         */
 1832|      0|        AT_RANK nRank10, nRank20;
 1833|      0|        int     nn1, nn2;
 1834|      0|        for (i = 0; i <= 2; i++)
  ------------------
  |  Branch (1834:21): [True: 0, False: 0]
  ------------------
 1835|      0|        {
 1836|      0|            switch (i)
 1837|      0|            {
 1838|      0|                case 0:  /* [in2](1) <--> [x](2);  */
  ------------------
  |  Branch (1838:17): [True: 0, False: 0]
  ------------------
 1839|      0|                    nn1 = n2;                    /* [in2] */
 1840|      0|                    nn2 = other_neigh[1 - in2 % 2];  /* [x]   */
 1841|      0|                    break;
 1842|      0|                case 1:  /* [x](1) <--> [y](2) */
  ------------------
  |  Branch (1842:17): [True: 0, False: 0]
  ------------------
 1843|      0|                    nn1 = other_neigh[1 - in2 % 2];  /* [x]   */
 1844|      0|                    nn2 = other_neigh[in2 % 2];  /* [y]   */
 1845|      0|                    break;
 1846|      0|                case 2:
  ------------------
  |  Branch (1846:17): [True: 0, False: 0]
  ------------------
 1847|      0|                    nn1 = other_neigh[in2 % 2];  /* [y]   */
 1848|      0|                    nn2 = n1;                    /* [in1] */
 1849|      0|                    break;
 1850|      0|                default:
  ------------------
  |  Branch (1850:17): [True: 0, False: 0]
  ------------------
 1851|      0|                    return -1; /* program error */
 1852|      0|            }
 1853|       |            /* map nn1(1) <--> nn2(2) */
 1854|      0|            nRank10 = pRankStack1[0][nn1];
 1855|      0|            nRank20 = pRankStack2[0][nn2];
 1856|      0|            nRank1 = GetMinNewRank( pRankStack1[0], pRankStack1[1], nRank10 );
 1857|      0|            nRank2 = GetMinNewRank( pRankStack2[0], pRankStack2[1], nRank20 );
 1858|      0|            if (nRank10 == nRank20 && nRank1 == nRank2)
  ------------------
  |  Branch (1858:17): [True: 0, False: 0]
  |  Branch (1858:39): [True: 0, False: 0]
  ------------------
 1859|      0|            {
 1860|      0|                if (nRank10 == nRank1)
  ------------------
  |  Branch (1860:21): [True: 0, False: 0]
  ------------------
 1861|      0|                {
 1862|      0|                    ;/* atoms are already mapped */
 1863|      0|                }
 1864|      0|                else
 1865|      0|                {
 1866|       |                             /* need additional mapping: ranks are not fixed yet */
 1867|      0|                    pRankStack1[0][nn1] = nRank1;
 1868|      0|                    nNumDiffRanks1 = DifferentiateRanksBasic( pCG, num_at_tg, NeighList,
 1869|      0|                                                 nNumDiffRanks, pRankStack1[0], nTempRank,
 1870|      0|                                                 pRankStack1[1], lNumIter, 1 );
 1871|      0|                    pRankStack2[0][nn2] = nRank2;
 1872|      0|                    nNumDiffRanks2 = DifferentiateRanksBasic( pCG, num_at_tg, NeighList,
 1873|      0|                                                 nNumDiffRanks, pRankStack2[0], nTempRank,
 1874|      0|                                                 pRankStack2[1], lNumIter, 1 );
 1875|       |
 1876|      0|                    if (nNumDiffRanks1 != nNumDiffRanks2)
  ------------------
  |  Branch (1876:25): [True: 0, False: 0]
  ------------------
 1877|      0|                    {
 1878|      0|                        return -1; /*  <BRKPT> */
 1879|      0|                    }
 1880|      0|                }
 1881|      0|            }
 1882|      0|            else
 1883|      0|            {
 1884|      0|                return 0;  /* mapping is not possible */
 1885|      0|            }
 1886|      0|        }
 1887|      0|    }
 1888|       |
 1889|  9.60k|#if ( BREAK_ONE_MORE_SC_TIE == 1 ) /* { */
 1890|       |    /* Check for a very highly symmetrical stereo center 12-06-2002 */
 1891|  9.60k|    if (ib >= num_atoms && at[ia].valence == MAX_NUM_STEREO_ATOM_NEIGH)
  ------------------
  |  |  877|  9.59k|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (1891:9): [True: 9.59k, False: 14]
  |  Branch (1891:28): [True: 8.63k, False: 955]
  ------------------
 1892|  8.63k|    {
 1893|  8.63k|        int num_eq;
 1894|  8.63k|        nRank1 = pRankStack1[0][n2];
 1895|  43.1k|        for (i = 0, num_eq = 0; i < at[ia].valence; i++)
  ------------------
  |  Branch (1895:33): [True: 34.5k, False: 8.63k]
  ------------------
 1896|  34.5k|        {
 1897|  34.5k|            num_eq += ( nRank1 == pRankStack1[0][at[ia].neighbor[i]] );
 1898|  34.5k|        }
 1899|  8.63k|        if (num_eq == MAX_NUM_STEREO_ATOM_NEIGH - 1)
  ------------------
  |  |  877|  8.63k|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (1899:13): [True: 5.76k, False: 2.87k]
  ------------------
 1900|  5.76k|        {
 1901|  23.0k|            for (i = (int) nRank1 - 1; 0 <= i && nRank1 == ( nRank2 = pRankStack1[0][(int) pRankStack1[1][i]] ); i--)
  ------------------
  |  Branch (1901:40): [True: 23.0k, False: 0]
  |  Branch (1901:50): [True: 17.2k, False: 5.76k]
  ------------------
 1902|  17.2k|            {
 1903|  17.2k|                ;
 1904|  17.2k|            }
 1905|  5.76k|            if (i >= 0)
  ------------------
  |  Branch (1905:17): [True: 5.76k, False: 0]
  ------------------
 1906|  5.76k|            {
 1907|  5.76k|                nRank2++;
 1908|  5.76k|            }
 1909|      0|            else
 1910|      0|            {
 1911|      0|                nRank2 = 1;
 1912|      0|            }
 1913|       |
 1914|       |            /*  7a. Break another neighbor tie */
 1915|  5.76k|            nNumDiffRanks = nNumDiffRanks1;
 1916|       |
 1917|  5.76k|            pRankStack1[0][n2] = nRank2;
 1918|  5.76k|            nNumDiffRanks1 = DifferentiateRanksBasic( pCG, num_at_tg, NeighList,
 1919|  5.76k|                                         nNumDiffRanks, pRankStack1[0], nTempRank,
 1920|  5.76k|                                         pRankStack1[1], lNumIter, 1 );
 1921|       |
 1922|  5.76k|            pRankStack2[0][n1] = nRank2;
 1923|  5.76k|            nNumDiffRanks2 = DifferentiateRanksBasic( pCG, num_at_tg, NeighList,
 1924|  5.76k|                                         nNumDiffRanks, pRankStack2[0], nTempRank,
 1925|  5.76k|                                         pRankStack2[1], lNumIter, 1 );
 1926|  5.76k|        }
 1927|  8.63k|    }
 1928|       |
 1929|  9.60k|    if (nNumDiffRanks1 != nNumDiffRanks2)
  ------------------
  |  Branch (1929:9): [True: 0, False: 9.60k]
  ------------------
 1930|      0|    {
 1931|      0|        return -1; /*  <BRKPT> */
 1932|      0|    }
 1933|  9.60k|#endif /* } BREAK_ONE_MORE_SC_TIE */
 1934|       |
 1935|       |#if ( BREAK_ALSO_NEIGH_TIE == 1 )
 1936|       |    /* check whether neighbor's neighbors are tied and untie them */
 1937|       |    if (at[n1].nRingSystem == at[n2].nRingSystem &&  ib >= num_atoms)
 1938|       |    {
 1939|       |        AT_RANK NeighNeighList[MAX_NUM_STEREO_ATOM_NEIGH + 1];
 1940|       |        int m, neigh1 = -1, neigh2 = -1;
 1941|       |        nRank1 = nRank2 = 0;
 1942|       |        /* n1 */
 1943|       |        NeighNeighList[0] = at[n1].valence - 1; /* for insertions_sort_NeighListBySymmAndCanonRank() */
 1944|       |        for (i = 0, m = 1; i < at[n1].valence; i++)
 1945|       |        {
 1946|       |            int neigh = at[n1].neighbor[i];
 1947|       |            if (neigh != ia)
 1948|       |            {
 1949|       |                NeighNeighList[m++] = neigh;
 1950|       |            }
 1951|       |        }
 1952|       |        insertions_sort_NeighListBySymmAndCanonRank( NeighNeighList, pRankStack1[0], nCanonRank );
 1953|       |        for (m = 2; m < at[n1].valence; m++)
 1954|       |        {
 1955|       |            if (pRankStack1[0][NeighNeighList[m]] == pRankStack1[0][NeighNeighList[m - 1]])
 1956|       |            {
 1957|       |                neigh1 = NeighNeighList[m - 1];
 1958|       |                break;
 1959|       |            }
 1960|       |        }
 1961|       |        /* n2 */
 1962|       |        NeighNeighList[0] = at[n2].valence - 1; /* for insertions_sort_NeighListBySymmAndCanonRank() */
 1963|       |        for (i = 0, m = 1; i < at[n2].valence; i++)
 1964|       |        {
 1965|       |            int neigh = at[n2].neighbor[i];
 1966|       |            if (neigh != ia)
 1967|       |            {
 1968|       |                NeighNeighList[m++] = neigh;
 1969|       |            }
 1970|       |        }
 1971|       |        insertions_sort_NeighListBySymmAndCanonRank( NeighNeighList, pRankStack2[0], nCanonRank );
 1972|       |        for (m = 2; m < at[n2].valence; m++)
 1973|       |        {
 1974|       |            if (pRankStack2[0][NeighNeighList[m]] == pRankStack2[0][NeighNeighList[m - 1]])
 1975|       |            {
 1976|       |#if ( BREAK_ALSO_NEIGH_TIE_ROTATE == 1 )
 1977|       |                neigh2 = NeighNeighList[m];    /* [m] to obtain same axis orientation  around ia<neigh */
 1978|       |#else
 1979|       |                neigh2 = NeighNeighList[m - 1];  /* [m-1] to obtain reflection ??? */
 1980|       |#endif
 1981|       |                break;
 1982|       |            }
 1983|       |        }
 1984|       |        if (neigh1 >= 0 && neigh2 >= 0 && pRankStack1[0][neigh1] == pRankStack2[0][neigh2])
 1985|       |        {
 1986|       |            /* neighbors' neighbors are tied */
 1987|       |            nRank1 = pRankStack1[0][neigh1];
 1988|       |            nRank2 = GetMinNewRank( pRankStack1[0], pRankStack1[1], nRank1 );
 1989|       |
 1990|       |            /*  Break neighbor's neighbor tie */
 1991|       |
 1992|       |            nNumDiffRanks = nNumDiffRanks1;
 1993|       |
 1994|       |            pRankStack1[0][neigh1] = nRank2;
 1995|       |            nNumDiffRanks1 = DifferentiateRanksBasic( pCG, num_at_tg, NeighList,
 1996|       |                                         nNumDiffRanks, pRankStack1[0], nTempRank,
 1997|       |                                         pRankStack1[1], lNumIter, 1 );
 1998|       |
 1999|       |            pRankStack2[0][neigh2] = nRank2;
 2000|       |            nNumDiffRanks2 = DifferentiateRanksBasic( pCG, num_at_tg, NeighList,
 2001|       |                                         nNumDiffRanks, pRankStack2[0], nTempRank,
 2002|       |                                         pRankStack2[1], lNumIter, 1 );
 2003|       |        }
 2004|       |    }
 2005|       |#endif
 2006|       |
 2007|       |    /*  for debug only */
 2008|  58.8k|    for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (2008:17): [True: 49.2k, False: 9.60k]
  ------------------
 2009|  49.2k|    {
 2010|  49.2k|        if (pRankStack1[0][(int) pRankStack1[1][i]] != pRankStack2[0][(int) pRankStack2[1][i]])
  ------------------
  |  Branch (2010:13): [True: 0, False: 49.2k]
  ------------------
 2011|      0|        {
 2012|      0|            return -1;  /*  <BRKPT> */
 2013|      0|        }
 2014|  49.2k|    }
 2015|       |
 2016|       |    /*  Resort lists of  neighbors */
 2017|  9.60k|    SortNeighListsBySymmAndCanonRank( num_atoms, nl1, pRankStack1[0], nCanonRank );
 2018|  9.60k|    SortNeighListsBySymmAndCanonRank( num_atoms, nl2, pRankStack2[0], nCanonRank );
 2019|       |
 2020|  9.60k|    return nNumDiffRanks1 + 1;
 2021|  9.60k|}
CheckNextSymmNeighborsAndBonds:
 2037|  75.5k|{
 2038|  75.5k|    AT_RANK s1 = 0, s2 = 0;
 2039|  75.5k|    int     i1, i2, k1, k2;
 2040|  75.5k|    if (nRank1[n1] != nRank2[n2])
  ------------------
  |  Branch (2040:9): [True: 0, False: 75.5k]
  ------------------
 2041|      0|    {
 2042|      0|        return -1; /*  parallel traversal in stereo removal failed */ /*   <BRKPT> */
 2043|      0|    }
 2044|  75.5k|    switch (!nVisited1[n1] + !nVisited2[n2])
  ------------------
  |  Branch (2044:13): [True: 55.0k, False: 20.5k]
  ------------------
 2045|  75.5k|    {
 2046|  55.0k|        case 0:
  ------------------
  |  Branch (2046:9): [True: 55.0k, False: 20.5k]
  ------------------
 2047|  55.0k|            if (nVisited1[n1] != n2 + 1 || nVisited2[n2] != n1 + 1)
  ------------------
  |  Branch (2047:17): [True: 0, False: 55.0k]
  |  Branch (2047:44): [True: 0, False: 55.0k]
  ------------------
 2048|      0|            {
 2049|      0|                return -1; /*  0; */ /*  possibly error???: we have come to an alreardy traversed pair and */
 2050|       |                           /*  found that the pair previously has not been traversed synchroneously. */
 2051|      0|            }              /*  -- Happens in C60. */
 2052|  55.0k|            break;
 2053|  55.0k|        case 1:
  ------------------
  |  Branch (2053:9): [True: 0, False: 75.5k]
  ------------------
 2054|      0|            return -1; /*  0; */ /*  possibly error: one is zero, another is not a zero. Happens in C60 */
 2055|       |
 2056|       |        /*  case 2: */
 2057|       |            /* both are zero, OK. */
 2058|  75.5k|    }
 2059|       |
 2060|  75.5k|    if (nVisitOrd1[n1] != nVisitOrd2[n2])
  ------------------
  |  Branch (2060:9): [True: 0, False: 75.5k]
  ------------------
 2061|      0|    {
 2062|      0|        return -1; /*  0; */ /*  different DFS trees */
 2063|      0|    }
 2064|       |    /*  at[n1] and at[n2] are next to at[cur1] and at[cur2] respectively */
 2065|       |    /*  Even though the bond might have already been checked, check whether */
 2066|       |    /*  it is a stereo bond/cumulene. If it is, check the bond/cumulene parity. */
 2067|       |
 2068|       |    /*  Even though the bond or cumulene might have already been checked, check it: this is */
 2069|       |    /*  the only place we can check stereo bonds and cumulenes that are not edges of the DFS tree */
 2070|       |    /*  The code works both for a stereo bond and a stereogenic cumulene. */
 2071|       |
 2072|  75.5k|    for (i1 = 0, k1 = 0; i1 < MAX_NUM_STEREO_BONDS &&
  ------------------
  |  |  873|   151k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2072:26): [True: 75.5k, False: 0]
  ------------------
 2073|  75.5k|        ( s1 = at[cur1].stereo_bond_neighbor[i1] ) &&
  ------------------
  |  Branch (2073:9): [True: 64, False: 75.5k]
  ------------------
 2074|     64|                         !( k1 = ( at[cur1].neighbor[(int) at[cur1].stereo_bond_ord[i1]] == n1 ) ); i1++)
  ------------------
  |  Branch (2074:26): [True: 22, False: 42]
  ------------------
 2075|     22|    {
 2076|     22|        ;
 2077|     22|    }
 2078|  75.5k|    for (i2 = 0, k2 = 0; i2 < MAX_NUM_STEREO_BONDS &&
  ------------------
  |  |  873|   151k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2078:26): [True: 75.5k, False: 0]
  ------------------
 2079|  75.5k|        ( s2 = at[cur2].stereo_bond_neighbor[i2] ) &&
  ------------------
  |  Branch (2079:9): [True: 63, False: 75.5k]
  ------------------
 2080|     63|                         !( k2 = ( at[cur2].neighbor[(int) at[cur2].stereo_bond_ord[i2]] == n2 ) ); i2++)
  ------------------
  |  Branch (2080:26): [True: 21, False: 42]
  ------------------
 2081|     21|    {
 2082|     21|        ;
 2083|     21|    }
 2084|       |
 2085|       |    /* -- this does not work in case of cumulenes --
 2086|       |    for ( i1 = 0, k1 = 0; i1 < MAX_NUM_STEREO_BONDS && (s1=at[cur1].stereo_bond_neighbor[i1]) && !(k1=(s1-1 == n1)); i1 ++ )
 2087|       |        ;
 2088|       |    for ( i2 = 0, k2 = 0; i2 < MAX_NUM_STEREO_BONDS && (s2=at[cur2].stereo_bond_neighbor[i2]) && !(k2=(s2-1 == n2)); i2 ++ )
 2089|       |        ;
 2090|       |    */
 2091|       |
 2092|  75.5k|    if (k1 != k2)
  ------------------
  |  Branch (2092:9): [True: 0, False: 75.5k]
  ------------------
 2093|      0|    {
 2094|      0|        return 0; /*  not an error: a stereo bond and not a stereo bond */
 2095|      0|    }
 2096|  75.5k|    if (k1)
  ------------------
  |  Branch (2096:9): [True: 42, False: 75.5k]
  ------------------
 2097|     42|    {
 2098|       |        /* here k1 == k2 */
 2099|     42|        int bCheckBond1, bCheckBond2;
 2100|     42|        s1--;
 2101|     42|        s2--;
 2102|       |
 2103|     42|        bCheckBond1 = ( cur1 != nAvoidCheckAtom[0] || s1 != nAvoidCheckAtom[1] ) &&
  ------------------
  |  Branch (2103:25): [True: 42, False: 0]
  |  Branch (2103:55): [True: 0, False: 0]
  ------------------
 2104|     42|            ( cur1 != nAvoidCheckAtom[1] || s1 != nAvoidCheckAtom[0] );
  ------------------
  |  Branch (2104:15): [True: 42, False: 0]
  |  Branch (2104:45): [True: 0, False: 0]
  ------------------
 2105|     42|        bCheckBond2 = ( cur2 != nAvoidCheckAtom[0] || s2 != nAvoidCheckAtom[1] ) &&
  ------------------
  |  Branch (2105:25): [True: 42, False: 0]
  |  Branch (2105:55): [True: 0, False: 0]
  ------------------
 2106|     42|            ( cur2 != nAvoidCheckAtom[1] || s2 != nAvoidCheckAtom[0] );
  ------------------
  |  Branch (2106:15): [True: 42, False: 0]
  |  Branch (2106:45): [True: 0, False: 0]
  ------------------
 2107|       |
 2108|     42|        if (bCheckBond1 != bCheckBond2)
  ------------------
  |  Branch (2108:13): [True: 0, False: 42]
  ------------------
 2109|      0|            return 0;
 2110|       |
 2111|     42|        if (!bCheckBond1 && !bCheckBond2)
  ------------------
  |  Branch (2111:13): [True: 0, False: 42]
  |  Branch (2111:29): [True: 0, False: 0]
  ------------------
 2112|      0|        {
 2113|      0|            return 1; /*  do not go any further in this direction */
 2114|      0|        }
 2115|       |
 2116|     42|        if (at[cur1].stereo_bond_parity[i1] != at[cur2].stereo_bond_parity[i2])
  ------------------
  |  Branch (2116:13): [True: 5, False: 37]
  ------------------
 2117|      5|        {
 2118|       |            /*  different values of  at[].stereo_bond_parity: definitely different bonds */
 2119|       |            /*  known parities */
 2120|      5|            if (PARITY_KNOWN( at[cur1].stereo_bond_parity[i1] ) &&
  ------------------
  |  |  265|     10|#define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|      5|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|     10|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      5|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|      5|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      5|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|      5|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (265:38): [True: 5, False: 0]
  |  |  |  Branch (265:78): [True: 5, False: 0]
  |  |  ------------------
  ------------------
 2121|      5|                 PARITY_KNOWN( at[cur2].stereo_bond_parity[i2] ))
  ------------------
  |  |  265|      5|#define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|      5|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|     10|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      5|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|      5|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      5|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|      5|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (265:38): [True: 5, False: 0]
  |  |  |  Branch (265:78): [True: 5, False: 0]
  |  |  ------------------
  ------------------
 2122|      5|            {
 2123|      5|                return 0; /*  different currently known stereo bond parities */
 2124|      5|            }
 2125|       |#if ( PROPAGATE_ILL_DEF_STEREO != 1 )
 2126|       |            /*  well defined and to be calculated from the ranks */
 2127|       |            if (!( PARITY_CALCULATE( at[cur1].stereo_bond_parity[i1] ) && PARITY_WELL_DEF( at[cur2].stereo_bond_parity[i2] ) ||
 2128|       |                PARITY_WELL_DEF( at[cur1].stereo_bond_parity[i1] ) && PARITY_CALCULATE( at[cur2].stereo_bond_parity[i2] ) ||
 2129|       |                PARITY_CALCULATE( at[cur1].stereo_bond_parity[i1] ) && PARITY_CALCULATE( at[cur2].stereo_bond_parity[i2] ) ))
 2130|       |            {
 2131|       |/*  do not reject if: "well defined" and "calculate" or "calculate" and "calculate" */
 2132|       |                return 0;
 2133|       |            }
 2134|       |#endif
 2135|      5|        }
 2136|       |
 2137|       |#if ( PROPAGATE_ILL_DEF_STEREO != 1 )
 2138|       |        if (( cur1 != cur2 || s1 != s2 ) && ( cur1 != s2 || cur2 != s1 ))
 2139|       |        {
 2140|       |/*  two different stereo bonds */
 2141|       |            if (PARITY_ILL_DEF( at[cur1].stereo_bond_parity[i1] ) ||
 2142|       |                 PARITY_ILL_DEF( at[cur2].stereo_bond_parity[i2] ))
 2143|       |            {
 2144|       |                return 0;
 2145|       |            }
 2146|       |        }
 2147|       |#endif
 2148|     42|    }
 2149|       |
 2150|  75.5k|    return 1; /*  stereo bonds to n1 and n2 have same known parities or are not stereo bonds */
 2151|  75.5k|}
CreateCheckSymmPaths:
 2174|  30.1k|{
 2175|  30.1k|    int k, k1, k2, ret = 0, bParitiesInvertedZero = 0, *pbParitiesInverted;
 2176|  30.1k|    AT_RANK n1, n2;
 2177|       |
 2178|  30.1k|    nVisited1[cur1] = cur2 + 1;  /*  symmetrically exchange atom numbers */
 2179|  30.1k|    nVisited2[cur2] = cur1 + 1;
 2180|       |
 2181|  30.1k|    ( *nLength )++;
 2182|       |
 2183|  30.1k|    nVisitOrd1[cur1] = *nLength; /*  save DFS visit order */
 2184|  30.1k|    nVisitOrd2[cur2] = *nLength;
 2185|       |
 2186|       |    /* new version allows all inverted parities */
 2187|  30.1k|    if (PARITY_WELL_DEF( at[cur1].stereo_atom_parity ) &&
  ------------------
  |  |  266|  60.2k|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  30.1k|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|  60.2k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  30.1k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|  23.0k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  23.0k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|  23.0k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 23.0k, False: 7.10k]
  |  |  |  Branch (266:85): [True: 72, False: 22.9k]
  |  |  ------------------
  ------------------
 2188|     72|         PARITY_WELL_DEF( at[cur2].stereo_atom_parity ))
  ------------------
  |  |  266|     72|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|     72|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|    144|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|     72|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|     68|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|     68|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|     68|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 68, False: 4]
  |  |  |  Branch (266:85): [True: 58, False: 10]
  |  |  ------------------
  ------------------
 2189|     58|    {
 2190|     58|        if (*bParitiesInverted < 0)
  ------------------
  |  Branch (2190:13): [True: 0, False: 58]
  ------------------
 2191|      0|        {
 2192|      0|            *bParitiesInverted = ( at[cur1].stereo_atom_parity + at[cur2].stereo_atom_parity ) % 2;
 2193|      0|        }
 2194|     58|        else
 2195|     58|        {
 2196|     58|            if (*bParitiesInverted != ( at[cur1].stereo_atom_parity + at[cur2].stereo_atom_parity ) % 2)
  ------------------
  |  Branch (2196:17): [True: 31, False: 27]
  ------------------
 2197|     31|            {
 2198|     31|                return 0; /*  Different known in advance parities have wrong "inverted" relation */
 2199|     31|            }
 2200|     58|        }
 2201|     58|    }
 2202|  30.0k|    else
 2203|  30.0k|    {
 2204|  30.0k|        if (PARITY_KNOWN( at[cur1].stereo_atom_parity ) &&
  ------------------
  |  |  265|  60.1k|#define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|  30.0k|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|  60.1k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  30.0k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|  22.9k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  22.9k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|  22.9k|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (265:38): [True: 22.9k, False: 7.10k]
  |  |  |  Branch (265:78): [True: 13.1k, False: 9.84k]
  |  |  ------------------
  ------------------
 2205|  13.1k|            PARITY_KNOWN( at[cur2].stereo_atom_parity ) &&
  ------------------
  |  |  265|  43.1k|#define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|  13.1k|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|  26.2k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  13.1k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|  12.3k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  12.3k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|  12.3k|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (265:38): [True: 12.3k, False: 714]
  |  |  |  Branch (265:78): [True: 9.13k, False: 3.26k]
  |  |  ------------------
  ------------------
 2206|  9.13k|            at[cur1].stereo_atom_parity != at[cur2].stereo_atom_parity)
  ------------------
  |  Branch (2206:13): [True: 295, False: 8.83k]
  ------------------
 2207|    295|        {
 2208|    295|            return 0;  /*  Different known in advance parities */
 2209|    295|        }
 2210|  30.0k|    }
 2211|       |
 2212|  29.7k|    if (cur1 != cur2 &&
  ------------------
  |  Branch (2212:9): [True: 16.3k, False: 13.4k]
  ------------------
 2213|  16.3k|         !at[cur1].stereo_bond_neighbor[0] && !at[cur2].stereo_bond_neighbor[0] &&
  ------------------
  |  Branch (2213:10): [True: 16.3k, False: 44]
  |  Branch (2213:47): [True: 16.3k, False: 0]
  ------------------
 2214|  16.3k|         PARITY_KNOWN( at[cur1].parity ) != PARITY_KNOWN( at[cur2].parity ))
  ------------------
  |  |  265|  16.3k|#define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|  16.3k|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|  32.6k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  16.3k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|  13.4k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  13.4k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|  13.4k|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (265:38): [True: 13.4k, False: 2.83k]
  |  |  |  Branch (265:78): [True: 13.4k, False: 0]
  |  |  ------------------
  ------------------
                       PARITY_KNOWN( at[cur1].parity ) != PARITY_KNOWN( at[cur2].parity ))
  ------------------
  |  |  265|  16.3k|#define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|  16.3k|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|  32.6k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  16.3k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|  14.3k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  14.3k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|  14.3k|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (265:38): [True: 14.3k, False: 1.92k]
  |  |  |  Branch (265:78): [True: 14.3k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2214:10): [True: 2.69k, False: 13.6k]
  ------------------
 2215|  2.69k|    {
 2216|  2.69k|        return 0; /*  one atom is stereogenic, another (presumably equivalent) is not. 9-11-2002 */
 2217|  2.69k|    }
 2218|       |#if ( PROPAGATE_ILL_DEF_STEREO != 1 )
 2219|       |    if (cur1 != cur2 &&
 2220|       |        ( PARITY_ILL_DEF( at[cur1].stereo_atom_parity ) ||
 2221|       |            PARITY_ILL_DEF( at[cur2].stereo_atom_parity ) )
 2222|       |       )
 2223|       |    {
 2224|       |        return 0;  /*  Cannot detect whether the paths are same or different */
 2225|       |    }
 2226|       |#endif
 2227|       |
 2228|  27.1k|    if (at[cur1].valence != at[cur2].valence)
  ------------------
  |  Branch (2228:9): [True: 0, False: 27.1k]
  ------------------
 2229|      0|    {
 2230|      0|        return CT_REMOVE_STEREO_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   33|      0|#define CT_REMOVE_STEREO_ERR (CT_ERR_FIRST-14)  /*(-30014) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 2231|      0|    }
 2232|  27.1k|    if (at[cur1].valence == 1)
  ------------------
  |  Branch (2232:9): [True: 261, False: 26.8k]
  ------------------
 2233|    261|    {
 2234|    261|        return 1; /*  so far success */
 2235|    261|    }
 2236|       |
 2237|  26.8k|    if (nl1[(int) cur1][0] != nl2[(int) cur2][0] || nl1[(int) cur1][0] != at[cur1].valence)
  ------------------
  |  Branch (2237:9): [True: 0, False: 26.8k]
  |  Branch (2237:53): [True: 0, False: 26.8k]
  ------------------
 2238|      0|    {
 2239|      0|        return CT_REMOVE_STEREO_ERR; /*  error: different valences */ /*   <BRKPT> */
  ------------------
  |  |   33|      0|#define CT_REMOVE_STEREO_ERR (CT_ERR_FIRST-14)  /*(-30014) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 2240|      0|    }
 2241|       |
 2242|       |
 2243|   102k|    for (k = 1, k1 = 1, k2 = 1; k < at[cur1].valence; k++, k1++, k2++)
  ------------------
  |  Branch (2243:33): [True: 75.5k, False: 26.6k]
  ------------------
 2244|  75.5k|    {
 2245|  75.5k|        if (( n1 = nl1[(int) cur1][k1] ) == prev1)
  ------------------
  |  Branch (2245:13): [True: 20.1k, False: 55.3k]
  ------------------
 2246|  20.1k|        {
 2247|  20.1k|            n1 = nl1[(int) cur1][++k1]; /*  don't go back */
 2248|  20.1k|        }
 2249|  75.5k|        if (( n2 = nl2[(int) cur2][k2] ) == prev2)
  ------------------
  |  Branch (2249:13): [True: 20.1k, False: 55.3k]
  ------------------
 2250|  20.1k|        {
 2251|  20.1k|            n2 = nl2[(int) cur2][++k2]; /*  don't go back */
 2252|  20.1k|        }
 2253|       |
 2254|  75.5k|        if (0 >= ( ret = CheckNextSymmNeighborsAndBonds( at, cur1, cur2, n1, n2, nAvoidCheckAtom,
  ------------------
  |  Branch (2254:13): [True: 5, False: 75.5k]
  ------------------
 2255|  75.5k|            nVisited1, nVisited2, nVisitOrd1, nVisitOrd2, nRank1, nRank2 ) ))
 2256|      5|        {
 2257|      5|            return ret; /*  different neighbors or bonds                       */
 2258|      5|        }
 2259|       |
 2260|  75.5k|        if (!nVisited1[n1])
  ------------------
  |  Branch (2260:13): [True: 20.5k, False: 55.0k]
  ------------------
 2261|  20.5k|        {
 2262|       |            /*  recursion */
 2263|       |            /* allow all inverted parities only inside a single ring system containing the starting point */
 2264|  20.5k|            pbParitiesInverted = ( at[cur1].nRingSystem == at[n1].nRingSystem ) ? bParitiesInverted : &bParitiesInvertedZero;
  ------------------
  |  Branch (2264:34): [True: 20.2k, False: 303]
  ------------------
 2265|  20.5k|            if (0 >= ( ret = CreateCheckSymmPaths( at, cur1, n1, cur2, n2, nAvoidCheckAtom,
  ------------------
  |  Branch (2265:17): [True: 143, False: 20.3k]
  ------------------
 2266|  20.5k|                nVisited1, nVisited2, nVisitOrd1, nVisitOrd2,
 2267|  20.5k|                nl1, nl2, nRank1, nRank2, nCanonRank, nLength, pbParitiesInverted, mode ) ))
 2268|    143|            {
 2269|    143|                return ret;
 2270|    143|            }
 2271|  20.5k|        }
 2272|  75.5k|    }
 2273|       |
 2274|  26.6k|    return 1; /*  Success */
 2275|  26.8k|}
CalculatedPathsParitiesAreIdentical:
 2382|  9.60k|{
 2383|  9.60k|    int i, i01, i02, i11, i12, i21, i22, k, parity, parity1, parity2, parity12, num_other_neigh;
 2384|  9.60k|    int nNumEqStereogenic, nCheckingMode, not_well_def_parities;
 2385|  9.60k|    AT_RANK other_neigh[MAX_NUM_STEREO_ATOM_NEIGH], neigh, r1, r2;
 2386|  9.60k|    int  nNumComparedCenters = 0, nNumComparedBonds = 0, bCurParityInv1 = 0 /*, bCurParityInv2=0*/;
 2387|  9.60k|    int  bCurRotated = 0, nNumDiff = 0, nNumInv = 0;
 2388|  9.60k|    int  s1, s2;
 2389|       |
 2390|  9.60k|    nCheckingMode = ( prev_sb_neigh < num_atoms ) ? CHECKING_STEREOBOND : CHECKING_STEREOCENTER;
  ------------------
  |  | 2286|     14|#define CHECKING_STEREOBOND    2
  ------------------
                  nCheckingMode = ( prev_sb_neigh < num_atoms ) ? CHECKING_STEREOBOND : CHECKING_STEREOCENTER;
  ------------------
  |  | 2285|  19.1k|#define CHECKING_STEREOCENTER  1
  ------------------
  |  Branch (2390:21): [True: 14, False: 9.59k]
  ------------------
 2391|  9.60k|    not_well_def_parities = 0;
 2392|  9.60k|    nNumEqStereogenic = 0;
 2393|       |
 2394|  9.60k|    if ((nNeighMode != NEIGH_MODE_RING &&
  ------------------
  |  | 2282|  19.2k|#define NEIGH_MODE_RING        1
  ------------------
  |  Branch (2394:10): [True: 0, False: 9.60k]
  ------------------
 2395|  9.60k|         bParitiesInverted != 0) || abs( bParitiesInverted ) != 1) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2395:10): [True: 0, False: 0]
  |  Branch (2395:37): [True: 9.60k, False: 0]
  ------------------
 2396|  9.60k|    {
 2397|  9.60k|        bParitiesInverted = 0;
 2398|  9.60k|    }
 2399|       |
 2400|  9.60k|    if (bParitiesInverted)
  ------------------
  |  Branch (2400:9): [True: 0, False: 9.60k]
  ------------------
 2401|      0|    {
 2402|      0|        for (i = 0, i11 = i22 = 0; i < num_atoms; i++)
  ------------------
  |  Branch (2402:36): [True: 0, False: 0]
  ------------------
 2403|      0|        {
 2404|       |            /* count number of atoms that have not been visited */
 2405|      0|            i11 += !nVisited1[i];
 2406|      0|            i22 += !nVisited2[i];
 2407|      0|            nAtomNumberCanon1[i] = MAX_ATOMS + 1;  /*  mark unchanged */
  ------------------
  |  |   15|      0|#define MAX_ATOMS  32766
  ------------------
 2408|      0|            nAtomNumberCanon2[i] = MAX_ATOMS + 1;  /*  mark unchanged */
  ------------------
  |  |   15|      0|#define MAX_ATOMS  32766
  ------------------
 2409|      0|        }
 2410|      0|        if (i11 || i22)
  ------------------
  |  Branch (2410:13): [True: 0, False: 0]
  |  Branch (2410:20): [True: 0, False: 0]
  ------------------
 2411|      0|        {
 2412|      0|            if (bParitiesInverted == 1)
  ------------------
  |  Branch (2412:17): [True: 0, False: 0]
  ------------------
 2413|      0|            {
 2414|      0|                return 0; /* only a part of the structure has been inverted */
 2415|      0|            }
 2416|      0|            else
 2417|      0|            {
 2418|      0|                bParitiesInverted = 0;
 2419|      0|            }
 2420|      0|        }
 2421|      0|    }
 2422|  9.60k|    else
 2423|  9.60k|    {
 2424|  58.8k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (2424:21): [True: 49.2k, False: 9.60k]
  ------------------
 2425|  49.2k|        {
 2426|  49.2k|            nAtomNumberCanon1[i] = MAX_ATOMS + 1;  /*  mark unchanged */
  ------------------
  |  |   15|  49.2k|#define MAX_ATOMS  32766
  ------------------
 2427|  49.2k|            nAtomNumberCanon2[i] = MAX_ATOMS + 1;  /*  mark unchanged */
  ------------------
  |  |   15|  49.2k|#define MAX_ATOMS  32766
  ------------------
 2428|  49.2k|        }
 2429|  9.60k|    }
 2430|  9.60k|    if ((bParitiesInverted > 0 && !( mode == MAP_MODE_C2v || mode == MAP_MODE_S4 )) ||
  ------------------
  |  |   15|      0|#define MAP_MODE_C2v  1 /* Check for C2v reflection leading to parity inversion */
  ------------------
                  if ((bParitiesInverted > 0 && !( mode == MAP_MODE_C2v || mode == MAP_MODE_S4 )) ||
  ------------------
  |  |   17|      0|#define MAP_MODE_S4   3 /* Check for S4 rotation/reflection leading to parity inversion */
  ------------------
  |  Branch (2430:10): [True: 0, False: 9.60k]
  |  Branch (2430:38): [True: 0, False: 0]
  |  Branch (2430:62): [True: 0, False: 0]
  ------------------
 2431|  9.60k|         (bParitiesInverted == 0 && !( mode == MAP_MODE_C2 || mode == MAP_MODE_STD ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   16|  19.2k|#define MAP_MODE_C2   2 /* Check for C2 rotation preserving parities */
  ------------------
                       (bParitiesInverted == 0 && !( mode == MAP_MODE_C2 || mode == MAP_MODE_STD ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   14|  9.60k|#define MAP_MODE_STD  0 /* Standard approach: switch 2 neighbors */
  ------------------
  |  Branch (2431:11): [True: 9.60k, False: 0]
  |  Branch (2431:40): [True: 0, False: 9.60k]
  |  Branch (2431:63): [True: 9.60k, False: 0]
  ------------------
 2432|      0|    {
 2433|      0|        return 0;
 2434|      0|    }
 2435|       |    /**************************************************************************************
 2436|       |     *    The following discussion assumes that the canonical numbers are
 2437|       |     *    switched for some pairs of constitutionally identical atoms
 2438|       |     *    in such a way that the new numbering is an equivalent to the
 2439|       |     *    nCanonRank[] canonical numbering (the transposition belongs to the
 2440|       |     *    automorphism group of the chemical structure having no stereo).
 2441|       |     *    At this point non-zero elements of nVisited1[] and nVisited2[]
 2442|       |     *    together contain transposition P of the atom numbers.
 2443|       |     *    and P2 respectively of the ordering atom numbers: nVisitedi[k] = Pi(k)+1;
 2444|       |     *    In this implementation:
 2445|       |     *       P1(k)=k for all k
 2446|       |     *       P2(cur)=cur, P2(next1)=next2, P2(next2)=next1
 2447|       |     *
 2448|       |     *    Below we call one of the numberings "old", another "new".
 2449|       |     *
 2450|       |     *    *IF* the old and the new canonical numberings produce same parities for stereogenic
 2451|       |     *    elements for the same canonical number(s)
 2452|       |     *    (that is, old_parity(canon_number) == new_parity(canon_number)
 2453|       |     *    *except* the currently being tested stereocenter at[cur] or stereobond/cumulene
 2454|       |     *    at[cur]=at[prev_sb_neigh], whose parity MUST be inverted
 2455|       |     *
 2456|       |     *    *THEN* the stereocenter or stereobond/cumulene is not stereogenic with one
 2457|       |     *
 2458|       |     *    *EXCEPTION* If the currently tested stereogenic element is constitutionally
 2459|       |     *    equivalent to two or more other stereogenic elements that have been
 2460|       |     *    permuted then the currently tested one is still stereogenic.
 2461|       |     **************************************************************************************/
 2462|       |
 2463|       |     /*
 2464|       |     * 1. replace the assigned in each of the parallel traversals atom numbers
 2465|       |     *    with the canon. ranks corresponding to the atom numbers in the
 2466|       |     *    currently numbered atoms at[].
 2467|       |     *    One of obtained this way canonical numberings (probably nVisited1[])
 2468|       |     *    is same as the nCanonRank[] because usually nVisited1[i] = i+1 or 0
 2469|       |     */
 2470|  58.8k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (2470:17): [True: 49.2k, False: 9.60k]
  ------------------
 2471|  49.2k|    {
 2472|  49.2k|        if (nVisited1[i])
  ------------------
  |  Branch (2472:13): [True: 39.7k, False: 9.53k]
  ------------------
 2473|  39.7k|        {
 2474|       |            /* canonical number of the atom mapped on atom #i in 'left' path */
 2475|  39.7k|            nVisited1[i] = nCanonRank[(int) nVisited1[i] - 1];
 2476|       |            /* reverse: atom # from the mapped canonical rank in 'left' path */
 2477|  39.7k|            nAtomNumberCanon1[nVisited1[i] - 1] = i;
 2478|  39.7k|        }
 2479|  49.2k|        if (nVisited2[i])
  ------------------
  |  Branch (2479:13): [True: 39.7k, False: 9.53k]
  ------------------
 2480|  39.7k|        {
 2481|       |            /* canonical number of the atom mapped on atom #i in 'right' path */
 2482|  39.7k|            nVisited2[i] = nCanonRank[(int) nVisited2[i] - 1];
 2483|       |            /* reverse: atom # from the mapped canonical rank in 'right' path */
 2484|  39.7k|            nAtomNumberCanon2[nVisited2[i] - 1] = i;
 2485|  39.7k|        }
 2486|       |        /* if 'left' and 'right' path do not have atoms in common except the
 2487|       |           starting atom (and in case of stereobond, the end atom) some of
 2488|       |           nVisitedi[i] elements may be zero.
 2489|       |        */
 2490|  49.2k|    }
 2491|       |
 2492|       |    /*
 2493|       |     * if started with a stereobond then check whether its parity has changed.
 2494|       |     * If yes then continue, otherwise parities are different
 2495|       |     *
 2496|       |     * if started with a stereo center then prev_sb_neigh = MAX_ATOMS+1
 2497|       |     *
 2498|       |     * If the transposition of next1 and next2 changes only the parity of the starting stereo atom or stereo bond
 2499|       |     * then the stereo bond or stereo atom is not stereogenic
 2500|       |     *
 2501|       |     * The exception: the stereogenic elememt in question is equivalent
 2502|       |     *    to two or more traversed other stereogenic elememts
 2503|       |     *    (see nNumEqStereogenic below, case similar to trimethylcyclopropane:
 2504|       |     *     3 or more constitutionally equivalent stereogenic elements)
 2505|       |     */
 2506|  9.60k|    if (nCheckingMode == CHECKING_STEREOBOND)
  ------------------
  |  | 2286|  9.60k|#define CHECKING_STEREOBOND    2
  ------------------
  |  Branch (2506:9): [True: 14, False: 9.59k]
  ------------------
 2507|     14|    {
 2508|       |        /******************************************************************************
 2509|       |         *
 2510|       |         *  Possibly stereogenic starting bond or cumulene at[cur]-at[prev_sb_neigh]
 2511|       |         *
 2512|       |         *******************************************************************************/
 2513|       |        /*  checking the starting stereo bond */
 2514|     14|        if (nVisited1[prev_sb_neigh] || nVisited2[prev_sb_neigh])
  ------------------
  |  Branch (2514:13): [True: 0, False: 14]
  |  Branch (2514:41): [True: 0, False: 14]
  ------------------
 2515|      0|        {
 2516|       |            /*  the bond or cumulene is in the ring and the opposite atom has been visited */
 2517|      0|            if (nVisited1[prev_sb_neigh] != nVisited2[prev_sb_neigh] ||
  ------------------
  |  Branch (2517:17): [True: 0, False: 0]
  ------------------
 2518|      0|                 nCanonRank[prev_sb_neigh] != nVisited2[prev_sb_neigh])
  ------------------
  |  Branch (2518:18): [True: 0, False: 0]
  ------------------
 2519|      0|            {
 2520|      0|                return 0; /*  error: we came back to the same bond/cumulene and */ /*   <BRKPT> */
 2521|       |                          /*  assigned different canon. ranks to the opposite atom. */
 2522|      0|            }
 2523|      0|            if (at[prev_sb_neigh].valence + at[prev_sb_neigh].num_H > 3)
  ------------------
  |  Branch (2523:17): [True: 0, False: 0]
  ------------------
 2524|      0|            {
 2525|      0|                return 0;   /*  at[prev_sb_neigh] atom can not be adjacent to a stereo bond/cumulene */
 2526|       |                            /*  or does not have 3 attachments (hydrogens are not considered here) */
 2527|      0|            }
 2528|      0|            for (i = 0, k = 0; i < MAX_NUM_STEREO_BONDS &&
  ------------------
  |  |  873|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2528:32): [True: 0, False: 0]
  ------------------
 2529|      0|                ( neigh = at[prev_sb_neigh].stereo_bond_neighbor[i] ) && !( k = ( neigh - 1 == cur ) );
  ------------------
  |  Branch (2529:17): [True: 0, False: 0]
  |  Branch (2529:74): [True: 0, False: 0]
  ------------------
 2530|      0|                i++)
 2531|      0|            {
 2532|      0|                ;
 2533|      0|            }
 2534|      0|            if (!k)
  ------------------
  |  Branch (2534:17): [True: 0, False: 0]
  ------------------
 2535|      0|            {
 2536|      0|                return -1; /*  program error: could not locate stereogenic bond mark on the opposite atom */
 2537|      0|            }
 2538|      0|            k = (int) at[prev_sb_neigh].stereo_bond_ord[i]; /*  seq. number of the double or cumulene bond on at[prev_sb_neigh] */
 2539|       |
 2540|      0|            for (i = 0, num_other_neigh = 0; i < at[prev_sb_neigh].valence && num_other_neigh <= MAX_OTHER_NEIGH; i++)
  ------------------
  |  | 2280|      0|#define MAX_OTHER_NEIGH        2
  ------------------
  |  Branch (2540:46): [True: 0, False: 0]
  |  Branch (2540:79): [True: 0, False: 0]
  ------------------
 2541|      0|            {
 2542|      0|                if (i != k)
  ------------------
  |  Branch (2542:21): [True: 0, False: 0]
  ------------------
 2543|      0|                {
 2544|       |                    /*  do not include the double or cumulene bond */
 2545|      0|                    other_neigh[num_other_neigh++] = at[prev_sb_neigh].neighbor[i];
 2546|      0|                }
 2547|      0|            }
 2548|      0|            if (num_other_neigh + at[prev_sb_neigh].num_H > MAX_OTHER_NEIGH)
  ------------------
  |  | 2280|      0|#define MAX_OTHER_NEIGH        2
  ------------------
  |  Branch (2548:17): [True: 0, False: 0]
  ------------------
 2549|      0|            {
 2550|      0|                return CT_STEREOCOUNT_ERR;  /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 2551|      0|            }
 2552|      0|            for (i = 0; i < num_other_neigh; i++)
  ------------------
  |  Branch (2552:25): [True: 0, False: 0]
  ------------------
 2553|      0|            {
 2554|      0|                k = (int) other_neigh[i];
 2555|      0|                if (nVisited1[k] && nVisited1[k] != nCanonRank[k])
  ------------------
  |  Branch (2555:21): [True: 0, False: 0]
  |  Branch (2555:37): [True: 0, False: 0]
  ------------------
 2556|      0|                {
 2557|      0|                    return 0; /*  parity of the statring stereo bond/cumulene has not changed. */
 2558|      0|                }
 2559|      0|                if (nVisited2[k] && nVisited2[k] != nCanonRank[k])
  ------------------
  |  Branch (2559:21): [True: 0, False: 0]
  |  Branch (2559:37): [True: 0, False: 0]
  ------------------
 2560|      0|                {
 2561|      0|                    return 0; /*  parity of the statring stereo bond/cumulene has not changed. */
 2562|      0|                }
 2563|      0|            }
 2564|      0|        }
 2565|     14|    }
 2566|       |
 2567|  9.60k|    if (nCheckingMode == CHECKING_STEREOCENTER)
  ------------------
  |  | 2285|  9.60k|#define CHECKING_STEREOCENTER  1
  ------------------
  |  Branch (2567:9): [True: 9.59k, False: 14]
  ------------------
 2568|  9.59k|    {
 2569|       |        /**************************************************
 2570|       |         *
 2571|       |         *  Possibly stereogenic starting atom at[cur]
 2572|       |         *
 2573|       |         **************************************************/
 2574|       |        /*  checking the starting stereo center */
 2575|  46.9k|        for (i = 0, num_other_neigh = 0; i < at[cur].valence && num_other_neigh <= MAX_OTHER_NEIGH; i++)
  ------------------
  |  | 2280|  37.4k|#define MAX_OTHER_NEIGH        2
  ------------------
  |  Branch (2575:42): [True: 37.4k, False: 9.59k]
  |  Branch (2575:65): [True: 37.4k, False: 0]
  ------------------
 2576|  37.4k|        {
 2577|  37.4k|            neigh = at[cur].neighbor[i];
 2578|  37.4k|            if (neigh != next1 && neigh != next2)
  ------------------
  |  Branch (2578:17): [True: 27.8k, False: 9.59k]
  |  Branch (2578:35): [True: 18.2k, False: 9.59k]
  ------------------
 2579|  18.2k|            {
 2580|  18.2k|                other_neigh[num_other_neigh++] = neigh;
 2581|  18.2k|            }
 2582|  37.4k|        }
 2583|  9.59k|        if (num_other_neigh + at[cur].num_H > MAX_OTHER_NEIGH)
  ------------------
  |  | 2280|  9.59k|#define MAX_OTHER_NEIGH        2
  ------------------
  |  Branch (2583:13): [True: 0, False: 9.59k]
  ------------------
 2584|      0|        {
 2585|      0|            return CT_STEREOCOUNT_ERR;  /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 2586|      0|        }
 2587|       |        /*
 2588|       |        if ( bParitiesInverted && at[cur].valence == MAX_NUM_STEREO_ATOM_NEIGH ) {
 2589|       |            if ( nVisited1[other_neigh[0]] == nCanonRank[other_neigh[0]] ||
 2590|       |                 nVisited2[other_neigh[0]] == nCanonRank[other_neigh[0]] ||
 2591|       |                 nVisited1[other_neigh[1]] == nCanonRank[other_neigh[1]] ||
 2592|       |                 nVisited2[other_neigh[1]] == nCanonRank[other_neigh[1]] ) {
 2593|       |                bParitiesInverted = 0;
 2594|       |                bCurRotated = 1;
 2595|       |            }
 2596|       |        }
 2597|       |        */
 2598|       |        /* bParitiesInverted = -1 means no predefined stereocenter has been checked */
 2599|  9.59k|        if (bParitiesInverted && at[cur].valence == MAX_NUM_STEREO_ATOM_NEIGH)
  ------------------
  |  |  877|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (2599:13): [True: 0, False: 9.59k]
  |  Branch (2599:34): [True: 0, False: 0]
  ------------------
 2600|      0|        {
 2601|       |            /* special case: 4 canonically eq. neighbors */
 2602|      0|            int canon_parity, parity_vis_1, parity_vis_2;
 2603|      0|            canon_parity = GetPermutationParity( pCG, at + cur, MAX_ATOMS + 1, nCanonRank );
  ------------------
  |  |   15|      0|#define MAX_ATOMS  32766
  ------------------
 2604|      0|            parity_vis_1 = GetPermutationParity( pCG, at + cur, MAX_ATOMS + 1, nVisited1 );
  ------------------
  |  |   15|      0|#define MAX_ATOMS  32766
  ------------------
 2605|      0|            parity_vis_2 = GetPermutationParity( pCG, at + cur, MAX_ATOMS + 1, nVisited2 );
  ------------------
  |  |   15|      0|#define MAX_ATOMS  32766
  ------------------
 2606|      0|            if (parity_vis_1 != parity_vis_2)
  ------------------
  |  Branch (2606:17): [True: 0, False: 0]
  ------------------
 2607|      0|            {
 2608|      0|                return 0;
 2609|      0|            }
 2610|      0|            if (bParitiesInverted == 1 && parity_vis_1 == canon_parity)
  ------------------
  |  Branch (2610:17): [True: 0, False: 0]
  |  Branch (2610:43): [True: 0, False: 0]
  ------------------
 2611|      0|            {
 2612|      0|                return 0; /* not a typical case of inversion during the mapping of D4h stereocenter */
 2613|      0|            }
 2614|      0|            else
 2615|      0|            {
 2616|      0|                if (bParitiesInverted == -1)
  ------------------
  |  Branch (2616:21): [True: 0, False: 0]
  ------------------
 2617|      0|                {
 2618|      0|                    if (parity_vis_1 == canon_parity)
  ------------------
  |  Branch (2618:25): [True: 0, False: 0]
  ------------------
 2619|      0|                    {
 2620|      0|                        bParitiesInverted = 0;
 2621|      0|                    }
 2622|      0|                    else
 2623|      0|                    {
 2624|      0|                        bParitiesInverted = 1;
 2625|      0|                    }
 2626|      0|                }
 2627|      0|            }
 2628|      0|        }
 2629|       |        /* at this point bParitiesInverted >= 0 */
 2630|  9.59k|        if (!bParitiesInverted && !bCurRotated)
  ------------------
  |  Branch (2630:13): [True: 9.59k, False: 0]
  |  Branch (2630:35): [True: 9.59k, False: 0]
  ------------------
 2631|  9.59k|        {
 2632|  27.1k|            for (i = 0; i < num_other_neigh; i++)
  ------------------
  |  Branch (2632:25): [True: 17.9k, False: 9.16k]
  ------------------
 2633|  17.9k|            {
 2634|  17.9k|                k = (int) other_neigh[i];
 2635|  17.9k|                if (nVisited1[k] && nVisited1[k] != nCanonRank[k])
  ------------------
  |  Branch (2635:21): [True: 12.3k, False: 5.58k]
  |  Branch (2635:37): [True: 418, False: 11.9k]
  ------------------
 2636|    418|                {
 2637|    418|                    return 0; /*  parity of the statring stereo center has not changed. */
 2638|    418|                }
 2639|  17.5k|                if (nVisited2[k] && nVisited2[k] != nCanonRank[k])
  ------------------
  |  Branch (2639:21): [True: 11.9k, False: 5.57k]
  |  Branch (2639:37): [True: 12, False: 11.9k]
  ------------------
 2640|     12|                {
 2641|     12|                    return 0; /*  parity of the statring stereo center has not changed. */
 2642|     12|                }
 2643|  17.5k|            }
 2644|  9.59k|        }
 2645|  9.59k|    }
 2646|       |
 2647|       |    /*****************************************************
 2648|       |     * Check other (non-starting) stereo centers
 2649|       |     ******************************************************/
 2650|  21.6k|    for (i = 0; i < pCS->nLenLinearCTStereoCarb; i++, nNumComparedCenters += ( k > 0 ))
  ------------------
  |  Branch (2650:17): [True: 21.1k, False: 519]
  ------------------
 2651|  21.1k|    {
 2652|  21.1k|        r1 = pCS->LinearCTStereoCarb[i].at_num;
 2653|  21.1k|        i01 = nAtomNumberCanon[r1 - 1]; /*  ord. number of the atom that has canon rank r1 */
 2654|       |
 2655|  21.1k|        i11 = nAtomNumberCanon1[r1 - 1]; /*  = (MAX_ATOMS+1) > num_atoms if the atom has not been traversed */
 2656|  21.1k|        i12 = nAtomNumberCanon2[r1 - 1]; /*  = otherwise < num_atoms */
 2657|       |
 2658|  21.1k|        s1 = ( i11 < num_atoms ); /*  1 => the center was traversed on path #1 */
 2659|  21.1k|        s2 = ( i12 < num_atoms ); /*  1 => the center was traversed on path #2 */
 2660|       |
 2661|  21.1k|        bCurParityInv1 = ( bParitiesInverted &&
  ------------------
  |  Branch (2661:28): [True: 0, False: 21.1k]
  ------------------
 2662|      0|                          at[cur].nRingSystem == at[i11].nRingSystem &&
  ------------------
  |  Branch (2662:27): [True: 0, False: 0]
  ------------------
 2663|      0|                          at[cur].nRingSystem == at[i12].nRingSystem );
  ------------------
  |  Branch (2663:27): [True: 0, False: 0]
  ------------------
 2664|       |
 2665|       |
 2666|  21.1k|        k = 0;
 2667|       |
 2668|       |        /*  check whether the two stereo centers (they can be one and the same atom) have been traversed */
 2669|  21.1k|        if (!s1 && !s2)
  ------------------
  |  Branch (2669:13): [True: 3.95k, False: 17.1k]
  |  Branch (2669:20): [True: 3.06k, False: 895]
  ------------------
 2670|  3.06k|        {
 2671|  3.06k|            continue;  /*  Both stereo centers have not been traversed; check the next pair. */
 2672|  3.06k|        }
 2673|       |
 2674|  18.0k|        if (nCheckingMode == CHECKING_STEREOCENTER)
  ------------------
  |  | 2285|  18.0k|#define CHECKING_STEREOCENTER  1
  ------------------
  |  Branch (2674:13): [True: 18.0k, False: 0]
  ------------------
 2675|  18.0k|        {
 2676|       |            /*  check whether the stereocenters are the starting stereocenter */
 2677|  18.0k|            switch (( cur == i11 ) + ( cur == i12 ))
  ------------------
  |  Branch (2677:21): [True: 4.51k, False: 13.5k]
  ------------------
 2678|  18.0k|            {
 2679|  4.51k|                case 2:
  ------------------
  |  Branch (2679:17): [True: 4.51k, False: 13.5k]
  ------------------
 2680|  4.51k|                    continue; /*  do not recheck the starting atom */
 2681|      0|                case 1:
  ------------------
  |  Branch (2681:17): [True: 0, False: 18.0k]
  ------------------
 2682|      0|                    return -1; /*  possibly program error */ /*   <BRKPT> */
 2683|       |                /* case 0: */
 2684|       |                /*     break;  */  /*  the stereo centers are not the sarting stereo center */
 2685|  18.0k|            }
 2686|  13.5k|            if (cur == i01)
  ------------------
  |  Branch (2686:17): [True: 0, False: 13.5k]
  ------------------
 2687|      0|            {
 2688|      0|                return -1;  /*  program error: in this case at least one of the i11, i12 must be == cur */ /*   <BRKPT> */
 2689|      0|            }
 2690|  13.5k|        }
 2691|       |
 2692|  13.5k|        if (nNeighMode == NEIGH_MODE_RING)
  ------------------
  |  | 2282|  13.5k|#define NEIGH_MODE_RING        1
  ------------------
  |  Branch (2692:13): [True: 13.5k, False: 0]
  ------------------
 2693|  13.5k|        {
 2694|  13.5k|            if (i11 != i12 && !bCurParityInv1)
  ------------------
  |  Branch (2694:17): [True: 2.91k, False: 10.6k]
  |  Branch (2694:31): [True: 2.91k, False: 0]
  ------------------
 2695|  2.91k|            {
 2696|  2.91k|                return -1; /*  failed: the two stereo atoms have not been traversed synchronously */
 2697|  2.91k|            }
 2698|  10.6k|            if (!at[i11].parity || !at[i12].parity)
  ------------------
  |  Branch (2698:17): [True: 0, False: 10.6k]
  |  Branch (2698:36): [True: 0, False: 10.6k]
  ------------------
 2699|      0|            {
 2700|      0|                return 0; /*  another atom does not have parity (it might have been removed) 9-11-2002 */
 2701|      0|            }
 2702|  10.6k|        }
 2703|  10.6k|        if (nNeighMode == NEIGH_MODE_CHAIN)
  ------------------
  |  | 2283|  10.6k|#define NEIGH_MODE_CHAIN       2
  ------------------
  |  Branch (2703:13): [True: 0, False: 10.6k]
  ------------------
 2704|      0|        {
 2705|      0|            if (s1 + s2 != 1)
  ------------------
  |  Branch (2705:17): [True: 0, False: 0]
  ------------------
 2706|      0|            {
 2707|      0|                return -1; /*  program error: only one out of s1 and s2 must be 1, another must be 0. */
 2708|      0|            }
 2709|      0|            if ((s1 && !at[i11].parity) || (s2 && !at[i12].parity)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2709:18): [True: 0, False: 0]
  |  Branch (2709:24): [True: 0, False: 0]
  |  Branch (2709:45): [True: 0, False: 0]
  |  Branch (2709:51): [True: 0, False: 0]
  ------------------
 2710|      0|            {
 2711|      0|                return 0; /*  another atom does not have parity (it might have been removed) 9-11-2002 */
 2712|      0|            }
 2713|      0|        }
 2714|       |
 2715|  10.6k|        parity = pCS->LinearCTStereoCarb[i].parity;
 2716|  10.6k|        if (nNeighMode == (NEIGH_MODE_RING && ( i11 != i01 ) && ( i12 != i01 )) ||
  ------------------
  |  | 2282|  21.3k|#define NEIGH_MODE_RING        1
  |  |  ------------------
  |  |  |  Branch (2282:32): [True: 10.6k, Folded]
  |  |  ------------------
  ------------------
  |  Branch (2716:13): [True: 5.04k, False: 5.62k]
  |  Branch (2716:47): [True: 5.04k, False: 5.62k]
  |  Branch (2716:65): [True: 5.04k, False: 0]
  ------------------
 2717|       |             /*  in NEIGH_MODE_RING case we know that i11 == i12 except bCurParityInv1 == 1 */
 2718|  5.62k|             nNeighMode == NEIGH_MODE_CHAIN
  ------------------
  |  | 2283|  5.62k|#define NEIGH_MODE_CHAIN       2
  ------------------
  |  Branch (2718:14): [True: 0, False: 5.62k]
  ------------------
 2719|       |             /*  in NEIGH_MODE_CHAIN case here we always have 2 different atoms */
 2720|  10.6k|           ) /* djb-rwth: addressing LLVM warning */
 2721|  5.04k|        {
 2722|       |            /****************************************************************
 2723|       |            * Case of two transposed atoms or a circular permutation in D4h
 2724|       |            */
 2725|  5.04k|            parity1 = s1 ? GetStereoCenterParity( pCG, at, i11, nVisited1 ) : PARITY_IMPOSSIBLE;
  ------------------
  |  | 2292|  5.04k|#define PARITY_IMPOSSIBLE    999
  ------------------
  |  Branch (2725:23): [True: 5.04k, False: 0]
  ------------------
 2726|  5.04k|            parity2 = s2 ? GetStereoCenterParity( pCG, at, i12, nVisited2 ) : PARITY_IMPOSSIBLE;
  ------------------
  |  | 2292|  5.04k|#define PARITY_IMPOSSIBLE    999
  ------------------
  |  Branch (2726:23): [True: 5.04k, False: 0]
  ------------------
 2727|  5.04k|            if (!ATOM_PARITY_KNOWN( parity1 ) && !ATOM_PARITY_KNOWN( parity2 ))
  ------------------
  |  |  258|  10.0k|#define ATOM_PARITY_KNOWN(X)        (AB_MIN_KNOWN_PARITY <= (X) && (X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|  5.04k|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define ATOM_PARITY_KNOWN(X)        (AB_MIN_KNOWN_PARITY <= (X) && (X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|  5.04k|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (258:38): [True: 5.04k, False: 0]
  |  |  |  Branch (258:68): [True: 5.04k, False: 0]
  |  |  ------------------
  ------------------
                          if (!ATOM_PARITY_KNOWN( parity1 ) && !ATOM_PARITY_KNOWN( parity2 ))
  ------------------
  |  |  258|      0|#define ATOM_PARITY_KNOWN(X)        (AB_MIN_KNOWN_PARITY <= (X) && (X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|      0|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define ATOM_PARITY_KNOWN(X)        (AB_MIN_KNOWN_PARITY <= (X) && (X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|      0|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (258:38): [True: 0, False: 0]
  |  |  |  Branch (258:68): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2728|      0|            {
 2729|      0|                return -1; /*  should not happen: must have been detected at the time of the traversal */
 2730|      0|            }
 2731|  5.04k|            if (s1 && s2)
  ------------------
  |  Branch (2731:17): [True: 5.04k, False: 0]
  |  Branch (2731:23): [True: 5.04k, False: 0]
  ------------------
 2732|  5.04k|            {
 2733|  5.04k|                if (bCurParityInv1)
  ------------------
  |  Branch (2733:21): [True: 0, False: 5.04k]
  ------------------
 2734|      0|                {
 2735|      0|                    int parity1orig = GetStereoCenterParity( pCG, at, i11, nCanonRank );
 2736|      0|                    int parity2orig = GetStereoCenterParity( pCG, at, i12, nCanonRank );
 2737|      0|                    if (i11 == i12 ||
  ------------------
  |  Branch (2737:25): [True: 0, False: 0]
  ------------------
 2738|      0|                        (( parity1 == parity1orig || parity2 == parity2orig || parity1 != parity2 ) &&
  ------------------
  |  Branch (2738:28): [True: 0, False: 0]
  |  Branch (2738:54): [True: 0, False: 0]
  |  Branch (2738:80): [True: 0, False: 0]
  ------------------
 2739|      0|                         ATOM_PARITY_WELL_DEF( parity1 )) ||
  ------------------
  |  |  259|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      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)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 0, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2740|      0|                         ((parity1 != parity2 && ( !ATOM_PARITY_WELL_DEF( parity1 ))) ||
  ------------------
  |  |  259|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      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)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 0, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2740:28): [True: 0, False: 0]
  ------------------
 2741|      0|                             !ATOM_PARITY_WELL_DEF( parity2 ) )) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  259|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      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)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 0, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2742|       |                        /*return -1; */ /* should be different atoms with inverted parities */
 2743|      0|                        nNumDiff++;
 2744|      0|                }
 2745|  5.04k|                else
 2746|  5.04k|                {
 2747|  5.04k|                    if (i11 != i12 || parity1 != parity2)
  ------------------
  |  Branch (2747:25): [True: 0, False: 5.04k]
  |  Branch (2747:39): [True: 0, False: 5.04k]
  ------------------
 2748|      0|                    {
 2749|      0|                        return -1; /*  program error: must be the same atom */
 2750|      0|                    }
 2751|  5.04k|                }
 2752|  5.04k|            }
 2753|  5.04k|            parity12 = s1 ? parity1 : parity2;
  ------------------
  |  Branch (2753:24): [True: 5.04k, False: 0]
  ------------------
 2754|       |
 2755|  5.04k|            if (ATOM_PARITY_WELL_DEF( parity ) && parity == parity12)
  ------------------
  |  |  259|  10.0k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  5.04k|#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)
  |  |  ------------------
  |  |  |  |  236|  5.04k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 5.04k, False: 0]
  |  |  |  Branch (259:75): [True: 2.96k, False: 2.08k]
  |  |  ------------------
  ------------------
  |  Branch (2755:51): [True: 585, False: 2.37k]
  ------------------
 2756|    585|            {
 2757|       |                /*  symmetrical neighbors have well-defined equal parities */
 2758|    585|                k++;
 2759|    585|                if (nCheckingMode == CHECKING_STEREOCENTER && nNeighMode == NEIGH_MODE_RING)
  ------------------
  |  | 2285|  1.17k|#define CHECKING_STEREOCENTER  1
  ------------------
                              if (nCheckingMode == CHECKING_STEREOCENTER && nNeighMode == NEIGH_MODE_RING)
  ------------------
  |  | 2282|    585|#define NEIGH_MODE_RING        1
  ------------------
  |  Branch (2759:21): [True: 585, False: 0]
  |  Branch (2759:63): [True: 585, False: 0]
  ------------------
 2760|    585|                {
 2761|       |                    /*  all 3: cur, i01, i11 are different atoms (here i11==i12) */
 2762|       |                    /*  here nSymmRank[i01]==nSymmRank[i11] due to the parallel traversal */
 2763|    585|                    if (nSymmRank[cur] == nSymmRank[i01])
  ------------------
  |  Branch (2763:25): [True: 480, False: 105]
  ------------------
 2764|    480|                    {
 2765|    480|                        nNumEqStereogenic++;  /*  all 3 are equ */
 2766|    480|                    }
 2767|    585|                }
 2768|    585|            }
 2769|  4.45k|            else
 2770|  4.45k|            {
 2771|  4.45k|                if (ATOM_PARITY_WELL_DEF( parity ) && ATOM_PARITY_WELL_DEF( parity12 ))
  ------------------
  |  |  259|  8.91k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  4.45k|#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)
  |  |  ------------------
  |  |  |  |  236|  4.45k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 4.45k, False: 0]
  |  |  |  Branch (259:75): [True: 2.37k, False: 2.08k]
  |  |  ------------------
  ------------------
                              if (ATOM_PARITY_WELL_DEF( parity ) && ATOM_PARITY_WELL_DEF( parity12 ))
  ------------------
  |  |  259|  2.37k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  2.37k|#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)
  |  |  ------------------
  |  |  |  |  236|  2.37k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 2.37k, False: 0]
  |  |  |  Branch (259:75): [True: 590, False: 1.78k]
  |  |  ------------------
  ------------------
 2772|    590|                {
 2773|       |                    /*  apparently different well-defined parities */
 2774|    590|                    if (!bCurParityInv1)
  ------------------
  |  Branch (2774:25): [True: 590, False: 0]
  ------------------
 2775|    590|                    {
 2776|    590|                        nNumInv++;
 2777|       |                        /* return 0; */
 2778|    590|                    }
 2779|    590|                }
 2780|  3.86k|                else
 2781|  3.86k|                {
 2782|  3.86k|#if ( PROPAGATE_ILL_DEF_STEREO == 1 )
 2783|       |                    /*  at least one parity is ill-defined. Use parity1 and parity2 to temporarily save bitmaps */
 2784|  3.86k|                    parity1 = ( parity == vABParityUnknown /*AB_PARITY_UNKN*/ )
  ------------------
  |  Branch (2784:31): [True: 2.08k, False: 1.78k]
  ------------------
 2785|  3.86k|                        ? NOT_WELL_DEF_UNKN
  ------------------
  |  | 2289|  2.08k|#define NOT_WELL_DEF_UNKN      2
  ------------------
 2786|  3.86k|                        : ( parity == AB_PARITY_UNDF ) ? NOT_WELL_DEF_UNDF : 0;
  ------------------
  |  |  222|  1.78k|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
                                      : ( parity == AB_PARITY_UNDF ) ? NOT_WELL_DEF_UNDF : 0;
  ------------------
  |  | 2290|      0|#define NOT_WELL_DEF_UNDF      4
  ------------------
  |  Branch (2786:27): [True: 0, False: 1.78k]
  ------------------
 2787|  3.86k|                    parity2 = ( parity12 == vABParityUnknown /*AB_PARITY_UNKN*/ )
  ------------------
  |  Branch (2787:31): [True: 2.86k, False: 1.00k]
  ------------------
 2788|  3.86k|                        ? NOT_WELL_DEF_UNKN : ( parity12 == AB_PARITY_UNDF ) ? NOT_WELL_DEF_UNDF : 0;
  ------------------
  |  | 2289|  2.86k|#define NOT_WELL_DEF_UNKN      2
  ------------------
                                      ? NOT_WELL_DEF_UNKN : ( parity12 == AB_PARITY_UNDF ) ? NOT_WELL_DEF_UNDF : 0;
  ------------------
  |  |  222|  1.00k|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
                                      ? NOT_WELL_DEF_UNKN : ( parity12 == AB_PARITY_UNDF ) ? NOT_WELL_DEF_UNDF : 0;
  ------------------
  |  | 2290|      0|#define NOT_WELL_DEF_UNDF      4
  ------------------
  |  Branch (2788:47): [True: 0, False: 1.00k]
  ------------------
 2789|  3.86k|                    if (parity1 | parity2)
  ------------------
  |  Branch (2789:25): [True: 3.69k, False: 178]
  ------------------
 2790|  3.69k|                    {
 2791|  3.69k|                        not_well_def_parities |= ( parity1 | parity2 );
 2792|  3.69k|                        k++;
 2793|  3.69k|                    }
 2794|    178|                    else
 2795|    178|                    {
 2796|    178|                        return -1;  /*  program error */ /*   <BRKPT> */
 2797|    178|                    }
 2798|       |#else
 2799|       |                    return 0;
 2800|       |#endif
 2801|  3.86k|                }
 2802|  4.45k|            }
 2803|  5.04k|        }
 2804|  5.62k|        else
 2805|  5.62k|        {
 2806|  5.62k|            if (i11 == i01 && i12 == i01)
  ------------------
  |  Branch (2806:17): [True: 5.62k, False: 0]
  |  Branch (2806:31): [True: 5.62k, False: 0]
  ------------------
 2807|  5.62k|            {
 2808|       |                /********************************************************************/
 2809|       |                /*  i11 == i12 are same atom as i01, nNeighMode == NEIGH_MODE_RING */
 2810|  5.62k|                if (!s1 || !s2)
  ------------------
  |  Branch (2810:21): [True: 0, False: 5.62k]
  |  Branch (2810:28): [True: 0, False: 5.62k]
  ------------------
 2811|      0|                {
 2812|      0|                    return -1;
 2813|      0|                }
 2814|       |                /*  the parity of the new neighbors permutation must be same as the old one */
 2815|       |                /*  this must work for well-defined and ill-defined parities. */
 2816|       |                /*  actual parity (that includes the geometry) is not important here. */
 2817|       |                /*  old permutation */
 2818|  5.62k|                parity = GetPermutationParity( pCG, at + i01, MAX_ATOMS + 1, nCanonRank );
  ------------------
  |  |   15|  5.62k|#define MAX_ATOMS  32766
  ------------------
 2819|       |                /*  new parmutation */
 2820|  5.62k|                parity1 = GetPermutationParity( pCG, at + i01, MAX_ATOMS + 1, nVisited1 );
  ------------------
  |  |   15|  5.62k|#define MAX_ATOMS  32766
  ------------------
 2821|  5.62k|                parity2 = GetPermutationParity( pCG, at + i01, MAX_ATOMS + 1, nVisited2 );
  ------------------
  |  |   15|  5.62k|#define MAX_ATOMS  32766
  ------------------
 2822|  5.62k|                if (parity != parity1 || parity != parity2)
  ------------------
  |  Branch (2822:21): [True: 5.56k, False: 55]
  |  Branch (2822:42): [True: 0, False: 55]
  ------------------
 2823|  5.56k|                {
 2824|  5.56k|                    return 0;
 2825|  5.56k|                }
 2826|     55|                k++;
 2827|     55|            }
 2828|      0|            else
 2829|      0|            {
 2830|       |                /* nNeighMode == NEIGH_MODE_RING and only one out of the two (i11 == i01) (i12 == i01) is true */
 2831|      0|                return -1;
 2832|      0|            }
 2833|  5.62k|        }
 2834|       |        /* nNumComparedCenters += (k > 0); */
 2835|  10.6k|    }
 2836|    519|    if (bCurRotated || nNumDiff || nNumInv)
  ------------------
  |  Branch (2836:9): [True: 0, False: 519]
  |  Branch (2836:24): [True: 0, False: 519]
  |  Branch (2836:36): [True: 13, False: 506]
  ------------------
 2837|     13|    {
 2838|     13|        return 0;
 2839|     13|    }
 2840|       |
 2841|       |     /* !!!! Add here bParitiesInverted == 1 case !!!! */
 2842|       |    /******************************************************/
 2843|       |    /*  Check other (non-starting) stereo bonds/cumulenes */
 2844|       |    /******************************************************/
 2845|    578|    for (i = 0; i < pCS->nLenLinearCTStereoDble; i++, nNumComparedBonds += ( k > 0 ))
  ------------------
  |  Branch (2845:17): [True: 74, False: 504]
  ------------------
 2846|     74|    {
 2847|     74|        r1 = pCS->LinearCTStereoDble[i].at_num1;
 2848|     74|        r2 = pCS->LinearCTStereoDble[i].at_num2;
 2849|     74|        i01 = nAtomNumberCanon[r1 - 1];  /*  ord. number of the atom that originally has canon rank r1 */
 2850|     74|        i02 = nAtomNumberCanon[r2 - 1];  /*  ord. number of the atom that originally has canon rank r2 */
 2851|       |
 2852|     74|        i11 = nAtomNumberCanon1[r1 - 1]; /*  ord. number of the atom that got canon rank r1 during the parallel traversal */
 2853|     74|        i12 = nAtomNumberCanon1[r2 - 1]; /*  ord. number of the atom that got canon rank r2 during the parallel traversal */
 2854|       |
 2855|     74|        i21 = nAtomNumberCanon2[r1 - 1];
 2856|     74|        i22 = nAtomNumberCanon2[r2 - 1];
 2857|       |
 2858|       |
 2859|     74|        s1 = ( i11 < num_atoms && i12 < num_atoms );
  ------------------
  |  Branch (2859:16): [True: 42, False: 32]
  |  Branch (2859:35): [True: 36, False: 6]
  ------------------
 2860|     74|        s2 = ( i21 < num_atoms && i22 < num_atoms );
  ------------------
  |  Branch (2860:16): [True: 40, False: 34]
  |  Branch (2860:35): [True: 34, False: 6]
  ------------------
 2861|       |
 2862|     74|        k = 0;
 2863|       |
 2864|       |        /*  check whether the two stereo bonds/allenes (they can be one and the same) have been traversed */
 2865|     74|        if (!s1 && !s2)
  ------------------
  |  Branch (2865:13): [True: 38, False: 36]
  |  Branch (2865:20): [True: 38, False: 0]
  ------------------
 2866|     38|        {
 2867|     38|            continue; /*  Both stereo bonds/cumulenes have not been traversed; check the next pair. */
 2868|     38|        }
 2869|       |
 2870|     36|        if (nCheckingMode == CHECKING_STEREOBOND)
  ------------------
  |  | 2286|     36|#define CHECKING_STEREOBOND    2
  ------------------
  |  Branch (2870:13): [True: 0, False: 36]
  ------------------
 2871|      0|        {
 2872|      0|            switch (( (i11 == cur && i12 == prev_sb_neigh) || (i12 == cur && i11 == prev_sb_neigh) ) +
  ------------------
  |  Branch (2872:21): [True: 0, False: 0]
  |  Branch (2872:24): [True: 0, False: 0]
  |  Branch (2872:38): [True: 0, False: 0]
  |  Branch (2872:64): [True: 0, False: 0]
  |  Branch (2872:78): [True: 0, False: 0]
  ------------------
 2873|      0|                ( (i21 == cur && i22 == prev_sb_neigh) || (i22 == cur && i21 == prev_sb_neigh) )) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2873:20): [True: 0, False: 0]
  |  Branch (2873:34): [True: 0, False: 0]
  |  Branch (2873:60): [True: 0, False: 0]
  |  Branch (2873:74): [True: 0, False: 0]
  ------------------
 2874|      0|            {
 2875|      0|                case 2:
  ------------------
  |  Branch (2875:17): [True: 0, False: 0]
  ------------------
 2876|      0|                    continue; /*  do not recheck the starting bond/cumulene */
 2877|      0|                case 1:
  ------------------
  |  Branch (2877:17): [True: 0, False: 0]
  ------------------
 2878|      0|                    return -1; /*  possibly program error  */ /*   <BRKPT> */
 2879|       |                /* case 0: */
 2880|       |                /*     break; */   /*  the stereo centers are not the sarting stereo center */
 2881|      0|            }
 2882|      0|            if (( i01 == cur && i02 == prev_sb_neigh ) || ( i02 == cur && i01 == prev_sb_neigh ))
  ------------------
  |  Branch (2882:19): [True: 0, False: 0]
  |  Branch (2882:33): [True: 0, False: 0]
  |  Branch (2882:61): [True: 0, False: 0]
  |  Branch (2882:75): [True: 0, False: 0]
  ------------------
 2883|      0|            {
 2884|      0|                return -1;  /*  program error: in this case at least one of the i1x, i2x must be == cur */ /*   <BRKPT> */
 2885|      0|            }
 2886|      0|        }
 2887|       |
 2888|     36|        if (nNeighMode == NEIGH_MODE_RING)
  ------------------
  |  | 2282|     36|#define NEIGH_MODE_RING        1
  ------------------
  |  Branch (2888:13): [True: 36, False: 0]
  ------------------
 2889|     36|        {
 2890|     36|            if (( i11 != i21 || i12 != i22 ) && ( i11 != i22 || i12 != i21 ))
  ------------------
  |  Branch (2890:19): [True: 2, False: 34]
  |  Branch (2890:33): [True: 0, False: 34]
  |  Branch (2890:51): [True: 2, False: 0]
  |  Branch (2890:65): [True: 0, False: 0]
  ------------------
 2891|      2|            {
 2892|      2|                return -1; /*  failed: the two bonds/cumulenes have not been traversed synchronously */
 2893|      2|            }
 2894|     34|            if (0 > GetStereoNeighborPos( at, i11, i12 ))
  ------------------
  |  Branch (2894:17): [True: 0, False: 34]
  ------------------
 2895|      0|            {
 2896|      0|                return 0; /*  another bond is not stereo (the stereo might have been removed) 9-11-2002 */
 2897|      0|            }
 2898|     34|        }
 2899|     34|        if (nNeighMode == NEIGH_MODE_CHAIN)
  ------------------
  |  | 2283|     34|#define NEIGH_MODE_CHAIN       2
  ------------------
  |  Branch (2899:13): [True: 0, False: 34]
  ------------------
 2900|      0|        {
 2901|      0|            if (s1 + s2 != 1)
  ------------------
  |  Branch (2901:17): [True: 0, False: 0]
  ------------------
 2902|      0|            {
 2903|      0|                return -1; /*  program error: only one out of s1 and s2 must be 1, another must be 0. */
 2904|      0|            }
 2905|      0|            if ((s1 && 0 > GetStereoNeighborPos( at, i11, i12 )) ||
  ------------------
  |  Branch (2905:18): [True: 0, False: 0]
  |  Branch (2905:24): [True: 0, False: 0]
  ------------------
 2906|      0|                 (s2 && 0 > GetStereoNeighborPos( at, i21, i22 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2906:19): [True: 0, False: 0]
  |  Branch (2906:25): [True: 0, False: 0]
  ------------------
 2907|      0|            {
 2908|      0|                return 0; /*  another bond is not stereo (the stereo might have been removed) 9-11-2002 */
 2909|      0|            }
 2910|      0|        }
 2911|       |
 2912|     34|        parity = pCS->LinearCTStereoDble[i].parity;
 2913|       |        /* bMustBeIdentical  = ATOM_PARITY_ILL_DEF(parity); */
 2914|       |        /* nNumEqStereogenic = 0; */
 2915|       |
 2916|     34|        if ((nNeighMode == NEIGH_MODE_RING && ( i11 != i01 || i12 != i02 ) && ( i11 != i02 || i12 != i01 )) ||
  ------------------
  |  | 2282|     68|#define NEIGH_MODE_RING        1
  ------------------
  |  Branch (2916:14): [True: 34, False: 0]
  |  Branch (2916:49): [True: 34, False: 0]
  |  Branch (2916:63): [True: 0, False: 0]
  |  Branch (2916:81): [True: 34, False: 0]
  |  Branch (2916:95): [True: 0, False: 0]
  ------------------
 2917|      0|             nNeighMode == NEIGH_MODE_CHAIN                    /*  in NEIGH_MODE_CHAIN case here we always have 2 different atoms */
  ------------------
  |  | 2283|      0|#define NEIGH_MODE_CHAIN       2
  ------------------
  |  Branch (2917:14): [True: 0, False: 0]
  ------------------
 2918|     34|        ) /* djb-rwth: addressing LLVM warning */
 2919|     34|        {
 2920|       |         /*******************************************/
 2921|       |         /*  case of two transposed bonds/cumulenes */
 2922|     34|            parity1 = s1 ? GetStereoBondParity( at, i11, i12, nVisited1 ) : PARITY_IMPOSSIBLE;
  ------------------
  |  | 2292|     34|#define PARITY_IMPOSSIBLE    999
  ------------------
  |  Branch (2922:23): [True: 34, False: 0]
  ------------------
 2923|     34|            parity2 = s2 ? GetStereoBondParity( at, i21, i22, nVisited2 ) : PARITY_IMPOSSIBLE;
  ------------------
  |  | 2292|     34|#define PARITY_IMPOSSIBLE    999
  ------------------
  |  Branch (2923:23): [True: 34, False: 0]
  ------------------
 2924|     34|            if (!ATOM_PARITY_KNOWN( parity1 ) && !ATOM_PARITY_KNOWN( parity2 ))
  ------------------
  |  |  258|     68|#define ATOM_PARITY_KNOWN(X)        (AB_MIN_KNOWN_PARITY <= (X) && (X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|     34|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define ATOM_PARITY_KNOWN(X)        (AB_MIN_KNOWN_PARITY <= (X) && (X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|     34|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (258:38): [True: 34, False: 0]
  |  |  |  Branch (258:68): [True: 34, False: 0]
  |  |  ------------------
  ------------------
                          if (!ATOM_PARITY_KNOWN( parity1 ) && !ATOM_PARITY_KNOWN( parity2 ))
  ------------------
  |  |  258|      0|#define ATOM_PARITY_KNOWN(X)        (AB_MIN_KNOWN_PARITY <= (X) && (X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|      0|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define ATOM_PARITY_KNOWN(X)        (AB_MIN_KNOWN_PARITY <= (X) && (X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|      0|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (258:38): [True: 0, False: 0]
  |  |  |  Branch (258:68): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2925|      0|            {
 2926|      0|                return -1; /*  should not happen: must have been detected at the time of traversal */
 2927|      0|            }
 2928|     34|            if (s1 && s2 && ( (( i11 != i21 || i12 != i22 ) && ( i11 != i22 || i12 != i21 )) || parity1 != parity2 )) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2928:17): [True: 34, False: 0]
  |  Branch (2928:23): [True: 34, False: 0]
  |  Branch (2928:34): [True: 0, False: 34]
  |  Branch (2928:48): [True: 0, False: 34]
  |  Branch (2928:66): [True: 0, False: 0]
  |  Branch (2928:80): [True: 0, False: 0]
  |  Branch (2928:97): [True: 0, False: 34]
  ------------------
 2929|      0|            {
 2930|      0|                return -1; /*  program error: must be the same bond/cumulene */
 2931|      0|            }
 2932|     34|            parity12 = s1 ? parity1 : parity2;
  ------------------
  |  Branch (2932:24): [True: 34, False: 0]
  ------------------
 2933|     34|            if (ATOM_PARITY_WELL_DEF( parity ) && parity == parity12)
  ------------------
  |  |  259|     68|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|     34|#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)
  |  |  ------------------
  |  |  |  |  236|     34|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 34, False: 0]
  |  |  |  Branch (259:75): [True: 2, False: 32]
  |  |  ------------------
  ------------------
  |  Branch (2933:51): [True: 2, False: 0]
  ------------------
 2934|      2|            {
 2935|       |                /*  symmetrical neighbors have well-defined equal parities */
 2936|      2|                k++;
 2937|      2|                if (nCheckingMode == CHECKING_STEREOBOND && nNeighMode == NEIGH_MODE_RING)
  ------------------
  |  | 2286|      4|#define CHECKING_STEREOBOND    2
  ------------------
                              if (nCheckingMode == CHECKING_STEREOBOND && nNeighMode == NEIGH_MODE_RING)
  ------------------
  |  | 2282|      0|#define NEIGH_MODE_RING        1
  ------------------
  |  Branch (2937:21): [True: 0, False: 2]
  |  Branch (2937:61): [True: 0, False: 0]
  ------------------
 2938|      0|                {
 2939|       |                    /*  all 3 bonds: cur-prev_sb_neigh, i01-i02, i11-i12 are different */
 2940|       |                    /*  (here <i11,i12>==<i21,i22> compared as unordered pairs) */
 2941|      0|                    if ((nSymmRank[cur] == nSymmRank[i01] && nSymmRank[prev_sb_neigh] == nSymmRank[i02]) ||
  ------------------
  |  Branch (2941:26): [True: 0, False: 0]
  |  Branch (2941:62): [True: 0, False: 0]
  ------------------
 2942|      0|                         (nSymmRank[cur] == nSymmRank[i02] && nSymmRank[prev_sb_neigh] == nSymmRank[i01])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2942:27): [True: 0, False: 0]
  |  Branch (2942:63): [True: 0, False: 0]
  ------------------
 2943|      0|                    {
 2944|      0|                        nNumEqStereogenic++;
 2945|      0|                    }
 2946|      0|                }
 2947|      2|            }
 2948|     32|            else
 2949|     32|            {
 2950|     32|                if (ATOM_PARITY_WELL_DEF( parity ) && ATOM_PARITY_WELL_DEF( parity12 ))
  ------------------
  |  |  259|     64|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|     32|#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)
  |  |  ------------------
  |  |  |  |  236|     32|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 32, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 32]
  |  |  ------------------
  ------------------
                              if (ATOM_PARITY_WELL_DEF( parity ) && ATOM_PARITY_WELL_DEF( parity12 ))
  ------------------
  |  |  259|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      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)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 0, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2951|      0|                {
 2952|       |                    /*  apparently different well-defined parities */
 2953|      0|                    return 0;
 2954|      0|                }
 2955|     32|                else
 2956|     32|                {
 2957|       |                    /*  at least one parity is ill-defined. Use parity1 and parity2 to temporarily save bitmaps */
 2958|     32|#if ( PROPAGATE_ILL_DEF_STEREO == 1 )
 2959|     32|                    parity1 = ( parity == vABParityUnknown /*AB_PARITY_UNKN*/ ) ? NOT_WELL_DEF_UNKN :
  ------------------
  |  | 2289|     32|#define NOT_WELL_DEF_UNKN      2
  ------------------
  |  Branch (2959:31): [True: 32, False: 0]
  ------------------
 2960|     32|                        ( parity == AB_PARITY_UNDF ) ? NOT_WELL_DEF_UNDF : 0;
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
                                      ( parity == AB_PARITY_UNDF ) ? NOT_WELL_DEF_UNDF : 0;
  ------------------
  |  | 2290|      0|#define NOT_WELL_DEF_UNDF      4
  ------------------
  |  Branch (2960:25): [True: 0, False: 0]
  ------------------
 2961|     32|                    parity2 = ( parity12 == vABParityUnknown /*AB_PARITY_UNKN*/ ) ? NOT_WELL_DEF_UNKN :
  ------------------
  |  | 2289|     32|#define NOT_WELL_DEF_UNKN      2
  ------------------
  |  Branch (2961:31): [True: 32, False: 0]
  ------------------
 2962|     32|                        ( parity12 == AB_PARITY_UNDF ) ? NOT_WELL_DEF_UNDF : 0;
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
                                      ( parity12 == AB_PARITY_UNDF ) ? NOT_WELL_DEF_UNDF : 0;
  ------------------
  |  | 2290|      0|#define NOT_WELL_DEF_UNDF      4
  ------------------
  |  Branch (2962:25): [True: 0, False: 0]
  ------------------
 2963|     32|                    if (parity1 | parity2)
  ------------------
  |  Branch (2963:25): [True: 32, False: 0]
  ------------------
 2964|     32|                    {
 2965|     32|                        not_well_def_parities |= ( parity1 | parity2 );
 2966|     32|                        k++;
 2967|     32|                    }
 2968|      0|                    else
 2969|      0|                    {
 2970|      0|                        return -1;  /*  program error */
 2971|      0|                    }
 2972|       |#else
 2973|       |                    return 0;
 2974|       |#endif
 2975|     32|                }
 2976|     32|            }
 2977|     34|        }
 2978|      0|        else
 2979|      0|        {
 2980|       |            /*****************************************************************************************/
 2981|       |            /*  i11-i12 and i21-i22 are same as i01-i02 bond/cumulene, nNeighMode == NEIGH_MODE_RING */
 2982|      0|            AT_NUMB n1, n2;
 2983|      0|            int       j;
 2984|      0|            if (!s1 || !s2)
  ------------------
  |  Branch (2984:17): [True: 0, False: 0]
  |  Branch (2984:24): [True: 0, False: 0]
  ------------------
 2985|      0|            {
 2986|      0|                return -1;
 2987|      0|            }
 2988|       |            /*  find neighbors along the stereo bond/cumulene */
 2989|      0|            for (j = 0, n1 = MAX_ATOMS + 1; j < MAX_NUM_STEREO_BOND_NEIGH && at[i01].stereo_bond_neighbor[j]; j++)
  ------------------
  |  |   15|      0|#define MAX_ATOMS  32766
  ------------------
                          for (j = 0, n1 = MAX_ATOMS + 1; j < MAX_NUM_STEREO_BOND_NEIGH && at[i01].stereo_bond_neighbor[j]; j++)
  ------------------
  |  |  874|      0|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (2989:45): [True: 0, False: 0]
  |  Branch (2989:78): [True: 0, False: 0]
  ------------------
 2990|      0|            {
 2991|      0|                if ((int) at[i01].stereo_bond_neighbor[j] == i02 + 1)
  ------------------
  |  Branch (2991:21): [True: 0, False: 0]
  ------------------
 2992|      0|                {
 2993|      0|                    n1 = at[i01].neighbor[(int) at[i01].stereo_bond_ord[j]];
 2994|      0|                    break;
 2995|      0|                }
 2996|      0|            }
 2997|      0|            for (j = 0, n2 = MAX_ATOMS + 1; j < MAX_NUM_STEREO_BOND_NEIGH && at[i02].stereo_bond_neighbor[j]; j++)
  ------------------
  |  |   15|      0|#define MAX_ATOMS  32766
  ------------------
                          for (j = 0, n2 = MAX_ATOMS + 1; j < MAX_NUM_STEREO_BOND_NEIGH && at[i02].stereo_bond_neighbor[j]; j++)
  ------------------
  |  |  874|      0|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (2997:45): [True: 0, False: 0]
  |  Branch (2997:78): [True: 0, False: 0]
  ------------------
 2998|      0|            {
 2999|      0|                if ((int) at[i02].stereo_bond_neighbor[j] == i01 + 1)
  ------------------
  |  Branch (2999:21): [True: 0, False: 0]
  ------------------
 3000|      0|                {
 3001|      0|                    n2 = at[i02].neighbor[(int) at[i02].stereo_bond_ord[j]];
 3002|      0|                    break;
 3003|      0|                }
 3004|      0|            }
 3005|      0|            if (n1 > MAX_ATOMS || n2 > MAX_ATOMS)
  ------------------
  |  |   15|      0|#define MAX_ATOMS  32766
  ------------------
                          if (n1 > MAX_ATOMS || n2 > MAX_ATOMS)
  ------------------
  |  |   15|      0|#define MAX_ATOMS  32766
  ------------------
  |  Branch (3005:17): [True: 0, False: 0]
  |  Branch (3005:35): [True: 0, False: 0]
  ------------------
 3006|      0|            {
 3007|      0|                return CT_REMOVE_STEREO_ERR;
  ------------------
  |  |   33|      0|#define CT_REMOVE_STEREO_ERR (CT_ERR_FIRST-14)  /*(-30014) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 3008|      0|            }
 3009|       |            /*  the parity of the new neighbors permutation must be same as the old one */
 3010|       |            /*  this must work for well-defined and ill-defined parities. */
 3011|       |            /*  actual parity (that includes the geometry) is not important here. */
 3012|       |            /*  old permutation */
 3013|      0|            parity = GetPermutationParity( pCG, at + i01, n1, nCanonRank ) + GetPermutationParity( pCG, at + i02, n2, nCanonRank );
 3014|       |            /*  new parmutation */
 3015|      0|            parity1 = GetPermutationParity( pCG, at + i01, n1, nVisited1 ) + GetPermutationParity( pCG, at + i02, n2, nVisited1 );
 3016|      0|            parity2 = GetPermutationParity( pCG, at + i01, n1, nVisited2 ) + GetPermutationParity( pCG, at + i02, n2, nVisited2 );
 3017|      0|            if (parity % 2 != parity1 % 2 || parity1 % 2 != parity2 % 2)
  ------------------
  |  Branch (3017:17): [True: 0, False: 0]
  |  Branch (3017:46): [True: 0, False: 0]
  ------------------
 3018|      0|            {
 3019|      0|                return 0;
 3020|      0|            }
 3021|      0|            k++;
 3022|      0|        }
 3023|       |
 3024|       |        /* nNumComparedBonds += ( k > 0 ); */
 3025|     34|    }
 3026|       |
 3027|    504|    if (nNumEqStereogenic > 0)
  ------------------
  |  Branch (3027:9): [True: 19, False: 485]
  ------------------
 3028|     19|    {
 3029|       |/*  case similar to trimethylcyclopropane: 3 constitutionally equivalent stereogenic elements */
 3030|       |/*  the transposition does not change the parities */
 3031|       |#if ( bRELEASE_VERSION == 0 )
 3032|       |        pCS->bExtract |= EXTR_2EQL2CENTER_TO_REMOVE_PARITY;
 3033|       |#endif
 3034|       |
 3035|     19|        return 0;
 3036|     19|    }
 3037|       |
 3038|       |
 3039|       |/* =========================================================================================
 3040|       |    Note
 3041|       |    ====
 3042|       |    At this point the comparison is complete and no difference sufficient to establish
 3043|       |    absence of stereo parity has been found.
 3044|       |    However, non-zero not_well_def_parities means that an ill-defined parity was
 3045|       |    compared to an ill-defined or well-defined parity. This means that the parity
 3046|       |    of the atom or bond being checked cannot be well-defined anymore.
 3047|       |========================================================================================*/
 3048|       |
 3049|       |
 3050|    485|    not_well_def_parities |= COMP_STEREO_SUCCESS;
  ------------------
  |  | 2288|    485|#define COMP_STEREO_SUCCESS    1
  ------------------
 3051|       |
 3052|    485|    return not_well_def_parities;
 3053|       |
 3054|       |   /*  Add 1 to indicate success. The stereogenic elements might have been */
 3055|       |   /*  removed while checking existence of the previous atom/bond stereo */
 3056|       |   /* return (nNumComparedCenters + nNumComparedBonds + 1);  */
 3057|    504|}
RemoveCalculatedNonStereoBondParities:
 3083|  2.18k|{
 3084|  2.18k|    int j, n, m, ret, ret1, ret2, ret_failed = 0;
 3085|       |
 3086|  2.18k|    int i1, n1, s2;  /*  n1 must be SIGNED integer */
 3087|  2.18k|    AT_RANK nAtomRank1, nAtomRank2, neigh[3] = { 0 }, nAvoidCheckAtom[2], opposite_atom, nLength; /* djb-rwth: initialisation of neigh required to avoid undefined array subscript */
 3088|  2.18k|    int         nNeighMode = NEIGH_MODE_CHAIN;
  ------------------
  |  | 2283|  2.18k|#define NEIGH_MODE_CHAIN       2
  ------------------
 3089|  2.18k|    int         nNumEqRingNeigh = 0, bRingNeigh, bSymmNeigh, bParitiesInverted;
 3090|  2.18k|    NEIGH_LIST *nl01, *nl02;
 3091|  2.18k|    const AT_RANK    *nSymmRank1, *nSymmRank2;
 3092|       |
 3093|  2.18k|    ret = 0;
 3094|       |
 3095|  2.19k|second_pass:
 3096|       |
 3097|  15.0k|    for (i1 = 0; i1 < num_atoms && !RETURNED_ERROR(ret_failed); i1++)
  ------------------
  |  |   44|  12.8k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  12.8k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  12.8k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  12.8k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  12.8k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  12.8k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 12.8k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 12.8k]
  |  |  ------------------
  ------------------
  |  Branch (3097:18): [True: 12.8k, False: 2.19k]
  ------------------
 3098|  12.8k|    {
 3099|  12.8k|        if (at[i1].valence != 3 || !at[i1].stereo_bond_neighbor[0])
  ------------------
  |  Branch (3099:13): [True: 10.7k, False: 2.12k]
  |  Branch (3099:36): [True: 2.00k, False: 124]
  ------------------
 3100|  12.7k|        {
 3101|  12.7k|            continue;
 3102|  12.7k|        }
 3103|    251|        for (n1 = 0; n1 < MAX_NUM_STEREO_BONDS && !RETURNED_ERROR(ret_failed) && (s2 = at[i1].stereo_bond_neighbor[n1]); n1++)
  ------------------
  |  |  873|    502|#define MAX_NUM_STEREO_BONDS      3
  ------------------
                      for (n1 = 0; n1 < MAX_NUM_STEREO_BONDS && !RETURNED_ERROR(ret_failed) && (s2 = at[i1].stereo_bond_neighbor[n1]); n1++)
  ------------------
  |  |   44|    502|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|    251|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|    251|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|    251|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|    251|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|    251|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 251, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 251]
  |  |  ------------------
  ------------------
  |  Branch (3103:22): [True: 251, False: 0]
  |  Branch (3103:82): [True: 127, False: 124]
  ------------------
 3104|    127|        {
 3105|    127|            if (!PARITY_CALCULATE(at[i1].stereo_bond_parity[n1]) && PARITY_WELL_DEF(at[i1].stereo_bond_parity[n1]))
  ------------------
  |  |  267|    254|#define PARITY_CALCULATE(X)         (AB_PARITY_CALC == PARITY_VAL(X))
  |  |  ------------------
  |  |  |  |  224|    127|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  |  |  ------------------
  |  |               #define PARITY_CALCULATE(X)         (AB_PARITY_CALC == PARITY_VAL(X))
  |  |  ------------------
  |  |  |  |  262|    127|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    127|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          if (!PARITY_CALCULATE(at[i1].stereo_bond_parity[n1]) && PARITY_WELL_DEF(at[i1].stereo_bond_parity[n1]))
  ------------------
  |  |  266|    104|#define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    104|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|    208|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    104|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|    104|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    104|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_WELL_DEF(X)          (AB_MIN_WELL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  236|    104|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (266:38): [True: 104, False: 0]
  |  |  |  Branch (266:85): [True: 39, False: 65]
  |  |  ------------------
  ------------------
  |  Branch (3105:17): [True: 104, False: 23]
  ------------------
 3106|     39|            {
 3107|     39|                continue;
 3108|     39|            }
 3109|     88|            opposite_atom = (AT_RANK)(s2 - 1);
 3110|     88|            s2 = at[i1].neighbor[(int)at[i1].stereo_bond_ord[n1]]; /*  different from opposite_atom in case of a cumulene */
 3111|    352|            for (j = 1, n = 0; j <= (int)at[i1].valence; j++)
  ------------------
  |  Branch (3111:32): [True: 264, False: 88]
  ------------------
 3112|    264|            {
 3113|    264|                if (nl[i1][j] != s2)
  ------------------
  |  Branch (3113:21): [True: 176, False: 88]
  ------------------
 3114|    176|                {
 3115|    176|                    neigh[n++] = nl[i1][j]; /*  sorting guarantees that canon. rank of neigh[0] is greater or equal */
 3116|    176|                }
 3117|    264|            }
 3118|     88|            if (n != 2)
  ------------------
  |  Branch (3118:17): [True: 0, False: 88]
  ------------------
 3119|      0|            {
 3120|      0|                ret = CT_STEREOBOND_ERROR;  /*   <BRKPT> */
  ------------------
  |  |   31|      0|#define CT_STEREOBOND_ERROR  (CT_ERR_FIRST-12)  /*(-30012) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 3121|      0|                goto exit_function;
 3122|      0|            }
 3123|     88|            if (nSymmRank[(int)neigh[0]] != nSymmRank[(int)neigh[1]])
  ------------------
  |  Branch (3123:17): [True: 56, False: 32]
  ------------------
 3124|     56|            {
 3125|     56|                continue; /*  may happen if another half-bond has not a defined parity */
 3126|     56|            }
 3127|       |
 3128|     32|            bRingNeigh = (at[(int)neigh[0]].nRingSystem == at[(int)neigh[1]].nRingSystem);
 3129|     32|            switch (nNeighMode)
 3130|     32|            {
 3131|     18|            case NEIGH_MODE_CHAIN:
  ------------------
  |  | 2283|     18|#define NEIGH_MODE_CHAIN       2
  ------------------
  |  Branch (3131:13): [True: 18, False: 14]
  ------------------
 3132|     18|                if (bRingNeigh)
  ------------------
  |  Branch (3132:21): [True: 18, False: 0]
  ------------------
 3133|     18|                {
 3134|     18|                    nNumEqRingNeigh++;
 3135|     18|                    continue;
 3136|     18|                }
 3137|      0|                nl01 = nl;
 3138|      0|                nl02 = nl;
 3139|      0|                nSymmRank1 = nSymmRank;
 3140|      0|                nSymmRank2 = nSymmRank;
 3141|      0|                break;
 3142|       |
 3143|     14|            case NEIGH_MODE_RING:
  ------------------
  |  | 2282|     14|#define NEIGH_MODE_RING        1
  ------------------
  |  Branch (3143:13): [True: 14, False: 18]
  ------------------
 3144|     14|                if (!bRingNeigh)
  ------------------
  |  Branch (3144:21): [True: 0, False: 14]
  ------------------
 3145|      0|                    continue;
 3146|       |                /*  break a tie between the two contitutionally equivalent neighbors, */
 3147|       |                /*  refine the two partitions, sort neighbors lists nl1, nl2 */
 3148|       |
 3149|     14|                bSymmNeigh = BreakNeighborsTie(pCG,
 3150|     14|                    at, num_atoms, num_at_tg,
 3151|     14|                    opposite_atom, i1,
 3152|     14|                    neigh, 0, 1, 0,
 3153|     14|                    pRankStack1, pRankStack2, nTempRank,
 3154|     14|                    NeighList, nSymmRank, nCanonRank,
 3155|     14|                    nl1, nl2, &pCS->lNumNeighListIter);
 3156|       |
 3157|     14|                if (bSymmNeigh <= 0)
  ------------------
  |  Branch (3157:21): [True: 0, False: 14]
  ------------------
 3158|      0|                {
 3159|      0|                    if (ret_failed > bSymmNeigh)
  ------------------
  |  Branch (3159:25): [True: 0, False: 0]
  ------------------
 3160|      0|                        ret_failed = bSymmNeigh;
 3161|      0|                    continue;
 3162|      0|                }
 3163|     14|                nl01 = nl1;
 3164|     14|                nl02 = nl2;
 3165|     14|                nSymmRank1 = pRankStack1[0];
 3166|     14|                nSymmRank2 = pRankStack2[0];
 3167|     14|                break;
 3168|      0|            default:
  ------------------
  |  Branch (3168:13): [True: 0, False: 32]
  ------------------
 3169|      0|                return CT_STEREOCOUNT_ERR;  /*  <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 3170|     32|            }
 3171|       |
 3172|       |            /*  initialize arrays */
 3173|     14|            memset(nVisited1, 0, sizeof(nVisited1[0]) * num_atoms); /* djb-rwth: memset_s C11/Annex K variant? */
 3174|     14|            memset(nVisited2, 0, sizeof(nVisited2[0]) * num_atoms); /* djb-rwth: memset_s C11/Annex K variant? */
 3175|     14|            memset(nAtomNumberCanon1, 0, sizeof(nAtomNumberCanon1[0]) * num_atoms); /* djb-rwth: memset_s C11/Annex K variant? */
 3176|     14|            memset(nAtomNumberCanon2, 0, sizeof(nAtomNumberCanon2[0]) * num_atoms); /* djb-rwth: memset_s C11/Annex K variant? */
 3177|     14|            nLength = 1;
 3178|     14|            nVisited1[i1] = i1 + 1;   /*  start atoms are the same */
 3179|     14|            nVisited2[i1] = i1 + 1;
 3180|     14|            nAtomNumberCanon1[i1] = nLength;
 3181|     14|            nAtomNumberCanon2[i1] = nLength;
 3182|     14|            nAvoidCheckAtom[0] = i1;
 3183|     14|            nAvoidCheckAtom[1] = opposite_atom;
 3184|     14|            bParitiesInverted = (nNeighMode == NEIGH_MODE_RING &&
  ------------------
  |  | 2282|     28|#define NEIGH_MODE_RING        1
  ------------------
  |  Branch (3184:34): [True: 14, False: 0]
  ------------------
 3185|     14|                IS_ALLENE_CHAIN(at[i1].stereo_bond_parity[n1]) &&
  ------------------
  |  |  215|     28|#define IS_ALLENE_CHAIN(X)          ((GET_BITS_CUMULENE_LEN(X)/MULT_STEREOBOND)%2)
  |  |  ------------------
  |  |  |  |  213|     14|#define GET_BITS_CUMULENE_LEN(X)    ((X)&MASK_CUMULENE_LEN)
  |  |  |  |  ------------------
  |  |  |  |  |  |  205|     14|#define MASK_CUMULENE_LEN  0x38  /* mask to retrieve (cumulene chain length - 1)*MULT_STEREOBOND    */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define IS_ALLENE_CHAIN(X)          ((GET_BITS_CUMULENE_LEN(X)/MULT_STEREOBOND)%2)
  |  |  ------------------
  |  |  |  |  209|     14|#define MULT_STEREOBOND    0x08  /* multiplier for cumulene chain length
  |  |  ------------------
  |  |  |  Branch (215:37): [True: 7, False: 7]
  |  |  ------------------
  ------------------
 3186|      7|                PARITY_CALCULATE(at[i1].stereo_bond_parity[n1]) &&
  ------------------
  |  |  267|     21|#define PARITY_CALCULATE(X)         (AB_PARITY_CALC == PARITY_VAL(X))
  |  |  ------------------
  |  |  |  |  224|      7|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  |  |  ------------------
  |  |               #define PARITY_CALCULATE(X)         (AB_PARITY_CALC == PARITY_VAL(X))
  |  |  ------------------
  |  |  |  |  262|      7|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      7|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (267:37): [True: 6, False: 1]
  |  |  ------------------
  ------------------
 3187|      6|                at[i1].nRingSystem == at[opposite_atom].nRingSystem &&
  ------------------
  |  Branch (3187:17): [True: 0, False: 6]
  ------------------
 3188|     14|                at[opposite_atom].valence == MAX_NUM_STEREO_BONDS) ? -1 : 0;
  ------------------
  |  |  873|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (3188:17): [True: 0, False: 0]
  ------------------
 3189|       |            /* djb-rwth: removing redundant code */
 3190|       |
 3191|       |            /* djb-rwth: restructuring code to avoid garbage values -- discussion required */
 3192|       |
 3193|     14|            ret1 = CreateCheckSymmPaths(at, (AT_RANK)i1, neigh[0], (AT_RANK)i1, neigh[1], nAvoidCheckAtom,
 3194|     14|                nVisited1, nVisited2, nAtomNumberCanon1, nAtomNumberCanon2,
 3195|     14|                nl01, nl02, nSymmRank1, nSymmRank2, nCanonRank, &nLength, &bParitiesInverted, 0);
 3196|     14|            ret2 = CalculatedPathsParitiesAreIdentical(pCG, at, num_atoms, nSymmRank,
 3197|     14|                nCanonRank, nAtomNumberCanon, nAtomNumberCanon1, nAtomNumberCanon2,
 3198|     14|                nVisited1, nVisited2, opposite_atom, (AT_RANK)i1,
 3199|     14|                neigh[0], neigh[1], nNeighMode, bParitiesInverted, 0,
 3200|     14|                pCS, vABParityUnknown);
 3201|       |
 3202|     14|            if (0 < ret1) /* djb-rwth: or is this (0 < ret1) && (0 < ret2) ? */
  ------------------
  |  Branch (3202:17): [True: 14, False: 0]
  ------------------
 3203|     14|            {
 3204|     14|                if (0 < ret2)
  ------------------
  |  Branch (3204:21): [True: 14, False: 0]
  ------------------
 3205|     14|                {
 3206|     14|                    {
 3207|     14|                        if (ret2 & (NOT_WELL_DEF_UNKN | NOT_WELL_DEF_UNDF))
  ------------------
  |  | 2289|     14|#define NOT_WELL_DEF_UNKN      2
  ------------------
                                      if (ret2 & (NOT_WELL_DEF_UNKN | NOT_WELL_DEF_UNDF))
  ------------------
  |  | 2290|     14|#define NOT_WELL_DEF_UNDF      4
  ------------------
  |  Branch (3207:29): [True: 0, False: 14]
  ------------------
 3208|      0|                        {
 3209|       |                            /*  possibly change the parity to unknown or undefined */
 3210|      0|                            int new_parity = (ret2 & NOT_WELL_DEF_UNKN) ? vABParityUnknown /*AB_PARITY_UNKN*/ : AB_PARITY_UNDF;
  ------------------
  |  | 2289|      0|#define NOT_WELL_DEF_UNKN      2
  ------------------
                                          int new_parity = (ret2 & NOT_WELL_DEF_UNKN) ? vABParityUnknown /*AB_PARITY_UNKN*/ : AB_PARITY_UNDF;
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (3210:46): [True: 0, False: 0]
  ------------------
 3211|      0|                            if ((PARITY_ILL_DEF(at[i1].stereo_bond_parity[n1]) && PARITY_VAL(at[i1].stereo_bond_parity[n1]) > new_parity) ||
  ------------------
  |  |  264|      0|#define PARITY_ILL_DEF(X)           (AB_MIN_ILL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_ILL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  239|      0|#define AB_MIN_ILL_DEFINED_PARITY  3
  |  |  ------------------
  |  |               #define PARITY_ILL_DEF(X)           (AB_MIN_ILL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_ILL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|      0|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      0|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_ILL_DEF(X)           (AB_MIN_ILL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_ILL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|      0|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      0|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_ILL_DEF(X)           (AB_MIN_ILL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_ILL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  240|      0|#define AB_MAX_ILL_DEFINED_PARITY  4
  |  |  ------------------
  |  |  |  Branch (264:38): [True: 0, False: 0]
  |  |  |  Branch (264:84): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                          if ((PARITY_ILL_DEF(at[i1].stereo_bond_parity[n1]) && PARITY_VAL(at[i1].stereo_bond_parity[n1]) > new_parity) ||
  ------------------
  |  |  262|      0|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|      0|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
  |  Branch (3211:83): [True: 0, False: 0]
  ------------------
 3212|      0|                                PARITY_CALCULATE(at[i1].stereo_bond_parity[n1])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  267|      0|#define PARITY_CALCULATE(X)         (AB_PARITY_CALC == PARITY_VAL(X))
  |  |  ------------------
  |  |  |  |  224|      0|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  |  |  ------------------
  |  |               #define PARITY_CALCULATE(X)         (AB_PARITY_CALC == PARITY_VAL(X))
  |  |  ------------------
  |  |  |  |  262|      0|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      0|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (267:37): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3213|      0|                            {
 3214|       |                                /*  set new unknown or undefined parity */
 3215|      0|                                SetOneStereoBondIllDefParity(at, i1, /* atom number*/ n1 /* stereo bond ord. number*/, new_parity);
 3216|       |                                /*  change in pCS */
 3217|      0|                                nAtomRank1 = inchi_max(nCanonRank[i1], nCanonRank[opposite_atom]);
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3218|      0|                                nAtomRank2 = inchi_min(nCanonRank[i1], nCanonRank[opposite_atom]);
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3219|      0|                                for (n = 0, m = pCS->nLenLinearCTStereoDble - 1; n <= m; n++)
  ------------------
  |  Branch (3219:82): [True: 0, False: 0]
  ------------------
 3220|      0|                                {
 3221|      0|                                    if (pCS->LinearCTStereoDble[n].at_num1 == nAtomRank1 &&
  ------------------
  |  Branch (3221:41): [True: 0, False: 0]
  ------------------
 3222|      0|                                        pCS->LinearCTStereoDble[n].at_num2 == nAtomRank2)
  ------------------
  |  Branch (3222:41): [True: 0, False: 0]
  ------------------
 3223|      0|                                    {
 3224|      0|                                        pCS->LinearCTStereoDble[n].parity = new_parity;
 3225|       |#if ( bRELEASE_VERSION == 0 )
 3226|       |                                        pCS->bExtract |= EXTR_CALC_USED_TO_REMOVE_PARITY;
 3227|       |#endif
 3228|      0|                                        m = -1;
 3229|      0|                                        break;
 3230|      0|                                    }
 3231|      0|                                }
 3232|      0|                                if (m >= 0)
  ------------------
  |  Branch (3232:37): [True: 0, False: 0]
  ------------------
 3233|      0|                                {
 3234|      0|                                    ret = CT_STEREOCOUNT_ERR;  /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 3235|      0|                                    goto exit_function;
 3236|      0|                                }
 3237|      0|                                ret++;
 3238|      0|                            }
 3239|      0|                        }
 3240|     14|                        else
 3241|     14|                        {
 3242|       |                            /*  remove the parity */
 3243|     14|                            if (!RemoveOneStereoBond(at, i1, /* atom number*/ n1 /* stereo bond ord. number*/))
  ------------------
  |  Branch (3243:33): [True: 0, False: 14]
  ------------------
 3244|      0|                            {
 3245|      0|                                ret = CT_STEREOBOND_ERROR;  /*   <BRKPT> */
  ------------------
  |  |   31|      0|#define CT_STEREOBOND_ERROR  (CT_ERR_FIRST-12)  /*(-30012) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 3246|      0|                                goto exit_function;
 3247|      0|                            }
 3248|     14|                            n1--;  /*  cycle counter may temporarily become negative */
 3249|       |                            /*  Remove from the pCS */
 3250|     14|                            nAtomRank1 = inchi_max(nCanonRank[i1], nCanonRank[opposite_atom]);
  ------------------
  |  |  138|     14|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 1, False: 13]
  |  |  ------------------
  ------------------
 3251|     14|                            nAtomRank2 = inchi_min(nCanonRank[i1], nCanonRank[opposite_atom]);
  ------------------
  |  |  139|     14|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 13, False: 1]
  |  |  ------------------
  ------------------
 3252|     14|                            for (n = 0, m = pCS->nLenLinearCTStereoDble - 1; n <= m; n++)
  ------------------
  |  Branch (3252:78): [True: 14, False: 0]
  ------------------
 3253|     14|                            {
 3254|     14|                                if (pCS->LinearCTStereoDble[n].at_num1 == nAtomRank1 &&
  ------------------
  |  Branch (3254:37): [True: 14, False: 0]
  ------------------
 3255|     14|                                    pCS->LinearCTStereoDble[n].at_num2 == nAtomRank2)
  ------------------
  |  Branch (3255:37): [True: 14, False: 0]
  ------------------
 3256|     14|                                {
 3257|     14|                                    if (n < m)
  ------------------
  |  Branch (3257:41): [True: 0, False: 14]
  ------------------
 3258|      0|                                    {
 3259|       |                                        /*  remove pCS->LinearCTStereoDble[n] */
 3260|      0|                                        memmove(pCS->LinearCTStereoDble + n,
 3261|      0|                                            pCS->LinearCTStereoDble + n + 1,
 3262|      0|                                            ((long long)m - (long long)n) * sizeof(pCS->LinearCTStereoDble[0])); /* djb-rwth: cast operators added */
 3263|      0|                                    }
 3264|     14|                                    pCS->nLenLinearCTStereoDble--;
 3265|       |#if ( bRELEASE_VERSION == 0 )
 3266|       |                                    pCS->bExtract |= EXTR_CALC_USED_TO_REMOVE_PARITY;
 3267|       |#endif
 3268|     14|                                    m = -1;
 3269|     14|                                    break;
 3270|     14|                                }
 3271|     14|                            }
 3272|     14|                            if (m >= 0)
  ------------------
  |  Branch (3272:33): [True: 0, False: 14]
  ------------------
 3273|      0|                            {
 3274|      0|                                ret = CT_STEREOCOUNT_ERR;  /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 3275|      0|                                goto exit_function;
 3276|      0|                            }
 3277|     14|                            ret++;
 3278|     14|                        }
 3279|     14|                    }
 3280|     14|                }
 3281|      0|                else
 3282|      0|                {
 3283|      0|                    if (!ret_failed)
  ------------------
  |  Branch (3283:25): [True: 0, False: 0]
  ------------------
 3284|      0|                    {
 3285|      0|                        ret_failed = (ret1 < 0) ? ret1 : (ret2 < 0) ? ret2 : 0;
  ------------------
  |  Branch (3285:38): [True: 0, False: 0]
  |  Branch (3285:58): [True: 0, False: 0]
  ------------------
 3286|      0|                    }
 3287|      0|                    if (!RETURNED_ERROR(ret_failed))
  ------------------
  |  |   44|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 0, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3288|      0|                    {
 3289|      0|                        if (RETURNED_ERROR(ret1))
  ------------------
  |  |   44|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 0, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3290|      0|                        {
 3291|      0|                            ret_failed = ret1;
 3292|      0|                        }
 3293|      0|                        else
 3294|      0|                        {
 3295|      0|                            if (RETURNED_ERROR(ret2))
  ------------------
  |  |   44|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 0, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3296|      0|                            {
 3297|      0|                                ret_failed = ret2;
 3298|      0|                            }
 3299|      0|                        }
 3300|      0|                    }
 3301|      0|                }
 3302|     14|            }
 3303|     14|        }
 3304|    124|    }
 3305|       |
 3306|  2.19k|    if (nNeighMode == NEIGH_MODE_CHAIN && nNumEqRingNeigh && !RETURNED_ERROR( ret_failed ))
  ------------------
  |  | 2283|  4.39k|#define NEIGH_MODE_CHAIN       2
  ------------------
                  if (nNeighMode == NEIGH_MODE_CHAIN && nNumEqRingNeigh && !RETURNED_ERROR( ret_failed ))
  ------------------
  |  |   44|     14|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|     14|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|     14|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|     14|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|     14|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|     14|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 14, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 14]
  |  |  ------------------
  ------------------
  |  Branch (3306:9): [True: 2.18k, False: 14]
  |  Branch (3306:43): [True: 14, False: 2.16k]
  ------------------
 3307|     14|    {
 3308|     14|        nNeighMode = NEIGH_MODE_RING;
  ------------------
  |  | 2282|     14|#define NEIGH_MODE_RING        1
  ------------------
 3309|     14|        goto second_pass;
 3310|     14|    }
 3311|       |
 3312|  2.18k|exit_function:
 3313|       |
 3314|  2.18k|    return RETURNED_ERROR( ret_failed ) ? ret_failed : ret_failed ? -( ret_failed + 1 ) : ret;
  ------------------
  |  |   44|  2.18k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  2.18k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  2.18k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  2.18k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  2.18k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  2.18k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 2.18k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 2.18k]
  |  |  ------------------
  ------------------
  |  Branch (3314:56): [True: 0, False: 2.18k]
  ------------------
 3315|  2.19k|}
RemoveCalculatedNonStereoCenterParities:
 3341|  2.18k|{
 3342|  2.18k|    int j, n, m, ret;
 3343|       |
 3344|  2.18k|    int i, k, ret1, ret2, ret_failed = 0, mode, max_mode;
 3345|  2.18k|    AT_RANK nAtomRank1, neigh[MAX_NUM_STEREO_ATOM_NEIGH] = { 0 }, nAvoidCheckAtom[2], nLength; /* djb-rwth: initialisation of neigh required to avoid undefined array subscript */
 3346|  2.18k|    int         nNeighMode = NEIGH_MODE_CHAIN;
  ------------------
  |  | 2283|  2.18k|#define NEIGH_MODE_CHAIN       2
  ------------------
 3347|  2.18k|    int         nNumEqRingNeigh = 0, bRingNeigh, bSymmNeigh, bParitiesInverted;
 3348|  2.18k|    NEIGH_LIST *nl01, *nl02;
 3349|  2.18k|    const AT_RANK    *nSymmRank1, *nSymmRank2;
 3350|       |
 3351|  2.18k|    ret = 0;
 3352|       |
 3353|  3.29k|second_pass:
 3354|       |
 3355|  22.1k|    for (i = 0; i < num_atoms && !RETURNED_ERROR( ret_failed ); i++)
  ------------------
  |  |   44|  18.8k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  18.8k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  18.8k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  18.8k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  18.8k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  18.8k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 18.8k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 18.8k]
  |  |  ------------------
  ------------------
  |  Branch (3355:17): [True: 18.8k, False: 3.29k]
  ------------------
 3356|  18.8k|    {
 3357|  18.8k|        if (!at[i].parity || at[i].stereo_bond_neighbor[0])
  ------------------
  |  Branch (3357:13): [True: 8.50k, False: 10.3k]
  |  Branch (3357:30): [True: 2.03k, False: 8.34k]
  ------------------
 3358|  10.5k|        {
 3359|  10.5k|            continue;
 3360|  10.5k|        }
 3361|       |
 3362|  8.34k|        if (at[i].valence > MAX_NUM_STEREO_ATOM_NEIGH)
  ------------------
  |  |  877|  8.34k|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (3362:13): [True: 0, False: 8.34k]
  ------------------
 3363|      0|        {
 3364|      0|            continue; /*  error: stereo center cannot have more than 4 neighbors */ /*   <BRKPT> */
 3365|      0|        }
 3366|       |
 3367|       |        /*  at[i1] is a stereo center */
 3368|  8.34k|        if (!PARITY_CALCULATE( at[i].stereo_atom_parity ) && !PARITY_ILL_DEF( at[i].stereo_atom_parity ))
  ------------------
  |  |  267|  16.6k|#define PARITY_CALCULATE(X)         (AB_PARITY_CALC == PARITY_VAL(X))
  |  |  ------------------
  |  |  |  |  224|  8.34k|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  |  |  ------------------
  |  |               #define PARITY_CALCULATE(X)         (AB_PARITY_CALC == PARITY_VAL(X))
  |  |  ------------------
  |  |  |  |  262|  8.34k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  8.34k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                      if (!PARITY_CALCULATE( at[i].stereo_atom_parity ) && !PARITY_ILL_DEF( at[i].stereo_atom_parity ))
  ------------------
  |  |  264|  5.61k|#define PARITY_ILL_DEF(X)           (AB_MIN_ILL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_ILL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  239|  5.61k|#define AB_MIN_ILL_DEFINED_PARITY  3
  |  |  ------------------
  |  |               #define PARITY_ILL_DEF(X)           (AB_MIN_ILL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_ILL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|  11.2k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  5.61k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_ILL_DEF(X)           (AB_MIN_ILL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_ILL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|  5.11k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  5.11k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_ILL_DEF(X)           (AB_MIN_ILL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_ILL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  240|  5.11k|#define AB_MAX_ILL_DEFINED_PARITY  4
  |  |  ------------------
  |  |  |  Branch (264:38): [True: 5.11k, False: 505]
  |  |  |  Branch (264:84): [True: 5.11k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (3368:13): [True: 5.61k, False: 2.72k]
  ------------------
 3369|    505|        {
 3370|    505|            continue;
 3371|    505|        }
 3372|       |
 3373|       |        /* neighbors sorted according to symm. ranks (primary key) and canon. ranks (secondary key), in descending order */
 3374|       |        /* sorting guarantees that for two constit. equ. neighbors canon. ranks of the first is greater */
 3375|       |        /* !!! previously (but not anymore) the canon. rank of neigh[0] was greater than the others !!! */
 3376|  37.7k|        for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (3376:21): [True: 29.9k, False: 7.83k]
  ------------------
 3377|  29.9k|        {
 3378|  29.9k|            neigh[j] = nl[i][j + 1]; /*  sorting does NOT guarantee that canon. rank of neigh[0] is greater than others */
 3379|  29.9k|        }
 3380|       |
 3381|       |        /*
 3382|       |         *  mode = 0 => Standard approach: switch 2 neighbors
 3383|       |         *         1 => Check for C2v reflection leading to parity inversion
 3384|       |         *         2 => Check for C2 rotation preserving parities
 3385|       |         *         3 => Check for S4 rotation/reflection leading to parity inversion
 3386|       |         */
 3387|       |
 3388|       |#if ( CHECK_C2v_S4_SYMM == 1 )
 3389|       |        if (nNeighMode = NEIGH_MODE_RING && at[i].valence == 4 &&
 3390|       |             nSymmRank[(int) neigh[0]] == nSymmRank[(int) neigh[1]] &&
 3391|       |             nSymmRank[(int) neigh[2]] == nSymmRank[(int) neigh[3]] &&
 3392|       |             !at[i].bCutVertex
 3393|       |           )
 3394|       |        {
 3395|       |            if (nSymmRank[(int) neigh[1]] == nSymmRank[(int) neigh[2]])
 3396|       |            {
 3397|       |                max_mode = MAP_MODE_S4;
 3398|       |            }
 3399|       |            else
 3400|       |            {
 3401|       |                max_mode = inchi_max( MAP_MODE_C2v, MAP_MODE_C2 );
 3402|       |            }
 3403|       |        }
 3404|       |        else
 3405|       |        {
 3406|       |            max_mode = MAP_MODE_STD;
 3407|       |        }
 3408|       |#else
 3409|  7.83k|        max_mode = MAP_MODE_STD;
  ------------------
  |  |   14|  7.83k|#define MAP_MODE_STD  0 /* Standard approach: switch 2 neighbors */
  ------------------
 3410|  7.83k|#endif
 3411|       |
 3412|  37.6k|        for (j = 0; j < at[i].valence && at[i].parity && !RETURNED_ERROR( ret_failed ); j++)
  ------------------
  |  |   44|  29.7k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  29.7k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  29.7k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  29.7k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  29.7k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  29.7k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 29.7k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 29.7k]
  |  |  ------------------
  ------------------
  |  Branch (3412:21): [True: 29.8k, False: 7.75k]
  |  Branch (3412:42): [True: 29.7k, False: 89]
  ------------------
 3413|  29.7k|        {
 3414|  72.4k|            for (k = j + 1; k < at[i].valence && at[i].parity && !RETURNED_ERROR( ret_failed ); k++)
  ------------------
  |  |   44|  42.6k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  42.6k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  42.6k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  42.6k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  42.6k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  42.6k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 42.6k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 42.6k]
  |  |  ------------------
  ------------------
  |  Branch (3414:29): [True: 42.7k, False: 29.7k]
  |  Branch (3414:50): [True: 42.6k, False: 43]
  ------------------
 3415|  42.6k|            {
 3416|  85.3k|                for (mode = 0; mode <= max_mode && at[i].parity && !RETURNED_ERROR(ret_failed); mode++)
  ------------------
  |  |   44|  42.6k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  42.6k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  42.6k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  42.6k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  42.6k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  42.6k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 42.6k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 42.6k]
  |  |  ------------------
  ------------------
  |  Branch (3416:32): [True: 42.6k, False: 42.6k]
  |  Branch (3416:52): [True: 42.6k, False: 0]
  ------------------
 3417|  42.6k|                {
 3418|  42.6k|                    if (nSymmRank[(int)neigh[j]] != nSymmRank[(int)neigh[k]])
  ------------------
  |  Branch (3418:25): [True: 23.1k, False: 19.5k]
  ------------------
 3419|  23.1k|                    {
 3420|  23.1k|                        continue; /*  the two neighbors are not constitutionally identical */
 3421|  23.1k|                    }
 3422|  19.5k|                    bRingNeigh = (at[(int)neigh[j]].nRingSystem == at[(int)neigh[k]].nRingSystem);
 3423|  19.5k|                    switch (nNeighMode)
 3424|  19.5k|                    {
 3425|  9.79k|                    case NEIGH_MODE_CHAIN:
  ------------------
  |  | 2283|  9.79k|#define NEIGH_MODE_CHAIN       2
  ------------------
  |  Branch (3425:21): [True: 9.79k, False: 9.71k]
  ------------------
 3426|  9.79k|                        if (bRingNeigh)
  ------------------
  |  Branch (3426:29): [True: 9.79k, False: 0]
  ------------------
 3427|  9.79k|                        {
 3428|  9.79k|                            nNumEqRingNeigh++;
 3429|  9.79k|                            continue;
 3430|  9.79k|                        }
 3431|      0|                        nl01 = nl;
 3432|      0|                        nl02 = nl;
 3433|      0|                        nSymmRank1 = nSymmRank;
 3434|      0|                        nSymmRank2 = nSymmRank;
 3435|      0|                        break;
 3436|  9.71k|                    case NEIGH_MODE_RING:
  ------------------
  |  | 2282|  9.71k|#define NEIGH_MODE_RING        1
  ------------------
  |  Branch (3436:21): [True: 9.71k, False: 9.79k]
  ------------------
 3437|  9.71k|                        if (!bRingNeigh)
  ------------------
  |  Branch (3437:29): [True: 0, False: 9.71k]
  ------------------
 3438|      0|                            continue;
 3439|       |                        /*  break a tie between the two contitutionally equivalent neighbors, */
 3440|       |                        /*  refine the two partitions, sort neighbors lists nl1, nl2 */
 3441|  9.71k|                        bSymmNeigh = BreakNeighborsTie(pCG, at, num_atoms, num_at_tg, MAX_ATOMS + 1, i,
  ------------------
  |  |   15|  9.71k|#define MAX_ATOMS  32766
  ------------------
 3442|  9.71k|                            neigh, j, k, mode,
 3443|  9.71k|                            pRankStack1, pRankStack2, nTempRank, NeighList, nSymmRank, nCanonRank,
 3444|  9.71k|                            nl1, nl2, &pCS->lNumNeighListIter);
 3445|  9.71k|                        if (bSymmNeigh <= 0)
  ------------------
  |  Branch (3445:29): [True: 127, False: 9.59k]
  ------------------
 3446|    127|                        {
 3447|    127|                            if (ret_failed > bSymmNeigh)
  ------------------
  |  Branch (3447:33): [True: 0, False: 127]
  ------------------
 3448|      0|                                ret_failed = bSymmNeigh;
 3449|    127|                            continue;
 3450|    127|                        }
 3451|  9.59k|                        nl01 = nl1;
 3452|  9.59k|                        nl02 = nl2;
 3453|  9.59k|                        nSymmRank1 = pRankStack1[0];
 3454|  9.59k|                        nSymmRank2 = pRankStack2[0];
 3455|  9.59k|                        break;
 3456|      0|                    default:
  ------------------
  |  Branch (3456:21): [True: 0, False: 19.5k]
  ------------------
 3457|      0|                        return CT_STEREOCOUNT_ERR;  /*  <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 3458|  19.5k|                    }
 3459|       |
 3460|       |                    /*  initialize arrays */
 3461|  9.59k|                    memset(nVisited1, 0, sizeof(nVisited1[0]) * num_atoms); /* djb-rwth: memset_s C11/Annex K variant? */
 3462|  9.59k|                    memset(nVisited2, 0, sizeof(nVisited2[0]) * num_atoms); /* djb-rwth: memset_s C11/Annex K variant? */
 3463|  9.59k|                    memset(nAtomNumberCanon1, 0, sizeof(nAtomNumberCanon1[0]) * num_atoms); /* djb-rwth: memset_s C11/Annex K variant? */
 3464|  9.59k|                    memset(nAtomNumberCanon2, 0, sizeof(nAtomNumberCanon2[0]) * num_atoms); /* djb-rwth: memset_s C11/Annex K variant? */
 3465|  9.59k|                    nLength = 1;
 3466|  9.59k|                    nVisited1[i] = i + 1;   /*  start atom is same */
 3467|  9.59k|                    nVisited2[i] = i + 1;
 3468|  9.59k|                    nAtomNumberCanon1[i] = nLength;
 3469|  9.59k|                    nAtomNumberCanon2[i] = nLength;
 3470|  9.59k|                    nAvoidCheckAtom[0] = i;
 3471|  9.59k|                    nAvoidCheckAtom[1] = MAX_ATOMS + 1;
  ------------------
  |  |   15|  9.59k|#define MAX_ATOMS  32766
  ------------------
 3472|       |
 3473|  9.59k|                    bParitiesInverted = (mode == MAP_MODE_C2v || mode == MAP_MODE_S4) ? -1 : 0;
  ------------------
  |  |   15|  19.1k|#define MAP_MODE_C2v  1 /* Check for C2v reflection leading to parity inversion */
  ------------------
                                  bParitiesInverted = (mode == MAP_MODE_C2v || mode == MAP_MODE_S4) ? -1 : 0;
  ------------------
  |  |   17|  9.59k|#define MAP_MODE_S4   3 /* Check for S4 rotation/reflection leading to parity inversion */
  ------------------
  |  Branch (3473:42): [True: 0, False: 9.59k]
  |  Branch (3473:66): [True: 0, False: 9.59k]
  ------------------
 3474|       |
 3475|       |                    /*
 3476|       |                    if (nNeighMode==NEIGH_MODE_RING && at[i].valence==MAX_NUM_STEREO_ATOM_NEIGH) {
 3477|       |                        AT_RANK other_neigh[2];
 3478|       |                        int     n;
 3479|       |                        for ( m = n = 0; m < MAX_NUM_STEREO_ATOM_NEIGH; m ++ ) {
 3480|       |                            if ( at[i].neighbor[m] != neigh[j] && at[i].neighbor[m] != neigh[k] )
 3481|       |                                other_neigh[n++] = at[i].neighbor[m];
 3482|       |                        }
 3483|       |                        if ( nSymmRank[(int)other_neigh[0]] == nSymmRank[(int)other_neigh[1]] )
 3484|       |                            bParitiesInverted = -1;
 3485|       |                    }
 3486|       |                    */
 3487|       |
 3488|       |                    /* allow matching inverted centers only in case all equivalent neighbors in same ring system */
 3489|       |
 3490|       |                    /* djb-rwth: restructuring code to avoid undefined array subscripts; removing unnecessary code; discussion required */
 3491|       |
 3492|  9.59k|                    ret1 = CreateCheckSymmPaths(at, (AT_RANK)i, neigh[j], (AT_RANK)i, neigh[k], nAvoidCheckAtom,
 3493|  9.59k|                        nVisited1, nVisited2, nAtomNumberCanon1, nAtomNumberCanon2,
 3494|  9.59k|                        nl01, nl02, nSymmRank1, nSymmRank2, nCanonRank, &nLength,
 3495|  9.59k|                        &bParitiesInverted, mode);
 3496|  9.59k|                    ret2 = CalculatedPathsParitiesAreIdentical(pCG, at, num_atoms, nSymmRank,
 3497|  9.59k|                        nCanonRank, nAtomNumberCanon, nAtomNumberCanon1, nAtomNumberCanon2,
 3498|  9.59k|                        nVisited1, nVisited2, (AT_RANK)MAX_ATOMS, (AT_RANK)i,
  ------------------
  |  |   15|  9.59k|#define MAX_ATOMS  32766
  ------------------
 3499|  9.59k|                        neigh[j], neigh[k], nNeighMode,
 3500|  9.59k|                        bParitiesInverted, mode, pCS, vABParityUnknown);
 3501|       |
 3502|  9.59k|                    if (0 < ret1) /* djb-rwth: or is this (0 < ret1) && (0 < ret2) ? */
  ------------------
  |  Branch (3502:25): [True: 6.56k, False: 3.02k]
  ------------------
 3503|  6.56k|                    {
 3504|  6.56k|                        if (0 < ret2)
  ------------------
  |  Branch (3504:29): [True: 468, False: 6.09k]
  ------------------
 3505|    468|                        {
 3506|    468|                            {
 3507|    468|                                if (ret2 & (NOT_WELL_DEF_UNKN | NOT_WELL_DEF_UNDF))
  ------------------
  |  | 2289|    468|#define NOT_WELL_DEF_UNKN      2
  ------------------
                                              if (ret2 & (NOT_WELL_DEF_UNKN | NOT_WELL_DEF_UNDF))
  ------------------
  |  | 2290|    468|#define NOT_WELL_DEF_UNDF      4
  ------------------
  |  Branch (3507:37): [True: 379, False: 89]
  ------------------
 3508|    379|                                {
 3509|       |                                    /*  possibly change the parity to unknown or undefined */
 3510|    379|                                    int new_parity = (ret2 & NOT_WELL_DEF_UNKN) ? vABParityUnknown /*AB_PARITY_UNKN*/ : AB_PARITY_UNDF;
  ------------------
  |  | 2289|    379|#define NOT_WELL_DEF_UNKN      2
  ------------------
                                                  int new_parity = (ret2 & NOT_WELL_DEF_UNKN) ? vABParityUnknown /*AB_PARITY_UNKN*/ : AB_PARITY_UNDF;
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (3510:54): [True: 379, False: 0]
  ------------------
 3511|    379|                                    if ((PARITY_ILL_DEF(at[i].stereo_atom_parity) &&
  ------------------
  |  |  264|    758|#define PARITY_ILL_DEF(X)           (AB_MIN_ILL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_ILL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  239|    379|#define AB_MIN_ILL_DEFINED_PARITY  3
  |  |  ------------------
  |  |               #define PARITY_ILL_DEF(X)           (AB_MIN_ILL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_ILL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|    758|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    379|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_ILL_DEF(X)           (AB_MIN_ILL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_ILL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  262|    379|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    379|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_ILL_DEF(X)           (AB_MIN_ILL_DEFINED_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_ILL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  240|    379|#define AB_MAX_ILL_DEFINED_PARITY  4
  |  |  ------------------
  |  |  |  Branch (264:38): [True: 379, False: 0]
  |  |  |  Branch (264:84): [True: 303, False: 76]
  |  |  ------------------
  ------------------
 3512|    303|                                        PARITY_VAL(at[i].stereo_atom_parity) > new_parity) ||
  ------------------
  |  |  262|    303|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|    303|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
  |  Branch (3512:41): [True: 0, False: 303]
  ------------------
 3513|    379|                                        PARITY_CALCULATE(at[i].stereo_atom_parity)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  267|    379|#define PARITY_CALCULATE(X)         (AB_PARITY_CALC == PARITY_VAL(X))
  |  |  ------------------
  |  |  |  |  224|    379|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  |  |  ------------------
  |  |               #define PARITY_CALCULATE(X)         (AB_PARITY_CALC == PARITY_VAL(X))
  |  |  ------------------
  |  |  |  |  262|    379|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    379|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (267:37): [True: 76, False: 303]
  |  |  ------------------
  ------------------
 3514|     76|                                    {
 3515|       |                                        /*  set new unknown or undefined parity */
 3516|     76|                                        at[i].stereo_atom_parity = (at[i].stereo_atom_parity ^ PARITY_VAL(at[i].stereo_atom_parity)) | PARITY_VAL(new_parity);
  ------------------
  |  |  262|     76|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|     76|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
                                                      at[i].stereo_atom_parity = (at[i].stereo_atom_parity ^ PARITY_VAL(at[i].stereo_atom_parity)) | PARITY_VAL(new_parity);
  ------------------
  |  |  262|     76|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|     76|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
 3517|     76|                                        at[i].parity = PARITY_VAL(new_parity);
  ------------------
  |  |  262|     76|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|     76|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
 3518|       |                                        /*  Remove from pCS */
 3519|     76|                                        nAtomRank1 = nCanonRank[i];
 3520|    151|                                        for (n = 0, m = pCS->nLenLinearCTStereoCarb - 1; n <= m; n++)
  ------------------
  |  Branch (3520:90): [True: 151, False: 0]
  ------------------
 3521|    151|                                        {
 3522|    151|                                            if (pCS->LinearCTStereoCarb[n].at_num == nAtomRank1)
  ------------------
  |  Branch (3522:49): [True: 76, False: 75]
  ------------------
 3523|     76|                                            {
 3524|     76|                                                pCS->LinearCTStereoCarb[n].parity = PARITY_VAL(new_parity);
  ------------------
  |  |  262|     76|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|     76|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
 3525|       |#if ( bRELEASE_VERSION == 0 )
 3526|       |                                                pCS->bExtract |= EXTR_CALC_USED_TO_REMOVE_PARITY;
 3527|       |#endif
 3528|     76|                                                m = -1;
 3529|     76|                                                break;
 3530|     76|                                            }
 3531|    151|                                        }
 3532|     76|                                        if (m >= 0)
  ------------------
  |  Branch (3532:45): [True: 0, False: 76]
  ------------------
 3533|      0|                                        {
 3534|      0|                                            ret = CT_STEREOCOUNT_ERR;  /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 3535|      0|                                            goto exit_function;
 3536|      0|                                        }
 3537|     76|                                        ret++; /*  number of removed or set unknown/undefined parities */
 3538|     76|                                    }
 3539|    379|                                }
 3540|     89|                                else
 3541|     89|                                {
 3542|     89|#ifdef FIX_STEREOCOUNT_ERR
 3543|     89|                                    if (at[i].stereo_atom_parity & KNOWN_PARITIES_EQL)
  ------------------
  |  |  206|     89|#define KNOWN_PARITIES_EQL 0x40  /* parity is same for all pairs of constit. equivalent atoms       */
  ------------------
  |  Branch (3543:41): [True: 44, False: 45]
  ------------------
 3544|     44|                                    {
 3545|     44|                                        int jj;
 3546|     44|                                        AT_RANK EqRank = pCS->nSymmRank[i];
 3547|    268|                                        for (jj = 0; jj < num_atoms; jj++)
  ------------------
  |  Branch (3547:54): [True: 224, False: 44]
  ------------------
 3548|    224|                                        {
 3549|    224|                                            if (pCS->nSymmRank[jj] == EqRank)
  ------------------
  |  Branch (3549:49): [True: 46, False: 178]
  ------------------
 3550|     46|                                            {
 3551|     46|                                                at[jj].stereo_atom_parity &= ~KNOWN_PARITIES_EQL;
  ------------------
  |  |  206|     46|#define KNOWN_PARITIES_EQL 0x40  /* parity is same for all pairs of constit. equivalent atoms       */
  ------------------
 3552|     46|                                            }
 3553|    224|                                        }
 3554|     44|                                    }
 3555|     89|#endif
 3556|     89|                                    RemoveOneStereoCenter(at, i /* atom number*/);
 3557|       |                                    /*  Remove from pCS */
 3558|     89|                                    nAtomRank1 = nCanonRank[i];
 3559|    101|                                    for (n = 0, m = pCS->nLenLinearCTStereoCarb - 1; n <= m; n++)
  ------------------
  |  Branch (3559:86): [True: 101, False: 0]
  ------------------
 3560|    101|                                    {
 3561|    101|                                        if (pCS->LinearCTStereoCarb[n].at_num == nAtomRank1)
  ------------------
  |  Branch (3561:45): [True: 89, False: 12]
  ------------------
 3562|     89|                                        {
 3563|     89|                                            if (n < m)
  ------------------
  |  Branch (3563:49): [True: 4, False: 85]
  ------------------
 3564|      4|                                            {
 3565|       |                                                /*  remove pCS->LinearCTStereoDble[n] */
 3566|      4|                                                memmove(pCS->LinearCTStereoCarb + n,
 3567|      4|                                                    pCS->LinearCTStereoCarb + n + 1,
 3568|      4|                                                    ((long long)m - (long long)n) * sizeof(pCS->LinearCTStereoCarb[0])); /* djb-rwth: cast operators added */
 3569|      4|                                            }
 3570|     89|                                            pCS->nLenLinearCTStereoCarb--;
 3571|       |#if ( bRELEASE_VERSION == 0 )
 3572|       |                                            pCS->bExtract |= EXTR_CALC_USED_TO_REMOVE_PARITY;
 3573|       |#endif
 3574|     89|                                            m = -1;
 3575|     89|                                            break;
 3576|     89|                                        }
 3577|    101|                                    }
 3578|     89|                                    if (m >= 0)
  ------------------
  |  Branch (3578:41): [True: 0, False: 89]
  ------------------
 3579|      0|                                    {
 3580|      0|                                        ret = CT_STEREOCOUNT_ERR;  /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 3581|      0|                                        goto exit_function;
 3582|      0|                                    }
 3583|     89|                                    ret++;  /*  number of removed or set unknown/undefined parities */
 3584|     89|                                }
 3585|    468|                            }
 3586|    468|                        }
 3587|  6.09k|                        else
 3588|  6.09k|                        {
 3589|  6.09k|                            if (!ret_failed)
  ------------------
  |  Branch (3589:33): [True: 5.70k, False: 396]
  ------------------
 3590|  5.70k|                            {
 3591|  5.70k|                                if (ret1 < 0)
  ------------------
  |  Branch (3591:37): [True: 0, False: 5.70k]
  ------------------
 3592|      0|                                {
 3593|      0|                                    ret_failed = ret1;
 3594|      0|                                }
 3595|  5.70k|                                else
 3596|  5.70k|                                {
 3597|  5.70k|                                    if (ret2 < 0)
  ------------------
  |  Branch (3597:41): [True: 78, False: 5.62k]
  ------------------
 3598|     78|                                    {
 3599|     78|                                        ret_failed = ret2;
 3600|     78|                                    }
 3601|  5.70k|                                }
 3602|  5.70k|                            }
 3603|  6.09k|                            if (!RETURNED_ERROR(ret_failed))
  ------------------
  |  |   44|  6.09k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  6.09k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  6.09k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  6.09k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  6.09k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  6.09k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 6.09k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 6.09k]
  |  |  ------------------
  ------------------
 3604|  6.09k|                            {
 3605|  6.09k|                                if (RETURNED_ERROR(ret1))
  ------------------
  |  |   44|  6.09k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  6.09k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  6.09k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  6.09k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  6.09k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  6.09k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 6.09k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 6.09k]
  |  |  ------------------
  ------------------
 3606|      0|                                {
 3607|      0|                                    ret_failed = ret1;
 3608|      0|                                }
 3609|  6.09k|                                else
 3610|  6.09k|                                {
 3611|  6.09k|                                    if (RETURNED_ERROR(ret2))
  ------------------
  |  |   44|  6.09k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  6.09k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  6.09k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  6.09k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  6.09k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  6.09k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 6.09k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 6.09k]
  |  |  ------------------
  ------------------
 3612|      0|                                    {
 3613|      0|                                        ret_failed = ret2;
 3614|      0|                                    }
 3615|  6.09k|                                }
 3616|  6.09k|                            }
 3617|  6.09k|                        }
 3618|  6.56k|                    }
 3619|  9.59k|                }
 3620|  42.6k|            }
 3621|  29.7k|        }
 3622|  7.83k|    }
 3623|       |
 3624|  3.29k|    if (nNeighMode == NEIGH_MODE_CHAIN && nNumEqRingNeigh && !RETURNED_ERROR( ret_failed ))
  ------------------
  |  | 2283|  6.58k|#define NEIGH_MODE_CHAIN       2
  ------------------
                  if (nNeighMode == NEIGH_MODE_CHAIN && nNumEqRingNeigh && !RETURNED_ERROR( ret_failed ))
  ------------------
  |  |   44|  1.11k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  1.11k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  1.11k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  1.11k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  1.11k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  1.11k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 1.11k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 1.11k]
  |  |  ------------------
  ------------------
  |  Branch (3624:9): [True: 2.18k, False: 1.11k]
  |  Branch (3624:43): [True: 1.11k, False: 1.07k]
  ------------------
 3625|  1.11k|    {
 3626|  1.11k|        nNeighMode = NEIGH_MODE_RING;
  ------------------
  |  | 2282|  1.11k|#define NEIGH_MODE_RING        1
  ------------------
 3627|  1.11k|        goto second_pass;
 3628|  1.11k|    }
 3629|       |
 3630|  2.18k|exit_function:
 3631|       |
 3632|  2.18k|    return RETURNED_ERROR( ret_failed ) ? ret_failed : ret_failed ? -( ret + 1 ) : ret;
  ------------------
  |  |   44|  2.18k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  2.18k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  2.18k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  2.18k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  2.18k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  2.18k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 2.18k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 2.18k]
  |  |  ------------------
  ------------------
  |  Branch (3632:56): [True: 78, False: 2.10k]
  ------------------
 3633|  3.29k|}
RemoveCalculatedNonStereo:
 3650|  2.01k|{
 3651|  2.01k|    NEIGH_LIST *nl = NULL, *nl1 = NULL, *nl2 = NULL;
 3652|  2.01k|    AT_RANK    *nVisited1 = NULL, *nVisited2 = NULL, *nAtomNumberCanon1 = NULL, *nAtomNumberCanon2 = NULL;
 3653|  2.01k|    int        nNumRemoved = 0, nTotRemoved = 0, ret = 0, ret1 = 0, ret2 = 0;
 3654|       |
 3655|  2.01k|    if (!AllocateForNonStereoRemoval( at, num_atoms, nSymmRank, nCanonRank,
  ------------------
  |  Branch (3655:9): [True: 0, False: 2.01k]
  ------------------
 3656|  2.01k|        &nAtomNumberCanon1, &nAtomNumberCanon2,
 3657|  2.01k|        &nl, &nl1, &nl2, &nVisited1, &nVisited2 ))
 3658|      0|    {
 3659|      0|        return CT_OUT_OF_RAM;  /*   <BRKPT> */
  ------------------
  |  |   21|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 3660|      0|    }
 3661|       |
 3662|  2.01k|    do
 3663|  2.18k|    {
 3664|  2.18k|        nNumRemoved = 0;
 3665|       |        /*  bonds */
 3666|  2.18k|        ret = RemoveCalculatedNonStereoBondParities( pCG, at, num_atoms, num_at_tg,
 3667|  2.18k|                                              pRankStack1, pRankStack2, nTempRank, NeighList,
 3668|  2.18k|                                              nCanonRank, nSymmRank,
 3669|  2.18k|                                              nAtomNumberCanon, nAtomNumberCanon1, nAtomNumberCanon2,
 3670|  2.18k|                                              nl, nl1, nl2, nVisited1, nVisited2, pCS,
 3671|  2.18k|                                              vABParityUnknown );
 3672|  2.18k|        if (RETURNED_ERROR( ret ))
  ------------------
  |  |   44|  2.18k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  2.18k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  2.18k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  2.18k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  2.18k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  2.18k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 2.18k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 2.18k]
  |  |  ------------------
  ------------------
 3673|      0|        {
 3674|      0|            goto exit_function;
 3675|      0|        }
 3676|  2.18k|        if (ret < 0)
  ------------------
  |  Branch (3676:13): [True: 0, False: 2.18k]
  ------------------
 3677|      0|        {
 3678|      0|            if (ret < ret1)
  ------------------
  |  Branch (3678:17): [True: 0, False: 0]
  ------------------
 3679|      0|            {  /*   <BRKPT> */
 3680|      0|                ret1 = ret;
 3681|      0|            }
 3682|      0|            ret = -( ret + 1 ); /*  number of removed */
 3683|      0|        }
 3684|  2.18k|        nNumRemoved += ret;
 3685|       |
 3686|       |        /*  centers */
 3687|  2.18k|        ret = RemoveCalculatedNonStereoCenterParities( pCG, at, num_atoms, num_at_tg,
 3688|  2.18k|                                              pRankStack1, pRankStack2, nTempRank, NeighList,
 3689|  2.18k|                                              nCanonRank, nSymmRank,
 3690|  2.18k|                                              nAtomNumberCanon, nAtomNumberCanon1, nAtomNumberCanon2,
 3691|  2.18k|                                              nl, nl1, nl2, nVisited1, nVisited2, pCS,
 3692|  2.18k|                                              vABParityUnknown );
 3693|  2.18k|        if (RETURNED_ERROR( ret ))
  ------------------
  |  |   44|  2.18k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  2.18k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  2.18k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  2.18k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  2.18k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  2.18k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 2.18k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 2.18k]
  |  |  ------------------
  ------------------
 3694|      0|        {
 3695|      0|            goto exit_function;
 3696|      0|        }
 3697|  2.18k|        if (ret < 0)
  ------------------
  |  Branch (3697:13): [True: 78, False: 2.10k]
  ------------------
 3698|     78|        {
 3699|     78|            if (ret < ret2)
  ------------------
  |  Branch (3699:17): [True: 78, False: 0]
  ------------------
 3700|     78|            {  /*   <BRKPT> */
 3701|     78|                ret2 = ret;
 3702|     78|            }
 3703|     78|            ret = -( ret + 1 ); /*  number of removed */
 3704|     78|        }
 3705|  2.18k|        nNumRemoved += ret;
 3706|       |
 3707|  2.18k|        nTotRemoved += nNumRemoved;
 3708|  2.18k|    }
 3709|  2.18k|    while (nNumRemoved);
  ------------------
  |  Branch (3709:12): [True: 171, False: 2.01k]
  ------------------
 3710|       |
 3711|  2.01k|    if (!RETURNED_ERROR( ret1 ) && !RETURNED_ERROR( ret2 ))
  ------------------
  |  |   44|  4.02k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  2.01k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  2.01k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  2.01k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  2.01k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  2.01k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 2.01k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 2.01k]
  |  |  ------------------
  ------------------
                  if (!RETURNED_ERROR( ret1 ) && !RETURNED_ERROR( ret2 ))
  ------------------
  |  |   44|  2.01k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  2.01k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  2.01k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  2.01k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  2.01k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  2.01k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 2.01k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 2.01k]
  |  |  ------------------
  ------------------
 3712|  2.01k|    {
 3713|  2.01k|        ret = inchi_min( ret1, ret2 );
  ------------------
  |  |  139|  2.01k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 2.01k]
  |  |  ------------------
  ------------------
 3714|  2.01k|        ret = ( ret >= 0 ) ? nTotRemoved : -( 1 + nTotRemoved );
  ------------------
  |  Branch (3714:15): [True: 1.93k, False: 78]
  ------------------
 3715|  2.01k|    }
 3716|       |
 3717|  2.01k|exit_function:
 3718|       |
 3719|  2.01k|    DeAllocateForNonStereoRemoval( &nAtomNumberCanon1, &nAtomNumberCanon2, &nl, &nl1, &nl2, &nVisited1, &nVisited2 );
 3720|       |
 3721|  2.01k|    return ret;
 3722|  2.01k|}

map_stereo_bonds4:
   69|  4.03k|{
   70|  4.03k|    int nTotSuccess = 0; /* 1=>full mapping has been completed;
   71|       |                          * 2=>obtained a better stereo;
   72|       |                          * 4=>restart (stereo bond or atom removed from the stereo CT)
   73|       |                          */
   74|  4.03k|    int tpos1 = 0;
   75|  4.03k|    AT_STEREO_DBLE prevBond;
   76|  4.03k|    memset( &prevBond, 0, sizeof( prevBond ) ); /* djb-rwth: memset_s C11/Annex K variant? */
   77|  4.03k|    tpos1 = CurTreeGetPos( cur_tree );
   78|       |
   79|  4.20k|total_restart:
   80|       |
   81|  4.20k|    if (!nNumMappedBonds)
  ------------------
  |  Branch (81:9): [True: 1.73k, False: 2.47k]
  ------------------
   82|  1.73k|    {
   83|       |
   84|  1.73k|        memset( pCS->bRankUsedForStereo, 0, sizeof( pCS->bRankUsedForStereo[0] )*num_atoms ); /* djb-rwth: memset_s C11/Annex K variant? */
   85|  1.73k|        SetUseAtomForStereo( pCS->bAtomUsedForStereo, at, num_atoms );
   86|       |
   87|  1.73k|        if (pCS->bFirstCT && nSymmStereo && !pCS->bKeepSymmRank)
  ------------------
  |  Branch (87:13): [True: 1.73k, False: 0]
  |  Branch (87:30): [True: 1.73k, False: 0]
  |  Branch (87:45): [True: 1.73k, False: 0]
  ------------------
   88|  1.73k|        {
   89|  1.73k|            int i;
   90|  12.1k|            for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (90:25): [True: 10.4k, False: 1.73k]
  ------------------
   91|  10.4k|            {
   92|       |                /*  nSymmStereo[i] = min. {k | at[k] stereo eq. to at[i]} */
   93|  10.4k|                nSymmStereo[i] = i; /*  for union-join to keep track of stereo-equivalent atoms */
   94|  10.4k|            }
   95|  1.73k|        }
   96|  1.73k|#ifdef FIX_STEREOCOUNT_ERR
   97|  1.73k|        if (pCS->bFirstCT)
  ------------------
  |  Branch (97:13): [True: 1.73k, False: 0]
  ------------------
   98|  1.73k|        {
   99|  1.73k|            CurTreeSetPos( cur_tree, tpos1 = 0 );
  100|  1.73k|        }
  101|  1.73k|#endif
  102|  1.73k|    }
  103|       |
  104|  4.20k|    if (nNumMappedBonds < pCS->nLenLinearCTStereoDble)
  ------------------
  |  Branch (104:9): [True: 2.36k, False: 1.84k]
  ------------------
  105|  2.36k|    {
  106|       |
  107|  2.36k|        int at_rank1, at_rank2, bStereoIsBetterWasSetHere;
  108|       |        /* AT_RANK *nRankFrom=*pRankStack1++,  AT_RANK *nAtomNumberFrom=pRankStack1++; */
  109|       |        /* AT_RANK *nRankTo  =*pRankStack2++,  AT_RANK *nAtomNumberTo  =pRankStack2++; */
  110|  2.36k|        AT_RANK canon_min1, canon_min2;
  111|  2.36k|        int bFirstCanonRank;
  112|  2.36k|        int i, j, j1, j2, at_from1, at_from2, at_to1, at_to2, iMax, c;
  113|  2.36k|        int nStackPtr[SB_DEPTH], nNumMappedRanks[SB_DEPTH], LastMappedTo1;
  114|  2.36k|        int istk, istk2, istk3, bAddStack, nNumAtTo1Success;
  115|  2.36k|        int ret1, ret2, parity1, parity2;
  116|       |
  117|  2.36k|        AT_RANK at_rank_canon1; /*  = pCS->LinearCTStereoDble[nNumMappedBonds].at_num1; */ /*  canonical numbers of atoms */
  118|  2.36k|        AT_RANK at_rank_canon2; /*  = pCS->LinearCTStereoDble[nNumMappedBonds].at_num2; */ /*  adjacent to the stereogenic bond */
  119|  2.36k|        int nNumChoices, nNumUnkn, nNumUndf, nNumBest, nNumWorse, nNumCalc, sb_parity_calc;
  120|  2.36k|        int stereo_bond_parity = 0, prev_stereo_bond_parity, pass, bAllParitiesIdentical, bAllParitiesIdentical2;
  121|  2.36k|        AT_STEREO_DBLE prevBond2;
  122|       |
  123|  2.36k|        prevBond = pCS->LinearCTStereoDble[nNumMappedBonds];
  124|  2.36k|        bFirstCanonRank = 1;
  125|  2.36k|        canon_min1 = canon_min2 = 0;
  126|       |        /*
  127|       |                // find candidates for atom_from1, atom_to1; they must have identical mapping ranks
  128|       |                at_rank1=pRankStack1[0][at_from1=nAtomNumberCanonFrom[(int)at_rank_canon1 - 1]]; // rank "from" for mapping
  129|       |                at_rank2=pRankStack1[0][at_from2=nAtomNumberCanonFrom[(int)at_rank_canon2 - 1]]; // rank "from" for mapping
  130|       |        */
  131|  2.36k|        if (nNumMappedBonds)
  ------------------
  |  Branch (131:13): [True: 1.97k, False: 386]
  ------------------
  132|  1.97k|        {
  133|  1.97k|            at_rank_canon1 = pCS->LinearCTStereoDble[nNumMappedBonds - 1].at_num1;
  134|  1.97k|            at_rank_canon2 = pCS->LinearCTStereoDble[nNumMappedBonds - 1].at_num2;
  135|  1.97k|        }
  136|    386|        else
  137|    386|        {
  138|    386|            at_rank_canon1 = 0;
  139|    386|            at_rank_canon2 = 0;
  140|    386|        }
  141|  2.36k|        goto bypass_next_canon_ranks_check;
  142|       |
  143|    212|    next_canon_ranks:
  144|       |
  145|       |            /*  Save time: avoid calling Next_SB_At_CanonRanks2() */
  146|    212|        if ((!pCS->bStereoIsBetter /* ??? && !pCS->bFirstCT ???*/ &&
  ------------------
  |  Branch (146:14): [True: 182, False: 30]
  ------------------
  147|    182|              at_rank_canon1 > pCS->LinearCTStereoDble[nNumMappedBonds].at_num1) ||
  ------------------
  |  Branch (147:15): [True: 0, False: 182]
  ------------------
  148|    212|              (at_rank_canon1 == pCS->LinearCTStereoDble[nNumMappedBonds].at_num1 &&
  ------------------
  |  Branch (148:16): [True: 208, False: 4]
  ------------------
  149|    208|              at_rank_canon2 >= pCS->LinearCTStereoDble[nNumMappedBonds].at_num2)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (149:15): [True: 208, False: 0]
  ------------------
  150|    208|        {
  151|       |
  152|    208|            if (!nTotSuccess)
  ------------------
  |  Branch (152:17): [True: 208, False: 0]
  ------------------
  153|    208|            {
  154|    208|                pCS->LinearCTStereoDble[nNumMappedBonds] = prevBond;
  155|    208|            }
  156|    208|            CurTreeSetPos( cur_tree, tpos1 );
  157|    208|            return nTotSuccess;
  158|    208|        }
  159|       |
  160|  2.36k|    bypass_next_canon_ranks_check:
  161|       |
  162|  2.36k|        CurTreeSetPos( cur_tree, tpos1 );
  163|       |
  164|       |        /*  find next available canon. numbers for a stereogenic bond pair of atoms */
  165|       |        /*  process allenes AFTER all double bonds and odd-number-of-double-bonds cumulenes */
  166|  2.36k|        if (!( ret1 = Next_SB_At_CanonRanks2( &at_rank_canon1, &at_rank_canon2, /*  canonical numbers */
  ------------------
  |  Branch (166:13): [True: 23, False: 2.34k]
  ------------------
  167|  2.36k|            &canon_min1, &canon_min2,
  168|  2.36k|            &bFirstCanonRank, pCS->bAtomUsedForStereo,
  169|  2.36k|            pRankStack1, pRankStack2,
  170|  2.36k|            nCanonRankFrom, nAtomNumberCanonFrom,
  171|  2.36k|            at, num_atoms, bAllene ) ))
  172|     23|        {
  173|       |            /* failed to find next stereo bond to assign parity */
  174|     23|            if (!bAllene && bFirstCanonRank)
  ------------------
  |  Branch (174:17): [True: 23, False: 0]
  |  Branch (174:29): [True: 23, False: 0]
  ------------------
  175|     23|            {
  176|       |                /* all stereobond have been processed; try to find allene to continue */
  177|     23|                AT_RANK at_rank_canon1_Allene = 0, canon_min1_Allene = 0;
  178|     23|                AT_RANK at_rank_canon2_Allene = 0, canon_min2_Allene = 0;
  179|     23|                if ((ret1 = Next_SB_At_CanonRanks2( &at_rank_canon1_Allene, &at_rank_canon2_Allene,
  ------------------
  |  Branch (179:21): [True: 12, False: 11]
  ------------------
  180|     23|                    &canon_min1_Allene, &canon_min2_Allene,
  181|     23|                    &bFirstCanonRank, pCS->bAtomUsedForStereo,
  182|     23|                    pRankStack1, pRankStack2,
  183|     23|                    nCanonRankFrom, nAtomNumberCanonFrom,
  184|     23|                    at, num_atoms, 1 ))) /* djb-rwth: addressing LLVM warning */
  185|     12|                {
  186|     12|                    at_rank_canon1 = at_rank_canon1_Allene;
  187|     12|                    at_rank_canon2 = at_rank_canon2_Allene;
  188|     12|                    canon_min1 = canon_min1_Allene;
  189|     12|                    canon_min2 = canon_min2_Allene;
  190|     12|                    bAllene = 1; /* switch to allenes */
  191|     12|                }
  192|     23|            }
  193|     23|        }
  194|       |
  195|  2.36k|        if (!ret1 || (!pCS->bStereoIsBetter &&
  ------------------
  |  Branch (195:13): [True: 11, False: 2.35k]
  |  Branch (195:23): [True: 1.82k, False: 524]
  ------------------
  196|  1.82k|            ( at_rank_canon1 > pCS->LinearCTStereoDble[nNumMappedBonds].at_num1 ||
  ------------------
  |  Branch (196:15): [True: 65, False: 1.76k]
  ------------------
  197|  1.76k|                (at_rank_canon1 == pCS->LinearCTStereoDble[nNumMappedBonds].at_num1 &&
  ------------------
  |  Branch (197:18): [True: 1.71k, False: 51]
  ------------------
  198|  1.71k|                at_rank_canon2 > pCS->LinearCTStereoDble[nNumMappedBonds].at_num2) ))) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (198:17): [True: 7, False: 1.70k]
  ------------------
  199|     83|        {
  200|       |            /* new ranks provide greater pCS->LinearCTStereoDble[nNumMappedBonds] and therefore rejected */
  201|     83|            if (!nTotSuccess)
  ------------------
  |  Branch (201:17): [True: 83, False: 0]
  ------------------
  202|     83|            {
  203|     83|                pCS->LinearCTStereoDble[nNumMappedBonds] = prevBond; /* restore stereo bond CT for the current bond */
  204|     83|            }
  205|     83|            return nTotSuccess;
  206|     83|        }
  207|       |
  208|       |        /* current stereo bond initialization */
  209|  2.28k|        nNumChoices = 0;
  210|  2.28k|        nNumUnkn = 0;
  211|  2.28k|        nNumUndf = 0;
  212|  2.28k|        nNumBest = 0;
  213|  2.28k|        nNumWorse = 0;
  214|  2.28k|        nNumCalc = 0;
  215|  2.28k|        pass = 0;
  216|  2.28k|        prev_stereo_bond_parity = 0;
  217|       |
  218|  2.28k|        at_rank1 = pRankStack1[0][at_from1 = nAtomNumberCanonFrom[(int) at_rank_canon1 - 1]]; /* atom 1 rank "from" for mapping */
  219|  2.28k|        at_rank2 = pRankStack1[0][at_from2 = nAtomNumberCanonFrom[(int) at_rank_canon2 - 1]]; /* atom 2 rank "from" for mapping */
  220|       |        /* we are going to map bond (at[at_from1], at[at_from2]) and
  221|       |           canonical ranks of its atoms (at_rank_canon1, at_rank_canon2)
  222|       |           onto a stereogenic bond (at[at_to1], at[at_to2])
  223|       |         */
  224|  2.28k|        iMax = at_rank1 - 1;
  225|       |        /*  test correctness: sorted pRankStack2[0][] and pRankStack1[0][] should have same ranks for both atoms */
  226|  2.28k|        if (at_rank1 != pRankStack2[0][pRankStack2[1][at_rank1 - 1]] ||
  ------------------
  |  Branch (226:13): [True: 0, False: 2.28k]
  ------------------
  227|  2.28k|             at_rank2 != pRankStack2[0][pRankStack2[1][at_rank2 - 1]])
  ------------------
  |  Branch (227:14): [True: 0, False: 2.28k]
  ------------------
  228|      0|        {
  229|       |            /* program error: "from" and "to" mapping ranks are not equal */
  230|      0|            return CT_STEREOCOUNT_ERR; /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  231|      0|        }
  232|       |        /* -- do not check stereo features of "from" atoms:
  233|       |           -- in case of "bond/charge isomerism" they may be missing.
  234|       |        if ( !at[at_from1].stereo_bond_neighbor[0] ||
  235|       |             !at[at_from2].stereo_bond_neighbor[0] )
  236|       |            return CT_STEREOCOUNT_ERR; // program error
  237|       |        */
  238|       |
  239|       |        /*  find out if we have a choice in mapping: check all possible pairs (at_to1, at_to2)
  240|       |            such that at_from1 is possibly constitutionally equivalent to at_to1, at_from2 to at_to2 */
  241|  5.89k|        for (j1 = 0; j1 <= iMax && at_rank1 == pRankStack2[0][at_to1 = pRankStack2[1][iMax - j1]]; j1++)
  ------------------
  |  Branch (241:22): [True: 5.73k, False: 152]
  |  Branch (241:36): [True: 3.61k, False: 2.12k]
  ------------------
  242|  3.61k|        {
  243|  3.61k|            if (!at[at_to1].stereo_bond_neighbor[0])
  ------------------
  |  Branch (243:17): [True: 86, False: 3.52k]
  ------------------
  244|     86|                continue; /*  at_to1 does not belong to a stereo bond */
  245|  9.82k|            for (j2 = 0; j2 < MAX_NUM_STEREO_BONDS &&
  ------------------
  |  |  873|  19.6k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (245:26): [True: 9.82k, False: 0]
  ------------------
  246|  9.82k|                ( at_to2 = at[at_to1].stereo_bond_neighbor[j2] ); j2++)
  ------------------
  |  Branch (246:17): [True: 6.29k, False: 3.52k]
  ------------------
  247|  6.29k|            {
  248|  6.29k|                at_to2--;
  249|  6.29k|                if (pRankStack1[0][at_from2] != pRankStack2[0][at_to2])
  ------------------
  |  Branch (249:21): [True: 1.86k, False: 4.43k]
  ------------------
  250|  1.86k|                    continue; /*  at_from2 cannot be mapped on at_to2 */
  251|  4.43k|                stereo_bond_parity = PARITY_VAL( at[at_to1].stereo_bond_parity[j2] );
  ------------------
  |  |  262|  4.43k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|  4.43k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
  252|  4.43k|                i = 0;
  253|  4.43k|                switch (stereo_bond_parity)
  ------------------
  |  Branch (253:25): [True: 4.43k, False: 0]
  ------------------
  254|  4.43k|                {
  255|       |
  256|  3.90k|                    case AB_PARITY_UNDF: nNumUndf++;
  ------------------
  |  |  222|  3.90k|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (256:21): [True: 3.90k, False: 534]
  ------------------
  257|  3.90k|                        break; /*  4 */
  258|      0|                    case AB_PARITY_UNKN: nNumUnkn++;
  ------------------
  |  |  221|      0|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
  |  Branch (258:21): [True: 0, False: 4.43k]
  ------------------
  259|      0|                        break; /*  3 (occurs if forced different to UNDF)*/
  260|       |
  261|    399|                    case BEST_PARITY:    nNumBest++; break; /*  1 */
  ------------------
  |  |  828|    399|#define BEST_PARITY        1  /* odd */
  ------------------
  |  Branch (261:21): [True: 399, False: 4.03k]
  ------------------
  262|    125|                    case WORSE_PARITY:   nNumWorse++; break; /*  2 */
  ------------------
  |  |  829|    125|#define WORSE_PARITY       2
  ------------------
  |  Branch (262:21): [True: 125, False: 4.30k]
  ------------------
  263|     10|                    case AB_PARITY_CALC: nNumCalc++; break; /*  6 */
  ------------------
  |  |  224|     10|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  ------------------
  |  Branch (263:21): [True: 10, False: 4.42k]
  ------------------
  264|      0|                    case AB_PARITY_NONE: i++;         break; /*  0 */
  ------------------
  |  |  218|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (264:21): [True: 0, False: 4.43k]
  ------------------
  265|  4.43k|                }
  266|  4.43k|                nNumChoices += !i;
  267|  4.43k|            }
  268|  3.52k|        }
  269|  2.28k|        if (nNumChoices != nNumCalc + nNumUndf + nNumUnkn + nNumBest + nNumWorse)
  ------------------
  |  Branch (269:13): [True: 0, False: 2.28k]
  ------------------
  270|      0|        {
  271|      0|            return CT_STEREOCOUNT_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  272|      0|        }
  273|  2.28k|        if (!nNumChoices)
  ------------------
  |  Branch (273:13): [True: 0, False: 2.28k]
  ------------------
  274|      0|        {
  275|      0|            goto next_canon_ranks;
  276|      0|        }
  277|       |        /*  Determine the first parity to search */
  278|  2.28k|        sb_parity_calc = ( nNumCalc > 0 ) ? BEST_PARITY : 0;
  ------------------
  |  |  828|      7|#define BEST_PARITY        1  /* odd */
  ------------------
  |  Branch (278:26): [True: 7, False: 2.27k]
  ------------------
  279|       |
  280|       |        /*  ==============================================================
  281|       |            Search sequence:           sb_parity_calc    stereo_bond_parity
  282|       |            ==============================================================
  283|       |            BEST_PARITY   (calc)       BEST_PARITY     BEST_PARITY
  284|       |            BEST_PARITY   (known)      BEST_PARITY     WORSE_PARITY  or 0
  285|       |            WORSE_PARITY  (calc)       WORSE_PARITY    WORSE_PARITY
  286|       |            WORSE_PARITY  (known)      WORSE_PARITY    0
  287|       |            AB_PARITY_UNKN(known)      AB_PARITY_UNKN  0
  288|       |            AB_PARITY_UNDF(known)      AB_PARITY_UNDF  0
  289|       |
  290|       |            if (sb_parity_calc==stereo_bond_parity) then "calc" else "known"
  291|       |         */
  292|       |
  293|  2.49k|    repeat_all:
  294|       |
  295|  2.49k|        if (!nNumMappedBonds)
  ------------------
  |  Branch (295:13): [True: 386, False: 2.10k]
  ------------------
  296|    386|            pCS->bStereoIsBetter = 0;  /*  the first stereo feature in the canonical CT; moved here 7-13-2002 */
  297|       |
  298|  2.49k|        if (!pass++)
  ------------------
  |  Branch (298:13): [True: 2.28k, False: 212]
  ------------------
  299|  2.28k|        {
  300|       |            /*  select the smallest (best) parity to search */
  301|  2.28k|            if (sb_parity_calc)
  ------------------
  |  Branch (301:17): [True: 7, False: 2.27k]
  ------------------
  302|      7|            {
  303|      7|                stereo_bond_parity = BEST_PARITY;
  ------------------
  |  |  828|      7|#define BEST_PARITY        1  /* odd */
  ------------------
  304|      7|            }
  305|  2.27k|            else
  306|  2.27k|            {
  307|  2.27k|                stereo_bond_parity = nNumBest ? BEST_PARITY :
  ------------------
  |  |  828|    248|#define BEST_PARITY        1  /* odd */
  ------------------
  |  Branch (307:38): [True: 248, False: 2.02k]
  ------------------
  308|  2.27k|                    nNumWorse ? WORSE_PARITY :
  ------------------
  |  |  829|     80|#define WORSE_PARITY       2
  ------------------
  |  Branch (308:21): [True: 80, False: 1.94k]
  ------------------
  309|  2.02k|                    nNumUnkn ? AB_PARITY_UNKN :
  ------------------
  |  |  221|      0|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
  |  Branch (309:21): [True: 0, False: 1.94k]
  ------------------
  310|  1.94k|                    nNumUndf ? AB_PARITY_UNDF : AB_PARITY_NONE;
  ------------------
  |  |  222|  1.94k|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
                                  nNumUndf ? AB_PARITY_UNDF : AB_PARITY_NONE;
  ------------------
  |  |  218|  2.27k|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (310:21): [True: 1.94k, False: 0]
  ------------------
  311|  2.27k|            }
  312|  2.28k|        }
  313|    212|        else
  314|    212|        {
  315|       |             /* second pass: since the first pass failed, search for a worse result */
  316|    212|            prev_stereo_bond_parity = stereo_bond_parity;
  317|    212|            i = NextStereoParity2Test( &stereo_bond_parity, &sb_parity_calc,
  318|    212|                                     nNumBest, nNumWorse, nNumUnkn, nNumUndf, nNumCalc, vABParityUnknown );
  319|    212|            switch (i)
  320|    212|            {
  321|      0|                case 0:
  ------------------
  |  Branch (321:17): [True: 0, False: 212]
  ------------------
  322|      0|                    break; /* obtained next parity to test */
  323|    212|                case 1:
  ------------------
  |  Branch (323:17): [True: 212, False: 0]
  ------------------
  324|    212|                    goto next_canon_ranks;
  325|      0|                default:
  ------------------
  |  Branch (325:17): [True: 0, False: 212]
  ------------------
  326|      0|                    return i; /* program error */
  327|    212|            }
  328|    212|        }
  329|  2.28k|        if (stereo_bond_parity == AB_PARITY_NONE)
  ------------------
  |  |  218|  2.28k|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (329:13): [True: 0, False: 2.28k]
  ------------------
  330|      0|        {
  331|       |            /*  error? */
  332|      0|            return CT_STEREOCOUNT_ERR;                   /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  333|      0|        }
  334|       |        /*  check if the new requested parity is good (small) enough */
  335|  2.28k|        if (!pCS->bStereoIsBetter)
  ------------------
  |  Branch (335:13): [True: 1.75k, False: 524]
  ------------------
  336|  1.75k|        {
  337|  1.75k|            c = CompareLinCtStereoDoubleToValues( nTotSuccess ? pCS->LinearCTStereoDble + nNumMappedBonds : &prevBond,
  ------------------
  |  Branch (337:51): [True: 0, False: 1.75k]
  ------------------
  338|  1.75k|                              at_rank_canon1, at_rank_canon2, (U_CHAR) stereo_bond_parity );
  339|  1.75k|            if (c < 0)
  ------------------
  |  Branch (339:17): [True: 43, False: 1.71k]
  ------------------
  340|     43|            {
  341|     43|                if (!nTotSuccess)
  ------------------
  |  Branch (341:21): [True: 43, False: 0]
  ------------------
  342|     43|                {
  343|     43|                    pCS->LinearCTStereoDble[nNumMappedBonds] = prevBond;
  344|     43|                }
  345|     43|                CurTreeSetPos( cur_tree, tpos1 );
  346|     43|                return nTotSuccess;
  347|     43|            }
  348|  1.75k|        }
  349|       |
  350|  2.23k|        bAllParitiesIdentical = 0;
  351|       |        /* djb-rwth: removing redundant code */
  352|  2.23k|        LastMappedTo1 = -1;
  353|  2.23k|        bStereoIsBetterWasSetHere = 0;
  354|       |        /* djb-rwth: removing redundant code */
  355|       |
  356|  2.23k|        if (!nNumMappedBonds && prev_stereo_bond_parity != stereo_bond_parity)
  ------------------
  |  Branch (356:13): [True: 386, False: 1.85k]
  |  Branch (356:33): [True: 386, False: 0]
  ------------------
  357|    386|            pCS->bStereoIsBetter = 0;  /*  the first stereo feature in the canonical CT; moved here 5-24-2002 */
  358|       |
  359|  2.23k|        if (prev_stereo_bond_parity != stereo_bond_parity)
  ------------------
  |  Branch (359:13): [True: 2.23k, False: 0]
  ------------------
  360|  2.23k|        {
  361|  2.23k|            CurTreeSetPos( cur_tree, tpos1 );  /*  start over */
  362|  2.23k|        }
  363|       |
  364|       |        /* Mapping: here at_rank1 = nRankTo, at_to1 = nAtomNumberTo */
  365|  3.21k|        for (j1 = 0; j1 <= iMax && at_rank1 == pRankStack2[0][at_to1 = pRankStack2[1][iMax - j1]]; j1++)
  ------------------
  |  Branch (365:22): [True: 3.11k, False: 93]
  |  Branch (365:36): [True: 2.99k, False: 125]
  ------------------
  366|  2.99k|        {
  367|  2.99k|            nNumAtTo1Success = 0;
  368|  2.99k|            if (!at[at_to1].stereo_bond_neighbor[0])
  ------------------
  |  Branch (368:17): [True: 86, False: 2.90k]
  ------------------
  369|     86|                continue; /*  at_to1 does not belong to a stereo bond */
  370|  2.90k|            if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (370:17): [True: 409, False: 2.49k]
  ------------------
  371|    409|                 1 == CurTreeIsLastRank( cur_tree, at_rank_canon1 ) &&
  ------------------
  |  Branch (371:18): [True: 409, False: 0]
  ------------------
  372|    409|                 1 == CurTreeIsLastAtomEqu( cur_tree, at_to1, nSymmStereo ))
  ------------------
  |  Branch (372:18): [True: 11, False: 398]
  ------------------
  373|     11|            {
  374|       |                /* at_to1 is known to be stereogenically equivalent to another atom tried with at_rank_canon1 */
  375|     11|                continue;
  376|     11|            }
  377|  2.89k|            bAllParitiesIdentical2 = 0;
  378|  4.73k|            for (j2 = 0; j2 < MAX_NUM_STEREO_BONDS && ( at_to2 = at[at_to1].stereo_bond_neighbor[j2] ); j2++)
  ------------------
  |  |  873|  9.47k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (378:26): [True: 4.73k, False: 0]
  |  Branch (378:55): [True: 4.05k, False: 682]
  ------------------
  379|  4.05k|            {
  380|  4.05k|                EQ_NEIGH  EN1[2], EN2[2];
  381|  4.05k|                int bond_parity, num1, num2;
  382|  4.05k|                AT_RANK at_rank_canon_n1, at_rank_canon_n2;
  383|       |
  384|  4.05k|                at_to2--;
  385|  4.05k|                if (pRankStack1[0][at_from2] != pRankStack2[0][at_to2])
  ------------------
  |  Branch (385:21): [True: 677, False: 3.37k]
  ------------------
  386|    677|                    continue; /*  at_from2 cannot be mapped on at_to2 even without mapping at_from1 to at_to1 */
  387|       |
  388|       |                /*  check whether the bond parity corresponds to the requested bond parity */
  389|  3.37k|                if (PARITY_KNOWN( at[at_to1].stereo_bond_parity[j2] ))
  ------------------
  |  |  265|  3.37k|#define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|  3.37k|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|  6.75k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  3.37k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|  3.37k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  3.37k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|  3.37k|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (265:38): [True: 3.37k, False: 0]
  |  |  |  Branch (265:78): [True: 3.37k, False: 7]
  |  |  ------------------
  ------------------
  390|  3.37k|                {
  391|  3.37k|                    if (stereo_bond_parity == sb_parity_calc)
  ------------------
  |  Branch (391:25): [True: 0, False: 3.37k]
  ------------------
  392|      0|                    {
  393|      0|                        continue;  /*  requested parity to be calculated, found known parity */
  394|      0|                    }
  395|  3.37k|                    if (stereo_bond_parity != PARITY_VAL( at[at_to1].stereo_bond_parity[j2] ))
  ------------------
  |  |  262|  3.37k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|  3.37k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
  |  Branch (395:25): [True: 902, False: 2.46k]
  ------------------
  396|    902|                    {
  397|    902|                        continue;  /*  parity differs from the requested parity */
  398|    902|                    }
  399|  3.37k|                }
  400|      7|                else
  401|      7|                    if (PARITY_CALCULATE( at[at_to1].stereo_bond_parity[j2] ))
  ------------------
  |  |  267|      7|#define PARITY_CALCULATE(X)         (AB_PARITY_CALC == PARITY_VAL(X))
  |  |  ------------------
  |  |  |  |  224|      7|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  |  |  ------------------
  |  |               #define PARITY_CALCULATE(X)         (AB_PARITY_CALC == PARITY_VAL(X))
  |  |  ------------------
  |  |  |  |  262|      7|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|      7|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (267:37): [True: 7, False: 0]
  |  |  ------------------
  ------------------
  402|      7|                    {
  403|      7|                        if (stereo_bond_parity != sb_parity_calc)
  ------------------
  |  Branch (403:29): [True: 0, False: 7]
  ------------------
  404|      0|                        {
  405|      0|                            continue;  /*  requested known parity, found parity to be calculated */
  406|      0|                        }
  407|      7|                    }
  408|      0|                    else
  409|      0|                    {
  410|      0|                        return CT_STEREOCOUNT_ERR;  /*  unknown parity type */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  411|      0|                    }
  412|       |                    /*  initialize stack pointer nStackPtr[istk] for "hand-made" recursion */
  413|       |                    /*  stacks are pRankStack1[], pRankStack2[], nNumMappedRanks[] */
  414|  2.47k|                istk = 0;
  415|  2.47k|                nStackPtr[0] = 0;
  416|  2.47k|                nNumMappedRanks[0] = nNumMappedRanksInput;
  417|  2.47k|                bAddStack = 0;
  418|  2.47k|                bAllParitiesIdentical = ( ( at[at_to1].stereo_bond_parity[j2] & KNOWN_PARITIES_EQL ) ) &&
  ------------------
  |  |  206|  2.47k|#define KNOWN_PARITIES_EQL 0x40  /* parity is same for all pairs of constit. equivalent atoms       */
  ------------------
  |  Branch (418:41): [True: 570, False: 1.90k]
  ------------------
  419|    570|                    PARITY_KNOWN( at[at_to1].stereo_bond_parity[j2] );
  ------------------
  |  |  265|  3.04k|#define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|    570|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|  1.14k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    570|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|    570|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|    570|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|    570|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (265:38): [True: 570, False: 0]
  |  |  |  Branch (265:78): [True: 570, False: 0]
  |  |  ------------------
  ------------------
  420|       |
  421|  2.47k|                if (!bAllParitiesIdentical && !nNumCalc &&
  ------------------
  |  Branch (421:21): [True: 1.90k, False: 570]
  |  Branch (421:47): [True: 1.89k, False: 7]
  ------------------
  422|  1.89k|                    ( !nNumUndf + !nNumUnkn + !nNumBest + !nNumWorse ) == 3)
  ------------------
  |  Branch (422:21): [True: 1.66k, False: 234]
  ------------------
  423|  1.66k|                {
  424|       |                    /* only one kind of bond parity is present; check whether all parities are really same */
  425|  1.66k|                    bAllParitiesIdentical = All_SB_Same( at_rank_canon1, at_rank_canon2, /*  canonical numbers */
  426|  1.66k|                                                          pRankStack1, pRankStack2,
  427|  1.66k|                                                          nAtomNumberCanonFrom, at );
  428|  1.66k|                    if (bAllParitiesIdentical < 0)
  ------------------
  |  Branch (428:25): [True: 0, False: 1.66k]
  ------------------
  429|      0|                    {
  430|      0|                        return CT_STEREOCOUNT_ERR;  /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  431|      0|                    }
  432|  1.66k|                }
  433|       |
  434|       |                /*****************************************************************
  435|       |                 * do the mapping only if parities are not same
  436|       |                 */
  437|  2.47k|                if (!bAllParitiesIdentical)
  ------------------
  |  Branch (437:21): [True: 462, False: 2.01k]
  ------------------
  438|    462|                {
  439|       |                    /*  map atom 1 or reuse previous mapping */
  440|    462|                    if (LastMappedTo1 != at_to1)
  ------------------
  |  Branch (440:25): [True: 462, False: 0]
  ------------------
  441|    462|                    {
  442|       |                        /*  avoid repetitve mapping to the same first at_to1 using LastMappedTo1 variable */
  443|       |                        /*  map atom 1 */
  444|    462|                        ret1 = map_an_atom2( pCG, num_at_tg, num_max, at_from1, at_to1,
  445|    462|                                            nTempRank, nNumMappedRanks[istk], &nNumMappedRanks[istk + 1], pCS,
  446|    462|                                            NeighList, pRankStack1 + nStackPtr[istk], pRankStack2 + nStackPtr[istk],
  447|    462|                                            &bAddStack );
  448|    462|                        if (RETURNED_ERROR( ret1 ))
  ------------------
  |  |   44|    462|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|    462|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|    462|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|    462|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|    462|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|    462|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 462, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 462]
  |  |  ------------------
  ------------------
  449|      0|                        {
  450|      0|                            return ret1; /*  error */
  451|      0|                        }
  452|    462|                        nStackPtr[istk + 1] = nStackPtr[istk] + bAddStack;
  453|    462|                        LastMappedTo1 = at_to1;
  454|    462|                        if (bAddStack)
  ------------------
  |  Branch (454:29): [True: 441, False: 21]
  ------------------
  455|    441|                        {
  456|    441|                            if (tpos1 == CurTreeGetPos( cur_tree ) ||
  ------------------
  |  Branch (456:33): [True: 225, False: 216]
  ------------------
  457|    216|                                 0 == CurTreeIsLastRank( cur_tree, at_rank_canon1 ))
  ------------------
  |  Branch (457:34): [True: 0, False: 216]
  ------------------
  458|    225|                            {
  459|    225|                                CurTreeAddRank( cur_tree, at_rank_canon1 );
  460|    225|                            }
  461|    441|                            CurTreeAddAtom( cur_tree, at_to1 );
  462|    441|                        }
  463|    462|                    }
  464|    462|                    istk++; /*  = 1 */
  465|       |                    /*  check if we can map atom 2 */
  466|    462|                    if (pRankStack1[nStackPtr[istk]][at_from2] != pRankStack2[nStackPtr[istk]][at_to2])
  ------------------
  |  Branch (466:25): [True: 0, False: 462]
  ------------------
  467|      0|                    {
  468|       |                        /*
  469|       |                         * This may happen when:
  470|       |                         * A) Charge/bond isomerism, for example cyclopentadiene(-), or
  471|       |                         * B) possibly stereogenic bond in an alternating ring has heighbors
  472|       |                         * in 2 symmetrically attached rings.
  473|       |                         * Such an alternating bond cannot be mapped on possibly stereogenic bond
  474|       |                         * that has neighbors belonging to 1 of the symmetrically attached rings only.
  475|       |                         * For example:
  476|       |                         *   A---B---C---D  If all atoms are Carbons then B, C, F, G are constitutionally
  477|       |                         *  ||  ||  ||  ||  equivalent. However, bonds B-C, F-G are not equivalent to
  478|       |                         *  ||  ||  ||  ||  B-F and C-G and cannot be mapped on them.
  479|       |                         *   E---F---G---H  If at_from1=B, at_from2=F, at_to1=B, then at_from2 cannot be mapped on at_to2=C
  480|       |                         *                  If at_from1=B, at_from2=F, at_to1=C, then at_from2 cannot be mapped on at_to2=B
  481|       |                         *                  etc.
  482|       |                         */
  483|      0|                        if (sb_parity_calc != stereo_bond_parity)
  ------------------
  |  Branch (483:29): [True: 0, False: 0]
  ------------------
  484|      0|                        {
  485|       |                            /* can be passed only once for each bond */
  486|      0|                            nNumChoices--;
  487|      0|                            nNumUndf -= ( stereo_bond_parity == AB_PARITY_UNDF );
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  488|      0|                            nNumUnkn -= ( stereo_bond_parity == AB_PARITY_UNKN );
  ------------------
  |  |  221|      0|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
  489|      0|                            nNumBest -= ( stereo_bond_parity == BEST_PARITY );
  ------------------
  |  |  828|      0|#define BEST_PARITY        1  /* odd */
  ------------------
  490|      0|                            nNumWorse -= ( stereo_bond_parity == WORSE_PARITY );
  ------------------
  |  |  829|      0|#define WORSE_PARITY       2
  ------------------
  491|       |                            /* nNumCalc  = nNumChoices - (nNumUndf + nNumUnkn + nNumBest + nNumWorse); */
  492|      0|                        }
  493|      0|                        else
  494|      0|                            if (sb_parity_calc == BEST_PARITY)
  ------------------
  |  |  828|      0|#define BEST_PARITY        1  /* odd */
  ------------------
  |  Branch (494:33): [True: 0, False: 0]
  ------------------
  495|      0|                            {
  496|       |                                /* can be passed 2 times: for BEST_PARITY and WORSE_PARITY in this order */
  497|      0|                                nNumChoices--; /*  do not repeate for WORSE_PARITY */
  498|      0|                                nNumCalc--;
  499|      0|                            }
  500|      0|                        continue;  /*  Happens for ID=80036,80253,91354,95532,101532,103788 */
  501|      0|                    }
  502|    462|                    if (nStackPtr[istk] > nStackPtr[istk - 1])
  ------------------
  |  Branch (502:25): [True: 441, False: 21]
  ------------------
  503|    441|                    {
  504|    441|                        bAllParitiesIdentical2 = All_SB_Same( at_rank_canon1, at_rank_canon2,
  505|    441|                                                  pRankStack1 + nStackPtr[istk], pRankStack2 + nStackPtr[istk],
  506|    441|                                                  nAtomNumberCanonFrom, at );
  507|    441|                        if (bAllParitiesIdentical2 < 0)
  ------------------
  |  Branch (507:29): [True: 0, False: 441]
  ------------------
  508|      0|                        {
  509|      0|                            return CT_STEREOBOND_ERROR;  /*   <BRKPT> */
  ------------------
  |  |   31|      0|#define CT_STEREOBOND_ERROR  (CT_ERR_FIRST-12)  /*(-30012) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  510|      0|                        }
  511|    441|                    }
  512|     21|                    else
  513|     21|                    {
  514|     21|                        bAllParitiesIdentical2 = 0;
  515|     21|                    }
  516|    462|                    if (bAllParitiesIdentical2)
  ------------------
  |  Branch (516:25): [True: 194, False: 268]
  ------------------
  517|    194|                    {
  518|       |                        /*  do no mapping when all equivalent bonds have same parity */
  519|       |                        /*  stereo_bond_parity = PARITY_VAL(at[at_to1].stereo_bond_parity[j2]); */
  520|    194|                        ClearPreviousMappings( pRankStack1 + nStackPtr[istk] + 2 );
  521|    194|                    }
  522|    268|                    else
  523|    268|                    {
  524|    268|                        if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (524:29): [True: 247, False: 21]
  ------------------
  525|    247|                             1 == CurTreeIsLastRank( cur_tree, at_rank_canon2 ) &&
  ------------------
  |  Branch (525:30): [True: 0, False: 247]
  ------------------
  526|      0|                             1 == CurTreeIsLastAtomEqu( cur_tree, at_to2, nSymmStereo ))
  ------------------
  |  Branch (526:30): [True: 0, False: 0]
  ------------------
  527|      0|                        {
  528|      0|                            continue;
  529|      0|                        }
  530|       |                        /*  map atom 2 */
  531|    268|                        ret2 = map_an_atom2( pCG, num_at_tg, num_max, at_from2, at_to2,
  532|    268|                                            nTempRank, nNumMappedRanks[istk], &nNumMappedRanks[istk + 1], pCS,
  533|    268|                                            NeighList, pRankStack1 + nStackPtr[istk], pRankStack2 + nStackPtr[istk],
  534|    268|                                            &bAddStack );
  535|    268|                        if (RETURNED_ERROR( ret2 ))
  ------------------
  |  |   44|    268|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|    268|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|    268|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|    268|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|    268|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|    268|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 268, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 268]
  |  |  ------------------
  ------------------
  536|      0|                        {
  537|      0|                            return ret2; /*  program error */
  538|      0|                        }
  539|    268|                        nStackPtr[istk + 1] = nStackPtr[istk] + bAddStack;
  540|    268|                        istk++; /*  = 2 */
  541|    268|                        if (bAddStack)
  ------------------
  |  Branch (541:29): [True: 261, False: 7]
  ------------------
  542|    261|                        {
  543|    261|                            if (tpos1 == CurTreeGetPos( cur_tree ) ||
  ------------------
  |  Branch (543:33): [True: 17, False: 244]
  ------------------
  544|    244|                                 0 == CurTreeIsLastRank( cur_tree, at_rank_canon2 ))
  ------------------
  |  Branch (544:34): [True: 244, False: 0]
  ------------------
  545|    261|                            {
  546|    261|                                CurTreeAddRank( cur_tree, at_rank_canon2 );
  547|    261|                            }
  548|    261|                            CurTreeAddAtom( cur_tree, at_to2 );
  549|    261|                        }
  550|    268|                    }
  551|    462|                }
  552|  2.01k|                else
  553|  2.01k|                {
  554|       |                    /*  do no mapping when all equivalent bonds have same parity */
  555|       |                    /*  stereo_bond_parity = PARITY_VAL(at[at_to1].stereo_bond_parity[j2]); */
  556|  2.01k|                    ClearPreviousMappings( pRankStack1 + 2 );
  557|  2.01k|                }
  558|       |
  559|       |                /*  we have a precalculated (known) bond parity */
  560|       |
  561|       |                /************************************************************
  562|       |                 *
  563|       |                 *   Known Bond Parity case: do not map stereo bond neighbors
  564|       |                 */
  565|  2.47k|                if (stereo_bond_parity != sb_parity_calc) /*  parity is known */
  ------------------
  |  Branch (565:21): [True: 2.46k, False: 7]
  ------------------
  566|  2.46k|                {
  567|       |                    /*  accept bond parity and do not map the neighbors */
  568|  2.46k|                    bond_parity = stereo_bond_parity;
  569|       |                    /*  same code as under " make a decision to accept current mapping" comment below */
  570|       |                    /*  with one exception: istk instead of istk3 */
  571|  2.46k|                    c = CompareLinCtStereoDoubleToValues( pCS->LinearCTStereoDble + nNumMappedBonds,
  572|  2.46k|                                              at_rank_canon1, at_rank_canon2, (U_CHAR) bond_parity );
  573|  2.46k|                    if (c < 0 && !pCS->bStereoIsBetter)
  ------------------
  |  Branch (573:25): [True: 142, False: 2.32k]
  |  Branch (573:34): [True: 0, False: 142]
  ------------------
  574|      0|                    {
  575|       |                        /*  reject */
  576|       |
  577|      0|                        pCS->lNumRejectedCT++;
  578|       |                        /*  remove failed atom2 from the tree */
  579|      0|                        if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (579:29): [True: 0, False: 0]
  ------------------
  580|      0|                             1 == CurTreeIsLastRank( cur_tree, at_rank_canon2 ))
  ------------------
  |  Branch (580:30): [True: 0, False: 0]
  ------------------
  581|      0|                        {
  582|      0|                            CurTreeRemoveIfLastAtom( cur_tree, at_to2 );
  583|      0|                            CurTreeRemoveLastRankIfNoAtoms( cur_tree );
  584|      0|                        }
  585|      0|                        continue;  /*  to next at_to2; Reject this at_to2: not a minimal CT. */
  586|      0|                    }
  587|  2.46k|                    else
  588|  2.46k|                    {
  589|       |                        /*  accept */
  590|       |
  591|  2.46k|                        if (c > 0 && !pCS->bStereoIsBetter)
  ------------------
  |  Branch (591:29): [True: 223, False: 2.24k]
  |  Branch (591:38): [True: 137, False: 86]
  ------------------
  592|    137|                        {
  593|       |                            /*  bond entry is less than the previusly found */
  594|    137|                            pCS->bStereoIsBetter = bStereoIsBetterWasSetHere = 1;
  595|    137|                            prevBond2 = pCS->LinearCTStereoDble[nNumMappedBonds];
  596|    137|                        }
  597|  2.46k|                        pCS->LinearCTStereoDble[nNumMappedBonds].at_num1 = at_rank_canon1;
  598|  2.46k|                        pCS->LinearCTStereoDble[nNumMappedBonds].at_num2 = at_rank_canon2;
  599|  2.46k|                        pCS->LinearCTStereoDble[nNumMappedBonds].parity = bond_parity;
  600|       |                        /*  recursive call */
  601|  2.46k|                        pCS->bRankUsedForStereo[at_from1] ++;
  602|  2.46k|                        pCS->bRankUsedForStereo[at_from2] ++;
  603|  2.46k|                        if (!bAllParitiesIdentical)
  ------------------
  |  Branch (603:29): [True: 455, False: 2.01k]
  ------------------
  604|    455|                        {
  605|    455|                            pCS->bAtomUsedForStereo[at_to1] --;
  606|    455|                            pCS->bAtomUsedForStereo[at_to2] --;
  607|    455|                        }
  608|  2.46k|                        ret2 = map_stereo_bonds4( ic, pCG, at, num_atoms, num_at_tg, num_max, bAllene, nCanonRankFrom, nAtomNumberCanonFrom, nCanonRankTo,
  609|  2.46k|                                                  nSymmRank, pRankStack1 + nStackPtr[istk], pRankStack2 + nStackPtr[istk],
  610|  2.46k|                                                  nTempRank, nNumMappedRanks[istk], nSymmStereo, NeighList,
  611|  2.46k|                                                  pCS, cur_tree, nNumMappedBonds + 1,
  612|  2.46k|                                                  vABParityUnknown );
  613|  2.46k|                        if (!bAllParitiesIdentical)
  ------------------
  |  Branch (613:29): [True: 455, False: 2.01k]
  ------------------
  614|    455|                        {
  615|    455|                            pCS->bAtomUsedForStereo[at_to1] ++;
  616|    455|                            pCS->bAtomUsedForStereo[at_to2] ++;
  617|    455|                        }
  618|  2.46k|                        pCS->bRankUsedForStereo[at_from1] --;
  619|  2.46k|                        pCS->bRankUsedForStereo[at_from2] --;
  620|  2.46k|                        if (ret2 == 4)
  ------------------
  |  Branch (620:29): [True: 7, False: 2.46k]
  ------------------
  621|      7|                        {
  622|      7|                            if (nNumMappedBonds)
  ------------------
  |  Branch (622:33): [True: 0, False: 7]
  ------------------
  623|      0|                            {
  624|      0|                                return ret2;
  625|      0|                            }
  626|      7|                            else
  627|      7|                            {
  628|      7|                                pCS->bFirstCT = 1;
  629|      7|                                goto total_restart;
  630|      7|                            }
  631|      7|                        }
  632|       |
  633|  2.46k|                        if (RETURNED_ERROR( ret2 ))
  ------------------
  |  |   44|  2.46k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  2.46k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  2.46k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  2.46k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  2.46k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  2.46k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 2.46k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 2.46k]
  |  |  ------------------
  ------------------
  634|      0|                        {
  635|      0|                            if (ret2 == CT_TIMEOUT_ERR)
  ------------------
  |  |   27|      0|#define CT_TIMEOUT_ERR       (CT_ERR_FIRST- 8)  /*(-30008) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (635:33): [True: 0, False: 0]
  ------------------
  636|      0|                                return ret2;
  637|      0|                            else
  638|      0|                                return ret2; /*  program error */
  639|      0|                        }
  640|  2.46k|                        if (ret2 > 0)
  ------------------
  |  Branch (640:29): [True: 2.12k, False: 334]
  ------------------
  641|  2.12k|                        {
  642|  2.12k|                            nTotSuccess |= 1;
  643|  2.12k|                            nNumAtTo1Success++;
  644|  2.12k|                            if (bStereoIsBetterWasSetHere || ( ret2 & 2 ))
  ------------------
  |  Branch (644:33): [True: 127, False: 2.00k]
  |  Branch (644:62): [True: 156, False: 1.84k]
  ------------------
  645|    283|                            {
  646|    283|                                CurTreeKeepLastAtomsOnly( cur_tree, tpos1, 1 );  /*  start over */
  647|    283|                                nTotSuccess |= 2; /*  Obtained a smaller CT */
  648|    283|                            }
  649|  2.12k|                        }
  650|    334|                        else
  651|    334|                        {
  652|    334|                            if (bStereoIsBetterWasSetHere)
  ------------------
  |  Branch (652:33): [True: 10, False: 324]
  ------------------
  653|     10|                            { /*  rollback */
  654|     10|                                pCS->bStereoIsBetter = 0;
  655|     10|                                pCS->LinearCTStereoDble[nNumMappedBonds] = prevBond2;
  656|     10|                            }
  657|       |                            /*  remove failed atom2 from the tree */
  658|    334|                            if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (658:33): [True: 155, False: 179]
  ------------------
  659|    155|                                 1 == CurTreeIsLastRank( cur_tree, at_rank_canon2 ))
  ------------------
  |  Branch (659:34): [True: 82, False: 73]
  ------------------
  660|     82|                            {
  661|     82|                                CurTreeRemoveIfLastAtom( cur_tree, at_to2 );
  662|     82|                                CurTreeRemoveLastRankIfNoAtoms( cur_tree );
  663|     82|                            }
  664|       |                            /*
  665|       |                            if ( 1 == CurTreeIsLastRank( cur_tree, at_rank_canon1 ) ) {
  666|       |                                CurTreeRemoveLastAtom( cur_tree, at_to1 );
  667|       |                                CurTreeRemoveLastRankIfNoAtoms( cur_tree );
  668|       |                            }
  669|       |                            */
  670|    334|                        }
  671|  2.46k|                        bStereoIsBetterWasSetHere = 0;
  672|  2.46k|                    }
  673|  2.46k|                    if (bAllParitiesIdentical || bAllParitiesIdentical2)
  ------------------
  |  Branch (673:25): [True: 2.00k, False: 455]
  |  Branch (673:50): [True: 194, False: 261]
  ------------------
  674|  2.20k|                    {
  675|  2.20k|                        break; /* j2 cycle, at_to2 (no need to repeat) */
  676|  2.20k|                    }
  677|    261|                    continue; /*  to next at_to2 */
  678|  2.46k|                }
  679|       |                /***************************************************************************
  680|       |                 *
  681|       |                 *   Unknown Bond Parity case: may need to map stereo bond neighbors
  682|       |                 *
  683|       |                 ****************************************************************************
  684|       |                 * Ranks are not known in advance
  685|       |                 * check if at_from1/at_to1 half-bond has neighbors with equal mapping ranks
  686|       |                 */
  687|       |
  688|      7|                parity1 = parity_of_mapped_half_bond( at_from1, at_to1, at_from2, at_to2, at, &EN1[0],
  689|      7|                           nCanonRankFrom, pRankStack1[nStackPtr[istk]], pRankStack2[nStackPtr[istk]] );
  690|       |                /* old approach -- before E/Z parities
  691|       |                parity1 = parity_of_mapped_atom2( pCG, at_from1, at_to1, at, &EN1[0],
  692|       |                               nCanonRankFrom, pRankStack1[nStackPtr[istk]], pRankStack2[nStackPtr[istk]] );
  693|       |                 */
  694|       |                /*  the following commented out statement is not needed here. */
  695|       |                /*  parity2 = parity_of_mapped_atom2( pCG, at_from2, at_to2, at, &EN2[0],
  696|       |                                                     nCanonRankFrom, pRankStack1[nStackPtr[istk]],
  697|       |                                                     pRankStack2[nStackPtr[istk]] );
  698|       |                 */
  699|      7|                if (!parity1)
  ------------------
  |  Branch (699:21): [True: 0, False: 7]
  ------------------
  700|      0|                {
  701|      0|                    return CT_STEREOCOUNT_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  702|      0|                }
  703|      7|                num1 = parity1 > 0 ? 1 : 2; /*  parity < 0 means additional mapping is needed to set parity */
  ------------------
  |  Branch (703:24): [True: 4, False: 3]
  ------------------
  704|       |
  705|       |                /*  --- try all possible mappings of the stereo bond ending atoms' neighbors --- */
  706|      7|                at_rank_canon_n1 = 0;
  707|       |                /* djb-rwth: removing redundant code */
  708|      7|                for (i = 0; i < num1; i++)
  ------------------
  |  Branch (708:29): [True: 7, False: 0]
  ------------------
  709|      7|                {
  710|      7|                    int at_from_n1, at_to_n1, at_no_n1_num_success = 0;
  711|      7|                    istk2 = istk;
  712|      7|                    if (num1 == 2)
  ------------------
  |  Branch (712:25): [True: 3, False: 4]
  ------------------
  713|      3|                    {
  714|      3|                        at_rank_canon_n1 = nCanonRankFrom[EN1[0].from_at];
  715|       |                        /*  an additional neighbor mapping is necessary; */
  716|       |                        /*  we need to map only one at_from1 neighbor to make all neighbors have different ranks */
  717|       |
  718|      3|                        at_from_n1 = EN1[0].from_at;
  719|      3|                        at_to_n1 = EN1[0].to_at[i];
  720|       |
  721|      3|                        if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (721:29): [True: 3, False: 0]
  ------------------
  722|      3|                             1 == CurTreeIsLastRank( cur_tree, at_rank_canon_n1 ) &&
  ------------------
  |  Branch (722:30): [True: 0, False: 3]
  ------------------
  723|      0|                             1 == CurTreeIsLastAtomEqu( cur_tree, at_to_n1, nSymmStereo ))
  ------------------
  |  Branch (723:30): [True: 0, False: 0]
  ------------------
  724|      0|                            continue;
  725|       |                        /*
  726|       |                        if ( nSymmStereo && !pCS->bFirstCT ) {
  727|       |                            if ( i && nSymmStereo[at_to_n1] == nSymmStereo[(int)EN1[0].to_at[0]] ) {
  728|       |                                continue; // do not test stereo equivalent atoms except the first one
  729|       |                            }
  730|       |                        }
  731|       |                        */
  732|       |                        /*  neighbors are tied. Untie them by breaking a tie on ONE of them. */
  733|      3|                        ret1 = map_an_atom2( pCG, num_at_tg, num_max, at_from_n1, at_to_n1,
  734|      3|                                            nTempRank, nNumMappedRanks[istk2], &nNumMappedRanks[istk2 + 1], pCS,
  735|      3|                                            NeighList, pRankStack1 + nStackPtr[istk2], pRankStack2 + nStackPtr[istk2],
  736|      3|                                            &bAddStack );
  737|      3|                        if (RETURNED_ERROR( ret1 ))
  ------------------
  |  |   44|      3|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|      3|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      3|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|      3|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|      3|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|      3|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 3, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 3]
  |  |  ------------------
  ------------------
  738|      0|                        {
  739|      0|                            return ret1; /*  program error */ /*   <BRKPT> */
  740|      0|                        }
  741|      3|                        nStackPtr[istk2 + 1] = nStackPtr[istk2] + bAddStack;
  742|      3|                        istk2++;  /*  <= 3 */
  743|       |                        /*  debug */
  744|      3|                        if (istk2 >= SB_DEPTH)
  ------------------
  |  |   13|      3|#define SB_DEPTH 6
  ------------------
  |  Branch (744:29): [True: 0, False: 3]
  ------------------
  745|      0|                        {
  746|      0|                            return CT_OVERFLOW; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   19|      0|#define CT_OVERFLOW          (CT_ERR_FIRST- 0)  /*(-30000) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  747|      0|                        }
  748|      3|                        if (bAddStack)
  ------------------
  |  Branch (748:29): [True: 3, False: 0]
  ------------------
  749|      3|                        {
  750|      3|                            if (tpos1 == CurTreeGetPos( cur_tree ) ||
  ------------------
  |  Branch (750:33): [True: 0, False: 3]
  ------------------
  751|      3|                                 0 == CurTreeIsLastRank( cur_tree, at_rank_canon_n1 ))
  ------------------
  |  Branch (751:34): [True: 3, False: 0]
  ------------------
  752|      3|                            {
  753|      3|                                CurTreeAddRank( cur_tree, at_rank_canon_n1 );
  754|      3|                            }
  755|      3|                            CurTreeAddAtom( cur_tree, at_to_n1 );
  756|      3|                        }
  757|       |
  758|       |
  759|       |                        /*  now that all at_from1 neighbors have been mapped the parity must be defined */
  760|      3|                        parity1 = parity_of_mapped_half_bond( at_from1, at_to1, at_from2, at_to2, at, &EN1[1],
  761|      3|                           nCanonRankFrom, pRankStack1[nStackPtr[istk2]], pRankStack2[nStackPtr[istk2]] );
  762|      3|                        if (parity1 <= 0)
  ------------------
  |  Branch (762:29): [True: 0, False: 3]
  ------------------
  763|      0|                            return CT_STEREOCOUNT_ERR;  /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  764|      3|                    }
  765|      4|                    else
  766|      4|                    {
  767|      4|                        nNumMappedRanks[istk2 + 1] = nNumMappedRanks[istk2];
  768|      4|                        nStackPtr[istk2 + 1] = nStackPtr[istk2];
  769|      4|                        istk2++;  /*  <= 3 */
  770|      4|                    }
  771|       |
  772|       |                    /*  check if at_from2/at_to2 half-bond has neighbors with equal mapping ranks */
  773|      7|                    parity2 = parity_of_mapped_half_bond( at_from2, at_to2, at_from1, at_to1, at, &EN2[0],
  774|      7|                           nCanonRankFrom, pRankStack1[nStackPtr[istk2]], pRankStack2[nStackPtr[istk2]] );
  775|      7|                    if (!parity2)
  ------------------
  |  Branch (775:25): [True: 0, False: 7]
  ------------------
  776|      0|                    {
  777|      0|                        return CT_STEREOCOUNT_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  778|      0|                    }
  779|      7|                    num2 = parity2 > 0 ? 1 : 2;
  ------------------
  |  Branch (779:28): [True: 0, False: 7]
  ------------------
  780|      7|                    at_rank_canon_n2 = 0;
  781|     10|                    for (j = 0; j < num2; j++)
  ------------------
  |  Branch (781:33): [True: 10, False: 0]
  ------------------
  782|     10|                    {
  783|     10|                        int at_from_n2, at_to_n2 = 0;
  784|     10|                        istk3 = istk2;
  785|     10|                        if (num2 == 2)
  ------------------
  |  Branch (785:29): [True: 10, False: 0]
  ------------------
  786|     10|                        {
  787|     10|                            at_rank_canon_n2 = nCanonRankFrom[EN2[0].from_at];
  788|       |                            /*  we need to map only one at_from2 neighbor to make its neighbors have different ranks */
  789|     10|                            at_from_n2 = EN2[0].from_at;
  790|     10|                            at_to_n2 = EN2[0].to_at[j];
  791|       |
  792|     10|                            if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (792:33): [True: 5, False: 5]
  ------------------
  793|      5|                                 1 == CurTreeIsLastRank( cur_tree, at_rank_canon_n2 ) &&
  ------------------
  |  Branch (793:34): [True: 0, False: 5]
  ------------------
  794|      0|                                 1 == CurTreeIsLastAtomEqu( cur_tree, at_to_n2, nSymmStereo ))
  ------------------
  |  Branch (794:34): [True: 0, False: 0]
  ------------------
  795|      0|                                continue;
  796|       |
  797|       |                            /*
  798|       |                            if ( nSymmStereo && !pCS->bFirstCT ) {
  799|       |                                if ( j && nSymmStereo[at_to_n2] == nSymmStereo[(int)EN2[0].to_at[0]] ) {
  800|       |                                    continue; // do not test stereo equivalent atoms except the first one
  801|       |                                }
  802|       |                            }
  803|       |                            */
  804|       |                            /*  neighbors are tied. Untie them by breaking a tie on ONE of them. */
  805|     10|                            ret1 = map_an_atom2( pCG, num_at_tg, num_max, at_from_n2, at_to_n2,
  806|     10|                                                nTempRank, nNumMappedRanks[istk3], &nNumMappedRanks[istk3 + 1], pCS,
  807|     10|                                                NeighList, pRankStack1 + nStackPtr[istk3],
  808|     10|                                                pRankStack2 + nStackPtr[istk3],
  809|     10|                                                &bAddStack );
  810|     10|                            if (RETURNED_ERROR( ret1 ))
  ------------------
  |  |   44|     10|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|     10|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|     10|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|     10|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|     10|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|     10|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 10, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 10]
  |  |  ------------------
  ------------------
  811|      0|                            {
  812|      0|                                return ret1; /*  program error */
  813|      0|                            }
  814|     10|                            nStackPtr[istk3 + 1] = nStackPtr[istk3] + bAddStack;
  815|     10|                            istk3++;  /*  <= 4 */
  816|       |
  817|     10|                            if (bAddStack)
  ------------------
  |  Branch (817:33): [True: 10, False: 0]
  ------------------
  818|     10|                            {
  819|     10|                                if (tpos1 == CurTreeGetPos( cur_tree ) ||
  ------------------
  |  Branch (819:37): [True: 5, False: 5]
  ------------------
  820|      5|                                     0 == CurTreeIsLastRank( cur_tree, at_rank_canon_n2 ))
  ------------------
  |  Branch (820:38): [True: 5, False: 0]
  ------------------
  821|     10|                                {
  822|     10|                                    CurTreeAddRank( cur_tree, at_rank_canon_n2 );
  823|     10|                                }
  824|     10|                                CurTreeAddAtom( cur_tree, at_to_n2 );
  825|     10|                            }
  826|       |
  827|     10|                            parity2 = parity_of_mapped_half_bond( at_from2, at_to2, at_from1, at_to1, at, &EN2[1],
  828|     10|                                     nCanonRankFrom, pRankStack1[nStackPtr[istk3]], pRankStack2[nStackPtr[istk3]] );
  829|     10|                            if (parity2 <= 0)
  ------------------
  |  Branch (829:33): [True: 0, False: 10]
  ------------------
  830|      0|                            {
  831|      0|                                return CT_STEREOCOUNT_ERR;  /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  832|      0|                            }
  833|     10|                        }
  834|      0|                        else
  835|      0|                        {
  836|       |                                             /*  no additional mapping is needed to set atom's parity */
  837|      0|                            nNumMappedRanks[istk3 + 1] = nNumMappedRanks[istk3];
  838|      0|                            nStackPtr[istk3 + 1] = nStackPtr[istk3];
  839|      0|                            istk3++;  /*  <= 4 */
  840|      0|                        }
  841|       |
  842|       |                        /*******************************************************************
  843|       |                         * at this point the stereo bond is fully mapped to find its parity
  844|       |                         *******************************************************************/
  845|       |
  846|     10|                        if (parity1 <= 0 || parity2 <= 0)
  ------------------
  |  Branch (846:29): [True: 0, False: 10]
  |  Branch (846:45): [True: 0, False: 10]
  ------------------
  847|      0|                        {
  848|      0|                            return CT_STEREOCOUNT_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  849|      0|                        }
  850|       |
  851|       |                        /*  find current bond parity  AB_PARITY_ODD */
  852|     10|                        if (ATOM_PARITY_WELL_DEF( parity1 ) && ATOM_PARITY_WELL_DEF( parity2 ))
  ------------------
  |  |  259|     20|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|     10|#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)
  |  |  ------------------
  |  |  |  |  236|     10|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 10, False: 0]
  |  |  |  Branch (259:75): [True: 10, False: 0]
  |  |  ------------------
  ------------------
                                      if (ATOM_PARITY_WELL_DEF( parity1 ) && ATOM_PARITY_WELL_DEF( parity2 ))
  ------------------
  |  |  259|     10|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|     10|#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)
  |  |  ------------------
  |  |  |  |  236|     10|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 10, False: 0]
  |  |  |  Branch (259:75): [True: 10, False: 0]
  |  |  ------------------
  ------------------
  853|     10|                        {
  854|     10|                            bond_parity = 2 - ( parity1 + parity2 ) % 2;
  855|     10|                        }
  856|      0|                        else
  857|      0|                        {
  858|      0|                            bond_parity = inchi_max( parity1, parity2 );
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  859|      0|                        }
  860|     10|                        if (ATOM_PARITY_WELL_DEF( bond_parity ) && at[at_to1].stereo_bond_z_prod[j2] < 0)
  ------------------
  |  |  259|     20|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|     10|#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)
  |  |  ------------------
  |  |  |  |  236|     10|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 10, False: 0]
  |  |  |  Branch (259:75): [True: 10, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (860:68): [True: 0, False: 10]
  ------------------
  861|      0|                            bond_parity = 2 - ( bond_parity + 1 ) % 2; /*  invert the bond parity */
  862|       |
  863|       |
  864|       |                        /********************************************************
  865|       |                         * make a decision whether to accept the current mapping
  866|       |                         */
  867|     10|                        c = CompareLinCtStereoDoubleToValues( pCS->LinearCTStereoDble + nNumMappedBonds,
  868|     10|                                                  at_rank_canon1, at_rank_canon2, (U_CHAR) bond_parity );
  869|     10|                        if (sb_parity_calc != bond_parity ||
  ------------------
  |  Branch (869:29): [True: 3, False: 7]
  ------------------
  870|      7|                             (c < 0 && !pCS->bStereoIsBetter)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (870:31): [True: 0, False: 7]
  |  Branch (870:40): [True: 0, False: 0]
  ------------------
  871|      3|                        {
  872|       |                            /*  reject */
  873|      3|                            pCS->lNumRejectedCT++;
  874|       |                            /*  remove failed atom2 from the tree */
  875|      3|                            if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (875:33): [True: 3, False: 0]
  ------------------
  876|      3|                                 1 == CurTreeIsLastRank( cur_tree, at_rank_canon_n2 ))
  ------------------
  |  Branch (876:34): [True: 3, False: 0]
  ------------------
  877|      3|                            {
  878|      3|                                CurTreeRemoveIfLastAtom( cur_tree, at_to_n2 );
  879|      3|                                CurTreeRemoveLastRankIfNoAtoms( cur_tree );
  880|      3|                            }
  881|      3|                            continue;  /*  Reject: not a minimal CT. */
  882|      3|                        }
  883|      7|                        else
  884|      7|                        {
  885|       |
  886|       |                                            /*  try to accept */
  887|       |
  888|      7|                            if (c > 0 && !pCS->bStereoIsBetter)
  ------------------
  |  Branch (888:33): [True: 3, False: 4]
  |  Branch (888:42): [True: 3, False: 0]
  ------------------
  889|      3|                            {
  890|       |                                /*  bond_parity is less than the previusly found */
  891|      3|                                pCS->bStereoIsBetter = bStereoIsBetterWasSetHere = 1;
  892|      3|                                prevBond2 = pCS->LinearCTStereoDble[nNumMappedBonds];
  893|      3|                            }
  894|       |                            /*  accept */
  895|      7|                            pCS->LinearCTStereoDble[nNumMappedBonds].at_num1 = at_rank_canon1;
  896|      7|                            pCS->LinearCTStereoDble[nNumMappedBonds].at_num2 = at_rank_canon2;
  897|      7|                            pCS->LinearCTStereoDble[nNumMappedBonds].parity = bond_parity;
  898|       |                            /*  recursive call */
  899|      7|                            pCS->bRankUsedForStereo[at_from1] ++;
  900|      7|                            pCS->bRankUsedForStereo[at_from2] ++;
  901|      7|                            pCS->bAtomUsedForStereo[at_to1] --;
  902|      7|                            pCS->bAtomUsedForStereo[at_to2] --;
  903|      7|                            ret2 = map_stereo_bonds4( ic, pCG, at, num_atoms, num_at_tg, num_max, bAllene, nCanonRankFrom, nAtomNumberCanonFrom, nCanonRankTo,
  904|      7|                                                      nSymmRank, pRankStack1 + nStackPtr[istk3], pRankStack2 + nStackPtr[istk3],
  905|      7|                                                      nTempRank, nNumMappedRanks[istk3], nSymmStereo, NeighList,
  906|      7|                                                      pCS, cur_tree, nNumMappedBonds + 1,
  907|      7|                                                      vABParityUnknown );
  908|      7|                            pCS->bRankUsedForStereo[at_from1] --;
  909|      7|                            pCS->bRankUsedForStereo[at_from2] --;
  910|      7|                            pCS->bAtomUsedForStereo[at_to1] ++;
  911|      7|                            pCS->bAtomUsedForStereo[at_to2] ++;
  912|      7|                            if (ret2 == 4)
  ------------------
  |  Branch (912:33): [True: 7, False: 0]
  ------------------
  913|      7|                            {
  914|      7|                                if (nNumMappedBonds)
  ------------------
  |  Branch (914:37): [True: 0, False: 7]
  ------------------
  915|      0|                                {
  916|      0|                                    return ret2;
  917|      0|                                }
  918|      7|                                else
  919|      7|                                {
  920|      7|                                    pCS->bFirstCT = 1;
  921|      7|                                    goto total_restart;
  922|      7|                                }
  923|      7|                            }
  924|      0|                            if (RETURNED_ERROR( ret2 ))
  ------------------
  |  |   44|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 0, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  925|      0|                            {
  926|      0|                                return ret2; /*  program error */ /* djb-rwth: fixing coverity ID #499569 */
  927|      0|                            }
  928|      0|                            if (ret2 > 0)
  ------------------
  |  Branch (928:33): [True: 0, False: 0]
  ------------------
  929|      0|                            {
  930|      0|                                nTotSuccess |= 1;
  931|      0|                                nNumAtTo1Success++;
  932|      0|                                if (bStereoIsBetterWasSetHere || ( ret2 & 2 ))
  ------------------
  |  Branch (932:37): [True: 0, False: 0]
  |  Branch (932:66): [True: 0, False: 0]
  ------------------
  933|      0|                                {
  934|      0|                                    CurTreeKeepLastAtomsOnly( cur_tree, tpos1, 1 );  /*  start over */
  935|      0|                                    nTotSuccess |= 2; /*  Obtained a smaller CT */
  936|      0|                                }
  937|      0|                                at_no_n1_num_success++;
  938|      0|                            }
  939|      0|                            else
  940|      0|                            {
  941|      0|                                if (bStereoIsBetterWasSetHere)
  ------------------
  |  Branch (941:37): [True: 0, False: 0]
  ------------------
  942|      0|                                {  /*  rollback */
  943|      0|                                    pCS->bStereoIsBetter = 0;
  944|      0|                                    pCS->LinearCTStereoDble[nNumMappedBonds] = prevBond2;
  945|      0|                                }
  946|      0|                                if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (946:37): [True: 0, False: 0]
  ------------------
  947|      0|                                     1 == CurTreeIsLastRank( cur_tree, at_rank_canon_n2 ))
  ------------------
  |  Branch (947:38): [True: 0, False: 0]
  ------------------
  948|      0|                                {
  949|      0|                                    CurTreeRemoveIfLastAtom( cur_tree, at_to_n2 );
  950|      0|                                    CurTreeRemoveLastRankIfNoAtoms( cur_tree );
  951|      0|                                }
  952|      0|                            }
  953|      0|                            bStereoIsBetterWasSetHere = 0;
  954|      0|                        }
  955|     10|                    } /*  end choices in mapping neighbors of the 2nd half-bond */
  956|      0|                    if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (956:25): [True: 0, False: 0]
  ------------------
  957|      0|                         1 == CurTreeIsLastRank( cur_tree, at_rank_canon_n2 ))
  ------------------
  |  Branch (957:26): [True: 0, False: 0]
  ------------------
  958|      0|                    {
  959|      0|                        CurTreeRemoveLastRank( cur_tree );
  960|      0|                    }
  961|       |                    /* added 2006-07-20 */
  962|      0|                    if (!at_no_n1_num_success && tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (962:25): [True: 0, False: 0]
  |  Branch (962:50): [True: 0, False: 0]
  ------------------
  963|      0|                        1 == CurTreeIsLastRank( cur_tree, at_rank_canon_n1 ))
  ------------------
  |  Branch (963:25): [True: 0, False: 0]
  ------------------
  964|      0|                    {
  965|      0|                        CurTreeRemoveIfLastAtom( cur_tree, at_to_n1 );
  966|      0|                    }
  967|      0|                } /*  end choices in mapping neighbors of the 1st half-bond */
  968|      0|                if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (968:21): [True: 0, False: 0]
  ------------------
  969|      0|                      1 == CurTreeIsLastRank( cur_tree, at_rank_canon_n1 ))
  ------------------
  |  Branch (969:23): [True: 0, False: 0]
  ------------------
  970|      0|                {
  971|      0|                    CurTreeRemoveLastRank( cur_tree );
  972|      0|                }
  973|      0|            } /*  end of choices in mapping at_from2 */
  974|  2.88k|            if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (974:17): [True: 637, False: 2.24k]
  ------------------
  975|    637|                 1 == CurTreeIsLastRank( cur_tree, at_rank_canon2 ))
  ------------------
  |  Branch (975:18): [True: 179, False: 458]
  ------------------
  976|    179|            {
  977|    179|                CurTreeRemoveLastRank( cur_tree );
  978|    179|            }
  979|  2.88k|            if (!nNumAtTo1Success)
  ------------------
  |  Branch (979:17): [True: 755, False: 2.12k]
  ------------------
  980|    755|            {
  981|    755|                if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (981:21): [True: 337, False: 418]
  ------------------
  982|    337|                     1 == CurTreeIsLastRank( cur_tree, at_rank_canon1 ))
  ------------------
  |  Branch (982:22): [True: 337, False: 0]
  ------------------
  983|    337|                {
  984|    337|                    CurTreeRemoveIfLastAtom( cur_tree, at_to1 );
  985|    337|                    CurTreeRemoveLastRankIfNoAtoms( cur_tree );
  986|    337|                }
  987|    755|            }
  988|  2.88k|            if (bAllParitiesIdentical /*&& !nSymmStereo*/)
  ------------------
  |  Branch (988:17): [True: 2.00k, False: 876]
  ------------------
  989|  2.00k|            {
  990|  2.00k|                break;
  991|  2.00k|            }
  992|  2.88k|        } /*  end of choices in mapping at_from1 */
  993|       |
  994|  2.22k|        if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (994:13): [True: 168, False: 2.05k]
  ------------------
  995|    168|             1 == CurTreeIsLastRank( cur_tree, at_rank_canon1 ))
  ------------------
  |  Branch (995:14): [True: 168, False: 0]
  ------------------
  996|    168|        {
  997|    168|            CurTreeRemoveLastRank( cur_tree );
  998|    168|        }
  999|  2.05k|        else
 1000|  2.05k|        {
 1001|       |            /*  CurTree consistecy check (debug only) */
 1002|  2.05k|            if (tpos1 != CurTreeGetPos( cur_tree ))
  ------------------
  |  Branch (1002:17): [True: 0, False: 2.05k]
  ------------------
 1003|      0|            {
 1004|      0|                return CT_STEREOCOUNT_ERR;  /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1005|      0|            }
 1006|  2.05k|        }
 1007|       |
 1008|  2.22k|        if (!nTotSuccess || stereo_bond_parity == sb_parity_calc)
  ------------------
  |  Branch (1008:13): [True: 212, False: 2.01k]
  |  Branch (1008:29): [True: 0, False: 2.01k]
  ------------------
 1009|    212|        {
 1010|    212|            goto repeat_all; /*  repeat with next parity if no success or with the same parity, now known */
 1011|    212|        }
 1012|       |
 1013|       |        /*  Previously the control flow never came here... */
 1014|  2.01k|        if (!nTotSuccess)
  ------------------
  |  Branch (1014:13): [True: 0, False: 2.01k]
  ------------------
 1015|      0|        {
 1016|      0|            pCS->LinearCTStereoDble[nNumMappedBonds] = prevBond;
 1017|      0|            CurTreeSetPos( cur_tree, tpos1 );
 1018|       |            /*  Occurs when atoms are not really equvalent ( -O= without positive charge in "aromatic" ring) */
 1019|      0|            return 0; /* Happens for ID=92439,100318,100319 when EXCL_ALL_AROM_BOND_PARITY=0 and
 1020|       |                       * nNumChoices=0.
 1021|       |                       * Results from impossible previous mapping of symmetric relatively
 1022|       |                       * to a central ring aromatic circles while central ring is not symmetrical due to
 1023|       |                       * alternate bonds (in the central ring number of pi-electrons, atoms and bonds
 1024|       |                       * are symmetrical).
 1025|       |                       * Does not happen when alternate bonds of the central ring
 1026|       |                       * are treated as aromatic by attaching a (+) charge to the oxygen.
 1027|       |                       */
 1028|      0|        }
 1029|  2.01k|    }
 1030|  1.84k|    else
 1031|  1.84k|    {
 1032|  1.84k|        int ret;
 1033|       |
 1034|  1.84k|        if (!nNumMappedBonds)
  ------------------
  |  Branch (1034:13): [True: 1.34k, False: 501]
  ------------------
 1035|  1.34k|        {
 1036|  1.34k|            pCS->bStereoIsBetter = 0;  /*  the first stereo feature in the canonical CT has not been processed yet */
 1037|  1.34k|        }
 1038|       |
 1039|  1.84k|        if (nNumMappedBonds < pCS->nLenLinearCTStereoDble)
  ------------------
  |  Branch (1039:13): [True: 0, False: 1.84k]
  ------------------
 1040|      0|        {
 1041|      0|            prevBond = pCS->LinearCTStereoDble[nNumMappedBonds];
 1042|      0|        }
 1043|       |
 1044|       |        /*deep_map_stereo_atoms4=0;*/
 1045|       |
 1046|       |        /*  all stereo bonds have been mapped; now start processing stereo atoms... */
 1047|  1.84k|        ret = map_stereo_atoms4( ic, pCG, at, num_atoms, num_at_tg, num_max, nCanonRankFrom, nAtomNumberCanonFrom, nCanonRankTo,
 1048|  1.84k|                        nSymmRank, pRankStack1, pRankStack2, nTempRank, nNumMappedRanksInput,
 1049|  1.84k|                        nSymmStereo, NeighList, pCS, cur_tree, 0, vABParityUnknown );
 1050|       |
 1051|  1.84k|        if (ret == 4)
  ------------------
  |  Branch (1051:13): [True: 171, False: 1.67k]
  ------------------
 1052|    171|        {
 1053|    171|            if (nNumMappedBonds)
  ------------------
  |  Branch (1053:17): [True: 14, False: 157]
  ------------------
 1054|     14|            {
 1055|     14|                return ret;
 1056|     14|            }
 1057|    157|            else
 1058|    157|            {
 1059|    157|                pCS->bFirstCT = 1;
 1060|    157|                goto total_restart;
 1061|    157|            }
 1062|    171|        }
 1063|  1.67k|        if (RETURNED_ERROR( ret ))
  ------------------
  |  |   44|  1.67k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  1.67k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  1.67k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  1.67k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  1.67k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  1.67k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 1.67k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 1.67k]
  |  |  ------------------
  ------------------
 1064|      0|        {
 1065|      0|            if (ret == CT_TIMEOUT_ERR)
  ------------------
  |  |   27|      0|#define CT_TIMEOUT_ERR       (CT_ERR_FIRST- 8)  /*(-30008) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (1065:17): [True: 0, False: 0]
  ------------------
 1066|      0|                return ret;
 1067|      0|            else
 1068|      0|                return ret; /*  program error */
 1069|      0|        }
 1070|  1.67k|        if (ret > 0)
  ------------------
  |  Branch (1070:13): [True: 1.67k, False: 0]
  ------------------
 1071|  1.67k|        {
 1072|  1.67k|            nTotSuccess |= 1;
 1073|  1.67k|            if (ret & 2)
  ------------------
  |  Branch (1073:17): [True: 588, False: 1.09k]
  ------------------
 1074|    588|            {
 1075|    588|                CurTreeKeepLastAtomsOnly( cur_tree, tpos1, 1 );  /*  start over */
 1076|    588|                nTotSuccess |= 2; /*  Obtained a smaller CT */
 1077|    588|            }
 1078|  1.67k|        }
 1079|  1.67k|    }
 1080|  3.69k|    if (!nTotSuccess && pCS->nLenLinearCTStereoDble &&
  ------------------
  |  Branch (1080:9): [True: 0, False: 3.69k]
  |  Branch (1080:25): [True: 0, False: 0]
  ------------------
 1081|      0|         nNumMappedBonds < pCS->nLenLinearCTStereoDble)
  ------------------
  |  Branch (1081:10): [True: 0, False: 0]
  ------------------
 1082|      0|    {
 1083|      0|        pCS->LinearCTStereoDble[nNumMappedBonds] = prevBond;
 1084|      0|    }
 1085|       |
 1086|  3.69k|    return nTotSuccess;  /*  ok */
 1087|  4.20k|}
map_stereo_atoms4:
 1111|  8.44k|{
 1112|       |    /*
 1113|       |     *   Do not check whether "from" atoms have any stereo features.
 1114|       |     */
 1115|  8.44k|    int nTotSuccess = 0;
 1116|  8.44k|    AT_STEREO_CARB prevAtom;
 1117|  8.44k|    int tpos1;
 1118|       |
 1119|  8.44k|    memset( &prevAtom, 0, sizeof( prevAtom ) );
 1120|       |
 1121|  8.44k|    tpos1 = CurTreeGetPos( cur_tree );
 1122|       |
 1123|  8.44k|    if (nNumMappedAtoms < pCS->nLenLinearCTStereoCarb)
  ------------------
  |  Branch (1123:9): [True: 6.15k, False: 2.29k]
  ------------------
 1124|  6.15k|    {
 1125|       |        /* AT_RANK *nRankFrom=*pRankStack1++,  AT_RANK *nAtomNumberFrom=pRankStack1++; */
 1126|       |        /* AT_RANK *nRankTo  =*pRankStack2++,  AT_RANK *nAtomNumberTo  =pRankStack2++; */
 1127|  6.15k|        int j1, at_from1, at_to1, /*at_from2, at_to2,*/ iMax, lvl, bStereoIsBetterWasSetHere;
 1128|  6.15k|        int istk, bAddStack, nNumAtTo1Success, c, bFirstTime = 1, bAllParitiesIdentical; /* djb-rwth: removing redundant variables */
 1129|  6.15k|        EQ_NEIGH EN[5], *pEN;
 1130|  6.15k|        int nStackPtr[5], nMappedRanks[5], j[5], *nSP, *nMR, bLastLvlFailed;
 1131|       |
 1132|  6.15k|        AT_RANK at_rank_canon1, cr[5], at_to[5];
 1133|  6.15k|        AT_RANK canon_rank1_min = 0;
 1134|  6.15k|        int at_rank1; /*  rank for mapping */
 1135|  6.15k|        int nNumChoices, nNumUnkn, nNumUndf, nNumWorse, nNumBest, nNumCalc;
 1136|  6.15k|        int stereo_center_parity = 0, sb_parity_calc, pass; /* djb-rwth: removing redundant variable */
 1137|  6.15k|        AT_STEREO_CARB prevAtom2;
 1138|       |
 1139|  6.15k|        prevAtom = pCS->LinearCTStereoCarb[nNumMappedAtoms]; /*  save to restore in case of failure */
 1140|  6.15k|        at_rank_canon1 = nNumMappedAtoms ? pCS->LinearCTStereoCarb[nNumMappedAtoms - 1].at_num : 0;
  ------------------
  |  Branch (1140:26): [True: 4.89k, False: 1.25k]
  ------------------
 1141|       |
 1142|  6.15k|        goto bypass_next_canon_rank_check;
 1143|       |
 1144|    614|    next_canon_rank:
 1145|       |
 1146|    614|        if (!pCS->bStereoIsBetter /*??? && !pCS->bFirstCT ???*/ &&
  ------------------
  |  Branch (1146:13): [True: 614, False: 0]
  ------------------
 1147|    614|              at_rank_canon1 >= pCS->LinearCTStereoCarb[nNumMappedAtoms].at_num)
  ------------------
  |  Branch (1147:15): [True: 614, False: 0]
  ------------------
 1148|    614|        {
 1149|       |            /*  cannot find next available canonical number */
 1150|    614|            if (!nTotSuccess)
  ------------------
  |  Branch (1150:17): [True: 291, False: 323]
  ------------------
 1151|    291|            {
 1152|    291|                pCS->LinearCTStereoCarb[nNumMappedAtoms] = prevAtom; /*  restore because of failure */
 1153|    291|            }
 1154|    614|            CurTreeSetPos( cur_tree, tpos1 );
 1155|    614|            return nTotSuccess;
 1156|    614|        }
 1157|       |
 1158|  6.15k|bypass_next_canon_rank_check:
 1159|       |
 1160|  6.15k|        CurTreeSetPos( cur_tree, tpos1 );
 1161|       |
 1162|       |        /*  find next available canon. number for a stereogenic atom */
 1163|  6.15k|        if (!Next_SC_At_CanonRank2( &at_rank_canon1, &canon_rank1_min, &bFirstTime,
  ------------------
  |  Branch (1163:13): [True: 0, False: 6.15k]
  ------------------
 1164|  6.15k|            pCS->bAtomUsedForStereo, pRankStack1, pRankStack2,
 1165|  6.15k|            nAtomNumberCanonFrom, num_atoms ) ||
 1166|  6.15k|              (!pCS->bStereoIsBetter &&
  ------------------
  |  Branch (1166:16): [True: 4.79k, False: 1.35k]
  ------------------
 1167|  4.79k|              at_rank_canon1 > pCS->LinearCTStereoCarb[nNumMappedAtoms].at_num)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1167:15): [True: 209, False: 4.58k]
  ------------------
 1168|    209|        {
 1169|       |            /*  cannot find next available canonical number */
 1170|    209|            if (!nTotSuccess)
  ------------------
  |  Branch (1170:17): [True: 209, False: 0]
  ------------------
 1171|    209|            {
 1172|    209|                pCS->LinearCTStereoCarb[nNumMappedAtoms] = prevAtom; /*  restore because of failure */
 1173|    209|            }
 1174|    209|            return nTotSuccess;
 1175|    209|        }
 1176|       |
 1177|  5.94k|        nNumChoices = 0;
 1178|  5.94k|        nNumUnkn = 0;
 1179|  5.94k|        nNumUndf = 0;
 1180|  5.94k|        nNumBest = 0;
 1181|  5.94k|        nNumWorse = 0;
 1182|  5.94k|        nNumCalc = 0;
 1183|  5.94k|        pass = 0;
 1184|       |        /* djb-rwth: removing redundant code */
 1185|       |
 1186|       |        /*  get mapping rank for the canon. number */
 1187|  5.94k|        at_rank1 = pRankStack1[0][at_from1 = (int) nAtomNumberCanonFrom[at_rank_canon1 - 1]];
 1188|  5.94k|        iMax = at_rank1 - 1;
 1189|       |        /*  for debug only */
 1190|  5.94k|        if (at_rank1 != pRankStack2[0][pRankStack2[1][at_rank1 - 1]])
  ------------------
  |  Branch (1190:13): [True: 0, False: 5.94k]
  ------------------
 1191|      0|        {
 1192|      0|            return CT_STEREOCOUNT_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1193|      0|        }
 1194|       |
 1195|       |        /*  count special parities of the not mapped yet "to" atoms */
 1196|  13.3k|        for (j1 = 0; j1 <= iMax && at_rank1 == pRankStack2[0][at_to1 = pRankStack2[1][iMax - j1]]; j1++)
  ------------------
  |  Branch (1196:22): [True: 12.9k, False: 476]
  |  Branch (1196:36): [True: 7.44k, False: 5.46k]
  ------------------
 1197|  7.44k|        {
 1198|  7.44k|            if (!at[at_to1].stereo_bond_neighbor[0] && pCS->bAtomUsedForStereo[at_to1] == STEREO_AT_MARK)
  ------------------
  |  |  878|  7.44k|#define STEREO_AT_MARK            8 /* > MAX_NUM_STEREO_BONDS */
  ------------------
  |  Branch (1198:17): [True: 7.44k, False: 0]
  |  Branch (1198:56): [True: 7.19k, False: 249]
  ------------------
 1199|  7.19k|            {
 1200|  7.19k|                int no_choice = 0;
 1201|  7.19k|                stereo_center_parity = PARITY_VAL( at[at_to1].stereo_atom_parity );
  ------------------
  |  |  262|  7.19k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|  7.19k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
 1202|  7.19k|                switch (stereo_center_parity)
  ------------------
  |  Branch (1202:25): [True: 7.19k, False: 0]
  ------------------
 1203|  7.19k|                {
 1204|       |
 1205|  4.65k|                    case AB_PARITY_UNDF: nNumUndf++; break; /*  4 */
  ------------------
  |  |  222|  4.65k|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (1205:21): [True: 4.65k, False: 2.53k]
  ------------------
 1206|       |
 1207|    244|                    case AB_PARITY_UNKN: nNumUnkn++;
  ------------------
  |  |  221|    244|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
  |  Branch (1207:21): [True: 244, False: 6.95k]
  ------------------
 1208|    244|                        break; /*  3 */
 1209|       |
 1210|    227|                    case BEST_PARITY:    nNumBest++; break; /*  1 */
  ------------------
  |  |  828|    227|#define BEST_PARITY        1  /* odd */
  ------------------
  |  Branch (1210:21): [True: 227, False: 6.96k]
  ------------------
 1211|    242|                    case WORSE_PARITY:   nNumWorse++; break; /*  2 */
  ------------------
  |  |  829|    242|#define WORSE_PARITY       2
  ------------------
  |  Branch (1211:21): [True: 242, False: 6.95k]
  ------------------
 1212|  1.82k|                    case AB_PARITY_CALC: nNumCalc++; break;
  ------------------
  |  |  224|  1.82k|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  ------------------
  |  Branch (1212:21): [True: 1.82k, False: 5.37k]
  ------------------
 1213|      0|                    case AB_PARITY_NONE: no_choice++; break; /*  0 */
  ------------------
  |  |  218|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (1213:21): [True: 0, False: 7.19k]
  ------------------
 1214|  7.19k|                }
 1215|  7.19k|                nNumChoices += !no_choice;
 1216|  7.19k|            }
 1217|  7.44k|        }
 1218|       |
 1219|  5.94k|        if (nNumChoices != nNumCalc + nNumUndf + nNumUnkn + nNumBest + nNumWorse)
  ------------------
  |  Branch (1219:13): [True: 0, False: 5.94k]
  ------------------
 1220|      0|        {
 1221|      0|            return CT_STEREOCOUNT_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1222|      0|        }
 1223|  5.94k|        if (!nNumChoices)
  ------------------
  |  Branch (1223:13): [True: 0, False: 5.94k]
  ------------------
 1224|      0|        {
 1225|      0|            goto next_canon_rank;
 1226|      0|        }
 1227|       |        /*  Determine the first parity to search */
 1228|  5.94k|        sb_parity_calc = ( nNumCalc > 0 ) ? BEST_PARITY : 0;
  ------------------
  |  |  828|  1.66k|#define BEST_PARITY        1  /* odd */
  ------------------
  |  Branch (1228:26): [True: 1.66k, False: 4.27k]
  ------------------
 1229|       |
 1230|       |        /*  ==============================================================
 1231|       |            Search sequence:           sb_parity_calc    stereo_center_parity
 1232|       |            ==============================================================
 1233|       |            BEST_PARITY   (calc)       BEST_PARITY     BEST_PARITY
 1234|       |            BEST_PARITY   (known)      BEST_PARITY     WORSE_PARITY  or 0
 1235|       |            WORSE_PARITY  (calc)       WORSE_PARITY    WORSE_PARITY
 1236|       |            WORSE_PARITY  (known)      WORSE_PARITY    0
 1237|       |            AB_PARITY_UNKN(known)      AB_PARITY_UNKN  0
 1238|       |            AB_PARITY_UNDF(known)      AB_PARITY_UNDF  0
 1239|       |
 1240|       |            if (sb_parity_calc==stereo_center_parity) then "calc" else "known"
 1241|       |         */
 1242|       |
 1243|  8.11k|    repeat_all:
 1244|       |
 1245|  8.11k|        if (!pass++)
  ------------------
  |  Branch (1245:13): [True: 5.94k, False: 2.17k]
  ------------------
 1246|  5.94k|        {
 1247|       |            /*  select the smallest parity to search */
 1248|  5.94k|            if (sb_parity_calc)
  ------------------
  |  Branch (1248:17): [True: 1.66k, False: 4.27k]
  ------------------
 1249|  1.66k|            {
 1250|  1.66k|                stereo_center_parity = BEST_PARITY;
  ------------------
  |  |  828|  1.66k|#define BEST_PARITY        1  /* odd */
  ------------------
 1251|  1.66k|            }
 1252|  4.27k|            else
 1253|  4.27k|            {
 1254|  4.27k|                stereo_center_parity = nNumBest ? BEST_PARITY :
  ------------------
  |  |  828|    211|#define BEST_PARITY        1  /* odd */
  ------------------
  |  Branch (1254:40): [True: 211, False: 4.06k]
  ------------------
 1255|  4.27k|                    nNumWorse ? WORSE_PARITY :
  ------------------
  |  |  829|    209|#define WORSE_PARITY       2
  ------------------
  |  Branch (1255:21): [True: 209, False: 3.85k]
  ------------------
 1256|  4.06k|                    nNumUnkn ? AB_PARITY_UNKN :
  ------------------
  |  |  221|    208|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
  |  Branch (1256:21): [True: 208, False: 3.64k]
  ------------------
 1257|  3.85k|                    nNumUndf ? AB_PARITY_UNDF : AB_PARITY_NONE;
  ------------------
  |  |  222|  3.64k|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
                                  nNumUndf ? AB_PARITY_UNDF : AB_PARITY_NONE;
  ------------------
  |  |  218|  4.27k|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (1257:21): [True: 3.64k, False: 0]
  ------------------
 1258|  4.27k|            }
 1259|  5.94k|        }
 1260|  2.17k|        else
 1261|  2.17k|        {
 1262|       |            /* djb-rwth: removing redundant code */
 1263|  2.17k|            j1 = NextStereoParity2Test( &stereo_center_parity, &sb_parity_calc,
 1264|  2.17k|                                     nNumBest, nNumWorse, nNumUnkn, nNumUndf, nNumCalc,
 1265|  2.17k|                                     vABParityUnknown );
 1266|  2.17k|            switch (j1)
 1267|  2.17k|            {
 1268|  1.55k|                case 0:
  ------------------
  |  Branch (1268:17): [True: 1.55k, False: 614]
  ------------------
 1269|  1.55k|                    break; /* obtained next parity to test */
 1270|    614|                case 1:
  ------------------
  |  Branch (1270:17): [True: 614, False: 1.55k]
  ------------------
 1271|    614|                    goto next_canon_rank;
 1272|      0|                default:
  ------------------
  |  Branch (1272:17): [True: 0, False: 2.17k]
  ------------------
 1273|      0|                    return j1; /* program error */
 1274|  2.17k|            }
 1275|  2.17k|        }
 1276|       |
 1277|  7.50k|        if (stereo_center_parity == AB_PARITY_NONE)
  ------------------
  |  |  218|  7.50k|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (1277:13): [True: 0, False: 7.50k]
  ------------------
 1278|      0|        {
 1279|       |            /*  error? */
 1280|      0|            return CT_STEREOCOUNT_ERR;                  /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1281|      0|        }
 1282|       |
 1283|       |        /*  check if the new requested parity is small enough */
 1284|  7.50k|        if (!pCS->bStereoIsBetter)
  ------------------
  |  Branch (1284:13): [True: 6.02k, False: 1.47k]
  ------------------
 1285|  6.02k|        {
 1286|  6.02k|            c = CompareLinCtStereoAtomToValues( nTotSuccess ? pCS->LinearCTStereoCarb + nNumMappedAtoms : &prevAtom,
  ------------------
  |  Branch (1286:49): [True: 818, False: 5.20k]
  ------------------
 1287|  6.02k|                              at_rank_canon1, (U_CHAR) stereo_center_parity );
 1288|  6.02k|            if (c < 0)
  ------------------
  |  Branch (1288:17): [True: 1.81k, False: 4.21k]
  ------------------
 1289|  1.81k|            {
 1290|  1.81k|                if (!nTotSuccess)
  ------------------
  |  Branch (1290:21): [True: 997, False: 818]
  ------------------
 1291|    997|                {
 1292|    997|                    pCS->LinearCTStereoCarb[nNumMappedAtoms] = prevAtom;
 1293|    997|                }
 1294|  1.81k|                CurTreeSetPos( cur_tree, tpos1 );
 1295|  1.81k|                return nTotSuccess;
 1296|  1.81k|            }
 1297|  6.02k|        }
 1298|       |
 1299|       |        /* djb-rwth: removing redundant code */
 1300|  5.68k|        bStereoIsBetterWasSetHere = 0;
 1301|       |        /* djb-rwth: removing redundant code */
 1302|  5.68k|        CurTreeSetPos( cur_tree, tpos1 );  /*  start over */
 1303|       |
 1304|       |        /*
 1305|       |        if ( prev_stereo_center_parity != stereo_center_parity ) {
 1306|       |            CurTreeSetPos( cur_tree, tpos1 );
 1307|       |        }
 1308|       |        */
 1309|       |        /*  nRankTo                 nAtomNumberTo */
 1310|  8.74k|        for (j1 = 0; j1 <= iMax && at_rank1 == pRankStack2[0][at_to1 = pRankStack2[1][iMax - j1]]; j1++)
  ------------------
  |  Branch (1310:22): [True: 8.47k, False: 272]
  |  Branch (1310:36): [True: 6.58k, False: 1.89k]
  ------------------
 1311|  6.58k|        {
 1312|  6.58k|            int ret, ret1, ret2, parity1;
 1313|  6.58k|            nNumAtTo1Success = 0;
 1314|       |            /*
 1315|       |            if ( !(at[at_to1].stereo_atom_parity && !at[at_to1].stereo_bond_neighbor[0] &&
 1316|       |                   pCS->bAtomUsedForStereo[at_to1] == STEREO_AT_MARK ) )
 1317|       |            */
 1318|  6.58k|            if (!at[at_to1].stereo_atom_parity || at[at_to1].stereo_bond_neighbor[0] ||
  ------------------
  |  Branch (1318:17): [True: 232, False: 6.34k]
  |  Branch (1318:51): [True: 0, False: 6.34k]
  ------------------
 1319|  6.34k|                  pCS->bAtomUsedForStereo[at_to1] != STEREO_AT_MARK) /* simplify 12-17-2003 */
  ------------------
  |  |  878|  6.34k|#define STEREO_AT_MARK            8 /* > MAX_NUM_STEREO_BONDS */
  ------------------
  |  Branch (1319:19): [True: 0, False: 6.34k]
  ------------------
 1320|    232|            {
 1321|    232|                continue;
 1322|    232|            }
 1323|       |            /* Do not map on non-stereogenic atom constitutionally
 1324|       |            * equivalent to a steregenic atom. Here
 1325|       |            * at[at_to1] is not a sterereo center;  |       |
 1326|       |            * bonds tautomerism is a usual cause.  -P(+)-CH=P-
 1327|       |            * For example, consider a fragment:     |       |
 1328|       |            * The two atoms P may be constitutionally
 1329|       |            * equivalent, P(+) may be seen as a stereocenter
 1330|       |            * while another P has a double bond (Now such a P(V) IS a stereocenter).
 1331|       |            */
 1332|       |
 1333|       |            /*  check whether the stereocenter parity corresponds to the requested stereocenter parity */
 1334|  6.34k|            if (PARITY_KNOWN( at[at_to1].stereo_atom_parity ))
  ------------------
  |  |  265|  6.34k|#define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|  6.34k|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|  12.6k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  6.34k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|  6.34k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  6.34k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|  6.34k|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (265:38): [True: 6.34k, False: 0]
  |  |  |  Branch (265:78): [True: 4.13k, False: 2.21k]
  |  |  ------------------
  ------------------
 1335|  4.13k|            {
 1336|  4.13k|                if (stereo_center_parity == sb_parity_calc)
  ------------------
  |  Branch (1336:21): [True: 381, False: 3.75k]
  ------------------
 1337|    381|                {
 1338|    381|                    continue;  /*  requested parity to be calculated, found known parity */
 1339|    381|                }
 1340|  3.75k|                if (stereo_center_parity != PARITY_VAL( at[at_to1].stereo_atom_parity ))
  ------------------
  |  |  262|  3.75k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|  3.75k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
  |  Branch (1340:21): [True: 64, False: 3.69k]
  ------------------
 1341|     64|                {
 1342|     64|                    continue;  /*  parity differs from the requested parity */
 1343|     64|                }
 1344|  3.75k|            }
 1345|  2.21k|            else
 1346|  2.21k|            {
 1347|  2.21k|                if (PARITY_CALCULATE( at[at_to1].stereo_atom_parity ))
  ------------------
  |  |  267|  2.21k|#define PARITY_CALCULATE(X)         (AB_PARITY_CALC == PARITY_VAL(X))
  |  |  ------------------
  |  |  |  |  224|  2.21k|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  |  |  ------------------
  |  |               #define PARITY_CALCULATE(X)         (AB_PARITY_CALC == PARITY_VAL(X))
  |  |  ------------------
  |  |  |  |  262|  2.21k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  2.21k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (267:37): [True: 2.21k, False: 0]
  |  |  ------------------
  ------------------
 1348|  2.21k|                {
 1349|  2.21k|                    if (stereo_center_parity != sb_parity_calc)
  ------------------
  |  Branch (1349:25): [True: 0, False: 2.21k]
  ------------------
 1350|      0|                    {
 1351|      0|                        continue;  /*  requested known parity, found patity to be calculated */
 1352|      0|                    }
 1353|  2.21k|                }
 1354|      0|                else
 1355|      0|                {
 1356|      0|                    return CT_STEREOCOUNT_ERR;  /*  unknown parity type */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1357|      0|                }
 1358|  2.21k|            }
 1359|       |
 1360|  5.90k|            bAllParitiesIdentical = ( ( at[at_to1].stereo_atom_parity & KNOWN_PARITIES_EQL ) &&
  ------------------
  |  |  206|  5.90k|#define KNOWN_PARITIES_EQL 0x40  /* parity is same for all pairs of constit. equivalent atoms       */
  ------------------
  |  Branch (1360:39): [True: 1.57k, False: 4.33k]
  ------------------
 1361|  1.57k|                                     PARITY_KNOWN( at[at_to1].stereo_atom_parity ) );
  ------------------
  |  |  265|  1.57k|#define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  231|  1.57k|#define AB_MIN_KNOWN_PARITY        1
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|  3.14k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  1.57k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  262|  1.57k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  204|  1.57k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PARITY_KNOWN(X)             (AB_MIN_KNOWN_PARITY <= PARITY_VAL(X) && PARITY_VAL(X) <= AB_MAX_KNOWN_PARITY)
  |  |  ------------------
  |  |  |  |  230|  1.57k|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  ------------------
  |  |  |  Branch (265:38): [True: 1.57k, False: 0]
  |  |  |  Branch (265:78): [True: 1.57k, False: 0]
  |  |  ------------------
  ------------------
 1362|       |
 1363|  5.90k|            if (!bAllParitiesIdentical && !nNumCalc &&
  ------------------
  |  Branch (1363:17): [True: 4.33k, False: 1.57k]
  |  Branch (1363:43): [True: 2.12k, False: 2.21k]
  ------------------
 1364|  2.12k|                ( !nNumUndf + !nNumUnkn + !nNumBest + !nNumWorse ) == 3)
  ------------------
  |  Branch (1364:17): [True: 2.06k, False: 61]
  ------------------
 1365|  2.06k|            {
 1366|       |                /* only one kind of stereocenter parity is present; check whether all parities are really same */
 1367|  2.06k|                bAllParitiesIdentical = All_SC_Same( at_rank_canon1, /*  canonical number */
 1368|  2.06k|                                                      pRankStack1, pRankStack2,
 1369|  2.06k|                                                      nAtomNumberCanonFrom, at );
 1370|  2.06k|                if (bAllParitiesIdentical < 0)
  ------------------
  |  Branch (1370:21): [True: 0, False: 2.06k]
  ------------------
 1371|      0|                {
 1372|      0|                    return CT_STEREOCOUNT_ERR;
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1373|      0|                }
 1374|  2.06k|            }
 1375|  5.90k|            if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (1375:17): [True: 199, False: 5.70k]
  ------------------
 1376|    199|                 1 == CurTreeIsLastRank( cur_tree, at_rank_canon1 ) &&
  ------------------
  |  Branch (1376:18): [True: 199, False: 0]
  ------------------
 1377|    199|                 1 == CurTreeIsLastAtomEqu( cur_tree, at_to1, nSymmStereo ))
  ------------------
  |  Branch (1377:18): [True: 42, False: 157]
  ------------------
 1378|     42|            {
 1379|     42|                continue;
 1380|     42|            }
 1381|       |
 1382|       |
 1383|       |            /*  initialize stack pointer nStackPtr[istk] for "hand-made" recursion */
 1384|       |            /*  stacks are pRankStack1[], pRankStack2[], nNumMappedRanks[] */
 1385|  5.86k|            istk = 0;
 1386|  5.86k|            nStackPtr[istk] = 0;
 1387|  5.86k|            nMappedRanks[istk] = nNumMappedRanksInput;
 1388|  5.86k|            bAddStack = 0;
 1389|       |            /*  if all equivalent atoms have same known parity, do not map any of them here */
 1390|  5.86k|            if (!bAllParitiesIdentical)
  ------------------
  |  Branch (1390:17): [True: 2.47k, False: 3.38k]
  ------------------
 1391|  2.47k|            {
 1392|       |                /*  map the central atom */
 1393|       |                /*  this mapping is always possible */
 1394|  2.47k|                ret1 = map_an_atom2( pCG, num_at_tg, num_max, at_from1, at_to1,
 1395|  2.47k|                                    nTempRank, nMappedRanks[istk], &nMappedRanks[istk + 1], pCS,
 1396|  2.47k|                                    NeighList, pRankStack1 + nStackPtr[istk], pRankStack2 + nStackPtr[istk],
 1397|  2.47k|                                    &bAddStack );
 1398|  2.47k|                if (RETURNED_ERROR( ret1 ))
  ------------------
  |  |   44|  2.47k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  2.47k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  2.47k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  2.47k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  2.47k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  2.47k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 2.47k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 2.47k]
  |  |  ------------------
  ------------------
 1399|      0|                {
 1400|      0|                    return ret1; /*  error */
 1401|      0|                }
 1402|  2.47k|                nStackPtr[istk + 1] = nStackPtr[istk] + bAddStack;
 1403|  2.47k|                istk++;
 1404|  2.47k|            }
 1405|  3.38k|            else
 1406|  3.38k|            {
 1407|  3.38k|                ClearPreviousMappings( pRankStack1 + 2 ); /*  precaution */
 1408|  3.38k|            }
 1409|       |
 1410|       |            /*********************************************************************************
 1411|       |             *
 1412|       |             *   Unknown Stereocenter Parity case: possibly need to map stereo center neighbors
 1413|       |             */
 1414|  5.86k|            if (stereo_center_parity == sb_parity_calc)
  ------------------
  |  Branch (1414:17): [True: 2.19k, False: 3.66k]
  ------------------
 1415|  2.19k|            {
 1416|       |                /*  find out the parity */
 1417|  2.19k|                parity1 = parity_of_mapped_atom2( pCG, at_from1, at_to1, at, &EN[istk],
 1418|  2.19k|                                                 nCanonRankFrom, pRankStack1[nStackPtr[istk]],
 1419|  2.19k|                                                 pRankStack2[nStackPtr[istk]] );
 1420|       |                /*  if parity is well-defined then returned EN[istk].num_to=0 */
 1421|  2.19k|                if (!parity1)
  ------------------
  |  Branch (1421:21): [True: 0, False: 2.19k]
  ------------------
 1422|      0|                {
 1423|      0|                    return CT_STEREOCOUNT_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1424|      0|                }
 1425|  2.19k|                if (!EN[istk].num_to && parity1 != sb_parity_calc)
  ------------------
  |  Branch (1425:21): [True: 1.50k, False: 694]
  |  Branch (1425:41): [True: 536, False: 966]
  ------------------
 1426|    536|                {
 1427|    536|                    continue; /*  looking for the parity value = sb_parity_calc */
 1428|    536|                }
 1429|  2.19k|            }
 1430|  3.66k|            else
 1431|  3.66k|            {
 1432|       |                /*  Known parity */
 1433|  3.66k|                parity1 = stereo_center_parity;
 1434|  3.66k|                EN[istk].num_to = 0;
 1435|  3.66k|            }
 1436|       |
 1437|       |            /***********************************************************************
 1438|       |             * no need to map the neighbors: parity is known or has been calculated
 1439|       |             */
 1440|  5.32k|            if ((stereo_center_parity == sb_parity_calc && !EN[istk].num_to) ||
  ------------------
  |  Branch (1440:18): [True: 1.66k, False: 3.66k]
  |  Branch (1440:60): [True: 966, False: 694]
  ------------------
 1441|       |                 /*  now well-defined, but unknown in advance atom parity  OR   */
 1442|  4.35k|                 stereo_center_parity != sb_parity_calc) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1442:18): [True: 3.66k, False: 694]
  ------------------
 1443|       |                 /*  known in advance parity = stereo_center_parity */
 1444|  4.63k|            {
 1445|       |                /*  do not need to map the neighbors */
 1446|  4.63k|                c = CompareLinCtStereoAtomToValues( pCS->LinearCTStereoCarb + nNumMappedAtoms,
 1447|  4.63k|                                            at_rank_canon1, (U_CHAR) parity1 );
 1448|  4.63k|                if (c < 0 && !pCS->bStereoIsBetter)
  ------------------
  |  Branch (1448:21): [True: 424, False: 4.20k]
  |  Branch (1448:30): [True: 0, False: 424]
  ------------------
 1449|      0|                {
 1450|       |                    /*  reject */
 1451|      0|                    pCS->lNumRejectedCT++;
 1452|      0|                    continue;  /*  Reject: not a minimal CT. Should not happen */
 1453|      0|                }
 1454|  4.63k|                else
 1455|  4.63k|                {
 1456|       |                    /*  accept */
 1457|  4.63k|                    if (bAddStack)
  ------------------
  |  Branch (1457:25): [True: 301, False: 4.33k]
  ------------------
 1458|    301|                    {
 1459|    301|                        if (tpos1 == CurTreeGetPos( cur_tree ) ||
  ------------------
  |  Branch (1459:29): [True: 261, False: 40]
  ------------------
 1460|     40|                             0 == CurTreeIsLastRank( cur_tree, at_rank_canon1 ))
  ------------------
  |  Branch (1460:30): [True: 0, False: 40]
  ------------------
 1461|    261|                        {
 1462|    261|                            CurTreeAddRank( cur_tree, at_rank_canon1 );
 1463|    261|                        }
 1464|    301|                        CurTreeAddAtom( cur_tree, at_to1 );
 1465|    301|                    }
 1466|       |
 1467|  4.63k|                    if (c > 0 && !pCS->bStereoIsBetter)
  ------------------
  |  Branch (1467:25): [True: 659, False: 3.97k]
  |  Branch (1467:34): [True: 458, False: 201]
  ------------------
 1468|    458|                    {
 1469|       |                        /*  stereo center entry is less than the previusly found */
 1470|    458|                        pCS->bStereoIsBetter = bStereoIsBetterWasSetHere = 1;
 1471|    458|                        prevAtom2 = pCS->LinearCTStereoCarb[nNumMappedAtoms];
 1472|    458|                    }
 1473|  4.63k|                    pCS->LinearCTStereoCarb[nNumMappedAtoms].parity = parity1;
 1474|  4.63k|                    pCS->LinearCTStereoCarb[nNumMappedAtoms].at_num = at_rank_canon1;
 1475|  4.63k|                    pCS->bRankUsedForStereo[at_from1] = 3;
 1476|  4.63k|#if ( FIX_ChCh_STEREO_CANON_BUG == 1 )
 1477|  4.63k|                    if (!bAllParitiesIdentical)
  ------------------
  |  Branch (1477:25): [True: 1.24k, False: 3.38k]
  ------------------
 1478|  1.24k|#endif
 1479|  1.24k|                        pCS->bAtomUsedForStereo[at_to1] -= STEREO_AT_MARK;
  ------------------
  |  |  878|  1.24k|#define STEREO_AT_MARK            8 /* > MAX_NUM_STEREO_BONDS */
  ------------------
 1480|       |
 1481|       |
 1482|  4.63k|                    ret = map_stereo_atoms4( ic, pCG,
 1483|  4.63k|                                              at, num_atoms, num_at_tg, num_max,
 1484|  4.63k|                                              nCanonRankFrom,
 1485|  4.63k|                                              nAtomNumberCanonFrom,
 1486|  4.63k|                                              nCanonRankTo,
 1487|  4.63k|                                              nSymmRank,
 1488|  4.63k|                                              pRankStack1 + nStackPtr[istk],
 1489|  4.63k|                                              pRankStack2 + nStackPtr[istk],
 1490|  4.63k|                                              nTempRank,
 1491|  4.63k|                                              nMappedRanks[istk],
 1492|  4.63k|                                              nSymmStereo,
 1493|  4.63k|                                              NeighList,
 1494|  4.63k|                                              pCS,
 1495|  4.63k|                                              cur_tree,
 1496|  4.63k|                                              nNumMappedAtoms + 1,
 1497|  4.63k|                                              vABParityUnknown );
 1498|       |
 1499|  4.63k|                    pCS->bRankUsedForStereo[at_from1] = 0;
 1500|  4.63k|#if ( FIX_ChCh_STEREO_CANON_BUG == 1 )
 1501|  4.63k|                    if (!bAllParitiesIdentical)
  ------------------
  |  Branch (1501:25): [True: 1.24k, False: 3.38k]
  ------------------
 1502|  1.24k|#endif
 1503|  1.24k|                        pCS->bAtomUsedForStereo[at_to1] += STEREO_AT_MARK;
  ------------------
  |  |  878|  1.24k|#define STEREO_AT_MARK            8 /* > MAX_NUM_STEREO_BONDS */
  ------------------
 1504|       |
 1505|  4.63k|                    if (ret == 4)
  ------------------
  |  Branch (1505:25): [True: 211, False: 4.42k]
  ------------------
 1506|    211|                    {
 1507|    211|                        return ret;
 1508|    211|                    }
 1509|       |
 1510|  4.42k|                    if (RETURNED_ERROR( ret ))
  ------------------
  |  |   44|  4.42k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  4.42k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  4.42k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  4.42k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  4.42k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  4.42k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 4.42k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 4.42k]
  |  |  ------------------
  ------------------
 1511|      0|                    {
 1512|      0|                        return ret; /*  program error */ /* djb-rwth: fixing coverity ID #499567 */
 1513|      0|                    }
 1514|       |
 1515|  4.42k|                    if (ret > 0)
  ------------------
  |  Branch (1515:25): [True: 3.91k, False: 504]
  ------------------
 1516|  3.91k|                    {
 1517|  3.91k|                        nTotSuccess |= 1;
 1518|  3.91k|                        nNumAtTo1Success++;
 1519|  3.91k|                        if (bStereoIsBetterWasSetHere || ( ret & 2 ))
  ------------------
  |  Branch (1519:29): [True: 438, False: 3.47k]
  |  Branch (1519:58): [True: 540, False: 2.93k]
  ------------------
 1520|    978|                        {
 1521|    978|                            CurTreeKeepLastAtomsOnly( cur_tree, tpos1, 1 );  /*  start over */
 1522|    978|                            nTotSuccess |= 2; /*  Obtained a smaller CT */
 1523|    978|                        }
 1524|  3.91k|                    }
 1525|    504|                    else
 1526|    504|                    {
 1527|    504|                        if (bStereoIsBetterWasSetHere)
  ------------------
  |  Branch (1527:29): [True: 0, False: 504]
  ------------------
 1528|      0|                        {
 1529|      0|                            pCS->bStereoIsBetter = 0;
 1530|      0|                            pCS->LinearCTStereoCarb[nNumMappedAtoms] = prevAtom2;
 1531|      0|                        }
 1532|       |                        /*  remove failed atom1 from the tree */
 1533|       |
 1534|    504|                        if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (1534:29): [True: 14, False: 490]
  ------------------
 1535|     14|                             1 == CurTreeIsLastRank( cur_tree, at_rank_canon1 ))
  ------------------
  |  Branch (1535:30): [True: 14, False: 0]
  ------------------
 1536|     14|                        {
 1537|     14|                            CurTreeRemoveIfLastAtom( cur_tree, at_to1 );
 1538|     14|                            CurTreeRemoveLastRankIfNoAtoms( cur_tree );
 1539|     14|                        }
 1540|    504|                    }
 1541|  4.42k|                    bStereoIsBetterWasSetHere = 0;
 1542|  4.42k|                }
 1543|       |
 1544|       |                /*
 1545|       |                if ( (at[at_to1].stereo_atom_parity & KNOWN_PARITIES_EQL ) &&
 1546|       |                     ATOM_PARITY_KNOWN(stereo_center_parity) && !nSymmStereo ) { // ??? add && !nSymmStereo ???
 1547|       |                    break; // do not repeat for the same kind of stereo atom with the parity known in advance
 1548|       |                }
 1549|       |                */
 1550|  4.42k|                if (bAllParitiesIdentical)
  ------------------
  |  Branch (1550:21): [True: 3.21k, False: 1.20k]
  ------------------
 1551|  3.21k|                {
 1552|  3.21k|                    break;  /*  do not repeat for the same kind of stereo atom with the parity known in advance */
 1553|  3.21k|                }
 1554|  1.20k|                continue;
 1555|  4.42k|            }
 1556|       |
 1557|       |            /***************************************************
 1558|       |             *
 1559|       |             * Need to map the neighbors
 1560|       |             */
 1561|    694|            if (stereo_center_parity != sb_parity_calc)
  ------------------
  |  Branch (1561:17): [True: 0, False: 694]
  ------------------
 1562|      0|            {
 1563|      0|                return CT_STEREOCOUNT_ERR;  /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1564|      0|            }
 1565|       |            /* -- has already been calculated --
 1566|       |            parity1 = parity_of_mapped_atom2( pCG, at_from1, at_to1, at, &EN[istk],
 1567|       |                                             nCanonRankFrom, pRankStack1[nStackPtr[istk]], pRankStack2[nStackPtr[istk]] );
 1568|       |            */
 1569|    694|            if (!parity1)
  ------------------
  |  Branch (1569:17): [True: 0, False: 694]
  ------------------
 1570|      0|            {
 1571|      0|                return CT_STEREOCOUNT_ERR; /*  1/25/2002 */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1572|      0|            }
 1573|       |
 1574|    694|            if (bAddStack)
  ------------------
  |  Branch (1574:17): [True: 405, False: 289]
  ------------------
 1575|    405|            {
 1576|    405|                if (tpos1 == CurTreeGetPos( cur_tree ) ||
  ------------------
  |  Branch (1576:21): [True: 288, False: 117]
  ------------------
 1577|    117|                     0 == CurTreeIsLastRank( cur_tree, at_rank_canon1 ))
  ------------------
  |  Branch (1577:22): [True: 0, False: 117]
  ------------------
 1578|    288|                {
 1579|    288|                    CurTreeAddRank( cur_tree, at_rank_canon1 );
 1580|    288|                }
 1581|    405|                CurTreeAddAtom( cur_tree, at_to1 );
 1582|    405|            }
 1583|       |            /******************************************************
 1584|       |             * Need to fix the neighbors to define the atom parity
 1585|       |             ******************************************************/
 1586|       |            /*  a recursion replaced with the hand-made stack */
 1587|    694|            lvl = 0;              /*  the "recursion" depth level */
 1588|    694|            nSP = &nStackPtr[istk];
 1589|    694|            nMR = &nMappedRanks[istk];
 1590|    694|            pEN = &EN[istk];
 1591|    694|            bLastLvlFailed = 0;
 1592|       |
 1593|       |            /*  entering "recursion" depth level lvl */
 1594|  2.66k|        next_lvl:
 1595|  2.66k|            if (pEN[lvl].num_to)
  ------------------
  |  Branch (1595:17): [True: 2.66k, False: 0]
  ------------------
 1596|  2.66k|            {
 1597|       |                /* Found tied neighbors. Try all transpositions of the tied neighbors.
 1598|       |                 * j is a number of the "to" tied neighbor in the pEN[lvl].to_at[*] to
 1599|       |                 * which the pEN[lvl].from_at "from" neighbor's canonical number is mapped
 1600|       |                 */
 1601|  2.66k|                j[lvl] = 0;
 1602|  6.00k|            next_j:
 1603|  6.00k|                cr[lvl] = nCanonRankFrom[pEN[lvl].from_at];
 1604|  6.00k|                at_to[lvl] = pEN[lvl].to_at[j[lvl]];
 1605|  6.00k|                if (j[lvl] && tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (1605:21): [True: 3.34k, False: 2.66k]
  |  Branch (1605:31): [True: 3.19k, False: 148]
  ------------------
 1606|  3.19k|                     1 == CurTreeIsLastRank( cur_tree, cr[lvl] ) &&
  ------------------
  |  Branch (1606:22): [True: 895, False: 2.29k]
  ------------------
 1607|    895|                     1 == CurTreeIsLastAtomEqu( cur_tree, at_to[lvl], nSymmStereo ))
  ------------------
  |  Branch (1607:22): [True: 233, False: 662]
  ------------------
 1608|    233|                {
 1609|    233|                    lvl++;
 1610|    233|                    bLastLvlFailed = 0;
 1611|    233|                    goto backup; /*  do not test stereo equivalent atoms except the first one */
 1612|    233|                }
 1613|       |
 1614|  5.76k|                ret2 = map_an_atom2( pCG, num_at_tg, num_max,
 1615|  5.76k|                                    pEN[lvl].from_at,        /* from */
 1616|  5.76k|                                    pEN[lvl].to_at[j[lvl]],  /* to */
 1617|  5.76k|                                    nTempRank, nMR[lvl], &nMR[lvl + 1], pCS,
 1618|  5.76k|                                    NeighList, pRankStack1 + nSP[lvl], pRankStack2 + nSP[lvl],
 1619|  5.76k|                                    &bAddStack );
 1620|       |
 1621|  5.76k|                if (RETURNED_ERROR( ret2 ))
  ------------------
  |  |   44|  5.76k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  5.76k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  5.76k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  5.76k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  5.76k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  5.76k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 5.76k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 5.76k]
  |  |  ------------------
  ------------------
 1622|      0|                {
 1623|      0|                    return ret2; /*  program error */
 1624|      0|                }
 1625|       |
 1626|       |                /*  next recursion depth level */
 1627|  5.76k|                if (bAddStack)
  ------------------
  |  Branch (1627:21): [True: 5.76k, False: 0]
  ------------------
 1628|  5.76k|                {
 1629|  5.76k|                    if (tpos1 == CurTreeGetPos( cur_tree ) ||
  ------------------
  |  Branch (1629:25): [True: 437, False: 5.33k]
  ------------------
 1630|  5.33k|                         0 == CurTreeIsLastRank( cur_tree, cr[lvl] ))
  ------------------
  |  Branch (1630:26): [True: 4.67k, False: 662]
  ------------------
 1631|  5.10k|                    {
 1632|  5.10k|                        CurTreeAddRank( cur_tree, cr[lvl] );
 1633|  5.10k|                    }
 1634|  5.76k|                    CurTreeAddAtom( cur_tree, at_to[lvl] );
 1635|  5.76k|                }
 1636|  5.76k|                nSP[lvl + 1] = nSP[lvl] + bAddStack;
 1637|  5.76k|                lvl++; /*  upon increment lvl = number of additionally mapped neighbors
 1638|       |                         *  (entering next recursion level) */
 1639|       |
 1640|       |                /*  check if the mapping has defined the parity */
 1641|  5.76k|                parity1 = parity_of_mapped_atom2( pCG, at_from1, at_to1, at, &pEN[lvl],
 1642|  5.76k|                                             nCanonRankFrom, pRankStack1[nSP[lvl]], pRankStack2[nSP[lvl]] );
 1643|       |
 1644|  5.76k|                if (!parity1)
  ------------------
  |  Branch (1644:21): [True: 0, False: 5.76k]
  ------------------
 1645|      0|                {
 1646|      0|                    return CT_STEREOCOUNT_ERR; /*  1/25/2002 */ /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1647|      0|                }
 1648|  5.76k|                if (parity1 < 0)
  ------------------
  |  Branch (1648:21): [True: 1.96k, False: 3.80k]
  ------------------
 1649|  1.96k|                {
 1650|  1.96k|                    goto next_lvl; /*  we need at least one more mapping to define the parity */
 1651|  1.96k|                }
 1652|       |
 1653|       |                /**********************************************************
 1654|       |                 *
 1655|       |                 *  Check the parity
 1656|       |                 *
 1657|       |                 **********************************************************
 1658|       |                 *  make a decision whether to accept the current mapping */
 1659|       |
 1660|  3.80k|                c = CompareLinCtStereoAtomToValues( pCS->LinearCTStereoCarb + nNumMappedAtoms,
 1661|  3.80k|                                            at_rank_canon1, (U_CHAR) parity1 );
 1662|  3.80k|                if (sb_parity_calc != parity1 ||
  ------------------
  |  Branch (1662:21): [True: 1.83k, False: 1.96k]
  ------------------
 1663|  1.96k|                     (c < 0 && !pCS->bStereoIsBetter)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1663:23): [True: 0, False: 1.96k]
  |  Branch (1663:32): [True: 0, False: 0]
  ------------------
 1664|  1.83k|                {
 1665|  1.83k|                    pCS->lNumRejectedCT++;
 1666|  1.83k|                    bLastLvlFailed = 1;
 1667|  1.83k|                }
 1668|  1.96k|                else
 1669|       |                   /*  the parity has been defined (all neighbors have untied ranks) */
 1670|       |                   /*  if ( bAcceptAllParities || parity1 == BEST_PARITY ) */
 1671|  1.96k|                {
 1672|       |                    /*********************************************************************
 1673|       |                     *
 1674|       |                     * Process the parity here. We are at the top of the recursion stack.
 1675|       |                     *
 1676|       |                     *********************************************************************/
 1677|       |                    /*  try to accept current neighbors mapping */
 1678|  1.96k|                    if (c > 0 && !pCS->bStereoIsBetter)
  ------------------
  |  Branch (1678:25): [True: 459, False: 1.50k]
  |  Branch (1678:34): [True: 452, False: 7]
  ------------------
 1679|    452|                    {
 1680|    452|                        pCS->bStereoIsBetter = bStereoIsBetterWasSetHere = 1;
 1681|    452|                        prevAtom2 = pCS->LinearCTStereoCarb[nNumMappedAtoms];
 1682|    452|                    }
 1683|  1.96k|                    pCS->LinearCTStereoCarb[nNumMappedAtoms].parity = parity1;
 1684|  1.96k|                    pCS->LinearCTStereoCarb[nNumMappedAtoms].at_num = at_rank_canon1;
 1685|  1.96k|                    pCS->bRankUsedForStereo[at_from1] = 3;
 1686|  1.96k|                    pCS->bAtomUsedForStereo[at_to1] -= STEREO_AT_MARK;
  ------------------
  |  |  878|  1.96k|#define STEREO_AT_MARK            8 /* > MAX_NUM_STEREO_BONDS */
  ------------------
 1687|       |
 1688|  1.96k|                    ret = map_stereo_atoms4( ic, pCG, at, num_atoms, num_at_tg, num_max, nCanonRankFrom, nAtomNumberCanonFrom, nCanonRankTo,
 1689|  1.96k|                                       nSymmRank, pRankStack1 + nSP[lvl], pRankStack2 + nSP[lvl],
 1690|  1.96k|                                       nTempRank, nMR[lvl], nSymmStereo, NeighList,
 1691|  1.96k|                                       pCS, cur_tree, nNumMappedAtoms + 1,
 1692|  1.96k|                                       vABParityUnknown );
 1693|       |
 1694|  1.96k|                    pCS->bRankUsedForStereo[at_from1] = 0;
 1695|  1.96k|                    pCS->bAtomUsedForStereo[at_to1] += STEREO_AT_MARK;
  ------------------
  |  |  878|  1.96k|#define STEREO_AT_MARK            8 /* > MAX_NUM_STEREO_BONDS */
  ------------------
 1696|  1.96k|                    if (ret == 4)
  ------------------
  |  Branch (1696:25): [True: 102, False: 1.86k]
  ------------------
 1697|    102|                    {
 1698|    102|                        return ret;
 1699|    102|                    }
 1700|  1.86k|                    if (RETURNED_ERROR( ret ))
  ------------------
  |  |   44|  1.86k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  1.86k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  1.86k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  1.86k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  1.86k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  1.86k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 1.86k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 1.86k]
  |  |  ------------------
  ------------------
 1701|      0|                    {
 1702|      0|                        if (ret == CT_TIMEOUT_ERR)
  ------------------
  |  |   27|      0|#define CT_TIMEOUT_ERR       (CT_ERR_FIRST- 8)  /*(-30008) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (1702:29): [True: 0, False: 0]
  ------------------
 1703|      0|                            return ret;
 1704|      0|                        else
 1705|      0|                            return ret; /*  program error */
 1706|      0|                    }
 1707|  1.86k|                    if (ret > 0)
  ------------------
  |  Branch (1707:25): [True: 873, False: 993]
  ------------------
 1708|    873|                    {
 1709|    873|                        nTotSuccess |= 1;
 1710|    873|                        nNumAtTo1Success++;
 1711|    873|                        if (bStereoIsBetterWasSetHere || ( ret & 2 ))
  ------------------
  |  Branch (1711:29): [True: 385, False: 488]
  |  Branch (1711:58): [True: 256, False: 232]
  ------------------
 1712|    641|                        {
 1713|    641|                            CurTreeKeepLastAtomsOnly( cur_tree, tpos1, 1 );  /*  start over */
 1714|    641|                            nTotSuccess |= 2; /*  Obtained a smaller CT */
 1715|    641|                        }
 1716|    873|                    }
 1717|    993|                    else
 1718|    993|                    {
 1719|    993|                        if (bStereoIsBetterWasSetHere)
  ------------------
  |  Branch (1719:29): [True: 0, False: 993]
  ------------------
 1720|      0|                        {
 1721|      0|                            pCS->bStereoIsBetter = 0;
 1722|      0|                            pCS->LinearCTStereoCarb[nNumMappedAtoms] = prevAtom2;
 1723|      0|                        }
 1724|    993|                        bLastLvlFailed = 1;
 1725|    993|                    }
 1726|  1.86k|                    bStereoIsBetterWasSetHere = 0;
 1727|       |
 1728|       |                    /*  avoid redundant repetitions: */
 1729|       |                    /*  check if neighbors mappings have altered another stereo center parity */
 1730|  1.86k|                    if (!nSymmStereo && !might_change_other_atom_parity( at, num_atoms, at_to1,
  ------------------
  |  Branch (1730:25): [True: 0, False: 1.86k]
  |  Branch (1730:41): [True: 0, False: 0]
  ------------------
 1731|      0|                        pRankStack2[nSP[lvl]] /* ranks after neigbors mapping */,
 1732|      0|                        pRankStack2[nStackPtr[istk]] /* ranks before the mapping neighbors */ ))
 1733|      0|                    {
 1734|      0|                        goto done;
 1735|      0|                    }
 1736|  1.86k|                }
 1737|       |                /*  Continue the cycle. Go to the previous "recursion" level */
 1738|  3.93k|            backup:
 1739|  6.45k|                while (lvl-- > 0)
  ------------------
  |  Branch (1739:24): [True: 5.86k, False: 592]
  ------------------
 1740|  5.86k|                {
 1741|       |
 1742|  5.86k|                    j[lvl] ++; /*  next neighbor at this level */
 1743|  5.86k|                    if (j[lvl] < pEN[lvl].num_to)
  ------------------
  |  Branch (1743:25): [True: 3.34k, False: 2.52k]
  ------------------
 1744|  3.34k|                    {
 1745|  3.34k|                        if (bLastLvlFailed)
  ------------------
  |  Branch (1745:29): [True: 2.49k, False: 841]
  ------------------
 1746|  2.49k|                        {
 1747|  2.49k|                            if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (1747:33): [True: 2.49k, False: 0]
  ------------------
 1748|  2.49k|                                 1 == CurTreeIsLastRank( cur_tree, cr[lvl] ))
  ------------------
  |  Branch (1748:34): [True: 2.49k, False: 0]
  ------------------
 1749|  2.49k|                            {
 1750|  2.49k|                                CurTreeRemoveIfLastAtom( cur_tree, at_to[lvl] );
 1751|  2.49k|                                CurTreeRemoveLastRankIfNoAtoms( cur_tree );
 1752|  2.49k|                            }
 1753|  2.49k|                            bLastLvlFailed = 0;
 1754|  2.49k|                        }
 1755|       |                        /*  Done with this level. Go back one level */
 1756|  3.34k|                        goto next_j;
 1757|  3.34k|                    }
 1758|       |                    /*  remove failed atom from the tree */
 1759|  2.52k|                    if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (1759:25): [True: 2.52k, False: 0]
  ------------------
 1760|  2.52k|                         1 == CurTreeIsLastRank( cur_tree, cr[lvl] ))
  ------------------
  |  Branch (1760:26): [True: 2.52k, False: 0]
  ------------------
 1761|  2.52k|                    {
 1762|  2.52k|                        CurTreeRemoveLastRank( cur_tree );
 1763|  2.52k|                    }
 1764|  2.52k|                }
 1765|    592|                goto done;
 1766|  3.93k|            }
 1767|      0|            else
 1768|      0|            {
 1769|      0|                cr[lvl] = 0;
 1770|      0|            }
 1771|       |
 1772|    592|done:;      /*  at this point lvl=0. */
 1773|    592|            if (!nNumAtTo1Success)
  ------------------
  |  Branch (1773:17): [True: 49, False: 543]
  ------------------
 1774|     49|            {
 1775|     49|                if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (1775:21): [True: 45, False: 4]
  ------------------
 1776|     45|                     1 == CurTreeIsLastRank( cur_tree, at_rank_canon1 ))
  ------------------
  |  Branch (1776:22): [True: 45, False: 0]
  ------------------
 1777|     45|                {
 1778|     45|                    CurTreeRemoveIfLastAtom( cur_tree, at_to1 );
 1779|     45|                    CurTreeRemoveLastRankIfNoAtoms( cur_tree );
 1780|     45|                }
 1781|     49|            }
 1782|    592|        } /*  end of stereo atom mapping cycle */
 1783|       |
 1784|  5.37k|        if (tpos1 < CurTreeGetPos( cur_tree ) &&
  ------------------
  |  Branch (1784:13): [True: 480, False: 4.89k]
  ------------------
 1785|    480|             1 == CurTreeIsLastRank( cur_tree, at_rank_canon1 ))
  ------------------
  |  Branch (1785:14): [True: 480, False: 0]
  ------------------
 1786|    480|        {
 1787|    480|            CurTreeRemoveLastRank( cur_tree );
 1788|    480|        }
 1789|  4.89k|        else
 1790|  4.89k|        {
 1791|       |            /*  CurTree consistency check (debug only) */
 1792|  4.89k|            if (tpos1 != CurTreeGetPos( cur_tree ))
  ------------------
  |  Branch (1792:17): [True: 0, False: 4.89k]
  ------------------
 1793|      0|            {
 1794|      0|                return CT_STEREOCOUNT_ERR;  /*   <BRKPT> */
  ------------------
  |  |   29|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1795|      0|            }
 1796|  4.89k|        }
 1797|       |
 1798|  5.37k|        if (!nTotSuccess || stereo_center_parity == sb_parity_calc)
  ------------------
  |  Branch (1798:13): [True: 1.03k, False: 4.34k]
  |  Branch (1798:29): [True: 1.14k, False: 3.20k]
  ------------------
 1799|  2.17k|        {
 1800|  2.17k|            goto repeat_all; /*  repeat with next parity if no success or with the same parity, now known */
 1801|  2.17k|        }
 1802|  5.37k|    }
 1803|       |
 1804|  2.29k|    else
 1805|  2.29k|    {
 1806|       |
 1807|       |        /****************************************************
 1808|       |         *
 1809|       |         *  All stereogenic atoms and bonds have been mapped
 1810|       |         *
 1811|       |         ****************************************************/
 1812|       |
 1813|  2.29k|        if ((UserAction && USER_ACTION_QUIT == ( *UserAction )( )) ||
  ------------------
  |  |  124|      0|#define USER_ACTION_QUIT   1
  ------------------
  |  Branch (1813:14): [True: 0, False: 2.29k]
  |  Branch (1813:28): [True: 0, False: 0]
  ------------------
 1814|  2.29k|             (ConsoleQuit && ( *ConsoleQuit )( ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1814:15): [True: 0, False: 2.29k]
  |  Branch (1814:30): [True: 0, False: 0]
  ------------------
 1815|      0|        {
 1816|      0|            return CT_USER_QUIT_ERR;
  ------------------
  |  |   32|      0|#define CT_USER_QUIT_ERR     (CT_ERR_FIRST-13)  /*(-30013) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1817|      0|        }
 1818|       |
 1819|  2.29k|        if (pCS->bStereoIsBetter || pCS->bFirstCT)
  ------------------
  |  Branch (1819:13): [True: 1.04k, False: 1.25k]
  |  Branch (1819:37): [True: 971, False: 283]
  ------------------
 1820|  2.01k|        {
 1821|       |            /* All stereo atoms have been mapped. Current stereo name is better than all previous.
 1822|       |             * Create new numbering for the new CT
 1823|       |             * break all remaining "from" ties
 1824|       |             */
 1825|  2.01k|            int i1, ret;
 1826|  2.01k|            AT_RANK rc, n1, n2;
 1827|       |
 1828|  2.01k|            ret = BreakAllTies( pCG, num_at_tg, num_max, pRankStack1,
 1829|  2.01k|                              NeighList, nTempRank, pCS );
 1830|       |
 1831|  2.01k|            if (RETURNED_ERROR( ret ))
  ------------------
  |  |   44|  2.01k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  2.01k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  2.01k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  2.01k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  2.01k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  2.01k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 2.01k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 2.01k]
  |  |  ------------------
  ------------------
 1832|      0|            {
 1833|      0|                return ret;
 1834|      0|            }
 1835|       |
 1836|       |            /*  break all remaining "from" ties */
 1837|  2.01k|            ret = BreakAllTies( pCG, num_at_tg, num_max, pRankStack2,
 1838|  2.01k|                              NeighList, nTempRank, pCS );
 1839|       |
 1840|  2.01k|            if (RETURNED_ERROR( ret ))
  ------------------
  |  |   44|  2.01k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  2.01k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  2.01k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  2.01k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  2.01k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  2.01k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 2.01k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 2.01k]
  |  |  ------------------
  ------------------
 1841|      0|            {
 1842|      0|                return ret;
 1843|      0|            }
 1844|       |            /*  move stack pointers to the "nAtomNumber[*]" after all ties are broken */
 1845|  2.01k|            pRankStack1 += 2;
 1846|  2.01k|            pRankStack2 += 2;
 1847|       |            /* Now final mapping ranks of "to" atom (*pRankStack2)[i] and "from" atom (*pRankStack1)[i]
 1848|       |             * are equal and all ranks are different, that is, we have a full mapping
 1849|       |             * Copy so far best canonical numbering from "from" to "to".
 1850|       |             */
 1851|  2.01k|            memset( pCS->nPrevAtomNumber, 0, num_at_tg * sizeof( pCS->nPrevAtomNumber[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 1852|  13.9k|            for (i1 = 0; i1 < num_at_tg; i1++)
  ------------------
  |  Branch (1852:26): [True: 11.9k, False: 2.01k]
  ------------------
 1853|  11.9k|            {
 1854|  11.9k|                n1 = pRankStack1[1][i1];
 1855|  11.9k|                rc = nCanonRankFrom[n1]; /*  new canon. rank */
 1856|  11.9k|                n2 = pRankStack2[1][i1];                  /*  orig. atom number */
 1857|  11.9k|                nCanonRankTo[n2] = rc;                    /*  assign new canon. number to the atom */
 1858|       |                /*  use this array to find stereo-equivalent atoms */
 1859|  11.9k|                pCS->nPrevAtomNumber[rc - 1] = n2; /*  ord. number of the atom having canon. rank = rc */
 1860|  11.9k|                nSymmStereo[i1] = i1;            /*  restart search for stereo equivalent atoms */
 1861|       |                /* check mapping correctness */
 1862|  11.9k|                if (pRankStack1[0][n1] != pRankStack2[0][n2] ||
  ------------------
  |  Branch (1862:21): [True: 0, False: 11.9k]
  ------------------
 1863|  11.9k|                     nSymmRank[n1] != nSymmRank[n2])
  ------------------
  |  Branch (1863:22): [True: 0, False: 11.9k]
  ------------------
 1864|      0|                {
 1865|      0|                    return CT_STEREO_CANON_ERR; /* stereo mapping error */
  ------------------
  |  |   36|      0|#define CT_STEREO_CANON_ERR  (CT_ERR_FIRST-17)  /*(-30017) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1866|      0|                }
 1867|  11.9k|            }
 1868|       |            /*  statistics */
 1869|  2.01k|            pCS->lNumTotCT++;
 1870|  2.01k|            pCS->lNumEqualCT = 1;
 1871|  2.01k|            pCS->lNumDecreasedCT++;
 1872|  2.01k|            pCS->bStereoIsBetter = 0; /*  prepare to start over */
 1873|  2.01k|            nTotSuccess = 1;
 1874|  2.01k|            pCS->bFirstCT = 0;
 1875|       |
 1876|  2.01k|#if ( REMOVE_CALC_NONSTEREO == 1 ) /* { */
 1877|  2.01k|            if (!( pCS->nMode & CMODE_REDNDNT_STEREO ))
  ------------------
  |  |  776|  2.01k|#define CMODE_REDNDNT_STEREO     0x000080 /* 6-11-2002: do not check for redundant stereo elements */
  ------------------
  |  Branch (1877:17): [True: 2.01k, False: 0]
  ------------------
 1878|  2.01k|            {
 1879|  2.01k|                i1 = RemoveCalculatedNonStereo( pCG, at, num_atoms, num_at_tg,
 1880|  2.01k|                                  pRankStack1, pRankStack2, nTempRank, NeighList,
 1881|  2.01k|                                  nSymmRank, nCanonRankTo, pCS->nPrevAtomNumber, pCS,
 1882|  2.01k|                                  vABParityUnknown );
 1883|  2.01k|                if (RETURNED_ERROR( i1 ))
  ------------------
  |  |   44|  2.01k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  2.01k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  2.01k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  2.01k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  2.01k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  2.01k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 2.01k, False: 0]
  |  |  |  Branch (44:53): [True: 0, False: 2.01k]
  |  |  ------------------
  ------------------
 1884|      0|                {
 1885|      0|                    return i1;
 1886|      0|                }
 1887|  2.01k|                if (i1 < 0)
  ------------------
  |  Branch (1887:21): [True: 78, False: 1.93k]
  ------------------
 1888|     78|                {
 1889|       |#if ( bRELEASE_VERSION == 0 )
 1890|       |                    pCS->bExtract |= EXTR_REMOVE_PARITY_WARNING;
 1891|       |#endif
 1892|     78|                    i1 = -( 1 + i1 );
 1893|     78|                }
 1894|  2.01k|                if (i1 > 0)
  ------------------
  |  Branch (1894:21): [True: 171, False: 1.84k]
  ------------------
 1895|    171|                {
 1896|    171|                    return 4; /*  total restart: due to newly found stereo equivalence */
 1897|       |                              /*  the length of the stereo CT has changed */
 1898|    171|                }
 1899|  2.01k|            }
 1900|  2.01k|#endif /* } REMOVE_CALC_NONSTEREO */
 1901|       |
 1902|       |            /* djb-rwth: removing redundant code */
 1903|  2.01k|        }
 1904|    283|        else
 1905|    283|        {
 1906|       |            /*  current stereo name is same as previous. We do not need a full mapping. */
 1907|    283|            if (nSymmStereo)
  ------------------
  |  Branch (1907:17): [True: 283, False: 0]
  ------------------
 1908|    283|            {
 1909|    283|                int num_changes = 0;
 1910|    283|                AT_RANK r, n1, n2, r_max, cr;
 1911|    283|                r_max = (AT_RANK) num_at_tg;
 1912|  1.95k|                for (r = 1; r <= r_max; r++)
  ------------------
  |  Branch (1912:29): [True: 1.67k, False: 283]
  ------------------
 1913|  1.67k|                {
 1914|  1.67k|                    if (bUniqueAtNbrFromMappingRank( pRankStack1, r, &n1 ))
  ------------------
  |  Branch (1914:25): [True: 1.66k, False: 10]
  ------------------
 1915|  1.66k|                    {
 1916|  1.66k|                        if (bUniqueAtNbrFromMappingRank( pRankStack2, r, &n2 ))
  ------------------
  |  Branch (1916:29): [True: 1.66k, False: 0]
  ------------------
 1917|  1.66k|                        {
 1918|       |                            /*  atoms at[n1], at[n2] have identical untied mapping rank r */
 1919|  1.66k|                            cr = nCanonRankFrom[(int) n1] - 1; /*  (new at[n2] canonical rank)-1 */
 1920|       |                            /*  pCS->nPrevAtomNumber[(int)cr] = */
 1921|       |                            /*    previous ordering number of an atom with the canon. rank = cr+1; */
 1922|       |                            /*    make this atom equivalent to atom at[n2]: */
 1923|  1.66k|                            num_changes += nJoin2Mcrs( nSymmStereo, pCS->nPrevAtomNumber[(int) cr], n2 );
 1924|  1.66k|                        }
 1925|      0|                        else
 1926|      0|                        {
 1927|      0|                            return CT_MAPCOUNT_ERR; /*  mapping ranks must be either both tied or untied. */ /*   <BRKPT> */
  ------------------
  |  |   26|      0|#define CT_MAPCOUNT_ERR      (CT_ERR_FIRST- 7)  /*(-30007) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1928|      0|                        }
 1929|  1.66k|                    }
 1930|  1.67k|                }
 1931|    283|                if (num_changes)
  ------------------
  |  Branch (1931:21): [True: 276, False: 7]
  ------------------
 1932|    276|                { /*  compress trees to stars */
 1933|  1.63k|                    for (r = r_max - 1; r; r--)
  ------------------
  |  Branch (1933:41): [True: 1.36k, False: 276]
  ------------------
 1934|  1.36k|                    {
 1935|  1.36k|                        nGetMcr( nSymmStereo, r );
 1936|  1.36k|                    }
 1937|    276|                }
 1938|    283|            }
 1939|       |            /*  statistics */
 1940|    283|            pCS->lNumEqualCT++;
 1941|    283|            pCS->lNumTotCT++;
 1942|    283|            nTotSuccess = 1;
 1943|    283|        }
 1944|  2.12k|        if (bInchiTimeIsOver( ic, pCS->ulTimeOutTime ))
  ------------------
  |  Branch (1944:13): [True: 0, False: 2.12k]
  ------------------
 1945|      0|        {
 1946|      0|            return CT_TIMEOUT_ERR;
  ------------------
  |  |   27|      0|#define CT_TIMEOUT_ERR       (CT_ERR_FIRST- 8)  /*(-30008) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1947|      0|        }
 1948|  2.12k|    }
 1949|  5.32k|    if (!nTotSuccess && nNumMappedAtoms < pCS->nLenLinearCTStereoCarb)
  ------------------
  |  Branch (1949:9): [True: 0, False: 5.32k]
  |  Branch (1949:25): [True: 0, False: 0]
  ------------------
 1950|      0|    {
 1951|      0|        pCS->LinearCTStereoCarb[nNumMappedAtoms] = prevAtom;
 1952|      0|        CurTreeSetPos( cur_tree, tpos1 );
 1953|      0|    }
 1954|       |
 1955|  5.32k|    return nTotSuccess;  /*  return to the previous level of the recursion. */
 1956|  8.44k|}

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

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

EquString:
  524|      3|{
  525|      3|    int bFrom = EquVal & (iiSTEREO | iiSTEREO_INV | iiNUMB | iiEQU);
  ------------------
  |  |   55|      3|#define iiSTEREO      0x0001  /* stereo (sp2 or sp3)   */
  ------------------
                  int bFrom = EquVal & (iiSTEREO | iiSTEREO_INV | iiNUMB | iiEQU);
  ------------------
  |  |   56|      3|#define iiSTEREO_INV  0x0002  /* inverted stereo (sp3) */
  ------------------
                  int bFrom = EquVal & (iiSTEREO | iiSTEREO_INV | iiNUMB | iiEQU);
  ------------------
  |  |   57|      3|#define iiNUMB        0x0004  /* numbering or inverted stereo numbering */
  ------------------
                  int bFrom = EquVal & (iiSTEREO | iiSTEREO_INV | iiNUMB | iiEQU);
  ------------------
  |  |   58|      3|#define iiEQU         0x0008  /* equivalence info */
  ------------------
  526|      3|    int bType = EquVal & (iitISO | iitNONTAUT);
  ------------------
  |  |   64|      3|#define iitISO       0x0010  /* Isotopic */
  ------------------
                  int bType = EquVal & (iitISO | iitNONTAUT);
  ------------------
  |  |   65|      3|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
  527|      3|    int bEq2 = EquVal & (iiEq2NONTAUT | iiEq2ISO | iiEq2INV);
  ------------------
  |  |   71|      3|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
                  int bEq2 = EquVal & (iiEq2NONTAUT | iiEq2ISO | iiEq2INV);
  ------------------
  |  |   72|      3|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
                  int bEq2 = EquVal & (iiEq2NONTAUT | iiEq2ISO | iiEq2INV);
  ------------------
  |  |   73|      3|#define iiEq2INV     0x0100  /* equal to inverted (stereo sp3) or to numbering of inverted stereo */
  ------------------
  528|      3|    const char *r = "";
  529|       |
  530|       |#if (FIX_EMPTY_LAYER_BUG == 1)
  531|       |    int bEmpty = EquVal & iiEmpty;
  532|       |    if (bEmpty)
  533|       |    {
  534|       |        r = "e";
  535|       |        return r;
  536|       |    }
  537|       |#endif
  538|       |
  539|      3|    switch (bFrom)
  540|      3|    {
  541|       |
  542|      3|    case iiSTEREO: /* ------------ Stereo --------------------*/
  ------------------
  |  |   55|      3|#define iiSTEREO      0x0001  /* stereo (sp2 or sp3)   */
  ------------------
  |  Branch (542:5): [True: 3, False: 0]
  ------------------
  543|      3|        switch (bType)
  544|      3|        {
  545|      3|        case iitISO: /* iso main stereo =... */
  ------------------
  |  |   64|      3|#define iitISO       0x0010  /* Isotopic */
  ------------------
  |  Branch (545:9): [True: 3, False: 0]
  ------------------
  546|      3|            switch (bEq2)
  547|      3|            {
  548|      3|            case 0:
  ------------------
  |  Branch (548:13): [True: 3, False: 0]
  ------------------
  549|      3|                r = "m"; /* iso main stereo = main stereo */
  550|      3|                break;
  551|      0|            default:
  ------------------
  |  Branch (551:13): [True: 0, False: 3]
  ------------------
  552|      0|                r = "??"; /* should not happen */
  553|      0|                break;
  554|      3|            }
  555|      3|            break;
  556|      3|        case iitNONTAUT: /* non-taut stereo =... */
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
  |  Branch (556:9): [True: 0, False: 3]
  ------------------
  557|      0|            switch (bEq2)
  558|      0|            {
  559|      0|            case 0:
  ------------------
  |  Branch (559:13): [True: 0, False: 0]
  ------------------
  560|      0|                r = "m"; /* non-taut stereo = main stereo */
  561|      0|                break;
  562|      0|            default:
  ------------------
  |  Branch (562:13): [True: 0, False: 0]
  ------------------
  563|      0|                r = "??"; /* should not happen */
  564|      0|                break;
  565|      0|            }
  566|      0|            break;
  567|      0|        case (iitNONTAUT | iitISO): /* iso non-taut stereo = ... */
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
                      case (iitNONTAUT | iitISO): /* iso non-taut stereo = ... */
  ------------------
  |  |   64|      0|#define iitISO       0x0010  /* Isotopic */
  ------------------
  |  Branch (567:9): [True: 0, False: 3]
  ------------------
  568|      0|            switch (bEq2)
  569|      0|            {
  570|      0|            case 0:
  ------------------
  |  Branch (570:13): [True: 0, False: 0]
  ------------------
  571|      0|                r = "m"; /* iso non-taut stereo = main stereo */
  572|      0|                break;
  573|      0|            case iiEq2ISO:
  ------------------
  |  |   72|      0|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
  |  Branch (573:13): [True: 0, False: 0]
  ------------------
  574|      0|                r = "M"; /* iso non-taut stereo = main iso stereo */
  575|      0|                break;
  576|      0|            case iiEq2NONTAUT:
  ------------------
  |  |   71|      0|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
  |  Branch (576:13): [True: 0, False: 0]
  ------------------
  577|      0|                r = "n"; /* iso non-taut stereo = non-taut stereo */
  578|      0|                break;
  579|      0|            default:
  ------------------
  |  Branch (579:13): [True: 0, False: 0]
  ------------------
  580|      0|                r = "??"; /* should not happen */
  581|      0|                break;
  582|      0|            }
  583|      0|            break;
  584|      0|        default:
  ------------------
  |  Branch (584:9): [True: 0, False: 3]
  ------------------
  585|      0|            r = "??"; /* should not happen */
  586|      0|            break;
  587|      3|        }
  588|      3|        break;
  589|       |
  590|      3|    case iiSTEREO_INV: /*---------- Inverted Aux Stereo ------*/
  ------------------
  |  |   56|      0|#define iiSTEREO_INV  0x0002  /* inverted stereo (sp3) */
  ------------------
  |  Branch (590:5): [True: 0, False: 3]
  ------------------
  591|      0|        if (bEq2 & iiEq2INV)
  ------------------
  |  |   73|      0|#define iiEq2INV     0x0100  /* equal to inverted (stereo sp3) or to numbering of inverted stereo */
  ------------------
  |  Branch (591:13): [True: 0, False: 0]
  ------------------
  592|      0|        { /* stereo = Inverted(another stereo) */
  593|      0|            bEq2 &= ~iiEq2INV;
  ------------------
  |  |   73|      0|#define iiEq2INV     0x0100  /* equal to inverted (stereo sp3) or to numbering of inverted stereo */
  ------------------
  594|      0|            switch (bType)
  595|      0|            {
  596|      0|            case 0: /* main = ...*/
  ------------------
  |  Branch (596:13): [True: 0, False: 0]
  ------------------
  597|      0|                switch (bEq2)
  598|      0|                {
  599|      0|                case 0:
  ------------------
  |  Branch (599:17): [True: 0, False: 0]
  ------------------
  600|      0|                    r = "im"; /* main         = Inv(main) */
  601|      0|                    break;
  602|      0|                case iiEq2ISO:
  ------------------
  |  |   72|      0|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
  |  Branch (602:17): [True: 0, False: 0]
  ------------------
  603|      0|                    r = "iM"; /* main         = Inv(main iso) */
  604|      0|                    break;
  605|      0|                case iiEq2NONTAUT:
  ------------------
  |  |   71|      0|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
  |  Branch (605:17): [True: 0, False: 0]
  ------------------
  606|      0|                    r = "in"; /* maim         = Inv(non-taut) */
  607|      0|                    break;
  608|      0|                case (iiEq2NONTAUT | iiEq2ISO):
  ------------------
  |  |   71|      0|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
                              case (iiEq2NONTAUT | iiEq2ISO):
  ------------------
  |  |   72|      0|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
  |  Branch (608:17): [True: 0, False: 0]
  ------------------
  609|      0|                    r = "iN"; /* maim         = Inv(non-taut iso ) */
  610|      0|                    break;
  611|      0|                default:
  ------------------
  |  Branch (611:17): [True: 0, False: 0]
  ------------------
  612|      0|                    r = "??"; /* should not happen */
  613|      0|                    break;
  614|      0|                }
  615|      0|                break;
  616|      0|            case iitISO: /* main iso = ...*/
  ------------------
  |  |   64|      0|#define iitISO       0x0010  /* Isotopic */
  ------------------
  |  Branch (616:13): [True: 0, False: 0]
  ------------------
  617|      0|                switch (bEq2)
  618|      0|                {
  619|      0|                case 0:
  ------------------
  |  Branch (619:17): [True: 0, False: 0]
  ------------------
  620|      0|                    r = "im"; /* main iso     = Inv(main) */
  621|      0|                    break;
  622|      0|                case iiEq2ISO:
  ------------------
  |  |   72|      0|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
  |  Branch (622:17): [True: 0, False: 0]
  ------------------
  623|      0|                    r = "iM"; /* main iso     = Inv(main iso) */
  624|      0|                    break;
  625|      0|                case iiEq2NONTAUT:
  ------------------
  |  |   71|      0|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
  |  Branch (625:17): [True: 0, False: 0]
  ------------------
  626|      0|                    r = "in"; /* maim iso     = Inv(non-taut) */
  627|      0|                    break;
  628|      0|                case (iiEq2NONTAUT | iiEq2ISO):
  ------------------
  |  |   71|      0|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
                              case (iiEq2NONTAUT | iiEq2ISO):
  ------------------
  |  |   72|      0|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
  |  Branch (628:17): [True: 0, False: 0]
  ------------------
  629|      0|                    r = "iN"; /* maim         = Inv(non-taut iso ) */
  630|      0|                    break;
  631|      0|                default:
  ------------------
  |  Branch (631:17): [True: 0, False: 0]
  ------------------
  632|      0|                    r = "??"; /* should not happen */
  633|      0|                    break;
  634|      0|                }
  635|      0|                break;
  636|      0|            case iitNONTAUT: /* non-taut = ... */
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
  |  Branch (636:13): [True: 0, False: 0]
  ------------------
  637|      0|                switch (bEq2)
  638|      0|                {
  639|      0|                case 0:
  ------------------
  |  Branch (639:17): [True: 0, False: 0]
  ------------------
  640|      0|                    r = "im"; /* non-taut     = Inv(main) */
  641|      0|                    break;
  642|      0|                case iiEq2ISO:
  ------------------
  |  |   72|      0|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
  |  Branch (642:17): [True: 0, False: 0]
  ------------------
  643|      0|                    r = "iM"; /* non-taut     = Inv(main iso) */
  644|      0|                    break;
  645|      0|                case iiEq2NONTAUT:
  ------------------
  |  |   71|      0|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
  |  Branch (645:17): [True: 0, False: 0]
  ------------------
  646|      0|                    r = "in"; /* non-taut     = Inv(non-taut) */
  647|      0|                    break;
  648|      0|                case (iiEq2NONTAUT | iiEq2ISO):
  ------------------
  |  |   71|      0|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
                              case (iiEq2NONTAUT | iiEq2ISO):
  ------------------
  |  |   72|      0|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
  |  Branch (648:17): [True: 0, False: 0]
  ------------------
  649|      0|                    r = "iN"; /* non-taut     = Inv(non-taut iso ) */
  650|      0|                    break;
  651|      0|                default:
  ------------------
  |  Branch (651:17): [True: 0, False: 0]
  ------------------
  652|      0|                    r = "??"; /* should not happen */
  653|      0|                    break;
  654|      0|                }
  655|      0|                break;
  656|      0|            case (iitNONTAUT | iitISO):
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
                          case (iitNONTAUT | iitISO):
  ------------------
  |  |   64|      0|#define iitISO       0x0010  /* Isotopic */
  ------------------
  |  Branch (656:13): [True: 0, False: 0]
  ------------------
  657|      0|                switch (bEq2)
  658|      0|                {
  659|      0|                case 0:
  ------------------
  |  Branch (659:17): [True: 0, False: 0]
  ------------------
  660|      0|                    r = "im"; /* non-taut iso = Inv(main) */
  661|      0|                    break;
  662|      0|                case iiEq2ISO:
  ------------------
  |  |   72|      0|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
  |  Branch (662:17): [True: 0, False: 0]
  ------------------
  663|      0|                    r = "iM"; /* non-taut iso = Inv(main iso) */
  664|      0|                    break;
  665|      0|                case iiEq2NONTAUT:
  ------------------
  |  |   71|      0|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
  |  Branch (665:17): [True: 0, False: 0]
  ------------------
  666|      0|                    r = "in"; /* non-taut iso = Inv(non-taut) */
  667|      0|                    break;
  668|      0|                case (iiEq2NONTAUT | iiEq2ISO):
  ------------------
  |  |   71|      0|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
                              case (iiEq2NONTAUT | iiEq2ISO):
  ------------------
  |  |   72|      0|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
  |  Branch (668:17): [True: 0, False: 0]
  ------------------
  669|      0|                    r = "iN"; /* non-taut iso = Inv(non-taut iso ) */
  670|      0|                    break;
  671|      0|                default:
  ------------------
  |  Branch (671:17): [True: 0, False: 0]
  ------------------
  672|      0|                    r = "??"; /* should not happen */
  673|      0|                }
  674|      0|                break;
  675|      0|            default:
  ------------------
  |  Branch (675:13): [True: 0, False: 0]
  ------------------
  676|      0|                r = "??"; /* should not happen */
  677|      0|                break;
  678|      0|            }
  679|      0|        }
  680|      0|        else
  681|      0|        { /* Inv stereo = another (non-inverted) stereo */
  682|       |
  683|      0|            switch (bType)
  684|      0|            {
  685|      0|            case iitISO: /* main iso = ...*/
  ------------------
  |  |   64|      0|#define iitISO       0x0010  /* Isotopic */
  ------------------
  |  Branch (685:13): [True: 0, False: 0]
  ------------------
  686|      0|                switch (bEq2)
  687|      0|                {
  688|      0|                case 0:
  ------------------
  |  Branch (688:17): [True: 0, False: 0]
  ------------------
  689|      0|                    r = "m"; /* main         = (inverted aux) main */
  690|      0|                    break;
  691|      0|                default:
  ------------------
  |  Branch (691:17): [True: 0, False: 0]
  ------------------
  692|      0|                    r = "??"; /* should not happen */
  693|      0|                    break;
  694|      0|                }
  695|      0|                break;
  696|      0|            case iitNONTAUT: /* non-taut = ... */
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
  |  Branch (696:13): [True: 0, False: 0]
  ------------------
  697|      0|                switch (bEq2)
  698|      0|                {
  699|      0|                case 0:
  ------------------
  |  Branch (699:17): [True: 0, False: 0]
  ------------------
  700|      0|                    r = "m"; /* non-taut     = (inverted aux) main */
  701|      0|                    break;
  702|      0|                default:
  ------------------
  |  Branch (702:17): [True: 0, False: 0]
  ------------------
  703|      0|                    r = "??"; /* should not happen */
  704|      0|                    break;
  705|      0|                }
  706|      0|                break;
  707|      0|            case (iitNONTAUT | iitISO): /* non-taut iso = ...*/
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
                          case (iitNONTAUT | iitISO): /* non-taut iso = ...*/
  ------------------
  |  |   64|      0|#define iitISO       0x0010  /* Isotopic */
  ------------------
  |  Branch (707:13): [True: 0, False: 0]
  ------------------
  708|      0|                switch (bEq2)
  709|      0|                {
  710|      0|                case 0:
  ------------------
  |  Branch (710:17): [True: 0, False: 0]
  ------------------
  711|      0|                    r = "m"; /* non-taut iso  = (inverted aux) main */
  712|      0|                    break;
  713|      0|                case iiEq2ISO:
  ------------------
  |  |   72|      0|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
  |  Branch (713:17): [True: 0, False: 0]
  ------------------
  714|      0|                    r = "M"; /* non-taut iso  = (inverted aux) main iso */
  715|      0|                    break;
  716|      0|                case iiEq2NONTAUT:
  ------------------
  |  |   71|      0|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
  |  Branch (716:17): [True: 0, False: 0]
  ------------------
  717|      0|                    r = "n"; /* non-taut iso  = (inverted aux) non-taut */
  718|      0|                    break;
  719|      0|                default:
  ------------------
  |  Branch (719:17): [True: 0, False: 0]
  ------------------
  720|      0|                    r = "??"; /* should not happen */
  721|      0|                    break;
  722|      0|                }
  723|      0|                break;
  724|      0|            default:
  ------------------
  |  Branch (724:13): [True: 0, False: 0]
  ------------------
  725|      0|                r = "??"; /* should not happen */
  726|      0|                break;
  727|      0|            }
  728|      0|        }
  729|      0|        break;
  730|       |
  731|      0|    case (iiNUMB | iiSTEREO_INV): /*------------- Inv Stereo Numbering ------------*/
  ------------------
  |  |   57|      0|#define iiNUMB        0x0004  /* numbering or inverted stereo numbering */
  ------------------
                  case (iiNUMB | iiSTEREO_INV): /*------------- Inv Stereo Numbering ------------*/
  ------------------
  |  |   56|      0|#define iiSTEREO_INV  0x0002  /* inverted stereo (sp3) */
  ------------------
  |  Branch (731:5): [True: 0, False: 3]
  ------------------
  732|      0|        switch (bType)
  733|      0|        {
  734|      0|        case 0: /* inv stereo numb main = ...*/
  ------------------
  |  Branch (734:9): [True: 0, False: 0]
  ------------------
  735|      0|            switch (bEq2)
  736|      0|            {
  737|      0|            case 0:
  ------------------
  |  Branch (737:13): [True: 0, False: 0]
  ------------------
  738|      0|                r = "m"; /* inv stereo numb main     = main numb */
  739|      0|                break;
  740|      0|            default:
  ------------------
  |  Branch (740:13): [True: 0, False: 0]
  ------------------
  741|      0|                r = "??"; /* should not happen */
  742|      0|                break;
  743|      0|            }
  744|      0|            break;
  745|      0|        case iitISO: /* inv stereo iso numb main = ...*/
  ------------------
  |  |   64|      0|#define iitISO       0x0010  /* Isotopic */
  ------------------
  |  Branch (745:9): [True: 0, False: 0]
  ------------------
  746|      0|            switch (bEq2)
  747|      0|            {
  748|      0|            case 0:
  ------------------
  |  Branch (748:13): [True: 0, False: 0]
  ------------------
  749|      0|                r = "m"; /* inv stereo iso numb main = main numb  */
  750|      0|                break;
  751|      0|            case iiEq2INV:
  ------------------
  |  |   73|      0|#define iiEq2INV     0x0100  /* equal to inverted (stereo sp3) or to numbering of inverted stereo */
  ------------------
  |  Branch (751:13): [True: 0, False: 0]
  ------------------
  752|      0|                r = "im"; /* inv stereo iso numb main = InvStereo(main) numb */
  753|      0|                break;
  754|      0|            case iiEq2ISO:
  ------------------
  |  |   72|      0|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
  |  Branch (754:13): [True: 0, False: 0]
  ------------------
  755|      0|                r = "M"; /* inv stereo iso numb main = isotopic main numb */
  756|      0|                break;
  757|      0|            default:
  ------------------
  |  Branch (757:13): [True: 0, False: 0]
  ------------------
  758|      0|                r = "??"; /* should not happen */
  759|      0|                break;
  760|      0|            }
  761|      0|            break;
  762|      0|        case iitNONTAUT: /* inv stereo numb non-taut = ... */
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
  |  Branch (762:9): [True: 0, False: 0]
  ------------------
  763|      0|            switch (bEq2)
  764|      0|            {
  765|      0|            case 0:
  ------------------
  |  Branch (765:13): [True: 0, False: 0]
  ------------------
  766|      0|                r = "m"; /* inv stereo numb non-taut = main numb */
  767|      0|                break;
  768|      0|            case iiEq2NONTAUT:
  ------------------
  |  |   71|      0|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
  |  Branch (768:13): [True: 0, False: 0]
  ------------------
  769|      0|                r = "n"; /* inv stereo numb non-taut = non-taut numb */
  770|      0|                break;
  771|      0|            case iiEq2INV:
  ------------------
  |  |   73|      0|#define iiEq2INV     0x0100  /* equal to inverted (stereo sp3) or to numbering of inverted stereo */
  ------------------
  |  Branch (771:13): [True: 0, False: 0]
  ------------------
  772|      0|                r = "im"; /* inv stereo numb non-taut =  InvStereo(main) numb  */
  773|      0|                break;
  774|      0|            default:
  ------------------
  |  Branch (774:13): [True: 0, False: 0]
  ------------------
  775|      0|                r = "??"; /* should not happen */
  776|      0|                break;
  777|      0|            }
  778|      0|            break;
  779|      0|        case (iitNONTAUT | iitISO): /* inv stereo numb non-taut iso = ... */
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
                      case (iitNONTAUT | iitISO): /* inv stereo numb non-taut iso = ... */
  ------------------
  |  |   64|      0|#define iitISO       0x0010  /* Isotopic */
  ------------------
  |  Branch (779:9): [True: 0, False: 0]
  ------------------
  780|      0|            switch (bEq2)
  781|      0|            {
  782|      0|            case 0:
  ------------------
  |  Branch (782:13): [True: 0, False: 0]
  ------------------
  783|      0|                r = "m"; /* inv stereo numb non-taut iso = main numb */
  784|      0|                break;
  785|      0|            case iiEq2ISO:
  ------------------
  |  |   72|      0|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
  |  Branch (785:13): [True: 0, False: 0]
  ------------------
  786|      0|                r = "M"; /* inv stereo numb non-taut iso = main numb iso */
  787|      0|                break;
  788|      0|            case (iiEq2ISO | iiEq2INV):
  ------------------
  |  |   72|      0|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
                          case (iiEq2ISO | iiEq2INV):
  ------------------
  |  |   73|      0|#define iiEq2INV     0x0100  /* equal to inverted (stereo sp3) or to numbering of inverted stereo */
  ------------------
  |  Branch (788:13): [True: 0, False: 0]
  ------------------
  789|      0|                r = "iM"; /* inv stereo numb non-taut iso = InvStereo(main iso) numb */
  790|      0|                break;
  791|      0|            case iiEq2NONTAUT:
  ------------------
  |  |   71|      0|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
  |  Branch (791:13): [True: 0, False: 0]
  ------------------
  792|      0|                r = "n"; /* inv stereo numb non-taut iso = non-taut numb */
  793|      0|                break;
  794|      0|            case (iiEq2NONTAUT | iiEq2ISO):
  ------------------
  |  |   71|      0|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
                          case (iiEq2NONTAUT | iiEq2ISO):
  ------------------
  |  |   72|      0|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
  |  Branch (794:13): [True: 0, False: 0]
  ------------------
  795|      0|                r = "N"; /* inv stereo numb non-taut iso = non-taut iso numb */
  796|      0|                break;
  797|      0|            case iiEq2INV:
  ------------------
  |  |   73|      0|#define iiEq2INV     0x0100  /* equal to inverted (stereo sp3) or to numbering of inverted stereo */
  ------------------
  |  Branch (797:13): [True: 0, False: 0]
  ------------------
  798|      0|                r = "im"; /* inv stereo numb non-taut iso = InvStereo(main) numb */
  799|      0|                break;
  800|      0|            case (iiEq2NONTAUT | iiEq2INV):
  ------------------
  |  |   71|      0|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
                          case (iiEq2NONTAUT | iiEq2INV):
  ------------------
  |  |   73|      0|#define iiEq2INV     0x0100  /* equal to inverted (stereo sp3) or to numbering of inverted stereo */
  ------------------
  |  Branch (800:13): [True: 0, False: 0]
  ------------------
  801|      0|                r = "in"; /* inv stereo numb non-taut iso = InvStereo(non-taut) numb ) */
  802|      0|                break;
  803|      0|            default:
  ------------------
  |  Branch (803:13): [True: 0, False: 0]
  ------------------
  804|      0|                r = "??"; /* should not happen  */
  805|      0|                break;
  806|      0|            }
  807|      0|            break;
  808|      0|        default:
  ------------------
  |  Branch (808:9): [True: 0, False: 0]
  ------------------
  809|      0|            r = "??"; /* should not happen */
  810|      0|            break;
  811|      0|        }
  812|      0|        break;
  813|       |
  814|      0|    case iiNUMB: /*------------- Canonical Numbering ------------*/
  ------------------
  |  |   57|      0|#define iiNUMB        0x0004  /* numbering or inverted stereo numbering */
  ------------------
  |  Branch (814:5): [True: 0, False: 3]
  ------------------
  815|      0|        switch (bType)
  816|      0|        {
  817|      0|        case 0:       /* numb main = ...*/
  ------------------
  |  Branch (817:9): [True: 0, False: 0]
  ------------------
  818|      0|            r = "??"; /* should not happen */
  819|      0|            break;
  820|      0|        case iitISO: /* iso numb main = ...*/
  ------------------
  |  |   64|      0|#define iitISO       0x0010  /* Isotopic */
  ------------------
  |  Branch (820:9): [True: 0, False: 0]
  ------------------
  821|      0|            switch (bEq2)
  822|      0|            {
  823|      0|            case 0:
  ------------------
  |  Branch (823:13): [True: 0, False: 0]
  ------------------
  824|      0|                r = "m"; /* iso numb main = main numb  */
  825|      0|                break;
  826|      0|            default:
  ------------------
  |  Branch (826:13): [True: 0, False: 0]
  ------------------
  827|      0|                r = "??"; /* should not happen */
  828|      0|            }
  829|      0|            break;
  830|      0|        case iitNONTAUT: /* numb non-taut = ... */
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
  |  Branch (830:9): [True: 0, False: 0]
  ------------------
  831|      0|            switch (bEq2)
  832|      0|            {
  833|      0|            case 0:
  ------------------
  |  Branch (833:13): [True: 0, False: 0]
  ------------------
  834|      0|                r = "m"; /* numb non-taut = main numb */
  835|      0|                break;
  836|      0|            default:
  ------------------
  |  Branch (836:13): [True: 0, False: 0]
  ------------------
  837|      0|                r = "??"; /* should not happen */
  838|      0|            }
  839|      0|            break;
  840|      0|        case (iitNONTAUT | iitISO): /* numb non-taut iso = ... */
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
                      case (iitNONTAUT | iitISO): /* numb non-taut iso = ... */
  ------------------
  |  |   64|      0|#define iitISO       0x0010  /* Isotopic */
  ------------------
  |  Branch (840:9): [True: 0, False: 0]
  ------------------
  841|      0|            switch (bEq2)
  842|      0|            {
  843|      0|            case 0:
  ------------------
  |  Branch (843:13): [True: 0, False: 0]
  ------------------
  844|      0|                r = "m"; /* numb non-taut iso = main numb */
  845|      0|                break;
  846|      0|            case iiEq2ISO:
  ------------------
  |  |   72|      0|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
  |  Branch (846:13): [True: 0, False: 0]
  ------------------
  847|      0|                r = "M"; /* numb non-taut iso = main numb iso */
  848|      0|                break;
  849|      0|            case iiEq2NONTAUT:
  ------------------
  |  |   71|      0|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
  |  Branch (849:13): [True: 0, False: 0]
  ------------------
  850|      0|                r = "n"; /* numb non-taut iso = non-taut numb */
  851|      0|                break;
  852|      0|            default:
  ------------------
  |  Branch (852:13): [True: 0, False: 0]
  ------------------
  853|      0|                r = "??"; /* should not happen */
  854|      0|                break;
  855|      0|            }
  856|      0|            break;
  857|      0|        default:
  ------------------
  |  Branch (857:9): [True: 0, False: 0]
  ------------------
  858|      0|            r = "??"; /* should not happen */
  859|      0|            break;
  860|      0|        }
  861|      0|        break;
  862|       |
  863|      0|    case iiEQU: /*------------- Atom Equivalence ------------*/
  ------------------
  |  |   58|      0|#define iiEQU         0x0008  /* equivalence info */
  ------------------
  |  Branch (863:5): [True: 0, False: 3]
  ------------------
  864|      0|        switch (bType)
  865|      0|        {
  866|      0|        case 0:       /* equivalence main = ...*/
  ------------------
  |  Branch (866:9): [True: 0, False: 0]
  ------------------
  867|      0|            r = "??"; /* should not happen */
  868|      0|            break;
  869|      0|        case iitISO: /* equivalence main iso = ...*/
  ------------------
  |  |   64|      0|#define iitISO       0x0010  /* Isotopic */
  ------------------
  |  Branch (869:9): [True: 0, False: 0]
  ------------------
  870|      0|            switch (bEq2)
  871|      0|            {
  872|      0|            case 0:
  ------------------
  |  Branch (872:13): [True: 0, False: 0]
  ------------------
  873|      0|                r = "m"; /* equivalence main = main equ  */
  874|      0|                break;
  875|      0|            default:
  ------------------
  |  Branch (875:13): [True: 0, False: 0]
  ------------------
  876|      0|                r = "??"; /* should not happen */
  877|      0|                break;
  878|      0|            }
  879|      0|            break;
  880|      0|        case iitNONTAUT: /* equivalence non-taut = ... */
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
  |  Branch (880:9): [True: 0, False: 0]
  ------------------
  881|      0|            switch (bEq2)
  882|      0|            {
  883|      0|            case 0:
  ------------------
  |  Branch (883:13): [True: 0, False: 0]
  ------------------
  884|      0|                r = "m"; /* equivalence non-taut = main equ */
  885|      0|                break;
  886|      0|            default:
  ------------------
  |  Branch (886:13): [True: 0, False: 0]
  ------------------
  887|      0|                r = "??"; /* should not happen */
  888|      0|                break;
  889|      0|            }
  890|      0|            break;
  891|      0|        case (iitNONTAUT | iitISO): /*  equivalence non-taut iso = ... */
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
                      case (iitNONTAUT | iitISO): /*  equivalence non-taut iso = ... */
  ------------------
  |  |   64|      0|#define iitISO       0x0010  /* Isotopic */
  ------------------
  |  Branch (891:9): [True: 0, False: 0]
  ------------------
  892|      0|            switch (bEq2)
  893|      0|            {
  894|      0|            case 0:
  ------------------
  |  Branch (894:13): [True: 0, False: 0]
  ------------------
  895|      0|                r = "m"; /* equivalence non-taut iso = main equ */
  896|      0|                break;
  897|      0|            case iiEq2ISO:
  ------------------
  |  |   72|      0|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
  |  Branch (897:13): [True: 0, False: 0]
  ------------------
  898|      0|                r = "M"; /* equivalence non-taut iso = main iso equ */
  899|      0|                break;
  900|      0|            case iiEq2NONTAUT:
  ------------------
  |  |   71|      0|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
  |  Branch (900:13): [True: 0, False: 0]
  ------------------
  901|      0|                r = "n"; /* equivalence non-taut iso = non-taut equ */
  902|      0|                break;
  903|      0|            default:
  ------------------
  |  Branch (903:13): [True: 0, False: 0]
  ------------------
  904|      0|                r = "??"; /* should not happen */
  905|      0|                break;
  906|      0|            }
  907|      0|            break;
  908|      0|        default:
  ------------------
  |  Branch (908:9): [True: 0, False: 0]
  ------------------
  909|      0|            r = "??"; /* should not happen */
  910|      0|            break;
  911|      0|        }
  912|      0|        break;
  913|      0|    default:
  ------------------
  |  Branch (913:5): [True: 0, False: 3]
  ------------------
  914|      0|        r = "??"; /* should not happen */
  915|      0|        break;
  916|      3|    }
  917|      3|    return r;
  918|      3|}
OutputINChI2:
  943|  5.02k|{
  944|  5.02k|    int bINChIOutputOptions0 = bINChIOutputOptions & ~(INCHI_OUT_PLAIN_TEXT | INCHI_OUT_PLAIN_TEXT_COMMENTS);
  ------------------
  |  |  135|  5.02k|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  ------------------
                  int bINChIOutputOptions0 = bINChIOutputOptions & ~(INCHI_OUT_PLAIN_TEXT | INCHI_OUT_PLAIN_TEXT_COMMENTS);
  ------------------
  |  |  136|  5.02k|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  ------------------
  945|  5.02k|    int bINChIOutputOptionsCur;
  946|  5.02k|    int bCurOption, ret, i;
  947|       |
  948|  5.02k|    ret = 0;
  949|       |
  950|  20.1k|    for (i = 0; i < 3; i++)
  ------------------
  |  Branch (950:17): [True: 15.0k, False: 5.02k]
  ------------------
  951|  15.0k|    {
  952|  15.0k|        switch (i)
  953|  15.0k|        {
  954|  5.02k|        case 1:
  ------------------
  |  Branch (954:9): [True: 5.02k, False: 10.0k]
  ------------------
  955|  5.02k|            bCurOption = INCHI_OUT_PLAIN_TEXT;
  ------------------
  |  |  135|  5.02k|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  ------------------
  956|  5.02k|            break;
  957|  5.02k|        case 2:
  ------------------
  |  Branch (957:9): [True: 5.02k, False: 10.0k]
  ------------------
  958|  5.02k|            bCurOption = INCHI_OUT_PLAIN_TEXT_COMMENTS;
  ------------------
  |  |  136|  5.02k|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  ------------------
  959|  5.02k|            break;
  960|  5.02k|        default:
  ------------------
  |  Branch (960:9): [True: 5.02k, False: 10.0k]
  ------------------
  961|  5.02k|            continue;
  962|  15.0k|        }
  963|  10.0k|        if (bINChIOutputOptions & bCurOption)
  ------------------
  |  Branch (963:13): [True: 5.02k, False: 5.02k]
  ------------------
  964|  5.02k|        {
  965|  5.02k|            bINChIOutputOptionsCur = bINChIOutputOptions0 | bCurOption;
  966|  5.02k|            if (i != 1)
  ------------------
  |  Branch (966:17): [True: 0, False: 5.02k]
  ------------------
  967|      0|            {
  968|      0|                bINChIOutputOptionsCur &= ~INCHI_OUT_TABBED_OUTPUT;
  ------------------
  |  |  139|      0|#define INCHI_OUT_TABBED_OUTPUT         0x0400   /* tab-delimited (only for plain text)     */
  ------------------
  969|      0|            }
  970|  5.02k|            ret |= OutputINChI1(pCG,
  971|  5.02k|                                strbuf,
  972|  5.02k|                                pINChISortTautAndNonTaut2,
  973|  5.02k|                                INCHI_basic_or_INCHI_reconnected,
  974|  5.02k|                                orig_inp_data,
  975|  5.02k|                                pOrigStruct,
  976|  5.02k|                                ip,
  977|  5.02k|                                bDisconnectedCoord,
  978|  5.02k|                                bOutputType,
  979|  5.02k|                                bINChIOutputOptionsCur,
  980|  5.02k|                                num_components2,
  981|  5.02k|                                num_non_taut2,
  982|  5.02k|                                num_taut2,
  983|  5.02k|                                output_file,
  984|  5.02k|                                log_file,
  985|  5.02k|                                num_input_struct,
  986|  5.02k|                                pSortPrintINChIFlags,
  987|  5.02k|                                save_opt_bits);
  988|  5.02k|        }
  989|  10.0k|    }
  990|       |
  991|  5.02k|    return ret;
  992|  5.02k|}
OutputINChI1:
 1035|  5.02k|{
 1036|  5.02k|    INCHI_OUT_CTL io;
 1037|       |    /*
 1038|       |        bINChIOutputOptions bits:
 1039|       |          INCHI_OUT_NO_AUX_INFO           0x0001    do not output Aux Info
 1040|       |          INCHI_OUT_SHORT_AUX_INFO        0x0002    output short version of Aux Info
 1041|       |          INCHI_OUT_ONLY_AUX_INFO         0x0004    output only Aux Info
 1042|       |          INCHI_OUT_EMBED_REC             0x0008    embed reconnected INChI into disconnected INChI
 1043|       |
 1044|       |        bOutputType =
 1045|       |         TAUT_YES  => tautomeric only (if no tautomeric components then no output;
 1046|       |         TAUT_NON  => only non-tautomeric output (if no non-taut present then no output;
 1047|       |         TAUT_BOTH => tautomeric and non-tautomeric
 1048|       |    */
 1049|  5.02k|    int i, j, ii, jj, /*ii2, jj2,*/ bEmbeddedOutputCalled = 0;
 1050|  5.02k|    int bTautIsoHNum, bTautIsoAt, bHasIsotopicAtoms[TAUT_NUM];
 1051|  5.02k|    int bStereoSp2[TAUT_NUM], bStereoSp3[TAUT_NUM];
 1052|  5.02k|    int bIsotopicStereoSp2[TAUT_NUM], bIsotopicStereoSp3[TAUT_NUM];
 1053|  5.02k|    int bStereoAbsInverted[TAUT_NUM], bIsotopicStereoAbsInverted[TAUT_NUM];
 1054|  5.02k|    int bStereoAbs[TAUT_NUM], bIsotopicStereoAbs[TAUT_NUM];
 1055|  5.02k|    int bTautomericAcid, bHardAddRemProton;
 1056|  5.02k|    int bRequestedRacemicStereo = 0, bRequestedRelativeStereo = 0;
 1057|  5.02k|    int npass = 0; /* djb-rwth: removing redundant variables */
 1058|  5.02k|    int is_molecular_inorganic = 0;
 1059|       |
 1060|  5.02k|    INCHI_SORT *is, *is2;
 1061|  5.02k|    INChI *pINChI /*, *pINChI2*/;
 1062|  5.02k|    INChI_Aux *pINChI_Aux = NULL;
 1063|       |
 1064|  5.02k|    int ret = 0; /*  0 failed, 1 success */
 1065|  5.02k|    int intermediate_result = 0;
 1066|  5.02k|    int then_goto_repeat = 0;
 1067|       |    /* djb-rwth: removing redundant variables */
 1068|  5.02k|    int bHasIsoH;
 1069|       |    /* djb-rwth: removing redundant variables */
 1070|  5.02k|    int bTautAndNonTaut, bTautIsNonTaut;
 1071|  5.02k|    int nAtomsAllComp1, nAtomsAllComp2; /* v. 1.05 Total atoms in all components */
 1072|       |
 1073|  5.02k|    int bPlainText = 0 != (bINChIOutputOptions & (INCHI_OUT_PLAIN_TEXT | INCHI_OUT_PLAIN_TEXT_COMMENTS));
  ------------------
  |  |  135|  5.02k|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  ------------------
                  int bPlainText = 0 != (bINChIOutputOptions & (INCHI_OUT_PLAIN_TEXT | INCHI_OUT_PLAIN_TEXT_COMMENTS));
  ------------------
  |  |  136|  5.02k|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  ------------------
 1074|  5.02k|    int bPlainTextCommnts = 0 != (bINChIOutputOptions & INCHI_OUT_PLAIN_TEXT_COMMENTS);
  ------------------
  |  |  136|  5.02k|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  ------------------
 1075|       |
 1076|  5.02k|    char *pLF, *pTAB;
 1077|       |#ifdef TARGET_LIB_FOR_WINCHI
 1078|       |    int silent = 1;
 1079|       |#endif
 1080|       |
 1081|  5.02k|    int bFixTranspChargeBug = 0;
 1082|  5.02k|#if (FIX_TRANSPOSITION_CHARGE_BUG == 1) /* 2008-01-02 */
 1083|  5.02k|    if (INCHI_OUT_FIX_TRANSPOSITION_CHARGE_BUG & bINChIOutputOptions)
  ------------------
  |  |  143|  5.02k|#define INCHI_OUT_FIX_TRANSPOSITION_CHARGE_BUG 0x2000
  ------------------
  |  Branch (1083:9): [True: 5.02k, False: 0]
  ------------------
 1084|  5.02k|        bFixTranspChargeBug = 1;
 1085|  5.02k|#endif
 1086|       |
 1087|  5.02k|    io.bAbcNumbers = ip->bAbcNumbers;
 1088|       |
 1089|  5.02k|    io.ATOM_MODE = ((io.bAbcNumbers ? CT_MODE_ABC_NUMBERS : 0) | CT_MODE_ATOM_COUNTS | CT_MODE_NO_ORPHANS
  ------------------
  |  |   26|      0|#define CT_MODE_ABC_NUMBERS       2
  ------------------
                  io.ATOM_MODE = ((io.bAbcNumbers ? CT_MODE_ABC_NUMBERS : 0) | CT_MODE_ATOM_COUNTS | CT_MODE_NO_ORPHANS
  ------------------
  |  |   27|  5.02k|#define CT_MODE_ATOM_COUNTS       4
  ------------------
                  io.ATOM_MODE = ((io.bAbcNumbers ? CT_MODE_ABC_NUMBERS : 0) | CT_MODE_ATOM_COUNTS | CT_MODE_NO_ORPHANS
  ------------------
  |  |   25|  5.02k|#define CT_MODE_NO_ORPHANS        1 /* no orphans, that CT should have only atoms with neighbors */
  ------------------
  |  Branch (1089:22): [True: 0, False: 5.02k]
  ------------------
 1090|  5.02k|#if (EQL_H_NUM_TOGETHER == 1)
 1091|  5.02k|                    | CT_MODE_EQL_H_TOGETHER
  ------------------
  |  |   29|  5.02k|#define CT_MODE_EQL_H_TOGETHER   16
  ------------------
 1092|  5.02k|#endif
 1093|  5.02k|#if (ABC_CT_NUM_CLOSURES == 1)
 1094|  5.02k|                    | (io.bAbcNumbers && ip->bCtPredecessors ? CT_MODE_ABC_NUM_CLOSURES : 0)
  ------------------
  |  |   30|      0|#define CT_MODE_ABC_NUM_CLOSURES 32 /* in CT_MODE_ABC_NUMBERS output AB1AC2AB instead of AB-AC-A-B */
  ------------------
  |  Branch (1094:24): [True: 0, False: 5.02k]
  |  Branch (1094:42): [True: 0, False: 0]
  ------------------
 1095|  5.02k|#endif
 1096|  5.02k|                    | (ip->bCtPredecessors ? CT_MODE_PREDECESSORS : 0));
  ------------------
  |  |   28|      0|#define CT_MODE_PREDECESSORS      8
  ------------------
  |  Branch (1096:24): [True: 0, False: 5.02k]
  ------------------
 1097|       |
 1098|  5.02k|    io.TAUT_MODE = (io.bAbcNumbers ? CT_MODE_ABC_NUMBERS : 0);
  ------------------
  |  |   26|      0|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (1098:21): [True: 0, False: 5.02k]
  ------------------
 1099|  5.02k|    io.pSortPrintINChIFlags = pSortPrintINChIFlags;
 1100|  5.02k|    io.num_components = num_components2[INCHI_basic_or_INCHI_reconnected];
 1101|  5.02k|    io.pINChISortTautAndNonTaut = pINChISortTautAndNonTaut2[INCHI_basic_or_INCHI_reconnected];
 1102|  5.02k|    io.pINChISort = io.pINChISortTautAndNonTaut[TAUT_YES];
  ------------------
  |  |  575|  5.02k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1103|  5.02k|    io.pINChISort2 = io.pINChISortTautAndNonTaut[TAUT_YES];
  ------------------
  |  |  575|  5.02k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1104|  5.02k|    io.bAlways = 0;
 1105|  5.02k|    io.bUseMulipliers = 1;
 1106|  5.02k|    io.bOmitRepetitions = 1;
 1107|  5.02k|    io.bPlainTextTags = 2;        /* 0 => no plain tags, 1=> plain text tags, 2=>plaintext tags without consecutive // */
 1108|  5.02k|    io.bOutputType = bOutputType; /* remains constant */
 1109|  5.02k|    io.bOutType = bOutputType;    /* will change! */
 1110|  5.02k|    io.bOverflow = 0;
 1111|  5.02k|    io.bSecondNonTautPass = 0;
 1112|  5.02k|    io.bNonTautIsoIdentifierNotEmpty = 0;
 1113|  5.02k|    io.bNonTautNonIsoIdentifierNotEmpty = 0;
 1114|  5.02k|    io.bNonTautIsIdenticalToTaut = 1;
 1115|  5.02k|    io.bFhTag = 0;
 1116|  5.02k|    io.nTag = bPlainTextCommnts ? 3 : bPlainText ? 2
  ------------------
  |  Branch (1116:15): [True: 0, False: 5.02k]
  |  Branch (1116:39): [True: 5.02k, False: 0]
  ------------------
 1117|  5.02k|                                                 : 0; /* tag type */
 1118|       |
 1119|  5.02k|    if (NULL == orig_inp_data)
  ------------------
  |  Branch (1119:9): [True: 5.02k, False: 0]
  ------------------
 1120|  5.02k|    {
 1121|       |        /*intermediate_result = 1;
 1122|       |        goto exit_function;*/
 1123|  5.02k|        io.n_zy = 0;
 1124|  5.02k|        io.n_pzz = 0;
 1125|  5.02k|        io.n_pzz = 0;
 1126|  5.02k|    }
 1127|      0|    else
 1128|      0|    {
 1129|      0|        io.n_zy = orig_inp_data->n_zy;
 1130|      0|        io.n_pzz = 0;
 1131|      0|        if (orig_inp_data->polymer)
  ------------------
  |  Branch (1131:13): [True: 0, False: 0]
  ------------------
 1132|      0|        {
 1133|      0|            io.n_pzz = orig_inp_data->polymer->n_pzz;
 1134|      0|        }
 1135|      0|    }
 1136|       |
 1137|       |    /*
 1138|       |     * @nnuk
 1139|       |     * The Molecular Inorganics subversion designator is structure-specific.
 1140|       |     * For structure input it is determined from the Molecular Inorganics
 1141|       |     * element classification when Molecular Inorganics processing is enabled.
 1142|       |     * For InChI-derived input, the subversion designator is preserved from
 1143|       |     * the input version prefix.
 1144|       |     */
 1145|  5.02k|    if (ip->bMolecularInorganics)
  ------------------
  |  Branch (1145:9): [True: 5.02k, False: 0]
  ------------------
 1146|  5.02k|    {
 1147|  5.02k|#if ( READ_INCHI_STRING == 1 )
 1148|  5.02k|        if (ip->bReadInChIOptions & (READ_INCHI_OUTPUT_INCHI | READ_INCHI_TO_STRUCTURE))
  ------------------
  |  |  988|  5.02k|#define READ_INCHI_OUTPUT_INCHI          0x00000001
  ------------------
                      if (ip->bReadInChIOptions & (READ_INCHI_OUTPUT_INCHI | READ_INCHI_TO_STRUCTURE))
  ------------------
  |  |  991|  5.02k|#define READ_INCHI_TO_STRUCTURE          0x00000008
  ------------------
  |  Branch (1148:13): [True: 5.02k, False: 0]
  ------------------
 1149|  5.02k|        {
 1150|  5.02k|            if (ip->bReadInChIOptions & READ_INCHI_INPUT_MI)
  ------------------
  |  |  993|  5.02k|#define READ_INCHI_INPUT_MI              0x00000020
  ------------------
  |  Branch (1150:17): [True: 0, False: 5.02k]
  ------------------
 1151|      0|            {
 1152|      0|                is_molecular_inorganic = 1;
 1153|      0|            }
 1154|  5.02k|        }
 1155|      0|        else
 1156|      0|#endif
 1157|      0|        if (orig_inp_data && orig_inp_data->at)
  ------------------
  |  Branch (1157:13): [True: 0, False: 0]
  |  Branch (1157:30): [True: 0, False: 0]
  ------------------
 1158|      0|        {
 1159|      0|            for (i = 0; i < orig_inp_data->num_inp_atoms; i++)
  ------------------
  |  Branch (1159:25): [True: 0, False: 0]
  ------------------
 1160|      0|            {
 1161|      0|                if (getElTypeforMolecularInorganics(orig_inp_data->at[i].el_number) != 0)
  ------------------
  |  Branch (1161:21): [True: 0, False: 0]
  ------------------
 1162|      0|                {
 1163|      0|                    is_molecular_inorganic = 1;
 1164|      0|                    break;
 1165|      0|                }
 1166|      0|            }
 1167|      0|        }
 1168|  5.02k|    }
 1169|       |
 1170|  5.02k|    io.bPolymers = ip->bPolymers;
 1171|       |
 1172|       |    /* djb-rwth: removing redundant code */
 1173|       |
 1174|       |#ifdef TARGET_LIB_FOR_WINCHI
 1175|       |    /* @@@ From now on we will go with silent output; it ends on @@@ below */
 1176|       |    silent = 1;
 1177|       |#endif
 1178|       |
 1179|       |    /* Analyze layers, make adjustments and fixes, etc. */
 1180|       |
 1181|  5.02k|    set_line_separators(bINChIOutputOptions, &pLF, &pTAB);
 1182|  5.02k|    memset(io.sDifSegs, DIFV_BOTH_EMPTY, sizeof(io.sDifSegs)); /* djb-rwth: memset_s C11/Annex K variant? */
 1183|  5.02k|    if (!strbuf || !(strbuf->pStr) || strbuf->nAllocatedLength <= 0)
  ------------------
  |  Branch (1183:9): [True: 0, False: 5.02k]
  |  Branch (1183:20): [True: 0, False: 5.02k]
  |  Branch (1183:39): [True: 0, False: 5.02k]
  ------------------
 1184|      0|    {
 1185|      0|        inchi_ios_eprint(log_file, "Cannot allocate output buffer. No output for structure #%d.%s%s%s%s\n",
 1186|      0|                         num_input_struct, SDF_LBL_VAL(ip->pSdfLabel, ip->pSdfValue));
  ------------------
  |  |  830|      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 \
  |  |  ------------------
  |  |  |  Branch (830:28): [True: 0, False: 0]
  |  |  |  Branch (830:35): [True: 0, False: 0]
  |  |  |  Branch (830:65): [True: 0, False: 0]
  |  |  |  Branch (830:72): [True: 0, False: 0]
  |  |  |  Branch (830:96): [True: 0, False: 0]
  |  |  |  Branch (830:103): [True: 0, False: 0]
  |  |  |  Branch (830:115): [True: 0, False: 0]
  |  |  |  Branch (830:122): [True: 0, False: 0]
  |  |  |  Branch (830:163): [True: 0, False: 0]
  |  |  |  Branch (830:170): [True: 0, False: 0]
  |  |  |  Branch (830:185): [True: 0, False: 0]
  |  |  |  Branch (830:192): [True: 0, False: 0]
  |  |  ------------------
  |  |  831|      0|                                                                                                                                                                                                       : gsEmpty
  ------------------
 1187|      0|        return ret;
 1188|      0|    }
 1189|       |
 1190|       |    /*    -- commented out to allow empty InChI --
 1191|       |    if (!io.num_components ) return 0;
 1192|       |    */
 1193|       |
 1194|  15.0k|    for (i = 0; i < TAUT_NUM; i++)
  ------------------
  |  |  573|  15.0k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1194:17): [True: 10.0k, False: 5.02k]
  ------------------
 1195|  10.0k|    {
 1196|  10.0k|        bHasIsotopicAtoms[i] =
 1197|  10.0k|            io.num_comp[i] =
 1198|  10.0k|                bStereoSp2[i] =
 1199|  10.0k|                    bStereoSp3[i] =
 1200|  10.0k|                        bIsotopicStereoSp2[i] =
 1201|  10.0k|                            bIsotopicStereoSp3[i] =
 1202|  10.0k|                                io.bIsotopicOrigNumb[i] =
 1203|  10.0k|                                    bStereoAbs[i] =
 1204|  10.0k|                                        bIsotopicStereoAbs[i] =
 1205|  10.0k|                                            bStereoAbsInverted[i] =
 1206|  10.0k|                                                bIsotopicStereoAbsInverted[i] =
 1207|  10.0k|                                                    io.bRacemicStereo[i] =
 1208|  10.0k|                                                        io.bRelativeStereo[i] =
 1209|  10.0k|                                                            io.bIsotopicRacemicStereo[i] =
 1210|  10.0k|                                                                io.bIsotopicRelativeStereo[i] =
 1211|  10.0k|                                                                    io.bAtomEqu[i] =
 1212|  10.0k|                                                                        io.bTautEqu[i] =
 1213|  10.0k|                                                                            io.bIsotopicAtomEqu[i] =
 1214|  10.0k|                                                                                io.bIsotopicTautEqu[i] =
 1215|  10.0k|                                                                                    io.bInvStereo[i] =
 1216|  10.0k|                                                                                        io.bInvIsotopicStereo[i] =
 1217|  10.0k|                                                                                            io.bInvStereoOrigNumb[i] =
 1218|  10.0k|                                                                                                io.bInvIsotopicStereoOrigNumb[i] =
 1219|  10.0k|                                                                                                    io.bIgn_UU_Sp3[i] =
 1220|  10.0k|                                                                                                        io.bIgn_UU_Sp2[i] =
 1221|  10.0k|                                                                                                            io.bIgn_UU_Sp3_Iso[i] =
 1222|  10.0k|                                                                                                                io.bIgn_UU_Sp2_Iso[i] =
 1223|  10.0k|                                                                                                                    io.bChargesRadVal[i] =
 1224|  10.0k|                                                                                                                        io.bOrigCoord[i] = 0;
 1225|  10.0k|    }
 1226|       |
 1227|       |    /*    Find if it is isotopic */
 1228|  5.02k|    io.bIsotopic =
 1229|  5.02k|        io.bTautomeric =
 1230|  5.02k|            io.bNonTautomeric =
 1231|  5.02k|                bTautomericAcid =
 1232|  5.02k|                    bHardAddRemProton =
 1233|  5.02k|                        bTautIsoHNum =
 1234|  5.02k|                            bTautIsoAt =
 1235|  5.02k|                                bTautAndNonTaut =
 1236|  5.02k|                                    bTautIsNonTaut = 0;
 1237|       |
 1238|       |    /*
 1239|       |         x = bStereo, bStereoSp2, bStereoSp3, bStereoAbsInverted,
 1240|       |             bIsotopicStereo, bIsotopicStereoSp2, bIsotopicStereoSp3, bIsotopicStereoAbsInverted
 1241|       |
 1242|       |         OUT_N1: x[TAUT_NON] refers to non-tautomeric only
 1243|       |         OUT_T1: x[TAUT_YES] refers to tautomeric if exists otherwise non-tautomeric
 1244|       |         OUT_NT: x[TAUT_NON] refers to non-taut representations of tautomeric
 1245|       |         OUT_TN: x[TAUT_YES] refers to tautomeric if exists otherwise non-tautomeric
 1246|       |                 x[TAUT_NON] refers to non-taut representations of tautomeric
 1247|       |     */
 1248|       |
 1249|  5.02k|    memset(io.num_iso_H, 0, sizeof(io.num_iso_H)); /* djb-rwth: memset_s C11/Annex K variant? */
 1250|  5.02k|    io.nNumRemovedProtons = 0;
 1251|       |    /* djb-rwth: removing redundant code */
 1252|  5.02k|    bHasIsoH = 0;
 1253|  5.02k|    io.bTautomericOutputAllowed = (io.bOutType == OUT_T1 || io.bOutType == OUT_TN);
  ------------------
  |  |  581|  10.0k|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  ------------------
                  io.bTautomericOutputAllowed = (io.bOutType == OUT_T1 || io.bOutType == OUT_TN);
  ------------------
  |  |  583|  5.02k|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (1253:36): [True: 0, False: 5.02k]
  |  Branch (1253:61): [True: 5.02k, False: 0]
  ------------------
 1254|  5.02k|    io.pINChISort = io.pINChISortTautAndNonTaut[io.bTautomericOutputAllowed ? TAUT_YES : TAUT_NON];
  ------------------
  |  |  575|  5.02k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  io.pINChISort = io.pINChISortTautAndNonTaut[io.bTautomericOutputAllowed ? TAUT_YES : TAUT_NON];
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1254:49): [True: 5.02k, False: 0]
  ------------------
 1255|  5.02k|    is = io.pINChISort;
 1256|       |    /* djb-rwth: removing redundant variables/code */
 1257|       |
 1258|   102k|    for (i = 0, is2 = io.pINChISortTautAndNonTaut[TAUT_NON]; i < io.num_components; i++, is++, is2 ? is2++ : NULL)
  ------------------
  |  |  574|  5.02k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1258:62): [True: 97.5k, False: 5.02k]
  |  Branch (1258:96): [True: 97.5k, False: 0]
  ------------------
 1259|  97.5k|    {
 1260|       |
 1261|  97.5k|        CompINChILayers(is, is2, io.sDifSegs, bFixTranspChargeBug);
 1262|       |
 1263|  97.5k|        io.bNonTautIsIdenticalToTaut = io.bNonTautIsIdenticalToTaut && !CompINChITautVsNonTaut(is, is2, 1);
  ------------------
  |  Branch (1263:40): [True: 97.5k, False: 0]
  |  Branch (1263:72): [True: 97.5k, False: 0]
  ------------------
 1264|       |
 1265|  97.5k|        if (is && (pINChI_Aux = is->pINChI_Aux[TAUT_YES]))
  ------------------
  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1265:13): [True: 97.5k, False: 0]
  |  Branch (1265:19): [True: 97.5k, False: 0]
  ------------------
 1266|  97.5k|        {
 1267|   390k|            for (j = 0; j < NUM_H_ISOTOPES; j++)
  ------------------
  |  |   25|   390k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (1267:25): [True: 292k, False: 97.5k]
  ------------------
 1268|   292k|            {
 1269|   292k|                bHasIsoH += abs(pINChI_Aux->nNumRemovedIsotopicH[j]);
 1270|   292k|                io.num_iso_H[j] += pINChI_Aux->nNumRemovedIsotopicH[j];
 1271|   292k|            }
 1272|  97.5k|            io.nNumRemovedProtons += pINChI_Aux->nNumRemovedProtons;
 1273|       |            /* djb-rwth: removing redundant code */
 1274|  97.5k|        }
 1275|       |
 1276|  97.5k|        if (io.bTautomericOutputAllowed && is) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (1276:13): [True: 97.5k, False: 0]
  |  Branch (1276:44): [True: 97.5k, False: 0]
  ------------------
 1277|  97.5k|        {
 1278|       |            /* Check for removed isotopic H */
 1279|   195k|            for (j = TAUT_YES; j < TAUT_NUM; j++)
  ------------------
  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          for (j = TAUT_YES; j < TAUT_NUM; j++)
  ------------------
  |  |  573|   195k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1279:32): [True: 97.5k, False: 97.5k]
  ------------------
 1280|  97.5k|            {
 1281|  97.5k|                switch (io.bOutType)
 1282|  97.5k|                {
 1283|      0|                case OUT_N1: /* x[TAUT_NON]: non-tautomeric only -- never happens */
  ------------------
  |  |  580|      0|#define OUT_N1              0    /* non-tautomeric only */
  ------------------
  |  Branch (1283:17): [True: 0, False: 97.5k]
  ------------------
 1284|      0|                    jj = GET_II(io.bOutType, is);
  ------------------
  |  |   45|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   46|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|      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): \
  |  |  ------------------
  |  |  |  |  583|      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): \
  |  |  ------------------
  |  |  |  |   35|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 0]
  |  |  |  Branch (46:36): [True: 0, False: 0]
  |  |  ------------------
  |  |   47|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1285|      0|                    if (jj != j)
  ------------------
  |  Branch (1285:25): [True: 0, False: 0]
  ------------------
 1286|      0|                        continue;
 1287|       |                    /* djb-rwth: removing redundant code */
 1288|      0|                    break;
 1289|      0|                case OUT_T1: /* x[TAUT_YES]: tautomeric if present otherwise non-tautomeric */
  ------------------
  |  |  581|      0|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  ------------------
  |  Branch (1289:17): [True: 0, False: 97.5k]
  ------------------
 1290|      0|                    jj = GET_II(io.bOutType, is);
  ------------------
  |  |   45|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   46|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|      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): \
  |  |  ------------------
  |  |  |  |  583|      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): \
  |  |  ------------------
  |  |  |  |   35|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 0]
  |  |  |  Branch (46:36): [True: 0, False: 0]
  |  |  ------------------
  |  |   47|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1291|      0|                    if (jj != j)
  ------------------
  |  Branch (1291:25): [True: 0, False: 0]
  ------------------
 1292|      0|                        continue;
 1293|       |                    /* djb-rwth: removing redundant code */
 1294|      0|                    break;
 1295|      0|                case OUT_NT: /* x[TAUT_NON]: only non-taut representations of tautomeric -- never happens */
  ------------------
  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  ------------------
  |  Branch (1295:17): [True: 0, False: 97.5k]
  ------------------
 1296|      0|                    jj = GET_II(io.bOutType, is);
  ------------------
  |  |   45|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   46|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|      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): \
  |  |  ------------------
  |  |  |  |  583|      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): \
  |  |  ------------------
  |  |  |  |   35|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 0]
  |  |  |  Branch (46:36): [True: 0, False: 0]
  |  |  ------------------
  |  |   47|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1297|      0|                    if (jj != j)
  ------------------
  |  Branch (1297:25): [True: 0, False: 0]
  ------------------
 1298|      0|                        continue;
 1299|       |                    /* djb-rwth: removing redundant code */
 1300|      0|                    break;
 1301|       |                /* main path of control flow */
 1302|  97.5k|                case OUT_TN: /* x[TAUT_YES]: tautomeric if present otherwise non-tautomeric;
  ------------------
  |  |  583|  97.5k|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (1302:17): [True: 97.5k, False: 0]
  ------------------
 1303|       |                              * x[TAUT_NON]: non-taut only if tautomeric is present */
 1304|  97.5k|                    jj = (j == TAUT_YES) ? GET_II(OUT_T1, is) : (j == TAUT_NON) ? GET_II(OUT_NT, is)
  ------------------
  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                  jj = (j == TAUT_YES) ? GET_II(OUT_T1, is) : (j == TAUT_NON) ? GET_II(OUT_NT, is)
  ------------------
  |  |   45|  97.5k|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|  97.5k|#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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [Folded, False: 97.5k]
  |  |  ------------------
  |  |   46|  97.5k|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|   195k|#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): \
  |  |  ------------------
  |  |  |  |  583|  97.5k|#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): \
  |  |  ------------------
  |  |  |  |   35|  97.5k|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 97.5k, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 97.5k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 97.5k, Folded]
  |  |  |  Branch (46:36): [Folded, False: 0]
  |  |  ------------------
  |  |   47|  97.5k|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [Folded, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [Folded, False: 0]
  |  |  ------------------
  ------------------
                                  jj = (j == TAUT_YES) ? GET_II(OUT_T1, is) : (j == TAUT_NON) ? GET_II(OUT_NT, is)
  ------------------
  |  |  574|      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)
  ------------------
  |  |   45|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [Folded, False: 0]
  |  |  ------------------
  |  |   46|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|      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): \
  |  |  ------------------
  |  |  |  |  583|      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): \
  |  |  ------------------
  |  |  |  |   35|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [Folded, False: 0]
  |  |  |  Branch (46:36): [Folded, False: 0]
  |  |  ------------------
  |  |   47|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [Folded, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, Folded]
  |  |  ------------------
  ------------------
  |  Branch (1304:26): [True: 97.5k, False: 0]
  |  Branch (1304:65): [True: 0, False: 0]
  ------------------
 1305|      0|                                                                                : -1;
 1306|  97.5k|                    if (jj == TAUT_YES)
  ------------------
  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1306:25): [True: 97.5k, False: 0]
  ------------------
 1307|  97.5k|                    {
 1308|       |                        /* Fix12 */
 1309|  97.5k|                        if (is->pINChI[jj]->lenTautomer > 0)
  ------------------
  |  Branch (1309:29): [True: 1.24k, False: 96.2k]
  ------------------
 1310|  1.24k|                        {
 1311|  1.24k|                            bTautAndNonTaut += (!is->pINChI[jj]->bDeleted && HAS_N(is));
  ------------------
  |  |   37|  1.23k|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  ------------------
  |  |  |  |  574|  1.23k|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (37:20): [True: 0, False: 1.23k]
  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1311:49): [True: 1.23k, False: 6]
  ------------------
 1312|  1.24k|                        }
 1313|  96.2k|                        else
 1314|  96.2k|                        {
 1315|  96.2k|                            bTautIsNonTaut++;
 1316|  96.2k|                        }
 1317|  97.5k|                    }
 1318|  97.5k|                    if (jj < 0)
  ------------------
  |  Branch (1318:25): [True: 0, False: 97.5k]
  ------------------
 1319|      0|                        continue;
 1320|       |                    /* djb-rwth: removing redundant code */
 1321|  97.5k|                    break;
 1322|  97.5k|                default:
  ------------------
  |  Branch (1322:17): [True: 0, False: 97.5k]
  ------------------
 1323|      0|                    continue;
 1324|  97.5k|                }
 1325|  97.5k|                if (jj != j)
  ------------------
  |  Branch (1325:21): [True: 0, False: 97.5k]
  ------------------
 1326|      0|                    continue;
 1327|  97.5k|                if ((pINChI = is->pINChI[jj]) && pINChI->nNumberOfAtoms > 0 && (pINChI_Aux = is->pINChI_Aux[jj]))
  ------------------
  |  Branch (1327:21): [True: 97.5k, False: 0]
  |  Branch (1327:50): [True: 97.5k, False: 0]
  |  Branch (1327:80): [True: 97.5k, False: 0]
  ------------------
 1328|  97.5k|                {
 1329|  97.5k|                    bTautIsoHNum += (pINChI_Aux->nNumRemovedIsotopicH[0] +
 1330|  97.5k|                                     pINChI_Aux->nNumRemovedIsotopicH[1] +
 1331|  97.5k|                                     pINChI_Aux->nNumRemovedIsotopicH[2]);
 1332|  97.5k|                    bTautIsoAt += (pINChI->nNumberOfIsotopicAtoms > 0 || pINChI->nNumberOfIsotopicTGroups > 0);
  ------------------
  |  Branch (1332:36): [True: 628, False: 96.8k]
  |  Branch (1332:74): [True: 0, False: 96.8k]
  ------------------
 1333|  97.5k|                }
 1334|  97.5k|            }
 1335|  97.5k|        }
 1336|  97.5k|    }
 1337|       |
 1338|  5.02k|    io.sDifSegs[DIFL_M][DIFS_p_PROTONS] = io.nNumRemovedProtons ? DIFV_NEQ2PRECED : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (1338:43): [True: 147, False: 4.88k]
  ------------------
 1339|  5.02k|    io.sDifSegs[DIFL_MI][DIFS_h_H_ATOMS] = bHasIsoH ? DIFV_NEQ2PRECED : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (1339:44): [True: 74, False: 4.95k]
  ------------------
 1340|       |
 1341|  5.02k|    MarkUnusedAndEmptyLayers(io.sDifSegs);
 1342|       |
 1343|  5.02k|    io.bNonTautIsIdenticalToTaut = io.bNonTautIsIdenticalToTaut && !bTautIsoHNum;
  ------------------
  |  Branch (1343:36): [True: 5.02k, False: 0]
  |  Branch (1343:68): [True: 4.95k, False: 73]
  ------------------
 1344|  5.02k|    nAtomsAllComp1 = nAtomsAllComp2 = 0;
 1345|       |
 1346|   102k|    for (i = 0, is = io.pINChISort; i < io.num_components; i++, is++)
  ------------------
  |  Branch (1346:37): [True: 97.5k, False: 5.02k]
  ------------------
 1347|  97.5k|    {
 1348|  97.5k|        int bCurIso, bCurHasIsoStereo /* Fix14 */, bCurTaut /*, bCurTaut2*/; /* djb-rwth: removing redundant variables */
 1349|  97.5k|        int bCompExists, bCurIsoHPos, bCurIsoHStereo;
 1350|  97.5k|        int bCurStereoSp2, bCurIsoStereoSp2, bCurStereoSp3, bCurIsoStereoSp3, bCurIsoStereoSp3Inv;
 1351|  97.5k|        int bCurRacemic, bCurRelative, bCurIsoRacemic, bCurIsoRelative;
 1352|  97.5k|        bCompExists = 0;
 1353|       |
 1354|   292k|        for (j = TAUT_NON; j < TAUT_NUM; j++)
  ------------------
  |  |  574|  97.5k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      for (j = TAUT_NON; j < TAUT_NUM; j++)
  ------------------
  |  |  573|   292k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1354:28): [True: 195k, False: 97.5k]
  ------------------
 1355|   195k|        {
 1356|   195k|            switch (io.bOutType)
 1357|   195k|            {
 1358|      0|            case OUT_N1:
  ------------------
  |  |  580|      0|#define OUT_N1              0    /* non-tautomeric only */
  ------------------
  |  Branch (1358:13): [True: 0, False: 195k]
  ------------------
 1359|       |                /* x[TAUT_NON]: non-tautomeric only */
 1360|      0|                jj = GET_II(io.bOutType, is);
  ------------------
  |  |   45|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   46|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|      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): \
  |  |  ------------------
  |  |  |  |  583|      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): \
  |  |  ------------------
  |  |  |  |   35|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 0]
  |  |  |  Branch (46:36): [True: 0, False: 0]
  |  |  ------------------
  |  |   47|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1361|      0|                if (jj != j)
  ------------------
  |  Branch (1361:21): [True: 0, False: 0]
  ------------------
 1362|      0|                    continue;
 1363|      0|                ii = TAUT_NON;
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1364|      0|                break;
 1365|      0|            case OUT_T1:
  ------------------
  |  |  581|      0|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  ------------------
  |  Branch (1365:13): [True: 0, False: 195k]
  ------------------
 1366|       |                /* x[TAUT_YES]: tautomeric if present otherwise non-tautomeric */
 1367|      0|                jj = GET_II(io.bOutType, is);
  ------------------
  |  |   45|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   46|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|      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): \
  |  |  ------------------
  |  |  |  |  583|      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): \
  |  |  ------------------
  |  |  |  |   35|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 0]
  |  |  |  Branch (46:36): [True: 0, False: 0]
  |  |  ------------------
  |  |   47|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1368|      0|                if (jj != j)
  ------------------
  |  Branch (1368:21): [True: 0, False: 0]
  ------------------
 1369|      0|                    continue;
 1370|      0|                ii = TAUT_YES;
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1371|      0|                break;
 1372|      0|            case OUT_NT:
  ------------------
  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  ------------------
  |  Branch (1372:13): [True: 0, False: 195k]
  ------------------
 1373|       |                /* x[TAUT_NON]: only non-taut representations of tautomeric */
 1374|      0|                jj = GET_II(io.bOutType, is);
  ------------------
  |  |   45|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   46|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|      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): \
  |  |  ------------------
  |  |  |  |  583|      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): \
  |  |  ------------------
  |  |  |  |   35|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 0]
  |  |  |  Branch (46:36): [True: 0, False: 0]
  |  |  ------------------
  |  |   47|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1375|      0|                if (jj != j)
  ------------------
  |  Branch (1375:21): [True: 0, False: 0]
  ------------------
 1376|      0|                    continue;
 1377|      0|                ii = TAUT_NON;
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1378|      0|                break;
 1379|       |            /* main control flow comes here: requested both mobile and fixed H results */
 1380|   195k|            case OUT_TN:
  ------------------
  |  |  583|   195k|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (1380:13): [True: 195k, False: 0]
  ------------------
 1381|       |                /* x[TAUT_YES]: tautomeric if present otherwise non-tautomeric; */
 1382|       |                /* x[TAUT_NON]: non-taut only if tautomeric is present          */
 1383|   195k|                jj = (j == TAUT_YES) ? GET_II(OUT_T1, is) : (j == TAUT_NON) ? GET_II(OUT_NT, is)
  ------------------
  |  |  575|   195k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              jj = (j == TAUT_YES) ? GET_II(OUT_T1, is) : (j == TAUT_NON) ? GET_II(OUT_NT, is)
  ------------------
  |  |   45|  97.5k|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|  97.5k|#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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [Folded, False: 97.5k]
  |  |  ------------------
  |  |   46|  97.5k|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|   195k|#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): \
  |  |  ------------------
  |  |  |  |  583|  97.5k|#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): \
  |  |  ------------------
  |  |  |  |   35|  97.5k|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 97.5k, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 97.5k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 97.5k, Folded]
  |  |  |  Branch (46:36): [Folded, False: 0]
  |  |  ------------------
  |  |   47|  97.5k|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [Folded, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [Folded, False: 0]
  |  |  ------------------
  ------------------
                              jj = (j == TAUT_YES) ? GET_II(OUT_T1, is) : (j == TAUT_NON) ? GET_II(OUT_NT, is)
  ------------------
  |  |  574|  97.5k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                              jj = (j == TAUT_YES) ? GET_II(OUT_T1, is) : (j == TAUT_NON) ? GET_II(OUT_NT, is)
  ------------------
  |  |   45|  97.5k|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|  97.5k|#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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [Folded, False: 97.5k]
  |  |  ------------------
  |  |   46|  97.5k|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|   195k|#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): \
  |  |  ------------------
  |  |  |  |  583|  97.5k|#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): \
  |  |  ------------------
  |  |  |  |   35|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [Folded, False: 0]
  |  |  |  Branch (46:36): [Folded, False: 0]
  |  |  ------------------
  |  |   47|  97.5k|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|  97.5k|#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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [Folded, False: 97.5k]
  |  |  ------------------
  |  |   48|  97.5k|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|  97.5k|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|   195k|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  97.5k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  97.5k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 97.5k, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 97.5k, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 1.24k, False: 96.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|  1.24k|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|  1.24k|#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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 1.24k]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 97.5k, Folded]
  |  |  ------------------
  ------------------
  |  Branch (1383:22): [True: 97.5k, False: 97.5k]
  |  Branch (1383:61): [True: 97.5k, False: 0]
  ------------------
 1384|  97.5k|                                                                            : -1;
 1385|   195k|                if (jj < 0)
  ------------------
  |  Branch (1385:21): [True: 97.5k, False: 97.5k]
  ------------------
 1386|  97.5k|                {
 1387|       |                    /* Fix12 */
 1388|  97.5k|                    if (bTautAndNonTaut && bTautIsNonTaut &&
  ------------------
  |  Branch (1388:25): [True: 0, False: 97.5k]
  |  Branch (1388:44): [True: 0, False: 0]
  ------------------
 1389|      0|                        j == TAUT_NON && 0 <= (jj = GET_II(OUT_T1, is)) &&
  ------------------
  |  |  574|  97.5k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                      j == TAUT_NON && 0 <= (jj = GET_II(OUT_T1, is)) &&
  ------------------
  |  |   45|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [Folded, False: 0]
  |  |  ------------------
  |  |   46|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|      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): \
  |  |  ------------------
  |  |  |  |  583|      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): \
  |  |  ------------------
  |  |  |  |   35|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, Folded]
  |  |  |  Branch (46:36): [Folded, False: 0]
  |  |  ------------------
  |  |   47|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [Folded, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1389:25): [True: 0, False: 0]
  |  Branch (1389:42): [True: 0, False: 0]
  ------------------
 1390|      0|                        !is->pINChI[jj]->bDeleted && !is->pINChI[jj]->lenTautomer)
  ------------------
  |  Branch (1390:25): [True: 0, False: 0]
  |  Branch (1390:54): [True: 0, False: 0]
  ------------------
 1391|      0|                    {
 1392|      0|                        ; /* the requested non-tautomeric component is in tautomeric position   */
 1393|       |                          /*   (is->pINChI[TAUT_YES]);                                          */
 1394|       |                          /*   process it also as non-tautomeric if Fixed-H layer was requested */
 1395|      0|                    }
 1396|  97.5k|                    else
 1397|  97.5k|                    {
 1398|  97.5k|                        continue;
 1399|  97.5k|                    }
 1400|  97.5k|                }
 1401|       |
 1402|  97.5k|                ii = j; /* ii is what we wanted; jj is what we found (0 = TAUT_NON: fixed_H, 1 = TAUT_YES: mobile_H) */
 1403|       |
 1404|       |                /* -- not used 2004-09-16 ---
 1405|       |                if ( is2 ) {
 1406|       |                    jj2 = ( j == TAUT_YES )? GET_II(OUT_T1,is2) : ( j == TAUT_NON )? GET_II(OUT_NT,is2) : -1;
 1407|       |                    if ( jj2 >= 0 ) {
 1408|       |                        ii2 = j;
 1409|       |                    } else {
 1410|       |                        ii2 = -1;
 1411|       |                    }
 1412|       |                } else {
 1413|       |                    jj2 = ii2 = -1;
 1414|       |                }
 1415|       |                -----------------------------*/
 1416|  97.5k|                break;
 1417|       |
 1418|      0|            default:
  ------------------
  |  Branch (1418:13): [True: 0, False: 195k]
  ------------------
 1419|      0|                continue;
 1420|   195k|            }
 1421|       |
 1422|  97.5k|            if ((pINChI = is->pINChI[jj]) && pINChI->nNumberOfAtoms > 0)
  ------------------
  |  Branch (1422:17): [True: 97.5k, False: 0]
  |  Branch (1422:46): [True: 97.5k, False: 0]
  ------------------
 1423|  97.5k|            {
 1424|       |                /*pINChI_Aux = is->pINChI_Aux[jj];*/
 1425|  97.5k|                bCompExists++;
 1426|       |
 1427|  97.5k|                if (j == TAUT_NON)
  ------------------
  |  |  574|  97.5k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1427:21): [True: 0, False: 97.5k]
  ------------------
 1428|      0|                    nAtomsAllComp1 += pINChI->nNumberOfAtoms;
 1429|  97.5k|                else if (j == TAUT_YES)
  ------------------
  |  |  575|  97.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1429:26): [True: 97.5k, False: 0]
  ------------------
 1430|  97.5k|                    nAtomsAllComp2 += pINChI->nNumberOfAtoms;
 1431|       |
 1432|  97.5k|                bCurTaut = (pINChI->lenTautomer > 0);
 1433|  97.5k|                bCurIso = (pINChI->nNumberOfIsotopicAtoms > 0 || pINChI->nNumberOfIsotopicTGroups > 0);
  ------------------
  |  Branch (1433:28): [True: 628, False: 96.8k]
  |  Branch (1433:66): [True: 0, False: 96.8k]
  ------------------
 1434|  97.5k|                bCurIsoHPos = ((pINChI->nPossibleLocationsOfIsotopicH && pINChI->nPossibleLocationsOfIsotopicH[0] > 1) || pINChI->lenTautomer > 1); /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1434:33): [True: 0, False: 97.5k]
  |  Branch (1434:74): [True: 0, False: 0]
  |  Branch (1434:123): [True: 1.23k, False: 96.2k]
  ------------------
 1435|       |                /* present isotopic H + their possible positions AND/OR isotopic atoms */
 1436|  97.5k|                bCurIsoHStereo = (bCurIsoHPos && (bTautIsoHNum || bTautIsoAt)) || bCurIso; /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1436:35): [True: 1.23k, False: 96.2k]
  |  Branch (1436:51): [True: 2, False: 1.23k]
  |  Branch (1436:67): [True: 0, False: 1.23k]
  |  Branch (1436:83): [True: 628, False: 96.8k]
  ------------------
 1437|  97.5k|                if (jj == j && pINChI->bDeleted)
  ------------------
  |  Branch (1437:21): [True: 97.5k, False: 0]
  |  Branch (1437:32): [True: 6, False: 97.5k]
  ------------------
 1438|      6|                {
 1439|      6|                    io.num_comp[j]--;
 1440|      6|                    if (bCurTaut)
  ------------------
  |  Branch (1440:25): [True: 6, False: 0]
  ------------------
 1441|      6|                    {
 1442|      6|                        io.bTautomeric |= 1; /* tautomeric representation is present */
 1443|      6|                        io.bNonTautomeric |= HAS_N(is);
  ------------------
  |  |   37|      6|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  ------------------
  |  |  |  |  574|      6|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (37:20): [True: 0, False: 6]
  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1444|      6|                    }
 1445|      6|                    io.bIsotopic |= bCurIso;
 1446|      6|                    continue; /* deleted H(+) in tautomeric representation */
 1447|      6|                }
 1448|       |
 1449|  97.5k|                bCurStereoSp2 = pINChI->Stereo && (pINChI->Stereo->nNumberOfStereoBonds > 0);
  ------------------
  |  Branch (1449:33): [True: 10.0k, False: 87.4k]
  |  Branch (1449:51): [True: 411, False: 9.59k]
  ------------------
 1450|       |
 1451|  97.5k|                bCurHasIsoStereo =
 1452|  97.5k|                    bCurStereoSp3 = pINChI->Stereo && (pINChI->Stereo->nNumberOfStereoCenters > 0);
  ------------------
  |  Branch (1452:37): [True: 10.0k, False: 87.4k]
  |  Branch (1452:55): [True: 382, False: 9.62k]
  ------------------
 1453|       |
 1454|  97.5k|                bCurIsoStereoSp2 = bCurIsoHStereo && pINChI->StereoIsotopic && (pINChI->StereoIsotopic->nNumberOfStereoBonds > 0);
  ------------------
  |  Branch (1454:36): [True: 630, False: 96.8k]
  |  Branch (1454:54): [True: 146, False: 484]
  |  Branch (1454:80): [True: 55, False: 91]
  ------------------
 1455|  97.5k|                bCurIsoStereoSp3 = bCurIsoHStereo && pINChI->StereoIsotopic && (pINChI->StereoIsotopic->nNumberOfStereoCenters > 0);
  ------------------
  |  Branch (1455:36): [True: 630, False: 96.8k]
  |  Branch (1455:54): [True: 146, False: 484]
  |  Branch (1455:80): [True: 74, False: 72]
  ------------------
 1456|  97.5k|                bCurIsoStereoSp3Inv = bCurIsoStereoSp3 && pINChI->StereoIsotopic->nCompInv2Abs; /* inversion changes sp3 stereo */
  ------------------
  |  Branch (1456:39): [True: 74, False: 97.4k]
  |  Branch (1456:59): [True: 6, False: 68]
  ------------------
 1457|  97.5k|                bRequestedRacemicStereo |= (0 != (pINChI->nFlags & INCHI_FLAG_RAC_STEREO));
  ------------------
  |  |  122|  97.5k|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
 1458|  97.5k|                bRequestedRelativeStereo |= (0 != (pINChI->nFlags & INCHI_FLAG_REL_STEREO));
  ------------------
  |  |  121|  97.5k|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
 1459|       |
 1460|       |                /* Check whether isotopic stereo is same as non-isotopic; if same than do not output isotopic stereo */
 1461|  97.5k|                if (bCurStereoSp2 && bCurIsoStereoSp2)
  ------------------
  |  Branch (1461:21): [True: 411, False: 97.0k]
  |  Branch (1461:38): [True: 37, False: 374]
  ------------------
 1462|     37|                {
 1463|     37|                    bCurIsoStereoSp2 = !Eql_INChI_Stereo(pINChI->Stereo, EQL_SP2, pINChI->StereoIsotopic, EQL_SP2, 0);
  ------------------
  |  |  477|     37|#define EQL_SP2 8
  ------------------
                                  bCurIsoStereoSp2 = !Eql_INChI_Stereo(pINChI->Stereo, EQL_SP2, pINChI->StereoIsotopic, EQL_SP2, 0);
  ------------------
  |  |  477|     37|#define EQL_SP2 8
  ------------------
 1464|     37|                }
 1465|  97.5k|                if (bCurStereoSp3 && bCurIsoStereoSp3)
  ------------------
  |  Branch (1465:21): [True: 382, False: 97.1k]
  |  Branch (1465:38): [True: 37, False: 345]
  ------------------
 1466|     37|                {
 1467|       |                    /* bCurIsoStereoSp3=0 means (iso stereo sp3) = (non-iso stereo sp3) or (iso stereo sp3) = Inv(non-iso stereo sp3) */
 1468|     37|                    bCurIsoStereoSp3 = !Eql_INChI_Stereo(pINChI->Stereo, EQL_SP3, pINChI->StereoIsotopic, EQL_SP3,
  ------------------
  |  |  475|     37|#define EQL_SP3 2
  ------------------
                                  bCurIsoStereoSp3 = !Eql_INChI_Stereo(pINChI->Stereo, EQL_SP3, pINChI->StereoIsotopic, EQL_SP3,
  ------------------
  |  |  475|     37|#define EQL_SP3 2
  ------------------
 1469|     37|                                                         (pINChI->nFlags & INCHI_FLAG_RAC_STEREO) || (pINChI->nFlags & INCHI_FLAG_REL_STEREO));
  ------------------
  |  |  122|     37|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
                                                                       (pINChI->nFlags & INCHI_FLAG_RAC_STEREO) || (pINChI->nFlags & INCHI_FLAG_REL_STEREO));
  ------------------
  |  |  121|     36|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
  |  Branch (1469:58): [True: 1, False: 36]
  |  Branch (1469:102): [True: 4, False: 32]
  ------------------
 1470|     37|                    if (!bCurIsoStereoSp3)
  ------------------
  |  Branch (1470:25): [True: 37, False: 0]
  ------------------
 1471|     37|                    {
 1472|       |                        /* Inversion changes iso sp3 differently from non-iso sp3 Fix11 */
 1473|     37|                        bCurIsoStereoSp3Inv &= (pINChI->StereoIsotopic->nCompInv2Abs != pINChI->Stereo->nCompInv2Abs);
 1474|     37|                    }
 1475|     37|                }
 1476|       |
 1477|  97.5k|                bCurRelative = bRequestedRelativeStereo && bCurStereoSp3;
  ------------------
  |  Branch (1477:32): [True: 69, False: 97.4k]
  |  Branch (1477:60): [True: 22, False: 47]
  ------------------
 1478|       |#if (REL_RAC_STEREO_IGN_1_SC == 1)
 1479|       |                bCurRelative = bCurRelative &&
 1480|       |                               (pINChI->Stereo->nNumberOfStereoCenters > 1) &&
 1481|       |                               (pINChI->Stereo->nCompInv2Abs != 0) &&
 1482|       |#endif
 1483|       |
 1484|  97.5k|                               bCurIsoRelative = bRequestedRelativeStereo && (bCurIsoStereoSp3 || bCurIsoStereoSp3Inv);
  ------------------
  |  Branch (1484:50): [True: 69, False: 97.4k]
  |  Branch (1484:79): [True: 0, False: 69]
  |  Branch (1484:99): [True: 3, False: 66]
  ------------------
 1485|       |#if (REL_RAC_STEREO_IGN_1_SC == 1)
 1486|       |                bCurIsoRelative = bCurIsoRelative &&
 1487|       |                                  (pINChI->StereoIsotopic->nNumberOfStereoCenters > 1) &&
 1488|       |                                  (pINChI->StereoIsotopic->nCompInv2Abs != 0) &&
 1489|       |#endif
 1490|       |
 1491|  97.5k|                                  bCurRacemic = bRequestedRacemicStereo && bCurStereoSp3;
  ------------------
  |  Branch (1491:49): [True: 61, False: 97.4k]
  |  Branch (1491:76): [True: 16, False: 45]
  ------------------
 1492|       |#if (REL_RAC_STEREO_IGN_1_SC == 1)
 1493|       |                bCurRacemic = bCurRacemic &&
 1494|       |                                      (pINChI->Stereo->nCompInv2Abs != 0) &&
 1495|       |                                      (pINChI->Stereo->nNumberOfStereoCenters > 0)
 1496|       |                                  ? pINChI->Stereo->nNumberOfStereoCenters
 1497|       |                                  : 0;
 1498|       |#endif
 1499|       |
 1500|  97.5k|                bCurIsoRacemic = bRequestedRacemicStereo && (bCurIsoStereoSp3 || bCurIsoStereoSp3Inv);
  ------------------
  |  Branch (1500:34): [True: 61, False: 97.4k]
  |  Branch (1500:62): [True: 0, False: 61]
  |  Branch (1500:82): [True: 1, False: 60]
  ------------------
 1501|       |#if (REL_RAC_STEREO_IGN_1_SC == 1)
 1502|       |                bCurIsoRacemic = bCurIsoRacemic &
 1503|       |                                             (pINChI->StereoIsotopic->nCompInv2Abs != 0) &&
 1504|       |                                         (pINChI->StereoIsotopic->nNumberOfStereoCenters > 0)
 1505|       |                                     ? pINChI->StereoIsotopic->nNumberOfStereoCenters
 1506|       |                                     : 0;
 1507|       |#endif
 1508|  97.5k|                if (bRequestedRelativeStereo)
  ------------------
  |  Branch (1508:21): [True: 69, False: 97.4k]
  ------------------
 1509|     69|                {
 1510|     69|                    bCurStereoSp3 = bCurRelative || (bCurStereoSp3 && (pINChI->Stereo->nNumberOfStereoCenters > 1)); /* Fix11 */ /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1510:37): [True: 22, False: 47]
  |  Branch (1510:54): [True: 0, False: 47]
  |  Branch (1510:71): [True: 0, False: 0]
  ------------------
 1511|     69|                    bCurIsoStereoSp3 = bCurIsoRelative ? bCurIsoStereoSp3 : 0;
  ------------------
  |  Branch (1511:40): [True: 3, False: 66]
  ------------------
 1512|     69|                }
 1513|  97.4k|                else
 1514|  97.4k|                {
 1515|  97.4k|                    if (bRequestedRacemicStereo)
  ------------------
  |  Branch (1515:25): [True: 61, False: 97.3k]
  ------------------
 1516|     61|                    {
 1517|     61|                        bCurStereoSp3 = bCurRacemic > 1 || (bCurStereoSp3 && (pINChI->Stereo->nNumberOfStereoCenters > 1)); /* Fix11 */ /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1517:41): [True: 0, False: 61]
  |  Branch (1517:61): [True: 16, False: 45]
  |  Branch (1517:78): [True: 0, False: 16]
  ------------------
 1518|     61|                        bCurIsoStereoSp3 = bCurIsoRacemic > 1 ? bCurIsoStereoSp3 : 0;
  ------------------
  |  Branch (1518:44): [True: 0, False: 61]
  ------------------
 1519|     61|                    }
 1520|  97.4k|                }
 1521|       |                /* djb-rwth: removing redundant code */
 1522|       |
 1523|  97.5k|                io.bIsotopic |= bCurIso;
 1524|  97.5k|                bHasIsotopicAtoms[ii] |= bCurIso;
 1525|  97.5k|                bStereoSp2[ii] |= bCurStereoSp2;
 1526|  97.5k|                bStereoSp3[ii] |= bCurStereoSp3;
 1527|  97.5k|                io.bIgn_UU_Sp3[ii] |= !bCurStereoSp3 && (pINChI->nFlags & INCHI_FLAG_SC_IGN_ALL_UU);
  ------------------
  |  |  123|  97.1k|#define INCHI_FLAG_SC_IGN_ALL_UU        0x0008   /* ignored all undefined/unknown stereocenters, non-isotopic */
  ------------------
  |  Branch (1527:39): [True: 97.1k, False: 366]
  |  Branch (1527:57): [True: 0, False: 97.1k]
  ------------------
 1528|  97.5k|                io.bIgn_UU_Sp2[ii] |= !bCurStereoSp2 && (pINChI->nFlags & INCHI_FLAG_SB_IGN_ALL_UU);
  ------------------
  |  |  124|  97.0k|#define INCHI_FLAG_SB_IGN_ALL_UU        0x0010   /* ignored all undefined/unknown stereocenters, non-isotopic */
  ------------------
  |  Branch (1528:39): [True: 97.0k, False: 411]
  |  Branch (1528:57): [True: 0, False: 97.0k]
  ------------------
 1529|  97.5k|                bIsotopicStereoSp2[ii] |= bCurIsoStereoSp2;
 1530|  97.5k|                bIsotopicStereoSp3[ii] |= bCurIsoStereoSp3;
 1531|  97.5k|                io.bIgn_UU_Sp3_Iso[ii] |= !bCurIsoStereoSp3 && (pINChI->nFlags & INCHI_FLAG_SC_IGN_ALL_ISO_UU);
  ------------------
  |  |  125|  97.4k|#define INCHI_FLAG_SC_IGN_ALL_ISO_UU    0x0020   /* ignored all undefined/unknown stereocenters, isotopic */
  ------------------
  |  Branch (1531:43): [True: 97.4k, False: 37]
  |  Branch (1531:64): [True: 0, False: 97.4k]
  ------------------
 1532|  97.5k|                io.bIgn_UU_Sp2_Iso[ii] |= !bCurIsoStereoSp2 && (pINChI->nFlags & INCHI_FLAG_SB_IGN_ALL_ISO_UU);
  ------------------
  |  |  126|  97.4k|#define INCHI_FLAG_SB_IGN_ALL_ISO_UU    0x0040   /* ignored all undefined/unknown stereocenters, isotopic */
  ------------------
  |  Branch (1532:43): [True: 97.4k, False: 19]
  |  Branch (1532:64): [True: 0, False: 97.4k]
  ------------------
 1533|  97.5k|                bStereoAbs[ii] |= bCurStereoSp3 && (pINChI->Stereo->nCompInv2Abs != 0);
  ------------------
  |  Branch (1533:35): [True: 366, False: 97.1k]
  |  Branch (1533:52): [True: 12, False: 354]
  ------------------
 1534|       |
 1535|  97.5k|                bStereoAbsInverted[ii] |= bCurStereoSp3 && (pINChI->Stereo->nCompInv2Abs < 0);
  ------------------
  |  Branch (1535:43): [True: 366, False: 97.1k]
  |  Branch (1535:60): [True: 0, False: 366]
  ------------------
 1536|       |
 1537|       |                /* Fix08: missing isotopic inverted flag if isotopic = inverted non-isotopic */
 1538|  97.5k|                bIsotopicStereoAbsInverted[ii] |= (bCurIsoStereoSp3 && (pINChI->StereoIsotopic->nCompInv2Abs < 0)) ||
  ------------------
  |  Branch (1538:52): [True: 37, False: 97.4k]
  |  Branch (1538:72): [True: 0, False: 37]
  ------------------
 1539|  97.5k|                                                  (!bCurIsoStereoSp3 && pINChI->StereoIsotopic && pINChI->Stereo &&
  ------------------
  |  Branch (1539:52): [True: 97.4k, False: 37]
  |  Branch (1539:73): [True: 283, False: 97.1k]
  |  Branch (1539:99): [True: 133, False: 150]
  ------------------
 1540|    133|                                                   pINChI->StereoIsotopic->nCompInv2Abs &&
  ------------------
  |  Branch (1540:52): [True: 19, False: 114]
  ------------------
 1541|     19|                                                   pINChI->StereoIsotopic->nCompInv2Abs != pINChI->Stereo->nCompInv2Abs); /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (1541:52): [True: 19, False: 0]
  ------------------
 1542|       |
 1543|       |                /* Fix 11: missing /s1 if only isotopic stereo is inverted */
 1544|  97.5k|                bIsotopicStereoAbs[ii] |= (bCurIsoStereoSp3 && (pINChI->StereoIsotopic->nCompInv2Abs != 0)) ||
  ------------------
  |  Branch (1544:44): [True: 37, False: 97.4k]
  |  Branch (1544:64): [True: 0, False: 37]
  ------------------
 1545|  97.5k|                                          (!bCurIsoStereoSp3 && pINChI->StereoIsotopic && pINChI->Stereo &&
  ------------------
  |  Branch (1545:44): [True: 97.4k, False: 37]
  |  Branch (1545:65): [True: 283, False: 97.1k]
  |  Branch (1545:91): [True: 133, False: 150]
  ------------------
 1546|    133|                                           pINChI->StereoIsotopic->nCompInv2Abs &&
  ------------------
  |  Branch (1546:44): [True: 19, False: 114]
  ------------------
 1547|     19|                                           pINChI->StereoIsotopic->nCompInv2Abs != pINChI->Stereo->nCompInv2Abs); /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (1547:44): [True: 19, False: 0]
  ------------------
 1548|       |
 1549|  97.5k|                io.bRelativeStereo[ii] |= bCurRelative;
 1550|  97.5k|                io.bIsotopicRelativeStereo[ii] |= bCurIsoRelative;
 1551|  97.5k|                io.bRacemicStereo[ii] |= bCurRacemic;
 1552|  97.5k|                io.bIsotopicRacemicStereo[ii] |= bCurIsoRacemic;
 1553|       |
 1554|  97.5k|                bTautomericAcid |= (0 != (pINChI->nFlags & INCHI_FLAG_ACID_TAUT));
  ------------------
  |  |  120|  97.5k|#define INCHI_FLAG_ACID_TAUT            0x0001   /* tautomerism of dissociated acid invoked */
  ------------------
 1555|  97.5k|                bHardAddRemProton |= (0 != (pINChI->nFlags & INCHI_FLAG_HARD_ADD_REM_PROTON));
  ------------------
  |  |  127|  97.5k|#define INCHI_FLAG_HARD_ADD_REM_PROTON  0x0080   /* in normalization a proton has been added or removed along alt path */
  ------------------
 1556|  97.5k|                if (bCurTaut)
  ------------------
  |  Branch (1556:21): [True: 1.23k, False: 96.2k]
  ------------------
 1557|  1.23k|                {
 1558|  1.23k|                    io.bTautomeric |= 1; /* tautomeric representation is present */
 1559|       |                    /* does tautomeric structure have also a non-tautomeric repesentation? */
 1560|  1.23k|                    io.bNonTautomeric |= HAS_N(is);
  ------------------
  |  |   37|  1.23k|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  ------------------
  |  |  |  |  574|  1.23k|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (37:20): [True: 0, False: 1.23k]
  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1561|  1.23k|                }
 1562|       |
 1563|       |                /* Auxiliary info */
 1564|  97.5k|                if (!(bINChIOutputOptions & INCHI_OUT_NO_AUX_INFO) && (pINChI_Aux = is->pINChI_Aux[jj]))
  ------------------
  |  |  129|  97.5k|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
  |  Branch (1564:21): [True: 0, False: 97.5k]
  |  Branch (1564:71): [True: 0, False: 0]
  ------------------
 1565|      0|                {
 1566|       |                    /* detect presence of constitutional equivalence onfo */
 1567|      0|                    int bCurEqu, bCurTautEqu = 0, bCurIsoEqu = 0, bCurIsoTautEqu = 0; /* Fix15-disabled */
 1568|      0|                    io.bAtomEqu[ii] |= (bCurEqu = bHasEquString(pINChI_Aux->nConstitEquNumbers,
 1569|      0|                                                                pINChI_Aux->nNumberOfAtoms)); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 1570|      0|                    if (bCurTaut)
  ------------------
  |  Branch (1570:25): [True: 0, False: 0]
  ------------------
 1571|      0|                    {
 1572|      0|                        io.bTautEqu[ii] |= (bCurTautEqu = bHasEquString(pINChI_Aux->nConstitEquTGroupNumbers,
 1573|      0|                                                                        pINChI_Aux->nNumberOfTGroups)); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 1574|      0|                    }
 1575|      0|                    if (bCurIso)
  ------------------
  |  Branch (1575:25): [True: 0, False: 0]
  ------------------
 1576|      0|                    {
 1577|      0|                        io.bIsotopicAtomEqu[ii] |= (bCurIsoEqu = bHasEquString(pINChI_Aux->nConstitEquIsotopicNumbers,
 1578|      0|                                                                               pINChI_Aux->nNumberOfAtoms)) /*|| bCurEqu*/; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 1579|      0|                        if (bCurTaut)
  ------------------
  |  Branch (1579:29): [True: 0, False: 0]
  ------------------
 1580|      0|                        {
 1581|      0|                            io.bIsotopicTautEqu[ii] |= (bCurIsoTautEqu = bHasEquString(pINChI_Aux->nConstitEquIsotopicTGroupNumbers,
 1582|      0|                                                                                       pINChI_Aux->nNumberOfTGroups)) /*|| bCurTautEqu*/; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 1583|      0|                        }
 1584|       |                        /* non-zero if isotopic numbering for inverted isotopic stereo is different */
 1585|      0|                        io.bIsotopicOrigNumb[ii] |= bCurHasIsoStereo && /* Fix14 */
  ------------------
  |  Branch (1585:53): [True: 0, False: 0]
  ------------------
 1586|      0|                                                    pINChI_Aux->nOrigAtNosInCanonOrdInv &&
  ------------------
  |  Branch (1586:53): [True: 0, False: 0]
  ------------------
 1587|      0|                                                    pINChI_Aux->nIsotopicOrigAtNosInCanonOrd &&
  ------------------
  |  Branch (1587:53): [True: 0, False: 0]
  ------------------
 1588|      0|                                                    (0 != memcmp(pINChI_Aux->nOrigAtNosInCanonOrdInv,
  ------------------
  |  Branch (1588:53): [True: 0, False: 0]
  ------------------
 1589|      0|                                                                 pINChI_Aux->nIsotopicOrigAtNosInCanonOrd,
 1590|      0|                                                                 sizeof(pINChI_Aux->nOrigAtNosInCanonOrdInv[0]) * pINChI_Aux->nNumberOfAtoms));
 1591|      0|                    }
 1592|       |                    /* Inverted stereo */
 1593|      0|                    if (bCurStereoSp3 && pINChI->Stereo->nCompInv2Abs)
  ------------------
  |  Branch (1593:25): [True: 0, False: 0]
  |  Branch (1593:42): [True: 0, False: 0]
  ------------------
 1594|      0|                    {
 1595|      0|                        io.bInvStereo[ii] |= 1;
 1596|      0|                        io.bInvStereoOrigNumb[ii] |= pINChI_Aux->nOrigAtNosInCanonOrd &&
  ------------------
  |  Branch (1596:54): [True: 0, False: 0]
  ------------------
 1597|      0|                                                     pINChI_Aux->nOrigAtNosInCanonOrdInv &&
  ------------------
  |  Branch (1597:54): [True: 0, False: 0]
  ------------------
 1598|      0|                                                     (0 != memcmp(pINChI_Aux->nOrigAtNosInCanonOrd,
  ------------------
  |  Branch (1598:54): [True: 0, False: 0]
  ------------------
 1599|      0|                                                                  pINChI_Aux->nOrigAtNosInCanonOrdInv,
 1600|      0|                                                                  sizeof(pINChI_Aux->nOrigAtNosInCanonOrd[0]) * pINChI_Aux->nNumberOfAtoms));
 1601|      0|                    }
 1602|       |
 1603|       |                    /* Inverted isotopic stereo */
 1604|      0|                    if (bCurIsoStereoSp3 && pINChI->StereoIsotopic->nCompInv2Abs)
  ------------------
  |  Branch (1604:25): [True: 0, False: 0]
  |  Branch (1604:45): [True: 0, False: 0]
  ------------------
 1605|      0|                    {
 1606|      0|                        io.bInvIsotopicStereo[ii] |= 1;
 1607|       |
 1608|      0|                        io.bInvIsotopicStereoOrigNumb[ii] |= pINChI_Aux->nIsotopicOrigAtNosInCanonOrd &&
  ------------------
  |  Branch (1608:62): [True: 0, False: 0]
  ------------------
 1609|      0|                                                             pINChI_Aux->nIsotopicOrigAtNosInCanonOrdInv &&
  ------------------
  |  Branch (1609:62): [True: 0, False: 0]
  ------------------
 1610|      0|                                                             (0 != memcmp(pINChI_Aux->nIsotopicOrigAtNosInCanonOrd,
  ------------------
  |  Branch (1610:62): [True: 0, False: 0]
  ------------------
 1611|      0|                                                                          pINChI_Aux->nIsotopicOrigAtNosInCanonOrdInv,
 1612|      0|                                                                          sizeof(pINChI_Aux->nIsotopicOrigAtNosInCanonOrd[0]) * pINChI_Aux->nNumberOfAtoms));
 1613|      0|                    }
 1614|       |
 1615|      0|                    if (pINChI_Aux->OrigInfo && bHasOrigInfo(pINChI_Aux->OrigInfo, pINChI_Aux->nNumberOfAtoms))
  ------------------
  |  Branch (1615:25): [True: 0, False: 0]
  |  Branch (1615:49): [True: 0, False: 0]
  ------------------
 1616|      0|                    {
 1617|      0|                        io.bChargesRadVal[ii] |= 1;
 1618|      0|                    }
 1619|      0|                }
 1620|       |
 1621|  97.5k|                if (ip->bEnhancedStereo)
  ------------------
  |  Branch (1621:21): [True: 0, False: 97.5k]
  ------------------
 1622|      0|                {
 1623|      0|                    set_EnhancedStereo_t_m_layers(orig_inp_data, pINChI, pINChI_Aux);
 1624|      0|                }
 1625|  97.5k|            }
 1626|  97.5k|        }
 1627|  97.5k|        if (bCompExists)
  ------------------
  |  Branch (1627:13): [True: 97.5k, False: 0]
  ------------------
 1628|  97.5k|        {
 1629|   292k|            for (j = TAUT_NON; j < TAUT_NUM; j++)
  ------------------
  |  |  574|  97.5k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                          for (j = TAUT_NON; j < TAUT_NUM; j++)
  ------------------
  |  |  573|   292k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1629:32): [True: 195k, False: 97.5k]
  ------------------
 1630|   195k|            {
 1631|   195k|                io.num_comp[j]++;
 1632|   195k|            }
 1633|  97.5k|        }
 1634|  97.5k|    }
 1635|  5.02k|    if (io.bTautomeric /*&& bTautomericAcid*/) /* "&& bTautomericAcid" commented out 2004-06-02 */
  ------------------
  |  Branch (1635:9): [True: 1.16k, False: 3.85k]
  ------------------
 1636|  1.16k|    {
 1637|  1.16k|        io.bTautomeric += bTautomericAcid; /* long-range tautomerism */
 1638|  1.16k|        io.bTautomeric += (bHardAddRemProton ? 4 : 0);
  ------------------
  |  Branch (1638:28): [True: 0, False: 1.16k]
  ------------------
 1639|  1.16k|    }
 1640|  5.02k|    if (bRequestedRacemicStereo || bRequestedRelativeStereo)
  ------------------
  |  Branch (1640:9): [True: 20, False: 5.00k]
  |  Branch (1640:36): [True: 24, False: 4.98k]
  ------------------
 1641|     44|    {
 1642|       |        /* do not output inverted stereo info */
 1643|    132|        for (i = 0; i < TAUT_NUM; i++)
  ------------------
  |  |  573|    132|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1643:21): [True: 88, False: 44]
  ------------------
 1644|     88|        {
 1645|       |            /* Fix11 */
 1646|     88|            bStereoAbsInverted[i] =
 1647|     88|                bStereoAbs[i] =
 1648|     88|                    io.bInvStereo[i] =
 1649|     88|                        io.bInvStereoOrigNumb[i] = 0;
 1650|       |            /* io.bIsotopicRelativeStereo[i]=0 may happen because iso stereo is same or inverted non-iso stereo */
 1651|     88|            bIsotopicStereoAbsInverted[i] =
 1652|     88|                bIsotopicStereoAbs[i] =
 1653|     88|                    io.bInvIsotopicStereo[i] =
 1654|     88|                        io.bInvIsotopicStereoOrigNumb[i] = 0;
 1655|     88|        }
 1656|     44|    }
 1657|       |
 1658|  5.02k|    io.iCurTautMode = io.bOutType == OUT_N1 ? TAUT_NON : /*  only non-taut */
  ------------------
  |  |  580|  5.02k|#define OUT_N1              0    /* non-tautomeric only */
  ------------------
                  io.iCurTautMode = io.bOutType == OUT_N1 ? TAUT_NON : /*  only non-taut */
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1658:23): [True: 0, False: 5.02k]
  ------------------
 1659|       |
 1660|  5.02k|                          io.bOutType == OUT_T1 ? TAUT_YES
  ------------------
  |  |  581|  5.02k|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  ------------------
                                        io.bOutType == OUT_T1 ? TAUT_YES
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1660:27): [True: 0, False: 5.02k]
  ------------------
 1661|  5.02k|                                                : /*  tautomeric if present, otherwise non-tautomeric     */
 1662|  5.02k|                          io.bOutType == OUT_NT ? TAUT_NON
  ------------------
  |  |  582|  5.02k|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  ------------------
                                        io.bOutType == OUT_NT ? TAUT_NON
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1662:27): [True: 0, False: 5.02k]
  ------------------
 1663|  5.02k|                                                : /*  only non-taut representations of tautomeric         */
 1664|  5.02k|                          io.bOutType == OUT_TN ? TAUT_YES
  ------------------
  |  |  583|  5.02k|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
                                        io.bOutType == OUT_TN ? TAUT_YES
  ------------------
  |  |  575|  5.02k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1664:27): [True: 5.02k, False: 0]
  ------------------
 1665|  5.02k|                                                : /*  tautomeric if present otherwise non-tautomeric;     */
 1666|  5.02k|                          -1;                     /*  separately output non-taut representations of tautomeric if present */
 1667|       |
 1668|  5.02k|    if (io.iCurTautMode < 0)
  ------------------
  |  Branch (1668:9): [True: 0, False: 5.02k]
  ------------------
 1669|      0|    {
 1670|      0|        return 0; /* error */
 1671|      0|    }
 1672|       |
 1673|       |    /* Now print out */
 1674|       |
 1675|  5.02k|    io.bOverflow = 0;
 1676|  5.02k|    io.num_components = io.num_comp[io.iCurTautMode];
 1677|       |    /* djb-rwth: removing redundant code */
 1678|       |
 1679|  5.02k|    if (bINChIOutputOptions & INCHI_OUT_ONLY_AUX_INFO)
  ------------------
  |  |  131|  5.02k|#define INCHI_OUT_ONLY_AUX_INFO         0x0004   /* output only Aux Info                    */
  ------------------
  |  Branch (1679:9): [True: 0, False: 5.02k]
  ------------------
 1680|      0|    {
 1681|      0|        goto output_aux_info;
 1682|      0|    }
 1683|       |
 1684|  5.02k|    io.nCurINChISegment = DIFL_M;
 1685|       |
 1686|       |    /* InChI output: version prefix */
 1687|  5.02k|    if (INCHI_basic_or_INCHI_reconnected == INCHI_BAS || !(bINChIOutputOptions & INCHI_OUT_EMBED_REC))
  ------------------
  |  |  570|  10.0k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                  if (INCHI_basic_or_INCHI_reconnected == INCHI_BAS || !(bINChIOutputOptions & INCHI_OUT_EMBED_REC))
  ------------------
  |  |  132|      0|#define INCHI_OUT_EMBED_REC             0x0008   /* embed reconnected INChI into disconnected INChI */
  ------------------
  |  Branch (1687:9): [True: 5.02k, False: 0]
  |  Branch (1687:58): [True: 0, False: 0]
  ------------------
 1688|  5.02k|    {
 1689|  5.02k|        int is_beta = 0;
 1690|  5.02k|        int nAtomsAllComp = inchi_max(nAtomsAllComp1, nAtomsAllComp2);
  ------------------
  |  |  138|  5.02k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 5.02k]
  |  |  ------------------
  ------------------
 1691|       |
 1692|  5.02k|#if ( READ_INCHI_STRING == 1 )
 1693|  5.02k|        if (ip->bReadInChIOptions & (READ_INCHI_OUTPUT_INCHI | READ_INCHI_TO_STRUCTURE))
  ------------------
  |  |  988|  5.02k|#define READ_INCHI_OUTPUT_INCHI          0x00000001
  ------------------
                      if (ip->bReadInChIOptions & (READ_INCHI_OUTPUT_INCHI | READ_INCHI_TO_STRUCTURE))
  ------------------
  |  |  991|  5.02k|#define READ_INCHI_TO_STRUCTURE          0x00000008
  ------------------
  |  Branch (1693:13): [True: 5.02k, False: 0]
  ------------------
 1694|  5.02k|        {
 1695|  5.02k|            if (ip->bReadInChIOptions & READ_INCHI_INPUT_BETA)
  ------------------
  |  |  992|  5.02k|#define READ_INCHI_INPUT_BETA            0x00000010
  ------------------
  |  Branch (1695:17): [True: 3, False: 5.02k]
  ------------------
 1696|      3|            {
 1697|      3|                is_beta = 1;
 1698|      3|            }
 1699|  5.02k|        }
 1700|      0|        else
 1701|      0|#endif
 1702|      0|        if (is_molecular_inorganic)
  ------------------
  |  Branch (1702:13): [True: 0, False: 0]
  ------------------
 1703|      0|        {
 1704|       |            /*
 1705|       |             * Molecular Inorganics is a Beta feature in this release.
 1706|       |             */
 1707|      0|            is_beta = 1;
 1708|      0|        }
 1709|       |
 1710|  5.02k|        if (nAtomsAllComp > NORMALLY_ALLOWED_INP_MAX_ATOMS)
  ------------------
  |  |   16|  5.02k|#define NORMALLY_ALLOWED_INP_MAX_ATOMS 1024
  ------------------
  |  Branch (1710:13): [True: 123, False: 4.90k]
  ------------------
 1711|    123|        {
 1712|       |            /* v. 1.05 for LargeMolecules */
 1713|    123|            is_beta = 1;
 1714|    123|        }
 1715|  5.02k|        if (pOrigStruct && pOrigStruct->polymer)
  ------------------
  |  Branch (1715:13): [True: 0, False: 5.02k]
  |  Branch (1715:28): [True: 0, False: 0]
  ------------------
 1716|      0|        {
 1717|       |            /* v. 1.05 for Polymers */
 1718|      0|            is_beta = 1;
 1719|      0|        }
 1720|       |        /* specifically put 'B' for empty structure InChI    */
 1721|       |        /* if "Polymers" or "LargeMolecules" requested        */
 1722|  5.02k|        else if (!pOrigStruct && (ip->bLargeMolecules || ip->bPolymers))
  ------------------
  |  Branch (1722:18): [True: 5.02k, False: 0]
  |  Branch (1722:35): [True: 0, False: 5.02k]
  |  Branch (1722:58): [True: 0, False: 5.02k]
  ------------------
 1723|      0|        {
 1724|      0|            is_beta = 1;
 1725|      0|        }
 1726|  5.02k|        else if (pOrigStruct && pOrigStruct->n_zy)
  ------------------
  |  Branch (1726:18): [True: 0, False: 5.02k]
  |  Branch (1726:33): [True: 0, False: 0]
  ------------------
 1727|      0|        {
 1728|      0|            is_beta = 1;
 1729|      0|        }
 1730|  5.02k|        else if (ip->bEnhancedStereo)
  ------------------
  |  Branch (1730:18): [True: 0, False: 5.02k]
  ------------------
 1731|      0|        {
 1732|      0|            is_beta = 1;
 1733|      0|        }
 1734|       |
 1735|  5.02k|        OutputINCHI_VersionAndKind(out_file, strbuf, bINChIOutputOptions, is_beta, is_molecular_inorganic, pLF, pTAB);
 1736|  5.02k|    }
 1737|       |
 1738|       |    /* InChI output: atoms */
 1739|  5.02k|    intermediate_result = OutputINCHI_MainLayerFormula(pCG, out_file, strbuf,
 1740|  5.02k|                                                       num_components2,
 1741|  5.02k|                                                       &INCHI_basic_or_INCHI_reconnected,
 1742|  5.02k|                                                       &io, pLF, pTAB);
 1743|  5.02k|    if (intermediate_result != 0)
  ------------------
  |  Branch (1743:9): [True: 0, False: 5.02k]
  ------------------
 1744|      0|        goto exit_function;
 1745|       |
 1746|       |    /* InChI output: connection table */
 1747|  5.02k|    intermediate_result = OutputINCHI_MainLayerConnections(pCG, out_file, strbuf, num_components2,
 1748|  5.02k|                                                           &INCHI_basic_or_INCHI_reconnected,
 1749|  5.02k|                                                           &io, pLF, pTAB);
 1750|  5.02k|    if (intermediate_result != 0)
  ------------------
  |  Branch (1750:9): [True: 0, False: 5.02k]
  ------------------
 1751|      0|        goto exit_function;
 1752|       |
 1753|       |    /* InChI output: hydrogens (with tautomeric info) */
 1754|  5.02k|    intermediate_result = OutputINCHI_MainLayerHydrogens(pCG, out_file, strbuf, num_components2,
 1755|  5.02k|                                                         &INCHI_basic_or_INCHI_reconnected,
 1756|  5.02k|                                                         &io, pLF, pTAB);
 1757|  5.02k|    if (intermediate_result != 0)
  ------------------
  |  Branch (1757:9): [True: 0, False: 5.02k]
  ------------------
 1758|      0|        goto exit_function;
 1759|       |
 1760|  5.02k|    io.bFhTag = 0;
 1761|  5.02k|    npass = 0;
 1762|       |
 1763|  5.02k|repeat_INChI_output:
 1764|       |
 1765|       |    /* InChI output: charge and  removed protons */
 1766|  5.02k|    intermediate_result = OutputINCHI_ChargeAndRemovedAddedProtonsLayers(pCG, out_file, strbuf,
 1767|  5.02k|                                                                         &io, pLF, pTAB);
 1768|  5.02k|    if (intermediate_result != 0)
  ------------------
  |  Branch (1768:9): [True: 0, False: 5.02k]
  ------------------
 1769|      0|        goto exit_function;
 1770|       |
 1771|       |    /* InChI output: polymer layer */
 1772|  5.02k|    if (npass == 0)
  ------------------
  |  Branch (1772:9): [True: 5.02k, False: 0]
  ------------------
 1773|  5.02k|    {
 1774|  5.02k|        intermediate_result = OutputINCHI_PolymerLayer(pCG, out_file, strbuf,
 1775|  5.02k|                                                       &INCHI_basic_or_INCHI_reconnected,
 1776|  5.02k|                                                       orig_inp_data, pOrigStruct,
 1777|  5.02k|                                                       &io, pLF, pTAB);
 1778|  5.02k|        if (intermediate_result != 0)
  ------------------
  |  Branch (1778:13): [True: 0, False: 5.02k]
  ------------------
 1779|      0|            goto exit_function;
 1780|  5.02k|    }
 1781|       |
 1782|       |    /* InChI output: stereo (non-isotopic) */
 1783|  5.02k|    if (ip->bEnhancedStereo) {
  ------------------
  |  Branch (1783:9): [True: 0, False: 5.02k]
  ------------------
 1784|      0|        intermediate_result = OutputINCHI_StereoLayer_EnhancedStereo( pCG, out_file, strbuf, &io, orig_inp_data, pLF, pTAB );
 1785|  5.02k|    } else {
 1786|  5.02k|        intermediate_result = OutputINCHI_StereoLayer( pCG, out_file, strbuf, &io, pLF, pTAB );
 1787|  5.02k|    }
 1788|  5.02k|    if (intermediate_result != 0)
  ------------------
  |  Branch (1788:9): [True: 0, False: 5.02k]
  ------------------
 1789|      0|        goto exit_function;
 1790|       |
 1791|       |    /* Switch from M to MI or from F to FI */
 1792|  5.02k|    io.nCurINChISegment++;
 1793|       |
 1794|       |    /* InChI output: isotopic */
 1795|  5.02k|    intermediate_result = OutputINCHI_IsotopicLayer(pCG, out_file, strbuf,
 1796|  5.02k|                                                    &INCHI_basic_or_INCHI_reconnected,
 1797|  5.02k|                                                    &io, pLF, pTAB);
 1798|       |
 1799|  5.02k|    if (intermediate_result != 0)
  ------------------
  |  Branch (1799:9): [True: 0, False: 5.02k]
  ------------------
 1800|      0|    {
 1801|      0|        goto exit_function;
 1802|      0|    }
 1803|       |
 1804|       |    /*
 1805|       |        At this point the INChI part of the output has been done.
 1806|       |        If this INChI is tautomeric and non-tautomeric results exist,
 1807|       |        then we need to output non-tautomeric data:
 1808|       |            fixed H
 1809|       |            stereo
 1810|       |            isotopic
 1811|       |            isotopic stereo
 1812|       |    */
 1813|       |
 1814|       |    /* InChI output: FixedH and sublayers */
 1815|  5.02k|    intermediate_result = OutputINCHI_FixedHLayerWithSublayers(pCG, out_file, strbuf,
 1816|  5.02k|                                                               &INCHI_basic_or_INCHI_reconnected,
 1817|  5.02k|                                                               &io, pLF, pTAB,
 1818|  5.02k|                                                               &then_goto_repeat);
 1819|  5.02k|    if (intermediate_result != 0)
  ------------------
  |  Branch (1819:9): [True: 0, False: 5.02k]
  ------------------
 1820|      0|    {
 1821|      0|        goto exit_function;
 1822|      0|    }
 1823|  5.02k|    if (then_goto_repeat)
  ------------------
  |  Branch (1823:9): [True: 0, False: 5.02k]
  ------------------
 1824|      0|    {
 1825|      0|        npass++;
 1826|      0|        goto repeat_INChI_output;
 1827|      0|    }
 1828|       |
 1829|       |    /*
 1830|       |        InChI output:  reconnected structure
 1831|       |    */
 1832|       |
 1833|  5.02k|    bEmbeddedOutputCalled = 0;
 1834|  5.02k|    if (bDisconnectedCoord && INCHI_basic_or_INCHI_reconnected == INCHI_BAS &&
  ------------------
  |  |  570|  5.02k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1834:9): [True: 0, False: 5.02k]
  |  Branch (1834:31): [True: 0, False: 0]
  ------------------
 1835|      0|        (bINChIOutputOptions & INCHI_OUT_EMBED_REC) && num_components2[INCHI_REC])
  ------------------
  |  |  132|      0|#define INCHI_OUT_EMBED_REC             0x0008   /* embed reconnected INChI into disconnected INChI */
  ------------------
                      (bINChIOutputOptions & INCHI_OUT_EMBED_REC) && num_components2[INCHI_REC])
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1835:9): [True: 0, False: 0]
  |  Branch (1835:56): [True: 0, False: 0]
  ------------------
 1836|      0|    {
 1837|      0|        int nRet;
 1838|      0|        bEmbeddedOutputCalled = 1;
 1839|       |
 1840|       |        /* output blank line before /R: in case of bPlainTextCommnts=1 */
 1841|      0|        inchi_ios_print_nodisplay(out_file, "%s", pLF);
 1842|       |        /* end of disconnected INChI output */
 1843|       |
 1844|      0|        nRet = OutputINChI1(pCG,
 1845|      0|                            strbuf,
 1846|      0|                            pINChISortTautAndNonTaut2,
 1847|      0|                            INCHI_REC,
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1848|      0|                            orig_inp_data,
 1849|      0|                            pOrigStruct,
 1850|      0|                            ip,
 1851|      0|                            0 /*bDisconnectedCoord*/,
 1852|      0|                            bOutputType,
 1853|      0|                            bINChIOutputOptions | INCHI_OUT_NO_AUX_INFO,
  ------------------
  |  |  129|      0|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
 1854|      0|                            num_components2,
 1855|      0|                            num_non_taut2,
 1856|      0|                            num_taut2,
 1857|      0|                            out_file,
 1858|      0|                            log_file,
 1859|      0|                            num_input_struct,
 1860|      0|                            pSortPrintINChIFlags,
 1861|      0|                            save_opt_bits);
 1862|       |
 1863|      0|        if (!nRet)
  ------------------
  |  Branch (1863:13): [True: 0, False: 0]
  ------------------
 1864|      0|        {
 1865|      0|            goto exit_function; /* error */
 1866|      0|        }
 1867|      0|    }
 1868|       |
 1869|       |    /* InChI output: save InChI creation options if requested */
 1870|  5.02k|    if (!bEmbeddedOutputCalled &&
  ------------------
  |  Branch (1870:9): [True: 5.02k, False: 0]
  ------------------
 1871|  5.02k|        (bINChIOutputOptions & INCHI_OUT_SAVEOPT) &&
  ------------------
  |  |  146|  5.02k|#define INCHI_OUT_SAVEOPT  0x8000
  ------------------
  |  Branch (1871:9): [True: 0, False: 5.02k]
  ------------------
 1872|      0|        (0 == (bINChIOutputOptions & INCHI_OUT_STDINCHI)) /* not std-InChI output */
  ------------------
  |  |  145|      0|#define INCHI_OUT_STDINCHI 0x4000
  ------------------
  |  Branch (1872:9): [True: 0, False: 0]
  ------------------
 1873|  5.02k|    )
 1874|      0|    {
 1875|      0|        char let1, let2;
 1876|      0|        GetSaveOptLetters(save_opt_bits, &let1, &let2);
 1877|      0|        inchi_ios_print_nodisplay(out_file, "\\%c%c", let1, let2);
 1878|      0|    }
 1879|  5.02k|    if (!bEmbeddedOutputCalled && !bPlainTextCommnts)
  ------------------
  |  Branch (1879:9): [True: 5.02k, False: 0]
  |  Branch (1879:35): [True: 5.02k, False: 0]
  ------------------
 1880|  5.02k|    { /* plain text comment earlier ended with LF */
 1881|  5.02k|        inchi_ios_print_nodisplay(out_file, "%s%s",
 1882|  5.02k|                                  (!num_components2[0] && !num_components2[1]) ? "//" : "", /* empty InChI=// */
  ------------------
  |  Branch (1882:36): [True: 0, False: 5.02k]
  |  Branch (1882:59): [True: 0, False: 0]
  ------------------
 1883|  5.02k|                                  (bINChIOutputOptions & INCHI_OUT_NO_AUX_INFO) ? "\n" : pTAB);
  ------------------
  |  |  129|  5.02k|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
  |  Branch (1883:35): [True: 5.02k, False: 0]
  ------------------
 1884|       |        /* end of INChI= output */
 1885|  5.02k|    }
 1886|       |
 1887|  5.02k|    inchi_strbuf_reset(strbuf);
 1888|       |
 1889|       |#ifdef TARGET_LIB_FOR_WINCHI
 1890|       |    /* @@@ Here we end up with silent output: display previously hidden output */
 1891|       |    if (inchi_ios_flush_not_displayed(out_file) != -1)
 1892|       |        silent = 0;
 1893|       |#endif
 1894|       |
 1895|  5.02k|output_aux_info:
 1896|       |
 1897|       |    /*  Output Aux Info */
 1898|       |
 1899|  5.02k|    io.bFhTag = 0;
 1900|  5.02k|    if ((bINChIOutputOptions & INCHI_OUT_NO_AUX_INFO) == 0)
  ------------------
  |  |  129|  5.02k|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
  |  Branch (1900:9): [True: 0, False: 5.02k]
  ------------------
 1901|      0|    {
 1902|       |
 1903|      0|        io.num_components = io.num_comp[io.iCurTautMode];
 1904|       |
 1905|       |        /* AuxInfo: header and normalization type */
 1906|      0|        intermediate_result = OutputAUXINFO_HeaderAndNormalization_type(pCG, out_file, strbuf,
 1907|      0|                                                                        bINChIOutputOptions,
 1908|      0|                                                                        &INCHI_basic_or_INCHI_reconnected,
 1909|      0|                                                                        num_components2,
 1910|      0|                                                                        &io, pLF, pTAB);
 1911|      0|        if (intermediate_result != 0)
  ------------------
  |  Branch (1911:13): [True: 0, False: 0]
  ------------------
 1912|      0|            goto exit_function;
 1913|       |
 1914|      0|    repeat_INChI_Aux_output:
 1915|       |
 1916|       |        /* AuxInfo: original atom numbers and symmetry numbers (constit. equivalence /E: )    */
 1917|      0|        intermediate_result = OutputAUXINFO_OriginalNumbersAndEquivalenceClasses(pCG, out_file, strbuf,
 1918|      0|                                                                                 num_components2,
 1919|      0|                                                                                 &io, pLF, pTAB);
 1920|      0|        if (intermediate_result != 0)
  ------------------
  |  Branch (1920:13): [True: 0, False: 0]
  ------------------
 1921|      0|            goto exit_function;
 1922|       |
 1923|       |        /* AuxInfo: tautomeric groups equivalence */
 1924|      0|        intermediate_result = OutputAUXINFO_TautomericGroupsEquivalence(pCG, out_file, strbuf, &io);
 1925|      0|        if (intermediate_result != 0)
  ------------------
  |  Branch (1925:13): [True: 0, False: 0]
  ------------------
 1926|      0|            goto exit_function;
 1927|       |
 1928|       |        /* AuxInfo: stereo data */
 1929|      0|        intermediate_result = OutputAUXINFO_Stereo(pCG, out_file, strbuf, &io, pLF, pTAB);
 1930|      0|        if (intermediate_result != 0)
  ------------------
  |  Branch (1930:13): [True: 0, False: 0]
  ------------------
 1931|      0|            goto exit_function;
 1932|       |
 1933|      0|    repeat_INChI_Aux_Iso_output:
 1934|       |        /* AuxInfo: isotopic info */
 1935|      0|        intermediate_result = OutputAUXINFO_IsotopicInfo(pCG, out_file, strbuf,
 1936|      0|                                                         &INCHI_basic_or_INCHI_reconnected,
 1937|      0|                                                         &io, pLF, pTAB);
 1938|      0|        if (intermediate_result != 0)
  ------------------
  |  Branch (1938:13): [True: 0, False: 0]
  ------------------
 1939|      0|        {
 1940|      0|            goto exit_function;
 1941|      0|        }
 1942|       |
 1943|       |        /*
 1944|       |          At this point the INChI_Aux part of the output has been completed.
 1945|       |          If this INChI is tautomeric and non-tautomeric results exist,
 1946|       |          then we need to output non-tautomeric auxilialy data
 1947|       |          (same as above excluding tautomeric information).
 1948|       |          Currently, this is enabled for xml output only
 1949|       |        */
 1950|       |
 1951|      0|        if (io.bOutType == OUT_TN && io.bTautomeric && io.bNonTautomeric &&
  ------------------
  |  |  583|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (1951:13): [True: 0, False: 0]
  |  Branch (1951:38): [True: 0, False: 0]
  |  Branch (1951:56): [True: 0, False: 0]
  ------------------
 1952|       |            /* Check whether the Fixed-H layer is empty */
 1953|      0|            (*pSortPrintINChIFlags & ((INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS : FLAG_SORT_PRINT_NO_NFIX_H_REC)) &&
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          (*pSortPrintINChIFlags & ((INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS : FLAG_SORT_PRINT_NO_NFIX_H_REC)) &&
  ------------------
  |  |  662|      0|#define FLAG_SORT_PRINT_NO_NFIX_H_BAS 4  /* no fixed H non-isotopic in the main InChI layer */
  ------------------
                          (*pSortPrintINChIFlags & ((INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS : FLAG_SORT_PRINT_NO_NFIX_H_REC)) &&
  ------------------
  |  |  663|      0|#define FLAG_SORT_PRINT_NO_NFIX_H_REC 8  /* no fixed H non-isotopic in the reconnected InChI layer */
  ------------------
  |  Branch (1953:13): [True: 0, False: 0]
  |  Branch (1953:39): [True: 0, False: 0]
  ------------------
 1954|      0|            (*pSortPrintINChIFlags & ((INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_IFIX_H_BAS : FLAG_SORT_PRINT_NO_IFIX_H_REC)))
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          (*pSortPrintINChIFlags & ((INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_IFIX_H_BAS : FLAG_SORT_PRINT_NO_IFIX_H_REC)))
  ------------------
  |  |  664|      0|#define FLAG_SORT_PRINT_NO_IFIX_H_BAS 16 /* no fixed H isotopic in the main InChI layer */
  ------------------
                          (*pSortPrintINChIFlags & ((INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_IFIX_H_BAS : FLAG_SORT_PRINT_NO_IFIX_H_REC)))
  ------------------
  |  |  665|      0|#define FLAG_SORT_PRINT_NO_IFIX_H_REC 32 /* no fixed H isotopic in the the reconnected InChI layer */
  ------------------
  |  Branch (1954:13): [True: 0, False: 0]
  |  Branch (1954:39): [True: 0, False: 0]
  ------------------
 1955|      0|        {
 1956|      0|            io.bNonTautomeric = 0; /* bNonTautIdentifierNotEmpty == 0 => no fixed H info 02-10-2995 */
 1957|      0|        }
 1958|       |
 1959|      0|        if (io.bOutType == OUT_TN && io.bTautomeric && io.bNonTautomeric)
  ------------------
  |  |  583|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (1959:13): [True: 0, False: 0]
  |  Branch (1959:38): [True: 0, False: 0]
  |  Branch (1959:56): [True: 0, False: 0]
  ------------------
 1960|      0|        {
 1961|       |            /* add the second (non-tautomeric) output */
 1962|      0|            io.bOutType = OUT_NONTAUT;
  ------------------
  |  |  920|      0|#define OUT_NONTAUT OUT_NN /* was OUT_NT until 2004-04-07 */
  |  |  ------------------
  |  |  |  |  585|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  ------------------
 1963|      0|            io.iCurTautMode = TAUT_NON;
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1964|      0|            io.pINChISort = io.pINChISortTautAndNonTaut[TAUT_NON];
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1965|      0|            io.bSecondNonTautPass = 1;
 1966|      0|            io.num_components = io.num_comp[io.iCurTautMode];
 1967|      0|            io.bFhTag = AL_FIXH;
 1968|      0|            inchi_strbuf_reset(strbuf); /*pStr[io.tot_len=0] = '\0';*/
 1969|       |
 1970|       |            /* if InChI Fixed-H isotopic is empty then do not output corresponding AuxInfo */
 1971|      0|            if (!(*pSortPrintINChIFlags &
  ------------------
  |  Branch (1971:17): [True: 0, False: 0]
  ------------------
 1972|      0|                  ((INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS : FLAG_SORT_PRINT_NO_NFIX_H_REC)))
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                                ((INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS : FLAG_SORT_PRINT_NO_NFIX_H_REC)))
  ------------------
  |  |  662|      0|#define FLAG_SORT_PRINT_NO_NFIX_H_BAS 4  /* no fixed H non-isotopic in the main InChI layer */
  ------------------
                                ((INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS : FLAG_SORT_PRINT_NO_NFIX_H_REC)))
  ------------------
  |  |  663|      0|#define FLAG_SORT_PRINT_NO_NFIX_H_REC 8  /* no fixed H non-isotopic in the reconnected InChI layer */
  ------------------
  |  Branch (1972:20): [True: 0, False: 0]
  ------------------
 1973|      0|            {
 1974|      0|                npass++;
 1975|      0|                goto repeat_INChI_Aux_output;
 1976|      0|            }
 1977|      0|            else
 1978|      0|            {
 1979|      0|                npass++;
 1980|      0|                goto repeat_INChI_Aux_Iso_output;
 1981|      0|            }
 1982|      0|        }
 1983|      0|        else
 1984|      0|        {
 1985|      0|            if (io.bOutType == OUT_NONTAUT && io.bOutputType == OUT_TN && io.bTautomeric && io.bNonTautomeric)
  ------------------
  |  |  920|      0|#define OUT_NONTAUT OUT_NN /* was OUT_NT until 2004-04-07 */
  |  |  ------------------
  |  |  |  |  585|      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)
  ------------------
  |  |  583|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (1985:17): [True: 0, False: 0]
  |  Branch (1985:47): [True: 0, False: 0]
  |  Branch (1985:75): [True: 0, False: 0]
  |  Branch (1985:93): [True: 0, False: 0]
  ------------------
 1986|      0|            {
 1987|       |                /* the second (non-taut) output has been done; restore variables */
 1988|      0|                io.bOutType = OUT_TN;
  ------------------
  |  |  583|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
 1989|      0|                io.iCurTautMode = TAUT_YES;
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1990|      0|                io.pINChISort = io.pINChISortTautAndNonTaut[TAUT_YES];
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1991|      0|                io.bSecondNonTautPass = 0;
 1992|       |                /* set correct num components for the reversibility info 02-10-2005 */
 1993|      0|                io.num_components = io.num_comp[io.iCurTautMode];
 1994|      0|                io.bFhTag = 0;
 1995|      0|            }
 1996|      0|        }
 1997|       |
 1998|       |        /*    Charges, radicals, unusual valences */
 1999|      0|        intermediate_result = OutputAUXINFO_ChargesRadicalsAndUnusualValences(pCG, out_file, strbuf, &io, pLF, pTAB);
 2000|      0|        if (intermediate_result != 0)
  ------------------
  |  Branch (2000:13): [True: 0, False: 0]
  ------------------
 2001|      0|        {
 2002|      0|            goto exit_function;
 2003|      0|        }
 2004|       |
 2005|       |        /* Output the original input structure -- quick fix */
 2006|      0|        intermediate_result = OutputAUXINFO_ReversibilityInfo(pCG, out_file, strbuf, pOrigStruct, &io, pLF, pTAB);
 2007|      0|        if (intermediate_result != 0)
  ------------------
  |  Branch (2007:13): [True: 0, False: 0]
  ------------------
 2008|      0|        {
 2009|      0|            goto exit_function;
 2010|      0|        }
 2011|       |
 2012|       |        /* Output polymeric Aux Info */
 2013|      0|        intermediate_result = OutputAUXINFO_PolymerInfo(pCG, out_file, strbuf, pOrigStruct, &io, pLF, pTAB);
 2014|      0|        if (intermediate_result != 0)
  ------------------
  |  Branch (2014:13): [True: 0, False: 0]
  ------------------
 2015|      0|        {
 2016|      0|            goto exit_function;
 2017|      0|        }
 2018|       |
 2019|       |        /*
 2020|       |            Output INChI_Aux of the reconnected structure
 2021|       |        */
 2022|       |
 2023|      0|        bEmbeddedOutputCalled = 0;
 2024|      0|        if (bDisconnectedCoord && INCHI_basic_or_INCHI_reconnected == INCHI_BAS && (bINChIOutputOptions & INCHI_OUT_EMBED_REC) &&
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      if (bDisconnectedCoord && INCHI_basic_or_INCHI_reconnected == INCHI_BAS && (bINChIOutputOptions & INCHI_OUT_EMBED_REC) &&
  ------------------
  |  |  132|      0|#define INCHI_OUT_EMBED_REC             0x0008   /* embed reconnected INChI into disconnected INChI */
  ------------------
  |  Branch (2024:13): [True: 0, False: 0]
  |  Branch (2024:35): [True: 0, False: 0]
  |  Branch (2024:84): [True: 0, False: 0]
  ------------------
 2025|      0|            num_components2[INCHI_REC] && !(bINChIOutputOptions & INCHI_OUT_NO_AUX_INFO))
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          num_components2[INCHI_REC] && !(bINChIOutputOptions & INCHI_OUT_NO_AUX_INFO))
  ------------------
  |  |  129|      0|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
  |  Branch (2025:13): [True: 0, False: 0]
  |  Branch (2025:43): [True: 0, False: 0]
  ------------------
 2026|      0|        {
 2027|      0|            int nRet;
 2028|      0|            bEmbeddedOutputCalled = 1;
 2029|      0|            inchi_ios_print(out_file, "%s", pLF);
 2030|       |
 2031|      0|            nRet = OutputINChI1(pCG,
 2032|      0|                                strbuf,
 2033|      0|                                pINChISortTautAndNonTaut2,
 2034|      0|                                INCHI_REC,
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 2035|      0|                                NULL,
 2036|      0|                                NULL,
 2037|      0|                                ip,
 2038|      0|                                0 /*bDisconnectedCoord*/,
 2039|      0|                                bOutputType,
 2040|      0|                                INCHI_OUT_ONLY_AUX_INFO | bINChIOutputOptions,
  ------------------
  |  |  131|      0|#define INCHI_OUT_ONLY_AUX_INFO         0x0004   /* output only Aux Info                    */
  ------------------
 2041|      0|                                num_components2,
 2042|      0|                                num_non_taut2,
 2043|      0|                                num_taut2,
 2044|      0|                                out_file,
 2045|      0|                                log_file,
 2046|      0|                                num_input_struct,
 2047|      0|                                pSortPrintINChIFlags,
 2048|      0|                                save_opt_bits);
 2049|       |
 2050|      0|            if (!nRet)
  ------------------
  |  Branch (2050:17): [True: 0, False: 0]
  ------------------
 2051|      0|            {
 2052|      0|                goto exit_function; /* error */
 2053|      0|            }
 2054|      0|        }
 2055|       |
 2056|       |        /* Close INChI_Aux */
 2057|      0|        if (!bEmbeddedOutputCalled && !bPlainTextCommnts)
  ------------------
  |  Branch (2057:13): [True: 0, False: 0]
  |  Branch (2057:39): [True: 0, False: 0]
  ------------------
 2058|      0|        {
 2059|      0|            inchi_ios_print(out_file, "%s\n", (!num_components2[0] && !num_components2[1]) ? "//" : "");
  ------------------
  |  Branch (2059:48): [True: 0, False: 0]
  |  Branch (2059:71): [True: 0, False: 0]
  ------------------
 2060|       |            /* plain text comment earlier ended with LF */
 2061|      0|        }
 2062|       |
 2063|       |        /* in wINChI window, separate AuxInfo: from InChIKey: with blank line */
 2064|      0|        inchi_ios_print(out_file, "%s",
 2065|      0|                        (bINChIOutputOptions & INCHI_OUT_WINCHI_WINDOW) ? "\n" : "");
  ------------------
  |  |  138|      0|#define INCHI_OUT_WINCHI_WINDOW         0x0200   /* output into wINChI text window          */
  ------------------
  |  Branch (2065:25): [True: 0, False: 0]
  ------------------
 2066|      0|    } /* end of output AuxInfo */
 2067|       |
 2068|  5.02k|    ret = 1;
 2069|       |
 2070|  5.02k|exit_function:
 2071|       |
 2072|       |#ifdef TARGET_LIB_FOR_WINCHI
 2073|       |    /* @@@ If for any error we get here silent, display previously hidden output */
 2074|       |    if (silent)
 2075|       |    {
 2076|       |        /*
 2077|       |           if ( !inchi_ios_flush_not_displayed( out_file ) != -1  )
 2078|       |               silent = 0;
 2079|       |       */
 2080|       |        silent = 0;
 2081|       |    }
 2082|       |#endif
 2083|       |
 2084|  5.02k|    if (io.bOverflow)
  ------------------
  |  Branch (2084:9): [True: 0, False: 5.02k]
  ------------------
 2085|      0|    {
 2086|      0|        inchi_ios_print(out_file, "\nFATAL ERROR: Output buffer overflow\n");
 2087|      0|    }
 2088|       |
 2089|  5.02k|    if (intermediate_result)
  ------------------
  |  Branch (2089:9): [True: 0, False: 5.02k]
  ------------------
 2090|      0|    {
 2091|      0|        ret = 0;
 2092|      0|        inchi_ios_eprint(log_file, "InChI serialization error for structure #%d.%s%s%s%s\n",
 2093|      0|                         num_input_struct, SDF_LBL_VAL(ip->pSdfLabel, ip->pSdfValue));
  ------------------
  |  |  830|      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 \
  |  |  ------------------
  |  |  |  Branch (830:28): [True: 0, False: 0]
  |  |  |  Branch (830:35): [True: 0, False: 0]
  |  |  |  Branch (830:65): [True: 0, False: 0]
  |  |  |  Branch (830:72): [True: 0, False: 0]
  |  |  |  Branch (830:96): [True: 0, False: 0]
  |  |  |  Branch (830:103): [True: 0, False: 0]
  |  |  |  Branch (830:115): [True: 0, False: 0]
  |  |  |  Branch (830:122): [True: 0, False: 0]
  |  |  |  Branch (830:163): [True: 0, False: 0]
  |  |  |  Branch (830:170): [True: 0, False: 0]
  |  |  |  Branch (830:185): [True: 0, False: 0]
  |  |  |  Branch (830:192): [True: 0, False: 0]
  |  |  ------------------
  |  |  831|      0|                                                                                                                                                                                                       : gsEmpty
  ------------------
 2094|      0|    }
 2095|       |
 2096|  5.02k|    return ret;
 2097|  5.02k|} /* OutputINChI1 */
szGetTag:
 2106|  15.2k|{
 2107|  15.2k|    int i, j, bit, num, len;
 2108|  15.2k|    const int MAX_TAG_NUM = tag_flag ? (int)IL_MAX_ORD : (int)AL_MAX_ORD; /* djb-rwth: fixing GHI #160 */
  ------------------
  |  Branch (2108:29): [True: 15.2k, False: 0]
  ------------------
 2109|  15.2k|    if (0 < nTag && nTag < 3)
  ------------------
  |  Branch (2109:9): [True: 15.2k, False: 0]
  |  Branch (2109:21): [True: 15.2k, False: 0]
  ------------------
 2110|  15.2k|    {
 2111|       |        /* no plain text comments: pick up the last tag */
 2112|   305k|        for (i = 0, j = -1, bit = 1; i < MAX_TAG_NUM; i++, bit <<= 1)
  ------------------
  |  Branch (2112:38): [True: 289k, False: 15.2k]
  ------------------
 2113|   289k|        {
 2114|   289k|            if (bTag & bit)
  ------------------
  |  Branch (2114:17): [True: 17.0k, False: 272k]
  ------------------
 2115|  17.0k|            {
 2116|  17.0k|                j = i;
 2117|  17.0k|            }
 2118|   289k|        }
 2119|  15.2k|        if (j >= 0)
  ------------------
  |  Branch (2119:13): [True: 15.2k, False: 0]
  ------------------
 2120|  15.2k|        {
 2121|       |#if USE_BCF
 2122|       |            int stl1, stl2, dstsz;
 2123|       |            stl1 = strlen(Tag[j].szXmlLabel) + 1;
 2124|       |            stl2 = strlen(Tag[j].szPlainLabel) + 1;
 2125|       |            dstsz = max_3(stl1, stl2, 5);
 2126|       |            strcpy_s(szTag, dstsz, nTag == 1 ? Tag[j].szXmlLabel : nTag == 2 ? Tag[j].szPlainLabel
 2127|       |                                                                             : "???"); /* djb-rwth: function replaced with its safe C11 variant */
 2128|       |#else
 2129|  15.2k|            strcpy(szTag, nTag == 1 ? Tag[j].szXmlLabel : nTag == 2 ? Tag[j].szPlainLabel : "???"); /* djb-rwth: addressing coverity ID #499488 -- when nTag == 2, the "???" is avoided, which is correct */
  ------------------
  |  Branch (2129:27): [True: 0, False: 15.2k]
  |  Branch (2129:59): [True: 15.2k, False: 0]
  ------------------
 2130|  15.2k|#endif
 2131|  15.2k|            if (nTag != 2)
  ------------------
  |  Branch (2131:17): [True: 0, False: 15.2k]
  ------------------
 2132|      0|            {
 2133|      0|                *bAlways = Tag[j].bAlwaysOutput;
 2134|      0|            }
 2135|  15.2k|            return szTag;
 2136|  15.2k|        }
 2137|  15.2k|    }
 2138|      0|    else if (nTag == 3)
  ------------------
  |  Branch (2138:14): [True: 0, False: 0]
  ------------------
 2139|      0|    {
 2140|       |        /* plain text with comments */
 2141|      0|        szTag[0] = '{';
 2142|      0|        szTag[1] = '\0';
 2143|      0|        for (i = 0, j = -1, bit = 1, num = 0; i < MAX_TAG_NUM; i++, bit <<= 1)
  ------------------
  |  Branch (2143:47): [True: 0, False: 0]
  ------------------
 2144|      0|        {
 2145|      0|            if (bTag & bit)
  ------------------
  |  Branch (2145:17): [True: 0, False: 0]
  ------------------
 2146|      0|            {
 2147|      0|                j = i;
 2148|      0|                if (num++)
  ------------------
  |  Branch (2148:21): [True: 0, False: 0]
  ------------------
 2149|      0|                {
 2150|      0|                    strcat(szTag, ":");
 2151|      0|                }
 2152|      0|                strcat(szTag, Tag[i].szPlainComment);
 2153|      0|            }
 2154|      0|        }
 2155|      0|        if (num)
  ------------------
  |  Branch (2155:13): [True: 0, False: 0]
  ------------------
 2156|      0|        {
 2157|      0|            strcat(szTag, "}");
 2158|      0|            num = (int)strlen(Tag[j].szPlainLabel);
 2159|      0|            len = (int)strlen(szTag);
 2160|      0|            if (len)
  ------------------
  |  Branch (2160:17): [True: 0, False: 0]
  ------------------
 2161|      0|            {
 2162|      0|                memmove(szTag + num, szTag, (long long)len + 1); /* djb-rwth: cast operator added */
 2163|      0|                memcpy(szTag, Tag[j].szPlainLabel, num);
 2164|      0|            }
 2165|      0|            else
 2166|      0|            {
 2167|      0|                strcpy(szTag, Tag[j].szPlainLabel);
 2168|      0|            }
 2169|      0|            *bAlways = Tag[j].bAlwaysOutput;
 2170|      0|        }
 2171|      0|        else
 2172|      0|        {
 2173|      0|            strcpy(szTag, "???");
 2174|      0|        }
 2175|      0|        return szTag;
 2176|      0|    }
 2177|       |
 2178|      0|    strcpy(szTag, "???");
 2179|      0|    return szTag;
 2180|  15.2k|}
OrigStruct_FillOut:
 2942|  70.4k|{
 2943|  70.4k|    char szBuf[ORIG_STR_BUFLEN];
 2944|  70.4k|    int i, len, len_coord, len_atoms, len_bonds;
 2945|       |
 2946|  70.4k|    pOrigStruct->polymer = NULL;
 2947|  70.4k|    pOrigStruct->v3000 = NULL;
 2948|       |
 2949|  70.4k|    pOrigStruct->n_zy = orig_inp_data->n_zy;
 2950|       |    /* Coordinates */
 2951|  70.4k|    len_coord = i = 0;
 2952|       |
 2953|  70.4k|    if (orig_inp_data->szCoord)
  ------------------
  |  Branch (2953:9): [True: 0, False: 70.4k]
  ------------------
 2954|      0|    {
 2955|       |
 2956|      0|        while ((len = WriteOrigCoord(orig_inp_data->num_inp_atoms,
  ------------------
  |  Branch (2956:16): [True: 0, False: 0]
  ------------------
 2957|      0|                                     orig_inp_data->szCoord, &i, szBuf, sizeof(szBuf)))) /* djb-rwth: addressing LLVM warning */
 2958|      0|        {
 2959|      0|            len_coord += len;
 2960|      0|        }
 2961|      0|        pOrigStruct->szCoord = (char *)inchi_malloc(((long long)len_coord + 1) * sizeof(pOrigStruct->szCoord[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1143|      0|#define inchi_malloc   malloc
  ------------------
 2962|      0|        i = 0;
 2963|      0|        if (pOrigStruct->szCoord &&
  ------------------
  |  Branch (2963:13): [True: 0, False: 0]
  ------------------
 2964|      0|            len_coord == WriteOrigCoord(orig_inp_data->num_inp_atoms,
  ------------------
  |  Branch (2964:13): [True: 0, False: 0]
  ------------------
 2965|      0|                                        orig_inp_data->szCoord, &i, pOrigStruct->szCoord, len_coord + 1) &&
 2966|      0|            i == orig_inp_data->num_inp_atoms)
  ------------------
  |  Branch (2966:13): [True: 0, False: 0]
  ------------------
 2967|      0|        {
 2968|       |            /* success */
 2969|      0|            if (orig_inp_data->szCoord)
  ------------------
  |  Branch (2969:17): [True: 0, False: 0]
  ------------------
 2970|      0|            {
 2971|      0|                inchi_free(orig_inp_data->szCoord);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2972|      0|                orig_inp_data->szCoord = NULL;
 2973|      0|            }
 2974|      0|        }
 2975|      0|        else
 2976|      0|        {
 2977|      0|            return -1;
 2978|      0|        }
 2979|      0|    }
 2980|       |
 2981|       |    /* Atoms */
 2982|  70.4k|    len_atoms = i = 0;
 2983|   141k|    while ((len = WriteOrigAtoms(pCG, orig_inp_data->num_inp_atoms,
  ------------------
  |  Branch (2983:12): [True: 70.6k, False: 70.4k]
  ------------------
 2984|   141k|                                 orig_inp_data->at, &i, szBuf, sizeof(szBuf), sd))) /* djb-rwth: addressing LLVM warning */
 2985|  70.6k|    {
 2986|  70.6k|        len_atoms += len;
 2987|  70.6k|        if (!orig_inp_data->num_inp_atoms)
  ------------------
  |  Branch (2987:13): [True: 0, False: 70.6k]
  ------------------
 2988|      0|            break;
 2989|  70.6k|    }
 2990|  70.4k|    pOrigStruct->szAtoms = (char *)inchi_malloc(((long long)len_atoms + 1) * sizeof(pOrigStruct->szAtoms[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1143|  70.4k|#define inchi_malloc   malloc
  ------------------
 2991|  70.4k|    i = 0;
 2992|  70.4k|    if (pOrigStruct->szAtoms &&
  ------------------
  |  Branch (2992:9): [True: 70.4k, False: 0]
  ------------------
 2993|  70.4k|        len_atoms == WriteOrigAtoms(pCG, orig_inp_data->num_inp_atoms,
  ------------------
  |  Branch (2993:9): [True: 70.4k, False: 0]
  ------------------
 2994|  70.4k|                                    orig_inp_data->at, &i, pOrigStruct->szAtoms, len_atoms + 1, sd) &&
 2995|  70.4k|        i == orig_inp_data->num_inp_atoms)
  ------------------
  |  Branch (2995:9): [True: 70.4k, False: 0]
  ------------------
 2996|  70.4k|    {
 2997|  70.4k|        ; /* success */
 2998|  70.4k|    }
 2999|      0|    else
 3000|      0|    {
 3001|      0|        return -1;
 3002|      0|    }
 3003|       |
 3004|       |    /* Bonds */
 3005|  70.4k|    len_bonds = 0;
 3006|  70.4k|    i = 1;
 3007|  83.8k|    while ((len = WriteOrigBonds(pCG, orig_inp_data->num_inp_atoms,
  ------------------
  |  Branch (3007:12): [True: 13.3k, False: 70.4k]
  ------------------
 3008|  83.8k|#if (FIX_CURE53_ISSUE_OOB_ALREADY_HAVE_THIS_MESSAGE == 1)
 3009|  83.8k|                                 orig_inp_data->at, &i, szBuf, sizeof(szBuf), sd))) /* djb-rwth: addressing LLVM warning */
 3010|       |#else
 3011|       |                                 orig_inp_data->at, &i, szBuf, sizeof(szBuf), NULL)))
 3012|       |#endif
 3013|  13.3k|    {
 3014|  13.3k|        len_bonds += len;
 3015|  13.3k|        if (!orig_inp_data->num_inp_atoms)
  ------------------
  |  Branch (3015:13): [True: 0, False: 13.3k]
  ------------------
 3016|      0|        {
 3017|      0|            break;
 3018|      0|        }
 3019|  13.3k|    }
 3020|       |
 3021|  70.4k|    pOrigStruct->szBonds = (char *)inchi_malloc(((long long)len_bonds + 2) * sizeof(pOrigStruct->szBonds[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1143|  70.4k|#define inchi_malloc   malloc
  ------------------
 3022|  70.4k|    i = 1;
 3023|       |
 3024|  70.4k|    if (pOrigStruct->szBonds &&
  ------------------
  |  Branch (3024:9): [True: 70.4k, False: 0]
  ------------------
 3025|  70.4k|        len_bonds == WriteOrigBonds(pCG, orig_inp_data->num_inp_atoms,
  ------------------
  |  Branch (3025:9): [True: 70.4k, False: 0]
  ------------------
 3026|  70.4k|                                    orig_inp_data->at, &i, pOrigStruct->szBonds, len_bonds + 2, sd) &&
 3027|  70.4k|        i == orig_inp_data->num_inp_atoms)
  ------------------
  |  Branch (3027:9): [True: 70.4k, False: 0]
  ------------------
 3028|  70.4k|    {
 3029|  70.4k|        ; /* success */
 3030|  70.4k|    }
 3031|      0|    else
 3032|      0|    {
 3033|      0|        return -1;
 3034|      0|    }
 3035|  70.4k|    pOrigStruct->num_atoms = orig_inp_data->num_inp_atoms;
 3036|       |
 3037|       |    /* Extensions of v. 1.05 */
 3038|  70.4k|    if (orig_inp_data->polymer != NULL && orig_inp_data->polymer->n > 0 && orig_inp_data->valid_polymer)
  ------------------
  |  Branch (3038:9): [True: 0, False: 70.4k]
  |  Branch (3038:43): [True: 0, False: 0]
  |  Branch (3038:76): [True: 0, False: 0]
  ------------------
 3039|      0|    {
 3040|      0|        pOrigStruct->polymer = orig_inp_data->polymer;
 3041|       |        /* pointer copy, do not free after use! */
 3042|      0|    }
 3043|  70.4k|    if (orig_inp_data->v3000 != NULL)
  ------------------
  |  Branch (3043:9): [True: 0, False: 70.4k]
  ------------------
 3044|      0|    {
 3045|      0|        pOrigStruct->v3000 = orig_inp_data->v3000;
 3046|       |        /* pointer copy, do not free after use! */
 3047|      0|    }
 3048|       |
 3049|  70.4k|    return 0;
 3050|  70.4k|}
OrigStruct_Free:
 3054|  70.4k|{
 3055|  70.4k|    if (pOrigStruct)
  ------------------
  |  Branch (3055:9): [True: 70.4k, False: 0]
  ------------------
 3056|  70.4k|    {
 3057|  70.4k|        if (pOrigStruct->szAtoms)
  ------------------
  |  Branch (3057:13): [True: 70.4k, False: 0]
  ------------------
 3058|  70.4k|        {
 3059|  70.4k|            inchi_free(pOrigStruct->szAtoms);
  ------------------
  |  | 1152|  70.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 70.4k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 70.4k]
  |  |  ------------------
  ------------------
 3060|  70.4k|        }
 3061|  70.4k|        if (pOrigStruct->szBonds)
  ------------------
  |  Branch (3061:13): [True: 70.4k, False: 0]
  ------------------
 3062|  70.4k|        {
 3063|  70.4k|            inchi_free(pOrigStruct->szBonds);
  ------------------
  |  | 1152|  70.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 70.4k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 70.4k]
  |  |  ------------------
  ------------------
 3064|  70.4k|        }
 3065|  70.4k|        if (pOrigStruct->szCoord)
  ------------------
  |  Branch (3065:13): [True: 0, False: 70.4k]
  ------------------
 3066|      0|        {
 3067|      0|            inchi_free(pOrigStruct->szCoord);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3068|      0|        }
 3069|       |
 3070|       |        /* For
 3071|       |
 3072|       |            OAD_Polymer *polymer;
 3073|       |            OAD_V3000    *v3000;
 3074|       |
 3075|       |            we used shallow (pointer) copy of analogs from orig_inp_data, so do not free these here */
 3076|       |
 3077|       |        /*memset( pOrigStruct, 0, sizeof(*pOrigStruct) );*/
 3078|  70.4k|        pOrigStruct->szAtoms = NULL;
 3079|  70.4k|        pOrigStruct->szBonds = NULL;
 3080|       |        pOrigStruct->szCoord = NULL;
 3081|  70.4k|    }
 3082|  70.4k|}
set_line_separators:
 3113|  5.02k|{
 3114|  5.02k|    int bPlainTextCommnts = 0 != (bINChIOutputOptions & INCHI_OUT_PLAIN_TEXT_COMMENTS);
  ------------------
  |  |  136|  5.02k|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  ------------------
 3115|       |
 3116|  5.02k|    *pLF = (char *)(bPlainTextCommnts ? "\n" : "\0");
  ------------------
  |  Branch (3116:21): [True: 0, False: 5.02k]
  ------------------
 3117|       |
 3118|       |#if (!defined(TARGET_API_LIB) && !defined(TARGET_LIB_FOR_WINCHI))
 3119|       |    {
 3120|       |        int bPlainText = 0 != (bINChIOutputOptions & (INCHI_OUT_PLAIN_TEXT | INCHI_OUT_PLAIN_TEXT_COMMENTS));
 3121|       |        int bPlainTabbedOutput = 0 != (bINChIOutputOptions & INCHI_OUT_TABBED_OUTPUT) &&
 3122|       |                                 bPlainText && !bPlainTextCommnts;
 3123|       |
 3124|       |        *pTAB = bPlainTabbedOutput ? (char*)"\t" : (char*)"\n";
 3125|       |    }
 3126|       |#else
 3127|  5.02k|    *pTAB = "\n";
 3128|  5.02k|#endif
 3129|       |
 3130|  5.02k|    return;
 3131|  5.02k|}
ichiprt1.c:WriteOrigAtoms:
 2425|   211k|{
 2426|   211k|    int j, k, n, len, len0, cur_len, val, bonds_val, mw, parity, num_trans, is_ok, b_self;
 2427|   211k|    static const char szIsoH[] = "hdt";
 2428|   211k|    char szCurAtom[32];
 2429|   211k|    AT_NUMB nNeighOrder[MAXVAL], neigh;
 2430|       |
 2431|   211k|    cur_len = 0;
 2432|   211k|    if (0 == *i)
  ------------------
  |  Branch (2432:9): [True: 140k, False: 70.6k]
  ------------------
 2433|   140k|    {
 2434|   140k|        cur_len = sprintf(szBuf, "%d%s", num_inp_atoms,
 2435|   140k|                          (sd->bChiralFlag & FLAG_INP_AT_CHIRAL) ? "c" : (sd->bChiralFlag & FLAG_INP_AT_NONCHIRAL) ? "n"
  ------------------
  |  |  669|   140k|#define FLAG_INP_AT_CHIRAL 1
  ------------------
                                        (sd->bChiralFlag & FLAG_INP_AT_CHIRAL) ? "c" : (sd->bChiralFlag & FLAG_INP_AT_NONCHIRAL) ? "n"
  ------------------
  |  |  670|   140k|#define FLAG_INP_AT_NONCHIRAL 2
  ------------------
  |  Branch (2435:27): [True: 0, False: 140k]
  |  Branch (2435:74): [True: 0, False: 140k]
  ------------------
 2436|   140k|                                                                                                                   : "");
 2437|   140k|    }
 2438|   529k|    for (j = *i; j < num_inp_atoms;)
  ------------------
  |  Branch (2438:18): [True: 318k, False: 211k]
  ------------------
 2439|   318k|    {
 2440|       |        /* tetrahedral parity treatment */
 2441|   318k|        parity = 0;
 2442|   318k|        num_trans = 0;
 2443|   318k|        if (at[j].p_parity)
  ------------------
  |  Branch (2443:13): [True: 502, False: 318k]
  ------------------
 2444|    502|        {
 2445|       |            /* verify neighbors */
 2446|    502|            is_ok = 1;
 2447|    502|            b_self = 0;
 2448|  2.51k|            for (n = 0, k = 0; n < MAX_NUM_STEREO_ATOM_NEIGH; n++)
  ------------------
  |  |  877|  2.51k|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (2448:32): [True: 2.00k, False: 502]
  ------------------
 2449|  2.00k|            {
 2450|  2.00k|                neigh = at[j].p_orig_at_num[n] - 1;
 2451|  2.00k|                if (is_in_the_list(at[j].neighbor, neigh, at[j].valence) &&
  ------------------
  |  Branch (2451:21): [True: 1.83k, False: 176]
  ------------------
 2452|  1.83k|                    at[neigh].orig_at_number == at[j].p_orig_at_num[n])
  ------------------
  |  Branch (2452:21): [True: 1.83k, False: 0]
  ------------------
 2453|  1.83k|                {
 2454|       |                    /* real neighbor */
 2455|  1.83k|                    nNeighOrder[k++] = at[j].p_orig_at_num[n];
 2456|  1.83k|                }
 2457|    176|                else
 2458|    176|                {
 2459|    176|                    if ((int)neigh == j && at[neigh].orig_at_number == at[j].p_orig_at_num[n])
  ------------------
  |  Branch (2459:25): [True: 176, False: 0]
  |  Branch (2459:44): [True: 176, False: 0]
  ------------------
 2460|    176|                    {
 2461|       |                        /* central atom is a neighbor */
 2462|    176|                        num_trans = n; /* move this neighbor to 0 position permutation parity */
 2463|    176|                        b_self++;
 2464|    176|                    }
 2465|      0|                    else
 2466|      0|                    {
 2467|      0|                        is_ok = 0;
 2468|      0|                        break;
 2469|      0|                    }
 2470|    176|                }
 2471|  2.00k|            }
 2472|    502|            if (is_ok && b_self <= 1 && b_self + k == MAX_NUM_STEREO_ATOM_NEIGH)
  ------------------
  |  |  877|    502|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (2472:17): [True: 502, False: 0]
  |  Branch (2472:26): [True: 502, False: 0]
  |  Branch (2472:41): [True: 502, False: 0]
  ------------------
 2473|    502|            {
 2474|    502|                num_trans += insertions_sort(pCG, nNeighOrder, k, sizeof(nNeighOrder[0]), comp_AT_RANK);
 2475|    502|                if (ATOM_PARITY_WELL_DEF(at[j].p_parity))
  ------------------
  |  |  259|    502|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    502|#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)
  |  |  ------------------
  |  |  |  |  236|    502|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 502, False: 0]
  |  |  |  Branch (259:75): [True: 426, False: 76]
  |  |  ------------------
  ------------------
 2476|    426|                {
 2477|    426|                    parity = 2 - (num_trans + at[j].p_parity) % 2;
 2478|    426|                }
 2479|     76|                else
 2480|     76|                {
 2481|     76|                    if (ATOM_PARITY_ILL_DEF(at[j].p_parity))
  ------------------
  |  |  257|     76|#define ATOM_PARITY_ILL_DEF(X)      (AB_MIN_ILL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_ILL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  239|     76|#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)
  |  |  ------------------
  |  |  |  |  240|     76|#define AB_MAX_ILL_DEFINED_PARITY  4
  |  |  ------------------
  |  |  |  Branch (257:38): [True: 76, False: 0]
  |  |  |  Branch (257:74): [True: 76, False: 0]
  |  |  ------------------
  ------------------
 2482|     76|                    {
 2483|     76|                        parity = at[j].p_parity;
 2484|     76|                    }
 2485|      0|                    else
 2486|      0|                    {
 2487|      0|                        ; /* invalid atom parity */
 2488|      0|                    }
 2489|     76|                }
 2490|    502|            }
 2491|      0|            else
 2492|      0|            {
 2493|      0|                ; /* add error message here */
 2494|      0|            }
 2495|    502|        }
 2496|       |
 2497|   318k|        len = len0 = (int)strlen(at[j].elname);
 2498|       |
 2499|   318k|        memcpy(szCurAtom, at[j].elname, len);
 2500|   318k|        bonds_val = nBondsValenceInpAt(at + j, NULL, NULL);
 2501|       |
 2502|   318k|        if ((val = needed_unusual_el_valence(at[j].el_number, at[j].charge, at[j].radical,
  ------------------
  |  Branch (2502:13): [True: 65.7k, False: 252k]
  ------------------
 2503|   318k|                                             at[j].chem_bonds_valence, bonds_val, at[j].num_H, at[j].valence)) ||
 2504|   252k|            at[j].charge || at[j].radical || at[j].iso_atw_diff || NUM_ISO_H(at, j) || parity)
  ------------------
  |  |   55|   455k|#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 (55:26): [True: 8, False: 136k]
  |  |  ------------------
  ------------------
  |  Branch (2504:13): [True: 109k, False: 142k]
  |  Branch (2504:29): [True: 6.20k, False: 136k]
  |  Branch (2504:46): [True: 220, False: 136k]
  |  Branch (2504:88): [True: 354, False: 136k]
  ------------------
 2505|   182k|        {
 2506|       |            /* valence */
 2507|   182k|            if (val)
  ------------------
  |  Branch (2507:17): [True: 65.7k, False: 116k]
  ------------------
 2508|  65.7k|            {
 2509|  65.7k|                len += sprintf(szCurAtom + len, "%d", val > 0 ? val : 0);
  ------------------
  |  Branch (2509:55): [True: 15.8k, False: 49.9k]
  ------------------
 2510|  65.7k|            }
 2511|       |            /* charge */
 2512|   182k|            if ((val = at[j].charge)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2512:17): [True: 111k, False: 71.0k]
  ------------------
 2513|   111k|            {
 2514|   111k|                szCurAtom[len++] = val > 0 ? '+' : '-';
  ------------------
  |  Branch (2514:36): [True: 90.4k, False: 20.9k]
  ------------------
 2515|   111k|                if ((val = abs(val)) > 1)
  ------------------
  |  Branch (2515:21): [True: 2.02k, False: 109k]
  ------------------
 2516|  2.02k|                {
 2517|  2.02k|                    len += sprintf(szCurAtom + len, "%d", val);
 2518|  2.02k|                }
 2519|   111k|            }
 2520|       |            /* radical */
 2521|   182k|            if ((val = at[j].radical)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2521:17): [True: 9.84k, False: 172k]
  ------------------
 2522|  9.84k|            {
 2523|  9.84k|                len += sprintf(szCurAtom + len, ".%d", val);
 2524|  9.84k|            }
 2525|       |            /* isotopic shift */
 2526|   182k|            if ((val = at[j].iso_atw_diff)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2526:17): [True: 1.46k, False: 180k]
  ------------------
 2527|  1.46k|            {
 2528|  1.46k|                mw = get_atomic_mass_from_elnum(at[j].el_number);
 2529|  1.46k|                if (val == 1)
  ------------------
  |  Branch (2529:21): [True: 1.11k, False: 348]
  ------------------
 2530|  1.11k|                    val = mw;
 2531|    348|                else if (val > 0)
  ------------------
  |  Branch (2531:26): [True: 286, False: 62]
  ------------------
 2532|    286|                    val = mw + val - 1;
 2533|     62|                else
 2534|     62|                    val = mw + val;
 2535|       |
 2536|  1.46k|                len += sprintf(szCurAtom + len, "%si%d", len == len0 ? "." : "", val);
  ------------------
  |  Branch (2536:58): [True: 220, False: 1.24k]
  ------------------
 2537|  1.46k|            }
 2538|       |            /* parity */
 2539|   182k|            if (parity)
  ------------------
  |  Branch (2539:17): [True: 502, False: 181k]
  ------------------
 2540|    502|            {
 2541|    502|                len += sprintf(szCurAtom + len, "%s%s", len == len0 ? "." : "",
  ------------------
  |  Branch (2541:57): [True: 354, False: 148]
  ------------------
 2542|    502|                               parity == AB_PARITY_ODD ? "o" : parity == AB_PARITY_EVEN ? "e"
  ------------------
  |  |  219|    502|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
                                             parity == AB_PARITY_ODD ? "o" : parity == AB_PARITY_EVEN ? "e"
  ------------------
  |  |  220|    278|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
  |  Branch (2542:32): [True: 224, False: 278]
  |  Branch (2542:64): [True: 202, False: 76]
  ------------------
 2543|    278|                                                           : parity == AB_PARITY_UNKN   ? "u"
  ------------------
  |  |  221|     76|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
  |  Branch (2543:62): [True: 32, False: 44]
  ------------------
 2544|     76|                                                           : parity == AB_PARITY_UNDF   ? "?"
  ------------------
  |  |  222|     44|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2544:62): [True: 44, False: 0]
  ------------------
 2545|     44|                                                                                        : "");
 2546|    502|            }
 2547|       |            /* implicit isotopic H */
 2548|   182k|            if (NUM_ISO_H(at, j))
  ------------------
  |  |   55|   182k|#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 (55:26): [True: 218, False: 182k]
  |  |  ------------------
  ------------------
 2549|    218|            {
 2550|    872|                for (k = 0; k < NUM_H_ISOTOPES; k++)
  ------------------
  |  |   25|    872|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (2550:29): [True: 654, False: 218]
  ------------------
 2551|    654|                {
 2552|    654|                    if ((val = at[j].num_iso_H[k])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2552:25): [True: 258, False: 396]
  ------------------
 2553|    258|                    {
 2554|    258|                        len += sprintf(szCurAtom + len, "%s%c", len == len0 ? "." : "", szIsoH[k]);
  ------------------
  |  Branch (2554:65): [True: 8, False: 250]
  ------------------
 2555|    258|                        if (val > 1)
  ------------------
  |  Branch (2555:29): [True: 48, False: 210]
  ------------------
 2556|     48|                        {
 2557|     48|                            len += sprintf(szCurAtom + len, "%d", val);
 2558|     48|                        }
 2559|    258|                    }
 2560|    654|                }
 2561|    218|            }
 2562|   182k|        }
 2563|       |
 2564|   318k|        if (len + cur_len < buf_len)
  ------------------
  |  Branch (2564:13): [True: 318k, False: 194]
  ------------------
 2565|   318k|        {
 2566|   318k|            memcpy(szBuf + cur_len, szCurAtom, len);
 2567|   318k|            cur_len += len;
 2568|   318k|            j++;
 2569|   318k|        }
 2570|    194|        else
 2571|    194|        {
 2572|    194|            break;
 2573|    194|        }
 2574|   318k|        szBuf[cur_len] = '\0';
 2575|   318k|        *i = j;
 2576|   318k|    }
 2577|       |
 2578|   211k|    return cur_len;
 2579|   211k|}
ichiprt1.c:WriteOrigBonds:
 2623|   154k|{
 2624|   154k|    int j, k, k2, kk, len, cur_len, j2 = 0, bond_stereo, bond_char, bond_parity, bond_parityNM, num_trans; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 2625|   154k|    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 ';' */
 2626|   154k|    AT_RANK nNeighOrder[MAXVAL];
 2627|   154k|    int chain_len, pnxt_atom, pinxt2cur, pinxt_sb_parity_ord;
 2628|   154k|    int chain_len2, pnxt_atom2, pinxt2cur2, pinxt_sb_parity_ord2, m1, m2;
 2629|   154k|    int pcur_atom, picur2nxt, picur_sb_parity_ord;
 2630|       |
 2631|   154k|    cur_len = 0;
 2632|   331k|    for (j = *i; j < num_inp_atoms;)
  ------------------
  |  Branch (2632:18): [True: 177k, False: 154k]
  ------------------
 2633|   177k|    {
 2634|   177k|        len = 0;
 2635|   177k|        if (at[j].valence >= 1) /* djb-rwth: changing condition to avoid garbage values */
  ------------------
  |  Branch (2635:13): [True: 107k, False: 69.9k]
  ------------------
 2636|   107k|        {
 2637|   311k|            for (k = 0; k < at[j].valence; k++)
  ------------------
  |  Branch (2637:25): [True: 203k, False: 107k]
  ------------------
 2638|   203k|            {
 2639|   203k|                nNeighOrder[k] = k;
 2640|   203k|            }
 2641|   107k|            pCG->m_pn_RankForSort = at[j].neighbor;
 2642|   107k|            num_trans = insertions_sort(pCG, nNeighOrder, at[j].valence, sizeof(nNeighOrder[0]), CompRank); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 2643|   107k|        }
 2644|  69.9k|        else
 2645|  69.9k|        {
 2646|  69.9k|            num_trans = 0; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 2647|  69.9k|            nNeighOrder[0] = 0;
 2648|  69.9k|        }
 2649|   381k|        for (kk = 0; kk < at[j].valence; kk++)
  ------------------
  |  Branch (2649:22): [True: 203k, False: 177k]
  ------------------
 2650|   203k|        {
 2651|   203k|            k = nNeighOrder[kk];
 2652|   203k|            j2 = at[j].neighbor[k];
 2653|   203k|            bond_parity = 0;
 2654|   203k|            bond_parityNM = 0;
 2655|   203k|            if (j2 < j)
  ------------------
  |  Branch (2655:17): [True: 124k, False: 79.4k]
  ------------------
 2656|   124k|            {
 2657|   124k|                bond_stereo = at[j].bond_stereo[k];
 2658|   124k|                switch (at[j].bond_type[k])
 2659|   124k|                {
 2660|  84.6k|                case BOND_TYPE_SINGLE:
  ------------------
  |  |   32|  84.6k|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2660:17): [True: 84.6k, False: 39.4k]
  ------------------
 2661|  84.6k|                    switch (bond_stereo)
 2662|  84.6k|                    {
 2663|      0|                    case STEREO_SNGL_UP:
  ------------------
  |  |   37|      0|#define STEREO_SNGL_UP       1
  ------------------
  |  Branch (2663:21): [True: 0, False: 84.6k]
  ------------------
 2664|      0|                        bond_char = 'p';
 2665|      0|                        break;
 2666|      0|                    case -STEREO_SNGL_UP:
  ------------------
  |  |   37|      0|#define STEREO_SNGL_UP       1
  ------------------
  |  Branch (2666:21): [True: 0, False: 84.6k]
  ------------------
 2667|      0|                        bond_char = 'P';
 2668|      0|                        break;
 2669|      0|                    case STEREO_SNGL_DOWN:
  ------------------
  |  |   39|      0|#define STEREO_SNGL_DOWN     6
  ------------------
  |  Branch (2669:21): [True: 0, False: 84.6k]
  ------------------
 2670|      0|                        bond_char = 'n';
 2671|      0|                        break;
 2672|      0|                    case -STEREO_SNGL_DOWN:
  ------------------
  |  |   39|      0|#define STEREO_SNGL_DOWN     6
  ------------------
  |  Branch (2672:21): [True: 0, False: 84.6k]
  ------------------
 2673|      0|                        bond_char = 'N';
 2674|      0|                        break;
 2675|      0|#if (FIX_EITHER_STEREO_IN_AUX_INFO == 1)
 2676|      0|                    case STEREO_SNGL_EITHER:
  ------------------
  |  |   38|      0|#define STEREO_SNGL_EITHER   4
  ------------------
  |  Branch (2676:21): [True: 0, False: 84.6k]
  ------------------
 2677|      0|                        bond_char = 'v';
 2678|      0|                        break;
 2679|      0|                    case -STEREO_SNGL_EITHER:
  ------------------
  |  |   38|      0|#define STEREO_SNGL_EITHER   4
  ------------------
  |  Branch (2679:21): [True: 0, False: 84.6k]
  ------------------
 2680|      0|                        bond_char = 'V';
 2681|      0|                        break;
 2682|       |#else
 2683|       |                    case STEREO_SNGL_EITHER:
 2684|       |                    case -STEREO_SNGL_EITHER:
 2685|       |                        bond_char = 'v';
 2686|       |                        break;
 2687|       |#endif
 2688|  84.6k|                    default:
  ------------------
  |  Branch (2688:21): [True: 84.6k, False: 0]
  ------------------
 2689|  84.6k|                        bond_char = 's';
 2690|  84.6k|                        break;
 2691|  84.6k|                    }
 2692|  84.6k|                    break;
 2693|  84.6k|                case BOND_TYPE_DOUBLE:
  ------------------
  |  |   33|  26.6k|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2693:17): [True: 26.6k, False: 97.3k]
  ------------------
 2694|  26.6k|                    switch (bond_stereo)
 2695|  26.6k|                    {
 2696|     74|                    case STEREO_DBLE_EITHER:
  ------------------
  |  |   40|     74|#define STEREO_DBLE_EITHER   3
  ------------------
  |  Branch (2696:21): [True: 74, False: 26.6k]
  ------------------
 2697|     74|                    case -STEREO_DBLE_EITHER:
  ------------------
  |  |   40|     74|#define STEREO_DBLE_EITHER   3
  ------------------
  |  Branch (2697:21): [True: 0, False: 26.6k]
  ------------------
 2698|     74|                        bond_char = 'w';
 2699|     74|                        break;
 2700|  26.6k|                    default:
  ------------------
  |  Branch (2700:21): [True: 26.6k, False: 74]
  ------------------
 2701|  26.6k|                        bond_char = 'd';
 2702|  26.6k|                        break;
 2703|  26.6k|                    }
 2704|  26.6k|                    break;
 2705|  26.6k|                case BOND_TYPE_TRIPLE:
  ------------------
  |  |   34|  12.7k|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (2705:17): [True: 12.7k, False: 111k]
  ------------------
 2706|  12.7k|                    bond_char = 't';
 2707|  12.7k|                    break;
 2708|      0|                case BOND_TYPE_ALTERN:
  ------------------
  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  ------------------
  |  Branch (2708:17): [True: 0, False: 124k]
  ------------------
 2709|      0|                    bond_char = 'a';
 2710|      0|                    break;
 2711|      0|                default:
  ------------------
  |  Branch (2711:17): [True: 0, False: 124k]
  ------------------
 2712|      0|                    bond_char = 's';
 2713|      0|                    break;
 2714|   124k|                }
 2715|       |                /* check for allene/cumulene */
 2716|   124k|                k2 = (int)(is_in_the_list(at[j2].neighbor, (AT_NUMB)j, at[j2].valence) - at[j2].neighbor);
 2717|   124k|                chain_len = chain_len2 = 0;
 2718|   124k|                if (at[j].sb_parity[0])
  ------------------
  |  Branch (2718:21): [True: 1.09k, False: 122k]
  ------------------
 2719|  1.09k|                {
 2720|  1.54k|                    for (m1 = 0; m1 < MAX_NUM_STEREO_BONDS && at[j].sb_parity[m1]; m1++)
  ------------------
  |  |  873|  3.09k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2720:34): [True: 1.54k, False: 0]
  |  Branch (2720:63): [True: 1.21k, False: 330]
  ------------------
 2721|  1.21k|                    {
 2722|  1.21k|                        if (k == at[j].sb_ord[m1])
  ------------------
  |  Branch (2722:29): [True: 766, False: 450]
  ------------------
 2723|    766|                        {
 2724|    766|                            chain_len = get_opposite_sb_atom(at, j, k,
 2725|    766|                                                             &pnxt_atom, &pinxt2cur, &pinxt_sb_parity_ord);
 2726|    766|                            break;
 2727|    766|                        }
 2728|  1.21k|                    }
 2729|  1.09k|                }
 2730|   124k|                if (at[j2].sb_parity[0])
  ------------------
  |  Branch (2730:21): [True: 1.77k, False: 122k]
  ------------------
 2731|  1.77k|                {
 2732|  2.97k|                    for (m2 = 0; m2 < MAX_NUM_STEREO_BONDS && at[j2].sb_parity[m2]; m2++)
  ------------------
  |  |  873|  5.95k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2732:34): [True: 2.97k, False: 0]
  |  Branch (2732:63): [True: 1.94k, False: 1.02k]
  ------------------
 2733|  1.94k|                    {
 2734|  1.94k|                        if (k2 == at[j2].sb_ord[m2])
  ------------------
  |  Branch (2734:29): [True: 742, False: 1.20k]
  ------------------
 2735|    742|                        {
 2736|    742|                            chain_len2 = get_opposite_sb_atom(at, j2, k2,
 2737|    742|                                                              &pnxt_atom2, &pinxt2cur2, &pinxt_sb_parity_ord2);
 2738|    742|                            break;
 2739|    742|                        }
 2740|  1.94k|                    }
 2741|  1.77k|                }
 2742|   124k|                if ((chain_len == 1 && chain_len2 == 1) || /* regular stereobond */
  ------------------
  |  Branch (2742:22): [True: 734, False: 123k]
  |  Branch (2742:40): [True: 734, False: 0]
  ------------------
 2743|   123k|                    (chain_len > 1 && j > pnxt_atom))      /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (2743:22): [True: 20, False: 123k]
  |  Branch (2743:39): [True: 10, False: 10]
  ------------------
 2744|    744|                {
 2745|       |                    /* j  is a cumulene endpoint */
 2746|    744|                    int m;
 2747|    744|                    pcur_atom = j; /* pcur_atom > pnxt_atom */
 2748|    744|                    picur2nxt = k;
 2749|    744|                    picur_sb_parity_ord = -1;
 2750|    834|                    for (m = 0; m < MAX_NUM_STEREO_BONDS && at[pcur_atom].sb_parity[m]; m++)
  ------------------
  |  |  873|  1.66k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2750:33): [True: 834, False: 0]
  |  Branch (2750:61): [True: 834, False: 0]
  ------------------
 2751|    834|                    {
 2752|    834|                        if (at[pcur_atom].sb_ord[m] == k)
  ------------------
  |  Branch (2752:29): [True: 744, False: 90]
  ------------------
 2753|    744|                        {
 2754|    744|                            picur_sb_parity_ord = m;
 2755|    744|                            break;
 2756|    744|                        }
 2757|    834|                    }
 2758|       |                    /* djb-rwth: removing redundant code */
 2759|    744|                }
 2760|   123k|                else
 2761|   123k|                {
 2762|   123k|                    if (chain_len2 > 1 && j2 > pnxt_atom2)
  ------------------
  |  Branch (2762:25): [True: 4, False: 123k]
  |  Branch (2762:43): [True: 2, False: 2]
  ------------------
 2763|      2|                    { /* j2 is a cumulene endpoint */
 2764|      2|                        int m;
 2765|      2|                        pcur_atom = j2;
 2766|      2|                        picur2nxt = k2;
 2767|      2|                        pnxt_atom = pnxt_atom2;
 2768|      2|                        pinxt2cur = pinxt2cur2;
 2769|      2|                        pinxt_sb_parity_ord = pinxt_sb_parity_ord2;
 2770|      2|                        picur_sb_parity_ord = -1;
 2771|      4|                        for (m = 0; m < MAX_NUM_STEREO_BONDS && at[pcur_atom].sb_parity[m]; m++)
  ------------------
  |  |  873|      8|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2771:37): [True: 4, False: 0]
  |  Branch (2771:65): [True: 2, False: 2]
  ------------------
 2772|      2|                        {
 2773|      2|                            if (at[pcur_atom].sb_ord[m] == k2)
  ------------------
  |  Branch (2773:33): [True: 2, False: 0]
  ------------------
 2774|      2|                                picur_sb_parity_ord = m;
 2775|      2|                        }
 2776|      2|                        chain_len = chain_len2;
 2777|       |                        /* djb-rwth: removing redundant code */
 2778|      2|                    }
 2779|   123k|                    else
 2780|   123k|                    {
 2781|   123k|                        chain_len = 0; /* djb-rwth: removing redundant code */
 2782|   123k|                    }
 2783|   123k|                }
 2784|       |                /*len += sprintf( szCurBonds + len, "%c%d", bond_char, val+1);*/
 2785|   124k|                if (chain_len)
  ------------------
  |  Branch (2785:21): [True: 746, False: 123k]
  ------------------
 2786|    746|                {
 2787|       |                    /* both atoms belong to a stereo bond */
 2788|    746|                    int kc;
 2789|    746|                    int p1 = 0, p2, p1NM = 0, p2NM, neigh, neigh1, neigh2, bHasMetal, bWellDef; /* djb-rwth: initialising p1 and p1NM */
 2790|    746|                    int bNeighSwitched1, bNeighSwitched2;
 2791|       |
 2792|       |                    /* djb-rwth: avoiding buffer overrun as picur_sb_parity_ord == -1 is possible */
 2793|    746|                    if (picur_sb_parity_ord >= 0)
  ------------------
  |  Branch (2793:25): [True: 746, False: 0]
  ------------------
 2794|    746|                    {
 2795|    746|                        p1 = SB_PARITY_1(at[pcur_atom].sb_parity[picur_sb_parity_ord]);
  ------------------
  |  |   65|    746|#define SB_PARITY_1(X) (X & SB_PARITY_MASK)                       /**< refers to connected structure */
  |  |  ------------------
  |  |  |  |   64|    746|#define SB_PARITY_MASK 0x07
  |  |  ------------------
  ------------------
 2796|    746|                        p1NM = SB_PARITY_2(at[pcur_atom].sb_parity[picur_sb_parity_ord]);
  ------------------
  |  |   66|    746|#define SB_PARITY_2(X) (((X) >> SB_PARITY_SHFT) & SB_PARITY_MASK) /**< refers to connected structure */
  |  |  ------------------
  |  |  |  |   63|    746|#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 */
  |  |  ------------------
  |  |  |  |   64|    746|#define SB_PARITY_MASK 0x07
  |  |  ------------------
  ------------------
 2797|    746|                    }
 2798|       |
 2799|    746|                    p2 = SB_PARITY_1(at[pnxt_atom].sb_parity[pinxt_sb_parity_ord]);
  ------------------
  |  |   65|    746|#define SB_PARITY_1(X) (X & SB_PARITY_MASK)                       /**< refers to connected structure */
  |  |  ------------------
  |  |  |  |   64|    746|#define SB_PARITY_MASK 0x07
  |  |  ------------------
  ------------------
 2800|    746|                    p2NM = SB_PARITY_2(at[pnxt_atom].sb_parity[pinxt_sb_parity_ord]);
  ------------------
  |  |   66|    746|#define SB_PARITY_2(X) (((X) >> SB_PARITY_SHFT) & SB_PARITY_MASK) /**< refers to connected structure */
  |  |  ------------------
  |  |  |  |   63|    746|#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 */
  |  |  ------------------
  |  |  |  |   64|    746|#define SB_PARITY_MASK 0x07
  |  |  ------------------
  ------------------
 2801|       |
 2802|    746|                    bWellDef = ATOM_PARITY_WELL_DEF(p1) && ATOM_PARITY_WELL_DEF(p2);
  ------------------
  |  |  259|  1.49k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    746|#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)
  |  |  ------------------
  |  |  |  |  236|    746|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 746, False: 0]
  |  |  |  Branch (259:75): [True: 504, False: 242]
  |  |  ------------------
  ------------------
                                  bWellDef = ATOM_PARITY_WELL_DEF(p1) && ATOM_PARITY_WELL_DEF(p2);
  ------------------
  |  |  259|  1.25k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    504|#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)
  |  |  ------------------
  |  |  |  |  236|    504|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 504, False: 0]
  |  |  |  Branch (259:75): [True: 504, False: 0]
  |  |  ------------------
  ------------------
 2803|    746|                    bHasMetal = ATOM_PARITY_WELL_DEF(p1NM) && ATOM_PARITY_WELL_DEF(p2NM);
  ------------------
  |  |  259|  1.49k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    746|#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)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 0, False: 746]
  |  |  |  Branch (259:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                  bHasMetal = ATOM_PARITY_WELL_DEF(p1NM) && ATOM_PARITY_WELL_DEF(p2NM);
  ------------------
  |  |  259|    746|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      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)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 0, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2804|       |
 2805|    746|                    bNeighSwitched1 = bNeighSwitched2 = 0;
 2806|       |
 2807|    746|                    if (bWellDef || bHasMetal)
  ------------------
  |  Branch (2807:25): [True: 504, False: 242]
  |  Branch (2807:37): [True: 0, False: 242]
  ------------------
 2808|    504|                    {
 2809|       |
 2810|    504|                        neigh1 = num_inp_atoms;
 2811|  1.63k|                        for (kc = 0; kc < at[pcur_atom].valence; kc++)
  ------------------
  |  Branch (2811:38): [True: 1.13k, False: 504]
  ------------------
 2812|  1.13k|                        {
 2813|  1.13k|                            if (kc == picur2nxt)
  ------------------
  |  Branch (2813:33): [True: 504, False: 630]
  ------------------
 2814|    504|                                continue;
 2815|    630|                            neigh = at[pcur_atom].neighbor[kc];
 2816|    630|                            if (bHasMetal && is_el_a_metal(at[neigh].el_number))
  ------------------
  |  Branch (2816:33): [True: 0, False: 630]
  |  Branch (2816:46): [True: 0, False: 0]
  ------------------
 2817|      0|                                continue;
 2818|    630|                            if (neigh < neigh1)
  ------------------
  |  Branch (2818:33): [True: 510, False: 120]
  ------------------
 2819|    510|                                neigh1 = neigh;
 2820|    630|                        }
 2821|    504|                        if (neigh1 < num_inp_atoms)
  ------------------
  |  Branch (2821:29): [True: 504, False: 0]
  ------------------
 2822|    504|                        {
 2823|    504|                            bNeighSwitched1 = (neigh1 != at[pcur_atom].neighbor[(int)at[pcur_atom].sn_ord[picur_sb_parity_ord]]);
 2824|    504|                        }
 2825|      0|                        else
 2826|      0|                        {
 2827|      0|                            AddErrorMessage(sd->pStrErrStruct, "Cannot find 0D stereobond neighbor");
 2828|       |                            /*
 2829|       |                            sd->nStructReadError =  99;
 2830|       |                            sd->nErrorType = _IS_ERROR;
 2831|       |                            */
 2832|      0|                        }
 2833|       |
 2834|    504|                        neigh2 = num_inp_atoms;
 2835|  1.62k|                        for (kc = 0; kc < at[pnxt_atom].valence; kc++)
  ------------------
  |  Branch (2835:38): [True: 1.12k, False: 504]
  ------------------
 2836|  1.12k|                        {
 2837|  1.12k|                            if (kc == pinxt2cur)
  ------------------
  |  Branch (2837:33): [True: 504, False: 620]
  ------------------
 2838|    504|                                continue;
 2839|    620|                            neigh = at[pnxt_atom].neighbor[kc];
 2840|    620|                            if (bHasMetal && is_el_a_metal(at[neigh].el_number))
  ------------------
  |  Branch (2840:33): [True: 0, False: 620]
  |  Branch (2840:46): [True: 0, False: 0]
  ------------------
 2841|      0|                                continue;
 2842|    620|                            if (neigh < neigh2)
  ------------------
  |  Branch (2842:33): [True: 516, False: 104]
  ------------------
 2843|    516|                                neigh2 = neigh;
 2844|    620|                        }
 2845|    504|                        if (neigh2 < num_inp_atoms)
  ------------------
  |  Branch (2845:29): [True: 504, False: 0]
  ------------------
 2846|    504|                        {
 2847|    504|                            bNeighSwitched2 = (neigh2 != at[pnxt_atom].neighbor[(int)at[pnxt_atom].sn_ord[pinxt_sb_parity_ord]]);
 2848|    504|                        }
 2849|      0|                        else
 2850|      0|                        {
 2851|      0|                            AddErrorMessage(sd->pStrErrStruct, "Cannot find 0D stereobond neighbor");
 2852|       |                            /*
 2853|       |                            sd->nStructReadError =  99;
 2854|       |                            sd->nErrorType = _IS_ERROR;
 2855|       |                            */
 2856|      0|                        }
 2857|       |
 2858|    504|                        if (neigh1 < num_inp_atoms && neigh2 < num_inp_atoms)
  ------------------
  |  Branch (2858:29): [True: 504, False: 0]
  |  Branch (2858:55): [True: 504, False: 0]
  ------------------
 2859|    504|                        {
 2860|    504|                            if (ATOM_PARITY_WELL_DEF(p1) && ATOM_PARITY_WELL_DEF(p2))
  ------------------
  |  |  259|  1.00k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    504|#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)
  |  |  ------------------
  |  |  |  |  236|    504|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 504, False: 0]
  |  |  |  Branch (259:75): [True: 504, False: 0]
  |  |  ------------------
  ------------------
                                          if (ATOM_PARITY_WELL_DEF(p1) && ATOM_PARITY_WELL_DEF(p2))
  ------------------
  |  |  259|    504|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    504|#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)
  |  |  ------------------
  |  |  |  |  236|    504|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 504, False: 0]
  |  |  |  Branch (259:75): [True: 504, False: 0]
  |  |  ------------------
  ------------------
 2861|    504|                            {
 2862|    504|                                bond_parity = 2 - (p1 + p2 + bNeighSwitched1 + bNeighSwitched2) % 2;
 2863|    504|                            }
 2864|      0|                            else
 2865|      0|                            {
 2866|      0|                                bond_parity = inchi_min(p1, p2);
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2867|      0|                            }
 2868|       |
 2869|    504|                            if (bHasMetal)
  ------------------
  |  Branch (2869:33): [True: 0, False: 504]
  ------------------
 2870|      0|                            {
 2871|      0|                                bond_parityNM = 2 - (p1NM + p2NM + bNeighSwitched1 + bNeighSwitched2) % 2;
 2872|      0|                            }
 2873|    504|                            else
 2874|    504|                            {
 2875|    504|                                if (p1NM && p2NM)
  ------------------
  |  Branch (2875:37): [True: 0, False: 504]
  |  Branch (2875:45): [True: 0, False: 0]
  ------------------
 2876|      0|                                {
 2877|      0|                                    bond_parityNM = inchi_min(p1NM, p2NM);
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2878|      0|                                }
 2879|    504|                            }
 2880|    504|                        }
 2881|    504|                    }
 2882|    242|                    else
 2883|    242|                    {
 2884|    242|                        if (p1 && p2)
  ------------------
  |  Branch (2884:29): [True: 242, False: 0]
  |  Branch (2884:35): [True: 242, False: 0]
  ------------------
 2885|    242|                        {
 2886|    242|                            bond_parity = inchi_min(p1, p2);
  ------------------
  |  |  139|    242|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 242]
  |  |  ------------------
  ------------------
 2887|    242|                        }
 2888|    242|                        if (p1NM && p2NM)
  ------------------
  |  Branch (2888:29): [True: 0, False: 242]
  |  Branch (2888:37): [True: 0, False: 0]
  ------------------
 2889|      0|                        {
 2890|      0|                            bond_parityNM = inchi_min(p1NM, p2NM);
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2891|      0|                        }
 2892|    242|                        if (bond_parityNM && !bond_parity)
  ------------------
  |  Branch (2892:29): [True: 0, False: 242]
  |  Branch (2892:46): [True: 0, False: 0]
  ------------------
 2893|      0|                        {
 2894|      0|                            bond_parity = AB_PARITY_UNDF;
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 2895|      0|                        }
 2896|    242|                    }
 2897|    746|                }
 2898|       |
 2899|   124k|                len += sprintf(szCurBonds + len, "%c%s%s%d",
 2900|   124k|                               bond_char,
 2901|       |
 2902|   124k|                               (bond_parity == AB_PARITY_ODD) ? "-" : (bond_parity == AB_PARITY_EVEN) ? "+"
  ------------------
  |  |  219|   124k|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
                                             (bond_parity == AB_PARITY_ODD) ? "-" : (bond_parity == AB_PARITY_EVEN) ? "+"
  ------------------
  |  |  220|   123k|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
  |  Branch (2902:32): [True: 304, False: 123k]
  |  Branch (2902:71): [True: 200, False: 123k]
  ------------------
 2903|   123k|                                                                  : (bond_parity == AB_PARITY_UNKN)   ? "u"
  ------------------
  |  |  221|   123k|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
  |  Branch (2903:69): [True: 88, False: 123k]
  ------------------
 2904|   123k|                                                                  : (bond_parity == AB_PARITY_UNDF)   ? "?"
  ------------------
  |  |  222|   123k|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2904:69): [True: 154, False: 123k]
  ------------------
 2905|   123k|                                                                                                      : "",
 2906|       |
 2907|   124k|                               (bond_parityNM == AB_PARITY_ODD) ? "-" : (bond_parityNM == AB_PARITY_EVEN) ? "+"
  ------------------
  |  |  219|   124k|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
                                             (bond_parityNM == AB_PARITY_ODD) ? "-" : (bond_parityNM == AB_PARITY_EVEN) ? "+"
  ------------------
  |  |  220|   124k|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
  |  Branch (2907:32): [True: 0, False: 124k]
  |  Branch (2907:73): [True: 0, False: 124k]
  ------------------
 2908|   124k|                                                                    : (bond_parityNM == AB_PARITY_UNKN)   ? "u"
  ------------------
  |  |  221|   124k|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
  |  Branch (2908:71): [True: 0, False: 124k]
  ------------------
 2909|   124k|                                                                    : (bond_parityNM == AB_PARITY_UNDF)   ? "?"
  ------------------
  |  |  222|   124k|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2909:71): [True: 0, False: 124k]
  ------------------
 2910|   124k|                                                                                                          : "",
 2911|       |
 2912|   124k|                               j2 + 1);
 2913|   124k|            }
 2914|   203k|        }
 2915|   177k|        if (len + cur_len + 2 < buf_len)
  ------------------
  |  Branch (2915:13): [True: 177k, False: 93]
  ------------------
 2916|   177k|        {
 2917|   177k|            memcpy(szBuf + cur_len, szCurBonds, len);
 2918|   177k|            cur_len += len;
 2919|   177k|            szBuf[cur_len++] = ';';
 2920|   177k|            j++;
 2921|   177k|        }
 2922|     93|        else
 2923|     93|        {
 2924|     93|            break;
 2925|     93|        }
 2926|   177k|    }
 2927|   154k|    szBuf[cur_len] = '\0';
 2928|   154k|    *i = num_inp_atoms > 0 ? j : 0;
  ------------------
  |  Branch (2928:10): [True: 154k, False: 0]
  ------------------
 2929|       |
 2930|   154k|    return cur_len;
 2931|   154k|}
ichiprt1.c:OutputINCHI_VersionAndKind:
 3143|  5.02k|{
 3144|  5.02k|    inchi_ios_print_nodisplay(out_file, "%s%s=%s", pLF, INCHI_NAME, pLF);
  ------------------
  |  |  224|  5.02k|#define INCHI_NAME          "InChI"
  ------------------
 3145|       |
 3146|  5.02k|    inchi_strbuf_reset(strbuf);
 3147|  5.02k|    inchi_strbuf_printf(strbuf, "%s", x_curr_ver);
 3148|       |
 3149|       |    /*
 3150|       |     * (@nnuk)
 3151|       |     * The calculation class designator is:
 3152|       |     *   S = Standard
 3153|       |     *   B = Beta
 3154|       |     *   N = non-standard
 3155|       |     *
 3156|       |     * Molecular Inorganics adds the subversion designator 'B'.
 3157|       |     *
 3158|       |     * Non-standard takes precedence over Beta because use of a non-standard
 3159|       |     * option makes the resulting InChI non-standard irrespective of any
 3160|       |     * experimental feature that would otherwise require the Beta designator.
 3161|       |    */
 3162|  5.02k|    if (!(bINChIOutputOptions & INCHI_OUT_STDINCHI))
  ------------------
  |  |  145|  5.02k|#define INCHI_OUT_STDINCHI 0x4000
  ------------------
  |  Branch (3162:9): [True: 5.00k, False: 22]
  ------------------
 3163|  5.00k|    {
 3164|  5.00k|        inchi_strbuf_printf(strbuf, "N");
 3165|  5.00k|    }
 3166|     22|    else if (is_beta)
  ------------------
  |  Branch (3166:14): [True: 5, False: 17]
  ------------------
 3167|      5|    {
 3168|      5|        inchi_strbuf_printf(strbuf, "B");
 3169|      5|    }
 3170|     17|    else
 3171|     17|    {
 3172|     17|        inchi_strbuf_printf(strbuf, "S");
 3173|     17|    }
 3174|       |
 3175|  5.02k|    if (is_molecular_inorganic)
  ------------------
  |  Branch (3175:9): [True: 0, False: 5.02k]
  ------------------
 3176|      0|    {
 3177|      0|        inchi_strbuf_printf(strbuf, "B");
 3178|      0|    }
 3179|       |
 3180|  5.02k|    inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 3181|       |
 3182|  5.02k|    return 0;
 3183|  5.02k|}
ichiprt1.c:OutputINCHI_MainLayerFormula:
 3197|  5.02k|{
 3198|       |
 3199|       |    /* constitution ( dot-disconnected Hill formulas: <formula> ) */
 3200|       |
 3201|  5.02k|    if (num_components2[0] || num_components2[1])
  ------------------
  |  Branch (3201:9): [True: 5.02k, False: 0]
  |  Branch (3201:31): [True: 0, False: 0]
  ------------------
 3202|  5.02k|    {
 3203|  5.02k|        szGetTag(IdentLbl, io->nTag, io->bTag1 = *INCHI_basic_or_INCHI_reconnected == INCHI_REC ? IL_REC_ : IL_FML_, io->szTag1, &io->bAlways, 1);
  ------------------
  |  |  571|  5.02k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (3203:50): [True: 0, False: 5.02k]
  ------------------
 3204|  5.02k|        inchi_strbuf_reset(strbuf);
 3205|  5.02k|        io->tot_len = str_HillFormula(io->pINChISort, strbuf, &io->bOverflow, io->bOutType,
 3206|  5.02k|                                      io->num_components, io->bUseMulipliers);
 3207|       |
 3208|  5.02k|        if (str_LineEnd(io->szTag1, &io->bOverflow, strbuf, -1, 1))
  ------------------
  |  Branch (3208:13): [True: 0, False: 5.02k]
  ------------------
 3209|      0|        {
 3210|      0|            return 1;
 3211|      0|        }
 3212|  5.02k|        if (io->n_pzz > 0 && io->n_zy > 0)
  ------------------
  |  Branch (3212:13): [True: 0, False: 5.02k]
  |  Branch (3212:30): [True: 0, False: 0]
  ------------------
 3213|      0|        {
 3214|      0|            int retm = MergeZzInHillFormula(strbuf);
 3215|      0|            if (0 != retm)
  ------------------
  |  Branch (3215:17): [True: 0, False: 0]
  ------------------
 3216|      0|            {
 3217|      0|                return -1;
 3218|      0|            }
 3219|      0|        }
 3220|  5.02k|        inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 3221|  5.02k|    }
 3222|       |
 3223|  5.02k|    LOG_NO_ARGS("\n#################### (L3318:ichiprt1.c) ##########################\n");
 3224|  5.02k|    LOG_MULT_ARGS("This is the Chemical formula : %s\n", strbuf->pStr);
 3225|  5.02k|    LOG_NO_ARGS("####################################################################\n");
 3226|       |
 3227|  5.02k|    return 0;
 3228|  5.02k|}
ichiprt1.c:str_LineEnd:
 2199|  13.0k|{
 2200|       |    /* djb-rwth: removing redundant variables */
 2201|  13.0k|    int tag_len;
 2202|       |
 2203|       |    /* check buffer overflow */
 2204|  13.0k|    if (*bOverflow)
  ------------------
  |  Branch (2204:9): [True: 0, False: 13.0k]
  ------------------
 2205|      0|    {
 2206|      0|        return 1;
 2207|      0|    }
 2208|       |
 2209|  13.0k|    if (ind < 0)
  ------------------
  |  Branch (2209:9): [True: 13.0k, False: 0]
  ------------------
 2210|  13.0k|    {
 2211|       |        /* Plain text */
 2212|       |        /* insert plain text tag if:
 2213|       |           (a) pStr has non-zero length, or
 2214|       |           (b) ind < -1
 2215|       |        */
 2216|  13.0k|        if (buf->pStr[0] || ind < -1)
  ------------------
  |  Branch (2216:13): [True: 12.5k, False: 480]
  |  Branch (2216:29): [True: 94, False: 386]
  ------------------
 2217|  12.6k|        {
 2218|  12.6k|            tag_len = bPlainTextTags ? (int)strlen(tag) : 0;
  ------------------
  |  Branch (2218:23): [True: 12.6k, False: 0]
  ------------------
 2219|  12.6k|            if (tag_len > 0)
  ------------------
  |  Branch (2219:17): [True: 12.6k, False: 0]
  ------------------
 2220|  12.6k|            {
 2221|  12.6k|                int n_added = tag_len + 2 + 2;
 2222|  12.6k|                inchi_strbuf_update(buf, n_added);
 2223|       |
 2224|  12.6k|                memmove(buf->pStr + tag_len, buf->pStr, (long long)buf->nUsedLength + 1); /* djb-rwth: cast operator added */
 2225|       |                /* NB: trailing 0 is also memmoved */
 2226|  12.6k|                memcpy(buf->pStr, tag, tag_len);
 2227|       |
 2228|       |                /* to be sure...  */
 2229|  12.6k|                buf->nUsedLength = strlen(buf->pStr);
 2230|  12.6k|            }
 2231|  12.6k|        }
 2232|  13.0k|    }
 2233|       |
 2234|  13.0k|    return 0;
 2235|  13.0k|}
ichiprt1.c:OutputINCHI_MainLayerConnections:
 3239|  5.02k|{
 3240|       |    /* connections ( semicolon/dot-disconnected connection tables ) */
 3241|       |
 3242|  5.02k|    szGetTag(IdentLbl, io->nTag, io->bTag1 = IL_CONN, io->szTag1, &io->bAlways, 1);
 3243|  5.02k|    inchi_strbuf_reset(strbuf);
 3244|  5.02k|    io->tot_len = 0;
 3245|  5.02k|    io->tot_len2 = str_Connections(pCG, io->pINChISort, strbuf, &io->bOverflow, io->bOutType,
 3246|  5.02k|                                   io->ATOM_MODE, io->num_components, io->bUseMulipliers);
 3247|       |
 3248|       |    /* current version does not output empty (";;;;") connectivity */
 3249|       |
 3250|  5.02k|    if (io->tot_len != io->tot_len2)
  ------------------
  |  Branch (3250:9): [True: 4.24k, False: 780]
  ------------------
 3251|  4.24k|    { /* 2004-06-30: never output empty connection table */
 3252|  4.24k|        io->tot_len = io->tot_len2;
 3253|  4.24k|        if (str_LineEnd(io->szTag1, &io->bOverflow, strbuf, -2, io->bPlainTextTags))
  ------------------
  |  Branch (3253:13): [True: 0, False: 4.24k]
  ------------------
 3254|      0|        {
 3255|      0|            return 1; /* pStr overfow */
 3256|      0|        }
 3257|  4.24k|        inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 3258|  4.24k|    }
 3259|       |
 3260|  5.02k|    LOG_NO_ARGS("\n##################### (L3357:ichiprt1.c) #########################\n");
 3261|  5.02k|    LOG_MULT_ARGS("This is the Connection Layer : %s\n", strbuf->pStr);
 3262|  5.02k|    LOG_NO_ARGS("####################################################################\n");
 3263|       |
 3264|  5.02k|    return 0;
 3265|  5.02k|}
ichiprt1.c:OutputINCHI_MainLayerHydrogens:
 3276|  5.02k|{
 3277|       |
 3278|       |    /* hydrogen atoms (do not output empty) */
 3279|       |
 3280|  5.02k|    if (INCHI_SEGM_FILL == INChI_SegmentAction(io->sDifSegs[io->nCurINChISegment][DIFS_h_H_ATOMS]))
  ------------------
  |  Branch (3280:9): [True: 1.86k, False: 3.16k]
  ------------------
 3281|  1.86k|    {
 3282|  1.86k|        szGetTag(IdentLbl, io->nTag, io->bTag1 = IL_ALLH, io->szTag1, &io->bAlways, 1);
 3283|  1.86k|        inchi_strbuf_reset(strbuf);
 3284|  1.86k|        io->tot_len = 0;
 3285|  1.86k|        io->tot_len2 = str_H_atoms(io->pINChISort, strbuf, &io->bOverflow, io->bOutType,
 3286|  1.86k|                                   io->ATOM_MODE, io->TAUT_MODE,
 3287|  1.86k|                                   io->num_components, io->bUseMulipliers);
 3288|  1.86k|        if (io->tot_len != io->tot_len2)
  ------------------
  |  Branch (3288:13): [True: 1.86k, False: 0]
  ------------------
 3289|  1.86k|        { /* 2004-06-21: never output empty */
 3290|  1.86k|            io->tot_len = io->tot_len2;
 3291|  1.86k|            if (str_LineEnd(io->szTag1, &io->bOverflow, strbuf, -2, 1))
  ------------------
  |  Branch (3291:17): [True: 0, False: 1.86k]
  ------------------
 3292|      0|            {
 3293|      0|                return 1;
 3294|      0|            }
 3295|  1.86k|            inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 3296|  1.86k|        }
 3297|  1.86k|    }
 3298|       |
 3299|  5.02k|    LOG_NO_ARGS("\n###################### (L3396:ichiprt1.c) ########################\n");
 3300|  5.02k|    LOG_MULT_ARGS("This is the Hydrogen Layer : %s\n", strbuf->pStr);
 3301|  5.02k|    LOG_NO_ARGS("####################################################################\n");
 3302|       |
 3303|  5.02k|    return 0;
 3304|  5.02k|}
ichiprt1.c:OutputINCHI_ChargeAndRemovedAddedProtonsLayers:
 3315|  5.02k|{
 3316|       |
 3317|       |    /* charge  */
 3318|       |
 3319|  5.02k|    io->nSegmAction = INChI_SegmentAction(io->sDifSegs[io->nCurINChISegment][DIFS_q_CHARGE]);
 3320|  5.02k|    if (io->nSegmAction)
  ------------------
  |  Branch (3320:9): [True: 243, False: 4.78k]
  ------------------
 3321|    243|    {
 3322|    243|        szGetTag(IdentLbl, io->nTag, io->bTag1 = IL_CHRG | io->bFhTag, io->szTag1, &io->bAlways, 1);
 3323|    243|        inchi_strbuf_reset(strbuf);
 3324|    243|        io->tot_len = 0;
 3325|    243|        if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3325:13): [True: 243, False: 0]
  ------------------
 3326|    243|        {
 3327|    243|            io->tot_len = str_Charge2(io->pINChISort, io->pINChISort2,
 3328|    243|                                      strbuf, &io->bOverflow, io->bOutType, io->num_components,
 3329|    243|                                      io->bSecondNonTautPass, io->bOmitRepetitions, io->bUseMulipliers);
 3330|    243|            io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3331|    243|        }
 3332|    243|        if (str_LineEnd(io->szTag1, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags))
  ------------------
  |  Branch (3332:13): [True: 0, False: 243]
  ------------------
 3333|      0|        {
 3334|      0|            return 1;
 3335|      0|        }
 3336|    243|        inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 3337|    243|    }
 3338|       |
 3339|       |    /* removed protons */
 3340|       |
 3341|  5.02k|    if (io->iCurTautMode == TAUT_YES && !io->bSecondNonTautPass)
  ------------------
  |  |  575|  10.0k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3341:9): [True: 5.02k, False: 0]
  |  Branch (3341:41): [True: 5.02k, False: 0]
  ------------------
 3342|  5.02k|    {
 3343|       |
 3344|  5.02k|        io->nSegmAction = INChI_SegmentAction(io->sDifSegs[io->nCurINChISegment][DIFS_p_PROTONS]);
 3345|  5.02k|        if (io->nSegmAction)
  ------------------
  |  Branch (3345:13): [True: 147, False: 4.88k]
  ------------------
 3346|    147|        {
 3347|    147|            szGetTag(IdentLbl, io->nTag, io->bTag1 = IL_PROT | io->bFhTag, io->szTag1, &io->bAlways, 1);
 3348|    147|            inchi_strbuf_reset(strbuf);
 3349|    147|            io->tot_len = 0;
 3350|    147|            inchi_strbuf_printf(strbuf, "%+d", io->nNumRemovedProtons);
 3351|    147|            if (str_LineEnd(io->szTag1, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags))
  ------------------
  |  Branch (3351:17): [True: 0, False: 147]
  ------------------
 3352|      0|            {
 3353|      0|                return 1;
 3354|      0|            }
 3355|    147|            inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 3356|    147|        }
 3357|  4.88k|        else
 3358|  4.88k|        {
 3359|  4.88k|            if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3359:17): [True: 0, False: 4.88k]
  ------------------
 3360|      0|                inchi_ios_print_nodisplay(out_file, "/");
 3361|  4.88k|        }
 3362|  5.02k|    }
 3363|       |
 3364|  5.02k|    return 0;
 3365|  5.02k|}
ichiprt1.c:OutputINCHI_StereoLayer:
 3384|  5.02k|{
 3385|       |
 3386|  5.02k|    if (INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_b_SBONDS] ) ||
  ------------------
  |  Branch (3386:9): [True: 410, False: 4.61k]
  ------------------
 3387|  4.61k|        INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_t_SATOMS] ) ||
  ------------------
  |  Branch (3387:9): [True: 357, False: 4.26k]
  ------------------
 3388|  4.26k|        INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_m_SP3INV] ) ||
  ------------------
  |  Branch (3388:9): [True: 0, False: 4.26k]
  ------------------
 3389|  4.26k|        INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_s_STYPE] ))
  ------------------
  |  Branch (3389:9): [True: 0, False: 4.26k]
  ------------------
 3390|    767|    {
 3391|       |
 3392|       |        /*  stereo */
 3393|       |
 3394|    767|        szGetTag(IdentLbl, io->nTag, io->bTag1 = IL_STER | io->bFhTag, io->szTag1, &io->bAlways, 1);
 3395|       |
 3396|       |        /*  sp2 */
 3397|       |
 3398|    767|        if ((io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_b_SBONDS] )))
  ------------------
  |  Branch (3398:13): [True: 410, False: 357]
  ------------------
 3399|    410|        {
 3400|    410|            szGetTag(IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_DBND, io->szTag2, &io->bAlways, 1);
 3401|    410|            inchi_strbuf_reset(strbuf);
 3402|    410|            io->tot_len = 0;
 3403|    410|            if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3403:17): [True: 410, False: 0]
  ------------------
 3404|    410|            {
 3405|    410|                io->tot_len = str_Sp2( io->pINChISort, io->pINChISort2, strbuf, &io->bOverflow,
 3406|    410|                                       io->bOutType, io->TAUT_MODE, io->num_components,
 3407|    410|                                       io->bSecondNonTautPass, io->bOmitRepetitions, io->bUseMulipliers );
 3408|       |
 3409|    410|                io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3410|    410|            }
 3411|       |
 3412|    410|            if (str_LineEnd(io->szTag2, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags))
  ------------------
  |  Branch (3412:17): [True: 0, False: 410]
  ------------------
 3413|      0|            {
 3414|      0|                return 1;
 3415|      0|            }
 3416|    410|            inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 3417|    410|        }
 3418|    357|        else
 3419|    357|        {
 3420|    357|            if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3420:17): [True: 0, False: 357]
  ------------------
 3421|      0|            {
 3422|      0|                inchi_ios_print_nodisplay(out_file, "/"); /* sp2 */
 3423|      0|            }
 3424|    357|        }
 3425|       |
 3426|       |        /*  sp3 */
 3427|       |
 3428|       |        /* t-layer */
 3429|    767|        if ((io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_t_SATOMS] ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3429:13): [True: 357, False: 410]
  ------------------
 3430|    357|        {
 3431|    357|            io->bRelRac = io->bRelativeStereo[io->iCurTautMode] || io->bRacemicStereo[io->iCurTautMode];
  ------------------
  |  Branch (3431:27): [True: 16, False: 341]
  |  Branch (3431:68): [True: 10, False: 331]
  ------------------
 3432|    357|            szGetTag(IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_SP3S, io->szTag2, &io->bAlways, 1);
 3433|    357|            inchi_strbuf_reset(strbuf);
 3434|    357|            io->tot_len = 0;
 3435|    357|            if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3435:17): [True: 357, False: 0]
  ------------------
 3436|    357|            {
 3437|    357|                io->tot_len = str_Sp3( io->pINChISort, io->pINChISort2, strbuf, &io->bOverflow,
 3438|    357|                                       io->bOutType, io->TAUT_MODE, io->num_components, io->bRelRac,
 3439|    357|                                       io->bSecondNonTautPass, io->bOmitRepetitions, io->bUseMulipliers );
 3440|       |
 3441|    357|                io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3442|    357|            }
 3443|       |
 3444|    357|            if (str_LineEnd(io->szTag2, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags))
  ------------------
  |  Branch (3444:17): [True: 0, False: 357]
  ------------------
 3445|      0|            {
 3446|      0|                return 2;
 3447|      0|            }
 3448|    357|            inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 3449|    357|        }
 3450|    410|        else
 3451|    410|        {
 3452|    410|            if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3452:17): [True: 0, False: 410]
  ------------------
 3453|      0|            {
 3454|      0|                inchi_ios_print_nodisplay( out_file, "/" ); /* sp3 */
 3455|      0|            }
 3456|    410|        }
 3457|       |
 3458|       |        /* m-layer */
 3459|    767|        if ((io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_m_SP3INV] ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3459:13): [True: 2, False: 765]
  ------------------
 3460|      2|        {
 3461|      2|            szGetTag(IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_INVS, io->szTag2, &io->bAlways, 1);
 3462|      2|            inchi_strbuf_reset(strbuf);
 3463|      2|            io->tot_len = 0;
 3464|      2|            if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3464:17): [True: 2, False: 0]
  ------------------
 3465|      2|            {
 3466|      2|                io->tot_len = str_StereoAbsInv( io->pINChISort, strbuf,
 3467|      2|                                               &io->bOverflow, io->bOutType, io->num_components );
 3468|      2|                io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3469|      2|            }
 3470|       |
 3471|      2|            if (str_LineEnd(io->szTag2, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags))
  ------------------
  |  Branch (3471:17): [True: 0, False: 2]
  ------------------
 3472|      0|            {
 3473|      0|                return 3;
 3474|      0|            }
 3475|      2|            inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 3476|      2|        }
 3477|    765|        else
 3478|    765|        {
 3479|    765|            if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3479:17): [True: 0, False: 765]
  ------------------
 3480|      0|            {
 3481|      0|                inchi_ios_print_nodisplay(out_file, "/"); /* stereo-abs-inv */
 3482|      0|            }
 3483|    765|        }
 3484|       |
 3485|       |        /* stereo type */
 3486|       |
 3487|       |        /* s-layer */
 3488|    767|        if ((io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_s_STYPE] )))
  ------------------
  |  Branch (3488:13): [True: 11, False: 756]
  ------------------
 3489|     11|        {
 3490|     11|            const char *p_stereo = io->bRelativeStereo[io->iCurTautMode] ? x_rel : io->bRacemicStereo[io->iCurTautMode] ? x_rac
  ------------------
  |  Branch (3490:36): [True: 7, False: 4]
  |  Branch (3490:84): [True: 2, False: 2]
  ------------------
 3491|      4|                                                                                                                        : x_abs;
 3492|     11|            szGetTag(IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_TYPS, io->szTag2, &io->bAlways, 1);
 3493|     11|            inchi_strbuf_reset(strbuf);
 3494|     11|            io->tot_len = 0;
 3495|     11|            if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3495:17): [True: 11, False: 0]
  ------------------
 3496|     11|            {
 3497|     11|                (io->tot_len) += MakeDelim(p_stereo, strbuf, &io->bOverflow);
 3498|     11|                io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3499|     11|            }
 3500|     11|            if (str_LineEnd(io->szTag2, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags))
  ------------------
  |  Branch (3500:17): [True: 0, False: 11]
  ------------------
 3501|      0|            {
 3502|      0|                return 1;
 3503|      0|            }
 3504|     11|            inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 3505|     11|        }
 3506|    767|        if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3506:13): [True: 0, False: 767]
  ------------------
 3507|      0|        {
 3508|      0|            inchi_ios_print_nodisplay(out_file, "/"); /* no abs, inv or racemic stereo */
 3509|      0|        }
 3510|    767|    }
 3511|  4.26k|    else
 3512|  4.26k|    {
 3513|  4.26k|        if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3513:13): [True: 0, False: 4.26k]
  ------------------
 3514|      0|        {
 3515|      0|            inchi_ios_print_nodisplay( out_file, "////" ); /* sp2, sp3, abs-inv, stereo.type */
 3516|      0|        }
 3517|  4.26k|    }
 3518|       |
 3519|  5.02k|    return 0;
 3520|  5.02k|}
ichiprt1.c:OutputINCHI_IsotopicLayer:
 3707|  5.02k|{
 3708|       |
 3709|  5.02k|    if (INChI_SegmentAction(io->sDifSegs[io->nCurINChISegment][DIFS_i_IATOMS]))
  ------------------
  |  Branch (3709:9): [True: 545, False: 4.48k]
  ------------------
 3710|    545|    {
 3711|       |        /*  isotopic #1:  composition -- atoms -- do not output in xml if empty */
 3712|    545|        szGetTag(IdentLbl, io->nTag, io->bTag1 = IL_ISOT | io->bFhTag, io->szTag1, &io->bAlways, 1);
 3713|       |        /* isotopic atoms without mobile H.
 3714|       |         * Fixed 2004-06-15: always output if not bXml. Note:
 3715|       |         * Previous condition if( bHasIsotopicAtoms[io->iCurTautMode] || bIsotopic && !bXml)
 3716|       |         * did not optput /i in case of only mobile isotopic H
 3717|       |         */
 3718|    545|        if ((io->nSegmAction = INChI_SegmentAction(io->sDifSegs[io->nCurINChISegment][DIFS_i_IATOMS]))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3718:13): [True: 545, False: 0]
  ------------------
 3719|    545|        {
 3720|    545|            szGetTag(IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_ATMS, io->szTag2, &io->bAlways, 1);
 3721|    545|            inchi_strbuf_reset(strbuf);
 3722|    545|            io->tot_len = 0;
 3723|       |            /*if ( bHasIsotopicAtoms[io->iCurTautMode] )*/
 3724|    545|            if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3724:17): [True: 451, False: 94]
  ------------------
 3725|    451|            {
 3726|    451|                io->tot_len2 = str_IsoAtoms(io->pINChISort, io->pINChISort2, strbuf, &io->bOverflow,
 3727|    451|                                            io->bOutType, io->TAUT_MODE, io->num_components, io->bAbcNumbers,
 3728|    451|                                            io->bSecondNonTautPass, io->bOmitRepetitions, io->bUseMulipliers);
 3729|    451|                io->bNonTautIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3730|    451|            }
 3731|     94|            else
 3732|     94|            {
 3733|     94|                io->tot_len2 = io->tot_len;
 3734|     94|            }
 3735|       |
 3736|    545|            io->tot_len = io->tot_len2;
 3737|    545|            if (str_LineEnd(io->szTag2, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags))
  ------------------
  |  Branch (3737:17): [True: 0, False: 545]
  ------------------
 3738|      0|            {
 3739|      0|                return 1;
 3740|      0|            }
 3741|    545|            inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 3742|    545|        }
 3743|       |
 3744|       |        /*  isotopic #1a:  composition -- exchangeable isotopic H (mobile H only) */
 3745|       |        /*if ( !io->bSecondNonTautPass && bHasIsoH )*/
 3746|    545|        if ((io->nSegmAction = INChI_SegmentAction(io->sDifSegs[io->nCurINChISegment][DIFS_h_H_ATOMS]))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3746:13): [True: 74, False: 471]
  ------------------
 3747|     74|        {
 3748|     74|            szGetTag(IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_XCGA, io->szTag2, &io->bAlways, 1);
 3749|     74|            inchi_strbuf_reset(strbuf);
 3750|     74|            io->tot_len = 0;
 3751|     74|            (io->tot_len) += MakeIsoHString(io->num_iso_H, strbuf, io->TAUT_MODE, &io->bOverflow);
 3752|     74|            io->bNonTautIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3753|     74|            if (str_LineEnd(io->szTag2, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags))
  ------------------
  |  Branch (3753:17): [True: 0, False: 74]
  ------------------
 3754|      0|            {
 3755|      0|                return 2;
 3756|      0|            }
 3757|     74|            inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 3758|     74|        }
 3759|       |
 3760|       |        /***************************************************
 3761|       |         *
 3762|       |         *       Isotopic stereo
 3763|       |         *
 3764|       |         ***************************************************/
 3765|       |
 3766|       |        /*if ( bIsotopicStereo[io->iCurTautMode] )*/
 3767|    545|        if (INChI_SegmentAction(io->sDifSegs[io->nCurINChISegment][DIFS_b_SBONDS]) ||
  ------------------
  |  Branch (3767:13): [True: 40, False: 505]
  ------------------
 3768|    505|            INChI_SegmentAction(io->sDifSegs[io->nCurINChISegment][DIFS_t_SATOMS]) ||
  ------------------
  |  Branch (3768:13): [True: 65, False: 440]
  ------------------
 3769|    440|            INChI_SegmentAction(io->sDifSegs[io->nCurINChISegment][DIFS_m_SP3INV]) ||
  ------------------
  |  Branch (3769:13): [True: 2, False: 438]
  ------------------
 3770|    438|            INChI_SegmentAction(io->sDifSegs[io->nCurINChISegment][DIFS_s_STYPE]))
  ------------------
  |  Branch (3770:13): [True: 7, False: 431]
  ------------------
 3771|    114|        {
 3772|       |            /*  stereo */
 3773|    114|            szGetTag(IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_STER, io->szTag2, &io->bAlways, 1);
 3774|       |
 3775|       |            /************************
 3776|       |              isotopic #2:  sp2
 3777|       |             ************************/
 3778|       |            /*if ( bIsotopicStereoSp2[io->iCurTautMode]  )*/
 3779|    114|            if ((io->nSegmAction = INChI_SegmentAction(io->sDifSegs[io->nCurINChISegment][DIFS_b_SBONDS]))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3779:17): [True: 40, False: 74]
  ------------------
 3780|     40|            {
 3781|     40|                szGetTag(IdentLbl, io->nTag, io->bTag3 = io->bTag2 | IL_DBND, io->szTag3, &io->bAlways, 1);
 3782|     40|                inchi_strbuf_reset(strbuf);
 3783|     40|                io->tot_len = 0;
 3784|     40|                if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3784:21): [True: 40, False: 0]
  ------------------
 3785|     40|                {
 3786|     40|                    io->tot_len = str_IsoSp2(io->pINChISort, io->pINChISort2, strbuf, &io->bOverflow,
 3787|     40|                                             io->bOutType, io->TAUT_MODE, io->num_components,
 3788|     40|                                             io->bSecondNonTautPass, io->bOmitRepetitions, io->bUseMulipliers);
 3789|     40|                    io->bNonTautIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3790|     40|                }
 3791|     40|                if (str_LineEnd(io->szTag3, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags))
  ------------------
  |  Branch (3791:21): [True: 0, False: 40]
  ------------------
 3792|      0|                {
 3793|      0|                    return 3;
 3794|      0|                }
 3795|     40|                inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 3796|     40|            }
 3797|     74|            else
 3798|     74|            {
 3799|     74|                if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3799:21): [True: 0, False: 74]
  ------------------
 3800|      0|                    inchi_ios_print_nodisplay(out_file, "/"); /* iso sp2 */
 3801|     74|            }
 3802|       |
 3803|       |            /************************
 3804|       |              isotopic #3:  sp3
 3805|       |             ************************/
 3806|       |            /*if ( bIsotopicStereoSp3[io->iCurTautMode]  )*/
 3807|    114|            if ((io->nSegmAction = INChI_SegmentAction(io->sDifSegs[io->nCurINChISegment][DIFS_t_SATOMS]))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3807:17): [True: 65, False: 49]
  ------------------
 3808|     65|            {
 3809|     65|                io->bRelRac = io->bIsotopicRelativeStereo[io->iCurTautMode] || io->bIsotopicRacemicStereo[io->iCurTautMode];
  ------------------
  |  Branch (3809:31): [True: 0, False: 65]
  |  Branch (3809:80): [True: 0, False: 65]
  ------------------
 3810|       |
 3811|     65|                szGetTag(IdentLbl, io->nTag, io->bTag3 = io->bTag2 | IL_SP3S, io->szTag3, &io->bAlways, 1);
 3812|     65|                inchi_strbuf_reset(strbuf);
 3813|     65|                io->tot_len = 0;
 3814|     65|                if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3814:21): [True: 65, False: 0]
  ------------------
 3815|     65|                {
 3816|     65|                    io->tot_len = str_IsoSp3(io->pINChISort, io->pINChISort2, strbuf, &io->bOverflow,
 3817|     65|                                             io->bOutType, io->TAUT_MODE, io->num_components, io->bRelRac,
 3818|     65|                                             io->bSecondNonTautPass, io->bOmitRepetitions, io->bUseMulipliers);
 3819|     65|                    io->bNonTautIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3820|     65|                }
 3821|     65|                if (str_LineEnd(io->szTag3, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags))
  ------------------
  |  Branch (3821:21): [True: 0, False: 65]
  ------------------
 3822|      0|                {
 3823|      0|                    return 5;
 3824|      0|                }
 3825|     65|                inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 3826|     65|            }
 3827|     49|            else
 3828|     49|            {
 3829|     49|                if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3829:21): [True: 0, False: 49]
  ------------------
 3830|      0|                {
 3831|      0|                    inchi_ios_print_nodisplay(out_file, "/"); /* iso-sp3 */
 3832|      0|                }
 3833|     49|            }
 3834|       |
 3835|       |            /* isotopic #4: abs inverted */
 3836|    114|            if ((io->nSegmAction = INChI_SegmentAction(io->sDifSegs[io->nCurINChISegment][DIFS_m_SP3INV]))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3836:17): [True: 2, False: 112]
  ------------------
 3837|      2|            {
 3838|      2|                szGetTag(IdentLbl, io->nTag, io->bTag3 = io->bTag2 | IL_INVS, io->szTag3, &io->bAlways, 1);
 3839|      2|                inchi_strbuf_reset(strbuf);
 3840|      2|                io->tot_len = 0;
 3841|      2|                if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3841:21): [True: 2, False: 0]
  ------------------
 3842|      2|                {
 3843|      2|                    io->tot_len = str_IsoStereoAbsInv(io->pINChISort, strbuf,
 3844|      2|                                                      &io->bOverflow, io->bOutType, io->num_components);
 3845|      2|                    io->bNonTautIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3846|      2|                }
 3847|      2|                if (str_LineEnd(io->szTag3, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags))
  ------------------
  |  Branch (3847:21): [True: 0, False: 2]
  ------------------
 3848|      0|                {
 3849|      0|                    return 5;
 3850|      0|                }
 3851|      2|                inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 3852|      2|            }
 3853|    112|            else
 3854|    112|            {
 3855|    112|                if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3855:21): [True: 0, False: 112]
  ------------------
 3856|      0|                {
 3857|      0|                    inchi_ios_print_nodisplay(out_file, "/");
 3858|      0|                }
 3859|    112|            }
 3860|       |
 3861|       |            /* isotopic #5: stereo type. Do not output if it has already been output in non-iso */
 3862|    114|            if ((io->nSegmAction = INChI_SegmentAction(io->sDifSegs[io->nCurINChISegment][DIFS_s_STYPE]))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3862:17): [True: 19, False: 95]
  ------------------
 3863|     19|            {
 3864|     19|                const char *p_stereo = io->bIsotopicRelativeStereo[io->iCurTautMode] ? x_rel : io->bIsotopicRacemicStereo[io->iCurTautMode] ? x_rac
  ------------------
  |  Branch (3864:40): [True: 3, False: 16]
  |  Branch (3864:96): [True: 1, False: 15]
  ------------------
 3865|     16|                                                                                                                                            : x_abs;
 3866|     19|                szGetTag(IdentLbl, io->nTag, io->bTag3 = io->bTag2 | IL_TYPS, io->szTag3, &io->bAlways, 1);
 3867|     19|                inchi_strbuf_reset(strbuf);
 3868|     19|                io->tot_len = 0;
 3869|     19|                if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3869:21): [True: 19, False: 0]
  ------------------
 3870|     19|                {
 3871|     19|                    io->tot_len += MakeDelim(p_stereo, strbuf, &io->bOverflow);
 3872|     19|                    io->bNonTautIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3873|     19|                }
 3874|     19|                if (str_LineEnd(io->szTag3, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags))
  ------------------
  |  Branch (3874:21): [True: 0, False: 19]
  ------------------
 3875|      0|                {
 3876|      0|                    return 6;
 3877|      0|                }
 3878|     19|                inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 3879|     19|            }
 3880|    114|            if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3880:17): [True: 0, False: 114]
  ------------------
 3881|      0|            {
 3882|      0|                inchi_ios_print_nodisplay(out_file, "/"); /* no abs, inv or racemic stereo */
 3883|      0|            }
 3884|    114|        }
 3885|    431|        else
 3886|    431|        {
 3887|       |            /* no isotopic stereo */
 3888|    431|            if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3888:17): [True: 0, False: 431]
  ------------------
 3889|      0|            {
 3890|      0|                inchi_ios_print_nodisplay(out_file, "////"); /* sp3, sp2, abs-inv, stereo.type */
 3891|      0|            }
 3892|    431|        }
 3893|    545|    }
 3894|  4.48k|    else
 3895|  4.48k|    {
 3896|  4.48k|        if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3896:13): [True: 0, False: 4.48k]
  ------------------
 3897|      0|        {
 3898|      0|            inchi_ios_print_nodisplay(out_file, "///"); /* isotopic composition, sp2, sp3 */
 3899|      0|        }
 3900|  4.48k|        if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3900:13): [True: 0, False: 4.48k]
  ------------------
 3901|      0|        {
 3902|      0|            inchi_ios_print_nodisplay(out_file, "//"); /* inv or racemic stereo */
 3903|      0|        }
 3904|  4.48k|    }
 3905|       |
 3906|  5.02k|#if (CANON_FIXH_TRANS == 1)
 3907|  5.02k|    if (io->bOutType == OUT_NONTAUT && io->bOutputType == OUT_TN && io->bSecondNonTautPass &&
  ------------------
  |  |  920|  5.02k|#define OUT_NONTAUT OUT_NN /* was OUT_NT until 2004-04-07 */
  |  |  ------------------
  |  |  |  |  585|  10.0k|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  ------------------
                  if (io->bOutType == OUT_NONTAUT && io->bOutputType == OUT_TN && io->bSecondNonTautPass &&
  ------------------
  |  |  583|  5.02k|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (3907:9): [True: 0, False: 5.02k]
  |  Branch (3907:40): [True: 0, False: 0]
  |  Branch (3907:69): [True: 0, False: 0]
  ------------------
 3908|      0|        INCHI_SEGM_FILL == INChI_SegmentAction(io->sDifSegs[DIFL_F][DIFS_o_TRANSP]))
  ------------------
  |  Branch (3908:9): [True: 0, False: 0]
  ------------------
 3909|      0|    {
 3910|       |        /* find and print non-tautomeric components transposition, if non-trivial */
 3911|      0|        AT_NUMB *nTrans_n, *nTrans_s;
 3912|       |
 3913|      0|        if (0 < bin_AuxTautTrans(io->pINChISort, io->pINChISort2, &nTrans_n, &nTrans_s, io->bOutType, io->num_components))
  ------------------
  |  Branch (3913:13): [True: 0, False: 0]
  ------------------
 3914|      0|        {
 3915|       |            /* a non-trivial transposition does exist; output start tag */
 3916|      0|            szGetTag(IdentLbl, io->nTag, io->bTag1 = IL_TRNS | io->bFhTag, io->szTag1, &io->bAlways, 1);
 3917|      0|            inchi_strbuf_reset(strbuf);
 3918|      0|            io->tot_len = 0;
 3919|       |            /* print the transposition, cycle after cycle */
 3920|      0|            io->tot_len = str_AuxTautTrans(pCG, nTrans_n, nTrans_s, strbuf,
 3921|      0|                                           &io->bOverflow, io->TAUT_MODE, io->num_components);
 3922|      0|            io->bNonTautIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3923|      0|            if (str_LineEnd(io->szTag1, &io->bOverflow, strbuf, -1, io->bPlainTextTags))
  ------------------
  |  Branch (3923:17): [True: 0, False: 0]
  ------------------
 3924|      0|            {
 3925|      0|                return 7;
 3926|      0|            }
 3927|      0|            inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 3928|       |            /* detected transposition */
 3929|      0|            (*io->pSortPrintINChIFlags) |=
 3930|      0|                (*INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_TRANSPOS_BAS : FLAG_SORT_PRINT_TRANSPOS_REC;
  ------------------
  |  |  570|      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;
  ------------------
  |  |  660|      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;
  ------------------
  |  |  661|      0|#define FLAG_SORT_PRINT_TRANSPOS_REC 2   /* transposition in the reconnected InChI layer */
  ------------------
  |  Branch (3930:17): [True: 0, False: 0]
  ------------------
 3931|      0|        }
 3932|      0|        else
 3933|      0|        {
 3934|      0|            if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3934:17): [True: 0, False: 0]
  ------------------
 3935|      0|            {
 3936|      0|                inchi_ios_print_nodisplay(out_file, "/");
 3937|      0|            }
 3938|      0|        }
 3939|      0|    }
 3940|  5.02k|#endif
 3941|       |
 3942|  5.02k|    return 0;
 3943|  5.02k|}
ichiprt1.c:OutputINCHI_FixedHLayerWithSublayers:
 3956|  5.02k|{
 3957|       |
 3958|  5.02k|    *then_goto_repeat = 0;
 3959|       |
 3960|  5.02k|    if (io->bOutType == OUT_TN &&
  ------------------
  |  |  583|  10.0k|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (3960:9): [True: 5.02k, False: 0]
  ------------------
 3961|  5.02k|        !(io->bSecondNonTautPass) &&
  ------------------
  |  Branch (3961:9): [True: 5.02k, False: 0]
  ------------------
 3962|  5.02k|        io->bNonTautIsIdenticalToTaut &&
  ------------------
  |  Branch (3962:9): [True: 4.95k, False: 73]
  ------------------
 3963|  4.95k|        io->bTautomeric &&
  ------------------
  |  Branch (3963:9): [True: 1.16k, False: 3.79k]
  ------------------
 3964|  1.16k|        io->bNonTautomeric)
  ------------------
  |  Branch (3964:9): [True: 0, False: 1.16k]
  ------------------
 3965|      0|    {
 3966|       |        /* Fixed-H layer is empty in the Identifier */
 3967|      0|        (*io->pSortPrintINChIFlags) |=
 3968|      0|            (*INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS : FLAG_SORT_PRINT_NO_NFIX_H_REC;
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          (*INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS : FLAG_SORT_PRINT_NO_NFIX_H_REC;
  ------------------
  |  |  662|      0|#define FLAG_SORT_PRINT_NO_NFIX_H_BAS 4  /* no fixed H non-isotopic in the main InChI layer */
  ------------------
                          (*INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS : FLAG_SORT_PRINT_NO_NFIX_H_REC;
  ------------------
  |  |  663|      0|#define FLAG_SORT_PRINT_NO_NFIX_H_REC 8  /* no fixed H non-isotopic in the reconnected InChI layer */
  ------------------
  |  Branch (3968:13): [True: 0, False: 0]
  ------------------
 3969|      0|        (*io->pSortPrintINChIFlags) |=
 3970|      0|            (*INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_IFIX_H_BAS : FLAG_SORT_PRINT_NO_IFIX_H_REC;
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          (*INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_IFIX_H_BAS : FLAG_SORT_PRINT_NO_IFIX_H_REC;
  ------------------
  |  |  664|      0|#define FLAG_SORT_PRINT_NO_IFIX_H_BAS 16 /* no fixed H isotopic in the main InChI layer */
  ------------------
                          (*INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_IFIX_H_BAS : FLAG_SORT_PRINT_NO_IFIX_H_REC;
  ------------------
  |  |  665|      0|#define FLAG_SORT_PRINT_NO_IFIX_H_REC 32 /* no fixed H isotopic in the the reconnected InChI layer */
  ------------------
  |  Branch (3970:13): [True: 0, False: 0]
  ------------------
 3971|      0|    }
 3972|       |
 3973|  5.02k|    if (io->bOutType == OUT_TN &&
  ------------------
  |  |  583|  10.0k|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (3973:9): [True: 5.02k, False: 0]
  ------------------
 3974|  5.02k|        !io->bNonTautIsIdenticalToTaut && /* added 2004-10-04 Fix16 */
  ------------------
  |  Branch (3974:9): [True: 73, False: 4.95k]
  ------------------
 3975|       |#ifdef OLD_ITEM_DISCOVERY
 3976|       |        io->bTautomeric &&
 3977|       |        io->bNonTautomeric &&
 3978|       |#endif
 3979|     73|        INChI_SegmentAction(io->sDifSegs[DIFL_F][DIFS_f_FORMULA])
  ------------------
  |  Branch (3979:9): [True: 0, False: 73]
  ------------------
 3980|       |        /* special case: removed isolated H(+): */
 3981|       |        /* || io->iCurTautMode == TAUT_YES && num_comp[TAUT_YES] < num_comp[TAUT_NON] &&
 3982|       |            0 < num_comp[TAUT_NON]*/
 3983|  5.02k|    )
 3984|       |
 3985|      0|    {
 3986|       |        /* add the second (non-tautomeric) output */
 3987|      0|        io->bOutType = OUT_NONTAUT; /* pick up only non-tautomeric representation of tautomeric */
  ------------------
  |  |  920|      0|#define OUT_NONTAUT OUT_NN /* was OUT_NT until 2004-04-07 */
  |  |  ------------------
  |  |  |  |  585|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  ------------------
 3988|      0|        io->iCurTautMode = TAUT_NON;
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 3989|      0|        io->pINChISort = io->pINChISortTautAndNonTaut[TAUT_NON];
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 3990|      0|        io->bSecondNonTautPass = 1;
 3991|      0|        io->nCurINChISegment = DIFL_F;
 3992|      0|        io->num_components = io->num_comp[io->iCurTautMode]; /* number of components could change due to removal of isolated H(+) from tautomeric */
 3993|      0|        io->bFhTag = IL_FIXH;
 3994|      0|        szGetTag(IdentLbl, io->nTag, io->bTag1 = io->bFhTag, io->szTag1, &io->bAlways, 1);
 3995|       |        /***** constitution non-taut: dot-disconnected Hill formulas: <formula> -- only if different */
 3996|      0|        szGetTag(IdentLbl, io->nTag, io->bTag1 = IL_FMLF | io->bFhTag, io->szTag1, &io->bAlways, 1);
 3997|      0|        inchi_strbuf_reset(strbuf);
 3998|      0|        io->tot_len = 0;
 3999|      0|        io->nSegmAction = INChI_SegmentAction(io->sDifSegs[io->nCurINChISegment][DIFS_f_FORMULA]);
 4000|      0|        if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (4000:13): [True: 0, False: 0]
  ------------------
 4001|      0|        {
 4002|      0|            io->tot_len2 = str_HillFormula2(io->pINChISort, io->pINChISort2,
 4003|      0|                                            strbuf, &io->bOverflow, io->bOutType,
 4004|      0|                                            io->num_components, io->bUseMulipliers);
 4005|      0|            if (io->n_pzz > 0 && io->n_zy > 0)
  ------------------
  |  Branch (4005:17): [True: 0, False: 0]
  |  Branch (4005:34): [True: 0, False: 0]
  ------------------
 4006|      0|            {
 4007|      0|                MergeZzInHillFormula(strbuf);
 4008|      0|            }
 4009|      0|            io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 4010|      0|        }
 4011|      0|        else
 4012|      0|        {
 4013|      0|            io->tot_len2 = io->tot_len;
 4014|      0|        }
 4015|      0|        io->tot_len = io->tot_len2;
 4016|      0|        if (str_LineEnd(io->szTag1, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags))
  ------------------
  |  Branch (4016:13): [True: 0, False: 0]
  ------------------
 4017|      0|        {
 4018|      0|            return 1;
 4019|      0|        }
 4020|      0|        inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 4021|       |
 4022|      0|        io->nSegmAction = INChI_SegmentAction(io->sDifSegs[io->nCurINChISegment][DIFS_h_H_ATOMS]);
 4023|       |
 4024|      0|        if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (4024:13): [True: 0, False: 0]
  ------------------
 4025|      0|        {
 4026|      0|            szGetTag(IdentLbl, io->nTag, io->bTag1 = IL_HFIX | io->bFhTag, io->szTag1, &io->bAlways, 1);
 4027|      0|            inchi_strbuf_reset(strbuf);
 4028|      0|            io->tot_len = 0; /* open H-fixed */
 4029|       |            /* output the second non-tautomeric item: fixed H -- do not output in xml if empty */
 4030|      0|            io->tot_len2 = str_FixedH_atoms(io->pINChISort, strbuf,
 4031|      0|                                            &io->bOverflow, io->bOutType, io->ATOM_MODE,
 4032|      0|                                            io->num_components, io->bUseMulipliers);
 4033|      0|            io->tot_len = io->tot_len2;
 4034|      0|            if (str_LineEnd(io->szTag1, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags))
  ------------------
  |  Branch (4034:17): [True: 0, False: 0]
  ------------------
 4035|      0|            {
 4036|      0|                return 2;
 4037|      0|            }
 4038|      0|            inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 4039|      0|            io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 4040|      0|        }
 4041|      0|        *then_goto_repeat = 1;
 4042|      0|        return 0;
 4043|      0|    }
 4044|       |
 4045|  5.02k|    else
 4046|  5.02k|    {
 4047|  5.02k|        if (io->bOutType == OUT_NONTAUT && io->bOutputType == OUT_TN && io->bSecondNonTautPass /* && io->bTautomeric && io->bNonTautomeric*/)
  ------------------
  |  |  920|  5.02k|#define OUT_NONTAUT OUT_NN /* was OUT_NT until 2004-04-07 */
  |  |  ------------------
  |  |  |  |  585|  10.0k|#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*/)
  ------------------
  |  |  583|  5.02k|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (4047:13): [True: 0, False: 5.02k]
  |  Branch (4047:44): [True: 0, False: 0]
  |  Branch (4047:73): [True: 0, False: 0]
  ------------------
 4048|      0|        {
 4049|       |            /* the second (non-taut) output has been done; restore variables */
 4050|      0|            io->bOutType = OUT_TN;
  ------------------
  |  |  583|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
 4051|      0|            io->iCurTautMode = TAUT_YES;
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4052|      0|            io->pINChISort = io->pINChISortTautAndNonTaut[TAUT_YES];
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4053|      0|            io->bSecondNonTautPass = 0;
 4054|      0|            io->num_components = io->num_comp[io->iCurTautMode];
 4055|      0|            if (!io->bNonTautNonIsoIdentifierNotEmpty)
  ------------------
  |  Branch (4055:17): [True: 0, False: 0]
  ------------------
 4056|      0|            {
 4057|       |                /* Fixed-H layer is empty in the Identifier */
 4058|      0|                (*io->pSortPrintINChIFlags) |= (*INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS : FLAG_SORT_PRINT_NO_NFIX_H_REC;
  ------------------
  |  |  570|      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 : FLAG_SORT_PRINT_NO_NFIX_H_REC;
  ------------------
  |  |  662|      0|#define FLAG_SORT_PRINT_NO_NFIX_H_BAS 4  /* no fixed H non-isotopic in the main InChI layer */
  ------------------
                              (*io->pSortPrintINChIFlags) |= (*INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS : FLAG_SORT_PRINT_NO_NFIX_H_REC;
  ------------------
  |  |  663|      0|#define FLAG_SORT_PRINT_NO_NFIX_H_REC 8  /* no fixed H non-isotopic in the reconnected InChI layer */
  ------------------
  |  Branch (4058:48): [True: 0, False: 0]
  ------------------
 4059|      0|            }
 4060|      0|            if (!io->bNonTautIsoIdentifierNotEmpty)
  ------------------
  |  Branch (4060:17): [True: 0, False: 0]
  ------------------
 4061|      0|            {
 4062|       |                /* Fixed-H layer is empty in the Identifier */
 4063|      0|                (*io->pSortPrintINChIFlags) |= (*INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_IFIX_H_BAS : FLAG_SORT_PRINT_NO_IFIX_H_REC;
  ------------------
  |  |  570|      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 : FLAG_SORT_PRINT_NO_IFIX_H_REC;
  ------------------
  |  |  664|      0|#define FLAG_SORT_PRINT_NO_IFIX_H_BAS 16 /* no fixed H isotopic in the main InChI layer */
  ------------------
                              (*io->pSortPrintINChIFlags) |= (*INCHI_basic_or_INCHI_reconnected == INCHI_BAS) ? FLAG_SORT_PRINT_NO_IFIX_H_BAS : FLAG_SORT_PRINT_NO_IFIX_H_REC;
  ------------------
  |  |  665|      0|#define FLAG_SORT_PRINT_NO_IFIX_H_REC 32 /* no fixed H isotopic in the the reconnected InChI layer */
  ------------------
  |  Branch (4063:48): [True: 0, False: 0]
  ------------------
 4064|      0|            }
 4065|      0|            io->bFhTag = 0;
 4066|      0|        }
 4067|  5.02k|    }
 4068|       |
 4069|  5.02k|    return 0;
 4070|  5.02k|}
ichiprt1.c:OutputINCHI_PolymerLayer:
 4084|  5.02k|{
 4085|  5.02k|    int i, err = 0;
 4086|  5.02k|    int nunits2 = 0;
 4087|  5.02k|    int n_used_stars = 0;
 4088|  5.02k|    int *cano_nums = NULL, *compnt_nums = NULL, *unum = NULL, *old_stars = NULL;
 4089|  5.02k|    OAD_PolymerUnit *u = NULL;
 4090|  5.02k|    OAD_PolymerUnit **units2 = NULL;
 4091|  5.02k|    OAD_Polymer *p = NULL;
 4092|  5.02k|    OAD_AtProps *aprops = NULL;
 4093|  5.02k|    int nat, num_inp_bonds;
 4094|  5.02k|    inp_ATOM *at = NULL;
 4095|  5.02k|    int is_inchi2inchi = 0;
 4096|       |
 4097|  5.02k|    if (!orig_inp_data)
  ------------------
  |  Branch (4097:9): [True: 5.02k, False: 0]
  ------------------
 4098|  5.02k|    {
 4099|  5.02k|        goto exit_function;
 4100|  5.02k|    }
 4101|       |
 4102|      0|    at = orig_inp_data->at;
 4103|      0|    nat = orig_inp_data->num_inp_atoms;
 4104|      0|    num_inp_bonds = orig_inp_data->num_inp_bonds;
 4105|       |
 4106|       |
 4107|      0|    if (pOrigStruct && !pOrigStruct->polymer)
  ------------------
  |  Branch (4107:9): [True: 0, False: 0]
  |  Branch (4107:24): [True: 0, False: 0]
  ------------------
 4108|      0|    {
 4109|      0|        return 0;
 4110|      0|    }
 4111|       |
 4112|      0|    if (pOrigStruct)
  ------------------
  |  Branch (4112:9): [True: 0, False: 0]
  ------------------
 4113|      0|    {
 4114|      0|        p = pOrigStruct->polymer;
 4115|      0|        is_inchi2inchi = !pOrigStruct->szAtoms && !pOrigStruct->szBonds && !pOrigStruct->szCoord;
  ------------------
  |  Branch (4115:26): [True: 0, False: 0]
  |  Branch (4115:51): [True: 0, False: 0]
  |  Branch (4115:76): [True: 0, False: 0]
  ------------------
 4116|       |
 4117|      0|        if (is_inchi2inchi)
  ------------------
  |  Branch (4117:13): [True: 0, False: 0]
  ------------------
 4118|      0|        {
 4119|      0|            err = NOT_YET_I2I_FOR_POLYMERS;
  ------------------
  |  |  470|      0|#define NOT_YET_I2I_FOR_POLYMERS 40
  ------------------
 4120|      0|            goto exit_function;
 4121|      0|        }
 4122|       |
 4123|       |        /*OAD_Polymer_DebugTrace( p );*/
 4124|       |
 4125|       |        /* Get canonical numbers and numbers-of-components for each original atom */
 4126|      0|        cano_nums = (int *)inchi_calloc((long long)pOrigStruct->num_atoms + 1, sizeof(int)); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 4127|      0|        if (!cano_nums)
  ------------------
  |  Branch (4127:13): [True: 0, False: 0]
  ------------------
 4128|      0|        {
 4129|      0|            err = 1;
 4130|      0|            goto exit_function;
 4131|      0|        }
 4132|      0|        compnt_nums = (int *)inchi_calloc((long long)pOrigStruct->num_atoms + 1, sizeof(int)); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 4133|      0|        if (!compnt_nums)
  ------------------
  |  Branch (4133:13): [True: 0, False: 0]
  ------------------
 4134|      0|        {
 4135|      0|            err = 2;
 4136|      0|            goto exit_function;
 4137|      0|        }
 4138|      0|        err = InternallyGetCanoNumsAndComponentNums(pCG,
 4139|      0|                                                    strbuf,
 4140|      0|                                                    io,
 4141|      0|                                                    pOrigStruct->num_atoms,
 4142|      0|                                                    cano_nums,
 4143|      0|                                                    compnt_nums);
 4144|      0|        if (err != 0)
  ------------------
  |  Branch (4144:13): [True: 0, False: 0]
  ------------------
 4145|      0|        {
 4146|      0|            err = 3;
 4147|      0|            goto exit_function;
 4148|      0|        }
 4149|       |
 4150|       |        /* Set atom properties for sorting */
 4151|      0|        aprops = (OAD_AtProps *)inchi_calloc((long long)nat + 1, sizeof(OAD_AtProps)); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 4152|       |        /* nat + 1: add extra element for possibe 1-based indexing */
 4153|      0|        if (!aprops)
  ------------------
  |  Branch (4153:13): [True: 0, False: 0]
  ------------------
 4154|      0|        {
 4155|       |            /* djb-rwth: avoiding memory leak */
 4156|      0|            if (cano_nums)
  ------------------
  |  Branch (4156:17): [True: 0, False: 0]
  ------------------
 4157|      0|            {
 4158|      0|                inchi_free(cano_nums);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4159|      0|            }
 4160|      0|            if (compnt_nums)
  ------------------
  |  Branch (4160:17): [True: 0, False: 0]
  ------------------
 4161|      0|            {
 4162|      0|                inchi_free(compnt_nums);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4163|      0|            }
 4164|      0|            if (aprops)
  ------------------
  |  Branch (4164:17): [True: 0, False: 0]
  ------------------
 4165|      0|            {
 4166|      0|                inchi_free(aprops);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4167|      0|            }
 4168|      0|            return 0;
 4169|      0|        }
 4170|       |
 4171|       |        /* Note that aprops[] is in orig_atoms domain (0-based) and      */
 4172|       |        /* u (from units) are in cano_nums domain (1-based)              */
 4173|       |        /* Supply non-NULL cano_nums to adjust the domains (base will be adjusted at place) */
 4174|      0|        OAD_Polymer_SetAtProps(p, at, nat, &num_inp_bonds, aprops, cano_nums);
 4175|       |
 4176|       |        /* Make a working copy of polymer units data: units2 is a copy        */
 4177|       |        /* of original polymer units (p->units) with atomic numbers changed    */
 4178|       |        /* to curr canonical ones; atoms in alists sorted; atoms in blists    */
 4179|       |        /* and blists themselves sorted                                     */
 4180|      0|        units2 = (OAD_PolymerUnit **)inchi_calloc(p->n, sizeof(OAD_PolymerUnit *));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 4181|       |
 4182|      0|        if (NULL == units2)
  ------------------
  |  Branch (4182:13): [True: 0, False: 0]
  ------------------
 4183|      0|        {
 4184|      0|            err = 3;
 4185|      0|            goto exit_function;
 4186|      0|        }
 4187|      0|        memset(units2, 0, sizeof(*units2)); /* djb-rwth: memset_s C11/Annex K variant? */
 4188|       |
 4189|      0|        old_stars = (int *)inchi_calloc(pOrigStruct->polymer->n_pzz, sizeof(int));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 4190|      0|        if (NULL == old_stars)
  ------------------
  |  Branch (4190:13): [True: 0, False: 0]
  ------------------
 4191|      0|        {
 4192|      0|            err = 3;
 4193|      0|            goto exit_function;
 4194|      0|        }
 4195|      0|        for (i = 0; i < pOrigStruct->polymer->n_pzz; i++)
  ------------------
  |  Branch (4195:21): [True: 0, False: 0]
  ------------------
 4196|      0|        {
 4197|      0|            old_stars[i] = pOrigStruct->polymer->pzz[i];
 4198|      0|        }
 4199|       |
 4200|      0|        for (i = 0; i < p->n; i++)
  ------------------
  |  Branch (4200:21): [True: 0, False: 0]
  ------------------
 4201|      0|        {
 4202|      0|            units2[i] = OAD_PolymerUnit_CreateCopy(p->units[i]);
 4203|      0|            if (NULL == units2[i]) /* djb-rwth: unresolved issue -- revision required? -- units2 properly allocated, and loop index well defined */
  ------------------
  |  Branch (4203:17): [True: 0, False: 0]
  ------------------
 4204|      0|            {
 4205|      0|                err = 4;
 4206|      0|                goto exit_function;
 4207|      0|            }
 4208|      0|            nunits2 = i + 1;
 4209|      0|        }
 4210|       |
 4211|       |        /* unum contains numbers of units (0..p->n) as they go  */
 4212|       |        /* when sorted by alist's in lexicographic order        */
 4213|      0|        unum = (int *)inchi_calloc(p->n, sizeof(int));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 4214|      0|        if (NULL == unum)
  ------------------
  |  Branch (4214:13): [True: 0, False: 0]
  ------------------
 4215|      0|        {
 4216|      0|            err = 4;
 4217|      0|            goto exit_function;
 4218|      0|        }
 4219|       |
 4220|      0|        err = OAD_Polymer_PrepareWorkingSet(p, cano_nums, compnt_nums, units2, unum);
 4221|       |
 4222|      0|        if (err != 0)
  ------------------
  |  Branch (4222:13): [True: 0, False: 0]
  ------------------
 4223|      0|        {
 4224|      0|            err = 5;
 4225|      0|            goto exit_function;
 4226|      0|        }
 4227|       |
 4228|       |        /* Prepare polymer substring */
 4229|       |
 4230|       |        /* Mark layer beginning */
 4231|      0|        inchi_strbuf_printf(strbuf, "%s", "/z");
 4232|       |
 4233|       |        /* Print polymer units data */
 4234|      0|        n_used_stars = 0;
 4235|      0|        for (i = 0; i < p->n; i++)
  ------------------
  |  Branch (4235:21): [True: 0, False: 0]
  ------------------
 4236|      0|        {
 4237|       |            /* For each unit u ... */
 4238|      0|            u = units2[unum[i]];
 4239|       |            /* djb-rwth: addressing coverity ID #499574 -- all NULL checks already done above */
 4240|      0|            err = OutputINCHI_PolymerLayer_SingleUnit(u,
 4241|      0|                                                      io->bPolymers,
 4242|      0|                                                      pOrigStruct->polymer->n_pzz,
 4243|      0|                                                      &n_used_stars, aprops,
 4244|      0|                                                      cano_nums,
 4245|      0|                                                      orig_inp_data,
 4246|      0|                                                      pOrigStruct, strbuf);
 4247|      0|            if (err)
  ------------------
  |  Branch (4247:17): [True: 0, False: 0]
  ------------------
 4248|      0|            {
 4249|      0|                goto exit_function;
 4250|      0|            }
 4251|      0|            if (i < p->n - 1)
  ------------------
  |  Branch (4251:17): [True: 0, False: 0]
  ------------------
 4252|      0|            {
 4253|      0|                inchi_strbuf_printf(strbuf, ";");
 4254|      0|            }
 4255|      0|        }
 4256|      0|        inchi_ios_print_nodisplay(out_file, "%s%s", strbuf->pStr, pLF);
 4257|       |
 4258|      0|        LOG_NO_ARGS("\n******************* (L4184:ichiprt1.c) ********************\n");
 4259|      0|        LOG_MULT_ARGS("Polymer Layer start: %s\n", strbuf->pStr);
 4260|      0|        LOG_NO_ARGS("\n***********************************************************\n");
 4261|       |
 4262|  5.02k|    exit_function:
 4263|  5.02k|        if (cano_nums)
  ------------------
  |  Branch (4263:13): [True: 0, False: 5.02k]
  ------------------
 4264|      0|        {
 4265|      0|            inchi_free(cano_nums);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4266|      0|        }
 4267|  5.02k|        if (compnt_nums)
  ------------------
  |  Branch (4267:13): [True: 0, False: 5.02k]
  ------------------
 4268|      0|        {
 4269|      0|            inchi_free(compnt_nums);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4270|      0|        }
 4271|  5.02k|        if (aprops)
  ------------------
  |  Branch (4271:13): [True: 0, False: 5.02k]
  ------------------
 4272|      0|        {
 4273|      0|            inchi_free(aprops);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4274|      0|        }
 4275|  5.02k|        if (unum)
  ------------------
  |  Branch (4275:13): [True: 0, False: 5.02k]
  ------------------
 4276|      0|        {
 4277|      0|            inchi_free(unum);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4278|      0|        }
 4279|  5.02k|        if (units2)
  ------------------
  |  Branch (4279:13): [True: 0, False: 5.02k]
  ------------------
 4280|      0|        {
 4281|      0|            for (i = 0; i < nunits2; i++)
  ------------------
  |  Branch (4281:25): [True: 0, False: 0]
  ------------------
 4282|      0|            {
 4283|      0|                OAD_PolymerUnit_Free(units2[i]);
 4284|      0|            }
 4285|      0|            inchi_free(units2);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4286|      0|        }
 4287|  5.02k|        if (old_stars)
  ------------------
  |  Branch (4287:13): [True: 0, False: 5.02k]
  ------------------
 4288|      0|        {
 4289|      0|            for (i = 0; i < pOrigStruct->polymer->n_pzz; i++)
  ------------------
  |  Branch (4289:25): [True: 0, False: 0]
  ------------------
 4290|      0|                pOrigStruct->polymer->pzz[i] = old_stars[i];
 4291|      0|            inchi_free(old_stars);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4292|      0|        }
 4293|  5.02k|    }
 4294|  5.02k|    return err;
 4295|      0|}

Eql_INChI_Stereo:
   24|    370|{
   25|    370|    int inv1 = 0, inv2 = 0, len;
   26|       |
   27|    370|    if (!s1)
  ------------------
  |  Branch (27:9): [True: 0, False: 370]
  ------------------
   28|      0|    {
   29|      0|        return 0;
   30|      0|    }
   31|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
   32|       |#else
   33|    370|    bRelRac = 0;
   34|    370|#endif
   35|       |
   36|    370|    if (EQL_SP2 == eql1)
  ------------------
  |  |  477|    370|#define EQL_SP2 8
  ------------------
  |  Branch (36:9): [True: 121, False: 249]
  ------------------
   37|    121|    {
   38|    121|        if (( len = s1->nNumberOfStereoBonds ) > 0 && s1->b_parity && s1->nBondAtom1 && s1->nBondAtom2)
  ------------------
  |  Branch (38:13): [True: 121, False: 0]
  |  Branch (38:55): [True: 121, False: 0]
  |  Branch (38:71): [True: 121, False: 0]
  |  Branch (38:89): [True: 121, False: 0]
  ------------------
   39|    121|        {
   40|    121|            if (!s2)
  ------------------
  |  Branch (40:17): [True: 38, False: 83]
  ------------------
   41|     38|            {
   42|     38|                if (EQL_EXISTS == eql2)
  ------------------
  |  |  474|     38|#define EQL_EXISTS 1
  ------------------
  |  Branch (42:21): [True: 0, False: 38]
  ------------------
   43|      0|                {
   44|       |                    /* find whether double bond stereo exists*/
   45|      0|                    return 1;
   46|      0|                }
   47|     38|                return 0;
   48|     38|            }
   49|     83|            if (EQL_SP2 == eql2 &&
  ------------------
  |  |  477|     83|#define EQL_SP2 8
  ------------------
  |  Branch (49:17): [True: 83, False: 0]
  ------------------
   50|     83|                 len == s2->nNumberOfStereoBonds && s2->b_parity && s2->nBondAtom1 && s2->nBondAtom2 &&
  ------------------
  |  Branch (50:18): [True: 81, False: 2]
  |  Branch (50:53): [True: 81, False: 0]
  |  Branch (50:69): [True: 81, False: 0]
  |  Branch (50:87): [True: 81, False: 0]
  ------------------
   51|     81|                 !memcmp( s1->nBondAtom1, s2->nBondAtom1, len * sizeof( s1->nBondAtom1[0] ) ) &&
  ------------------
  |  Branch (51:18): [True: 78, False: 3]
  ------------------
   52|     78|                 !memcmp( s1->nBondAtom2, s2->nBondAtom2, len * sizeof( s1->nBondAtom2[0] ) ) &&
  ------------------
  |  Branch (52:18): [True: 78, False: 0]
  ------------------
   53|     78|                 !memcmp( s1->b_parity, s2->b_parity, len * sizeof( s1->b_parity[0] ) ))
  ------------------
  |  Branch (53:18): [True: 78, False: 0]
  ------------------
   54|     78|            {
   55|     78|                return 1;
   56|     78|            }
   57|     83|        }
   58|      5|        return 0;
   59|    121|    }
   60|       |
   61|    249|    else
   62|    249|    {
   63|    249|        if (( eql1 == EQL_SP3 || ( inv1 = ( eql1 == EQL_SP3_INV ) ) ) &&
  ------------------
  |  |  475|    498|#define EQL_SP3 2
  ------------------
                      if (( eql1 == EQL_SP3 || ( inv1 = ( eql1 == EQL_SP3_INV ) ) ) &&
  ------------------
  |  |  476|      0|#define EQL_SP3_INV 4
  ------------------
  |  Branch (63:15): [True: 249, False: 0]
  |  Branch (63:34): [True: 0, False: 0]
  ------------------
   64|    249|            ( len = s1->nNumberOfStereoCenters ) > ( bRelRac ? 1 : 0 )) /* djb-rwth: addressing coverity ID #499484 -- bRelRac does not have to be 0 */
  ------------------
  |  Branch (64:13): [True: 234, False: 15]
  |  Branch (64:54): [True: 0, False: 249]
  ------------------
   65|    234|        {
   66|       |
   67|    234|            S_CHAR  *t_parity1, *t_parity2;
   68|    234|            AT_NUMB *nNumber1, *nNumber2;
   69|    234|            if (inv1)
  ------------------
  |  Branch (69:17): [True: 0, False: 234]
  ------------------
   70|      0|            {
   71|      0|                if (s1->nCompInv2Abs)
  ------------------
  |  Branch (71:21): [True: 0, False: 0]
  ------------------
   72|      0|                {
   73|      0|                    t_parity1 = s1->t_parityInv;
   74|      0|                    nNumber1 = s1->nNumberInv;
   75|      0|                }
   76|      0|                else
   77|      0|                {
   78|      0|                    return 0;
   79|      0|                }
   80|      0|            }
   81|    234|            else
   82|    234|            {
   83|    234|                t_parity1 = s1->t_parity;
   84|    234|                nNumber1 = s1->nNumber;
   85|    234|            }
   86|    234|            if (t_parity1 && nNumber1)
  ------------------
  |  Branch (86:17): [True: 234, False: 0]
  |  Branch (86:30): [True: 234, False: 0]
  ------------------
   87|    234|            {
   88|    234|                if (!s2)
  ------------------
  |  Branch (88:21): [True: 53, False: 181]
  ------------------
   89|     53|                {
   90|     53|                    if (EQL_EXISTS == eql2 && ( !inv1 || s1->nCompInv2Abs ))
  ------------------
  |  |  474|     53|#define EQL_EXISTS 1
  ------------------
  |  Branch (90:25): [True: 0, False: 53]
  |  Branch (90:49): [True: 0, False: 0]
  |  Branch (90:58): [True: 0, False: 0]
  ------------------
   91|      0|                    {
   92|       |                        /* the 1st sp3 (inverted if requested) stereo exists*/
   93|      0|                        return 1;
   94|      0|                    }
   95|     53|                    return 0;  /* both sp3 do not exist */
   96|     53|                }
   97|    181|                if (( eql2 == EQL_SP3 || ( inv2 = ( eql2 == EQL_SP3_INV ) ) ) &&
  ------------------
  |  |  475|    362|#define EQL_SP3 2
  ------------------
                              if (( eql2 == EQL_SP3 || ( inv2 = ( eql2 == EQL_SP3_INV ) ) ) &&
  ------------------
  |  |  476|      0|#define EQL_SP3_INV 4
  ------------------
  |  Branch (97:23): [True: 181, False: 0]
  |  Branch (97:42): [True: 0, False: 0]
  ------------------
   98|    181|                    len == s2->nNumberOfStereoCenters)
  ------------------
  |  Branch (98:21): [True: 146, False: 35]
  ------------------
   99|    146|                {
  100|    146|                    if (inv2)
  ------------------
  |  Branch (100:25): [True: 0, False: 146]
  ------------------
  101|      0|                    {
  102|      0|                        if (s2->nCompInv2Abs && s1->nCompInv2Abs)
  ------------------
  |  Branch (102:29): [True: 0, False: 0]
  |  Branch (102:49): [True: 0, False: 0]
  ------------------
  103|      0|                        {
  104|      0|                            t_parity2 = s2->t_parityInv;
  105|      0|                            nNumber2 = s2->nNumberInv;
  106|      0|                        }
  107|      0|                        else
  108|      0|                        {
  109|       |                            /* if one sp3 is inverted then another should have non-trivial inverted stereo */
  110|      0|                            return 0;
  111|      0|                        }
  112|      0|                    }
  113|    146|                    else
  114|    146|                    {
  115|    146|                        if (inv1 && !s2->nCompInv2Abs)
  ------------------
  |  Branch (115:29): [True: 0, False: 146]
  |  Branch (115:37): [True: 0, False: 0]
  ------------------
  116|      0|                        {
  117|       |                            /* if one sp3 is inverted then another should have non-trivial inverted stereo */
  118|      0|                            return 0;
  119|      0|                        }
  120|    146|                        t_parity2 = s2->t_parity;
  121|    146|                        nNumber2 = s2->nNumber;
  122|    146|                    }
  123|    146|                    if (t_parity2 && nNumber2)
  ------------------
  |  Branch (123:25): [True: 146, False: 0]
  |  Branch (123:38): [True: 146, False: 0]
  ------------------
  124|    146|                    {
  125|    146|                        if (inv1 ^ inv2)
  ------------------
  |  Branch (125:29): [True: 0, False: 146]
  ------------------
  126|      0|                        {
  127|      0|                            int i, num_inv;
  128|      0|                            for (i = 0, num_inv = 0; i < len; i++)
  ------------------
  |  Branch (128:54): [True: 0, False: 0]
  ------------------
  129|      0|                            {
  130|      0|                                if (nNumber1[i] != nNumber2[i])
  ------------------
  |  Branch (130:37): [True: 0, False: 0]
  ------------------
  131|      0|                                    break;
  132|      0|                                if (ATOM_PARITY_WELL_DEF( t_parity1[i] ) &&
  ------------------
  |  |  259|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      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)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 0, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  133|      0|                                     ATOM_PARITY_WELL_DEF( t_parity2[i] ))
  ------------------
  |  |  259|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      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)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 0, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  134|      0|                                {
  135|      0|                                    if (3 == t_parity1[i] + t_parity2[i])
  ------------------
  |  Branch (135:41): [True: 0, False: 0]
  ------------------
  136|      0|                                    {
  137|      0|                                        num_inv++;
  138|      0|                                    }
  139|      0|                                    else
  140|      0|                                    {
  141|      0|                                        break;
  142|      0|                                    }
  143|      0|                                }
  144|      0|                                else
  145|      0|                                    if (t_parity1[i] != t_parity2[i])
  ------------------
  |  Branch (145:41): [True: 0, False: 0]
  ------------------
  146|      0|                                    {
  147|      0|                                        break;
  148|      0|                                    }
  149|      0|                            }
  150|      0|                            return ( len == i && num_inv > 0 );
  ------------------
  |  Branch (150:38): [True: 0, False: 0]
  |  Branch (150:50): [True: 0, False: 0]
  ------------------
  151|      0|                        }
  152|    146|                        else
  153|    146|                        {
  154|    146|                            return !memcmp( t_parity1, t_parity2, len * sizeof( t_parity1[0] ) ) &&
  ------------------
  |  Branch (154:36): [True: 112, False: 34]
  ------------------
  155|    112|                                !memcmp( nNumber1, nNumber2, len * sizeof( nNumber1[0] ) );
  ------------------
  |  Branch (155:33): [True: 91, False: 21]
  ------------------
  156|    146|                        }
  157|    146|                    }
  158|    146|                }
  159|    181|            }
  160|    234|        }
  161|    249|    }
  162|       |
  163|     50|    return 0;
  164|    370|}
Eql_INChI_Isotopic:
  169|    628|{
  170|    628|    int eq = i1
  ------------------
  |  Branch (170:14): [True: 177, False: 451]
  ------------------
  171|    177|            && i2
  ------------------
  |  Branch (171:16): [True: 177, False: 0]
  ------------------
  172|    177|            && !i1->bDeleted
  ------------------
  |  Branch (172:16): [True: 177, False: 0]
  ------------------
  173|    177|            && !i2->bDeleted
  ------------------
  |  Branch (173:16): [True: 177, False: 0]
  ------------------
  174|    177|            && ( i1->nNumberOfIsotopicAtoms > 0 || i1->nNumberOfIsotopicTGroups > 0 )
  ------------------
  |  Branch (174:18): [True: 177, False: 0]
  |  Branch (174:52): [True: 0, False: 0]
  ------------------
  175|    177|            && i1->nNumberOfIsotopicAtoms == i2->nNumberOfIsotopicAtoms
  ------------------
  |  Branch (175:16): [True: 177, False: 0]
  ------------------
  176|    177|            && i1->nNumberOfIsotopicTGroups == i2->nNumberOfIsotopicTGroups
  ------------------
  |  Branch (176:16): [True: 177, False: 0]
  ------------------
  177|    177|            && ( !i1->nNumberOfIsotopicAtoms ||
  ------------------
  |  Branch (177:18): [True: 0, False: 177]
  ------------------
  178|    177|                (i1->IsotopicAtom && i2->IsotopicAtom &&
  ------------------
  |  Branch (178:18): [True: 177, False: 0]
  |  Branch (178:38): [True: 177, False: 0]
  ------------------
  179|    177|                !memcmp( i1->IsotopicAtom, i2->IsotopicAtom,
  ------------------
  |  Branch (179:17): [True: 175, False: 2]
  ------------------
  180|    177|                        i1->nNumberOfIsotopicAtoms * sizeof( i1->IsotopicAtom[0] ) )) )
  181|    175|            && ( !i1->nNumberOfIsotopicTGroups ||
  ------------------
  |  Branch (181:18): [True: 175, False: 0]
  ------------------
  182|      0|                (i1->IsotopicTGroup && i2->IsotopicTGroup &&
  ------------------
  |  Branch (182:18): [True: 0, False: 0]
  |  Branch (182:40): [True: 0, False: 0]
  ------------------
  183|      0|                !memcmp( i1->IsotopicTGroup, i2->IsotopicTGroup,
  ------------------
  |  Branch (183:17): [True: 0, False: 0]
  ------------------
  184|      0|                    i1->nNumberOfIsotopicTGroups * sizeof( i1->IsotopicAtom[0] )) )
  185|    175|            ); /* djb-rwth: addressing LLVM warnings */
  186|       |
  187|    628|    return eq;
  188|    628|}
MakeMult:
  401|  13.3k|{
  402|  13.3k|    char szValue[2048];
  403|  13.3k|    int  len = 0, len_delim, n;
  404|       |
  405|  13.3k|    if (mult == 1 || *bOverflow)
  ------------------
  |  Branch (405:9): [True: 10.6k, False: 2.74k]
  |  Branch (405:22): [True: 0, False: 2.74k]
  ------------------
  406|  10.6k|    {
  407|  10.6k|        return 0;
  408|  10.6k|    }
  409|  2.74k|    if (nCtMode & CT_MODE_ABC_NUMBERS)
  ------------------
  |  |   26|  2.74k|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (409:9): [True: 0, False: 2.74k]
  ------------------
  410|      0|    {
  411|      0|        len += MakeAbcNumber( szValue, ( int )sizeof( szValue ), NULL, mult );
  412|      0|    }
  413|  2.74k|    else
  414|  2.74k|    {
  415|  2.74k|        len += MakeDecNumber( szValue, ( int )sizeof( szValue ), NULL, mult );
  416|  2.74k|    }
  417|  2.74k|    len_delim = (int) strlen( szTailingDelim );
  418|       |
  419|  2.74k|    if (len + len_delim < ( int )sizeof( szValue ))
  ------------------
  |  Branch (419:9): [True: 2.74k, False: 0]
  ------------------
  420|  2.74k|    {
  421|  2.74k|        strcpy(szValue + len, szTailingDelim);
  422|  2.74k|        n = inchi_strbuf_printf( buf, "%s", szValue );
  423|  2.74k|        if (-1 == n) *bOverflow |= 1;
  ------------------
  |  Branch (423:13): [True: 0, False: 2.74k]
  ------------------
  424|  2.74k|        return n;
  425|       |        /*
  426|       |        len += len_delim;
  427|       |        if ( len < nLen_szLinearCT )
  428|       |        {
  429|       |            strcpy( szLinearCT, szValue );
  430|       |            return len;
  431|       |        }*/
  432|  2.74k|    }
  433|       |
  434|      0|    *bOverflow |= 1;
  435|       |
  436|      0|    return 0;
  437|  2.74k|}
MakeDelim:
  500|  98.5k|{
  501|  98.5k|    int n;
  502|  98.5k|    if (!szTailingDelim || !*szTailingDelim || *bOverflow)
  ------------------
  |  Branch (502:9): [True: 0, False: 98.5k]
  |  Branch (502:28): [True: 0, False: 98.5k]
  |  Branch (502:48): [True: 0, False: 98.5k]
  ------------------
  503|      0|    {
  504|      0|        return 0;
  505|      0|    }
  506|       |
  507|  98.5k|    n = inchi_strbuf_printf( buf, szTailingDelim );
  508|  98.5k|    if (-1 == n)
  ------------------
  |  Branch (508:9): [True: 0, False: 98.5k]
  ------------------
  509|      0|    {
  510|      0|        *bOverflow |= 1;
  511|      0|    }
  512|       |
  513|  98.5k|    return n;
  514|       |    /*
  515|       |    len_delim = (int) strlen(szTailingDelim);
  516|       |    if ( len_delim < nLen_szLinearCT ) {
  517|       |    strcpy( szLinearCT, szTailingDelim );
  518|       |    return len_delim;
  519|       |    }
  520|       |    *bOverflow |= 1;
  521|       |    return 0;
  522|       |    */
  523|  98.5k|}
MakeEqStr:
  531|      3|{
  532|      3|    int  n = 0, n0;
  533|      3|    char szValue[2048];
  534|       |
  535|      3|    if (!szTailingDelim || !*szTailingDelim || *bOverflow)
  ------------------
  |  Branch (535:9): [True: 0, False: 3]
  |  Branch (535:28): [True: 0, False: 3]
  |  Branch (535:48): [True: 0, False: 3]
  ------------------
  536|      0|    {
  537|      0|        return 0;
  538|      0|    }
  539|       |
  540|      3|    n0 = buf->nUsedLength;
  541|       |
  542|      3|    if (mult != 1)
  ------------------
  |  Branch (542:9): [True: 0, False: 3]
  ------------------
  543|      0|    {
  544|      0|        n = MakeDecNumber( szValue, ( int )sizeof( szValue ), NULL, mult );
  545|      0|        if (-1 == n)
  ------------------
  |  Branch (545:13): [True: 0, False: 0]
  ------------------
  546|      0|        {
  547|      0|            *bOverflow |= 1;
  548|      0|            return -1;
  549|      0|        }
  550|      0|    }
  551|      3|    if (n > 0)
  ------------------
  |  Branch (551:9): [True: 0, False: 3]
  ------------------
  552|      0|    {
  553|      0|        n = inchi_strbuf_printf( buf, "%-s", szValue );
  554|      0|        if (-1 == n) *bOverflow |= 1;
  ------------------
  |  Branch (554:13): [True: 0, False: 0]
  ------------------
  555|      0|    }
  556|      3|    n = inchi_strbuf_printf( buf, "%-s", szTailingDelim );
  557|      3|    if (-1 == n)
  ------------------
  |  Branch (557:9): [True: 0, False: 3]
  ------------------
  558|      0|    {
  559|      0|        *bOverflow |= 1;
  560|      0|    }
  561|       |
  562|      3|    return ( buf->nUsedLength - n0 );
  563|      3|}
MakeCtStringNew:
  581|  4.30k|{
  582|       |    /*  produce output string; */
  583|  4.30k|    int nUsedLength0 = 0, nLen = 0, len, i, bOvfl = *bOverflow;
  584|  4.30k|    char szValue[2048];
  585|  4.30k|    int   nValue, nDelim, num_H;
  586|  4.30k|    AT_NUMB *nDfsOrderCT = NULL;
  587|  4.30k|    int      bNoNum_H = ( NULL == nNum_H );
  588|  4.30k|    int      nNumRingClosures;
  589|  4.30k|    int      bAbcNumbers = ( 0 != ( nCtMode & CT_MODE_ABC_NUMBERS ) );
  ------------------
  |  |   26|  4.30k|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  590|  4.30k|    int      bPredecessors = ( 0 != ( nCtMode & CT_MODE_PREDECESSORS ) );
  ------------------
  |  |   28|  4.30k|#define CT_MODE_PREDECESSORS      8
  ------------------
  591|  4.30k|    int      bCountRingClosures = bAbcNumbers && bPredecessors && ( nCtMode & CT_MODE_ABC_NUM_CLOSURES );
  ------------------
  |  |   30|      0|#define CT_MODE_ABC_NUM_CLOSURES 32 /* in CT_MODE_ABC_NUMBERS output AB1AC2AB instead of AB-AC-A-B */
  ------------------
  |  Branch (591:35): [True: 0, False: 4.30k]
  |  Branch (591:50): [True: 0, False: 0]
  |  Branch (591:67): [True: 0, False: 0]
  ------------------
  592|       |
  593|  4.30k|    if (nLenCT <= 1)
  ------------------
  |  Branch (593:9): [True: 0, False: 4.30k]
  ------------------
  594|      0|    {
  595|      0|        return 0;  /*  no atoms or a single atom: no connection table */
  596|      0|    }
  597|       |
  598|  4.30k|    nUsedLength0 = strbuf->nUsedLength;
  599|       |
  600|       |    /*  make array containing connection string data */
  601|  4.30k|    if (!( nDfsOrderCT = GetDfsOrder4CT( pCG, LinearCT, nLenCT,
  ------------------
  |  Branch (601:9): [True: 0, False: 4.30k]
  ------------------
  602|  4.30k|        nNum_H, num_atoms, nCtMode ) ))
  603|      0|    {
  604|      0|        ( *bOverflow )++;
  605|      0|        return 0;
  606|      0|    }
  607|       |
  608|       |    /*  add connection table string */
  609|  4.30k|    if (!bOvfl && bAddDelim)
  ------------------
  |  Branch (609:9): [True: 4.30k, False: 0]
  |  Branch (609:19): [True: 0, False: 4.30k]
  ------------------
  610|      0|    {
  611|      0|        inchi_strbuf_printf( strbuf, "," );
  612|      0|    }
  613|       |
  614|  4.30k|    if (!bOvfl)
  ------------------
  |  Branch (614:9): [True: 4.30k, False: 0]
  ------------------
  615|  4.30k|    {
  616|  4.30k|        nNumRingClosures = 0;
  617|  34.9k|        for (i = 0; nDfsOrderCT[i]/* && nLen < nLen_szLinearCT*/; i += 3)
  ------------------
  |  Branch (617:21): [True: 30.5k, False: 4.30k]
  ------------------
  618|  30.5k|        {
  619|  30.5k|            nValue = ( nDfsOrderCT[i] > MAX_ATOMS ) ? 0 : nDfsOrderCT[i];
  ------------------
  |  |   15|  30.5k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (619:22): [True: 0, False: 30.5k]
  ------------------
  620|  30.5k|            num_H = nDfsOrderCT[i + 1] ? nDfsOrderCT[i + 1] - 16 : 0;
  ------------------
  |  Branch (620:21): [True: 0, False: 30.5k]
  ------------------
  621|  30.5k|            nDelim = nDfsOrderCT[i + 2];
  622|  30.5k|            len = 0;
  623|       |            /*  delimiter */
  624|  30.5k|            if (bPredecessors)
  ------------------
  |  Branch (624:17): [True: 0, False: 30.5k]
  ------------------
  625|      0|            {
  626|      0|                if (bCountRingClosures)
  ------------------
  |  Branch (626:21): [True: 0, False: 0]
  ------------------
  627|      0|                {
  628|      0|                    if (nDelim == '-' && i > 3 && bNoNum_H)
  ------------------
  |  Branch (628:25): [True: 0, False: 0]
  |  Branch (628:42): [True: 0, False: 0]
  |  Branch (628:51): [True: 0, False: 0]
  ------------------
  629|      0|                    {
  630|      0|                        if (!nNumRingClosures)
  ------------------
  |  Branch (630:29): [True: 0, False: 0]
  ------------------
  631|      0|                        {
  632|      0|                            int j;
  633|      0|                            for (j = i; nDfsOrderCT[j] && '-' == nDfsOrderCT[j + 2]; j += 3)
  ------------------
  |  Branch (633:41): [True: 0, False: 0]
  |  Branch (633:59): [True: 0, False: 0]
  ------------------
  634|      0|                            {
  635|      0|                                nNumRingClosures++;
  636|      0|                            }
  637|      0|                            if (nNumRingClosures)
  ------------------
  |  Branch (637:33): [True: 0, False: 0]
  ------------------
  638|      0|                            {
  639|      0|                                len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, NULL, nNumRingClosures );
  640|      0|                            }
  641|      0|                            nNumRingClosures--;
  642|      0|                        }
  643|      0|                        else
  644|      0|                        {
  645|      0|                            nNumRingClosures--;
  646|      0|                        }
  647|      0|                    }
  648|      0|                    else
  649|      0|                    {
  650|      0|                        nNumRingClosures = 0;
  651|      0|                    }
  652|      0|                }
  653|      0|                else if (nDelim && !( bAbcNumbers && nDelim == ',' ))
  ------------------
  |  Branch (653:26): [True: 0, False: 0]
  |  Branch (653:39): [True: 0, False: 0]
  |  Branch (653:54): [True: 0, False: 0]
  ------------------
  654|      0|                {
  655|      0|                    if (nNum_H || i > 3)
  ------------------
  |  Branch (655:25): [True: 0, False: 0]
  |  Branch (655:35): [True: 0, False: 0]
  ------------------
  656|      0|                    {
  657|      0|                        szValue[len++] = nDelim;
  658|      0|                    }
  659|      0|                }
  660|      0|            }
  661|  30.5k|            else
  662|  30.5k|            {
  663|  30.5k|                if (nDelim && !( bAbcNumbers && nDelim == '-' ))
  ------------------
  |  Branch (663:21): [True: 26.2k, False: 4.30k]
  |  Branch (663:34): [True: 0, False: 26.2k]
  |  Branch (663:49): [True: 0, False: 0]
  ------------------
  664|  26.2k|                {
  665|  26.2k|                    szValue[len++] = nDelim;
  666|  26.2k|                }
  667|  30.5k|            }
  668|  30.5k|            if (bAbcNumbers)
  ------------------
  |  Branch (668:17): [True: 0, False: 30.5k]
  ------------------
  669|      0|            {
  670|      0|                if (nValue || i)
  ------------------
  |  Branch (670:21): [True: 0, False: 0]
  |  Branch (670:31): [True: 0, False: 0]
  ------------------
  671|      0|                {
  672|       |                    /* the 1st value may be zero in case of presdecessor list */
  673|      0|                    len += MakeAbcNumber( szValue + len, ( int )sizeof( szValue ) - len, NULL, nValue );
  674|      0|                }
  675|      0|                if (num_H)
  ------------------
  |  Branch (675:21): [True: 0, False: 0]
  ------------------
  676|      0|                {
  677|      0|                    len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, NULL, num_H );
  678|      0|                }
  679|      0|            }
  680|  30.5k|            else
  681|  30.5k|            {
  682|  30.5k|                if (nValue || i)
  ------------------
  |  Branch (682:21): [True: 30.5k, False: 0]
  |  Branch (682:31): [True: 0, False: 0]
  ------------------
  683|  30.5k|                {
  684|       |                    /* the 1st value may be zero in case of presdecessor list */
  685|  30.5k|                    len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, NULL, nValue );
  686|  30.5k|                }
  687|  30.5k|                if (num_H)
  ------------------
  |  Branch (687:21): [True: 0, False: 30.5k]
  ------------------
  688|      0|                {
  689|      0|                    szValue[len] = 'H';
  690|      0|                    len++;
  691|      0|                    if (num_H > 1)
  ------------------
  |  Branch (691:25): [True: 0, False: 0]
  ------------------
  692|      0|                    {
  693|      0|                        len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, NULL, num_H );
  694|      0|                    }
  695|      0|                }
  696|  30.5k|            }
  697|       |
  698|  30.5k|            if (len > 0)
  ------------------
  |  Branch (698:17): [True: 30.5k, False: 0]
  ------------------
  699|  30.5k|            {
  700|  30.5k|                inchi_strbuf_printf( strbuf, "%s", szValue );
  701|  30.5k|            }
  702|  30.5k|        }
  703|  4.30k|    }
  704|       |
  705|  4.30k|    *bOverflow |= bOvfl;
  706|  4.30k|    if (nDfsOrderCT)
  ------------------
  |  Branch (706:9): [True: 4.30k, False: 0]
  ------------------
  707|  4.30k|    {
  708|  4.30k|        inchi_free( nDfsOrderCT );
  ------------------
  |  | 1152|  4.30k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 4.30k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 4.30k]
  |  |  ------------------
  ------------------
  709|  4.30k|    }
  710|       |
  711|  4.30k|    nLen = strbuf->nUsedLength - nUsedLength0;
  712|       |
  713|  4.30k|    return nLen;
  714|  4.30k|}
MakeHString:
  816|  1.86k|{
  817|  1.86k|#define INIT_MIN_NUM_H (-4)
  818|  1.86k|#define INIT_MAX_NUM_H 16
  819|  1.86k|#define INIT_LEN_NUM_H (INIT_MAX_NUM_H - INIT_MIN_NUM_H + 1)
  820|       |
  821|       |    /*  produce output string; */
  822|  1.86k|    int nUsedLength0 = 0, nLen = 0, len, i, iFirst, nVal, bOvfl = *bOverflow;
  823|  1.86k|    char szValue[2048];
  824|  1.86k|    const char *pH;
  825|  1.86k|    int  bNext = 0;
  826|       |
  827|  1.86k|    nUsedLength0 = strbuf->nUsedLength;
  828|       |
  829|       |    /*  add connection table string */
  830|  1.86k|    if (!( nCtMode & CT_MODE_ABC_NUMBERS ) && !bOvfl && bAddDelim)
  ------------------
  |  |   26|  1.86k|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (830:9): [True: 1.86k, False: 0]
  |  Branch (830:47): [True: 1.86k, False: 0]
  |  Branch (830:57): [True: 0, False: 1.86k]
  ------------------
  831|      0|    {
  832|      0|        inchi_strbuf_printf( strbuf, "," );
  833|       |                            /*if ( nLen_szLinearCT > 1 ) {
  834|       |                                strcpy( szLinearCT, "," );
  835|       |                                nLen ++;
  836|       |                                } else {
  837|       |                                    bOvfl = 1;
  838|       |                            }*/
  839|      0|    }
  840|  1.86k|    if (!bOvfl && 0 < nLenCT && LinearCT)
  ------------------
  |  Branch (840:9): [True: 1.86k, False: 0]
  |  Branch (840:19): [True: 1.86k, False: 0]
  |  Branch (840:33): [True: 1.86k, False: 0]
  ------------------
  841|  1.86k|    {
  842|  1.86k|        if (nCtMode & CT_MODE_EQL_H_TOGETHER)
  ------------------
  |  |   29|  1.86k|#define CT_MODE_EQL_H_TOGETHER   16
  ------------------
  |  Branch (842:13): [True: 1.86k, False: 0]
  ------------------
  843|  1.86k|        {
  844|  1.86k|            int  curMinH = INIT_MIN_NUM_H;
  ------------------
  |  |  817|  1.86k|#define INIT_MIN_NUM_H (-4)
  ------------------
  845|  1.86k|            int  curMaxH = INIT_MAX_NUM_H;
  ------------------
  |  |  818|  1.86k|#define INIT_MAX_NUM_H 16
  ------------------
  846|  1.86k|            int  curLenH = INIT_LEN_NUM_H;
  ------------------
  |  |  819|  1.86k|#define INIT_LEN_NUM_H (INIT_MAX_NUM_H - INIT_MIN_NUM_H + 1)
  |  |  ------------------
  |  |  |  |  818|  1.86k|#define INIT_MAX_NUM_H 16
  |  |  ------------------
  |  |               #define INIT_LEN_NUM_H (INIT_MAX_NUM_H - INIT_MIN_NUM_H + 1)
  |  |  ------------------
  |  |  |  |  817|  1.86k|#define INIT_MIN_NUM_H (-4)
  |  |  ------------------
  ------------------
  847|  1.86k|            int  nInitNumH[INIT_LEN_NUM_H];
  848|  1.86k|            int *nNumH = nInitNumH;
  849|  1.86k|            int  numAt, curNumH;
  850|  1.86k|            int      j, bOutOfRange, tot_num_no_H;
  851|       |            /* count atoms H */
  852|  1.86k|            do
  853|  1.87k|            {
  854|  1.87k|                bOutOfRange = 0;
  855|  1.87k|                tot_num_no_H = 0; /* number of atoms that have no H */
  856|  1.87k|                memset( nNumH, 0, curLenH * sizeof( nNumH[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  857|   295k|                for (i = 0; i < nLenCT; i++)
  ------------------
  |  Branch (857:29): [True: 293k, False: 1.87k]
  ------------------
  858|   293k|                {
  859|   293k|                    curNumH = LinearCT[i];
  860|   293k|                    if (curNumH < curMinH)
  ------------------
  |  Branch (860:25): [True: 7, False: 293k]
  ------------------
  861|      7|                    {
  862|      7|                        curMinH = curNumH;
  863|      7|                        bOutOfRange++;
  864|      7|                    }
  865|   293k|                    else
  866|   293k|                    {
  867|   293k|                        if (curNumH > curMaxH)
  ------------------
  |  Branch (867:29): [True: 8, False: 293k]
  ------------------
  868|      8|                        {
  869|      8|                            curMaxH = curNumH;
  870|      8|                            bOutOfRange++;
  871|      8|                        }
  872|   293k|                        else
  873|   293k|                            if (!bOutOfRange)
  ------------------
  |  Branch (873:33): [True: 286k, False: 6.65k]
  ------------------
  874|   286k|                            {
  875|   286k|                                nNumH[curNumH - curMinH] ++;
  876|   286k|                            }
  877|   293k|                    }
  878|   293k|                    tot_num_no_H += !curNumH;
  879|   293k|                }
  880|  1.87k|                if (tot_num_no_H == nLenCT)
  ------------------
  |  Branch (880:21): [True: 1.14k, False: 737]
  ------------------
  881|  1.14k|                {
  882|  1.14k|                    return nLen; /* empty string */
  883|  1.14k|                }
  884|    737|                if (bOutOfRange)
  ------------------
  |  Branch (884:21): [True: 11, False: 726]
  ------------------
  885|     11|                {
  886|       |                    /* for debug only */
  887|     11|                    if (nNumH != nInitNumH)
  ------------------
  |  Branch (887:25): [True: 0, False: 11]
  ------------------
  888|      0|                    {
  889|      0|                        *bOverflow |= 1;
  890|      0|                        inchi_free( nNumH );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  891|      0|                        return nLen;
  892|      0|                    }
  893|       |                    /* end debug */
  894|     11|                    curLenH = curMaxH - curMinH + 1;
  895|     11|                    nNumH = (int*) inchi_malloc( curLenH * sizeof( nNumH[0] ) );
  ------------------
  |  | 1143|     11|#define inchi_malloc   malloc
  ------------------
  896|     11|                    if (!nNumH)
  ------------------
  |  Branch (896:25): [True: 0, False: 11]
  ------------------
  897|      0|                    {
  898|      0|                        *bOverflow |= 1;
  899|      0|                        return nLen;
  900|      0|                    }
  901|     11|                }
  902|    737|            }
  903|  1.86k|            while (bOutOfRange); /* the loop may be executed 1 or 2 times only */
  ------------------
  |  Branch (903:20): [True: 11, False: 726]
  ------------------
  904|       |
  905|  16.8k|            for (curNumH = curMinH; curNumH <= curMaxH; curNumH++)
  ------------------
  |  Branch (905:37): [True: 16.1k, False: 726]
  ------------------
  906|  16.1k|            {
  907|  16.1k|                numAt = nNumH[curNumH - curMinH]; /* number of atoms that have curNumH atoms H */
  908|  16.1k|                if (!numAt || !curNumH)
  ------------------
  |  Branch (908:21): [True: 14.6k, False: 1.45k]
  |  Branch (908:31): [True: 722, False: 734]
  ------------------
  909|  15.4k|                {
  910|  15.4k|                    continue; /* no atom has this number of H or number of H = 0 */
  911|  15.4k|                }
  912|    734|                j = 0;
  913|  3.47k|                while (j < nLenCT && numAt)
  ------------------
  |  Branch (913:24): [True: 3.41k, False: 55]
  |  Branch (913:38): [True: 2.73k, False: 679]
  ------------------
  914|  2.73k|                {
  915|  2.73k|                    if (curNumH == LinearCT[j])
  ------------------
  |  Branch (915:25): [True: 797, False: 1.94k]
  ------------------
  916|    797|                    {
  917|    797|                        iFirst = ++j;
  918|    797|                        numAt--;
  919|  2.65k|                        for (; j < nLenCT && curNumH == LinearCT[j] && numAt; j++)
  ------------------
  |  Branch (919:32): [True: 2.60k, False: 55]
  |  Branch (919:46): [True: 1.85k, False: 742]
  |  Branch (919:72): [True: 1.85k, False: 0]
  ------------------
  920|  1.85k|                        {
  921|  1.85k|                            numAt--;
  922|  1.85k|                        }
  923|    797|                        if (nCtMode & CT_MODE_ABC_NUMBERS)
  ------------------
  |  |   26|    797|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (923:29): [True: 0, False: 797]
  ------------------
  924|      0|                        {
  925|      0|                            len = MakeAbcNumber( szValue, ( int )sizeof( szValue ), NULL, iFirst );
  926|      0|                        }
  927|    797|                        else
  928|    797|                        {
  929|    797|                            len = MakeDecNumber( szValue, ( int )sizeof( szValue ), bNext ? ITEM_DELIMETER : NULL, iFirst );
  ------------------
  |  |   17|     71|#define ITEM_DELIMETER    ","
  ------------------
  |  Branch (929:85): [True: 71, False: 726]
  ------------------
  930|    797|                            bNext++; /* add a delimiter (comma) before all except the first */
  931|    797|                        }
  932|    797|                        if (iFirst < j)
  ------------------
  |  Branch (932:29): [True: 127, False: 670]
  ------------------
  933|    127|                        {
  934|       |                            /* output last canonical number */
  935|    127|                            if (nCtMode & CT_MODE_ABC_NUMBERS)
  ------------------
  |  |   26|    127|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (935:33): [True: 0, False: 127]
  ------------------
  936|      0|                            {
  937|      0|                                len += MakeAbcNumber( szValue + len, ( int )sizeof( szValue ), NULL, j );
  938|      0|                            }
  939|    127|                            else
  940|    127|                            {
  941|    127|                                len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, "-", j );
  942|    127|                            }
  943|    127|                        }
  944|    797|                        if (!numAt || ( nCtMode & CT_MODE_ABC_NUMBERS ))
  ------------------
  |  |   26|     63|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (944:29): [True: 734, False: 63]
  |  Branch (944:39): [True: 0, False: 63]
  ------------------
  945|    734|                        {
  946|       |                            /* add number of H */
  947|       |                            /* output number of H */
  948|    734|                            nVal = curNumH;
  949|    734|                            if (nCtMode & CT_MODE_ABC_NUMBERS)
  ------------------
  |  |   26|    734|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (949:33): [True: 0, False: 734]
  ------------------
  950|      0|                            {
  951|      0|                                len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, NULL, nVal );
  952|      0|                            }
  953|    734|                            else
  954|    734|                            {
  955|    734|                                pH = nVal > 0 ? "H" : "h";
  ------------------
  |  Branch (955:38): [True: 727, False: 7]
  ------------------
  956|    734|                                nVal = abs( nVal );
  957|    734|                                if (nVal > 1)
  ------------------
  |  Branch (957:37): [True: 141, False: 593]
  ------------------
  958|    141|                                {
  959|    141|                                    len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, pH, nVal );
  960|    141|                                }
  961|    593|                                else
  962|    593|                                {
  963|    593|                                    strcpy(szValue + len, pH);
  964|    593|                                    len++;
  965|    593|                                }
  966|    734|                            }
  967|    734|                        }
  968|       |                        /* add to the output */
  969|    797|                        if (len > 0)
  ------------------
  |  Branch (969:29): [True: 797, False: 0]
  ------------------
  970|    797|                        {
  971|    797|                            inchi_strbuf_printf( strbuf, "%-s", szValue );
  972|    797|                            bNext++;
  973|    797|                        }
  974|       |                        /*
  975|       |                        if ( 0 <= len && nLen+len < nLen_szLinearCT ) {
  976|       |                            if ( len ) {
  977|       |                                strcpy( szLinearCT+nLen, szValue );
  978|       |                                nLen += len;
  979|       |                                bNext ++;
  980|       |                            }
  981|       |                        } else {
  982|       |                            bOvfl = 1;
  983|       |                            break;
  984|       |                        }*/
  985|    797|                    }
  986|  1.94k|                    else
  987|  1.94k|                    {
  988|  1.94k|                        j++;
  989|  1.94k|                    }
  990|  2.73k|                }
  991|    734|            }
  992|    726|            if (nNumH != nInitNumH)
  ------------------
  |  Branch (992:17): [True: 11, False: 715]
  ------------------
  993|     11|            {
  994|     11|                inchi_free( nNumH );
  ------------------
  |  | 1152|     11|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 11, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 11]
  |  |  ------------------
  ------------------
  995|     11|            }
  996|    726|        }
  997|      0|        else
  998|      0|        {
  999|      0|            iFirst = 0;
 1000|      0|            for (i = iFirst + 1; i <= nLenCT/* && nLen < nLen_szLinearCT*/; i++)
  ------------------
  |  Branch (1000:34): [True: 0, False: 0]
  ------------------
 1001|      0|            {
 1002|      0|                if (i < nLenCT && LinearCT[i] == LinearCT[iFirst])
  ------------------
  |  Branch (1002:21): [True: 0, False: 0]
  |  Branch (1002:35): [True: 0, False: 0]
  ------------------
 1003|      0|                {
 1004|      0|                    continue;
 1005|      0|                }
 1006|       |                /* output identical values located at i = iFirst..i-1 */
 1007|      0|                if (LinearCT[iFirst])
  ------------------
  |  Branch (1007:21): [True: 0, False: 0]
  ------------------
 1008|      0|                { /* output only non-zero values */
 1009|       |                  /* first canonical number */
 1010|      0|                    nVal = LinearCT[iFirst];
 1011|      0|                    iFirst++;
 1012|      0|                    if (nCtMode & CT_MODE_ABC_NUMBERS)
  ------------------
  |  |   26|      0|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (1012:25): [True: 0, False: 0]
  ------------------
 1013|      0|                    {
 1014|      0|                        len = MakeAbcNumber( szValue, ( int )sizeof( szValue ), NULL, iFirst );
 1015|      0|                    }
 1016|      0|                    else
 1017|      0|                    {
 1018|      0|                        len = MakeDecNumber( szValue, ( int )sizeof( szValue ), bNext ? ITEM_DELIMETER : NULL, iFirst );
  ------------------
  |  |   17|      0|#define ITEM_DELIMETER    ","
  ------------------
  |  Branch (1018:81): [True: 0, False: 0]
  ------------------
 1019|      0|                    }
 1020|      0|                    if (iFirst < i)
  ------------------
  |  Branch (1020:25): [True: 0, False: 0]
  ------------------
 1021|      0|                    {
 1022|       |                        /* output last canonical number */
 1023|      0|                        if (nCtMode & CT_MODE_ABC_NUMBERS)
  ------------------
  |  |   26|      0|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (1023:29): [True: 0, False: 0]
  ------------------
 1024|      0|                        {
 1025|      0|                            len += MakeAbcNumber( szValue + len, ( int )sizeof( szValue ), NULL, i );
 1026|      0|                        }
 1027|      0|                        else
 1028|      0|                        {
 1029|      0|                            len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, "-", i );
 1030|      0|                        }
 1031|      0|                    }
 1032|       |                    /* output number of H */
 1033|      0|                    if (nCtMode & CT_MODE_ABC_NUMBERS)
  ------------------
  |  |   26|      0|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (1033:25): [True: 0, False: 0]
  ------------------
 1034|      0|                    {
 1035|      0|                        len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, NULL, nVal );
 1036|      0|                    }
 1037|      0|                    else
 1038|      0|                    {
 1039|      0|                        pH = nVal > 0 ? "H" : "h";
  ------------------
  |  Branch (1039:30): [True: 0, False: 0]
  ------------------
 1040|      0|                        nVal = abs( nVal );
 1041|      0|                        if (nVal > 1)
  ------------------
  |  Branch (1041:29): [True: 0, False: 0]
  ------------------
 1042|      0|                        {
 1043|      0|                            len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, pH, nVal );
 1044|      0|                        }
 1045|      0|                        else
 1046|      0|                        {
 1047|      0|                            strcpy(szValue + len, pH); /* djb-rwth: GCC 14 false positive */
 1048|      0|                            len++;
 1049|      0|                        }
 1050|      0|                    }
 1051|      0|                    if (0 <= len/* && nLen+len < nLen_szLinearCT*/)
  ------------------
  |  Branch (1051:25): [True: 0, False: 0]
  ------------------
 1052|      0|                    {
 1053|      0|                        if (len)
  ------------------
  |  Branch (1053:29): [True: 0, False: 0]
  ------------------
 1054|      0|                        {
 1055|      0|                            inchi_strbuf_printf( strbuf, "%-s", szValue );
 1056|       |                                        /*strcpy( szLinearCT+nLen, szValue );
 1057|       |                                        nLen += len;*/
 1058|      0|                            bNext++;
 1059|      0|                        }
 1060|      0|                    }
 1061|      0|                    else
 1062|      0|                    {
 1063|      0|                        bOvfl = 1;
 1064|      0|                        break;
 1065|      0|                    }
 1066|      0|                }
 1067|      0|                iFirst = i;
 1068|      0|            }
 1069|      0|        }
 1070|  1.86k|    }
 1071|    726|    *bOverflow |= bOvfl;
 1072|       |
 1073|    726|    nLen = strbuf->nUsedLength - nUsedLength0;
 1074|    726|    return nLen;
 1075|       |
 1076|  1.86k|#undef INIT_MIN_NUM_H
 1077|  1.86k|#undef INIT_MAX_NUM_H
 1078|  1.86k|#undef INIT_LEN_NUM_H
 1079|  1.86k|}
MakeTautString:
 1138|  1.86k|{
 1139|       |    /*  produce output string; */
 1140|  1.86k|    int nUsedLength0 = 0, nLen = 0, len, i, bOvfl = *bOverflow;
 1141|  1.86k|    char szValue[2048];
 1142|  1.86k|    const char *p;
 1143|  1.86k|    int   nValue, nGroupLen, iGroupOutputCount, bCompressed;
 1144|       |    /*  make tautomer string */
 1145|  1.86k|    if (!nLenCT || !LinearCT || !*LinearCT)
  ------------------
  |  Branch (1145:9): [True: 704, False: 1.16k]
  |  Branch (1145:20): [True: 0, False: 1.16k]
  |  Branch (1145:33): [True: 0, False: 1.16k]
  ------------------
 1146|    704|    {
 1147|    704|        return nLen;
 1148|    704|    }
 1149|       |
 1150|  1.16k|    nUsedLength0 = strbuf->nUsedLength;
 1151|       |
 1152|  1.16k|    bCompressed = ( nCtMode & CT_MODE_ABC_NUMBERS );
  ------------------
  |  |   26|  1.16k|#define CT_MODE_ABC_NUMBERS       2
  ------------------
 1153|  1.16k|    if (!bCompressed && !bOvfl && bAddDelim)
  ------------------
  |  Branch (1153:9): [True: 1.16k, False: 0]
  |  Branch (1153:25): [True: 1.16k, False: 0]
  |  Branch (1153:35): [True: 22, False: 1.14k]
  ------------------
 1154|     22|    {
 1155|     22|        inchi_strbuf_printf( strbuf, "%s", COMMA_EXTRA_SPACE );
  ------------------
  |  |   19|     22|#define COMMA_EXTRA_SPACE ","
  ------------------
 1156|       |        /*if ( nLen_szLinearCT > 1+LEN_EXTRA_SPACE ) {
 1157|       |            strcpy( szLinearCT, COMMA_EXTRA_SPACE);
 1158|       |            nLen += 1+LEN_EXTRA_SPACE;
 1159|       |        } else {
 1160|       |            bOvfl = 1;
 1161|       |        }*/
 1162|     22|    }
 1163|  1.16k|    LinearCT++; /*  bypass number of tautomeric groups */
 1164|  1.16k|    nLenCT--;
 1165|       |
 1166|  1.16k|    if (!bOvfl)
  ------------------
  |  Branch (1166:9): [True: 1.16k, False: 0]
  ------------------
 1167|  1.16k|    {
 1168|  24.5k|        for (i = nGroupLen = iGroupOutputCount = 0; i < nLenCT/* && nLen < nLen_szLinearCT*/; i++)
  ------------------
  |  Branch (1168:53): [True: 23.3k, False: 1.16k]
  ------------------
 1169|  23.3k|        {
 1170|  23.3k|            nValue = (int) LinearCT[i];
 1171|  23.3k|            if (nGroupLen == iGroupOutputCount)
  ------------------
  |  Branch (1171:17): [True: 2.15k, False: 21.2k]
  ------------------
 1172|  2.15k|            {
 1173|  2.15k|                nGroupLen = nValue;
 1174|  2.15k|                iGroupOutputCount = 0;
 1175|       |                /* group delimiter (uncompressed) */
 1176|  2.15k|                if (!bCompressed)
  ------------------
  |  Branch (1176:21): [True: 2.15k, False: 0]
  ------------------
 1177|  2.15k|                {
 1178|  2.15k|                    if (!i)
  ------------------
  |  Branch (1178:25): [True: 1.16k, False: 996]
  ------------------
 1179|  1.16k|                    {
 1180|  1.16k|                        strcpy( szValue, "(" );
 1181|  1.16k|                        len = 1;
 1182|  1.16k|                    }
 1183|    996|                    else
 1184|    996|                    {
 1185|    996|                        strcpy( szValue, ")(" );
 1186|    996|                        len = 2;
 1187|    996|                    }
 1188|  2.15k|                }
 1189|      0|                else
 1190|      0|                {
 1191|      0|                    len = 0;
 1192|      0|                }
 1193|  2.15k|            }
 1194|  21.2k|            else
 1195|  21.2k|            {
 1196|  21.2k|                if (bCompressed && iGroupOutputCount >= INCHI_T_NUM_MOVABLE)
  ------------------
  |  |  749|      0|#define INCHI_T_NUM_MOVABLE  2
  ------------------
  |  Branch (1196:21): [True: 0, False: 21.2k]
  |  Branch (1196:36): [True: 0, False: 0]
  ------------------
 1197|      0|                {
 1198|       |                    /*  compressed canon number in Abc */
 1199|      0|                    len = MakeAbcNumber( szValue, ( int )sizeof( szValue ), NULL, nValue );
 1200|      0|                    iGroupOutputCount++;
 1201|      0|                }
 1202|  21.2k|                else
 1203|  21.2k|                {
 1204|       |                    /*  always output number of hydrogen atoms as a decimal */
 1205|       |                    /*  output leading space if: */
 1206|       |                    /*  (a) this is the first output value in compressed mode (i==1 && bCompressed) */
 1207|       |                    /*  (b) this is not the first output value in non-compressed mode ( iGroupOutputCount && !bCompressed) */
 1208|  21.2k|                    if (bCompressed)
  ------------------
  |  Branch (1208:25): [True: 0, False: 21.2k]
  ------------------
 1209|      0|                    {
 1210|      0|                        p = NULL;
 1211|      0|                        len = 0;
 1212|      0|                        switch (iGroupOutputCount)
  ------------------
  |  Branch (1212:33): [True: 0, False: 0]
  ------------------
 1213|      0|                        {
 1214|      0|                            case 0:
  ------------------
  |  Branch (1214:29): [True: 0, False: 0]
  ------------------
 1215|      0|                                len = MakeDecNumber( szValue, ( int )sizeof( szValue ), ( i == 1 ) ? ITEM_DELIMETER : NULL, nValue );
  ------------------
  |  |   17|      0|#define ITEM_DELIMETER    ","
  ------------------
  |  Branch (1215:89): [True: 0, False: 0]
  ------------------
 1216|      0|                                break;
 1217|      0|                            case 1:
  ------------------
  |  Branch (1217:29): [True: 0, False: 0]
  ------------------
 1218|      0|                                p = "-";
 1219|      0|                                break;
 1220|      0|                            case 2:
  ------------------
  |  Branch (1220:29): [True: 0, False: 0]
  ------------------
 1221|      0|                                p = "+";
 1222|      0|                                break;
 1223|      0|                        }
 1224|      0|                        if (p)
  ------------------
  |  Branch (1224:29): [True: 0, False: 0]
  ------------------
 1225|      0|                        {
 1226|      0|                            switch (nValue)
 1227|      0|                            {
 1228|      0|                                case 0:
  ------------------
  |  Branch (1228:33): [True: 0, False: 0]
  ------------------
 1229|      0|                                    len = 0;
 1230|      0|                                    break;
 1231|      0|                                case 1:
  ------------------
  |  Branch (1231:33): [True: 0, False: 0]
  ------------------
 1232|      0|                                    strcpy(szValue, p);
 1233|      0|                                    len = (int) strlen( szValue );
 1234|      0|                                    break;
 1235|      0|                                default:
  ------------------
  |  Branch (1235:33): [True: 0, False: 0]
  ------------------
 1236|      0|                                    len = MakeDecNumber( szValue, ( int )sizeof( szValue ), p, nValue );
 1237|      0|                                    break;
 1238|      0|                            }
 1239|      0|                        }
 1240|      0|                    }
 1241|  21.2k|                    else
 1242|  21.2k|                    {
 1243|  21.2k|                        if (iGroupOutputCount >= INCHI_T_NUM_MOVABLE)
  ------------------
  |  |  749|  21.2k|#define INCHI_T_NUM_MOVABLE  2
  ------------------
  |  Branch (1243:29): [True: 16.8k, False: 4.31k]
  ------------------
 1244|  16.8k|                        {
 1245|       |                            /*  canonical number of the atom in the tautomeric group */
 1246|  16.8k|                            len = MakeDecNumber( szValue, ( int )sizeof( szValue ), ITEM_DELIMETER, nValue );
  ------------------
  |  |   17|  16.8k|#define ITEM_DELIMETER    ","
  ------------------
 1247|  16.8k|                        }
 1248|  4.31k|                        else
 1249|  4.31k|                        {
 1250|  4.31k|                            p = NULL;
 1251|  4.31k|                            len = 0;
 1252|  4.31k|                            if (nValue)
  ------------------
  |  Branch (1252:33): [True: 675, False: 3.64k]
  ------------------
 1253|    675|                            {
 1254|    675|                                switch (iGroupOutputCount)
  ------------------
  |  Branch (1254:41): [True: 675, False: 0]
  ------------------
 1255|    675|                                {
 1256|    200|                                    case 0:
  ------------------
  |  Branch (1256:37): [True: 200, False: 475]
  ------------------
 1257|    200|                                        p = "H";
 1258|    200|                                        break;
 1259|    475|                                    case 1:
  ------------------
  |  Branch (1259:37): [True: 475, False: 200]
  ------------------
 1260|    475|                                        p = "-";
 1261|    475|                                        break;
 1262|      0|                                    case 2:
  ------------------
  |  Branch (1262:37): [True: 0, False: 675]
  ------------------
 1263|      0|                                        p = "+";
 1264|      0|                                        break;
 1265|    675|                                }
 1266|    675|                                if (p)
  ------------------
  |  Branch (1266:37): [True: 675, False: 0]
  ------------------
 1267|    675|                                {
 1268|       |                                    /*  number of hydrogens */
 1269|    675|                                    if (nValue == 1)
  ------------------
  |  Branch (1269:41): [True: 366, False: 309]
  ------------------
 1270|    366|                                    {
 1271|    366|                                        strcpy(szValue, p);
 1272|    366|                                        len = (int) strlen( szValue );
 1273|    366|                                    }
 1274|    309|                                    else
 1275|    309|                                    {
 1276|    309|                                        len = MakeDecNumber( szValue, ( int )sizeof( szValue ), p, nValue );
 1277|    309|                                    }
 1278|    675|                                }
 1279|    675|                            }
 1280|  4.31k|                        }
 1281|  21.2k|                    }
 1282|  21.2k|                    iGroupOutputCount++;
 1283|  21.2k|                }
 1284|  21.2k|            }
 1285|       |
 1286|  23.3k|            if (len > 0)
  ------------------
  |  Branch (1286:17): [True: 19.7k, False: 3.64k]
  ------------------
 1287|  19.7k|            {
 1288|  19.7k|                inchi_strbuf_printf( strbuf, "%s", szValue );
 1289|  19.7k|            }
 1290|       |            /*if ( 0 <= len && nLen+len < nLen_szLinearCT ) {
 1291|       |                if ( len ) {
 1292|       |                    strcpy( szLinearCT+nLen, szValue );
 1293|       |                    nLen += len;
 1294|       |                }
 1295|       |            } else {
 1296|       |                bOvfl = 1;
 1297|       |                break;
 1298|       |            }*/
 1299|  23.3k|        }
 1300|       |
 1301|  1.16k|        if (!bOvfl && !bCompressed && i)
  ------------------
  |  Branch (1301:13): [True: 1.16k, False: 0]
  |  Branch (1301:23): [True: 1.16k, False: 0]
  |  Branch (1301:39): [True: 1.16k, False: 0]
  ------------------
 1302|  1.16k|        {
 1303|  1.16k|            inchi_strbuf_printf( strbuf, ")" );
 1304|       |            /*if ( nLen + 1 < nLen_szLinearCT ) {
 1305|       |                strcpy( szLinearCT+nLen, ")" );
 1306|       |                nLen ++;
 1307|       |            } else {
 1308|       |                bOvfl = 1;
 1309|       |            }*/
 1310|  1.16k|        }
 1311|  1.16k|    }
 1312|  1.16k|    *bOverflow |= bOvfl;
 1313|       |
 1314|  1.16k|    nLen = strbuf->nUsedLength - nUsedLength0;
 1315|       |
 1316|  1.16k|    return nLen;
 1317|  1.16k|}
MakeIsoAtomString:
 1671|    453|{
 1672|       |    /*  produce output string; */
 1673|    453|    int nUsedLength0 = 0, nLen = 0, len, tot_len, ret, i, j, bOvfl = *bOverflow;
 1674|    453|    char szValue[2048];
 1675|    453|    char *p;
 1676|    453|    int   nValue;
 1677|    453|    int   bAbcNumbers = ( nCtMode & CT_MODE_ABC_NUMBERS );
  ------------------
  |  |   26|    453|#define CT_MODE_ABC_NUMBERS       2
  ------------------
 1678|    453|    static const char letter[] = "itdh";
 1679|    453|    static const char *h[] = { "T", "D", "H" };
 1680|    453|    static const char *sign[] = { "-", "+" };
 1681|       |
 1682|    453|    nUsedLength0 = strbuf->nUsedLength;
 1683|       |
 1684|    453|    if (!bOvfl)
  ------------------
  |  Branch (1684:9): [True: 453, False: 0]
  ------------------
 1685|    453|    {
 1686|  2.59k|        for (i = 0; i < nNumberOfIsotopicAtoms/* && nLen < nLen_szLinearCT*/; i++)
  ------------------
  |  Branch (1686:21): [True: 2.14k, False: 453]
  ------------------
 1687|  2.14k|        {
 1688|  2.14k|            p = szValue;
 1689|  2.14k|            tot_len = 0;
 1690|  12.8k|            for (j = 0; j < 5; j++)
  ------------------
  |  Branch (1690:25): [True: 10.7k, False: 2.14k]
  ------------------
 1691|  10.7k|            {
 1692|  10.7k|                len = 0;
 1693|  10.7k|                switch (j)
  ------------------
  |  Branch (1693:25): [True: 10.7k, False: 0]
  ------------------
 1694|  10.7k|                {
 1695|  2.14k|                    case 0:
  ------------------
  |  Branch (1695:21): [True: 2.14k, False: 8.57k]
  ------------------
 1696|  2.14k|                        nValue = (int) IsotopicAtom[i].nAtomNumber;
 1697|  2.14k|                        break;
 1698|  2.14k|                    case 1:
  ------------------
  |  Branch (1698:21): [True: 2.14k, False: 8.57k]
  ------------------
 1699|  2.14k|                        nValue = (int) IsotopicAtom[i].nIsoDifference;
 1700|  2.14k|                        break;
 1701|  2.14k|                    case 2:
  ------------------
  |  Branch (1701:21): [True: 2.14k, False: 8.57k]
  ------------------
 1702|  2.14k|                        nValue = (int) IsotopicAtom[i].nNum_T;
 1703|  2.14k|                        break;
 1704|  2.14k|                    case 3:
  ------------------
  |  Branch (1704:21): [True: 2.14k, False: 8.57k]
  ------------------
 1705|  2.14k|                        nValue = (int) IsotopicAtom[i].nNum_D;
 1706|  2.14k|                        break;
 1707|  2.14k|                    case 4:
  ------------------
  |  Branch (1707:21): [True: 2.14k, False: 8.57k]
  ------------------
 1708|  2.14k|                        nValue = (int) IsotopicAtom[i].nNum_H;
 1709|  2.14k|                        break;
 1710|  10.7k|                }
 1711|  10.7k|                if (!j)
  ------------------
  |  Branch (1711:21): [True: 2.14k, False: 8.57k]
  ------------------
 1712|  2.14k|                {
 1713|       |                    /*  atom canonical number */
 1714|  2.14k|                    len = ( bAbcNumbers ? MakeAbcNumber : MakeDecNumber )
  ------------------
  |  Branch (1714:29): [True: 0, False: 2.14k]
  ------------------
 1715|  2.14k|                        ( p, ( int )sizeof( szValue ) - tot_len,
 1716|  2.14k|                          bAbcNumbers ? NULL : ( i ? ITEM_DELIMETER : EXTRA_SPACE ), nValue
  ------------------
  |  |   17|  1.69k|#define ITEM_DELIMETER    ","
  ------------------
                                        bAbcNumbers ? NULL : ( i ? ITEM_DELIMETER : EXTRA_SPACE ), nValue
  ------------------
  |  |   18|    453|#define EXTRA_SPACE       ""
  ------------------
  |  Branch (1716:27): [True: 0, False: 2.14k]
  |  Branch (1716:50): [True: 1.69k, False: 453]
  ------------------
 1717|  2.14k|                        );
 1718|  2.14k|                }
 1719|  8.57k|                else
 1720|  8.57k|                {
 1721|  8.57k|                    if (bAbcNumbers)
  ------------------
  |  Branch (1721:25): [True: 0, False: 8.57k]
  ------------------
 1722|      0|                    {
 1723|       |                        /*  Abc output */
 1724|      0|                        switch (j)
  ------------------
  |  Branch (1724:33): [True: 0, False: 0]
  ------------------
 1725|      0|                        {
 1726|      0|                            case 1: /* nIsoDifference */
  ------------------
  |  Branch (1726:29): [True: 0, False: 0]
  ------------------
 1727|      0|                                len = MakeDecNumber( p, ( int )sizeof( szValue ) - tot_len, NULL, nValue );
 1728|      0|                                break;
 1729|      0|                            case 2: /* nNum_T */
  ------------------
  |  Branch (1729:29): [True: 0, False: 0]
  ------------------
 1730|      0|                            case 3: /* nNum_D */
  ------------------
  |  Branch (1730:29): [True: 0, False: 0]
  ------------------
 1731|      0|                            case 4: /* nNum_H */
  ------------------
  |  Branch (1731:29): [True: 0, False: 0]
  ------------------
 1732|      0|                                if (nValue)
  ------------------
  |  Branch (1732:37): [True: 0, False: 0]
  ------------------
 1733|      0|                                {
 1734|      0|                                    if (( int )sizeof( szValue ) - tot_len > 1)
  ------------------
  |  Branch (1734:41): [True: 0, False: 0]
  ------------------
 1735|      0|                                    {
 1736|      0|                                        p[len++] = letter[j - 1];
 1737|      0|                                        if (1 == nValue)
  ------------------
  |  Branch (1737:45): [True: 0, False: 0]
  ------------------
 1738|      0|                                        {
 1739|      0|                                            p[len] = '\0';
 1740|      0|                                        }
 1741|      0|                                        else
 1742|      0|                                        {
 1743|      0|                                            ret = MakeDecNumber( p + len, ( int )sizeof( szValue ) - tot_len - len, NULL, nValue );
 1744|      0|                                            len = ( ret >= 0 ) ? len + ret : ret;
  ------------------
  |  Branch (1744:51): [True: 0, False: 0]
  ------------------
 1745|      0|                                        }
 1746|      0|                                    }
 1747|      0|                                    else
 1748|      0|                                    {
 1749|      0|                                        len = -1; /* overflow */
 1750|      0|                                    }
 1751|      0|                                }
 1752|      0|                        }
 1753|      0|                    }
 1754|  8.57k|                    else
 1755|  8.57k|                    {
 1756|  8.57k|                        if (nValue)
  ------------------
  |  Branch (1756:29): [True: 2.39k, False: 6.17k]
  ------------------
 1757|  2.39k|                        {
 1758|  2.39k|                            if (j == 1)
  ------------------
  |  Branch (1758:33): [True: 564, False: 1.83k]
  ------------------
 1759|    564|                            {
 1760|       |                                /*  Decimal output */
 1761|       |                                /*  signed isotopic mass difference */
 1762|    564|                                int subtract = ( nValue > 0 );
 1763|       |                                /*  (n = mass difference) > 0 corresponds to nValue = n+1 */
 1764|       |                                /*  subtract 1 from it so that mass difference for 35Cl or 12C is zero */
 1765|    564|                                len = MakeDecNumber( p, ( int )sizeof( szValue ) - tot_len, sign[nValue >= 0], abs( nValue - subtract ) );
 1766|    564|                            }
 1767|  1.83k|                            else
 1768|  1.83k|                            {
 1769|       |                                /*  hydrogen isotope */
 1770|  1.83k|                                if (nValue != 1)
  ------------------
  |  Branch (1770:37): [True: 572, False: 1.26k]
  ------------------
 1771|    572|                                {
 1772|    572|                                    len = MakeDecNumber( p, ( int )sizeof( szValue ) - tot_len, h[j - 2], nValue );
 1773|    572|                                }
 1774|  1.26k|                                else
 1775|  1.26k|                                {
 1776|  1.26k|                                    if (( int )sizeof( szValue ) - tot_len > 1)
  ------------------
  |  Branch (1776:41): [True: 1.26k, False: 0]
  ------------------
 1777|  1.26k|                                    {
 1778|  1.26k|                                        strcpy(p, h[j - 2]);
 1779|  1.26k|                                        len = 1;
 1780|  1.26k|                                    }
 1781|      0|                                    else
 1782|      0|                                    {
 1783|      0|                                        len = -1; /*  overflow */
 1784|      0|                                    }
 1785|  1.26k|                                }
 1786|  1.83k|                            }
 1787|  2.39k|                        }
 1788|  6.17k|                        else
 1789|  6.17k|                        {
 1790|  6.17k|                            continue; /*  do not write zeroes */
 1791|  6.17k|                        }
 1792|  8.57k|                    }
 1793|  8.57k|                }
 1794|  4.54k|                if (len < 0)
  ------------------
  |  Branch (1794:21): [True: 0, False: 4.54k]
  ------------------
 1795|      0|                {
 1796|      0|                    bOvfl = 1;
 1797|      0|                    break;
 1798|      0|                }
 1799|  4.54k|                tot_len += len;
 1800|  4.54k|                p += len;
 1801|  4.54k|            }
 1802|  2.14k|            inchi_strbuf_printf( strbuf, "%s", szValue );
 1803|       |            /*if ( nLen+tot_len < nLen_szLinearCT )
 1804|       |            {
 1805|       |                memcpy( szLinearCT+nLen, szValue, tot_len+1 );
 1806|       |                nLen += tot_len;
 1807|       |            }
 1808|       |            else
 1809|       |            {
 1810|       |                bOvfl = 1;
 1811|       |                break;
 1812|       |            }*/
 1813|  2.14k|        }
 1814|    453|    }
 1815|    453|    *bOverflow |= bOvfl;
 1816|       |
 1817|    453|    nLen = strbuf->nUsedLength - nUsedLength0;
 1818|       |
 1819|    453|    return nLen;
 1820|    453|}
MakeIsoHString:
 1949|     74|{
 1950|       |    /*  produce output string; */
 1951|     74|    int nUsedLength0 = 0, nLen = 0, len, tot_len, j, bOvfl = *bOverflow;
 1952|       |    /* djb-rwth: removing redundant variables */
 1953|     74|    char szValue[2048];
 1954|     74|    char *p;
 1955|     74|    int   nValue;
 1956|     74|    int   bAbcNumbers = ( nCtMode & CT_MODE_ABC_NUMBERS );
  ------------------
  |  |   26|     74|#define CT_MODE_ABC_NUMBERS       2
  ------------------
 1957|     74|    static const char letter[] = "tdh";
 1958|     74|    static const char *h[] = { "T", "D", "H" };
 1959|       |
 1960|     74|    nUsedLength0 = strbuf->nUsedLength;
 1961|       |
 1962|       |    /*  add connection table string */
 1963|       |    /* djb-rwth: removing redundant code */
 1964|     74|    if (!bOvfl)
  ------------------
  |  Branch (1964:9): [True: 74, False: 0]
  ------------------
 1965|     74|    {
 1966|     74|        p = szValue;
 1967|     74|        tot_len = 0;
 1968|    296|        for (j = 1; j < 4; j++)
  ------------------
  |  Branch (1968:21): [True: 222, False: 74]
  ------------------
 1969|    222|        {
 1970|    222|            nValue = num_iso_H[NUM_H_ISOTOPES - j];/* j: 1=>T, 2=>D, 3=>1H */
  ------------------
  |  |   25|    222|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
 1971|    222|            if (nValue)
  ------------------
  |  Branch (1971:17): [True: 96, False: 126]
  ------------------
 1972|     96|            {
 1973|     96|                if (bAbcNumbers)
  ------------------
  |  Branch (1973:21): [True: 0, False: 96]
  ------------------
 1974|      0|                {
 1975|      0|                    len = MakeDecNumber( p, ( int )sizeof( szValue ) - tot_len, NULL, nValue );
 1976|      0|                    if (len > 0)
  ------------------
  |  Branch (1976:25): [True: 0, False: 0]
  ------------------
 1977|      0|                    {
 1978|       |                        /*  make sure overflow has not happened */
 1979|      0|                        if (( int )sizeof( szValue ) - tot_len - len > 1)
  ------------------
  |  Branch (1979:29): [True: 0, False: 0]
  ------------------
 1980|      0|                        {
 1981|      0|                            p[len++] = letter[j - 1];
 1982|      0|                            p[len] = '\0';
 1983|      0|                        }
 1984|      0|                        else
 1985|      0|                        {
 1986|      0|                            len = -1; /*  overflow */
 1987|      0|                        }
 1988|      0|                    }
 1989|      0|                }
 1990|     96|                else
 1991|     96|                {
 1992|       |                    /*  hydrogen isotope */
 1993|     96|                    if (nValue != 1)
  ------------------
  |  Branch (1993:25): [True: 44, False: 52]
  ------------------
 1994|     44|                    {
 1995|     44|                        len = MakeDecNumber( p, ( int )sizeof( szValue ) - tot_len, h[j - 1], nValue );
 1996|     44|                    }
 1997|     52|                    else
 1998|     52|                    {
 1999|     52|                        if (( int )sizeof( szValue ) - tot_len > 1)
  ------------------
  |  Branch (1999:29): [True: 52, False: 0]
  ------------------
 2000|     52|                        {
 2001|     52|                            strcpy(p, h[j - 1]);
 2002|     52|                            len = 1;
 2003|     52|                        }
 2004|      0|                        else
 2005|      0|                        {
 2006|      0|                            len = -1; /*  overflow */
 2007|      0|                        }
 2008|     52|                    }
 2009|     96|                }
 2010|     96|            }
 2011|    126|            else
 2012|    126|            {
 2013|    126|                continue; /*  do not write zeroes */
 2014|    126|            }
 2015|     96|            if (len < 0)
  ------------------
  |  Branch (2015:17): [True: 0, False: 96]
  ------------------
 2016|      0|            {
 2017|      0|                bOvfl = 1;
 2018|      0|                break;
 2019|      0|            }
 2020|     96|            p += len;
 2021|     96|            tot_len += len;
 2022|     96|        }
 2023|     74|        inchi_strbuf_printf( strbuf, "%s", szValue );
 2024|       |        /*if ( nLen+tot_len < nLen_szLinearCT ) {
 2025|       |            memcpy( szLinearCT+nLen, szValue, tot_len+1 );
 2026|       |            nLen += tot_len;
 2027|       |        } else {
 2028|       |            bOvfl = 1;
 2029|       |        }*/
 2030|     74|    }
 2031|     74|    *bOverflow |= bOvfl;
 2032|       |
 2033|     74|    nLen = strbuf->nUsedLength - nUsedLength0;
 2034|       |
 2035|     74|    return nLen;
 2036|     74|}
MakeStereoString:
 2048|    907|{
 2049|       |    /*  produce output string; */
 2050|    907|    int nUsedLength0 = 0, nLen = 0, len, tot_len, i, j, bOvfl = *bOverflow;
 2051|    907|    char szValue[2048];
 2052|    907|    char *p;
 2053|    907|    int   nValue;
 2054|    907|    static const char parity_char[] = "!-+u?";
 2055|       |
 2056|    907|    nUsedLength0 = strbuf->nUsedLength;
 2057|    907|    bAddDelim = 0;
 2058|       |
 2059|    907|    if (!bOvfl)
  ------------------
  |  Branch (2059:9): [True: 907, False: 0]
  ------------------
 2060|    907|    {
 2061|  2.26k|        for (i = 0; i < nLenCT/* && nLen < nLen_szLinearCT*/; i++)
  ------------------
  |  Branch (2061:21): [True: 1.35k, False: 907]
  ------------------
 2062|  1.35k|        {
 2063|  1.35k|            p = szValue;
 2064|  1.35k|            tot_len = 0;
 2065|  5.43k|            for (j = 0; j < 3; j++)
  ------------------
  |  Branch (2065:25): [True: 4.07k, False: 1.35k]
  ------------------
 2066|  4.07k|            {
 2067|  4.07k|                if (j == 0 && at1)
  ------------------
  |  Branch (2067:21): [True: 1.35k, False: 2.71k]
  |  Branch (2067:31): [True: 1.35k, False: 0]
  ------------------
 2068|  1.35k|                {
 2069|  1.35k|                    nValue = (int) at1[i];
 2070|  1.35k|                }
 2071|  2.71k|                else
 2072|  2.71k|                {
 2073|  2.71k|                    if (j == 1 && at2)
  ------------------
  |  Branch (2073:25): [True: 1.35k, False: 1.35k]
  |  Branch (2073:35): [True: 670, False: 688]
  ------------------
 2074|    670|                    {
 2075|    670|                        nValue = (int) at2[i];
 2076|    670|                    }
 2077|  2.04k|                    else
 2078|  2.04k|                    {
 2079|  2.04k|                        if (j == 2 && parity)
  ------------------
  |  Branch (2079:29): [True: 1.35k, False: 688]
  |  Branch (2079:39): [True: 1.35k, False: 0]
  ------------------
 2080|  1.35k|                        {
 2081|  1.35k|                            nValue = (int) parity[i];
 2082|  1.35k|                        }
 2083|    688|                        else
 2084|    688|                        {
 2085|    688|                            continue;
 2086|    688|                        }
 2087|  2.04k|                    }
 2088|  2.71k|                }
 2089|  3.38k|                if (nCtMode & CT_MODE_ABC_NUMBERS)
  ------------------
  |  |   26|  3.38k|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (2089:21): [True: 0, False: 3.38k]
  ------------------
 2090|      0|                {
 2091|      0|                    len = ( j == 2 ? MakeDecNumber : MakeAbcNumber )( p, ( int )sizeof( szValue ) - tot_len, NULL, nValue );
  ------------------
  |  Branch (2091:29): [True: 0, False: 0]
  ------------------
 2092|      0|                }
 2093|  3.38k|                else
 2094|  3.38k|                {
 2095|  3.38k|                    if (j < 2)
  ------------------
  |  Branch (2095:25): [True: 2.02k, False: 1.35k]
  ------------------
 2096|  2.02k|                    {
 2097|  2.02k|                        len = MakeDecNumber( p, ( int )sizeof( szValue ) - tot_len, tot_len ? "-" : ( i || bAddDelim ) ? ITEM_DELIMETER : NULL, nValue );
  ------------------
  |  |   17|    451|#define ITEM_DELIMETER    ","
  ------------------
  |  Branch (2097:85): [True: 670, False: 1.35k]
  |  Branch (2097:103): [True: 451, False: 907]
  |  Branch (2097:108): [True: 0, False: 907]
  ------------------
 2098|  2.02k|                    }
 2099|  1.35k|                    else
 2100|  1.35k|                    {
 2101|  1.35k|                        if (tot_len + 1 < ( int )sizeof( szValue ))
  ------------------
  |  Branch (2101:29): [True: 1.35k, False: 0]
  ------------------
 2102|  1.35k|                        {
 2103|  1.35k|                            *p++ = ( 0 <= nValue && nValue <= 4 ) ? parity_char[nValue] : parity_char[0];
  ------------------
  |  Branch (2103:38): [True: 1.35k, False: 0]
  |  Branch (2103:53): [True: 1.35k, False: 0]
  ------------------
 2104|  1.35k|                            *p = '\0';
 2105|  1.35k|                            len = 1;
 2106|  1.35k|                        }
 2107|      0|                        else
 2108|      0|                        {
 2109|      0|                            len = -1; /*  Overflow */
 2110|      0|                        }
 2111|  1.35k|                    }
 2112|  3.38k|                }
 2113|  3.38k|                if (len < 0)
  ------------------
  |  Branch (2113:21): [True: 0, False: 3.38k]
  ------------------
 2114|      0|                {
 2115|      0|                    bOvfl = 1;
 2116|      0|                    break;
 2117|      0|                }
 2118|  3.38k|                p += len;
 2119|  3.38k|                tot_len += len;
 2120|  3.38k|            }
 2121|       |
 2122|  1.35k|            inchi_strbuf_printf( strbuf, "%s", szValue );
 2123|       |            /*
 2124|       |            if ( nLen+tot_len < nLen_szLinearCT ) {
 2125|       |                memcpy(  szLinearCT+nLen, szValue, tot_len+1 );
 2126|       |                nLen += tot_len;
 2127|       |            } else {
 2128|       |                bOvfl = 1;
 2129|       |                break;
 2130|       |            }*/
 2131|  1.35k|        }
 2132|    907|    }
 2133|    907|    *bOverflow |= bOvfl;
 2134|       |
 2135|    907|    nLen = strbuf->nUsedLength - nUsedLength0;
 2136|       |
 2137|    907|    return nLen;
 2138|    907|}
inchi_strtol:
 2553|   372k|{
 2554|   372k|    if (base == ALPHA_BASE) {
  ------------------
  |  |  170|   372k|#define ALPHA_BASE 27
  ------------------
  |  Branch (2554:9): [True: 0, False: 372k]
  ------------------
 2555|      0|        return abctol(str, (char **)p); /* cast deliberately discards const qualifier */
 2556|      0|    }
 2557|   372k|    else {
 2558|   372k|        return strtol(str, (char **)p, base); /* cast deliberately discards const qualifier */
 2559|   372k|    }
 2560|   372k|}
MakeDecNumber:
 2589|  56.9k|{
 2590|  56.9k|#define DECIMAL_BASE     10
 2591|  56.9k|#define DECIMAL_MINUS    '-'
 2592|  56.9k|#define DECIMAL_ZERO_VAL '0'
 2593|  56.9k|#define DECIMAL_ONE      '1'
 2594|  56.9k|#define DECIMAL_ZERO     '0'
 2595|       |
 2596|  56.9k|    char *p = szString;
 2597|  56.9k|    char *q;
 2598|  56.9k|    int  nChar;
 2599|       |
 2600|  56.9k|    if (nStringLen < 2)
  ------------------
  |  Branch (2600:9): [True: 0, False: 56.9k]
  ------------------
 2601|      0|    {
 2602|      0|        return -1;
 2603|      0|    }
 2604|  78.4k|    while (szLeadingDelim && *szLeadingDelim && --nStringLen)
  ------------------
  |  Branch (2604:12): [True: 43.5k, False: 34.9k]
  |  Branch (2604:30): [True: 21.5k, False: 21.9k]
  |  Branch (2604:49): [True: 21.5k, False: 0]
  ------------------
 2605|  21.5k|    {
 2606|  21.5k|        *p++ = *szLeadingDelim++; /* djb-rwth: GCC 14 false positive */
 2607|  21.5k|    }
 2608|  56.9k|    if (nStringLen < 2)
  ------------------
  |  Branch (2608:9): [True: 0, False: 56.9k]
  ------------------
 2609|      0|    {
 2610|      0|        return -1;
 2611|      0|    }
 2612|  56.9k|    if (!nValue)
  ------------------
  |  Branch (2612:9): [True: 39, False: 56.9k]
  ------------------
 2613|     39|    {
 2614|     39|        *p++ = DECIMAL_ZERO_VAL;  /*  zero value (cannot use 0) */
  ------------------
  |  | 2592|     39|#define DECIMAL_ZERO_VAL '0'
  ------------------
 2615|     39|        *p = '\0';
 2616|     39|        return (int) ( p - szString );
 2617|     39|    }
 2618|  56.9k|    if (nValue < 0)
  ------------------
  |  Branch (2618:9): [True: 136, False: 56.7k]
  ------------------
 2619|    136|    {
 2620|    136|        *p++ = DECIMAL_MINUS;
  ------------------
  |  | 2591|    136|#define DECIMAL_MINUS    '-'
  ------------------
 2621|    136|        nStringLen--;
 2622|    136|        nValue = -nValue;
 2623|    136|    }
 2624|   121k|    for (q = p; nValue && --nStringLen; nValue /= DECIMAL_BASE)
  ------------------
  |  | 2590|  64.6k|#define DECIMAL_BASE     10
  ------------------
  |  Branch (2624:17): [True: 64.6k, False: 56.9k]
  |  Branch (2624:27): [True: 64.6k, False: 0]
  ------------------
 2625|  64.6k|    {
 2626|  64.6k|        if ((nChar = nValue % DECIMAL_BASE)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 2590|  64.6k|#define DECIMAL_BASE     10
  ------------------
  |  Branch (2626:13): [True: 63.7k, False: 859]
  ------------------
 2627|  63.7k|        {
 2628|  63.7k|            nChar = DECIMAL_ONE + nChar - 1;
  ------------------
  |  | 2593|  63.7k|#define DECIMAL_ONE      '1'
  ------------------
 2629|  63.7k|        }
 2630|    859|        else
 2631|    859|        {
 2632|    859|            nChar = DECIMAL_ZERO;
  ------------------
  |  | 2594|    859|#define DECIMAL_ZERO     '0'
  ------------------
 2633|    859|        }
 2634|  64.6k|        *q++ = nChar;
 2635|  64.6k|    }
 2636|  56.9k|    if (nStringLen <= 0)
  ------------------
  |  Branch (2636:9): [True: 0, False: 56.9k]
  ------------------
 2637|      0|    {
 2638|      0|        return -1;
 2639|      0|    }
 2640|  56.9k|    *q = '\0';
 2641|  56.9k|    mystrrev( p );
 2642|       |
 2643|  56.9k|    return (int) ( q - szString );
 2644|       |
 2645|  56.9k|#undef DECIMAL_BASE
 2646|  56.9k|#undef DECIMAL_MINUS
 2647|  56.9k|#undef DECIMAL_ZERO_VAL
 2648|  56.9k|#undef DECIMAL_ONE
 2649|  56.9k|#undef DECIMAL_ZERO
 2650|  56.9k|}

str_HillFormula:
   31|  5.02k|{
   32|  5.02k|    int          i, ii, nUsedLength0;
   33|  5.02k|    INCHI_SORT   *is, *is0;
   34|  5.02k|    INChI        *pINChI, *pINChI_Prev;
   35|  5.02k|    int          mult, eq2prev, bNext;
   36|       |
   37|  5.02k|    nUsedLength0 = strbuf->nUsedLength;
   38|       |
   39|  5.02k|    if (!( is0 = pINChISort ))
  ------------------
  |  Branch (39:9): [True: 0, False: 5.02k]
  ------------------
   40|      0|    {
   41|      0|        return nUsedLength0;
   42|      0|    }
   43|  5.02k|    i = 0;
   44|  5.02k|    pINChI_Prev = ( 0 <= ( ii = GET_II( bOutType, is0 ) ) ) ? is0->pINChI[ii] : NULL;
  ------------------
  |  |   45|  5.02k|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|  5.02k|#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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 5.02k]
  |  |  ------------------
  |  |   46|  5.02k|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|  10.0k|#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): \
  |  |  ------------------
  |  |  |  |  583|  10.0k|#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): \
  |  |  ------------------
  |  |  |  |   35|  5.02k|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  5.02k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  5.02k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 5.02k, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 5.02k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|  5.02k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 5.02k]
  |  |  |  Branch (46:36): [True: 5.02k, False: 0]
  |  |  ------------------
  |  |   47|  5.02k|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (44:19): [True: 5.02k, False: 0]
  ------------------
   45|  5.02k|    mult = 0;
   46|  5.02k|    bNext = 0;
   47|       |
   48|       |    /* For each connected component */
   49|   102k|    for (i++; i <= num_components; i++)
  ------------------
  |  Branch (49:15): [True: 97.5k, False: 5.02k]
  ------------------
   50|  97.5k|    {
   51|       |
   52|  97.5k|        pINChI = ( i < num_components &&
  ------------------
  |  Branch (52:20): [True: 92.4k, False: 5.02k]
  ------------------
   53|  92.4k|            ( is = is0 + i, 0 <= ( ii = GET_II( bOutType, is ) ) ) )
  ------------------
  |  |   45|  92.4k|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|  92.4k|#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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 92.4k]
  |  |  ------------------
  |  |   46|  92.4k|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|   184k|#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): \
  |  |  ------------------
  |  |  |  |  583|   184k|#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): \
  |  |  ------------------
  |  |  |  |   35|  92.4k|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  92.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  92.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 92.4k, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 92.4k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|  92.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 92.4k]
  |  |  |  Branch (46:36): [True: 92.4k, False: 0]
  |  |  ------------------
  |  |   47|  92.4k|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (53:13): [True: 92.4k, False: 0]
  ------------------
   54|  97.5k|            ? is->pINChI[ii]
   55|  97.5k|            : NULL;
   56|       |
   57|  97.5k|        eq2prev = bUseMulipliers &&
  ------------------
  |  Branch (57:19): [True: 97.5k, False: 0]
  ------------------
   58|  97.5k|            pINChI &&
  ------------------
  |  Branch (58:13): [True: 92.4k, False: 5.02k]
  ------------------
   59|  92.4k|            pINChI_Prev &&
  ------------------
  |  Branch (59:13): [True: 92.4k, False: 0]
  ------------------
   60|  92.4k|            pINChI->szHillFormula &&
  ------------------
  |  Branch (60:13): [True: 57.6k, False: 34.8k]
  ------------------
   61|  57.6k|            pINChI_Prev->szHillFormula &&
  ------------------
  |  Branch (61:13): [True: 57.5k, False: 37]
  ------------------
   62|  57.5k|            pINChI->szHillFormula[0] &&
  ------------------
  |  Branch (62:13): [True: 57.5k, False: 0]
  ------------------
   63|  57.5k|            !strcmp( pINChI_Prev->szHillFormula, pINChI->szHillFormula );
  ------------------
  |  Branch (63:13): [True: 56.5k, False: 1.00k]
  ------------------
   64|       |
   65|  97.5k|        if (eq2prev)
  ------------------
  |  Branch (65:13): [True: 56.5k, False: 40.9k]
  ------------------
   66|  56.5k|        {
   67|  56.5k|            mult++; /* mult = (number of non-empty equal items)-1 */
   68|  56.5k|            continue;
   69|  56.5k|        }
   70|  40.9k|        else
   71|  40.9k|        {
   72|  40.9k|            int ok;
   73|  40.9k|            if (bNext++)
  ------------------
  |  Branch (73:17): [True: 35.8k, False: 5.02k]
  ------------------
   74|  35.8k|            {
   75|  35.8k|                MakeDelim( ".", strbuf, bOverflow );
   76|  35.8k|            }
   77|       |
   78|  40.9k|            ok = pINChI_Prev &&
  ------------------
  |  Branch (78:18): [True: 40.9k, False: 0]
  ------------------
   79|  40.9k|                pINChI_Prev->szHillFormula &&
  ------------------
  |  Branch (79:17): [True: 5.62k, False: 35.2k]
  ------------------
   80|  5.62k|                pINChI_Prev->szHillFormula[0];
  ------------------
  |  Branch (80:17): [True: 5.62k, False: 0]
  ------------------
   81|       |
   82|  40.9k|            if (ok)
  ------------------
  |  Branch (82:17): [True: 5.62k, False: 35.2k]
  ------------------
   83|  5.62k|            {
   84|  5.62k|                MakeMult( mult + 1, "", strbuf, 0, bOverflow );
   85|  5.62k|                MakeHillFormulaString( pINChI_Prev->szHillFormula,
   86|  5.62k|                    strbuf,
   87|  5.62k|                    bOverflow );
   88|  5.62k|            }
   89|  40.9k|        }
   90|  40.9k|        pINChI_Prev = pINChI;
   91|  40.9k|        mult = 0; /* we do not know whether the item is empty */
   92|  40.9k|    }
   93|       |
   94|  5.02k|    return ( strbuf->nUsedLength - nUsedLength0 );
   95|  5.02k|}
str_Connections:
  197|  5.02k|{
  198|  5.02k|    int          i, ii, nUsedLength0;
  199|  5.02k|    INCHI_SORT   *is, *is0;
  200|  5.02k|    INChI        *pINChI, *pINChI_Prev;
  201|  5.02k|    int          mult, eq2prev, bNext, nNumEmpty;
  202|       |
  203|  5.02k|    nUsedLength0 = strbuf->nUsedLength;
  204|  5.02k|    if (!( is0 = pINChISort ))
  ------------------
  |  Branch (204:9): [True: 0, False: 5.02k]
  ------------------
  205|      0|    {
  206|      0|        return nUsedLength0;
  207|      0|    }
  208|  5.02k|    i = 0;
  209|  5.02k|    pINChI_Prev = ( 0 <= ( ii = GET_II( bOutType, is0 ) ) ) ? is0->pINChI[ii] : NULL;
  ------------------
  |  |   45|  5.02k|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|  5.02k|#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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 5.02k]
  |  |  ------------------
  |  |   46|  5.02k|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|  10.0k|#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): \
  |  |  ------------------
  |  |  |  |  583|  10.0k|#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): \
  |  |  ------------------
  |  |  |  |   35|  5.02k|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  5.02k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  5.02k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 5.02k, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 5.02k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|  5.02k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 5.02k]
  |  |  |  Branch (46:36): [True: 5.02k, False: 0]
  |  |  ------------------
  |  |   47|  5.02k|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (209:19): [True: 5.02k, False: 0]
  ------------------
  210|  5.02k|    is = NULL;
  211|  5.02k|    mult = 0;
  212|  5.02k|    bNext = 0;
  213|  5.02k|    nNumEmpty = 0;
  214|       |
  215|       |    /* For each connected component...    */
  216|   102k|    for (i++; i <= num_components; i++)
  ------------------
  |  Branch (216:15): [True: 97.5k, False: 5.02k]
  ------------------
  217|  97.5k|    {
  218|  97.5k|        pINChI = ( i < num_components && ( is = is0 + i, 0 <= ( ii = GET_II( bOutType, is ) ) ) ) ? is->pINChI[ii] : NULL;
  ------------------
  |  |   45|  92.4k|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|  92.4k|#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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 92.4k]
  |  |  ------------------
  |  |   46|  92.4k|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|   184k|#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): \
  |  |  ------------------
  |  |  |  |  583|   184k|#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): \
  |  |  ------------------
  |  |  |  |   35|  92.4k|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  92.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  92.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 92.4k, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 92.4k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|  92.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 92.4k]
  |  |  |  Branch (46:36): [True: 92.4k, False: 0]
  |  |  ------------------
  |  |   47|  92.4k|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (218:20): [True: 92.4k, False: 5.02k]
  |  Branch (218:42): [True: 92.4k, False: 0]
  ------------------
  219|  97.5k|        eq2prev = bUseMulipliers                                &&
  ------------------
  |  Branch (219:19): [True: 97.5k, False: 0]
  ------------------
  220|  97.5k|            pINChI && pINChI_Prev && pINChI->lenConnTable > 1   &&
  ------------------
  |  Branch (220:13): [True: 92.4k, False: 5.02k]
  |  Branch (220:23): [True: 92.4k, False: 0]
  |  Branch (220:38): [True: 30.0k, False: 62.4k]
  ------------------
  221|  30.0k|            pINChI_Prev->lenConnTable == pINChI->lenConnTable   &&
  ------------------
  |  Branch (221:13): [True: 29.9k, False: 36]
  ------------------
  222|  29.9k|            !memcmp( pINChI_Prev->nConnTable, pINChI->nConnTable,
  ------------------
  |  Branch (222:13): [True: 29.9k, False: 23]
  ------------------
  223|  29.9k|                pINChI_Prev->lenConnTable * sizeof( pINChI->nConnTable[0] ) );
  224|  97.5k|        if (eq2prev)
  ------------------
  |  Branch (224:13): [True: 29.9k, False: 67.5k]
  ------------------
  225|  29.9k|        {
  226|  29.9k|            mult++; /* mult = (number of non-empty equal items)-1 */
  227|  29.9k|            continue;
  228|  29.9k|        }
  229|  67.5k|        else
  230|  67.5k|        {
  231|  67.5k|            if (pINChI_Prev)
  ------------------
  |  Branch (231:17): [True: 67.5k, False: 0]
  ------------------
  232|  67.5k|            {
  233|  67.5k|                if (bNext++)
  ------------------
  |  Branch (233:21): [True: 62.5k, False: 5.02k]
  ------------------
  234|  62.5k|                {
  235|  62.5k|                    MakeDelim( sCompDelim, strbuf, bOverflow );
  236|  62.5k|                }
  237|  67.5k|                if (pINChI_Prev && pINChI_Prev->lenConnTable > 1)
  ------------------
  |  Branch (237:21): [True: 67.5k, False: 0]
  |  Branch (237:36): [True: 4.30k, False: 63.2k]
  ------------------
  238|  4.30k|                {
  239|  4.30k|                    MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
  240|  4.30k|                    MakeCtStringNew( pCG, pINChI_Prev->nConnTable,
  241|  4.30k|                        pINChI_Prev->lenConnTable,
  242|  4.30k|                        0, NULL,
  243|  4.30k|                        pINChI_Prev->nNumberOfAtoms,
  244|  4.30k|                        strbuf, ATOM_MODE, bOverflow );
  245|  4.30k|                }
  246|  63.2k|                else
  247|  63.2k|                {
  248|  63.2k|                    nNumEmpty++;
  249|  63.2k|                }
  250|  67.5k|            }
  251|  67.5k|        }
  252|  67.5k|        pINChI_Prev = pINChI;
  253|  67.5k|        mult = 0; /* we do not know whether the item is empty */
  254|  67.5k|    }
  255|  5.02k|    if (nNumEmpty == num_components && strbuf->nUsedLength > nUsedLength0)
  ------------------
  |  Branch (255:9): [True: 780, False: 4.24k]
  |  Branch (255:40): [True: 317, False: 463]
  ------------------
  256|    317|    {
  257|    317|        strbuf->nUsedLength = nUsedLength0;
  258|    317|        strbuf->pStr[strbuf->nUsedLength] = '\0';
  259|    317|    }
  260|       |    /*
  261|       |    if ( nNumEmpty == num_components && tot_len > tot_len_inp ) {
  262|       |    tot_len = tot_len_inp;
  263|       |    strbuf->pStr[tot_len] = '\0';
  264|       |    }
  265|       |    */
  266|       |
  267|  5.02k|    return ( strbuf->nUsedLength - nUsedLength0 );
  268|  5.02k|}
str_H_atoms:
  282|  1.86k|{
  283|  1.86k|    int          i, j, ii, len_H, nUsedLength0;
  284|  1.86k|    INCHI_SORT   *is, *is0;
  285|  1.86k|    INChI        *pINChI, *pINChI_Prev;
  286|  1.86k|    int          mult, eq2prev, bNext, bNotEmpty, nNumEmpty;
  287|       |
  288|  1.86k|    nNumEmpty = 0;
  289|  1.86k|    is0 = pINChISort;
  290|  1.86k|    is = NULL;
  291|  1.86k|    i = 0;
  292|  1.86k|    pINChI_Prev = ( 0 <= ( ii = GET_II( bOutType, is0 ) ) ) ? is0->pINChI[ii] : NULL;
  ------------------
  |  |   45|  1.86k|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|  1.86k|#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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 1.86k]
  |  |  ------------------
  |  |   46|  1.86k|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|  3.73k|#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): \
  |  |  ------------------
  |  |  |  |  583|  3.73k|#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): \
  |  |  ------------------
  |  |  |  |   35|  1.86k|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  1.86k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|  1.86k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 1.86k, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 1.86k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|  1.86k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 1.86k]
  |  |  |  Branch (46:36): [True: 1.86k, False: 0]
  |  |  ------------------
  |  |   47|  1.86k|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (292:19): [True: 1.86k, False: 0]
  ------------------
  293|  1.86k|    mult = 0;
  294|  1.86k|    bNext = 0;
  295|  1.86k|    nUsedLength0 = strbuf->nUsedLength;
  296|       |
  297|       |    /* For each connected component...    */
  298|  3.81k|    for (i++; i <= num_components; i++)
  ------------------
  |  Branch (298:15): [True: 1.94k, False: 1.86k]
  ------------------
  299|  1.94k|    {
  300|       |
  301|  1.94k|        pINChI = ( i < num_components && ( is = is0 + i, 0 <= ( ii = GET_II( bOutType, is ) ) ) ) ? is->pINChI[ii] : NULL;
  ------------------
  |  |   45|     79|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|     79|#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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 79]
  |  |  ------------------
  |  |   46|     79|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|    158|#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): \
  |  |  ------------------
  |  |  |  |  583|    158|#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): \
  |  |  ------------------
  |  |  |  |   35|     79|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|     79|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|     79|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 79, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 79, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|     79|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 79]
  |  |  |  Branch (46:36): [True: 79, False: 0]
  |  |  ------------------
  |  |   47|     79|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (301:20): [True: 79, False: 1.86k]
  |  Branch (301:42): [True: 79, False: 0]
  ------------------
  302|       |        /*========== compare to previous ============*/
  303|  1.94k|        eq2prev = bUseMulipliers &&
  ------------------
  |  Branch (303:19): [True: 1.94k, False: 0]
  ------------------
  304|  1.94k|            pINChI && pINChI_Prev && ( pINChI->nNumberOfAtoms > 0 || pINChI->lenTautomer > 1 ) &&
  ------------------
  |  Branch (304:13): [True: 79, False: 1.86k]
  |  Branch (304:23): [True: 79, False: 0]
  |  Branch (304:40): [True: 79, False: 0]
  |  Branch (304:70): [True: 0, False: 0]
  ------------------
  305|     79|            pINChI_Prev->nNumberOfAtoms == pINChI->nNumberOfAtoms &&
  ------------------
  |  Branch (305:13): [True: 78, False: 1]
  ------------------
  306|     78|            ( !pINChI_Prev->nNumberOfAtoms || !memcmp( pINChI_Prev->nNum_H, pINChI->nNum_H,
  ------------------
  |  Branch (306:15): [True: 0, False: 78]
  |  Branch (306:47): [True: 78, False: 0]
  ------------------
  307|     78|                pINChI_Prev->nNumberOfAtoms * sizeof( pINChI->nNum_H[0] ) ) ) &&
  308|     78|            !CompareTautNonIsoPartOfINChI( pINChI_Prev, pINChI );
  ------------------
  |  Branch (308:13): [True: 78, False: 0]
  ------------------
  309|       |
  310|  1.94k|        if (eq2prev && pINChI_Prev->lenTautomer <= 1)
  ------------------
  |  Branch (310:13): [True: 78, False: 1.86k]
  |  Branch (310:24): [True: 1, False: 77]
  ------------------
  311|      1|        {
  312|       |            /* make sure it is not empty */
  313|      1|            eq2prev = 0;
  314|     12|            for (j = 0; j < pINChI_Prev->nNumberOfAtoms; j++)
  ------------------
  |  Branch (314:25): [True: 11, False: 1]
  ------------------
  315|     11|            {
  316|     11|                if (pINChI_Prev->nNum_H[j])
  ------------------
  |  Branch (316:21): [True: 0, False: 11]
  ------------------
  317|      0|                {
  318|      0|                    eq2prev = 1;
  319|      0|                    break;
  320|      0|                }
  321|     11|            }
  322|      1|        }
  323|  1.94k|        if (eq2prev)
  ------------------
  |  Branch (323:13): [True: 77, False: 1.86k]
  ------------------
  324|     77|        {
  325|     77|            mult++; /* mult = (number of non-empty equal items)-1 */
  326|     77|            continue;
  327|     77|        }
  328|  1.86k|        else
  329|  1.86k|        {
  330|  1.86k|            if (pINChI_Prev)
  ------------------
  |  Branch (330:17): [True: 1.86k, False: 0]
  ------------------
  331|  1.86k|            {
  332|       |                /* delimiter */
  333|  1.86k|                if (bNext++)
  ------------------
  |  Branch (333:21): [True: 2, False: 1.86k]
  ------------------
  334|      2|                {
  335|      2|                    MakeDelim( sCompDelim, strbuf, bOverflow );
  336|      2|                }
  337|       |                /* verify non-empty */
  338|  1.86k|                bNotEmpty = 0;
  339|  1.86k|                if (pINChI_Prev)
  ------------------
  |  Branch (339:21): [True: 1.86k, False: 0]
  ------------------
  340|  1.86k|                {
  341|  1.86k|                    bNotEmpty = ( pINChI_Prev->lenTautomer > 1 );
  342|  1.86k|                    if (!bNotEmpty)
  ------------------
  |  Branch (342:25): [True: 706, False: 1.16k]
  ------------------
  343|    706|                    {
  344|  2.47k|                        for (j = 0; j < pINChI_Prev->nNumberOfAtoms; j++)
  ------------------
  |  Branch (344:37): [True: 2.47k, False: 2]
  ------------------
  345|  2.47k|                        {
  346|  2.47k|                            if (pINChI_Prev->nNum_H[j])
  ------------------
  |  Branch (346:33): [True: 704, False: 1.76k]
  ------------------
  347|    704|                            {
  348|    704|                                bNotEmpty = 1;
  349|    704|                                break;
  350|    704|                            }
  351|  2.47k|                        }
  352|    706|                    }
  353|  1.86k|                }
  354|  1.86k|                if (bNotEmpty)
  ------------------
  |  Branch (354:21): [True: 1.86k, False: 2]
  ------------------
  355|  1.86k|                {
  356|  1.86k|                    MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
  357|       |                    /* H-atoms */
  358|  1.86k|                    len_H = MakeHString( 0, pINChI_Prev->nNum_H, pINChI_Prev->nNumberOfAtoms,
  359|  1.86k|                        strbuf, ATOM_MODE, bOverflow );
  360|       |                    /*  tautomeric groups */
  361|  1.86k|                    MakeTautString( pINChI_Prev->nTautomer, pINChI_Prev->lenTautomer, ( 0 != len_H ),
  362|  1.86k|                        strbuf, TAUT_MODE, bOverflow );
  363|  1.86k|                }
  364|      2|                else
  365|      2|                {
  366|      2|                    nNumEmpty++;
  367|      2|                }
  368|  1.86k|            }
  369|  1.86k|        }
  370|  1.86k|        pINChI_Prev = pINChI;
  371|  1.86k|        mult = 0; /* we do not know whether the item is empty */
  372|  1.86k|    }
  373|  1.86k|    if (nNumEmpty == num_components && strbuf->nUsedLength > nUsedLength0)
  ------------------
  |  Branch (373:9): [True: 0, False: 1.86k]
  |  Branch (373:40): [True: 0, False: 0]
  ------------------
  374|      0|    {
  375|      0|        strbuf->nUsedLength = nUsedLength0;
  376|      0|        strbuf->pStr[nUsedLength0] = '\0';
  377|      0|    }
  378|       |    /*
  379|       |    if ( nNumEmpty == num_components && tot_len > tot_len_inp ) {
  380|       |    tot_len = tot_len_inp;
  381|       |    strbuf->pStr[tot_len] = '\0';
  382|       |    }
  383|       |    */
  384|       |
  385|  1.86k|    return ( strbuf->nUsedLength - nUsedLength0 );
  386|  1.86k|}
str_Charge2:
  401|    243|{
  402|    243|    int          i, ii, ii2, nUsedLength0;
  403|    243|    INCHI_SORT   *is, *is2, *is0, *is20;
  404|    243|    INChI        *pINChI, *pINChI_Prev, *pINChI_Taut, *pINChI_Taut_Prev;
  405|    243|    int         nTotalCharge, nTotalCharge_Prev, nTotalCharge_Taut; /* djb-rwth: removing redundant variables */
  406|    243|    int          mult, eq2prev, eq2taut, eq2tautPrev, bNext;
  407|    243|    const char  *pPrevEquStr, *pCurrEquStr;
  408|    243|    int         multPrevEquStr;
  409|    243|    pINChI_Taut = NULL;
  410|    243|    pINChI_Prev = NULL;
  411|    243|    pINChI_Taut_Prev = NULL;
  412|    243|    mult = 0;
  413|    243|    bNext = 0;
  414|    243|    is = NULL;
  415|    243|    is2 = NULL;
  416|    243|    is0 = pINChISort;
  417|    243|    is20 = bSecondNonTautPass ? pINChISort2 : NULL;
  ------------------
  |  Branch (417:12): [True: 0, False: 243]
  ------------------
  418|       |    /* djb-rwth: removing redundant code */
  419|    243|    eq2tautPrev = 1; /* pINChI_Prev (previous pINChI) does not exist */
  420|    243|    pPrevEquStr = NULL; /*, *pCurrEquStr;*/
  421|    243|    multPrevEquStr = 0;
  422|    243|    nUsedLength0 = strbuf->nUsedLength;
  423|       |
  424|       |    /* For each connected component...    */
  425|    740|    for (i = 0; i <= num_components; i++)
  ------------------
  |  Branch (425:17): [True: 497, False: 243]
  ------------------
  426|    497|    {
  427|       |
  428|       |        /* 1st (taut) pass: bOutType=OUT_TN  ; 2nd (non-taut pass) bOutType=OUT_NT */
  429|    497|        pINChI = ( i < num_components && ( is = is0 + i, 0 <= ( ii = GET_II( bOutType, is ) ) ) ) ? is->pINChI[ii] : NULL;
  ------------------
  |  |   45|    254|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|    254|#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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 254]
  |  |  ------------------
  |  |   46|    254|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|    508|#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): \
  |  |  ------------------
  |  |  |  |  583|    508|#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): \
  |  |  ------------------
  |  |  |  |   35|    254|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|    254|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|    254|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 254, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 254, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|    254|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 254]
  |  |  |  Branch (46:36): [True: 254, False: 0]
  |  |  ------------------
  |  |   47|    254|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (429:20): [True: 254, False: 243]
  |  Branch (429:42): [True: 254, False: 0]
  ------------------
  430|       |        /*================ compare sp3 to previous =====================*/
  431|    497|        if (bSecondNonTautPass)
  ------------------
  |  Branch (431:13): [True: 0, False: 497]
  ------------------
  432|      0|        {
  433|       |            /* component that was output on the 1st pass */
  434|      0|            pINChI_Taut = ( i < num_components && ( is2 = is20 + i, 0 <= ( ii2 = GET_II( OUT_T1, is2 ) ) ) ) ? is2->pINChI[ii2] : NULL;
  ------------------
  |  |   45|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [Folded, False: 0]
  |  |  ------------------
  |  |   46|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|      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): \
  |  |  ------------------
  |  |  |  |  583|      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): \
  |  |  ------------------
  |  |  |  |   35|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, Folded]
  |  |  |  Branch (46:36): [Folded, False: 0]
  |  |  ------------------
  |  |   47|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [Folded, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (434:29): [True: 0, False: 0]
  |  Branch (434:51): [True: 0, False: 0]
  ------------------
  435|      0|        }
  436|       |        /*========= if bSecondNonTautPass then compare non-iso non-taut stereo to non-iso taut ========*/
  437|    497|        eq2taut = 0;
  438|    497|        if (!eq2taut && bSecondNonTautPass && bOmitRepetitions)
  ------------------
  |  Branch (438:13): [True: 497, False: 0]
  |  Branch (438:25): [True: 0, False: 497]
  |  Branch (438:47): [True: 0, False: 0]
  ------------------
  439|      0|        {
  440|      0|            eq2taut = pINChI && pINChI_Taut && !pINChI_Taut->bDeleted &&
  ------------------
  |  Branch (440:23): [True: 0, False: 0]
  |  Branch (440:33): [True: 0, False: 0]
  |  Branch (440:48): [True: 0, False: 0]
  ------------------
  441|      0|                ( nTotalCharge = pINChI->nTotalCharge ) && ( nTotalCharge_Taut = pINChI_Taut->nTotalCharge ) &&
  ------------------
  |  Branch (441:17): [True: 0, False: 0]
  |  Branch (441:60): [True: 0, False: 0]
  ------------------
  442|      0|                nTotalCharge == nTotalCharge_Taut;
  ------------------
  |  Branch (442:17): [True: 0, False: 0]
  ------------------
  443|      0|            eq2taut = eq2taut ? ( iiEQU | iitNONTAUT ) : 0;
  ------------------
  |  |   58|      0|#define iiEQU         0x0008  /* equivalence info */
  ------------------
                          eq2taut = eq2taut ? ( iiEQU | iitNONTAUT ) : 0;
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
  |  Branch (443:23): [True: 0, False: 0]
  ------------------
  444|      0|        }
  445|    497|        if (eq2taut)
  ------------------
  |  Branch (445:13): [True: 0, False: 497]
  ------------------
  446|      0|        {
  447|       |            /* we may be here only in case of the second (non-taut) pass */
  448|       |            /* current non-taut stereo has been found to be same as tautomeric */
  449|      0|            if (pINChI_Prev && pINChI_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (449:17): [True: 0, False: 0]
  |  Branch (449:32): [True: 0, False: 0]
  ------------------
  450|      0|            {
  451|       |                /* previous component exists; output it */
  452|      0|                if (bNext++)
  ------------------
  |  Branch (452:21): [True: 0, False: 0]
  ------------------
  453|      0|                {
  454|      0|                    MakeDelim( sCompDelim, strbuf, bOverflow );
  455|      0|                }
  456|      0|                if ((nTotalCharge_Prev = pINChI_Prev->nTotalCharge)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (456:21): [True: 0, False: 0]
  ------------------
  457|      0|                {
  458|      0|                    MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
  459|      0|                    inchi_strbuf_printf( strbuf, "%+d", nTotalCharge_Prev );
  460|      0|                }
  461|      0|            }
  462|      0|            else
  463|      0|            {
  464|      0|                if (pINChI_Taut_Prev && pINChI_Taut_Prev->nNumberOfAtoms && !pINChI_Taut_Prev->bDeleted)
  ------------------
  |  Branch (464:21): [True: 0, False: 0]
  |  Branch (464:41): [True: 0, False: 0]
  |  Branch (464:77): [True: 0, False: 0]
  ------------------
  465|      0|                {
  466|       |                    /* previous non-taut component exists only in taut list */
  467|      0|                    if (bNext++)
  ------------------
  |  Branch (467:25): [True: 0, False: 0]
  ------------------
  468|      0|                    {
  469|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
  470|      0|                    }
  471|      0|                }
  472|      0|            }
  473|       |            /* we have found pINChI->nTotalCharge same as in pINChI_Taut */
  474|       |            /* output this (current) equivalence as '*', that is, same as tautomeric */
  475|       |            /* that was printed on the 1st pass. */
  476|       |
  477|      0|            pCurrEquStr = EquString( eq2taut );
  478|      0|            if (multPrevEquStr && pPrevEquStr)
  ------------------
  |  Branch (478:17): [True: 0, False: 0]
  |  Branch (478:35): [True: 0, False: 0]
  ------------------
  479|      0|            {
  480|      0|                if (pCurrEquStr && !strcmp( pCurrEquStr, pPrevEquStr ))
  ------------------
  |  Branch (480:21): [True: 0, False: 0]
  |  Branch (480:36): [True: 0, False: 0]
  ------------------
  481|      0|                {
  482|      0|                    multPrevEquStr++;
  483|      0|                }
  484|      0|                else
  485|      0|                {
  486|       |                    /* new EqStr is different; output it */
  487|      0|                    if (bNext++)
  ------------------
  |  Branch (487:25): [True: 0, False: 0]
  ------------------
  488|      0|                    {
  489|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
  490|      0|                    }
  491|      0|                    MakeEqStr( pPrevEquStr, multPrevEquStr, strbuf, bOverflow );
  492|      0|                    pPrevEquStr = pCurrEquStr;
  493|      0|                    multPrevEquStr = 1;
  494|      0|                }
  495|      0|            }
  496|      0|            else
  497|      0|            {
  498|      0|                pPrevEquStr = pCurrEquStr;
  499|      0|                multPrevEquStr = 1;
  500|      0|            }
  501|       |
  502|      0|            pINChI_Prev = NULL; /* pINChI_Prev sp2 does not exist since */
  503|      0|            pINChI_Taut_Prev = NULL; /* pINChI has just been printed */
  504|      0|            mult = 0;
  505|      0|            eq2tautPrev = 1;     /* pINChI_Prev sp2 does not exist */
  506|      0|        }
  507|    497|        else
  508|    497|        {
  509|    497|            if (eq2tautPrev)
  ------------------
  |  Branch (509:17): [True: 243, False: 254]
  ------------------
  510|    243|            {
  511|       |                /* at this point pINChI_Prev does not exist; however, pINChI */
  512|       |                /*might have been discovered and it is different from pINChI_Taut */
  513|    243|                if (multPrevEquStr && pPrevEquStr)
  ------------------
  |  Branch (513:21): [True: 0, False: 243]
  |  Branch (513:39): [True: 0, False: 0]
  ------------------
  514|      0|                {
  515|       |                    /* new EqStr is different; output it */
  516|      0|                    if (bNext++)
  ------------------
  |  Branch (516:25): [True: 0, False: 0]
  ------------------
  517|      0|                    {
  518|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
  519|      0|                    }
  520|      0|                    MakeEqStr( pPrevEquStr, multPrevEquStr, strbuf, bOverflow );
  521|      0|                    pPrevEquStr = NULL;
  522|      0|                    multPrevEquStr = 0;
  523|      0|                }
  524|    243|                eq2tautPrev = 0;
  525|    243|                pINChI_Prev = pINChI;
  526|    243|                pINChI_Taut_Prev = pINChI_Taut;
  527|    243|                mult = 0;
  528|    243|            }
  529|    254|            else
  530|    254|            {
  531|       |                /* check whether pINChI and pINChI_Prev have non-zero identical stereo sp3 */
  532|       |                /*================ compare sp3 to previous =====================*/
  533|    254|                eq2prev = bUseMulipliers &&
  ------------------
  |  Branch (533:27): [True: 254, False: 0]
  ------------------
  534|    254|                    pINChI && pINChI_Prev &&
  ------------------
  |  Branch (534:21): [True: 11, False: 243]
  |  Branch (534:31): [True: 11, False: 0]
  ------------------
  535|     11|                    ( nTotalCharge = pINChI->nTotalCharge ) && ( nTotalCharge_Prev = pINChI_Prev->nTotalCharge ) &&
  ------------------
  |  Branch (535:21): [True: 11, False: 0]
  |  Branch (535:64): [True: 10, False: 1]
  ------------------
  536|     10|                    nTotalCharge == nTotalCharge_Prev;
  ------------------
  |  Branch (536:21): [True: 7, False: 3]
  ------------------
  537|    254|                if (eq2prev)
  ------------------
  |  Branch (537:21): [True: 7, False: 247]
  ------------------
  538|      7|                {
  539|      7|                    mult++; /* mult = (number of non-empty equal items)-1 */
  540|      7|                    continue;
  541|      7|                }
  542|    247|                else
  543|    247|                {
  544|    247|                    if (bNext++)
  ------------------
  |  Branch (544:25): [True: 4, False: 243]
  ------------------
  545|      4|                    {
  546|      4|                        MakeDelim( sCompDelim, strbuf, bOverflow );
  547|      4|                    }
  548|    247|                    if (pINChI_Prev && pINChI_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (548:25): [True: 247, False: 0]
  |  Branch (548:40): [True: 247, False: 0]
  ------------------
  549|    247|                    {
  550|    247|                        if ((nTotalCharge_Prev = pINChI_Prev->nTotalCharge)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (550:29): [True: 246, False: 1]
  ------------------
  551|    246|                        {
  552|       |                            /* pINChI_Prev exists and has charge info */
  553|    246|                            MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
  554|    246|                            inchi_strbuf_printf( strbuf, "%+d", nTotalCharge_Prev );
  555|    246|                        }
  556|       |                        /* else charge is not present in pINChI_Prev */
  557|    247|                    }
  558|      0|                    else
  559|      0|                    {
  560|       |                        /* djb-rwth: removing redundant code */
  561|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
  562|       |                        if (!(bSecondNonTautPass && pINChI_Taut_Prev && pINChI_Taut_Prev->nNumberOfAtoms && !pINChI_Taut_Prev->bDeleted))
  563|       |                        {
  564|       |                            int stop = 1;   /* <BRKPT> */
  565|       |                        }
  566|       |#endif
  567|      0|                    }
  568|    247|                }
  569|    247|                pINChI_Prev = pINChI;
  570|    247|                pINChI_Taut_Prev = pINChI_Taut;
  571|    247|                mult = 0; /* we do not know whether the item is empty */
  572|    247|            }
  573|    497|        }
  574|    497|    }
  575|       |
  576|    243|    return ( strbuf->nUsedLength - nUsedLength0 );
  577|    243|}
str_Sp2:
  711|    410|{
  712|    410|    int          i, ii, ii2, nUsedLength0;
  713|    410|    INCHI_SORT   *is, *is2, *is0, *is20;
  714|    410|    INChI        *pINChI, *pINChI_Prev, *pINChI_Taut, *pINChI_Taut_Prev;
  715|    410|    INChI_Stereo *Stereo, *Stereo_Prev, *Stereo_Taut, *Stereo_Taut_Prev;
  716|    410|    int          mult, eq2prev, eq2taut, eq2tautPrev, bNext;
  717|    410|    const char  *pPrevEquStr, *pCurrEquStr;
  718|    410|    int         multPrevEquStr;
  719|       |
  720|    410|    pINChI_Taut = NULL;
  721|    410|    pINChI_Prev = NULL;
  722|    410|    pINChI_Taut_Prev = NULL;
  723|    410|    mult = 0;
  724|    410|    bNext = 0;
  725|    410|    is = NULL;
  726|    410|    is2 = NULL;
  727|    410|    is0 = pINChISort;
  728|    410|    is20 = bSecondNonTautPass ? pINChISort2 : NULL;
  ------------------
  |  Branch (728:12): [True: 0, False: 410]
  ------------------
  729|       |    /* djb-rwth: removing redundant code */
  730|    410|    eq2tautPrev = 1; /* pINChI_Prev (previous pINChI) does not exist */
  731|    410|    pPrevEquStr = NULL; /*, *pCurrEquStr;*/
  732|    410|    multPrevEquStr = 0;
  733|    410|    nUsedLength0 = strbuf->nUsedLength;
  734|       |
  735|       |    /* For each connected component ... */
  736|  1.23k|    for (i = 0; i <= num_components; i++)
  ------------------
  |  Branch (736:17): [True: 821, False: 410]
  ------------------
  737|    821|    {
  738|       |
  739|       |        /* 1st (taut) pass: bOutType=OUT_TN  ; 2nd (non-taut pass) bOutType=OUT_NT */
  740|    821|        pINChI = ( i < num_components && ( is = is0 + i, 0 <= ( ii = GET_II( bOutType, is ) ) ) ) ? is->pINChI[ii] : NULL;
  ------------------
  |  |   45|    411|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|    411|#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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 411]
  |  |  ------------------
  |  |   46|    411|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|    822|#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): \
  |  |  ------------------
  |  |  |  |  583|    822|#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): \
  |  |  ------------------
  |  |  |  |   35|    411|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|    411|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|    411|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 411, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 411, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|    411|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 411]
  |  |  |  Branch (46:36): [True: 411, False: 0]
  |  |  ------------------
  |  |   47|    411|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (740:20): [True: 411, False: 410]
  |  Branch (740:42): [True: 411, False: 0]
  ------------------
  741|       |        /*================ compare sp2 to previous =====================*/
  742|    821|        if (bSecondNonTautPass)
  ------------------
  |  Branch (742:13): [True: 0, False: 821]
  ------------------
  743|      0|        {
  744|       |            /* component that was output on the 1st pass */
  745|      0|            pINChI_Taut = ( i < num_components && ( is2 = is20 + i, 0 <= ( ii2 = GET_II( OUT_T1, is2 ) ) ) ) ? is2->pINChI[ii2] : NULL;
  ------------------
  |  |   45|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [Folded, False: 0]
  |  |  ------------------
  |  |   46|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|      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): \
  |  |  ------------------
  |  |  |  |  583|      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): \
  |  |  ------------------
  |  |  |  |   35|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, Folded]
  |  |  |  Branch (46:36): [Folded, False: 0]
  |  |  ------------------
  |  |   47|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [Folded, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (745:29): [True: 0, False: 0]
  |  Branch (745:51): [True: 0, False: 0]
  ------------------
  746|      0|        }
  747|       |        /*========= if bSecondNonTautPass then compare non-iso non-taut stereo to non-iso taut ========*/
  748|    821|        eq2taut = 0;
  749|       |#if ( FIX_EMPTY_LAYER_BUG == 1 )
  750|       |        if (!eq2taut && bSecondNonTautPass && bOmitRepetitions && pINChI && pINChI_Taut)
  751|       |        {
  752|       |            Stereo = pINChI->Stereo;
  753|       |            Stereo_Taut = pINChI_Taut->Stereo;
  754|       |            eq2taut = Stereo && Stereo_Taut &&
  755|       |                Eql_INChI_Stereo( Stereo, EQL_SP2, Stereo_Taut, EQL_SP2, 0 );
  756|       |            eq2taut = eq2taut ? ( iiSTEREO | iitNONTAUT ) : 0;
  757|       |
  758|       |            if (!eq2taut &&
  759|       |                !Eql_INChI_Stereo( Stereo, EQL_SP2, NULL, EQL_EXISTS, 0 ) &&
  760|       |                Eql_INChI_Stereo( Stereo_Taut, EQL_SP2, NULL, EQL_EXISTS, 0 ))
  761|       |            {
  762|       |                eq2taut = iiEmpty; /* the current is empty while the preceding (taut) is not */
  763|       |            }
  764|       |        }
  765|       |#else
  766|    821|        if (!eq2taut && bSecondNonTautPass && bOmitRepetitions)
  ------------------
  |  Branch (766:13): [True: 821, False: 0]
  |  Branch (766:25): [True: 0, False: 821]
  |  Branch (766:47): [True: 0, False: 0]
  ------------------
  767|      0|        {
  768|      0|            eq2taut = pINChI && pINChI_Taut &&
  ------------------
  |  Branch (768:23): [True: 0, False: 0]
  |  Branch (768:33): [True: 0, False: 0]
  ------------------
  769|      0|                ( Stereo = pINChI->Stereo ) && ( Stereo_Taut = pINChI_Taut->Stereo ) &&
  ------------------
  |  Branch (769:17): [True: 0, False: 0]
  |  Branch (769:48): [True: 0, False: 0]
  ------------------
  770|      0|                Eql_INChI_Stereo( Stereo, EQL_SP2, Stereo_Taut, EQL_SP2, 0 );
  ------------------
  |  |  477|      0|#define EQL_SP2 8
  ------------------
                              Eql_INChI_Stereo( Stereo, EQL_SP2, Stereo_Taut, EQL_SP2, 0 );
  ------------------
  |  |  477|      0|#define EQL_SP2 8
  ------------------
  |  Branch (770:17): [True: 0, False: 0]
  ------------------
  771|      0|            eq2taut = eq2taut ? ( iiSTEREO | iitNONTAUT ) : 0;
  ------------------
  |  |   55|      0|#define iiSTEREO      0x0001  /* stereo (sp2 or sp3)   */
  ------------------
                          eq2taut = eq2taut ? ( iiSTEREO | iitNONTAUT ) : 0;
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
  |  Branch (771:23): [True: 0, False: 0]
  ------------------
  772|      0|        }
  773|    821|#endif
  774|    821|        if (eq2taut)
  ------------------
  |  Branch (774:13): [True: 0, False: 821]
  ------------------
  775|      0|        {
  776|       |            /* we may be here only in case of the second (non-taut) pass */
  777|       |            /* current non-taut stereo has been found to be same as tautomeric */
  778|      0|            if (pINChI_Prev && pINChI_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (778:17): [True: 0, False: 0]
  |  Branch (778:32): [True: 0, False: 0]
  ------------------
  779|      0|            {
  780|       |                /* previous component exists; output it */
  781|      0|                if (bNext++)
  ------------------
  |  Branch (781:21): [True: 0, False: 0]
  ------------------
  782|      0|                {
  783|      0|                    MakeDelim( sCompDelim, strbuf, bOverflow );
  784|      0|                }
  785|      0|                if (( Stereo_Prev = pINChI_Prev->Stereo ) && Stereo_Prev->nNumberOfStereoBonds > 0)
  ------------------
  |  Branch (785:21): [True: 0, False: 0]
  |  Branch (785:62): [True: 0, False: 0]
  ------------------
  786|      0|                {
  787|      0|                    MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
  788|       |
  789|      0|                    MakeStereoString( Stereo_Prev->nBondAtom1, Stereo_Prev->nBondAtom2,
  790|      0|                        Stereo_Prev->b_parity,
  791|      0|                        0, Stereo_Prev->nNumberOfStereoBonds,
  792|      0|                        strbuf, TAUT_MODE, bOverflow );
  793|      0|                }
  794|      0|            }
  795|      0|            else
  796|      0|            {
  797|      0|                if (pINChI_Taut_Prev && pINChI_Taut_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (797:21): [True: 0, False: 0]
  |  Branch (797:41): [True: 0, False: 0]
  ------------------
  798|      0|                {
  799|       |                    /* previous non-taut component exists only in taut list */
  800|      0|                    if (bNext++)
  ------------------
  |  Branch (800:25): [True: 0, False: 0]
  ------------------
  801|      0|                    {
  802|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
  803|      0|                    }
  804|      0|                }
  805|      0|            }
  806|       |            /* we have found pINChI->Stereo sp2 same as in pINChI_Taut */
  807|       |            /* output this (current) equivalence as '*', that is, same as tautomeric */
  808|       |            /* that was printed on the 1st pass. */
  809|      0|            pCurrEquStr = EquString( eq2taut );
  810|      0|            if (multPrevEquStr && pPrevEquStr)
  ------------------
  |  Branch (810:17): [True: 0, False: 0]
  |  Branch (810:35): [True: 0, False: 0]
  ------------------
  811|      0|            {
  812|      0|                if (pCurrEquStr && !strcmp( pCurrEquStr, pPrevEquStr ))
  ------------------
  |  Branch (812:21): [True: 0, False: 0]
  |  Branch (812:36): [True: 0, False: 0]
  ------------------
  813|      0|                {
  814|      0|                    multPrevEquStr++;
  815|      0|                }
  816|      0|                else
  817|      0|                {
  818|       |                    /* new EqStr is different; output the previous one */
  819|      0|                    if (bNext++)
  ------------------
  |  Branch (819:25): [True: 0, False: 0]
  ------------------
  820|      0|                    {
  821|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
  822|      0|                    }
  823|      0|                    MakeEqStr( pPrevEquStr, multPrevEquStr, strbuf, bOverflow );
  824|      0|                    pPrevEquStr = pCurrEquStr;
  825|      0|                    multPrevEquStr = 1;
  826|      0|                }
  827|      0|            }
  828|      0|            else
  829|      0|            {
  830|      0|                pPrevEquStr = pCurrEquStr;
  831|      0|                multPrevEquStr = 1;
  832|      0|            }
  833|      0|            pINChI_Prev = NULL; /* pINChI_Prev sp2 does not exist since */
  834|      0|            pINChI_Taut_Prev = NULL; /* pINChI has just been printed */
  835|      0|            mult = 0;
  836|      0|            eq2tautPrev = 1;     /* pINChI_Prev sp2 does not exist */
  837|      0|        }
  838|    821|        else
  839|    821|        {
  840|    821|            if (eq2tautPrev)
  ------------------
  |  Branch (840:17): [True: 410, False: 411]
  ------------------
  841|    410|            {
  842|       |                /* at this point pINChI_Prev does not exist; however, pINChI */
  843|       |                /*might have been discovered and it is different from pINChI_Taut */
  844|    410|                if (multPrevEquStr && pPrevEquStr)
  ------------------
  |  Branch (844:21): [True: 0, False: 410]
  |  Branch (844:39): [True: 0, False: 0]
  ------------------
  845|      0|                {
  846|       |                    /* new EqStr is different; output it */
  847|      0|                    if (bNext++)
  ------------------
  |  Branch (847:25): [True: 0, False: 0]
  ------------------
  848|      0|                    {
  849|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
  850|      0|                    }
  851|      0|                    MakeEqStr( pPrevEquStr, multPrevEquStr, strbuf, bOverflow );
  852|      0|                    pPrevEquStr = NULL;
  853|      0|                    multPrevEquStr = 0;
  854|      0|                }
  855|    410|                eq2tautPrev = 0;
  856|    410|                pINChI_Prev = pINChI;
  857|    410|                pINChI_Taut_Prev = pINChI_Taut;
  858|    410|                mult = 0;
  859|    410|            }
  860|    411|            else
  861|    411|            {
  862|       |                /* check whether pINChI and pINChI_Prev have non-zero identical stereo sp2 */
  863|    411|                eq2prev = bUseMulipliers &&
  ------------------
  |  Branch (863:27): [True: 411, False: 0]
  ------------------
  864|    411|                    pINChI && pINChI_Prev &&
  ------------------
  |  Branch (864:21): [True: 1, False: 410]
  |  Branch (864:31): [True: 1, False: 0]
  ------------------
  865|      1|                    ( Stereo = pINChI->Stereo ) && ( Stereo_Prev = pINChI_Prev->Stereo ) &&
  ------------------
  |  Branch (865:21): [True: 1, False: 0]
  |  Branch (865:52): [True: 1, False: 0]
  ------------------
  866|      1|                    Eql_INChI_Stereo( Stereo, EQL_SP2, Stereo_Prev, EQL_SP2, 0 );
  ------------------
  |  |  477|      1|#define EQL_SP2 8
  ------------------
                                  Eql_INChI_Stereo( Stereo, EQL_SP2, Stereo_Prev, EQL_SP2, 0 );
  ------------------
  |  |  477|      1|#define EQL_SP2 8
  ------------------
  |  Branch (866:21): [True: 1, False: 0]
  ------------------
  867|    411|                if (eq2prev)
  ------------------
  |  Branch (867:21): [True: 1, False: 410]
  ------------------
  868|      1|                {
  869|      1|                    mult++; /* mult = (number of non-empty equal items)-1 */
  870|      1|                    continue;
  871|      1|                }
  872|    410|                else
  873|    410|                {
  874|       |                    /* pINChI sp2 info is either different or trivial. Output pINChI_Prev anyway */
  875|    410|                    if (bNext++)
  ------------------
  |  Branch (875:25): [True: 0, False: 410]
  ------------------
  876|      0|                    {
  877|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
  878|      0|                    }
  879|    410|                    if (pINChI_Prev && pINChI_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (879:25): [True: 410, False: 0]
  |  Branch (879:40): [True: 410, False: 0]
  ------------------
  880|    410|                    {
  881|    410|                        if (( Stereo_Prev = pINChI_Prev->Stereo ) && Stereo_Prev->nNumberOfStereoBonds > 0)
  ------------------
  |  Branch (881:29): [True: 410, False: 0]
  |  Branch (881:70): [True: 410, False: 0]
  ------------------
  882|    410|                        {
  883|       |                            /* pINChI_Prev exists and has sp2 info */
  884|    410|                            MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
  885|       |
  886|    410|                            MakeStereoString( Stereo_Prev->nBondAtom1, Stereo_Prev->nBondAtom2,
  887|    410|                                Stereo_Prev->b_parity,
  888|    410|                                0, Stereo_Prev->nNumberOfStereoBonds,
  889|    410|                                strbuf, TAUT_MODE, bOverflow );
  890|    410|                        }
  891|       |                        /* else sp2 info is not present in pINChI_Prev */
  892|    410|                    }
  893|      0|                    else
  894|      0|                    {
  895|      0|                        if (bSecondNonTautPass && pINChI_Taut_Prev && pINChI_Taut_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (895:29): [True: 0, False: 0]
  |  Branch (895:51): [True: 0, False: 0]
  |  Branch (895:71): [True: 0, False: 0]
  ------------------
  896|      0|                        {
  897|      0|                            if (( Stereo_Taut_Prev = pINChI_Taut_Prev->Stereo ) && Stereo_Taut_Prev->nNumberOfStereoBonds > 0)
  ------------------
  |  Branch (897:33): [True: 0, False: 0]
  |  Branch (897:84): [True: 0, False: 0]
  ------------------
  898|      0|                            {
  899|       |                                /* since pINChI_Prev does not exist, pINChI_Taut_Prev is non-tautomeric */
  900|       |                                /* and it has non-trivial sp2 info */
  901|       |                                /*
  902|       |                                tot_len += MakeDelim( sIdenticalValues, strbuf, bOverflow);
  903|       |                                */
  904|      0|                                ;/* pINChI_Taut_Prev sp2 info was output in the main stereo section */
  905|      0|                            }
  906|      0|                            else
  907|      0|                            {
  908|      0|                                ; /* pINChI_Taut_Prev exists and has not sp2 info */
  909|      0|                            }
  910|      0|                        }
  911|      0|                    }
  912|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
  913|       |                        else
  914|       |                        {
  915|       |                            int stop = 1;   /* <BRKPT> */
  916|       |                        }
  917|       |#endif
  918|    410|                }
  919|    410|                pINChI_Prev = pINChI;
  920|    410|                pINChI_Taut_Prev = pINChI_Taut;
  921|    410|                mult = 0; /* we do not know whether the item is empty */
  922|    410|            }
  923|    821|        }
  924|    821|    }    /* end of for each connected component ... */
  925|       |
  926|    410|    return ( strbuf->nUsedLength - nUsedLength0 );
  927|    410|}
str_Sp3:
  956|    357|{
  957|    357|    int          i, ii, ii2, nUsedLength0;
  958|    357|    INCHI_SORT   *is, *is2, *is0, *is20;
  959|    357|    INChI        *pINChI, *pINChI_Prev, *pINChI_Taut, *pINChI_Taut_Prev;
  960|    357|    INChI_Stereo *Stereo, *Stereo_Prev, *Stereo_Taut, *Stereo_Taut_Prev;
  961|    357|    int          mult, eq2prev, eq2taut, eq2tautPrev, bNext;
  962|    357|    const char  *pPrevEquStr, *pCurrEquStr;
  963|    357|    int         multPrevEquStr;
  964|    357|    pINChI_Taut = NULL;
  965|    357|    pINChI_Prev = NULL;
  966|    357|    pINChI_Taut_Prev = NULL;
  967|    357|    mult = 0;
  968|    357|    bNext = 0;
  969|    357|    is = NULL;
  970|    357|    is2 = NULL;
  971|    357|    is0 = pINChISort;
  972|    357|    is20 = bSecondNonTautPass ? pINChISort2 : NULL;
  ------------------
  |  Branch (972:12): [True: 0, False: 357]
  ------------------
  973|       |    /* djb-rwth: removing redundant code */
  974|    357|    eq2tautPrev = 1; /* pINChI_Prev (previous pINChI) does not exist */
  975|    357|    pPrevEquStr = NULL; /*, *pCurrEquStr;*/
  976|    357|    multPrevEquStr = 0;
  977|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
  978|       |#else
  979|    357|    bRelRac = 0;
  980|    357|#endif
  981|    357|    nUsedLength0 = strbuf->nUsedLength;
  982|       |
  983|       |    /* For each connected component...    */
  984|  1.10k|    for (i = 0; i <= num_components; i++)
  ------------------
  |  Branch (984:17): [True: 745, False: 357]
  ------------------
  985|    745|    {
  986|       |
  987|       |        /* 1st (taut) pass: bOutType=OUT_TN  ; 2nd (non-taut pass) bOutType=OUT_NT */
  988|    745|        pINChI = ( i < num_components && ( is = is0 + i, 0 <= ( ii = GET_II( bOutType, is ) ) ) ) ? is->pINChI[ii] : NULL;
  ------------------
  |  |   45|    388|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|    388|#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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 388]
  |  |  ------------------
  |  |   46|    388|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|    776|#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): \
  |  |  ------------------
  |  |  |  |  583|    776|#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): \
  |  |  ------------------
  |  |  |  |   35|    388|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|    388|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|    388|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 388, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 388, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|    388|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 388]
  |  |  |  Branch (46:36): [True: 388, False: 0]
  |  |  ------------------
  |  |   47|    388|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (988:20): [True: 388, False: 357]
  |  Branch (988:42): [True: 388, False: 0]
  ------------------
  989|       |        /*================ compare sp3 to previous =====================*/
  990|    745|        if (bSecondNonTautPass)
  ------------------
  |  Branch (990:13): [True: 0, False: 745]
  ------------------
  991|      0|        {
  992|       |            /* component that was output on the 1st pass */
  993|      0|            pINChI_Taut = ( i < num_components && ( is2 = is20 + i, 0 <= ( ii2 = GET_II( OUT_T1, is2 ) ) ) ) ? is2->pINChI[ii2] : NULL;
  ------------------
  |  |   45|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [Folded, False: 0]
  |  |  ------------------
  |  |   46|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|      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): \
  |  |  ------------------
  |  |  |  |  583|      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): \
  |  |  ------------------
  |  |  |  |   35|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, Folded]
  |  |  |  Branch (46:36): [Folded, False: 0]
  |  |  ------------------
  |  |   47|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [Folded, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (993:29): [True: 0, False: 0]
  |  Branch (993:51): [True: 0, False: 0]
  ------------------
  994|      0|        }
  995|       |        /*========= if bSecondNonTautPass then compare non-iso non-taut stereo to non-iso taut ========*/
  996|    745|        eq2taut = 0;
  997|       |#if ( FIX_EMPTY_LAYER_BUG == 1 )
  998|       |        if (!eq2taut && bSecondNonTautPass && bOmitRepetitions && pINChI && pINChI_Taut)
  999|       |        {
 1000|       |            Stereo = pINChI->Stereo;
 1001|       |            Stereo_Taut = pINChI_Taut->Stereo;
 1002|       |            eq2taut = Stereo && Stereo_Taut &&
 1003|       |                Eql_INChI_Stereo( Stereo, EQL_SP3, Stereo_Taut, EQL_SP3, bRelRac );
 1004|       |            eq2taut = eq2taut ? ( iiSTEREO | iitNONTAUT ) : 0;
 1005|       |            if (!eq2taut &&
 1006|       |                !Eql_INChI_Stereo( Stereo, EQL_SP3, NULL, EQL_EXISTS, 0 ) &&
 1007|       |                Eql_INChI_Stereo( Stereo_Taut, EQL_SP3, NULL, EQL_EXISTS, 0 ))
 1008|       |            {
 1009|       |                eq2taut = iiEmpty; /* the current is empty while the preceding (taut) is not */
 1010|       |            }
 1011|       |        }
 1012|       |#else
 1013|    745|        if (!eq2taut && bSecondNonTautPass && bOmitRepetitions)
  ------------------
  |  Branch (1013:13): [True: 745, False: 0]
  |  Branch (1013:25): [True: 0, False: 745]
  |  Branch (1013:47): [True: 0, False: 0]
  ------------------
 1014|      0|        {
 1015|      0|            eq2taut = pINChI && pINChI_Taut &&
  ------------------
  |  Branch (1015:23): [True: 0, False: 0]
  |  Branch (1015:33): [True: 0, False: 0]
  ------------------
 1016|      0|                ( Stereo = pINChI->Stereo ) && ( Stereo_Taut = pINChI_Taut->Stereo ) &&
  ------------------
  |  Branch (1016:17): [True: 0, False: 0]
  |  Branch (1016:48): [True: 0, False: 0]
  ------------------
 1017|      0|                Eql_INChI_Stereo( Stereo, EQL_SP3, Stereo_Taut, EQL_SP3, bRelRac );
  ------------------
  |  |  475|      0|#define EQL_SP3 2
  ------------------
                              Eql_INChI_Stereo( Stereo, EQL_SP3, Stereo_Taut, EQL_SP3, bRelRac );
  ------------------
  |  |  475|      0|#define EQL_SP3 2
  ------------------
  |  Branch (1017:17): [True: 0, False: 0]
  ------------------
 1018|      0|            eq2taut = eq2taut ? ( iiSTEREO | iitNONTAUT ) : 0;
  ------------------
  |  |   55|      0|#define iiSTEREO      0x0001  /* stereo (sp2 or sp3)   */
  ------------------
                          eq2taut = eq2taut ? ( iiSTEREO | iitNONTAUT ) : 0;
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
  |  Branch (1018:23): [True: 0, False: 0]
  ------------------
 1019|      0|        }
 1020|    745|#endif
 1021|    745|        if (eq2taut)
  ------------------
  |  Branch (1021:13): [True: 0, False: 745]
  ------------------
 1022|      0|        {
 1023|       |            /* we may be here only in case of the second (non-taut) pass */
 1024|       |            /* current non-taut stereo has been found to be same as tautomeric */
 1025|      0|            if (pINChI_Prev && pINChI_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1025:17): [True: 0, False: 0]
  |  Branch (1025:32): [True: 0, False: 0]
  ------------------
 1026|      0|            {
 1027|       |                /* previous component exists; output it */
 1028|      0|                if (bNext++)
  ------------------
  |  Branch (1028:21): [True: 0, False: 0]
  ------------------
 1029|      0|                {
 1030|      0|                    MakeDelim( sCompDelim, strbuf, bOverflow );
 1031|      0|                }
 1032|      0|                if (( Stereo_Prev = pINChI_Prev->Stereo ) && Stereo_Prev->nNumberOfStereoCenters > 0)
  ------------------
  |  Branch (1032:21): [True: 0, False: 0]
  |  Branch (1032:62): [True: 0, False: 0]
  ------------------
 1033|      0|                {
 1034|       |                    /* non-empty item */
 1035|      0|                    MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
 1036|      0|                    MakeStereoString( Stereo_Prev->nNumber, NULL,
 1037|      0|                                      Stereo_Prev->t_parity,0,
 1038|      0|                                      Stereo_Prev->nNumberOfStereoCenters,
 1039|      0|                                      strbuf, TAUT_MODE, bOverflow );
 1040|      0|                }
 1041|      0|            }
 1042|      0|            else
 1043|      0|                if (pINChI_Taut_Prev && pINChI_Taut_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1043:21): [True: 0, False: 0]
  |  Branch (1043:41): [True: 0, False: 0]
  ------------------
 1044|      0|                {
 1045|       |                    /* previous non-taut component exists only in taut list */
 1046|      0|                    if (bNext++)
  ------------------
  |  Branch (1046:25): [True: 0, False: 0]
  ------------------
 1047|      0|                    {
 1048|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1049|      0|                    }
 1050|      0|                }
 1051|       |            /* we have found pINChI->Stereo sp3 same as in pINChI_Taut */
 1052|       |            /* output this (current) equivalence as '*', that is, same as tautomeric */
 1053|       |            /* that was printed on the 1st pass. */
 1054|       |
 1055|      0|            pCurrEquStr = EquString( eq2taut );
 1056|      0|            if (multPrevEquStr && pPrevEquStr)
  ------------------
  |  Branch (1056:17): [True: 0, False: 0]
  |  Branch (1056:35): [True: 0, False: 0]
  ------------------
 1057|      0|            {
 1058|      0|                if (pCurrEquStr && !strcmp( pCurrEquStr, pPrevEquStr ))
  ------------------
  |  Branch (1058:21): [True: 0, False: 0]
  |  Branch (1058:36): [True: 0, False: 0]
  ------------------
 1059|      0|                {
 1060|      0|                    multPrevEquStr++;
 1061|      0|                }
 1062|      0|                else
 1063|      0|                {
 1064|       |                    /* new EqStr is different; output it */
 1065|      0|                    if (bNext++)
  ------------------
  |  Branch (1065:25): [True: 0, False: 0]
  ------------------
 1066|      0|                    {
 1067|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1068|      0|                    }
 1069|      0|                    MakeEqStr( pPrevEquStr, multPrevEquStr, strbuf, bOverflow );
 1070|      0|                    pPrevEquStr = pCurrEquStr;
 1071|      0|                    multPrevEquStr = 1;
 1072|      0|                }
 1073|      0|            }
 1074|      0|            else
 1075|      0|            {
 1076|      0|                pPrevEquStr = pCurrEquStr;
 1077|      0|                multPrevEquStr = 1;
 1078|      0|            }
 1079|       |
 1080|      0|            pINChI_Prev = NULL; /* pINChI_Prev sp2 does not exist since */
 1081|      0|            pINChI_Taut_Prev = NULL; /* pINChI has just been printed */
 1082|      0|            mult = 0;
 1083|      0|            eq2tautPrev = 1;     /* pINChI_Prev sp2 does not exist */
 1084|      0|        }
 1085|    745|        else
 1086|    745|        {
 1087|    745|            if (eq2tautPrev)
  ------------------
  |  Branch (1087:17): [True: 357, False: 388]
  ------------------
 1088|    357|            {
 1089|       |                /* at this point pINChI_Prev does not exist; however, pINChI */
 1090|       |                /*might have been discovered and it is different from pINChI_Taut */
 1091|    357|                if (multPrevEquStr && pPrevEquStr)
  ------------------
  |  Branch (1091:21): [True: 0, False: 357]
  |  Branch (1091:39): [True: 0, False: 0]
  ------------------
 1092|      0|                {
 1093|       |                    /* new EqStr is different; output it */
 1094|      0|                    if (bNext++)
  ------------------
  |  Branch (1094:25): [True: 0, False: 0]
  ------------------
 1095|      0|                    {
 1096|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1097|      0|                    }
 1098|      0|                    MakeEqStr( pPrevEquStr, multPrevEquStr, strbuf, bOverflow );
 1099|      0|                    pPrevEquStr = NULL;
 1100|      0|                    multPrevEquStr = 0;
 1101|      0|                }
 1102|    357|                eq2tautPrev = 0;
 1103|    357|                pINChI_Prev = pINChI;
 1104|    357|                pINChI_Taut_Prev = pINChI_Taut;
 1105|    357|                mult = 0;
 1106|    357|            }
 1107|    388|            else
 1108|    388|            {
 1109|       |                /* check whether pINChI and pINChI_Prev have non-zero identical stereo sp3 */
 1110|       |                /*================ compare sp3 to previous =====================*/
 1111|    388|                eq2prev = bUseMulipliers &&
  ------------------
  |  Branch (1111:27): [True: 388, False: 0]
  ------------------
 1112|    388|                    pINChI && pINChI_Prev &&
  ------------------
  |  Branch (1112:21): [True: 31, False: 357]
  |  Branch (1112:31): [True: 31, False: 0]
  ------------------
 1113|     31|                    ( Stereo = pINChI->Stereo ) && ( Stereo_Prev = pINChI_Prev->Stereo ) &&
  ------------------
  |  Branch (1113:21): [True: 31, False: 0]
  |  Branch (1113:52): [True: 31, False: 0]
  ------------------
 1114|     31|                    Eql_INChI_Stereo( Stereo, EQL_SP3, Stereo_Prev, EQL_SP3, bRelRac );
  ------------------
  |  |  475|     31|#define EQL_SP3 2
  ------------------
                                  Eql_INChI_Stereo( Stereo, EQL_SP3, Stereo_Prev, EQL_SP3, bRelRac );
  ------------------
  |  |  475|     31|#define EQL_SP3 2
  ------------------
  |  Branch (1114:21): [True: 1, False: 30]
  ------------------
 1115|    388|                if (eq2prev)
  ------------------
  |  Branch (1115:21): [True: 1, False: 387]
  ------------------
 1116|      1|                {
 1117|      1|                    mult++; /* mult = (number of non-empty equal items)-1 */
 1118|      1|                    continue;
 1119|      1|                }
 1120|    387|                else
 1121|    387|                {
 1122|    387|                    if (bNext++)
  ------------------
  |  Branch (1122:25): [True: 30, False: 357]
  ------------------
 1123|     30|                    {
 1124|     30|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1125|     30|                    }
 1126|    387|                    if (pINChI_Prev && pINChI_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1126:25): [True: 387, False: 0]
  |  Branch (1126:40): [True: 387, False: 0]
  ------------------
 1127|    387|                    {
 1128|    387|                        if (( Stereo_Prev = pINChI_Prev->Stereo ) && Stereo_Prev->nNumberOfStereoCenters > bRelRac)
  ------------------
  |  Branch (1128:29): [True: 387, False: 0]
  |  Branch (1128:70): [True: 381, False: 6]
  ------------------
 1129|    381|                        {
 1130|       |                            /* pINChI_Prev exists and has sp3 info */
 1131|    381|                            MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
 1132|       |
 1133|    381|                            MakeStereoString( Stereo_Prev->nNumber, NULL, Stereo_Prev->t_parity,
 1134|    381|                                0, Stereo_Prev->nNumberOfStereoCenters,
 1135|    381|                                strbuf, TAUT_MODE, bOverflow );
 1136|    381|                        }
 1137|       |                        /* else sp3 info is not present in pINChI_Prev */
 1138|    387|                    }
 1139|      0|                    else
 1140|      0|                    {
 1141|      0|                        if (bSecondNonTautPass && pINChI_Taut_Prev && pINChI_Taut_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1141:29): [True: 0, False: 0]
  |  Branch (1141:51): [True: 0, False: 0]
  |  Branch (1141:71): [True: 0, False: 0]
  ------------------
 1142|      0|                        {
 1143|      0|                            if (( Stereo_Taut_Prev = pINChI_Taut_Prev->Stereo ) && Stereo_Taut_Prev->nNumberOfStereoCenters > bRelRac)
  ------------------
  |  Branch (1143:33): [True: 0, False: 0]
  |  Branch (1143:84): [True: 0, False: 0]
  ------------------
 1144|      0|                            {
 1145|       |                                /* since pINChI_Prev does not exist, pINChI_Taut_Prev is non-tautomeric */
 1146|       |                                /* and it has non-trivial sp3 info. This info has already been printed in the main section */
 1147|       |                                /*
 1148|       |                                tot_len += MakeDelim( sIdenticalValues, strbuf, bOverflow);
 1149|       |                                */
 1150|      0|                                ; /* pINChI_Taut_Prev sp3 info was output in the main stereo section */
 1151|      0|                            }
 1152|      0|                            else
 1153|      0|                            {
 1154|      0|                                ; /* pINChI_Taut_Prev exists and has not sp3 info */
 1155|      0|                            }
 1156|      0|                        }
 1157|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 1158|       |                        else
 1159|       |                        {
 1160|       |                            int stop = 1;   /* <BRKPT> */
 1161|       |                        }
 1162|       |#endif
 1163|      0|                    }
 1164|    387|                }
 1165|    387|                pINChI_Prev = pINChI;
 1166|    387|                pINChI_Taut_Prev = pINChI_Taut;
 1167|    387|                mult = 0; /* we do not know whether the item is empty */
 1168|    387|            }
 1169|    745|        }
 1170|    745|    }
 1171|       |
 1172|    357|    return ( strbuf->nUsedLength - nUsedLength0 );
 1173|    357|}
str_StereoAbsInv:
 1189|      2|{
 1190|      2|    int          i, j, ii, nUsedLength0;
 1191|      2|    INCHI_SORT   *is, *is0;
 1192|      2|    INChI_Stereo *Stereo;
 1193|      2|    INChI        *pINChI;
 1194|       |
 1195|      2|    is = NULL;
 1196|      2|    is0 = pINChISort;
 1197|      2|    nUsedLength0 = strbuf->nUsedLength;
 1198|       |
 1199|       |    /* For each connected component...    */
 1200|      5|    for (i = 0; !*bOverflow && i < num_components; i++)
  ------------------
  |  Branch (1200:17): [True: 5, False: 0]
  |  Branch (1200:32): [True: 3, False: 2]
  ------------------
 1201|      3|    {
 1202|       |
 1203|      3|        is = is0 + i;
 1204|      3|        pINChI = ( 0 <= ( ii = GET_II( bOutType, is ) ) ) ? is->pINChI[ii] : NULL;
  ------------------
  |  |   45|      3|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 3]
  |  |  ------------------
  |  |   46|      3|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|      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): \
  |  |  ------------------
  |  |  |  |  583|      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): \
  |  |  ------------------
  |  |  |  |   35|      3|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      3|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      3|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 3, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      3|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 3]
  |  |  |  Branch (46:36): [True: 3, False: 0]
  |  |  ------------------
  |  |   47|      3|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1204:18): [True: 3, False: 0]
  ------------------
 1205|      3|        if (pINChI && ( Stereo = pINChI->Stereo ) && ( j = Stereo->nCompInv2Abs ))
  ------------------
  |  Branch (1205:13): [True: 3, False: 0]
  |  Branch (1205:23): [True: 3, False: 0]
  |  Branch (1205:54): [True: 3, False: 0]
  ------------------
 1206|      3|        {
 1207|      3|            MakeDelim( j < 0 ? "1" : "0", strbuf, bOverflow );
  ------------------
  |  Branch (1207:24): [True: 0, False: 3]
  ------------------
 1208|      3|        }
 1209|      0|        else
 1210|      0|        {
 1211|      0|            MakeDelim( ".", strbuf, bOverflow );
 1212|      0|        }
 1213|      3|    }
 1214|       |
 1215|      2|    return ( strbuf->nUsedLength - nUsedLength0 );
 1216|      2|}
str_IsoAtoms:
 1233|    451|{
 1234|    451|    int          i, ii, ii2, nUsedLength0;
 1235|    451|    INCHI_SORT   *is, *is2, *is0, *is20;
 1236|    451|    INChI        *pINChI, *pINChI_Prev, *pINChI_Taut, *pINChI_Taut_Prev;
 1237|    451|    int          mult, eq2prev, eq2taut, eq2tautPrev, bNext;
 1238|    451|    const char  *pPrevEquStr, *pCurrEquStr;
 1239|    451|    int         multPrevEquStr;
 1240|    451|    pINChI_Taut = NULL;
 1241|    451|    pINChI_Prev = NULL;
 1242|    451|    pINChI_Taut_Prev = NULL;
 1243|    451|    mult = 0;
 1244|    451|    bNext = 0;
 1245|    451|    is = NULL;
 1246|    451|    is2 = NULL;
 1247|    451|    is0 = pINChISort;
 1248|    451|    is20 = bSecondNonTautPass ? pINChISort2 : NULL;
  ------------------
  |  Branch (1248:12): [True: 0, False: 451]
  ------------------
 1249|       |    /* djb-rwth: removing redundant code */
 1250|    451|    eq2tautPrev = 1; /* pINChI_Prev (previous pINChI) does not exist */
 1251|    451|    pPrevEquStr = NULL; /*, *pCurrEquStr;*/
 1252|    451|    multPrevEquStr = 0;
 1253|    451|    nUsedLength0 = strbuf->nUsedLength;
 1254|       |
 1255|       |    /* For each connected component...    */
 1256|  1.53k|    for (i = 0; i <= num_components; i++)
  ------------------
  |  Branch (1256:17): [True: 1.07k, False: 451]
  ------------------
 1257|  1.07k|    {
 1258|       |
 1259|       |        /* 1st (taut) pass: bOutType=OUT_TN  ; 2nd (non-taut pass) bOutType=OUT_NT */
 1260|  1.07k|        pINChI = ( i < num_components && ( is = is0 + i, 0 <= ( ii = GET_II( bOutType, is ) ) ) ) ? is->pINChI[ii] : NULL;
  ------------------
  |  |   45|    628|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|    628|#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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 628]
  |  |  ------------------
  |  |   46|    628|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|  1.25k|#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): \
  |  |  ------------------
  |  |  |  |  583|  1.25k|#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): \
  |  |  ------------------
  |  |  |  |   35|    628|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|    628|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|    628|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 628, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 628, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|    628|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 628]
  |  |  |  Branch (46:36): [True: 628, False: 0]
  |  |  ------------------
  |  |   47|    628|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1260:20): [True: 628, False: 451]
  |  Branch (1260:42): [True: 628, False: 0]
  ------------------
 1261|       |        /*================ compare isotopic info to previous component =====================*/
 1262|  1.07k|        if (bSecondNonTautPass)
  ------------------
  |  Branch (1262:13): [True: 0, False: 1.07k]
  ------------------
 1263|      0|        {
 1264|       |            /* component that was output on the 1st pass */
 1265|      0|            pINChI_Taut = ( i < num_components && ( is2 = is20 + i, 0 <= ( ii2 = GET_II( OUT_T1, is2 ) ) ) ) ? is2->pINChI[ii2] : NULL;
  ------------------
  |  |   45|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [Folded, False: 0]
  |  |  ------------------
  |  |   46|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|      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): \
  |  |  ------------------
  |  |  |  |  583|      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): \
  |  |  ------------------
  |  |  |  |   35|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, Folded]
  |  |  |  Branch (46:36): [Folded, False: 0]
  |  |  ------------------
  |  |   47|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [Folded, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1265:29): [True: 0, False: 0]
  |  Branch (1265:51): [True: 0, False: 0]
  ------------------
 1266|      0|        }
 1267|       |        /*========= if bSecondNonTautPass then compare iso non-taut to taut non-iso ========*/
 1268|  1.07k|        eq2taut = 0;
 1269|  1.07k|        if (!eq2taut && bSecondNonTautPass && bOmitRepetitions)
  ------------------
  |  Branch (1269:13): [True: 1.07k, False: 0]
  |  Branch (1269:25): [True: 0, False: 1.07k]
  |  Branch (1269:47): [True: 0, False: 0]
  ------------------
 1270|      0|        {
 1271|      0|            eq2taut = Eql_INChI_Isotopic( pINChI, pINChI_Taut );
 1272|      0|            eq2taut = eq2taut ? ( iiNUMB | iitNONTAUT ) : 0;
  ------------------
  |  |   57|      0|#define iiNUMB        0x0004  /* numbering or inverted stereo numbering */
  ------------------
                          eq2taut = eq2taut ? ( iiNUMB | iitNONTAUT ) : 0;
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
  |  Branch (1272:23): [True: 0, False: 0]
  ------------------
 1273|      0|        }
 1274|  1.07k|        if (eq2taut)
  ------------------
  |  Branch (1274:13): [True: 0, False: 1.07k]
  ------------------
 1275|      0|        {
 1276|       |            /* we may be here only in case of the second (non-taut) pass */
 1277|       |            /* current non-taut isotopic info has been found to be same as current tautomeric */
 1278|      0|            if (pINChI_Prev && pINChI_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1278:17): [True: 0, False: 0]
  |  Branch (1278:32): [True: 0, False: 0]
  ------------------
 1279|      0|            {
 1280|       |                /* previous component exists; output it */
 1281|      0|                if (bNext++)
  ------------------
  |  Branch (1281:21): [True: 0, False: 0]
  ------------------
 1282|      0|                {
 1283|      0|                    MakeDelim( sCompDelim, strbuf, bOverflow );
 1284|      0|                }
 1285|      0|                if (pINChI_Prev && ( pINChI_Prev->nNumberOfIsotopicAtoms > 0 ||
  ------------------
  |  Branch (1285:21): [True: 0, False: 0]
  |  Branch (1285:38): [True: 0, False: 0]
  ------------------
 1286|      0|                    pINChI_Prev->nNumberOfIsotopicTGroups > 0 ))
  ------------------
  |  Branch (1286:21): [True: 0, False: 0]
  ------------------
 1287|      0|                {
 1288|       |                    /* non-empty item */
 1289|      0|                    MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
 1290|       |                    /*  Isotopic atoms */
 1291|      0|                    if (pINChI_Prev->nNumberOfIsotopicAtoms > 0/* && nStrLen-tot_len > 2*/ && !*bOverflow)
  ------------------
  |  Branch (1291:25): [True: 0, False: 0]
  |  Branch (1291:95): [True: 0, False: 0]
  ------------------
 1292|      0|                    { /* dereferenced bOverflow 2004-06-07 */
 1293|      0|                        MakeIsoAtomString( pINChI_Prev->IsotopicAtom,
 1294|      0|                            pINChI_Prev->nNumberOfIsotopicAtoms,
 1295|      0|                            strbuf,
 1296|      0|                            TAUT_MODE, bOverflow );
 1297|      0|                    }
 1298|       |                    /*  Isotopic tautomeric groups */
 1299|      0|                    if (pINChI_Prev->nNumberOfIsotopicTGroups > 0 &&
  ------------------
  |  Branch (1299:25): [True: 0, False: 0]
  ------------------
 1300|       |                        /*nStrLen-tot_len > 3 && */
 1301|      0|                        !*bOverflow)
  ------------------
  |  Branch (1301:25): [True: 0, False: 0]
  ------------------
 1302|      0|                    {
 1303|      0|                        MakeDelim( bAbcNumbers ? ITEM_DELIMETER : "(", strbuf, bOverflow );
  ------------------
  |  |   17|      0|#define ITEM_DELIMETER    ","
  ------------------
  |  Branch (1303:36): [True: 0, False: 0]
  ------------------
 1304|      0|                        MakeIsoTautString( pINChI_Prev->IsotopicTGroup, pINChI_Prev->nNumberOfIsotopicTGroups,
 1305|      0|                            strbuf, TAUT_MODE, bOverflow );
 1306|      0|                        if (!bAbcNumbers)
  ------------------
  |  Branch (1306:29): [True: 0, False: 0]
  ------------------
 1307|      0|                        {
 1308|      0|                            MakeDelim( ")", strbuf, bOverflow );
 1309|      0|                        }
 1310|      0|                    }
 1311|      0|                }
 1312|      0|            }
 1313|      0|            else
 1314|      0|            {
 1315|      0|                if (pINChI_Taut_Prev && pINChI_Taut_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1315:21): [True: 0, False: 0]
  |  Branch (1315:41): [True: 0, False: 0]
  ------------------
 1316|      0|                {
 1317|       |                    /* previous non-taut component exists only in taut list */
 1318|      0|                    if (bNext++)
  ------------------
  |  Branch (1318:25): [True: 0, False: 0]
  ------------------
 1319|      0|                    {
 1320|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1321|      0|                    }
 1322|      0|                }
 1323|      0|            }
 1324|       |            /* we have found pINChI isotopic info to be same as in pINChI_Taut */
 1325|       |            /* output this (current) equivalence as '*', that is, same as tautomeric */
 1326|       |            /* that was printed on the 1st pass. */
 1327|      0|            pCurrEquStr = EquString( eq2taut );
 1328|      0|            if (multPrevEquStr && pPrevEquStr)
  ------------------
  |  Branch (1328:17): [True: 0, False: 0]
  |  Branch (1328:35): [True: 0, False: 0]
  ------------------
 1329|      0|            {
 1330|      0|                if (pCurrEquStr && !strcmp( pCurrEquStr, pPrevEquStr ))
  ------------------
  |  Branch (1330:21): [True: 0, False: 0]
  |  Branch (1330:36): [True: 0, False: 0]
  ------------------
 1331|      0|                {
 1332|      0|                    multPrevEquStr++;
 1333|      0|                }
 1334|      0|                else
 1335|      0|                {
 1336|       |                    /* new EqStr is different; output it */
 1337|      0|                    if (bNext++)
  ------------------
  |  Branch (1337:25): [True: 0, False: 0]
  ------------------
 1338|      0|                    {
 1339|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1340|      0|                    }
 1341|      0|                    MakeEqStr( pPrevEquStr, multPrevEquStr, strbuf, bOverflow );
 1342|      0|                    pPrevEquStr = pCurrEquStr;
 1343|      0|                    multPrevEquStr = 1;
 1344|      0|                }
 1345|      0|            }
 1346|      0|            else
 1347|      0|            {
 1348|      0|                pPrevEquStr = pCurrEquStr;
 1349|      0|                multPrevEquStr = 1;
 1350|      0|            }
 1351|      0|            pINChI_Prev = NULL; /* pINChI_Prev isotopic info does not exist since */
 1352|      0|            pINChI_Taut_Prev = NULL; /* pINChI has just been printed */
 1353|      0|            mult = 0;
 1354|      0|            eq2tautPrev = 1;     /* pINChI_Prev isotopic info does not exist */
 1355|      0|        }
 1356|  1.07k|        else
 1357|  1.07k|            if (eq2tautPrev)
  ------------------
  |  Branch (1357:17): [True: 451, False: 628]
  ------------------
 1358|    451|            {
 1359|       |                /* at this point pINChI_Prev does not exist; however, pINChI */
 1360|       |                /* might have been discovered and it is different from pINChI_Taut */
 1361|    451|                if (multPrevEquStr && pPrevEquStr)
  ------------------
  |  Branch (1361:21): [True: 0, False: 451]
  |  Branch (1361:39): [True: 0, False: 0]
  ------------------
 1362|      0|                {
 1363|       |                    /* new EqStr is different; output it */
 1364|      0|                    if (bNext++)
  ------------------
  |  Branch (1364:25): [True: 0, False: 0]
  ------------------
 1365|      0|                    {
 1366|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1367|      0|                    }
 1368|      0|                    MakeEqStr( pPrevEquStr, multPrevEquStr, strbuf, bOverflow );
 1369|      0|                    pPrevEquStr = NULL;
 1370|      0|                    multPrevEquStr = 0;
 1371|      0|                }
 1372|    451|                eq2tautPrev = 0;
 1373|    451|                pINChI_Prev = pINChI;
 1374|    451|                pINChI_Taut_Prev = pINChI_Taut;
 1375|    451|                mult = 0;
 1376|    451|            }
 1377|    628|            else
 1378|    628|            {
 1379|       |                /*================ compare iso composition to previous =====================*/
 1380|       |                /* check whether pINChI and pINChI_Prev have non-zero identical isotopic info */
 1381|    628|                eq2prev = bUseMulipliers && Eql_INChI_Isotopic( pINChI, pINChI_Prev );
  ------------------
  |  Branch (1381:27): [True: 628, False: 0]
  |  Branch (1381:45): [True: 175, False: 453]
  ------------------
 1382|    628|                if (eq2prev)
  ------------------
  |  Branch (1382:21): [True: 175, False: 453]
  ------------------
 1383|    175|                {
 1384|    175|                    mult++; /* mult = (number of non-empty equal items)-1 */
 1385|    175|                    continue;
 1386|    175|                }
 1387|    453|                else
 1388|    453|                {
 1389|       |                    /* pINChI isotopic info is either different or empty. Output pINChI_Prev anyway */
 1390|    453|                    if (bNext++)
  ------------------
  |  Branch (1390:25): [True: 2, False: 451]
  ------------------
 1391|      2|                    {
 1392|      2|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1393|      2|                    }
 1394|    453|                    if (pINChI_Prev && pINChI_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1394:25): [True: 453, False: 0]
  |  Branch (1394:40): [True: 453, False: 0]
  ------------------
 1395|    453|                    {
 1396|    453|                        if (( pINChI_Prev->nNumberOfIsotopicAtoms > 0 ||
  ------------------
  |  Branch (1396:31): [True: 453, False: 0]
  ------------------
 1397|      0|                              pINChI_Prev->nNumberOfIsotopicTGroups > 0 ))
  ------------------
  |  Branch (1397:31): [True: 0, False: 0]
  ------------------
 1398|    453|                        {
 1399|       |                            /* pINChI_Prev exists and has isotopic info */
 1400|    453|                            MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
 1401|       |                            /*  Isotopic atoms */
 1402|    453|                            if (pINChI_Prev->nNumberOfIsotopicAtoms > 0 &&
  ------------------
  |  Branch (1402:33): [True: 453, False: 0]
  ------------------
 1403|       |                                /*nStrLen-tot_len > 2 && */
 1404|    453|                                !*bOverflow)
  ------------------
  |  Branch (1404:33): [True: 453, False: 0]
  ------------------
 1405|    453|                            {
 1406|    453|                                MakeIsoAtomString( pINChI_Prev->IsotopicAtom,
 1407|    453|                                    pINChI_Prev->nNumberOfIsotopicAtoms,
 1408|    453|                                    strbuf, TAUT_MODE, bOverflow );
 1409|    453|                            }
 1410|       |                            /*  Isotopic tautomeric groups */
 1411|    453|                            if (pINChI_Prev->nNumberOfIsotopicTGroups > 0 &&
  ------------------
  |  Branch (1411:33): [True: 0, False: 453]
  ------------------
 1412|       |                                /*nStrLen-tot_len > 3 && */
 1413|      0|                                !*bOverflow)
  ------------------
  |  Branch (1413:33): [True: 0, False: 0]
  ------------------
 1414|      0|                            {
 1415|      0|                                MakeDelim( bAbcNumbers ? ITEM_DELIMETER : "(", strbuf, bOverflow );
  ------------------
  |  |   17|      0|#define ITEM_DELIMETER    ","
  ------------------
  |  Branch (1415:44): [True: 0, False: 0]
  ------------------
 1416|      0|                                MakeIsoTautString( pINChI_Prev->IsotopicTGroup, pINChI_Prev->nNumberOfIsotopicTGroups,
 1417|      0|                                    strbuf, TAUT_MODE, bOverflow );
 1418|      0|                                if (!bAbcNumbers)
  ------------------
  |  Branch (1418:37): [True: 0, False: 0]
  ------------------
 1419|      0|                                {
 1420|      0|                                    MakeDelim( ")", strbuf, bOverflow );
 1421|      0|                                }
 1422|      0|                            }
 1423|    453|                        }
 1424|       |                        /* else isotopic info is not present in pINChI_Prev */
 1425|    453|                    }
 1426|      0|                    else
 1427|      0|                    {
 1428|      0|                        if (bSecondNonTautPass && pINChI_Taut_Prev && pINChI_Taut_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1428:29): [True: 0, False: 0]
  |  Branch (1428:51): [True: 0, False: 0]
  |  Branch (1428:71): [True: 0, False: 0]
  ------------------
 1429|      0|                        {
 1430|      0|                            if (( pINChI_Taut_Prev->nNumberOfIsotopicAtoms > 0 ||
  ------------------
  |  Branch (1430:35): [True: 0, False: 0]
  ------------------
 1431|      0|                                  pINChI_Taut_Prev->nNumberOfIsotopicTGroups > 0 ))
  ------------------
  |  Branch (1431:35): [True: 0, False: 0]
  ------------------
 1432|      0|                            {
 1433|       |                                /* since pINChI_Prev does not exist, pINChI_Taut_Prev is non-tautomeric */
 1434|       |                                /* and it has non-trivial isotopic info */
 1435|       |                                /*
 1436|       |                                tot_len += MakeDelim( sIdenticalValues, strbuf, bOverflow);
 1437|       |                                */
 1438|      0|                                ;/* pINChI_Taut_Prev isotopic info was output in the main isotopic section */
 1439|      0|                            }
 1440|      0|                            else
 1441|      0|                            {
 1442|      0|                                ; /* pINChI_Taut_Prev exists and has not isotopic info */
 1443|      0|                            }
 1444|      0|                        }
 1445|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 1446|       |                        else
 1447|       |                        {
 1448|       |                            int stop = 1;   /* <BRKPT> */
 1449|       |                        }
 1450|       |#endif
 1451|      0|                    }
 1452|    453|                }
 1453|       |                /* Fix17: moved here 2004-10-08 */
 1454|    453|                pINChI_Prev = pINChI;
 1455|    453|                pINChI_Taut_Prev = pINChI_Taut;
 1456|    453|                mult = 0; /* we do not know whether the item is empty */
 1457|    453|            }
 1458|       |        /* Fix17: moved from here 2004-10-08
 1459|       |        pINChI_Prev = pINChI;
 1460|       |        pINChI_Taut_Prev = pINChI_Taut;
 1461|       |        mult = 0;
 1462|       |        */
 1463|  1.07k|    }
 1464|       |
 1465|    451|    return ( strbuf->nUsedLength - nUsedLength0 );
 1466|    451|}
str_IsoSp2:
 1482|     40|{
 1483|     40|    int          i, ii, ii2, nUsedLength0;
 1484|     40|    INCHI_SORT   *is, *is2, *is0, *is20;
 1485|     40|    INChI        *pINChI, *pINChI_Prev, *pINChI_Taut, *pINChI_Taut_Prev;
 1486|     40|    INChI_Stereo *Stereo, *Stereo_Prev, *Stereo_Taut, *Stereo_Taut_Prev;
 1487|     40|    int          mult, eq2prev, eq2taut, eq2tautPrev = 1, bNext; /* djb-rwth: initialisation required to avoid garbage values */
 1488|     40|    const char  *pPrevEquStr, *pCurrEquStr;
 1489|     40|    int         multPrevEquStr;
 1490|     40|    pINChI_Taut = NULL;
 1491|     40|    pINChI_Prev = NULL;
 1492|     40|    pINChI_Taut_Prev = NULL;
 1493|     40|    mult = 0;
 1494|     40|    bNext = 0;
 1495|     40|    is = NULL;
 1496|     40|    is2 = NULL;
 1497|     40|    is0 = pINChISort;
 1498|     40|    is20 = bSecondNonTautPass ? pINChISort2 : NULL;
  ------------------
  |  Branch (1498:12): [True: 0, False: 40]
  ------------------
 1499|       |    /* djb-rwth: removing redundant code */
 1500|     40|    pPrevEquStr = NULL; /*, *pCurrEquStr;*/
 1501|     40|    multPrevEquStr = 0;
 1502|     40|    nUsedLength0 = strbuf->nUsedLength;
 1503|       |
 1504|       |    /* For each connected component...    */
 1505|    120|    for (i = 0; i <= num_components; i++)
  ------------------
  |  Branch (1505:17): [True: 80, False: 40]
  ------------------
 1506|     80|    {
 1507|       |        /* 1st (taut) pass: bOutType=OUT_TN  ; 2nd (non-taut pass) bOutType=OUT_NT */
 1508|     80|        pINChI = ( i < num_components && ( is = is0 + i, 0 <= ( ii = GET_II( bOutType, is ) ) ) ) ? is->pINChI[ii] : NULL;
  ------------------
  |  |   45|     40|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|     40|#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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 40]
  |  |  ------------------
  |  |   46|     40|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|     80|#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): \
  |  |  ------------------
  |  |  |  |  583|     80|#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): \
  |  |  ------------------
  |  |  |  |   35|     40|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|     40|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|     40|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 40, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 40, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|     40|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 40]
  |  |  |  Branch (46:36): [True: 40, False: 0]
  |  |  ------------------
  |  |   47|     40|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1508:20): [True: 40, False: 40]
  |  Branch (1508:42): [True: 40, False: 0]
  ------------------
 1509|       |        /*================ compare sp2 to previous =====================*/
 1510|     80|        if (bSecondNonTautPass)
  ------------------
  |  Branch (1510:13): [True: 0, False: 80]
  ------------------
 1511|      0|        {
 1512|       |            /* component that was output on the 1st pass */
 1513|      0|            pINChI_Taut = ( i < num_components && ( is2 = is20 + i, 0 <= ( ii2 = GET_II( OUT_T1, is2 ) ) ) ) ? is2->pINChI[ii2] : NULL;
  ------------------
  |  |   45|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [Folded, False: 0]
  |  |  ------------------
  |  |   46|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|      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): \
  |  |  ------------------
  |  |  |  |  583|      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): \
  |  |  ------------------
  |  |  |  |   35|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, Folded]
  |  |  |  Branch (46:36): [Folded, False: 0]
  |  |  ------------------
  |  |   47|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [Folded, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1513:29): [True: 0, False: 0]
  |  Branch (1513:51): [True: 0, False: 0]
  ------------------
 1514|      0|        }
 1515|     80|        eq2taut = 0;
 1516|       |        /*========= if bSecondNonTautPass then compare iso non-taut stereo to other stereo ========*/
 1517|     80|        if (bSecondNonTautPass && bOmitRepetitions)
  ------------------
  |  Branch (1517:13): [True: 0, False: 80]
  |  Branch (1517:35): [True: 0, False: 0]
  ------------------
 1518|      0|        {
 1519|       |            /* compare non-tautomeric isotopic to:
 1520|       |            *   a) non-tautomeric non-isotopic
 1521|       |            *   b) tautomeric non-isotopic
 1522|       |            *   c) tautomeric isotopic
 1523|       |            */
 1524|       |            /* a) compare non-tautomeric isotopic to non-tautomeric non-isotopic */
 1525|      0|            if (!eq2taut)
  ------------------
  |  Branch (1525:17): [True: 0, False: 0]
  ------------------
 1526|      0|            {
 1527|      0|                eq2taut = pINChI &&
  ------------------
  |  Branch (1527:27): [True: 0, False: 0]
  ------------------
 1528|       |                    /* non-taut isotopic */                  /* non-taut non-isotopic */
 1529|      0|                    ( Stereo = pINChI->StereoIsotopic ) && ( Stereo_Taut = pINChI->Stereo ) &&
  ------------------
  |  Branch (1529:21): [True: 0, False: 0]
  |  Branch (1529:60): [True: 0, False: 0]
  ------------------
 1530|      0|                    Eql_INChI_Stereo( Stereo, EQL_SP2, Stereo_Taut, EQL_SP2, 0 );
  ------------------
  |  |  477|      0|#define EQL_SP2 8
  ------------------
                                  Eql_INChI_Stereo( Stereo, EQL_SP2, Stereo_Taut, EQL_SP2, 0 );
  ------------------
  |  |  477|      0|#define EQL_SP2 8
  ------------------
  |  Branch (1530:21): [True: 0, False: 0]
  ------------------
 1531|       |                /* stereo     isotopic non-taut =  non-taut (stereo) */
 1532|      0|                eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT | iiEq2NONTAUT ) : 0;
  ------------------
  |  |   55|      0|#define iiSTEREO      0x0001  /* stereo (sp2 or sp3)   */
  ------------------
                              eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT | iiEq2NONTAUT ) : 0;
  ------------------
  |  |   64|      0|#define iitISO       0x0010  /* Isotopic */
  ------------------
                              eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT | iiEq2NONTAUT ) : 0;
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
                              eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT | iiEq2NONTAUT ) : 0;
  ------------------
  |  |   71|      0|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
  |  Branch (1532:27): [True: 0, False: 0]
  ------------------
 1533|      0|            }
 1534|       |            /* b) compare non-tautomeric isotopic to tautomeric non-isotopic */
 1535|      0|            if (!eq2taut)
  ------------------
  |  Branch (1535:17): [True: 0, False: 0]
  ------------------
 1536|      0|            {
 1537|      0|                eq2taut = pINChI && pINChI_Taut &&
  ------------------
  |  Branch (1537:27): [True: 0, False: 0]
  |  Branch (1537:37): [True: 0, False: 0]
  ------------------
 1538|       |                    /* non-taut isotopic */                  /* taut non-isotopic */
 1539|      0|                    ( Stereo = pINChI->StereoIsotopic ) && ( Stereo_Taut = pINChI_Taut->Stereo ) &&
  ------------------
  |  Branch (1539:21): [True: 0, False: 0]
  |  Branch (1539:60): [True: 0, False: 0]
  ------------------
 1540|      0|                    Eql_INChI_Stereo( Stereo, EQL_SP2, Stereo_Taut, EQL_SP2, 0 );
  ------------------
  |  |  477|      0|#define EQL_SP2 8
  ------------------
                                  Eql_INChI_Stereo( Stereo, EQL_SP2, Stereo_Taut, EQL_SP2, 0 );
  ------------------
  |  |  477|      0|#define EQL_SP2 8
  ------------------
  |  Branch (1540:21): [True: 0, False: 0]
  ------------------
 1541|       |                /* stereo     isotopic non-taut =  taut (stereo) */
 1542|      0|                eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT ) : 0;
  ------------------
  |  |   55|      0|#define iiSTEREO      0x0001  /* stereo (sp2 or sp3)   */
  ------------------
                              eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT ) : 0;
  ------------------
  |  |   64|      0|#define iitISO       0x0010  /* Isotopic */
  ------------------
                              eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT ) : 0;
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
  |  Branch (1542:27): [True: 0, False: 0]
  ------------------
 1543|      0|            }
 1544|       |            /* c) compare non-tautomeric isotopic to tautomeric isotopic */
 1545|      0|            if (!eq2taut && bSecondNonTautPass && bOmitRepetitions)
  ------------------
  |  Branch (1545:17): [True: 0, False: 0]
  |  Branch (1545:29): [True: 0, False: 0]
  |  Branch (1545:51): [True: 0, False: 0]
  ------------------
 1546|      0|            {
 1547|      0|                eq2taut = pINChI && pINChI_Taut &&
  ------------------
  |  Branch (1547:27): [True: 0, False: 0]
  |  Branch (1547:37): [True: 0, False: 0]
  ------------------
 1548|      0|                    ( Stereo = pINChI->StereoIsotopic ) && ( Stereo_Taut = pINChI_Taut->StereoIsotopic ) &&
  ------------------
  |  Branch (1548:21): [True: 0, False: 0]
  |  Branch (1548:60): [True: 0, False: 0]
  ------------------
 1549|      0|                    Eql_INChI_Stereo( Stereo, EQL_SP2, Stereo_Taut, EQL_SP2, 0 );
  ------------------
  |  |  477|      0|#define EQL_SP2 8
  ------------------
                                  Eql_INChI_Stereo( Stereo, EQL_SP2, Stereo_Taut, EQL_SP2, 0 );
  ------------------
  |  |  477|      0|#define EQL_SP2 8
  ------------------
  |  Branch (1549:21): [True: 0, False: 0]
  ------------------
 1550|       |                /* stereo     isotopic non-taut =  isotopic taut (stereo) */
 1551|      0|                eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT | iiEq2ISO ) : 0;
  ------------------
  |  |   55|      0|#define iiSTEREO      0x0001  /* stereo (sp2 or sp3)   */
  ------------------
                              eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT | iiEq2ISO ) : 0;
  ------------------
  |  |   64|      0|#define iitISO       0x0010  /* Isotopic */
  ------------------
                              eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT | iiEq2ISO ) : 0;
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
                              eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT | iiEq2ISO ) : 0;
  ------------------
  |  |   72|      0|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
  |  Branch (1551:27): [True: 0, False: 0]
  ------------------
 1552|      0|            }
 1553|       |#if ( FIX_EMPTY_LAYER_BUG == 1 )
 1554|       |            if (!eq2taut && pINChI && !( ( Stereo = pINChI->StereoIsotopic ) &&
 1555|       |                Eql_INChI_Stereo( Stereo, EQL_SP2, NULL, EQL_EXISTS, 0 ) ))
 1556|       |            {
 1557|       |                /* component has no stereo; check whether it has stereo in the preceding layers */
 1558|       |                if (pINChI_Taut && ( Stereo_Taut = pINChI_Taut->Stereo ) && /* F is not empty */
 1559|       |                    Eql_INChI_Stereo( Stereo_Taut, EQL_SP2, NULL, EQL_EXISTS, 0 ) ||
 1560|       |                    !( pINChI_Taut && ( Stereo_Taut = pINChI_Taut->Stereo ) &&  /* M is empty and ... */
 1561|       |                        Eql_INChI_Stereo( Stereo_Taut, EQL_SP2, NULL, EQL_EXISTS, 0 ) ) &&
 1562|       |                        ( pINChI_Taut && ( Stereo_Taut = pINChI_Taut->StereoIsotopic ) &&  /* ... MI is not empty */
 1563|       |                            Eql_INChI_Stereo( Stereo_Taut, EQL_SP2, NULL, EQL_EXISTS, 0 ) ))
 1564|       |                {
 1565|       |
 1566|       |                    eq2taut = iiEmpty; /* the component has stereo in the preceding layer  */
 1567|       |                }
 1568|       |            }
 1569|       |#endif
 1570|      0|        }
 1571|     80|        else
 1572|     80|        {
 1573|       |            /*========= if not bSecondNonTautPass then compare iso taut stereo to non-iso taut ========*/
 1574|     80|            if (!bSecondNonTautPass && bOmitRepetitions)
  ------------------
  |  Branch (1574:17): [True: 80, False: 0]
  |  Branch (1574:40): [True: 80, False: 0]
  ------------------
 1575|     80|            {
 1576|       |                /* compare tautomeric isotopic to tautomeric non-isotopic */
 1577|     80|                if (!eq2taut)
  ------------------
  |  Branch (1577:21): [True: 80, False: 0]
  ------------------
 1578|     80|                {
 1579|     80|                    eq2taut = pINChI &&
  ------------------
  |  Branch (1579:31): [True: 40, False: 40]
  ------------------
 1580|       |                        /* taut isotopic */                  /* taut non-isotopic */
 1581|     40|                        ( Stereo = pINChI->StereoIsotopic ) && ( Stereo_Taut = pINChI->Stereo ) &&
  ------------------
  |  Branch (1581:25): [True: 40, False: 0]
  |  Branch (1581:64): [True: 2, False: 38]
  ------------------
 1582|      2|                        Eql_INChI_Stereo( Stereo, EQL_SP2, Stereo_Taut, EQL_SP2, 0 );
  ------------------
  |  |  477|      2|#define EQL_SP2 8
  ------------------
                                      Eql_INChI_Stereo( Stereo, EQL_SP2, Stereo_Taut, EQL_SP2, 0 );
  ------------------
  |  |  477|      2|#define EQL_SP2 8
  ------------------
  |  Branch (1582:25): [True: 0, False: 2]
  ------------------
 1583|       |                    /* stereo     isotopic taut =  taut (stereo) */
 1584|     80|                    eq2taut = eq2taut ? ( iiSTEREO | iitISO ) : 0;
  ------------------
  |  |   55|      0|#define iiSTEREO      0x0001  /* stereo (sp2 or sp3)   */
  ------------------
                                  eq2taut = eq2taut ? ( iiSTEREO | iitISO ) : 0;
  ------------------
  |  |   64|      0|#define iitISO       0x0010  /* Isotopic */
  ------------------
  |  Branch (1584:31): [True: 0, False: 80]
  ------------------
 1585|       |#if ( FIX_EMPTY_LAYER_BUG == 1 )
 1586|       |                    if (!eq2taut && pINChI && !( ( Stereo = pINChI->StereoIsotopic ) &&
 1587|       |                                                 Eql_INChI_Stereo( Stereo, EQL_SP2, NULL, EQL_EXISTS, 0 ) ))
 1588|       |                    {
 1589|       |                        /* component has no MI stereo; check whether it has stereo in the preceding layer M */
 1590|       |                        if (( Stereo_Taut = pINChI->Stereo ) &&
 1591|       |                            Eql_INChI_Stereo( Stereo_Taut, EQL_SP2, NULL, EQL_EXISTS, 0 ))
 1592|       |                        {
 1593|       |                            eq2taut = iiEmpty; /* the component has stereo in the preceding layer  */
 1594|       |                        }
 1595|       |                    }
 1596|       |#endif
 1597|     80|                }
 1598|     80|            }
 1599|     80|        }
 1600|     80|        if (eq2taut)
  ------------------
  |  Branch (1600:13): [True: 0, False: 80]
  ------------------
 1601|      0|        {
 1602|       |            /* we may be here only in case of the current layer found equal in another layer the same component */
 1603|      0|            if (pINChI_Prev && pINChI_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1603:17): [True: 0, False: 0]
  |  Branch (1603:32): [True: 0, False: 0]
  ------------------
 1604|      0|            {
 1605|       |                /* previous component exists; output it before output the current component */
 1606|      0|                if (bNext++)
  ------------------
  |  Branch (1606:21): [True: 0, False: 0]
  ------------------
 1607|      0|                {
 1608|      0|                    MakeDelim( sCompDelim, strbuf, bOverflow );
 1609|      0|                }
 1610|      0|                if (( Stereo_Prev = pINChI_Prev->StereoIsotopic ) && Stereo_Prev->nNumberOfStereoBonds > 0)
  ------------------
  |  Branch (1610:21): [True: 0, False: 0]
  |  Branch (1610:70): [True: 0, False: 0]
  ------------------
 1611|      0|                {
 1612|      0|                    MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
 1613|       |
 1614|      0|                    MakeStereoString( Stereo_Prev->nBondAtom1, Stereo_Prev->nBondAtom2,
 1615|      0|                        Stereo_Prev->b_parity,
 1616|      0|                        0, Stereo_Prev->nNumberOfStereoBonds,
 1617|      0|                        strbuf, TAUT_MODE, bOverflow );
 1618|      0|                }
 1619|      0|            }
 1620|      0|            else
 1621|      0|            {
 1622|      0|                if (pINChI_Taut_Prev && pINChI_Taut_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1622:21): [True: 0, False: 0]
  |  Branch (1622:41): [True: 0, False: 0]
  ------------------
 1623|      0|                {
 1624|       |                    /* previous non-taut component exists only in taut list */
 1625|      0|                    if (bNext++)
  ------------------
  |  Branch (1625:25): [True: 0, False: 0]
  ------------------
 1626|      0|                    {
 1627|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1628|      0|                    }
 1629|       |                    /* do not output stereo of non-tautomeric in non-taut layer: it has been output in the main layer */
 1630|      0|                }
 1631|      0|            }
 1632|       |            /* we have found another (previously printed) layer of the current component equal to this layer */
 1633|       |            /* output this (current) equivalence mark = EquString(eq2taut) */
 1634|      0|            pCurrEquStr = EquString( eq2taut );
 1635|      0|            if (multPrevEquStr && pPrevEquStr)
  ------------------
  |  Branch (1635:17): [True: 0, False: 0]
  |  Branch (1635:35): [True: 0, False: 0]
  ------------------
 1636|      0|            {
 1637|      0|                if (pCurrEquStr && !strcmp( pCurrEquStr, pPrevEquStr ))
  ------------------
  |  Branch (1637:21): [True: 0, False: 0]
  |  Branch (1637:36): [True: 0, False: 0]
  ------------------
 1638|      0|                {
 1639|      0|                    multPrevEquStr++;
 1640|      0|                }
 1641|      0|                else
 1642|      0|                {
 1643|       |                    /* new EqStr is different; output it */
 1644|      0|                    if (bNext++)
  ------------------
  |  Branch (1644:25): [True: 0, False: 0]
  ------------------
 1645|      0|                    {
 1646|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1647|      0|                    }
 1648|      0|                    MakeEqStr( pPrevEquStr, multPrevEquStr, strbuf, bOverflow );
 1649|      0|                    pPrevEquStr = pCurrEquStr;
 1650|      0|                    multPrevEquStr = 1;
 1651|      0|                }
 1652|      0|            }
 1653|      0|            else
 1654|      0|            {
 1655|      0|                pPrevEquStr = pCurrEquStr;
 1656|      0|                multPrevEquStr = 1;
 1657|      0|            }
 1658|      0|            pINChI_Prev = NULL; /* pINChI_Prev sp2 does not exist since */
 1659|      0|            pINChI_Taut_Prev = NULL; /* pINChI has just been printed */
 1660|      0|            mult = 0;
 1661|      0|            eq2tautPrev = 1;     /* pINChI_Prev and pINChI_Taut_Prev have already been */
 1662|      0|        }
 1663|     80|        else
 1664|     80|        {
 1665|     80|            if (eq2tautPrev)
  ------------------
  |  Branch (1665:17): [True: 40, False: 40]
  ------------------
 1666|     40|            {
 1667|       |                /* at this point pINChI_Prev does not exist; however, pINChI */
 1668|       |                /*might have been discovered and it is different from pINChI_Taut */
 1669|     40|                if (multPrevEquStr && pPrevEquStr)
  ------------------
  |  Branch (1669:21): [True: 0, False: 40]
  |  Branch (1669:39): [True: 0, False: 0]
  ------------------
 1670|      0|                {
 1671|       |                    /* new EqStr is different; output it */
 1672|      0|                    if (bNext++)
  ------------------
  |  Branch (1672:25): [True: 0, False: 0]
  ------------------
 1673|      0|                    {
 1674|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1675|      0|                    }
 1676|      0|                    MakeEqStr( pPrevEquStr, multPrevEquStr, strbuf, bOverflow );
 1677|      0|                    pPrevEquStr = NULL;
 1678|      0|                    multPrevEquStr = 0;
 1679|      0|                }
 1680|     40|                eq2tautPrev = 0;
 1681|     40|                pINChI_Prev = pINChI;
 1682|     40|                pINChI_Taut_Prev = pINChI_Taut;
 1683|     40|                mult = 0;
 1684|     40|            }
 1685|     40|            else
 1686|     40|            {
 1687|       |                /* current layer is different from previously printed layers of the current component */
 1688|       |                /* compare the current layer to this layer of the previous component: */
 1689|       |                /* check whether pINChI and pINChI_Prev have non-zero identical stereo sp2 */
 1690|       |                /*================ compare iso sp2 to previous =====================*/
 1691|     40|                eq2prev = bUseMulipliers &&
  ------------------
  |  Branch (1691:27): [True: 40, False: 0]
  ------------------
 1692|     40|                    pINChI && pINChI_Prev &&
  ------------------
  |  Branch (1692:21): [True: 0, False: 40]
  |  Branch (1692:31): [True: 0, False: 0]
  ------------------
 1693|      0|                    ( Stereo = pINChI->StereoIsotopic ) && ( Stereo_Prev = pINChI_Prev->StereoIsotopic ) &&
  ------------------
  |  Branch (1693:21): [True: 0, False: 0]
  |  Branch (1693:60): [True: 0, False: 0]
  ------------------
 1694|      0|                    Eql_INChI_Stereo( Stereo, EQL_SP2, Stereo_Prev, EQL_SP2, 0 );
  ------------------
  |  |  477|      0|#define EQL_SP2 8
  ------------------
                                  Eql_INChI_Stereo( Stereo, EQL_SP2, Stereo_Prev, EQL_SP2, 0 );
  ------------------
  |  |  477|      0|#define EQL_SP2 8
  ------------------
  |  Branch (1694:21): [True: 0, False: 0]
  ------------------
 1695|     40|                if (eq2prev)
  ------------------
  |  Branch (1695:21): [True: 0, False: 40]
  ------------------
 1696|      0|                {
 1697|      0|                    mult++; /* mult = (number of non-empty equal items)-1 */
 1698|      0|                    continue;
 1699|      0|                }
 1700|     40|                else
 1701|     40|                {
 1702|       |                    /* the current layer is different from this layer of the previous component */
 1703|       |                    /* therefore print the current layer */
 1704|     40|                    if (bNext++)
  ------------------
  |  Branch (1704:25): [True: 0, False: 40]
  ------------------
 1705|      0|                    {
 1706|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1707|      0|                    }
 1708|     40|                    if (pINChI_Prev && pINChI_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1708:25): [True: 40, False: 0]
  |  Branch (1708:40): [True: 40, False: 0]
  ------------------
 1709|     40|                    {
 1710|     40|                        if (( Stereo_Prev = pINChI_Prev->StereoIsotopic ) && Stereo_Prev->nNumberOfStereoBonds > 0)
  ------------------
  |  Branch (1710:29): [True: 40, False: 0]
  |  Branch (1710:78): [True: 40, False: 0]
  ------------------
 1711|     40|                        {
 1712|     40|                            MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
 1713|       |
 1714|     40|                            MakeStereoString( Stereo_Prev->nBondAtom1, Stereo_Prev->nBondAtom2,
 1715|     40|                                Stereo_Prev->b_parity,
 1716|     40|                                0, Stereo_Prev->nNumberOfStereoBonds,
 1717|     40|                                strbuf, TAUT_MODE, bOverflow );
 1718|     40|                        }
 1719|       |                        /* else sp2 info is not present in pINChI_Prev */
 1720|     40|                    }
 1721|      0|                    else
 1722|      0|                    {/* do not print pINChI_Prev because it either do not exist of have already been printed */
 1723|      0|                        if (bSecondNonTautPass && pINChI_Taut_Prev && pINChI_Taut_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1723:29): [True: 0, False: 0]
  |  Branch (1723:51): [True: 0, False: 0]
  |  Branch (1723:71): [True: 0, False: 0]
  ------------------
 1724|      0|                        {
 1725|      0|                            if (( Stereo_Taut_Prev = pINChI_Taut_Prev->StereoIsotopic ) && Stereo_Taut_Prev->nNumberOfStereoBonds > 0)
  ------------------
  |  Branch (1725:33): [True: 0, False: 0]
  |  Branch (1725:92): [True: 0, False: 0]
  ------------------
 1726|      0|                            {
 1727|       |                                /* since pINChI_Prev does not exist, pINChI_Taut_Prev is non-tautomeric */
 1728|       |                                /* and it has non-trivial sp2 info */
 1729|       |                                /*
 1730|       |                                tot_len += MakeDelim( sIdenticalValues, strbuf, bOverflow);
 1731|       |                                */
 1732|      0|                                ;/* pINChI_Taut_Prev sp3 info was output in the main stereo section */
 1733|      0|                            }
 1734|      0|                            else
 1735|      0|                            {
 1736|      0|                                ; /* pINChI_Taut_Prev exists and has not sp2 info */
 1737|      0|                            }
 1738|      0|                        }
 1739|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 1740|       |                        else
 1741|       |                        {
 1742|       |                            int stop = 1;   /* <BRKPT> */
 1743|       |                        }
 1744|       |#endif
 1745|      0|                    }
 1746|     40|                }
 1747|     40|                pINChI_Prev = pINChI;
 1748|     40|                pINChI_Taut_Prev = pINChI_Taut;
 1749|     40|                mult = 0; /* we do not know whether the item is empty */
 1750|     40|            }
 1751|     80|        }
 1752|     80|    }
 1753|       |
 1754|     40|    return ( strbuf->nUsedLength - nUsedLength0 );
 1755|     40|}
str_IsoSp3:
 1772|     65|{
 1773|     65|    int          i, ii, ii2, nUsedLength0;
 1774|     65|    INCHI_SORT   *is, *is2, *is0, *is20;
 1775|     65|    INChI        *pINChI, *pINChI_Prev, *pINChI_Taut, *pINChI_Taut_Prev;
 1776|     65|    INChI_Stereo *Stereo, *Stereo_Prev, *Stereo_Taut, *Stereo_Taut_Prev;
 1777|     65|    int          mult, eq2prev, eq2taut, eq2tautPrev, bNext;
 1778|     65|    const char  *pPrevEquStr, *pCurrEquStr;
 1779|     65|    int         multPrevEquStr;
 1780|     65|    pINChI_Taut = NULL;
 1781|     65|    pINChI_Prev = NULL;
 1782|     65|    pINChI_Taut_Prev = NULL;
 1783|     65|    mult = 0;
 1784|     65|    bNext = 0;
 1785|     65|    is = NULL;
 1786|     65|    is2 = NULL;
 1787|     65|    is0 = pINChISort;
 1788|     65|    is20 = bSecondNonTautPass ? pINChISort2 : NULL;
  ------------------
  |  Branch (1788:12): [True: 0, False: 65]
  ------------------
 1789|       |    /* djb-rwth: removing redundant code */
 1790|     65|    eq2tautPrev = 1; /* pINChI_Prev (previous pINChI) does not exist */
 1791|     65|    pPrevEquStr = NULL; /*, *pCurrEquStr;*/
 1792|     65|    multPrevEquStr = 0;
 1793|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
 1794|       |#else
 1795|     65|    bRelRac = 0;
 1796|     65|#endif
 1797|     65|    nUsedLength0 = strbuf->nUsedLength;
 1798|       |
 1799|       |    /* For each connected component...    */
 1800|    219|    for (i = 0; i <= num_components; i++)
  ------------------
  |  Branch (1800:17): [True: 154, False: 65]
  ------------------
 1801|    154|    {
 1802|       |
 1803|       |        /* 1st (taut) pass: bOutType=OUT_TN  ; 2nd (non-taut pass) bOutType=OUT_NT */
 1804|    154|        pINChI = ( i < num_components && ( is = is0 + i, 0 <= ( ii = GET_II( bOutType, is ) ) ) ) ? is->pINChI[ii] : NULL;
  ------------------
  |  |   45|     89|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|     89|#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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 89]
  |  |  ------------------
  |  |   46|     89|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|    178|#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): \
  |  |  ------------------
  |  |  |  |  583|    178|#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): \
  |  |  ------------------
  |  |  |  |   35|     89|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|     89|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|     89|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 89, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 89, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|     89|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 89]
  |  |  |  Branch (46:36): [True: 89, False: 0]
  |  |  ------------------
  |  |   47|     89|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1804:20): [True: 89, False: 65]
  |  Branch (1804:42): [True: 89, False: 0]
  ------------------
 1805|       |        /*================ compare sp2 to previous =====================*/
 1806|    154|        if (bSecondNonTautPass)
  ------------------
  |  Branch (1806:13): [True: 0, False: 154]
  ------------------
 1807|      0|        {
 1808|       |            /* component that was output on the 1st pass */
 1809|      0|            pINChI_Taut = ( i < num_components && ( is2 = is20 + i, 0 <= ( ii2 = GET_II( OUT_T1, is2 ) ) ) ) ? is2->pINChI[ii2] : NULL;
  ------------------
  |  |   45|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [Folded, False: 0]
  |  |  ------------------
  |  |   46|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|      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): \
  |  |  ------------------
  |  |  |  |  583|      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): \
  |  |  ------------------
  |  |  |  |   35|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, Folded]
  |  |  |  Branch (46:36): [Folded, False: 0]
  |  |  ------------------
  |  |   47|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [Folded, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1809:29): [True: 0, False: 0]
  |  Branch (1809:51): [True: 0, False: 0]
  ------------------
 1810|      0|        }
 1811|    154|        eq2taut = 0;
 1812|       |        /*========= if bSecondNonTautPass then compare iso non-taut stereo to other stereo ========*/
 1813|    154|        if (bSecondNonTautPass && bOmitRepetitions)
  ------------------
  |  Branch (1813:13): [True: 0, False: 154]
  |  Branch (1813:35): [True: 0, False: 0]
  ------------------
 1814|      0|        {
 1815|       |            /* compare non-tautomeric isotopic to:
 1816|       |            *   a) non-tautomeric non-isotopic
 1817|       |            *   b) tautomeric non-isotopic
 1818|       |            *   c) tautomeric isotopic
 1819|       |            */
 1820|       |            /* a) compare non-tautomeric isotopic to non-tautomeric non-isotopic */
 1821|      0|            if (!eq2taut)
  ------------------
  |  Branch (1821:17): [True: 0, False: 0]
  ------------------
 1822|      0|            {
 1823|      0|                eq2taut = pINChI && /* non-taut isotopic */                  /* non-taut non-isotopic */
  ------------------
  |  Branch (1823:27): [True: 0, False: 0]
  ------------------
 1824|      0|                    ( Stereo = pINChI->StereoIsotopic ) && ( Stereo_Taut = pINChI->Stereo ) &&
  ------------------
  |  Branch (1824:21): [True: 0, False: 0]
  |  Branch (1824:60): [True: 0, False: 0]
  ------------------
 1825|      0|                    Eql_INChI_Stereo( Stereo, EQL_SP3, Stereo_Taut, EQL_SP3, bRelRac );
  ------------------
  |  |  475|      0|#define EQL_SP3 2
  ------------------
                                  Eql_INChI_Stereo( Stereo, EQL_SP3, Stereo_Taut, EQL_SP3, bRelRac );
  ------------------
  |  |  475|      0|#define EQL_SP3 2
  ------------------
  |  Branch (1825:21): [True: 0, False: 0]
  ------------------
 1826|       |                /* stereo     isotopic non-taut =  non-taut (stereo) */
 1827|      0|                eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT | iiEq2NONTAUT ) : 0;
  ------------------
  |  |   55|      0|#define iiSTEREO      0x0001  /* stereo (sp2 or sp3)   */
  ------------------
                              eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT | iiEq2NONTAUT ) : 0;
  ------------------
  |  |   64|      0|#define iitISO       0x0010  /* Isotopic */
  ------------------
                              eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT | iiEq2NONTAUT ) : 0;
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
                              eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT | iiEq2NONTAUT ) : 0;
  ------------------
  |  |   71|      0|#define iiEq2NONTAUT 0x0040  /* non-tautomeric */
  ------------------
  |  Branch (1827:27): [True: 0, False: 0]
  ------------------
 1828|      0|            }
 1829|       |            /* b) compare non-tautomeric isotopic to tautomeric non-isotopic */
 1830|      0|            if (!eq2taut)
  ------------------
  |  Branch (1830:17): [True: 0, False: 0]
  ------------------
 1831|      0|            {
 1832|      0|                eq2taut = pINChI && pINChI_Taut &&
  ------------------
  |  Branch (1832:27): [True: 0, False: 0]
  |  Branch (1832:37): [True: 0, False: 0]
  ------------------
 1833|       |                    /* non-taut isotopic */                  /* taut non-isotopic */
 1834|      0|                    ( Stereo = pINChI->StereoIsotopic ) && ( Stereo_Taut = pINChI_Taut->Stereo ) &&
  ------------------
  |  Branch (1834:21): [True: 0, False: 0]
  |  Branch (1834:60): [True: 0, False: 0]
  ------------------
 1835|      0|                    Eql_INChI_Stereo( Stereo, EQL_SP3, Stereo_Taut, EQL_SP3, bRelRac );
  ------------------
  |  |  475|      0|#define EQL_SP3 2
  ------------------
                                  Eql_INChI_Stereo( Stereo, EQL_SP3, Stereo_Taut, EQL_SP3, bRelRac );
  ------------------
  |  |  475|      0|#define EQL_SP3 2
  ------------------
  |  Branch (1835:21): [True: 0, False: 0]
  ------------------
 1836|       |                /* stereo     isotopic non-taut =  taut (stereo) */
 1837|      0|                eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT ) : 0;
  ------------------
  |  |   55|      0|#define iiSTEREO      0x0001  /* stereo (sp2 or sp3)   */
  ------------------
                              eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT ) : 0;
  ------------------
  |  |   64|      0|#define iitISO       0x0010  /* Isotopic */
  ------------------
                              eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT ) : 0;
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
  |  Branch (1837:27): [True: 0, False: 0]
  ------------------
 1838|      0|            }
 1839|       |            /* c) compare non-tautomeric isotopic to tautomeric isotopic */
 1840|      0|            if (!eq2taut && bSecondNonTautPass && bOmitRepetitions)
  ------------------
  |  Branch (1840:17): [True: 0, False: 0]
  |  Branch (1840:29): [True: 0, False: 0]
  |  Branch (1840:51): [True: 0, False: 0]
  ------------------
 1841|      0|            {
 1842|      0|                eq2taut = pINChI && pINChI_Taut &&
  ------------------
  |  Branch (1842:27): [True: 0, False: 0]
  |  Branch (1842:37): [True: 0, False: 0]
  ------------------
 1843|      0|                    ( Stereo = pINChI->StereoIsotopic ) && ( Stereo_Taut = pINChI_Taut->StereoIsotopic ) &&
  ------------------
  |  Branch (1843:21): [True: 0, False: 0]
  |  Branch (1843:60): [True: 0, False: 0]
  ------------------
 1844|      0|                    Eql_INChI_Stereo( Stereo, EQL_SP3, Stereo_Taut, EQL_SP3, bRelRac );
  ------------------
  |  |  475|      0|#define EQL_SP3 2
  ------------------
                                  Eql_INChI_Stereo( Stereo, EQL_SP3, Stereo_Taut, EQL_SP3, bRelRac );
  ------------------
  |  |  475|      0|#define EQL_SP3 2
  ------------------
  |  Branch (1844:21): [True: 0, False: 0]
  ------------------
 1845|       |                /* stereo     isotopic non-taut =  isotopic taut (stereo) */
 1846|      0|                eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT | iiEq2ISO ) : 0;
  ------------------
  |  |   55|      0|#define iiSTEREO      0x0001  /* stereo (sp2 or sp3)   */
  ------------------
                              eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT | iiEq2ISO ) : 0;
  ------------------
  |  |   64|      0|#define iitISO       0x0010  /* Isotopic */
  ------------------
                              eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT | iiEq2ISO ) : 0;
  ------------------
  |  |   65|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
                              eq2taut = eq2taut ? ( iiSTEREO | iitISO | iitNONTAUT | iiEq2ISO ) : 0;
  ------------------
  |  |   72|      0|#define iiEq2ISO     0x0080  /* isotopic */
  ------------------
  |  Branch (1846:27): [True: 0, False: 0]
  ------------------
 1847|      0|            }
 1848|       |#if ( FIX_EMPTY_LAYER_BUG == 1 )
 1849|       |            if (!eq2taut && pINChI && !( ( Stereo = pINChI->StereoIsotopic ) &&
 1850|       |                Eql_INChI_Stereo( Stereo, EQL_SP3, NULL, EQL_EXISTS, 0 ) ))
 1851|       |            {
 1852|       |                /* component has no stereo; check whether it has stereo in the preceding layers */
 1853|       |                if (pINChI_Taut && ( Stereo_Taut = pINChI_Taut->Stereo ) && /* F is not empty */
 1854|       |                    Eql_INChI_Stereo( Stereo_Taut, EQL_SP3, NULL, EQL_EXISTS, 0 ) ||
 1855|       |                    !( pINChI_Taut && ( Stereo_Taut = pINChI_Taut->Stereo ) &&  /* M is empty and ... */
 1856|       |                        Eql_INChI_Stereo( Stereo_Taut, EQL_SP3, NULL, EQL_EXISTS, 0 ) ) &&
 1857|       |                        ( pINChI_Taut && ( Stereo_Taut = pINChI_Taut->StereoIsotopic ) &&  /* ... MI is not empty */
 1858|       |                            Eql_INChI_Stereo( Stereo_Taut, EQL_SP3, NULL, EQL_EXISTS, 0 ) ))
 1859|       |                {
 1860|       |
 1861|       |                    eq2taut = iiEmpty; /* the component has stereo in the preceding layer  */
 1862|       |                }
 1863|       |            }
 1864|       |#endif
 1865|      0|        }
 1866|    154|        else
 1867|    154|        {
 1868|       |            /*========= if not bSecondNonTautPass then compare iso taut stereo to non-iso taut ========*/
 1869|    154|            if (!bSecondNonTautPass && bOmitRepetitions)
  ------------------
  |  Branch (1869:17): [True: 154, False: 0]
  |  Branch (1869:40): [True: 154, False: 0]
  ------------------
 1870|    154|            {
 1871|       |                /* compare tautomeric isotopic to tautomeric non-isotopic */
 1872|    154|                if (!eq2taut)
  ------------------
  |  Branch (1872:21): [True: 154, False: 0]
  ------------------
 1873|    154|                {
 1874|    154|                    eq2taut = pINChI &&
  ------------------
  |  Branch (1874:31): [True: 89, False: 65]
  ------------------
 1875|       |                        /* taut isotopic */                  /* taut non-isotopic */
 1876|     89|                        ( Stereo = pINChI->StereoIsotopic ) && ( Stereo_Taut = pINChI->Stereo ) &&
  ------------------
  |  Branch (1876:25): [True: 89, False: 0]
  |  Branch (1876:64): [True: 34, False: 55]
  ------------------
 1877|     34|                        Eql_INChI_Stereo( Stereo, EQL_SP3, Stereo_Taut, EQL_SP3, bRelRac );
  ------------------
  |  |  475|     34|#define EQL_SP3 2
  ------------------
                                      Eql_INChI_Stereo( Stereo, EQL_SP3, Stereo_Taut, EQL_SP3, bRelRac );
  ------------------
  |  |  475|     34|#define EQL_SP3 2
  ------------------
  |  Branch (1877:25): [True: 3, False: 31]
  ------------------
 1878|       |                    /* stereo     isotopic taut =  taut (stereo) */
 1879|    154|                    eq2taut = eq2taut ? ( iiSTEREO | iitISO ) : 0;
  ------------------
  |  |   55|      3|#define iiSTEREO      0x0001  /* stereo (sp2 or sp3)   */
  ------------------
                                  eq2taut = eq2taut ? ( iiSTEREO | iitISO ) : 0;
  ------------------
  |  |   64|      3|#define iitISO       0x0010  /* Isotopic */
  ------------------
  |  Branch (1879:31): [True: 3, False: 151]
  ------------------
 1880|       |#if ( FIX_EMPTY_LAYER_BUG == 1 )
 1881|       |                    if (!eq2taut && pINChI && !( ( Stereo = pINChI->StereoIsotopic ) &&
 1882|       |                                                 Eql_INChI_Stereo( Stereo, EQL_SP3, NULL, EQL_EXISTS, 0 ) ))
 1883|       |                    {
 1884|       |                        /* component has no MI stereo; check whether it has stereo in the preceding layer M */
 1885|       |                        if (( Stereo_Taut = pINChI->Stereo ) &&
 1886|       |                            Eql_INChI_Stereo( Stereo_Taut, EQL_SP3, NULL, EQL_EXISTS, 0 ))
 1887|       |                        {
 1888|       |                            eq2taut = iiEmpty; /* the component has stereo in the preceding layer  */
 1889|       |                        }
 1890|       |                    }
 1891|       |#endif
 1892|    154|                }
 1893|    154|            }
 1894|    154|        }
 1895|    154|        if (eq2taut)
  ------------------
  |  Branch (1895:13): [True: 3, False: 151]
  ------------------
 1896|      3|        {
 1897|       |            /* we may be here only in case of the current layer found equal in another layer the same component */
 1898|      3|            if (pINChI_Prev && pINChI_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1898:17): [True: 1, False: 2]
  |  Branch (1898:32): [True: 1, False: 0]
  ------------------
 1899|      1|            {
 1900|       |                /* previous component exists; output it before output the current component */
 1901|      1|                if (bNext++)
  ------------------
  |  Branch (1901:21): [True: 0, False: 1]
  ------------------
 1902|      0|                {
 1903|      0|                    MakeDelim( sCompDelim, strbuf, bOverflow );
 1904|      0|                }
 1905|      1|                if (( Stereo_Prev = pINChI_Prev->StereoIsotopic ) && Stereo_Prev->nNumberOfStereoCenters > bRelRac)
  ------------------
  |  Branch (1905:21): [True: 1, False: 0]
  |  Branch (1905:70): [True: 1, False: 0]
  ------------------
 1906|      1|                {
 1907|      1|                    MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
 1908|       |
 1909|      1|                    MakeStereoString( Stereo_Prev->nNumber, NULL, Stereo_Prev->t_parity,
 1910|      1|                        0, Stereo_Prev->nNumberOfStereoCenters,
 1911|      1|                        strbuf, TAUT_MODE, bOverflow );
 1912|      1|                }
 1913|      1|            }
 1914|      2|            else
 1915|      2|            {
 1916|      2|                if (pINChI_Taut_Prev && pINChI_Taut_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1916:21): [True: 0, False: 2]
  |  Branch (1916:41): [True: 0, False: 0]
  ------------------
 1917|      0|                {
 1918|       |                    /* previous non-taut component exists only in taut list */
 1919|      0|                    if (bNext++)
  ------------------
  |  Branch (1919:25): [True: 0, False: 0]
  ------------------
 1920|      0|                    {
 1921|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1922|      0|                    }
 1923|       |                    /* do not output stereo of non-tautomeric in non-taut layer: it has been output in the main layer */
 1924|      0|                }
 1925|      2|            }
 1926|       |            /* we have found another (previously printed) layer of the current component equal to this layer */
 1927|       |            /* output this (current) equivalence mark = EquString(eq2taut) */
 1928|      3|            pCurrEquStr = EquString( eq2taut );
 1929|      3|            if (multPrevEquStr && pPrevEquStr)
  ------------------
  |  Branch (1929:17): [True: 0, False: 3]
  |  Branch (1929:35): [True: 0, False: 0]
  ------------------
 1930|      0|            {
 1931|      0|                if (pCurrEquStr && !strcmp( pCurrEquStr, pPrevEquStr ))
  ------------------
  |  Branch (1931:21): [True: 0, False: 0]
  |  Branch (1931:36): [True: 0, False: 0]
  ------------------
 1932|      0|                {
 1933|      0|                    multPrevEquStr++;
 1934|      0|                }
 1935|      0|                else
 1936|      0|                {
 1937|       |                    /* new EqStr is different; output it */
 1938|      0|                    if (bNext++)
  ------------------
  |  Branch (1938:25): [True: 0, False: 0]
  ------------------
 1939|      0|                    {
 1940|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1941|      0|                    }
 1942|      0|                    MakeEqStr( pPrevEquStr, multPrevEquStr, strbuf, bOverflow );
 1943|      0|                    pPrevEquStr = pCurrEquStr;
 1944|      0|                    multPrevEquStr = 1;
 1945|      0|                }
 1946|      0|            }
 1947|      3|            else
 1948|      3|            {
 1949|      3|                pPrevEquStr = pCurrEquStr;
 1950|      3|                multPrevEquStr = 1;
 1951|      3|            }
 1952|      3|            pINChI_Prev = NULL; /* pINChI_Prev sp2 does not exist since */
 1953|      3|            pINChI_Taut_Prev = NULL; /* pINChI has just been printed */
 1954|      3|            mult = 0;
 1955|      3|            eq2tautPrev = 1;     /* pINChI_Prev and pINChI_Taut_Prev have already been output */
 1956|      3|        }
 1957|    151|        else
 1958|    151|        {
 1959|    151|            if (eq2tautPrev)
  ------------------
  |  Branch (1959:17): [True: 66, False: 85]
  ------------------
 1960|     66|            {
 1961|       |                /* at this point pINChI_Prev does not exist; however, pINChI */
 1962|       |                /*might have been discovered and it is different from pINChI_Taut */
 1963|     66|                if (multPrevEquStr && pPrevEquStr)
  ------------------
  |  Branch (1963:21): [True: 3, False: 63]
  |  Branch (1963:39): [True: 3, False: 0]
  ------------------
 1964|      3|                {
 1965|       |                    /* new EqStr is different; output it */
 1966|      3|                    if (bNext++)
  ------------------
  |  Branch (1966:25): [True: 1, False: 2]
  ------------------
 1967|      1|                    {
 1968|      1|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1969|      1|                    }
 1970|      3|                    MakeEqStr( pPrevEquStr, multPrevEquStr, strbuf, bOverflow );
 1971|      3|                    pPrevEquStr = NULL;
 1972|      3|                    multPrevEquStr = 0;
 1973|      3|                }
 1974|     66|                eq2tautPrev = 0;
 1975|     66|                pINChI_Prev = pINChI;
 1976|     66|                pINChI_Taut_Prev = pINChI_Taut;
 1977|     66|                mult = 0;
 1978|     66|            }
 1979|     85|            else
 1980|     85|            {
 1981|       |                /* current layer is different from previously printed layers of the current component */
 1982|       |                /* compare the current layer to this layer of the previous component: */
 1983|       |                /* check whether pINChI and pINChI_Prev have non-zero identical stereo sp2 */
 1984|       |                /*================ compare iso sp3 to previous =====================*/
 1985|     85|                eq2prev = bUseMulipliers && pINChI && pINChI_Prev &&
  ------------------
  |  Branch (1985:27): [True: 85, False: 0]
  |  Branch (1985:45): [True: 21, False: 64]
  |  Branch (1985:55): [True: 21, False: 0]
  ------------------
 1986|     21|                    ( Stereo = pINChI->StereoIsotopic ) && ( Stereo_Prev = pINChI_Prev->StereoIsotopic ) &&
  ------------------
  |  Branch (1986:21): [True: 21, False: 0]
  |  Branch (1986:60): [True: 21, False: 0]
  ------------------
 1987|     21|                    Eql_INChI_Stereo( Stereo, EQL_SP3, Stereo_Prev, EQL_SP3, bRelRac );
  ------------------
  |  |  475|     21|#define EQL_SP3 2
  ------------------
                                  Eql_INChI_Stereo( Stereo, EQL_SP3, Stereo_Prev, EQL_SP3, bRelRac );
  ------------------
  |  |  475|     21|#define EQL_SP3 2
  ------------------
  |  Branch (1987:21): [True: 3, False: 18]
  ------------------
 1988|     85|                if (eq2prev)
  ------------------
  |  Branch (1988:21): [True: 3, False: 82]
  ------------------
 1989|      3|                {
 1990|      3|                    mult++; /* mult = (number of non-empty equal items)-1 */
 1991|      3|                    continue;
 1992|      3|                }
 1993|     82|                else
 1994|     82|                {
 1995|     82|                    if (bNext++)
  ------------------
  |  Branch (1995:25): [True: 20, False: 62]
  ------------------
 1996|     20|                    {
 1997|     20|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1998|     20|                    }
 1999|     82|                    if (pINChI_Prev && pINChI_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1999:25): [True: 82, False: 0]
  |  Branch (1999:40): [True: 82, False: 0]
  ------------------
 2000|     82|                    {
 2001|     82|                        if (( Stereo_Prev = pINChI_Prev->StereoIsotopic ) && Stereo_Prev->nNumberOfStereoCenters > bRelRac)
  ------------------
  |  Branch (2001:29): [True: 82, False: 0]
  |  Branch (2001:78): [True: 75, False: 7]
  ------------------
 2002|     75|                        {
 2003|     75|                            MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
 2004|       |
 2005|     75|                            MakeStereoString( Stereo_Prev->nNumber, NULL, Stereo_Prev->t_parity,
 2006|     75|                                0, Stereo_Prev->nNumberOfStereoCenters,
 2007|     75|                                strbuf, TAUT_MODE, bOverflow );
 2008|     75|                        }
 2009|       |                        /* else sp3 info is not present in pINChI_Prev */
 2010|     82|                    }
 2011|      0|                    else
 2012|       |                        /* do not print pINChI_Prev because it either do not exist of have already been printed */
 2013|      0|                        if (bSecondNonTautPass && pINChI_Taut_Prev && pINChI_Taut_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (2013:29): [True: 0, False: 0]
  |  Branch (2013:51): [True: 0, False: 0]
  |  Branch (2013:71): [True: 0, False: 0]
  ------------------
 2014|      0|                        {
 2015|      0|                            if (( Stereo_Taut_Prev = pINChI_Taut_Prev->StereoIsotopic ) && Stereo_Taut_Prev->nNumberOfStereoCenters > bRelRac)
  ------------------
  |  Branch (2015:33): [True: 0, False: 0]
  |  Branch (2015:92): [True: 0, False: 0]
  ------------------
 2016|      0|                            {
 2017|       |                                /* since pINChI_Prev does not exist, pINChI_Taut_Prev is non-tautomeric */
 2018|       |                                /* and it has non-trivial sp2 info */
 2019|       |                                /*
 2020|       |                                tot_len += MakeDelim( sIdenticalValues, strbuf, bOverflow);
 2021|       |                                */
 2022|      0|                                ;/* pINChI_Taut_Prev sp3 info was output in the main stereo section */
 2023|      0|                            }
 2024|      0|                            else
 2025|      0|                            {
 2026|      0|                                ; /* pINChI_Taut_Prev exists and has not sp3 info */
 2027|      0|                            }
 2028|      0|                        }
 2029|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 2030|       |                        else
 2031|       |                        {
 2032|       |                            int stop = 1;   /* <BRKPT> */
 2033|       |                        }
 2034|       |#endif
 2035|     82|                }
 2036|     82|                pINChI_Prev = pINChI;
 2037|     82|                pINChI_Taut_Prev = pINChI_Taut;
 2038|     82|                mult = 0; /* we do not know whether the item is empty */
 2039|     82|            }
 2040|    151|        }
 2041|    154|    }
 2042|       |
 2043|     65|    return ( strbuf->nUsedLength - nUsedLength0 );
 2044|     65|}
str_IsoStereoAbsInv:
 2056|      2|{
 2057|      2|    int          i, j, ii, nUsedLength0;
 2058|      2|    INCHI_SORT   *is, *is0;
 2059|      2|    INChI_Stereo *Stereo;
 2060|      2|    INChI        *pINChI;
 2061|       |
 2062|      2|    is = NULL;
 2063|      2|    is0 = pINChISort;
 2064|      2|    nUsedLength0 = strbuf->nUsedLength;
 2065|       |
 2066|       |    /* For each connected component...    */
 2067|      4|    for (i = 0; !*bOverflow && i < num_components; i++)
  ------------------
  |  Branch (2067:17): [True: 4, False: 0]
  |  Branch (2067:32): [True: 2, False: 2]
  ------------------
 2068|      2|    {
 2069|      2|        is = is0 + i;
 2070|      2|        pINChI = ( 0 <= ( ii = GET_II( bOutType, is ) ) )
  ------------------
  |  |   45|      2|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      2|#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): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 2]
  |  |  ------------------
  |  |   46|      2|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  581|      4|#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): \
  |  |  ------------------
  |  |  |  |  583|      4|#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): \
  |  |  ------------------
  |  |  |  |   35|      2|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      2|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      2|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (35:20): [True: 2, False: 0]
  |  |  |  |  |  Branch (35:43): [True: 2, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  575|      2|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   37|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (37:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (37:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (46:23): [True: 0, False: 2]
  |  |  |  Branch (46:36): [True: 2, False: 0]
  |  |  ------------------
  |  |   47|      2|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  585|      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): \
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   42|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (42:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (47:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   48|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  582|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   40|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (40:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   44|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      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)
  |  |  |  |  ------------------
  |  |  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (44:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (44:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (48:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2070:18): [True: 2, False: 0]
  ------------------
 2071|      2|            ? is->pINChI[ii]
 2072|      2|            : NULL;
 2073|      2|        if (pINChI &&
  ------------------
  |  Branch (2073:13): [True: 2, False: 0]
  ------------------
 2074|      2|            ( Stereo = pINChI->StereoIsotopic ) &&
  ------------------
  |  Branch (2074:13): [True: 2, False: 0]
  ------------------
 2075|      2|            ( j = Stereo->nCompInv2Abs ))
  ------------------
  |  Branch (2075:13): [True: 2, False: 0]
  ------------------
 2076|      2|        {
 2077|      2|            MakeDelim( j < 0 ? "1" : "0", strbuf, bOverflow );
  ------------------
  |  Branch (2077:24): [True: 0, False: 2]
  ------------------
 2078|      2|        }
 2079|      0|        else
 2080|      0|        {
 2081|      0|            MakeDelim( ".", strbuf, bOverflow );
 2082|      0|        }
 2083|      2|    }
 2084|       |
 2085|      2|    return ( strbuf->nUsedLength - nUsedLength0 );
 2086|      2|}

bIsCenterPointStrict:
  181|  95.4k|{
  182|  95.4k|    if (atom[iat].valence == atom[iat].chem_bonds_valence)
  ------------------
  |  Branch (182:9): [True: 24.9k, False: 70.4k]
  ------------------
  183|  24.9k|    {
  184|  24.9k|        int endpoint_valence = get_endpoint_valence( atom[iat].el_number );
  185|  24.9k|        if (endpoint_valence && ( (endpoint_valence > atom[iat].valence && /* added a check for negative charge or H 3-31-03 */
  ------------------
  |  Branch (185:13): [True: 17.5k, False: 7.48k]
  |  Branch (185:36): [True: 12.2k, False: 5.27k]
  ------------------
  186|  12.2k|            ( atom[iat].num_H || atom[iat].charge == -1 )) ||
  ------------------
  |  Branch (186:15): [True: 6.81k, False: 5.42k]
  |  Branch (186:34): [True: 3.13k, False: 2.28k]
  ------------------
  187|  7.56k|            (!atom[iat].charge && atom[iat].c_point) )) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (187:14): [True: 6.85k, False: 709]
  |  Branch (187:35): [True: 440, False: 6.41k]
  ------------------
  188|  10.3k|        {
  189|  10.3k|            return 1; /*  may appear to be tautomeric or chargable
  190|       |                          (this increases chem_bonds_valence), should be explored */
  191|  10.3k|        }
  192|  14.6k|        return 0;
  193|  24.9k|    }
  194|  70.4k|    if (atom[iat].valence + 1 == atom[iat].chem_bonds_valence &&
  ------------------
  |  Branch (194:9): [True: 62.2k, False: 8.25k]
  ------------------
  195|  62.2k|        is_centerpoint_elem_strict( atom[iat].el_number ))
  ------------------
  |  Branch (195:9): [True: 57.2k, False: 4.92k]
  ------------------
  196|  57.2k|    {
  197|  57.2k|        return 1;
  198|  57.2k|    }
  199|       |
  200|  13.1k|    return 0;
  201|  70.4k|}
nGet14TautIn5MembAltRing:
  266|    376|{
  267|    376|    int nRet;
  268|       |
  269|    376|    *pnNumEndPoint = 0;
  270|    376|    *pnNumBondPos = 0;
  271|       |
  272|    376|    if (nMaxLenDfsPath <= 5)
  ------------------
  |  Branch (272:9): [True: 0, False: 376]
  ------------------
  273|      0|    {
  274|      0|        return -1; /*  path is too short */
  275|      0|    }
  276|       |
  277|    376|    nRet = DFS_FindTautInARing( pCG, atom, nStartAtom, nStartAtomNeighbor,
  278|    376|        nStartAtomNeighborEndpoint, nStartAtomNeighborNeighborEndpoint, 5,
  279|    376|        nDfsPathPos, DfsPath, Check7MembTautRing, bIsCenterPointStrict,
  280|    376|        EndPoint, nMaxNumEndPoint, BondPos, nMaxNumBondPos,
  281|    376|        pnNumEndPoint, pnNumBondPos, pBNS, pBD, num_atoms );
  282|       |
  283|    376|    return nRet;
  284|    376|}
nGet12TautIn5MembAltRing:
  303|  2.40k|{
  304|  2.40k|    int nRet;
  305|       |
  306|  2.40k|    *pnNumEndPoint = 0;
  307|  2.40k|    *pnNumBondPos = 0;
  308|       |
  309|  2.40k|    if (nMaxLenDfsPath <= 5)
  ------------------
  |  Branch (309:9): [True: 0, False: 2.40k]
  ------------------
  310|      0|    {
  311|      0|        return -1; /*  path is too short */
  312|      0|    }
  313|       |
  314|  2.40k|    nRet = DFS_FindTautInARing( pCG, atom, nStartAtom, nStartAtomNeighbor,
  315|  2.40k|                                -1, -1, 5,
  316|  2.40k|                                nDfsPathPos, DfsPath, Check5MembTautRing,
  317|  2.40k|                                bIsCenterPointStrict, EndPoint, nMaxNumEndPoint,
  318|  2.40k|                                BondPos, nMaxNumBondPos, pnNumEndPoint,
  319|  2.40k|                                pnNumBondPos, pBNS, pBD, num_atoms );
  320|       |
  321|  2.40k|    return nRet;
  322|  2.40k|}
nGet15TautIn6MembAltRing:
  341|  6.09k|{
  342|  6.09k|    int nRet;
  343|       |
  344|  6.09k|    *pnNumEndPoint = 0;
  345|  6.09k|    *pnNumBondPos = 0;
  346|       |
  347|  6.09k|    if (nMaxLenDfsPath <= 7)
  ------------------
  |  Branch (347:9): [True: 0, False: 6.09k]
  ------------------
  348|      0|    {
  349|      0|        return -1; /*  path is too short */
  350|      0|    }
  351|       |
  352|  6.09k|    nRet = DFS_FindTautInARing( pCG, atom, nStartAtom,
  353|  6.09k|                                -1/*nStartAtomNeighbor*/,
  354|  6.09k|                                -1/*nStartAtomNeighbor2*/,
  355|  6.09k|                                -1/*nStartAtomNeighborNeighbor*/,
  356|  6.09k|                                6 /* nCycleLen*/,
  357|  6.09k|                                nDfsPathPos, DfsPath,
  358|  6.09k|                                Check6MembTautRing, bIsCenterPointStrict,
  359|  6.09k|                                EndPoint, nMaxNumEndPoint,
  360|  6.09k|                                BondPos, nMaxNumBondPos,
  361|  6.09k|                                pnNumEndPoint, pnNumBondPos,
  362|  6.09k|                                pBNS, pBD, num_atoms );
  363|       |
  364|  6.09k|    return nRet;
  365|  6.09k|}
DFS_FindTautInARing:
  443|  8.88k|{
  444|       |    /*  Depth First Search */
  445|       |    /*  Ignore all atoms not belonging to the current ring system (=biconnected component) */
  446|  8.88k|    AT_RANK      nMinLenDfsPath;
  447|  8.88k|    int          j, cur_at, nxt_at, prv_at;
  448|  8.88k|    int          nLenDfsPath, nNumFound, ret;
  449|       |    /* djb-rwth: removing redundant variables */
  450|  8.88k|    int          nDoNotTouchAtom1 = -1, nDoNotTouchAtom2 = -1;
  451|       |
  452|  8.88k|    nLenDfsPath = 0;
  453|  8.88k|    nNumFound = 0;
  454|       |
  455|  8.88k|    nCycleLen--;
  456|       |
  457|  8.88k|    DfsPath[nLenDfsPath].at_no = cur_at = nStartAtom;
  458|  8.88k|    DfsPath[nLenDfsPath].bond_type = 0;
  459|  8.88k|    DfsPath[nLenDfsPath].bond_pos = -1;
  460|  8.88k|    nDfsPathPos[cur_at] = nLenDfsPath + 1;  /*  mark */
  461|       |    /* djb-rwth: removing redundant code */
  462|  8.88k|    nMinLenDfsPath = 0;
  463|  8.88k|    if (nStartAtomNeighbor2 >= 0)
  ------------------
  |  Branch (463:9): [True: 376, False: 8.50k]
  ------------------
  464|    376|    {
  465|    376|        nDoNotTouchAtom1 = (int) atom[cur_at].neighbor[nStartAtomNeighbor2];
  466|    376|    }
  467|       |
  468|       |    /*  add the first neighbor to the 2nd tree position if required */
  469|  8.88k|    if (nStartAtomNeighbor >= 0)
  ------------------
  |  Branch (469:9): [True: 2.78k, False: 6.09k]
  ------------------
  470|  2.78k|    {
  471|  2.78k|        j = nStartAtomNeighbor;
  472|  2.78k|        prv_at = cur_at;
  473|  2.78k|        cur_at = atom[prv_at].neighbor[j];
  474|  2.78k|        DfsPath[nLenDfsPath].bond_type = ( atom[prv_at].bond_type[j] & ~BOND_MARK_ALL );
  ------------------
  |  |  191|  2.78k|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
  475|       |#if ( FIX_BOND23_IN_TAUT == 1 )
  476|       |        DfsPath[nLenDfsPath].bond_type = ACTUAL_ORDER( pBNS, prv_at, j, DfsPath[nLenDfsPath].bond_type );
  477|       |#endif
  478|  2.78k|        DfsPath[nLenDfsPath].bond_pos = j;
  479|       |
  480|  2.78k|        nLenDfsPath++;
  481|       |
  482|  2.78k|        DfsPath[nLenDfsPath].at_no = cur_at;
  483|  2.78k|        DfsPath[nLenDfsPath].bond_type = 0;
  484|  2.78k|        DfsPath[nLenDfsPath].bond_pos = -1;
  485|  2.78k|        nDfsPathPos[cur_at] = nLenDfsPath + 1;
  486|  2.78k|        nMinLenDfsPath++;
  487|  2.78k|        if (nStartAtomNeighborNeighbor >= 0)
  ------------------
  |  Branch (487:13): [True: 376, False: 2.40k]
  ------------------
  488|    376|        {
  489|    376|            nDoNotTouchAtom2 = (int) atom[cur_at].neighbor[nStartAtomNeighborNeighbor];
  490|    376|        }
  491|  2.78k|    }
  492|       |
  493|       |    /*  MAIN DFS CYCLE: may find one and the same t-group 2 times; saves only one instance */
  494|       |    /*  traverse *all* paths starting at atom[nStartAtom]; max. path length = (nCycleLen+1)  */
  495|   176k|    while (nLenDfsPath >= nMinLenDfsPath)
  ------------------
  |  Branch (495:12): [True: 168k, False: 8.88k]
  ------------------
  496|   168k|    {
  497|   168k|        j = ++DfsPath[nLenDfsPath].bond_pos;
  498|   168k|        if (j < atom[cur_at = (int) DfsPath[nLenDfsPath].at_no].valence)
  ------------------
  |  Branch (498:13): [True: 113k, False: 54.4k]
  ------------------
  499|   113k|        {
  500|   113k|            DfsPath[nLenDfsPath].bond_type = ( atom[cur_at].bond_type[j] & ~BOND_MARK_ALL );
  ------------------
  |  |  191|   113k|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
  501|       |#if ( FIX_BOND23_IN_TAUT == 1 )
  502|       |            DfsPath[nLenDfsPath].bond_type = ACTUAL_ORDER( pBNS, cur_at, j, DfsPath[nLenDfsPath].bond_type );
  503|       |#endif
  504|   113k|            nxt_at = (int) atom[cur_at].neighbor[j];
  505|   113k|            if (nxt_at == nDoNotTouchAtom1 ||
  ------------------
  |  Branch (505:17): [True: 0, False: 113k]
  ------------------
  506|   113k|                nxt_at == nDoNotTouchAtom2)
  ------------------
  |  Branch (506:17): [True: 376, False: 113k]
  ------------------
  507|    376|            {
  508|    376|                ; /*  ignore */
  509|    376|            }
  510|   113k|            else
  511|   113k|            {
  512|   113k|                if (nDfsPathPos[nxt_at])
  ------------------
  |  Branch (512:21): [True: 51.9k, False: 61.3k]
  ------------------
  513|  51.9k|                {
  514|       |                    /*  found a ring closure or a step backwards */
  515|  51.9k|                    if (1 == nDfsPathPos[nxt_at] && nLenDfsPath == nCycleLen)
  ------------------
  |  Branch (515:25): [True: 15.2k, False: 36.6k]
  |  Branch (515:53): [True: 2.35k, False: 12.8k]
  ------------------
  516|  2.35k|                    {
  517|       |                        /*  we have found the cycle; check it */
  518|  2.35k|                        ret = ( *CheckDfsRing )( pCG,
  519|  2.35k|                            atom,
  520|  2.35k|                            DfsPath, nLenDfsPath,
  521|  2.35k|                            nStartAtomNeighbor,
  522|  2.35k|                            nStartAtomNeighbor2,
  523|  2.35k|                            nStartAtomNeighborNeighbor,
  524|  2.35k|                            EndPoint, nMaxNumEndPoint,
  525|  2.35k|                            BondPos, nMaxNumBondPos,
  526|  2.35k|                            pnNumEndPoint, pnNumBondPos,
  527|  2.35k|                            pBNS, pBD, num_atoms );
  528|  2.35k|                        if (ret < 0)
  ------------------
  |  Branch (528:29): [True: 0, False: 2.35k]
  ------------------
  529|      0|                        {
  530|      0|                            nNumFound = ret;
  531|      0|                            goto clear_path;
  532|      0|                        }
  533|  2.35k|                        nNumFound += ret;
  534|  2.35k|                    }
  535|  51.9k|                }
  536|  61.3k|                else
  537|  61.3k|                {
  538|  61.3k|                    if (!( *CheckCenterPoint )( atom, nxt_at ))
  ------------------
  |  Branch (538:25): [True: 11.4k, False: 49.8k]
  ------------------
  539|  11.4k|                    {
  540|  11.4k|                        ; /*  cannot advance to a non-centerpoint; ignore */
  541|  11.4k|                    }
  542|  49.8k|                    else
  543|  49.8k|                    {
  544|  49.8k|                        if (nLenDfsPath < nCycleLen)
  ------------------
  |  Branch (544:29): [True: 45.6k, False: 4.27k]
  ------------------
  545|  45.6k|                        {
  546|       |                            /*  advance */
  547|  45.6k|                            nLenDfsPath++;
  548|  45.6k|                            cur_at = nxt_at;
  549|  45.6k|                            DfsPath[nLenDfsPath].at_no = cur_at;
  550|  45.6k|                            DfsPath[nLenDfsPath].bond_type = 0;
  551|  45.6k|                            DfsPath[nLenDfsPath].bond_pos = -1;
  552|  45.6k|                            nDfsPathPos[cur_at] = nLenDfsPath + 1;  /*  mark */
  553|  45.6k|                        }
  554|  49.8k|                    }
  555|  61.3k|                }
  556|   113k|            }
  557|   113k|        }
  558|  54.4k|        else
  559|  54.4k|        {
  560|       |            /*  retract */
  561|  54.4k|            nDfsPathPos[(int) DfsPath[nLenDfsPath].at_no] = 0;
  562|  54.4k|            nLenDfsPath--;
  563|  54.4k|        }
  564|   168k|    }
  565|       |
  566|  8.88k|clear_path:
  567|  11.6k|    while (0 <= nLenDfsPath)
  ------------------
  |  Branch (567:12): [True: 2.78k, False: 8.88k]
  ------------------
  568|  2.78k|    {
  569|  2.78k|        nDfsPathPos[(int) DfsPath[nLenDfsPath].at_no] = 0;
  570|  2.78k|        nLenDfsPath--;
  571|  2.78k|    }
  572|       |
  573|  8.88k|    return nNumFound;
  574|  8.88k|}
are_alt_bonds:
  744|  1.06k|{
  745|  1.06k|    U_CHAR next_bond;
  746|  1.06k|    int           i, bAnyBond, bTautBondPresent = BOND_ALTERN;
  ------------------
  |  |  180|  1.06k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|  1.06k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  747|  1.06k|    if (len < 2 || bonds[0] == BOND_TRIPLE || bonds[0] == BOND_ALT_13)
  ------------------
  |  |  179|  1.06k|#define BOND_TRIPLE BOND_TYPE_TRIPLE  /* 3                                  */
  |  |  ------------------
  |  |  |  |   34|  2.13k|#define BOND_TYPE_TRIPLE    3
  |  |  ------------------
  ------------------
                  if (len < 2 || bonds[0] == BOND_TRIPLE || bonds[0] == BOND_ALT_13)
  ------------------
  |  |  183|  1.06k|#define BOND_ALT_13              6   /* single/triple                       */
  ------------------
  |  Branch (747:9): [True: 0, False: 1.06k]
  |  Branch (747:20): [True: 0, False: 1.06k]
  |  Branch (747:47): [True: 0, False: 1.06k]
  ------------------
  748|      0|    {
  749|      0|        return 0;
  750|      0|    }
  751|  1.06k|    next_bond = bonds[0] == BOND_SINGLE ? BOND_DOUBLE : bonds[0] == BOND_DOUBLE ? BOND_SINGLE : 0; /* djb-rwth: removing redundant code; ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  177|  1.06k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|  1.06k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                  next_bond = bonds[0] == BOND_SINGLE ? BOND_DOUBLE : bonds[0] == BOND_DOUBLE ? BOND_SINGLE : 0; /* djb-rwth: removing redundant code; ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  178|     60|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|     60|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
                  next_bond = bonds[0] == BOND_SINGLE ? BOND_DOUBLE : bonds[0] == BOND_DOUBLE ? BOND_SINGLE : 0; /* djb-rwth: removing redundant code; ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  178|  1.00k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|  1.00k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
                  next_bond = bonds[0] == BOND_SINGLE ? BOND_DOUBLE : bonds[0] == BOND_DOUBLE ? BOND_SINGLE : 0; /* djb-rwth: removing redundant code; ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  177|     47|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|     47|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (751:17): [True: 60, False: 1.00k]
  |  Branch (751:57): [True: 47, False: 960]
  ------------------
  752|  1.06k|    if (bonds[0] == BOND_TAUTOM)
  ------------------
  |  |  185|  1.06k|#define BOND_TAUTOM              8
  ------------------
  |  Branch (752:9): [True: 889, False: 178]
  ------------------
  753|    889|    {
  754|    889|        bTautBondPresent = BOND_TAUTOM;
  ------------------
  |  |  185|    889|#define BOND_TAUTOM              8
  ------------------
  755|    889|        next_bond = 0;
  756|    889|    }
  757|    178|    else
  758|    178|    {
  759|    178|        next_bond = bonds[0] == BOND_SINGLE ? BOND_DOUBLE : bonds[0] == BOND_DOUBLE ? BOND_SINGLE : 0;
  ------------------
  |  |  177|    178|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|    178|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                      next_bond = bonds[0] == BOND_SINGLE ? BOND_DOUBLE : bonds[0] == BOND_DOUBLE ? BOND_SINGLE : 0;
  ------------------
  |  |  178|     60|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|     60|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
                      next_bond = bonds[0] == BOND_SINGLE ? BOND_DOUBLE : bonds[0] == BOND_DOUBLE ? BOND_SINGLE : 0;
  ------------------
  |  |  178|    118|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|    118|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
                      next_bond = bonds[0] == BOND_SINGLE ? BOND_DOUBLE : bonds[0] == BOND_DOUBLE ? BOND_SINGLE : 0;
  ------------------
  |  |  177|     47|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|     47|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (759:21): [True: 60, False: 118]
  |  Branch (759:61): [True: 47, False: 71]
  ------------------
  760|    178|    }
  761|       |
  762|  5.25k|    for (i = 1; i < len; i++)
  ------------------
  |  Branch (762:17): [True: 4.26k, False: 994]
  ------------------
  763|  4.26k|    {
  764|  4.26k|        if (bonds[i] == BOND_TAUTOM)
  ------------------
  |  |  185|  4.26k|#define BOND_TAUTOM              8
  ------------------
  |  Branch (764:13): [True: 3.55k, False: 701]
  ------------------
  765|  3.55k|        {
  766|  3.55k|            bTautBondPresent = BOND_TAUTOM;
  ------------------
  |  |  185|  3.55k|#define BOND_TAUTOM              8
  ------------------
  767|  3.55k|            bAnyBond = 1;
  768|  3.55k|        }
  769|    701|        else
  770|    701|        {
  771|    701|            bAnyBond = ( bonds[i] == BOND_ALTERN || bonds[i] == BOND_ALT12NS );
  ------------------
  |  |  180|    701|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|  1.40k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                          bAnyBond = ( bonds[i] == BOND_ALTERN || bonds[i] == BOND_ALT12NS );
  ------------------
  |  |  186|    586|#define BOND_ALT12NS             9
  ------------------
  |  Branch (771:26): [True: 115, False: 586]
  |  Branch (771:53): [True: 108, False: 478]
  ------------------
  772|    701|        }
  773|  4.26k|        if (next_bond)
  ------------------
  |  Branch (773:13): [True: 526, False: 3.73k]
  ------------------
  774|    526|        {
  775|    526|            if (bonds[i] == next_bond || bAnyBond)
  ------------------
  |  Branch (775:17): [True: 324, False: 202]
  |  Branch (775:42): [True: 153, False: 49]
  ------------------
  776|    477|            {
  777|    477|                next_bond = ( next_bond == BOND_SINGLE ) ? BOND_DOUBLE : BOND_SINGLE;
  ------------------
  |  |  177|    477|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|    477|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                              next_bond = ( next_bond == BOND_SINGLE ) ? BOND_DOUBLE : BOND_SINGLE;
  ------------------
  |  |  178|    235|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|    235|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
                              next_bond = ( next_bond == BOND_SINGLE ) ? BOND_DOUBLE : BOND_SINGLE;
  ------------------
  |  |  177|    242|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|    719|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (777:29): [True: 235, False: 242]
  ------------------
  778|    477|                continue;
  779|    477|            }
  780|     49|            return 0;
  781|    526|        }
  782|  3.73k|        else
  783|  3.73k|        {
  784|  3.73k|            if (bonds[i] == BOND_SINGLE)
  ------------------
  |  |  177|  3.73k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|  3.73k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (784:17): [True: 76, False: 3.65k]
  ------------------
  785|     76|            {
  786|     76|                next_bond = BOND_DOUBLE;
  ------------------
  |  |  178|     76|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|     76|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  787|     76|                continue;
  788|     76|            }
  789|  3.65k|            else
  790|  3.65k|            {
  791|  3.65k|                if (bonds[i] == BOND_DOUBLE)
  ------------------
  |  |  178|  3.65k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|  3.65k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (791:21): [True: 5, False: 3.65k]
  ------------------
  792|      5|                {
  793|      5|                    next_bond = BOND_SINGLE;
  ------------------
  |  |  177|      5|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|      5|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  794|      5|                    continue;
  795|      5|                }
  796|  3.65k|                else
  797|  3.65k|                {
  798|  3.65k|                    if (!bAnyBond)
  ------------------
  |  Branch (798:25): [True: 24, False: 3.62k]
  ------------------
  799|     24|                    {
  800|     24|                        return 0;
  801|     24|                    }
  802|  3.65k|                }
  803|  3.65k|            }
  804|  3.73k|        }
  805|  4.26k|    }
  806|    994|    return !next_bond ? bTautBondPresent : ( next_bond == BOND_SINGLE )
  ------------------
  |  |  177|    139|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|    139|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (806:12): [True: 855, False: 139]
  |  Branch (806:44): [True: 59, False: 80]
  ------------------
  807|    139|                            ? BOND_DOUBLE : BOND_SINGLE; /* bond to the end atom */
  ------------------
  |  |  178|     59|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|     59|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
                                          ? BOND_DOUBLE : BOND_SINGLE; /* bond to the end atom */
  ------------------
  |  |  177|     80|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|     80|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  808|  1.06k|}
AddBondsPos:
  817|    603|{
  818|    603|    int i, j, k, cur_at, nxt_at;
  819|       |    /*  add opposite direction bonds to BondPosTmp */
  820|    980|    for (j = 0; j < nNumBondPosTmp; j += 2)
  ------------------
  |  Branch (820:17): [True: 377, False: 603]
  ------------------
  821|    377|    {
  822|    377|        cur_at = BondPosTmp[j].nAtomNumber;
  823|    377|        nxt_at = atom[cur_at].neighbor[(int) BondPosTmp[j].neighbor_index];
  824|    537|        for (k = 0; k < atom[nxt_at].valence; k++)
  ------------------
  |  Branch (824:21): [True: 537, False: 0]
  ------------------
  825|    537|        {
  826|    537|            if (cur_at == atom[nxt_at].neighbor[k])
  ------------------
  |  Branch (826:17): [True: 377, False: 160]
  ------------------
  827|    377|            {
  828|    377|                BondPosTmp[j + 1].nAtomNumber = nxt_at;
  829|    377|                BondPosTmp[j + 1].neighbor_index = k;
  830|    377|                break;
  831|    377|            }
  832|    537|        }
  833|    377|    }
  834|       |    /*  add new tautomeric bonds */
  835|    980|    for (j = 0; j < nNumBondPosTmp; j += 2)
  ------------------
  |  Branch (835:17): [True: 377, False: 603]
  ------------------
  836|    377|    {
  837|  1.18k|        for (i = 0; i < nNumBondPos; i++)
  ------------------
  |  Branch (837:21): [True: 849, False: 331]
  ------------------
  838|    849|        {
  839|    849|            if ((BondPos[i].nAtomNumber == BondPosTmp[j].nAtomNumber &&
  ------------------
  |  Branch (839:18): [True: 69, False: 780]
  ------------------
  840|     69|                BondPos[i].neighbor_index == BondPosTmp[j].neighbor_index) ||
  ------------------
  |  Branch (840:17): [True: 6, False: 63]
  ------------------
  841|    843|                (BondPos[i].nAtomNumber == BondPosTmp[j + 1].nAtomNumber &&
  ------------------
  |  Branch (841:18): [True: 65, False: 778]
  ------------------
  842|     65|                BondPos[i].neighbor_index == BondPosTmp[j + 1].neighbor_index))  /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (842:17): [True: 40, False: 25]
  ------------------
  843|     46|            {
  844|     46|                break; /*  bond has already been added */
  845|     46|            }
  846|    849|        }
  847|    377|        if (i == nNumBondPos)
  ------------------
  |  Branch (847:13): [True: 331, False: 46]
  ------------------
  848|    331|        {
  849|    331|            if (i > nMaxNumBondPos)
  ------------------
  |  Branch (849:17): [True: 0, False: 331]
  ------------------
  850|      0|            {
  851|      0|                return -1; /*  overflow */
  852|      0|            }
  853|    331|            BondPos[nNumBondPos++] = BondPosTmp[j];
  854|    331|        }
  855|    377|    }
  856|       |
  857|    603|    return nNumBondPos;
  858|    603|}
AddEndPoints:
  867|    603|{
  868|    603|    int i, j;
  869|       |    /*  add new endpoints */
  870|  1.80k|    for (j = 0; j < nNumNewEndPoint; j++)
  ------------------
  |  Branch (870:17): [True: 1.20k, False: 603]
  ------------------
  871|  1.20k|    {
  872|  1.80k|        for (i = 0; i < nNumEndPoint; i++)
  ------------------
  |  Branch (872:21): [True: 685, False: 1.12k]
  ------------------
  873|    685|        {
  874|    685|            if (EndPoint[i].nAtomNumber == EndPointTmp[j].nAtomNumber)
  ------------------
  |  Branch (874:17): [True: 82, False: 603]
  ------------------
  875|     82|            {
  876|     82|                break;
  877|     82|            }
  878|    685|        }
  879|  1.20k|        if (i == nNumEndPoint)
  ------------------
  |  Branch (879:13): [True: 1.12k, False: 82]
  ------------------
  880|  1.12k|        {
  881|  1.12k|            if (i > nMaxNumEndPoint)
  ------------------
  |  Branch (881:17): [True: 0, False: 1.12k]
  ------------------
  882|      0|            {
  883|      0|                return -1; /*  overflow */
  884|      0|            }
  885|  1.12k|            EndPoint[nNumEndPoint++] = EndPointTmp[j];
  886|  1.12k|        }
  887|  1.20k|    }
  888|       |
  889|    603|    return nNumEndPoint;
  890|    603|}
Check7MembTautRing:
  932|    290|{
  933|    290|#define PATH_LEN 8
  934|       |
  935|    290|    int i, j, k, /*m,*/ nNumEndPoint, nNumEndPointTmp, nNumBondPos, nNumBondPosTmp;
  936|    290|    int endpoint, /*nMobile, nMobile1, nMobile2,*/ o1_at, o2_at;
  937|    290|    int ret;
  938|    290|    U_CHAR path_bonds[PATH_LEN + 1], bond_type;
  939|    290|    T_ENDPOINT EndPointTmp[2];
  940|    290|    T_BONDPOS  BondPosTmp[2 * PATH_LEN];
  941|    290|    ENDPOINT_INFO eif1, eif2;
  942|    290|    int nErr = 0;
  943|       |
  944|       |
  945|    290|    if (nLenDfsPath + 2 > PATH_LEN)
  ------------------
  |  |  933|    290|#define PATH_LEN 8
  ------------------
  |  Branch (945:9): [True: 0, False: 290]
  ------------------
  946|      0|    {
  947|      0|        return -1; /*  too long path */
  948|      0|    }
  949|    290|    if (nLenDfsPath != 6 && nLenDfsPath != 4)
  ------------------
  |  Branch (949:9): [True: 290, False: 0]
  |  Branch (949:29): [True: 0, False: 290]
  ------------------
  950|      0|    {
  951|      0|        return -1; /*  wrong call */
  952|      0|    }
  953|       |
  954|    290|    nNumBondPos = *pnNumBondPos;
  955|    290|    nNumEndPoint = *pnNumEndPoint;
  956|    290|    nNumBondPosTmp = 0;
  957|    290|    nNumEndPointTmp = 0;
  958|    290|    ret = 0;
  959|       |
  960|    290|    o1_at = atom[(int) DfsPath[1].at_no].neighbor[nStartAtomNeighborNeighbor];
  961|    290|    o2_at = atom[(int) DfsPath[0].at_no].neighbor[nStartAtomNeighbor2];
  962|       |    /*
  963|       |    nMobile1 = (atom[o1_at].charge == -1) + atom[o1_at].num_H;
  964|       |    nMobile2 = (atom[o2_at].charge == -1) + atom[o2_at].num_H;
  965|       |    */
  966|    290|    if (!nGetEndpointInfo( atom, o1_at, &eif1 ) ||
  ------------------
  |  Branch (966:9): [True: 0, False: 290]
  ------------------
  967|    290|        !nGetEndpointInfo( atom, o2_at, &eif2 ))
  ------------------
  |  Branch (967:9): [True: 0, False: 290]
  ------------------
  968|      0|    {
  969|      0|        return 0;
  970|      0|    }
  971|       |
  972|       |    /*  save endpoints */
  973|    870|    for (j = 0; j < 2; j++)
  ------------------
  |  Branch (973:17): [True: 580, False: 290]
  ------------------
  974|    580|    {
  975|    580|        endpoint = j ? o2_at : o1_at;
  ------------------
  |  Branch (975:20): [True: 290, False: 290]
  ------------------
  976|    580|        if (!atom[endpoint].endpoint)
  ------------------
  |  Branch (976:13): [True: 83, False: 497]
  ------------------
  977|     83|        {
  978|     83|            AddAtom2num( EndPointTmp[nNumEndPointTmp].num, atom, endpoint, 2 ); /* fill out */
  979|     83|            AddAtom2DA( EndPointTmp[nNumEndPointTmp].num_DA, atom, endpoint, 2 );
  980|       |            /*
  981|       |                   nMobile  = j? nMobile2 : nMobile1;
  982|       |               } else {
  983|       |                   nMobile  = 0;
  984|       |               }
  985|       |               if ( nMobile ) {
  986|       |                   EndPointTmp[nNumEndPointTmp].num[1] = (atom[endpoint].charge == -1);
  987|       |                   EndPointTmp[nNumEndPointTmp].num[0] = nMobile;
  988|       |                   for ( m = 0; m < T_NUM_ISOTOPIC; m ++ ) {
  989|       |                       EndPointTmp[nNumEndPointTmp].num[T_NUM_NO_ISOTOPIC+m] = atom[endpoint].num_iso_H[NUM_H_ISOTOPES-m-1];
  990|       |                   }
  991|       |            */
  992|     83|        }
  993|    497|        else
  994|    497|        {
  995|    497|            memset( EndPointTmp + nNumEndPointTmp, 0, sizeof( EndPointTmp[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  996|    497|        }
  997|    580|        EndPointTmp[nNumEndPointTmp].nAtomNumber = endpoint;
  998|    580|        EndPointTmp[nNumEndPointTmp].nGroupNumber = atom[endpoint].endpoint;
  999|    580|        EndPointTmp[nNumEndPointTmp].nEquNumber = 0;
 1000|    580|        nNumEndPointTmp++;
 1001|    580|    }
 1002|       |
 1003|       |    /*  extract bonds */
 1004|    290|    k = (int) DfsPath[1].at_no;
 1005|    290|    bond_type = ( atom[k].bond_type[nStartAtomNeighborNeighbor] & ~BOND_MARK_ALL );
  ------------------
  |  |  191|    290|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 1006|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 1007|       |    bond_type = ACTUAL_ORDER( pBNS, k, nStartAtomNeighborNeighbor, bond_type );
 1008|       |#endif
 1009|    290|    path_bonds[0] = bond_type;
 1010|    290|    if (REPLACE_THE_BOND( bond_type ))
  ------------------
  |  |  173|    290|#define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  177|    290|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  |  |  ------------------
  |  |  |  |  |  |   32|    580|#define BOND_TYPE_SINGLE    1
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  178|    272|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  |  |  ------------------
  |  |  |  |  |  |   33|    562|#define BOND_TYPE_DOUBLE    2
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  180|    254|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|    544|#define BOND_TYPE_ALTERN    4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  186|    247|#define BOND_ALT12NS             9
  |  |  ------------------
  |  |  |  Branch (173:31): [True: 18, False: 272]
  |  |  |  Branch (173:53): [True: 18, False: 254]
  |  |  |  Branch (173:75): [True: 7, False: 247]
  |  |  |  Branch (173:97): [True: 6, False: 241]
  |  |  ------------------
  ------------------
 1011|     49|    {
 1012|     49|        BondPosTmp[nNumBondPosTmp].nAtomNumber = k;
 1013|     49|        BondPosTmp[nNumBondPosTmp].neighbor_index = nStartAtomNeighborNeighbor;
 1014|     49|        nNumBondPosTmp += 2;
 1015|     49|    }
 1016|  1.45k|    for (i = 1; i <= nLenDfsPath; i++)
  ------------------
  |  Branch (1016:17): [True: 1.16k, False: 290]
  ------------------
 1017|  1.16k|    {
 1018|  1.16k|        bond_type = DfsPath[i].bond_type;
 1019|  1.16k|        path_bonds[i] = bond_type;
 1020|  1.16k|        if (REPLACE_THE_BOND( bond_type ))
  ------------------
  |  |  173|  1.16k|#define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  177|  1.16k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  |  |  ------------------
  |  |  |  |  |  |   32|  2.32k|#define BOND_TYPE_SINGLE    1
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  178|  1.06k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  |  |  ------------------
  |  |  |  |  |  |   33|  2.22k|#define BOND_TYPE_DOUBLE    2
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  180|  1.00k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|  2.16k|#define BOND_TYPE_ALTERN    4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  186|    979|#define BOND_ALT12NS             9
  |  |  ------------------
  |  |  |  Branch (173:31): [True: 96, False: 1.06k]
  |  |  |  Branch (173:53): [True: 57, False: 1.00k]
  |  |  |  Branch (173:75): [True: 28, False: 979]
  |  |  |  Branch (173:97): [True: 25, False: 954]
  |  |  ------------------
  ------------------
 1021|    206|        {
 1022|    206|            BondPosTmp[nNumBondPosTmp].nAtomNumber = DfsPath[i].at_no;
 1023|    206|            BondPosTmp[nNumBondPosTmp].neighbor_index = DfsPath[i].bond_pos;
 1024|    206|            nNumBondPosTmp += 2;
 1025|    206|        }
 1026|  1.16k|    }
 1027|    290|    bond_type = ( atom[(int) DfsPath[0].at_no].bond_type[nStartAtomNeighbor2] & ~BOND_MARK_ALL );
  ------------------
  |  |  191|    290|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 1028|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 1029|       |    bond_type = ACTUAL_ORDER( pBNS, (int) DfsPath[0].at_no, nStartAtomNeighbor2, bond_type );
 1030|       |#endif
 1031|    290|    path_bonds[i++] = bond_type;
 1032|    290|    if (REPLACE_THE_BOND( bond_type ))
  ------------------
  |  |  173|    290|#define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  177|    290|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  |  |  ------------------
  |  |  |  |  |  |   32|    580|#define BOND_TYPE_SINGLE    1
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  178|    267|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  |  |  ------------------
  |  |  |  |  |  |   33|    557|#define BOND_TYPE_DOUBLE    2
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  180|    255|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|    545|#define BOND_TYPE_ALTERN    4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  186|    248|#define BOND_ALT12NS             9
  |  |  ------------------
  |  |  |  Branch (173:31): [True: 23, False: 267]
  |  |  |  Branch (173:53): [True: 12, False: 255]
  |  |  |  Branch (173:75): [True: 7, False: 248]
  |  |  |  Branch (173:97): [True: 6, False: 242]
  |  |  ------------------
  ------------------
 1033|     48|    {
 1034|     48|        BondPosTmp[nNumBondPosTmp].nAtomNumber = DfsPath[0].at_no;
 1035|     48|        BondPosTmp[nNumBondPosTmp].neighbor_index = nStartAtomNeighbor2;
 1036|     48|        nNumBondPosTmp += 2;
 1037|     48|    }
 1038|       |
 1039|    290|    if (!are_alt_bonds( path_bonds, i ))
  ------------------
  |  Branch (1039:9): [True: 14, False: 276]
  ------------------
 1040|     14|    {
 1041|     14|        return 0;
 1042|     14|    }
 1043|       |
 1044|       |    /* path_bonds is from at_n1 to at_n2 */
 1045|    276|    if (!( j = are_alt_bonds( path_bonds, i ) ))
  ------------------
  |  Branch (1045:9): [True: 0, False: 276]
  ------------------
 1046|      0|    {
 1047|      0|        return 0;
 1048|      0|    }
 1049|       |    /* j is a bond type of the last bond to o2_at, the first bond from o1_at is 2-j if j=1 or 2 */
 1050|       |
 1051|       |    /* single bond at o2_at: it should have a mobile atom, o1_at should not */
 1052|    276|    if ((j == BOND_SINGLE && ( (!atom[o2_at].endpoint && !eif2.cDonor) || (!atom[o1_at].endpoint && !eif1.cAcceptor) )) ||
  ------------------
  |  |  177|    276|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|    552|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (1052:10): [True: 22, False: 254]
  |  Branch (1052:33): [True: 18, False: 4]
  |  Branch (1052:58): [True: 0, False: 18]
  |  Branch (1052:76): [True: 20, False: 2]
  |  Branch (1052:101): [True: 0, False: 20]
  ------------------
 1053|       |        /* double bond at o2_at: it should not have a mobile atom, o1_at should */
 1054|    276|        (j == BOND_DOUBLE && ( (!atom[o2_at].endpoint && !eif2.cAcceptor) || (!atom[o1_at].endpoint && !eif1.cDonor) ))) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |  178|    276|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|    552|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (1054:10): [True: 16, False: 260]
  |  Branch (1054:33): [True: 14, False: 2]
  |  Branch (1054:58): [True: 0, False: 14]
  |  Branch (1054:79): [True: 13, False: 3]
  |  Branch (1054:104): [True: 0, False: 13]
  ------------------
 1055|      0|    {
 1056|      0|        return 0; /* bond pattern does not fit */
 1057|      0|    }
 1058|       |
 1059|    276|    nNumBondPos = AddBondsPos( atom, BondPosTmp, nNumBondPosTmp, BondPos, nMaxNumBondPos, nNumBondPos );
 1060|    276|    nNumEndPoint = AddEndPoints( EndPointTmp, nNumEndPointTmp, EndPoint, nMaxNumEndPoint, nNumEndPoint );
 1061|       |
 1062|    276|    if (nNumBondPos >= 0 && nNumEndPoint >= 0)
  ------------------
  |  Branch (1062:9): [True: 276, False: 0]
  |  Branch (1062:29): [True: 276, False: 0]
  ------------------
 1063|    276|    {
 1064|    276|        if ((ret = ( nNumBondPos > *pnNumBondPos ) || ( nNumEndPoint > *pnNumEndPoint ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1064:13): [True: 276, False: 0]
  |  Branch (1064:20): [True: 44, False: 232]
  |  Branch (1064:55): [True: 232, False: 0]
  ------------------
 1065|    276|        {
 1066|    276|            *pnNumBondPos = nNumBondPos;
 1067|    276|            *pnNumEndPoint = nNumEndPoint;
 1068|    276|        }
 1069|    276|    }
 1070|       |
 1071|    276|    if (ret)
  ------------------
  |  Branch (1071:9): [True: 276, False: 0]
  ------------------
 1072|    276|    {
 1073|       |        /* finally check whether the bonds allow moving the hydrogens */
 1074|    276|        if (( atom[o1_at].endpoint != atom[o2_at].endpoint || !atom[o1_at].endpoint ))
  ------------------
  |  Branch (1074:15): [True: 10, False: 266]
  |  Branch (1074:63): [True: 28, False: 238]
  ------------------
 1075|     38|        {
 1076|       |
 1077|     38|            nErr = bExistsAnyAltPath( pCG, pBNS, pBD, atom, num_atoms, o1_at, o2_at, ALT_PATH_MODE_TAUTOM );
  ------------------
  |  |  310|     38|#define ALT_PATH_MODE_TAUTOM     1
  ------------------
 1078|       |
 1079|     38|            if (nErr <= 0)
  ------------------
  |  Branch (1079:17): [True: 0, False: 38]
  ------------------
 1080|      0|            {
 1081|      0|                return nErr;
 1082|      0|            }
 1083|     38|        }
 1084|    276|    }
 1085|       |
 1086|    276|    return ret;
 1087|       |
 1088|       |
 1089|    276|#undef PATH_LEN
 1090|    276|}
Check6MembTautRing:
 1123|  1.79k|{
 1124|  1.79k|#define PATH_LEN 4
 1125|  1.79k|    int i, j, k, /*m,*/ nNumBondPos, nNumEndPoint, ept, eptn;
 1126|  1.79k|    int nNumEndPointTmp, nNumBondPosTmp, o_at = 0, ret;
 1127|       |    /* int num_taut_endpoints, num_H; */
 1128|  1.79k|    int middle_pos;
 1129|  1.79k|    int nMobile, endpoint, endpoint_valence, chem_bonds_valence;
 1130|  1.79k|    int nMobile1, endpoint_valence1;  /*  o_at */
 1131|  1.79k|    int nMobile2, endpoint_valence2;  /*  n_at */
 1132|  1.79k|    int nxt_at;
 1133|  1.79k|    int n_at;
 1134|  1.79k|    U_CHAR path_bonds[2][PATH_LEN + 1], bond_type;
 1135|  1.79k|    T_ENDPOINT EndPointTmp[2];
 1136|  1.79k|    T_BONDPOS  BondPosTmp[4 * PATH_LEN];
 1137|  1.79k|    ENDPOINT_INFO eif1, eif2;
 1138|       |
 1139|  1.79k|    if (nStartAtomNeighbor >= 0 || nStartAtomNeighbor2 >= 0 || nStartAtomNeighborNeighbor >= 0)
  ------------------
  |  Branch (1139:9): [True: 0, False: 1.79k]
  |  Branch (1139:36): [True: 0, False: 1.79k]
  |  Branch (1139:64): [True: 0, False: 1.79k]
  ------------------
 1140|      0|    {
 1141|      0|        return -1; /*  wrong call */
 1142|      0|    }
 1143|  1.79k|    if (nLenDfsPath != 5)
  ------------------
  |  Branch (1143:9): [True: 0, False: 1.79k]
  ------------------
 1144|      0|    {
 1145|      0|        return -1; /*  wrong call */
 1146|      0|    }
 1147|       |
 1148|  1.79k|    nNumBondPos = *pnNumBondPos;
 1149|  1.79k|    nNumEndPoint = *pnNumEndPoint;
 1150|       |    /* djb-rwth: removing redundant code */
 1151|  1.79k|    nNumEndPointTmp = 0;
 1152|  1.79k|    ret = 0;
 1153|  5.37k|    for (ept = 0; ept < 2; ept++) /* djb-rwth: initialisation needed for num array */
  ------------------
  |  Branch (1153:19): [True: 3.58k, False: 1.79k]
  ------------------
 1154|  21.5k|        for (eptn = 0; eptn < T_NUM_NO_ISOTOPIC + T_NUM_ISOTOPIC; eptn++)
  ------------------
  |  |   69|  21.5k|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
                      for (eptn = 0; eptn < T_NUM_NO_ISOTOPIC + T_NUM_ISOTOPIC; eptn++)
  ------------------
  |  |   70|  21.5k|#define           T_NUM_ISOTOPIC    NUM_H_ISOTOPES /* was 2, now 3 */
  |  |  ------------------
  |  |  |  |   25|  21.5k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  |  |  ------------------
  ------------------
  |  Branch (1154:24): [True: 17.9k, False: 3.58k]
  ------------------
 1155|  17.9k|            EndPointTmp[ept].num[eptn] = 0;
 1156|       |
 1157|  1.79k|    n_at = (int) DfsPath[0].at_no;   /*  -N= or -NH- atom */
 1158|  1.79k|    nxt_at = DfsPath[middle_pos = ( nLenDfsPath + 1 ) / 2].at_no;  /*  must have tautomeric neighbor -OH or =O or -NH2 or =NH */
 1159|       |
 1160|  1.79k|    if (atom[nxt_at].valence != 3
  ------------------
  |  Branch (1160:9): [True: 1.57k, False: 216]
  ------------------
 1161|    216|#if ( TAUT_RINGS_ATTACH_CHAIN == 1 )
 1162|    216|        || !atom[nxt_at].bCutVertex
  ------------------
  |  Branch (1162:12): [True: 34, False: 182]
  ------------------
 1163|  1.79k|#endif
 1164|  1.79k|        )
 1165|  1.61k|    {
 1166|  1.61k|        return 0;
 1167|  1.61k|    }
 1168|       |
 1169|    440|    for (i = 0; i < atom[nxt_at].valence; i++)
  ------------------
  |  Branch (1169:17): [True: 440, False: 0]
  ------------------
 1170|    440|    {
 1171|    440|        o_at = atom[nxt_at].neighbor[i];
 1172|    440|        if (o_at != DfsPath[middle_pos - 1].at_no && o_at != DfsPath[middle_pos + 1].at_no)
  ------------------
  |  Branch (1172:13): [True: 311, False: 129]
  |  Branch (1172:54): [True: 182, False: 129]
  ------------------
 1173|    182|        {
 1174|    182|            break; /*  >=O or />-OH has been found */
 1175|    182|        }
 1176|    440|    }
 1177|    182|    if (i == atom[nxt_at].valence)
  ------------------
  |  Branch (1177:9): [True: 0, False: 182]
  ------------------
 1178|      0|    {
 1179|      0|        return 0; /*  no neighboring atom >=O or />-OH */
 1180|      0|    }
 1181|    182|    bond_type = ( atom[nxt_at].bond_type[i] & ~BOND_MARK_ALL );
  ------------------
  |  |  191|    182|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 1182|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 1183|       |    bond_type = ACTUAL_ORDER( pBNS, nxt_at, i, bond_type );
 1184|       |#endif
 1185|    182|    if (bond_type != BOND_SINGLE &&
  ------------------
  |  |  177|    182|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|    364|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (1185:9): [True: 152, False: 30]
  ------------------
 1186|    152|        bond_type != BOND_DOUBLE &&
  ------------------
  |  |  178|    152|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|    334|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (1186:9): [True: 122, False: 30]
  ------------------
 1187|    122|        bond_type != BOND_TAUTOM &&
  ------------------
  |  |  185|    304|#define BOND_TAUTOM              8
  ------------------
  |  Branch (1187:9): [True: 28, False: 94]
  ------------------
 1188|     28|        bond_type != BOND_ALT12NS &&
  ------------------
  |  |  186|    210|#define BOND_ALT12NS             9
  ------------------
  |  Branch (1188:9): [True: 10, False: 18]
  ------------------
 1189|     10|        bond_type != BOND_ALTERN)
  ------------------
  |  |  180|     10|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|     10|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (1189:9): [True: 0, False: 10]
  ------------------
 1190|      0|    {
 1191|      0|        return 0;
 1192|      0|    }
 1193|       |
 1194|       |    /*  check whether the two atoms already belong to one tautomeric group */
 1195|       |#if ( TAUT_IGNORE_EQL_ENDPOINTS == 1 )
 1196|       |    if (atom[n_at].endpoint && atom[n_at].endpoint == atom[o_at].endpoint)
 1197|       |    {
 1198|       |        return 0;
 1199|       |    }
 1200|       |#endif
 1201|       |    /*  check =O valence; must be 2 for O, S, Se or 3 for N */
 1202|    182|    if (!( endpoint_valence1 = nGetEndpointInfo( atom, o_at, &eif1 ) ))
  ------------------
  |  Branch (1202:9): [True: 30, False: 152]
  ------------------
 1203|     30|    {
 1204|     30|        return 0; /*  n_at has been checked in MarkTautomerGroups(...) */
 1205|     30|    }
 1206|       |    /*
 1207|       |        if ( 2 != endpoint_valence1 )
 1208|       |            return 0; // accept only O, S, Se
 1209|       |    */
 1210|       |    /*  check hydrogens/endpoints */
 1211|    152|    nMobile1 = atom[o_at].num_H + ( atom[o_at].charge == -1 );
 1212|    152|    if (bond_type == BOND_SINGLE && !eif1.cDonor && !atom[o_at].endpoint)
  ------------------
  |  |  177|    152|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|    304|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (1212:9): [True: 22, False: 130]
  |  Branch (1212:37): [True: 6, False: 16]
  |  Branch (1212:53): [True: 6, False: 0]
  ------------------
 1213|      6|    {
 1214|      6|        return 0;
 1215|      6|    }
 1216|       |    /* not needed since nGetEndpointInfo returned non-zero
 1217|       |    if ( nMobile1 + atom[o_at].chem_bonds_valence != endpoint_valence1 )
 1218|       |        return 0;
 1219|       |    */
 1220|       |
 1221|    146|    if (!( endpoint_valence2 = nGetEndpointInfo( atom, n_at, &eif2 ) ))
  ------------------
  |  Branch (1221:9): [True: 0, False: 146]
  ------------------
 1222|      0|    {
 1223|      0|        return 0; /* should not happen here */
 1224|      0|    }
 1225|    146|    nMobile2 = atom[n_at].num_H + ( atom[n_at].charge == -1 );
 1226|       |
 1227|    146|    nMobile = 0;
 1228|       |
 1229|       |    /*  can mobile group move from o_at to n_at? */
 1230|    146|    nMobile += ( atom[o_at].endpoint || eif1.cDonor ) &&  /*  from o_at */
  ------------------
  |  Branch (1230:18): [True: 102, False: 44]
  |  Branch (1230:41): [True: 20, False: 24]
  ------------------
 1231|    122|        bond_type != BOND_DOUBLE &&
  ------------------
  |  |  178|    122|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|    268|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (1231:9): [True: 122, False: 0]
  ------------------
 1232|    122|        ( atom[n_at].endpoint ||                   /*  to n_at */
  ------------------
  |  Branch (1232:11): [True: 98, False: 24]
  ------------------
 1233|     24|            eif2.cNeutralBondsValence > atom[n_at].valence );
  ------------------
  |  Branch (1233:13): [True: 8, False: 16]
  ------------------
 1234|       |    /*  can mobile group move from n_at to o_at? */
 1235|    146|    nMobile += ( atom[n_at].endpoint || eif2.cDonor ) && /*  from n_at */
  ------------------
  |  Branch (1235:18): [True: 106, False: 40]
  |  Branch (1235:41): [True: 26, False: 14]
  ------------------
 1236|    132|        ( atom[o_at].endpoint ||          /*  to o_at */
  ------------------
  |  Branch (1236:11): [True: 102, False: 30]
  ------------------
 1237|     30|            eif1.cNeutralBondsValence > atom[o_at].valence ) &&
  ------------------
  |  Branch (1237:13): [True: 18, False: 12]
  ------------------
 1238|    120|        bond_type != BOND_SINGLE;
  ------------------
  |  |  177|    120|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|    266|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (1238:9): [True: 120, False: 0]
  ------------------
 1239|       |
 1240|       |
 1241|    146|    if (!nMobile)
  ------------------
  |  Branch (1241:9): [True: 10, False: 136]
  ------------------
 1242|     10|    {
 1243|     10|        return 0;
 1244|     10|    }
 1245|       |
 1246|       |    /*
 1247|       |    num_H = atom[n_at].num_H + atom[o_at].num_H;
 1248|       |    num_taut_endpoints = (0!=atom[n_at].endpoint) + (0!=atom[o_at].endpoint); // if O, N already are endpoints
 1249|       |    if ( num_H != 1 && num_taut_endpoints != 2 && !(num_H==2 && num_taut_endpoints >= 1) ) {
 1250|       |        return 0;
 1251|       |    }
 1252|       |    */
 1253|       |    /*  extract -OH bond */
 1254|    136|    nNumBondPosTmp = 0;
 1255|       |
 1256|    136|    path_bonds[0][0] = path_bonds[1][0] = bond_type;
 1257|    136|    if (REPLACE_THE_BOND( bond_type ))
  ------------------
  |  |  173|    136|#define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  177|    136|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  |  |  ------------------
  |  |  |  |  |  |   32|    272|#define BOND_TYPE_SINGLE    1
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  178|    124|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  |  |  ------------------
  |  |  |  |  |  |   33|    260|#define BOND_TYPE_DOUBLE    2
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  180|    116|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|    252|#define BOND_TYPE_ALTERN    4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  186|    106|#define BOND_ALT12NS             9
  |  |  ------------------
  |  |  |  Branch (173:31): [True: 12, False: 124]
  |  |  |  Branch (173:53): [True: 8, False: 116]
  |  |  |  Branch (173:75): [True: 10, False: 106]
  |  |  |  Branch (173:97): [True: 12, False: 94]
  |  |  ------------------
  ------------------
 1258|     42|    {
 1259|     42|        BondPosTmp[nNumBondPosTmp].nAtomNumber = nxt_at; /*  accumulate bonds to be */
 1260|     42|        BondPosTmp[nNumBondPosTmp].neighbor_index = i;   /*  marked as tautomeric */
 1261|     42|        nNumBondPosTmp += 2; /*  leave room for the same bond in the opposite direction */
 1262|     42|    }
 1263|       |
 1264|       |    /*  extract other bonds */
 1265|       |    /* path_bonds[] contents:
 1266|       |
 1267|       |
 1268|       |                    O              OH            OH
 1269|       |                    ||             |             |
 1270|       |                   /  \          //  \          /  \\
 1271|       |                  ||   ||  <-->  |   ||  <-->  ||   |
 1272|       |                   \  /          \\  /          \  //
 1273|       |                    NH             N             N
 1274|       |
 1275|       |        path[0]:  O=NH-=-      OH-N...         OH.N...
 1276|       |        path[1]   O=NH-=-      OH-N...         OH.N...
 1277|       |                 bonds are    all bonds       all bonds
 1278|       |                 single and   are either      are either
 1279|       |                 double       alt or taut     alt or taut
 1280|       |    */
 1281|    544|    for (j = 0; j < middle_pos; j++)
  ------------------
  |  Branch (1281:17): [True: 408, False: 136]
  ------------------
 1282|    408|    {
 1283|  1.22k|        for (i = 0; i < 2; i++)
  ------------------
  |  Branch (1283:21): [True: 816, False: 408]
  ------------------
 1284|    816|        {
 1285|       |            /* k = i? j : middle_pos-1-j; */
 1286|    816|            k = i ? middle_pos + j : middle_pos - 1 - j;
  ------------------
  |  Branch (1286:17): [True: 408, False: 408]
  ------------------
 1287|       |            /*  i=0: from O neighbor i=0: down to N, i=1: up to N */
 1288|    816|            bond_type = DfsPath[k].bond_type;
 1289|       |
 1290|    816|            path_bonds[i][j + 1] = bond_type;
 1291|    816|            if (REPLACE_THE_BOND( bond_type ))
  ------------------
  |  |  173|    816|#define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  177|    816|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  |  |  ------------------
  |  |  |  |  |  |   32|  1.63k|#define BOND_TYPE_SINGLE    1
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  178|    672|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  |  |  ------------------
  |  |  |  |  |  |   33|  1.48k|#define BOND_TYPE_DOUBLE    2
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  180|    642|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|  1.45k|#define BOND_TYPE_ALTERN    4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  186|    584|#define BOND_ALT12NS             9
  |  |  ------------------
  |  |  |  Branch (173:31): [True: 144, False: 672]
  |  |  |  Branch (173:53): [True: 30, False: 642]
  |  |  |  Branch (173:75): [True: 58, False: 584]
  |  |  |  Branch (173:97): [True: 44, False: 540]
  |  |  ------------------
  ------------------
 1292|    276|            {
 1293|    276|                BondPosTmp[nNumBondPosTmp].nAtomNumber = DfsPath[k].at_no;       /*  accumulate bonds to be */
 1294|    276|                BondPosTmp[nNumBondPosTmp].neighbor_index = DfsPath[k].bond_pos; /*  marked as tautomeric */
 1295|    276|                nNumBondPosTmp += 2;   /*  leave room for the same bond in the opposite direction */
 1296|    276|            }
 1297|    816|        }
 1298|    408|    }
 1299|       |
 1300|    136|    if (!are_alt_bonds( path_bonds[0], middle_pos + 1 ) || !are_alt_bonds( path_bonds[1], middle_pos + 1 ))
  ------------------
  |  Branch (1300:9): [True: 27, False: 109]
  |  Branch (1300:60): [True: 23, False: 86]
  ------------------
 1301|     50|    {
 1302|     50|        return 0;
 1303|     50|    }
 1304|       |
 1305|       |    /* finally check whether the bonds allow moving the hydrogens */
 1306|     86|    if (( atom[o_at].endpoint != atom[n_at].endpoint || !atom[o_at].endpoint ))
  ------------------
  |  Branch (1306:11): [True: 10, False: 76]
  |  Branch (1306:57): [True: 8, False: 68]
  ------------------
 1307|     18|    {
 1308|     18|        int nErr;
 1309|     18|        nErr = bExistsAnyAltPath( pCG, pBNS, pBD, atom, num_atoms, n_at, o_at, ALT_PATH_MODE_TAUTOM );
  ------------------
  |  |  310|     18|#define ALT_PATH_MODE_TAUTOM     1
  ------------------
 1310|     18|        if (nErr <= 0)
  ------------------
  |  Branch (1310:13): [True: 4, False: 14]
  ------------------
 1311|      4|        {
 1312|      4|            return nErr;
 1313|      4|        }
 1314|     18|    }
 1315|       |
 1316|       |    /*  save endpoints */
 1317|    246|    for (j = 0; j < 2; j++)
  ------------------
  |  Branch (1317:17): [True: 164, False: 82]
  ------------------
 1318|    164|    {
 1319|    164|        endpoint = j ? n_at :      /*  =N-  2 */
  ------------------
  |  Branch (1319:20): [True: 82, False: 82]
  ------------------
 1320|    164|            o_at;       /*  -OH  1 */
 1321|    164|        if (!atom[endpoint].endpoint)
  ------------------
  |  Branch (1321:13): [True: 22, False: 142]
  ------------------
 1322|     22|        { /* not a known endpoint */
 1323|     22|            endpoint_valence = j ? endpoint_valence2 : endpoint_valence1;
  ------------------
  |  Branch (1323:32): [True: 10, False: 12]
  ------------------
 1324|     22|            chem_bonds_valence = j ? eif2.cNeutralBondsValence : eif1.cNeutralBondsValence;
  ------------------
  |  Branch (1324:34): [True: 10, False: 12]
  ------------------
 1325|       |            /* endpoint_valence = get_endpoint_valence( atom[endpoint].el_number ); */
 1326|     22|            nMobile = j ? nMobile2 : nMobile1;
  ------------------
  |  Branch (1326:23): [True: 10, False: 12]
  ------------------
 1327|       |            /* nMobile  = (atom[endpoint].charge == -1) + atom[endpoint].num_H; */
 1328|       |            /* if ( nMobile + atom[endpoint].chem_bonds_valence != endpoint_valence ) -- fixed 02-06-2003*/
 1329|     22|            if (nMobile + chem_bonds_valence != endpoint_valence)
  ------------------
  |  Branch (1329:17): [True: 0, False: 22]
  ------------------
 1330|      0|                return 0; /*  abnormal endpoint valence; ignore. */
 1331|     22|            AddAtom2num( EndPointTmp[nNumEndPointTmp].num, atom, endpoint, 2 ); /* fill out */
 1332|     22|            AddAtom2DA( EndPointTmp[nNumEndPointTmp].num_DA, atom, endpoint, 2 );
 1333|       |            /*
 1334|       |                        EndPointTmp[nNumEndPointTmp].num[1] = (atom[endpoint].charge == -1);
 1335|       |                        EndPointTmp[nNumEndPointTmp].num[0] = nMobile;
 1336|       |                        for ( m = 0; m < T_NUM_ISOTOPIC; m ++ ) {
 1337|       |                            EndPointTmp[nNumEndPointTmp].num[T_NUM_NO_ISOTOPIC+m] = atom[endpoint].num_iso_H[NUM_H_ISOTOPES-m-1];
 1338|       |                        }
 1339|       |            */
 1340|     22|        }
 1341|    142|        else
 1342|    142|        { /* already an endpoint */ /* **now it is wrong:** no mobile atom/charge at this endpoint */
 1343|    142|            memset( EndPointTmp + nNumEndPointTmp, 0, sizeof( EndPointTmp[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 1344|    142|        }
 1345|    164|        EndPointTmp[nNumEndPointTmp].nAtomNumber = endpoint;
 1346|    164|        EndPointTmp[nNumEndPointTmp].nGroupNumber = atom[endpoint].endpoint;
 1347|    164|        EndPointTmp[nNumEndPointTmp].nEquNumber = 0;
 1348|       |
 1349|    164|        nNumEndPointTmp++;
 1350|    164|    }
 1351|       |    /*  add collected tautomeric bonds and endpoints to the input/output data */
 1352|     82|    nNumBondPos = AddBondsPos( atom, BondPosTmp, nNumBondPosTmp, BondPos, nMaxNumBondPos, nNumBondPos );
 1353|     82|    nNumEndPoint = AddEndPoints( EndPointTmp, nNumEndPointTmp, EndPoint, nMaxNumEndPoint, nNumEndPoint );
 1354|       |
 1355|     82|    if (nNumBondPos >= 0 && nNumEndPoint >= 0)
  ------------------
  |  Branch (1355:9): [True: 82, False: 0]
  |  Branch (1355:29): [True: 82, False: 0]
  ------------------
 1356|     82|    {
 1357|     82|        if ((ret = ( nNumBondPos > *pnNumBondPos ) || ( nNumEndPoint > *pnNumEndPoint ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1357:13): [True: 41, False: 41]
  |  Branch (1357:20): [True: 11, False: 71]
  |  Branch (1357:55): [True: 30, False: 41]
  ------------------
 1358|     41|        {
 1359|     41|            *pnNumBondPos = nNumBondPos;
 1360|     41|            *pnNumEndPoint = nNumEndPoint;
 1361|     41|        }
 1362|     82|    }
 1363|       |
 1364|     82|    return ret;
 1365|     82|#undef PATH_LEN
 1366|     82|}
Check5MembTautRing:
 1647|    271|{
 1648|    271|#define PATH_LEN 4
 1649|    271|    int i, j, /*m,*/ nMobile, nMobile1, nMobile2, ept, eptn;
 1650|    271|    int num_taut_endpoints, nNumBondPos, nNumBondPosTmp, nNumEndPoint, nNumEndPointTmp, ret;
 1651|    271|    int endpoint;
 1652|    271|    int n1_at = (int) DfsPath[0].at_no;
 1653|    271|    int n2_at = (int) DfsPath[1].at_no;
 1654|    271|    U_CHAR path_bonds[PATH_LEN + 1], bond_type;
 1655|    271|    T_ENDPOINT EndPointTmp[2];
 1656|    271|    T_BONDPOS  BondPosTmp[2 * PATH_LEN];
 1657|    271|    ENDPOINT_INFO eif1, eif2;
 1658|       |
 1659|       |    /*  the two root atoms (atom[n1_at] and atom[n2_at]) cannot belong */
 1660|       |    /*  to one and the same tautomeric group: it has been verified in MarkTautomerGroups() */
 1661|       |
 1662|       |    /*  check hydrogens/endpoints */
 1663|    271|    if (nLenDfsPath != 4)
  ------------------
  |  Branch (1663:9): [True: 0, False: 271]
  ------------------
 1664|      0|    {
 1665|      0|        return 0; /*  program error */
 1666|      0|    }
 1667|    271|    if (nStartAtomNeighbor2 >= 0 || nStartAtomNeighborNeighbor >= 0)
  ------------------
  |  Branch (1667:9): [True: 0, False: 271]
  |  Branch (1667:37): [True: 0, False: 271]
  ------------------
 1668|      0|    {
 1669|      0|        return 0; /*  program error: wrong call */
 1670|      0|    }
 1671|       |
 1672|    271|    nNumBondPos = *pnNumBondPos;
 1673|    271|    nNumEndPoint = *pnNumEndPoint;
 1674|    271|    nNumEndPointTmp = 0;
 1675|       |    /* djb-rwth: removing redundant code */
 1676|    271|    ret = 0;
 1677|    813|    for (ept = 0; ept < 2; ept++) /* djb-rwth: initialisation needed for num array */
  ------------------
  |  Branch (1677:19): [True: 542, False: 271]
  ------------------
 1678|  3.25k|        for (eptn = 0; eptn < T_NUM_NO_ISOTOPIC + T_NUM_ISOTOPIC; eptn++)
  ------------------
  |  |   69|  3.25k|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
                      for (eptn = 0; eptn < T_NUM_NO_ISOTOPIC + T_NUM_ISOTOPIC; eptn++)
  ------------------
  |  |   70|  3.25k|#define           T_NUM_ISOTOPIC    NUM_H_ISOTOPES /* was 2, now 3 */
  |  |  ------------------
  |  |  |  |   25|  3.25k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  |  |  ------------------
  ------------------
  |  Branch (1678:24): [True: 2.71k, False: 542]
  ------------------
 1679|  2.71k|            EndPointTmp[ept].num[eptn] = 0;
 1680|       |
 1681|    271|    if (!nGetEndpointInfo( atom, n1_at, &eif1 ) ||
  ------------------
  |  Branch (1681:9): [True: 0, False: 271]
  ------------------
 1682|    271|        !nGetEndpointInfo( atom, n2_at, &eif2 ))
  ------------------
  |  Branch (1682:9): [True: 0, False: 271]
  ------------------
 1683|      0|    {
 1684|      0|        return 0;
 1685|      0|    }
 1686|       |
 1687|    271|    nMobile1 = atom[n1_at].num_H + ( atom[n1_at].charge == -1 );
 1688|    271|    nMobile2 = atom[n2_at].num_H + ( atom[n2_at].charge == -1 );
 1689|    271|    nMobile = nMobile1 + nMobile2;
 1690|    271|    num_taut_endpoints = ( 0 != atom[n1_at].endpoint ) + ( 0 != atom[n2_at].endpoint ); /*  if both N atoms already are endpoints */
 1691|       |    /*
 1692|       |    if ( !(nMobile == 1 || num_taut_endpoints == 2) && !(nMobile>1 && num_taut_endpoints >= 1) ) {
 1693|       |        return 0;
 1694|       |    }
 1695|       |    */
 1696|    271|    if (num_taut_endpoints == 0 && nMobile != 1)
  ------------------
  |  Branch (1696:9): [True: 14, False: 257]
  |  Branch (1696:36): [True: 0, False: 14]
  ------------------
 1697|      0|    {
 1698|      0|        return 0;
 1699|      0|    }
 1700|       |
 1701|       |    /* finally check whether the bonds allow moving the hydrogens */
 1702|    271|    if (( atom[n1_at].endpoint != atom[n2_at].endpoint || !atom[n1_at].endpoint ))
  ------------------
  |  Branch (1702:11): [True: 33, False: 238]
  |  Branch (1702:59): [True: 14, False: 224]
  ------------------
 1703|     47|    {
 1704|     47|        int nErr;
 1705|     47|        nErr = bExistsAnyAltPath( pCG, pBNS, pBD, atom, num_atoms, n1_at, n2_at, ALT_PATH_MODE_TAUTOM );
  ------------------
  |  |  310|     47|#define ALT_PATH_MODE_TAUTOM     1
  ------------------
 1706|     47|        if (nErr <= 0)
  ------------------
  |  Branch (1706:13): [True: 15, False: 32]
  ------------------
 1707|     15|        {
 1708|     15|            return nErr;
 1709|     15|        }
 1710|     47|    }
 1711|       |
 1712|       |    /*  save endpoints */
 1713|    768|    for (j = 0; j < 2; j++)
  ------------------
  |  Branch (1713:17): [True: 512, False: 256]
  ------------------
 1714|    512|    {
 1715|    512|        endpoint = j ? n1_at : n2_at;
  ------------------
  |  Branch (1715:20): [True: 256, False: 256]
  ------------------
 1716|    512|        if (!atom[endpoint].endpoint)
  ------------------
  |  Branch (1716:13): [True: 40, False: 472]
  ------------------
 1717|     40|        {
 1718|       |            /* not a known endpoint */
 1719|       |            /*
 1720|       |                        nMobile  = (atom[endpoint].charge == -1) + atom[endpoint].num_H;
 1721|       |                    } else {
 1722|       |                        nMobile  = 0;
 1723|       |                    }
 1724|       |                    if ( nMobile ) {
 1725|       |            */
 1726|     40|            AddAtom2num( EndPointTmp[nNumEndPointTmp].num, atom, endpoint, 2 ); /* fill out */
 1727|     40|            AddAtom2DA( EndPointTmp[nNumEndPointTmp].num_DA, atom, endpoint, 2 );
 1728|       |            /*
 1729|       |            EndPointTmp[nNumEndPointTmp].num[1] = (atom[endpoint].charge == -1);
 1730|       |            EndPointTmp[nNumEndPointTmp].num[0] = nMobile;
 1731|       |            for ( m = 0; m < T_NUM_ISOTOPIC; m ++ ) {
 1732|       |                EndPointTmp[nNumEndPointTmp].num[T_NUM_NO_ISOTOPIC+m] = atom[endpoint].num_iso_H[NUM_H_ISOTOPES-m-1];
 1733|       |            }
 1734|       |            */
 1735|     40|        }
 1736|    472|        else
 1737|    472|        {
 1738|    472|            memset( EndPointTmp + nNumEndPointTmp, 0, sizeof( EndPointTmp[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 1739|    472|        }
 1740|    512|        EndPointTmp[nNumEndPointTmp].nAtomNumber = endpoint;
 1741|    512|        EndPointTmp[nNumEndPointTmp].nGroupNumber = atom[endpoint].endpoint;
 1742|    512|        EndPointTmp[nNumEndPointTmp].nEquNumber = 0;
 1743|       |
 1744|    512|        nNumEndPointTmp++;
 1745|    512|    }
 1746|       |
 1747|       |    /*  extract bonds */
 1748|    256|    nNumBondPosTmp = 0;
 1749|  1.28k|    for (i = 1; i <= nLenDfsPath; i++)
  ------------------
  |  Branch (1749:17): [True: 1.02k, False: 256]
  ------------------
 1750|  1.02k|    {
 1751|  1.02k|        bond_type = DfsPath[i].bond_type;
 1752|  1.02k|        path_bonds[i - 1] = bond_type;
 1753|  1.02k|        if (REPLACE_THE_BOND( bond_type ))
  ------------------
  |  |  173|  1.02k|#define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  177|  1.02k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  |  |  ------------------
  |  |  |  |  |  |   32|  2.04k|#define BOND_TYPE_SINGLE    1
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  178|    997|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  |  |  ------------------
  |  |  |  |  |  |   33|  2.02k|#define BOND_TYPE_DOUBLE    2
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  180|    991|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|  2.01k|#define BOND_TYPE_ALTERN    4
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define REPLACE_THE_BOND(X) ( (X) == BOND_SINGLE || (X) == BOND_DOUBLE || (X) == BOND_ALTERN || (X) == BOND_ALT12NS )
  |  |  ------------------
  |  |  |  |  186|    978|#define BOND_ALT12NS             9
  |  |  ------------------
  |  |  |  Branch (173:31): [True: 27, False: 997]
  |  |  |  Branch (173:53): [True: 6, False: 991]
  |  |  |  Branch (173:75): [True: 13, False: 978]
  |  |  |  Branch (173:97): [True: 23, False: 955]
  |  |  ------------------
  ------------------
 1754|     69|        {
 1755|     69|            BondPosTmp[nNumBondPosTmp].nAtomNumber = DfsPath[i].at_no;
 1756|     69|            BondPosTmp[nNumBondPosTmp].neighbor_index = DfsPath[i].bond_pos;
 1757|     69|            nNumBondPosTmp += 2;
 1758|     69|        }
 1759|  1.02k|    }
 1760|       |    /* path_bonds is from at_n2 to at_n1 */
 1761|    256|    if (!( i = are_alt_bonds( path_bonds, nLenDfsPath ) ))
  ------------------
  |  Branch (1761:9): [True: 9, False: 247]
  ------------------
 1762|      9|    {
 1763|      9|        return 0;
 1764|      9|    }
 1765|       |    /* i is a bond type of the last bond to at_n1, the first bond from at_n2 is 2-i if i=1 or 2 */
 1766|       |
 1767|       |    /* single bond at n1_at: it should have a mobile atom, n2_at should not */
 1768|    247|    if ((i == BOND_SINGLE && ( (!atom[n1_at].endpoint && !eif1.cDonor) || (!atom[n2_at].endpoint && !eif2.cAcceptor) )) ||
  ------------------
  |  |  177|    247|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|    494|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (1768:10): [True: 9, False: 238]
  |  Branch (1768:33): [True: 6, False: 3]
  |  Branch (1768:58): [True: 0, False: 6]
  |  Branch (1768:76): [True: 6, False: 3]
  |  Branch (1768:101): [True: 0, False: 6]
  ------------------
 1769|       |        /* double bond at n1_at: it should not have a mobile atom, n2_at should */
 1770|    247|        (i == BOND_DOUBLE && ( (!atom[n1_at].endpoint && !eif1.cAcceptor) || (!atom[n2_at].endpoint && !eif2.cDonor) ))) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |  178|    247|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|    494|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (1770:10): [True: 10, False: 237]
  |  Branch (1770:33): [True: 5, False: 5]
  |  Branch (1770:58): [True: 0, False: 5]
  |  Branch (1770:79): [True: 6, False: 4]
  |  Branch (1770:104): [True: 2, False: 4]
  ------------------
 1771|      2|    {
 1772|      2|        return 0; /* bond pattern does not fit */
 1773|      2|    }
 1774|       |
 1775|    245|    nNumBondPos = AddBondsPos( atom, BondPosTmp, nNumBondPosTmp, BondPos, nMaxNumBondPos, nNumBondPos );
 1776|    245|    nNumEndPoint = AddEndPoints( EndPointTmp, nNumEndPointTmp, EndPoint, nMaxNumEndPoint, nNumEndPoint );
 1777|       |
 1778|    245|    if (nNumBondPos >= 0 && nNumEndPoint >= 0)
  ------------------
  |  Branch (1778:9): [True: 245, False: 0]
  |  Branch (1778:29): [True: 245, False: 0]
  ------------------
 1779|    245|    {
 1780|    245|        if ((ret = ( nNumBondPos > *pnNumBondPos ) || ( nNumEndPoint > *pnNumEndPoint ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1780:13): [True: 245, False: 0]
  |  Branch (1780:20): [True: 21, False: 224]
  |  Branch (1780:55): [True: 224, False: 0]
  ------------------
 1781|    245|        {
 1782|    245|            *pnNumBondPos = nNumBondPos;
 1783|    245|            *pnNumEndPoint = nNumEndPoint;
 1784|    245|        }
 1785|    245|    }
 1786|    245|    return ret;
 1787|       |
 1788|    247|#undef PATH_LEN
 1789|    247|}

ReadWriteInChI:
  603|  12.5k|{
  604|  12.5k|    InpInChI OneInput;
  605|  12.5k|    char* strHdr = NULL;
  606|  12.5k|    char* szCurHdr = NULL;
  607|  12.5k|    int num_components[INCHI_NUM];
  608|  12.5k|    int bReqNonTaut = (0 != ((ip_inp->nMode & REQ_MODE_BASIC) &&
  ------------------
  |  |   15|  12.5k|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (608:30): [True: 0, False: 12.5k]
  ------------------
  609|      0|        (ip_inp->nMode & REQ_MODE_TAUT)));
  ------------------
  |  |   16|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  |  Branch (609:9): [True: 0, False: 0]
  ------------------
  610|       |    /*
  611|       |    int bReqRecmet  = (0 != ((ip->bTautFlags & TG_FLAG_RECONNECT_COORD) &&
  612|       |    (ip->bTautFlags & TG_FLAG_DISCONNECT_COORD)));
  613|       |    */
  614|  12.5k|    int bReqStereo = (0 != (ip_inp->nMode & REQ_MODE_STEREO));
  ------------------
  |  |   19|  12.5k|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
  615|  12.5k|    int bHasSomeReconnected = 0, bHasSomeFixedH = 0, bHasMetal = 0;
  616|  12.5k|    int nModeFlagsStereo = 0, bTautFlags = 0; /* InChI creation flags modifications derived from current InChI */
  617|  12.5k|    MODE_PIXH nModeProtonIsoExchgH[INCHI_NUM];
  618|       |
  619|  12.5k|    NORM_CANON_FLAGS ncFlags;
  620|  12.5k|    NORM_CANON_FLAGS* pncFlags = &ncFlags;
  621|  12.5k|    INPUT_PARMS ip_cur, * ip;
  622|  12.5k|    STRUCT_DATA sd_cur, * sd;
  623|       |
  624|  12.5k|    int  pState; /* djb-rwth: removing redundant variables */
  625|  12.5k|    int  bReqProtonsForEachComponent = 0;
  626|  12.5k|    int  bReqSplitOutputInChI = 0;
  627|  12.5k|    SEGM_LINE Line;
  628|  12.5k|    SEGM_LINE* pLine = &Line;
  629|  12.5k|    long          ulProcessingTime = 0;
  630|  12.5k|    inchiTime     ulTStart;
  631|  12.5k|    long          num_processed = 0, num_errors = 0;
  632|  12.5k|    int  bPlainTabbedOutput; /* djb-rwth: ignoring LLVM warning: variable used */
  633|  12.5k|    const char* pTAB; /* djb-rwth: ignoring LLVM warning: variable used */
  634|       |
  635|  12.5k|    long num_inp = 0;
  636|       |
  637|  12.5k|    int read_inchi_ok = 0;
  638|  12.5k|    int end_of_data_reached = 0;
  639|  12.5k|    int treat_save_opt = 0;
  640|  12.5k|    int input_is_stdinchi = 0;
  641|  12.5k|    int input_has_save_opt = 0;
  642|  12.5k|    unsigned char input_save_opt_bits = 0;
  643|  12.5k|    unsigned char save_opt_bits = 0;
  644|       |
  645|  12.5k|    const int       bInChI2Structure = 0 != (ip_inp->bReadInChIOptions & READ_INCHI_TO_STRUCTURE);
  ------------------
  |  |  991|  12.5k|#define READ_INCHI_TO_STRUCTURE          0x00000008
  ------------------
  646|  12.5k|    const int       bInChI2InChI = 0 != (ip_inp->bReadInChIOptions & READ_INCHI_OUTPUT_INCHI);
  ------------------
  |  |  988|  12.5k|#define READ_INCHI_OUTPUT_INCHI          0x00000001
  ------------------
  647|  12.5k|    const int       bReadCoord = bInChI2Structure;
  648|       |
  649|  12.5k|    int  nMessageLen = MAX_MSG_LEN;
  ------------------
  |  |  423|  12.5k|#define MAX_MSG_LEN 512
  ------------------
  650|  12.5k|    char szMessage[MAX_MSG_LEN];
  651|  12.5k|    int  nInitLenMessage;
  652|  12.5k|    int invalid_opt = 0;
  653|  12.5k|    int      j, nErr, iINChI;
  654|       |
  655|  12.5k|    int treat_mismatch_as_error = ip_inp->bINChIOutputOptions2 & INCHI_OUT_MISMATCH_AS_ERROR;
  ------------------
  |  |  150|  12.5k|#define INCHI_OUT_MISMATCH_AS_ERROR      0x0002 /* v. 1.05 */
  ------------------
  656|  12.5k|    int output_error_inchi = ip_inp->bINChIOutputOptions2 & INCHI_OUT_INCHI_GEN_ERROR;
  ------------------
  |  |  149|  12.5k|#define INCHI_OUT_INCHI_GEN_ERROR        0x0001 /* v. 1.05 */
  ------------------
  657|       |
  658|  12.5k|    int ret = 0;
  659|  12.5k|    int nReadStatus = RI_ERR_EOL;
  ------------------
  |  |   18|  12.5k|#define RI_ERR_EOL     (-4)
  ------------------
  660|       |
  661|  12.5k|    INCHI_IOSTREAM* pRealOut = pOut;
  662|       |    /* temporary output buffer pTmpOut may be used    */
  663|       |    /* locally instead of legal pOut to capture        */
  664|       |    /* InChI string which may then be recognised    */
  665|       |    /* as erratic (whence should not be finally        */
  666|       |    /* printed)        */
  667|  12.5k|    INCHI_IOSTREAM tmpoutputstr;
  668|  12.5k|    INCHI_IOSTREAM* pTmpOut = &tmpoutputstr;
  669|  12.5k|    if (bInChI2Structure)
  ------------------
  |  Branch (669:9): [True: 6.28k, False: 6.28k]
  ------------------
  670|  6.28k|    {
  671|  6.28k|        inchi_ios_init(pTmpOut, INCHI_IOS_TYPE_STRING, NULL);
  ------------------
  |  | 1016|  6.28k|#define INCHI_IOS_TYPE_STRING 1
  ------------------
  672|  6.28k|        if (pTmpOut->s.pStr)
  ------------------
  |  Branch (672:13): [True: 0, False: 6.28k]
  ------------------
  673|      0|            pRealOut = pTmpOut;
  674|  6.28k|    }
  675|       |
  676|       |#ifdef GHI100_FIX
  677|       |#if ((SPRINTF_FLAG != 1) && (SPRINTF_FLAG != 2))
  678|       |    setlocale(LC_ALL, "en-US"); /* djb-rwth: setting all locales to "en-US" */
  679|       |#endif
  680|       |#endif
  681|       |
  682|  12.5k|    memset(szMessage, 0, sizeof(szMessage)); /* djb-rwth: memset_s C11/Annex K variant? */
  683|  12.5k|    memset(&OneInput, 0, sizeof(OneInput)); /* djb-rwth: memset_s C11/Annex K variant? */
  684|  12.5k|    memset(pLine, 0, sizeof(pLine[0])); /* djb-rwth: memset_s C11/Annex K variant? */
  685|  12.5k|    if (szMsg)
  ------------------
  |  Branch (685:9): [True: 12.5k, False: 0]
  ------------------
  686|  12.5k|        szMsg[0] = '\0';
  687|       |
  688|  12.5k|    OneInput.polymer = NULL;    /* v. 1.05 added */
  689|  12.5k|    OneInput.v3000 = NULL;
  690|       |
  691|       |
  692|       |    /* Read input, InChI by InChI*/
  693|  12.5k|    while (nReadStatus != RI_ERR_EOF)
  ------------------
  |  |   19|  12.5k|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (693:12): [True: 12.5k, False: 0]
  ------------------
  694|  12.5k|    {
  695|  37.6k|        for (iINChI = 0; iINChI < INCHI_NUM; iINChI++)
  ------------------
  |  |  569|  37.6k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (695:26): [True: 25.1k, False: 12.5k]
  ------------------
  696|  25.1k|        {
  697|  75.3k|            for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  573|  75.3k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (697:25): [True: 50.2k, False: 25.1k]
  ------------------
  698|  50.2k|            {
  699|  50.2k|                if (OneInput.nNumProtons[iINChI][j].pNumProtons)
  ------------------
  |  Branch (699:21): [True: 0, False: 50.2k]
  ------------------
  700|      0|                {
  701|      0|                    inchi_free(OneInput.nNumProtons[iINChI][j].pNumProtons);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  702|      0|                    OneInput.nNumProtons[iINChI][j].pNumProtons = NULL;
  703|      0|                }
  704|  50.2k|            }
  705|  25.1k|        }
  706|       |
  707|  12.5k|        memset(&OneInput, 0, sizeof(OneInput)); /* djb-rwth: memset_s C11/Annex K variant? */
  708|  12.5k|        memset(pncFlags, 0, sizeof(*pncFlags)); /* djb-rwth: memset_s C11/Annex K variant? */
  709|       |        /* djb-rwth: removing redundant code */
  710|  12.5k|        ip_cur = *ip_inp;
  711|  12.5k|        ip = &ip_cur;
  712|  12.5k|        sd_cur = *sd_inp;
  713|  12.5k|        sd = &sd_cur;
  714|       |
  715|  12.5k|        bReqSplitOutputInChI =
  716|  12.5k|            0 != (ip->bReadInChIOptions & READ_INCHI_SPLIT_OUTPUT);
  ------------------
  |  |  989|  12.5k|#define READ_INCHI_SPLIT_OUTPUT          0x00000002
  ------------------
  717|  12.5k|        bReqProtonsForEachComponent =
  718|  12.5k|            bReqSplitOutputInChI &&
  ------------------
  |  Branch (718:13): [True: 0, False: 12.5k]
  ------------------
  719|      0|            0 != (READ_INCHI_KEEP_BALANCE_P & ip->bReadInChIOptions);
  ------------------
  |  |  990|      0|#define READ_INCHI_KEEP_BALANCE_P        0x00000004
  ------------------
  |  Branch (719:13): [True: 0, False: 0]
  ------------------
  720|  12.5k|        bPlainTabbedOutput =
  721|  12.5k|            0 != (ip->bINChIOutputOptions & INCHI_OUT_TABBED_OUTPUT);
  ------------------
  |  |  139|  12.5k|#define INCHI_OUT_TABBED_OUTPUT         0x0400   /* tab-delimited (only for plain text)     */
  ------------------
  722|       |
  723|  12.5k|        pTAB =
  724|  12.5k|#if ( defined(TARGET_API_LIB) || defined(TARGET_LIB_FOR_WINCHI) )
  725|  12.5k|            "\n";
  726|       |#else
  727|       |            bPlainTabbedOutput ? "\t" : "\n";
  728|       |#endif
  729|       |
  730|       |
  731|  12.5k|        if (bInChI2Structure)
  ------------------
  |  Branch (731:13): [True: 6.28k, False: 6.28k]
  ------------------
  732|  6.28k|        {
  733|  6.28k|            bReqStereo = 1;
  734|  6.28k|            bReqSplitOutputInChI = 1;
  735|  6.28k|            bReqProtonsForEachComponent = bReqNonTaut;
  736|  6.28k|            ip->bTautFlags |= (TG_FLAG_DISCONNECT_COORD | TG_FLAG_RECONNECT_COORD);
  ------------------
  |  |  931|  6.28k|#define TG_FLAG_DISCONNECT_COORD         0x00000080   /* find "coord. centers" and disconnect them */
  ------------------
                          ip->bTautFlags |= (TG_FLAG_DISCONNECT_COORD | TG_FLAG_RECONNECT_COORD);
  ------------------
  |  |  932|  6.28k|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  737|  6.28k|            ip->nMode |= (REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_ISO);
  ------------------
  |  |   15|  6.28k|#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);
  ------------------
  |  |   16|  6.28k|#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);
  ------------------
  |  |   19|  6.28k|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                          ip->nMode |= (REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_ISO);
  ------------------
  |  |   20|  6.28k|#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);
  ------------------
  |  |   17|  6.28k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
  738|       |            /* bReqRecmet  = 1; */
  739|  6.28k|#if ( bRELEASE_VERSION == 1 )
  740|  6.28k|            bReqNonTaut = 1; /* bReqNonTaut=0 ignores Fixed-H layer in input InChI, for testing only */
  741|  6.28k|#endif
  742|       |            /* polymer stuff added */
  743|  6.28k|            if (pInp->type == INCHI_IOS_TYPE_STRING)
  ------------------
  |  | 1016|  6.28k|#define INCHI_IOS_TYPE_STRING 1
  ------------------
  |  Branch (743:17): [True: 6.28k, False: 0]
  ------------------
  744|  6.28k|            {
  745|  6.28k|                int res; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  746|       |
  747|  6.28k|                if (ip_inp->lMolfileNumber)
  ------------------
  |  Branch (747:21): [True: 0, False: 6.28k]
  ------------------
  748|       |                    /* get here from inchi-1 main emulation mode */
  749|      0|                    num_inp = ip_inp->lMolfileNumber - 1;
  750|       |
  751|  6.28k|                res = DetectAndExposePolymerInternals(pInp); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  752|       |                /* proceed silently for now, errs mist be uncovered further on conversion */
  753|  6.28k|            }
  754|  6.28k|        }
  755|       |
  756|  12.5k|        InchiTimeGet(&ulTStart);
  757|       |
  758|       |        /* Read InChI string */
  759|  12.5k|        nReadStatus = InChILine2Data(pInp, pLine, &strHdr, &pState, &nErr,
  760|  12.5k|            OneInput.pInpInChI, OneInput.nNumComponents,
  761|  12.5k|            OneInput.nNumProtons, OneInput.s,
  762|  12.5k|            bReadCoord, bInChI2Structure, ip_inp->nMode,
  763|  12.5k|            &input_is_stdinchi, &input_has_save_opt,
  764|  12.5k|            &input_save_opt_bits,
  765|  12.5k|            &OneInput.polymer, &OneInput.v3000);
  766|       |
  767|  12.5k|        ulProcessingTime += InchiTimeElapsed(ic, &ulTStart);
  768|       |
  769|       |#if 0
  770|       |        if (!bInChI2Structure && OneInput.polymer)
  771|       |        {
  772|       |            /* inchi2inchi for polymers: for now skip */
  773|       |            pState == IST_MOBILE_H_POLYMER;
  774|       |            nReadStatus = -2;
  775|       |        }
  776|       |#endif
  777|       |
  778|       |
  779|  12.5k|        end_of_data_reached = nReadStatus == RI_ERR_EOL || nReadStatus == RI_ERR_EOF;
  ------------------
  |  |   18|  25.1k|#define RI_ERR_EOL     (-4)
  ------------------
                      end_of_data_reached = nReadStatus == RI_ERR_EOL || nReadStatus == RI_ERR_EOF;
  ------------------
  |  |   19|  24.0k|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (779:31): [True: 1.03k, False: 11.5k]
  |  Branch (779:60): [True: 9.31k, False: 2.21k]
  ------------------
  780|       |
  781|  12.5k|        if (!bInChI2Structure)
  ------------------
  |  Branch (781:13): [True: 6.28k, False: 6.28k]
  ------------------
  782|  6.28k|        {
  783|       |            /* i2i, disable polymer related */
  784|  6.28k|            if (OneInput.polymer)
  ------------------
  |  Branch (784:17): [True: 416, False: 5.86k]
  ------------------
  785|    416|            {
  786|    416|                pState = IST_MOBILE_H_POLYMER;
  787|    416|                nErr = RI_ERR_PROGR;
  ------------------
  |  |   17|    416|#define RI_ERR_PROGR   (-3)
  ------------------
  788|    416|            }
  789|  6.28k|        }
  790|       |
  791|  12.5k|        read_inchi_ok = end_of_data_reached && !nErr;
  ------------------
  |  Branch (791:25): [True: 10.3k, False: 2.21k]
  |  Branch (791:48): [True: 10.2k, False: 104]
  ------------------
  792|       |
  793|       |        /* then uncommented... commented out 2020-07-10 (potentially dangerous change, needs testing (TODO: i2s for InChI=1// )*/
  794|  12.5k|        read_inchi_ok = read_inchi_ok &&
  ------------------
  |  Branch (794:25): [True: 10.2k, False: 2.31k]
  ------------------
  795|  10.2k|            (OneInput.nNumComponents[INCHI_BAS][TAUT_YES] + OneInput.nNumComponents[INCHI_BAS][TAUT_NON]);
  ------------------
  |  |  570|  10.2k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          (OneInput.nNumComponents[INCHI_BAS][TAUT_YES] + OneInput.nNumComponents[INCHI_BAS][TAUT_NON]);
  ------------------
  |  |  575|  10.2k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          (OneInput.nNumComponents[INCHI_BAS][TAUT_YES] + OneInput.nNumComponents[INCHI_BAS][TAUT_NON]);
  ------------------
  |  |  570|  10.2k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          (OneInput.nNumComponents[INCHI_BAS][TAUT_YES] + OneInput.nNumComponents[INCHI_BAS][TAUT_NON]);
  ------------------
  |  |  574|  10.2k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (795:13): [True: 10.2k, False: 31]
  ------------------
  796|       |
  797|       |#if ALLOW_EMPTY_INCHI_AS_INPUT!=1
  798|       |        /* no empty InChI allowed */
  799|       |        read_inchi_ok = read_inchi_ok &&
  800|       |            (OneInput.nNumComponents[INCHI_BAS][TAUT_YES] +
  801|       |                OneInput.nNumComponents[INCHI_BAS][TAUT_NON]);
  802|       |#endif
  803|       |#ifdef TARGET_EXE_STANDALONE
  804|       |        /*  inchi-1: we currently disable conversion of polymeric InChI (inchi2struct)
  805|       |        to anything but SDF (would it be necessary in the future?)                */
  806|       |        if (OneInput.polymer &&
  807|       |            bInChI2Structure &&
  808|       |            !(ip_inp->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY))
  809|       |        {
  810|       |            read_inchi_ok = 0;
  811|       |            nErr = RI_ERR_PROGR;
  812|       |        }
  813|       |#endif
  814|       |
  815|  12.5k|        if (!read_inchi_ok)
  ------------------
  |  Branch (815:13): [True: 2.34k, False: 10.2k]
  ------------------
  816|  2.34k|        {
  817|  2.34k|            TreatErrorsInReadInChIString(nReadStatus, nErr, pState, ip_inp, pRealOut, pLog,
  818|  2.34k|                &num_inp, &num_errors, &num_processed,
  819|  2.34k|                &strHdr, &szCurHdr, &OneInput);
  820|  2.34k|            if (nReadStatus == RI_ERR_SYNTAX || nReadStatus == RI_ERR_PROGR)
  ------------------
  |  |   16|  4.69k|#define RI_ERR_SYNTAX  (-2)
  ------------------
                          if (nReadStatus == RI_ERR_SYNTAX || nReadStatus == RI_ERR_PROGR)
  ------------------
  |  |   17|    184|#define RI_ERR_PROGR   (-3)
  ------------------
  |  Branch (820:17): [True: 2.16k, False: 184]
  |  Branch (820:49): [True: 18, False: 166]
  ------------------
  821|  2.18k|            {
  822|  2.18k|                ret = nReadStatus;
  823|  2.18k|            }
  824|  2.34k|        }
  825|  10.2k|        else
  826|  10.2k|        {
  827|       |            /* InChI has been successfully read */
  828|  10.2k|            ret = 0;
  829|  10.2k|            num_inp++;
  830|  10.2k|            ip->lMolfileNumber = num_inp;
  831|  10.2k|            bHasSomeReconnected = 0;
  832|  10.2k|            bHasSomeFixedH = 0;
  833|       |
  834|  10.2k|            if (pRealOut == pTmpOut)
  ------------------
  |  Branch (834:17): [True: 0, False: 10.2k]
  ------------------
  835|      0|            {
  836|      0|                inchi_ios_reset(pRealOut);
  837|       |                /*inchi_ios_close( pRealOut );
  838|       |                inchi_ios_init( pRealOut, INCHI_IOS_TYPE_STRING, NULL );*/
  839|      0|            }
  840|       |            /* inchi_ios_print( pRealOut, ""); */
  841|       |
  842|       |            /* Does not allow conversion of a non-standard input to Standard output. */
  843|  10.2k|            if (ip_inp->bINChIOutputOptions & INCHI_OUT_STDINCHI)
  ------------------
  |  |  145|  10.2k|#define INCHI_OUT_STDINCHI 0x4000
  ------------------
  |  Branch (843:17): [True: 10.2k, False: 0]
  ------------------
  844|  10.2k|            {
  845|  10.2k|                if ((input_is_stdinchi & INCHI_INPUT_CLASS_MASK) ==
  ------------------
  |  |   75|  10.2k|#define INCHI_INPUT_CLASS_MASK         0x03
  ------------------
  |  Branch (845:21): [True: 10.1k, False: 41]
  ------------------
  846|  10.2k|                    INCHI_INPUT_CLASS_NONSTANDARD)
  ------------------
  |  |   76|  10.2k|#define INCHI_INPUT_CLASS_NONSTANDARD  0x00
  ------------------
  847|  10.1k|                {
  848|       |                    /* Input InChI is non-standard. */
  849|  10.1k|                    ip->bINChIOutputOptions &= ~INCHI_OUT_STDINCHI;
  ------------------
  |  |  145|  10.1k|#define INCHI_OUT_STDINCHI 0x4000
  ------------------
  850|       |                    /*
  851|       |                    if (szCurHdr && szCurHdr[0])
  852|       |                    inchi_ios_eprint( pLog, "Warning: forced conversion to non-standard InChI for non-std input, %s\n", szCurHdr );
  853|       |                    else
  854|       |                    inchi_ios_eprint( pLog, "Warning: forced conversion to non-standard InChI for non-std input, Structure %ld\n", num_inp );
  855|       |                    */
  856|  10.1k|                }
  857|  10.2k|            }
  858|       |
  859|       |            /*
  860|       |             * Preserve the input calculation-class designator and subversion
  861|       |             * designator when an InChI is converted or restored to a structure.
  862|       |             */
  863|  10.2k|            if (bInChI2InChI || bInChI2Structure)
  ------------------
  |  Branch (863:17): [True: 5.02k, False: 5.18k]
  |  Branch (863:33): [True: 5.18k, False: 0]
  ------------------
  864|  10.2k|            {
  865|  10.2k|                ip->bReadInChIOptions &= ~(READ_INCHI_INPUT_BETA | READ_INCHI_INPUT_MI);
  ------------------
  |  |  992|  10.2k|#define READ_INCHI_INPUT_BETA            0x00000010
  ------------------
                              ip->bReadInChIOptions &= ~(READ_INCHI_INPUT_BETA | READ_INCHI_INPUT_MI);
  ------------------
  |  |  993|  10.2k|#define READ_INCHI_INPUT_MI              0x00000020
  ------------------
  866|       |
  867|  10.2k|                if ((input_is_stdinchi & INCHI_INPUT_CLASS_MASK) == INCHI_INPUT_CLASS_BETA)
  ------------------
  |  |   75|  10.2k|#define INCHI_INPUT_CLASS_MASK         0x03
  ------------------
                              if ((input_is_stdinchi & INCHI_INPUT_CLASS_MASK) == INCHI_INPUT_CLASS_BETA)
  ------------------
  |  |   78|  10.2k|#define INCHI_INPUT_CLASS_BETA         0x02
  ------------------
  |  Branch (867:21): [True: 5, False: 10.2k]
  ------------------
  868|      5|                {
  869|      5|                    ip->bReadInChIOptions |= READ_INCHI_INPUT_BETA;
  ------------------
  |  |  992|      5|#define READ_INCHI_INPUT_BETA            0x00000010
  ------------------
  870|      5|                }
  871|       |
  872|  10.2k|                if (input_is_stdinchi & INCHI_INPUT_MI_MARKER)
  ------------------
  |  |   79|  10.2k|#define INCHI_INPUT_MI_MARKER          0x04
  ------------------
  |  Branch (872:21): [True: 0, False: 10.2k]
  ------------------
  873|      0|                {
  874|      0|                    ip->bReadInChIOptions |= READ_INCHI_INPUT_MI;
  ------------------
  |  |  993|      0|#define READ_INCHI_INPUT_MI              0x00000020
  ------------------
  875|      0|                }
  876|  10.2k|            }
  877|       |
  878|  10.2k|            treat_save_opt = ip->bINChIOutputOptions & INCHI_OUT_SAVEOPT;
  ------------------
  |  |  146|  10.2k|#define INCHI_OUT_SAVEOPT  0x8000
  ------------------
  879|       |
  880|  10.2k|            if (treat_save_opt)
  ------------------
  |  Branch (880:17): [True: 0, False: 10.2k]
  ------------------
  881|      0|            {
  882|      0|                PrepareSaveOptBits(ip, pLog, num_inp, szCurHdr,
  883|      0|                    input_has_save_opt,
  884|      0|                    input_save_opt_bits,
  885|      0|                    &save_opt_bits);
  886|      0|            }
  887|       |
  888|       |#ifndef TARGET_API_LIB
  889|       |            /*
  890|       |            inchi_ios_eprint(stderr, "%ld: %s\r", num_inp, strHdr? strHdr : "");
  891|       |            inchi_ios_eprint(pLog,  "%ld: %s\n", num_inp, strHdr? strHdr : "");
  892|       |            */
  893|       |
  894|       |            if (!ip->bNoStructLabels &&
  895|       |                !(bInChI2Structure && (ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY))
  896|       |                )
  897|       |            {
  898|       |                /* Added 2nd item: Do not output this extra line into the output SDfile. 2008-11-17 DCh */
  899|       |                if (strHdr && strstr(strHdr, "Structure:"))
  900|       |                {
  901|       |                    inchi_ios_print(pRealOut, "%s%s", strHdr, pTAB); /* output header */
  902|       |#if ( FIX_DALKE_BUGS == 1 )
  903|       |#else
  904|       |                    sprintf(szMessage, "%s (%ld)", strHdr ? strHdr : "", num_inp);
  905|       |#endif
  906|       |                }
  907|       |                else
  908|       |                {
  909|       |                    if (bInChI2Structure)    inchi_ios_print(pRealOut, "Structure: %ld. (%s)%s",
  910|       |                        num_inp, strHdr ? strHdr : "No struct name",
  911|       |                        pTAB); /* output header */
  912|       |#if ( FIX_DALKE_BUGS == 1 )
  913|       |#else
  914|       |                    sprintf(szMessage, "Structure: %ld. (%s)%s", num_inp, strHdr ? strHdr : "No struct name", pTAB);
  915|       |#endif
  916|       |                }
  917|       |                if (strHdr && strHdr[0])
  918|       |                {
  919|       |                    strncpy(ip->szSdfDataHeader, strHdr, sizeof(ip->szSdfDataHeader));
  920|       |                    ip->szSdfDataHeader[sizeof(ip->szSdfDataHeader) - 1] = '\0';
  921|       |                    ip->pSdfLabel = NULL;
  922|       |                    ip->pSdfValue = ip->szSdfDataHeader;
  923|       |                }
  924|       |                else
  925|       |                {
  926|       |                    ip->pSdfValue = NULL;
  927|       |                    ip->szSdfDataHeader[0] = '\0';
  928|       |                }
  929|       |            }
  930|       |
  931|       |#if ( FIX_DALKE_BUGS == 1 )
  932|       |            sprintf(szMessage, "%ld: %.400s", num_inp, strHdr ? strHdr : "");
  933|       |#else
  934|       |            sprintf(szMessage, "%ld: %s", num_inp, strHdr ? strHdr : "");
  935|       |#endif
  936|       |#endif
  937|       |
  938|  10.2k|            nInitLenMessage = (int)strlen(szMessage);
  939|  10.2k|            if (strHdr)
  ------------------
  |  Branch (939:17): [True: 0, False: 10.2k]
  ------------------
  940|      0|            {
  941|      0|                szCurHdr = strHdr;
  942|      0|                strHdr = NULL;
  943|      0|            }
  944|  10.2k|            if (szCurHdr && ip && ip->first_struct_number > 0)
  ------------------
  |  Branch (944:17): [True: 0, False: 10.2k]
  |  Branch (944:29): [True: 0, False: 0]
  |  Branch (944:35): [True: 0, False: 0]
  ------------------
  945|      0|            {
  946|       |                /* Check whether the structure should be skipped */
  947|      0|                static const char szStruct[] = "Structure:";
  948|      0|                char* pStrNum = strstr(szCurHdr, szStruct);
  949|      0|                long cur_struct_number;
  950|      0|                if (pStrNum)
  ------------------
  |  Branch (950:21): [True: 0, False: 0]
  ------------------
  951|      0|                {
  952|      0|                    pStrNum += sizeof(szStruct) - 1; /* -1 takes care of the string terminal zero */
  953|      0|                    cur_struct_number = inchi_strtol(pStrNum, NULL, 10);
  954|      0|                    if (cur_struct_number)
  ------------------
  |  Branch (954:25): [True: 0, False: 0]
  ------------------
  955|      0|                    {
  956|      0|                        OneInput.num_inp = cur_struct_number;
  957|      0|                    }
  958|       |                    /* Process request to bypass first several InChIs */
  959|      0|                    if (cur_struct_number > 0 && cur_struct_number < ip->first_struct_number)
  ------------------
  |  Branch (959:25): [True: 0, False: 0]
  |  Branch (959:50): [True: 0, False: 0]
  ------------------
  960|      0|                    {
  961|       |
  962|       |#if ( !defined(TARGET_API_LIB) && !defined(TARGET_EXE_STANDALONE) )
  963|       |                        inchi_fprintf(stderr, "Skipping %s\r", szMessage);
  964|       |#endif
  965|      0|                        FreeInpInChI(&OneInput);
  966|      0|                        if (szCurHdr)
  ------------------
  |  Branch (966:29): [True: 0, False: 0]
  ------------------
  967|      0|                        {
  968|      0|                            inchi_free(szCurHdr);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  969|      0|                            szCurHdr = NULL;
  970|      0|                        }
  971|      0|                        INCHI_HEAPCHK
  972|      0|                            continue;
  973|      0|                    }
  974|      0|                }
  975|      0|            }
  976|       |
  977|  10.2k|            num_processed++;
  978|       |
  979|       |            /* In case of splitting InChI into separate components */
  980|       |            /* decide whether to keep /p in each component or      */
  981|       |            /* output /p and /i/h as a separate component          */
  982|       |            /* Note: if InChI is not to be splitted DO NOT create  */
  983|       |            /* a separate component for /p, /i/h: it would be a bug*/
  984|       |
  985|  10.2k|            InchiTimeGet(&ulTStart);
  986|       |
  987|       |            INCHI_HEAPCHK
  988|       |
  989|  10.2k|                ret = SetProtonsAndXchgIsoH(bInChI2Structure, bReqSplitOutputInChI,
  990|  10.2k|                    bReqProtonsForEachComponent, bReqNonTaut, bReqStereo,
  991|  10.2k|                    num_components, nModeProtonIsoExchgH, &OneInput);
  992|  10.2k|            INCHI_HEAPCHK
  993|       |
  994|  10.2k|                if (ret < 0)
  ------------------
  |  Branch (994:21): [True: 0, False: 10.2k]
  ------------------
  995|      0|                {
  996|      0|                    num_errors++;
  997|      0|                    goto exit_error;
  998|      0|                }
  999|       |
 1000|  10.2k|            sd->num_components[INCHI_BAS] = num_components[INCHI_BAS];
  ------------------
  |  |  570|  10.2k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          sd->num_components[INCHI_BAS] = num_components[INCHI_BAS];
  ------------------
  |  |  570|  10.2k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1001|  10.2k|            sd->num_components[INCHI_REC] = num_components[INCHI_REC];
  ------------------
  |  |  571|  10.2k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          sd->num_components[INCHI_REC] = num_components[INCHI_REC];
  ------------------
  |  |  571|  10.2k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1002|       |
 1003|       |            /* Do we have reconnected InChI ? */
 1004|  10.2k|            if ((OneInput.nNumComponents[INCHI_REC][TAUT_YES] ||
  ------------------
  |  |  571|  10.2k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          if ((OneInput.nNumComponents[INCHI_REC][TAUT_YES] ||
  ------------------
  |  |  575|  10.2k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1004:18): [True: 50, False: 10.1k]
  ------------------
 1005|  10.1k|                OneInput.nNumComponents[INCHI_REC][TAUT_NON]) &&
  ------------------
  |  |  571|  10.1k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              OneInput.nNumComponents[INCHI_REC][TAUT_NON]) &&
  ------------------
  |  |  574|  10.1k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1005:17): [True: 0, False: 10.1k]
  ------------------
 1006|     50|                (ip->bTautFlags & TG_FLAG_RECONNECT_COORD) &&
  ------------------
  |  |  932|     50|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  |  Branch (1006:17): [True: 25, False: 25]
  ------------------
 1007|     25|                (ip->bTautFlags & TG_FLAG_DISCONNECT_COORD)
  ------------------
  |  |  931|     25|#define TG_FLAG_DISCONNECT_COORD         0x00000080   /* find "coord. centers" and disconnect them */
  ------------------
  |  Branch (1007:17): [True: 25, False: 0]
  ------------------
 1008|  10.2k|                )
 1009|     25|            {
 1010|       |                /* needed for InChI string output to include reconnected InChI */
 1011|     25|                sd->bTautFlagsDone[0] |= TG_FLAG_DISCONNECT_COORD_DONE;
  ------------------
  |  |  975|     25|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
 1012|     25|                bHasSomeReconnected = 1;
 1013|     25|            }
 1014|       |
 1015|       |            /* Do we have fixed H InChI ? */
 1016|  10.2k|            if (bReqNonTaut &&
  ------------------
  |  Branch (1016:17): [True: 5.18k, False: 5.02k]
  ------------------
 1017|       |                /*OneInput.nNumComponents[bHasSomeReconnected?INCHI_REC:INCHI_BAS][TAUT_NON]*/
 1018|  5.18k|                (OneInput.nNumComponents[INCHI_REC][TAUT_NON] ||
  ------------------
  |  |  571|  5.18k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              (OneInput.nNumComponents[INCHI_REC][TAUT_NON] ||
  ------------------
  |  |  574|  5.18k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1018:18): [True: 19, False: 5.17k]
  ------------------
 1019|  5.17k|                    OneInput.nNumComponents[INCHI_BAS][TAUT_NON]))
  ------------------
  |  |  570|  5.17k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                                  OneInput.nNumComponents[INCHI_BAS][TAUT_NON]))
  ------------------
  |  |  574|  5.17k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1019:21): [True: 1.25k, False: 3.91k]
  ------------------
 1020|  1.27k|            {
 1021|  1.27k|                bHasSomeFixedH = 1;
 1022|  1.27k|            }
 1023|       |
 1024|  10.2k|            ulProcessingTime += InchiTimeElapsed(ic, &ulTStart);
 1025|       |
 1026|  10.2k|            invalid_opt = (!bInChI2Structure && !bInChI2InChI) ||
  ------------------
  |  Branch (1026:28): [True: 5.02k, False: 5.18k]
  |  Branch (1026:49): [True: 0, False: 5.02k]
  ------------------
 1027|  10.2k|                (bInChI2Structure && bInChI2InChI);
  ------------------
  |  Branch (1027:18): [True: 5.18k, False: 5.02k]
  |  Branch (1027:38): [True: 0, False: 5.18k]
  ------------------
 1028|       |
 1029|  10.2k|            if (invalid_opt)
  ------------------
  |  Branch (1029:17): [True: 0, False: 10.2k]
  ------------------
 1030|      0|            {
 1031|      0|                inchi_ios_eprint(pLog, "\nWrong command line options: expected Inch2Struct or Inchi2Inchi\n", num_inp);
 1032|      0|                break;
 1033|      0|            }
 1034|       |
 1035|       |            /* InChI --> Structure */
 1036|  10.2k|            if (bInChI2Structure)
  ------------------
  |  Branch (1036:17): [True: 5.18k, False: 5.02k]
  ------------------
 1037|  5.18k|            {
 1038|  5.18k|                char* result_string;
 1039|       |
 1040|  5.18k|                if (OneInput.polymer && OneInput.polymer->n)
  ------------------
  |  Branch (1040:21): [True: 175, False: 5.01k]
  |  Branch (1040:41): [True: 175, False: 0]
  ------------------
 1041|    175|                {
 1042|    175|                    OneInput.valid_polymer = 1;
 1043|    175|                }
 1044|       |
 1045|  5.18k|                ret = ConvertInChI2Struct(ip_inp, ip, &OneInput,
 1046|  5.18k|                    at, num_at,
 1047|  5.18k|                    polymer, v3000,
 1048|  5.18k|                    pRealOut, pLog,
 1049|  5.18k|                    sd, num_components, nModeProtonIsoExchgH,
 1050|  5.18k|                    &szCurHdr, szMsg, nMsgLen, szMessage,
 1051|  5.18k|                    nInitLenMessage, nMessageLen,
 1052|  5.18k|                    input_is_stdinchi, bHasSomeReconnected,
 1053|  5.18k|                    bHasSomeFixedH, bHasMetal,
 1054|  5.18k|                    nModeFlagsStereo, bTautFlags, bReqNonTaut,
 1055|  5.18k|                    WarningFlags, num_inp, &num_errors,
 1056|  5.18k|                    save_opt_bits, &ulTStart, &ulProcessingTime,
 1057|  5.18k|                    ic, pCG);
 1058|       |
 1059|  5.18k|                result_string = pRealOut->s.pStr;
 1060|  5.18k|                if (ret == 0)        /* no problems */
  ------------------
  |  Branch (1060:21): [True: 1.75k, False: 3.43k]
  ------------------
 1061|  1.75k|                {
 1062|  1.75k|                    ;
 1063|  1.75k|                }
 1064|  3.43k|                else if (ret > 0)
  ------------------
  |  Branch (1064:26): [True: 0, False: 3.43k]
  ------------------
 1065|      0|                {
 1066|       |                    /* error */
 1067|      0|                    if (output_error_inchi)
  ------------------
  |  Branch (1067:25): [True: 0, False: 0]
  ------------------
 1068|      0|                    {
 1069|       |                        /* emit error string */
 1070|      0|                        inchi_ios_eprint(pRealOut, "InChI creation Error!\n");
 1071|      0|                    }
 1072|      0|                }
 1073|  3.43k|                else if (ret < 0)
  ------------------
  |  Branch (1073:26): [True: 3.43k, False: 0]
  ------------------
 1074|  3.43k|                {
 1075|       |                    /* error or a mismatch possibly treated as error */
 1076|  3.43k|                    if (ret != RI_ERR_MISMATCH)
  ------------------
  |  |   21|  3.43k|#define RI_ERR_MISMATCH (-9)
  ------------------
  |  Branch (1076:25): [True: 3.43k, False: 0]
  ------------------
 1077|  3.43k|                    {
 1078|  3.43k|                        goto exit_error;
 1079|  3.43k|                    }
 1080|      0|                    else
 1081|      0|                    {
 1082|      0|                        if (!treat_mismatch_as_error)
  ------------------
  |  Branch (1082:29): [True: 0, False: 0]
  ------------------
 1083|      0|                        {
 1084|       |                            /* ignore mismatch, print InChI as usual */
 1085|      0|                            if (result_string)
  ------------------
  |  Branch (1085:33): [True: 0, False: 0]
  ------------------
 1086|      0|                            {
 1087|      0|                                inchi_ios_eprint(pRealOut, "%-s\n", result_string);
 1088|      0|                            }
 1089|      0|                        }
 1090|      0|                        else
 1091|      0|                        {
 1092|       |                            /* concider mismatch an error */
 1093|      0|                            if (!output_error_inchi)
  ------------------
  |  Branch (1093:33): [True: 0, False: 0]
  ------------------
 1094|      0|                            {
 1095|      0|                                ;    /* print nothing for now*/
 1096|      0|                            }
 1097|      0|                            else
 1098|      0|                            {
 1099|       |                                /* emit err string instead of InChI */
 1100|      0|                                if (result_string)
  ------------------
  |  Branch (1100:37): [True: 0, False: 0]
  ------------------
 1101|      0|                                {
 1102|       |                                    /* try to preserve header if any */
 1103|      0|                                    char* pi = strstr(result_string, "InChI=");
 1104|      0|                                    if (pi)
  ------------------
  |  Branch (1104:41): [True: 0, False: 0]
  ------------------
 1105|      0|                                    {
 1106|      0|                                        int np = pi - result_string;
 1107|      0|                                        if (np)
  ------------------
  |  Branch (1107:45): [True: 0, False: 0]
  ------------------
 1108|      0|                                            result_string[np - 1] = '\0';
 1109|      0|                                        inchi_ios_eprint(pRealOut, "%-s\n", result_string);
 1110|      0|                                    }
 1111|      0|                                }
 1112|      0|                                inchi_ios_eprint(pRealOut, "InChICreationError!\n"); /* emit err string  */
 1113|      0|                            }
 1114|      0|                        }
 1115|      0|                        FreeInpInChI(&OneInput);
 1116|      0|                        if (strHdr)
  ------------------
  |  Branch (1116:29): [True: 0, False: 0]
  ------------------
 1117|      0|                        {
 1118|      0|                            inchi_free(strHdr);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1119|      0|                            strHdr = NULL;
 1120|      0|                        }
 1121|      0|                        if (szCurHdr)
  ------------------
  |  Branch (1121:29): [True: 0, False: 0]
  ------------------
 1122|      0|                        {
 1123|      0|                            inchi_free(szCurHdr);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1124|      0|                            szCurHdr = NULL;
 1125|      0|                        }
 1126|      0|                        INCHI_HEAPCHK
 1127|      0|                            continue;
 1128|      0|                    }
 1129|  3.43k|                }
 1130|  5.18k|            }    /* ( bInChI2Structure )  */
 1131|       |
 1132|       |
 1133|       |            /* InChI --> InChI */
 1134|  5.02k|            else if (bInChI2InChI)
  ------------------
  |  Branch (1134:22): [True: 5.02k, False: 0]
  ------------------
 1135|  5.02k|            {
 1136|  5.02k|                ret = ConvertInChI2InChI(ip, &OneInput, pRealOut, pLog, sd,
 1137|  5.02k|                    num_components, nModeProtonIsoExchgH,
 1138|  5.02k|                    &szCurHdr, num_inp, &num_errors,
 1139|  5.02k|                    save_opt_bits, &ulTStart,
 1140|  5.02k|                    &ulProcessingTime, ic, pCG);
 1141|  5.02k|            }
 1142|       |
 1143|  6.78k|            if (nReadStatus == RI_ERR_EOF)
  ------------------
  |  |   19|  6.78k|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (1143:17): [True: 6.08k, False: 700]
  ------------------
 1144|       |#if ( FIX_ONE_LINE_INCHI_INPUT_CONVERSION_ISSUE==1 && defined(TARGET_EXE_STANDALONE) && !defined(TARGET_API_LIB) )
 1145|       |            {
 1146|       |                inchi_ios_flush(pRealOut);
 1147|       |                inchi_ios_flush2(pLog, stderr);
 1148|       |                break;
 1149|       |            }
 1150|       |#else
 1151|  6.08k|                break;
 1152|  6.78k|#endif
 1153|  6.78k|        } /* InChI has been successfully read */
 1154|       |
 1155|       |
 1156|       |#ifdef TARGET_EXE_STANDALONE
 1157|       |#ifndef TARGET_API_LIB
 1158|       |        inchi_ios_flush(pRealOut);
 1159|       |        inchi_ios_flush2(pLog, stderr);
 1160|       |#endif
 1161|       |#endif
 1162|  3.04k|#ifdef TARGET_API_LIB
 1163|  3.04k|        break;  /* exit after the 1st structure */
 1164|  12.5k|#endif
 1165|  12.5k|    } /* while */
 1166|       |
 1167|  12.5k|exit_error:
 1168|  12.5k|    FreeInpInChI(&OneInput);
 1169|  12.5k|    if (strHdr)
  ------------------
  |  Branch (1169:9): [True: 0, False: 12.5k]
  ------------------
 1170|      0|    {
 1171|      0|        inchi_free(strHdr);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1172|      0|        strHdr = NULL;
 1173|      0|    }
 1174|  12.5k|    if (pLine->str)
  ------------------
  |  Branch (1174:9): [True: 12.5k, False: 0]
  ------------------
 1175|  12.5k|    {
 1176|  12.5k|        inchi_free(pLine->str);
  ------------------
  |  | 1152|  12.5k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 12.5k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 12.5k]
  |  |  ------------------
  ------------------
 1177|  12.5k|    }
 1178|  12.5k|    if (szCurHdr)
  ------------------
  |  Branch (1178:9): [True: 0, False: 12.5k]
  ------------------
 1179|      0|    {
 1180|      0|        inchi_free(szCurHdr);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1181|      0|        szCurHdr = NULL;
 1182|      0|    }
 1183|       |
 1184|       |    INCHI_HEAPCHK
 1185|       |
 1186|  12.5k|        if (sd_inp)
  ------------------
  |  Branch (1186:13): [True: 12.5k, False: 0]
  ------------------
 1187|  12.5k|        {
 1188|  12.5k|            sd_inp->ulStructTime = ulProcessingTime;
 1189|  12.5k|            sd_inp->fPtrStart = num_processed;
 1190|  12.5k|            sd_inp->fPtrEnd = num_errors;
 1191|  12.5k|        }
 1192|  12.5k|    if (pRealOut == pTmpOut)
  ------------------
  |  Branch (1192:9): [True: 0, False: 12.5k]
  ------------------
 1193|      0|    {
 1194|      0|        inchi_ios_close(pTmpOut);
 1195|      0|    }
 1196|       |
 1197|  12.5k|    return ret;
 1198|  12.5k|}
GetNumNeighborsFromInchi:
 1636|    229|{
 1637|    229|    int i, j, n_vertex, n_neigh, nNumNeigh, bTautAtom, nNumH, nTotNumNeigh, num_atoms;
 1638|    229|    AT_NUMB  taut_at_number;
 1639|    229|    nAtNumber -= 1;
 1640|    229|    nNumNeigh = 0; /* number of bonds */
 1641|    229|    bTautAtom = 0; /* 1 if atom belongs to a Mobile-H group */
 1642|    229|    nNumH = 0; /* number of terminal neighbors H */
 1643|    229|    num_atoms = 0; /* djb-rwth: initialisation with pInChI below */
 1644|       |
 1645|    229|    if (pInChI) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (1645:9): [True: 229, False: 0]
  ------------------
 1646|    229|    {
 1647|    229|        num_atoms = pInChI->nNumberOfAtoms;
 1648|       |        /* from RestoreAtomConnectionsSetStereo() */
 1649|       |        /* Connection table structure:
 1650|       |        Vert(1) [, Neigh(11), Neigh(12),...], Vert(2) [, Neigh(2,1), Neigh(2,2),...] ...
 1651|       |        where Neigh(i,1) < Neigh(i,2) <... < Vert(i);
 1652|       |        Vert(i) < Vert(i+1)
 1653|       |        */
 1654|  2.64k|        for (i = 1, n_vertex = pInChI->nConnTable[0] - 1; i < pInChI->lenConnTable; i++)
  ------------------
  |  Branch (1654:59): [True: 2.41k, False: 229]
  ------------------
 1655|  2.41k|        {
 1656|  2.41k|            if ((n_neigh = pInChI->nConnTable[i] - 1) < n_vertex)
  ------------------
  |  Branch (1656:17): [True: 1.52k, False: 882]
  ------------------
 1657|  1.52k|            {
 1658|       |                /*  vertex - neighbor connection */
 1659|  1.52k|                nNumNeigh += (nAtNumber == n_vertex || nAtNumber == n_neigh);
  ------------------
  |  Branch (1659:31): [True: 244, False: 1.28k]
  |  Branch (1659:56): [True: 415, False: 870]
  ------------------
 1660|  1.52k|            }
 1661|    882|            else
 1662|    882|            {/* n_neigh is the next vertex */
 1663|    882|                if ((n_vertex = n_neigh) >= num_atoms)
  ------------------
  |  Branch (1663:21): [True: 0, False: 882]
  ------------------
 1664|      0|                {
 1665|      0|                    return  RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1666|      0|                }
 1667|    882|            }
 1668|  2.41k|        }
 1669|    229|    }
 1670|       |
 1671|       |
 1672|       |    /* is atom tautomeric, from GetTgroupInfoFromInChI() */
 1673|    229|    if (pInChI && pInChI->lenTautomer > 1 && pInChI->nTautomer && pInChI->nTautomer[0] > 0)
  ------------------
  |  Branch (1673:9): [True: 229, False: 0]
  |  Branch (1673:19): [True: 13, False: 216]
  |  Branch (1673:46): [True: 13, False: 0]
  |  Branch (1673:67): [True: 13, False: 0]
  ------------------
 1674|     13|    {
 1675|     13|        int itg, len_tg;
 1676|     13|        int tot_len_tg = pInChI->lenTautomer - T_GROUP_HDR_LEN * pInChI->nTautomer[0] - 1; /* number of endpoints */
  ------------------
  |  |   72|     13|#define           T_GROUP_HDR_LEN   (1+T_NUM_NO_ISOTOPIC /*+T_NUM_ISOTOPIC*/) /* LinearCTTautomer */
  |  |  ------------------
  |  |  |  |   69|     13|#define           T_NUM_NO_ISOTOPIC 2
  |  |  ------------------
  ------------------
 1677|     13|        j = 1; /* index in pInChI->nTautomer[] */
 1678|     13|        i = 0; /* index in ti->nEndpointAtomNumber[] */
 1679|     47|        for (itg = 0; itg < pInChI->nTautomer[0]; itg++)
  ------------------
  |  Branch (1679:23): [True: 34, False: 13]
  ------------------
 1680|     34|        {
 1681|     34|            len_tg = pInChI->nTautomer[j]; /* t-group length not including pInChI->nTautomer[j] */
 1682|     34|            j += T_GROUP_HDR_LEN;   /* skip t-group header */
  ------------------
  |  |   72|     34|#define           T_GROUP_HDR_LEN   (1+T_NUM_NO_ISOTOPIC /*+T_NUM_ISOTOPIC*/) /* LinearCTTautomer */
  |  |  ------------------
  |  |  |  |   69|     34|#define           T_NUM_NO_ISOTOPIC 2
  |  |  ------------------
  ------------------
 1683|     34|            len_tg -= T_GROUP_HDR_LEN - 1;
  ------------------
  |  |   72|     34|#define           T_GROUP_HDR_LEN   (1+T_NUM_NO_ISOTOPIC /*+T_NUM_ISOTOPIC*/) /* LinearCTTautomer */
  |  |  ------------------
  |  |  |  |   69|     34|#define           T_NUM_NO_ISOTOPIC 2
  |  |  ------------------
  ------------------
 1684|     71|            for (; 0 < len_tg--; j++, i++)
  ------------------
  |  Branch (1684:20): [True: 37, False: 34]
  ------------------
 1685|     37|            {
 1686|     37|                taut_at_number = pInChI->nTautomer[j] - 1; /* Mobile-H group atom number */
 1687|     37|                bTautAtom += (taut_at_number == nAtNumber);
 1688|     37|            }
 1689|     34|        }
 1690|     13|        if (i != tot_len_tg)
  ------------------
  |  Branch (1690:13): [True: 0, False: 13]
  ------------------
 1691|      0|        {
 1692|      0|            return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1693|      0|        }
 1694|     13|    }
 1695|       |    /* count hydrogen neighbors */
 1696|    229|    if (pInChI && pInChI->nNum_H) /* djb-rwth: condition added for fixing a NULL pointer dereference */
  ------------------
  |  Branch (1696:9): [True: 229, False: 0]
  |  Branch (1696:19): [True: 229, False: 0]
  ------------------
 1697|    229|    {
 1698|    229|        nNumH = pInChI->nNum_H[nAtNumber];
 1699|    229|    }
 1700|       |    /* conclusion: if not tautomeric then return positive number, otherwise add 1000 */
 1701|    229|    nTotNumNeigh = nNumNeigh + nNumH;
 1702|    229|    if (bTautAtom)
  ------------------
  |  Branch (1702:9): [True: 5, False: 224]
  ------------------
 1703|      5|    {
 1704|      5|        nTotNumNeigh += 1000;
 1705|      5|    }
 1706|    229|    return nTotNumNeigh;
 1707|       |
 1708|    229|}
CountStereoTypes:
 1719|   180k|{
 1720|   180k|    INChI_Stereo* Stereo;
 1721|   180k|    int           i, ret;
 1722|   180k|    AT_NUMB       nAtNumber;
 1723|   180k|    U_CHAR        el_number;
 1724|       |
 1725|   180k|    if (!pInChI->nNumberOfAtoms || pInChI->bDeleted)
  ------------------
  |  Branch (1725:9): [True: 30.3k, False: 150k]
  |  Branch (1725:36): [True: 3.92k, False: 146k]
  ------------------
 1726|  34.2k|    {
 1727|  34.2k|        return 0; /* no InChI */
 1728|  34.2k|    }
 1729|   146k|    Stereo = (pInChI->StereoIsotopic &&
  ------------------
  |  Branch (1729:15): [True: 616, False: 146k]
  ------------------
 1730|    616|        (pInChI->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (1730:9): [True: 252, False: 364]
  ------------------
 1731|    616|            pInChI->StereoIsotopic->nNumberOfStereoCenters)) ? pInChI->StereoIsotopic :
 1732|   146k|        (pInChI->Stereo &&
  ------------------
  |  Branch (1732:10): [True: 12.2k, False: 134k]
  ------------------
 1733|  12.2k|            (pInChI->Stereo->nNumberOfStereoBonds +
  ------------------
  |  Branch (1733:13): [True: 874, False: 11.3k]
  ------------------
 1734|   146k|                pInChI->Stereo->nNumberOfStereoCenters)) ? pInChI->Stereo : NULL;
 1735|   146k|    if (!Stereo)
  ------------------
  |  Branch (1735:9): [True: 145k, False: 1.12k]
  ------------------
 1736|   145k|    {
 1737|   145k|        return 1; /* No Stereo */
 1738|   145k|    }
 1739|       |
 1740|       |    /* count SB and cumulenes */
 1741|  1.92k|    for (i = 0; i < Stereo->nNumberOfStereoBonds; i++)
  ------------------
  |  Branch (1741:17): [True: 794, False: 1.12k]
  ------------------
 1742|    794|    {
 1743|    794|        if (ATOM_PARITY_WELL_DEF(Stereo->b_parity[i]))
  ------------------
  |  |  259|    794|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    794|#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)
  |  |  ------------------
  |  |  |  |  236|    794|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 794, False: 0]
  |  |  |  Branch (259:75): [True: 551, False: 243]
  |  |  ------------------
  ------------------
 1744|    551|        {
 1745|    551|            (*num_known_SB)++;
 1746|    551|        }
 1747|    243|        else
 1748|    243|        {
 1749|    243|            (*num_unk_und_SB)++;
 1750|    243|        }
 1751|    794|    }
 1752|       |    /* count SC and allenes */
 1753|  1.96k|    for (i = 0; i < Stereo->nNumberOfStereoCenters; i++)
  ------------------
  |  Branch (1753:17): [True: 840, False: 1.12k]
  ------------------
 1754|    840|    {
 1755|    840|        if (!(nAtNumber = Stereo->nNumber[i]) || nAtNumber > pInChI->nNumberOfAtoms)
  ------------------
  |  Branch (1755:13): [True: 0, False: 840]
  |  Branch (1755:50): [True: 0, False: 840]
  ------------------
 1756|      0|        {
 1757|      0|            return RI_ERR_PROGR; /* wrong data, should never happen */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1758|      0|        }
 1759|    840|        if (ATOM_PARITY_WELL_DEF(Stereo->t_parity[i]))
  ------------------
  |  |  259|    840|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    840|#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)
  |  |  ------------------
  |  |  |  |  236|    840|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 840, False: 0]
  |  |  |  Branch (259:75): [True: 683, False: 157]
  |  |  ------------------
  ------------------
 1760|    683|        {
 1761|    683|            (*num_known_SC)++;
 1762|    683|        }
 1763|    157|        else
 1764|    157|        {
 1765|    157|            (*num_unk_und_SC)++;
 1766|    157|        }
 1767|    840|        el_number = pInChI->nAtom[nAtNumber - 1];
 1768|    840|        if (el_number != EL_NUMBER_P && el_number != EL_NUMBER_AS)
  ------------------
  |  |   18|  1.68k|#define EL_NUMBER_P  ((U_CHAR)15)
  ------------------
                      if (el_number != EL_NUMBER_P && el_number != EL_NUMBER_AS)
  ------------------
  |  |   22|    618|#define EL_NUMBER_AS ((U_CHAR)33)
  ------------------
  |  Branch (1768:13): [True: 618, False: 222]
  |  Branch (1768:41): [True: 611, False: 7]
  ------------------
 1769|    611|        {
 1770|    611|            continue;
 1771|    611|        }
 1772|    229|        ret = GetNumNeighborsFromInchi(pInChI, nAtNumber);
 1773|    229|        if (ret < 0)
  ------------------
  |  Branch (1773:13): [True: 0, False: 229]
  ------------------
 1774|      0|        {
 1775|      0|            return ret;
 1776|      0|        }
 1777|    229|        if (3 == ret)
  ------------------
  |  Branch (1777:13): [True: 118, False: 111]
  ------------------
 1778|    118|        {
 1779|    118|            *num_SC_PIII += (EL_NUMBER_P == el_number);
  ------------------
  |  |   18|    118|#define EL_NUMBER_P  ((U_CHAR)15)
  ------------------
 1780|    118|            *num_SC_AsIII += (EL_NUMBER_AS == el_number);
  ------------------
  |  |   22|    118|#define EL_NUMBER_AS ((U_CHAR)33)
  ------------------
 1781|    118|        }
 1782|    229|    }
 1783|       |
 1784|  1.12k|    return 2; /* Has Stereo */
 1785|  1.12k|}
bInpInchiComponentExists:
 1793|  34.1k|{
 1794|  34.1k|    if ((INCHI_BAS != iInChI && iInChI != INCHI_REC) ||
  ------------------
  |  |  570|  34.1k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                  if ((INCHI_BAS != iInChI && iInChI != INCHI_REC) ||
  ------------------
  |  |  571|     32|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1794:10): [True: 32, False: 34.0k]
  |  Branch (1794:33): [True: 0, False: 32]
  ------------------
 1795|  34.1k|        (TAUT_NON != bMobileH && TAUT_YES != bMobileH) || k < 0) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |  574|  34.1k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      (TAUT_NON != bMobileH && TAUT_YES != bMobileH) || k < 0) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |  575|  34.1k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1795:10): [True: 34.1k, False: 12]
  |  Branch (1795:34): [True: 0, False: 34.1k]
  |  Branch (1795:59): [True: 0, False: 34.1k]
  ------------------
 1796|      0|    {
 1797|      0|        return 0;
 1798|      0|    }
 1799|       |
 1800|  34.1k|    return (k < pOneInput->nNumComponents[iInChI][bMobileH] &&
  ------------------
  |  Branch (1800:13): [True: 34.1k, False: 0]
  ------------------
 1801|  34.1k|        pOneInput->pInpInChI[iInChI][bMobileH] &&
  ------------------
  |  Branch (1801:9): [True: 34.1k, False: 0]
  ------------------
 1802|  34.1k|        pOneInput->pInpInChI[iInChI][bMobileH][k].nNumberOfAtoms > 0 &&
  ------------------
  |  Branch (1802:9): [True: 34.1k, False: 2]
  ------------------
 1803|  34.1k|        !pOneInput->pInpInChI[iInChI][bMobileH][k].bDeleted);
  ------------------
  |  Branch (1803:9): [True: 32.6k, False: 1.51k]
  ------------------
 1804|  34.1k|}
bInpInchiComponentDeleted:
 1812|      3|{
 1813|      3|    if ((INCHI_BAS != iInChI && iInChI != INCHI_REC) ||
  ------------------
  |  |  570|      3|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                  if ((INCHI_BAS != iInChI && iInChI != INCHI_REC) ||
  ------------------
  |  |  571|      3|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1813:10): [True: 3, False: 0]
  |  Branch (1813:33): [True: 0, False: 3]
  ------------------
 1814|      3|        (TAUT_NON != bMobileH && TAUT_YES != bMobileH) || k < 0) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |  574|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      (TAUT_NON != bMobileH && TAUT_YES != bMobileH) || k < 0) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |  575|      3|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1814:10): [True: 3, False: 0]
  |  Branch (1814:34): [True: 0, False: 3]
  |  Branch (1814:59): [True: 0, False: 3]
  ------------------
 1815|      0|    {
 1816|      0|        return 0;
 1817|      0|    }
 1818|       |
 1819|      3|    return (k < pOneInput->nNumComponents[iInChI][bMobileH] &&
  ------------------
  |  Branch (1819:13): [True: 3, False: 0]
  ------------------
 1820|      3|        pOneInput->pInpInChI[iInChI][bMobileH] &&
  ------------------
  |  Branch (1820:9): [True: 3, False: 0]
  ------------------
 1821|      3|        pOneInput->pInpInChI[iInChI][bMobileH][k].nNumberOfAtoms > 0 &&
  ------------------
  |  Branch (1821:9): [True: 3, False: 0]
  ------------------
 1822|      3|        pOneInput->pInpInChI[iInChI][bMobileH][k].bDeleted);
  ------------------
  |  Branch (1822:9): [True: 3, False: 0]
  ------------------
 1823|      3|}
bRevInchiComponentExists:
 1831|   142k|{
 1832|   142k|    if (!pStruct || /*!pStruct->at2 ||*/ !pStruct->num_atoms ||
  ------------------
  |  Branch (1832:9): [True: 0, False: 142k]
  |  Branch (1832:42): [True: 0, False: 142k]
  ------------------
 1833|   142k|        (INCHI_BAS != iInChI && iInChI != INCHI_REC) ||
  ------------------
  |  |  570|   142k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      (INCHI_BAS != iInChI && iInChI != INCHI_REC) ||
  ------------------
  |  |  571|  71.6k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1833:10): [True: 71.6k, False: 70.4k]
  |  Branch (1833:33): [True: 0, False: 71.6k]
  ------------------
 1834|   142k|        (TAUT_NON != bMobileH && TAUT_YES != bMobileH) || k < 0) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |  574|   142k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      (TAUT_NON != bMobileH && TAUT_YES != bMobileH) || k < 0) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |  575|   142k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1834:10): [True: 142k, False: 7]
  |  Branch (1834:34): [True: 0, False: 142k]
  |  Branch (1834:59): [True: 0, False: 142k]
  ------------------
 1835|      0|    {
 1836|      0|        return 0;
 1837|      0|    }
 1838|       |
 1839|   142k|    return (k < pStruct->RevInChI.num_components[iInChI] &&
  ------------------
  |  Branch (1839:13): [True: 70.4k, False: 71.6k]
  ------------------
 1840|  70.4k|        pStruct->RevInChI.pINChI[iInChI] &&
  ------------------
  |  Branch (1840:9): [True: 70.4k, False: 0]
  ------------------
 1841|  70.4k|        pStruct->RevInChI.pINChI[iInChI][k][bMobileH] &&
  ------------------
  |  Branch (1841:9): [True: 70.4k, False: 0]
  ------------------
 1842|  70.4k|        pStruct->RevInChI.pINChI[iInChI][k][bMobileH]->nNumberOfAtoms > 0 &&
  ------------------
  |  Branch (1842:9): [True: 70.4k, False: 7]
  ------------------
 1843|  70.4k|        !pStruct->RevInChI.pINChI[iInChI][k][bMobileH]->bDeleted);
  ------------------
  |  Branch (1843:9): [True: 70.2k, False: 156]
  ------------------
 1844|   142k|}
bRevInchiComponentDeleted:
 1852|      1|{
 1853|      1|    if (!pStruct || /*!pStruct->at2 ||*/ !pStruct->num_atoms ||
  ------------------
  |  Branch (1853:9): [True: 0, False: 1]
  |  Branch (1853:42): [True: 0, False: 1]
  ------------------
 1854|      1|        (INCHI_BAS != iInChI && iInChI != INCHI_REC) ||
  ------------------
  |  |  570|      1|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      (INCHI_BAS != iInChI && iInChI != INCHI_REC) ||
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1854:10): [True: 0, False: 1]
  |  Branch (1854:33): [True: 0, False: 0]
  ------------------
 1855|      1|        (TAUT_NON != bMobileH && TAUT_YES != bMobileH) || k < 0) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |  574|      1|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      (TAUT_NON != bMobileH && TAUT_YES != bMobileH) || k < 0) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |  575|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1855:10): [True: 1, False: 0]
  |  Branch (1855:34): [True: 0, False: 1]
  |  Branch (1855:59): [True: 0, False: 1]
  ------------------
 1856|      0|    {
 1857|      0|        return 0;
 1858|      0|    }
 1859|       |
 1860|      1|    return (k < pStruct->RevInChI.num_components[iInChI] &&
  ------------------
  |  Branch (1860:13): [True: 1, False: 0]
  ------------------
 1861|      1|        pStruct->RevInChI.pINChI[iInChI] &&
  ------------------
  |  Branch (1861:9): [True: 1, False: 0]
  ------------------
 1862|      1|        pStruct->RevInChI.pINChI[iInChI][k][bMobileH] &&
  ------------------
  |  Branch (1862:9): [True: 1, False: 0]
  ------------------
 1863|      1|        pStruct->RevInChI.pINChI[iInChI][k][bMobileH]->nNumberOfAtoms > 0 &&
  ------------------
  |  Branch (1863:9): [True: 1, False: 0]
  ------------------
 1864|      1|        pStruct->RevInChI.pINChI[iInChI][k][bMobileH]->bDeleted);
  ------------------
  |  Branch (1864:9): [True: 1, False: 0]
  ------------------
 1865|      1|}
DetectInpInchiCreationOptions:
 1875|  5.18k|{
 1876|  5.18k|    int ret = 0, bHasStereo;
 1877|  5.18k|    int nModeFlagsValue = 0, bTautFlagsValue; /* stereo flags */
 1878|  5.18k|    int iInChI, iMobileH, bIso, k, max_components, num_components;
 1879|  5.18k|    INChI* pInChI;
 1880|  5.18k|    int num_known_SB /*Stereo Bonds & Cumulenes >C==C==C==C< */;
 1881|  5.18k|    int num_known_SC /* Stereo Centers & Allenes >C=C=C< */;
 1882|  5.18k|    int num_unk_und_SB, num_unk_und_SC;
 1883|  5.18k|    int num_SC_PIII, num_SC_AsIII; /* has Phosphine or Arsine stereo center(s) */
 1884|       |
 1885|  5.18k|    *bHasReconnected = *bHasFixedH = *nModeFlagsStereo = *bTautFlagsStereo = 0;
 1886|  5.18k|    nModeFlagsValue = bTautFlagsValue = bHasStereo = 0;
 1887|  5.18k|    num_known_SB = num_known_SC = num_unk_und_SB = num_unk_und_SC = num_SC_PIII = num_SC_AsIII = 0;
 1888|  5.18k|    *bHasMetal = 0;
 1889|       |
 1890|  15.5k|    for (iInChI = 0; iInChI < INCHI_NUM; iInChI++)
  ------------------
  |  |  569|  15.5k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1890:22): [True: 10.3k, False: 5.18k]
  ------------------
 1891|  10.3k|    {
 1892|  31.1k|        for (iMobileH = 0; iMobileH < TAUT_NUM; iMobileH++)
  ------------------
  |  |  573|  31.1k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1892:28): [True: 20.7k, False: 10.3k]
  ------------------
 1893|  20.7k|        {
 1894|  61.9k|            for (bIso = 1; !nModeFlagsValue && 0 <= bIso; bIso--)
  ------------------
  |  Branch (1894:28): [True: 61.7k, False: 204]
  |  Branch (1894:48): [True: 41.2k, False: 20.5k]
  ------------------
 1895|  41.2k|            {
 1896|  41.2k|                switch (pOneInput->s[iInChI][iMobileH][bIso])
  ------------------
  |  Branch (1896:25): [True: 63, False: 41.1k]
  ------------------
 1897|  41.2k|                {
 1898|      7|                case 1: /* SABS */
  ------------------
  |  Branch (1898:17): [True: 7, False: 41.1k]
  ------------------
 1899|      7|                    nModeFlagsValue |= REQ_MODE_STEREO | REQ_MODE_ISO_STEREO;
  ------------------
  |  |   19|      7|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                                  nModeFlagsValue |= REQ_MODE_STEREO | REQ_MODE_ISO_STEREO;
  ------------------
  |  |   20|      7|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
 1900|      7|                    break;
 1901|     39|                case 2:
  ------------------
  |  Branch (1901:17): [True: 39, False: 41.1k]
  ------------------
 1902|     39|                    nModeFlagsValue |= REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_RELATIVE_STEREO;
  ------------------
  |  |   19|     39|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                                  nModeFlagsValue |= REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_RELATIVE_STEREO;
  ------------------
  |  |   20|     39|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
                                  nModeFlagsValue |= REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_RELATIVE_STEREO;
  ------------------
  |  |   26|     39|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
 1903|     39|                    break;
 1904|     17|                case 3:
  ------------------
  |  Branch (1904:17): [True: 17, False: 41.1k]
  ------------------
 1905|     17|                    nModeFlagsValue |= REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_RACEMIC_STEREO;
  ------------------
  |  |   19|     17|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                                  nModeFlagsValue |= REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_RACEMIC_STEREO;
  ------------------
  |  |   20|     17|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
                                  nModeFlagsValue |= REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_RACEMIC_STEREO;
  ------------------
  |  |   28|     17|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
 1906|  41.2k|                }
 1907|  41.2k|            }
 1908|       |
 1909|  20.7k|            max_components = pOneInput->pInpInChI[iInChI][iMobileH] ?
  ------------------
  |  Branch (1909:30): [True: 6.50k, False: 14.2k]
  ------------------
 1910|  14.2k|                pOneInput->nNumComponents[iInChI][iMobileH] : 0;
 1911|       |
 1912|   201k|            for (k = num_components = 0; k < max_components; k++)
  ------------------
  |  Branch (1912:42): [True: 180k, False: 20.7k]
  ------------------
 1913|   180k|            {
 1914|   180k|                pInChI = pOneInput->pInpInChI[iInChI][iMobileH] + k;
 1915|   180k|                ret = CountStereoTypes(pInChI,
 1916|   180k|                    &num_known_SB, &num_known_SC,
 1917|   180k|                    &num_unk_und_SB, &num_unk_und_SC,
 1918|   180k|                    &num_SC_PIII, &num_SC_AsIII);
 1919|   180k|                if (ret < 0)
  ------------------
  |  Branch (1919:21): [True: 0, False: 180k]
  ------------------
 1920|      0|                {
 1921|      0|                    return ret; /* error */
 1922|      0|                }
 1923|   180k|                bHasStereo += (ret == 2);
 1924|   180k|                if ((ret > 0))
  ------------------
  |  Branch (1924:21): [True: 146k, False: 34.2k]
  ------------------
 1925|   146k|                {
 1926|       |                    /* ret == 0 => Empty InChI, 1=> No Stereo, 2=> Has Stereo */
 1927|   146k|                    num_components++;
 1928|   146k|                    *bHasReconnected |= (iInChI == INCHI_REC);
  ------------------
  |  |  571|   146k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1929|   146k|                    *bHasFixedH |= (iMobileH == TAUT_NON);
  ------------------
  |  |  574|   146k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1930|   146k|                }
 1931|   180k|                *bHasMetal |= bInChIHasReconnectedMetal(pInChI);
 1932|   180k|            }
 1933|  20.7k|        }
 1934|  10.3k|    }
 1935|       |
 1936|  5.18k|    if ((nModeFlagsValue & REQ_MODE_RELATIVE_STEREO) && (nModeFlagsValue & REQ_MODE_RACEMIC_STEREO))
  ------------------
  |  |   26|  5.18k|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
                  if ((nModeFlagsValue & REQ_MODE_RELATIVE_STEREO) && (nModeFlagsValue & REQ_MODE_RACEMIC_STEREO))
  ------------------
  |  |   28|     39|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  |  Branch (1936:9): [True: 39, False: 5.15k]
  |  Branch (1936:57): [True: 0, False: 39]
  ------------------
 1937|      0|    {
 1938|      0|        return RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 1939|      0|    }
 1940|  5.18k|    if (bHasStereo && !nModeFlagsValue) /* REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU*/
  ------------------
  |  Branch (1940:9): [True: 961, False: 4.22k]
  |  Branch (1940:23): [True: 912, False: 49]
  ------------------
 1941|    912|    {
 1942|       |        /* inversion does not change the stereo or no stereo at all */
 1943|    912|        nModeFlagsValue = REQ_MODE_STEREO | REQ_MODE_ISO_STEREO; /* Abs */
  ------------------
  |  |   19|    912|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                      nModeFlagsValue = REQ_MODE_STEREO | REQ_MODE_ISO_STEREO; /* Abs */
  ------------------
  |  |   20|    912|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
 1944|    912|    }
 1945|       |
 1946|  5.18k|    if (!num_known_SB && num_unk_und_SB)
  ------------------
  |  Branch (1946:9): [True: 4.82k, False: 365]
  |  Branch (1946:26): [True: 132, False: 4.69k]
  ------------------
 1947|    132|    {
 1948|    132|        ; /* full SUU option or SB part of it */
 1949|    132|    }
 1950|  5.05k|    else
 1951|  5.05k|    {
 1952|  5.05k|        nModeFlagsValue |= REQ_MODE_SB_IGN_ALL_UU; /* ignore Unknown/Undefind SB if no well-defined SB exist */
  ------------------
  |  |   32|  5.05k|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
 1953|  5.05k|    }
 1954|       |
 1955|  5.18k|    if (!num_known_SC && num_unk_und_SC)
  ------------------
  |  Branch (1955:9): [True: 4.77k, False: 410]
  |  Branch (1955:26): [True: 62, False: 4.71k]
  ------------------
 1956|     62|    {
 1957|     62|        ; /* full SUU option or SB part of it */
 1958|     62|    }
 1959|  5.12k|    else
 1960|  5.12k|    {
 1961|  5.12k|        nModeFlagsValue |= REQ_MODE_SC_IGN_ALL_UU; /* ignore Unknown/Undefind SC if no well-defined SB exist */
  ------------------
  |  |   30|  5.12k|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
 1962|  5.12k|    }
 1963|       |    /* Phosphine and Arsine Stereo */
 1964|  5.18k|    if (num_SC_PIII)
  ------------------
  |  Branch (1964:9): [True: 88, False: 5.10k]
  ------------------
 1965|     88|    {
 1966|     88|        bTautFlagsValue |= TG_FLAG_PHOSPHINE_STEREO;
  ------------------
  |  |  941|     88|#define TG_FLAG_PHOSPHINE_STEREO         0x00008000   /* add phosphine sp3 stereo */
  ------------------
 1967|     88|    }
 1968|       |    /* Phosphine and Arsine Stereo */
 1969|  5.18k|    if (num_SC_AsIII)
  ------------------
  |  Branch (1969:9): [True: 2, False: 5.18k]
  ------------------
 1970|      2|    {
 1971|      2|        bTautFlagsValue |= TG_FLAG_ARSINE_STEREO;
  ------------------
  |  |  942|      2|#define TG_FLAG_ARSINE_STEREO            0x00010000   /* add arsine sp3 stereo */
  ------------------
 1972|      2|    }
 1973|       |
 1974|  5.18k|    *nModeFlagsStereo = nModeFlagsValue;
 1975|  5.18k|    *bTautFlagsStereo = bTautFlagsValue;
 1976|       |
 1977|  5.18k|    return 0;
 1978|  5.18k|}
InChILine2Data:
 2348|  12.5k|{
 2349|  12.5k|    int iINChI, i, j, k, m, len1, len2, ret2 = 0, retAux = 0, stateAux = 0; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 2350|  12.5k|    int ret, tot_charge[INCHI_NUM][TAUT_NUM];
 2351|  12.5k|    int i1, i2, i3;
 2352|  12.5k|    int kc;
 2353|  12.5k|    NUM_ELEM* num_elem[INCHI_NUM][TAUT_NUM];
 2354|       |
 2355|       |
 2356|  12.5k|#if ( FIX_I2I_STEREOCONVERSION_BUG == 1 )
 2357|       |    /* (2008-03-06)   1=> Fix bug of i2i conversion SAbs-->(SRel||Srac) */
 2358|       |    /*                    (converter does not placed proper stereo to output) */
 2359|       |
 2360|       |    /* set new stereo type as requested by conversion option */
 2361|  12.5k|    int target_stereo_type = 1;
 2362|  12.5k|    if (nMode & REQ_MODE_RELATIVE_STEREO)
  ------------------
  |  |   26|  12.5k|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
  |  Branch (2362:9): [True: 0, False: 12.5k]
  ------------------
 2363|      0|    {
 2364|      0|        target_stereo_type = 2;
 2365|      0|    }
 2366|  12.5k|    else if (nMode & REQ_MODE_RACEMIC_STEREO)
  ------------------
  |  |   28|  12.5k|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  |  Branch (2366:14): [True: 0, False: 12.5k]
  ------------------
 2367|      0|    {
 2368|      0|        target_stereo_type = 3;
 2369|      0|    }
 2370|  12.5k|#endif
 2371|       |
 2372|  12.5k|    memset(num_elem, 0, sizeof(num_elem)); /* djb-rwth: memset_s C11/Annex K variant? */
 2373|       |
 2374|  12.5k|    ret = ReadInChILine(pInp, pLine, pStr, pState, pInpInChI,
 2375|  12.5k|        nNumComponents, nNumProtons, s, bStdFormat,
 2376|  12.5k|        input_has_save_opt, input_save_opt_bits,
 2377|  12.5k|        bInchi2Struct, ppolymer, pv3000);
 2378|       |
 2379|  12.5k|#if ( FIX_I2I_STEREOCONVERSION_BUG == 1 )
 2380|       |    /* modify stereo type for layers as requested */
 2381|  12.5k|    if (target_stereo_type > 1)
  ------------------
  |  Branch (2381:9): [True: 0, False: 12.5k]
  ------------------
 2382|      0|    {
 2383|      0|        for (i1 = 0; i1 < INCHI_NUM; i1++)
  ------------------
  |  |  569|      0|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (2383:22): [True: 0, False: 0]
  ------------------
 2384|      0|        {
 2385|      0|            for (i2 = 0; i2 < TAUT_NUM; i2++)
  ------------------
  |  |  573|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (2385:26): [True: 0, False: 0]
  ------------------
 2386|      0|            {
 2387|      0|                for (i3 = 0; i3 < 2; i3++)
  ------------------
  |  Branch (2387:30): [True: 0, False: 0]
  ------------------
 2388|      0|                {
 2389|      0|                    if (s[i1][i2][i3] != 0)
  ------------------
  |  Branch (2389:25): [True: 0, False: 0]
  ------------------
 2390|      0|                    {
 2391|      0|                        if (target_stereo_type != 1)
  ------------------
  |  Branch (2391:29): [True: 0, False: 0]
  ------------------
 2392|      0|                        {
 2393|       |                            /* do not allow conversion SRel=>SAbs, SRac=>SAbs */
 2394|      0|                            s[i1][i2][i3] = target_stereo_type;
 2395|      0|                        }
 2396|      0|                    }
 2397|      0|                }
 2398|      0|            }
 2399|      0|        }
 2400|      0|    }
 2401|  12.5k|#endif
 2402|       |
 2403|  12.5k|    * nErr = 0;
 2404|       |
 2405|  12.5k|    if ((ret == RI_ERR_EOL) &&
  ------------------
  |  |   18|  12.5k|#define RI_ERR_EOL     (-4)
  ------------------
  |  Branch (2405:9): [True: 1.03k, False: 11.5k]
  ------------------
 2406|  1.03k|        nNumComponents[INCHI_BAS][TAUT_YES]
  ------------------
  |  |  570|  1.03k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      nNumComponents[INCHI_BAS][TAUT_YES]
  ------------------
  |  |  575|  1.03k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2406:9): [True: 1.00k, False: 31]
  ------------------
 2407|  1.03k|        + nNumComponents[INCHI_BAS][TAUT_NON] && bReadCoord)
  ------------------
  |  |  570|  1.03k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      + nNumComponents[INCHI_BAS][TAUT_NON] && bReadCoord)
  ------------------
  |  |  574|  1.03k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2407:50): [True: 585, False: 417]
  ------------------
 2408|    585|    {
 2409|    585|        retAux = ReadInChICoord(pInp, pLine, &stateAux, pInpInChI, nNumComponents); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 2410|    585|    }
 2411|       |
 2412|  12.5k|    if ((ret == RI_ERR_EOL || ret == RI_ERR_EOF) &&
  ------------------
  |  |   18|  25.1k|#define RI_ERR_EOL     (-4)
  ------------------
                  if ((ret == RI_ERR_EOL || ret == RI_ERR_EOF) &&
  ------------------
  |  |   19|  11.5k|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (2412:10): [True: 1.03k, False: 11.5k]
  |  Branch (2412:31): [True: 9.31k, False: 2.21k]
  ------------------
 2413|  10.3k|        nNumComponents[INCHI_BAS][TAUT_YES]
  ------------------
  |  |  570|  10.3k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      nNumComponents[INCHI_BAS][TAUT_YES]
  ------------------
  |  |  575|  10.3k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2413:9): [True: 10.3k, False: 31]
  ------------------
 2414|  10.3k|        + nNumComponents[INCHI_BAS][TAUT_NON])
  ------------------
  |  |  570|  10.3k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      + nNumComponents[INCHI_BAS][TAUT_NON])
  ------------------
  |  |  574|  10.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 2415|  10.3k|    {
 2416|       |        /* post-processing: add omitted layers */
 2417|  10.3k|        *pState = IST_MATERIAL_BALANCE_ERROR;
 2418|  30.8k|        for (iINChI = 0; iINChI < INCHI_NUM; iINChI++)
  ------------------
  |  |  569|  30.8k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (2418:26): [True: 20.5k, False: 10.2k]
  ------------------
 2419|  20.5k|        {
 2420|  61.6k|            for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  573|  61.6k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (2420:25): [True: 41.1k, False: 20.5k]
  ------------------
 2421|  41.1k|            {
 2422|       |                /* for Mobile/Fixed H (j) ... */
 2423|  41.1k|                int bIsotopic, bStereoType, bStereoTypeAlt;
 2424|  41.1k|                int nMH2FH_AltInv = 0, nFH2iFH_AltInv = 0 /*, niMH2iFH_AltInv=0, nMH2iMH_AltInv=0*/;
 2425|  41.1k|                int jAlt = ALT_TAUT(j);
  ------------------
  |  |  577|  41.1k|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|  41.1k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 41.1k]
  |  |  ------------------
  ------------------
 2426|  41.1k|                INCHI_MODE  nFlags = 0, nFlagsAlt = 0;
 2427|       |                /* get stereo type: ABS, REL, RAC, or nothing */
 2428|  41.1k|                tot_charge[iINChI][j] = 0;
 2429|   123k|                for (bIsotopic = bStereoType = bStereoTypeAlt = 0; bIsotopic < 2; bIsotopic++)
  ------------------
  |  Branch (2429:68): [True: 82.2k, False: 41.1k]
  ------------------
 2430|  82.2k|                {
 2431|  82.2k|                    if (!bStereoType || bStereoType < s[iINChI][j][bIsotopic])
  ------------------
  |  Branch (2431:25): [True: 82.0k, False: 193]
  |  Branch (2431:41): [True: 10, False: 183]
  ------------------
 2432|  82.0k|                    {
 2433|  82.0k|                        bStereoType = s[iINChI][j][bIsotopic];
 2434|  82.0k|                    }
 2435|  82.2k|                    if (!bStereoTypeAlt || bStereoTypeAlt < s[iINChI][jAlt][bIsotopic])
  ------------------
  |  Branch (2435:25): [True: 82.0k, False: 193]
  |  Branch (2435:44): [True: 10, False: 183]
  ------------------
 2436|  82.0k|                    {
 2437|  82.0k|                        bStereoTypeAlt = s[iINChI][jAlt][bIsotopic];
 2438|  82.0k|                    }
 2439|  82.2k|                    nFlags = bStereoType == 2 ? INCHI_FLAG_REL_STEREO : bStereoType == 3 ? INCHI_FLAG_RAC_STEREO : 0;
  ------------------
  |  |  121|    136|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                  nFlags = bStereoType == 2 ? INCHI_FLAG_REL_STEREO : bStereoType == 3 ? INCHI_FLAG_RAC_STEREO : 0;
  ------------------
  |  |  122|     78|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2439:30): [True: 136, False: 82.1k]
  |  Branch (2439:73): [True: 78, False: 82.0k]
  ------------------
 2440|  82.2k|                    nFlagsAlt = bStereoTypeAlt == 2 ? INCHI_FLAG_REL_STEREO : bStereoTypeAlt == 3 ? INCHI_FLAG_RAC_STEREO : 0;
  ------------------
  |  |  121|    136|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                  nFlagsAlt = bStereoTypeAlt == 2 ? INCHI_FLAG_REL_STEREO : bStereoTypeAlt == 3 ? INCHI_FLAG_RAC_STEREO : 0;
  ------------------
  |  |  122|     78|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2440:33): [True: 136, False: 82.1k]
  |  Branch (2440:79): [True: 78, False: 82.0k]
  ------------------
 2441|  82.2k|                }
 2442|       |                /* set stereo type to each component */
 2443|       |                /* add missing nNum_H and nConnTable */
 2444|  41.1k|                if (nNumComponents[iINChI][j])
  ------------------
  |  Branch (2444:21): [True: 13.0k, False: 28.0k]
  ------------------
 2445|  13.0k|                {
 2446|  13.0k|                    num_elem[iINChI][j] = (NUM_ELEM*)inchi_calloc((long long)nElDataLen + 1, sizeof(num_elem[0][0][0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  13.0k|#define inchi_calloc   calloc
  ------------------
 2447|  13.0k|                    if (!num_elem[iINChI][j])
  ------------------
  |  Branch (2447:25): [True: 0, False: 13.0k]
  ------------------
 2448|      0|                    {
 2449|      0|                        ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 2450|      0|                        goto exit_function;
 2451|      0|                    }
 2452|  13.0k|                }
 2453|   318k|                for (k = 0; k < nNumComponents[iINChI][j]; k++)
  ------------------
  |  Branch (2453:29): [True: 277k, False: 41.1k]
  ------------------
 2454|   277k|                {
 2455|       |                    /* for each component k ... */
 2456|   277k|                    if (pInpInChI[iINChI][j])
  ------------------
  |  Branch (2456:25): [True: 277k, False: 0]
  ------------------
 2457|   277k|                    {
 2458|   277k|                        INChI* pInChI = &pInpInChI[iINChI][j][k];
 2459|   277k|                        INChI* pInChI_Alt = (k < nNumComponents[iINChI][jAlt] &&
  ------------------
  |  Branch (2459:46): [True: 66.2k, False: 211k]
  ------------------
 2460|  66.2k|                            pInpInChI[iINChI][jAlt] &&
  ------------------
  |  Branch (2460:29): [True: 66.2k, False: 0]
  ------------------
 2461|       |                            /*pInpInChI[iINChI][jAlt]->nNumberOfAtoms)? pInpInChI[iINChI][jAlt]:NULL;*/ /* 2007-09-25 DT */
 2462|   277k|                            pInpInChI[iINChI][jAlt][k].nNumberOfAtoms) ? &pInpInChI[iINChI][jAlt][k] : NULL;
  ------------------
  |  Branch (2462:29): [True: 66.2k, False: 0]
  ------------------
 2463|   277k|                        if (nFlags)
  ------------------
  |  Branch (2463:29): [True: 333, False: 277k]
  ------------------
 2464|    333|                        {
 2465|    333|                            pInChI->nFlags |= nFlags;
 2466|    333|                        }
 2467|   277k|                        else
 2468|   277k|                        {
 2469|   277k|                            if (j == TAUT_NON && !nFlags && nFlagsAlt)
  ------------------
  |  |  574|   554k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2469:33): [True: 33.7k, False: 243k]
  |  Branch (2469:50): [True: 33.7k, False: 0]
  |  Branch (2469:61): [True: 633, False: 33.1k]
  ------------------
 2470|    633|                            {
 2471|    633|                                pInChI->nFlags |= nFlagsAlt;
 2472|    633|                            }
 2473|   277k|                        }
 2474|       |                        /**** add empty immobile H (nNum_H) if it is missing ****/
 2475|   277k|                        if (!pInChI->nNum_H &&
  ------------------
  |  Branch (2475:29): [True: 68.9k, False: 208k]
  ------------------
 2476|  68.9k|                            !(pInChI->nNum_H = (S_CHAR*)inchi_calloc((long long)pInChI->nNumberOfAtoms + 1, sizeof(pInChI->nNum_H[0])))) /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  68.9k|#define inchi_calloc   calloc
  ------------------
  |  Branch (2476:29): [True: 0, False: 68.9k]
  ------------------
 2477|      0|                        {
 2478|      0|                            ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 2479|      0|                            goto exit_function;
 2480|      0|                        }
 2481|       |                        /**** add single atom nConnTable if it is missing ****/
 2482|   277k|                        if (!pInChI->nConnTable && pInpInChI[iINChI][TAUT_YES]) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  |  575|  50.2k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2482:29): [True: 50.2k, False: 227k]
  |  Branch (2482:52): [True: 50.2k, False: 0]
  ------------------
 2483|  50.2k|                        {
 2484|  50.2k|                            AT_NUMB* pCT;
 2485|  50.2k|                            int      lenCT;
 2486|  50.2k|                            if (j == TAUT_NON && k < nNumComponents[iINChI][TAUT_YES] &&
  ------------------
  |  |  574|   100k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                          if (j == TAUT_NON && k < nNumComponents[iINChI][TAUT_YES] &&
  ------------------
  |  |  575|  33.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2486:33): [True: 33.8k, False: 16.3k]
  |  Branch (2486:50): [True: 33.1k, False: 720]
  ------------------
 2487|  33.1k|                                (pCT = pInpInChI[iINChI][TAUT_YES][k].nConnTable) &&
  ------------------
  |  |  575|  33.1k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2487:33): [True: 33.1k, False: 0]
  ------------------
 2488|  33.1k|                                (lenCT = pInpInChI[iINChI][TAUT_YES][k].lenConnTable) > 0)
  ------------------
  |  |  575|  33.1k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2488:33): [True: 33.1k, False: 0]
  ------------------
 2489|  33.1k|                            {
 2490|  33.1k|                                if (!(pInChI->nConnTable = (AT_NUMB*)inchi_calloc((long long)lenCT + 1, sizeof(pInChI->nConnTable[0])))) /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  33.1k|#define inchi_calloc   calloc
  ------------------
  |  Branch (2490:37): [True: 0, False: 33.1k]
  ------------------
 2491|      0|                                {
 2492|      0|                                    ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 2493|      0|                                    goto exit_function;
 2494|      0|                                }
 2495|  33.1k|                                memcpy(pInChI->nConnTable, pCT, lenCT * sizeof(pInChI->nConnTable[0]));
 2496|  33.1k|                                pInChI->lenConnTable = lenCT;
 2497|  33.1k|                            }
 2498|  17.0k|                            else
 2499|  17.0k|                            {
 2500|  17.0k|                                if (j == TAUT_YES && pInChI->nNumberOfAtoms > 1)
  ------------------
  |  |  575|  34.1k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2500:37): [True: 16.3k, False: 720]
  |  Branch (2500:54): [True: 4, False: 16.3k]
  ------------------
 2501|      4|                                {
 2502|      4|                                    *pState = IST_MOBILE_H_CONNECTIONS + (iINChI == INCHI_REC ? IST_HAPPENED_IN_RECMET : 0);
  ------------------
  |  |  571|      4|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                                                  *pState = IST_MOBILE_H_CONNECTIONS + (iINChI == INCHI_REC ? IST_HAPPENED_IN_RECMET : 0);
  ------------------
  |  |  342|      0|#define IST_HAPPENED_IN_RECMET   100
  ------------------
  |  Branch (2502:75): [True: 0, False: 4]
  ------------------
 2503|      4|                                    ret2 = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      4|#define RI_ERR_SYNTAX  (-2)
  ------------------
 2504|      4|                                    goto exit_function;
 2505|      4|                                }
 2506|  17.0k|                                if (!(pInChI->nConnTable = (AT_NUMB*)inchi_calloc((long long)pInChI->nNumberOfAtoms + 1, sizeof(pInChI->nConnTable[0])))) /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  17.0k|#define inchi_calloc   calloc
  ------------------
  |  Branch (2506:37): [True: 0, False: 17.0k]
  ------------------
 2507|      0|                                {
 2508|      0|                                    ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 2509|      0|                                    goto exit_function;
 2510|      0|                                }
 2511|  17.0k|                                pInChI->lenConnTable = 1;
 2512|  17.0k|                                pInChI->nConnTable[0] = 1;
 2513|  17.0k|                            }
 2514|  50.2k|                        }
 2515|   227k|                        else
 2516|   227k|                        {
 2517|   227k|                            if (pInChI->nConnTable && !pInChI->lenConnTable && pInChI->nNumberOfAtoms == 1)
  ------------------
  |  Branch (2517:33): [True: 227k, False: 0]
  |  Branch (2517:55): [True: 0, False: 227k]
  |  Branch (2517:80): [True: 0, False: 0]
  ------------------
 2518|      0|                            {
 2519|      0|                                pInChI->nConnTable[0] = 1;
 2520|      0|                                pInChI->lenConnTable = 1;
 2521|      0|                            }
 2522|   227k|                        }
 2523|       |                        /**** copy charge: Mobile H --> Fixed H; ****/
 2524|   277k|                        if (j == TAUT_NON)
  ------------------
  |  |  574|   277k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2524:29): [True: 33.8k, False: 243k]
  ------------------
 2525|  33.8k|                        {
 2526|       |                            /*
 2527|       |                            if ( pInChI->nTotalCharge == NO_VALUE_INT )
 2528|       |                            {
 2529|       |                            pInChI->nTotalCharge = 0;
 2530|       |                            }
 2531|       |                            else
 2532|       |                            */
 2533|  33.8k|                            if (!pInChI->nTotalCharge && k < nNumComponents[iINChI][TAUT_YES] && pInpInChI[iINChI][TAUT_YES]) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  |  575|  33.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                          if (!pInChI->nTotalCharge && k < nNumComponents[iINChI][TAUT_YES] && pInpInChI[iINChI][TAUT_YES]) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  |  575|  33.1k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2533:33): [True: 33.8k, False: 10]
  |  Branch (2533:58): [True: 33.1k, False: 720]
  |  Branch (2533:98): [True: 33.1k, False: 0]
  ------------------
 2534|  33.1k|                            {
 2535|  33.1k|                                INChI* pAltInChI = &pInpInChI[iINChI][TAUT_YES][k]; /* Mobile H InChI */
  ------------------
  |  |  575|  33.1k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2536|  33.1k|                                if (pAltInChI->nTotalCharge && pAltInChI->nTotalCharge != NO_VALUE_INT)
  ------------------
  |  |   23|     95|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2536:37): [True: 95, False: 33.0k]
  |  Branch (2536:64): [True: 37, False: 58]
  ------------------
 2537|     37|                                {
 2538|     37|                                    pInChI->nTotalCharge = pAltInChI->nTotalCharge;
 2539|     37|                                }
 2540|  33.1k|                            }
 2541|  33.8k|                        }
 2542|       |                        /***** Fixed H: add pInChI->nNum_H_fixed to pInChI->nNum_H ****/
 2543|   277k|                        if (j == TAUT_NON && pInChI->nNum_H && pInChI->nNum_H_fixed)
  ------------------
  |  |  574|   555k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2543:29): [True: 33.8k, False: 243k]
  |  Branch (2543:46): [True: 33.8k, False: 0]
  |  Branch (2543:64): [True: 1.32k, False: 32.5k]
  ------------------
 2544|  1.32k|                        {
 2545|  12.6k|                            for (m = 0; m < pInChI->nNumberOfAtoms; m++)
  ------------------
  |  Branch (2545:41): [True: 11.3k, False: 1.32k]
  ------------------
 2546|  11.3k|                            {
 2547|  11.3k|                                pInChI->nNum_H[m] += pInChI->nNum_H_fixed[m];
 2548|  11.3k|                            }
 2549|  1.32k|                        }
 2550|       |                        /***** copy isotopic atoms: Mobile H --> Fixed H ******/
 2551|   277k|                        if (j == TAUT_YES && pInChI->nNumberOfIsotopicAtoms &&
  ------------------
  |  |  575|   555k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2551:29): [True: 243k, False: 33.8k]
  |  Branch (2551:46): [True: 1.28k, False: 242k]
  ------------------
 2552|  1.28k|                            k < nNumComponents[iINChI][TAUT_NON])
  ------------------
  |  |  574|  1.28k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2552:29): [True: 127, False: 1.15k]
  ------------------
 2553|    127|                        {
 2554|    127|                            INChI* pAltInChI = &pInpInChI[iINChI][TAUT_NON][k]; /* Fixed H InChI */
  ------------------
  |  |  574|    127|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 2555|       |
 2556|    127|                            if (!pAltInChI->nNumberOfIsotopicAtoms)
  ------------------
  |  Branch (2556:33): [True: 118, False: 9]
  ------------------
 2557|    118|                            {
 2558|    118|                                ret2 = CopySegment(pAltInChI, pInChI, CPY_ISO_AT, 0, 0);
 2559|    118|                                if (ret2 < 0)
  ------------------
  |  Branch (2559:37): [True: 0, False: 118]
  ------------------
 2560|      0|                                {
 2561|      0|                                    goto exit_function;
 2562|      0|                                }
 2563|    118|                            }
 2564|    127|                        }
 2565|       |                        /**** copy coordinates: Mobile H --> Fixed H ******/
 2566|   277k|                        if (j == TAUT_YES && pInChI->IsotopicTGroup &&
  ------------------
  |  |  575|   555k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2566:29): [True: 243k, False: 33.8k]
  |  Branch (2566:46): [True: 0, False: 243k]
  ------------------
 2567|      0|                            k < nNumComponents[iINChI][TAUT_NON])
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2567:29): [True: 0, False: 0]
  ------------------
 2568|      0|                        {
 2569|      0|                            INChI* pAltInChI = &pInpInChI[iINChI][TAUT_NON][k]; /* Fixed H InChI */
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 2570|       |
 2571|      0|                            if (!pAltInChI->IsotopicTGroup)
  ------------------
  |  Branch (2571:33): [True: 0, False: 0]
  ------------------
 2572|      0|                            {
 2573|      0|                                XYZ_COORD* pxyz = (XYZ_COORD*)inchi_calloc(pInChI->nNumberOfAtoms, sizeof(pxyz[0]));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 2574|      0|                                if (pxyz)
  ------------------
  |  Branch (2574:37): [True: 0, False: 0]
  ------------------
 2575|      0|                                {
 2576|      0|                                    memcpy(pxyz, pInChI->IsotopicTGroup, pInChI->nNumberOfAtoms * sizeof(pxyz[0]));
 2577|      0|                                    pAltInChI->IsotopicTGroup = (INChI_IsotopicTGroup*)pxyz;
 2578|      0|                                }
 2579|      0|                                else
 2580|      0|                                {
 2581|      0|                                    ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 2582|      0|                                    goto exit_function;
 2583|      0|                                }
 2584|      0|                            }
 2585|      0|                        }
 2586|       |
 2587|       |                        /********************************************************
 2588|       |                        *                                                      *
 2589|       |                        *            Restore omitted stereo seqments           *
 2590|       |                        *                                                      *
 2591|       |                        * order of restoring:                                  *
 2592|       |                        *                                                      *
 2593|       |                        * 1. Fixed H            (F) -> (FI) Isotopic Fixed H   *
 2594|       |                        * 2. Mobile H           (M) -> (F)  Fixed H            *
 2595|       |                        * 3. Isotopic Mobile H (MI) -> (FI) Isotopic Fixed H   *
 2596|       |                        * 4. Mobile H           (M) -> (MI) Isotopic Mobile H  *
 2597|       |                        *                                                      *
 2598|       |                        ********************************************************/
 2599|       |
 2600|       |                        /***** (4) copy stereo: Mobile H --> isotopic Mobile H ******/
 2601|   277k|                        if (j == TAUT_YES)
  ------------------
  |  |  575|   277k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2601:29): [True: 243k, False: 33.8k]
  ------------------
 2602|   243k|                        {
 2603|   243k|                            int bIso = pInChI->nNumberOfIsotopicAtoms ||
  ------------------
  |  Branch (2603:40): [True: 1.28k, False: 242k]
  ------------------
 2604|   242k|                                (pInChI->StereoIsotopic &&
  ------------------
  |  Branch (2604:34): [True: 564, False: 241k]
  ------------------
 2605|    564|                                    pInChI->StereoIsotopic->nNumberOfStereoCenters
  ------------------
  |  Branch (2605:37): [True: 163, False: 401]
  ------------------
 2606|    564|                                    + pInChI->StereoIsotopic->nNumberOfStereoBonds) ||
 2607|   242k|                                (pInChI_Alt && pInChI_Alt->nNumberOfIsotopicAtoms); /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2607:34): [True: 32.9k, False: 209k]
  |  Branch (2607:48): [True: 165, False: 32.7k]
  ------------------
 2608|       |
 2609|       |                            /* non-isotopic Mobile H => isotopic Mobile H */
 2610|   243k|                            if (bIso)
  ------------------
  |  Branch (2610:33): [True: 1.60k, False: 242k]
  ------------------
 2611|  1.60k|                            {
 2612|  1.60k|                                if (pInChI->Stereo && pInChI->Stereo->nNumberOfStereoCenters &&
  ------------------
  |  Branch (2612:37): [True: 271, False: 1.33k]
  |  Branch (2612:55): [True: 135, False: 136]
  ------------------
 2613|    135|                                    (!pInChI->StereoIsotopic || !pInChI->StereoIsotopic->t_parity))
  ------------------
  |  Branch (2613:38): [True: 73, False: 62]
  |  Branch (2613:65): [True: 12, False: 50]
  ------------------
 2614|     85|                                {
 2615|     85|                                    if (0 > (ret2 = CopySegment(pInChI, pInChI, CPY_SP3, 1, 0)) ||
  ------------------
  |  Branch (2615:41): [True: 0, False: 85]
  ------------------
 2616|     85|                                        ((!pInChI->StereoIsotopic->nCompInv2Abs || NO_VALUE_INT == pInChI->StereoIsotopic->nCompInv2Abs) &&
  ------------------
  |  |   23|     10|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2616:43): [True: 75, False: 10]
  |  Branch (2616:84): [True: 6, False: 4]
  ------------------
 2617|     81|                                            0 > (ret2 = CopySegment(pInChI, pInChI, CPY_SP3_M, 1, 0)))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2617:45): [True: 0, False: 81]
  ------------------
 2618|      0|                                    {
 2619|      0|                                        goto exit_function;
 2620|      0|                                    }
 2621|     85|                                    if ((nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)))
  ------------------
  |  |  121|     85|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                  if ((nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)))
  ------------------
  |  |  122|     85|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2621:41): [True: 14, False: 71]
  ------------------
 2622|     14|                                    {
 2623|     14|                                        if (pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   23|     14|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2623:45): [True: 12, False: 2]
  ------------------
 2624|     12|                                        {
 2625|     12|                                            pInChI->Stereo->nCompInv2Abs = s[iINChI][j][0] > 0 ? 2 : 0;
  ------------------
  |  Branch (2625:76): [True: 2, False: 10]
  ------------------
 2626|     12|                                        }
 2627|     14|                                        if (pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   23|     14|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2627:45): [True: 12, False: 2]
  ------------------
 2628|     12|                                        {
 2629|     12|                                            pInChI->StereoIsotopic->nCompInv2Abs = s[iINChI][j][1] > 0 ? 2 : 0;
  ------------------
  |  Branch (2629:84): [True: 10, False: 2]
  ------------------
 2630|     12|                                        }
 2631|     14|                                    }
 2632|     85|                                }
 2633|  1.52k|                                else
 2634|  1.52k|                                {
 2635|       |                                    /* copy sp3 inversion info: non-isotopic Mobile H => isotopic Mobile H  */
 2636|  1.52k|                                    if (pInChI->Stereo && pInChI->Stereo->nNumberOfStereoCenters &&
  ------------------
  |  Branch (2636:41): [True: 186, False: 1.33k]
  |  Branch (2636:59): [True: 50, False: 136]
  ------------------
 2637|     50|                                        pInChI->StereoIsotopic && pInChI->StereoIsotopic->nNumberOfStereoCenters &&
  ------------------
  |  Branch (2637:41): [True: 50, False: 0]
  |  Branch (2637:67): [True: 44, False: 6]
  ------------------
 2638|     44|                                        pInChI->Stereo->nCompInv2Abs)
  ------------------
  |  Branch (2638:41): [True: 44, False: 0]
  ------------------
 2639|     44|                                    {
 2640|     44|                                        if ((nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)) &&
  ------------------
  |  |  121|     44|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                      if ((nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)) &&
  ------------------
  |  |  122|     44|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2640:45): [True: 20, False: 24]
  ------------------
 2641|     20|                                            pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT &&
  ------------------
  |  |   23|     64|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2641:45): [True: 20, False: 0]
  ------------------
 2642|     20|                                            pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   23|     20|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2642:45): [True: 20, False: 0]
  ------------------
 2643|     20|                                        {
 2644|     20|                                            pInChI->Stereo->nCompInv2Abs = s[iINChI][j][0] > 0 ? 2 : 0;
  ------------------
  |  Branch (2644:76): [True: 0, False: 20]
  ------------------
 2645|     20|                                            pInChI->StereoIsotopic->nCompInv2Abs = s[iINChI][j][1] > 0 ? 2 : 0;
  ------------------
  |  Branch (2645:84): [True: 20, False: 0]
  ------------------
 2646|     20|                                        }
 2647|     24|                                        else
 2648|     24|                                        {
 2649|     24|                                            if (!pInChI->StereoIsotopic->nCompInv2Abs || NO_VALUE_INT == pInChI->StereoIsotopic->nCompInv2Abs)
  ------------------
  |  |   23|     24|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2649:49): [True: 0, False: 24]
  |  Branch (2649:90): [True: 24, False: 0]
  ------------------
 2650|     24|                                            {
 2651|     24|                                                pInChI->StereoIsotopic->nCompInv2Abs = pInChI->Stereo->nCompInv2Abs;
 2652|     24|                                            }
 2653|     24|                                        }
 2654|     44|                                    }
 2655|  1.52k|                                }
 2656|  1.60k|                            }
 2657|   243k|                            if (bIso &&
  ------------------
  |  Branch (2657:33): [True: 1.60k, False: 242k]
  ------------------
 2658|  1.60k|                                pInChI->Stereo && pInChI->Stereo->nNumberOfStereoBonds &&
  ------------------
  |  Branch (2658:33): [True: 271, False: 1.33k]
  |  Branch (2658:51): [True: 88, False: 183]
  ------------------
 2659|     88|                                (!pInChI->StereoIsotopic || !pInChI->StereoIsotopic->b_parity))
  ------------------
  |  Branch (2659:34): [True: 74, False: 14]
  |  Branch (2659:61): [True: 10, False: 4]
  ------------------
 2660|     84|                            {
 2661|     84|                                if (0 > (ret2 = CopySegment(pInChI, pInChI, CPY_SP2, 1, 0)))
  ------------------
  |  Branch (2661:37): [True: 0, False: 84]
  ------------------
 2662|      0|                                {
 2663|      0|                                    goto exit_function;
 2664|      0|                                }
 2665|     84|                            }
 2666|   243k|                        }
 2667|       |                        /***** (0) set nCompInv2Abs to Fixed-H *********************************/
 2668|   277k|                        if (j == TAUT_NON)
  ------------------
  |  |  574|   277k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2668:29): [True: 33.8k, False: 243k]
  ------------------
 2669|  33.8k|                        {
 2670|  33.8k|                            if (pInChI->Stereo && pInChI->Stereo->nNumberOfStereoCenters &&
  ------------------
  |  Branch (2670:33): [True: 678, False: 33.1k]
  |  Branch (2670:51): [True: 221, False: 457]
  ------------------
 2671|    221|                                pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   23|    221|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2671:33): [True: 219, False: 2]
  ------------------
 2672|    219|                            {
 2673|       |                                /* case of /sN and /t... in non-isotopic Mobile-H, no /s in non-isotopic Fixed-H */
 2674|    219|                                if (!s[iINChI][j][0] && s[iINChI][jAlt][0] > 0 &&  /* /sN is not present in F and is present in M */
  ------------------
  |  Branch (2674:37): [True: 209, False: 10]
  |  Branch (2674:57): [True: 24, False: 185]
  ------------------
 2675|     24|                                    pInChI_Alt && pInChI_Alt->Stereo && pInChI_Alt->Stereo->nNumberOfStereoCenters)
  ------------------
  |  Branch (2675:37): [True: 24, False: 0]
  |  Branch (2675:51): [True: 24, False: 0]
  |  Branch (2675:73): [True: 20, False: 4]
  ------------------
 2676|     20|                                {
 2677|       |                                    /* inherit from Mobile-H */
 2678|       |                                    /* /s1 in M and MI; /m1 or /m0 in MI; /m. in M; no /m in F. Inherit MI->FI. Added 10-15-2007 */
 2679|     20|                                    if (pInChI_Alt->Stereo->nCompInv2Abs == 0 &&                    /*  M: /m. ; means no /m for this component */
  ------------------
  |  Branch (2679:41): [True: 2, False: 18]
  ------------------
 2680|      2|                                        pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT &&         /*  F: no /m segment for all components */
  ------------------
  |  |   23|     22|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2680:41): [True: 2, False: 0]
  ------------------
 2681|      2|                                        pInChI_Alt->StereoIsotopic &&                               /*  MI: present */
  ------------------
  |  Branch (2681:41): [True: 0, False: 2]
  ------------------
 2682|      0|                                        pInChI_Alt->StereoIsotopic->nCompInv2Abs != 0 &&
  ------------------
  |  Branch (2682:41): [True: 0, False: 0]
  ------------------
 2683|      0|                                        pInChI_Alt->StereoIsotopic->nCompInv2Abs != NO_VALUE_INT && /* MI:    /m0 or /m1  */
  ------------------
  |  |   23|     20|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2683:41): [True: 0, False: 0]
  ------------------
 2684|      0|                                        !s[iINChI][j][0] && !s[iINChI][j][1] &&                     /* F, FI: no /s       */
  ------------------
  |  Branch (2684:41): [True: 0, False: 0]
  |  Branch (2684:61): [True: 0, False: 0]
  ------------------
 2685|      0|                                        s[iINChI][jAlt][0] == 1 && s[iINChI][jAlt][1] == 1          /* M, MI: /s1 and /s1 */
  ------------------
  |  Branch (2685:41): [True: 0, False: 0]
  |  Branch (2685:68): [True: 0, False: 0]
  ------------------
 2686|     20|                                        )
 2687|      0|                                    {
 2688|       |                                        /* copy /m from MI to FI */
 2689|      0|                                        if (0 > (ret2 = CopySegment(pInChI, pInChI_Alt, CPY_SP3_M, 1, 1)))
  ------------------
  |  Branch (2689:45): [True: 0, False: 0]
  ------------------
 2690|      0|                                        {
 2691|      0|                                            goto exit_function;
 2692|      0|                                        }
 2693|      0|                                    }
 2694|     20|                                    else
 2695|     20|                                    {
 2696|       |                                        /* the following if(){...} was added to fix m1 bug 2007-09-25 DT */
 2697|     20|                                        if (pInChI_Alt->Stereo->nCompInv2Abs != NO_VALUE_INT && s[iINChI][jAlt][0] == 1)
  ------------------
  |  |   23|     40|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2697:45): [True: 4, False: 16]
  |  Branch (2697:97): [True: 2, False: 2]
  ------------------
 2698|      2|                                        {
 2699|      2|                                            pInChI->Stereo->nCompInv2Abs = pInChI_Alt->Stereo->nCompInv2Abs;
 2700|      2|                                        }
 2701|     18|                                        else
 2702|     18|                                        {
 2703|       |                                            /* M and MI contain /sN and /sN, N=2,3. Added 10-15-2007 */
 2704|     18|                                            if (pInChI_Alt->Stereo->nCompInv2Abs == NO_VALUE_INT &&
  ------------------
  |  |   23|     36|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2704:49): [True: 16, False: 2]
  ------------------
 2705|     16|                                                pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT &&
  ------------------
  |  |   23|     34|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2705:49): [True: 16, False: 0]
  ------------------
 2706|     16|                                                !s[iINChI][j][0] && !s[iINChI][j][1] &&
  ------------------
  |  Branch (2706:49): [True: 16, False: 0]
  |  Branch (2706:69): [True: 14, False: 2]
  ------------------
 2707|     14|                                                (s[iINChI][jAlt][0] & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)) &&
  ------------------
  |  |  121|     14|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                              (s[iINChI][jAlt][0] & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)) &&
  ------------------
  |  |  122|     14|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2707:49): [True: 8, False: 6]
  ------------------
 2708|      8|                                                (s[iINChI][jAlt][1] & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)))
  ------------------
  |  |  121|      8|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                              (s[iINChI][jAlt][1] & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)))
  ------------------
  |  |  122|      8|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2708:49): [True: 4, False: 4]
  ------------------
 2709|      4|                                            {
 2710|      4|                                                int bIso = pInChI->nNumberOfIsotopicAtoms ||
  ------------------
  |  Branch (2710:60): [True: 0, False: 4]
  ------------------
 2711|      4|                                                    (pInChI->StereoIsotopic &&
  ------------------
  |  Branch (2711:54): [True: 2, False: 2]
  ------------------
 2712|      2|                                                        pInChI->StereoIsotopic->nNumberOfStereoCenters
  ------------------
  |  Branch (2712:57): [True: 0, False: 2]
  ------------------
 2713|      2|                                                        + pInChI->StereoIsotopic->nNumberOfStereoBonds) ||
 2714|      4|                                                    (pInChI_Alt && pInChI_Alt->nNumberOfIsotopicAtoms); /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2714:54): [True: 4, False: 0]
  |  Branch (2714:68): [True: 4, False: 0]
  ------------------
 2715|      4|                                                if (bIso)
  ------------------
  |  Branch (2715:53): [True: 4, False: 0]
  ------------------
 2716|      4|                                                {
 2717|      4|                                                    if (!pInChI_Alt->StereoIsotopic &&  /* create zero/NULL-initialized pInChI_Alt->StereoIsotopic */
  ------------------
  |  Branch (2717:57): [True: 0, False: 4]
  ------------------
 2718|      0|                                                        0 > (ret2 = CopySegment(pInChI_Alt, pInChI_Alt, CPY_SP3_M, 1, -1)))
  ------------------
  |  Branch (2718:57): [True: 0, False: 0]
  ------------------
 2719|      0|                                                    {
 2720|      0|                                                        goto exit_function;
 2721|      0|                                                    }
 2722|      4|                                                    pInChI_Alt->StereoIsotopic->nCompInv2Abs = 2;  /* MI: /m1 or /m0 */
 2723|      4|                                                    pInChI_Alt->Stereo->nCompInv2Abs = 0;  /* M:  /m. ; no /m for this component */
 2724|      4|                                                    pInChI->Stereo->nCompInv2Abs = NO_VALUE_INT + 1; /* FI: Stereo->CompInv2Abs=0, StereoIsotopic->CompInv2Abs=1 or -1 */
  ------------------
  |  |   23|      4|#define NO_VALUE_INT    9999
  ------------------
 2725|      4|                                                }
 2726|      0|                                                else
 2727|      0|                                                {
 2728|      0|                                                    pInChI->Stereo->nCompInv2Abs = 2; /* F:  /m1 or /m0, omitted from InChI as a repetition */
 2729|      0|                                                    pInChI_Alt->Stereo->nCompInv2Abs = 2; /* M:  /m1 or /m0; in Srel/SRac case the value = 2 */
 2730|      0|                                                }
 2731|      4|                                            }
 2732|     14|                                            else
 2733|     14|                                            {
 2734|     14|                                                pInChI->Stereo->nCompInv2Abs = 2;         /* F:  /m1 or /m0, omitted from InChI as a repetition */
 2735|     14|                                                pInChI_Alt->Stereo->nCompInv2Abs = 2;     /* M:  /m1 or /m0; in Srel/SRac case the value = 2 */
 2736|     14|                                            }
 2737|     18|                                        }
 2738|     20|                                    }
 2739|     20|                                }
 2740|    199|                                else
 2741|    199|                                {
 2742|       |                                    /* case of /sN in Isotopic Fixed-H only, /t... in Fixed-H, no /m (2007-08-27 DT) */
 2743|    199|                                    if (!s[iINChI][j][0] && !s[iINChI][jAlt][0] && /* /sN in Fixed-H isotopic only */
  ------------------
  |  Branch (2743:41): [True: 189, False: 10]
  |  Branch (2743:61): [True: 185, False: 4]
  ------------------
 2744|    185|                                        (nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)) &&
  ------------------
  |  |  121|    185|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                      (nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)) &&
  ------------------
  |  |  122|    185|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2744:41): [True: 18, False: 167]
  ------------------
 2745|     18|                                        !(pInChI->StereoIsotopic && pInChI->StereoIsotopic->nNumberOfStereoCenters) &&
  ------------------
  |  Branch (2745:43): [True: 10, False: 8]
  |  Branch (2745:69): [True: 2, False: 8]
  ------------------
 2746|       |                                        /*!(pInChI_Alt && pInChI_Alt->Stereo && pInChI_Alt->Stereo->nNumberOfStereoCenters) &&*/
 2747|     16|                                        !(pInChI_Alt && pInChI_Alt->StereoIsotopic && pInChI_Alt->StereoIsotopic->nNumberOfStereoCenters))
  ------------------
  |  Branch (2747:43): [True: 16, False: 0]
  |  Branch (2747:57): [True: 6, False: 10]
  |  Branch (2747:87): [True: 0, False: 6]
  ------------------
 2748|     16|                                    {
 2749|     16|                                        pInChI->Stereo->nCompInv2Abs = NO_VALUE_INT + 1; /* Stereo->CompInv2Abs=0, StereoIsotopic->CompInv2Abs=1 or -1 */
  ------------------
  |  |   23|     16|#define NO_VALUE_INT    9999
  ------------------
 2750|     16|                                    }
 2751|    183|                                    else
 2752|    183|                                    {
 2753|    183|                                        pInChI->Stereo->nCompInv2Abs = s[iINChI][j][0] > 0 ? 2 : 0;
  ------------------
  |  Branch (2753:72): [True: 10, False: 173]
  ------------------
 2754|    183|                                    }
 2755|    199|                                }
 2756|    219|                            }
 2757|  33.8k|                        }
 2758|       |
 2759|       |                        /***** (1) copy stereo: non-isotopic Fixed H --> isotopic Fixed H ******/
 2760|   277k|                        if (j == TAUT_NON)
  ------------------
  |  |  574|   277k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2760:29): [True: 33.8k, False: 243k]
  ------------------
 2761|  33.8k|                        {
 2762|  33.8k|                            int bIso = pInChI->nNumberOfIsotopicAtoms ||
  ------------------
  |  Branch (2762:40): [True: 174, False: 33.6k]
  ------------------
 2763|  33.6k|                                (pInChI->StereoIsotopic &&
  ------------------
  |  Branch (2763:34): [True: 30.2k, False: 3.44k]
  ------------------
 2764|  30.2k|                                    pInChI->StereoIsotopic->nNumberOfStereoCenters
  ------------------
  |  Branch (2764:37): [True: 28, False: 30.1k]
  ------------------
 2765|  30.2k|                                    + pInChI->StereoIsotopic->nNumberOfStereoBonds) ||
 2766|  33.6k|                                (pInChI_Alt && pInChI_Alt->nNumberOfIsotopicAtoms); /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2766:34): [True: 32.9k, False: 720]
  |  Branch (2766:48): [True: 118, False: 32.8k]
  ------------------
 2767|       |                            /* non-isotopic Fixed H => isotopic Fixed H */
 2768|  33.8k|                            if (bIso)
  ------------------
  |  Branch (2768:33): [True: 320, False: 33.5k]
  ------------------
 2769|    320|                            {
 2770|    320|                                if (pInChI->Stereo && pInChI->Stereo->nNumberOfStereoCenters &&
  ------------------
  |  Branch (2770:37): [True: 105, False: 215]
  |  Branch (2770:55): [True: 71, False: 34]
  ------------------
 2771|     71|                                    (!pInChI->StereoIsotopic || !pInChI->StereoIsotopic->t_parity))
  ------------------
  |  Branch (2771:38): [True: 57, False: 14]
  |  Branch (2771:65): [True: 6, False: 8]
  ------------------
 2772|     63|                                {
 2773|       |                                    /* -- replaced 2007-08-27 by (aaa), see below -- DT
 2774|       |                                    if ( 0 > (ret2 = CopySegment( pInChI, pInChI, CPY_SP3, 1, 0)) ||
 2775|       |                                    !(pInChI->StereoIsotopic->nCompInv2Abs || NO_VALUE_INT == pInChI->StereoIsotopic->nCompInv2Abs) &&
 2776|       |                                    0 > (ret2 = CopySegment( pInChI, pInChI, CPY_SP3_M, 1, 0))) {
 2777|       |                                    goto exit_function;
 2778|       |                                    }
 2779|       |                                    */
 2780|       |                                    /*----------- replacement (aaa) begin 2007-08-27 DT */
 2781|     63|                                    if (0 > (ret2 = CopySegment(pInChI, pInChI, CPY_SP3, 1, 0)))
  ------------------
  |  Branch (2781:41): [True: 0, False: 63]
  ------------------
 2782|      0|                                    {
 2783|      0|                                        goto exit_function;
 2784|      0|                                    }
 2785|     63|                                    if (pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT + 1)
  ------------------
  |  |   23|     63|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2785:41): [True: 6, False: 57]
  ------------------
 2786|      6|                                    {
 2787|      6|                                        pInChI->Stereo->nCompInv2Abs = 0;
 2788|      6|                                        pInChI->StereoIsotopic->nCompInv2Abs = 2;
 2789|      6|                                    }
 2790|     57|                                    else
 2791|     57|                                    {
 2792|     57|                                        if (!(pInChI->StereoIsotopic->nCompInv2Abs || NO_VALUE_INT == pInChI->StereoIsotopic->nCompInv2Abs) &&
  ------------------
  |  |   23|     55|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2792:47): [True: 2, False: 55]
  |  Branch (2792:87): [True: 0, False: 55]
  ------------------
 2793|     55|                                            0 > (ret2 = CopySegment(pInChI, pInChI, CPY_SP3_M, 1, 0)))
  ------------------
  |  Branch (2793:45): [True: 0, False: 55]
  ------------------
 2794|      0|                                        {
 2795|      0|                                            goto exit_function;
 2796|      0|                                        }
 2797|     57|                                    }
 2798|       |                                    /*----------- replacement (aaa) end 2007-08-27 DT */
 2799|     63|                                    if ((nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)))
  ------------------
  |  |  121|     63|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                  if ((nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)))
  ------------------
  |  |  122|     63|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2799:41): [True: 6, False: 57]
  ------------------
 2800|      6|                                    {
 2801|      6|                                        if (pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   23|      6|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2801:45): [True: 0, False: 6]
  ------------------
 2802|      0|                                        {
 2803|      0|                                            pInChI->Stereo->nCompInv2Abs = s[iINChI][j][0] > 0 ? 2 : 0;
  ------------------
  |  Branch (2803:76): [True: 0, False: 0]
  ------------------
 2804|      0|                                        }
 2805|      6|                                        if (pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   23|      6|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2805:45): [True: 2, False: 4]
  ------------------
 2806|      2|                                        {
 2807|      2|                                            pInChI->StereoIsotopic->nCompInv2Abs = s[iINChI][j][1] > 0 ? 2 : 0;
  ------------------
  |  Branch (2807:84): [True: 0, False: 2]
  ------------------
 2808|      2|                                        }
 2809|      6|                                    }
 2810|       |#ifdef NEVER
 2811|       |                                    if ((nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)) &&
 2812|       |                                        !s[iINChI][j][0] && s[iINChI][j][0] > 0)
 2813|       |                                    {
 2814|       |                                        /* copied Rel/Rac stereo to Iso; /s is in Iso /s is not in non-Iso */
 2815|       |                                        /* this means all difference in stereo is in inversion */
 2816|       |                                        if (pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT &&
 2817|       |                                            pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT)
 2818|       |                                        {
 2819|       |                                            pInChI->Stereo->nCompInv2Abs = 0;         /* missing */
 2820|       |                                            pInChI->StereoIsotopic->nCompInv2Abs = 2; /* unusual value */
 2821|       |                                        }
 2822|       |                                    }
 2823|       |#endif
 2824|     63|                                }
 2825|    257|                                else
 2826|    257|                                {
 2827|       |                                    /* copy sp3 inversion info: non-isotopic Fixed H --> isotopic Fixed H  */
 2828|    257|                                    if (pInChI->Stereo && pInChI->Stereo->nNumberOfStereoCenters &&
  ------------------
  |  Branch (2828:41): [True: 42, False: 215]
  |  Branch (2828:59): [True: 8, False: 34]
  ------------------
 2829|      8|                                        pInChI->StereoIsotopic && pInChI->StereoIsotopic->nNumberOfStereoCenters &&
  ------------------
  |  Branch (2829:41): [True: 8, False: 0]
  |  Branch (2829:67): [True: 6, False: 2]
  ------------------
 2830|      6|                                        pInChI->Stereo->nCompInv2Abs)
  ------------------
  |  Branch (2830:41): [True: 0, False: 6]
  ------------------
 2831|      0|                                    {
 2832|      0|                                        if ((nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)) &&
  ------------------
  |  |  121|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                      if ((nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)) &&
  ------------------
  |  |  122|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2832:45): [True: 0, False: 0]
  ------------------
 2833|      0|                                            pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT &&
  ------------------
  |  |   23|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2833:45): [True: 0, False: 0]
  ------------------
 2834|      0|                                            pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   23|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2834:45): [True: 0, False: 0]
  ------------------
 2835|      0|                                        {
 2836|      0|                                            pInChI->Stereo->nCompInv2Abs = s[iINChI][j][0] > 0 ? 2 : 0;
  ------------------
  |  Branch (2836:76): [True: 0, False: 0]
  ------------------
 2837|      0|                                            pInChI->StereoIsotopic->nCompInv2Abs = s[iINChI][j][1] > 0 ? 2 : 0;
  ------------------
  |  Branch (2837:84): [True: 0, False: 0]
  ------------------
 2838|      0|                                        }
 2839|      0|                                        else
 2840|      0|                                        {
 2841|      0|                                            if (!pInChI->StereoIsotopic->nCompInv2Abs || NO_VALUE_INT == pInChI->StereoIsotopic->nCompInv2Abs)
  ------------------
  |  |   23|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2841:49): [True: 0, False: 0]
  |  Branch (2841:90): [True: 0, False: 0]
  ------------------
 2842|      0|                                            {
 2843|      0|                                                pInChI->StereoIsotopic->nCompInv2Abs = pInChI->Stereo->nCompInv2Abs;
 2844|      0|                                            }
 2845|      0|                                        }
 2846|      0|                                    }
 2847|    257|                                }
 2848|    320|                            }
 2849|  33.8k|                            if (bIso &&
  ------------------
  |  Branch (2849:33): [True: 320, False: 33.5k]
  ------------------
 2850|    320|                                pInChI->Stereo && pInChI->Stereo->nNumberOfStereoBonds &&
  ------------------
  |  Branch (2850:33): [True: 105, False: 215]
  |  Branch (2850:51): [True: 2, False: 103]
  ------------------
 2851|      2|                                (!pInChI->StereoIsotopic || !pInChI->StereoIsotopic->b_parity))
  ------------------
  |  Branch (2851:34): [True: 2, False: 0]
  |  Branch (2851:61): [True: 0, False: 0]
  ------------------
 2852|      2|                            {
 2853|      2|                                if (0 > (ret2 = CopySegment(pInChI, pInChI, CPY_SP2, 1, 0)))
  ------------------
  |  Branch (2853:37): [True: 0, False: 2]
  ------------------
 2854|      0|                                {
 2855|      0|                                    goto exit_function;
 2856|      0|                                }
 2857|      2|                            }
 2858|  33.8k|                        }
 2859|       |
 2860|       |                        /***** copy stereo: Mobile H --> Fixed H ******/
 2861|   277k|                        if (j == TAUT_NON && k < nNumComponents[iINChI][TAUT_YES])
  ------------------
  |  |  574|   555k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                      if (j == TAUT_NON && k < nNumComponents[iINChI][TAUT_YES])
  ------------------
  |  |  575|  33.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2861:29): [True: 33.8k, False: 243k]
  |  Branch (2861:46): [True: 33.1k, False: 720]
  ------------------
 2862|  33.1k|                        {
 2863|  33.1k|                            INChI* pAltInChI = &pInpInChI[iINChI][TAUT_YES][k]; /* Mobile H InChI */
  ------------------
  |  |  575|  33.1k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2864|  33.1k|                            int bIso = pInChI->nNumberOfIsotopicAtoms ||
  ------------------
  |  Branch (2864:40): [True: 174, False: 32.9k]
  ------------------
 2865|  32.9k|                                (pInChI->StereoIsotopic &&
  ------------------
  |  Branch (2865:34): [True: 30.2k, False: 2.67k]
  ------------------
 2866|  30.2k|                                    pInChI->StereoIsotopic->nNumberOfStereoCenters
  ------------------
  |  Branch (2866:37): [True: 80, False: 30.1k]
  ------------------
 2867|  30.2k|                                    + pInChI->StereoIsotopic->nNumberOfStereoBonds) ||
 2868|  32.8k|                                (pAltInChI && (
  ------------------
  |  Branch (2868:34): [True: 32.8k, False: 0]
  ------------------
 2869|  32.8k|                                    pAltInChI->nNumberOfIsotopicAtoms ||
  ------------------
  |  Branch (2869:37): [True: 66, False: 32.8k]
  ------------------
 2870|  32.8k|                                    (pAltInChI->StereoIsotopic &&
  ------------------
  |  Branch (2870:38): [True: 117, False: 32.6k]
  ------------------
 2871|    117|                                        pAltInChI->StereoIsotopic->nNumberOfStereoCenters
  ------------------
  |  Branch (2871:41): [True: 55, False: 62]
  ------------------
 2872|    117|                                        + pAltInChI->StereoIsotopic->nNumberOfStereoBonds))); /* djb-rwth: addressing LLVM warning */
 2873|  33.1k|                            int bNo_InChI_t = (!pInChI->Stereo || !pInChI->Stereo->t_parity);
  ------------------
  |  Branch (2873:48): [True: 32.4k, False: 652]
  |  Branch (2873:67): [True: 301, False: 351]
  ------------------
 2874|  33.1k|                            int bNo_InChI_m = (!pInChI->Stereo || NO_VALUE_INT == pInChI->Stereo->nCompInv2Abs);
  ------------------
  |  |   23|    652|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2874:48): [True: 32.4k, False: 652]
  |  Branch (2874:67): [True: 132, False: 520]
  ------------------
 2875|       |
 2876|       |                            /* (2) non-isotopic Mobile H => non-isotopic Fixed H */
 2877|  33.1k|                            if (pAltInChI->Stereo && pAltInChI->Stereo->nNumberOfStereoCenters &&
  ------------------
  |  Branch (2877:33): [True: 537, False: 32.5k]
  |  Branch (2877:54): [True: 213, False: 324]
  ------------------
 2878|    213|                                (!pInChI->Stereo || !pInChI->Stereo->t_parity))
  ------------------
  |  Branch (2878:34): [True: 88, False: 125]
  |  Branch (2878:53): [True: 42, False: 83]
  ------------------
 2879|    130|                            {
 2880|    130|#if ( FIX_I2I_STEREOCONVERSION_BUG2 == 1 )
 2881|       |                                /* (2008-04-02)   1=> Fix bug of i2i conversion SAbs-->(SRel||Srac) */
 2882|       |                                /*                    (converter skipped empty '/t' or sometimes produced an excess one */
 2883|       |
 2884|       |                                /* check whether t stereo is actually present */
 2885|    130|                                int bHave_t_stereo = 1;
 2886|    130|                                if (pInChI->Stereo)
  ------------------
  |  Branch (2886:37): [True: 42, False: 88]
  ------------------
 2887|     42|                                    bHave_t_stereo = pInChI->Stereo->nNumberOfStereoCenters;
 2888|       |                                /* account for stereobonds present */
 2889|    130|                                if (bHave_t_stereo < 1)
  ------------------
  |  Branch (2889:37): [True: 42, False: 88]
  ------------------
 2890|     42|                                    if (pInChI->Stereo->nNumberOfStereoBonds > 0)
  ------------------
  |  Branch (2890:41): [True: 4, False: 38]
  ------------------
 2891|      4|                                        bHave_t_stereo = 1;
 2892|       |                                /* copy stereo anyway ... */
 2893|    130|#endif
 2894|    130|                                if (0 > (ret2 = CopySegment(pInChI, pAltInChI, CPY_SP3, 0, 0)) ||
  ------------------
  |  Branch (2894:37): [True: 0, False: 130]
  ------------------
 2895|    130|                                    ((!pInChI->Stereo->nCompInv2Abs || NO_VALUE_INT == pInChI->Stereo->nCompInv2Abs) &&
  ------------------
  |  |   23|     28|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2895:39): [True: 102, False: 28]
  |  Branch (2895:72): [True: 28, False: 0]
  ------------------
 2896|    130|                                        0 > (ret2 = CopySegment(pInChI, pAltInChI, CPY_SP3_M, 0, 0)))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2896:41): [True: 0, False: 130]
  ------------------
 2897|      0|                                {
 2898|      0|                                    goto exit_function;
 2899|      0|                                }
 2900|       |
 2901|    130|#if ( FIX_I2I_STEREOCONVERSION_BUG2 == 1 )
 2902|       |                                /* ... correct just copied stereo if applicable */
 2903|    130|                                if ((s[iINChI][j][0] < 1) &&
  ------------------
  |  Branch (2903:37): [True: 118, False: 12]
  ------------------
 2904|    118|                                    (bHave_t_stereo < 1) &&
  ------------------
  |  Branch (2904:37): [True: 38, False: 80]
  ------------------
 2905|     38|                                    (pAltInChI->Stereo->nNumberOfStereoCenters > 0) &&
  ------------------
  |  Branch (2905:37): [True: 38, False: 0]
  ------------------
 2906|     38|                                    (s[iINChI][jAlt][0] < 1))
  ------------------
  |  Branch (2906:37): [True: 36, False: 2]
  ------------------
 2907|     36|                                {
 2908|       |                                    /* (2010-02-28) if not all stereo centers are unknown/undefined */
 2909|       |                                    /*  at which condition stereo still should present .. */
 2910|     36|                                    int all_UU = 1;
 2911|     40|                                    for (kc = 0; kc < pAltInChI->Stereo->nNumberOfStereoCenters; kc++)
  ------------------
  |  Branch (2911:50): [True: 38, False: 2]
  ------------------
 2912|     38|                                    {
 2913|     38|                                        if ((pAltInChI->Stereo->t_parity[kc] != AB_PARITY_UNKN) &&
  ------------------
  |  |  221|     38|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
  |  Branch (2913:45): [True: 36, False: 2]
  ------------------
 2914|     36|                                            (pAltInChI->Stereo->t_parity[kc] != AB_PARITY_UNDF))
  ------------------
  |  |  222|     36|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2914:45): [True: 34, False: 2]
  ------------------
 2915|     34|                                        {
 2916|     34|                                            all_UU = 0;
 2917|     34|                                            break;
 2918|     34|                                        }
 2919|     38|                                    }
 2920|     36|                                    if (!all_UU)
  ------------------
  |  Branch (2920:41): [True: 34, False: 2]
  ------------------
 2921|     34|                                        pInChI->Stereo->nNumberOfStereoCenters = 0;
 2922|     36|                                }
 2923|    130|#endif
 2924|       |
 2925|       |                                /* in case of missing nCompInv2Abs, 2005-05-10 */
 2926|    130|                                if ((pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT) &&
  ------------------
  |  |   23|    130|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2926:37): [True: 130, False: 0]
  ------------------
 2927|    130|                                    (nFlagsAlt & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)))
  ------------------
  |  |  121|    130|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                  (nFlagsAlt & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)))
  ------------------
  |  |  122|    130|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2927:37): [True: 50, False: 80]
  ------------------
 2928|     50|                                {
 2929|     50|                                    if (s[iINChI][jAlt][0] > 0 && s[iINChI][j][0] > 0)
  ------------------
  |  Branch (2929:41): [True: 18, False: 32]
  |  Branch (2929:67): [True: 4, False: 14]
  ------------------
 2930|      4|                                    {
 2931|       |                                        /* suppose once in a while only non-taut stereo changes if inverted */
 2932|      4|                                        pAltInChI->Stereo->nCompInv2Abs = (++nMH2FH_AltInv) % 2 ? 2 : 0;
  ------------------
  |  Branch (2932:75): [True: 2, False: 2]
  ------------------
 2933|      4|                                        pInChI->Stereo->nCompInv2Abs = 2;
 2934|      4|                                    }
 2935|     46|                                    else
 2936|     46|                                    {
 2937|       |                                        /* 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 */
 2938|       |                                        /* Mobile-H /sN was caused by another component that would have same /mN in all layers */
 2939|       |                                        /* therefore, in case of Abs. Stereo, Mobile-H stereo isotopic stereo would have /m1 */
 2940|       |                                        /* In case of Rel/Rac stereo, since no /m1 could occur in Mobile-H isotopic, */
 2941|       |                                        /* no pAltInChI->StereoIsotopic or pInChI->StereoIsotopic have been created yet. */
 2942|       |                                        /* added 10-11-2007 to fix i2i bug for Rel/Rac stereo */
 2943|     46|                                        if (nNumComponents[iINChI][j] > 1 &&
  ------------------
  |  Branch (2943:45): [True: 32, False: 14]
  ------------------
 2944|     32|                                            bNo_InChI_t && bNo_InChI_m /* no /t... or /mN in Fixed-H  */ && !nFlags &&
  ------------------
  |  Branch (2944:45): [True: 32, False: 0]
  |  Branch (2944:60): [True: 32, False: 0]
  |  Branch (2944:109): [True: 26, False: 6]
  ------------------
 2945|     26|                                            !(pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->t_parity) &&
  ------------------
  |  Branch (2945:47): [True: 10, False: 16]
  |  Branch (2945:76): [True: 8, False: 2]
  ------------------
 2946|     18|                                            !(pInChI->StereoIsotopic && pInChI->StereoIsotopic->t_parity) &&
  ------------------
  |  Branch (2946:47): [True: 0, False: 18]
  |  Branch (2946:73): [True: 0, False: 0]
  ------------------
 2947|     18|                                            s[iINChI][j][0] == 0 && s[iINChI][j][1] == 0 &&
  ------------------
  |  Branch (2947:45): [True: 18, False: 0]
  |  Branch (2947:69): [True: 18, False: 0]
  ------------------
 2948|       |                                            /* /sN, N=2 or 3 only in Mobile-H AND Mobile-H isotopic */
 2949|     18|                                            (s[iINChI][jAlt][0] & ((INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO))) &&
  ------------------
  |  |  121|     18|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                          (s[iINChI][jAlt][0] & ((INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO))) &&
  ------------------
  |  |  122|     18|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2949:45): [True: 12, False: 6]
  ------------------
 2950|     12|                                            (s[iINChI][jAlt][1] & ((INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO))))
  ------------------
  |  |  121|     12|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                          (s[iINChI][jAlt][1] & ((INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO))))
  ------------------
  |  |  122|     12|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2950:45): [True: 0, False: 12]
  ------------------
 2951|      0|                                        {
 2952|      0|                                            if (bIso)
  ------------------
  |  Branch (2952:49): [True: 0, False: 0]
  ------------------
 2953|      0|                                            {
 2954|       |                                                /* create two zero/NULL-initialized isotopic stereo if they do not exist */
 2955|      0|                                                if ((!pInChI->StereoIsotopic && 0 > (ret2 = CopySegment(pInChI, pAltInChI, CPY_SP3_M, 1, -1)))
  ------------------
  |  Branch (2955:54): [True: 0, False: 0]
  |  Branch (2955:81): [True: 0, False: 0]
  ------------------
 2956|       |                                                    /* -- the following will be created later, in TAUT_YES part of the code -- */
 2957|      0|                                                    || (!pAltInChI->StereoIsotopic && 0 > (ret2 = CopySegment(pAltInChI, pAltInChI, CPY_SP3_M, 1, -1)))) /* djb-rwth: addressing LLVM warnings */ /* djb-rwth: addressing coverity ID #499533 -- unresolved issue -- revision required */
  ------------------
  |  Branch (2957:57): [True: 0, False: 0]
  |  Branch (2957:87): [True: 0, False: 0]
  ------------------
 2958|      0|                                                {
 2959|      0|                                                    goto exit_function;
 2960|      0|                                                }
 2961|       |                                                /* same value = 2 for MI and FI; here we assign only FI */
 2962|      0|                                                pInChI->StereoIsotopic->nCompInv2Abs = 2;
 2963|      0|                                                pInChI->Stereo->nCompInv2Abs = 0;
 2964|       |                                                /* -- the following will NOT be assigned later, in TAUT_YES part of the code -- */
 2965|      0|                                                pAltInChI->StereoIsotopic->nCompInv2Abs = 2;
 2966|      0|                                                pAltInChI->Stereo->nCompInv2Abs = 0;
 2967|       |                                                /* */
 2968|      0|                                            }
 2969|      0|                                            else
 2970|      0|                                            {
 2971|      0|                                                if (NO_VALUE_INT == pInChI->Stereo->nCompInv2Abs &&
  ------------------
  |  |   23|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2971:53): [True: 0, False: 0]
  ------------------
 2972|      0|                                                    NO_VALUE_INT == pAltInChI->Stereo->nCompInv2Abs)
  ------------------
  |  |   23|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2972:53): [True: 0, False: 0]
  ------------------
 2973|      0|                                                {
 2974|      0|                                                    pInChI->Stereo->nCompInv2Abs = 2;
 2975|      0|                                                    pAltInChI->Stereo->nCompInv2Abs = 2;
 2976|      0|                                                }
 2977|      0|                                            }
 2978|      0|                                        }
 2979|     46|                                        else
 2980|     46|                                        {
 2981|     46|                                            if ((s[iINChI][jAlt][0] > 0 || s[iINChI][j][0] > 0) && s[iINChI][j][0] >= 0)
  ------------------
  |  Branch (2981:50): [True: 14, False: 32]
  |  Branch (2981:76): [True: 8, False: 24]
  |  Branch (2981:100): [True: 22, False: 0]
  ------------------
 2982|     22|                                            {
 2983|     22|                                                pInChI->Stereo->nCompInv2Abs = 2;
 2984|     22|                                            }
 2985|     24|                                            else
 2986|     24|                                            {
 2987|       |                                                /* Mobile-H: /t..., no /sN; Mobile-H isotopic: /s2 or /s3, not /t; Fixed-H layer is present, has no /t, no /i/t */
 2988|       |                                                /* therefore, in case of Abs. Stereo, Mobile-H stereo isotopic stereo would have /m1 */
 2989|       |                                                /* In case of Rel/Rac stereo, since no /m1 could occur in Mobile-H isotopic, */
 2990|       |                                                /* no pAltInChI->StereoIsotopic or pInChI->StereoIsotopic have been created yet. */
 2991|       |                                                /* added 10-10-2007 to fix i2i bug for Rel/Rac stereo */
 2992|     24|                                                if (bIso && bNo_InChI_t && bNo_InChI_m /* no /t... or /mN in Fixed-H  */ && !nFlags &&
  ------------------
  |  Branch (2992:53): [True: 16, False: 8]
  |  Branch (2992:61): [True: 16, False: 0]
  |  Branch (2992:76): [True: 16, False: 0]
  |  Branch (2992:125): [True: 16, False: 0]
  ------------------
 2993|     16|                                                    !(pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->t_parity) &&
  ------------------
  |  Branch (2993:55): [True: 14, False: 2]
  |  Branch (2993:84): [True: 8, False: 6]
  ------------------
 2994|      8|                                                    !(pInChI->StereoIsotopic && pInChI->StereoIsotopic->t_parity) &&
  ------------------
  |  Branch (2994:55): [True: 4, False: 4]
  |  Branch (2994:81): [True: 2, False: 2]
  ------------------
 2995|      6|                                                    s[iINChI][jAlt][0] == 0 && s[iINChI][j][0] == 0 && s[iINChI][j][1] == 0 &&
  ------------------
  |  Branch (2995:53): [True: 6, False: 0]
  |  Branch (2995:80): [True: 6, False: 0]
  |  Branch (2995:104): [True: 6, False: 0]
  ------------------
 2996|       |                                                    /* /sN, N=2 or 3 only in Mobile-H isotopic */
 2997|      6|                                                    (s[iINChI][jAlt][1] & ((INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO))))
  ------------------
  |  |  121|      6|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                                  (s[iINChI][jAlt][1] & ((INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO))))
  ------------------
  |  |  122|      6|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2997:53): [True: 6, False: 0]
  ------------------
 2998|      6|                                                {
 2999|       |                                                    /* create two zero/NULL-initialized isotopic stereo if they do not exist */
 3000|      6|                                                    if (!pInChI->StereoIsotopic && 0 > (ret2 = CopySegment(pInChI, pAltInChI, CPY_SP3_M, 1, -1))
  ------------------
  |  Branch (3000:57): [True: 4, False: 2]
  |  Branch (3000:84): [True: 0, False: 4]
  ------------------
 3001|       |                                                        /* -- the following will be created later, in TAUT_YES part of the code -- */
 3002|      6|                                                        /*|| !pAltInChI->StereoIsotopic && 0 > (ret2 = CopySegment( pAltInChI, pAltInChI, CPY_SP3_M, 1, -1))*/)
 3003|      0|                                                    {
 3004|      0|                                                        goto exit_function;
 3005|      0|                                                    }
 3006|       |                                                    /* same value = 2 for MI and FI; here we assign only FI */
 3007|      6|                                                    pInChI->StereoIsotopic->nCompInv2Abs = 2;
 3008|      6|                                                    pInChI->Stereo->nCompInv2Abs = 0;
 3009|       |                                                    /* -- the following will be assigned later, in TAUT_YES part of the code -- */
 3010|       |                                                    /*
 3011|       |                                                    pAltInChI->StereoIsotopic->nCompInv2Abs = 2;
 3012|       |                                                    pAltInChI->Stereo->nCompInv2Abs = 0;
 3013|       |                                                    */
 3014|      6|                                                }
 3015|     18|                                                else
 3016|     18|                                                {
 3017|     18|                                                    pInChI->Stereo->nCompInv2Abs = 0;
 3018|     18|                                                }
 3019|     24|                                            }
 3020|     46|                                        }
 3021|     46|                                    }
 3022|     50|                                    if (!(pInChI->nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)))
  ------------------
  |  |  121|     50|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                  if (!(pInChI->nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)))
  ------------------
  |  |  122|     50|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (3022:41): [True: 0, False: 50]
  ------------------
 3023|      0|                                    {
 3024|      0|                                        pInChI->nFlags |= ((nFlagsAlt | nFlags) & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO));
  ------------------
  |  |  121|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                      pInChI->nFlags |= ((nFlagsAlt | nFlags) & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO));
  ------------------
  |  |  122|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
 3025|      0|                                    }
 3026|     50|                                }
 3027|    130|                            }
 3028|  32.9k|                            else
 3029|  32.9k|                            {
 3030|       |                                /* copy sp3 inversion info: non-isotopic Mobile H => non-isotopic Fixed H  */
 3031|  32.9k|                                if (pAltInChI->Stereo && pAltInChI->Stereo->nNumberOfStereoCenters &&
  ------------------
  |  Branch (3031:37): [True: 407, False: 32.5k]
  |  Branch (3031:58): [True: 83, False: 324]
  ------------------
 3032|     83|                                    pInChI->Stereo && pInChI->Stereo->nNumberOfStereoCenters &&
  ------------------
  |  Branch (3032:37): [True: 83, False: 0]
  |  Branch (3032:55): [True: 54, False: 29]
  ------------------
 3033|     54|                                    pAltInChI->Stereo->nCompInv2Abs &&
  ------------------
  |  Branch (3033:37): [True: 48, False: 6]
  ------------------
 3034|     48|                                    (!pInChI->Stereo->nCompInv2Abs || NO_VALUE_INT == pInChI->Stereo->nCompInv2Abs))
  ------------------
  |  |   23|     16|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3034:38): [True: 32, False: 16]
  |  Branch (3034:71): [True: 0, False: 16]
  ------------------
 3035|     32|                                {
 3036|     32|                                    if (!(nFlagsAlt && !nFlags) || NO_VALUE_INT == pInChI->Stereo->nCompInv2Abs)
  ------------------
  |  |   23|      6|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3036:43): [True: 6, False: 26]
  |  Branch (3036:56): [True: 6, False: 0]
  |  Branch (3036:68): [True: 0, False: 6]
  ------------------
 3037|     26|                                    {
 3038|       |                                        /* ??? */
 3039|     26|                                        pInChI->Stereo->nCompInv2Abs = pAltInChI->Stereo->nCompInv2Abs;
 3040|     26|                                    }
 3041|     32|                                }
 3042|  32.9k|                            }
 3043|       |
 3044|       |                            /* use same rule to copy stereobonds */
 3045|  33.1k|                            if (pAltInChI->Stereo && pAltInChI->Stereo->nNumberOfStereoBonds &&
  ------------------
  |  Branch (3045:33): [True: 537, False: 32.5k]
  |  Branch (3045:54): [True: 174, False: 363]
  ------------------
 3046|    174|                                (!pInChI->Stereo || !pInChI->Stereo->b_parity))
  ------------------
  |  Branch (3046:34): [True: 51, False: 123]
  |  Branch (3046:53): [True: 6, False: 117]
  ------------------
 3047|     57|                            {
 3048|     57|                                if (0 > (ret2 = CopySegment(pInChI, pAltInChI, CPY_SP2, 0, 0)))
  ------------------
  |  Branch (3048:37): [True: 0, False: 57]
  ------------------
 3049|      0|                                {
 3050|      0|                                    goto exit_function;
 3051|      0|                                }
 3052|     57|                            }
 3053|       |                            /* (3) isotopic Mobile H -> isotopic Fixed H */
 3054|       |                            /* if !FH_Stereo && !MH_Stereo && MH_IsoStereo!=NULL && FH_IsoStereo==NULL */
 3055|  33.1k|                            if (bIso)
  ------------------
  |  Branch (3055:33): [True: 375, False: 32.7k]
  ------------------
 3056|    375|                            {
 3057|    375|                                if (!(pInChI->Stereo && pInChI->Stereo->t_parity) &&                                    /* !FH_Stereo */
  ------------------
  |  Branch (3057:39): [True: 158, False: 217]
  |  Branch (3057:57): [True: 126, False: 32]
  ------------------
 3058|    249|                                    !(pAltInChI->Stereo && pAltInChI->Stereo->t_parity) &&                              /* !MH_Stereo */
  ------------------
  |  Branch (3058:39): [True: 42, False: 207]
  |  Branch (3058:60): [True: 21, False: 21]
  ------------------
 3059|    228|                                    (pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->nNumberOfStereoCenters) && /*  MH_IsoStereo */
  ------------------
  |  Branch (3059:38): [True: 37, False: 191]
  |  Branch (3059:67): [True: 28, False: 9]
  ------------------
 3060|     28|                                    (!pInChI->StereoIsotopic || !pInChI->StereoIsotopic->t_parity))
  ------------------
  |  Branch (3060:38): [True: 17, False: 11]
  |  Branch (3060:65): [True: 3, False: 8]
  ------------------
 3061|     20|                                {
 3062|       |                                    /* !FH_IsoStereo */
 3063|       |                                    /* copy sp3 iso stereo MI->FI (/t) and, if FH nCompInv2Abs (/m) is missing, copy it, too, MI->FI */
 3064|     20|                                    if (0 > (ret2 = CopySegment(pInChI, pAltInChI, CPY_SP3, 1, 1)) ||
  ------------------
  |  Branch (3064:41): [True: 0, False: 20]
  ------------------
 3065|     20|                                        ((!pInChI->StereoIsotopic->nCompInv2Abs || NO_VALUE_INT == pInChI->StereoIsotopic->nCompInv2Abs) &&
  ------------------
  |  |   23|      3|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3065:43): [True: 17, False: 3]
  |  Branch (3065:84): [True: 3, False: 0]
  ------------------
 3066|     20|                                            0 > (ret2 = CopySegment(pInChI, pAltInChI, CPY_SP3_M, 1, 1)))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3066:45): [True: 0, False: 20]
  ------------------
 3067|      0|                                    {
 3068|      0|                                        goto exit_function;
 3069|      0|                                    }
 3070|       |                                    /* in case of missing nCompInv2Abs, Relative or Racemic stereo 2005-05-10 */
 3071|     20|                                    if (pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT &&
  ------------------
  |  |   23|     40|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3071:41): [True: 20, False: 0]
  ------------------
 3072|     20|                                        (nFlagsAlt & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)))
  ------------------
  |  |  121|     20|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                      (nFlagsAlt & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)))
  ------------------
  |  |  122|     20|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (3072:41): [True: 6, False: 14]
  ------------------
 3073|      6|                                    {
 3074|      6|                                        pInChI->StereoIsotopic->nCompInv2Abs = s[iINChI][jAlt][1] > 0 ? 2 : 0;
  ------------------
  |  Branch (3074:80): [True: 6, False: 0]
  ------------------
 3075|      6|                                        if (!(pInChI->nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)))
  ------------------
  |  |  121|      6|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                      if (!(pInChI->nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)))
  ------------------
  |  |  122|      6|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (3075:45): [True: 0, False: 6]
  ------------------
 3076|      0|                                        {
 3077|      0|                                            pInChI->nFlags |= (nFlagsAlt & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO));
  ------------------
  |  |  121|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                          pInChI->nFlags |= (nFlagsAlt & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO));
  ------------------
  |  |  122|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
 3078|      0|                                        }
 3079|      6|                                    }
 3080|     20|                                }
 3081|    355|                                else
 3082|    355|                                {
 3083|       |                                    /* copy sp3 inversion info only: isotopic Mobile H -> isotopic Fixed H  */
 3084|    355|                                    if (!(pInChI->Stereo && pInChI->Stereo->t_parity) &&                                     /* !FH_Stereo    /t */
  ------------------
  |  Branch (3084:43): [True: 148, False: 207]
  |  Branch (3084:61): [True: 126, False: 22]
  ------------------
 3085|    229|                                        !(pAltInChI->Stereo && pAltInChI->Stereo->t_parity) &&                               /* !MH_Stereo    /t */
  ------------------
  |  Branch (3085:43): [True: 32, False: 197]
  |  Branch (3085:64): [True: 21, False: 11]
  ------------------
 3086|    208|                                        (pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->nNumberOfStereoCenters) &&  /*  MH_IsoStereo /t */
  ------------------
  |  Branch (3086:42): [True: 17, False: 191]
  |  Branch (3086:71): [True: 8, False: 9]
  ------------------
 3087|      8|                                        (pInChI->StereoIsotopic && pInChI->StereoIsotopic->nNumberOfStereoCenters) &&        /*  FH_IsoStereo /t */
  ------------------
  |  Branch (3087:42): [True: 8, False: 0]
  |  Branch (3087:68): [True: 7, False: 1]
  ------------------
 3088|      7|                                        pAltInChI->StereoIsotopic->nCompInv2Abs &&                                           /*  MH_IsoStereo /m */
  ------------------
  |  Branch (3088:41): [True: 7, False: 0]
  ------------------
 3089|      7|                                        (!pInChI->StereoIsotopic->nCompInv2Abs || NO_VALUE_INT == pInChI->StereoIsotopic->nCompInv2Abs))
  ------------------
  |  |   23|      5|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3089:42): [True: 2, False: 5]
  |  Branch (3089:83): [True: 3, False: 2]
  ------------------
 3090|      5|                                    {
 3091|       |                                        /*  !FH_IsoStereo /m */
 3092|       |                                        /* added 02-09-2006 */
 3093|      5|                                        if (0 > (ret2 = CopySegment(pInChI, pAltInChI, CPY_SP3_M, 1, 1)))
  ------------------
  |  Branch (3093:45): [True: 0, False: 5]
  ------------------
 3094|      0|                                        {
 3095|      0|                                            goto exit_function;
 3096|      0|                                        }
 3097|      5|                                    }
 3098|    355|                                }
 3099|       |                                /* use same rule to copy stereobonds */
 3100|    375|                                if (!(pInChI->Stereo && pInChI->Stereo->b_parity) &&
  ------------------
  |  Branch (3100:39): [True: 158, False: 217]
  |  Branch (3100:57): [True: 28, False: 130]
  ------------------
 3101|    347|                                    !(pAltInChI->Stereo && pAltInChI->Stereo->b_parity) &&
  ------------------
  |  Branch (3101:39): [True: 71, False: 276]
  |  Branch (3101:60): [True: 2, False: 69]
  ------------------
 3102|    345|                                    (pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->nNumberOfStereoBonds) &&
  ------------------
  |  Branch (3102:38): [True: 94, False: 251]
  |  Branch (3102:67): [True: 8, False: 86]
  ------------------
 3103|      8|                                    (!pInChI->StereoIsotopic || !pInChI->StereoIsotopic->b_parity))
  ------------------
  |  Branch (3103:38): [True: 6, False: 2]
  |  Branch (3103:65): [True: 2, False: 0]
  ------------------
 3104|      8|                                {
 3105|      8|                                    if (0 > (ret2 = CopySegment(pInChI, pAltInChI, CPY_SP2, 1, 1)))
  ------------------
  |  Branch (3105:41): [True: 0, False: 8]
  ------------------
 3106|      0|                                    {
 3107|      0|                                        goto exit_function;
 3108|      0|                                    }
 3109|      8|                                }
 3110|       |
 3111|       |                                /* (4) Copy Fixed-H -> isotopic Fixed-H */
 3112|       |                                /* if FH_Stereo && !MH_IsoStereo && && !FH_IsoStereo */
 3113|    375|                                if ((pInChI->Stereo && pInChI->Stereo->nNumberOfStereoCenters) &&              /* FH_Stereo     /t */
  ------------------
  |  Branch (3113:38): [True: 158, False: 217]
  |  Branch (3113:56): [True: 106, False: 52]
  ------------------
 3114|    106|                                    !(pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->t_parity) &&     /* !MH_IsoStereo /t */
  ------------------
  |  Branch (3114:39): [True: 43, False: 63]
  |  Branch (3114:68): [True: 33, False: 10]
  ------------------
 3115|     73|                                    !(pInChI->StereoIsotopic && pInChI->StereoIsotopic->t_parity))
  ------------------
  |  Branch (3115:39): [True: 71, False: 2]
  |  Branch (3115:65): [True: 65, False: 6]
  ------------------
 3116|      8|                                {
 3117|       |                                    /* !FH_IsoStereo /t */
 3118|       |
 3119|       |                                    /* added 10-10-2007 DT: copy MH_Iso /m => FH_Iso /m to fix i2i bug for Abs stereo */
 3120|       |                                    /* InChI string contains: MH(/t...), MH_Iso(/mN, no /t), FH(no /t /m), FH_Iso(no /t /m) */
 3121|      8|                                    if (pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->nCompInv2Abs && /* MH_IsoStereo /m */
  ------------------
  |  Branch (3121:41): [True: 6, False: 2]
  |  Branch (3121:70): [True: 4, False: 2]
  ------------------
 3122|      4|                                        bNo_InChI_t &&
  ------------------
  |  Branch (3122:41): [True: 4, False: 0]
  ------------------
 3123|      4|                                        NO_VALUE_INT != pAltInChI->StereoIsotopic->nCompInv2Abs &&              /* undef FH_IsoStereo /m */
  ------------------
  |  |   23|      4|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3123:41): [True: 0, False: 4]
  ------------------
 3124|      0|                                        !(pInChI->StereoIsotopic && NO_VALUE_INT != pInChI->StereoIsotopic->nCompInv2Abs))
  ------------------
  |  |   23|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3124:43): [True: 0, False: 0]
  |  Branch (3124:69): [True: 0, False: 0]
  ------------------
 3125|      0|                                    {
 3126|      0|                                        if (0 > (ret2 = CopySegment(pInChI, pAltInChI, CPY_SP3_M, 1, 1)))
  ------------------
  |  Branch (3126:45): [True: 0, False: 0]
  ------------------
 3127|      0|                                        {
 3128|      0|                                            goto exit_function;
 3129|      0|                                        }
 3130|      0|                                    }
 3131|       |
 3132|       |                                    /* added 05-09-2006: copy sp3 FH=>FH_Iso */
 3133|      8|                                    if (0 > (ret2 = CopySegment(pInChI, pInChI, CPY_SP3, 1, 0)) ||
  ------------------
  |  Branch (3133:41): [True: 0, False: 8]
  ------------------
 3134|      8|                                        ((!pInChI->StereoIsotopic->nCompInv2Abs || NO_VALUE_INT == pInChI->StereoIsotopic->nCompInv2Abs) &&
  ------------------
  |  |   23|      6|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3134:43): [True: 2, False: 6]
  |  Branch (3134:84): [True: 0, False: 6]
  ------------------
 3135|      2|                                            0 > (ret2 = CopySegment(pInChI, pInChI, CPY_SP3_M, 1, 0)))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3135:45): [True: 0, False: 2]
  ------------------
 3136|      0|                                    {
 3137|      0|                                        goto exit_function;
 3138|      0|                                    }
 3139|       |
 3140|       |                                    /* in case of missing nCompInv2Abs, Relative or Racemic stereo, /sN in Fixed-H, 2005-05-10 */
 3141|      8|                                    if (pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT &&
  ------------------
  |  |   23|     16|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3141:41): [True: 0, False: 8]
  ------------------
 3142|      0|                                        (nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)))
  ------------------
  |  |  121|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                      (nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)))
  ------------------
  |  |  122|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (3142:41): [True: 0, False: 0]
  ------------------
 3143|      0|                                    {
 3144|      0|                                        if (s[iINChI][j][0] > 0 && s[iINChI][j][1] > 0)
  ------------------
  |  Branch (3144:45): [True: 0, False: 0]
  |  Branch (3144:68): [True: 0, False: 0]
  ------------------
 3145|      0|                                        {
 3146|       |                                            /* suppose once in a while only non-taut stereo changes if inverted */
 3147|      0|                                            pInChI->StereoIsotopic->nCompInv2Abs = 2;
 3148|      0|                                            pInChI->Stereo->nCompInv2Abs = (++nFH2iFH_AltInv) % 2 ? 2 : 0;
  ------------------
  |  Branch (3148:76): [True: 0, False: 0]
  ------------------
 3149|      0|                                        }
 3150|      0|                                        else
 3151|      0|                                        {
 3152|      0|                                            if ((s[iINChI][j][0] > 0 || s[iINChI][j][1] > 0) && s[iINChI][j][1] >= 0) /* ??? != NO_VALUE_INT ??? */
  ------------------
  |  Branch (3152:50): [True: 0, False: 0]
  |  Branch (3152:73): [True: 0, False: 0]
  |  Branch (3152:97): [True: 0, False: 0]
  ------------------
 3153|      0|                                            {
 3154|      0|                                                pInChI->StereoIsotopic->nCompInv2Abs = 2;
 3155|      0|                                            }
 3156|      0|                                            else
 3157|      0|                                            {
 3158|      0|                                                pInChI->StereoIsotopic->nCompInv2Abs = 0;
 3159|      0|                                            }
 3160|      0|                                        }
 3161|      0|                                        if (!(pInChI->nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)))
  ------------------
  |  |  121|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                      if (!(pInChI->nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO)))
  ------------------
  |  |  122|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (3161:45): [True: 0, False: 0]
  ------------------
 3162|      0|                                        {
 3163|      0|                                            pInChI->nFlags |= (nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO));
  ------------------
  |  |  121|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                          pInChI->nFlags |= (nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO));
  ------------------
  |  |  122|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
 3164|      0|                                        }
 3165|      0|                                    }
 3166|      8|                                }
 3167|    367|                                else
 3168|    367|                                {
 3169|       |                                    /* copy sp3 inversion info only: Fixed-H -> isotopic Fixed H  */
 3170|    367|                                    if ((pInChI->Stereo && pInChI->Stereo->t_parity) &&
  ------------------
  |  Branch (3170:42): [True: 150, False: 217]
  |  Branch (3170:60): [True: 118, False: 32]
  ------------------
 3171|    118|                                        !(pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->t_parity) &&
  ------------------
  |  Branch (3171:43): [True: 53, False: 65]
  |  Branch (3171:72): [True: 33, False: 20]
  ------------------
 3172|     85|                                        (pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->nNumberOfStereoCenters) &&
  ------------------
  |  Branch (3172:42): [True: 20, False: 65]
  |  Branch (3172:71): [True: 0, False: 20]
  ------------------
 3173|      0|                                        (pInChI->StereoIsotopic && pInChI->StereoIsotopic->nNumberOfStereoCenters) &&
  ------------------
  |  Branch (3173:42): [True: 0, False: 0]
  |  Branch (3173:68): [True: 0, False: 0]
  ------------------
 3174|      0|                                        pInChI->Stereo->nCompInv2Abs &&
  ------------------
  |  Branch (3174:41): [True: 0, False: 0]
  ------------------
 3175|      0|                                        (!pInChI->StereoIsotopic->nCompInv2Abs || NO_VALUE_INT == pInChI->StereoIsotopic->nCompInv2Abs))
  ------------------
  |  |   23|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3175:42): [True: 0, False: 0]
  |  Branch (3175:83): [True: 0, False: 0]
  ------------------
 3176|      0|                                    {
 3177|       |                                        /* added 05-09-2006 */
 3178|      0|                                        if (0 > (ret2 = CopySegment(pInChI, pInChI, CPY_SP3_M, 1, 0)))
  ------------------
  |  Branch (3178:45): [True: 0, False: 0]
  ------------------
 3179|      0|                                        {
 3180|      0|                                            goto exit_function;
 3181|      0|                                        }
 3182|      0|                                    }
 3183|    367|                                }
 3184|    375|                            }
 3185|  33.1k|                            if (bIso &&
  ------------------
  |  Branch (3185:33): [True: 375, False: 32.7k]
  ------------------
 3186|    375|                                !(pInChI->Stereo && pInChI->Stereo->nNumberOfStereoBonds) &&
  ------------------
  |  Branch (3186:35): [True: 158, False: 217]
  |  Branch (3186:53): [True: 22, False: 136]
  ------------------
 3187|    353|                                !(pAltInChI->Stereo && pAltInChI->Stereo->nNumberOfStereoBonds) &&
  ------------------
  |  Branch (3187:35): [True: 75, False: 278]
  |  Branch (3187:56): [True: 2, False: 73]
  ------------------
 3188|    351|                                (pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->nNumberOfStereoBonds) &&
  ------------------
  |  Branch (3188:34): [True: 99, False: 252]
  |  Branch (3188:63): [True: 10, False: 89]
  ------------------
 3189|     10|                                (!pInChI->StereoIsotopic || !pInChI->StereoIsotopic->b_parity))
  ------------------
  |  Branch (3189:34): [True: 2, False: 8]
  |  Branch (3189:61): [True: 0, False: 8]
  ------------------
 3190|      2|                            {
 3191|      2|                                if (0 > (ret2 = CopySegment(pInChI, pAltInChI, CPY_SP2, 1, 1)))
  ------------------
  |  Branch (3191:37): [True: 0, False: 2]
  ------------------
 3192|      0|                                {
 3193|      0|                                    goto exit_function;
 3194|      0|                                }
 3195|      2|                            }
 3196|  33.1k|                        }
 3197|   277k|                    }
 3198|   277k|                } /* end of component cycle (k) */
 3199|  41.1k|            } /* end of Mobile/Fixed H cycle (j) */
 3200|       |
 3201|       |              /**** replace NO_VALUE_INT with zeroes in all Mobile & Fixed H components ****/
 3202|  61.6k|            for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  573|  61.6k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3202:25): [True: 41.1k, False: 20.5k]
  ------------------
 3203|  41.1k|            {
 3204|   318k|                for (k = 0; k < nNumComponents[iINChI][j]; k++)
  ------------------
  |  Branch (3204:29): [True: 277k, False: 41.1k]
  ------------------
 3205|   277k|                {
 3206|   277k|                    if (pInpInChI[iINChI][j])
  ------------------
  |  Branch (3206:25): [True: 277k, False: 0]
  ------------------
 3207|   277k|                    {
 3208|   277k|                        INChI* pInChI = &pInpInChI[iINChI][j][k];
 3209|   277k|                        if (pInChI->nTotalCharge == NO_VALUE_INT)
  ------------------
  |  |   23|   277k|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3209:29): [True: 76, False: 277k]
  ------------------
 3210|     76|                        {
 3211|     76|                            pInChI->nTotalCharge = 0;
 3212|     76|                        }
 3213|   277k|                        if (pInChI->Stereo && pInChI->StereoIsotopic &&
  ------------------
  |  Branch (3213:29): [True: 23.0k, False: 254k]
  |  Branch (3213:47): [True: 582, False: 22.4k]
  ------------------
 3214|    582|                            pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   23|    582|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3214:29): [True: 359, False: 223]
  ------------------
 3215|    359|                        {
 3216|    359|                            if (pInChI->Stereo->nNumberOfStereoCenters &&
  ------------------
  |  Branch (3216:33): [True: 131, False: 228]
  ------------------
 3217|    131|                                pInChI->Stereo->nCompInv2Abs != NO_VALUE_INT)
  ------------------
  |  |   23|    131|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3217:33): [True: 14, False: 117]
  ------------------
 3218|     14|                            {
 3219|     14|                                pInChI->StereoIsotopic->nCompInv2Abs = pInChI->Stereo->nCompInv2Abs;
 3220|     14|                            }
 3221|    359|                        }
 3222|       |                        /* Add special nCompInv2Abs=2 to force /s2 or /s3 in InChI output */
 3223|   277k|                        if (pInChI->Stereo && pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   23|  23.0k|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3223:29): [True: 23.0k, False: 254k]
  |  Branch (3223:47): [True: 9.41k, False: 13.5k]
  ------------------
 3224|  9.41k|                        {
 3225|  9.41k|                            if (pInChI->nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO) &&
  ------------------
  |  |  121|  9.41k|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                          if (pInChI->nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO) &&
  ------------------
  |  |  122|  9.41k|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (3225:33): [True: 82, False: 9.33k]
  ------------------
 3226|     82|                                pInChI->Stereo->nNumberOfStereoCenters)
  ------------------
  |  Branch (3226:33): [True: 52, False: 30]
  ------------------
 3227|     52|                            {
 3228|     52|                                pInChI->Stereo->nCompInv2Abs = (s[iINChI][j][0] > 0 /*|| s[iINChI][j][1]>0*/) ? 2 : 0; /* we do not know the real value */
  ------------------
  |  Branch (3228:64): [True: 22, False: 30]
  ------------------
 3229|     52|                            }
 3230|  9.36k|                            else
 3231|  9.36k|                            {
 3232|  9.36k|                                pInChI->Stereo->nCompInv2Abs = 0;
 3233|  9.36k|                            }
 3234|  9.41k|                        }
 3235|   277k|                        if (pInChI->StereoIsotopic && pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   23|  31.2k|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3235:29): [True: 31.2k, False: 246k]
  |  Branch (3235:55): [True: 30.7k, False: 507]
  ------------------
 3236|  30.7k|                        {
 3237|  30.7k|                            if (pInChI->nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO) &&
  ------------------
  |  |  121|  30.7k|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                          if (pInChI->nFlags & (INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO) &&
  ------------------
  |  |  122|  30.7k|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (3237:33): [True: 40, False: 30.7k]
  ------------------
 3238|     40|                                pInChI->StereoIsotopic->nNumberOfStereoCenters)
  ------------------
  |  Branch (3238:33): [True: 22, False: 18]
  ------------------
 3239|     22|                            {
 3240|     22|                                pInChI->StereoIsotopic->nCompInv2Abs = s[iINChI][j][1] > 0 ? 2 : 0; /* we do not know the real value */
  ------------------
  |  Branch (3240:72): [True: 22, False: 0]
  ------------------
 3241|     22|                            }
 3242|  30.7k|                            else
 3243|  30.7k|                            {
 3244|  30.7k|                                pInChI->StereoIsotopic->nCompInv2Abs = 0;
 3245|  30.7k|                            }
 3246|  30.7k|                        }
 3247|       |                        /* added 02-07-2006 */
 3248|   277k|                        if ((pInChI->Stereo && pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT) ||
  ------------------
  |  |   23|  23.0k|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3248:30): [True: 23.0k, False: 254k]
  |  Branch (3248:48): [True: 0, False: 23.0k]
  ------------------
 3249|   277k|                            (pInChI->StereoIsotopic && pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT)) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |   23|  31.2k|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3249:30): [True: 31.2k, False: 246k]
  |  Branch (3249:56): [True: 0, False: 31.2k]
  ------------------
 3250|      0|                        {
 3251|      0|                            ret2 = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3252|      0|                            goto exit_function;
 3253|      0|                        }
 3254|   277k|                        if (!pInChI->bDeleted && pInChI->nNumberOfAtoms)
  ------------------
  |  Branch (3254:29): [True: 277k, False: 33]
  |  Branch (3254:50): [True: 277k, False: 0]
  ------------------
 3255|   277k|                        {
 3256|   277k|                            tot_charge[iINChI][j] += pInChI->nTotalCharge;
 3257|  3.68M|                            for (m = 0; m < pInChI->nNumberOfAtoms; m++)
  ------------------
  |  Branch (3257:41): [True: 3.40M, False: 277k]
  ------------------
 3258|  3.40M|                            {
 3259|  3.40M|                                if (pInChI->nAtom[m] < EL_NUMBER_H || pInChI->nAtom[m] > nElDataLen)
  ------------------
  |  |   11|  6.81M|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
  |  Branch (3259:37): [True: 0, False: 3.40M]
  |  Branch (3259:71): [True: 0, False: 3.40M]
  ------------------
 3260|      0|                                {
 3261|      0|                                    ret2 = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3262|      0|                                    goto exit_function;
 3263|      0|                                }
 3264|       |                                /* all atoms except H */
 3265|  3.40M|                                if (pInChI->nAtom[m] > EL_NUMBER_H)
  ------------------
  |  |   11|  3.40M|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
  |  Branch (3265:37): [True: 3.30M, False: 102k]
  ------------------
 3266|  3.30M|                                {
 3267|  3.30M|                                    num_elem[iINChI][j][pInChI->nAtom[m]].num++;
 3268|  3.30M|                                }
 3269|  3.40M|                            }
 3270|   277k|                            if (0 > (ret2 = GetInChINumH(pInChI, &m)))
  ------------------
  |  Branch (3270:33): [True: 0, False: 277k]
  ------------------
 3271|      0|                            {
 3272|      0|                                goto exit_function;
 3273|      0|                            }
 3274|   277k|                            num_elem[iINChI][j][EL_NUMBER_H].num += m;
  ------------------
  |  |   11|   277k|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
 3275|   277k|                        }
 3276|   277k|                    }
 3277|   277k|                }
 3278|  41.1k|            }
 3279|       |
 3280|  61.6k|            for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  573|  61.6k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3280:25): [True: 41.1k, False: 20.5k]
  ------------------
 3281|  41.1k|            {
 3282|   318k|                for (k = 0; k < nNumComponents[iINChI][j]; k++)
  ------------------
  |  Branch (3282:29): [True: 277k, False: 41.1k]
  ------------------
 3283|   277k|                {
 3284|   277k|                    if (pInpInChI[iINChI][j])
  ------------------
  |  Branch (3284:25): [True: 277k, False: 0]
  ------------------
 3285|   277k|                    {
 3286|   277k|                        INChI* pInChI = &pInpInChI[iINChI][j][k];
 3287|   277k|                        if (pInChI->Stereo && !pInChI->Stereo->nNumberOfStereoCenters)
  ------------------
  |  Branch (3287:29): [True: 23.0k, False: 254k]
  |  Branch (3287:47): [True: 21.8k, False: 1.11k]
  ------------------
 3288|  21.8k|                        {
 3289|  21.8k|                            pInChI->Stereo->nCompInv2Abs = 0;
 3290|  21.8k|                        }
 3291|   277k|                        if (pInChI->StereoIsotopic && !pInChI->StereoIsotopic->nNumberOfStereoCenters)
  ------------------
  |  Branch (3291:29): [True: 31.2k, False: 246k]
  |  Branch (3291:55): [True: 30.9k, False: 394]
  ------------------
 3292|  30.9k|                        {
 3293|  30.9k|                            pInChI->StereoIsotopic->nCompInv2Abs = 0;
 3294|  30.9k|                        }
 3295|   277k|                    }
 3296|   277k|                }
 3297|  41.1k|            }
 3298|       |
 3299|  20.5k|#if ( FIX_I2I_STEREOCONVERSION_BUG3 == 1 )
 3300|       |            /* (2008-04-10)   1=> Fix bug of i2i conversion */
 3301|       |            /* (missed repeating /s in FI after F for multi-component case) */
 3302|  20.5k|            if (nNumComponents[iINChI][TAUT_NON] > 1)                     /* if multi-component */
  ------------------
  |  |  574|  20.5k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3302:17): [True: 189, False: 20.3k]
  ------------------
 3303|    189|            {
 3304|    189|                if (!s[iINChI][TAUT_YES][0] && !s[iINChI][TAUT_YES][1])/* if no /s in M, MI */
  ------------------
  |  |  575|    189|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              if (!s[iINChI][TAUT_YES][0] && !s[iINChI][TAUT_YES][1])/* if no /s in M, MI */
  ------------------
  |  |  575|    168|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3304:21): [True: 168, False: 21]
  |  Branch (3304:48): [True: 136, False: 32]
  ------------------
 3305|    136|                {
 3306|    136|                    if ((s[iINChI][TAUT_NON][0] > 1) && (s[iINChI][TAUT_NON][1] > 1))     /* if /srel/srac in both F, FI */
  ------------------
  |  |  574|    136|#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 */
  ------------------
  |  |  574|      2|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3306:25): [True: 2, False: 134]
  |  Branch (3306:57): [True: 0, False: 2]
  ------------------
 3307|      0|                    {
 3308|      0|                        if (s[iINChI][TAUT_NON][0] == s[iINChI][TAUT_NON][1])  /* if same stereo in F and FI */
  ------------------
  |  |  574|      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 */
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3308:29): [True: 0, False: 0]
  ------------------
 3309|      0|                        {
 3310|       |                            /* we assume that at least one component in F has no actual stereo */
 3311|       |                            /* and place deliberately 0 to appropriate place */
 3312|      0|                            for (k = 0; k < nNumComponents[iINChI][TAUT_NON]; k++)
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3312:41): [True: 0, False: 0]
  ------------------
 3313|      0|                            {
 3314|      0|                                INChI* pInChI = &pInpInChI[iINChI][TAUT_NON][k];
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 3315|      0|                                if (pInChI->Stereo->nCompInv2Abs != 0)
  ------------------
  |  Branch (3315:37): [True: 0, False: 0]
  ------------------
 3316|      0|                                {
 3317|      0|                                    pInChI->Stereo->nCompInv2Abs = 0;
 3318|      0|                                    goto fini;
 3319|      0|                                }
 3320|      0|                            }
 3321|      0|                        }
 3322|      0|                    }
 3323|    136|                }
 3324|    189|            }
 3325|  20.5k|        fini:;
 3326|  20.5k|#endif
 3327|  20.5k|            if (num_elem[iINChI][TAUT_YES])
  ------------------
  |  |  575|  20.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3327:17): [True: 10.3k, False: 10.1k]
  ------------------
 3328|  10.3k|            {
 3329|  10.3k|                tot_charge[iINChI][TAUT_YES] += nNumProtons[iINChI][TAUT_YES].nNumRemovedProtons;
  ------------------
  |  |  575|  10.3k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              tot_charge[iINChI][TAUT_YES] += nNumProtons[iINChI][TAUT_YES].nNumRemovedProtons;
  ------------------
  |  |  575|  10.3k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3330|  10.3k|                num_elem[iINChI][TAUT_YES][EL_NUMBER_H].num += nNumProtons[iINChI][TAUT_YES].nNumRemovedProtons;
  ------------------
  |  |  575|  10.3k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              num_elem[iINChI][TAUT_YES][EL_NUMBER_H].num += nNumProtons[iINChI][TAUT_YES].nNumRemovedProtons;
  ------------------
  |  |   11|  10.3k|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
                              num_elem[iINChI][TAUT_YES][EL_NUMBER_H].num += nNumProtons[iINChI][TAUT_YES].nNumRemovedProtons;
  ------------------
  |  |  575|  10.3k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3331|  10.3k|            }
 3332|       |
 3333|       |            /**** Count H and isotopic H in Mobile and Fixed H represntations of components */
 3334|       |            /* if at least one component has Fixed-H layer then all components have Fixed-H */
 3335|       |            /* layer; those whose Fixed-H layer is empty have Fixed-H layer same as Mobile-H layer */
 3336|  20.5k|            if (nNumComponents[iINChI][TAUT_NON])
  ------------------
  |  |  574|  20.5k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3336:17): [True: 2.66k, False: 17.8k]
  ------------------
 3337|  2.66k|            {
 3338|       |                /* only if both Mobile and Fixed H exist */
 3339|  2.66k|                int nFormulaH[TAUT_NUM], nNumH[TAUT_NUM], nCharge[TAUT_NUM], nNumIsotopicH[TAUT_NUM][NUM_H_ISOTOPES];
 3340|  2.66k|                int nRemovedCharge, nRemovedH, nRemovedIsotopicH[NUM_H_ISOTOPES], nFoundRemovedIsoH;
 3341|  2.66k|                int nTotRemovedProtons, nTotRemovedIsotopicH[NUM_H_ISOTOPES], bExists[TAUT_NUM];
 3342|  2.66k|                INChI* pInChI[TAUT_NUM];
 3343|  2.66k|                nTotRemovedProtons = 0;
 3344|  2.66k|                memset(nTotRemovedIsotopicH, 0, sizeof(nTotRemovedIsotopicH)); /* djb-rwth: memset_s C11/Annex K variant? */
 3345|  2.66k|                len2 = inchi_max(nNumComponents[iINChI][TAUT_YES], nNumComponents[iINChI][TAUT_NON]);
  ------------------
  |  |  138|  2.66k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 4, False: 2.66k]
  |  |  ------------------
  ------------------
 3346|       |
 3347|  36.2k|                for (k = 0; k < len2; k++)
  ------------------
  |  Branch (3347:29): [True: 33.6k, False: 2.60k]
  ------------------
 3348|  33.6k|                {
 3349|       |                    /* k is a component index */
 3350|   101k|                    for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  573|   101k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3350:33): [True: 67.3k, False: 33.6k]
  ------------------
 3351|  67.3k|                    {
 3352|       |                        /* j is 0=TAUT_NON or 1=TAUT_YES */
 3353|  67.3k|                        pInChI[j] = NULL; /* initialization 2006-03 */
 3354|  67.3k|                        bExists[j] = (k < nNumComponents[iINChI][j]) &&
  ------------------
  |  Branch (3354:38): [True: 66.7k, False: 596]
  ------------------
 3355|  66.7k|                            pInpInChI[iINChI][j][k].nNumberOfAtoms &&
  ------------------
  |  Branch (3355:29): [True: 66.7k, False: 0]
  ------------------
 3356|  66.7k|                            !pInpInChI[iINChI][j][k].bDeleted;
  ------------------
  |  Branch (3356:29): [True: 66.7k, False: 17]
  ------------------
 3357|  67.3k|                    }
 3358|  33.6k|                    if (!bExists[TAUT_NON])
  ------------------
  |  |  574|  33.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3358:25): [True: 4, False: 33.6k]
  ------------------
 3359|      4|                    {
 3360|       |                        /* TAUT_YES does not exist for a proton (H+) in TAUT_NON */
 3361|      4|                        ret2 = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      4|#define RI_ERR_SYNTAX  (-2)
  ------------------
 3362|      4|                        goto exit_function;
 3363|      4|                    }
 3364|       |                    /* at this point at least one of Mobile[k] and Fixed[k] real InChI exists */
 3365|       |                    /* initialize for counting removed protons and isotopic H from kth  Mobile-H component */
 3366|   101k|                    for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  573|   101k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3366:33): [True: 67.3k, False: 33.6k]
  ------------------
 3367|  67.3k|                    {
 3368|  67.3k|                        if (bExists[j])
  ------------------
  |  Branch (3368:29): [True: 66.7k, False: 609]
  ------------------
 3369|  66.7k|                        {
 3370|  66.7k|                            pInChI[j] = &pInpInChI[iINChI][j][k];  /* BC: reading uninit memory (fixed?) */
 3371|  66.7k|                        }
 3372|  67.3k|                        nFormulaH[j] = 0;
 3373|  67.3k|                        nNumH[j] = 0;
 3374|  67.3k|                        nCharge[j] = 0;
 3375|   269k|                        for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |   72|   269k|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (3375:37): [True: 202k, False: 67.3k]
  ------------------
 3376|   202k|                        {
 3377|   202k|                            nNumIsotopicH[j][m] = 0;
 3378|   202k|                        }
 3379|  67.3k|                    }
 3380|       |                    /* extract number of H, isotopic H, and charge */
 3381|   101k|                    for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  573|   101k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3381:33): [True: 67.3k, False: 33.6k]
  ------------------
 3382|  67.3k|                    {
 3383|  67.3k|                        if (!bExists[j])
  ------------------
  |  Branch (3383:29): [True: 609, False: 66.7k]
  ------------------
 3384|    609|                        {
 3385|    609|                            continue;
 3386|    609|                        }
 3387|  66.7k|                        if (0 > (ret2 = GetInChIFormulaNumH(pInChI[j], &nFormulaH[j])) ||
  ------------------
  |  Branch (3387:29): [True: 0, False: 66.7k]
  ------------------
 3388|  66.7k|                            0 > (ret2 = GetInChINumH(pInChI[j], &nNumH[j])) ||
  ------------------
  |  Branch (3388:29): [True: 0, False: 66.7k]
  ------------------
 3389|  66.7k|                            0 > (ret2 = GetInChIIsoH(pInChI[j], nNumIsotopicH[j])))
  ------------------
  |  Branch (3389:29): [True: 0, False: 66.7k]
  ------------------
 3390|      0|                        {
 3391|      0|                            goto exit_function;
 3392|      0|                        }
 3393|  66.7k|                        nCharge[j] = pInChI[j]->nTotalCharge;
 3394|  66.7k|                    }
 3395|   100k|                    for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  573|   100k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3395:33): [True: 67.3k, False: 33.6k]
  ------------------
 3396|  67.3k|                    {
 3397|  67.3k|                        if (!bExists[j])
  ------------------
  |  Branch (3397:29): [True: 609, False: 66.7k]
  ------------------
 3398|    609|                        {
 3399|    609|                            continue;
 3400|    609|                        }
 3401|  66.7k|                        if (nFormulaH[j] != nNumH[j])
  ------------------
  |  Branch (3401:29): [True: 39, False: 66.6k]
  ------------------
 3402|     39|                        {
 3403|     39|                            ret2 = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     39|#define RI_ERR_SYNTAX  (-2)
  ------------------
 3404|     39|                            goto exit_function;
 3405|     39|                        }
 3406|  66.7k|                    }
 3407|  33.6k|                    nFoundRemovedIsoH = 0;
 3408|  33.6k|                    nRemovedCharge = nCharge[TAUT_NON] - nCharge[TAUT_YES];
  ------------------
  |  |  574|  33.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                  nRemovedCharge = nCharge[TAUT_NON] - nCharge[TAUT_YES];
  ------------------
  |  |  575|  33.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3409|  33.6k|                    nRemovedH = nNumH[TAUT_NON] - nNumH[TAUT_YES];
  ------------------
  |  |  574|  33.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                  nRemovedH = nNumH[TAUT_NON] - nNumH[TAUT_YES];
  ------------------
  |  |  575|  33.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3410|   134k|                    for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |   72|   134k|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (3410:33): [True: 100k, False: 33.6k]
  ------------------
 3411|   100k|                    {
 3412|   100k|                        nFoundRemovedIsoH += 0 != (nRemovedIsotopicH[m] = nNumIsotopicH[TAUT_NON][m] -
  ------------------
  |  |  574|   100k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 3413|   100k|                            nNumIsotopicH[TAUT_YES][m]);
  ------------------
  |  |  575|   100k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3414|   100k|                    }
 3415|  33.6k|                    if (nRemovedCharge != nRemovedH)
  ------------------
  |  Branch (3415:25): [True: 17, False: 33.6k]
  ------------------
 3416|     17|                    {
 3417|     17|                        ret2 = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     17|#define RI_ERR_SYNTAX  (-2)
  ------------------
 3418|     17|                        goto exit_function;
 3419|     17|                    }
 3420|  33.6k|                    if (nRemovedCharge || nFoundRemovedIsoH)
  ------------------
  |  Branch (3420:25): [True: 0, False: 33.6k]
  |  Branch (3420:43): [True: 13, False: 33.6k]
  ------------------
 3421|     13|                    {
 3422|     13|                        COMPONENT_REM_PROTONS* pNumProtons;
 3423|     13|                        if (!nNumProtons[iINChI][TAUT_YES].pNumProtons)
  ------------------
  |  |  575|     13|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3423:29): [True: 13, False: 0]
  ------------------
 3424|     13|                        {
 3425|       |                            /* allocate only if needed */
 3426|     13|                            nNumProtons[iINChI][TAUT_YES].pNumProtons =
  ------------------
  |  |  575|     13|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3427|     13|                                (COMPONENT_REM_PROTONS*)inchi_calloc(len2,
  ------------------
  |  | 1146|     13|#define inchi_calloc   calloc
  ------------------
 3428|     13|                                    sizeof(nNumProtons[0][0].pNumProtons[0]));
 3429|     13|                            if (!nNumProtons[iINChI][TAUT_YES].pNumProtons)
  ------------------
  |  |  575|     13|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3429:33): [True: 0, False: 13]
  ------------------
 3430|      0|                            {
 3431|      0|                                ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 3432|      0|                                goto exit_function;
 3433|      0|                            }
 3434|     13|                        }
 3435|     13|                        pNumProtons = nNumProtons[iINChI][TAUT_YES].pNumProtons + k;
  ------------------
  |  |  575|     13|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3436|     13|                        pNumProtons->nNumRemovedProtons = nRemovedH;
 3437|     13|                        nTotRemovedProtons += nRemovedH;
 3438|     52|                        for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |   72|     52|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (3438:37): [True: 39, False: 13]
  ------------------
 3439|     39|                        {
 3440|     39|                            pNumProtons->nNumRemovedIsotopicH[m] = nRemovedIsotopicH[m];
 3441|     39|                            nTotRemovedIsotopicH[m] += nRemovedIsotopicH[m];
 3442|     39|                        }
 3443|       |                        /* make sure the Mobile-H InChI has nTautomer */
 3444|     13|                        if (pInChI[TAUT_YES] && bExists[TAUT_YES])
  ------------------
  |  |  575|     13|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                      if (pInChI[TAUT_YES] && bExists[TAUT_YES])
  ------------------
  |  |  575|     13|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3444:29): [True: 13, False: 0]
  |  Branch (3444:49): [True: 13, False: 0]
  ------------------
 3445|     13|                        {
 3446|     13|                            if (!pInChI[TAUT_YES]->lenTautomer)
  ------------------
  |  |  575|     13|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3446:33): [True: 11, False: 2]
  ------------------
 3447|     11|                            {
 3448|     11|                                pInChI[TAUT_YES]->lenTautomer = 1;
  ------------------
  |  |  575|     11|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3449|     11|                            }
 3450|     13|                            if (!pInChI[TAUT_YES]->nTautomer)
  ------------------
  |  |  575|     13|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3450:33): [True: 11, False: 2]
  ------------------
 3451|     11|                            {
 3452|     11|                                pInChI[TAUT_YES]->nTautomer = (AT_NUMB*)inchi_calloc(pInChI[TAUT_YES]->lenTautomer, sizeof(pInChI[0]->nTautomer[0]));
  ------------------
  |  |  575|     11|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                              pInChI[TAUT_YES]->nTautomer = (AT_NUMB*)inchi_calloc(pInChI[TAUT_YES]->lenTautomer, sizeof(pInChI[0]->nTautomer[0]));
  ------------------
  |  | 1146|     11|#define inchi_calloc   calloc
  ------------------
                                              pInChI[TAUT_YES]->nTautomer = (AT_NUMB*)inchi_calloc(pInChI[TAUT_YES]->lenTautomer, sizeof(pInChI[0]->nTautomer[0]));
  ------------------
  |  |  575|     11|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3453|     11|                            }
 3454|     13|                        }
 3455|     13|                    }
 3456|  33.6k|                }
 3457|  2.60k|                if (nNumProtons[iINChI][TAUT_YES].pNumProtons)
  ------------------
  |  |  575|  2.60k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3457:21): [True: 13, False: 2.59k]
  ------------------
 3458|     13|                {
 3459|       |                    /* check consistency */
 3460|       |#if ( FIX_ISO_FIXEDH_BUG_READ == 1 )
 3461|       |                    int iso_diff[NUM_H_ISOTOPES], iso_diff_tot = 0;
 3462|       |#endif
 3463|     13|                    if (nTotRemovedProtons != nNumProtons[iINChI][TAUT_YES].nNumRemovedProtons)
  ------------------
  |  |  575|     13|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3463:25): [True: 0, False: 13]
  ------------------
 3464|      0|                    {
 3465|      0|                        ret2 = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 3466|      0|                        goto exit_function;
 3467|      0|                    }
 3468|       |#if ( FIX_ISO_FIXEDH_BUG_READ == 1 )
 3469|       |                    for (m = 0; m < NUM_H_ISOTOPES; m++)
 3470|       |                    {
 3471|       |                        iso_diff[m] = nNumProtons[iINChI][TAUT_YES].nNumRemovedIsotopicH[m] - nTotRemovedIsotopicH[m];
 3472|       |                        if (iso_diff[m] < 0)
 3473|       |                        {
 3474|       |                            ret2 = RI_ERR_SYNTAX;
 3475|       |                            goto exit_function;
 3476|       |                        }
 3477|       |                        else
 3478|       |                        {
 3479|       |                            /* InChI-1.02b bug: nTotRemovedIsotopicH[m] < nNumProtons[iINChI][TAUT_YES].nNumRemovedIsotopicH[m] */
 3480|       |                            /* in non-tautomeric components where D(+) or T(+) was removed from -NH(+)= or =OH(+)           */
 3481|       |                            iso_diff_tot += iso_diff[m];
 3482|       |                        }
 3483|       |                    }
 3484|       |                    if (iso_diff_tot)
 3485|       |                    {
 3486|       |                        if (0 > bIsoMayBeArranged(bInchi2Struct, iso_diff, nNumProtons, pInpInChI, nNumComponents, iINChI))
 3487|       |                        {
 3488|       |                            ret2 = RI_ERR_SYNTAX;
 3489|       |                            goto exit_function;
 3490|       |                        }
 3491|       |                    }
 3492|       |#else
 3493|     15|                    for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |   72|     15|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (3493:33): [True: 15, False: 0]
  ------------------
 3494|     15|                    {
 3495|     15|                        if (nTotRemovedIsotopicH[m] != nNumProtons[iINChI][TAUT_YES].nNumRemovedIsotopicH[m])
  ------------------
  |  |  575|     15|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3495:29): [True: 13, False: 2]
  ------------------
 3496|     13|                        {
 3497|     13|                            ret2 = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     13|#define RI_ERR_SYNTAX  (-2)
  ------------------
 3498|     13|                            goto exit_function;
 3499|     13|                        }
 3500|     15|                    }
 3501|     13|#endif
 3502|     13|                }
 3503|  2.60k|            }
 3504|       |
 3505|       |            /* make Mobile H and Fixed H InChI arrays have same length */
 3506|  20.4k|            len2 = len1 = 0;
 3507|  20.4k|            if (nNumComponents[iINChI][TAUT_YES] < nNumComponents[iINChI][TAUT_NON])
  ------------------
  |  |  575|  20.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          if (nNumComponents[iINChI][TAUT_YES] < nNumComponents[iINChI][TAUT_NON])
  ------------------
  |  |  574|  20.4k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3507:17): [True: 12, False: 20.4k]
  ------------------
 3508|     12|            {
 3509|     12|                j = TAUT_YES; /* less components in Mobile-H layer */
  ------------------
  |  |  575|     12|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3510|     12|                len2 = nNumComponents[iINChI][TAUT_NON];
  ------------------
  |  |  574|     12|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 3511|     12|                len1 = nNumComponents[iINChI][TAUT_YES];
  ------------------
  |  |  575|     12|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3512|     12|            }
 3513|  20.4k|            else
 3514|  20.4k|                if (nNumComponents[iINChI][TAUT_YES] > nNumComponents[iINChI][TAUT_NON])
  ------------------
  |  |  575|  20.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              if (nNumComponents[iINChI][TAUT_YES] > nNumComponents[iINChI][TAUT_NON])
  ------------------
  |  |  574|  20.4k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3514:21): [True: 7.71k, False: 12.7k]
  ------------------
 3515|  7.71k|                {
 3516|  7.71k|                    j = TAUT_NON;  /* less components in Fixed-H layer */
  ------------------
  |  |  574|  7.71k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 3517|  7.71k|                    len2 = nNumComponents[iINChI][TAUT_YES];
  ------------------
  |  |  575|  7.71k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3518|  7.71k|                    len1 = nNumComponents[iINChI][TAUT_NON];
  ------------------
  |  |  574|  7.71k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 3519|  7.71k|                }
 3520|       |            /* always len1 <= len2; if Mobile-H and Fixed-H have same number of components then len1=len2=0  */
 3521|  20.4k|            if (len2 && len1)
  ------------------
  |  Branch (3521:17): [True: 7.72k, False: 12.7k]
  |  Branch (3521:25): [True: 12, False: 7.71k]
  ------------------
 3522|     12|            {
 3523|     12|                INChI* pInChI = (INChI*)inchi_calloc(len2, sizeof(pInChI[0]));
  ------------------
  |  | 1146|     12|#define inchi_calloc   calloc
  ------------------
 3524|     12|                if (!pInChI)
  ------------------
  |  Branch (3524:21): [True: 0, False: 12]
  ------------------
 3525|      0|                {
 3526|      0|                    ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 3527|      0|                    goto exit_function;
 3528|      0|                }
 3529|     12|                memcpy(pInChI, pInpInChI[iINChI][j], len1 * sizeof(pInChI[0]));
 3530|     12|                inchi_free(pInpInChI[iINChI][j]);
  ------------------
  |  | 1152|     12|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 12, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 12]
  |  |  ------------------
  ------------------
 3531|     12|                pInpInChI[iINChI][j] = pInChI;
 3532|     12|                nNumComponents[iINChI][j] = len2;
 3533|    604|                for (; len1 < len2; len1++)
  ------------------
  |  Branch (3533:24): [True: 592, False: 12]
  ------------------
 3534|    592|                {
 3535|    592|                    if (j == TAUT_YES)
  ------------------
  |  |  575|    592|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3535:25): [True: 592, False: 0]
  ------------------
 3536|    592|                    {
 3537|       |                        /* mark added to Mobile H layer components as deleted protons */
 3538|    592|                        if (0 > (ret2 = nFillOutProtonMobileH(pInpInChI[iINChI][j] + len1)))
  ------------------
  |  Branch (3538:29): [True: 0, False: 592]
  ------------------
 3539|      0|                        {
 3540|      0|                            goto exit_function;
 3541|      0|                        }
 3542|    592|                        if (0 > (ret2 = nProtonCopyIsotopicInfo(pInpInChI[iINChI][j] + len1/* to */,
  ------------------
  |  Branch (3542:29): [True: 0, False: 592]
  ------------------
 3543|    592|                            pInpInChI[iINChI][TAUT_NON] + len1/* from */)))
  ------------------
  |  |  574|    592|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 3544|      0|                        {
 3545|      0|                            goto exit_function;
 3546|      0|                        }
 3547|    592|                    }
 3548|      0|                    else
 3549|      0|                    {
 3550|       |                        /* mark added to Fixed H layer components as empty deleted */
 3551|       |                        /* this should not happen */
 3552|      0|                        pInChI[len1].bDeleted = 1;
 3553|      0|                    }
 3554|    592|                }
 3555|     12|            }
 3556|  20.4k|        } /* end of iINChI cycle */
 3557|       |
 3558|       |          /* check balances */
 3559|  30.6k|        for (iINChI = 0; iINChI < INCHI_NUM; iINChI++)
  ------------------
  |  |  569|  30.6k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3559:26): [True: 20.4k, False: 10.2k]
  ------------------
 3560|  20.4k|        {
 3561|  51.1k|            for (i = iINChI; i < INCHI_NUM; i++)
  ------------------
  |  |  569|  51.1k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3561:30): [True: 30.6k, False: 20.4k]
  ------------------
 3562|  30.6k|            {
 3563|  92.0k|                for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  573|  92.0k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3563:29): [True: 61.3k, False: 30.6k]
  ------------------
 3564|  61.3k|                {
 3565|   153k|                    for (k = j; k < TAUT_NUM; k++)
  ------------------
  |  |  573|   153k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3565:33): [True: 92.0k, False: 61.3k]
  ------------------
 3566|  92.0k|                    {
 3567|  92.0k|                        if ((iINChI != i || j != k) && num_elem[iINChI][j] && num_elem[i][k])
  ------------------
  |  Branch (3567:30): [True: 30.6k, False: 61.3k]
  |  Branch (3567:45): [True: 20.4k, False: 40.9k]
  |  Branch (3567:56): [True: 17.8k, False: 33.2k]
  |  Branch (3567:79): [True: 2.72k, False: 15.1k]
  ------------------
 3568|  2.72k|                        {
 3569|  2.72k|                            if (tot_charge[iINChI][j] != tot_charge[i][k])
  ------------------
  |  Branch (3569:33): [True: 1, False: 2.72k]
  ------------------
 3570|      1|                            {
 3571|      1|                                ret2 = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 3572|      1|                                goto exit_function;
 3573|      1|                            }
 3574|   345k|                            for (m = 0; m <= nElDataLen; m++)
  ------------------
  |  Branch (3574:41): [True: 342k, False: 2.69k]
  ------------------
 3575|   342k|                            {
 3576|   342k|                                if (num_elem[iINChI][j][m].num != num_elem[i][k][m].num)
  ------------------
  |  Branch (3576:37): [True: 26, False: 342k]
  ------------------
 3577|     26|                                {
 3578|     26|                                    ret2 = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     26|#define RI_ERR_SYNTAX  (-2)
  ------------------
 3579|     26|                                    goto exit_function;
 3580|     26|                                }
 3581|   342k|                            }
 3582|       |                            /*
 3583|       |                            if ( memcmp( num_elem[iINChI], num_elem[i][k], (nElDataLen+1)*sizeof(num_elem[0][0][0]) ) {
 3584|       |                            ret2 = RI_ERR_SYNTAX;
 3585|       |                            goto exit_function;
 3586|       |                            }
 3587|       |                            */
 3588|  2.72k|                        }
 3589|  92.0k|                    }
 3590|  61.3k|                }
 3591|  30.6k|            }
 3592|  20.4k|        }
 3593|       |
 3594|  10.2k|    }
 3595|  2.24k|    else
 3596|  2.24k|    {
 3597|  2.24k|        ret2 = ret;
 3598|  2.24k|    }
 3599|       |
 3600|  12.5k|exit_function:
 3601|       |
 3602|  37.6k|    for (i = 0; i < INCHI_NUM; i++)
  ------------------
  |  |  569|  37.6k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3602:17): [True: 25.1k, False: 12.5k]
  ------------------
 3603|  25.1k|    {
 3604|  75.3k|        for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  573|  75.3k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3604:21): [True: 50.2k, False: 25.1k]
  ------------------
 3605|  50.2k|        {
 3606|  50.2k|            if (num_elem[i][j])
  ------------------
  |  Branch (3606:17): [True: 13.0k, False: 37.2k]
  ------------------
 3607|  13.0k|            {
 3608|  13.0k|                inchi_free(num_elem[i][j]);
  ------------------
  |  | 1152|  13.0k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 13.0k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 13.0k]
  |  |  ------------------
  ------------------
 3609|  13.0k|                num_elem[i][j] = NULL;
 3610|  13.0k|            }
 3611|  50.2k|        }
 3612|  25.1k|    }
 3613|  12.5k|    *nErr = (ret2 < 0 && ret2 != RI_ERR_EOL) ? ret2 : 0;
  ------------------
  |  |   18|  2.34k|#define RI_ERR_EOL     (-4)
  ------------------
  |  Branch (3613:14): [True: 2.34k, False: 10.2k]
  |  Branch (3613:26): [True: 2.31k, False: 31]
  ------------------
 3614|       |
 3615|  12.5k|    return ret;
 3616|  12.5k|}
ReadInChICoord:
 4677|    585|{
 4678|    585|    int     c;
 4679|       |    /* djb-rwth: removing redundant variables */
 4680|    585|    int     ret = RI_ERR_ALLOC;
  ------------------
  |  |   15|    585|#define RI_ERR_ALLOC   (-1)
  ------------------
 4681|    585|    int     bMobileH = TAUT_YES;
  ------------------
  |  |  575|    585|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4682|    585|    int     bReconn = INCHI_BAS;
  ------------------
  |  |  570|    585|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 4683|    585|    int     state = -1;
 4684|    585|    int     prev_state = -1;
 4685|    585|    int     nLenXYZ = 0;
 4686|    585|    int     bAbc = -1;   /* initially undefined */
 4687|    585|    const char
 4688|    585|        szToken[] = INCHI_TOKEN;
  ------------------
  |  |  277|    585|#define INCHI_TOKEN "/\n\r\t\\"
  ------------------
 4689|    585|    XYZ_COORD
 4690|    585|        * pXYZ = NULL;
 4691|       |
 4692|    585|    *pState = 0;
 4693|    585|    INCHI_HEAPCHK
 4694|       |
 4695|       |        /* Get "InChI=1/" */
 4696|    585|        if (pLine->len)
  ------------------
  |  Branch (4696:13): [True: 0, False: 585]
  ------------------
 4697|      0|        {
 4698|      0|            c = pLine->c;
 4699|      0|        }
 4700|    585|        else
 4701|    585|        {
 4702|    585|            c = nGetInChISegment(pInp, pLine, szToken);
 4703|    585|        }
 4704|    585|    if (c == RI_ERR_EOF && !pLine->len && !pLine->str[0])
  ------------------
  |  |   19|  1.17k|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (4704:9): [True: 560, False: 25]
  |  Branch (4704:28): [True: 559, False: 1]
  |  Branch (4704:43): [True: 559, False: 0]
  ------------------
 4705|    559|    {
 4706|    559|        ret = c;
 4707|    559|        pLine->len = 0;
 4708|    559|        goto exit_error;
 4709|    559|    }
 4710|     26|    if (pLine->len == 0 || (c != SEG_END && c != RI_ERR_EOF && !INCHI_INP_EOL(c))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  273|      2|#define SEG_END '/'
  ------------------
                  if (pLine->len == 0 || (c != SEG_END && c != RI_ERR_EOF && !INCHI_INP_EOL(c))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   19|      2|#define RI_ERR_EOF     (0)
  ------------------
                  if (pLine->len == 0 || (c != SEG_END && c != RI_ERR_EOF && !INCHI_INP_EOL(c))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  275|      0|#define INCHI_INP_EOL(X) ((X)=='\n' || (X)=='\r' || (X)=='\t')
  |  |  ------------------
  |  |  |  Branch (275:27): [True: 0, False: 0]
  |  |  |  Branch (275:40): [True: 0, False: 0]
  |  |  |  Branch (275:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (4710:9): [True: 25, False: 1]
  |  Branch (4710:29): [True: 1, False: 0]
  |  Branch (4710:45): [True: 0, False: 1]
  ------------------
 4711|     25|    {
 4712|     25|        *pState = -1;
 4713|     25|        pLine->len = 0;
 4714|     25|        ret = RI_ERR_PROGR;
  ------------------
  |  |   17|     25|#define RI_ERR_PROGR   (-3)
  ------------------
 4715|     25|        goto exit_error;
 4716|     25|    }
 4717|      1|    if (memcmp(pLine->str, "AuxInfo=", 8))
  ------------------
  |  Branch (4717:9): [True: 1, False: 0]
  ------------------
 4718|      1|    {
 4719|      1|        *pState = -1;
 4720|      1|        return c;
 4721|      1|    }
 4722|       |
 4723|      0|    state = AST_VERSION;
 4724|      0|    ret = 1; /* means read the next segment */
 4725|      0|    do
 4726|      0|    {
 4727|       |        /* Read the next segment up to the '/' */
 4728|      0|        INCHI_HEAPCHK
 4729|      0|            if (ret < 0)
  ------------------
  |  Branch (4729:17): [True: 0, False: 0]
  ------------------
 4730|      0|            {
 4731|      0|                *pState = prev_state;
 4732|      0|                break;
 4733|      0|            }
 4734|      0|        prev_state = state + (bReconn ? IST_HAPPENED_IN_RECMET : 0);
  ------------------
  |  |  342|      0|#define IST_HAPPENED_IN_RECMET   100
  ------------------
  |  Branch (4734:31): [True: 0, False: 0]
  ------------------
 4735|      0|        if (0 < ret)
  ------------------
  |  Branch (4735:13): [True: 0, False: 0]
  ------------------
 4736|      0|        {
 4737|       |            /* read next segment */
 4738|      0|            if (c != RI_ERR_EOF && c != SEG_END)
  ------------------
  |  |   19|      0|#define RI_ERR_EOF     (0)
  ------------------
                          if (c != RI_ERR_EOF && c != SEG_END)
  ------------------
  |  |  273|      0|#define SEG_END '/'
  ------------------
  |  Branch (4738:17): [True: 0, False: 0]
  |  Branch (4738:36): [True: 0, False: 0]
  ------------------
 4739|      0|            {
 4740|       |                /* abnormal reading result; should not happen */
 4741|      0|                while (c != RI_ERR_EOF && !INCHI_INP_EOL(c))
  ------------------
  |  |   19|      0|#define RI_ERR_EOF     (0)
  ------------------
                              while (c != RI_ERR_EOF && !INCHI_INP_EOL(c))
  ------------------
  |  |  275|      0|#define INCHI_INP_EOL(X) ((X)=='\n' || (X)=='\r' || (X)=='\t')
  |  |  ------------------
  |  |  |  Branch (275:27): [True: 0, False: 0]
  |  |  |  Branch (275:40): [True: 0, False: 0]
  |  |  |  Branch (275:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (4741:24): [True: 0, False: 0]
  ------------------
 4742|      0|                {
 4743|       |                    /* bypass to the end of line or file */
 4744|      0|                    c = getInChIChar(pInp);
 4745|      0|                }
 4746|      0|                ret = (c == RI_ERR_EOF) ? RI_ERR_EOF : RI_ERR_EOL; /* end of line */
  ------------------
  |  |   19|      0|#define RI_ERR_EOF     (0)
  ------------------
                              ret = (c == RI_ERR_EOF) ? RI_ERR_EOF : RI_ERR_EOL; /* end of line */
  ------------------
  |  |   19|      0|#define RI_ERR_EOF     (0)
  ------------------
                              ret = (c == RI_ERR_EOF) ? RI_ERR_EOF : RI_ERR_EOL; /* end of line */
  ------------------
  |  |   18|      0|#define RI_ERR_EOL     (-4)
  ------------------
  |  Branch (4746:23): [True: 0, False: 0]
  ------------------
 4747|      0|                pLine->len = 0;
 4748|      0|                pLine->c = ret;
 4749|      0|                break;
 4750|      0|            }
 4751|      0|            if (c == RI_ERR_EOF)
  ------------------
  |  |   19|      0|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (4751:17): [True: 0, False: 0]
  ------------------
 4752|      0|            {
 4753|      0|                ret = RI_ERR_EOF; /* end of line */
  ------------------
  |  |   19|      0|#define RI_ERR_EOF     (0)
  ------------------
 4754|      0|                break;
 4755|      0|            }
 4756|      0|            if (c == SEG_END)
  ------------------
  |  |  273|      0|#define SEG_END '/'
  ------------------
  |  Branch (4756:17): [True: 0, False: 0]
  ------------------
 4757|      0|            {
 4758|      0|                c = nGetInChISegment(pInp, pLine, szToken);
 4759|      0|            }
 4760|      0|            if (c < 0)
  ------------------
  |  Branch (4760:17): [True: 0, False: 0]
  ------------------
 4761|      0|            {
 4762|      0|                goto exit_error; /* error */
 4763|      0|            }
 4764|      0|            if (!pLine->len)
  ------------------
  |  Branch (4764:17): [True: 0, False: 0]
  ------------------
 4765|      0|            {
 4766|      0|                ret = RI_ERR_EOL; /* end of line */
  ------------------
  |  |   18|      0|#define RI_ERR_EOL     (-4)
  ------------------
 4767|      0|                break;
 4768|      0|            }
 4769|       |            /* djb-rwth: removing redundant code */
 4770|      0|        }
 4771|       |
 4772|       |        /* Process the seqment */
 4773|      0|        switch (state)
  ------------------
  |  Branch (4773:17): [True: 0, False: 0]
  ------------------
 4774|      0|        {
 4775|      0|        case AST_VERSION:
  ------------------
  |  Branch (4775:9): [True: 0, False: 0]
  ------------------
 4776|       |            /* Mobile H */
 4777|      0|            bMobileH = TAUT_YES;
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4778|      0|            ret = ParseAuxSegmentVersion(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 4779|      0|            state = AST_MOBILE_H_NUMBERS;
 4780|      0|            break;
 4781|      0|        case AST_MOBILE_H_NUMBERS:
  ------------------
  |  Branch (4781:9): [True: 0, False: 0]
  ------------------
 4782|      0|            ret = ParseAuxSegmentNumbers(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc);
 4783|      0|            state = AST_MOBILE_H_ATOM_EQ;
 4784|      0|            break;
 4785|      0|        case AST_MOBILE_H_ATOM_EQ:
  ------------------
  |  Branch (4785:9): [True: 0, False: 0]
  ------------------
 4786|      0|            ret = ParseAuxSegmentAtomEqu(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 4787|      0|            state = AST_MOBILE_H_GROUP_EQ;
 4788|      0|            break;
 4789|      0|        case AST_MOBILE_H_GROUP_EQ:
  ------------------
  |  Branch (4789:9): [True: 0, False: 0]
  ------------------
 4790|      0|            ret = ParseAuxSegmentGroupEqu(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 4791|      0|            state = AST_MOBILE_H_SP3_INV;
 4792|      0|            break;
 4793|      0|        case AST_MOBILE_H_SP3_INV:
  ------------------
  |  Branch (4793:9): [True: 0, False: 0]
  ------------------
 4794|      0|            ret = ParseAuxSegmentSp3Inv(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 4795|      0|            state = AST_MOBILE_H_SP3_INV_NUMBERS;
 4796|      0|            break;
 4797|      0|        case AST_MOBILE_H_SP3_INV_NUMBERS:
  ------------------
  |  Branch (4797:9): [True: 0, False: 0]
  ------------------
 4798|      0|            ret = ParseAuxSegmentSp3InvNumbers(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 4799|      0|            state = AST_MOBILE_H_ISO_LAYER_FORK;
 4800|      0|            break;
 4801|       |
 4802|      0|        case AST_MOBILE_H_ISO_LAYER_FORK:
  ------------------
  |  Branch (4802:9): [True: 0, False: 0]
  ------------------
 4803|      0|            if (!memcmp(pLine->str, "I:", 2))
  ------------------
  |  Branch (4803:17): [True: 0, False: 0]
  ------------------
 4804|      0|            {
 4805|      0|                state = AST_MOBILE_H_ISO_NUMBERS;
 4806|      0|            }
 4807|      0|            else if (!inchi_memicmp(pLine->str, "F:", 2))
  ------------------
  |  Branch (4807:22): [True: 0, False: 0]
  ------------------
 4808|      0|            {
 4809|      0|                state = AST_FIXED_H_NUMBERS;
 4810|      0|                bMobileH = TAUT_NON;
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4811|      0|            }
 4812|      0|            else if ( /*bReconn == INCHI_BAS &&*/ !inchi_memicmp(pLine->str, "CRV:", 4))
  ------------------
  |  Branch (4812:51): [True: 0, False: 0]
  ------------------
 4813|      0|            {
 4814|      0|                state = AST_REVERSE_INFO_CRV;
 4815|      0|            }
 4816|      0|            else
 4817|      0|                if (bReconn == INCHI_BAS && !inchi_memicmp(pLine->str, "rA:", 3))
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (4817:21): [True: 0, False: 0]
  |  Branch (4817:45): [True: 0, False: 0]
  ------------------
 4818|      0|                {
 4819|      0|                    state = AST_REVERSE_INFO_ATOMS;
 4820|      0|                }
 4821|      0|                else if (bReconn == INCHI_BAS && !inchi_memicmp(pLine->str, "R:", 3))
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (4821:26): [True: 0, False: 0]
  |  Branch (4821:50): [True: 0, False: 0]
  ------------------
 4822|      0|                {
 4823|      0|                    ret = 1;  /* read the next segment */
 4824|      0|                    state = AST_VERSION;
 4825|      0|                    bMobileH = TAUT_YES;
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4826|      0|                    bReconn = INCHI_REC;
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 4827|      0|                }
 4828|      0|                else
 4829|      0|                {
 4830|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 4831|      0|                }
 4832|      0|            break;
 4833|       |
 4834|       |            /* Mobile H, isotopic */
 4835|      0|        case AST_MOBILE_H_ISO_NUMBERS:
  ------------------
  |  Branch (4835:9): [True: 0, False: 0]
  ------------------
 4836|      0|            ret = ParseAuxSegmentNumbers(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc);
 4837|      0|            state = AST_MOBILE_H_ISO_ATOM_EQ;
 4838|      0|            break;
 4839|      0|        case AST_MOBILE_H_ISO_ATOM_EQ:
  ------------------
  |  Branch (4839:9): [True: 0, False: 0]
  ------------------
 4840|      0|            ret = ParseAuxSegmentAtomEqu(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 4841|      0|            state = AST_MOBILE_H_ISO_GROUP_EQ;
 4842|      0|            break;
 4843|      0|        case AST_MOBILE_H_ISO_GROUP_EQ:
  ------------------
  |  Branch (4843:9): [True: 0, False: 0]
  ------------------
 4844|      0|            ret = ParseAuxSegmentGroupEqu(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 4845|      0|            state = AST_MOBILE_H_ISO_SP3_INV;
 4846|      0|            break;
 4847|      0|        case AST_MOBILE_H_ISO_SP3_INV:
  ------------------
  |  Branch (4847:9): [True: 0, False: 0]
  ------------------
 4848|      0|            ret = ParseAuxSegmentSp3Inv(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 4849|      0|            state = AST_MOBILE_H_ISO_SP3_INV_NUMBERS;
 4850|      0|            break;
 4851|      0|        case AST_MOBILE_H_ISO_SP3_INV_NUMBERS:
  ------------------
  |  Branch (4851:9): [True: 0, False: 0]
  ------------------
 4852|      0|            ret = ParseAuxSegmentSp3InvNumbers(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 4853|      0|            state = AST_FIXED_H_LAYER_FORK;
 4854|      0|            break;
 4855|       |
 4856|      0|        case AST_FIXED_H_LAYER_FORK:
  ------------------
  |  Branch (4856:9): [True: 0, False: 0]
  ------------------
 4857|      0|            if (!inchi_memicmp(pLine->str, "F:", 2))
  ------------------
  |  Branch (4857:17): [True: 0, False: 0]
  ------------------
 4858|      0|            {
 4859|      0|                state = AST_FIXED_H_NUMBERS;
 4860|      0|                bMobileH = TAUT_NON;
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4861|      0|            }
 4862|      0|            else if ( /*bReconn == INCHI_BAS &&*/ !inchi_memicmp(pLine->str, "CRV:", 4))
  ------------------
  |  Branch (4862:51): [True: 0, False: 0]
  ------------------
 4863|      0|            {
 4864|      0|                state = AST_REVERSE_INFO_CRV;
 4865|      0|            }
 4866|      0|            else if (bReconn == INCHI_BAS && !inchi_memicmp(pLine->str, "rA:", 3))
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (4866:22): [True: 0, False: 0]
  |  Branch (4866:46): [True: 0, False: 0]
  ------------------
 4867|      0|            {
 4868|      0|                state = AST_REVERSE_INFO_ATOMS;
 4869|      0|            }
 4870|      0|            else if (bReconn == INCHI_BAS && !inchi_memicmp(pLine->str, "R:", 3))
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (4870:22): [True: 0, False: 0]
  |  Branch (4870:46): [True: 0, False: 0]
  ------------------
 4871|      0|            {
 4872|      0|                ret = 1;  /* read the next segment */
 4873|      0|                state = AST_VERSION;
 4874|      0|                bMobileH = TAUT_YES;
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4875|      0|                bReconn = INCHI_REC;
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 4876|      0|            }
 4877|      0|            else
 4878|      0|            {
 4879|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 4880|      0|            }
 4881|      0|            break;
 4882|       |
 4883|      0|        case AST_FIXED_H_NUMBERS:
  ------------------
  |  Branch (4883:9): [True: 0, False: 0]
  ------------------
 4884|      0|            ret = ParseAuxSegmentNumbers(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc);
 4885|      0|            state = AST_FIXED_H_ATOM_EQ;
 4886|      0|            break;
 4887|      0|        case AST_FIXED_H_ATOM_EQ:
  ------------------
  |  Branch (4887:9): [True: 0, False: 0]
  ------------------
 4888|      0|            ret = ParseAuxSegmentAtomEqu(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 4889|      0|            state = AST_FIXED_H_SP3_INV;
 4890|      0|            break;
 4891|      0|        case AST_FIXED_H_SP3_INV:
  ------------------
  |  Branch (4891:9): [True: 0, False: 0]
  ------------------
 4892|      0|            ret = ParseAuxSegmentSp3Inv(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 4893|      0|            state = AST_FIXED_H_SP3_INV_NUMBERS;
 4894|      0|            break;
 4895|      0|        case AST_FIXED_H_SP3_INV_NUMBERS:
  ------------------
  |  Branch (4895:9): [True: 0, False: 0]
  ------------------
 4896|      0|            ret = ParseAuxSegmentSp3InvNumbers(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 4897|      0|            state = AST_FIXED_H_ISO_LAYER_FORK;
 4898|      0|            break;
 4899|       |
 4900|      0|        case AST_FIXED_H_ISO_LAYER_FORK:
  ------------------
  |  Branch (4900:9): [True: 0, False: 0]
  ------------------
 4901|      0|            if (!memcmp(pLine->str, "I:", 2))
  ------------------
  |  Branch (4901:17): [True: 0, False: 0]
  ------------------
 4902|      0|            {
 4903|      0|                state = AST_FIXED_H_ISO_NUMBERS;
 4904|      0|            }
 4905|      0|            else if ( /*bReconn == INCHI_BAS &&*/ !inchi_memicmp(pLine->str, "CRV:", 4))
  ------------------
  |  Branch (4905:51): [True: 0, False: 0]
  ------------------
 4906|      0|            {
 4907|      0|                state = AST_REVERSE_INFO_CRV;
 4908|      0|            }
 4909|      0|            else if (bReconn == INCHI_BAS && !inchi_memicmp(pLine->str, "rA:", 3))
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (4909:22): [True: 0, False: 0]
  |  Branch (4909:46): [True: 0, False: 0]
  ------------------
 4910|      0|            {
 4911|      0|                state = AST_REVERSE_INFO_ATOMS;
 4912|      0|            }
 4913|      0|            else if (bReconn == INCHI_BAS && !inchi_memicmp(pLine->str, "R:", 3))
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (4913:22): [True: 0, False: 0]
  |  Branch (4913:46): [True: 0, False: 0]
  ------------------
 4914|      0|            {
 4915|      0|                ret = 1;  /* read the next segment */
 4916|      0|                state = AST_VERSION;
 4917|      0|                bMobileH = TAUT_YES;
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4918|      0|                bReconn = INCHI_REC;
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 4919|      0|            }
 4920|      0|            else
 4921|      0|            {
 4922|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 4923|      0|            }
 4924|      0|            break;
 4925|       |
 4926|      0|        case AST_FIXED_H_ISO_NUMBERS:
  ------------------
  |  Branch (4926:9): [True: 0, False: 0]
  ------------------
 4927|      0|            ret = ParseAuxSegmentNumbers(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc);
 4928|      0|            state = AST_FIXED_H_ISO_ATOM_EQ;
 4929|      0|            break;
 4930|      0|        case AST_FIXED_H_ISO_ATOM_EQ:
  ------------------
  |  Branch (4930:9): [True: 0, False: 0]
  ------------------
 4931|      0|            ret = ParseAuxSegmentAtomEqu(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 4932|      0|            state = AST_FIXED_H_SP3_INV;
 4933|      0|            break;
 4934|      0|        case AST_FIXED_H_ISO_SP3_INV:
  ------------------
  |  Branch (4934:9): [True: 0, False: 0]
  ------------------
 4935|      0|            ret = ParseAuxSegmentSp3Inv(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 4936|      0|            state = AST_FIXED_H_ISO_SP3_INV_NUMBERS;
 4937|      0|            break;
 4938|      0|        case AST_FIXED_H_ISO_SP3_INV_NUMBERS:
  ------------------
  |  Branch (4938:9): [True: 0, False: 0]
  ------------------
 4939|      0|            ret = ParseAuxSegmentSp3InvNumbers(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 4940|      0|            state = AST_REVERSE_INFO_CRV;
 4941|      0|            break;
 4942|      0|        case AST_REVERSE_INFO_CRV:
  ------------------
  |  Branch (4942:9): [True: 0, False: 0]
  ------------------
 4943|      0|            ret = ParseAuxSegmentReverseCRV(pLine->str, state);
 4944|       |            /* state = (bReconn == INCHI_BAS)? AST_REVERSE_INFO_ATOMS : AST_RECONNECTED_LAYER_FORK;*/
 4945|      0|            state = AST_REVERSE_INFO_ATOMS;
 4946|      0|            break;
 4947|      0|        case AST_REVERSE_INFO_ATOMS:
  ------------------
  |  Branch (4947:9): [True: 0, False: 0]
  ------------------
 4948|      0|            ret = ParseAuxSegmentReverseAtoms(pLine->str, state);
 4949|      0|            state = AST_REVERSE_INFO_BONDS;
 4950|      0|            break;
 4951|      0|        case AST_REVERSE_INFO_BONDS:
  ------------------
  |  Branch (4951:9): [True: 0, False: 0]
  ------------------
 4952|      0|            ret = ParseAuxSegmentReverseBonds(pLine->str, state);
 4953|      0|            state = AST_REVERSE_INFO_XYZ;
 4954|      0|            break;
 4955|      0|        case AST_REVERSE_INFO_XYZ:
  ------------------
  |  Branch (4955:9): [True: 0, False: 0]
  ------------------
 4956|      0|            ret = ParseAuxSegmentReverseXYZ(pLine->str, &pXYZ, state);
 4957|      0|            state = AST_RECONNECTED_LAYER_FORK;
 4958|      0|            if (ret > 0)
  ------------------
  |  Branch (4958:17): [True: 0, False: 0]
  ------------------
 4959|      0|            {
 4960|      0|                nLenXYZ = ret - 1;
 4961|      0|            }
 4962|      0|            break;
 4963|      0|        case AST_RECONNECTED_LAYER_FORK:
  ------------------
  |  Branch (4963:9): [True: 0, False: 0]
  ------------------
 4964|      0|            if (bReconn == INCHI_BAS && !inchi_memicmp(pLine->str, "R:", 3))
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (4964:17): [True: 0, False: 0]
  |  Branch (4964:41): [True: 0, False: 0]
  ------------------
 4965|      0|            {
 4966|      0|                ret = 1;  /* read the next segment */
 4967|      0|                state = AST_VERSION;
 4968|      0|                bMobileH = TAUT_YES;
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4969|      0|                bReconn = INCHI_REC;
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 4970|      0|            }
 4971|      0|            else
 4972|      0|            {
 4973|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 4974|      0|            }
 4975|      0|            break;
 4976|      0|        }
 4977|      0|    } while (c >= 0);
  ------------------
  |  Branch (4977:14): [True: 0, False: 0]
  ------------------
 4978|       |
 4979|      0|    if (pXYZ) /* djb-rwth: fixing coverity ID #499576 */
  ------------------
  |  Branch (4979:9): [True: 0, False: 0]
  ------------------
 4980|      0|    {
 4981|      0|        ret = AddAuxSegmentCoord(ret, pXYZ, nLenXYZ, pInpInChI, nNumComponents);
 4982|      0|    }
 4983|      0|    else
 4984|      0|    {
 4985|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 4986|      0|    }
 4987|       |
 4988|    584|exit_error:
 4989|    584|    if (pXYZ)
  ------------------
  |  Branch (4989:9): [True: 0, False: 584]
  ------------------
 4990|      0|    {
 4991|      0|        inchi_free(pXYZ);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4992|      0|    }
 4993|    584|    if (ret >= 0 || c == RI_ERR_EOF || c == RI_ERR_EOL)
  ------------------
  |  |   19|    609|#define RI_ERR_EOF     (0)
  ------------------
                  if (ret >= 0 || c == RI_ERR_EOF || c == RI_ERR_EOL)
  ------------------
  |  |   18|     25|#define RI_ERR_EOL     (-4)
  ------------------
  |  Branch (4993:9): [True: 559, False: 25]
  |  Branch (4993:21): [True: 0, False: 25]
  |  Branch (4993:40): [True: 0, False: 25]
  ------------------
 4994|    559|    {
 4995|    559|        pLine->len = 0;
 4996|    559|    }
 4997|       |
 4998|    584|    return ret;
 4999|      0|}
ParseSegmentReadDelimitedNumbers:
 7985|  1.03k|{
 7986|  1.03k|    const char* p, * pStart;
 7987|  1.03k|    int num, curr_atom = 0;
 7988|       |
 7989|  1.03k|    *ret = 1;
 7990|       |
 7991|  1.03k|    if (!str)
  ------------------
  |  Branch (7991:9): [True: 0, False: 1.03k]
  ------------------
 7992|      0|    {
 7993|      0|        *ret = -1;
 7994|      0|        return NULL;
 7995|      0|    }
 7996|       |
 7997|  1.03k|    pStart = (char*)(str + 1);
 7998|  1.03k|    p = pStart;
 7999|  1.03k|    while (*pStart)
  ------------------
  |  Branch (7999:12): [True: 1.03k, False: 1]
  ------------------
 8000|  1.03k|    {
 8001|  3.59k|        for (p = pStart, curr_atom = 0; p < pEnd && *p != c_stop; curr_atom++)
  ------------------
  |  Branch (8001:41): [True: 3.59k, False: 0]
  |  Branch (8001:53): [True: 2.81k, False: 772]
  ------------------
 8002|  2.81k|        {
 8003|  2.81k|            num = (AT_NUMB)inchi_strtol(p, &p, 10);
 8004|  2.81k|#if ( CHECK_STRTOL_ATNUMB==1 )
 8005|  2.81k|            if (num > MAX_ATOMS || num < 0)
  ------------------
  |  |   15|  5.63k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (8005:17): [True: 2, False: 2.81k]
  |  Branch (8005:36): [True: 0, False: 2.81k]
  ------------------
 8006|      2|            {
 8007|      2|                *ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8008|      2|                return p;
 8009|      2|            }
 8010|  2.81k|#endif
 8011|  2.81k|            {
 8012|  2.81k|                if (0 != IntArray_Append(numlist, num))
  ------------------
  |  Branch (8012:21): [True: 0, False: 2.81k]
  ------------------
 8013|      0|                {
 8014|      0|                    *ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8015|      0|                    return p;
 8016|      0|                }
 8017|  2.81k|            }
 8018|  2.81k|            if (*p == c_delim)
  ------------------
  |  Branch (8018:17): [True: 2.55k, False: 259]
  ------------------
 8019|  2.55k|            {
 8020|  2.55k|                p++;
 8021|  2.55k|            }
 8022|    259|            else if (*p == c_stop)
  ------------------
  |  Branch (8022:22): [True: 255, False: 4]
  ------------------
 8023|    255|            {
 8024|    255|                return p;
 8025|    255|            }
 8026|      4|            else
 8027|      4|            {
 8028|      4|                *ret = -1; return NULL;
 8029|      4|            }
 8030|  2.81k|        }
 8031|    772|        if (*p == c_stop)
  ------------------
  |  Branch (8031:13): [True: 772, False: 0]
  ------------------
 8032|    772|        {
 8033|    772|            return p;
 8034|    772|        }
 8035|    772|    }
 8036|       |
 8037|      1|    return p;
 8038|  1.03k|}
insertions_sort_AT_NUMB:
10561|  57.2k|{
10562|  57.2k|    AT_NUMB* i, * j, * pk, tmp;
10563|  57.2k|    int  k, num_trans = 0;
10564|   112k|    for (k = 1, pk = base; k < num; k++, pk++)
  ------------------
  |  Branch (10564:28): [True: 55.5k, False: 57.2k]
  ------------------
10565|  55.5k|    {
10566|   100k|        for (j = (i = pk) + 1, tmp = *j; j > base && *i > tmp; j = i, i--)
  ------------------
  |  Branch (10566:42): [True: 73.3k, False: 26.7k]
  |  Branch (10566:54): [True: 44.6k, False: 28.7k]
  ------------------
10567|  44.6k|        {
10568|  44.6k|            *j = *i;
10569|  44.6k|            num_trans++;
10570|  44.6k|        }
10571|  55.5k|        *j = tmp;
10572|  55.5k|    }
10573|       |
10574|  57.2k|    return num_trans;
10575|  57.2k|}
TreatErrorsInReadInChIString:
10927|  2.34k|{
10928|  2.34k|    int bInChI2Struct = (ip->bReadInChIOptions & READ_INCHI_TO_STRUCTURE) && ip->nInputType == INPUT_INCHI;
  ------------------
  |  |  991|  2.34k|#define READ_INCHI_TO_STRUCTURE          0x00000008
  ------------------
  |  Branch (10928:25): [True: 1.09k, False: 1.25k]
  |  Branch (10928:78): [True: 1.09k, False: 0]
  ------------------
10929|       |
10930|       |    /* InChI could not be read */
10931|  2.34k|    if (nReadStatus == RI_ERR_EOF && nErr == 0 && pState == 0) /* && !(*pstrHdr) )  */
  ------------------
  |  |   19|  4.69k|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (10931:9): [True: 92, False: 2.25k]
  |  Branch (10931:38): [True: 0, False: 92]
  |  Branch (10931:51): [True: 0, False: 0]
  ------------------
10932|      0|    {
10933|       |        /*if ( !(*pstrHdr) ) */
10934|      0|        ;/*inchi_ios_eprint( pLog, "\nEnd of file detected after structure %ld.    \n", *num_inp );*/
10935|      0|    }
10936|  2.34k|    else
10937|  2.34k|    {
10938|       |        /* Output InChI parsing error message */
10939|  2.34k|        char szHdrSimulation[128];
10940|  2.34k|        char szMsg2[1024];
10941|  2.34k|        (*num_inp)++;
10942|  2.34k|        sprintf(szHdrSimulation, "Structure: %ld", *num_inp);
10943|  2.34k|        getInchiStateReadErr(pState, szMsg2);
10944|       |
10945|       |#ifdef TARGET_EXE_STANDALONE
10946|       |        if (pOneInput->polymer &&
10947|       |            bInChI2Struct &&
10948|       |            !(ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY))
10949|       |        {
10950|       |            inchi_ios_eprint(pLog, "%s Skipping polymer InChI (only conversion to Molfile is available, use OutputSDF option)\n",
10951|       |                *pstrHdr ? *pstrHdr : szHdrSimulation);
10952|       |        }
10953|       |        else
10954|       |#endif
10955|  2.34k|        {
10956|  2.34k|            if (!bInChI2Struct &&
  ------------------
  |  Branch (10956:17): [True: 1.25k, False: 1.09k]
  ------------------
10957|  1.25k|                (pState == IST_MOBILE_H_POLYMER && !ip->bPolymers))
  ------------------
  |  Branch (10957:18): [True: 416, False: 838]
  |  Branch (10957:52): [True: 416, False: 0]
  ------------------
10958|    416|            {
10959|       |                /* TO DO: implement InChI2InChI for polymers in a way similar to InChI2Struct
10960|       |                thru an external (to ReadWriteInchi) loop                                */
10961|    416|                inchi_ios_eprint(pLog, "%s Skipping polymer InChI for conversion of InChI to InChI\n",
10962|    416|                    *pstrHdr ? *pstrHdr : szHdrSimulation);
  ------------------
  |  Branch (10962:21): [True: 0, False: 416]
  ------------------
10963|    416|            }
10964|  1.93k|            else
10965|  1.93k|            {
10966|  1.93k|                inchi_ios_eprint(pLog, "\n%s %s (%d) in %s (%d)\n",
10967|  1.93k|                    *pstrHdr ? *pstrHdr : szHdrSimulation,
  ------------------
  |  Branch (10967:21): [True: 0, False: 1.93k]
  ------------------
10968|  1.93k|                    getInchiErrName(nErr), nErr,
10969|  1.93k|                    szMsg2, pState);
10970|  1.93k|            }
10971|  2.34k|        }
10972|       |
10973|  2.34k|        if (ip->bINChIOutputOptions2 & INCHI_OUT_INCHI_GEN_ERROR)
  ------------------
  |  |  149|  2.34k|#define INCHI_OUT_INCHI_GEN_ERROR        0x0001 /* v. 1.05 */
  ------------------
  |  Branch (10973:13): [True: 0, False: 2.34k]
  ------------------
10974|      0|        {
10975|      0|            if (!(ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY))
  ------------------
  |  |  133|      0|#define INCHI_OUT_SDFILE_ONLY           0x0010   /* save input data in a Molfile instead of creating INChI */
  ------------------
  |  Branch (10975:17): [True: 0, False: 0]
  ------------------
10976|      0|            {
10977|      0|                inchi_ios_eprint(pOut, "%s\n", *pstrHdr ? *pstrHdr : szHdrSimulation);
  ------------------
  |  Branch (10977:48): [True: 0, False: 0]
  ------------------
10978|      0|                if (ip->bINChIOutputOptions & INCHI_OUT_STDINCHI)
  ------------------
  |  |  145|      0|#define INCHI_OUT_STDINCHI 0x4000
  ------------------
  |  Branch (10978:21): [True: 0, False: 0]
  ------------------
10979|      0|                {
10980|      0|                    inchi_ios_eprint(pOut, "InChI=1S//\n");
10981|      0|                }
10982|      0|                else
10983|      0|                {
10984|      0|                    inchi_ios_eprint(pOut, "InChI=1N//\n");
10985|      0|                }
10986|      0|            }
10987|      0|        }
10988|       |
10989|  2.34k|        if (0 != (ip->bReadInChIOptions & READ_INCHI_TO_STRUCTURE))
  ------------------
  |  |  991|  2.34k|#define READ_INCHI_TO_STRUCTURE          0x00000008
  ------------------
  |  Branch (10989:13): [True: 1.09k, False: 1.25k]
  ------------------
10990|       |
10991|  1.09k|            (*num_errors)++;
10992|  2.34k|        (*num_processed)++;
10993|  2.34k|    }
10994|  2.34k|    if (*pstrHdr)
  ------------------
  |  Branch (10994:9): [True: 0, False: 2.34k]
  ------------------
10995|      0|    {
10996|      0|        inchi_free(*pstrHdr);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
10997|      0|        *pstrHdr = NULL;
10998|      0|    }
10999|  2.34k|    if (*pszCurHdr)
  ------------------
  |  Branch (10999:9): [True: 0, False: 2.34k]
  ------------------
11000|      0|    {
11001|      0|        inchi_free(*pszCurHdr);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
11002|      0|        *pszCurHdr = NULL;
11003|      0|    }
11004|       |
11005|  2.34k|    FreeInpInChI(pOneInput);
11006|       |
11007|  2.34k|    return;
11008|  2.34k|}
ConvertInChI2InChI:
11032|  5.02k|{
11033|  5.02k|    int ret, tmp;
11034|       |
11035|  5.02k|    InchiTimeGet(pulTStart);
11036|       |
11037|  5.02k|    tmp = ip->bNoStructLabels;
11038|  5.02k|    ip->bNoStructLabels = 1;
11039|  5.02k|    INCHI_HEAPCHK
11040|  5.02k|        ip->pSdfValue = NULL;
11041|  5.02k|    ip->pSdfLabel = NULL;
11042|       |
11043|  5.02k|#if ( FIX_DALKE_BUGS == 1 )
11044|  5.02k|    SetHillFormFromInChI(pOneInput);
11045|  5.02k|#endif
11046|       |
11047|       |    /*
11048|       |     * Legacy metal handling cannot be applied during InChI-to-InChI
11049|       |     * conversion because the structure is not reconstructed and the
11050|       |     * metal-bond processing is therefore not rerun.
11051|       |     */
11052|  5.02k|    if (!ip->bMolecularInorganics && (ip->bReadInChIOptions & READ_INCHI_INPUT_MI))
  ------------------
  |  |  993|      0|#define READ_INCHI_INPUT_MI              0x00000020
  ------------------
  |  Branch (11052:9): [True: 0, False: 5.02k]
  |  Branch (11052:38): [True: 0, False: 0]
  ------------------
11053|      0|    {
11054|      0|        inchi_ios_eprint(pLog, "LegacyMetalHandling cannot be used with InChI2InChI for Molecular Inorganics input\n");
11055|      0|        ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
11056|      0|    }
11057|  5.02k|    else
11058|  5.02k|    {
11059|  5.02k|        ret = OutputInChIAsRequested(pCG, pOut, pLog, ip, sd,
11060|  5.02k|            pOneInput, num_components,
11061|  5.02k|            nModeProtonIsoExchgH,
11062|  5.02k|            num_inp, save_opt_bits);
11063|  5.02k|    }
11064|       |
11065|       |#if ( !defined(TARGET_API_LIB) && defined(TARGET_EXE_STANDALONE) )
11066|       |
11067|       |    /* Calculate InChIKey if requested */
11068|       |    /* However, do not calculate/write it if this function is called from within dll */
11069|       |    {
11070|       |        char ik_string[256];    /* Resulting InChIKey string */
11071|       |        int ik_ret = 0;           /* InChIKey-calc result code */
11072|       |        int xhash1, xhash2;
11073|       |        char szXtra1[65], szXtra2[65];
11074|       |
11075|       |        inchi_ios_flush2(pLog, stderr);
11076|       |
11077|       |        /* post-1.02b addition - correctly treat tabbed output with InChIKey */
11078|       |        if (ip->bINChIOutputOptions & INCHI_OUT_TABBED_OUTPUT)
11079|       |        {
11080|       |            if (ip->bCalcInChIHash != INCHIHASH_NONE)
11081|       |            {
11082|       |                if (pOut->s.pStr)
11083|       |                {
11084|       |                    if (pOut->s.nUsedLength > 0)
11085|       |                    {
11086|       |                        if (pOut->s.pStr[pOut->s.nUsedLength - 1] == '\n')
11087|       |                        {    /* replace LF with TAB */
11088|       |                            pOut->s.pStr[pOut->s.nUsedLength - 1] = '\t';
11089|       |                        }
11090|       |                    }
11091|       |                }
11092|       |            }
11093|       |        }
11094|       |
11095|       |        if (ip->bCalcInChIHash == INCHIHASH_NONE)
11096|       |        {
11097|       |            /* inchi_ios_flush(pOut); */
11098|       |        }
11099|       |        else
11100|       |        {
11101|       |            char* buf = NULL;
11102|       |            size_t slen = pOut->s.nUsedLength;
11103|       |            extract_inchi_substring(&buf, pOut->s.pStr, slen);
11104|       |
11105|       |            if (NULL != buf)
11106|       |            {
11107|       |                xhash1 = xhash2 = 0;
11108|       |                if ((ip->bCalcInChIHash == INCHIHASH_KEY_XTRA1) ||
11109|       |                    (ip->bCalcInChIHash == INCHIHASH_KEY_XTRA1_XTRA2))
11110|       |                {
11111|       |                    xhash1 = 1;
11112|       |                }
11113|       |                if ((ip->bCalcInChIHash == INCHIHASH_KEY_XTRA2) ||
11114|       |                    (ip->bCalcInChIHash == INCHIHASH_KEY_XTRA1_XTRA2))
11115|       |                {
11116|       |                    xhash2 = 1;
11117|       |                }
11118|       |
11119|       |                ik_ret = GetINCHIKeyFromINCHI(buf,
11120|       |                    xhash1,
11121|       |                    xhash2,
11122|       |                    ik_string,
11123|       |                    szXtra1,
11124|       |                    szXtra2);
11125|       |                inchi_free(buf);
11126|       |            }
11127|       |            else
11128|       |            {
11129|       |                ik_ret = INCHIKEY_NOT_ENOUGH_MEMORY;
11130|       |            }
11131|       |
11132|       |
11133|       |            if (ik_ret == INCHIKEY_OK)
11134|       |            {
11135|       |                inchi_ios_print(pOut, "InChIKey=%-s\n", ik_string);
11136|       |            }
11137|       |            else
11138|       |            {
11139|       |                inchi_ios_print(pLog, "Warning (Could not compute InChIKey: ", num_inp);
11140|       |                switch (ik_ret)
11141|       |                {
11142|       |                case INCHIKEY_UNKNOWN_ERROR:
11143|       |                    inchi_ios_print(pLog, "unresolved error)");
11144|       |                    break;
11145|       |                case INCHIKEY_EMPTY_INPUT:
11146|       |                    inchi_ios_print(pLog, "got an empty string)");
11147|       |                    break;
11148|       |                case INCHIKEY_INVALID_INCHI_PREFIX:
11149|       |                case INCHIKEY_INVALID_INCHI:
11150|       |                case INCHIKEY_INVALID_STD_INCHI:
11151|       |                    inchi_ios_print(pLog, "no valid InChI string found)");
11152|       |                    break;
11153|       |                case INCHIKEY_NOT_ENOUGH_MEMORY:
11154|       |                    inchi_ios_print(pLog, "not enough memory to treat the string)");
11155|       |                    break;
11156|       |                default:inchi_ios_print(pLog, "internal program error)");
11157|       |                    break;
11158|       |                }
11159|       |
11160|       |                inchi_ios_print(pLog, " structure #%-lu.\n", num_inp);
11161|       |                if (ip->bINChIOutputOptions & INCHI_OUT_TABBED_OUTPUT)
11162|       |                {
11163|       |                    inchi_ios_print(pOut, "\n");
11164|       |                }
11165|       |            } /* if (ip->bCalcInChIHash!=INCHIHASH_NONE) */
11166|       |
11167|       |            inchi_ios_flush(pOut);
11168|       |            inchi_ios_flush2(pLog, stderr);
11169|       |        }
11170|       |    } /* Calculate InChIKey if requested */
11171|       |#endif
11172|       |
11173|  5.02k|    ip->bNoStructLabels = tmp;
11174|       |
11175|       |#ifndef TARGET_API_LIB
11176|       |    if (ret < 0)
11177|       |    {
11178|       |
11179|       |        if (*pszCurHdr && (*pszCurHdr)[0])
11180|       |        {
11181|       |            inchi_ios_eprint(pLog, "Error %d creating InChI string %s\n", ret, *pszCurHdr);
11182|       |        }
11183|       |        else
11184|       |        {
11185|       |            inchi_ios_eprint(pLog, "Error %d creating InChI string, Structure %ld\n", ret, num_inp);
11186|       |        }
11187|       |        if (ip->bINChIOutputOptions2 & INCHI_OUT_INCHI_GEN_ERROR)
11188|       |        {/* inchi_ios_eprint( pOut, "InChICreationError!\n"); *//* emit err string */
11189|       |            if (ip->bINChIOutputOptions & INCHI_OUT_STDINCHI)
11190|       |            {
11191|       |                inchi_ios_eprint(pOut, "InChI=1S//\n");
11192|       |            }
11193|       |            else
11194|       |            {
11195|       |                inchi_ios_eprint(pOut, "InChI=1N//\n");
11196|       |            }
11197|       |        }
11198|       |
11199|       |        (*num_errors)++;
11200|       |    }
11201|       |
11202|       |#if ( !defined(TARGET_API_LIB) && !defined(TARGET_EXE_STANDALONE) )
11203|       |    else
11204|       |        if (*pszCurHdr && (*pszCurHdr)[0])
11205|       |        {
11206|       |            inchi_fprintf(stderr, "%s\r", *pszCurHdr);
11207|       |        }
11208|       |#endif
11209|       |#endif
11210|       |
11211|       |
11212|  5.02k|    if (*pszCurHdr)
  ------------------
  |  Branch (11212:9): [True: 0, False: 5.02k]
  ------------------
11213|      0|    {
11214|      0|        inchi_free(*pszCurHdr);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
11215|      0|        *pszCurHdr = NULL;
11216|      0|    }
11217|       |
11218|       |    INCHI_HEAPCHK
11219|       |
11220|  5.02k|        * ulProcessingTime += InchiTimeElapsed(ic, pulTStart);
11221|       |
11222|  5.02k|    return ret;
11223|  5.02k|}
ConvertInChI2Struct:
11263|  5.18k|{
11264|  5.18k|    int ret, i, j;
11265|  5.18k|    SRM srm; /* rules how to handle bonds to metal atoms */
11266|  5.18k|    StrFromINChI* pStruct[INCHI_NUM][TAUT_NUM];
11267|       |
11268|  5.18k|    int bINChIOutputOptions = /* djb-rwth: ignoring LLVM warning: variable used */
11269|  5.18k|#if ( I2S_MODIFY_OUTPUT != 1 )
11270|  5.18k|        0;
11271|       |#else
11272|       |        /* transfer user's InChI output options to serialization 10-12-2007 */
11273|       |        ip_inp->bINChIOutputOptions&
11274|       |        (
11275|       |            INCHI_OUT_NO_AUX_INFO |   /* do not output Aux Info */
11276|       |            INCHI_OUT_SHORT_AUX_INFO |   /* output short version of Aux Info */
11277|       |            INCHI_OUT_ONLY_AUX_INFO |   /* output only Aux Info */
11278|       |            /* INCHI_OUT_EMBED_REC             |*/   /* embed reconnected INChI into disconnected INChI */
11279|       |            INCHI_OUT_SDFILE_ONLY |   /* save input data in a Molfile instead of creating INChI */
11280|       |            INCHI_OUT_PLAIN_TEXT |   /* output plain text INChI */
11281|       |            INCHI_OUT_PLAIN_TEXT_COMMENTS |   /* output plain text annotation */
11282|       |            /* INCHI_OUT_WINCHI_WINDOW         |*/   /* output into wINChI text window */
11283|       |            INCHI_OUT_TABBED_OUTPUT |   /* tab-delimited (only for plain text) */
11284|       |            INCHI_OUT_SDFILE_ATOMS_DT |   /* SDfile output H isotopes as D and T */
11285|       |            INCHI_OUT_SDFILE_SPLIT |   /* Split SDfile into components */
11286|       |            0
11287|       |            );
11288|       |#endif
11289|       |
11290|       |    /* Preliminaries */
11291|  5.18k|    InchiTimeGet(pulTStart);
11292|       |
11293|  5.18k|    if ((input_is_stdinchi & INCHI_INPUT_CLASS_MASK) == INCHI_INPUT_CLASS_STANDARD ||
  ------------------
  |  |   75|  5.18k|#define INCHI_INPUT_CLASS_MASK         0x03
  ------------------
                  if ((input_is_stdinchi & INCHI_INPUT_CLASS_MASK) == INCHI_INPUT_CLASS_STANDARD ||
  ------------------
  |  |   77|  10.3k|#define INCHI_INPUT_CLASS_STANDARD     0x01
  ------------------
  |  Branch (11293:9): [True: 17, False: 5.17k]
  ------------------
11294|  5.17k|        (input_is_stdinchi & INCHI_INPUT_CLASS_MASK) == INCHI_INPUT_CLASS_BETA)
  ------------------
  |  |   75|  5.17k|#define INCHI_INPUT_CLASS_MASK         0x03
  ------------------
                      (input_is_stdinchi & INCHI_INPUT_CLASS_MASK) == INCHI_INPUT_CLASS_BETA)
  ------------------
  |  |   78|  5.17k|#define INCHI_INPUT_CLASS_BETA         0x02
  ------------------
  |  Branch (11294:9): [True: 2, False: 5.17k]
  ------------------
11295|     19|    {
11296|     19|        if (ip_inp->bINChIOutputOptions & INCHI_OUT_STDINCHI)
  ------------------
  |  |  145|     19|#define INCHI_OUT_STDINCHI 0x4000
  ------------------
  |  Branch (11296:13): [True: 19, False: 0]
  ------------------
11297|     19|        {
11298|     19|            bINChIOutputOptions |= INCHI_OUT_STDINCHI;
  ------------------
  |  |  145|     19|#define INCHI_OUT_STDINCHI 0x4000
  ------------------
11299|     19|        }
11300|     19|    }
11301|  5.17k|    else
11302|  5.17k|    {
11303|  5.17k|        if (ip_inp->bINChIOutputOptions & INCHI_OUT_SAVEOPT)
  ------------------
  |  |  146|  5.17k|#define INCHI_OUT_SAVEOPT  0x8000
  ------------------
  |  Branch (11303:13): [True: 0, False: 5.17k]
  ------------------
11304|      0|        {
11305|      0|            bINChIOutputOptions |= INCHI_OUT_SAVEOPT;
  ------------------
  |  |  146|      0|#define INCHI_OUT_SAVEOPT  0x8000
  ------------------
11306|      0|        }
11307|  5.17k|    }
11308|       |
11309|  5.18k|    memset(pStruct, 0, sizeof(pStruct)); /* djb-rwth: memset_s C11/Annex K variant? */
11310|       |
11311|  5.18k|    SetUpSrm(&srm);    /* structure restore parms */
11312|       |
11313|       |    /* Eliminate Fixed-H InChI that are exactly same as the corresponding Mobile-H structures */
11314|  5.18k|    RemoveFixHInChIIdentical2MobH(pOneInput);
11315|       |
11316|       |    /* Recheck layers after thee elimination; get optional stereo flags */
11317|  5.18k|    ret = DetectInpInchiCreationOptions(pOneInput, &bHasSomeReconnected,
11318|  5.18k|        &bHasMetal, &bHasSomeFixedH,
11319|  5.18k|        &nModeFlagsStereo, &bTautFlags);
11320|  5.18k|    if (ret < 0)
  ------------------
  |  Branch (11320:9): [True: 0, False: 5.18k]
  ------------------
11321|      0|    {
11322|      0|        AddOneMsg(szMessage, (int)strlen(szMessage), nMessageLen,
11323|      0|            "Error in detecting input InChI options", "; ");
11324|      0|        (*num_errors)++;
11325|      0|        goto dealloc;
11326|      0|    }
11327|       |
11328|  5.18k|    if (bHasSomeFixedH && !bReqNonTaut)
  ------------------
  |  Branch (11328:9): [True: 1.23k, False: 3.95k]
  |  Branch (11328:27): [True: 0, False: 1.23k]
  ------------------
11329|      0|    {
11330|      0|        bHasSomeFixedH = 0;
11331|      0|    }
11332|       |
11333|       |    /* Set stereo flags */
11334|  5.18k|    ip->nMode &= ~(REQ_MODE_STEREO |
  ------------------
  |  |   19|  5.18k|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
11335|  5.18k|        REQ_MODE_ISO_STEREO |
  ------------------
  |  |   20|  5.18k|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
11336|  5.18k|        REQ_MODE_RELATIVE_STEREO |
  ------------------
  |  |   26|  5.18k|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
11337|  5.18k|        REQ_MODE_RACEMIC_STEREO |
  ------------------
  |  |   28|  5.18k|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
11338|  5.18k|        REQ_MODE_CHIR_FLG_STEREO |
  ------------------
  |  |   34|  5.18k|#define REQ_MODE_CHIR_FLG_STEREO    0x002000    /* SUCF  If Chiral flag then Abs otherwise Rel stereo */
  ------------------
11339|  5.18k|        REQ_MODE_SB_IGN_ALL_UU |
  ------------------
  |  |   32|  5.18k|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
11340|  5.18k|        REQ_MODE_SC_IGN_ALL_UU);
  ------------------
  |  |   30|  5.18k|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
11341|       |
11342|  5.18k|    ip->nMode |= nModeFlagsStereo;
11343|       |
11344|       |    /* Remove Phosphine and Arsine Stereo Flags */
11345|  5.18k|    ip->bTautFlags &= ~TG_FLAG_PHOSPHINE_STEREO;
  ------------------
  |  |  941|  5.18k|#define TG_FLAG_PHOSPHINE_STEREO         0x00008000   /* add phosphine sp3 stereo */
  ------------------
11346|  5.18k|    ip->bTautFlags &= ~TG_FLAG_ARSINE_STEREO;
  ------------------
  |  |  942|  5.18k|#define TG_FLAG_ARSINE_STEREO            0x00010000   /* add arsine sp3 stereo */
  ------------------
11347|  5.18k|    ip->bTautFlags &= ~TG_FLAG_FIX_SP3_BUG;
  ------------------
  |  |  944|  5.18k|#define TG_FLAG_FIX_SP3_BUG              0x00040000   /* fix sp3 stereo bug: overlapping 2D stereo bond & coordinate scaling */
  ------------------
11348|       |
11349|  5.18k|    ip->bTautFlags |= bTautFlags;
11350|       |
11351|       |    /* Mark Disconnected InChI components that are exactly came as Reconnected ones */
11352|       |    /* Disconnected will have a negative number of the reconnected component */
11353|       |    /* Reconnected will have a positive number of the disconnected component */
11354|       |
11355|  5.18k|    MarkDisconectedIdenticalToReconnected(pOneInput);
11356|       |
11357|       |    /*****************************************************************************/
11358|       |    /* Pay attention to:                                                         */
11359|       |    /* 1) .nLink < 0 in Disonnected which means InChI is same as in Reconnected  */
11360|       |    /*    The component in Reconnected has .nLink pointing to the Disconnected;  */
11361|       |    /*    each .nLink = (1+component index) or -(1+component index)              */
11362|       |    /*    In the future .nLink>0 in Disconnected shall point to the Reconnectrd  */
11363|       |    /*    component from which it was created                                    */
11364|       |    /* 2) Currently reversed structures from Disconnected components are created */
11365|       |    /*    and abandoned if Reconnected layer exists                              */
11366|       |    /* 3) Connect/disconnect H depends on the presence of atom/bond parity       */
11367|       |    /*    The combined Mobile/Fixed-H parity should be set for Fixed-H components*/
11368|       |    /* 4) No comparison of the Disconnected layer is done if Reconnected exists  */
11369|       |    /* 5) Reading InChI was not fully tested in case one component has stereo in */
11370|       |    /*    both Mobile-H and Fixed-H layers while another component has stereo    */
11371|       |    /*    only in Mobile-H layer                                                 */
11372|       |    /*****************************************************************************/
11373|       |
11374|       |
11375|       |    /* Main conversion InChI->Structure for each component and  */
11376|       |    /* after that pStruct[iRec][iMobH][iComponent].at2 is the structure,      */
11377|       |    /* pStruct[iRec][iMobH][iComponent].RevInChI full InChI for the structure */
11378|       |    /* In case of both Fixed-H and Mobile-H layers the results are in iMobH=0 */
11379|       |    /* In case of only Mobile-H/Main layer the results are in iMobH=1         */
11380|       |
11381|  5.18k|    ulProcessingTime += InchiTimeElapsed(ic, pulTStart);
11382|       |
11383|  5.18k|    sd->ulStructTime = 0;
11384|       |
11385|  5.18k|    ret = AllInchiToStructure(ic, pCG, ip, sd, num_inp, *pszCurHdr, &srm, bHasSomeFixedH, pStruct, pOneInput);
11386|       |
11387|  5.18k|    ulProcessingTime += sd->ulStructTime;
11388|  5.18k|    InchiTimeGet(pulTStart);
11389|       |
11390|       |    /* ret < 0 is error code; ret > 0 is number of errors */
11391|       |    /* in pStruct[iInchiRec][iMobileH][iComponent].nError */
11392|  5.18k|    if (ret)
  ------------------
  |  Branch (11392:9): [True: 3.42k, False: 1.76k]
  ------------------
11393|  3.42k|    {
11394|  3.42k|#if ( FIX_GAF_2019_1==1 )
11395|  3.42k|        if (ret > 0)
  ------------------
  |  Branch (11395:13): [True: 3.42k, False: 0]
  ------------------
11396|  3.42k|        {
11397|  3.42k|            ret = RI_ERR_PROGR;
  ------------------
  |  |   17|  3.42k|#define RI_ERR_PROGR   (-3)
  ------------------
11398|  3.42k|        }
11399|  3.42k|#endif
11400|       |        /* conversion error */
11401|  3.42k|        (*num_errors)++;
11402|  3.42k|        goto dealloc;
11403|  3.42k|    }
11404|       |
11405|       |    /* Attempt to fix the numumber of removed protons in case of Mobile-H */
11406|  1.76k|    if (!pOneInput->nNumProtons[INCHI_BAS][TAUT_YES].pNumProtons &&
  ------------------
  |  |  570|  1.76k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                  if (!pOneInput->nNumProtons[INCHI_BAS][TAUT_YES].pNumProtons &&
  ------------------
  |  |  575|  1.76k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (11406:9): [True: 1.76k, False: 0]
  ------------------
11407|  1.76k|        !pOneInput->nNumProtons[INCHI_REC][TAUT_YES].pNumProtons)
  ------------------
  |  |  571|  1.76k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                      !pOneInput->nNumProtons[INCHI_REC][TAUT_YES].pNumProtons)
  ------------------
  |  |  575|  1.76k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (11407:9): [True: 1.76k, False: 0]
  ------------------
11408|  1.76k|    {
11409|  1.76k|        ret = AddProtonAndIsoHBalanceToMobHStruct(ic, pCG, ip, sd, num_inp, bHasSomeFixedH, *pszCurHdr, pStruct, pOneInput);
11410|       |
11411|  1.76k|        if (ret < 0)
  ------------------
  |  Branch (11411:13): [True: 9, False: 1.75k]
  ------------------
11412|      9|        {
11413|      9|            AddOneMsg(szMessage, (int)strlen(szMessage), nMessageLen, "Add/Remove protons error", "; ");
11414|      9|            (*num_errors)++;
11415|      9|            goto dealloc;
11416|      9|        }
11417|  1.76k|    }
11418|       |
11419|       |    /* Compare InChI from the Reversed Structure to the original input InChI    */
11420|  1.75k|    ret = CompareAllOrigInchiToRevInChI(pStruct, pOneInput, bHasSomeFixedH, num_inp, *pszCurHdr);
11421|  1.75k|    if (ret < 0)
  ------------------
  |  Branch (11421:9): [True: 0, False: 1.75k]
  ------------------
11422|      0|    {
11423|      0|        AddOneMsg(szMessage, (int)strlen(szMessage), nMessageLen, "InChI compare error", "; ");
11424|      0|        (*num_errors)++;
11425|      0|        goto dealloc;
11426|      0|    }
11427|       |
11428|       |    /* Compare disconnected versions */
11429|  1.75k|    ret = CompareAllDisconnectedOrigInchiToRevInChI(pStruct, pOneInput,
11430|  1.75k|        bHasSomeFixedH, num_inp, *pszCurHdr);
11431|  1.75k|    if (ret < 0)
  ------------------
  |  Branch (11431:9): [True: 0, False: 1.75k]
  ------------------
11432|      0|    {
11433|      0|        AddOneMsg(szMessage, (int)strlen(szMessage), nMessageLen, "InChI compare2 error", "; ");
11434|      0|        (*num_errors)++;
11435|      0|        goto dealloc;
11436|      0|    }
11437|       |
11438|  1.75k|    if (WarningFlags)
  ------------------
  |  Branch (11438:9): [True: 1.75k, False: 0]
  ------------------
11439|  1.75k|    {
11440|  5.26k|        for (i = 0; i < 2; i++)
  ------------------
  |  Branch (11440:21): [True: 3.50k, False: 1.75k]
  ------------------
11441|  3.50k|        {
11442|  10.5k|            for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  573|  10.5k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (11442:25): [True: 7.01k, False: 3.50k]
  ------------------
11443|  7.01k|            {
11444|  7.01k|                WarningFlags[i][j] = (unsigned long)pOneInput->CompareInchiFlags[i][j];
11445|  7.01k|            }
11446|  3.50k|        }
11447|  1.75k|    }
11448|       |
11449|  1.75k|    ulProcessingTime += InchiTimeElapsed(ic, pulTStart);
11450|       |
11451|       |#ifndef COMPILE_ANSI_ONLY
11452|       |    ret = DisplayStructureComponents(pCG, ip, sd, num_inp, *pszCurHdr, &srm, bReqNonTaut, pStruct, pOneInput);
11453|       |    if (ret < 0)
11454|       |    {
11455|       |        AddOneMsg(szMessage, (int)strlen(szMessage), nMessageLen, "Display structure error", "; ");
11456|       |    }
11457|       |#endif
11458|       |
11459|       |
11460|  1.75k|    InchiTimeGet(pulTStart);
11461|       |
11462|  1.75k|    ret = MergeStructureComponents(ip, sd, num_inp, *pszCurHdr, &srm, bReqNonTaut, pStruct, pOneInput);
11463|       |
11464|  1.75k|    ulProcessingTime += InchiTimeElapsed(ic, pulTStart);
11465|       |
11466|  1.75k|    if (ret < 0)
  ------------------
  |  Branch (11466:9): [True: 0, False: 1.75k]
  ------------------
11467|      0|    {
11468|      0|        AddOneMsg(szMessage, (int)strlen(szMessage), nMessageLen, "Merge Components error", "; ");
11469|      0|        (*num_errors)++;
11470|      0|        goto dealloc;
11471|      0|    }
11472|       |
11473|       |
11474|  1.75k|#ifdef TARGET_API_LIB
11475|       |    /*------------- for debug only -------------------
11476|       |    InchiTimeGet(&ulTStart);
11477|       |    ret = OutputInChIOutOfStrFromINChI( ic, pCG,
11478|       |    ip, sd, num_inp, 0,
11479|       |    pOut, pLog, &OneInput,
11480|       |    save_opt_bits);
11481|       |    ulProcessingTime += InchiTimeElapsed( ic, pulTStart);
11482|       |    if ( ret < 0 )
11483|       |    {
11484|       |    AddOneMsg(szMessage, (int)strlen(szMessage), nMessageLen, "Restored structure to InChI conversion failed", "; ");
11485|       |    goto dealloc;
11486|       |    }
11487|       |    -------------------------------------------------*/
11488|  1.75k|    if (at && num_at)
  ------------------
  |  Branch (11488:9): [True: 1.75k, False: 0]
  |  Branch (11488:15): [True: 1.75k, False: 0]
  ------------------
11489|  1.75k|    {
11490|  1.75k|        *at = pOneInput->atom;
11491|  1.75k|        *num_at = pOneInput->num_atoms;
11492|  1.75k|        pOneInput->atom = NULL;
11493|  1.75k|        *polymer = pOneInput->polymer;
11494|  1.75k|        pOneInput->polymer = NULL;
11495|  1.75k|        *v3000 = pOneInput->v3000;
11496|  1.75k|        pOneInput->v3000 = NULL;
11497|  1.75k|    }
11498|       |#else
11499|       |
11500|       |    InchiTimeGet(pulTStart);
11501|       |
11502|       |    ret = OutputInChIOutOfStrFromINChI(ic, pCG, ip, sd, num_inp, bINChIOutputOptions,
11503|       |        pOut, NULL, pOneInput, bHasSomeFixedH, save_opt_bits);
11504|       |
11505|       |    ulProcessingTime += InchiTimeElapsed(ic, pulTStart);
11506|       |
11507|       |    if (ret < 0)
11508|       |    {
11509|       |        AddOneMsg(szMessage, (int)strlen(szMessage), nMessageLen, "Restored structure to InChI conversion error", "; ");
11510|       |        (*num_errors)++;
11511|       |        goto dealloc;
11512|       |    }
11513|       |#endif
11514|       |
11515|  1.75k|    if (szMessage)
  ------------------
  |  Branch (11515:9): [True: 1.75k, False: 0]
  ------------------
11516|  1.75k|    {
11517|  1.75k|        int len, retcomp = 0, retcomp1 = 0;
11518|  1.75k|        InchiTimeGet(pulTStart);
11519|  1.75k|        retcomp = FillOutCompareMessage(szMessage, nMessageLen, pOneInput->CompareInchiFlags[0]);
11520|       |
11521|  1.75k|        if (pOneInput->CompareInchiFlags[1][0] || pOneInput->CompareInchiFlags[1][1])
  ------------------
  |  Branch (11521:13): [True: 3, False: 1.75k]
  |  Branch (11521:51): [True: 1, False: 1.75k]
  ------------------
11522|      4|        {
11523|      4|            AddOneMsg(szMessage, (int)strlen(szMessage), nMessageLen, "Disconnected: ", "; ");
11524|      4|            retcomp1 = FillOutCompareMessage(szMessage, nMessageLen, pOneInput->CompareInchiFlags[1]);
11525|      4|        }
11526|       |        /* add a metal warning */
11527|  1.75k|        if (bHasMetal && nInitLenMessage < (len = (int)strlen(szMessage)))
  ------------------
  |  Branch (11527:13): [True: 754, False: 1.00k]
  |  Branch (11527:26): [True: 641, False: 113]
  ------------------
11528|    641|        {
11529|    641|            char szMetal[] = " (Metal compound)";
11530|    641|            int shift;
11531|    641|            if (len + (int)sizeof(szMetal) > nMessageLen)
  ------------------
  |  Branch (11531:17): [True: 0, False: 641]
  ------------------
11532|      0|            {
11533|      0|                len = nMessageLen - (int)sizeof(szMetal);
11534|      0|            }
11535|    641|            shift = nInitLenMessage + (int)sizeof(szMetal) - 1;
11536|    641|            memmove(szMessage + shift, szMessage + nInitLenMessage, ((long long)len - nInitLenMessage) * sizeof(szMessage[0])); /* djb-rwth: cast operator added */
11537|    641|            memcpy(szMessage + nInitLenMessage, szMetal, sizeof(szMetal) - sizeof(szMessage[0]));
11538|    641|            szMessage[shift + len - nInitLenMessage] = '\0';
11539|    641|        }
11540|       |
11541|  1.75k|        retcomp = inchi_min(retcomp, retcomp1);
  ------------------
  |  |  139|  1.75k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 1.47k, False: 283]
  |  |  ------------------
  ------------------
11542|       |
11543|  1.75k|        if (retcomp < 0 &&
  ------------------
  |  Branch (11543:13): [True: 1.47k, False: 279]
  ------------------
11544|  1.47k|            (ip_inp->bINChIOutputOptions2 & INCHI_OUT_MISMATCH_AS_ERROR)
  ------------------
  |  |  150|  1.47k|#define INCHI_OUT_MISMATCH_AS_ERROR      0x0002 /* v. 1.05 */
  ------------------
  |  Branch (11544:13): [True: 0, False: 1.47k]
  ------------------
11545|  1.75k|            )
11546|      0|        {
11547|      0|            ret = RI_ERR_MISMATCH;
  ------------------
  |  |   21|      0|#define RI_ERR_MISMATCH (-9)
  ------------------
11548|       |            /* AddOneMsg(szMessage, (int)strlen(szMessage), nMessageLen, "* Treated as error by user supplied option", "; "); */
11549|      0|            (*num_errors)++;
11550|      0|            goto dealloc;
11551|      0|        }
11552|       |
11553|  1.75k|        ulProcessingTime += InchiTimeElapsed(ic, pulTStart);
11554|  1.75k|    }
11555|       |
11556|  1.75k|    ret = 0;
11557|       |
11558|  5.18k|dealloc:
11559|       |    /* Deallocate */
11560|  5.18k|    if (ret)
  ------------------
  |  Branch (11560:9): [True: 3.43k, False: 1.75k]
  ------------------
11561|  3.43k|    {
11562|  3.43k|        if (ret < 0)
  ------------------
  |  Branch (11562:13): [True: 3.43k, False: 0]
  ------------------
11563|  3.43k|        {
11564|  3.43k|            if (ret == CT_USER_QUIT_ERR)
  ------------------
  |  |   32|  3.43k|#define CT_USER_QUIT_ERR     (CT_ERR_FIRST-13)  /*(-30013) */
  |  |  ------------------
  |  |  |  |   18|  3.43k|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (11564:17): [True: 0, False: 3.43k]
  ------------------
11565|      0|            {
11566|      0|                AddOneMsg(szMessage, (int)strlen(szMessage), nMessageLen, "*Terminated by the user*", "; ");
11567|      0|            }
11568|  3.43k|            else
11569|  3.43k|            {
11570|  3.43k|                AddOneMsg(szMessage, (int)strlen(szMessage), nMessageLen, "*Conversion failed*", "; ");
11571|  3.43k|            }
11572|  3.43k|        }
11573|      0|        else
11574|      0|        {
11575|      0|            int iRec, iMob, iComp, nComp, len; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
11576|      0|            char szTemp[128];
11577|      0|            AddOneMsg(szMessage, (int)strlen(szMessage), nMessageLen, "*Conversion failed on component(s)", "; ");
11578|      0|            len = (int)strlen(szMessage); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
11579|      0|            for (iRec = 0; iRec < INCHI_NUM; iRec++)
  ------------------
  |  |  569|      0|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (11579:28): [True: 0, False: 0]
  ------------------
11580|      0|            {
11581|      0|                for (iMob = bHasSomeFixedH ? TAUT_NON : TAUT_YES; iMob < TAUT_NUM; iMob++)
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                              for (iMob = bHasSomeFixedH ? TAUT_NON : TAUT_YES; iMob < TAUT_NUM; iMob++)
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              for (iMob = bHasSomeFixedH ? TAUT_NON : TAUT_YES; iMob < TAUT_NUM; iMob++)
  ------------------
  |  |  573|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (11581:29): [True: 0, False: 0]
  |  Branch (11581:67): [True: 0, False: 0]
  ------------------
11582|      0|                {
11583|      0|                    nComp = pOneInput->nNumComponents[iRec][iMob];
11584|      0|                    if (!pStruct[iRec][iMob])
  ------------------
  |  Branch (11584:25): [True: 0, False: 0]
  ------------------
11585|      0|                    {
11586|      0|                        continue;
11587|      0|                    }
11588|      0|                    for (iComp = 0; iComp < nComp; iComp++)
  ------------------
  |  Branch (11588:37): [True: 0, False: 0]
  ------------------
11589|      0|                    {
11590|      0|                        if (pStruct[iRec][iMob][iComp].nError)
  ------------------
  |  Branch (11590:29): [True: 0, False: 0]
  ------------------
11591|      0|                        {
11592|      0|                            char* szFormula = pOneInput->pInpInChI[iRec][iMob][iComp].szHillFormula;
11593|      0|                            sprintf(szTemp,
11594|      0|#if ( FIX_DALKE_BUGS == 1 )
11595|      0|                                " %s%s%d(%.96s)",
11596|       |#else
11597|       |                                " %s%s%d(%s)",
11598|       |#endif
11599|      0|                                !bHasSomeReconnected ? "" : iRec ? "R" : "D",
  ------------------
  |  Branch (11599:33): [True: 0, False: 0]
  |  Branch (11599:61): [True: 0, False: 0]
  ------------------
11600|      0|                                !bHasSomeFixedH ? "" : iMob ? "M" : "F",
  ------------------
  |  Branch (11600:33): [True: 0, False: 0]
  |  Branch (11600:56): [True: 0, False: 0]
  ------------------
11601|      0|                                iComp + 1, szFormula ? szFormula : "???");
  ------------------
  |  Branch (11601:44): [True: 0, False: 0]
  ------------------
11602|      0|                            AddOneMsg(szMessage, (int)strlen(szMessage), nMessageLen, szTemp, NULL);
11603|      0|                        }
11604|      0|                    }
11605|      0|                }
11606|      0|            }
11607|      0|        } /* if ( ret > 0 ) */
11608|  3.43k|    } /* if ( ret ) */
11609|       |
11610|       |
11611|  5.18k|    InchiTimeGet(pulTStart);
11612|       |
11613|       |    /* Print one structure report */
11614|  5.18k|    if (szMessage && szMsg && nMsgLen > 1) /* djb-rwth: additional condition for szMessage */
  ------------------
  |  Branch (11614:9): [True: 5.18k, False: 0]
  |  Branch (11614:22): [True: 5.18k, False: 0]
  |  Branch (11614:31): [True: 5.18k, False: 0]
  ------------------
11615|  5.18k|    {
11616|  5.18k|        int len = inchi_min((int)strlen(szMessage), nMsgLen - 1);
  ------------------
  |  |  139|  5.18k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 5.18k, False: 0]
  |  |  ------------------
  ------------------
11617|  5.18k|        if (len > 0)
  ------------------
  |  Branch (11617:13): [True: 4.91k, False: 279]
  ------------------
11618|  4.91k|        {
11619|  4.91k|            memcpy(szMsg, szMessage, len);
11620|  4.91k|            szMsg[len] = '\0';
11621|  4.91k|        }
11622|    279|        else
11623|    279|        {
11624|    279|            szMsg[0] = '\0';
11625|    279|        }
11626|  5.18k|    }
11627|       |
11628|  5.18k|    if (szMessage && (nInitLenMessage < (int)strlen(szMessage))) /* djb-rwth: additional condition for szMessage */
  ------------------
  |  Branch (11628:9): [True: 5.18k, False: 0]
  |  Branch (11628:22): [True: 4.91k, False: 279]
  ------------------
11629|  4.91k|    {
11630|  4.91k|        inchi_ios_eprint(pLog, "%s\n", szMessage);
11631|  4.91k|    }
11632|       |#ifndef TARGET_API_LIB
11633|       |    else
11634|       |    {
11635|       |        /*^^^inchi_ios_eprint( stderr, "%s\r", szMessage );*/
11636|       |        inchi_fprintf(stderr, "%s\r", szMessage);
11637|       |    }
11638|       |#endif
11639|       |
11640|  5.18k|    FreeStrFromINChI(pStruct, pOneInput->nNumComponents);
11641|  5.18k|    FreeInpInChI(pOneInput);
11642|  5.18k|    if (*pszCurHdr)
  ------------------
  |  Branch (11642:9): [True: 0, False: 5.18k]
  ------------------
11643|      0|    {
11644|      0|        inchi_free(*pszCurHdr);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
11645|      0|        *pszCurHdr = NULL;
11646|      0|    }
11647|       |
11648|       |    INCHI_HEAPCHK
11649|       |
11650|  5.18k|        ulProcessingTime += InchiTimeElapsed(ic, pulTStart); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
11651|       |
11652|  5.18k|    return ret;
11653|  1.75k|}
DetectAndExposePolymerInternals:
11658|  6.28k|{
11659|  6.28k|    int  i, j, elindex, ret = 0, nheavy = 0,
11660|  6.28k|        nstars = 0, zlen = 0, star0 = 0, i_last_sym,
11661|  6.28k|        slen = 0, i2 = 0, ninsert = 0, kinsert, lead_pos, nc, ntimes, nc_max;
11662|  6.28k|    const char* p, * pz, * pz2, * pr, * pend, * q;
11663|  6.28k|    char prev_layer_symbol = '0';
11664|  6.28k|    char element[3], * tmpstr = NULL, * edited_s = NULL;
11665|  6.28k|    int* insert_pos = NULL;    /* inserts go before insert_pos[k] */
11666|  6.28k|    char* s = NULL, * s2 = NULL;
11667|  6.28k|    int  slength;
11668|       |
11669|  6.28k|    slength = is->s.nUsedLength;
11670|  6.28k|    s = (char*)inchi_calloc(2 * (long long)slength + 32, sizeof(char)); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  6.28k|#define inchi_calloc   calloc
  ------------------
11671|  6.28k|    if (!s)
  ------------------
  |  Branch (11671:9): [True: 0, False: 6.28k]
  ------------------
11672|      0|    {
11673|      0|        goto endf;
11674|      0|    }
11675|       |
11676|       |    /* Remove but save a tail (AuxInfo, InChIKey, etc.) if any */
11677|  6.28k|    strcpy(s, is->s.pStr);
11678|  2.36M|    for (i = 0; i < slength; i++)
  ------------------
  |  Branch (11678:17): [True: 2.35M, False: 6.13k]
  ------------------
11679|  2.35M|    {
11680|  2.35M|        if (isspace(UCINT s[i]))
  ------------------
  |  Branch (11680:13): [True: 150, False: 2.35M]
  ------------------
11681|    150|        {
11682|    150|            i2 = i;
11683|    150|            break;
11684|    150|        }
11685|  2.35M|    }
11686|  6.28k|    if (i2)
  ------------------
  |  Branch (11686:9): [True: 150, False: 6.13k]
  ------------------
11687|    150|    {
11688|    150|        s2 = (char*)inchi_calloc((long long)slength - (long long)i2 + 2, sizeof(char)); /* djb-rwth: cast operators added */
  ------------------
  |  | 1146|    150|#define inchi_calloc   calloc
  ------------------
11689|    150|        if (!s2) goto endf;
  ------------------
  |  Branch (11689:13): [True: 0, False: 150]
  ------------------
11690|    150|        strcpy(s2, s + i2);
11691|    150|        s[i2] = '\0';
11692|    150|    }
11693|       |
11694|  6.28k|    i_last_sym = strlen(s) - 1;
11695|  6.28k|    p = strstr(s, "InChI=1");
11696|  6.28k|    if (!p)
  ------------------
  |  Branch (11696:9): [True: 0, False: 6.28k]
  ------------------
11697|      0|    {
11698|      0|        goto endf;
11699|      0|    }
11700|       |
11701|  6.28k|    pz = strstr(p, "/z");
11702|  6.28k|    if (!pz)
  ------------------
  |  Branch (11702:9): [True: 5.49k, False: 784]
  ------------------
11703|  5.49k|    {
11704|  5.49k|        goto endf;
11705|  5.49k|    }
11706|    784|    pz++;
11707|       |
11708|       |    /* Check formula */
11709|    784|    p = strchr(p, '/');
11710|    784|    if (!p) /* djb-rwth: fixing coverity ID #499505 */
  ------------------
  |  Branch (11710:9): [True: 0, False: 784]
  ------------------
11711|      0|    {
11712|      0|        goto endf;
11713|      0|    }
11714|    784|    p++;
11715|    784|    pend = strchr(p, '/');
11716|    784|    ntimes = 1;
11717|  10.5k|    while (p != pend)
  ------------------
  |  Branch (11717:12): [True: 9.82k, False: 744]
  ------------------
11718|  9.82k|    {
11719|  9.82k|        if (isdigit(*p))
  ------------------
  |  Branch (11719:13): [True: 930, False: 8.89k]
  ------------------
11720|    930|        {
11721|    930|            ntimes = (int)inchi_strtol(p, &q, 10);
11722|    930|#if ( CHECK_STRTOL_ATNUMB==1 )
11723|    930|            if (ntimes > MAX_ATOMS || ntimes < 0)
  ------------------
  |  |   15|  1.86k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (11723:17): [True: 1, False: 929]
  |  Branch (11723:39): [True: 17, False: 912]
  ------------------
11724|     18|            {
11725|     18|#if (FIX_GAF_2020_25607 == 1)
11726|     18|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     18|#define RI_ERR_SYNTAX  (-2)
  ------------------
11727|     18|                goto endf;
11728|       |#else
11729|       |                return RI_ERR_SYNTAX; /* syntax error */
11730|       |#endif
11731|     18|            }
11732|    912|#endif
11733|    912|            p = q;
11734|    912|        }
11735|  8.89k|        else
11736|  8.89k|        {
11737|  8.89k|            if (*p == '.')
  ------------------
  |  Branch (11737:17): [True: 0, False: 8.89k]
  ------------------
11738|      0|            {
11739|      0|                ntimes = 1;
11740|      0|            }
11741|  8.89k|        }
11742|       |
11743|  9.81k|        if (!isupper(UCINT * p))
  ------------------
  |  Branch (11743:13): [True: 5, False: 9.80k]
  ------------------
11744|      5|        {
11745|      5|            ret = -1;
11746|      5|            goto endf;
11747|      5|        }
11748|       |
11749|  9.80k|        j = 0;
11750|  9.80k|        element[j++] = *p++;
11751|  9.80k|        if (*p && islower(UCINT * p))
  ------------------
  |  Branch (11751:13): [True: 9.80k, False: 0]
  |  Branch (11751:19): [True: 1.78k, False: 8.01k]
  ------------------
11752|  1.78k|        {
11753|  1.78k|            element[j++] = *p++;
11754|  1.78k|        }
11755|  9.80k|        element[j++] = '\0';
11756|  9.80k|        if (*p && isdigit(UCINT * p))
  ------------------
  |  Branch (11756:13): [True: 9.80k, False: 0]
  |  Branch (11756:19): [True: 1.12k, False: 8.68k]
  ------------------
11757|  1.12k|        {
11758|  1.12k|            elindex = (int)inchi_strtol(p, &q, 10);
11759|  1.12k|#if ( CHECK_STRTOL_ATNUMB==1 )
11760|  1.12k|            if (elindex > MAX_ATOMS || elindex < 0)
  ------------------
  |  |   15|  2.24k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (11760:17): [True: 1, False: 1.11k]
  |  Branch (11760:40): [True: 12, False: 1.10k]
  ------------------
11761|     13|            {
11762|     13|#if (FIX_GAF_2020_25607 == 1)
11763|     13|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     13|#define RI_ERR_SYNTAX  (-2)
  ------------------
11764|     13|                goto endf;
11765|       |#else
11766|       |                return RI_ERR_SYNTAX; /* syntax error */
11767|       |#endif
11768|       |
11769|     13|            }
11770|  1.10k|#endif
11771|  1.10k|            p = q;
11772|  1.10k|        }
11773|  8.68k|        else
11774|  8.68k|        {
11775|  8.68k|            elindex = 1;
11776|  8.68k|        }
11777|  9.79k|        if (!elindex)
  ------------------
  |  Branch (11777:13): [True: 0, False: 9.79k]
  ------------------
11778|      0|        {
11779|      0|            ret = -1;
11780|      0|            goto endf;
11781|      0|        }
11782|  9.79k|#if ( FIX_GAF_2019_2==1 )
11783|  9.79k|        if (ERR_ELEM == get_periodic_table_number(element))
  ------------------
  |  Branch (11783:13): [True: 4, False: 9.78k]
  ------------------
11784|      4|        {
11785|      4|            ret = -1;
11786|      4|            goto endf;
11787|      4|        }
11788|  9.78k|#endif
11789|  9.78k|        if (element[0] != 'H' || element[1])
  ------------------
  |  Branch (11789:13): [True: 8.85k, False: 933]
  |  Branch (11789:34): [True: 231, False: 702]
  ------------------
11790|  9.08k|        {
11791|  9.08k|            nheavy += ntimes * elindex;
11792|  9.08k|        }
11793|       |
11794|  9.78k|        if (*p == '.')
  ------------------
  |  Branch (11794:13): [True: 1.38k, False: 8.40k]
  ------------------
11795|  1.38k|        {
11796|  1.38k|            p++;
11797|  1.38k|        }
11798|  9.78k|    }
11799|       |
11800|    744|#if ( FIX_GAF_2019_2==1 )
11801|    744|    insert_pos = (int*)inchi_calloc((long long)is->s.nUsedLength + 1, sizeof(int)); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|    744|#define inchi_calloc   calloc
  ------------------
11802|       |#else
11803|       |    /* max num of insert positions is 2 in formulas + Npolymeric units, the latter may not be > nheavy */
11804|       |    insert_pos = (int*)inchi_calloc(nheavy + 32, sizeof(int));
11805|       |#endif
11806|    744|    if (!insert_pos)
  ------------------
  |  Branch (11806:9): [True: 0, False: 744]
  ------------------
11807|      0|    {
11808|      0|        ret = -2;
11809|      0|        goto endf;
11810|      0|    }
11811|       |
11812|    744|    ninsert = 0;
11813|    744|    if (pend)
  ------------------
  |  Branch (11813:9): [True: 744, False: 0]
  ------------------
11814|    744|    {
11815|    744|        insert_pos[ninsert] = (int)(pend - s);
11816|    744|    }
11817|      0|    else
11818|      0|    {
11819|      0|        insert_pos[ninsert] = i_last_sym;
11820|      0|    }
11821|    744|    ninsert++;
11822|       |
11823|       |    /* Check hidden stars */
11824|    744|    lead_pos = (int)(pz - s);
11825|    744|    pend = strchr(pz, '/');
11826|    744|    if (pend)
  ------------------
  |  Branch (11826:9): [True: 236, False: 508]
  ------------------
11827|    236|    {
11828|    236|        zlen = (int)(pend - pz);
11829|    236|    }
11830|    508|    else
11831|    508|    {
11832|    508|        zlen = (int)strlen(pz);
11833|    508|    }
11834|    744|    tmpstr = (char*)inchi_calloc((long long)zlen + 32, sizeof(char)); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|    744|#define inchi_calloc   calloc
  ------------------
11835|    744|    if (!tmpstr)
  ------------------
  |  Branch (11835:9): [True: 0, False: 744]
  ------------------
11836|      0|    {
11837|      0|        ret = -2;
11838|      0|        goto endf;
11839|      0|    }
11840|    744|    memcpy(tmpstr, pz, zlen);
11841|    744|    ret = DetectHiddenPolymerStuff(tmpstr, zlen, &ninsert, insert_pos, lead_pos, &nstars);
11842|    744|    if (ret)
  ------------------
  |  Branch (11842:9): [True: 14, False: 730]
  ------------------
11843|     14|    {
11844|     14|        goto endf;
11845|     14|    }
11846|    730|    if (!nstars)
  ------------------
  |  Branch (11846:9): [True: 240, False: 490]
  ------------------
11847|    240|    {
11848|    240|        goto endf;
11849|    240|    }
11850|       |
11851|       |    /* Have second '/z' ? */
11852|    490|    pr = strstr(s, "/r");
11853|    490|    if (pr)
  ------------------
  |  Branch (11853:9): [True: 182, False: 308]
  ------------------
11854|    182|    {
11855|    182|        pr++;
11856|       |
11857|    182|        pend = strchr(pr, '/');
11858|    182|        if (pend)
  ------------------
  |  Branch (11858:13): [True: 180, False: 2]
  ------------------
11859|    180|        {
11860|    180|            insert_pos[ninsert] = (int)(pend - s);
11861|    180|        }
11862|      2|        else
11863|      2|        {
11864|      2|            insert_pos[ninsert] = i_last_sym;
11865|      2|        }
11866|    182|        ninsert++;
11867|       |
11868|    182|        pz2 = strstr(pr, "/z");
11869|    182|        if (pz2)
  ------------------
  |  Branch (11869:13): [True: 179, False: 3]
  ------------------
11870|    179|        {
11871|    179|            pz2++;
11872|    179|            lead_pos = (int)(pz2 - s);
11873|    179|            pend = strchr(pz2, '/');
11874|    179|            if (pend)
  ------------------
  |  Branch (11874:17): [True: 59, False: 120]
  ------------------
11875|     59|            {
11876|     59|                zlen = (int)(pend - pz2);
11877|     59|            }
11878|    120|            else
11879|    120|            {
11880|    120|                zlen = (int)strlen(pz2);
11881|    120|            }
11882|    179|            if (tmpstr)
  ------------------
  |  Branch (11882:17): [True: 179, False: 0]
  ------------------
11883|    179|            {
11884|    179|                inchi_free(tmpstr);
  ------------------
  |  | 1152|    179|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 179, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 179]
  |  |  ------------------
  ------------------
11885|    179|            }
11886|    179|            tmpstr = (char*)inchi_calloc((long long)zlen + 32, sizeof(char)); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|    179|#define inchi_calloc   calloc
  ------------------
11887|    179|            if (!tmpstr)
  ------------------
  |  Branch (11887:17): [True: 0, False: 179]
  ------------------
11888|      0|            {
11889|      0|                ret = -2;
11890|      0|                goto endf;
11891|      0|            }
11892|    179|            memcpy(tmpstr, pz2, zlen);
11893|    179|            nstars = 0;
11894|    179|            ret = DetectHiddenPolymerStuff(tmpstr, zlen, &ninsert, insert_pos, lead_pos, &nstars);
11895|    179|            if (ret)
  ------------------
  |  Branch (11895:17): [True: 3, False: 176]
  ------------------
11896|      3|            {
11897|      3|                goto endf;
11898|      3|            }
11899|    179|        }
11900|    182|    }
11901|       |
11902|    487|    slen = (int)strlen(s);
11903|    487|    edited_s = (char*)inchi_calloc((long long)slen * 100 + 32 * 10 * (long long)ninsert, sizeof(char)); /* high reservation */ /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|    487|#define inchi_calloc   calloc
  ------------------
11904|    487|    if (!edited_s)
  ------------------
  |  Branch (11904:9): [True: 0, False: 487]
  ------------------
11905|      0|    {
11906|      0|        ret = -2;
11907|      0|        goto endf;
11908|      0|    }
11909|       |
11910|       |    /* Edits */
11911|    487|    nc = 0;
11912|    487|    nc_max = slen * 100 + 32 * 10 * ninsert; /* djb-rwth: fixing oss-fuzz issue #384549256 */
11913|    487|    kinsert = 0;
11914|    487|    star0 = nheavy + 1;
11915|   518k|    for (i = 0; i < slen; i++)
  ------------------
  |  Branch (11915:17): [True: 518k, False: 0]
  ------------------
11916|   518k|    {
11917|   518k|        if (kinsert < ninsert && i == insert_pos[kinsert])
  ------------------
  |  Branch (11917:13): [True: 491k, False: 26.5k]
  |  Branch (11917:34): [True: 86.5k, False: 405k]
  ------------------
11918|  86.5k|        {
11919|  86.5k|            if (kinsert == 0 || prev_layer_symbol == 'r')
  ------------------
  |  Branch (11919:17): [True: 487, False: 86.0k]
  |  Branch (11919:33): [True: 18, False: 86.0k]
  ------------------
11920|    505|            {
11921|    505|                sprintf(tmpstr, ".%dZz", nstars);
11922|    505|                star0 = nheavy + 1;            /* reset star numbers pool */
11923|    505|                prev_layer_symbol = '0';    /* avoid printing ';' also */
11924|    505|            }
11925|  86.0k|            else
11926|  86.0k|            {
11927|  86.0k|                sprintf(tmpstr, "%d,%d-", star0, star0 + 1);
11928|  86.0k|                star0 += 2;
11929|  86.0k|            }
11930|  86.5k|            kinsert++;
11931|   993k|            for (j = 0; j < (int)strlen(tmpstr); j++)
  ------------------
  |  Branch (11931:25): [True: 907k, False: 86.5k]
  ------------------
11932|   907k|            {
11933|   907k|                if (nc < nc_max)
  ------------------
  |  Branch (11933:21): [True: 907k, False: 0]
  ------------------
11934|   907k|                {
11935|   907k|                    edited_s[nc] = tmpstr[j];
11936|   907k|                    nc++;
11937|   907k|                }
11938|   907k|            }
11939|  86.5k|        }
11940|       |
11941|   518k|        if ((i == i_last_sym) && (nc < nc_max))
  ------------------
  |  Branch (11941:13): [True: 487, False: 518k]
  |  Branch (11941:34): [True: 487, False: 0]
  ------------------
11942|    487|        {
11943|    487|            edited_s[nc++] = s[i];
11944|    487|        }
11945|       |
11946|   518k|        if (s[i] == '/' || i == i_last_sym)
  ------------------
  |  Branch (11946:13): [True: 24.1k, False: 494k]
  |  Branch (11946:28): [True: 474, False: 493k]
  ------------------
11947|  24.6k|        {
11948|  24.6k|            if (prev_layer_symbol != '0' &&
  ------------------
  |  Branch (11948:17): [True: 23.6k, False: 992]
  ------------------
11949|  23.6k|                prev_layer_symbol != 'f' &&
  ------------------
  |  Branch (11949:17): [True: 19.7k, False: 3.86k]
  ------------------
11950|  19.7k|                prev_layer_symbol != 'z' &&
  ------------------
  |  Branch (11950:17): [True: 17.1k, False: 2.59k]
  ------------------
11951|  17.1k|                prev_layer_symbol != 'p' &&
  ------------------
  |  Branch (11951:17): [True: 16.7k, False: 411]
  ------------------
11952|  16.7k|                prev_layer_symbol != 'r' &&
  ------------------
  |  Branch (11952:17): [True: 14.1k, False: 2.66k]
  ------------------
11953|  14.1k|                prev_layer_symbol != 's'
  ------------------
  |  Branch (11953:17): [True: 12.5k, False: 1.58k]
  ------------------
11954|  24.6k|                )
11955|  12.5k|            {
11956|  12.5k|                char addon = ';';
11957|  12.5k|                if (prev_layer_symbol == 'm')
  ------------------
  |  Branch (11957:21): [True: 6.30k, False: 6.21k]
  ------------------
11958|  6.30k|                {
11959|  6.30k|                    addon = '.';
11960|  6.30k|                }
11961|  2.37M|                for (j = 0; j < nstars; j++)
  ------------------
  |  Branch (11961:29): [True: 2.35M, False: 12.5k]
  ------------------
11962|  2.35M|                {
11963|  2.35M|                    if (nc < nc_max)
  ------------------
  |  Branch (11963:25): [True: 2.35M, False: 0]
  ------------------
11964|  2.35M|                    {
11965|  2.35M|                        edited_s[nc++] = addon;
11966|  2.35M|                    }
11967|  2.35M|                }
11968|  12.5k|            }
11969|  12.1k|            else if (prev_layer_symbol == 'f')
  ------------------
  |  Branch (11969:22): [True: 3.86k, False: 8.24k]
  ------------------
11970|  3.86k|            {
11971|  3.86k|                if (s[i - 1] != 'f' && s[i - 2] != '/')
  ------------------
  |  Branch (11971:21): [True: 1.72k, False: 2.13k]
  |  Branch (11971:40): [True: 1.72k, False: 0]
  ------------------
11972|  1.72k|                {
11973|  1.72k|                    sprintf(tmpstr, ".%dZz", nstars);
11974|  9.83k|                    for (j = 0; j < (int)strlen(tmpstr); j++)
  ------------------
  |  Branch (11974:33): [True: 8.10k, False: 1.72k]
  ------------------
11975|  8.10k|                    {
11976|  8.10k|                        if (nc < nc_max)
  ------------------
  |  Branch (11976:29): [True: 8.10k, False: 0]
  ------------------
11977|  8.10k|                        {
11978|  8.10k|                            edited_s[nc] = tmpstr[j];
11979|  8.10k|                            nc++;
11980|  8.10k|                        }
11981|  8.10k|                    }
11982|  1.72k|                }
11983|  3.86k|            }
11984|       |
11985|  24.6k|            if (i != i_last_sym)
  ------------------
  |  Branch (11985:17): [True: 24.1k, False: 487]
  ------------------
11986|  24.1k|            {
11987|  24.1k|                prev_layer_symbol = s[i + 1];
11988|  24.1k|            }
11989|    487|            else
11990|    487|            {
11991|    487|                break;
11992|    487|            }
11993|  24.6k|        }
11994|   518k|        if (nc < nc_max)
  ------------------
  |  Branch (11994:13): [True: 518k, False: 0]
  ------------------
11995|   518k|        {
11996|   518k|            edited_s[nc] = s[i];
11997|   518k|            nc++;
11998|   518k|        }
11999|   518k|    }
12000|    487|    if (nc < nc_max)
  ------------------
  |  Branch (12000:9): [True: 487, False: 0]
  ------------------
12001|    487|    {
12002|    487|        edited_s[nc] = '\0';
12003|    487|    }
12004|    487|    inchi_strbuf_close(&is->s);
12005|    487|    inchi_ios_print(is, "%-s%-s\n", edited_s, s2 ? s2 : "");
  ------------------
  |  Branch (12005:47): [True: 33, False: 454]
  ------------------
12006|       |
12007|  6.28k|endf:
12008|  6.28k|    if (s)
  ------------------
  |  Branch (12008:9): [True: 6.28k, False: 0]
  ------------------
12009|  6.28k|    {
12010|  6.28k|        inchi_free(s);
  ------------------
  |  | 1152|  6.28k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 6.28k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 6.28k]
  |  |  ------------------
  ------------------
12011|  6.28k|    }
12012|  6.28k|    if (s2)
  ------------------
  |  Branch (12012:9): [True: 150, False: 6.13k]
  ------------------
12013|    150|    {
12014|    150|        inchi_free(s2);
  ------------------
  |  | 1152|    150|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 150, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 150]
  |  |  ------------------
  ------------------
12015|    150|    }
12016|  6.28k|    if (edited_s)
  ------------------
  |  Branch (12016:9): [True: 487, False: 5.79k]
  ------------------
12017|    487|    {
12018|    487|        inchi_free(edited_s);
  ------------------
  |  | 1152|    487|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 487, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 487]
  |  |  ------------------
  ------------------
12019|    487|    }
12020|  6.28k|    if (tmpstr)
  ------------------
  |  Branch (12020:9): [True: 744, False: 5.53k]
  ------------------
12021|    744|    {
12022|    744|        inchi_free(tmpstr);
  ------------------
  |  | 1152|    744|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 744, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 744]
  |  |  ------------------
  ------------------
12023|    744|    }
12024|  6.28k|    if (insert_pos)
  ------------------
  |  Branch (12024:9): [True: 744, False: 5.53k]
  ------------------
12025|    744|    {
12026|    744|        inchi_free(insert_pos);
  ------------------
  |  | 1152|    744|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 744, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 744]
  |  |  ------------------
  ------------------
12027|    744|    }
12028|       |
12029|  6.28k|    return ret;
12030|    487|}
DetectHiddenPolymerStuff:
12040|    923|{
12041|    923|    char c;
12042|    923|    int  opened, skip, i, i0, closed, ret = 0;
12043|       |
12044|    923|    *nstars = opened = skip = i0 = 0;
12045|    923|    closed = 1;
12046|   662k|    for (i = 0; i < tmpstrlen; i++)
  ------------------
  |  Branch (12046:17): [True: 661k, False: 906]
  ------------------
12047|   661k|    {
12048|   661k|        c = tmpstr[i];
12049|       |
12050|   661k|        if (c == '(')
  ------------------
  |  Branch (12050:13): [True: 194k, False: 467k]
  ------------------
12051|   194k|        {
12052|   194k|            if (!closed)
  ------------------
  |  Branch (12052:17): [True: 0, False: 194k]
  ------------------
12053|      0|            {
12054|      0|                ret = -3; goto endf;
12055|      0|            }
12056|   194k|            opened = 1;
12057|   194k|            skip = 0;
12058|   194k|            i0 = i;
12059|   194k|        }
12060|   467k|        else if (c == ')')
  ------------------
  |  Branch (12060:18): [True: 165k, False: 302k]
  ------------------
12061|   165k|        {
12062|   165k|            if (!opened)
  ------------------
  |  Branch (12062:17): [True: 17, False: 165k]
  ------------------
12063|     17|            {
12064|     17|                ret = -3; goto endf;
12065|     17|            }
12066|   165k|            if (!skip)
  ------------------
  |  Branch (12066:17): [True: 164k, False: 46]
  ------------------
12067|   164k|            {
12068|   164k|                (*nstars) += 2;
12069|   164k|                insert_pos[(*ninsert)] = i0 + 1 + insert_lead_offset;
12070|   164k|                (*ninsert)++;
12071|   164k|            }
12072|   165k|            opened = 0;
12073|   165k|        }
12074|   302k|        else if (c == '-')
  ------------------
  |  Branch (12074:18): [True: 3.64k, False: 298k]
  ------------------
12075|  3.64k|        {
12076|  3.64k|            skip = 1;
12077|  3.64k|        }
12078|   661k|    }
12079|       |
12080|    923|endf:
12081|    923|    return ret;
12082|    923|}
ichiread.c:bInChIHasReconnectedMetal:
 1983|   180k|{
 1984|   180k|    int i;
 1985|   180k|    if (pInChI && !pInChI->bDeleted && pInChI->nNumberOfAtoms && pInChI->nAtom)
  ------------------
  |  Branch (1985:9): [True: 180k, False: 0]
  |  Branch (1985:19): [True: 176k, False: 3.92k]
  |  Branch (1985:40): [True: 146k, False: 30.3k]
  |  Branch (1985:66): [True: 146k, False: 0]
  ------------------
 1986|   146k|    {
 1987|  1.07M|        for (i = 0; i < pInChI->nNumberOfAtoms; i++)
  ------------------
  |  Branch (1987:21): [True: 990k, False: 82.6k]
  ------------------
 1988|   990k|        {
 1989|   990k|            if (is_el_a_metal((int)pInChI->nAtom[i]))
  ------------------
  |  Branch (1989:17): [True: 65.4k, False: 925k]
  ------------------
 1990|  65.4k|            {
 1991|  65.4k|                if (pInChI->nNumberOfAtoms > 1 || (pInChI->nNum_H && pInChI->nNum_H[0])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1991:21): [True: 63.9k, False: 1.52k]
  |  Branch (1991:52): [True: 1.52k, False: 0]
  |  Branch (1991:70): [True: 4, False: 1.51k]
  ------------------
 1992|  63.9k|                {
 1993|  63.9k|                    return 1;
 1994|  63.9k|                }
 1995|  65.4k|            }
 1996|   990k|        }
 1997|   146k|    }
 1998|       |
 1999|   116k|    return 0;
 2000|   180k|}
ichiread.c:SetProtonsAndXchgIsoH:
 2012|  10.2k|{
 2013|  10.2k|    int      j, k, k1, ret2 = 0, iINChI;
 2014|  10.2k|    int  bAvailableProtonsForEachComponent, bAvailableProtonsTotal;
 2015|       |
 2016|       |    INCHI_HEAPCHK
 2017|       |
 2018|  10.2k|        num_components[INCHI_BAS] = num_components[INCHI_REC] = 0;
  ------------------
  |  |  570|  10.2k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      num_components[INCHI_BAS] = num_components[INCHI_REC] = 0;
  ------------------
  |  |  571|  10.2k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 2019|       |
 2020|  30.6k|    for (iINChI = 0; iINChI < INCHI_NUM; iINChI++)
  ------------------
  |  |  569|  30.6k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (2020:22): [True: 20.4k, False: 10.2k]
  ------------------
 2021|  20.4k|    {
 2022|  20.4k|        nModeProtonIsoExchgH[iINChI] = MODE_PIXH_UNDEFINED;
 2023|       |        /* are totals of /p and/or /i/h available ? */
 2024|  20.4k|        bAvailableProtonsTotal = 0 != OneInput->nNumProtons[iINChI][TAUT_YES].nNumRemovedProtons;
  ------------------
  |  |  575|  20.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2025|  81.7k|        for (k1 = 0; k1 < NUM_H_ISOTOPES; k1++)
  ------------------
  |  |   72|  81.7k|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (2025:22): [True: 61.2k, False: 20.4k]
  ------------------
 2026|  61.2k|        {
 2027|  61.2k|            bAvailableProtonsTotal |= 0 != OneInput->nNumProtons[iINChI][TAUT_YES].nNumRemovedIsotopicH[k1];
  ------------------
  |  |  575|  61.2k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2028|  61.2k|        }
 2029|       |        /* are /p and/or /i/h available for each component ? */
 2030|  20.4k|        bAvailableProtonsForEachComponent = (NULL != OneInput->nNumProtons[iINChI][TAUT_YES].pNumProtons);
  ------------------
  |  |  575|  20.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2031|       |
 2032|       |        /* decision: add /p to each component, add total to the 1st, add total as one more component */
 2033|       |        /* In case of bInChI2Structure just keep totals if not available for each component */
 2034|       |
 2035|  20.4k|        if (bInChI2Structure)
  ------------------
  |  Branch (2035:13): [True: 10.3k, False: 10.0k]
  ------------------
 2036|  10.3k|        {
 2037|  10.3k|            nModeProtonIsoExchgH[iINChI] = bAvailableProtonsForEachComponent ?
  ------------------
  |  Branch (2037:44): [True: 0, False: 10.3k]
  ------------------
 2038|      0|                MODE_PIXH_ADD_TO_EACH :
 2039|  10.3k|                MODE_PIXH_KEEP_TOTALS;
 2040|  10.3k|        }
 2041|  10.0k|        else
 2042|  10.0k|        {
 2043|  10.0k|            if (!bReqSplitOutputInChI)
  ------------------
  |  Branch (2043:17): [True: 10.0k, False: 0]
  ------------------
 2044|  10.0k|            {
 2045|  10.0k|                nModeProtonIsoExchgH[iINChI] = bAvailableProtonsForEachComponent ?
  ------------------
  |  Branch (2045:48): [True: 0, False: 10.0k]
  ------------------
 2046|      0|                    MODE_PIXH_ADD_TO_EACH :
 2047|  10.0k|                    MODE_PIXH_ADD_TO_FIRST;
 2048|  10.0k|            }
 2049|      0|            else
 2050|      0|            {
 2051|      0|                if (!bAvailableProtonsForEachComponent)
  ------------------
  |  Branch (2051:21): [True: 0, False: 0]
  ------------------
 2052|      0|                {
 2053|      0|                    nModeProtonIsoExchgH[iINChI] = bAvailableProtonsTotal ?
  ------------------
  |  Branch (2053:52): [True: 0, False: 0]
  ------------------
 2054|      0|                        MODE_PIXH_ADD_A_PIXH_COMPONENT :
 2055|      0|                        MODE_PIXH_ADD_TO_FIRST;
 2056|      0|                }
 2057|      0|                else
 2058|      0|                {
 2059|       |                    /* bAvailableProtonsForEachComponent && bReqSplitOutputInChI */
 2060|      0|                    if (bReqProtonsForEachComponent)
  ------------------
  |  Branch (2060:25): [True: 0, False: 0]
  ------------------
 2061|      0|                    {
 2062|      0|                        nModeProtonIsoExchgH[iINChI] = MODE_PIXH_ADD_TO_EACH;
 2063|      0|                    }
 2064|      0|                    else
 2065|      0|                    {
 2066|      0|                        nModeProtonIsoExchgH[iINChI] = bReqNonTaut ?
  ------------------
  |  Branch (2066:56): [True: 0, False: 0]
  ------------------
 2067|      0|                            MODE_PIXH_ADD_TO_EACH :
 2068|      0|                            MODE_PIXH_ADD_A_PIXH_COMPONENT;
 2069|      0|                    }
 2070|      0|                }
 2071|      0|            }
 2072|  10.0k|        }
 2073|       |
 2074|       |        /* remove unneeded data: protons for each component */
 2075|  20.4k|        if (bAvailableProtonsForEachComponent &&
  ------------------
  |  Branch (2075:13): [True: 0, False: 20.4k]
  ------------------
 2076|      0|            nModeProtonIsoExchgH[iINChI] != MODE_PIXH_ADD_TO_EACH)
  ------------------
  |  Branch (2076:13): [True: 0, False: 0]
  ------------------
 2077|      0|        {
 2078|      0|            inchi_free(OneInput->nNumProtons[iINChI][TAUT_YES].pNumProtons);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2079|      0|            OneInput->nNumProtons[iINChI][TAUT_YES].pNumProtons = NULL;
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2080|      0|            bAvailableProtonsForEachComponent = 0;
 2081|      0|        }
 2082|       |        /* remove unneeded data: total protons all components */
 2083|  20.4k|        if (bAvailableProtonsTotal && nModeProtonIsoExchgH[iINChI] == MODE_PIXH_ADD_TO_EACH)
  ------------------
  |  Branch (2083:13): [True: 376, False: 20.0k]
  |  Branch (2083:39): [True: 0, False: 376]
  ------------------
 2084|      0|        {
 2085|      0|            OneInput->nNumProtons[iINChI][TAUT_YES].nNumRemovedProtons = 0;
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2086|      0|            for (k1 = 0; k1 < NUM_H_ISOTOPES; k1++)
  ------------------
  |  |   72|      0|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (2086:26): [True: 0, False: 0]
  ------------------
 2087|      0|            {
 2088|      0|                OneInput->nNumProtons[iINChI][TAUT_YES].nNumRemovedIsotopicH[k1] = 0;
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2089|      0|            }
 2090|       |            /* djb-rwth: removing redundant code */
 2091|      0|        }
 2092|       |        /* remove unneeded data: Fixed-H InChI; no protons data exist for Fixed-H */
 2093|  20.4k|        if (!bReqNonTaut && OneInput->nNumComponents[iINChI][TAUT_NON])
  ------------------
  |  |  574|  10.0k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2093:13): [True: 10.0k, False: 10.3k]
  |  Branch (2093:29): [True: 1.27k, False: 8.77k]
  ------------------
 2094|  1.27k|        {
 2095|  1.27k|            j = TAUT_NON;
  ------------------
  |  |  574|  1.27k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 2096|  2.62k|            for (k = 0; k < OneInput->nNumComponents[iINChI][j]; k++)
  ------------------
  |  Branch (2096:25): [True: 1.35k, False: 1.27k]
  ------------------
 2097|  1.35k|            {
 2098|  1.35k|                Free_INChI_Members(&OneInput->pInpInChI[iINChI][j][k]);
 2099|  1.35k|            }
 2100|  1.27k|            inchi_free(OneInput->pInpInChI[iINChI][j]);
  ------------------
  |  | 1152|  1.27k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 1.27k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 1.27k]
  |  |  ------------------
  ------------------
 2101|  1.27k|            OneInput->pInpInChI[iINChI][j] = NULL;
 2102|  1.27k|            OneInput->nNumComponents[iINChI][j] = 0;
 2103|  1.27k|        }
 2104|       |#ifdef NEVER
 2105|       |        /* remove unneeded data: Mobile-H InChI ????? */
 2106|       |        if (bReqNonTaut && OneInput->nNumComponents[iINChI][TAUT_NON])
 2107|       |        {
 2108|       |            j = TAUT_YES;
 2109|       |            for (k = 0; k < OneInput->nNumComponents[iINChI][j]; k++)
 2110|       |            {
 2111|       |                Free_INChI_Members(&OneInput->pInpInChI[iINChI][j][k]);
 2112|       |            }
 2113|       |            inchi_free(OneInput->pInpInChI[iINChI][j]);
 2114|       |            OneInput->pInpInChI[iINChI][j] = NULL;
 2115|       |            OneInput->nNumComponents[iINChI][j] = 0;
 2116|       |            nModeProtonIsoExchgH[iINChI] = MODE_PIXH_UNDEFINED;
 2117|       |            if (OneInput->nNumProtons[iINChI][TAUT_YES].pNumProtons)
 2118|       |            {
 2119|       |                inchi_free(OneInput->nNumProtons[iINChI][TAUT_YES].pNumProtons);
 2120|       |                OneInput->nNumProtons[iINChI][TAUT_YES].pNumProtons = NULL;
 2121|       |            }
 2122|       |        }
 2123|       |#endif
 2124|       |        /* add one more component containing only /p and /i/h */
 2125|  20.4k|        if ((nModeProtonIsoExchgH[iINChI] == MODE_PIXH_ADD_A_PIXH_COMPONENT &&
  ------------------
  |  Branch (2125:14): [True: 0, False: 20.4k]
  ------------------
 2126|      0|            OneInput->nNumComponents[iINChI][TAUT_YES]) ||
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2126:13): [True: 0, False: 0]
  ------------------
 2127|       |            /* always add one deleted component if no non-taut InChI is available */
 2128|  20.4k|            (bInChI2Structure && !bAvailableProtonsForEachComponent &&
  ------------------
  |  Branch (2128:14): [True: 10.3k, False: 10.0k]
  |  Branch (2128:34): [True: 10.3k, False: 0]
  ------------------
 2129|  10.3k|                !OneInput->nNumComponents[iINChI][TAUT_NON] &&
  ------------------
  |  |  574|  10.3k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2129:17): [True: 9.08k, False: 1.29k]
  ------------------
 2130|  9.08k|                OneInput->nNumComponents[iINChI][TAUT_YES])) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |  575|  9.08k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2130:17): [True: 3.92k, False: 5.16k]
  ------------------
 2131|  3.92k|        {
 2132|  3.92k|            int nPrevLen, nLen = 0;
 2133|  3.92k|            j = TAUT_YES;
  ------------------
  |  |  575|  3.92k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2134|  3.92k|            nPrevLen = OneInput->nNumComponents[iINChI][j];
 2135|   117k|            for (k = 0; k < nPrevLen; k++)
  ------------------
  |  Branch (2135:25): [True: 113k, False: 3.92k]
  ------------------
 2136|   113k|            {
 2137|   113k|                nLen += !OneInput->pInpInChI[iINChI][j][k].bDeleted;
 2138|   113k|            }
 2139|  3.92k|            if (nLen == nPrevLen)
  ------------------
  |  Branch (2139:17): [True: 3.91k, False: 7]
  ------------------
 2140|  3.91k|            {
 2141|       |                /* add one more component */
 2142|  3.91k|                INChI* pInChI = (INChI*)inchi_calloc((long long)nLen + 1, sizeof(*pInChI)); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  3.91k|#define inchi_calloc   calloc
  ------------------
 2143|  3.91k|                if (!pInChI)
  ------------------
  |  Branch (2143:21): [True: 0, False: 3.91k]
  ------------------
 2144|      0|                {
 2145|      0|                    ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 2146|      0|                    goto exit_error;
 2147|      0|                }
 2148|  3.91k|                memcpy(pInChI, OneInput->pInpInChI[iINChI][j], nLen * sizeof(*pInChI));
 2149|  3.91k|                inchi_free(OneInput->pInpInChI[iINChI][j]);
  ------------------
  |  | 1152|  3.91k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 3.91k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 3.91k]
  |  |  ------------------
  ------------------
 2150|  3.91k|                OneInput->pInpInChI[iINChI][j] = pInChI;
 2151|  3.91k|            }
 2152|  3.92k|            OneInput->nNumComponents[iINChI][j] = nLen + 1;
 2153|       |
 2154|  3.93k|            for (k = nLen; k < nPrevLen; k++)
  ------------------
  |  Branch (2154:28): [True: 7, False: 3.92k]
  ------------------
 2155|      7|            {
 2156|      7|                Free_INChI_Members(&OneInput->pInpInChI[iINChI][j][k]);
 2157|      7|                memset(&OneInput->pInpInChI[iINChI][j][k], 0, sizeof(OneInput->pInpInChI[iINChI][j][k])); /* djb-rwth: memset_s C11/Annex K variant? */
 2158|      7|            }
 2159|       |            /* mark the last component as a proton */
 2160|  3.92k|            if (0 > (ret2 = nFillOutProtonMobileH(OneInput->pInpInChI[iINChI][j] + nLen)))
  ------------------
  |  Branch (2160:17): [True: 0, False: 3.92k]
  ------------------
 2161|      0|            {
 2162|      0|                goto exit_error;
 2163|      0|            }
 2164|  3.92k|        }
 2165|  20.4k|        INCHI_HEAPCHK
 2166|       |
 2167|       |            /* remove unneeded Stereo and/or Fixed H */
 2168|  20.4k|            if (!bReqStereo)
  ------------------
  |  Branch (2168:17): [True: 0, False: 20.4k]
  ------------------
 2169|      0|            {
 2170|      0|                for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  573|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (2170:29): [True: 0, False: 0]
  ------------------
 2171|      0|                {
 2172|      0|                    for (k = 0; k < OneInput->nNumComponents[iINChI][j]; k++)
  ------------------
  |  Branch (2172:33): [True: 0, False: 0]
  ------------------
 2173|      0|                    {
 2174|      0|                        if (OneInput->pInpInChI[iINChI][j][k].Stereo)
  ------------------
  |  Branch (2174:29): [True: 0, False: 0]
  ------------------
 2175|      0|                        {
 2176|      0|                            Free_INChI_Stereo(OneInput->pInpInChI[iINChI][j][k].Stereo);
 2177|      0|                            inchi_free(OneInput->pInpInChI[iINChI][j][k].Stereo);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2178|      0|                            OneInput->pInpInChI[iINChI][j][k].Stereo = NULL;
 2179|      0|                        }
 2180|      0|                        if (OneInput->pInpInChI[iINChI][j][k].StereoIsotopic)
  ------------------
  |  Branch (2180:29): [True: 0, False: 0]
  ------------------
 2181|      0|                        {
 2182|      0|                            Free_INChI_Stereo(OneInput->pInpInChI[iINChI][j][k].StereoIsotopic);
 2183|      0|                            inchi_free(OneInput->pInpInChI[iINChI][j][k].StereoIsotopic);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2184|      0|                            OneInput->pInpInChI[iINChI][j][k].StereoIsotopic = NULL;
 2185|      0|                        }
 2186|      0|                        INCHI_HEAPCHK
 2187|      0|                    }
 2188|      0|                }
 2189|      0|            }
 2190|       |
 2191|  20.4k|    }
 2192|       |
 2193|  10.2k|    num_components[INCHI_BAS] = inchi_max(OneInput->nNumComponents[INCHI_BAS][TAUT_YES],
  ------------------
  |  |  570|  10.2k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                  num_components[INCHI_BAS] = inchi_max(OneInput->nNumComponents[INCHI_BAS][TAUT_YES],
  ------------------
  |  |  138|  10.2k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 8.94k, False: 1.27k]
  |  |  ------------------
  ------------------
 2194|  10.2k|        OneInput->nNumComponents[INCHI_BAS][TAUT_NON]);
 2195|  10.2k|    num_components[INCHI_REC] = inchi_max(OneInput->nNumComponents[INCHI_REC][TAUT_YES],
  ------------------
  |  |  571|  10.2k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                  num_components[INCHI_REC] = inchi_max(OneInput->nNumComponents[INCHI_REC][TAUT_YES],
  ------------------
  |  |  138|  10.2k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 31, False: 10.1k]
  |  |  ------------------
  ------------------
 2196|  10.2k|        OneInput->nNumComponents[INCHI_REC][TAUT_NON]);
 2197|       |
 2198|  10.2k|exit_error:
 2199|  10.2k|    return ret2;
 2200|  10.2k|}
ichiread.c:GetInChINumH:
 2244|   350k|{
 2245|   350k|    int i, j, nNumTautGroups, iTautGroup, nTautGroupLen, lenTautomer;
 2246|   350k|    *nNumH = 0;
 2247|  4.98M|    for (i = 0; i < pInChI->nNumberOfAtoms; i++)
  ------------------
  |  Branch (2247:17): [True: 4.63M, False: 350k]
  ------------------
 2248|  4.63M|    {
 2249|  4.63M|        *nNumH += (pInChI->nAtom[i] == EL_NUMBER_H); /* bridging H */
  ------------------
  |  |   11|  4.63M|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
 2250|  4.63M|        *nNumH += pInChI->nNum_H[i];
 2251|  4.63M|    }
 2252|       |    /* earlier nNum_H_fixed[] should have been added to pInChI->nNum_H[] */
 2253|       |    /*
 2254|       |    if ( pInChI->nNum_H_fixed ) {
 2255|       |    for ( i = 0; i < pInChI->nNumberOfAtoms; i ++ ) {
 2256|       |    *nNumH += pInChI->nNum_H_fixed[i];
 2257|       |    }
 2258|       |    }
 2259|       |    */
 2260|   350k|    if (pInChI->lenTautomer > 3 && pInChI->nTautomer)
  ------------------
  |  Branch (2260:9): [True: 6.22k, False: 343k]
  |  Branch (2260:36): [True: 6.22k, False: 0]
  ------------------
 2261|  6.22k|    {
 2262|  6.22k|        lenTautomer = pInChI->lenTautomer;
 2263|  6.22k|        j = 0;
 2264|  6.22k|        nNumTautGroups = pInChI->nTautomer[j++];
 2265|  16.9k|        for (iTautGroup = 0; j < lenTautomer && iTautGroup < nNumTautGroups; iTautGroup++, j += nTautGroupLen)
  ------------------
  |  Branch (2265:30): [True: 10.6k, False: 6.22k]
  |  Branch (2265:49): [True: 10.6k, False: 0]
  ------------------
 2266|  10.6k|        {
 2267|  10.6k|            nTautGroupLen = pInChI->nTautomer[j] + 1;
 2268|  10.6k|            *nNumH += pInChI->nTautomer[j + 1];
 2269|  10.6k|        }
 2270|  6.22k|        if (iTautGroup != nNumTautGroups || j != lenTautomer)
  ------------------
  |  Branch (2270:13): [True: 0, False: 6.22k]
  |  Branch (2270:45): [True: 0, False: 6.22k]
  ------------------
 2271|      0|        {
 2272|      0|            return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2273|      0|        }
 2274|  6.22k|    }
 2275|   350k|    if (pInChI->nNum_H_fixed && (pInChI->lenTautomer || pInChI->nTautomer))
  ------------------
  |  Branch (2275:9): [True: 4.05k, False: 346k]
  |  Branch (2275:34): [True: 0, False: 4.05k]
  |  Branch (2275:57): [True: 0, False: 4.05k]
  ------------------
 2276|      0|    {
 2277|      0|        return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2278|      0|    }
 2279|       |
 2280|   350k|    return 0;
 2281|   350k|}
ichiread.c:GetInChIFormulaNumH:
 2205|  72.5k|{  /* get number of H including bridging hydrogen atoms */
 2206|  72.5k|    const char* p, * q;
 2207|  72.5k|    *nNumH = 0;
 2208|  72.5k|    if (pInChI->szHillFormula)
  ------------------
  |  Branch (2208:9): [True: 72.5k, False: 0]
  ------------------
 2209|  72.5k|    {
 2210|  78.8k|        for (p = strchr(pInChI->szHillFormula, 'H'); p; p = strchr(p, 'H'))
  ------------------
  |  Branch (2210:54): [True: 6.29k, False: 72.5k]
  ------------------
 2211|  6.29k|        {
 2212|  6.29k|            p++;
 2213|  6.29k|            if (!islower(UCINT * p))
  ------------------
  |  Branch (2213:17): [True: 6.18k, False: 109]
  ------------------
 2214|  6.18k|            {
 2215|       |                /* found hydrogen in the formula */
 2216|  6.18k|                if (isdigit(UCINT * p))
  ------------------
  |  Branch (2216:21): [True: 652, False: 5.53k]
  ------------------
 2217|    652|                {
 2218|    652|#if ( CHECK_STRTOL_ATNUMB==1 )
 2219|    652|                    int delta = (int)inchi_strtol(p, &q, 10);
 2220|    652|                    if (delta > MAX_ATOMS || delta < 0)
  ------------------
  |  |   15|  1.30k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (2220:25): [True: 0, False: 652]
  |  Branch (2220:46): [True: 0, False: 652]
  ------------------
 2221|      0|                    {
 2222|      0|                        return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 2223|      0|                    }
 2224|    652|                    *nNumH += delta;
 2225|       |#else
 2226|       |                    * nNumH += (int)inchi_strtol(p, &q, 10);
 2227|       |#endif
 2228|    652|                    p = q;
 2229|    652|                }
 2230|  5.53k|                else
 2231|  5.53k|                {
 2232|  5.53k|                    *nNumH += 1;
 2233|  5.53k|                }
 2234|  6.18k|            }
 2235|  6.29k|        }
 2236|  72.5k|    }
 2237|       |
 2238|  72.5k|    return 0;
 2239|  72.5k|}
ichiread.c:GetInChIIsoH:
 2286|  66.7k|{
 2287|  66.7k|    int i;
 2288|   266k|    for (i = 0; i < NUM_H_ISOTOPES; i++)
  ------------------
  |  |   72|   266k|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (2288:17): [True: 200k, False: 66.7k]
  ------------------
 2289|   200k|    {
 2290|   200k|        nNumIsotopicH[i] = 0;
 2291|   200k|    }
 2292|  67.4k|    for (i = 0; i < pInChI->nNumberOfIsotopicAtoms; i++)
  ------------------
  |  Branch (2292:17): [True: 752, False: 66.7k]
  ------------------
 2293|    752|    {
 2294|    752|        if (pInChI->IsotopicAtom[i].nIsoDifference > 0 &&
  ------------------
  |  Branch (2294:13): [True: 148, False: 604]
  ------------------
 2295|    148|            pInChI->IsotopicAtom[i].nIsoDifference <= NUM_H_ISOTOPES)
  ------------------
  |  |   72|    148|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (2295:13): [True: 135, False: 13]
  ------------------
 2296|    135|        {
 2297|    135|            if (!pInChI->nAtom ||
  ------------------
  |  Branch (2297:17): [True: 0, False: 135]
  ------------------
 2298|    135|                !pInChI->IsotopicAtom[i].nAtomNumber ||
  ------------------
  |  Branch (2298:17): [True: 0, False: 135]
  ------------------
 2299|    135|                pInChI->IsotopicAtom[i].nAtomNumber > pInChI->nNumberOfAtoms)
  ------------------
  |  Branch (2299:17): [True: 0, False: 135]
  ------------------
 2300|      0|            {
 2301|      0|                return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2302|      0|            }
 2303|    135|            if (pInChI->nAtom[pInChI->IsotopicAtom[i].nAtomNumber - 1] == (AT_NUMB)EL_NUMBER_H)
  ------------------
  |  |   11|    135|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
  |  Branch (2303:17): [True: 1, False: 134]
  ------------------
 2304|      1|            {
 2305|       |                /* isotopic H in connection table */
 2306|      1|                nNumIsotopicH[pInChI->IsotopicAtom[i].nIsoDifference - 1]++;
 2307|      1|            }
 2308|    135|        }
 2309|    752|        nNumIsotopicH[0] += pInChI->IsotopicAtom[i].nNum_H;
 2310|    752|        nNumIsotopicH[1] += pInChI->IsotopicAtom[i].nNum_D;
 2311|    752|        nNumIsotopicH[2] += pInChI->IsotopicAtom[i].nNum_T;
 2312|    752|    }
 2313|       |
 2314|  66.7k|    return 0;
 2315|  66.7k|}
ichiread.c:ReadInChILine:
 5019|  12.5k|{
 5020|  12.5k|    int   c, ret = RI_ERR_ALLOC, len; /* djb-rwth: removing redundant variables */
  ------------------
  |  |   15|  12.5k|#define RI_ERR_ALLOC   (-1)
  ------------------
 5021|  12.5k|    int   bMobileH = TAUT_YES, bReconn = INCHI_BAS;
  ------------------
  |  |  575|  12.5k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  int   bMobileH = TAUT_YES, bReconn = INCHI_BAS;
  ------------------
  |  |  570|  12.5k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 5022|  12.5k|    const char szToken[] = INCHI_TOKEN;
  ------------------
  |  |  277|  12.5k|#define INCHI_TOKEN "/\n\r\t\\"
  ------------------
 5023|  12.5k|    char* p;
 5024|  12.5k|    int  state = -1, prev_state = -1;
 5025|  12.5k|    int  bAbc = -1;                    /* -1=> undefined, 0=> decimal, 1=> abc (compressed) */
 5026|       |
 5027|  12.5k|    const int len_version_prefix = (int)(sizeof("InChI=1") - 1);
 5028|  12.5k|    size_t k = 0;
 5029|  12.5k|    unsigned char let1 = 0, let2 = 0;
 5030|  12.5k|    const char a2p[] = "ABCDEFGHIJKLMNOP";
 5031|       |
 5032|  12.5k|    int na_total = 0;                /* whole struct, without explH */
 5033|  12.5k|    int nb_total = 0;                /* whole struct, without explH */
 5034|  12.5k|#if ( DISABLE_READ_COMPRESSED_INCHI==1 )
 5035|  12.5k|    bAbc = 0;
 5036|       |    /* We do not support compressed InChI explicitly */
 5037|       |    /* Parsing compressed InChI easily fails on fake/fuzzing inputs */
 5038|  12.5k|#endif
 5039|       |    /* memset( pLine, 0, sizeof( pLine[0] ) ); */
 5040|  12.5k|    * pState = 0;
 5041|       |
 5042|  12.5k|next_line:
 5043|  12.5k|    INCHI_HEAPCHK
 5044|       |        /* Got "InChI=1/" */
 5045|  12.5k|        if (pLine->len)
  ------------------
  |  Branch (5045:13): [True: 0, False: 12.5k]
  ------------------
 5046|      0|        {
 5047|      0|            c = pLine->c;
 5048|      0|        }
 5049|  12.5k|        else
 5050|  12.5k|        {
 5051|  12.5k|            INCHI_HEAPCHK
 5052|  12.5k|                c = nGetInChISegment(pInp, pLine, szToken);
 5053|  12.5k|            INCHI_HEAPCHK
 5054|  12.5k|        }
 5055|  12.5k|    if (pLine->str && (c == RI_ERR_EOF && !pLine->len && !pLine->str[0])) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  |   19|  25.1k|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (5055:9): [True: 12.5k, False: 0]
  |  Branch (5055:24): [True: 0, False: 12.5k]
  |  Branch (5055:43): [True: 0, False: 0]
  |  Branch (5055:58): [True: 0, False: 0]
  ------------------
 5056|      0|    {
 5057|      0|        ret = c;
 5058|      0|        goto exit_function;
 5059|      0|    }
 5060|  12.5k|    INCHI_HEAPCHK
 5061|       |
 5062|  12.5k|        if (pLine->str && (pLine->len == 0 || (c != SEG_END && c != RI_ERR_EOF) || !(p = strstr(pLine->str, "InChI=1")))) /* djb-rwth: fixing a NULL pointer dereference; addressing LLVM warning; ignoring LLVM warning: value used */
  ------------------
  |  |  273|  25.1k|#define SEG_END '/'
  ------------------
                      if (pLine->str && (pLine->len == 0 || (c != SEG_END && c != RI_ERR_EOF) || !(p = strstr(pLine->str, "InChI=1")))) /* djb-rwth: fixing a NULL pointer dereference; addressing LLVM warning; ignoring LLVM warning: value used */
  ------------------
  |  |   19|      0|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (5062:13): [True: 12.5k, False: 0]
  |  Branch (5062:28): [True: 0, False: 12.5k]
  |  Branch (5062:48): [True: 0, False: 12.5k]
  |  Branch (5062:64): [True: 0, False: 0]
  |  Branch (5062:84): [True: 0, False: 12.5k]
  ------------------
 5063|      0|        {
 5064|      0|            if (pLine->str && pLine->str == strstr(pLine->str, "Structure"))
  ------------------
  |  Branch (5064:17): [True: 0, False: 0]
  |  Branch (5064:31): [True: 0, False: 0]
  ------------------
 5065|      0|            {
 5066|      0|                if (*pStr)
  ------------------
  |  Branch (5066:21): [True: 0, False: 0]
  ------------------
 5067|      0|                {
 5068|      0|                    INCHI_HEAPCHK
 5069|      0|                        inchi_free(*pStr);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5070|      0|                }
 5071|      0|                *pStr = pLine->str;
 5072|       |                /* bypass to the end of the 'Structure nnn' line */
 5073|      0|                memset(pLine, 0, sizeof(pLine[0])); /* djb-rwth: memset_s C11/Annex K variant? */
 5074|      0|                while (c && !INCHI_INP_EOL(c))
  ------------------
  |  |  275|      0|#define INCHI_INP_EOL(X) ((X)=='\n' || (X)=='\r' || (X)=='\t')
  |  |  ------------------
  |  |  |  Branch (275:27): [True: 0, False: 0]
  |  |  |  Branch (275:40): [True: 0, False: 0]
  |  |  |  Branch (275:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (5074:24): [True: 0, False: 0]
  ------------------
 5075|      0|                {
 5076|      0|                    c = getInChIChar(pInp);
 5077|      0|                }
 5078|      0|                goto next_line;
 5079|      0|            }
 5080|       |            /* bypass to the end of unrecognized line */
 5081|      0|            while (c != RI_ERR_EOF && !INCHI_INP_EOL(c))
  ------------------
  |  |   19|      0|#define RI_ERR_EOF     (0)
  ------------------
                          while (c != RI_ERR_EOF && !INCHI_INP_EOL(c))
  ------------------
  |  |  275|      0|#define INCHI_INP_EOL(X) ((X)=='\n' || (X)=='\r' || (X)=='\t')
  |  |  ------------------
  |  |  |  Branch (275:27): [True: 0, False: 0]
  |  |  |  Branch (275:40): [True: 0, False: 0]
  |  |  |  Branch (275:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (5081:20): [True: 0, False: 0]
  ------------------
 5082|      0|            {
 5083|      0|                c = getInChIChar(pInp);
 5084|      0|            }
 5085|      0|            pLine->len = 0;
 5086|      0|            INCHI_HEAPCHK
 5087|      0|                goto next_line;
 5088|      0|        }
 5089|       |
 5090|       |
 5091|       |    /*
 5092|       |     * Preserve the calculation-class designator and Molecular Inorganics
 5093|       |     * subversion designator from the input prefix. Historical InChI=1/...
 5094|       |     * remains accepted as non-standard input.
 5095|       |     */
 5096|  12.5k|    *bStdFormat = INCHI_INPUT_CLASS_NONSTANDARD;
  ------------------
  |  |   76|  12.5k|#define INCHI_INPUT_CLASS_NONSTANDARD  0x00
  ------------------
 5097|       |
 5098|  12.5k|    if (pLine->str &&
  ------------------
  |  Branch (5098:9): [True: 12.5k, False: 0]
  ------------------
 5099|  12.5k|        (pLine->len == len_version_prefix + 1 ||
  ------------------
  |  Branch (5099:10): [True: 118, False: 12.4k]
  ------------------
 5100|  12.4k|         (pLine->len == len_version_prefix + 2 &&
  ------------------
  |  Branch (5100:11): [True: 0, False: 12.4k]
  ------------------
 5101|      0|          pLine->str[len_version_prefix + 1] == 'B')))
  ------------------
  |  Branch (5101:11): [True: 0, False: 0]
  ------------------
 5102|    118|    {
 5103|    118|        switch (pLine->str[len_version_prefix])
  ------------------
  |  Branch (5103:17): [True: 118, False: 0]
  ------------------
 5104|    118|        {
 5105|     70|        case 'S':
  ------------------
  |  Branch (5105:9): [True: 70, False: 48]
  ------------------
 5106|     70|            *bStdFormat = INCHI_INPUT_CLASS_STANDARD;
  ------------------
  |  |   77|     70|#define INCHI_INPUT_CLASS_STANDARD     0x01
  ------------------
 5107|     70|            break;
 5108|       |
 5109|     48|        case 'B':
  ------------------
  |  Branch (5109:9): [True: 48, False: 70]
  ------------------
 5110|     48|            *bStdFormat = INCHI_INPUT_CLASS_BETA;
  ------------------
  |  |   78|     48|#define INCHI_INPUT_CLASS_BETA         0x02
  ------------------
 5111|     48|            break;
 5112|       |
 5113|      0|        case 'N':
  ------------------
  |  Branch (5113:9): [True: 0, False: 118]
  ------------------
 5114|      0|            *bStdFormat = INCHI_INPUT_CLASS_NONSTANDARD;
  ------------------
  |  |   76|      0|#define INCHI_INPUT_CLASS_NONSTANDARD  0x00
  ------------------
 5115|      0|            break;
 5116|    118|        }
 5117|       |
 5118|    118|        if (pLine->len == len_version_prefix + 2 &&
  ------------------
  |  Branch (5118:13): [True: 0, False: 118]
  ------------------
 5119|      0|            strchr("SBN", pLine->str[len_version_prefix]))
  ------------------
  |  Branch (5119:13): [True: 0, False: 0]
  ------------------
 5120|      0|        {
 5121|      0|            *bStdFormat |= INCHI_INPUT_MI_MARKER;
  ------------------
  |  |   79|      0|#define INCHI_INPUT_MI_MARKER          0x04
  ------------------
 5122|      0|        }
 5123|    118|    }
 5124|       |
 5125|  12.5k|    state = IST_MOBILE_H_FORMULA;
 5126|  12.5k|    ret = 1; /* means read the next segment */
 5127|  12.5k|    do
 5128|   110k|    {
 5129|       |        /* read the next segment up to the '/' */
 5130|   110k|        INCHI_HEAPCHK
 5131|   110k|            if (ret < 0)
  ------------------
  |  Branch (5131:17): [True: 2.21k, False: 108k]
  ------------------
 5132|  2.21k|            {
 5133|  2.21k|                *pState = prev_state;
 5134|  2.21k|                break;
 5135|  2.21k|            }
 5136|   108k|        prev_state = state + (bReconn ? IST_HAPPENED_IN_RECMET : 0);
  ------------------
  |  |  342|  1.88k|#define IST_HAPPENED_IN_RECMET   100
  ------------------
  |  Branch (5136:31): [True: 1.88k, False: 106k]
  ------------------
 5137|   108k|        if (0 < ret)
  ------------------
  |  Branch (5137:13): [True: 46.9k, False: 61.3k]
  ------------------
 5138|  46.9k|        {
 5139|       |            /* read next segment */
 5140|  46.9k|            if (c != RI_ERR_EOF && c != SEG_END)
  ------------------
  |  |   19|  93.9k|#define RI_ERR_EOF     (0)
  ------------------
                          if (c != RI_ERR_EOF && c != SEG_END)
  ------------------
  |  |  273|  37.6k|#define SEG_END '/'
  ------------------
  |  Branch (5140:17): [True: 37.6k, False: 9.30k]
  |  Branch (5140:36): [True: 314, False: 37.3k]
  ------------------
 5141|    314|            {
 5142|       |                /* abnormal reading result; should not happen */
 5143|       |                /* unless we got backslash-SaveOpt */
 5144|    314|                if (c == '\\')
  ------------------
  |  Branch (5144:21): [True: 12, False: 302]
  ------------------
 5145|     12|                {
 5146|       |                    /* May be SaveOpt */
 5147|     12|                    *input_has_save_opt = 1;
 5148|     12|                }
 5149|    314|                k = 0;
 5150|    534|                while (c != RI_ERR_EOF && !INCHI_INP_EOL(c))
  ------------------
  |  |   19|  1.06k|#define RI_ERR_EOF     (0)
  ------------------
                              while (c != RI_ERR_EOF && !INCHI_INP_EOL(c))
  ------------------
  |  |  275|    522|#define INCHI_INP_EOL(X) ((X)=='\n' || (X)=='\r' || (X)=='\t')
  |  |  ------------------
  |  |  |  Branch (275:27): [True: 198, False: 324]
  |  |  |  Branch (275:40): [True: 52, False: 272]
  |  |  |  Branch (275:53): [True: 52, False: 220]
  |  |  ------------------
  ------------------
  |  Branch (5150:24): [True: 522, False: 12]
  ------------------
 5151|    220|                {
 5152|       |                    /* bypass to the end of line or file */
 5153|    220|                    c = getInChIChar(pInp);
 5154|    220|                    k++;
 5155|    220|                    if (k == 1)
  ------------------
  |  Branch (5155:25): [True: 12, False: 208]
  ------------------
 5156|     12|                    {
 5157|     12|                        let1 = c;
 5158|     12|                    }
 5159|    208|                    else
 5160|    208|                    {
 5161|    208|                        if (k == 2)
  ------------------
  |  Branch (5161:29): [True: 12, False: 196]
  ------------------
 5162|     12|                        {
 5163|     12|                            let2 = c;
 5164|     12|                        }
 5165|    208|                    }
 5166|    220|                }
 5167|    314|                if (k != 3)
  ------------------
  |  Branch (5167:21): [True: 310, False: 4]
  ------------------
 5168|    310|                {
 5169|       |                    /* not a valid SaveOpt which must be of two chars */
 5170|    310|                    *input_has_save_opt = 0;
 5171|       |                    /* djb-rwth: removing redundant code */
 5172|    310|                }
 5173|      4|                else
 5174|      4|                {
 5175|       |                    /* may be SaveOpt - analyze the content */
 5176|      4|                    if ((let2 >= 'A') && (let2 <= 'D'))        /* letter-2 OK */
  ------------------
  |  Branch (5176:25): [True: 4, False: 0]
  |  Branch (5176:42): [True: 4, False: 0]
  ------------------
 5177|      4|                    {
 5178|      4|                        *input_has_save_opt = 0;
 5179|      4|                        *input_save_opt_bits = 0;
 5180|     49|                        for (k = 0; k < 16; k++)
  ------------------
  |  Branch (5180:37): [True: 48, False: 1]
  ------------------
 5181|     48|                        {
 5182|     48|                            if (a2p[k] == let1)                    /* letter-1 OK */
  ------------------
  |  Branch (5182:33): [True: 3, False: 45]
  ------------------
 5183|      3|                            {
 5184|      3|                                *input_save_opt_bits = (unsigned char)k;
 5185|      3|                                *input_has_save_opt = 1;
 5186|      3|                                break;
 5187|      3|                            }
 5188|     48|                        }
 5189|      4|                        if (*input_has_save_opt)
  ------------------
  |  Branch (5189:29): [True: 3, False: 1]
  ------------------
 5190|      3|                        {
 5191|      3|                            if (let2 == 'B' || let2 == 'D')
  ------------------
  |  Branch (5191:33): [True: 0, False: 3]
  |  Branch (5191:48): [True: 2, False: 1]
  ------------------
 5192|      2|                            {
 5193|      2|                                *input_save_opt_bits |= SAVE_OPT_15T;
  ------------------
  |  |  160|      2|#define SAVE_OPT_15T    0x0020
  ------------------
 5194|      2|                            }
 5195|      3|                            if (let2 == 'C' || let2 == 'D')
  ------------------
  |  Branch (5195:33): [True: 1, False: 2]
  |  Branch (5195:48): [True: 2, False: 0]
  ------------------
 5196|      3|                            {
 5197|      3|                                *input_save_opt_bits |= SAVE_OPT_KET;
  ------------------
  |  |  159|      3|#define SAVE_OPT_KET    0x0010
  ------------------
 5198|      3|                            }
 5199|      3|                        }
 5200|      4|                    }
 5201|      4|                }
 5202|       |
 5203|    314|                ret = (c == RI_ERR_EOF) ? RI_ERR_EOF : RI_ERR_EOL; /* end of line */
  ------------------
  |  |   19|    314|#define RI_ERR_EOF     (0)
  ------------------
                              ret = (c == RI_ERR_EOF) ? RI_ERR_EOF : RI_ERR_EOL; /* end of line */
  ------------------
  |  |   19|     12|#define RI_ERR_EOF     (0)
  ------------------
                              ret = (c == RI_ERR_EOF) ? RI_ERR_EOF : RI_ERR_EOL; /* end of line */
  ------------------
  |  |   18|    616|#define RI_ERR_EOL     (-4)
  ------------------
  |  Branch (5203:23): [True: 12, False: 302]
  ------------------
 5204|    314|                pLine->len = 0;
 5205|    314|                pLine->c = ret;
 5206|    314|                break; /* exit */
 5207|    314|            }
 5208|  46.6k|            if (c == RI_ERR_EOF)
  ------------------
  |  |   19|  46.6k|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (5208:17): [True: 9.30k, False: 37.3k]
  ------------------
 5209|  9.30k|            {
 5210|  9.30k|                ret = RI_ERR_EOF; /* end of line */
  ------------------
  |  |   19|  9.30k|#define RI_ERR_EOF     (0)
  ------------------
 5211|  9.30k|                break;
 5212|  9.30k|            }
 5213|  37.3k|            if (c == SEG_END)
  ------------------
  |  |  273|  37.3k|#define SEG_END '/'
  ------------------
  |  Branch (5213:17): [True: 37.3k, False: 0]
  ------------------
 5214|  37.3k|            {
 5215|  37.3k|                c = nGetInChISegment(pInp, pLine, szToken);
 5216|  37.3k|            }
 5217|  37.3k|            if (c < 0)
  ------------------
  |  Branch (5217:17): [True: 0, False: 37.3k]
  ------------------
 5218|      0|            {
 5219|      0|                goto exit_error; /* error */
 5220|      0|            }
 5221|  37.3k|            if (!pLine->len)
  ------------------
  |  Branch (5221:17): [True: 731, False: 36.6k]
  ------------------
 5222|    731|            {
 5223|    731|                ret = RI_ERR_EOL; /* end of line */
  ------------------
  |  |   18|    731|#define RI_ERR_EOL     (-4)
  ------------------
 5224|    731|                break;
 5225|    731|            }
 5226|       |            /* djb-rwth: removing redundant code */
 5227|       |
 5228|       |            /*
 5229|       |            if ( fst == 'z' )
 5230|       |            {
 5231|       |            ret = RI_ERR_EOL;
 5232|       |            break;
 5233|       |            }*/
 5234|  37.3k|        }
 5235|       |        /* process the seqment */
 5236|  97.9k|        switch (state)
  ------------------
  |  Branch (5236:17): [True: 97.9k, False: 0]
  ------------------
 5237|  97.9k|        {
 5238|       |            /* Mobile H, M */                /* /  */
 5239|  12.6k|        case IST_MOBILE_H_FORMULA:
  ------------------
  |  Branch (5239:9): [True: 12.6k, False: 85.3k]
  ------------------
 5240|  12.6k|            bMobileH = TAUT_YES;
  ------------------
  |  |  575|  12.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5241|  12.6k|#if ( FIX_GAF_2019_2==1 )
 5242|       |            /* hack: pass state in na_total (will be updated in ParseSegmentFormula anyway) */
 5243|  12.6k|            na_total = state;
 5244|  12.6k|#endif
 5245|  12.6k|            ret = ParseSegmentFormula(pLine->str, bMobileH, pInpInChI[bReconn],
 5246|  12.6k|                nNumComponents[bReconn], &na_total);
 5247|  12.6k|            state = IST_MOBILE_H_CONNECTIONS;
 5248|  12.6k|            break;
 5249|  12.3k|        case IST_MOBILE_H_CONNECTIONS:   /* /c */
  ------------------
  |  Branch (5249:9): [True: 12.3k, False: 85.6k]
  ------------------
 5250|  12.3k|            ret = ParseSegmentConnections(pLine->str, bMobileH, &pInpInChI[bReconn][bMobileH],
 5251|  12.3k|                &nNumComponents[bReconn][bMobileH], &bAbc, &nb_total);
 5252|  12.3k|            state = IST_MOBILE_H;
 5253|  12.3k|            break;
 5254|  9.03k|        case IST_MOBILE_H:               /* /h */
  ------------------
  |  Branch (5254:9): [True: 9.03k, False: 88.9k]
  ------------------
 5255|  9.03k|            ret = ParseSegmentMobileH(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], &bAbc);
 5256|  9.03k|            state = IST_MOBILE_H_CHARGE;
 5257|  9.03k|            break;
 5258|  7.46k|        case IST_MOBILE_H_CHARGE:        /* /q */
  ------------------
  |  Branch (5258:9): [True: 7.46k, False: 90.5k]
  ------------------
 5259|  7.46k|            ret = ParseSegmentCharge(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn]);
 5260|  7.46k|            state = IST_MOBILE_H_PROTONS;
 5261|  7.46k|            break;
 5262|  6.94k|        case IST_MOBILE_H_PROTONS:       /* /p */
  ------------------
  |  Branch (5262:9): [True: 6.94k, False: 91.0k]
  ------------------
 5263|  6.94k|            ret = ParseSegmentProtons(pLine->str, bMobileH, nNumProtons[bReconn], nNumComponents[bReconn]);
 5264|  6.94k|            state = IST_MOBILE_H_POLYMER;
 5265|  6.94k|            break;
 5266|  6.74k|        case IST_MOBILE_H_POLYMER:       /* /z */
  ------------------
  |  Branch (5266:9): [True: 6.74k, False: 91.2k]
  ------------------
 5267|  6.74k|            ret = ParseSegmentPolymer(pLine->str, bMobileH,
 5268|  6.74k|                nNumProtons[bReconn], nNumComponents[bReconn],
 5269|  6.74k|                na_total, nb_total, bInchi2Struct, ppPolymer, ppV3000);
 5270|  6.74k|            if (*ppPolymer)
  ------------------
  |  Branch (5270:17): [True: 838, False: 5.90k]
  ------------------
 5271|    838|                (*ppPolymer)->is_in_reconn = bReconn;
 5272|  6.74k|            state = IST_MOBILE_H_SP2;
 5273|  6.74k|            break;
 5274|  5.98k|        case IST_MOBILE_H_SP2:           /* /b */
  ------------------
  |  Branch (5274:9): [True: 5.98k, False: 92.0k]
  ------------------
 5275|  5.98k|            ret = ParseSegmentSp2(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc);
 5276|  5.98k|            state = IST_MOBILE_H_SP3;
 5277|  5.98k|            break;
 5278|  5.30k|        case IST_MOBILE_H_SP3:         /* t */
  ------------------
  |  Branch (5278:9): [True: 5.30k, False: 92.6k]
  ------------------
 5279|  5.30k|            ret = ParseSegmentSp3(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc);
 5280|  5.30k|            state = IST_MOBILE_H_SP3_M;
 5281|  5.30k|            break;
 5282|  4.77k|        case IST_MOBILE_H_SP3_M:       /* /m */
  ------------------
  |  Branch (5282:9): [True: 4.77k, False: 93.2k]
  ------------------
 5283|  4.77k|            ret = ParseSegmentSp3m(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 5284|  4.77k|            state = IST_MOBILE_H_SP3_S;
 5285|  4.77k|            break;
 5286|  4.73k|        case IST_MOBILE_H_SP3_S:       /* /s */
  ------------------
  |  Branch (5286:9): [True: 4.73k, False: 93.2k]
  ------------------
 5287|  4.73k|            ret = ParseSegmentSp3s(pLine->str, bMobileH, pInpInChI[bReconn], s[bReconn], nNumComponents[bReconn], state);
 5288|  4.73k|            state = IST_MOBILE_H_ISO_LAYER_FORK;
 5289|  4.73k|            break;
 5290|  4.68k|        case IST_MOBILE_H_ISO_LAYER_FORK:
  ------------------
  |  Branch (5290:9): [True: 4.68k, False: 93.2k]
  ------------------
 5291|       |            /* find layer type after M */
 5292|  4.68k|            ret = 0;
 5293|  4.68k|            switch (pLine->str[0])
 5294|  4.68k|            {
 5295|  1.38k|            case 'i':
  ------------------
  |  Branch (5295:13): [True: 1.38k, False: 3.30k]
  ------------------
 5296|  1.38k|                state = IST_MOBILE_H_ISO_ATOMS;  /* MI */
 5297|  1.38k|                break;
 5298|  2.87k|            case 'f':
  ------------------
  |  Branch (5298:13): [True: 2.87k, False: 1.81k]
  ------------------
 5299|  2.87k|                state = IST_FIXED_H_FORMULA; /* F */
 5300|  2.87k|                break;
 5301|    415|            case 'r':
  ------------------
  |  Branch (5301:13): [True: 415, False: 4.27k]
  ------------------
 5302|    415|                state = IST_RECONNECTED_FORMULA; /* reconnected */
 5303|    415|                break;
 5304|     16|            default:
  ------------------
  |  Branch (5304:13): [True: 16, False: 4.67k]
  ------------------
 5305|     16|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     16|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5306|  4.68k|            }
 5307|  4.68k|            if (INCHI_INP_EOL(c) && ret == 0 && !pLine->str[1])
  ------------------
  |  |  275|  9.37k|#define INCHI_INP_EOL(X) ((X)=='\n' || (X)=='\r' || (X)=='\t')
  |  |  ------------------
  |  |  |  Branch (275:27): [True: 41, False: 4.64k]
  |  |  |  Branch (275:40): [True: 2, False: 4.64k]
  |  |  |  Branch (275:53): [True: 8, False: 4.63k]
  |  |  ------------------
  ------------------
  |  Branch (5307:37): [True: 49, False: 2]
  |  Branch (5307:49): [True: 0, False: 49]
  ------------------
 5308|      0|            {
 5309|      0|                prev_state = state + (bReconn ? IST_HAPPENED_IN_RECMET : 0);
  ------------------
  |  |  342|      0|#define IST_HAPPENED_IN_RECMET   100
  ------------------
  |  Branch (5309:39): [True: 0, False: 0]
  ------------------
 5310|      0|                ret = RI_ERR_SYNTAX; /* empty layer /i or /f or /r at the end of InChI line */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5311|      0|            }
 5312|  4.68k|            else
 5313|  4.68k|            {
 5314|  4.68k|                if (!ret && state != IST_MOBILE_H_ISO_ATOMS)
  ------------------
  |  Branch (5314:21): [True: 4.67k, False: 16]
  |  Branch (5314:29): [True: 3.28k, False: 1.38k]
  ------------------
 5315|  3.28k|                {
 5316|  3.28k|                    len = (int)strlen(pLine->str);
 5317|  3.28k|                    if (len > 1)
  ------------------
  |  Branch (5317:25): [True: 2.50k, False: 778]
  ------------------
 5318|  2.50k|                    {
 5319|  2.50k|                        memmove(pLine->str, pLine->str + 1, len);
 5320|  2.50k|                    }
 5321|    778|                    else
 5322|    778|                    {
 5323|    778|                        ret = 1; /* read the next segment */
 5324|    778|                    }
 5325|  3.28k|                }
 5326|  4.68k|            }
 5327|  4.68k|            break;
 5328|       |            /* Mobile H, isotopic, MI */
 5329|  1.38k|        case IST_MOBILE_H_ISO_ATOMS:   /* i */
  ------------------
  |  Branch (5329:9): [True: 1.38k, False: 96.5k]
  ------------------
 5330|  1.38k|            ret = ParseSegmentIsoAtoms(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc);
 5331|  1.38k|            state = IST_MOBILE_H_ISO_EXCH_H;
 5332|  1.38k|            break;
 5333|    617|        case IST_MOBILE_H_ISO_EXCH_H:  /* /i/h */
  ------------------
  |  Branch (5333:9): [True: 617, False: 97.3k]
  ------------------
 5334|    617|            ret = ParseSegmentIsoExchgH(pLine->str, bMobileH, nNumProtons[bReconn], nNumComponents[bReconn], state, &bAbc);
 5335|    617|            state = IST_MOBILE_H_ISO_SP2;
 5336|    617|            break;
 5337|    504|        case IST_MOBILE_H_ISO_SP2:         /* /i/b */
  ------------------
  |  Branch (5337:9): [True: 504, False: 97.4k]
  ------------------
 5338|    504|            ret = ParseSegmentSp2(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc);
 5339|    504|            state = IST_MOBILE_H_ISO_SP3;
 5340|    504|            break;
 5341|    413|        case IST_MOBILE_H_ISO_SP3:         /* /i/t */
  ------------------
  |  Branch (5341:9): [True: 413, False: 97.5k]
  ------------------
 5342|    413|            ret = ParseSegmentSp3(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc);
 5343|    413|            state = IST_MOBILE_H_ISO_SP3_M;
 5344|    413|            break;
 5345|    303|        case IST_MOBILE_H_ISO_SP3_M:       /* /i/m */
  ------------------
  |  Branch (5345:9): [True: 303, False: 97.6k]
  ------------------
 5346|    303|            ret = ParseSegmentSp3m(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 5347|    303|            state = IST_MOBILE_H_ISO_SP3_S;
 5348|    303|            break;
 5349|    295|        case IST_MOBILE_H_ISO_SP3_S:       /* /i/s */
  ------------------
  |  Branch (5349:9): [True: 295, False: 97.6k]
  ------------------
 5350|    295|            ret = ParseSegmentSp3s(pLine->str, bMobileH, pInpInChI[bReconn], s[bReconn], nNumComponents[bReconn], state);
 5351|    295|            state = IST_FIXED_H_LAYER_FORK;
 5352|    295|            break;
 5353|    287|        case IST_FIXED_H_LAYER_FORK:
  ------------------
  |  Branch (5353:9): [True: 287, False: 97.6k]
  ------------------
 5354|       |            /* find layer type after MI */
 5355|    287|            ret = 0;
 5356|    287|            switch (pLine->str[0])
 5357|    287|            {
 5358|    251|            case 'f':
  ------------------
  |  Branch (5358:13): [True: 251, False: 36]
  ------------------
 5359|    251|                state = IST_FIXED_H_FORMULA; /* F */
 5360|    251|                break;
 5361|     20|            case 'r':
  ------------------
  |  Branch (5361:13): [True: 20, False: 267]
  ------------------
 5362|     20|                state = IST_RECONNECTED_FORMULA; /* reconnected */
 5363|     20|                break;
 5364|     16|            default:
  ------------------
  |  Branch (5364:13): [True: 16, False: 271]
  ------------------
 5365|     16|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     16|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5366|    287|            }
 5367|    287|            if (INCHI_INP_EOL(c) && ret == 0 && !pLine->str[1])
  ------------------
  |  |  275|    574|#define INCHI_INP_EOL(X) ((X)=='\n' || (X)=='\r' || (X)=='\t')
  |  |  ------------------
  |  |  |  Branch (275:27): [True: 6, False: 281]
  |  |  |  Branch (275:40): [True: 1, False: 280]
  |  |  |  Branch (275:53): [True: 2, False: 278]
  |  |  ------------------
  ------------------
  |  Branch (5367:37): [True: 7, False: 2]
  |  Branch (5367:49): [True: 0, False: 7]
  ------------------
 5368|      0|            {
 5369|      0|                prev_state = state + (bReconn ? IST_HAPPENED_IN_RECMET : 0);
  ------------------
  |  |  342|      0|#define IST_HAPPENED_IN_RECMET   100
  ------------------
  |  Branch (5369:39): [True: 0, False: 0]
  ------------------
 5370|      0|                ret = RI_ERR_SYNTAX; /* empty layer /f or /r at the end of InChI line */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5371|      0|            }
 5372|    287|            else
 5373|    287|            {
 5374|    287|                if (!ret)
  ------------------
  |  Branch (5374:21): [True: 271, False: 16]
  ------------------
 5375|    271|                {
 5376|    271|                    len = (int)strlen(pLine->str);
 5377|    271|                    if (len > 1)
  ------------------
  |  Branch (5377:25): [True: 206, False: 65]
  ------------------
 5378|    206|                    {
 5379|    206|                        memmove(pLine->str, pLine->str + 1, len);
 5380|    206|                    }
 5381|     65|                    else
 5382|     65|                    {
 5383|     65|                        ret = 1; /* read the next segment */
 5384|     65|                    }
 5385|    271|                }
 5386|    287|            }
 5387|    287|            break;
 5388|       |
 5389|       |            /* Fixed H, F */
 5390|  3.03k|        case IST_FIXED_H_FORMULA:
  ------------------
  |  Branch (5390:9): [True: 3.03k, False: 94.9k]
  ------------------
 5391|  3.03k|            bMobileH = TAUT_NON;
  ------------------
  |  |  574|  3.03k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5392|  3.03k|#if ( FIX_GAF_2019_2==1 )
 5393|       |            /* hack: pass state in na_total (will be updated in ParseSegmentFormula anyway) */
 5394|  3.03k|            na_total = state;
 5395|  3.03k|#endif
 5396|  3.03k|            ret = ParseSegmentFormula(pLine->str, bMobileH, pInpInChI[bReconn],
 5397|  3.03k|                nNumComponents[bReconn], &na_total);
 5398|  3.03k|            state = IST_FIXED_H;
 5399|  3.03k|            break;
 5400|  2.46k|        case IST_FIXED_H:               /* /f/h */
  ------------------
  |  Branch (5400:9): [True: 2.46k, False: 95.5k]
  ------------------
 5401|  2.46k|            ret = ParseSegmentMobileH(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], &bAbc);
 5402|  2.46k|            state = IST_FIXED_H_CHARGE;
 5403|  2.46k|            break;
 5404|  1.16k|        case IST_FIXED_H_CHARGE:        /* /f/q */
  ------------------
  |  Branch (5404:9): [True: 1.16k, False: 96.8k]
  ------------------
 5405|  1.16k|            ret = ParseSegmentCharge(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn]);
 5406|  1.16k|            state = IST_FIXED_H_SP2;
 5407|  1.16k|            break;
 5408|  1.14k|        case IST_FIXED_H_SP2:           /* /f/b */
  ------------------
  |  Branch (5408:9): [True: 1.14k, False: 96.8k]
  ------------------
 5409|  1.14k|            ret = ParseSegmentSp2(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc);
 5410|  1.14k|            state = IST_FIXED_H_SP3;
 5411|  1.14k|            break;
 5412|    932|        case IST_FIXED_H_SP3:         /* /f/t */
  ------------------
  |  Branch (5412:9): [True: 932, False: 97.0k]
  ------------------
 5413|    932|            ret = ParseSegmentSp3(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc);
 5414|    932|            state = IST_FIXED_H_SP3_M;
 5415|    932|            break;
 5416|    750|        case IST_FIXED_H_SP3_M:       /* /f/m */
  ------------------
  |  Branch (5416:9): [True: 750, False: 97.2k]
  ------------------
 5417|    750|            ret = ParseSegmentSp3m(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 5418|    750|            state = IST_FIXED_H_SP3_S;
 5419|    750|            break;
 5420|    723|        case IST_FIXED_H_SP3_S:       /* /f/s */
  ------------------
  |  Branch (5420:9): [True: 723, False: 97.2k]
  ------------------
 5421|    723|            ret = ParseSegmentSp3s(pLine->str, bMobileH, pInpInChI[bReconn], s[bReconn], nNumComponents[bReconn], state);
 5422|    723|            state = IST_FIXED_H_PERMUTATION;
 5423|    723|            break;
 5424|    633|        case IST_FIXED_H_PERMUTATION:  /* /f/o */
  ------------------
  |  Branch (5424:9): [True: 633, False: 97.3k]
  ------------------
 5425|    633|            ret = ParseSegmentPerm(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc);
 5426|    633|            state = IST_FIXED_H_ISO_LAYER_FORK;
 5427|    633|            break;
 5428|    547|        case IST_FIXED_H_ISO_LAYER_FORK:
  ------------------
  |  Branch (5428:9): [True: 547, False: 97.4k]
  ------------------
 5429|       |            /* find layer type after M */
 5430|    547|            ret = 0;
 5431|    547|            switch (pLine->str[0])
 5432|    547|            {
 5433|    435|            case 'i':
  ------------------
  |  Branch (5433:13): [True: 435, False: 112]
  ------------------
 5434|    435|                state = IST_FIXED_H_ISO_ATOMS;  /* FI */
 5435|    435|                break;
 5436|     79|            case 'r':
  ------------------
  |  Branch (5436:13): [True: 79, False: 468]
  ------------------
 5437|     79|                state = IST_RECONNECTED_FORMULA; /* reconnected */
 5438|     79|                break;
 5439|     33|            default:
  ------------------
  |  Branch (5439:13): [True: 33, False: 514]
  ------------------
 5440|     33|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     33|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5441|    547|            }
 5442|    547|            if (INCHI_INP_EOL(c) && ret == 0 && !pLine->str[1])
  ------------------
  |  |  275|  1.09k|#define INCHI_INP_EOL(X) ((X)=='\n' || (X)=='\r' || (X)=='\t')
  |  |  ------------------
  |  |  |  Branch (275:27): [True: 10, False: 537]
  |  |  |  Branch (275:40): [True: 3, False: 534]
  |  |  |  Branch (275:53): [True: 3, False: 531]
  |  |  ------------------
  ------------------
  |  Branch (5442:37): [True: 4, False: 12]
  |  Branch (5442:49): [True: 0, False: 4]
  ------------------
 5443|      0|            {
 5444|      0|                prev_state = state + (bReconn ? IST_HAPPENED_IN_RECMET : 0);
  ------------------
  |  |  342|      0|#define IST_HAPPENED_IN_RECMET   100
  ------------------
  |  Branch (5444:39): [True: 0, False: 0]
  ------------------
 5445|      0|                ret = RI_ERR_SYNTAX; /* empty layer /i or /r at the end of InChI line */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5446|      0|            }
 5447|    547|            else
 5448|    547|            {
 5449|    547|                if (!ret && state != IST_FIXED_H_ISO_ATOMS)
  ------------------
  |  Branch (5449:21): [True: 514, False: 33]
  |  Branch (5449:29): [True: 79, False: 435]
  ------------------
 5450|     79|                {
 5451|     79|                    len = (int)strlen(pLine->str);
 5452|     79|                    if (len > 1)
  ------------------
  |  Branch (5452:25): [True: 33, False: 46]
  ------------------
 5453|     33|                    {
 5454|     33|                        memmove(pLine->str, pLine->str + 1, len);
 5455|     33|                    }
 5456|     46|                    else
 5457|     46|                    {
 5458|     46|                        ret = 1; /* read the next segment */
 5459|     46|                    }
 5460|     79|                }
 5461|    547|            }
 5462|    547|            break;
 5463|       |
 5464|       |            /* Fixed H, isotopic, FI */
 5465|    435|        case IST_FIXED_H_ISO_ATOMS:   /* /f/i */
  ------------------
  |  Branch (5465:9): [True: 435, False: 97.5k]
  ------------------
 5466|    435|            ret = ParseSegmentIsoAtoms(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc);
 5467|    435|            state = IST_FIXED_H_ISO_SP2;
 5468|    435|            break;
 5469|    272|        case IST_FIXED_H_ISO_SP2:         /* /f/i/b */
  ------------------
  |  Branch (5469:9): [True: 272, False: 97.7k]
  ------------------
 5470|    272|            ret = ParseSegmentSp2(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc);
 5471|    272|            state = IST_FIXED_H_ISO_SP3;
 5472|    272|            break;
 5473|    257|        case IST_FIXED_H_ISO_SP3:         /* /f/i/t */
  ------------------
  |  Branch (5473:9): [True: 257, False: 97.7k]
  ------------------
 5474|    257|            ret = ParseSegmentSp3(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc);
 5475|    257|            state = IST_FIXED_H_ISO_SP3_M;
 5476|    257|            break;
 5477|    232|        case IST_FIXED_H_ISO_SP3_M:       /* /f/i/m */
  ------------------
  |  Branch (5477:9): [True: 232, False: 97.7k]
  ------------------
 5478|    232|            ret = ParseSegmentSp3m(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state);
 5479|    232|            state = IST_FIXED_H_ISO_SP3_S;
 5480|    232|            break;
 5481|    211|        case IST_FIXED_H_ISO_SP3_S:       /* /f/i/s */
  ------------------
  |  Branch (5481:9): [True: 211, False: 97.7k]
  ------------------
 5482|    211|            ret = ParseSegmentSp3s(pLine->str, bMobileH, pInpInChI[bReconn], s[bReconn], nNumComponents[bReconn], state);
 5483|    211|            state = IST_FIXED_H_ISO_PERMUTATION;
 5484|    211|            break;
 5485|    184|        case IST_FIXED_H_ISO_PERMUTATION:  /* /f/i/o */
  ------------------
  |  Branch (5485:9): [True: 184, False: 97.8k]
  ------------------
 5486|    184|            ret = ParseSegmentPerm(pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc);
 5487|    184|            state = IST_RECONNECTED_LAYER_FORK;
 5488|    184|            break;
 5489|    178|        case IST_RECONNECTED_LAYER_FORK:
  ------------------
  |  Branch (5489:9): [True: 178, False: 97.8k]
  ------------------
 5490|       |            /* find layer type after FI */
 5491|    178|            ret = 0;
 5492|    178|            switch (pLine->str[0])
 5493|    178|            {
 5494|    150|            case 'r':
  ------------------
  |  Branch (5494:13): [True: 150, False: 28]
  ------------------
 5495|    150|                state = IST_RECONNECTED_FORMULA; /* reconnected */
 5496|    150|                break;
 5497|     28|            default:
  ------------------
  |  Branch (5497:13): [True: 28, False: 150]
  ------------------
 5498|     28|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     28|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5499|    178|            }
 5500|    178|            if (INCHI_INP_EOL(c) && ret == 0 && !pLine->str[1])
  ------------------
  |  |  275|    356|#define INCHI_INP_EOL(X) ((X)=='\n' || (X)=='\r' || (X)=='\t')
  |  |  ------------------
  |  |  |  Branch (275:27): [True: 12, False: 166]
  |  |  |  Branch (275:40): [True: 1, False: 165]
  |  |  |  Branch (275:53): [True: 3, False: 162]
  |  |  ------------------
  ------------------
  |  Branch (5500:37): [True: 2, False: 14]
  |  Branch (5500:49): [True: 0, False: 2]
  ------------------
 5501|      0|            {
 5502|      0|                prev_state = state + (bReconn ? IST_HAPPENED_IN_RECMET : 0);
  ------------------
  |  |  342|      0|#define IST_HAPPENED_IN_RECMET   100
  ------------------
  |  Branch (5502:39): [True: 0, False: 0]
  ------------------
 5503|      0|                ret = RI_ERR_SYNTAX; /* empty layer /r at the end of InChI line */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5504|      0|            }
 5505|    178|            else
 5506|    178|            {
 5507|    178|                if (!ret)
  ------------------
  |  Branch (5507:21): [True: 150, False: 28]
  ------------------
 5508|    150|                {
 5509|    150|                    len = (int)strlen(pLine->str);
 5510|    150|                    if (len > 1)
  ------------------
  |  Branch (5510:25): [True: 36, False: 114]
  ------------------
 5511|     36|                    {
 5512|     36|                        memmove(pLine->str, pLine->str + 1, len);
 5513|     36|                    }
 5514|    114|                    else
 5515|    114|                    {
 5516|    114|                        ret = 1; /* read the next segment */
 5517|    114|                    }
 5518|    150|                }
 5519|    178|            }
 5520|    178|            break;
 5521|    300|        case IST_RECONNECTED_FORMULA:
  ------------------
  |  Branch (5521:9): [True: 300, False: 97.6k]
  ------------------
 5522|    300|#if ( FIX_GAF_2019_1==1 )
 5523|    300|            if (bReconn == INCHI_REC)
  ------------------
  |  |  571|    300|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (5523:17): [True: 13, False: 287]
  ------------------
 5524|     13|            {
 5525|       |                /* reconnected layer may appear only once */
 5526|     13|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     13|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5527|     13|                break;
 5528|     13|            }
 5529|    287|#endif
 5530|    287|            bReconn = INCHI_REC;
  ------------------
  |  |  571|    287|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 5531|    287|            bMobileH = TAUT_YES;
  ------------------
  |  |  575|    287|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5532|    287|            state = IST_MOBILE_H_FORMULA;
 5533|    287|            break;
 5534|  97.9k|        }
 5535|  97.9k|    } while (c >= 0);
  ------------------
  |  Branch (5535:14): [True: 97.9k, False: 0]
  ------------------
 5536|       |
 5537|  12.5k|exit_function:;
 5538|  12.5k|exit_error:;
 5539|       |
 5540|       |    INCHI_HEAPCHK
 5541|       |
 5542|  12.5k|        if (ret >= 0 || c == RI_ERR_EOF || c == RI_ERR_EOL)
  ------------------
  |  |   19|  15.8k|#define RI_ERR_EOF     (0)
  ------------------
                      if (ret >= 0 || c == RI_ERR_EOF || c == RI_ERR_EOL)
  ------------------
  |  |   18|  1.52k|#define RI_ERR_EOL     (-4)
  ------------------
  |  Branch (5542:13): [True: 9.31k, False: 3.24k]
  |  Branch (5542:25): [True: 1.72k, False: 1.52k]
  |  Branch (5542:44): [True: 0, False: 1.52k]
  ------------------
 5543|  11.0k|        {
 5544|  11.0k|            pLine->len = 0;
 5545|  11.0k|        }
 5546|       |
 5547|  12.5k|    return ret;
 5548|  12.5k|}
ichiread.c:ParseSegmentFormula:
 9829|  15.7k|{
 9830|  15.7k|    int i, j, mpy_component, mpy_atom, len, el_number;
 9831|  15.7k|    int nNumComponents = 0, iComponent, nNumAtoms, nNumAtomsAndH, iAtom, nNumH, nAltMobileH = ALT_TAUT(bMobileH);
  ------------------
  |  |  577|  15.7k|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|  15.7k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 15.7k]
  |  |  ------------------
  ------------------
 9832|  15.7k|    const char* p, * q, * e, * pStart, * pEnd;
 9833|  15.7k|    INChI* pInChI;
 9834|  15.7k|    char szEl[3];
 9835|  15.7k|#if ( FIX_GAF_2019_2==1 )
 9836|       |    /* hack: state passed in *na_total (will be updated in ParseSegmentFormula anyway) */
 9837|  15.7k|    int state = *na_total;
 9838|  15.7k|#endif
 9839|  15.7k|    nNumAtoms = -999; /* impossible value */
 9840|  15.7k|    *na_total = 0;
 9841|       |
 9842|       |    /* Pass 1. Count components */
 9843|       |
 9844|  15.7k|    pStart = (char*)str;
 9845|  30.0k|    while (1)
  ------------------
  |  Branch (9845:12): [True: 30.0k, Folded]
  ------------------
 9846|  30.0k|    {
 9847|  30.0k|        if (!(pEnd = strchr(pStart, '.')))
  ------------------
  |  Branch (9847:13): [True: 15.6k, False: 14.4k]
  ------------------
 9848|  15.6k|        {
 9849|  15.6k|            pEnd = pStart + strlen(pStart);
 9850|  15.6k|        }
 9851|  30.0k|        p = pStart;
 9852|  30.0k|        if (isdigit(*p))
  ------------------
  |  Branch (9852:13): [True: 8.76k, False: 21.3k]
  ------------------
 9853|  8.76k|        {
 9854|  8.76k|            mpy_component = (int)inchi_strtol(p, &q, 10);
 9855|  8.76k|            p = q;
 9856|  8.76k|        }
 9857|  21.3k|        else
 9858|  21.3k|        {
 9859|  21.3k|            mpy_component = 1;
 9860|  21.3k|        }
 9861|  30.0k|        if (!mpy_component)
  ------------------
  |  Branch (9861:13): [True: 50, False: 30.0k]
  ------------------
 9862|     50|        {
 9863|     50|            break;
 9864|     50|        }
 9865|  30.0k|        if (!isupper(UCINT * p))
  ------------------
  |  Branch (9865:13): [True: 2.55k, False: 27.4k]
  ------------------
 9866|  2.55k|        {
 9867|  2.55k|            break; /* not a formula layer */
 9868|  2.55k|        }
 9869|  27.4k|        if (pEnd == p)
  ------------------
  |  Branch (9869:13): [True: 0, False: 27.4k]
  ------------------
 9870|      0|        {
 9871|      0|            break; /* zero length formula */
 9872|      0|        }
 9873|  27.4k|        nNumComponents += mpy_component;
 9874|  27.4k|        if (*pEnd)
  ------------------
  |  Branch (9874:13): [True: 14.3k, False: 13.1k]
  ------------------
 9875|  14.3k|        {
 9876|  14.3k|            pStart = pEnd + 1;
 9877|  14.3k|        }
 9878|  13.1k|        else
 9879|  13.1k|        {
 9880|  13.1k|            break;
 9881|  13.1k|        }
 9882|  27.4k|    }
 9883|  15.7k|    pnNumComponents[bMobileH] = nNumComponents;
 9884|  15.7k|#if ( FIX_GAF_2019_1==1 )
 9885|  15.7k|    if (nNumComponents > MAX_ATOMS)
  ------------------
  |  |   15|  15.7k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (9885:9): [True: 3, False: 15.7k]
  ------------------
 9886|      3|    {
 9887|      3|        pnNumComponents[bMobileH] = 0;
 9888|      3|        return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      3|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9889|      3|    }
 9890|       |    /*    pnNumComponents was not reset to 0 which results
 9891|       |    in attempt then to free() garbage at
 9892|       |    Free_INChI_Stereo ( <-- Free_INChI_Members <-- FreeInpInChI ) */
 9893|       |#elif ( FIX_DALKE_BUGS == 1 )
 9894|       |    if (nNumComponents > MAX_ATOMS)
 9895|       |    {
 9896|       |        return RI_ERR_SYNTAX; /* syntax error */
 9897|       |    }
 9898|       |#endif
 9899|       |    /* exit or error check */
 9900|  15.7k|    if (!nNumComponents)
  ------------------
  |  Branch (9900:9): [True: 2.49k, False: 13.2k]
  ------------------
 9901|  2.49k|    {
 9902|  2.49k|#if ( FIX_GAF_2019_2==1 )
 9903|  2.49k|        int low_case = 0;
 9904|  2.49k|        if (*pStart)
  ------------------
  |  Branch (9904:13): [True: 2.49k, False: 0]
  ------------------
 9905|  2.49k|        {
 9906|  2.49k|            low_case = islower(UCINT * pStart);
 9907|  2.49k|        }
 9908|  2.49k|        if (!*pStart || low_case) {
  ------------------
  |  Branch (9908:13): [True: 0, False: 2.49k]
  |  Branch (9908:25): [True: 2.45k, False: 42]
  ------------------
 9909|  2.45k|            if (low_case)
  ------------------
  |  Branch (9909:17): [True: 2.45k, False: 0]
  ------------------
 9910|  2.45k|            {
 9911|  2.45k|                if (state == IST_MOBILE_H_FORMULA)
  ------------------
  |  Branch (9911:21): [True: 85, False: 2.37k]
  ------------------
 9912|     85|                {
 9913|     85|                    if (*pStart != 'q' && *pStart != 'p')
  ------------------
  |  Branch (9913:25): [True: 51, False: 34]
  |  Branch (9913:43): [True: 25, False: 26]
  ------------------
 9914|     25|                    {
 9915|     25|                        return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     25|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9916|     25|                    }
 9917|     85|                }
 9918|       |                /*
 9919|       |                else if (state == IST_FIXED_H_FORMULA)
 9920|       |                {
 9921|       |                if (*pStart != 'h' &&  *pStart != 'i' && *pStart != 'b' && *pStart != 'q' && *pStart != 'p')
 9922|       |                {
 9923|       |                return RI_ERR_SYNTAX;
 9924|       |                }
 9925|       |                }*/
 9926|  2.45k|            }
 9927|       |#else
 9928|       |        if (!*pStart || islower(UCINT * pStart)) {
 9929|       |#endif
 9930|       |
 9931|  2.43k|            INCHI_HEAPCHK
 9932|  2.43k|                if (bMobileH == TAUT_NON && 0 < (nNumComponents = pnNumComponents[nAltMobileH]))
  ------------------
  |  |  574|  4.86k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (9932:21): [True: 2.37k, False: 60]
  |  Branch (9932:45): [True: 2.37k, False: 0]
  ------------------
 9933|  2.37k|                {
 9934|       |                    /* allocate InChI */
 9935|  2.37k|                    pInChI = (INChI*)inchi_calloc(nNumComponents, sizeof(INChI));
  ------------------
  |  | 1146|  2.37k|#define inchi_calloc   calloc
  ------------------
 9936|  2.37k|                    if (!(pInChI))
  ------------------
  |  Branch (9936:25): [True: 0, False: 2.37k]
  ------------------
 9937|      0|                    {
 9938|      0|                        return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9939|      0|                    }
 9940|  2.37k|                    pInpInChI[bMobileH] = pInChI;
 9941|  2.37k|                    pnNumComponents[bMobileH] = nNumComponents;
 9942|       |                    /* djb-rwth: fixing oss-fuzz issue #66985, #66718 */
 9943|       |                    /* U_CHAR** piibmi_na = (U_CHAR**)inchi_malloc(nNumComponents * sizeof(U_CHAR*));
 9944|       |                    char** piibmi_shf = (char**)inchi_malloc(nNumComponents * sizeof(char*)); */
 9945|  41.0k|                    for (i = 0; i < nNumComponents; i++)
  ------------------
  |  Branch (9945:33): [True: 38.7k, False: 2.37k]
  ------------------
 9946|  38.7k|                    {
 9947|  38.7k|                        U_CHAR* piibmi_na = NULL;  /* copied from below to obey C syntax - 2024-09-01 DT */
 9948|  38.7k|                        char* piibmi_shf = NULL;   /* copied from below to obey C syntax - 2024-09-01 DT */
 9949|       |                        /* copy number of atoms */
 9950|  38.7k|                        len = pInpInChI[bMobileH][i].nNumberOfAtoms = pInpInChI[nAltMobileH][i].nNumberOfAtoms;
 9951|       |                        /* copy atoms */
 9952|  38.7k|                        len = (len + 1) * sizeof(pInpInChI[0][0].nAtom[0]);
 9953|  38.7k|                        if (pInpInChI[bMobileH][i].nAtom)
  ------------------
  |  Branch (9953:29): [True: 0, False: 38.7k]
  ------------------
 9954|      0|                        {
 9955|      0|                            inchi_free(pInpInChI[bMobileH][i].nAtom);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 9956|      0|                        }
 9957|  38.7k|                        piibmi_na = (U_CHAR*)inchi_malloc(((long long)len + 1) * sizeof(pInpInChI[0][0].nAtom[0]));
  ------------------
  |  | 1143|  38.7k|#define inchi_malloc   malloc
  ------------------
 9958|  38.7k|                        if (piibmi_na) /* djb-rwth: cast operator added; addressing LLVM warning */
  ------------------
  |  Branch (9958:29): [True: 38.7k, False: 0]
  ------------------
 9959|  38.7k|                        {
 9960|  38.7k|                            memcpy(piibmi_na, pInpInChI[nAltMobileH][i].nAtom, len);
 9961|  38.7k|                            piibmi_na[len] = 0;
 9962|  38.7k|                            pInpInChI[bMobileH][i].nAtom = piibmi_na;
 9963|  38.7k|                        }
 9964|      0|                        else
 9965|      0|                        {
 9966|      0|                            return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9967|      0|                        }
 9968|       |                        /* copy Hill formula */
 9969|  38.7k|                        len = (int)strlen(pInpInChI[nAltMobileH][i].szHillFormula) + 1;
 9970|  38.7k|                        if (pInpInChI[bMobileH][i].szHillFormula)
  ------------------
  |  Branch (9970:29): [True: 0, False: 38.7k]
  ------------------
 9971|      0|                        {
 9972|      0|                            inchi_free(pInpInChI[bMobileH][i].szHillFormula);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 9973|      0|                        }
 9974|  38.7k|                        piibmi_shf = (char*)inchi_malloc((inchi_max(len, 2)) * sizeof(char));
  ------------------
  |  | 1143|  38.7k|#define inchi_malloc   malloc
  ------------------
                                      piibmi_shf = (char*)inchi_malloc((inchi_max(len, 2)) * sizeof(char));
  ------------------
  |  |  138|  38.7k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 37.2k, False: 1.43k]
  |  |  ------------------
  ------------------
 9975|  38.7k|                        if (piibmi_shf) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (9975:29): [True: 38.7k, False: 0]
  ------------------
 9976|  38.7k|                        {
 9977|  38.7k|                            memcpy(piibmi_shf, pInpInChI[nAltMobileH][i].szHillFormula, len);
 9978|  38.7k|                            pInpInChI[bMobileH][i].szHillFormula = piibmi_shf;
 9979|  38.7k|                        }
 9980|      0|                        else
 9981|      0|                        {
 9982|      0|                            return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9983|      0|                        }
 9984|  38.7k|                    }
 9985|  2.37k|                }
 9986|     60|                else
 9987|     60|                {
 9988|     60|                    if (bMobileH == TAUT_YES)
  ------------------
  |  |  575|     60|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (9988:25): [True: 60, False: 0]
  ------------------
 9989|     60|                    {
 9990|     60|                        int ret;
 9991|       |                        /* allocate InChI */
 9992|     60|                        nNumComponents = 1;
 9993|       |                        /* InChI */
 9994|     60|                        pnNumComponents[bMobileH] = nNumComponents;
 9995|     60|                        if (!(pInChI = (INChI*)inchi_calloc(nNumComponents, sizeof(INChI))))
  ------------------
  |  | 1146|     60|#define inchi_calloc   calloc
  ------------------
  |  Branch (9995:29): [True: 0, False: 60]
  ------------------
 9996|      0|                        {
 9997|      0|                            return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9998|      0|                        }
 9999|     60|                        pInpInChI[bMobileH] = pInChI;
10000|     60|                        ret = nFillOutProtonMobileH(pInChI);
10001|     60|                        if (ret < 0)
  ------------------
  |  Branch (10001:29): [True: 0, False: 60]
  ------------------
10002|      0|                        {
10003|      0|                            return ret;
10004|      0|                        }
10005|     60|                    }
10006|     60|                }
10007|  2.43k|            return 0;
10008|  2.43k|        }
10009|     42|        return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     42|#define RI_ERR_SYNTAX  (-2)
  ------------------
10010|  2.49k|        }
10011|       |
10012|  13.2k|    if (*pEnd)
  ------------------
  |  Branch (10012:9): [True: 29, False: 13.1k]
  ------------------
10013|     29|    {
10014|     29|        return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     29|#define RI_ERR_SYNTAX  (-2)
  ------------------
10015|     29|    }
10016|       |
10017|       |    /* allocate InChI */
10018|  13.1k|    if (!((sizeof(INChI) > 0) && (pInpInChI[bMobileH] = (INChI*)inchi_calloc(nNumComponents, sizeof(INChI))))) /* djb-rwth: fixing GH issue #58 */
  ------------------
  |  | 1146|  13.1k|#define inchi_calloc   calloc
  ------------------
  |  Branch (10018:11): [True: 13.1k, Folded]
  |  Branch (10018:34): [True: 13.1k, False: 31]
  ------------------
10019|     31|    {
10020|     31|        return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   15|     31|#define RI_ERR_ALLOC   (-1)
  ------------------
10021|     31|    }
10022|  13.1k|    pInChI = pInpInChI[bMobileH];
10023|       |
10024|       |    /* Pass 2. Count elements, save formulas and elements */
10025|  13.1k|    pStart = (char*)str;
10026|  13.1k|    iComponent = 0;
10027|  26.8k|    while (1)
  ------------------
  |  Branch (10027:12): [True: 26.8k, Folded]
  ------------------
10028|  26.8k|    {
10029|  26.8k|        if (!(pEnd = strchr(pStart, '.')))
  ------------------
  |  Branch (10029:13): [True: 13.1k, False: 13.6k]
  ------------------
10030|  13.1k|        {
10031|  13.1k|            pEnd = pStart + strlen(pStart);
10032|  13.1k|        }
10033|  26.8k|        p = pStart;
10034|  26.8k|        if (isdigit(UCINT * p))
  ------------------
  |  Branch (10034:13): [True: 8.38k, False: 18.4k]
  ------------------
10035|  8.38k|        {
10036|  8.38k|            mpy_component = (int)inchi_strtol(p, &q, 10);
10037|  8.38k|#if ( CHECK_STRTOL_ATNUMB==1 )
10038|  8.38k|            if (mpy_component > MAX_ATOMS || mpy_component < 0)
  ------------------
  |  |   15|  16.7k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (10038:17): [True: 5, False: 8.37k]
  |  Branch (10038:46): [True: 34, False: 8.34k]
  ------------------
10039|     39|            {
10040|     39|                return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     39|#define RI_ERR_SYNTAX  (-2)
  ------------------
10041|     39|            }
10042|  8.34k|#endif
10043|  8.34k|            p = q;
10044|  8.34k|        }
10045|  18.4k|        else
10046|  18.4k|        {
10047|  18.4k|            mpy_component = 1;
10048|  18.4k|        }
10049|  26.7k|#if ( FIX_DALKE_BUGS == 1 )
10050|  26.7k|        if (iComponent + mpy_component > MAX_ATOMS)
  ------------------
  |  |   15|  26.7k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (10050:13): [True: 0, False: 26.7k]
  ------------------
10051|      0|        {
10052|      0|#if ( FIX_GAF_2019_1==1 )
10053|      0|            nNumComponents = 0; /* djb-rwth: ignoring LLVM warning: value used */
10054|      0|#endif
10055|      0|            return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10056|      0|        }
10057|  26.7k|#endif
10058|  26.7k|        len = (int)(pEnd - p);
10059|   415k|        for (i = 0; i < mpy_component; i++)
  ------------------
  |  Branch (10059:21): [True: 388k, False: 26.6k]
  ------------------
10060|   388k|        {
10061|   388k|            if (iComponent + i >= nNumComponents)
  ------------------
  |  Branch (10061:17): [True: 13, False: 388k]
  ------------------
10062|     13|            {
10063|     13|                return RI_ERR_SYNTAX;
  ------------------
  |  |   16|     13|#define RI_ERR_SYNTAX  (-2)
  ------------------
10064|     13|            }
10065|   388k|            if (pInChI[iComponent + i].szHillFormula)
  ------------------
  |  Branch (10065:17): [True: 0, False: 388k]
  ------------------
10066|      0|            {
10067|      0|                inchi_free(pInChI[iComponent + i].szHillFormula);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
10068|      0|            }
10069|   388k|            pInChI[iComponent + i].szHillFormula = (char*)inchi_malloc(inchi_max((long long)len, 1) + 1); /* djb-rwth: cast operator added */
  ------------------
  |  | 1143|   388k|#define inchi_malloc   malloc
  ------------------
                          pInChI[iComponent + i].szHillFormula = (char*)inchi_malloc(inchi_max((long long)len, 1) + 1); /* djb-rwth: cast operator added */
  ------------------
  |  |  138|   388k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 285k, False: 103k]
  |  |  ------------------
  ------------------
10070|   388k|            if (pInChI[iComponent + i].szHillFormula) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (10070:17): [True: 388k, False: 0]
  ------------------
10071|   388k|            {
10072|   388k|                memcpy(pInChI[iComponent].szHillFormula, p, len);
10073|   388k|                pInChI[iComponent + i].szHillFormula[len] = '\0';
10074|   388k|            }
10075|      0|            else
10076|      0|            {
10077|      0|                return RI_ERR_ALLOC; /* djb-rwth: memory could not be allocated */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
10078|      0|            }
10079|   388k|            if (!i)
  ------------------
  |  Branch (10079:17): [True: 26.7k, False: 362k]
  ------------------
10080|  26.7k|            {
10081|       |                /* Pass 2.1 Parse formula and count atoms except H */
10082|  26.7k|                nNumAtoms = 0;
10083|  26.7k|                nNumH = 0;
10084|       |                /* djb-rwth: removing redundant code */
10085|  26.7k|                e = pInChI[iComponent].szHillFormula;
10086|   167k|                while (e && *e) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (10086:24): [True: 167k, False: 0]
  |  Branch (10086:29): [True: 140k, False: 26.6k]
  ------------------
10087|   140k|                {
10088|   140k|                    if (!isupper(UCINT * e))
  ------------------
  |  Branch (10088:25): [True: 60, False: 140k]
  ------------------
10089|     60|                    {
10090|     60|                        return RI_ERR_SYNTAX;
  ------------------
  |  |   16|     60|#define RI_ERR_SYNTAX  (-2)
  ------------------
10091|     60|                    }
10092|   140k|                    j = 0;
10093|   140k|                    szEl[j++] = *e++;
10094|   140k|                    if (*e && islower(UCINT * e))
  ------------------
  |  Branch (10094:25): [True: 121k, False: 18.5k]
  |  Branch (10094:31): [True: 21.0k, False: 100k]
  ------------------
10095|  21.0k|                        szEl[j++] = *e++;
10096|   140k|                    szEl[j++] = '\0';
10097|   140k|                    if (*e && isdigit(UCINT * e))
  ------------------
  |  Branch (10097:25): [True: 119k, False: 21.2k]
  |  Branch (10097:31): [True: 21.0k, False: 98.1k]
  ------------------
10098|  21.0k|                    {
10099|  21.0k|                        mpy_atom = (int)inchi_strtol(e, &q, 10);
10100|  21.0k|#if ( CHECK_STRTOL_ATNUMB==1 )
10101|  21.0k|                        if (mpy_atom > MAX_ATOMS || mpy_atom < 0)
  ------------------
  |  |   15|  42.0k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (10101:29): [True: 3, False: 21.0k]
  |  Branch (10101:53): [True: 44, False: 20.9k]
  ------------------
10102|     47|                        {
10103|     47|                            return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     47|#define RI_ERR_SYNTAX  (-2)
  ------------------
10104|     47|                        }
10105|  20.9k|#endif
10106|  20.9k|                        e = q;
10107|  20.9k|                    }
10108|   119k|                    else
10109|   119k|                    {
10110|   119k|                        mpy_atom = 1;
10111|   119k|                    }
10112|   140k|                    if (!mpy_atom)
  ------------------
  |  Branch (10112:25): [True: 0, False: 140k]
  ------------------
10113|      0|                    {
10114|      0|                        return RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10115|      0|                    }
10116|   140k|                    if (szEl[0] == 'H' && !szEl[1])
  ------------------
  |  Branch (10116:25): [True: 8.43k, False: 131k]
  |  Branch (10116:43): [True: 6.99k, False: 1.44k]
  ------------------
10117|  6.99k|                    {
10118|  6.99k|                        nNumH += mpy_atom;
10119|  6.99k|                        continue; /* ignore H in counting number of atoms */
10120|  6.99k|                    }
10121|   133k|                    nNumAtoms += mpy_atom;
10122|   133k|                }
10123|  26.6k|#if ( FIX_DALKE_BUGS == 1 )
10124|  26.6k|                if (nNumAtoms > MAX_ATOMS)
  ------------------
  |  |   15|  26.6k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (10124:21): [True: 0, False: 26.6k]
  ------------------
10125|      0|                {
10126|      0|                    return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10127|      0|                }
10128|  26.6k|#endif
10129|  26.6k|                (*na_total) += mpy_component * nNumAtoms;
10130|       |
10131|  26.6k|                nNumAtomsAndH = nNumAtoms ? nNumAtoms : (nNumH > 0);
  ------------------
  |  Branch (10131:33): [True: 26.3k, False: 291]
  ------------------
10132|  26.6k|                pInChI[iComponent + i].nNumberOfAtoms = nNumAtomsAndH;
10133|  26.6k|                if (pInChI[iComponent + i].nAtom)
  ------------------
  |  Branch (10133:21): [True: 0, False: 26.6k]
  ------------------
10134|      0|                {
10135|      0|                    inchi_free(pInChI[iComponent + i].nAtom);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
10136|      0|                }
10137|  26.6k|                pInChI[iComponent + i].nAtom = (U_CHAR*)inchi_malloc(((long long)nNumAtomsAndH + 1) * sizeof(pInChI[0].nAtom[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1143|  26.6k|#define inchi_malloc   malloc
  ------------------
10138|  26.6k|                if (!pInChI[iComponent + i].nAtom)
  ------------------
  |  Branch (10138:21): [True: 0, False: 26.6k]
  ------------------
10139|      0|                {
10140|      0|                    return RI_ERR_ALLOC; /* failed allocation */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
10141|      0|                }
10142|       |                /* Pass 2.2 Store elements; this assumes no bridging H. Bridging H will be found in connection table, /c */
10143|  26.6k|                iAtom = 0;
10144|  26.6k|                if (nNumAtoms > 0)
  ------------------
  |  Branch (10144:21): [True: 26.3k, False: 291]
  ------------------
10145|  26.3k|                {
10146|  26.3k|                    e = pInChI[iComponent + i].szHillFormula;
10147|   166k|                    while (*e)
  ------------------
  |  Branch (10147:28): [True: 139k, False: 26.3k]
  ------------------
10148|   139k|                    {
10149|   139k|                        if (!isupper(UCINT * e))
  ------------------
  |  Branch (10149:29): [True: 0, False: 139k]
  ------------------
10150|      0|                        {
10151|      0|                            return RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10152|      0|                        }
10153|   139k|                        j = 0;
10154|   139k|                        szEl[j++] = *e++;
10155|   139k|                        if (*e && islower(UCINT * e))
  ------------------
  |  Branch (10155:29): [True: 121k, False: 18.3k]
  |  Branch (10155:35): [True: 21.0k, False: 100k]
  ------------------
10156|  21.0k|                            szEl[j++] = *e++;
10157|   139k|                        szEl[j++] = '\0';
10158|   139k|                        if (*e && isdigit(UCINT * e))
  ------------------
  |  Branch (10158:29): [True: 118k, False: 21.1k]
  |  Branch (10158:35): [True: 20.7k, False: 97.7k]
  ------------------
10159|  20.7k|                        {
10160|  20.7k|                            mpy_atom = (int)inchi_strtol(e, &q, 10);
10161|  20.7k|#if ( CHECK_STRTOL_ATNUMB==1 )
10162|  20.7k|                            if (mpy_atom > MAX_ATOMS || mpy_atom < 0)
  ------------------
  |  |   15|  41.5k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (10162:33): [True: 0, False: 20.7k]
  |  Branch (10162:57): [True: 0, False: 20.7k]
  ------------------
10163|      0|                            {
10164|      0|                                return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10165|      0|                            }
10166|  20.7k|#endif
10167|  20.7k|                            e = q;
10168|  20.7k|                        }
10169|   118k|                        else
10170|   118k|                        {
10171|   118k|                            mpy_atom = 1;
10172|   118k|                        }
10173|   139k|                        if (!mpy_atom)
  ------------------
  |  Branch (10173:29): [True: 0, False: 139k]
  ------------------
10174|      0|                        {
10175|      0|                            return RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10176|      0|                        }
10177|   139k|                        if (szEl[0] == 'H' && !szEl[1])
  ------------------
  |  Branch (10177:29): [True: 8.05k, False: 131k]
  |  Branch (10177:47): [True: 6.62k, False: 1.43k]
  ------------------
10178|  6.62k|                            continue; /* ignore H */
10179|   133k|                        el_number = get_periodic_table_number(szEl);
10180|   133k|                        if (el_number == ERR_ELEM)
  ------------------
  |  Branch (10180:29): [True: 25, False: 133k]
  ------------------
10181|     25|                        {
10182|     25|                            return RI_ERR_SYNTAX; /* wrong element */
  ------------------
  |  |   16|     25|#define RI_ERR_SYNTAX  (-2)
  ------------------
10183|     25|                        }
10184|  2.37M|                        while (mpy_atom--)
  ------------------
  |  Branch (10184:32): [True: 2.24M, False: 133k]
  ------------------
10185|  2.24M|                        {
10186|  2.24M|                            if (iAtom >= nNumAtoms)
  ------------------
  |  Branch (10186:33): [True: 0, False: 2.24M]
  ------------------
10187|      0|                            {
10188|      0|                                return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
10189|      0|                            }
10190|  2.24M|                            pInChI[iComponent + i].nAtom[iAtom++] = (U_CHAR)el_number;
10191|  2.24M|                        }
10192|   133k|                    }
10193|  26.3k|                }
10194|    291|                else
10195|    291|                {
10196|    291|                    if (nNumH > 0)
  ------------------
  |  Branch (10196:25): [True: 291, False: 0]
  ------------------
10197|    291|                    {
10198|    291|                        pInChI[iComponent + i].nAtom[iAtom++] = EL_NUMBER_H;
  ------------------
  |  |   11|    291|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
10199|    291|                        nNumAtoms = 1;
10200|    291|                    }
10201|    291|                }
10202|  26.6k|                pInChI[iComponent + i].nAtom[iAtom] = '\0';
10203|  26.6k|                if (nNumAtoms != iAtom)
  ------------------
  |  Branch (10203:21): [True: 0, False: 26.6k]
  ------------------
10204|      0|                {
10205|      0|                    return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
10206|      0|                }
10207|  26.6k|            }
10208|   362k|            else
10209|   362k|            {
10210|   362k|                U_CHAR* pci1 = NULL;  /* copied from below to obey C syntax - 2024-09-01 DT */
10211|       |                /* Copy duplicated formula */
10212|   362k|                strcpy(pInChI[iComponent + i].szHillFormula, pInChI[iComponent].szHillFormula); /* djb-rwth: unresolved issue -- revision required? */
10213|       |                /* Copy atoms in the duplicated formula */
10214|   362k|                pInChI[iComponent + i].nNumberOfAtoms = nNumAtoms;
10215|       |                /* djb-rwth: fixing oss-fuzz issue #43420, #34772 */
10216|   362k|                pci1 = (U_CHAR*)inchi_malloc((long long)nNumAtoms + 1); /* djb-rwth: cast operator added */
  ------------------
  |  | 1143|   362k|#define inchi_malloc   malloc
  ------------------
10217|   362k|                if (!pci1)
  ------------------
  |  Branch (10217:21): [True: 0, False: 362k]
  ------------------
10218|      0|                {
10219|      0|                    return RI_ERR_ALLOC; /* failed allocation */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
10220|      0|                }
10221|   362k|                pInChI[iComponent + i].nAtom = pci1;
10222|   362k|                memcpy(pci1, pInChI[iComponent].nAtom, (long long)nNumAtoms + 1); /* djb-rwth: cast operator added */
10223|   362k|            }
10224|   388k|        }
10225|  26.6k|        iComponent += i;
10226|  26.6k|        if (*pEnd)
  ------------------
  |  Branch (10226:13): [True: 13.6k, False: 12.9k]
  ------------------
10227|  13.6k|        {
10228|  13.6k|            if (*pEnd != '.')
  ------------------
  |  Branch (10228:17): [True: 0, False: 13.6k]
  ------------------
10229|      0|            {
10230|      0|                return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10231|      0|            }
10232|  13.6k|            pStart = pEnd + 1;
10233|  13.6k|        }
10234|  12.9k|        else
10235|  12.9k|        {
10236|  12.9k|            break;
10237|  12.9k|        }
10238|  26.6k|    }
10239|       |
10240|  12.9k|    if (iComponent != nNumComponents)
  ------------------
  |  Branch (10240:9): [True: 0, False: 12.9k]
  ------------------
10241|      0|    {
10242|      0|        return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
10243|      0|    }
10244|  12.9k|    if (bMobileH == TAUT_NON)
  ------------------
  |  |  574|  12.9k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (10244:9): [True: 636, False: 12.3k]
  ------------------
10245|    636|    {
10246|       |        /* at this point the exact number of atoms including bridging H is known from TAUT_YES */
10247|  1.41k|        for (i = 0; i < nNumComponents && i < pnNumComponents[nAltMobileH]; i++)
  ------------------
  |  Branch (10247:21): [True: 816, False: 595]
  |  Branch (10247:43): [True: 775, False: 41]
  ------------------
10248|    775|        {
10249|    775|            if (pInpInChI[bMobileH][i].nNumberOfAtoms < (len = pInpInChI[nAltMobileH][i].nNumberOfAtoms))
  ------------------
  |  Branch (10249:17): [True: 681, False: 94]
  ------------------
10250|    681|            {
10251|       |                /* there are bridging H in this component */
10252|    681|                if (pInpInChI[nAltMobileH][i].nAtom)
  ------------------
  |  Branch (10252:21): [True: 681, False: 0]
  ------------------
10253|    681|                {
10254|    681|                    U_CHAR* nAtom = (U_CHAR*)inchi_malloc(((long long)len + 1) * sizeof(nAtom[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1143|    681|#define inchi_malloc   malloc
  ------------------
10255|    681|                    if (!nAtom)
  ------------------
  |  Branch (10255:25): [True: 0, False: 681]
  ------------------
10256|      0|                    {
10257|      0|                        return RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
10258|      0|                    }
10259|    681|                    memcpy(nAtom, pInpInChI[nAltMobileH][i].nAtom, len * sizeof(nAtom[0]));
10260|    681|                    nAtom[len] = 0;
10261|    681|                    if (pInpInChI[bMobileH][i].nAtom)
  ------------------
  |  Branch (10261:25): [True: 681, False: 0]
  ------------------
10262|    681|                    {
10263|    681|                        inchi_free(pInpInChI[bMobileH][i].nAtom);
  ------------------
  |  | 1152|    681|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 681, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 681]
  |  |  ------------------
  ------------------
10264|    681|                    }
10265|    681|                    pInpInChI[bMobileH][i].nAtom = nAtom;
10266|    681|                }
10267|    681|                pInpInChI[bMobileH][i].nNumberOfAtoms = len;
10268|    681|            }
10269|    775|        }
10270|    636|    }
10271|       |
10272|  12.9k|    return nNumComponents + 1;
10273|  12.9k|    }
ichiread.c:ParseSegmentConnections:
 9104|  12.3k|{
 9105|  12.3k|#define LAST_AT_LEN 256
 9106|       |    /* Pass 1: count bonds and find actual numbers of  atom */
 9107|  12.3k|    int i, j, k, m, c, mpy_component;
 9108|  12.3k|    int nNumComponents, iComponent, nNumAtoms, nNumBonds, lenConnTable; /* djb-rwth: removing redundant variables */
 9109|  12.3k|    const char* p, * q, * pStart, * pEnd;
 9110|  12.3k|    AT_NUMB last_atom[LAST_AT_LEN], curAtom, maxAtom;
 9111|  12.3k|    int  num_open, state, ret, base;
 9112|  12.3k|    INChI* pInChI = *pInpInChI;
 9113|  12.3k|    LINKED_BONDS LB;
 9114|  12.3k|    LINKED_BONDS* pLB = &LB; /* a list of linked lists of bonds, for each atom */
 9115|  12.3k|    AT_NUMB neighbor[MAXVAL];
 9116|  12.3k|    int bPrevVersion = -1;
 9117|       |
 9118|  12.3k|    *nb_total = 0;
 9119|  12.3k|    iComponent = 0;
 9120|  12.3k|    LB.pBond = NULL; /* djb-rwth: initialization required to avoid garbage values */
 9121|  12.3k|    if (str[0] != 'c')
  ------------------
  |  Branch (9121:9): [True: 3.27k, False: 9.09k]
  ------------------
 9122|  3.27k|    {
 9123|  3.27k|        if (!pInChI && !*pnNumComponents)
  ------------------
  |  Branch (9123:13): [True: 0, False: 3.27k]
  |  Branch (9123:24): [True: 0, False: 0]
  ------------------
 9124|      0|        {
 9125|      0|            int lenFormula = 1;
 9126|       |            /* component has no formula; allocate InChI */
 9127|      0|            lenConnTable = 0;
 9128|      0|            nNumComponents = 1;
 9129|       |            /* allocate InChI */
 9130|      0|            if (!(pInChI = *pInpInChI = (INChI*)inchi_calloc(nNumComponents, sizeof(INChI))))
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (9130:17): [True: 0, False: 0]
  ------------------
 9131|      0|            {
 9132|      0|                return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9133|      0|            }
 9134|       |            /* allocate empty formula */
 9135|      0|            pInChI[iComponent].szHillFormula = (char*)inchi_calloc((long long)lenFormula + 1, sizeof(pInChI[0].szHillFormula[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 9136|      0|            if (!pInChI[iComponent].szHillFormula)
  ------------------
  |  Branch (9136:17): [True: 0, False: 0]
  ------------------
 9137|      0|            {
 9138|      0|                ret = RI_ERR_ALLOC; /* allocation failure */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9139|      0|                goto exit_function;
 9140|      0|            }
 9141|       |            /* allocate empty connection table */
 9142|      0|            pInChI[iComponent].nConnTable = (AT_NUMB*)inchi_calloc((long long)lenConnTable + 1, sizeof(pInChI[0].nConnTable[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 9143|      0|            if (!pInChI[iComponent].nConnTable)
  ------------------
  |  Branch (9143:17): [True: 0, False: 0]
  ------------------
 9144|      0|            {
 9145|      0|                ret = RI_ERR_ALLOC; /* allocation failure */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9146|      0|                goto exit_function;
 9147|      0|            }
 9148|      0|            pInChI[iComponent].lenConnTable = lenConnTable;
 9149|      0|            *pnNumComponents = nNumComponents;
 9150|      0|        }
 9151|  3.27k|        else
 9152|  3.27k|        {
 9153|  3.27k|            lenConnTable = 1;
 9154|  3.27k|            nNumComponents = *pnNumComponents;
 9155|   266k|            for (i = 0; i < nNumComponents; i++)
  ------------------
  |  Branch (9155:25): [True: 263k, False: 3.27k]
  ------------------
 9156|   263k|            {
 9157|       |                /* allocate 1 atom connection table */
 9158|   263k|                if (pInChI) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (9158:21): [True: 263k, False: 0]
  ------------------
 9159|   263k|                {
 9160|   263k|                    if (pInChI[i].nConnTable)
  ------------------
  |  Branch (9160:25): [True: 60, False: 263k]
  ------------------
 9161|     60|                    {
 9162|     60|                        inchi_free(pInChI[i].nConnTable);
  ------------------
  |  | 1152|     60|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 60, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 60]
  |  |  ------------------
  ------------------
 9163|     60|                    }
 9164|   263k|                    pInChI[i].nConnTable = (AT_NUMB*)inchi_calloc((long long)lenConnTable + 1, sizeof(pInChI[0].nConnTable[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|   263k|#define inchi_calloc   calloc
  ------------------
 9165|   263k|                    if (!pInChI[i].nConnTable)
  ------------------
  |  Branch (9165:25): [True: 0, False: 263k]
  ------------------
 9166|      0|                    {
 9167|      0|                        ret = RI_ERR_ALLOC; /* allocation failure */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9168|      0|                        goto exit_function;
 9169|      0|                    }
 9170|   263k|                    pInChI[i].nConnTable[0] = 1;
 9171|   263k|                    pInChI[i].lenConnTable = lenConnTable;
 9172|   263k|                }
 9173|   263k|            }
 9174|  3.27k|        }
 9175|  3.27k|        return 0;
 9176|  3.27k|    }
 9177|       |
 9178|       |    /* Pass 1. Re-Count atoms, count bonds */
 9179|       |
 9180|  9.09k|    pStart = (char*)str + 1;
 9181|  9.09k|    nNumComponents = *pnNumComponents;
 9182|  9.09k|#if (FIX_DALKE_BUGS == 1)
 9183|       |    /* prevent crash on too many components */
 9184|  9.09k|    if (nNumComponents > MAX_ATOMS)
  ------------------
  |  |   15|  9.09k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (9184:9): [True: 0, False: 9.09k]
  ------------------
 9185|      0|    {
 9186|      0|        ret = RI_ERR_SYNTAX; /* syntax error: extra component */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9187|      0|        goto exit_function;
 9188|      0|    }
 9189|  9.09k|#endif
 9190|  9.09k|    memset(pLB, 0, sizeof(pLB[0])); /* djb-rwth: memset_s C11/Annex K variant? */
 9191|       |
 9192|  14.4k|    while (1)
  ------------------
  |  Branch (9192:12): [True: 14.4k, Folded]
  ------------------
 9193|  14.4k|    {
 9194|       |        /* cycle over components */
 9195|  14.4k|        if (!(pEnd = strchr(pStart, ';')))
  ------------------
  |  Branch (9195:13): [True: 8.11k, False: 6.33k]
  ------------------
 9196|  8.11k|        {
 9197|  8.11k|            pEnd = pStart + strlen(pStart);
 9198|  8.11k|        }
 9199|  14.4k|        if ((p = strchr(pStart, '*')) && p < pEnd)
  ------------------
  |  Branch (9199:13): [True: 2.80k, False: 11.6k]
  |  Branch (9199:42): [True: 2.62k, False: 180]
  ------------------
 9200|  2.62k|        {
 9201|  2.62k|            mpy_component = (int)inchi_strtol(pStart, &q, 10);
 9202|  2.62k|#if ( CHECK_STRTOL_ATNUMB==1 )
 9203|  2.62k|            if (mpy_component > MAX_ATOMS || mpy_component < 0)
  ------------------
  |  |   15|  5.25k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (9203:17): [True: 2, False: 2.62k]
  |  Branch (9203:46): [True: 30, False: 2.59k]
  ------------------
 9204|     32|            {
 9205|     32|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     32|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9206|     32|                goto exit_function;
 9207|     32|            }
 9208|  2.59k|#endif
 9209|  2.59k|            if (p != q
  ------------------
  |  Branch (9209:17): [True: 2, False: 2.59k]
  ------------------
 9210|  2.59k|#if (FIX_DALKE_BUGS == 1)
 9211|  2.59k|                || !isdigit(UCINT * pStart)
  ------------------
  |  Branch (9211:20): [True: 0, False: 2.59k]
  ------------------
 9212|  2.59k|#endif
 9213|  2.59k|                )
 9214|      2|            {
 9215|      2|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9216|      2|                goto exit_function;
 9217|      2|            }
 9218|  2.59k|            p++;
 9219|  2.59k|        }
 9220|  11.8k|        else
 9221|  11.8k|        {
 9222|  11.8k|            mpy_component = 1;
 9223|  11.8k|            p = pStart;
 9224|  11.8k|        }
 9225|  14.4k|#if (FIX_DALKE_BUGS == 1)
 9226|  14.4k|        if (iComponent + mpy_component > MAX_ATOMS)
  ------------------
  |  |   15|  14.4k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (9226:13): [True: 0, False: 14.4k]
  ------------------
 9227|      0|        {
 9228|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9229|      0|            goto exit_function;
 9230|      0|        }
 9231|  14.4k|#endif
 9232|  14.4k|        pStart = p;
 9233|       |        /* Pass 1.1 parse a component */
 9234|  14.4k|        num_open = 0;
 9235|  14.4k|        memset(last_atom, 0, sizeof(last_atom)); /* djb-rwth: memset_s C11/Annex K variant? */
 9236|  14.4k|        state = '\0';   /* initial state */
 9237|  14.4k|        maxAtom = 0;
 9238|  14.4k|        nNumBonds = 0;
 9239|       |        /* djb-rwth: removing redundant code */
 9240|  14.4k|        if (p < pEnd && *pbAbc == -1)
  ------------------
  |  Branch (9240:13): [True: 9.52k, False: 4.88k]
  |  Branch (9240:25): [True: 0, False: 9.52k]
  ------------------
 9241|      0|        {
 9242|       |            /* check if compressed InChI */
 9243|      0|            *pbAbc = isupper(UCINT * p) ? 1 : 0;
  ------------------
  |  Branch (9243:22): [True: 0, False: 0]
  ------------------
 9244|      0|        }
 9245|  14.4k|        base = *pbAbc ? ALPHA_BASE : 10;
  ------------------
  |  |  170|      0|#define ALPHA_BASE 27
  ------------------
  |  Branch (9245:16): [True: 0, False: 14.4k]
  ------------------
 9246|       |
 9247|  14.4k|        if (*pbAbc == 1)
  ------------------
  |  Branch (9247:13): [True: 0, False: 14.4k]
  ------------------
 9248|      0|        {
 9249|      0|            nNumAtoms = 1;
 9250|      0|            while (p < pEnd)
  ------------------
  |  Branch (9250:20): [True: 0, False: 0]
  ------------------
 9251|      0|            {
 9252|      0|                if (*p == '-')
  ------------------
  |  Branch (9252:21): [True: 0, False: 0]
  ------------------
 9253|      0|                {
 9254|      0|                    if (bPrevVersion == -1)
  ------------------
  |  Branch (9254:25): [True: 0, False: 0]
  ------------------
 9255|      0|                    {
 9256|       |                        /* previous InChI version */
 9257|      0|                        bPrevVersion = 1;
 9258|      0|                    }
 9259|      0|                    else
 9260|      0|                        if (bPrevVersion != 1)
  ------------------
  |  Branch (9260:29): [True: 0, False: 0]
  ------------------
 9261|      0|                        {
 9262|      0|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9263|      0|                            goto exit_function;
 9264|      0|                        }
 9265|      0|                    nNumAtoms--;
 9266|      0|                    p++;
 9267|      0|                }
 9268|      0|                if (isdigit(UCINT * p))
  ------------------
  |  Branch (9268:21): [True: 0, False: 0]
  ------------------
 9269|      0|                {
 9270|      0|                    if (bPrevVersion == -1)
  ------------------
  |  Branch (9270:25): [True: 0, False: 0]
  ------------------
 9271|      0|                    {
 9272|       |                        /* curreny InChI, version 1 */
 9273|      0|                        bPrevVersion = 0;
 9274|      0|                    }
 9275|      0|                    else
 9276|      0|                        if (bPrevVersion != 0)
  ------------------
  |  Branch (9276:29): [True: 0, False: 0]
  ------------------
 9277|      0|                        {
 9278|      0|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9279|      0|                            goto exit_function;
 9280|      0|                        }
 9281|      0|                    nNumAtoms -= inchi_strtol(p, &p, 10); /* bypass digits */
 9282|      0|                }
 9283|      0|                if (*p != '-' && (curAtom = (AT_NUMB)inchi_strtol(p, &q, base)))
  ------------------
  |  Branch (9283:21): [True: 0, False: 0]
  |  Branch (9283:34): [True: 0, False: 0]
  ------------------
 9284|      0|                {
 9285|      0|                    nNumAtoms++;
 9286|      0|                    nNumBonds++;
 9287|      0|                    p = q;
 9288|      0|                    if (maxAtom < curAtom)
  ------------------
  |  Branch (9288:25): [True: 0, False: 0]
  ------------------
 9289|      0|                        maxAtom = curAtom;
 9290|      0|                }
 9291|      0|                else
 9292|      0|                {
 9293|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9294|      0|                    goto exit_function;
 9295|      0|                }
 9296|      0|            }
 9297|      0|            if (maxAtom < nNumAtoms && nNumBonds)
  ------------------
  |  Branch (9297:17): [True: 0, False: 0]
  |  Branch (9297:40): [True: 0, False: 0]
  ------------------
 9298|      0|            {
 9299|      0|                maxAtom = nNumAtoms;
 9300|      0|            }
 9301|      0|        }
 9302|  14.4k|        else
 9303|  14.4k|        {
 9304|   155k|            while (p < pEnd)
  ------------------
  |  Branch (9304:20): [True: 140k, False: 14.3k]
  ------------------
 9305|   140k|            {
 9306|       |                /* atom number */
 9307|   140k|                c = UCINT * p++;
  ------------------
  |  |   88|   140k|#define UCINT  (int)(unsigned char)
  ------------------
 9308|   140k|                switch (c)
 9309|   140k|                {
 9310|  11.4k|                case '(':
  ------------------
  |  Branch (9310:17): [True: 11.4k, False: 129k]
  ------------------
 9311|  21.3k|                case ')':
  ------------------
  |  Branch (9311:17): [True: 9.91k, False: 130k]
  ------------------
 9312|  26.4k|                case ',':
  ------------------
  |  Branch (9312:17): [True: 5.09k, False: 135k]
  ------------------
 9313|  66.3k|                case '-':
  ------------------
  |  Branch (9313:17): [True: 39.9k, False: 100k]
  ------------------
 9314|  66.3k|                    if (state != 'N')
  ------------------
  |  Branch (9314:25): [True: 23, False: 66.3k]
  ------------------
 9315|     23|                    {
 9316|     23|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     23|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9317|     23|                        goto exit_function;
 9318|     23|                    }
 9319|  66.3k|                    state = c;
 9320|  66.3k|                    num_open += (c == '(') - (c == ')');
 9321|  66.3k|                    if (num_open < 0)
  ------------------
  |  Branch (9321:25): [True: 12, False: 66.3k]
  ------------------
 9322|     12|                    {
 9323|     12|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     12|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9324|     12|                        goto exit_function;
 9325|     12|                    }
 9326|  66.3k|                    break;
 9327|  74.3k|                default:
  ------------------
  |  Branch (9327:17): [True: 74.3k, False: 66.3k]
  ------------------
 9328|  74.3k|                    if (isdigit(c) && (curAtom = (AT_NUMB)inchi_strtol(p - 1, &q, 10)))
  ------------------
  |  Branch (9328:25): [True: 74.2k, False: 29]
  |  Branch (9328:39): [True: 74.2k, False: 5]
  ------------------
 9329|  74.2k|                    {
 9330|  74.2k|                        p = q;
 9331|  74.2k|                        switch (state)
 9332|  74.2k|                        {
 9333|  11.4k|                        case '(':
  ------------------
  |  Branch (9333:25): [True: 11.4k, False: 62.8k]
  ------------------
 9334|  20.6k|                        case ')':
  ------------------
  |  Branch (9334:25): [True: 9.24k, False: 65.0k]
  ------------------
 9335|  25.6k|                        case ',':
  ------------------
  |  Branch (9335:25): [True: 5.00k, False: 69.2k]
  ------------------
 9336|  64.7k|                        case '-':
  ------------------
  |  Branch (9336:25): [True: 39.1k, False: 35.1k]
  ------------------
 9337|  64.7k|                            nNumBonds++;
 9338|  74.2k|                        case '\0':
  ------------------
  |  Branch (9338:25): [True: 9.50k, False: 64.7k]
  ------------------
 9339|  74.2k|                            if (maxAtom < curAtom)
  ------------------
  |  Branch (9339:33): [True: 20.6k, False: 53.6k]
  ------------------
 9340|  20.6k|                                maxAtom = curAtom;
 9341|  74.2k|                            state = 'N';
 9342|  74.2k|                            break;
 9343|      0|                        default:
  ------------------
  |  Branch (9343:25): [True: 0, False: 74.2k]
  ------------------
 9344|      0|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9345|      0|                            goto exit_function;
 9346|  74.2k|                        }
 9347|  74.2k|                    }
 9348|     34|                    else
 9349|     34|                    {
 9350|     34|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     34|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9351|     34|                        goto exit_function;
 9352|     34|                    }
 9353|  74.2k|                    break;
 9354|   140k|                }
 9355|   140k|            }
 9356|  14.3k|            if (num_open)
  ------------------
  |  Branch (9356:17): [True: 11, False: 14.3k]
  ------------------
 9357|     11|            {
 9358|     11|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     11|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9359|     11|                goto exit_function;
 9360|       |                /* syntax error: parentheses do not match */
 9361|     11|            }
 9362|  14.3k|        }
 9363|  14.3k|        (*nb_total) += nNumBonds;
 9364|       |
 9365|       |        /* Save the results and allocate memory */
 9366|  14.3k|        nNumAtoms = (int)maxAtom; /* 0 if empty connection table and no bonds present */
 9367|  14.3k|        lenConnTable = nNumAtoms + nNumBonds;
 9368|       |
 9369|       |        /* connection table format: At1[,Neigh11,Neigh12,...],At2[,Neigh21,Neigh22,...],AtN[NeighN1,NeighN2,...] */
 9370|       |        /* where AtK > NeighK1 > NeighK2,...; At(K) < At(K+1); the length = num.atoms + num.bonds */
 9371|  89.1k|        for (i = 0; i < mpy_component; i++)
  ------------------
  |  Branch (9371:21): [True: 74.8k, False: 14.2k]
  ------------------
 9372|  74.8k|        {
 9373|  74.8k|#if ( FIX_GAF_2019_2==1 )
 9374|  74.8k|            if ((iComponent + i > nNumComponents - 1) || (iComponent + i < 0))
  ------------------
  |  Branch (9374:17): [True: 13, False: 74.8k]
  |  Branch (9374:58): [True: 0, False: 74.8k]
  ------------------
 9375|     13|            {
 9376|     13|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     13|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9377|     13|                goto exit_function;
 9378|     13|            }
 9379|  74.8k|            if (pInChI[iComponent + i].nNumberOfAtoms <= 0 || pInChI[iComponent + i].nNumberOfAtoms > MAX_ATOMS)
  ------------------
  |  |   15|  74.8k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (9379:17): [True: 0, False: 74.8k]
  |  Branch (9379:63): [True: 0, False: 74.8k]
  ------------------
 9380|      0|            {
 9381|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9382|      0|                goto exit_function;
 9383|      0|            }
 9384|  74.8k|#endif
 9385|       |            /* check number of atoms: the difference may be due to bridging H */
 9386|  74.8k|            if ((j = pInChI[iComponent + i].nNumberOfAtoms) < nNumAtoms)
  ------------------
  |  Branch (9386:17): [True: 34.9k, False: 39.8k]
  ------------------
 9387|  34.9k|            {
 9388|       |                /* reallocate */
 9389|  34.9k|                U_CHAR* nAtomTmp = (U_CHAR*)inchi_malloc((long long)nNumAtoms + 1); /* djb-rwth: cast operator added */
  ------------------
  |  | 1143|  34.9k|#define inchi_malloc   malloc
  ------------------
 9390|  34.9k|                if (!nAtomTmp)
  ------------------
  |  Branch (9390:21): [True: 0, False: 34.9k]
  ------------------
 9391|      0|                {
 9392|      0|                    ret = RI_ERR_ALLOC; /* allocation failure */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9393|      0|                    goto exit_function;
 9394|      0|                }
 9395|  34.9k|                memcpy(nAtomTmp, pInChI[iComponent + i].nAtom, sizeof(nAtomTmp[0]) * j);
 9396|  7.68M|                while (j < nNumAtoms)
  ------------------
  |  Branch (9396:24): [True: 7.64M, False: 34.9k]
  ------------------
 9397|  7.64M|                {
 9398|  7.64M|                    nAtomTmp[j++] = EL_NUMBER_H; /* bridging H */
  ------------------
  |  |   11|  7.64M|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
 9399|  7.64M|                }
 9400|  34.9k|                nAtomTmp[j] = '\0';
 9401|  34.9k|                INCHI_HEAPCHK
 9402|  34.9k|                    if (pInChI[iComponent + i].nAtom)
  ------------------
  |  Branch (9402:25): [True: 34.9k, False: 0]
  ------------------
 9403|  34.9k|                    {
 9404|  34.9k|                        inchi_free(pInChI[iComponent + i].nAtom);
  ------------------
  |  | 1152|  34.9k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 34.9k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 34.9k]
  |  |  ------------------
  ------------------
 9405|  34.9k|                    }
 9406|  34.9k|                pInChI[iComponent + i].nAtom = nAtomTmp;
 9407|  34.9k|                pInChI[iComponent + i].nNumberOfAtoms = nNumAtoms;
 9408|  34.9k|            }
 9409|  39.8k|            else
 9410|  39.8k|            {
 9411|  39.8k|                if (j > nNumAtoms && (lenConnTable || j != 1))
  ------------------
  |  Branch (9411:21): [True: 4.91k, False: 34.9k]
  |  Branch (9411:39): [True: 24, False: 4.88k]
  |  Branch (9411:55): [True: 7, False: 4.88k]
  ------------------
 9412|     31|                {
 9413|     31|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     31|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9414|     31|                    goto exit_function;
 9415|     31|                }
 9416|  39.8k|            }
 9417|       |            /* allocate connection table */
 9418|  74.7k|            if (pInChI[iComponent + i].nConnTable)
  ------------------
  |  Branch (9418:17): [True: 0, False: 74.7k]
  ------------------
 9419|      0|            {
 9420|      0|                inchi_free(pInChI[iComponent + i].nConnTable);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 9421|      0|            }
 9422|  74.7k|            if (!nNumAtoms && !nNumBonds && !lenConnTable)
  ------------------
  |  Branch (9422:17): [True: 4.88k, False: 69.8k]
  |  Branch (9422:31): [True: 4.88k, False: 0]
  |  Branch (9422:45): [True: 4.88k, False: 0]
  ------------------
 9423|  4.88k|            {
 9424|  4.88k|                lenConnTable = 1;  /* one atom, no bonds */
 9425|  4.88k|            }
 9426|  74.7k|            pInChI[iComponent + i].nConnTable = (AT_NUMB*)inchi_calloc((long long)lenConnTable + 1, sizeof(pInChI[0].nConnTable[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  74.7k|#define inchi_calloc   calloc
  ------------------
 9427|  74.7k|            if (!pInChI[iComponent + i].nConnTable)
  ------------------
  |  Branch (9427:17): [True: 0, False: 74.7k]
  ------------------
 9428|      0|            {
 9429|      0|                ret = RI_ERR_ALLOC; /* allocation failure */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9430|      0|                goto exit_function;
 9431|      0|            }
 9432|  74.7k|            pInChI[iComponent + i].lenConnTable = lenConnTable;
 9433|  74.7k|        }
 9434|       |
 9435|       |        /* Pass 1.2 parse a component and extract the bonds */
 9436|  14.2k|        num_open = 0;
 9437|  14.2k|        memset(last_atom, 0, sizeof(last_atom)); /* djb-rwth: memset_s C11/Annex K variant? */
 9438|  14.2k|        state = '\0';   /* initial state */
 9439|       |        /* djb-rwth: removing redundant code */
 9440|  14.2k|        p = pStart;
 9441|  14.2k|        pLB->len = 0;
 9442|       |
 9443|  14.2k|        if (*pbAbc == 1)
  ------------------
  |  Branch (9443:13): [True: 0, False: 14.2k]
  ------------------
 9444|      0|        {
 9445|       |            /* compressed */
 9446|      0|            int num_neigh;
 9447|      0|            num_open = 0;
 9448|      0|            last_atom[num_open] = 2;
 9449|      0|            while (p < pEnd)
  ------------------
  |  Branch (9449:20): [True: 0, False: 0]
  ------------------
 9450|      0|            {
 9451|      0|                if (last_atom[num_open] > maxAtom)
  ------------------
  |  Branch (9451:21): [True: 0, False: 0]
  ------------------
 9452|      0|                {
 9453|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9454|      0|                    goto exit_function;
 9455|      0|                }
 9456|      0|                if (isupper(UCINT * p))
  ------------------
  |  Branch (9456:21): [True: 0, False: 0]
  ------------------
 9457|      0|                {
 9458|      0|                    curAtom = (AT_NUMB)inchi_strtol(p, &q, base);
 9459|      0|                    if ((ret = AddLinkedBond(last_atom[num_open], curAtom, (AT_NUMB)nNumAtoms, pLB))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (9459:25): [True: 0, False: 0]
  ------------------
 9460|      0|                    {
 9461|      0|                        goto exit_function;
 9462|      0|                    }
 9463|      0|                    p = q;
 9464|      0|                    if (bPrevVersion == 1)
  ------------------
  |  Branch (9464:25): [True: 0, False: 0]
  ------------------
 9465|      0|                    {
 9466|      0|                        while (p < pEnd && *p == '-')
  ------------------
  |  Branch (9466:32): [True: 0, False: 0]
  |  Branch (9466:44): [True: 0, False: 0]
  ------------------
 9467|      0|                        {
 9468|      0|                            p++;
 9469|      0|                            if ((curAtom = (AT_NUMB)inchi_strtol(p, &q, base))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (9469:33): [True: 0, False: 0]
  ------------------
 9470|      0|                            {
 9471|      0|                                if ((ret = AddLinkedBond(last_atom[num_open], curAtom, (AT_NUMB)nNumAtoms, pLB))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (9471:37): [True: 0, False: 0]
  ------------------
 9472|      0|                                {
 9473|      0|                                    goto exit_function;
 9474|      0|                                }
 9475|      0|                                p = q;
 9476|      0|                            }
 9477|      0|                            else
 9478|      0|                            {
 9479|      0|                                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9480|      0|                                goto exit_function;
 9481|      0|                            }
 9482|      0|                        }
 9483|      0|                    }
 9484|      0|                    else
 9485|      0|                    {
 9486|      0|                        if (bPrevVersion == 0 && isdigit(*p))
  ------------------
  |  Branch (9486:29): [True: 0, False: 0]
  |  Branch (9486:50): [True: 0, False: 0]
  ------------------
 9487|      0|                        {
 9488|      0|                            num_neigh = (int)inchi_strtol(p, &q, 10);
 9489|      0|                            p = q;
 9490|      0|                            while (num_neigh-- && p < pEnd)
  ------------------
  |  Branch (9490:36): [True: 0, False: 0]
  |  Branch (9490:51): [True: 0, False: 0]
  ------------------
 9491|      0|                            {
 9492|      0|                                if ((curAtom = (AT_NUMB)inchi_strtol(p, &q, base))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (9492:37): [True: 0, False: 0]
  ------------------
 9493|      0|                                {
 9494|      0|                                    if ((ret = AddLinkedBond(last_atom[num_open], curAtom, (AT_NUMB)nNumAtoms, pLB))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (9494:41): [True: 0, False: 0]
  ------------------
 9495|      0|                                    {
 9496|      0|                                        goto exit_function;
 9497|      0|                                    }
 9498|      0|                                    p = q;
 9499|      0|                                }
 9500|      0|                                else
 9501|      0|                                {
 9502|      0|                                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9503|      0|                                    goto exit_function;
 9504|      0|                                }
 9505|      0|                            }
 9506|      0|                        }
 9507|      0|                    }
 9508|      0|                    last_atom[num_open]++;
 9509|      0|                }
 9510|      0|                else
 9511|      0|                {
 9512|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9513|      0|                    goto exit_function;
 9514|      0|                }
 9515|      0|            }
 9516|      0|        }
 9517|  14.2k|        else
 9518|  14.2k|        {
 9519|   149k|            while (p < pEnd)
  ------------------
  |  Branch (9519:20): [True: 135k, False: 14.2k]
  ------------------
 9520|   135k|            {
 9521|       |                /* each atom number except the first means a new bond */
 9522|   135k|                c = UCINT * p++;
  ------------------
  |  |   88|   135k|#define UCINT  (int)(unsigned char)
  ------------------
 9523|   135k|                switch (c)
 9524|   135k|                {
 9525|  9.71k|                case '(':
  ------------------
  |  Branch (9525:17): [True: 9.71k, False: 125k]
  ------------------
 9526|  19.4k|                case ')':
  ------------------
  |  Branch (9526:17): [True: 9.71k, False: 125k]
  ------------------
 9527|  24.2k|                case ',':
  ------------------
  |  Branch (9527:17): [True: 4.82k, False: 130k]
  ------------------
 9528|  63.7k|                case '-':
  ------------------
  |  Branch (9528:17): [True: 39.5k, False: 95.9k]
  ------------------
 9529|  63.7k|                    switch (state)
 9530|  63.7k|                    {
 9531|  63.7k|                    case 'N':
  ------------------
  |  Branch (9531:21): [True: 63.7k, False: 0]
  ------------------
 9532|  63.7k|                        state = c;
 9533|  63.7k|                        break;
 9534|      0|                    default:
  ------------------
  |  Branch (9534:21): [True: 0, False: 63.7k]
  ------------------
 9535|      0|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9536|      0|                        goto exit_function;
 9537|  63.7k|                    }
 9538|  63.7k|                    break;
 9539|  71.6k|                default:
  ------------------
  |  Branch (9539:17): [True: 71.6k, False: 63.7k]
  ------------------
 9540|  71.6k|                    if (isdigit(c) && (curAtom = (AT_NUMB)inchi_strtol(p - 1, &q, 10)))
  ------------------
  |  Branch (9540:25): [True: 71.6k, False: 0]
  |  Branch (9540:39): [True: 71.6k, False: 0]
  ------------------
 9541|  71.6k|                    {
 9542|  71.6k|                        p = q;
 9543|  71.6k|                        switch (state)
 9544|  71.6k|                        {
 9545|  9.40k|                        case '\0':
  ------------------
  |  Branch (9545:25): [True: 9.40k, False: 62.2k]
  ------------------
 9546|  9.40k|                            last_atom[num_open] = curAtom;
 9547|  9.40k|                            state = 'N';
 9548|  9.40k|                            break;
 9549|  9.71k|                        case '(':
  ------------------
  |  Branch (9549:25): [True: 9.71k, False: 61.9k]
  ------------------
 9550|  9.71k|                            if ((ret = AddLinkedBond(last_atom[num_open], curAtom, (AT_NUMB)nNumAtoms, pLB))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (9550:33): [True: 1, False: 9.71k]
  ------------------
 9551|      1|                            {
 9552|      1|                                goto exit_function;
 9553|      1|                            }
 9554|  9.71k|                            if (++num_open >= LAST_AT_LEN)
  ------------------
  |  | 9105|  9.71k|#define LAST_AT_LEN 256
  ------------------
  |  Branch (9554:33): [True: 0, False: 9.71k]
  ------------------
 9555|      0|                            {
 9556|      0|                                ret = RI_ERR_PROGR; /* program error: buffer overflow */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 9557|      0|                                goto exit_function;
 9558|      0|                            }
 9559|  9.71k|                            last_atom[num_open] = curAtom;
 9560|  9.71k|                            state = 'N';
 9561|  9.71k|                            break;
 9562|       |
 9563|  9.05k|                        case ')':
  ------------------
  |  Branch (9563:25): [True: 9.05k, False: 62.6k]
  ------------------
 9564|  9.05k|                            if (!num_open)
  ------------------
  |  Branch (9564:33): [True: 0, False: 9.05k]
  ------------------
 9565|      0|                            {
 9566|      0|                                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9567|      0|                                goto exit_function;
 9568|      0|                            }
 9569|  9.05k|                            if ((ret = AddLinkedBond(last_atom[--num_open], curAtom, (AT_NUMB)nNumAtoms, pLB))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (9569:33): [True: 0, False: 9.05k]
  ------------------
 9570|      0|                            {
 9571|      0|                                goto exit_function;
 9572|      0|                            }
 9573|  9.05k|                            last_atom[num_open] = curAtom;
 9574|  9.05k|                            state = 'N';
 9575|  9.05k|                            break;
 9576|       |
 9577|  4.73k|                        case ',':
  ------------------
  |  Branch (9577:25): [True: 4.73k, False: 66.9k]
  ------------------
 9578|  4.73k|                            if (!num_open)
  ------------------
  |  Branch (9578:33): [True: 2, False: 4.73k]
  ------------------
 9579|      2|                            {
 9580|      2|                                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9581|      2|                                goto exit_function;
 9582|      2|                            }
 9583|  4.73k|                            if ((ret = AddLinkedBond(last_atom[num_open - 1], curAtom, (AT_NUMB)nNumAtoms, pLB))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (9583:33): [True: 0, False: 4.73k]
  ------------------
 9584|      0|                            {
 9585|      0|                                goto exit_function;
 9586|      0|                            }
 9587|  4.73k|                            last_atom[num_open] = curAtom;
 9588|  4.73k|                            state = 'N';
 9589|  4.73k|                            break;
 9590|  38.7k|                        case '-':
  ------------------
  |  Branch (9590:25): [True: 38.7k, False: 32.9k]
  ------------------
 9591|  38.7k|                            if ((ret = AddLinkedBond(last_atom[num_open], curAtom, (AT_NUMB)nNumAtoms, pLB))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (9591:33): [True: 9, False: 38.7k]
  ------------------
 9592|      9|                            {
 9593|      9|                                goto exit_function;
 9594|      9|                            }
 9595|  38.7k|                            last_atom[num_open] = curAtom;
 9596|  38.7k|                            state = 'N';
 9597|  38.7k|                            break;
 9598|      0|                        default:
  ------------------
  |  Branch (9598:25): [True: 0, False: 71.6k]
  ------------------
 9599|      0|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9600|      0|                            goto exit_function;
 9601|  71.6k|                        }
 9602|  71.6k|                    }
 9603|      0|                    else
 9604|      0|                    {
 9605|      0|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9606|      0|                        goto exit_function;
 9607|      0|                    }
 9608|  71.6k|                    break;
 9609|   135k|                }
 9610|   135k|            }
 9611|  14.2k|        }
 9612|       |
 9613|       |        /* Store the bonds in connection table */
 9614|  14.2k|        if (lenConnTable > 1)
  ------------------
  |  Branch (9614:13): [True: 9.38k, False: 4.89k]
  ------------------
 9615|  9.38k|        {
 9616|  65.8k|            for (i = 0, m = 0; i < nNumAtoms; i++)
  ------------------
  |  Branch (9616:32): [True: 56.6k, False: 9.22k]
  ------------------
 9617|  56.6k|            {
 9618|  56.6k|                k = 0;
 9619|       |
 9620|  56.6k|                if (!pLB->pBond)
  ------------------
  |  Branch (9620:21): [True: 8, False: 56.6k]
  ------------------
 9621|      8|                {
 9622|      8|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      8|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9623|      8|                    goto exit_function;
 9624|      8|                }
 9625|       |
 9626|  56.6k|                if ((j = pLB->pBond[i + 1].prev)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (9626:21): [True: 56.5k, False: 61]
  ------------------
 9627|  56.5k|                {
 9628|   112k|                    while (k < MAXVAL)
  ------------------
  |  |   70|   112k|#define MAXVAL                   50 /* max number of bonds per atom                 */ /* @nnuk : Changed from 20 -> 50 for testing purposes, to account for some structures with one atom having more than 20 bonds */
  ------------------
  |  Branch (9628:28): [True: 112k, False: 12]
  ------------------
 9629|   112k|                    {
 9630|   112k|                        neighbor[k++] = pLB->pBond[j].neigh;
 9631|   112k|                        if (j == i + 1)
  ------------------
  |  Branch (9631:29): [True: 56.5k, False: 55.5k]
  ------------------
 9632|  56.5k|                            break;
 9633|  55.5k|                        j = pLB->pBond[j].prev;
 9634|  55.5k|                    }
 9635|  56.5k|                }
 9636|  56.6k|                if (j != i + 1)
  ------------------
  |  Branch (9636:21): [True: 73, False: 56.5k]
  ------------------
 9637|     73|                {
 9638|     73|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     73|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9639|     73|                    goto exit_function;
 9640|     73|                }
 9641|       |
 9642|       |                /* sort the neighbors */
 9643|       |
 9644|  56.5k|                insertions_sort_AT_NUMB(neighbor, k);
 9645|       |
 9646|  56.5k|                if (m == pInChI[iComponent].lenConnTable)
  ------------------
  |  Branch (9646:21): [True: 12, False: 56.5k]
  ------------------
 9647|     12|                {
 9648|     12|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     12|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9649|     12|                    goto exit_function;
 9650|     12|                }
 9651|       |
 9652|  56.5k|#if ( FIX_GAF_2020_25726==1 )
 9653|   110k|                for (j = 1; j < k; j++)
  ------------------
  |  Branch (9653:29): [True: 54.3k, False: 56.5k]
  ------------------
 9654|  54.3k|                {
 9655|  54.3k|                    if (neighbor[j] == neighbor[j - 1])
  ------------------
  |  Branch (9655:25): [True: 68, False: 54.2k]
  ------------------
 9656|     68|                    {
 9657|     68|                        ret = RI_ERR_SYNTAX; /* syntax error - same nbr twice, i.e. multiple bond between same atoms */
  ------------------
  |  |   16|     68|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9658|     68|                        goto exit_function;
 9659|     68|                    }
 9660|  54.3k|                }
 9661|  56.5k|#endif
 9662|  56.5k|                pInChI[iComponent].nConnTable[m++] = i + 1; /* atom number */
 9663|   111k|                for (j = 0; j < k && (int)neighbor[j] <= i; j++)
  ------------------
  |  Branch (9663:29): [True: 89.8k, False: 21.9k]
  |  Branch (9663:38): [True: 55.2k, False: 34.5k]
  ------------------
 9664|  55.2k|                {
 9665|  55.2k|                    if (m == pInChI[iComponent].lenConnTable)
  ------------------
  |  Branch (9665:25): [True: 5, False: 55.2k]
  ------------------
 9666|      5|                    {
 9667|      5|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      5|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9668|      5|                        goto exit_function;
 9669|      5|                    }
 9670|  55.2k|                    pInChI[iComponent].nConnTable[m++] = neighbor[j];
 9671|  55.2k|                }
 9672|  56.5k|            }
 9673|  9.22k|            if (m != lenConnTable)
  ------------------
  |  Branch (9673:17): [True: 0, False: 9.22k]
  ------------------
 9674|      0|            {
 9675|      0|                ret = RI_ERR_PROGR; /* program error */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 9676|      0|                goto exit_function;
 9677|      0|            }
 9678|  9.22k|        }
 9679|  4.89k|        else
 9680|  4.89k|        {
 9681|  4.89k|            pInChI[iComponent].nConnTable[0] = 1; /* single atom */
 9682|  4.89k|        }
 9683|       |
 9684|       |        /* Duplicate if needed */
 9685|  74.1k|        for (i = 1; i < mpy_component; i++)
  ------------------
  |  Branch (9685:21): [True: 60.0k, False: 14.1k]
  ------------------
 9686|  60.0k|        {
 9687|       |            /*
 9688|       |            if ( pInChI[iComponent+i].nConnTable ) {
 9689|       |            inchi_free( pInChI[iComponent+i].nConnTable );
 9690|       |            }
 9691|       |            pInChI[iComponent+i].nConnTable = (AT_NUMB *)inchi_calloc( lenConnTable+1, sizeof(pInChI[0].nConnTable[0]) );
 9692|       |            if ( !pInChI[iComponent+i].nConnTable ) {
 9693|       |            ret = RI_ERR_ALLOC;
 9694|       |            goto exit_function;
 9695|       |            }
 9696|       |            */
 9697|  60.0k|            if (!pInChI[iComponent + i].nConnTable || pInChI[iComponent + i].lenConnTable != lenConnTable)
  ------------------
  |  Branch (9697:17): [True: 0, False: 60.0k]
  |  Branch (9697:55): [True: 0, False: 60.0k]
  ------------------
 9698|      0|            {
 9699|      0|                ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 9700|      0|                goto exit_function;
 9701|      0|            }
 9702|  60.0k|            memcpy(pInChI[iComponent + i].nConnTable, pInChI[iComponent].nConnTable, lenConnTable * sizeof(pInChI[0].nConnTable[0]));
 9703|  60.0k|        }
 9704|       |        /* prepare for the next connection table */
 9705|  14.1k|        iComponent += i;
 9706|  14.1k|        if (*pEnd)
  ------------------
  |  Branch (9706:13): [True: 6.28k, False: 7.83k]
  ------------------
 9707|  6.28k|            pStart = pEnd + 1;
 9708|  7.83k|        else
 9709|  7.83k|            break;
 9710|       |        /* We must check if we have already read as many components as we have in the fragment. */
 9711|       |        /* If yes, then we break, because anything else that might follow cannot be useful information. */
 9712|       |        /* There are files with a trailing ";" that would cause a problem (memory allocation bug) if we did not do this. */
 9713|  6.28k|        if (iComponent == nNumComponents)
  ------------------
  |  Branch (9713:13): [True: 928, False: 5.35k]
  ------------------
 9714|    928|            break;
 9715|  6.28k|    }
 9716|  8.76k|    ret = iComponent;
 9717|       |
 9718|  9.09k|exit_function:
 9719|       |
 9720|  9.09k|    if (pLB->pBond)
  ------------------
  |  Branch (9720:9): [True: 8.92k, False: 167]
  ------------------
 9721|  8.92k|    {
 9722|  8.92k|        INCHI_HEAPCHK
 9723|  8.92k|            inchi_free(pLB->pBond);
  ------------------
  |  | 1152|  8.92k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 8.92k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 8.92k]
  |  |  ------------------
  ------------------
 9724|  8.92k|    }
 9725|       |
 9726|  9.09k|    return ret;
 9727|  8.76k|#undef LAST_AT_LEN
 9728|  8.76k|}
ichiread.c:AddLinkedBond:
10717|  62.2k|{
10718|  62.2k|    int nReqLen = inchi_max(2 * num_at + 2, pLB->len + 2);
  ------------------
  |  |  138|  62.2k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 50.2k, False: 11.9k]
  |  |  ------------------
  ------------------
10719|  62.2k|    AT_NUMB prev;
10720|  62.2k|#if ( FIX_GAF_2019_2==1 )
10721|  62.2k|    {
10722|  62.2k|        if (at2 > num_at || at1 > num_at || at1 < 0 || at2<0 || num_at>MAX_ATOMS)
  ------------------
  |  |   15|  62.2k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (10722:13): [True: 0, False: 62.2k]
  |  Branch (10722:29): [True: 0, False: 62.2k]
  |  Branch (10722:45): [True: 0, False: 62.2k]
  |  Branch (10722:56): [True: 0, False: 62.2k]
  |  Branch (10722:65): [True: 10, False: 62.2k]
  ------------------
10723|     10|        {
10724|     10|            return RI_ERR_SYNTAX;
  ------------------
  |  |   16|     10|#define RI_ERR_SYNTAX  (-2)
  ------------------
10725|     10|        }
10726|  62.2k|    }
10727|  62.2k|#endif
10728|  62.2k|    if (pLB->len_alloc <= nReqLen)
  ------------------
  |  Branch (10728:9): [True: 8.97k, False: 53.2k]
  ------------------
10729|  8.97k|    {
10730|       |        /*int nNewLen = nReqLen + (nReqLen + LINKED_BOND_ADD - 1)%LINKED_BOND_ADD + LINKED_BOND_ADD;*/
10731|  8.97k|        int nNewLen = nReqLen - nReqLen % LINKED_BOND_ADD + 2 * LINKED_BOND_ADD;
  ------------------
  |  |   64|  8.97k|#define LINKED_BOND_ADD  128
  ------------------
                      int nNewLen = nReqLen - nReqLen % LINKED_BOND_ADD + 2 * LINKED_BOND_ADD;
  ------------------
  |  |   64|  8.97k|#define LINKED_BOND_ADD  128
  ------------------
10732|  8.97k|        ONE_LINKED_BOND* pBond = (ONE_LINKED_BOND*)inchi_calloc(nNewLen, sizeof(pBond[0]));
  ------------------
  |  | 1146|  8.97k|#define inchi_calloc   calloc
  ------------------
10733|  8.97k|        if (!pBond)
  ------------------
  |  Branch (10733:13): [True: 0, False: 8.97k]
  ------------------
10734|      0|        {
10735|      0|            return RI_ERR_ALLOC; /* allocation error */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
10736|      0|        }
10737|  8.97k|        if (pLB->pBond && pLB->len)
  ------------------
  |  Branch (10737:13): [True: 42, False: 8.92k]
  |  Branch (10737:27): [True: 40, False: 2]
  ------------------
10738|     40|        {
10739|     40|            memcpy(pBond, pLB->pBond, pLB->len * sizeof(pBond[0]));
10740|     40|        }
10741|  8.97k|        if (pLB->pBond)
  ------------------
  |  Branch (10741:13): [True: 42, False: 8.92k]
  ------------------
10742|     42|            inchi_free(pLB->pBond);
  ------------------
  |  | 1152|     42|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 42, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 42]
  |  |  ------------------
  ------------------
10743|  8.97k|        pLB->pBond = pBond;
10744|  8.97k|        pLB->len_alloc = nNewLen;
10745|  8.97k|    }
10746|  62.2k|    if (!pLB->len)
  ------------------
  |  Branch (10746:9): [True: 9.35k, False: 52.8k]
  ------------------
10747|  9.35k|    {
10748|  9.35k|        pLB->len = num_at + 1;
10749|  9.35k|        memset(pLB->pBond, 0, ((long long)num_at + 1) * sizeof(pLB->pBond[0])); /* djb-rwth: cast operator added; memset_s C11/Annex K variant? */
10750|  9.35k|    }
10751|       |
10752|  62.2k|    prev = pLB->pBond[at1].prev; /* position of the last neighbor of at1 in the pLB->pBond */
10753|  62.2k|    if (!prev)
  ------------------
  |  Branch (10753:9): [True: 9.35k, False: 52.8k]
  ------------------
10754|  9.35k|    {
10755|  9.35k|        pLB->pBond[at1].neigh = at2;
10756|  9.35k|        pLB->pBond[at1].prev = at1;
10757|  9.35k|    }
10758|  52.8k|    else
10759|  52.8k|    {
10760|  52.8k|        pLB->pBond[pLB->len].neigh = at2;
10761|  52.8k|        pLB->pBond[pLB->len].prev = prev;
10762|  52.8k|        pLB->pBond[at1].prev = pLB->len++;
10763|  52.8k|    }
10764|       |
10765|  62.2k|    prev = pLB->pBond[at2].prev; /* position of the last neighbor of at2 in the pLB->pBond */
10766|  62.2k|    if (!prev)
  ------------------
  |  Branch (10766:9): [True: 47.6k, False: 14.6k]
  ------------------
10767|  47.6k|    {
10768|  47.6k|        pLB->pBond[at2].neigh = at1;
10769|  47.6k|        pLB->pBond[at2].prev = at2;
10770|  47.6k|    }
10771|  14.6k|    else
10772|  14.6k|    {
10773|  14.6k|        pLB->pBond[pLB->len].neigh = at1;
10774|  14.6k|        pLB->pBond[pLB->len].prev = prev;
10775|  14.6k|        pLB->pBond[at2].prev = pLB->len++;
10776|  14.6k|    }
10777|       |
10778|  62.2k|    return 0;
10779|  62.2k|}
ichiread.c:ParseSegmentMobileH:
 8248|  11.4k|{
 8249|  11.4k|#define nNum_H( ICOMPONENT ) ((bMobileH==TAUT_YES)? pInChI[ICOMPONENT].nNum_H : pInChI[ICOMPONENT].nNum_H_fixed)
 8250|       |
 8251|       |    /* Pass 1: count bonds and find actual numbers of  atom */
 8252|       |
 8253|  11.4k|    int i, mpy_component, num_H, num_Minus, val, num_Atoms, numCtAtoms, tg_alloc_len, len, len2, k = 0;
 8254|  11.4k|    int num_H_component, num_H_formula, num_taut_H_component, num_H_InChI, ret2;
 8255|  11.4k|    int nNumComponents, iComponent, lenTautomer, tg_pos_Tautomer, iTGroup; /* djb-rwth: removing redundant variables */
 8256|  11.4k|    const char* p, * q, * h, * t, * p1, * pTaut, * pStart, * pEnd;
 8257|  11.4k|    int curAtom, nxtAtom; /* djb-rwth: fixing coverity ID #499563 */
 8258|  11.4k|    int  state, ret, nAltMobileH = ALT_TAUT(bMobileH); /* djb-rwth: removing redundant variables */
  ------------------
  |  |  577|  11.4k|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|  11.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 11.4k]
  |  |  ------------------
  ------------------
 8259|  11.4k|    INChI* pInChI = pInpInChI[bMobileH];
 8260|  11.4k|    INChI* pAltInChI = pInpInChI[nAltMobileH];
 8261|  11.4k|    int  base = 10;
 8262|       |
 8263|  11.4k|    num_H = -999;          /* impossible value */
 8264|  11.4k|    num_Minus = -999;      /* impossible value */
 8265|  11.4k|    tg_pos_Tautomer = -999; /* impossible value */
 8266|       |
 8267|       |    /* number of immobile H is always allocated; immobile H are present in M layer only */
 8268|  11.4k|    nNumComponents = pnNumComponents[bMobileH];
 8269|       |
 8270|       |    /* djb-rwth: fixing oss-fuzz issues #66985, #66718, #43512, #43456, #43420, #42774, #34772, #30156 */
 8271|       |
 8272|   345k|    for (i = 0; i < nNumComponents; i++)
  ------------------
  |  Branch (8272:17): [True: 334k, False: 11.4k]
  ------------------
 8273|   334k|    {
 8274|   334k|        len = pInChI[i].nNumberOfAtoms;
 8275|   334k|        if (bMobileH == TAUT_NON && i < pnNumComponents[nAltMobileH])
  ------------------
  |  |  574|   668k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (8275:13): [True: 42.0k, False: 292k]
  |  Branch (8275:37): [True: 38.8k, False: 3.13k]
  ------------------
 8276|  38.8k|        {
 8277|  38.8k|            if (len < pAltInChI[i].nNumberOfAtoms)
  ------------------
  |  Branch (8277:17): [True: 0, False: 38.8k]
  ------------------
 8278|      0|            {
 8279|      0|                len = pAltInChI[i].nNumberOfAtoms;
 8280|      0|                if (pInChI[i].nNum_H)
  ------------------
  |  Branch (8280:21): [True: 0, False: 0]
  ------------------
 8281|      0|                {
 8282|      0|                    inchi_free(pInChI[i].nNum_H);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 8283|      0|                    pInChI[i].nNum_H = NULL;
 8284|      0|                }
 8285|      0|            }
 8286|  38.8k|        }
 8287|   334k|        len++;
 8288|   334k|        if (!pInChI[i].nNum_H)
  ------------------
  |  Branch (8288:13): [True: 334k, False: 60]
  ------------------
 8289|   334k|        {
 8290|   334k|            S_CHAR* pi_nnh2 = (S_CHAR*)inchi_calloc(len, sizeof(pInChI[0].nNum_H[0]));
  ------------------
  |  | 1146|   334k|#define inchi_calloc   calloc
  ------------------
 8291|   334k|            if (!pi_nnh2)
  ------------------
  |  Branch (8291:17): [True: 0, False: 334k]
  ------------------
 8292|      0|            {
 8293|      0|                ret = RI_ERR_ALLOC; /* allocation error */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 8294|      0|                goto exit_function;
 8295|      0|            }
 8296|   334k|            pInChI[i].nNum_H = pi_nnh2;
 8297|       |            /* pi_nnh2_init = true; */
 8298|   334k|        }
 8299|       |        /* copy immobile H from Mobile-H layer to Fixed-H layer */
 8300|   334k|        if (bMobileH == TAUT_NON && i < pnNumComponents[nAltMobileH])
  ------------------
  |  |  574|   668k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (8300:13): [True: 42.0k, False: 292k]
  |  Branch (8300:37): [True: 38.8k, False: 3.13k]
  ------------------
 8301|  38.8k|        {
 8302|  38.8k|            S_CHAR* pai_nnh = (S_CHAR*)inchi_realloc(pAltInChI[i].nNum_H, len * sizeof(pAltInChI[0].nNum_H[0]));
  ------------------
  |  | 1149|  38.8k|#define inchi_realloc   realloc
  ------------------
 8303|  38.8k|            if (pai_nnh)
  ------------------
  |  Branch (8303:17): [True: 38.8k, False: 0]
  ------------------
 8304|  38.8k|            {
 8305|  38.8k|                S_CHAR* pi_nnh1 = NULL;  /* copied from below to satisfy C syntax 2024-09-01 DT */
 8306|  38.8k|                pAltInChI[i].nNum_H = pai_nnh;
 8307|       |                /*if (!pi_nnh2_init)
 8308|       |                {
 8309|       |                */
 8310|  38.8k|                pi_nnh1 = (S_CHAR*)inchi_calloc(len, sizeof(pInChI[0].nNum_H[0]));
  ------------------
  |  | 1146|  38.8k|#define inchi_calloc   calloc
  ------------------
 8311|  38.8k|                if (!pi_nnh1)
  ------------------
  |  Branch (8311:21): [True: 0, False: 38.8k]
  ------------------
 8312|      0|                {
 8313|      0|                    ret = RI_ERR_ALLOC; /* allocation error */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 8314|      0|                    goto exit_function;
 8315|      0|                }
 8316|  38.8k|                memcpy(pi_nnh1, pai_nnh, ((long long)len - 1) * sizeof(pInChI[0].nNum_H[0])); /* djb-rwth: cast operator added */
 8317|       |                /* djb-rwth: alternative solution
 8318|       |                k = memcpy_custom(&pi_nnh1[i], pAltInChI[i].nNum_H, ((long long)len - 1) * sizeof(pInChI[0].nNum_H[0]))
 8319|       |                if (k)
 8320|       |                {
 8321|       |                    ret = RI_ERR_ALLOC;
 8322|       |                    goto exit_function;
 8323|       |                }
 8324|       |                */
 8325|  38.8k|                pInChI[i].nNum_H = pi_nnh1;
 8326|       |                /*
 8327|       |                }
 8328|       |                else
 8329|       |                {
 8330|       |                    memcpy(pi_nnh2, pai_nnh, ((long long)len - 1) * sizeof(pInChI[0].nNum_H[0])); * djb-rwth: cast operator added *
 8331|       |                    * djb-rwth: alternative solution *
 8332|       |                    k = memcpy_custom(&pi_nnh2[i], pAltInChI[i].nNum_H, ((long long)len - 1) * sizeof(pInChI[0].nNum_H[0]))
 8333|       |                    if (k)
 8334|       |                    {
 8335|       |                        ret = RI_ERR_ALLOC;
 8336|       |                        goto exit_function;
 8337|       |                    }
 8338|       |
 8339|       |                }
 8340|       |                */
 8341|  38.8k|            }
 8342|      0|            else
 8343|      0|            {
 8344|      0|                ret = RI_ERR_ALLOC; /* allocation error */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 8345|      0|                goto exit_function;
 8346|      0|            }
 8347|  38.8k|        }
 8348|   334k|    }
 8349|       |
 8350|  11.4k|    if (str[0] != 'h')
  ------------------
  |  Branch (8350:9): [True: 6.03k, False: 5.46k]
  ------------------
 8351|  6.03k|    {
 8352|  6.03k|        return 0;
 8353|  6.03k|    }
 8354|       |
 8355|       |    /* Read Hydrogen info in 1 pass */
 8356|       |
 8357|  5.46k|    pStart = (char*)str + 1;
 8358|  5.46k|    iComponent = 0;
 8359|  5.46k|    nNumComponents = pnNumComponents[bMobileH];
 8360|       |
 8361|  5.74k|    while (1)
  ------------------
  |  Branch (8361:12): [True: 5.74k, Folded]
  ------------------
 8362|  5.74k|    {
 8363|       |        /* cycle over components */
 8364|  5.74k|        if (!(pEnd = strchr(pStart, ';')))
  ------------------
  |  Branch (8364:13): [True: 5.44k, False: 292]
  ------------------
 8365|  5.44k|        {
 8366|  5.44k|            pEnd = pStart + strlen(pStart);
 8367|  5.44k|        }
 8368|  5.74k|        if ((p = strchr(pStart, '*')) && p < pEnd)
  ------------------
  |  Branch (8368:13): [True: 132, False: 5.60k]
  |  Branch (8368:42): [True: 81, False: 51]
  ------------------
 8369|     81|        {
 8370|     81|            mpy_component = (int)inchi_strtol(pStart, &q, 10);
 8371|     81|#if ( CHECK_STRTOL_ATNUMB==1 )
 8372|     81|            if (mpy_component > MAX_ATOMS || mpy_component < 0)
  ------------------
  |  |   15|    162|#define MAX_ATOMS  32766
  ------------------
  |  Branch (8372:17): [True: 0, False: 81]
  |  Branch (8372:46): [True: 6, False: 75]
  ------------------
 8373|      6|            {
 8374|      6|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      6|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8375|      6|                goto exit_function;
 8376|      6|            }
 8377|     75|#endif
 8378|     75|#if ( FIX_DALKE_BUGS == 1 )
 8379|     75|            if (p != q || !isdigit(UCINT* pStart)) /* prevent non-positive multipliers */
  ------------------
  |  Branch (8379:17): [True: 1, False: 74]
  |  Branch (8379:27): [True: 0, False: 74]
  ------------------
 8380|       |#else
 8381|       |            if (p != q)
 8382|       |#endif
 8383|      1|            {
 8384|      1|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8385|      1|                goto exit_function;
 8386|      1|            }
 8387|     74|            p++;
 8388|     74|        }
 8389|  5.65k|        else
 8390|  5.65k|        {
 8391|  5.65k|            mpy_component = 1;
 8392|  5.65k|            p = pStart;
 8393|  5.65k|        }
 8394|  5.73k|        pStart = p;
 8395|       |        /* Pass 1.1 parse a component */
 8396|       |        /* djb-rwth: removing redundant code */
 8397|       |        /* djb-rwth: removing redundant code */
 8398|       |        /* djb-rwth: removing redundant code */
 8399|  5.73k|        curAtom = 0; /* djb-rwth: ignoring LLVM warning: value used */
 8400|  5.73k|        numCtAtoms = pInChI[iComponent].nNumberOfAtoms;
 8401|  5.73k|        if (bMobileH == TAUT_NON && iComponent < pnNumComponents[nAltMobileH])
  ------------------
  |  |  574|  11.4k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (8401:13): [True: 1.41k, False: 4.31k]
  |  Branch (8401:37): [True: 1.38k, False: 39]
  ------------------
 8402|  1.38k|        {
 8403|  1.38k|            numCtAtoms = pAltInChI[iComponent].nNumberOfAtoms;
 8404|  1.38k|        }
 8405|       |
 8406|  5.73k|        if (p < pEnd && *pbAbc == -1)
  ------------------
  |  Branch (8406:13): [True: 5.18k, False: 552]
  |  Branch (8406:25): [True: 0, False: 5.18k]
  ------------------
 8407|      0|        {
 8408|       |            /* check if compressed InChI */
 8409|      0|            *pbAbc = (*p == ',' || isupper(UCINT* p)) ? 1 : 0;
  ------------------
  |  Branch (8409:23): [True: 0, False: 0]
  |  Branch (8409:36): [True: 0, False: 0]
  ------------------
 8410|      0|        }
 8411|  5.73k|        base = (*pbAbc == 1) ? ALPHA_BASE : 10;
  ------------------
  |  |  170|      0|#define ALPHA_BASE 27
  ------------------
  |  Branch (8411:16): [True: 0, False: 5.73k]
  ------------------
 8412|       |
 8413|       |        /* immobile H */
 8414|  5.73k|        t = pTaut = (*pbAbc == 1) ? strchr(p, ',') : strchr(p, '('); /* locate the first tautomer group character */
  ------------------
  |  Branch (8414:21): [True: 0, False: 5.73k]
  ------------------
 8415|       |
 8416|  5.73k|        if (t && bMobileH == TAUT_NON)
  ------------------
  |  |  574|  2.48k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (8416:13): [True: 2.48k, False: 3.24k]
  |  Branch (8416:18): [True: 1, False: 2.48k]
  ------------------
 8417|      1|        {
 8418|      1|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8419|      1|            goto exit_function;
 8420|      1|        }
 8421|  5.73k|        if (!pTaut || pTaut > pEnd)
  ------------------
  |  Branch (8421:13): [True: 3.24k, False: 2.48k]
  |  Branch (8421:23): [True: 10, False: 2.47k]
  ------------------
 8422|  3.25k|        {
 8423|  3.25k|            pTaut = pEnd;
 8424|  3.25k|            t = NULL; /* found no tautomeric group for this component */
 8425|  3.25k|        }
 8426|       |        /* djb-rwth: fixing oss-fuzz issue #69489 */
 8427|  11.7k|        for (i = 0; (i < mpy_component) && (iComponent + i < nNumComponents); i++)
  ------------------
  |  Branch (8427:21): [True: 6.08k, False: 5.71k]
  |  Branch (8427:44): [True: 6.07k, False: 12]
  ------------------
 8428|  6.07k|        {
 8429|  6.07k|            if (bMobileH == TAUT_NON)
  ------------------
  |  |  574|  6.07k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (8429:17): [True: 1.45k, False: 4.62k]
  ------------------
 8430|  1.45k|            {
 8431|       |                /* allocate nNum_H_fixed */
 8432|  1.45k|                if (pInChI[iComponent + i].nNum_H_fixed)
  ------------------
  |  Branch (8432:21): [True: 0, False: 1.45k]
  ------------------
 8433|      0|                {
 8434|      0|                    ret = RI_ERR_PROGR; /* program error */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 8435|      0|                    goto exit_function;
 8436|      0|                }
 8437|  1.45k|                if (iComponent + i < pnNumComponents[nAltMobileH])
  ------------------
  |  Branch (8437:21): [True: 1.38k, False: 69]
  ------------------
 8438|  1.38k|                {
 8439|  1.38k|                    len = inchi_max(pInChI[iComponent + i].nNumberOfAtoms, pAltInChI[iComponent + i].nNumberOfAtoms) + 1;
  ------------------
  |  |  138|  1.38k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 3, False: 1.37k]
  |  |  ------------------
  ------------------
 8440|  1.38k|                }
 8441|     69|                else
 8442|     69|                {
 8443|     69|                    len = pInChI[iComponent + i].nNumberOfAtoms + 1;
 8444|     69|                }
 8445|  1.45k|                pInChI[iComponent + i].nNum_H_fixed = (S_CHAR*)inchi_calloc(len, sizeof(pInChI[0].nNum_H_fixed[0]));
  ------------------
  |  | 1146|  1.45k|#define inchi_calloc   calloc
  ------------------
 8446|  1.45k|                if (!pInChI[iComponent + i].nNum_H_fixed)
  ------------------
  |  Branch (8446:21): [True: 0, False: 1.45k]
  ------------------
 8447|      0|                {
 8448|      0|                    ret = RI_ERR_ALLOC; /* allocation error */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 8449|      0|                    goto exit_function;
 8450|      0|                }
 8451|       |                /* compare nAtom */
 8452|  1.45k|                if (iComponent + i < pnNumComponents[nAltMobileH])
  ------------------
  |  Branch (8452:21): [True: 1.38k, False: 69]
  ------------------
 8453|  1.38k|                {
 8454|  1.38k|                    len2 = inchi_min(pInChI[iComponent + i].nNumberOfAtoms, pAltInChI[iComponent + i].nNumberOfAtoms);
  ------------------
  |  |  139|  1.38k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 1.38k]
  |  |  ------------------
  ------------------
 8455|  1.38k|                    if (pInChI[iComponent + i].nAtom && len2)
  ------------------
  |  Branch (8455:25): [True: 1.38k, False: 0]
  |  Branch (8455:57): [True: 1.38k, False: 0]
  ------------------
 8456|  1.38k|                    {
 8457|       |                        /* check */
 8458|  1.38k|                        if (memcmp(pInChI[iComponent + i].nAtom, pAltInChI[iComponent + i].nAtom, len2 * sizeof(pInChI[0].nAtom[0])))
  ------------------
  |  Branch (8458:29): [True: 5, False: 1.37k]
  ------------------
 8459|      5|                        {
 8460|      5|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      5|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8461|      5|                            goto exit_function;
 8462|      5|                        }
 8463|  1.38k|                    }
 8464|       |                    /* allocate and copy atom if bridging H are present */
 8465|  1.37k|                    if (pInChI[iComponent + i].nNumberOfAtoms < pAltInChI[iComponent + i].nNumberOfAtoms)
  ------------------
  |  Branch (8465:25): [True: 0, False: 1.37k]
  ------------------
 8466|      0|                    {
 8467|      0|                        if (pInChI[iComponent + i].nAtom)
  ------------------
  |  Branch (8467:29): [True: 0, False: 0]
  ------------------
 8468|      0|                            inchi_free(pInChI[iComponent + i].nAtom);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 8469|      0|                        if (!(pInChI[iComponent + i].nAtom = (U_CHAR*)inchi_calloc(len, sizeof(pInChI[0].nAtom[0]))))
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (8469:29): [True: 0, False: 0]
  ------------------
 8470|      0|                        {
 8471|      0|                            ret = RI_ERR_ALLOC; /* allocation error */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 8472|      0|                            goto exit_function;
 8473|      0|                        }
 8474|      0|                        if (len > 1)
  ------------------
  |  Branch (8474:29): [True: 0, False: 0]
  ------------------
 8475|      0|                        {
 8476|      0|                            memcpy(pInChI[iComponent + i].nAtom, pAltInChI[iComponent + i].nAtom, ((long long)len - 1) * sizeof(pInChI[0].nAtom[0])); /* djb-rwth: cast operator added */
 8477|      0|                        }
 8478|       |                        /* correct number of atoms including bridging H */
 8479|      0|                        pInChI[iComponent + i].nNumberOfAtoms = pAltInChI[iComponent + i].nNumberOfAtoms;
 8480|      0|                    }
 8481|  1.37k|                }
 8482|  1.45k|            }
 8483|  6.07k|        }
 8484|       |
 8485|  5.72k|        if (*pbAbc == 1)
  ------------------
  |  Branch (8485:13): [True: 0, False: 5.72k]
  ------------------
 8486|      0|        {
 8487|       |            /* read numbers of H: XnYn... or XYn... */
 8488|      0|            p = pStart;
 8489|      0|            tg_alloc_len = 0;
 8490|      0|            num_H_component = num_taut_H_component = 0;
 8491|      0|            while (p < pTaut)
  ------------------
  |  Branch (8491:20): [True: 0, False: 0]
  ------------------
 8492|      0|            {
 8493|       |                /* syntax check: atom number */
 8494|      0|                if (!*p || !isupper(UCINT* p))
  ------------------
  |  Branch (8494:21): [True: 0, False: 0]
  |  Branch (8494:28): [True: 0, False: 0]
  ------------------
 8495|      0|                {
 8496|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8497|      0|                    goto exit_function;
 8498|      0|                }
 8499|      0|                if ((curAtom = nxtAtom = (int)inchi_strtol(p, &q, base))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (8499:21): [True: 0, False: 0]
  ------------------
 8500|      0|                {
 8501|      0|                    p = q;
 8502|      0|                    if (isupper(UCINT* p))
  ------------------
  |  Branch (8502:25): [True: 0, False: 0]
  ------------------
 8503|      0|                    {
 8504|      0|                        nxtAtom = (int)inchi_strtol(p, &q, base);
 8505|      0|#if ( CHECK_STRTOL_ATNUMB==1 )
 8506|      0|                        if (nxtAtom > MAX_ATOMS || nxtAtom < 0)
  ------------------
  |  |   15|      0|#define MAX_ATOMS  32766
  ------------------
  |  Branch (8506:29): [True: 0, False: 0]
  |  Branch (8506:52): [True: 0, False: 0]
  ------------------
 8507|      0|                        {
 8508|      0|                            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8509|      0|                            goto exit_function;
 8510|      0|                        }
 8511|      0|#endif
 8512|      0|                        p = q;
 8513|      0|                    }
 8514|      0|                }
 8515|      0|                if (curAtom <= 0 || curAtom > nxtAtom ||
  ------------------
  |  Branch (8515:21): [True: 0, False: 0]
  |  Branch (8515:37): [True: 0, False: 0]
  ------------------
 8516|      0|                    nxtAtom > numCtAtoms || p > pTaut)
  ------------------
  |  Branch (8516:21): [True: 0, False: 0]
  |  Branch (8516:45): [True: 0, False: 0]
  ------------------
 8517|      0|                {
 8518|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8519|      0|                    goto exit_function;
 8520|      0|                }
 8521|       |                /* number of H, may be negative */
 8522|      0|                if (!(num_H = (int)inchi_strtol(p, &q, 10)) || q > pTaut)
  ------------------
  |  Branch (8522:21): [True: 0, False: 0]
  |  Branch (8522:64): [True: 0, False: 0]
  ------------------
 8523|      0|                {
 8524|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8525|      0|                    goto exit_function;
 8526|      0|                }
 8527|      0|                p = q;
 8528|       |                /* set number of H */
 8529|       |                /* djb-rwth: fixing oss-fuzz issue #38399 */
 8530|      0|                if (((bMobileH == TAUT_YES) && pInChI[iComponent].nNum_H) || ((bMobileH != TAUT_YES) && pInChI[iComponent].nNum_H_fixed))
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              if (((bMobileH == TAUT_YES) && pInChI[iComponent].nNum_H) || ((bMobileH != TAUT_YES) && pInChI[iComponent].nNum_H_fixed))
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (8530:22): [True: 0, False: 0]
  |  Branch (8530:48): [True: 0, False: 0]
  |  Branch (8530:79): [True: 0, False: 0]
  |  Branch (8530:105): [True: 0, False: 0]
  ------------------
 8531|      0|                {
 8532|      0|                    for (i = curAtom; i <= nxtAtom; i++)
  ------------------
  |  Branch (8532:39): [True: 0, False: 0]
  ------------------
 8533|      0|                    {
 8534|      0|                        nNum_H(iComponent)[i - 1] = num_H;
  ------------------
  |  | 8249|      0|#define nNum_H( ICOMPONENT ) ((bMobileH==TAUT_YES)? pInChI[ICOMPONENT].nNum_H : pInChI[ICOMPONENT].nNum_H_fixed)
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (8249:31): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 8535|      0|                        num_H_component += num_H;
 8536|      0|                    }
 8537|      0|                }
 8538|      0|            }
 8539|      0|            if (p != pTaut)
  ------------------
  |  Branch (8539:17): [True: 0, False: 0]
  ------------------
 8540|      0|            {
 8541|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8542|      0|                goto exit_function;
 8543|      0|            }
 8544|      0|        }
 8545|  5.72k|        else
 8546|  5.72k|        {
 8547|       |            /* read numbers of H: 1-2,3H2,4,5H3 */
 8548|  5.72k|            p = pStart;
 8549|  5.72k|            tg_alloc_len = 0;
 8550|  5.72k|            num_H_component = num_taut_H_component = 0;
 8551|  5.72k|#if ( FIX_GAF_2019_1==1 )
 8552|  5.72k|            {
 8553|  5.72k|                char invalid;
 8554|  5.72k|                const char* str1 = str + 1;
 8555|  5.72k|                if (bMobileH == TAUT_NON)    /* FixedH layer "/h"*/
  ------------------
  |  |  574|  5.72k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (8555:21): [True: 1.41k, False: 4.31k]
  ------------------
 8556|  1.41k|                {
 8557|  1.41k|                    invalid = str1[strspn(str1, "0123456789hDHT-,;()*")];
 8558|  1.41k|                }
 8559|  4.31k|                else                        /* Main layer (mobileH) "/h"*/
 8560|  4.31k|                {
 8561|  4.31k|                    invalid = str1[strspn(str1, "0123456789DHT-,;()*")];
 8562|  4.31k|                }
 8563|  5.72k|                if (invalid != '\0')
  ------------------
  |  Branch (8563:21): [True: 10, False: 5.71k]
  ------------------
 8564|     10|                {
 8565|     10|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     10|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8566|     10|                    goto exit_function;
 8567|     10|                }
 8568|  5.72k|            }
 8569|  5.71k|#endif
 8570|  9.93k|            while (p < pTaut)
  ------------------
  |  Branch (8570:20): [True: 4.32k, False: 5.61k]
  ------------------
 8571|  4.32k|            {
 8572|       |                /* syntax check: atom number */
 8573|  4.32k|                if (!*p || !isdigit(UCINT* p))
  ------------------
  |  Branch (8573:21): [True: 0, False: 4.32k]
  |  Branch (8573:28): [True: 11, False: 4.31k]
  ------------------
 8574|     11|                {
 8575|     11|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     11|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8576|     11|                    goto exit_function;
 8577|     11|                }
 8578|       |                /* number of H */
 8579|  4.31k|                h = p + strcspn(p, "Hh");
 8580|       |                /*h = strchr( p, 'H' );*/
 8581|  4.31k|                if (!*h || h >= pTaut)
  ------------------
  |  Branch (8581:21): [True: 3, False: 4.31k]
  |  Branch (8581:28): [True: 2, False: 4.31k]
  ------------------
 8582|      5|                {
 8583|      5|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      5|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8584|      5|                    goto exit_function;
 8585|       |                    /*
 8586|       |                    p = pTaut;
 8587|       |                    h = NULL;
 8588|       |                    break; */ /* no more H found */
 8589|      5|                }
 8590|  4.31k|                num_H = (*h == 'H') ? 1 : (*h == 'h') ? -1 : 0;
  ------------------
  |  Branch (8590:25): [True: 3.03k, False: 1.27k]
  |  Branch (8590:43): [True: 1.27k, False: 0]
  ------------------
 8591|  4.31k|                if (!num_H)
  ------------------
  |  Branch (8591:21): [True: 0, False: 4.31k]
  ------------------
 8592|      0|                {
 8593|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8594|      0|                    goto exit_function;
 8595|      0|                }
 8596|  4.31k|                if (h[1] && isdigit(UCINT h[1]))
  ------------------
  |  Branch (8596:21): [True: 2.18k, False: 2.12k]
  |  Branch (8596:29): [True: 1.00k, False: 1.18k]
  ------------------
 8597|  1.00k|                {
 8598|  1.00k|                    num_H *= (int)inchi_strtol(h + 1, &p1, 10);
 8599|  1.00k|                }
 8600|  3.30k|                else
 8601|  3.30k|                {
 8602|  3.30k|                    p1 = h + 1; /* next set of immobile H */
 8603|  3.30k|                }
 8604|  4.31k|                if (*p1 == ',')
  ------------------
  |  Branch (8604:21): [True: 1.67k, False: 2.64k]
  ------------------
 8605|  1.67k|                {
 8606|  1.67k|                    p1++;  /* next H-subsegment; otherwise (H or ; or end of the segment */
 8607|  1.67k|                }
 8608|       |                /* list of atoms that have num_H */
 8609|  9.02k|                while (p < h)
  ------------------
  |  Branch (8609:24): [True: 4.80k, False: 4.22k]
  ------------------
 8610|  4.80k|                {
 8611|  4.80k|                    if (!*p || !isdigit(UCINT* p))
  ------------------
  |  Branch (8611:25): [True: 0, False: 4.80k]
  |  Branch (8611:32): [True: 3, False: 4.79k]
  ------------------
 8612|      3|                    {
 8613|      3|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      3|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8614|      3|                        goto exit_function;
 8615|      3|                    }
 8616|  4.79k|                    nxtAtom = curAtom = (int)inchi_strtol(p, &q, 10);
 8617|  4.79k|                    if (*q == '-')
  ------------------
  |  Branch (8617:25): [True: 222, False: 4.57k]
  ------------------
 8618|    222|                    {
 8619|    222|                        nxtAtom = (int)inchi_strtol(q + 1, &q, 10);
 8620|    222|#if ( CHECK_STRTOL_ATNUMB==1 )
 8621|    222|                        if (nxtAtom > MAX_ATOMS || nxtAtom < 0)
  ------------------
  |  |   15|    444|#define MAX_ATOMS  32766
  ------------------
  |  Branch (8621:29): [True: 2, False: 220]
  |  Branch (8621:52): [True: 34, False: 186]
  ------------------
 8622|     36|                        {
 8623|     36|                            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     36|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8624|     36|                            goto exit_function;
 8625|     36|                        }
 8626|    222|#endif
 8627|    222|                    }
 8628|       |                    /* consitency check */
 8629|  4.76k|                    if (curAtom <= 0 || curAtom > numCtAtoms ||
  ------------------
  |  Branch (8629:25): [True: 17, False: 4.74k]
  |  Branch (8629:41): [True: 27, False: 4.71k]
  ------------------
 8630|  4.71k|                        nxtAtom < curAtom || nxtAtom > numCtAtoms)
  ------------------
  |  Branch (8630:25): [True: 0, False: 4.71k]
  |  Branch (8630:46): [True: 6, False: 4.71k]
  ------------------
 8631|     50|                    {
 8632|     50|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     50|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8633|     50|                        goto exit_function;
 8634|     50|                    }
 8635|       |                    /* set number of H */
 8636|       |                    /* djb-rwth: fixing oss-fuzz issue #38399 */
 8637|  4.71k|                    if (((bMobileH == TAUT_YES) && pInChI[iComponent].nNum_H) || ((bMobileH != TAUT_YES) && pInChI[iComponent].nNum_H_fixed))
  ------------------
  |  |  575|  4.71k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                  if (((bMobileH == TAUT_YES) && pInChI[iComponent].nNum_H) || ((bMobileH != TAUT_YES) && pInChI[iComponent].nNum_H_fixed))
  ------------------
  |  |  575|  2.69k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (8637:26): [True: 2.01k, False: 2.69k]
  |  Branch (8637:52): [True: 2.01k, False: 0]
  |  Branch (8637:83): [True: 2.69k, False: 0]
  |  Branch (8637:109): [True: 2.68k, False: 4]
  ------------------
 8638|  4.70k|                    {
 8639|  13.0k|                        for (i = curAtom; i <= nxtAtom; i++)
  ------------------
  |  Branch (8639:43): [True: 8.35k, False: 4.70k]
  ------------------
 8640|  8.35k|                        {
 8641|  8.35k|                            nNum_H(iComponent)[i - 1] = num_H;
  ------------------
  |  | 8249|  8.35k|#define nNum_H( ICOMPONENT ) ((bMobileH==TAUT_YES)? pInChI[ICOMPONENT].nNum_H : pInChI[ICOMPONENT].nNum_H_fixed)
  |  |  ------------------
  |  |  |  |  575|  8.35k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (8249:31): [True: 5.66k, False: 2.69k]
  |  |  ------------------
  ------------------
 8642|  8.35k|                            num_H_component += num_H;
 8643|  8.35k|                        }
 8644|  4.70k|                    }
 8645|       |                    /* move to the next atom number if any */
 8646|  4.71k|                    p = q;
 8647|  4.71k|                    if (*p == ',')
  ------------------
  |  Branch (8647:25): [True: 503, False: 4.20k]
  ------------------
 8648|    503|                    {
 8649|    503|                        p++;
 8650|    503|                    }
 8651|  4.71k|                }
 8652|       |
 8653|  4.22k|                if (p == h)
  ------------------
  |  Branch (8653:21): [True: 4.22k, False: 0]
  ------------------
 8654|  4.22k|                {
 8655|  4.22k|                    p = p1;
 8656|  4.22k|                }
 8657|      0|                else
 8658|      0|                {
 8659|      0|                    if (p == pTaut)
  ------------------
  |  Branch (8659:25): [True: 0, False: 0]
  ------------------
 8660|      0|                    {
 8661|      0|                        break;
 8662|      0|                    }
 8663|      0|                    else
 8664|      0|                    {
 8665|      0|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8666|      0|                        goto exit_function;
 8667|      0|                    }
 8668|      0|                }
 8669|  4.22k|            }
 8670|  5.71k|        }
 8671|       |
 8672|       |        INCHI_HEAPCHK
 8673|       |            /* ) -> (, H, N, [-, N,], AtNum,... AtNum) */
 8674|  5.61k|            lenTautomer = 0;
 8675|  5.61k|        if ((p = t)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (8675:13): [True: 2.47k, False: 3.13k]
  ------------------
 8676|  2.47k|        {
 8677|  2.47k|            if (*pbAbc == 1)
  ------------------
  |  Branch (8677:17): [True: 0, False: 2.47k]
  ------------------
 8678|      0|            {
 8679|       |                /* tautomeric groups: pass 1 */
 8680|      0|                iTGroup = 0;
 8681|      0|                state = ')';  /* init as if the prev. t-group just ended */ /* djb-rwth: ignoring LLVM warning: value used */
 8682|      0|                num_Atoms = 0;
 8683|       |                /* Tautomeric info storage */
 8684|       |                /* NumGroups; ((NumAt+2, NumH, Num(-), At1..AtNumAt),...); {INCHI_T_NUM_MOVABLE = 2} */
 8685|       |                /* Allocated length: [5*nNumberOfAtoms/2+1], see Alloc_INChI(...) */
 8686|      0|                if (*p == ',')
  ------------------
  |  Branch (8686:21): [True: 0, False: 0]
  ------------------
 8687|      0|                { /* start t-group */
 8688|      0|                    p++;
 8689|      0|                }
 8690|      0|                else
 8691|      0|                {
 8692|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8693|      0|                    goto exit_function;
 8694|      0|                }
 8695|      0|                while (p < pEnd)
  ------------------
  |  Branch (8695:24): [True: 0, False: 0]
  ------------------
 8696|      0|                {
 8697|       |                    /* start t-group */
 8698|      0|                    if (!isdigit(UCINT* p) || !(num_H = (int)inchi_strtol(p, &q, 10)) || q > pEnd)
  ------------------
  |  Branch (8698:25): [True: 0, False: 0]
  |  Branch (8698:47): [True: 0, False: 0]
  |  Branch (8698:90): [True: 0, False: 0]
  ------------------
 8699|      0|                    {
 8700|      0|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8701|      0|                        goto exit_function;
 8702|      0|                    }
 8703|      0|                    p = q;
 8704|      0|                    num_Minus = 0;
 8705|      0|                    if (*p == '-')
  ------------------
  |  Branch (8705:25): [True: 0, False: 0]
  ------------------
 8706|      0|                    {
 8707|      0|                        p++;
 8708|      0|                        if (isdigit(UCINT* p))
  ------------------
  |  Branch (8708:29): [True: 0, False: 0]
  ------------------
 8709|      0|                        {
 8710|      0|                            num_Minus = (int)inchi_strtol(p, &q, 10);
 8711|      0|                            p = q;
 8712|      0|                        }
 8713|      0|                        else
 8714|      0|                        {
 8715|      0|                            num_Minus = 1;
 8716|      0|                        }
 8717|      0|                    }
 8718|      0|                    if (p >= pEnd)
  ------------------
  |  Branch (8718:25): [True: 0, False: 0]
  ------------------
 8719|      0|                    {
 8720|      0|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8721|      0|                        goto exit_function;
 8722|      0|                    }
 8723|      0|                    if (!tg_alloc_len)
  ------------------
  |  Branch (8723:25): [True: 0, False: 0]
  ------------------
 8724|      0|                    {
 8725|       |                        /*
 8726|       |                        --- header ---
 8727|       |                        [num_t_groups]
 8728|       |                        --- one t-group: ---
 8729|       |                        [len=group length no including this value]
 8730|       |                        [num_H]
 8731|       |                        [num_(-)]
 8732|       |                        [Endpoint(1),...,Endpoint(len-2)]
 8733|       |                        --- next t-group ---
 8734|       |                        ...
 8735|       |
 8736|       |                        Max. size = 1 + 3*max_num_t_groups + max_num_endpoints
 8737|       |
 8738|       |                        max_num_t_groups  = num_at/2
 8739|       |                        max_num_endpoints = num_at
 8740|       |
 8741|       |                        Max. size = 1 + 3*(num_at/2) + num_at = 1 + (5*num_at)/2
 8742|       |                        5 = 3 + INCHI_T_NUM_MOVABLE = 3 + num_types_of_attachments
 8743|       |
 8744|       |                        This does not include zero termination!
 8745|       |
 8746|       |                        */
 8747|      0|                        tg_alloc_len = ((3 + INCHI_T_NUM_MOVABLE) * pInChI[iComponent].nNumberOfAtoms) / 2 + 1;
  ------------------
  |  |  749|      0|#define INCHI_T_NUM_MOVABLE  2
  ------------------
 8748|      0|                        for (i = 0; i < mpy_component; i++)
  ------------------
  |  Branch (8748:37): [True: 0, False: 0]
  ------------------
 8749|      0|                        {
 8750|      0|                            pInChI[iComponent + i].nTautomer = (AT_NUMB*)inchi_calloc((long long)tg_alloc_len + 1, sizeof(pInChI->nTautomer[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 8751|      0|                            if (!pInChI[iComponent + i].nTautomer)
  ------------------
  |  Branch (8751:33): [True: 0, False: 0]
  ------------------
 8752|      0|                            {
 8753|      0|                                ret = RI_ERR_ALLOC; /* allocation error */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 8754|      0|                                goto exit_function;
 8755|      0|                            }
 8756|      0|                            pInChI[iComponent + i].lenTautomer = 0;
 8757|      0|                        }
 8758|      0|                        tg_pos_Tautomer = 1; /* number atoms (NumAt+2) position */
 8759|      0|                    }
 8760|      0|                    else
 8761|      0|                    {
 8762|       |                        /* next t-group */
 8763|      0|                        tg_pos_Tautomer = lenTautomer;
 8764|      0|                    }
 8765|      0|                    if (tg_pos_Tautomer + 3 >= tg_alloc_len)
  ------------------
  |  Branch (8765:25): [True: 0, False: 0]
  ------------------
 8766|      0|                    {
 8767|      0|                        ret = RI_ERR_PROGR; /* wrong tautomer array length */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 8768|      0|                        goto exit_function;
 8769|      0|                    }
 8770|      0|                    pInChI[iComponent].nTautomer[tg_pos_Tautomer + 1] = num_H;
 8771|      0|                    pInChI[iComponent].nTautomer[tg_pos_Tautomer + 2] = num_Minus;
 8772|      0|                    lenTautomer = tg_pos_Tautomer + 3; /* first atom number position */
 8773|      0|                    num_taut_H_component += num_H;
 8774|       |
 8775|      0|                    while (p < pEnd && isupper(UCINT* p))
  ------------------
  |  Branch (8775:28): [True: 0, False: 0]
  |  Branch (8775:40): [True: 0, False: 0]
  ------------------
 8776|      0|                    {
 8777|       |                        /* read list of tautomeric atoms */
 8778|      0|                        val = (int)inchi_strtol(p, &q, base);
 8779|      0|                        if (lenTautomer >= tg_alloc_len || val > numCtAtoms)
  ------------------
  |  Branch (8779:29): [True: 0, False: 0]
  |  Branch (8779:60): [True: 0, False: 0]
  ------------------
 8780|      0|                        {
 8781|      0|                            ret = RI_ERR_PROGR; /* wrong tautomer array length */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 8782|      0|                            goto exit_function;
 8783|      0|                        }
 8784|      0|                        num_Atoms++;
 8785|      0|                        pInChI[iComponent].nTautomer[lenTautomer++] = val;
 8786|      0|                        p = q;
 8787|      0|                    }
 8788|      0|                    if (!num_Atoms || (p < pEnd && !isdigit(UCINT * p))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (8788:25): [True: 0, False: 0]
  |  Branch (8788:40): [True: 0, False: 0]
  |  Branch (8788:52): [True: 0, False: 0]
  ------------------
 8789|      0|                    {
 8790|      0|                        ret = RI_ERR_PROGR; /* wrong tautomer array length */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 8791|      0|                        goto exit_function;
 8792|      0|                    }
 8793|      0|                    iTGroup++;
 8794|      0|                    pInChI[iComponent].nTautomer[tg_pos_Tautomer] = lenTautomer - tg_pos_Tautomer - 1; /* length of the rest of the t-group */
 8795|      0|                    pInChI[iComponent].lenTautomer = lenTautomer;
 8796|      0|                }
 8797|      0|                if (!iTGroup || p != pEnd)
  ------------------
  |  Branch (8797:21): [True: 0, False: 0]
  |  Branch (8797:33): [True: 0, False: 0]
  ------------------
 8798|      0|                {
 8799|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8800|      0|                    goto exit_function;
 8801|      0|                }
 8802|      0|                pInChI[iComponent].nTautomer[0] = iTGroup;
 8803|      0|            }
 8804|  2.47k|            else
 8805|  2.47k|            {
 8806|       |                /* tautomeric groups: pass 1 */
 8807|  2.47k|                iTGroup = 0;
 8808|  2.47k|                state = ')';  /* init as if the prev. t-group just ended */
 8809|  2.47k|                num_Atoms = 0;
 8810|       |                /* Tautomeric info storage */
 8811|       |                /* NumGroups; ((NumAt+2, NumH, Num(-), At1..AtNumAt),...); {INCHI_T_NUM_MOVABLE = 2} */
 8812|       |                /* Allocated length: [5*nNumberOfAtoms/2+1], see Alloc_INChI(...) */
 8813|   100k|                while (p < pEnd)
  ------------------
  |  Branch (8813:24): [True: 98.1k, False: 2.41k]
  ------------------
 8814|  98.1k|                {
 8815|       |                    /* t-group */
 8816|  98.1k|                    switch (*p)
 8817|  98.1k|                    {
 8818|  4.66k|                    case '(': /* start t-group */
  ------------------
  |  Branch (8818:21): [True: 4.66k, False: 93.5k]
  ------------------
 8819|  4.66k|                        switch (state)
 8820|  4.66k|                        {
 8821|  4.65k|                        case ')':
  ------------------
  |  Branch (8821:25): [True: 4.65k, False: 9]
  ------------------
 8822|  4.65k|                            state = *p++;
 8823|  4.65k|                            num_H = 0;
 8824|  4.65k|                            num_Minus = 0;
 8825|  4.65k|                            continue;
 8826|      9|                        default:
  ------------------
  |  Branch (8826:25): [True: 9, False: 4.65k]
  ------------------
 8827|      9|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      9|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8828|      9|                            goto exit_function;
 8829|  4.66k|                        }
 8830|  4.57k|                    case ')': /* end t-group */
  ------------------
  |  Branch (8830:21): [True: 4.57k, False: 93.6k]
  ------------------
 8831|  4.57k|                        switch (state)
 8832|  4.57k|                        {
 8833|  4.56k|                        case 'A': /* previuos was atom number */
  ------------------
  |  Branch (8833:25): [True: 4.56k, False: 2]
  ------------------
 8834|  4.56k|                            if (!tg_alloc_len)
  ------------------
  |  Branch (8834:33): [True: 0, False: 4.56k]
  ------------------
 8835|      0|                            {
 8836|      0|                                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8837|      0|                                goto exit_function;
 8838|      0|                            }
 8839|  4.56k|                            iTGroup++;
 8840|  4.56k|                            state = *p++;
 8841|  4.56k|                            pInChI[iComponent].nTautomer[tg_pos_Tautomer] = lenTautomer - tg_pos_Tautomer - 1; /* length of the rest of the t-group */
 8842|  4.56k|                            pInChI[iComponent].lenTautomer = lenTautomer;
 8843|  4.56k|                            continue;
 8844|      2|                        default:
  ------------------
  |  Branch (8844:25): [True: 2, False: 4.56k]
  ------------------
 8845|      2|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8846|      2|                            goto exit_function;
 8847|  4.57k|                        }
 8848|  4.65k|                    case 'H': /* number of H */
  ------------------
  |  Branch (8848:21): [True: 4.65k, False: 93.5k]
  ------------------
 8849|  4.65k|                        switch (state)
 8850|  4.65k|                        {
 8851|  4.65k|                        case '(':
  ------------------
  |  Branch (8851:25): [True: 4.65k, False: 1]
  ------------------
 8852|  4.65k|                            state = *p++;
 8853|  4.65k|                            num_H = 1;
 8854|  4.65k|                            continue;
 8855|      1|                        default:
  ------------------
  |  Branch (8855:25): [True: 1, False: 4.65k]
  ------------------
 8856|      1|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8857|      1|                            goto exit_function;
 8858|  4.65k|                        }
 8859|  1.09k|                    case '-':  /* number of (-) */
  ------------------
  |  Branch (8859:21): [True: 1.09k, False: 97.1k]
  ------------------
 8860|  1.09k|                        switch (state)
 8861|  1.09k|                        {
 8862|    946|                        case 'N': /* previous was number of H */
  ------------------
  |  Branch (8862:25): [True: 946, False: 149]
  ------------------
 8863|  1.09k|                        case 'H': /* previous was H */
  ------------------
  |  Branch (8863:25): [True: 144, False: 951]
  ------------------
 8864|  1.09k|                            state = *p++;
 8865|  1.09k|                            num_Minus = 1;
 8866|  1.09k|                            continue;
 8867|      5|                        default:
  ------------------
  |  Branch (8867:25): [True: 5, False: 1.09k]
  ------------------
 8868|      5|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      5|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8869|      5|                            goto exit_function;
 8870|  1.09k|                        }
 8871|  39.0k|                    case ',':
  ------------------
  |  Branch (8871:21): [True: 39.0k, False: 59.1k]
  ------------------
 8872|  39.0k|                        switch (state)
 8873|  39.0k|                        {
 8874|  3.25k|                        case 'N': /* previous was number of H */
  ------------------
  |  Branch (8874:25): [True: 3.25k, False: 35.8k]
  ------------------
 8875|  3.53k|                        case 'H': /* previous was H */
  ------------------
  |  Branch (8875:25): [True: 284, False: 38.8k]
  ------------------
 8876|  3.81k|                        case '-': /* previuos was - */
  ------------------
  |  Branch (8876:25): [True: 274, False: 38.8k]
  ------------------
 8877|  4.60k|                        case 'M': /* previous was number of (-) */
  ------------------
  |  Branch (8877:25): [True: 797, False: 38.2k]
  ------------------
 8878|       |                            /* the next must be the first tautomeric atom number; save num_H & num_Minus */
 8879|  4.60k|                            if (num_H <= 0 && num_Minus <= 0)
  ------------------
  |  Branch (8879:33): [True: 0, False: 4.60k]
  |  Branch (8879:47): [True: 0, False: 0]
  ------------------
 8880|      0|                            {
 8881|      0|                                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8882|      0|                                goto exit_function;
 8883|      0|                            }
 8884|  4.60k|                            if (!tg_alloc_len)
  ------------------
  |  Branch (8884:33): [True: 2.43k, False: 2.17k]
  ------------------
 8885|  2.43k|                            {
 8886|       |                                /*
 8887|       |                                --- header ---
 8888|       |                                [num_t_groups]
 8889|       |                                --- one t-group: ---
 8890|       |                                [len=group length no including this value]
 8891|       |                                [num_H]
 8892|       |                                [num_(-)]
 8893|       |                                [Endpoint(1),...,Endpoint(len-2)]
 8894|       |                                --- next t-group ---
 8895|       |                                ...
 8896|       |
 8897|       |                                Max. size = 1 + 3*max_num_t_groups + max_num_endpoints
 8898|       |
 8899|       |                                max_num_t_groups  = num_at/2
 8900|       |                                max_num_endpoints = num_at
 8901|       |
 8902|       |                                Max. size = 1 + 3*(num_at/2) + num_at = 1 + (5*num_at)/2
 8903|       |                                5 = 3 + INCHI_T_NUM_MOVABLE = 3 + num_types_of_attachments
 8904|       |
 8905|       |                                This does not include zero termination!
 8906|       |
 8907|       |                                */
 8908|  2.43k|                                tg_alloc_len = ((3 + INCHI_T_NUM_MOVABLE) * pInChI[iComponent].nNumberOfAtoms) / 2 + 1;
  ------------------
  |  |  749|  2.43k|#define INCHI_T_NUM_MOVABLE  2
  ------------------
 8909|  5.06k|                                for (i = 0; i < mpy_component; i++)
  ------------------
  |  Branch (8909:45): [True: 2.62k, False: 2.43k]
  ------------------
 8910|  2.62k|                                {
 8911|       |                                    /* djb-rwth: fixing oss-fuzz issue #68314 */
 8912|  2.62k|                                    AT_NUMB* pinchi_icint = (AT_NUMB*)inchi_calloc((long long)tg_alloc_len + 1, sizeof(pInChI->nTautomer[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  2.62k|#define inchi_calloc   calloc
  ------------------
 8913|  2.62k|                                    if (!pinchi_icint)
  ------------------
  |  Branch (8913:41): [True: 0, False: 2.62k]
  ------------------
 8914|      0|                                    {
 8915|      0|                                        ret = RI_ERR_ALLOC; /* allocation error */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 8916|      0|                                        goto exit_function;
 8917|      0|                                    }
 8918|  2.62k|                                    pInChI[iComponent + i].nTautomer = pinchi_icint;
 8919|  2.62k|                                    pInChI[iComponent + i].lenTautomer = 0;
 8920|  2.62k|                                }
 8921|  2.43k|                                tg_pos_Tautomer = 1; /* number atoms (NumAt+2) position */
 8922|  2.43k|                            }
 8923|  2.17k|                            else
 8924|  2.17k|                            {
 8925|       |                                /* next t-group */
 8926|  2.17k|                                tg_pos_Tautomer = lenTautomer;
 8927|  2.17k|                            }
 8928|  4.60k|                            if (tg_pos_Tautomer + 3 >= tg_alloc_len)
  ------------------
  |  Branch (8928:33): [True: 2, False: 4.60k]
  ------------------
 8929|      2|                            {
 8930|      2|                                ret = RI_ERR_PROGR; /* wrong tautomer array length */
  ------------------
  |  |   17|      2|#define RI_ERR_PROGR   (-3)
  ------------------
 8931|      2|                                goto exit_function;
 8932|      2|                            }
 8933|  4.60k|                            pInChI[iComponent].nTautomer[tg_pos_Tautomer + 1] = num_H;
 8934|  4.60k|                            pInChI[iComponent].nTautomer[tg_pos_Tautomer + 2] = num_Minus;
 8935|  4.60k|                            lenTautomer = tg_pos_Tautomer + 3; /* first atom number position */
 8936|       |                            /* djb-rwth: fixing GH issue #59.1 */
 8937|  4.60k|                            if (num_H >= INT_MIN && num_H <= INT_MAX) /* djb-rwth: addressing coverity ID #499582 -- boundary check is required */
  ------------------
  |  Branch (8937:33): [True: 4.60k, False: 0]
  |  Branch (8937:53): [True: 4.60k, False: 0]
  ------------------
 8938|  4.60k|                            {
 8939|  4.60k|                                num_taut_H_component += num_H;
 8940|  4.60k|                            }
 8941|      0|                            else
 8942|      0|                            {
 8943|      0|                                ret = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 8944|      0|                                goto exit_function;
 8945|      0|                            }
 8946|  4.60k|                            state = *p++;
 8947|  4.60k|                            continue;
 8948|  34.4k|                        case 'A':
  ------------------
  |  Branch (8948:25): [True: 34.4k, False: 4.60k]
  ------------------
 8949|       |                            /* previuos was atom number */
 8950|  34.4k|                            state = *p++;
 8951|  34.4k|                            continue;
 8952|      0|                        default:
  ------------------
  |  Branch (8952:25): [True: 0, False: 39.0k]
  ------------------
 8953|      0|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8954|      0|                            goto exit_function;
 8955|  39.0k|                        }
 8956|  44.1k|                    default:
  ------------------
  |  Branch (8956:21): [True: 44.1k, False: 54.0k]
  ------------------
 8957|  44.1k|                        if (isdigit(UCINT* p))
  ------------------
  |  Branch (8957:29): [True: 44.1k, False: 0]
  ------------------
 8958|  44.1k|                        {
 8959|  44.1k|                            val = (int)inchi_strtol(p, &q, 10);
 8960|  44.1k|                            if (val <= 0)
  ------------------
  |  Branch (8960:33): [True: 25, False: 44.0k]
  ------------------
 8961|     25|                            {
 8962|     25|                                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     25|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8963|     25|                                goto exit_function;
 8964|     25|                            }
 8965|  44.0k|                            p = q;
 8966|  44.0k|                            switch (state)
 8967|  44.0k|                            {
 8968|  4.20k|                            case 'H':
  ------------------
  |  Branch (8968:29): [True: 4.20k, False: 39.8k]
  ------------------
 8969|  4.20k|                                num_H = val;
 8970|  4.20k|                                state = 'N';
 8971|  4.20k|                                continue;
 8972|    803|                            case '-':
  ------------------
  |  Branch (8972:29): [True: 803, False: 43.2k]
  ------------------
 8973|    803|                                num_Minus = val;
 8974|    803|                                state = 'M';
 8975|    803|                                continue;
 8976|  39.0k|                            case ',':
  ------------------
  |  Branch (8976:29): [True: 39.0k, False: 5.01k]
  ------------------
 8977|  39.0k|                                if (lenTautomer >= tg_alloc_len || val > numCtAtoms)
  ------------------
  |  Branch (8977:37): [True: 0, False: 39.0k]
  |  Branch (8977:68): [True: 13, False: 39.0k]
  ------------------
 8978|     13|                                {
 8979|     13|                                    ret = RI_ERR_PROGR; /* wrong tautomer array length */
  ------------------
  |  |   17|     13|#define RI_ERR_PROGR   (-3)
  ------------------
 8980|     13|                                    goto exit_function;
 8981|     13|                                }
 8982|  39.0k|                                num_Atoms++;
 8983|  39.0k|                                pInChI[iComponent].nTautomer[lenTautomer++] = val;
 8984|  39.0k|                                state = 'A';
 8985|  39.0k|                                continue;
 8986|      3|                            default:
  ------------------
  |  Branch (8986:29): [True: 3, False: 44.0k]
  ------------------
 8987|      3|                                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      3|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8988|      3|                                goto exit_function;
 8989|  44.0k|                            }
 8990|  44.0k|                        }
 8991|      0|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8992|      0|                        goto exit_function;
 8993|  98.1k|                    }
 8994|  98.1k|                }
 8995|  2.41k|                if (!iTGroup || state != ')')
  ------------------
  |  Branch (8995:21): [True: 17, False: 2.39k]
  |  Branch (8995:33): [True: 17, False: 2.37k]
  ------------------
 8996|     34|                {
 8997|     34|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     34|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8998|     34|                    goto exit_function;
 8999|     34|                }
 9000|  2.37k|                pInChI[iComponent].nTautomer[0] = iTGroup;
 9001|  2.37k|            }
 9002|  2.47k|        }
 9003|       |        /* check num_H in components; for bMobileH=TAUT_NON, pInChI->nNum_H_fixed[] has not been added to pInChI->nNum_H[] yet */
 9004|  5.51k|        if (0 > (ret2 = GetInChIFormulaNumH(pInChI + iComponent, &num_H_formula)) ||
  ------------------
  |  Branch (9004:13): [True: 0, False: 5.51k]
  ------------------
 9005|  5.51k|            0 > (ret2 = GetInChINumH(pInChI + iComponent, &num_H_InChI)))
  ------------------
  |  Branch (9005:13): [True: 0, False: 5.51k]
  ------------------
 9006|      0|        {
 9007|      0|            ret = ret2;
 9008|      0|            goto exit_function;
 9009|      0|        }
 9010|  5.51k|        if (num_H_formula != num_H_InChI + (bMobileH == TAUT_NON ? num_H_component : 0))
  ------------------
  |  |  574|  5.51k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (9010:13): [True: 74, False: 5.44k]
  |  Branch (9010:45): [True: 1.39k, False: 4.12k]
  ------------------
 9011|     74|        {
 9012|     74|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     74|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9013|     74|            goto exit_function;
 9014|     74|        }
 9015|       |
 9016|       |        /* duplicate according to multiplication */
 9017|  5.78k|        for (i = 1; i < mpy_component; i++)
  ------------------
  |  Branch (9017:21): [True: 345, False: 5.43k]
  ------------------
 9018|    345|        {
 9019|    345|#if ( FIX_GAF_2019_2==1 )
 9020|    345|            if ((iComponent + i > nNumComponents - 1) || (iComponent + i < 0))
  ------------------
  |  Branch (9020:17): [True: 5, False: 340]
  |  Branch (9020:58): [True: 0, False: 340]
  ------------------
 9021|      5|            {
 9022|      5|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      5|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9023|      5|                goto exit_function;
 9024|      5|            }
 9025|       |
 9026|    340|            if ((pInChI[iComponent + i].nNumberOfAtoms <= 0) || (pInChI[iComponent + i].nNumberOfAtoms > MAX_ATOMS))
  ------------------
  |  |   15|    340|#define MAX_ATOMS  32766
  ------------------
  |  Branch (9026:17): [True: 0, False: 340]
  |  Branch (9026:65): [True: 0, False: 340]
  ------------------
 9027|      0|            {
 9028|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9029|      0|                goto exit_function;
 9030|      0|            }
 9031|    340|#endif
 9032|       |            /* djb-rwth: fixing oss-fuzz issue #69699 */
 9033|    340|            if (nNum_H(iComponent)) /* djb-rwth: fixing GH issues #27/#28 */
  ------------------
  |  | 8249|    340|#define nNum_H( ICOMPONENT ) ((bMobileH==TAUT_YES)? pInChI[ICOMPONENT].nNum_H : pInChI[ICOMPONENT].nNum_H_fixed)
  |  |  ------------------
  |  |  |  |  575|    340|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (8249:30): [True: 340, False: 0]
  |  |  |  Branch (8249:31): [True: 306, False: 34]
  |  |  ------------------
  ------------------
 9034|    340|            {
 9035|    340|                memcpy(nNum_H(iComponent + i), nNum_H(iComponent), pInChI[iComponent + i].nNumberOfAtoms * sizeof(nNum_H(0)[0]));
  ------------------
  |  | 8249|    340|#define nNum_H( ICOMPONENT ) ((bMobileH==TAUT_YES)? pInChI[ICOMPONENT].nNum_H : pInChI[ICOMPONENT].nNum_H_fixed)
  |  |  ------------------
  |  |  |  |  575|    340|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (8249:31): [True: 306, False: 34]
  |  |  ------------------
  ------------------
                              memcpy(nNum_H(iComponent + i), nNum_H(iComponent), pInChI[iComponent + i].nNumberOfAtoms * sizeof(nNum_H(0)[0]));
  ------------------
  |  | 8249|    340|#define nNum_H( ICOMPONENT ) ((bMobileH==TAUT_YES)? pInChI[ICOMPONENT].nNum_H : pInChI[ICOMPONENT].nNum_H_fixed)
  |  |  ------------------
  |  |  |  |  575|    340|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (8249:31): [True: 306, False: 34]
  |  |  ------------------
  ------------------
                              memcpy(nNum_H(iComponent + i), nNum_H(iComponent), pInChI[iComponent + i].nNumberOfAtoms * sizeof(nNum_H(0)[0]));
  ------------------
  |  | 8249|    340|#define nNum_H( ICOMPONENT ) ((bMobileH==TAUT_YES)? pInChI[ICOMPONENT].nNum_H : pInChI[ICOMPONENT].nNum_H_fixed)
  |  |  ------------------
  |  |  |  |  575|    340|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (8249:31): [True: 0, False: 340]
  |  |  ------------------
  ------------------
 9036|    340|            }
 9037|       |            /*
 9038|       |            memcpy( pInChI[iComponent+i].nNum_H, pInChI[iComponent].nNum_H,
 9039|       |            pInChI[iComponent+i].nNumberOfAtoms * sizeof(pInChI[0].nNum_H[0]) );
 9040|       |            */
 9041|    340|            if (pInChI[iComponent + i].nTautomer && pInChI[iComponent].nTautomer && pInChI[iComponent].lenTautomer)
  ------------------
  |  Branch (9041:17): [True: 168, False: 172]
  |  Branch (9041:53): [True: 168, False: 0]
  |  Branch (9041:85): [True: 168, False: 0]
  ------------------
 9042|    168|            {
 9043|    168|                memcpy(pInChI[iComponent + i].nTautomer, pInChI[iComponent].nTautomer,
 9044|    168|                    pInChI[iComponent].lenTautomer * sizeof(pInChI[0].nTautomer[0]));
 9045|    168|                pInChI[iComponent + i].lenTautomer = pInChI[iComponent].lenTautomer;
 9046|    168|            }
 9047|       |            /* check num_H in components */
 9048|    340|            if (0 > (ret2 = GetInChIFormulaNumH(pInChI + iComponent + i, &num_H_formula)) ||
  ------------------
  |  Branch (9048:17): [True: 0, False: 340]
  ------------------
 9049|    340|                0 > (ret2 = GetInChINumH(pInChI + iComponent + i, &num_H_InChI)))
  ------------------
  |  Branch (9049:17): [True: 0, False: 340]
  ------------------
 9050|      0|            {
 9051|      0|                ret = ret2;
 9052|      0|                goto exit_function;
 9053|      0|            }
 9054|    340|            if (num_H_formula != num_H_InChI + (bMobileH == TAUT_NON ? num_H_component : 0))
  ------------------
  |  |  574|    340|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (9054:17): [True: 0, False: 340]
  |  Branch (9054:49): [True: 34, False: 306]
  ------------------
 9055|      0|            {
 9056|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9057|      0|                goto exit_function;
 9058|      0|            }
 9059|    340|        }
 9060|       |
 9061|       |        /* prepare for the next component */
 9062|  5.43k|        iComponent += i;
 9063|  5.43k|        if (*pEnd)
  ------------------
  |  Branch (9063:13): [True: 279, False: 5.16k]
  ------------------
 9064|    279|        {
 9065|    279|#if (FIX_DALKE_BUGS == 1)
 9066|       |            /* prevent crash on extra trailing ';' */
 9067|    279|            if (iComponent >= nNumComponents)
  ------------------
  |  Branch (9067:17): [True: 1, False: 278]
  ------------------
 9068|      1|            {
 9069|      1|                ret = RI_ERR_SYNTAX; /* syntax error: extra component */
  ------------------
  |  |   16|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9070|      1|                goto exit_function;
 9071|      1|            }
 9072|    278|#endif
 9073|    278|            pStart = pEnd + 1;
 9074|    278|        }
 9075|  5.16k|        else
 9076|  5.16k|        {
 9077|  5.16k|            break;
 9078|  5.16k|        }
 9079|  5.43k|    }
 9080|       |
 9081|  5.16k|    if (nNumComponents != iComponent)
  ------------------
  |  Branch (9081:9): [True: 17, False: 5.14k]
  ------------------
 9082|     17|    {
 9083|     17|        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     17|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9084|     17|        goto exit_function;
 9085|     17|    }
 9086|  5.14k|    ret = iComponent + 1;
 9087|       |
 9088|  5.46k|exit_function:
 9089|  5.46k|    INCHI_HEAPCHK
 9090|       |
 9091|  5.46k|        return ret;
 9092|  5.14k|}
ichiread.c:ParseSegmentCharge:
 8049|  8.63k|{
 8050|       |    /* Pass 1: count bonds and find actual numbers of  atom */
 8051|  8.63k|    int i, mpy_component, val;
 8052|  8.63k|    int nNumComponents, iComponent;
 8053|  8.63k|    const char* p, * q, * t, * pStart, * pEnd;
 8054|  8.63k|    int  ret;
 8055|  8.63k|    INChI* pInChI = pInpInChI[bMobileH];
 8056|  8.63k|    const char   mult_type[] = "mnMNe";
 8057|  8.63k|    int if_cnd = 1; /* djb-rwth: needed for some if condition restructuring */
 8058|       |
 8059|  8.63k|    if (str[0] != 'q')
  ------------------
  |  Branch (8059:9): [True: 7.99k, False: 640]
  ------------------
 8060|  7.99k|    {
 8061|  7.99k|        return 0;
 8062|  7.99k|    }
 8063|       |
 8064|    640|    pStart = (char*)str + 1;
 8065|    640|    iComponent = 0;
 8066|    640|    nNumComponents = ppnNumComponents[bMobileH];
 8067|       |
 8068|    640|    if (!*pStart && bMobileH == TAUT_NON)
  ------------------
  |  |  574|     36|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (8068:9): [True: 36, False: 604]
  |  Branch (8068:21): [True: 10, False: 26]
  ------------------
 8069|     10|    {
 8070|     20|        for (i = 0; i < nNumComponents; i++)
  ------------------
  |  Branch (8070:21): [True: 10, False: 10]
  ------------------
 8071|     10|        {
 8072|     10|            pInChI[i].nTotalCharge = NO_VALUE_INT;
  ------------------
  |  |   23|     10|#define NO_VALUE_INT    9999
  ------------------
 8073|     10|        }
 8074|     10|        return nNumComponents + 1;
 8075|     10|    }
 8076|       |
 8077|  1.04k|    while (1)
  ------------------
  |  Branch (8077:12): [True: 1.04k, Folded]
  ------------------
 8078|  1.04k|    {
 8079|       |        /* cycle over components */
 8080|  1.04k|        if (!(pEnd = strchr(pStart, ';')))
  ------------------
  |  Branch (8080:13): [True: 611, False: 432]
  ------------------
 8081|    611|        {
 8082|    611|            pEnd = pStart + strlen(pStart);
 8083|    611|        }
 8084|       |
 8085|       |        /* djb-rwth: condition for if block had to be rewritten */
 8086|  1.04k|        if ((int)inchi_strtol(pStart, &q, 10) > 0)
  ------------------
  |  Branch (8086:13): [True: 311, False: 732]
  ------------------
 8087|    311|        {
 8088|    311|            val = (int)inchi_strtol(pStart, &q, 10);
 8089|    311|            if_cnd = isdigit(UCINT * pStart);
 8090|       |
 8091|    311|        }
 8092|    732|        else
 8093|    732|        {
 8094|    732|            val = 1;
 8095|    732|            q = pStart;
 8096|    732|            if_cnd = 1;
 8097|    732|        }
 8098|       |
 8099|       |
 8100|  1.04k|        if (if_cnd && (t = strchr((char*)mult_type, *q)) && q + 1 == pEnd) /* djb-rwth: if_cnd applied; ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (8100:13): [True: 753, False: 290]
  |  Branch (8100:23): [True: 42, False: 711]
  |  Branch (8100:61): [True: 6, False: 36]
  ------------------
 8101|      6|        {
 8102|       |            /* process the abbreviation */
 8103|       |
 8104|      6|            switch (bMobileH)
 8105|      6|            {
 8106|      0|            case TAUT_YES:
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (8106:13): [True: 0, False: 6]
  ------------------
 8107|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8108|      0|                goto exit_function;
 8109|      6|            case TAUT_NON:
  ------------------
  |  |  574|      6|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (8109:13): [True: 6, False: 0]
  ------------------
 8110|      6|                if (*q != 'm' ||
  ------------------
  |  Branch (8110:21): [True: 0, False: 6]
  ------------------
 8111|      6|                    iComponent + val > nNumComponents ||
  ------------------
  |  Branch (8111:21): [True: 5, False: 1]
  ------------------
 8112|      1|                    iComponent + val > ppnNumComponents[TAUT_YES])
  ------------------
  |  |  575|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (8112:21): [True: 0, False: 1]
  ------------------
 8113|      5|                {
 8114|       |
 8115|      5|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      5|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8116|      5|                    goto exit_function;
 8117|      5|                }
 8118|      5|                for (i = 0; i < val; i++)
  ------------------
  |  Branch (8118:29): [True: 4, False: 1]
  ------------------
 8119|      4|                {
 8120|       |                    /* avoid 0 which means "omitted" */
 8121|      4|                    pInChI[iComponent + i].nTotalCharge = pInpInChI[TAUT_YES][iComponent + i].nTotalCharge ?
  ------------------
  |  |  575|      4|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (8121:59): [True: 0, False: 4]
  ------------------
 8122|      0|                        pInpInChI[TAUT_YES][iComponent + i].nTotalCharge :
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 8123|      4|                        NO_VALUE_INT;
  ------------------
  |  |   23|      8|#define NO_VALUE_INT    9999
  ------------------
 8124|      4|                }
 8125|      1|                mpy_component = val;
 8126|      1|                goto end_main_cycle;
 8127|      0|            default:
  ------------------
  |  Branch (8127:13): [True: 0, False: 6]
  ------------------
 8128|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8129|      0|                goto exit_function;
 8130|      6|            }
 8131|      6|        }
 8132|  1.03k|        else
 8133|  1.03k|        {
 8134|  1.03k|            if ((p = strchr(pStart, '*')) && p < pEnd)
  ------------------
  |  Branch (8134:17): [True: 102, False: 935]
  |  Branch (8134:46): [True: 21, False: 81]
  ------------------
 8135|     21|            {
 8136|     21|                mpy_component = (int)inchi_strtol(pStart, &q, 10);
 8137|     21|#if ( CHECK_STRTOL_ATNUMB==1 )
 8138|     21|                if (mpy_component > MAX_ATOMS || mpy_component < 0)
  ------------------
  |  |   15|     42|#define MAX_ATOMS  32766
  ------------------
  |  Branch (8138:21): [True: 0, False: 21]
  |  Branch (8138:50): [True: 11, False: 10]
  ------------------
 8139|     11|                {
 8140|     11|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     11|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8141|     11|                    goto exit_function;
 8142|     11|                }
 8143|     10|#endif
 8144|     10|                if (p != q)
  ------------------
  |  Branch (8144:21): [True: 0, False: 10]
  ------------------
 8145|      0|                {
 8146|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8147|      0|                    goto exit_function;
 8148|      0|                }
 8149|     10|                p++;
 8150|     10|            }
 8151|  1.01k|            else
 8152|  1.01k|            {
 8153|  1.01k|                mpy_component = 1;
 8154|  1.01k|                p = pStart;
 8155|  1.01k|            }
 8156|  1.03k|        }
 8157|  1.02k|#if ( FIX_DALKE_BUGS == 1 )
 8158|  1.02k|        if (mpy_component + iComponent > nNumComponents || mpy_component <= 0)
  ------------------
  |  Branch (8158:13): [True: 6, False: 1.02k]
  |  Branch (8158:60): [True: 2, False: 1.01k]
  ------------------
 8159|      8|        {
 8160|      8|            ret = RI_ERR_SYNTAX; /* syntax error: too many components in charge layer */
  ------------------
  |  |   16|      8|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8161|      8|            goto exit_function;
 8162|      8|        }
 8163|  1.01k|#endif
 8164|  1.01k|        pStart = p;
 8165|  1.01k|        if (pStart < pEnd)
  ------------------
  |  Branch (8165:13): [True: 693, False: 325]
  ------------------
 8166|    693|        {
 8167|    693|            if (pStart[0] == '+' && isdigit(UCINT pStart[1]))
  ------------------
  |  Branch (8167:17): [True: 296, False: 397]
  |  Branch (8167:37): [True: 296, False: 0]
  ------------------
 8168|    296|            {
 8169|    296|                val = (int)inchi_strtol(pStart + 1, &q, 10);
 8170|    296|                pStart = q;
 8171|    296|            }
 8172|    397|            else
 8173|    397|            {
 8174|    397|                if (pStart[0] == '-' && isdigit(UCINT pStart[1]))
  ------------------
  |  Branch (8174:21): [True: 378, False: 19]
  |  Branch (8174:41): [True: 372, False: 6]
  ------------------
 8175|    372|                {
 8176|    372|                    val = -(int)inchi_strtol(pStart + 1, &q, 10);
 8177|    372|                    pStart = q;
 8178|    372|                }
 8179|     25|                else
 8180|     25|                {
 8181|     25|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     25|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8182|     25|                    goto exit_function;
 8183|     25|                }
 8184|    397|            }
 8185|    668|#if ( FIX_DALKE_BUGS == 1 )
 8186|    668|            if (val < -256 || val > 256)
  ------------------
  |  Branch (8186:17): [True: 24, False: 644]
  |  Branch (8186:31): [True: 7, False: 637]
  ------------------
 8187|     31|            {
 8188|     31|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     31|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8189|     31|                goto exit_function;
 8190|     31|            }
 8191|    637|#endif
 8192|    637|            if (!val)
  ------------------
  |  Branch (8192:17): [True: 55, False: 582]
  ------------------
 8193|     55|            {
 8194|     55|                if (pStart != pEnd)
  ------------------
  |  Branch (8194:21): [True: 1, False: 54]
  ------------------
 8195|      1|                {
 8196|      1|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8197|      1|                    goto exit_function;
 8198|      1|                }
 8199|     54|                if (bMobileH == TAUT_NON)
  ------------------
  |  |  574|     54|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (8199:21): [True: 0, False: 54]
  ------------------
 8200|      0|                {
 8201|      0|                    val = NO_VALUE_INT;  /* avoid 0 which means "omitted" */
  ------------------
  |  |   23|      0|#define NO_VALUE_INT    9999
  ------------------
 8202|      0|                }
 8203|     54|            }
 8204|    637|        }
 8205|    325|        else
 8206|    325|        {
 8207|    325|            val = NO_VALUE_INT;
  ------------------
  |  |   23|    325|#define NO_VALUE_INT    9999
  ------------------
 8208|    325|        }
 8209|  1.96k|        for (i = 0; i < mpy_component; i++)
  ------------------
  |  Branch (8209:21): [True: 1.00k, False: 961]
  ------------------
 8210|  1.00k|        {
 8211|  1.00k|            pInChI[iComponent + i].nTotalCharge = val;
 8212|  1.00k|        }
 8213|       |
 8214|    962|    end_main_cycle:
 8215|    962|        iComponent += mpy_component;
 8216|    962|        if (*pEnd)
  ------------------
  |  Branch (8216:13): [True: 413, False: 549]
  ------------------
 8217|    413|        {
 8218|    413|            pStart = pEnd + 1;
 8219|    413|            continue;
 8220|    413|        }
 8221|    549|        else
 8222|    549|        {
 8223|    549|            break;
 8224|    549|        }
 8225|    962|    }
 8226|       |
 8227|    549|    if (nNumComponents != iComponent)
  ------------------
  |  Branch (8227:9): [True: 8, False: 541]
  ------------------
 8228|      8|    {
 8229|      8|        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      8|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8230|      8|        goto exit_function;
 8231|      8|    }
 8232|    541|    ret = iComponent + 1;
 8233|       |
 8234|    630|exit_function:
 8235|       |
 8236|    630|    return ret;
 8237|    541|}
ichiread.c:ParseSegmentProtons:
 7443|  6.94k|{
 7444|       |    /* Pass 1: count bonds and find actual numbers of  atom */
 7445|  6.94k|    int val;
 7446|  6.94k|    const char* q, * pStart, * pEnd;
 7447|  6.94k|    int  ret;
 7448|       |
 7449|  6.94k|    if (str[0] != 'p')
  ------------------
  |  Branch (7449:9): [True: 6.60k, False: 336]
  ------------------
 7450|  6.60k|    {
 7451|  6.60k|        return 0;
 7452|  6.60k|    }
 7453|       |
 7454|    336|    pStart = (char*)str + 1;
 7455|       |
 7456|    336|    while (1)
  ------------------
  |  Branch (7456:12): [True: 336, Folded]
  ------------------
 7457|    336|    {
 7458|       |        /* cycle over components */
 7459|    336|        if (!(pEnd = strchr(pStart, ';')))
  ------------------
  |  Branch (7459:13): [True: 332, False: 4]
  ------------------
 7460|    332|        {
 7461|    332|            pEnd = pStart + strlen(pStart);
 7462|    332|        }
 7463|       |
 7464|    336|        if (pStart[0] == '+' && isdigit(UCINT pStart[1]))
  ------------------
  |  Branch (7464:13): [True: 202, False: 134]
  |  Branch (7464:33): [True: 202, False: 0]
  ------------------
 7465|    202|        {
 7466|    202|            val = (int)inchi_strtol(pStart + 1, &q, 10);
 7467|    202|        }
 7468|    134|        else
 7469|    134|        {
 7470|    134|            if (pStart[0] == '-' && isdigit(UCINT pStart[1]))
  ------------------
  |  Branch (7470:17): [True: 124, False: 10]
  |  Branch (7470:37): [True: 122, False: 2]
  ------------------
 7471|    122|            {
 7472|    122|                val = -(int)inchi_strtol(pStart + 1, &q, 10);
 7473|    122|            }
 7474|     12|            else
 7475|     12|            {
 7476|     12|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     12|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7477|     12|                goto exit_function;
 7478|     12|            }
 7479|    134|        }
 7480|    324|        if (!val)
  ------------------
  |  Branch (7480:13): [True: 0, False: 324]
  ------------------
 7481|      0|        {
 7482|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7483|      0|            goto exit_function;
 7484|      0|        }
 7485|    324|        nNumProtons[bMobileH].nNumRemovedProtons = val;
 7486|    324|        if (*pEnd || q != pEnd)
  ------------------
  |  Branch (7486:13): [True: 4, False: 320]
  |  Branch (7486:22): [True: 13, False: 307]
  ------------------
 7487|     17|        {
 7488|     17|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     17|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7489|     17|            goto exit_function;
 7490|     17|        }
 7491|    307|        else
 7492|    307|        {
 7493|    307|            break;
 7494|    307|        }
 7495|    324|    }
 7496|    307|    ret = 1;
 7497|       |
 7498|    336|exit_function:
 7499|       |
 7500|    336|    return ret;
 7501|    307|}
ichiread.c:ParseSegmentPolymer:
 7516|  6.74k|{
 7517|  6.74k|    const char* p, * q, * pStart, * pEnd, * p0;
 7518|  6.74k|    char  comma = ',', dot = '.', dash = '-', lt_par = '(', rt_par = ')';
 7519|  6.74k|    int         iunit, val, ret, prev, is_range, pdn_limit;
 7520|  6.74k|    int         curr_atom, type = -1, subtype = -1, conn = -1;
 7521|  6.74k|    AT_NUMB     num_atom;
 7522|  6.74k|    INT_ARRAY   alist;
 7523|  6.74k|    OAD_Polymer* pd = NULL;
 7524|       |
 7525|  6.74k|    if (str[0] != 'z')
  ------------------
  |  Branch (7525:9): [True: 5.90k, False: 837]
  ------------------
 7526|  5.90k|    {
 7527|  5.90k|        return 0;
 7528|  5.90k|    }
 7529|       |
 7530|    837|    if (IntArray_Alloc(&alist, 4))
  ------------------
  |  Branch (7530:9): [True: 0, False: 837]
  ------------------
 7531|      0|    {
 7532|      0|        return RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7533|      0|    }
 7534|       |
 7535|    837|    if (*ppPolymer)
  ------------------
  |  Branch (7535:9): [True: 0, False: 837]
  ------------------
 7536|      0|    {
 7537|      0|        OAD_Polymer_Free(*ppPolymer);
 7538|      0|    }
 7539|       |
 7540|    837|    pd = *ppPolymer = (OAD_Polymer*)
 7541|    837|        inchi_calloc(1, sizeof(OAD_Polymer));
  ------------------
  |  | 1146|    837|#define inchi_calloc   calloc
  ------------------
 7542|    837|    (*ppPolymer)->pzz = NULL;
 7543|       |
 7544|    837|    if (!pd)
  ------------------
  |  Branch (7544:9): [True: 0, False: 837]
  ------------------
 7545|      0|    {
 7546|      0|        ret = RI_ERR_ALLOC; goto exit_function;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7547|      0|    }
 7548|       |
 7549|       |
 7550|    837|    if (!bInchi2Struct)
  ------------------
  |  Branch (7550:9): [True: 416, False: 421]
  ------------------
 7551|    416|    {
 7552|    416|        ret = RI_ERR_SYNTAX; goto exit_function;
  ------------------
  |  |   16|    416|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7553|    416|    }
 7554|       |
 7555|       |    /* Count units */
 7556|    421|    pd->n = 1;
 7557|    421|    p = (char*)str + 1;
 7558|  2.30k|    while ((p = strchr(p, ';'))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (7558:12): [True: 1.88k, False: 421]
  ------------------
 7559|  1.88k|    {
 7560|  1.88k|        p++;
 7561|  1.88k|        pd->n++;
 7562|  1.88k|    }
 7563|    421|    pd->units = (OAD_PolymerUnit**)
 7564|    421|        inchi_calloc(pd->n, sizeof(OAD_PolymerUnit*));
  ------------------
  |  | 1146|    421|#define inchi_calloc   calloc
  ------------------
 7565|    421|    pdn_limit = pd->n;
 7566|    421|    if (!pd->units)
  ------------------
  |  Branch (7566:9): [True: 0, False: 421]
  ------------------
 7567|      0|    {
 7568|      0|        ret = RI_ERR_ALLOC; goto exit_function;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7569|      0|    }
 7570|       |
 7571|    421|    pStart = (char*)str;
 7572|    421|    pStart++;
 7573|    421|    if (!pStart)
  ------------------
  |  Branch (7573:9): [True: 0, False: 421]
  ------------------
 7574|      0|    {
 7575|      0|        ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 7576|      0|        goto exit_function;
 7577|      0|    }
 7578|       |
 7579|    421|    iunit = 0;
 7580|       |    /* djb-rwth: fixing oss-fuzz issue #67678 */
 7581|  2.03k|    while (pStart && (*pStart))
  ------------------
  |  Branch (7581:12): [True: 2.03k, False: 0]
  |  Branch (7581:22): [True: 1.79k, False: 245]
  ------------------
 7582|  1.79k|    {
 7583|  1.79k|        OAD_PolymerUnit* unit = NULL;
 7584|       |
 7585|  1.79k|        if (*pStart == ';')
  ------------------
  |  Branch (7585:13): [True: 779, False: 1.01k]
  ------------------
 7586|    779|        {
 7587|    779|            pStart++;
 7588|    779|        }
 7589|       |
 7590|  1.79k|        if (!(pEnd = strchr(pStart, ';')))
  ------------------
  |  Branch (7590:13): [True: 401, False: 1.39k]
  ------------------
 7591|    401|        {
 7592|    401|            pEnd = pStart + strlen(pStart);
 7593|    401|        }
 7594|  1.79k|        if (!isdigit(UCINT pStart[0]))
  ------------------
  |  Branch (7594:13): [True: 78, False: 1.71k]
  ------------------
 7595|     78|        {
 7596|     78|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     78|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7597|     78|            goto exit_function;
 7598|     78|        }
 7599|  1.71k|        val = (int)inchi_strtol(pStart + 0, &q, 10);
 7600|  1.71k|        type = val / 100;
 7601|  1.71k|        subtype = (val - (type * 100)) / 10;
 7602|  1.71k|        conn = (val - (type * 100 + subtype * 10));
 7603|  1.71k|        if (*q != '-')
  ------------------
  |  Branch (7603:13): [True: 17, False: 1.69k]
  ------------------
 7604|     17|        {
 7605|     17|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     17|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7606|     17|            goto exit_function;
 7607|     17|        }
 7608|  1.69k|#if ( FIX_OSS_FUZZ_30162_30343==1 )
 7609|  1.69k|        if (val < 100) /* type should always be non-zero followed by subtype and conn, like 101 or 200 */
  ------------------
  |  Branch (7609:13): [True: 26, False: 1.67k]
  ------------------
 7610|     26|        {
 7611|     26|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     26|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7612|     26|            goto exit_function;
 7613|     26|        }
 7614|  1.67k|#endif
 7615|       |
 7616|  1.67k|#if ( FIX_GAF_2020_25741==1 )
 7617|  1.67k|        {
 7618|  1.67k|            int valid_unit = 0;
 7619|  1.67k|            if (type == POLYMER_STY_NON || type == POLYMER_STY_SRU || type == POLYMER_STY_MON ||
  ------------------
  |  |  179|  3.34k|#define POLYMER_STY_NON 0
  ------------------
                          if (type == POLYMER_STY_NON || type == POLYMER_STY_SRU || type == POLYMER_STY_MON ||
  ------------------
  |  |  180|  3.34k|#define POLYMER_STY_SRU 1 /**<  structure-based unit or copolymer subunit                        */
  ------------------
                          if (type == POLYMER_STY_NON || type == POLYMER_STY_SRU || type == POLYMER_STY_MON ||
  ------------------
  |  |  181|  3.32k|#define POLYMER_STY_MON 2 /**< source-based    polymer unit or copolymer subunit                    */
  ------------------
  |  Branch (7619:17): [True: 0, False: 1.67k]
  |  Branch (7619:44): [True: 24, False: 1.64k]
  |  Branch (7619:71): [True: 203, False: 1.44k]
  ------------------
 7620|  1.44k|                type == POLYMER_STY_COP || type == POLYMER_STY_MOD || type == POLYMER_STY_CRO ||
  ------------------
  |  |  182|  3.11k|#define POLYMER_STY_COP 3 /**< copolymer unit embedding >1 subunits (may be SRU, MON, MER, CRO, MOD; others not supported yet)                               */
  ------------------
                              type == POLYMER_STY_COP || type == POLYMER_STY_MOD || type == POLYMER_STY_CRO ||
  ------------------
  |  |  183|  2.95k|#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|  2.92k|#define POLYMER_STY_CRO 5 /**< copolymer subunit only, designates cross-linked version of SRU    */
  ------------------
  |  Branch (7620:17): [True: 165, False: 1.28k]
  |  Branch (7620:44): [True: 30, False: 1.25k]
  |  Branch (7620:71): [True: 999, False: 252]
  ------------------
 7621|    252|                type == POLYMER_STY_MER)
  ------------------
  |  |  185|    252|#define POLYMER_STY_MER 6 /**< copolymer subunit only, source-based with no homopolymerize        */
  ------------------
  |  Branch (7621:17): [True: 237, False: 15]
  ------------------
 7622|  1.65k|            {
 7623|  1.65k|                if (subtype == POLYMER_SST_NON || subtype == POLYMER_SST_ALT ||
  ------------------
  |  |  187|  3.31k|#define POLYMER_SST_NON 0
  ------------------
                              if (subtype == POLYMER_SST_NON || subtype == POLYMER_SST_ALT ||
  ------------------
  |  |  188|  2.68k|#define POLYMER_SST_ALT 1
  ------------------
  |  Branch (7623:21): [True: 634, False: 1.02k]
  |  Branch (7623:51): [True: 491, False: 533]
  ------------------
 7624|    533|                    subtype == POLYMER_SST_RAN || subtype == POLYMER_SST_BLK)
  ------------------
  |  |  189|  2.19k|#define POLYMER_SST_RAN 2
  ------------------
                                  subtype == POLYMER_SST_RAN || subtype == POLYMER_SST_BLK)
  ------------------
  |  |  190|    159|#define POLYMER_SST_BLK 3
  ------------------
  |  Branch (7624:21): [True: 374, False: 159]
  |  Branch (7624:51): [True: 156, False: 3]
  ------------------
 7625|  1.65k|                {
 7626|  1.65k|                    if (conn == POLYMER_CONN_NON || conn == POLYMER_CONN_HT ||
  ------------------
  |  |  192|  3.31k|#define POLYMER_CONN_NON 0
  ------------------
                                  if (conn == POLYMER_CONN_NON || conn == POLYMER_CONN_HT ||
  ------------------
  |  |  193|  2.80k|#define POLYMER_CONN_HT 1
  ------------------
  |  Branch (7626:25): [True: 508, False: 1.14k]
  |  Branch (7626:53): [True: 537, False: 610]
  ------------------
 7627|    610|                        conn == POLYMER_CONN_HH || conn == POLYMER_CONN_EU)
  ------------------
  |  |  194|  2.26k|#define POLYMER_CONN_HH 2
  ------------------
                                      conn == POLYMER_CONN_HH || conn == POLYMER_CONN_EU)
  ------------------
  |  |  195|     56|#define POLYMER_CONN_EU 3
  ------------------
  |  Branch (7627:25): [True: 554, False: 56]
  |  Branch (7627:52): [True: 55, False: 1]
  ------------------
 7628|  1.65k|                    {
 7629|  1.65k|                        valid_unit = 1;
 7630|  1.65k|                    }
 7631|  1.65k|                }
 7632|  1.65k|            }
 7633|  1.67k|            if (!valid_unit)
  ------------------
  |  Branch (7633:17): [True: 19, False: 1.65k]
  ------------------
 7634|     19|            {
 7635|     19|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     19|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7636|     19|                goto exit_function;
 7637|     19|            }
 7638|  1.67k|        }
 7639|  1.65k|#endif
 7640|       |
 7641|  1.65k|        q++;
 7642|  1.65k|        prev = 0;
 7643|  1.65k|        is_range = 0;
 7644|  3.40k|        for (p = q, curr_atom = 0; p < pEnd && *p != '('; curr_atom++)
  ------------------
  |  Branch (7644:36): [True: 2.71k, False: 685]
  |  Branch (7644:48): [True: 1.76k, False: 949]
  ------------------
 7645|  1.76k|        {
 7646|  1.76k|            num_atom = (AT_NUMB)inchi_strtol(p, &p, 10);
 7647|  1.76k|#if ( ( CHECK_STRTOL_ATNUMB==1 ) || ( FIX_GAF_2019_2==1 ) )
 7648|  1.76k|            if (num_atom > na_total || num_atom < 0)
  ------------------
  |  Branch (7648:17): [True: 16, False: 1.75k]
  |  Branch (7648:40): [True: 0, False: 1.75k]
  ------------------
 7649|     16|            {
 7650|     16|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     16|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7651|     16|                goto exit_function;
 7652|     16|            }
 7653|  1.75k|#endif
 7654|  1.75k|            if (!num_atom || num_atom > na_total)
  ------------------
  |  Branch (7654:17): [True: 4, False: 1.74k]
  |  Branch (7654:30): [True: 0, False: 1.74k]
  ------------------
 7655|      4|            {
 7656|      4|                ret = RI_ERR_SYNTAX; goto exit_function;
  ------------------
  |  |   16|      4|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7657|      4|            }
 7658|  1.74k|            if (is_range)
  ------------------
  |  Branch (7658:17): [True: 465, False: 1.28k]
  ------------------
 7659|    465|            {
 7660|    465|                int a;
 7661|  4.18k|                for (a = prev + 1; a <= num_atom; a++)
  ------------------
  |  Branch (7661:36): [True: 3.72k, False: 465]
  ------------------
 7662|  3.72k|                {
 7663|  3.72k|                    if (0 != IntArray_Append(&alist, a))
  ------------------
  |  Branch (7663:25): [True: 0, False: 3.72k]
  ------------------
 7664|      0|                    {
 7665|      0|                        ret = RI_ERR_ALLOC; goto exit_function;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7666|      0|                    }
 7667|  3.72k|                }
 7668|    465|                is_range = 0;
 7669|    465|                prev = 0;
 7670|    465|            }
 7671|  1.28k|            else
 7672|  1.28k|            {
 7673|  1.28k|                if (0 != IntArray_Append(&alist, num_atom))
  ------------------
  |  Branch (7673:21): [True: 0, False: 1.28k]
  ------------------
 7674|      0|                {
 7675|      0|                    ret = RI_ERR_ALLOC; goto exit_function;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7676|      0|                }
 7677|  1.28k|                prev = num_atom;
 7678|  1.28k|            }
 7679|  1.74k|            if (*p == '-')
  ------------------
  |  Branch (7679:17): [True: 507, False: 1.24k]
  ------------------
 7680|    507|            {
 7681|    507|                p++;
 7682|    507|                is_range = 1;
 7683|    507|            }
 7684|  1.24k|            else if (*p == ',')
  ------------------
  |  Branch (7684:22): [True: 240, False: 1.00k]
  ------------------
 7685|    240|            {
 7686|    240|                p++;
 7687|    240|            }
 7688|  1.74k|        }
 7689|       |
 7690|  1.63k|        if (alist.used)
  ------------------
  |  Branch (7690:13): [True: 1.16k, False: 469]
  ------------------
 7691|  1.16k|        {
 7692|  1.16k|            unit = OAD_PolymerUnit_New(4,          /* maxatoms             */
 7693|  1.16k|                0,          /* maxbonds=0 for now   */
 7694|  1.16k|                iunit + 1,  /* id                   */
 7695|  1.16k|                iunit + 1,  /* label                */
 7696|  1.16k|                type,
 7697|  1.16k|                subtype,
 7698|  1.16k|                conn,
 7699|  1.16k|                "",         /* smt                  */
 7700|  1.16k|                alist.used,
 7701|  1.16k|                &alist,
 7702|  1.16k|                0,          /* blist.used           */
 7703|  1.16k|                NULL,       /* &blist               */
 7704|  1.16k|                0,          /* nlinks             */
 7705|       |                NULL        /* **links            */
 7706|  1.16k|            );
 7707|       |
 7708|  1.16k|            if (!unit)
  ------------------
  |  Branch (7708:17): [True: 0, False: 1.16k]
  ------------------
 7709|      0|            {
 7710|      0|                ret = RI_ERR_ALLOC; goto exit_function;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7711|      0|            }
 7712|       |            /* djb-rwth: preventing buffer overrun */
 7713|  1.16k|            if (iunit < pdn_limit)
  ------------------
  |  Branch (7713:17): [True: 1.16k, False: 1]
  ------------------
 7714|  1.16k|            {
 7715|  1.16k|                pd->units[iunit] = unit;
 7716|  1.16k|            }
 7717|      1|            else
 7718|      1|            {
 7719|      1|                ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      1|#define RI_ERR_PROGR   (-3)
  ------------------
 7720|      1|                goto exit_function;
 7721|      1|            }
 7722|  1.16k|            IntArray_Reset(&alist);
 7723|  1.16k|            iunit++;
 7724|  1.16k|        }
 7725|       |
 7726|  1.63k|        if (*p == lt_par)
  ------------------
  |  Branch (7726:13): [True: 948, False: 685]
  ------------------
 7727|    948|        {
 7728|       |            /* Structure-based representn, read crossing bonds information */
 7729|    948|            const int nothing = 0, endgroups = 1, stars = 2, stars_ring = 3, stars_bond = 4, stars_atom = 5;
 7730|    948|            int have = nothing;
 7731|    948|            int res, ib, err = 0; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 7732|    948|            INT_ARRAY numlist;
 7733|       |
 7734|    948|            if (IntArray_Alloc(&numlist, 4))
  ------------------
  |  Branch (7734:17): [True: 0, False: 948]
  ------------------
 7735|      0|            {
 7736|      0|                ret = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7737|      0|                goto exit_function;
 7738|      0|            }
 7739|       |
 7740|    948|            p0 = p;
 7741|  2.11k|            while (*(++p))
  ------------------
  |  Branch (7741:20): [True: 2.11k, False: 7]
  ------------------
 7742|  2.11k|            {
 7743|  2.11k|                if (*p == '-')
  ------------------
  |  Branch (7743:21): [True: 808, False: 1.30k]
  ------------------
 7744|    808|                {
 7745|    808|                    have = endgroups; break;
 7746|    808|                }
 7747|  1.30k|                if (*p == ',')
  ------------------
  |  Branch (7747:21): [True: 133, False: 1.17k]
  ------------------
 7748|    133|                {
 7749|    133|                    have = stars; break;
 7750|    133|                }
 7751|  1.30k|            }
 7752|    948|            if (have == stars)
  ------------------
  |  Branch (7752:17): [True: 133, False: 815]
  ------------------
 7753|    133|            {
 7754|    752|                while (*(++p))
  ------------------
  |  Branch (7754:24): [True: 750, False: 2]
  ------------------
 7755|    750|                {
 7756|    750|                    if (*p == ',')
  ------------------
  |  Branch (7756:25): [True: 113, False: 637]
  ------------------
 7757|    113|                    {
 7758|    113|                        have = stars_ring; break;
 7759|    113|                    }
 7760|    637|                    if (*p == '.')
  ------------------
  |  Branch (7760:25): [True: 7, False: 630]
  ------------------
 7761|      7|                    {
 7762|      7|                        have = stars_bond; break;
 7763|      7|                    }
 7764|    630|                    if (*p == ')')
  ------------------
  |  Branch (7764:25): [True: 11, False: 619]
  ------------------
 7765|     11|                    {
 7766|     11|                        have = stars_atom; break;
 7767|     11|                    }
 7768|    630|                }
 7769|    133|            }
 7770|    948|            p = p0;
 7771|       |
 7772|    948|            if (unit) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (7772:17): [True: 921, False: 27]
  ------------------
 7773|    921|            {
 7774|    921|                unit->cyclizable = CLOSING_SRU_NOT_APPLICABLE;
  ------------------
  |  |   19|    921|#define CLOSING_SRU_NOT_APPLICABLE 0
  ------------------
 7775|    921|                if (have == endgroups)
  ------------------
  |  Branch (7775:21): [True: 786, False: 135]
  ------------------
 7776|    786|                {
 7777|       |                    /* Read end groups notation */
 7778|    786|                    p = ParseSegmentReadDelimitedNumbers(p, pEnd, &numlist, dash, comma, &res);
 7779|    786|                    if (res == 1 && numlist.used == 2)
  ------------------
  |  Branch (7779:25): [True: 785, False: 1]
  |  Branch (7779:37): [True: 2, False: 783]
  ------------------
 7780|      2|                    {
 7781|      2|                        p = ParseSegmentReadDelimitedNumbers(p, pEnd, &numlist, dash, rt_par, &res);
 7782|      2|                    }
 7783|    786|                    if (res == 1 && numlist.used == 4)
  ------------------
  |  Branch (7783:25): [True: 785, False: 1]
  |  Branch (7783:37): [True: 16, False: 769]
  ------------------
 7784|     16|                    {
 7785|     16|                        pStart = p + 1;
 7786|     16|                        unit->nb = 2;
 7787|     16|                        unit->blist = (int*)inchi_calloc(2 * (long long)unit->nb, sizeof(int)); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|     16|#define inchi_calloc   calloc
  ------------------
 7788|     16|                        if (!unit->blist)
  ------------------
  |  Branch (7788:29): [True: 0, False: 16]
  ------------------
 7789|      0|                        {
 7790|      0|                            ret = RI_ERR_ALLOC; IntArray_Free(&numlist); goto exit_function;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7791|      0|                        }
 7792|     16|                        unit->blist[0] = numlist.item[0];    unit->blist[1] = numlist.item[1];
 7793|     16|                        unit->blist[2] = numlist.item[2];    unit->blist[3] = numlist.item[3];
 7794|     16|                        unit->cap1 = numlist.item[0]; /* just for GAF check belows */
 7795|     16|                        unit->cap2 = numlist.item[2];
 7796|     16|                        IntArray_Free(&numlist);
 7797|     16|                        continue;
 7798|     16|                    }
 7799|    786|                }
 7800|    135|                else if (have == stars_ring ||
  ------------------
  |  Branch (7800:26): [True: 112, False: 23]
  ------------------
 7801|     23|                    have == stars_bond ||
  ------------------
  |  Branch (7801:21): [True: 7, False: 16]
  ------------------
 7802|     16|                    have == stars_atom)
  ------------------
  |  Branch (7802:21): [True: 11, False: 5]
  ------------------
 7803|    130|                {
 7804|       |                    /* Read star atoms - frame shiftable bonds notation */
 7805|    130|                    IntArray_Reset(&numlist);
 7806|    130|                    p = ParseSegmentReadDelimitedNumbers(p, pEnd, &numlist, comma, dash, &res);
 7807|    130|                    if (res != 1 || numlist.used != 2)
  ------------------
  |  Branch (7807:25): [True: 3, False: 127]
  |  Branch (7807:37): [True: 0, False: 127]
  ------------------
 7808|      3|                    {
 7809|      3|                        ret = RI_ERR_SYNTAX; IntArray_Free(&numlist); goto exit_function;
  ------------------
  |  |   16|      3|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7810|      3|                    }
 7811|       |                    /* OK, we got star atom numbers */
 7812|    127|                    if (have == stars_ring)
  ------------------
  |  Branch (7812:25): [True: 109, False: 18]
  ------------------
 7813|    109|                    {
 7814|    109|                        p = ParseSegmentReadDelimitedNumbers(p, pEnd, &numlist, comma, rt_par, &res);
 7815|    109|                        if (res != 1 || numlist.used < 4)
  ------------------
  |  Branch (7815:29): [True: 1, False: 108]
  |  Branch (7815:41): [True: 0, False: 108]
  ------------------
 7816|      1|                        {
 7817|      1|                            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7818|      1|                            IntArray_Free(&numlist);
 7819|      1|                            goto exit_function;
 7820|      1|                        }
 7821|    108|                        unit->cyclizable = CLOSING_SRU_RING;
  ------------------
  |  |   20|    108|#define CLOSING_SRU_RING 1
  ------------------
 7822|    108|                        unit->nbkbonds = (numlist.used - 2) / 2;
 7823|    108|                    }
 7824|     18|                    else if (have == stars_bond)
  ------------------
  |  Branch (7824:30): [True: 7, False: 11]
  ------------------
 7825|      7|                    {
 7826|      7|                        p = ParseSegmentReadDelimitedNumbers(p, pEnd, &numlist, dot, rt_par, &res);
 7827|      7|                        if (res != 1 || numlist.used < 4)
  ------------------
  |  Branch (7827:29): [True: 1, False: 6]
  |  Branch (7827:41): [True: 1, False: 5]
  ------------------
 7828|      2|                        {
 7829|      2|                            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7830|      2|                            IntArray_Free(&numlist);
 7831|      2|                            goto exit_function;
 7832|      2|                        }
 7833|      5|                        unit->cyclizable = CLOSING_SRU_HIGHER_ORDER_BOND;
  ------------------
  |  |   21|      5|#define CLOSING_SRU_HIGHER_ORDER_BOND 2
  ------------------
 7834|      5|                        unit->nbkbonds = 1;
 7835|      5|                    }
 7836|     11|                    else if (have == stars_atom)
  ------------------
  |  Branch (7836:30): [True: 11, False: 0]
  ------------------
 7837|     11|                    {
 7838|     11|                        int num = inchi_strtol(++p, &p, 10);
 7839|     11|#if ( ( CHECK_STRTOL_ATNUMB==1 ) || ( FIX_GAF_2019_2==1 ) )
 7840|     11|                        if (num > na_total || num < 0)
  ------------------
  |  Branch (7840:29): [True: 1, False: 10]
  |  Branch (7840:47): [True: 1, False: 9]
  ------------------
 7841|      2|                        {
 7842|      2|                            IntArray_Free(&numlist);
 7843|      2|                            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7844|      2|                            goto exit_function;
 7845|      2|                        }
 7846|      9|#endif
 7847|      9|                        if (*p != rt_par)
  ------------------
  |  Branch (7847:29): [True: 2, False: 7]
  ------------------
 7848|      2|                        {
 7849|      2|                            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7850|      2|                            IntArray_Free(&numlist);
 7851|      2|                            goto exit_function;
 7852|      2|                        }
 7853|      7|                        IntArray_Append(&numlist, num);
 7854|      7|                        unit->cyclizable = CLOSING_SRU_DIRADICAL;
  ------------------
  |  |   22|      7|#define CLOSING_SRU_DIRADICAL 3
  ------------------
 7855|      7|                        unit->nbkbonds = 1;
 7856|      7|                    }
 7857|    127|                }
 7858|      5|                else
 7859|      5|                {
 7860|      5|                    ret = RI_ERR_SYNTAX;  IntArray_Free(&numlist);  goto exit_function;
  ------------------
  |  |   16|      5|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7861|      5|                }
 7862|       |
 7863|    890|                unit->cap1 = numlist.item[0];
 7864|    890|                unit->cap2 = numlist.item[1];
 7865|       |
 7866|    890|                if (unit->bkbonds)
  ------------------
  |  Branch (7866:21): [True: 0, False: 890]
  ------------------
 7867|      0|                {
 7868|      0|                    imat_free(unit->maxbkbonds, unit->bkbonds);
 7869|      0|                    unit->bkbonds = NULL;
 7870|      0|                }
 7871|    890|                unit->maxbkbonds = inchi_max(unit->maxbkbonds, unit->nbkbonds);
  ------------------
  |  |  138|    890|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 890]
  |  |  ------------------
  ------------------
 7872|    890|                err = imat_new(unit->maxbkbonds, 2, &(unit->bkbonds)); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 7873|  1.70k|                for (ib = 0; ib < unit->nbkbonds; ib++)
  ------------------
  |  Branch (7873:30): [True: 817, False: 890]
  ------------------
 7874|    817|                {
 7875|    817|                    unit->bkbonds[ib][0] = numlist.item[ib * 2 + 2];
 7876|    817|                    if (numlist.used != 3)
  ------------------
  |  Branch (7876:25): [True: 810, False: 7]
  ------------------
 7877|    810|                    {
 7878|    810|                        unit->bkbonds[ib][1] = numlist.item[ib * 2 + 3];
 7879|    810|                    }
 7880|      7|                    else
 7881|      7|                    {
 7882|      7|                        unit->bkbonds[ib][1] = unit->bkbonds[ib][0];
 7883|      7|                    }
 7884|    817|                }
 7885|    890|                if (unit->nbkbonds > 0)
  ------------------
  |  Branch (7885:21): [True: 120, False: 770]
  ------------------
 7886|    120|                {
 7887|       |                    /*unit->cyclizable = 1;*/
 7888|    120|                    unit->cap1 = numlist.item[0];
 7889|    120|                    unit->cap2 = numlist.item[1];
 7890|    120|                }
 7891|    890|            }
 7892|       |
 7893|    917|            pStart = p + 1;
 7894|    917|            IntArray_Free(&numlist);
 7895|    917|            continue;
 7896|    948|        }
 7897|       |
 7898|    685|        if (*p == ';')
  ------------------
  |  Branch (7898:13): [True: 583, False: 102]
  ------------------
 7899|    583|        {
 7900|    583|            p++;
 7901|    583|        }
 7902|    685|        q = p;
 7903|    685|        pStart = p;
 7904|    685|    }
 7905|       |
 7906|    245|    pd->really_do_frame_shift = 1;
 7907|    245|    pd->frame_shift_scheme = FSS_STARS_CYCLED;
 7908|    245|    pd->treat = POLYMERS_MODERN;
  ------------------
  |  | 1216|    245|#define POLYMERS_MODERN 1	/* v. 1.06+ way to treat polymers with Zz			*/
  ------------------
 7909|    245|    pd->is_in_reconn = 0;
 7910|       |
 7911|       |    /*OAD_Polymer_DebugTrace( pd );*/
 7912|       |
 7913|    245|    ret = pd->n;
 7914|       |
 7915|    837|exit_function:
 7916|       |
 7917|    837|    IntArray_Free(&alist);
 7918|    837|    if (ret == RI_ERR_ALLOC || ret == RI_ERR_SYNTAX || ret == RI_ERR_PROGR)
  ------------------
  |  |   15|  1.67k|#define RI_ERR_ALLOC   (-1)
  ------------------
                  if (ret == RI_ERR_ALLOC || ret == RI_ERR_SYNTAX || ret == RI_ERR_PROGR)
  ------------------
  |  |   16|  1.67k|#define RI_ERR_SYNTAX  (-2)
  ------------------
                  if (ret == RI_ERR_ALLOC || ret == RI_ERR_SYNTAX || ret == RI_ERR_PROGR)
  ------------------
  |  |   17|    246|#define RI_ERR_PROGR   (-3)
  ------------------
  |  Branch (7918:9): [True: 0, False: 837]
  |  Branch (7918:32): [True: 591, False: 246]
  |  Branch (7918:56): [True: 1, False: 245]
  ------------------
 7919|    592|    {
 7920|       |        /*FreeExtOrigAtData( pd, pv );*/
 7921|    592|    }
 7922|    245|#if ( FIX_GAF_2019_2==1 )
 7923|    245|    else
 7924|    245|    {
 7925|    245|        if (pd)
  ------------------
  |  Branch (7925:13): [True: 245, False: 0]
  ------------------
 7926|    245|        {
 7927|    245|            int iu, ipsb, maxats = na_total + pd->n_pzz;
 7928|    828|            for (iu = 0; iu < pd->n; iu++)
  ------------------
  |  Branch (7928:26): [True: 601, False: 227]
  ------------------
 7929|    601|            {
 7930|    601|                int astar1, astar2;
 7931|    601|#if ( FIX_OSS_FUZZ_25604==1 )
 7932|    601|                if (NULL == pd->units[iu])
  ------------------
  |  Branch (7932:21): [True: 14, False: 587]
  ------------------
 7933|     14|                {
 7934|     14|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     14|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7935|     14|                    break;
 7936|     14|                }
 7937|    587|#endif
 7938|    587|                astar1 = pd->units[iu]->cap1;
 7939|    587|                astar2 = pd->units[iu]->cap2;
 7940|    587|                if (0 == pd->units[iu]->nb)
  ------------------
  |  Branch (7940:21): [True: 572, False: 15]
  ------------------
 7941|    572|                {
 7942|    572|                    continue;
 7943|    572|                }
 7944|     15|                if (ret == RI_ERR_SYNTAX)
  ------------------
  |  |   16|     15|#define RI_ERR_SYNTAX  (-2)
  ------------------
  |  Branch (7944:21): [True: 0, False: 15]
  ------------------
 7945|      0|                {
 7946|      0|                    break;
 7947|      0|                }
 7948|     15|                if (astar1 > maxats || astar1 <= 0 || astar2 > maxats || astar2 <= 0)
  ------------------
  |  Branch (7948:21): [True: 0, False: 15]
  |  Branch (7948:40): [True: 4, False: 11]
  |  Branch (7948:55): [True: 0, False: 11]
  |  Branch (7948:74): [True: 0, False: 11]
  ------------------
 7949|      4|                {
 7950|      4|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      4|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7951|      4|                    break;
 7952|      4|                }
 7953|     11|                for (ipsb = 0; ipsb < pd->units[iu]->nbkbonds; ipsb++)
  ------------------
  |  Branch (7953:32): [True: 0, False: 11]
  ------------------
 7954|      0|                {
 7955|      0|                    int a1psb, a2psb;
 7956|      0|                    a1psb = pd->units[iu]->bkbonds[ipsb][0];
 7957|      0|                    a2psb = pd->units[iu]->bkbonds[ipsb][1];
 7958|      0|                    if (a1psb > maxats || a1psb <= 0 || a2psb > maxats || a2psb <= 0)
  ------------------
  |  Branch (7958:25): [True: 0, False: 0]
  |  Branch (7958:43): [True: 0, False: 0]
  |  Branch (7958:57): [True: 0, False: 0]
  |  Branch (7958:75): [True: 0, False: 0]
  ------------------
 7959|      0|                    {
 7960|      0|                        ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7961|      0|                        break;
 7962|      0|                    }
 7963|      0|                }
 7964|     11|            }
 7965|    245|        }
 7966|    245|    }
 7967|    837|#endif
 7968|       |
 7969|    837|    return ret;
 7970|    245|}
ichiread.c:ParseSegmentSp2:
 6885|  7.90k|{
 6886|       |    /* Pass 1: count bonds and find actual numbers of  atom */
 6887|  7.90k|    int i, mpy_component, val, len_limit;
 6888|  7.90k|    int nNumComponents, iComponent, len, iBond;
 6889|  7.90k|    AT_NUMB nAtom1, nAtom2;
 6890|  7.90k|    int     bondParity;
 6891|  7.90k|    const char* p, * q, * t, * pStart, * pEnd, * r;
 6892|  7.90k|    int  ret = 0;
 6893|  7.90k|    INChI* pInChI = pInpInChI[bMobileH];
 6894|  7.90k|    INChI* pInChIFrom = NULL;
 6895|       |    /*
 6896|       |    INChI_Stereo *Stereo = NULL;
 6897|       |    INChI_Stereo *StereoOther = NULL;
 6898|       |    */
 6899|  7.90k|    INChI_Stereo** pStereo = NULL;
 6900|       |
 6901|  7.90k|    const char   mult_type[] = "mnMNe";
 6902|  7.90k|    const char   parity_type[] = "-+u?";
 6903|  7.90k|    int   bIsoTo, bIsoFrom, nCpyType = CPY_SP2;
 6904|  7.90k|    int   bIso = (state == IST_MOBILE_H_ISO_SP2 || state == IST_FIXED_H_ISO_SP2);
  ------------------
  |  Branch (6904:19): [True: 504, False: 7.39k]
  |  Branch (6904:52): [True: 272, False: 7.12k]
  ------------------
 6905|  7.90k|    int   base = 10;
 6906|  7.90k|    int if_cnd = 1; /* djb-rwth: needed for some if condition restructuring */
 6907|       |
 6908|  7.90k|    if (!bIso && state != IST_MOBILE_H_SP2 && state != IST_FIXED_H_SP2)
  ------------------
  |  Branch (6908:9): [True: 7.12k, False: 776]
  |  Branch (6908:18): [True: 1.14k, False: 5.98k]
  |  Branch (6908:47): [True: 0, False: 1.14k]
  ------------------
 6909|      0|    {
 6910|      0|        return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 6911|      0|    }
 6912|       |
 6913|  7.90k|    if (str[0] != 'b')
  ------------------
  |  Branch (6913:9): [True: 6.51k, False: 1.38k]
  ------------------
 6914|  6.51k|    {
 6915|  6.51k|        return 0;
 6916|  6.51k|    }
 6917|       |
 6918|  1.38k|    pStart = (char*)str + 1;
 6919|  1.38k|    iComponent = 0;
 6920|  1.38k|    nNumComponents = ppnNumComponents[bMobileH];
 6921|       |
 6922|  1.38k|    if (!*pStart)
  ------------------
  |  Branch (6922:9): [True: 169, False: 1.21k]
  ------------------
 6923|    169|    {
 6924|       |        /* create empty sp2 segment which means no sp2 */
 6925|  6.91k|        for (iComponent = 0; iComponent < nNumComponents; iComponent++)
  ------------------
  |  Branch (6925:30): [True: 6.74k, False: 169]
  ------------------
 6926|  6.74k|        {
 6927|  6.74k|            INChI* pIsoInChI = &pInChI[iComponent];
 6928|  6.74k|            pStereo = bIso ? &pIsoInChI->StereoIsotopic : &pIsoInChI->Stereo;
  ------------------
  |  Branch (6928:23): [True: 180, False: 6.56k]
  ------------------
 6929|  6.74k|            if (*pStereo && (pStereo[0]->b_parity || pStereo[0]->nNumberOfStereoBonds ||
  ------------------
  |  Branch (6929:17): [True: 4, False: 6.73k]
  |  Branch (6929:30): [True: 0, False: 4]
  |  Branch (6929:54): [True: 0, False: 4]
  ------------------
 6930|      4|                pStereo[0]->nBondAtom1 || pStereo[0]->nBondAtom2))
  ------------------
  |  Branch (6930:17): [True: 0, False: 4]
  |  Branch (6930:43): [True: 0, False: 4]
  ------------------
 6931|      0|            {
 6932|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6933|      0|                goto exit_function;
 6934|      0|            }
 6935|       |            /* allocate empty sp2 stereo */
 6936|  6.74k|            ret = CopySegment(pIsoInChI, NULL, CPY_SP2, bIso, -1);
 6937|  6.74k|            if (ret < 0)
  ------------------
  |  Branch (6937:17): [True: 0, False: 6.74k]
  ------------------
 6938|      0|            {
 6939|      0|                goto exit_function;
 6940|      0|            }
 6941|  6.74k|        }
 6942|    169|        ret = nNumComponents + 1;
 6943|    169|        goto exit_function;
 6944|    169|    }
 6945|       |
 6946|  1.83k|    while (1)
  ------------------
  |  Branch (6946:12): [True: 1.83k, Folded]
  ------------------
 6947|  1.83k|    {
 6948|       |        /* Cycle over components */
 6949|  1.83k|        if (!(pEnd = strchr(pStart, ';')))
  ------------------
  |  Branch (6949:13): [True: 1.18k, False: 647]
  ------------------
 6950|  1.18k|        {
 6951|  1.18k|            pEnd = pStart + strlen(pStart);
 6952|  1.18k|        }
 6953|       |
 6954|       |        /* djb-rwth: condition for if block had to be rewritten -- GH issue #09, thanks to Istvan Ori */
 6955|  1.83k|        if ((int)inchi_strtol(pStart, &q, 10) > 0)
  ------------------
  |  Branch (6955:13): [True: 1.12k, False: 706]
  ------------------
 6956|  1.12k|        {
 6957|  1.12k|            val = (int)inchi_strtol(pStart, &q, 10);
 6958|  1.12k|            if_cnd = isdigit(*pStart);
 6959|       |
 6960|  1.12k|        }
 6961|    706|        else
 6962|    706|        {
 6963|    706|            val = 1;
 6964|    706|            q = pStart;
 6965|    706|            if_cnd = 1;
 6966|    706|        }
 6967|       |
 6968|       |
 6969|  1.83k|        if (if_cnd && (t = strchr((char*)mult_type, *q)) && q + 1 == pEnd) /* djb-rwth: if_cnd applied; ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (6969:13): [True: 1.82k, False: 10]
  |  Branch (6969:23): [True: 71, False: 1.75k]
  |  Branch (6969:61): [True: 26, False: 45]
  ------------------
 6970|     26|        {
 6971|       |            /* process the abbreviation */
 6972|     26|            ret = 0;
 6973|     26|#if (FIX_DALKE_BUGS == 1)
 6974|       |            /* djb-rwth: fixing GH issue #59.2 */
 6975|     26|            if ((iComponent + val >= INT_MIN) && (iComponent + val <= INT_MAX))
  ------------------
  |  Branch (6975:17): [True: 26, False: 0]
  |  Branch (6975:50): [True: 26, False: 0]
  ------------------
 6976|     26|            {
 6977|     26|                if ((iComponent + val > nNumComponents))
  ------------------
  |  Branch (6977:21): [True: 8, False: 18]
  ------------------
 6978|      8|                {
 6979|      8|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      8|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6980|      8|                    goto exit_function;
 6981|      8|                }
 6982|     26|            }
 6983|      0|            else
 6984|      0|            {
 6985|      0|                ret = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6986|      0|                goto exit_function;
 6987|      0|            }
 6988|     18|#endif
 6989|     18|            switch (bMobileH)
 6990|     18|            {
 6991|     14|            case TAUT_YES:
  ------------------
  |  |  575|     14|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (6991:13): [True: 14, False: 4]
  ------------------
 6992|     14|                switch (state)
 6993|     14|                {
 6994|     13|                case IST_MOBILE_H_ISO_SP2:
  ------------------
  |  Branch (6994:17): [True: 13, False: 1]
  ------------------
 6995|     13|                    if (*q == 'm')
  ------------------
  |  Branch (6995:25): [True: 0, False: 13]
  ------------------
 6996|      0|                    {
 6997|       |                        /* copy from mobile H to isotopic mobile H */
 6998|      0|                        pInChIFrom = pInChI;
 6999|      0|                        bIsoTo = 1;
 7000|      0|                        bIsoFrom = 0;
 7001|      0|                    }
 7002|     13|                    else
 7003|     13|                    {
 7004|     13|                        if (*q == 'e')
  ------------------
  |  Branch (7004:29): [True: 13, False: 0]
  ------------------
 7005|     13|                        {
 7006|       |                            /* copy from mobile H to isotopic mobile H */
 7007|     13|                            pInChIFrom = pInChI;
 7008|     13|                            bIsoTo = 1;
 7009|     13|                            bIsoFrom = -1; /* empty */
 7010|     13|                        }
 7011|      0|                        else
 7012|      0|                        {
 7013|      0|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7014|      0|                        }
 7015|     13|                    }
 7016|     13|                    break;
 7017|      1|                default:
  ------------------
  |  Branch (7017:17): [True: 1, False: 13]
  ------------------
 7018|      1|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7019|      1|                    break;
 7020|     14|            }
 7021|     14|                break;
 7022|     14|            case TAUT_NON:
  ------------------
  |  |  574|      4|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (7022:13): [True: 4, False: 14]
  ------------------
 7023|      4|                switch (state)
 7024|      4|                {
 7025|      0|                case IST_FIXED_H_SP2:
  ------------------
  |  Branch (7025:17): [True: 0, False: 4]
  ------------------
 7026|      0|                    if (*q == 'm')
  ------------------
  |  Branch (7026:25): [True: 0, False: 0]
  ------------------
 7027|      0|                    {
 7028|       |                        /* copy from mobile H to fixed H */
 7029|      0|#if ( FIX_GAF_2019_2==1 )
 7030|      0|                        int inum = ALT_TAUT(bMobileH);
  ------------------
  |  |  577|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 7031|      0|                        pInChIFrom = pInpInChI[inum];
 7032|       |#else
 7033|       |                        pInChIFrom = pInpInChI[ALT_TAUT(bMobileH)];
 7034|       |#endif
 7035|      0|                        bIsoTo = 0;
 7036|      0|                        bIsoFrom = 0;
 7037|      0|                    }
 7038|      0|                    else
 7039|      0|                    {
 7040|      0|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7041|      0|                    }
 7042|      0|                    break;
 7043|      4|                case IST_FIXED_H_ISO_SP2:
  ------------------
  |  Branch (7043:17): [True: 4, False: 0]
  ------------------
 7044|      4|                    if (*q == 'm')
  ------------------
  |  Branch (7044:25): [True: 0, False: 4]
  ------------------
 7045|      0|                    {
 7046|       |                        /* copy from mobile H to fixed isotopic H */
 7047|      0|                        pInChIFrom = pInpInChI[ALT_TAUT(bMobileH)];
  ------------------
  |  |  577|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 7048|      0|                        bIsoTo = 1;
 7049|      0|                        bIsoFrom = 0;
 7050|      0|                    }
 7051|      4|                    else
 7052|      4|                    {
 7053|      4|                        if (*q == 'M')
  ------------------
  |  Branch (7053:29): [True: 0, False: 4]
  ------------------
 7054|      0|                        {
 7055|       |                            /* copy from isotopic mobile H to fixed isotopic H */
 7056|      0|                            pInChIFrom = pInpInChI[ALT_TAUT(bMobileH)];
  ------------------
  |  |  577|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 7057|      0|                            bIsoTo = 1;
 7058|      0|                            bIsoFrom = 1;
 7059|      0|                        }
 7060|      4|                        else
 7061|      4|                        {
 7062|      4|                            if (*q == 'n')
  ------------------
  |  Branch (7062:33): [True: 0, False: 4]
  ------------------
 7063|      0|                            {
 7064|       |                                /* copy from fixed H to fixed isotopic H */
 7065|      0|                                pInChIFrom = pInChI;
 7066|      0|                                bIsoTo = 1;
 7067|      0|                                bIsoFrom = 0;
 7068|      0|                            }
 7069|      4|                            else
 7070|      4|                            {
 7071|      4|                                if (*q == 'e')
  ------------------
  |  Branch (7071:37): [True: 4, False: 0]
  ------------------
 7072|      4|                                {
 7073|       |                                    /* copy from mobile H to isotopic mobile H */
 7074|      4|                                    pInChIFrom = pInChI;
 7075|      4|                                    bIsoTo = 1;
 7076|      4|                                    bIsoFrom = -1; /* empty */
 7077|      4|                                }
 7078|      0|                                else
 7079|      0|                                {
 7080|      0|                                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7081|      0|                                }
 7082|      4|                            }
 7083|      4|                        }
 7084|      4|                    }
 7085|      4|                    break;
 7086|      0|                default:
  ------------------
  |  Branch (7086:17): [True: 0, False: 4]
  ------------------
 7087|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7088|      0|                    break;
 7089|      4|                }
 7090|      4|                break;
 7091|       |
 7092|      4|            default:
  ------------------
  |  Branch (7092:13): [True: 0, False: 18]
  ------------------
 7093|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7094|      0|                break;
 7095|     18|        }
 7096|     18|            if (ret < 0)
  ------------------
  |  Branch (7096:17): [True: 1, False: 17]
  ------------------
 7097|      1|            {
 7098|      1|                goto exit_function;
 7099|      1|            }
 7100|       |            /* copy */
 7101|     41|            for (i = 0; i < val; i++)
  ------------------
  |  Branch (7101:25): [True: 25, False: 16]
  ------------------
 7102|     25|            {
 7103|     25|#if ( FIX_GAF_2019_2==1 )
 7104|     25|                if ((iComponent + i > nNumComponents - 1) || (iComponent + i < 0))
  ------------------
  |  Branch (7104:21): [True: 0, False: 25]
  |  Branch (7104:62): [True: 0, False: 25]
  ------------------
 7105|      0|                {
 7106|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7107|      0|                    goto exit_function;
 7108|      0|                }
 7109|     25|                if (NULL == pInChIFrom || NULL == pInChIFrom + iComponent + i) /* djb-rwth: ignoring GCC warning */
  ------------------
  |  Branch (7109:21): [True: 0, False: 25]
  |  Branch (7109:43): [True: 0, False: 25]
  ------------------
 7110|      0|                {
 7111|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7112|      0|                    goto exit_function;
 7113|      0|                }
 7114|       |
 7115|     25|                if ((pInChIFrom[iComponent + i].nNumberOfAtoms <= 0) || (pInChIFrom[iComponent + i].nNumberOfAtoms > MAX_ATOMS))
  ------------------
  |  |   15|     25|#define MAX_ATOMS  32766
  ------------------
  |  Branch (7115:21): [True: 0, False: 25]
  |  Branch (7115:73): [True: 0, False: 25]
  ------------------
 7116|      0|                {
 7117|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7118|      0|                    goto exit_function;
 7119|      0|                }
 7120|     25|#endif
 7121|     25|                ret = CopySegment(pInChI + iComponent + i, pInChIFrom + iComponent + i, nCpyType, bIsoTo, bIsoFrom);
 7122|     25|                if (!ret)
  ------------------
  |  Branch (7122:21): [True: 0, False: 25]
  ------------------
 7123|      0|                {
 7124|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7125|      0|                }
 7126|     25|                if (ret < 0)
  ------------------
  |  Branch (7126:21): [True: 1, False: 24]
  ------------------
 7127|      1|                {
 7128|      1|                    goto exit_function;
 7129|      1|                }
 7130|     25|            }
 7131|     16|            mpy_component = val;
 7132|     16|            goto end_main_cycle;
 7133|     17|    }
 7134|  1.80k|        else
 7135|       |            /* regular multiplier */
 7136|  1.80k|            if ((p = strchr(pStart, '*')) && p < pEnd)
  ------------------
  |  Branch (7136:17): [True: 20, False: 1.78k]
  |  Branch (7136:46): [True: 17, False: 3]
  ------------------
 7137|     17|            {
 7138|     17|                mpy_component = (int)inchi_strtol(pStart, &q, 10);
 7139|     17|#if ( CHECK_STRTOL_ATNUMB==1 )
 7140|     17|                if (mpy_component > MAX_ATOMS || mpy_component < 0)
  ------------------
  |  |   15|     34|#define MAX_ATOMS  32766
  ------------------
  |  Branch (7140:21): [True: 3, False: 14]
  |  Branch (7140:50): [True: 0, False: 14]
  ------------------
 7141|      3|                {
 7142|      3|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      3|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7143|      3|                    goto exit_function;
 7144|      3|                }
 7145|     14|#endif
 7146|     14|                if (p != q)
  ------------------
  |  Branch (7146:21): [True: 1, False: 13]
  ------------------
 7147|      1|                {
 7148|      1|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7149|      1|                    goto exit_function;
 7150|      1|                }
 7151|       |
 7152|     13|                p++; /* move to the 1st character of the component */
 7153|     13|            }
 7154|  1.79k|            else
 7155|  1.79k|            {
 7156|  1.79k|                mpy_component = 1;
 7157|  1.79k|                p = pStart;
 7158|  1.79k|            }
 7159|  1.80k|#if (FIX_DALKE_BUGS == 1)
 7160|  1.80k|        if (iComponent + mpy_component > nNumComponents)
  ------------------
  |  Branch (7160:13): [True: 2, False: 1.80k]
  ------------------
 7161|      2|        {
 7162|      2|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7163|      2|            goto exit_function;
 7164|      2|        }
 7165|  1.80k|#endif
 7166|  1.80k|        pStart = p;
 7167|  1.80k|        if (p < pEnd && *pbAbc == -1)
  ------------------
  |  Branch (7167:13): [True: 1.15k, False: 647]
  |  Branch (7167:25): [True: 0, False: 1.15k]
  ------------------
 7168|      0|        {
 7169|       |            /* check if compressed InChI */
 7170|      0|            *pbAbc = isupper(UCINT * p) ? 1 : 0;
  ------------------
  |  Branch (7170:22): [True: 0, False: 0]
  ------------------
 7171|      0|        }
 7172|  1.80k|        base = (*pbAbc == 1) ? ALPHA_BASE : 10;
  ------------------
  |  |  170|      0|#define ALPHA_BASE 27
  ------------------
  |  Branch (7172:16): [True: 0, False: 1.80k]
  ------------------
 7173|  1.80k|        if (*pbAbc == 1)
  ------------------
  |  Branch (7173:13): [True: 0, False: 1.80k]
  ------------------
 7174|      0|        {
 7175|       |            /* process the componnt: at1-at2p,at1-at2p,... */
 7176|       |            /* pass 1: find number of stereobonds */
 7177|      0|            for (p = pStart, iBond = 0; p < pEnd; iBond++)
  ------------------
  |  Branch (7177:41): [True: 0, False: 0]
  ------------------
 7178|      0|            {
 7179|       |                /* atoms 1, 2, and parity */
 7180|      0|                if ((nAtom1 = (AT_NUMB)inchi_strtol(p, &p, base)) &&
  ------------------
  |  Branch (7180:21): [True: 0, False: 0]
  ------------------
 7181|      0|                    (nAtom2 = (AT_NUMB)inchi_strtol(p, &p, base)) &&
  ------------------
  |  Branch (7181:21): [True: 0, False: 0]
  ------------------
 7182|      0|                    (bondParity = (int)inchi_strtol(p, &p, 10),
  ------------------
  |  Branch (7182:21): [True: 0, False: 0]
  ------------------
 7183|      0|                        AB_MIN_KNOWN_PARITY <= bondParity && bondParity <= AB_MAX_KNOWN_PARITY))
  ------------------
  |  |  231|      0|#define AB_MIN_KNOWN_PARITY        1
  ------------------
                                      AB_MIN_KNOWN_PARITY <= bondParity && bondParity <= AB_MAX_KNOWN_PARITY))
  ------------------
  |  |  230|      0|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  ------------------
  |  Branch (7183:25): [True: 0, False: 0]
  |  Branch (7183:62): [True: 0, False: 0]
  ------------------
 7184|      0|                {
 7185|      0|                    ; /* okay */
 7186|      0|                }
 7187|      0|                else
 7188|      0|                {
 7189|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7190|      0|                    goto exit_function;
 7191|      0|                }
 7192|      0|                if (nAtom1 <= nAtom2 ||
  ------------------
  |  Branch (7192:21): [True: 0, False: 0]
  ------------------
 7193|      0|                    nAtom1 > pInChI[iComponent].nNumberOfAtoms)
  ------------------
  |  Branch (7193:21): [True: 0, False: 0]
  ------------------
 7194|      0|                {
 7195|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7196|      0|                    goto exit_function;
 7197|      0|                }
 7198|      0|            }
 7199|      0|        }
 7200|  1.80k|        else
 7201|  1.80k|        {
 7202|       |            /* process the componnt: at1-at2p,at1-at2p,... */
 7203|       |            /* pass 1: find number of stereobonds */
 7204|  3.40k|            for (p = pStart, iBond = 0; p < pEnd; iBond++, p += (*p == ','))
  ------------------
  |  Branch (7204:41): [True: 1.68k, False: 1.72k]
  ------------------
 7205|  1.68k|            {
 7206|  1.68k|                nAtom1 = (AT_NUMB)inchi_strtol(p, &q, 10);
 7207|  1.68k|#if ( CHECK_STRTOL_ATNUMB==1 )
 7208|  1.68k|                if (nAtom1 > MAX_ATOMS || nAtom1 < 0)
  ------------------
  |  |   15|  3.36k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (7208:21): [True: 4, False: 1.67k]
  |  Branch (7208:43): [True: 0, False: 1.67k]
  ------------------
 7209|      4|                {
 7210|      4|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      4|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7211|      4|                    goto exit_function;
 7212|      4|                }
 7213|  1.67k|#endif
 7214|  1.67k|                if (*q != '-')
  ------------------
  |  Branch (7214:21): [True: 50, False: 1.62k]
  ------------------
 7215|     50|                {
 7216|     50|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     50|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7217|     50|                    goto exit_function;
 7218|     50|                }
 7219|  1.62k|                p = q + 1;
 7220|  1.62k|                nAtom2 = (AT_NUMB)inchi_strtol(p, &q, 10);
 7221|  1.62k|#if ( CHECK_STRTOL_ATNUMB==1 )
 7222|  1.62k|                if (nAtom2 > MAX_ATOMS || nAtom2 < 0)
  ------------------
  |  |   15|  3.25k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (7222:21): [True: 3, False: 1.62k]
  |  Branch (7222:43): [True: 0, False: 1.62k]
  ------------------
 7223|      3|                {
 7224|      3|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      3|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7225|      3|                    goto exit_function;
 7226|      3|                }
 7227|  1.62k|#endif
 7228|  1.62k|                if (!nAtom1 || !nAtom2 ||
  ------------------
  |  Branch (7228:21): [True: 0, False: 1.62k]
  |  Branch (7228:32): [True: 0, False: 1.62k]
  ------------------
 7229|  1.62k|                    nAtom1 <= nAtom2 ||
  ------------------
  |  Branch (7229:21): [True: 4, False: 1.62k]
  ------------------
 7230|  1.62k|                    nAtom1 > pInChI[iComponent].nNumberOfAtoms ||
  ------------------
  |  Branch (7230:21): [True: 15, False: 1.60k]
  ------------------
 7231|  1.60k|                    !(r = strchr((char*)parity_type, *q))) /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (7231:21): [True: 2, False: 1.60k]
  ------------------
 7232|     21|                {
 7233|     21|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     21|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7234|     21|                    goto exit_function;
 7235|     21|                }
 7236|  1.60k|                p = q + 1;
 7237|  1.60k|            }
 7238|  1.80k|        }
 7239|       |
 7240|  1.72k|        if (p != pEnd)
  ------------------
  |  Branch (7240:13): [True: 1, False: 1.72k]
  ------------------
 7241|      1|        {
 7242|      1|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7243|      1|            goto exit_function;
 7244|      1|        }
 7245|  1.72k|        len = iBond;
 7246|       |
 7247|  1.72k|#if ( FIX_GAF_2019_2==1 )
 7248|  1.72k|        if ((iComponent > nNumComponents - 1) || (iComponent < 0))
  ------------------
  |  Branch (7248:13): [True: 2, False: 1.72k]
  |  Branch (7248:50): [True: 0, False: 1.72k]
  ------------------
 7249|      2|        {
 7250|      2|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7251|      2|            goto exit_function;
 7252|      2|        }
 7253|  1.72k|        if (pInChI[iComponent].nNumberOfAtoms <= 0 || pInChI[iComponent].nNumberOfAtoms > MAX_ATOMS)
  ------------------
  |  |   15|  1.72k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (7253:13): [True: 0, False: 1.72k]
  |  Branch (7253:55): [True: 0, False: 1.72k]
  ------------------
 7254|      0|        {
 7255|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7256|      0|            goto exit_function;
 7257|      0|        }
 7258|  1.72k|#endif
 7259|       |
 7260|       |        /* memory allocation */
 7261|  1.72k|        pStereo = bIso ? &pInChI[iComponent].StereoIsotopic : &pInChI[iComponent].Stereo;
  ------------------
  |  Branch (7261:19): [True: 124, False: 1.59k]
  ------------------
 7262|  1.72k|        if (!*pStereo)
  ------------------
  |  Branch (7262:13): [True: 1.71k, False: 4]
  ------------------
 7263|  1.71k|        {
 7264|  1.71k|            if (!(*pStereo = (INChI_Stereo*)inchi_calloc(1, sizeof(**pStereo))))
  ------------------
  |  | 1146|  1.71k|#define inchi_calloc   calloc
  ------------------
  |  Branch (7264:17): [True: 0, False: 1.71k]
  ------------------
 7265|      0|            {
 7266|      0|                ret = RI_ERR_ALLOC; /* memory allocation failed */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7267|      0|                goto exit_function;
 7268|      0|            }
 7269|  1.71k|        }
 7270|  1.72k|        if (pStereo[0]->b_parity || pStereo[0]->nNumberOfStereoBonds ||
  ------------------
  |  Branch (7270:13): [True: 0, False: 1.72k]
  |  Branch (7270:37): [True: 0, False: 1.72k]
  ------------------
 7271|  1.72k|            pStereo[0]->nBondAtom1 || pStereo[0]->nBondAtom2)
  ------------------
  |  Branch (7271:13): [True: 0, False: 1.72k]
  |  Branch (7271:39): [True: 0, False: 1.72k]
  ------------------
 7272|      0|        {
 7273|      0|            ret = RI_ERR_SYNTAX; /* syntax error: bonds have already been allocated */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7274|      0|            goto exit_function;
 7275|      0|        }
 7276|       |        /* allocate sp2 stereo */
 7277|  1.72k|        len_limit = len + 1;
 7278|  1.72k|        if (!(pStereo[0]->b_parity = (S_CHAR*)inchi_calloc((long long)len + 1, sizeof(pStereo[0]->b_parity[0]))) ||
  ------------------
  |  | 1146|  1.72k|#define inchi_calloc   calloc
  ------------------
  |  Branch (7278:13): [True: 0, False: 1.72k]
  ------------------
 7279|  1.72k|            !(pStereo[0]->nBondAtom1 = (AT_NUMB*)inchi_calloc((long long)len + 1, sizeof(pStereo[0]->nBondAtom1[0]))) ||
  ------------------
  |  | 1146|  1.72k|#define inchi_calloc   calloc
  ------------------
  |  Branch (7279:13): [True: 0, False: 1.72k]
  ------------------
 7280|  1.72k|            !(pStereo[0]->nBondAtom2 = (AT_NUMB*)inchi_calloc((long long)len + 1, sizeof(pStereo[0]->nBondAtom2[0])))) /* djb-rwth: cast operators added */
  ------------------
  |  | 1146|  1.72k|#define inchi_calloc   calloc
  ------------------
  |  Branch (7280:13): [True: 0, False: 1.72k]
  ------------------
 7281|      0|        {
 7282|       |            /* cleanup */
 7283|      0|            if (pStereo[0]->b_parity)
  ------------------
  |  Branch (7283:17): [True: 0, False: 0]
  ------------------
 7284|      0|            {
 7285|      0|                INCHI_HEAPCHK
 7286|      0|                    inchi_free(pStereo[0]->b_parity);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 7287|      0|                pStereo[0]->b_parity = NULL;
 7288|      0|            }
 7289|      0|            if (pStereo[0]->nBondAtom1)
  ------------------
  |  Branch (7289:17): [True: 0, False: 0]
  ------------------
 7290|      0|            {
 7291|      0|                INCHI_HEAPCHK
 7292|      0|                    inchi_free(pStereo[0]->nBondAtom1);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 7293|      0|                pStereo[0]->nBondAtom1 = NULL;
 7294|      0|            }
 7295|      0|            if (pStereo[0]->nBondAtom2)
  ------------------
  |  Branch (7295:17): [True: 0, False: 0]
  ------------------
 7296|      0|            {
 7297|      0|                INCHI_HEAPCHK
 7298|      0|                    inchi_free(pStereo[0]->nBondAtom2);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 7299|      0|                pStereo[0]->nBondAtom2 = NULL;
 7300|      0|            }
 7301|      0|            INCHI_HEAPCHK
 7302|      0|                ret = RI_ERR_ALLOC; /* memory allocation failed */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7303|      0|            goto exit_function;
 7304|      0|        }
 7305|       |
 7306|       |        /* pass 2: store stereobonds */
 7307|  1.72k|        if (*pbAbc == 1)
  ------------------
  |  Branch (7307:13): [True: 0, False: 1.72k]
  ------------------
 7308|      0|        {
 7309|      0|            for (p = pStart, iBond = 0; p < pEnd; iBond++)
  ------------------
  |  Branch (7309:41): [True: 0, False: 0]
  ------------------
 7310|      0|            {
 7311|      0|                if ((nAtom1 = (AT_NUMB)inchi_strtol(p, &p, base)) &&
  ------------------
  |  Branch (7311:21): [True: 0, False: 0]
  ------------------
 7312|      0|                    (nAtom2 = (AT_NUMB)inchi_strtol(p, &p, base)) &&
  ------------------
  |  Branch (7312:21): [True: 0, False: 0]
  ------------------
 7313|      0|                    (bondParity = (int)inchi_strtol(p, &p, 10),
  ------------------
  |  Branch (7313:21): [True: 0, False: 0]
  ------------------
 7314|      0|                        AB_MIN_KNOWN_PARITY <= bondParity && bondParity <= AB_MAX_KNOWN_PARITY))
  ------------------
  |  |  231|      0|#define AB_MIN_KNOWN_PARITY        1
  ------------------
                                      AB_MIN_KNOWN_PARITY <= bondParity && bondParity <= AB_MAX_KNOWN_PARITY))
  ------------------
  |  |  230|      0|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  ------------------
  |  Branch (7314:25): [True: 0, False: 0]
  |  Branch (7314:62): [True: 0, False: 0]
  ------------------
 7315|      0|                {
 7316|      0|                    ; /* okay */
 7317|      0|                }
 7318|      0|                else
 7319|      0|                {
 7320|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7321|      0|                    goto exit_function;
 7322|      0|                }
 7323|      0|                pStereo[0]->b_parity[iBond] = bondParity;
 7324|      0|                pStereo[0]->nBondAtom1[iBond] = nAtom1;
 7325|      0|                pStereo[0]->nBondAtom2[iBond] = nAtom2;
 7326|       |
 7327|      0|                if (iBond &&
  ------------------
  |  Branch (7327:21): [True: 0, False: 0]
  ------------------
 7328|      0|                    !(pStereo[0]->nBondAtom1[iBond - 1] < nAtom1 ||
  ------------------
  |  Branch (7328:23): [True: 0, False: 0]
  ------------------
 7329|      0|                        (pStereo[0]->nBondAtom1[iBond - 1] == nAtom1 &&
  ------------------
  |  Branch (7329:26): [True: 0, False: 0]
  ------------------
 7330|      0|                            pStereo[0]->nBondAtom2[iBond - 1] < nAtom2))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (7330:29): [True: 0, False: 0]
  ------------------
 7331|      0|                {
 7332|      0|                    ret = RI_ERR_SYNTAX; /* syntax error: wrong bond order */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7333|      0|                    goto exit_function;
 7334|      0|                }
 7335|      0|            }
 7336|      0|        }
 7337|  1.72k|        else
 7338|  1.72k|        {
 7339|  3.29k|            for (p = pStart, iBond = 0; p < pEnd; iBond++, p += (*p == ','))
  ------------------
  |  Branch (7339:41): [True: 1.57k, False: 1.72k]
  ------------------
 7340|  1.57k|            {
 7341|  1.57k|                nAtom1 = (AT_NUMB)inchi_strtol(p, &q, 10);
 7342|  1.57k|#if ( CHECK_STRTOL_ATNUMB==1 )
 7343|  1.57k|                if (nAtom1 > MAX_ATOMS || nAtom1 < 0)
  ------------------
  |  |   15|  3.15k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (7343:21): [True: 0, False: 1.57k]
  |  Branch (7343:43): [True: 0, False: 1.57k]
  ------------------
 7344|      0|                {
 7345|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7346|      0|                    goto exit_function;
 7347|      0|                }
 7348|  1.57k|#endif
 7349|  1.57k|                if (*q != '-')
  ------------------
  |  Branch (7349:21): [True: 0, False: 1.57k]
  ------------------
 7350|      0|                {
 7351|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7352|      0|                    goto exit_function;
 7353|      0|                }
 7354|  1.57k|                p = q + 1;
 7355|  1.57k|                nAtom2 = (AT_NUMB)inchi_strtol(p, &q, 10);
 7356|  1.57k|#if ( CHECK_STRTOL_ATNUMB==1 )
 7357|  1.57k|                if (nAtom2 > MAX_ATOMS || nAtom2 < 0)
  ------------------
  |  |   15|  3.15k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (7357:21): [True: 0, False: 1.57k]
  |  Branch (7357:43): [True: 0, False: 1.57k]
  ------------------
 7358|      0|                {
 7359|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7360|      0|                    goto exit_function;
 7361|      0|                }
 7362|  1.57k|#endif
 7363|  1.57k|                if (!(r = strchr((char*)parity_type, *q)))
  ------------------
  |  Branch (7363:21): [True: 0, False: 1.57k]
  ------------------
 7364|      0|                {
 7365|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7366|      0|                    goto exit_function;
 7367|      0|                }
 7368|  1.57k|                p = q + 1;
 7369|  1.57k|                bondParity = (int)(r - parity_type) + 1;
 7370|       |                /* djb-rwth: preventing buffer overrun */
 7371|  1.57k|                if (iBond < len_limit)
  ------------------
  |  Branch (7371:21): [True: 1.57k, False: 0]
  ------------------
 7372|  1.57k|                {
 7373|  1.57k|                    pStereo[0]->b_parity[iBond] = bondParity;
 7374|  1.57k|                    pStereo[0]->nBondAtom1[iBond] = nAtom1;
 7375|  1.57k|                    pStereo[0]->nBondAtom2[iBond] = nAtom2;
 7376|  1.57k|                }
 7377|      0|                else
 7378|      0|                {
 7379|      0|                    ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 7380|      0|                    goto exit_function;
 7381|      0|                }
 7382|       |
 7383|  1.57k|                if (iBond &&
  ------------------
  |  Branch (7383:21): [True: 500, False: 1.07k]
  ------------------
 7384|    500|                    !(pStereo[0]->nBondAtom1[iBond - 1] < nAtom1 ||
  ------------------
  |  Branch (7384:23): [True: 373, False: 127]
  ------------------
 7385|    127|                        (pStereo[0]->nBondAtom1[iBond - 1] == nAtom1 &&
  ------------------
  |  Branch (7385:26): [True: 126, False: 1]
  ------------------
 7386|    126|                            pStereo[0]->nBondAtom2[iBond - 1] < nAtom2))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (7386:29): [True: 125, False: 1]
  ------------------
 7387|      2|                {
 7388|      2|                    ret = RI_ERR_SYNTAX; /* syntax error: wrong bond order */
  ------------------
  |  |   16|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7389|      2|                    goto exit_function;
 7390|      2|                }
 7391|  1.57k|            }
 7392|  1.72k|        }
 7393|  1.72k|        pStereo[0]->nNumberOfStereoBonds = iBond;
 7394|       |
 7395|  1.72k|        if (p != pEnd)
  ------------------
  |  Branch (7395:13): [True: 0, False: 1.72k]
  ------------------
 7396|      0|        {
 7397|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7398|      0|            goto exit_function;
 7399|      0|        }
 7400|       |
 7401|       |        /* multiplier */
 7402|  1.72k|        for (i = 1; i < mpy_component; i++)
  ------------------
  |  Branch (7402:21): [True: 8, False: 1.72k]
  ------------------
 7403|      8|        {
 7404|      8|            ret = CopySegment(pInChI + iComponent + i, pInChI + iComponent, nCpyType, bIso, bIso);
 7405|      8|            if (ret < 0)
  ------------------
  |  Branch (7405:17): [True: 0, False: 8]
  ------------------
 7406|      0|            {
 7407|      0|                goto exit_function;
 7408|      0|            }
 7409|      8|        }
 7410|       |
 7411|  1.73k|    end_main_cycle:
 7412|  1.73k|        iComponent += mpy_component;
 7413|  1.73k|        if (*pEnd)
  ------------------
  |  Branch (7413:13): [True: 619, False: 1.11k]
  ------------------
 7414|    619|        {
 7415|    619|            pStart = pEnd + 1;
 7416|    619|            continue;
 7417|    619|        }
 7418|  1.11k|        else
 7419|  1.11k|        {
 7420|  1.11k|            break;
 7421|  1.11k|        }
 7422|  1.73k|}
 7423|  1.11k|    if (nNumComponents != iComponent)
  ------------------
  |  Branch (7423:9): [True: 2, False: 1.11k]
  ------------------
 7424|      2|    {
 7425|      2|        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7426|      2|        goto exit_function;
 7427|      2|    }
 7428|  1.11k|    ret = iComponent + 1;
 7429|       |
 7430|  1.38k|exit_function:
 7431|       |
 7432|  1.38k|    return ret;
 7433|  1.11k|    }
ichiread.c:ParseSegmentSp3:
 6619|  6.90k|{
 6620|       |    /* Pass 1: count bonds and find actual numbers of  atom */
 6621|  6.90k|    const char mult_type[] = "mnMNe";
 6622|  6.90k|    const char parity_type[] = "-+u?";
 6623|  6.90k|    const char* p, * q, * t, * pStart, * pEnd, * r;
 6624|  6.90k|    AT_NUMB nAtom1;
 6625|  6.90k|    int mpy_component = 0, val;
 6626|  6.90k|    int nNumComponents, iComponent, len, iAtom;
 6627|  6.90k|    int atomParity;
 6628|  6.90k|    int ret = 0, retf = 0;
 6629|  6.90k|    int base = 10;
 6630|  6.90k|    int nCpyType = CPY_SP3;
 6631|  6.90k|    int bIso = (state == IST_MOBILE_H_ISO_SP3 || state == IST_FIXED_H_ISO_SP3);
  ------------------
  |  Branch (6631:17): [True: 413, False: 6.49k]
  |  Branch (6631:50): [True: 257, False: 6.23k]
  ------------------
 6632|  6.90k|    INChI* pInChI = pInpInChI[bMobileH];
 6633|  6.90k|    INChI_Stereo** pStereo = NULL;
 6634|  6.90k|    int if_cnd = 1; /* djb-rwth: needed for some if condition restructuring */
 6635|       |
 6636|  6.90k|    if (!bIso && state != IST_MOBILE_H_SP3 && state != IST_FIXED_H_SP3)
  ------------------
  |  Branch (6636:9): [True: 6.23k, False: 670]
  |  Branch (6636:18): [True: 932, False: 5.30k]
  |  Branch (6636:47): [True: 0, False: 932]
  ------------------
 6637|      0|    {
 6638|      0|        return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 6639|      0|    }
 6640|  6.90k|    if (str[0] != 't')
  ------------------
  |  Branch (6640:9): [True: 5.25k, False: 1.65k]
  ------------------
 6641|  5.25k|    {
 6642|  5.25k|        return 0; /* RI_ERR_EOF - ? */
 6643|  5.25k|    }
 6644|       |
 6645|  1.65k|    pStart = (char*)str + 1;
 6646|  1.65k|    iComponent = 0;
 6647|  1.65k|    nNumComponents = ppnNumComponents[bMobileH];
 6648|       |
 6649|       |    /* Pass 1: create empty segment and exit */
 6650|  1.65k|    if (!*pStart)
  ------------------
  |  Branch (6650:9): [True: 233, False: 1.41k]
  ------------------
 6651|    233|    {
 6652|    233|        ret = SegmentSp3CreateEmpty(str, bMobileH, pInpInChI, nNumComponents, state, pbAbc);
 6653|    233|        goto exit_function;
 6654|    233|    }
 6655|       |
 6656|       |    /* Cycle over components */
 6657|  35.7k|    while (1)
  ------------------
  |  Branch (6657:12): [True: 35.7k, Folded]
  ------------------
 6658|  35.7k|    {
 6659|  35.7k|        if (!(pEnd = strchr(pStart, ';')))
  ------------------
  |  Branch (6659:13): [True: 1.39k, False: 34.3k]
  ------------------
 6660|  1.39k|        {
 6661|  1.39k|            pEnd = pStart + strlen(pStart);
 6662|  1.39k|        }
 6663|       |
 6664|       |        /* djb-rwth: condition for if block had to be rewritten */
 6665|  35.7k|        if ((int)inchi_strtol(pStart, &q, 10) > 0)
  ------------------
  |  Branch (6665:13): [True: 1.48k, False: 34.2k]
  ------------------
 6666|  1.48k|        {
 6667|  1.48k|            val = (int)inchi_strtol(pStart, &q, 10);
 6668|  1.48k|            if_cnd = isdigit(*pStart);
 6669|       |
 6670|  1.48k|        }
 6671|  34.2k|        else
 6672|  34.2k|        {
 6673|  34.2k|            val = 1;
 6674|  34.2k|            q = pStart;
 6675|  34.2k|            if_cnd = 1;
 6676|  34.2k|        }
 6677|       |
 6678|       |        /* Abbreviation? */
 6679|  35.7k|        if (if_cnd && (t = strchr((char*)mult_type, *q)) && q + 1 == pEnd) /* djb-rwth: if_cnd applied; ignoring LLVM warning: variable used */
  ------------------
  |  Branch (6679:13): [True: 35.7k, False: 10]
  |  Branch (6679:23): [True: 231, False: 35.4k]
  |  Branch (6679:61): [True: 22, False: 209]
  ------------------
 6680|     22|        {
 6681|       |            /* Process abbrebiation */
 6682|     22|            retf = SegmentSp3ProcessAbbreviation(&mpy_component, iComponent, nNumComponents,
 6683|     22|                val, q, state, pbAbc, bMobileH, nCpyType,
 6684|     22|                pInChI, pInpInChI[ALT_TAUT(bMobileH)]);
  ------------------
  |  |  577|     22|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|     22|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 22]
  |  |  ------------------
  ------------------
 6685|     22|            if (retf == RI_ERR_SYNTAX)
  ------------------
  |  |   16|     22|#define RI_ERR_SYNTAX  (-2)
  ------------------
  |  Branch (6685:17): [True: 7, False: 15]
  ------------------
 6686|      7|            {
 6687|      7|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      7|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6688|      7|                goto exit_function;
 6689|      7|            }
 6690|     15|            goto end_main_cycle;
 6691|     22|        }
 6692|       |        /* Multiplier? */
 6693|  35.6k|        else if ((p = strchr(pStart, '*')) && p < pEnd)
  ------------------
  |  Branch (6693:18): [True: 124, False: 35.5k]
  |  Branch (6693:47): [True: 105, False: 19]
  ------------------
 6694|    105|        {
 6695|       |            /* Process regular multiplier */
 6696|    105|            mpy_component = (int)inchi_strtol(pStart, &q, 10);
 6697|    105|            if (p != q)
  ------------------
  |  Branch (6697:17): [True: 2, False: 103]
  ------------------
 6698|      2|            {
 6699|      2|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6700|      2|                goto exit_function;
 6701|      2|            }
 6702|    103|            p++; /* move to the 1st character of the component */
 6703|    103|        }
 6704|  35.5k|        else
 6705|  35.5k|        {
 6706|       |            /* Just normal sequence of centers/configs, prepare to read */
 6707|  35.5k|            mpy_component = 1;
 6708|  35.5k|            p = pStart;
 6709|  35.5k|        }
 6710|  35.6k|#if (FIX_DALKE_BUGS == 1)
 6711|  35.6k|        if (iComponent + mpy_component > nNumComponents)
  ------------------
  |  Branch (6711:13): [True: 12, False: 35.6k]
  ------------------
 6712|     12|        {
 6713|     12|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     12|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6714|     12|            goto exit_function;
 6715|     12|        }
 6716|  35.6k|#endif
 6717|       |
 6718|  35.6k|        pStart = p;
 6719|  35.6k|        if (p < pEnd && *pbAbc == -1)
  ------------------
  |  Branch (6719:13): [True: 1.40k, False: 34.2k]
  |  Branch (6719:25): [True: 0, False: 1.40k]
  ------------------
 6720|      0|        {
 6721|       |            /* check if compressed InChI */
 6722|      0|            *pbAbc = isupper(UCINT * p) ? 1 : 0;
  ------------------
  |  Branch (6722:22): [True: 0, False: 0]
  ------------------
 6723|      0|        }
 6724|  35.6k|        base = (*pbAbc == 1) ? ALPHA_BASE : 10;
  ------------------
  |  |  170|      0|#define ALPHA_BASE 27
  ------------------
  |  Branch (6724:16): [True: 0, False: 35.6k]
  ------------------
 6725|       |
 6726|       |        /* Process the component: at1p,at1p,... */
 6727|       |
 6728|       |        /* Pass 1: find number of stereoatoms len */
 6729|  35.6k|        if (*pbAbc == 1)
  ------------------
  |  Branch (6729:13): [True: 0, False: 35.6k]
  ------------------
 6730|      0|        {
 6731|      0|            for (p = pStart, iAtom = 0; p < pEnd; iAtom++)
  ------------------
  |  Branch (6731:41): [True: 0, False: 0]
  ------------------
 6732|      0|            {
 6733|      0|                if ((nAtom1 = (AT_NUMB)inchi_strtol(p, &p, base)) &&
  ------------------
  |  Branch (6733:21): [True: 0, False: 0]
  ------------------
 6734|      0|                    (atomParity = (int)inchi_strtol(p, &p, 10),
  ------------------
  |  Branch (6734:21): [True: 0, False: 0]
  ------------------
 6735|      0|                        AB_MIN_KNOWN_PARITY <= atomParity && atomParity <= AB_MAX_KNOWN_PARITY))
  ------------------
  |  |  231|      0|#define AB_MIN_KNOWN_PARITY        1
  ------------------
                                      AB_MIN_KNOWN_PARITY <= atomParity && atomParity <= AB_MAX_KNOWN_PARITY))
  ------------------
  |  |  230|      0|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  ------------------
  |  Branch (6735:25): [True: 0, False: 0]
  |  Branch (6735:62): [True: 0, False: 0]
  ------------------
 6736|      0|                {
 6737|      0|                    ; /* okay */
 6738|      0|                }
 6739|      0|                else
 6740|      0|                {
 6741|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6742|      0|                    goto exit_function;
 6743|      0|                }
 6744|      0|                if (nAtom1 > pInChI[iComponent].nNumberOfAtoms)
  ------------------
  |  Branch (6744:21): [True: 0, False: 0]
  ------------------
 6745|      0|                {
 6746|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6747|      0|                    goto exit_function;
 6748|      0|                }
 6749|      0|            }
 6750|      0|        }
 6751|  35.6k|        else
 6752|  35.6k|        {
 6753|  37.6k|            for (p = pStart, iAtom = 0; p < pEnd; iAtom++, p += (*p == ','))
  ------------------
  |  Branch (6753:41): [True: 1.95k, False: 35.6k]
  ------------------
 6754|  1.95k|            {
 6755|  1.95k|                nAtom1 = (AT_NUMB)inchi_strtol(p, &q, 10);
 6756|  1.95k|                p = q + 1;
 6757|  1.95k|                if (!nAtom1 ||
  ------------------
  |  Branch (6757:21): [True: 16, False: 1.94k]
  ------------------
 6758|  1.94k|                    nAtom1 > pInChI[iComponent].nNumberOfAtoms ||
  ------------------
  |  Branch (6758:21): [True: 15, False: 1.92k]
  ------------------
 6759|  1.92k|                    !(r = strchr((char*)parity_type, *q))) /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (6759:21): [True: 1, False: 1.92k]
  ------------------
 6760|     32|                {
 6761|     32|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     32|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6762|     32|                    goto exit_function;
 6763|     32|                }
 6764|  1.95k|            }
 6765|  35.6k|        }
 6766|  35.6k|        if (p != pEnd)
  ------------------
  |  Branch (6766:13): [True: 6, False: 35.6k]
  ------------------
 6767|      6|        {
 6768|      6|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      6|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6769|      6|            goto exit_function;
 6770|      6|        }
 6771|  35.6k|        len = iAtom;
 6772|       |        /* Found len, the number of stereo centers in /t segment for component iComponent */
 6773|       |
 6774|  35.6k|#if ( ( FIX_GAF_2019_1==1 ) || ( FIX_GAF_2019_2==1 ) )
 6775|  35.6k|        if ((iComponent > nNumComponents - 1) || (iComponent < 0))
  ------------------
  |  Branch (6775:13): [True: 0, False: 35.6k]
  |  Branch (6775:50): [True: 2, False: 35.6k]
  ------------------
 6776|      2|        {
 6777|      2|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6778|      2|            goto exit_function;
 6779|      2|        }
 6780|  35.6k|        if (pInChI[iComponent].nNumberOfAtoms <= 0 || pInChI[iComponent].nNumberOfAtoms > MAX_ATOMS)
  ------------------
  |  |   15|  35.6k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (6780:13): [True: 0, False: 35.6k]
  |  Branch (6780:55): [True: 0, False: 35.6k]
  ------------------
 6781|      0|        {
 6782|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6783|      0|            goto exit_function;
 6784|      0|        }
 6785|  35.6k|#endif
 6786|       |
 6787|       |        /* Allocate memory for pStereo */
 6788|  35.6k|        pStereo = bIso ? &pInChI[iComponent].StereoIsotopic : &pInChI[iComponent].Stereo;
  ------------------
  |  Branch (6788:19): [True: 33.9k, False: 1.73k]
  ------------------
 6789|  35.6k|        if (!*pStereo)
  ------------------
  |  Branch (6789:13): [True: 35.3k, False: 296]
  ------------------
 6790|  35.3k|        {
 6791|  35.3k|            if (!(*pStereo = (INChI_Stereo*)inchi_calloc(1, sizeof(**pStereo))))
  ------------------
  |  | 1146|  35.3k|#define inchi_calloc   calloc
  ------------------
  |  Branch (6791:17): [True: 0, False: 35.3k]
  ------------------
 6792|      0|            {
 6793|      0|                ret = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 6794|      0|                goto exit_function;
 6795|      0|            }
 6796|  35.3k|        }
 6797|  35.6k|        if (pStereo[0]->t_parity || pStereo[0]->nNumberOfStereoCenters ||
  ------------------
  |  Branch (6797:13): [True: 2, False: 35.6k]
  |  Branch (6797:37): [True: 0, False: 35.6k]
  ------------------
 6798|  35.6k|            pStereo[0]->nNumber)
  ------------------
  |  Branch (6798:13): [True: 0, False: 35.6k]
  ------------------
 6799|      2|        {
 6800|      2|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6801|      2|            goto exit_function;
 6802|      2|        }
 6803|       |        /* Allocate sp3 stereo */
 6804|  35.6k|        if (!(pStereo[0]->t_parity = (S_CHAR*)inchi_calloc((long long)len + 1, sizeof(pStereo[0]->b_parity[0]))) ||
  ------------------
  |  | 1146|  35.6k|#define inchi_calloc   calloc
  ------------------
  |  Branch (6804:13): [True: 0, False: 35.6k]
  ------------------
 6805|  35.6k|            !(pStereo[0]->nNumber = (AT_NUMB*)inchi_calloc((long long)len + 1, sizeof(pStereo[0]->nNumber[0])))) /* djb-rwth: cast operators added */
  ------------------
  |  | 1146|  35.6k|#define inchi_calloc   calloc
  ------------------
  |  Branch (6805:13): [True: 0, False: 35.6k]
  ------------------
 6806|      0|        {
 6807|       |            /* cleanup */
 6808|      0|            if (pStereo[0]->t_parity)
  ------------------
  |  Branch (6808:17): [True: 0, False: 0]
  ------------------
 6809|      0|            {
 6810|      0|                INCHI_HEAPCHK
 6811|      0|                    inchi_free(pStereo[0]->t_parity);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6812|      0|                pStereo[0]->t_parity = NULL;
 6813|      0|            }
 6814|      0|            if (pStereo[0]->nNumber)
  ------------------
  |  Branch (6814:17): [True: 0, False: 0]
  ------------------
 6815|      0|            {
 6816|      0|                INCHI_HEAPCHK
 6817|      0|                    inchi_free(pStereo[0]->nNumber);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6818|      0|                pStereo[0]->nNumber = NULL;
 6819|      0|            }
 6820|      0|            ret = RI_ERR_ALLOC; /* memory allocation failed */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 6821|      0|            goto exit_function;
 6822|      0|        }
 6823|       |
 6824|       |
 6825|       |        /* Store stereocenters (pass 2) */
 6826|  35.6k|        retf = SegmentSp3StoreStereoCenters(pbAbc, pStart, pEnd, pInChI[iComponent].nNumberOfAtoms, pStereo[0]);
 6827|  35.6k|        if (retf == RI_ERR_SYNTAX)
  ------------------
  |  |   16|  35.6k|#define RI_ERR_SYNTAX  (-2)
  ------------------
  |  Branch (6827:13): [True: 4, False: 35.6k]
  ------------------
 6828|      4|        {
 6829|      4|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      4|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6830|      4|            goto exit_function;
 6831|      4|        }
 6832|       |
 6833|       |        /* Treat multiplier-covered components */
 6834|  35.6k|        retf = SegmentSp3CopyMultiplierCovered(mpy_component, iComponent, pInChI, bIso, nCpyType);
 6835|  35.6k|        if (retf == RI_ERR_SYNTAX)
  ------------------
  |  |   16|  35.6k|#define RI_ERR_SYNTAX  (-2)
  ------------------
  |  Branch (6835:13): [True: 0, False: 35.6k]
  ------------------
 6836|      0|        {
 6837|      0|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6838|      0|            goto exit_function;
 6839|      0|        }
 6840|       |
 6841|  35.6k|    end_main_cycle:
 6842|  35.6k|        iComponent += mpy_component;
 6843|  35.6k|        if (*pEnd)
  ------------------
  |  Branch (6843:13): [True: 34.2k, False: 1.35k]
  ------------------
 6844|  34.2k|        {
 6845|  34.2k|            pStart = pEnd + 1;
 6846|  34.2k|            continue;
 6847|  34.2k|        }
 6848|  1.35k|        else
 6849|  1.35k|        {
 6850|  1.35k|            break;
 6851|  1.35k|        }
 6852|       |
 6853|  35.6k|    } /* Cycle over components */
 6854|       |
 6855|  1.35k|    if (nNumComponents != iComponent)
  ------------------
  |  Branch (6855:9): [True: 11, False: 1.33k]
  ------------------
 6856|     11|    {
 6857|       |        /* Not all components treated, that's an error */
 6858|     11|        ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|     11|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6859|     11|        goto exit_function;
 6860|     11|    }
 6861|       |    /* At this moment, INChI_Stereo pInChI[k].Stereo provides stereocenter parity info for k-th component
 6862|       |        pInChI[k].Stereo.
 6863|       |                        nNumber[nNumberOfStereoCenters] cano numbers
 6864|       |                        t_parity[nNumberOfStereoCenters] tetrahedral atom parities
 6865|       |    */
 6866|       |
 6867|       |
 6868|  1.33k|    ret = iComponent + 1;
 6869|       |
 6870|  1.65k|exit_function:
 6871|       |
 6872|  1.65k|    return ret;
 6873|  1.33k|}
ichiread.c:SegmentSp3CreateEmpty:
12094|    233|{
12095|    233|    int ret = 0;
12096|    233|    int iComponent;
12097|    233|    int len0 = 0;
12098|    233|    int bIso = (state == IST_MOBILE_H_ISO_SP3 || state == IST_FIXED_H_ISO_SP3);
  ------------------
  |  Branch (12098:17): [True: 19, False: 214]
  |  Branch (12098:50): [True: 86, False: 128]
  ------------------
12099|    233|    INChI_Stereo** pStereo = NULL;
12100|    233|    INChI* pInChI = pInpInChI[bMobileH];
12101|       |
12102|  2.24k|    for (iComponent = 0; iComponent < nNumComponents; iComponent++)
  ------------------
  |  Branch (12102:26): [True: 2.01k, False: 233]
  ------------------
12103|  2.01k|    {
12104|  2.01k|        INChI* pIsoInChI = &pInChI[iComponent];
12105|  2.01k|        pStereo = bIso ? &pIsoInChI->StereoIsotopic : &pIsoInChI->Stereo;
  ------------------
  |  Branch (12105:19): [True: 159, False: 1.85k]
  ------------------
12106|  2.01k|        if (!*pStereo)
  ------------------
  |  Branch (12106:13): [True: 1.06k, False: 944]
  ------------------
12107|  1.06k|        {
12108|  1.06k|            if (!(*pStereo = (INChI_Stereo*)inchi_calloc(1, sizeof(**pStereo))))
  ------------------
  |  | 1146|  1.06k|#define inchi_calloc   calloc
  ------------------
  |  Branch (12108:17): [True: 0, False: 1.06k]
  ------------------
12109|      0|            {
12110|      0|                return RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
12111|      0|            }
12112|  1.06k|        }
12113|       |        /* allocate empty sp3 stereo */
12114|  2.01k|        if ((!pStereo[0]->b_parity &&
  ------------------
  |  Branch (12114:14): [True: 1.06k, False: 944]
  ------------------
12115|  1.06k|            !(pStereo[0]->b_parity = (S_CHAR*)inchi_calloc((long long)len0 + 1, sizeof(pStereo[0]->b_parity[0])))) ||
  ------------------
  |  | 1146|  1.06k|#define inchi_calloc   calloc
  ------------------
  |  Branch (12115:13): [True: 0, False: 1.06k]
  ------------------
12116|  2.01k|            (!pStereo[0]->nBondAtom1 &&
  ------------------
  |  Branch (12116:14): [True: 1.06k, False: 944]
  ------------------
12117|  1.06k|                !(pStereo[0]->nBondAtom1 = (AT_NUMB*)inchi_calloc((long long)len0 + 1, sizeof(pStereo[0]->nBondAtom1[0])))) ||
  ------------------
  |  | 1146|  1.06k|#define inchi_calloc   calloc
  ------------------
  |  Branch (12117:17): [True: 0, False: 1.06k]
  ------------------
12118|  2.01k|            (!pStereo[0]->nBondAtom2 &&
  ------------------
  |  Branch (12118:14): [True: 1.06k, False: 944]
  ------------------
12119|  1.06k|                !(pStereo[0]->nBondAtom2 = (AT_NUMB*)inchi_calloc((long long)len0 + 1, sizeof(pStereo[0]->nBondAtom2[0]))))) /* djb-rwth: cast operator added; addressing LLVM warnings */
  ------------------
  |  | 1146|  1.06k|#define inchi_calloc   calloc
  ------------------
  |  Branch (12119:17): [True: 0, False: 1.06k]
  ------------------
12120|      0|        {
12121|       |            /* cleanup */
12122|      0|            if (pStereo[0]->b_parity)
  ------------------
  |  Branch (12122:17): [True: 0, False: 0]
  ------------------
12123|      0|            {
12124|      0|                INCHI_HEAPCHK
12125|      0|                    inchi_free(pStereo[0]->b_parity);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
12126|      0|                pStereo[0]->b_parity = NULL;
12127|      0|            }
12128|      0|            if (pStereo[0]->nBondAtom1)
  ------------------
  |  Branch (12128:17): [True: 0, False: 0]
  ------------------
12129|      0|            {
12130|      0|                INCHI_HEAPCHK
12131|      0|                    inchi_free(pStereo[0]->nBondAtom1);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
12132|      0|                pStereo[0]->nBondAtom1 = NULL;
12133|      0|            }
12134|      0|            if (pStereo[0]->nBondAtom2)
  ------------------
  |  Branch (12134:17): [True: 0, False: 0]
  ------------------
12135|      0|            {
12136|      0|                INCHI_HEAPCHK
12137|      0|                    inchi_free(pStereo[0]->nBondAtom2);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
12138|      0|                pStereo[0]->nBondAtom2 = NULL;
12139|      0|            }
12140|      0|            return RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
12141|      0|        }
12142|  2.01k|        pStereo[0]->nCompInv2Abs = NO_VALUE_INT;
  ------------------
  |  |   23|  2.01k|#define NO_VALUE_INT    9999
  ------------------
12143|  2.01k|    }
12144|    233|    ret = nNumComponents + 1;
12145|       |
12146|    233|    return ret;
12147|    233|}
ichiread.c:SegmentSp3ProcessAbbreviation:
12278|     22|{
12279|     22|    int i, bIsoTo = -1, bIsoFrom = -1;
12280|     22|    int ret = 0;
12281|     22|    INChI* pInChIFrom = NULL;
12282|       |
12283|     22|#if (FIX_DALKE_BUGS == 1)
12284|     22|    if (iComponent + val > nNumComponents)
  ------------------
  |  Branch (12284:9): [True: 3, False: 19]
  ------------------
12285|      3|    {
12286|      3|        return RI_ERR_SYNTAX;
  ------------------
  |  |   16|      3|#define RI_ERR_SYNTAX  (-2)
  ------------------
12287|      3|    }
12288|     19|#endif
12289|       |#if (FIX_GAF_ISSUES==1)
12290|       |    if (iComponent < 0)
12291|       |    {
12292|       |        return RI_ERR_SYNTAX;
12293|       |    }
12294|       |#endif
12295|       |
12296|     19|    switch (bMobileH)
12297|     19|    {
12298|      8|    case TAUT_YES:
  ------------------
  |  |  575|      8|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (12298:5): [True: 8, False: 11]
  ------------------
12299|      8|        switch (state)
12300|      8|        {
12301|      7|        case IST_MOBILE_H_ISO_SP3:
  ------------------
  |  Branch (12301:9): [True: 7, False: 1]
  ------------------
12302|      7|            if (*q == 'm')
  ------------------
  |  Branch (12302:17): [True: 0, False: 7]
  ------------------
12303|      0|            {
12304|       |                /* copy from mobile H to isotopic mobile H */
12305|      0|                pInChIFrom = pInChI;
12306|      0|                bIsoTo = 1;
12307|      0|                bIsoFrom = 0;
12308|      0|            }
12309|      7|            else
12310|      7|            {
12311|      7|                if (*q == 'e')
  ------------------
  |  Branch (12311:21): [True: 7, False: 0]
  ------------------
12312|      7|                {
12313|       |                    /* copy from mobile H to isotopic mobile H */
12314|      7|                    pInChIFrom = pInChI;
12315|      7|                    bIsoTo = 1;
12316|      7|                    bIsoFrom = -1; /* empty */
12317|      7|                }
12318|      0|                else
12319|      0|                {
12320|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
12321|      0|                }
12322|      7|            }
12323|      7|            break;
12324|      1|        default:
  ------------------
  |  Branch (12324:9): [True: 1, False: 7]
  ------------------
12325|      1|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
12326|      1|            break;
12327|      8|        }
12328|      8|        break;
12329|     11|    case TAUT_NON:
  ------------------
  |  |  574|     11|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (12329:5): [True: 11, False: 8]
  ------------------
12330|     11|        switch (state)
12331|     11|        {
12332|      8|        case IST_FIXED_H_SP3:
  ------------------
  |  Branch (12332:9): [True: 8, False: 3]
  ------------------
12333|      8|            if (*q == 'm')
  ------------------
  |  Branch (12333:17): [True: 2, False: 6]
  ------------------
12334|      2|            {
12335|       |                /* copy from mobile H to fixed H */
12336|      2|                pInChIFrom = pInpInChI_ALT_TAUT_bMobileH;
12337|      2|                bIsoTo = 0;
12338|      2|                bIsoFrom = 0;
12339|      2|            }
12340|      6|            else
12341|      6|            {
12342|      6|                if (*q == 'e')
  ------------------
  |  Branch (12342:21): [True: 6, False: 0]
  ------------------
12343|      6|                {
12344|       |                    /* copy from mobile H to isotopic mobile H */
12345|      6|                    pInChIFrom = pInChI; /* djb-rwth: addressing coverity ID #499498 -- definitely not a copy-paste error */
12346|      6|                    bIsoTo = 1;
12347|      6|                    bIsoFrom = -1; /* empty */
12348|      6|                }
12349|      0|                else
12350|      0|                {
12351|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
12352|      0|                }
12353|      6|            }
12354|      8|            break;
12355|      3|        case IST_FIXED_H_ISO_SP3:
  ------------------
  |  Branch (12355:9): [True: 3, False: 8]
  ------------------
12356|      3|            if (*q == 'm')
  ------------------
  |  Branch (12356:17): [True: 0, False: 3]
  ------------------
12357|      0|            {
12358|       |                /* copy from mobile H to fixed isotopic H */
12359|      0|                pInChIFrom = pInpInChI_ALT_TAUT_bMobileH;
12360|      0|                bIsoTo = 1;
12361|      0|                bIsoFrom = 0;
12362|      0|            }
12363|      3|            else
12364|      3|            {
12365|      3|                if (*q == 'M')
  ------------------
  |  Branch (12365:21): [True: 3, False: 0]
  ------------------
12366|      3|                {
12367|       |                    /* copy from isotopic mobile H to fixed isotopic H */
12368|      3|                    pInChIFrom = pInpInChI_ALT_TAUT_bMobileH;
12369|      3|                    bIsoTo = 1;
12370|      3|                    bIsoFrom = 1;
12371|      3|                }
12372|      0|                else
12373|      0|                {
12374|      0|                    if (*q == 'n')
  ------------------
  |  Branch (12374:25): [True: 0, False: 0]
  ------------------
12375|      0|                    {
12376|       |                        /* copy from fixed H to fixed isotopic H */
12377|      0|                        pInChIFrom = pInChI;
12378|      0|                        bIsoTo = 1;
12379|      0|                        bIsoFrom = 0;
12380|      0|                    }
12381|      0|                    else
12382|      0|                    {
12383|      0|                        if (*q == 'e')
  ------------------
  |  Branch (12383:29): [True: 0, False: 0]
  ------------------
12384|      0|                        {
12385|       |                            /* copy from mobile H to isotopic mobile H */
12386|      0|                            pInChIFrom = pInChI;
12387|      0|                            bIsoTo = 1;
12388|      0|                            bIsoFrom = -1; /* empty */
12389|      0|                        }
12390|      0|                        else
12391|      0|                        {
12392|      0|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
12393|      0|                        }
12394|      0|                    }
12395|      0|                }
12396|      3|            }
12397|      3|            break;
12398|      0|        default:
  ------------------
  |  Branch (12398:9): [True: 0, False: 11]
  ------------------
12399|      0|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
12400|      0|            break;
12401|     11|        }
12402|     11|        break;
12403|       |
12404|     11|    default:
  ------------------
  |  Branch (12404:5): [True: 0, False: 19]
  ------------------
12405|      0|        ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
12406|      0|        break;
12407|     19|    }
12408|       |
12409|     19|    if (ret < 0)
  ------------------
  |  Branch (12409:9): [True: 1, False: 18]
  ------------------
12410|      1|    {
12411|      1|        return ret;
12412|      1|    }
12413|       |
12414|       |    /* copy */
12415|     45|    for (i = 0; i < val; i++)
  ------------------
  |  Branch (12415:17): [True: 30, False: 15]
  ------------------
12416|     30|    {
12417|       |        /* djb-rwth: fixing oss-fuzz issue #26540 */
12418|     30|        ret = CopySegment(pInChI + iComponent + i, pInChIFrom + iComponent + i, nCpyType, bIsoTo, bIsoFrom);
12419|     30|        if (!ret)
  ------------------
  |  Branch (12419:13): [True: 3, False: 27]
  ------------------
12420|      3|        {
12421|      3|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      3|#define RI_ERR_SYNTAX  (-2)
  ------------------
12422|      3|        }
12423|     30|        if (ret < 0)
  ------------------
  |  Branch (12423:13): [True: 3, False: 27]
  ------------------
12424|      3|        {
12425|      3|            return ret;
12426|      3|        }
12427|     27|        if (bIsoFrom >= 0)
  ------------------
  |  Branch (12427:13): [True: 4, False: 23]
  ------------------
12428|      4|        {
12429|      4|            INChI_Stereo* pStereoTo = bIsoTo ? pInChI[iComponent + i].StereoIsotopic : pInChI[iComponent + i].Stereo;
  ------------------
  |  Branch (12429:39): [True: 0, False: 4]
  ------------------
12430|      4|            if (pStereoTo)
  ------------------
  |  Branch (12430:17): [True: 4, False: 0]
  ------------------
12431|      4|            {
12432|      4|                pStereoTo->nCompInv2Abs = NO_VALUE_INT; /* in case there in no /m segment after this */
  ------------------
  |  |   23|      4|#define NO_VALUE_INT    9999
  ------------------
12433|      4|            }
12434|      4|        }
12435|     27|    }
12436|       |
12437|     15|    *mpy_component = val;
12438|       |
12439|     15|    return ret;
12440|     18|}
ichiread.c:SegmentSp3StoreStereoCenters:
12156|  35.6k|{
12157|  35.6k|    const char parity_type[] = "-+u?";
12158|  35.6k|    const char* p, * q, * r;
12159|  35.6k|    AT_NUMB nAtom1;
12160|  35.6k|    int iAtom;
12161|  35.6k|    int atomParity;
12162|  35.6k|    int base = 10;
12163|       |
12164|  35.6k|    if (*pbAbc == 1)
  ------------------
  |  Branch (12164:9): [True: 0, False: 35.6k]
  ------------------
12165|      0|    {
12166|      0|        for (p = (char*)pStart, iAtom = 0; p < pEnd; iAtom++)
  ------------------
  |  Branch (12166:44): [True: 0, False: 0]
  ------------------
12167|      0|        {
12168|      0|            if ((nAtom1 = (AT_NUMB)inchi_strtol(p, &p, base)) &&
  ------------------
  |  Branch (12168:17): [True: 0, False: 0]
  ------------------
12169|      0|                (atomParity = (int)inchi_strtol(p, &p, 10),
  ------------------
  |  Branch (12169:17): [True: 0, False: 0]
  ------------------
12170|      0|                    AB_MIN_KNOWN_PARITY <= atomParity && atomParity <= AB_MAX_KNOWN_PARITY))
  ------------------
  |  |  231|      0|#define AB_MIN_KNOWN_PARITY        1
  ------------------
                                  AB_MIN_KNOWN_PARITY <= atomParity && atomParity <= AB_MAX_KNOWN_PARITY))
  ------------------
  |  |  230|      0|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  ------------------
  |  Branch (12170:21): [True: 0, False: 0]
  |  Branch (12170:58): [True: 0, False: 0]
  ------------------
12171|      0|            {
12172|      0|                ; /* okay */
12173|      0|            }
12174|      0|            else
12175|      0|            {
12176|      0|                return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
12177|      0|            }
12178|      0|            if (nAtom1 > pInChI_iComponent_nNumberOfAtoms)
  ------------------
  |  Branch (12178:17): [True: 0, False: 0]
  ------------------
12179|      0|            {
12180|      0|                return RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
12181|      0|            }
12182|      0|            PStereo_0->t_parity[iAtom] = atomParity;
12183|      0|            PStereo_0->nNumber[iAtom] = nAtom1;
12184|      0|            if (iAtom && !(PStereo_0->nNumber[iAtom - 1] < nAtom1))
  ------------------
  |  Branch (12184:17): [True: 0, False: 0]
  |  Branch (12184:26): [True: 0, False: 0]
  ------------------
12185|      0|            {
12186|      0|                return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
12187|      0|            }
12188|      0|        }
12189|      0|    }
12190|  35.6k|    else
12191|  35.6k|    {
12192|  37.4k|        for (p = (char*)pStart, iAtom = 0; p < pEnd; iAtom++, p += (*p == ','))
  ------------------
  |  Branch (12192:44): [True: 1.85k, False: 35.6k]
  ------------------
12193|  1.85k|        {
12194|  1.85k|            nAtom1 = (AT_NUMB)inchi_strtol(p, &q, 10);
12195|  1.85k|#if ( CHECK_STRTOL_ATNUMB==1 )
12196|  1.85k|            if (nAtom1 > MAX_ATOMS || nAtom1 < 0)
  ------------------
  |  |   15|  3.70k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (12196:17): [True: 0, False: 1.85k]
  |  Branch (12196:39): [True: 0, False: 1.85k]
  ------------------
12197|      0|            {
12198|      0|                return RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
12199|      0|            }
12200|  1.85k|#endif
12201|  1.85k|            if (!(r = strchr((char*)parity_type, *q)))
  ------------------
  |  Branch (12201:17): [True: 0, False: 1.85k]
  ------------------
12202|      0|            {
12203|      0|                return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
12204|      0|            }
12205|  1.85k|            p = q + 1;
12206|  1.85k|            atomParity = (int)(r - parity_type) + 1;
12207|  1.85k|            PStereo_0->t_parity[iAtom] = atomParity;
12208|  1.85k|            PStereo_0->nNumber[iAtom] = nAtom1;
12209|  1.85k|            if (iAtom && !(PStereo_0->nNumber[iAtom - 1] < nAtom1))
  ------------------
  |  Branch (12209:17): [True: 488, False: 1.36k]
  |  Branch (12209:26): [True: 4, False: 484]
  ------------------
12210|      4|            {
12211|      4|                return RI_ERR_SYNTAX;
  ------------------
  |  |   16|      4|#define RI_ERR_SYNTAX  (-2)
  ------------------
12212|      4|            }
12213|  1.85k|        }
12214|  35.6k|    }
12215|  35.6k|    PStereo_0->nNumberOfStereoCenters = iAtom;
12216|       |    /*if ( iAtom ) {*/
12217|  35.6k|    PStereo_0->nCompInv2Abs = NO_VALUE_INT; /* unknown yet */
  ------------------
  |  |   23|  35.6k|#define NO_VALUE_INT    9999
  ------------------
12218|       |
12219|  35.6k|    if (p != pEnd)
  ------------------
  |  Branch (12219:9): [True: 0, False: 35.6k]
  ------------------
12220|      0|    {
12221|      0|        return RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
12222|      0|    }
12223|       |
12224|  35.6k|    return 0;
12225|  35.6k|}
ichiread.c:SegmentSp3CopyMultiplierCovered:
12236|  35.6k|{
12237|  35.6k|    int i, ret = 0;
12238|  35.6k|    for (i = 1; i < mpy_component; i++)
  ------------------
  |  Branch (12238:17): [True: 21, False: 35.6k]
  ------------------
12239|     21|    {
12240|     21|        ret = CopySegment(pInChI + iComponent + i, pInChI + iComponent, nCpyType, bIso, bIso);
12241|     21|        if (!ret)
  ------------------
  |  Branch (12241:13): [True: 0, False: 21]
  ------------------
12242|      0|        {
12243|      0|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
12244|      0|        }
12245|     21|        if (ret < 0)
  ------------------
  |  Branch (12245:13): [True: 0, False: 21]
  ------------------
12246|      0|        {
12247|      0|            return ret;
12248|      0|        }
12249|     21|        ret = CopySegment(pInChI + iComponent + i, pInChI + iComponent, CPY_SP3_M, bIso, bIso);
12250|     21|        if (!ret)
  ------------------
  |  Branch (12250:13): [True: 0, False: 21]
  ------------------
12251|      0|        {
12252|      0|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
12253|      0|        }
12254|     21|        if (ret < 0)
  ------------------
  |  Branch (12254:13): [True: 0, False: 21]
  ------------------
12255|      0|        {
12256|      0|            return ret;
12257|      0|        }
12258|     21|    }
12259|       |
12260|  35.6k|    return ret;
12261|  35.6k|}
ichiread.c:ParseSegmentSp3m:
 6396|  6.05k|{
 6397|       |    /* Pass 1: count bonds and find actual numbers of  atom */
 6398|  6.05k|    int nNumComponents, iComponent;
 6399|  6.05k|    const char* p, * pStart, * pEnd;
 6400|  6.05k|    int  ret = 0;
 6401|  6.05k|    INChI* pInChI = pInpInChI[bMobileH];
 6402|  6.05k|    INChI_Stereo** pStereo = NULL;
 6403|       |
 6404|  6.05k|    int   bIso = (state == IST_MOBILE_H_ISO_SP3_M || state == IST_FIXED_H_ISO_SP3_M);
  ------------------
  |  Branch (6404:19): [True: 303, False: 5.75k]
  |  Branch (6404:54): [True: 232, False: 5.52k]
  ------------------
 6405|       |
 6406|  6.05k|    if (!bIso && state != IST_MOBILE_H_SP3_M && state != IST_FIXED_H_SP3_M)
  ------------------
  |  Branch (6406:9): [True: 5.52k, False: 535]
  |  Branch (6406:18): [True: 750, False: 4.77k]
  |  Branch (6406:49): [True: 0, False: 750]
  ------------------
 6407|      0|    {
 6408|      0|        return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 6409|      0|    }
 6410|  6.05k|    nNumComponents = ppnNumComponents[bMobileH];
 6411|       |
 6412|  6.05k|    if (str[0] != 'm')
  ------------------
  |  Branch (6412:9): [True: 5.86k, False: 192]
  ------------------
 6413|  5.86k|    {
 6414|       |        /* /m is missing: check whether we have to inherit /m from a preceding stereo layer */
 6415|  5.86k|        INChI_Stereo* pStereoFrom, * pStereoTo;
 6416|  5.86k|        INChI* pInChIFrom;
 6417|  5.86k|        int          bMobileHFrom = -1, bIsoFrom = -1; /* djb-rwth: removing redundant variables */
 6418|  5.86k|        if (bMobileH && !bIso)
  ------------------
  |  Branch (6418:13): [True: 4.94k, False: 917]
  |  Branch (6418:25): [True: 4.67k, False: 275]
  ------------------
 6419|  4.67k|        {
 6420|  4.67k|            return 0; /* Main non-isotopic cannot inherit: it has no preceding layer */
 6421|  4.67k|        }
 6422|  1.19k|        else
 6423|  1.19k|        {
 6424|  1.19k|            if (!bMobileH && !bIso)
  ------------------
  |  Branch (6424:17): [True: 917, False: 275]
  |  Branch (6424:30): [True: 706, False: 211]
  ------------------
 6425|    706|            {
 6426|       |                /* fixed-H non-isotopic (F) inherits from Mobile-H non-isotopic (M) */
 6427|    706|                bMobileHFrom = TAUT_YES;
  ------------------
  |  |  575|    706|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6428|    706|                bIsoFrom = 0;
 6429|    706|            }
 6430|    486|            else
 6431|    486|            {
 6432|    486|                if (bMobileH && bIso)
  ------------------
  |  Branch (6432:21): [True: 275, False: 211]
  |  Branch (6432:33): [True: 275, False: 0]
  ------------------
 6433|    275|                {
 6434|       |                    /* Mobile-H isotopic (MI) inherits from Mobile-H non-isotopic (M) */
 6435|    275|                    bMobileHFrom = TAUT_YES;
  ------------------
  |  |  575|    275|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6436|    275|                    bIsoFrom = 0;
 6437|    275|                }
 6438|    211|                else
 6439|    211|                {
 6440|    211|                    if (!bMobileH && bIso)
  ------------------
  |  Branch (6440:25): [True: 211, False: 0]
  |  Branch (6440:38): [True: 211, False: 0]
  ------------------
 6441|    211|                    {
 6442|       |                        /* Fixed-H isotopic (FI) inherits from Fixed-H non-isotopic (F) */
 6443|    211|                        bMobileHFrom = TAUT_NON;
  ------------------
  |  |  574|    211|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 6444|    211|                        bIsoFrom = 0;
 6445|       |                        /* if Sp3 is empty in F as well as in M, then inherit from MI */
 6446|    211|                        if (!bIsSp3LayerNotEmpty(pInpInChI, TAUT_NON, 0, ppnNumComponents[TAUT_NON /*bMobileH*/]) /* F */ &&
  ------------------
  |  |  574|    211|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                      if (!bIsSp3LayerNotEmpty(pInpInChI, TAUT_NON, 0, ppnNumComponents[TAUT_NON /*bMobileH*/]) /* F */ &&
  ------------------
  |  |  574|    211|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (6446:29): [True: 166, False: 45]
  ------------------
 6447|    166|                            !bIsSp3LayerNotEmpty(pInpInChI, TAUT_YES, 0, ppnNumComponents[TAUT_YES /*bMobileH*/]) /* M */)
  ------------------
  |  |  575|    166|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                          !bIsSp3LayerNotEmpty(pInpInChI, TAUT_YES, 0, ppnNumComponents[TAUT_YES /*bMobileH*/]) /* M */)
  ------------------
  |  |  575|    166|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (6447:29): [True: 163, False: 3]
  ------------------
 6448|    163|                        {
 6449|    163|                            bMobileHFrom = TAUT_YES;
  ------------------
  |  |  575|    163|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6450|    163|                            bIsoFrom = 1;
 6451|    163|                        }
 6452|    211|                    }
 6453|    211|                }
 6454|    486|            }
 6455|  1.19k|        }
 6456|  1.19k|        if (bMobileHFrom < 0 || bIsoFrom < 0) /* djb-rwth: addressing coverity ID #499556 -- check necessary due to initialisation values */
  ------------------
  |  Branch (6456:13): [True: 0, False: 1.19k]
  |  Branch (6456:33): [True: 0, False: 1.19k]
  ------------------
 6457|      0|        {
 6458|      0|            return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 6459|      0|        }
 6460|  1.19k|        if (!bIsSp3LayerNotEmpty(pInpInChI, bMobileHFrom, bIsoFrom, ppnNumComponents[/*bMobileH*/ bMobileHFrom]))
  ------------------
  |  Branch (6460:13): [True: 990, False: 202]
  ------------------
 6461|    990|        {
 6462|       |            /* nothing to copy; check whether it should have inherited from a preceding layer */
 6463|    990|            if ((!bMobileHFrom && bIsoFrom) || (bMobileHFrom && !bIsoFrom)) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (6463:18): [True: 3, False: 987]
  |  Branch (6463:35): [True: 0, False: 3]
  |  Branch (6463:49): [True: 987, False: 3]
  |  Branch (6463:65): [True: 841, False: 146]
  ------------------
 6464|    841|            {
 6465|       |                /* MI or F inherit stereo from M */
 6466|    841|                bMobileHFrom = TAUT_YES;
  ------------------
  |  |  575|    841|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6467|    841|                bIsoFrom = 0;
 6468|    841|                if (!bIsSp3LayerNotEmpty(pInpInChI, bMobileHFrom, bIsoFrom, ppnNumComponents[bMobileHFrom /*bMobileH*/]))
  ------------------
  |  Branch (6468:21): [True: 841, False: 0]
  ------------------
 6469|    841|                {
 6470|    841|                    return 0;
 6471|    841|                }
 6472|    841|            }
 6473|    149|            else
 6474|    149|            {
 6475|    149|                return 0;
 6476|    149|            }
 6477|    990|        }
 6478|    202|        nNumComponents = inchi_min(ppnNumComponents[bMobileH], ppnNumComponents[bMobileHFrom]);
  ------------------
  |  |  139|    202|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 2, False: 200]
  |  |  ------------------
  ------------------
 6479|    834|        for (iComponent = 0; iComponent < nNumComponents; iComponent++)
  ------------------
  |  Branch (6479:30): [True: 632, False: 202]
  ------------------
 6480|    632|        {
 6481|    632|            pInChIFrom = pInpInChI[bMobileHFrom] + iComponent;
 6482|    632|            pInChI = pInpInChI[bMobileH] + iComponent;
 6483|    632|            if (pInChIFrom->nNumberOfAtoms > 0 && !pInChIFrom->bDeleted &&
  ------------------
  |  Branch (6483:17): [True: 632, False: 0]
  |  Branch (6483:51): [True: 632, False: 0]
  ------------------
 6484|    632|                pInChI->nNumberOfAtoms > 0 && !pInChI->bDeleted)
  ------------------
  |  Branch (6484:17): [True: 632, False: 0]
  |  Branch (6484:47): [True: 632, False: 0]
  ------------------
 6485|    632|            {
 6486|    632|                pStereoFrom = bIsoFrom ? pInChIFrom->StereoIsotopic : pInChIFrom->Stereo;
  ------------------
  |  Branch (6486:31): [True: 167, False: 465]
  ------------------
 6487|    632|                pStereoTo = bIso ? pInChI->StereoIsotopic : pInChI->Stereo;
  ------------------
  |  Branch (6487:29): [True: 405, False: 227]
  ------------------
 6488|    632|                if (pStereoFrom && pStereoTo)
  ------------------
  |  Branch (6488:21): [True: 632, False: 0]
  |  Branch (6488:36): [True: 272, False: 360]
  ------------------
 6489|    272|                {
 6490|    272|                    pStereoTo->nCompInv2Abs = pStereoFrom->nCompInv2Abs;
 6491|       |                    /* djb-rwth: removing redundant code */
 6492|    272|                }
 6493|    632|            }
 6494|    632|        }
 6495|    202|        return 0; /* return value > 0 means the non-/m segment has been processed here */
 6496|  1.19k|    }
 6497|       |
 6498|    192|    pStart = str + 1;
 6499|    192|    iComponent = 0;
 6500|       |
 6501|       |    /*if ( !(pEnd = strchr( pStart, ';' )) )*/ /* 2007-09-25 DT */
 6502|    192|    if (!(strchr(pStart, '/'))) /* djb-rwth: removing redundant code */
  ------------------
  |  Branch (6502:9): [True: 192, False: 0]
  ------------------
 6503|    192|    {
 6504|    192|        pEnd = pStart + strlen(pStart);
 6505|    192|    }
 6506|      0|    else
 6507|      0|    {
 6508|      0|        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6509|      0|        goto exit_function;
 6510|      0|    }
 6511|    192|    p = pStart;
 6512|    192|    if (pEnd == pStart)
  ------------------
  |  Branch (6512:9): [True: 121, False: 71]
  ------------------
 6513|    121|    {
 6514|       |        /* create empty sp3 segment */
 6515|    121|        int len = 0;
 6516|  6.87k|        for (iComponent = 0; iComponent < nNumComponents; iComponent++)
  ------------------
  |  Branch (6516:30): [True: 6.75k, False: 121]
  ------------------
 6517|  6.75k|        {
 6518|  6.75k|            INChI* pIsoInChI = &pInChI[iComponent];
 6519|  6.75k|            pStereo = bIso ? &pIsoInChI->StereoIsotopic : &pIsoInChI->Stereo;
  ------------------
  |  Branch (6519:23): [True: 38, False: 6.71k]
  ------------------
 6520|  6.75k|            if (!*pStereo)
  ------------------
  |  Branch (6520:17): [True: 6.69k, False: 52]
  ------------------
 6521|  6.69k|            {
 6522|  6.69k|                if (!(*pStereo = (INChI_Stereo*)inchi_calloc(1, sizeof(**pStereo))))
  ------------------
  |  | 1146|  6.69k|#define inchi_calloc   calloc
  ------------------
  |  Branch (6522:21): [True: 0, False: 6.69k]
  ------------------
 6523|      0|                {
 6524|      0|                    ret = RI_ERR_ALLOC; /* memory allocation failed */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 6525|      0|                    goto exit_function;
 6526|      0|                }
 6527|  6.69k|            }
 6528|  6.75k|            pStereo[0]->nCompInv2Abs = NO_VALUE_INT;  /* deliberately empty */
  ------------------
  |  |   23|  6.75k|#define NO_VALUE_INT    9999
  ------------------
 6529|       |#ifdef NEVER
 6530|       |            if (pStereo[0]->nNumberOfStereoCenters)
 6531|       |            {
 6532|       |                ret = RI_ERR_SYNTAX; /* syntax error */
 6533|       |                goto exit_function;
 6534|       |            }
 6535|       |#endif
 6536|       |            /* allocate empty sp3 stereo */
 6537|  6.75k|            if ((!pStereo[0]->t_parity &&
  ------------------
  |  Branch (6537:18): [True: 6.71k, False: 35]
  ------------------
 6538|  6.71k|                !(pStereo[0]->t_parity = (S_CHAR*)inchi_calloc((long long)len + 1, sizeof(pStereo[0]->b_parity[0])))) ||
  ------------------
  |  | 1146|  6.71k|#define inchi_calloc   calloc
  ------------------
  |  Branch (6538:17): [True: 0, False: 6.71k]
  ------------------
 6539|  6.75k|                (!pStereo[0]->nNumber &&
  ------------------
  |  Branch (6539:18): [True: 6.71k, False: 35]
  ------------------
 6540|  6.71k|                    !(pStereo[0]->nNumber = (AT_NUMB*)inchi_calloc((long long)len + 1, sizeof(pStereo[0]->nNumber[0]))))) /* djb-rwth: cast operators added; addressing LLVM warnings */
  ------------------
  |  | 1146|  6.71k|#define inchi_calloc   calloc
  ------------------
  |  Branch (6540:21): [True: 0, False: 6.71k]
  ------------------
 6541|      0|            {
 6542|       |                /* cleanup */
 6543|      0|                if (pStereo[0]->t_parity)
  ------------------
  |  Branch (6543:21): [True: 0, False: 0]
  ------------------
 6544|      0|                {
 6545|      0|                    INCHI_HEAPCHK
 6546|      0|                        inchi_free(pStereo[0]->t_parity);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6547|      0|                    pStereo[0]->t_parity = NULL;
 6548|      0|                }
 6549|      0|                if (pStereo[0]->nNumber)
  ------------------
  |  Branch (6549:21): [True: 0, False: 0]
  ------------------
 6550|      0|                {
 6551|      0|                    INCHI_HEAPCHK
 6552|      0|                        inchi_free(pStereo[0]->nNumber);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6553|      0|                    pStereo[0]->nNumber = NULL;
 6554|      0|                }
 6555|      0|                ret = RI_ERR_ALLOC; /* memory allocation failed */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 6556|      0|                goto exit_function;
 6557|      0|            }
 6558|  6.75k|}
 6559|    121|        ret = nNumComponents + 1;
 6560|    121|    }
 6561|     71|    else
 6562|     71|    {
 6563|    498|        while (p < pEnd && iComponent < nNumComponents)
  ------------------
  |  Branch (6563:16): [True: 440, False: 58]
  |  Branch (6563:28): [True: 434, False: 6]
  ------------------
 6564|    434|        {
 6565|       |            /* cycle over components */
 6566|    434|            pStereo = bIso ? &pInChI[iComponent].StereoIsotopic : &pInChI[iComponent].Stereo;
  ------------------
  |  Branch (6566:23): [True: 79, False: 355]
  ------------------
 6567|    434|            if (*p != '.' && !*pStereo)
  ------------------
  |  Branch (6567:17): [True: 95, False: 339]
  |  Branch (6567:30): [True: 83, False: 12]
  ------------------
 6568|     83|            {
 6569|     83|                if (!(*pStereo = (INChI_Stereo*)inchi_calloc(1, sizeof(**pStereo))))
  ------------------
  |  | 1146|     83|#define inchi_calloc   calloc
  ------------------
  |  Branch (6569:21): [True: 0, False: 83]
  ------------------
 6570|      0|                {
 6571|      0|                    ret = RI_ERR_ALLOC; /* memory allocation failed */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 6572|      0|                    goto exit_function;
 6573|      0|                }
 6574|     83|            }
 6575|    434|            switch (*p)
 6576|    434|            {
 6577|     39|            case '1':
  ------------------
  |  Branch (6577:13): [True: 39, False: 395]
  ------------------
 6578|     39|                pStereo[0]->nCompInv2Abs = -1;
 6579|     39|                break;
 6580|     49|            case '0':
  ------------------
  |  Branch (6580:13): [True: 49, False: 385]
  ------------------
 6581|     49|                pStereo[0]->nCompInv2Abs = 1;
 6582|     49|                break;
 6583|    339|            case '.':
  ------------------
  |  Branch (6583:13): [True: 339, False: 95]
  ------------------
 6584|    339|                if (*pStereo)
  ------------------
  |  Branch (6584:21): [True: 46, False: 293]
  ------------------
 6585|     46|                {
 6586|     46|                    pStereo[0]->nCompInv2Abs = 0;
 6587|     46|                }
 6588|    339|                break;
 6589|      7|            default:
  ------------------
  |  Branch (6589:13): [True: 7, False: 427]
  ------------------
 6590|      7|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      7|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6591|      7|                goto exit_function;
 6592|    434|            }
 6593|    427|            iComponent++;
 6594|    427|            p++;
 6595|    427|        }
 6596|     64|        if (p != pEnd || iComponent != nNumComponents)
  ------------------
  |  Branch (6596:13): [True: 6, False: 58]
  |  Branch (6596:26): [True: 28, False: 30]
  ------------------
 6597|     34|        {
 6598|     34|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     34|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6599|     34|            goto exit_function;
 6600|     34|        }
 6601|     30|        ret = nNumComponents + 1;
 6602|     30|    }
 6603|       |
 6604|    192|exit_function:
 6605|       |
 6606|    192|    return ret;
 6607|    192|        }
ichiread.c:bIsSp3LayerNotEmpty:
 6363|  2.41k|{
 6364|  2.41k|    INChI* pInChI;
 6365|  2.41k|    INChI_Stereo* pStereo;
 6366|  2.41k|    int           iComponent, num_not_empty = 0;
 6367|       |
 6368|  2.41k|    if (pInpInChI[bMobileH])
  ------------------
  |  Branch (6368:9): [True: 2.41k, False: 0]
  ------------------
 6369|  2.41k|    {
 6370|   178k|        for (iComponent = 0; iComponent < nNumComponents; iComponent++)
  ------------------
  |  Branch (6370:30): [True: 175k, False: 2.41k]
  ------------------
 6371|   175k|        {
 6372|   175k|            pInChI = pInpInChI[bMobileH] + iComponent;
 6373|   175k|            if (pInChI->bDeleted || !pInChI->nNumberOfAtoms)
  ------------------
  |  Branch (6373:17): [True: 46, False: 175k]
  |  Branch (6373:37): [True: 0, False: 175k]
  ------------------
 6374|     46|            {
 6375|     46|                continue;
 6376|     46|            }
 6377|   175k|            pStereo = bIso ? pInChI->StereoIsotopic : pInChI->Stereo;
  ------------------
  |  Branch (6377:23): [True: 33.5k, False: 142k]
  ------------------
 6378|   175k|            if (pStereo && pStereo->nNumberOfStereoCenters > 0 && pStereo->nNumber && pStereo->t_parity)
  ------------------
  |  Branch (6378:17): [True: 1.54k, False: 174k]
  |  Branch (6378:28): [True: 344, False: 1.19k]
  |  Branch (6378:67): [True: 344, False: 0]
  |  Branch (6378:87): [True: 344, False: 0]
  ------------------
 6379|    344|            {
 6380|    344|                num_not_empty++;
 6381|    344|            }
 6382|   175k|        }
 6383|  2.41k|    }
 6384|  2.41k|    return num_not_empty;
 6385|  2.41k|}
ichiread.c:ParseSegmentSp3s:
 6254|  5.96k|{
 6255|       |    /* Pass 1: count bonds and find actual numbers of  atom */
 6256|  5.96k|    int nNumComponents, iComponent, val;
 6257|  5.96k|    const char* p, * q, * pStart, * pEnd;
 6258|  5.96k|    int  ret = 0;
 6259|  5.96k|    INChI* pInChI = pInpInChI[bMobileH];
 6260|  5.96k|    INChI_Stereo** pStereo = NULL;
 6261|       |
 6262|  5.96k|    int   bIso = (state == IST_MOBILE_H_ISO_SP3_S || state == IST_FIXED_H_ISO_SP3_S);
  ------------------
  |  Branch (6262:19): [True: 295, False: 5.67k]
  |  Branch (6262:54): [True: 211, False: 5.46k]
  ------------------
 6263|       |
 6264|  5.96k|    if (!bIso && state != IST_MOBILE_H_SP3_S && state != IST_FIXED_H_SP3_S)
  ------------------
  |  Branch (6264:9): [True: 5.46k, False: 506]
  |  Branch (6264:18): [True: 723, False: 4.73k]
  |  Branch (6264:49): [True: 0, False: 723]
  ------------------
 6265|      0|    {
 6266|      0|        return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 6267|      0|    }
 6268|       |
 6269|  5.96k|    if (str[0] != 's')
  ------------------
  |  Branch (6269:9): [True: 5.61k, False: 356]
  ------------------
 6270|  5.61k|    {
 6271|  5.61k|        return 0;
 6272|  5.61k|    }
 6273|       |
 6274|    356|    pStart = (char*)str + 1;
 6275|       |    /* djb-rwth: removing redundant code */
 6276|    356|    nNumComponents = ppnNumComponents[bMobileH];
 6277|       |
 6278|       |    /*if ( !(pEnd = strchr( pStart, ';' )) )*/ /* 2007-09-25 DT */
 6279|    356|    if (!(strchr(pStart, '/'))) /* djb-rwth: removing redundant variables/code */
  ------------------
  |  Branch (6279:9): [True: 356, False: 0]
  ------------------
 6280|    356|    {
 6281|    356|        pEnd = pStart + strlen(pStart);
 6282|    356|    }
 6283|      0|    else
 6284|      0|    {
 6285|      0|        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6286|      0|        goto exit_function;
 6287|      0|    }
 6288|    356|    p = pStart;
 6289|    356|    if (pEnd == pStart)
  ------------------
  |  Branch (6289:9): [True: 154, False: 202]
  ------------------
 6290|    154|    {
 6291|       |        /* create empty sp3 segment */
 6292|    154|        int len = 0;
 6293|    154|        s[bMobileH][bIso] = NO_VALUE_INT; /* empty */
  ------------------
  |  |   23|    154|#define NO_VALUE_INT    9999
  ------------------
 6294|       |        /* create empty sp3 segment */
 6295|  10.3k|        for (iComponent = 0; iComponent < nNumComponents; iComponent++)
  ------------------
  |  Branch (6295:30): [True: 10.1k, False: 153]
  ------------------
 6296|  10.1k|        {
 6297|  10.1k|            pStereo = bIso ? &pInChI[iComponent].StereoIsotopic : &pInChI[iComponent].Stereo;
  ------------------
  |  Branch (6297:23): [True: 98, False: 10.0k]
  ------------------
 6298|  10.1k|            if (!*pStereo)
  ------------------
  |  Branch (6298:17): [True: 10.0k, False: 111]
  ------------------
 6299|  10.0k|            {
 6300|  10.0k|                if (!(*pStereo = (INChI_Stereo*)inchi_calloc(1, sizeof(**pStereo))))
  ------------------
  |  | 1146|  10.0k|#define inchi_calloc   calloc
  ------------------
  |  Branch (6300:21): [True: 0, False: 10.0k]
  ------------------
 6301|      0|                {
 6302|      0|                    ret = RI_ERR_ALLOC; /* memory allocation failed */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 6303|      0|                    goto exit_function;
 6304|      0|                }
 6305|  10.0k|            }
 6306|  10.1k|            pStereo[0]->nCompInv2Abs = 0;  /* deliberately empty */
 6307|       |
 6308|  10.1k|            if (pStereo[0]->nNumberOfStereoCenters)
  ------------------
  |  Branch (6308:17): [True: 1, False: 10.1k]
  ------------------
 6309|      1|            {
 6310|      1|                ret = RI_ERR_SYNTAX; /* syntax error: "/s" without a digit describes "no stereo" */
  ------------------
  |  |   16|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6311|      1|                goto exit_function;
 6312|      1|            }
 6313|       |            /* allocate empty sp3 stereo */
 6314|  10.1k|            if ((!pStereo[0]->t_parity &&
  ------------------
  |  Branch (6314:18): [True: 10.0k, False: 102]
  ------------------
 6315|  10.0k|                !(pStereo[0]->t_parity = (S_CHAR*)inchi_calloc((long long)len + 1, sizeof(pStereo[0]->b_parity[0])))) ||
  ------------------
  |  | 1146|  10.0k|#define inchi_calloc   calloc
  ------------------
  |  Branch (6315:17): [True: 0, False: 10.0k]
  ------------------
 6316|  10.1k|                (!pStereo[0]->nNumber &&
  ------------------
  |  Branch (6316:18): [True: 10.0k, False: 102]
  ------------------
 6317|  10.0k|                    !(pStereo[0]->nNumber = (AT_NUMB*)inchi_calloc((long long)len + 1, sizeof(pStereo[0]->nNumber[0]))))) /* djb-rwth: cast operators added; addressing LLVM warnings */
  ------------------
  |  | 1146|  10.0k|#define inchi_calloc   calloc
  ------------------
  |  Branch (6317:21): [True: 0, False: 10.0k]
  ------------------
 6318|      0|            {
 6319|       |                /* cleanup */
 6320|      0|                if (pStereo[0]->t_parity)
  ------------------
  |  Branch (6320:21): [True: 0, False: 0]
  ------------------
 6321|      0|                {
 6322|      0|                    INCHI_HEAPCHK
 6323|      0|                        inchi_free(pStereo[0]->t_parity);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6324|      0|                    pStereo[0]->t_parity = NULL;
 6325|      0|                }
 6326|      0|                if (pStereo[0]->nNumber)
  ------------------
  |  Branch (6326:21): [True: 0, False: 0]
  ------------------
 6327|      0|                {
 6328|      0|                    INCHI_HEAPCHK
 6329|      0|                        inchi_free(pStereo[0]->nNumber);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6330|      0|                    pStereo[0]->nNumber = NULL;
 6331|      0|                }
 6332|      0|                ret = RI_ERR_ALLOC; /* memory allocation failed */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 6333|      0|                goto exit_function;
 6334|      0|            }
 6335|  10.1k|        }
 6336|    153|        ret = nNumComponents + 1;
 6337|    153|    }
 6338|    202|    else
 6339|    202|    {
 6340|    202|        val = (int)inchi_strtol(p, &q, 10);
 6341|    202|        if (q == pEnd && 1 <= val && val <= 3)
  ------------------
  |  Branch (6341:13): [True: 200, False: 2]
  |  Branch (6341:26): [True: 190, False: 10]
  |  Branch (6341:38): [True: 178, False: 12]
  ------------------
 6342|    178|        {
 6343|    178|            s[bMobileH][bIso] = val;
 6344|    178|            ret = nNumComponents + 1;
 6345|    178|        }
 6346|     24|        else
 6347|     24|        {
 6348|     24|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     24|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6349|     24|        }
 6350|    202|    }
 6351|       |
 6352|    356|exit_function:
 6353|       |
 6354|    356|    return ret;
 6355|    356|}
ichiread.c:ParseSegmentIsoAtoms:
 5825|  1.82k|{
 5826|  1.82k|    int i, mpy_component, val;
 5827|  1.82k|    int nNumComponents, iComponent, len = 0, iAtom;
 5828|  1.82k|    int nAtom1; /* djb-rwth: fixing coverity ID #499573 */
 5829|  1.82k|    const char* p, * q, * t, * pStart, * pEnd, * r;
 5830|  1.82k|    int  ret = 0;
 5831|  1.82k|    INChI* pInChI = pInpInChI[bMobileH];
 5832|  1.82k|    INChI* pInChIFrom = NULL;
 5833|  1.82k|    INChI_IsotopicAtom** pIsotopicAtom = NULL;
 5834|  1.82k|    INChI_IsotopicAtom isoAtom;
 5835|       |
 5836|  1.82k|    const char   mult_type[] = "mnMNe";
 5837|  1.82k|    const char   parity_type[] = "-+TDH";
 5838|  1.82k|    int    bIsoFrom, nCpyType = CPY_ISO_AT;
 5839|  1.82k|    int    base = 10;
 5840|  1.82k|    int if_cnd = 1; /* djb-rwth: needed for some if condition restructuring */
 5841|       |
 5842|  1.82k|    if (str[0] != 'i')
  ------------------
  |  Branch (5842:9): [True: 0, False: 1.82k]
  ------------------
 5843|      0|    {
 5844|      0|        return 0;
 5845|      0|    }
 5846|       |
 5847|  1.82k|    pStart = (char*)str + 1;
 5848|  1.82k|    iComponent = 0;
 5849|  1.82k|    nNumComponents = ppnNumComponents[bMobileH];
 5850|       |
 5851|  1.82k|    if (!((bMobileH == TAUT_YES && state == IST_MOBILE_H_ISO_ATOMS) ||
  ------------------
  |  |  575|  3.64k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5851:12): [True: 1.38k, False: 435]
  |  Branch (5851:36): [True: 1.38k, False: 0]
  ------------------
 5852|    435|        (bMobileH == TAUT_NON && state == IST_FIXED_H_ISO_ATOMS))) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |  574|    870|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5852:10): [True: 435, False: 0]
  |  Branch (5852:34): [True: 435, False: 0]
  ------------------
 5853|      0|    {
 5854|      0|        return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5855|      0|    }
 5856|  1.82k|    if (!*pStart)
  ------------------
  |  Branch (5856:9): [True: 492, False: 1.33k]
  ------------------
 5857|    492|    {
 5858|    492|        return nNumComponents + 1; /* no isotopic atoms */
 5859|    492|    }
 5860|       |
 5861|  35.2k|    while (1)
  ------------------
  |  Branch (5861:12): [True: 35.2k, Folded]
  ------------------
 5862|  35.2k|    {
 5863|       |        /* cycle over components */
 5864|  35.2k|        if (!(pEnd = strchr(pStart, ';')))
  ------------------
  |  Branch (5864:13): [True: 1.30k, False: 33.9k]
  ------------------
 5865|  1.30k|        {
 5866|  1.30k|            pEnd = pStart + strlen(pStart);
 5867|  1.30k|        }
 5868|  35.2k|        if ((p = strchr(pStart, '*')) && p < pEnd)
  ------------------
  |  Branch (5868:13): [True: 153, False: 35.1k]
  |  Branch (5868:42): [True: 129, False: 24]
  ------------------
 5869|    129|        {
 5870|    129|            mpy_component = (int)inchi_strtol(pStart, &q, 10);
 5871|    129|            if (p != q)
  ------------------
  |  Branch (5871:17): [True: 1, False: 128]
  ------------------
 5872|      1|            {
 5873|      1|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5874|      1|                goto exit_function;
 5875|      1|            }
 5876|    128|#if (FIX_DALKE_BUGS == 1)
 5877|    128|            if (iComponent + mpy_component > nNumComponents)
  ------------------
  |  Branch (5877:17): [True: 8, False: 120]
  ------------------
 5878|      8|            {
 5879|      8|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      8|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5880|      8|                goto exit_function;
 5881|      8|            }
 5882|    120|#endif
 5883|    120|            p++; /* move to the 1st character of the component */
 5884|    120|        }
 5885|  35.1k|        else
 5886|  35.1k|        {
 5887|       |            /* djb-rwth: condition for if block had to be rewritten */
 5888|  35.1k|            if ((int)inchi_strtol(pStart, &q, 10) > 0)
  ------------------
  |  Branch (5888:17): [True: 1.16k, False: 33.9k]
  ------------------
 5889|  1.16k|            {
 5890|  1.16k|                val = (int)inchi_strtol(pStart, &q, 10);
 5891|  1.16k|                if_cnd = isdigit(*pStart);
 5892|       |
 5893|  1.16k|            }
 5894|  33.9k|            else
 5895|  33.9k|            {
 5896|  33.9k|                val = 1;
 5897|  33.9k|                q = pStart;
 5898|  33.9k|                if_cnd = 1;
 5899|  33.9k|            }
 5900|       |
 5901|  35.1k|            if (if_cnd && (t = strchr((char*)mult_type, *q)) && q + 1 == pEnd) /* djb-rwth: if_cnd applied; ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (5901:17): [True: 35.1k, False: 3]
  |  Branch (5901:27): [True: 134, False: 35.0k]
  |  Branch (5901:65): [True: 19, False: 115]
  ------------------
 5902|     19|            {
 5903|       |                /* process the abbreviation */
 5904|     19|                ret = 0;
 5905|     19|#if (FIX_DALKE_BUGS == 1)
 5906|     19|                if (iComponent + val > nNumComponents)
  ------------------
  |  Branch (5906:21): [True: 0, False: 19]
  ------------------
 5907|      0|                {
 5908|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5909|      0|                    goto exit_function;
 5910|      0|                }
 5911|     19|#endif
 5912|     19|                bIsoFrom = 0;
 5913|     19|                switch (bMobileH)
 5914|     19|                {
 5915|      1|                case TAUT_YES:
  ------------------
  |  |  575|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5915:17): [True: 1, False: 18]
  ------------------
 5916|      1|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5917|      1|                    break;
 5918|     18|                case TAUT_NON:
  ------------------
  |  |  574|     18|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5918:17): [True: 18, False: 1]
  ------------------
 5919|     18|                    if (*q == 'm')
  ------------------
  |  Branch (5919:25): [True: 6, False: 12]
  ------------------
 5920|      6|                    {
 5921|       |                        /* copy from mobile H to fixed H */
 5922|      6|                        pInChIFrom = pInpInChI[ALT_TAUT(bMobileH)];
  ------------------
  |  |  577|      6|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      6|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 6]
  |  |  ------------------
  ------------------
 5923|      6|                    }
 5924|     12|                    else
 5925|     12|                    {
 5926|     12|                        if (*q == 'e')
  ------------------
  |  Branch (5926:29): [True: 12, False: 0]
  ------------------
 5927|     12|                        {
 5928|       |                            /* copy from mobile H to isotopic mobile H */
 5929|     12|                            pInChIFrom = pInChI;
 5930|     12|                            bIsoFrom = -1; /* empty */
 5931|     12|                        }
 5932|      0|                        else
 5933|      0|                        {
 5934|      0|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5935|      0|                        }
 5936|     12|                    }
 5937|     18|                    break;
 5938|      0|                default:
  ------------------
  |  Branch (5938:17): [True: 0, False: 19]
  ------------------
 5939|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5940|      0|                    break;
 5941|     19|                }
 5942|     19|                if (ret < 0)
  ------------------
  |  Branch (5942:21): [True: 1, False: 18]
  ------------------
 5943|      1|                {
 5944|      1|                    goto exit_function;
 5945|      1|                }
 5946|       |                /* copy */
 5947|     58|                for (i = 0; i < val; i++)
  ------------------
  |  Branch (5947:29): [True: 48, False: 10]
  ------------------
 5948|     48|                {
 5949|     48|#if ( FIX_GAF_2019_2==1 )
 5950|     48|                    {
 5951|     48|                        if ((iComponent + i > nNumComponents) || (iComponent + i < 0))
  ------------------
  |  Branch (5951:29): [True: 0, False: 48]
  |  Branch (5951:66): [True: 8, False: 40]
  ------------------
 5952|      8|                        {
 5953|      8|                            ret = RI_ERR_SYNTAX;  /* syntax error */
  ------------------
  |  |   16|      8|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5954|      8|                            goto exit_function;
 5955|      8|                        }
 5956|     48|                    }
 5957|     40|#endif
 5958|     40|                ret = CopySegment(pInChI + iComponent + i, pInChIFrom + iComponent + i, nCpyType, 0, bIsoFrom);
 5959|     40|                if (!ret)
  ------------------
  |  Branch (5959:21): [True: 0, False: 40]
  ------------------
 5960|      0|                {
 5961|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5962|      0|                }
 5963|     40|                if (ret < 0)
  ------------------
  |  Branch (5963:21): [True: 0, False: 40]
  ------------------
 5964|      0|                {
 5965|      0|                    goto exit_function;
 5966|      0|                }
 5967|     40|                }
 5968|     10|                iComponent += val;
 5969|       |                /* continue to the next component(s) */
 5970|     10|                if (*pEnd)
  ------------------
  |  Branch (5970:21): [True: 8, False: 2]
  ------------------
 5971|      8|                {
 5972|      8|                    pStart = pEnd + 1;
 5973|      8|                    continue;
 5974|      8|                }
 5975|      2|                else
 5976|      2|                {
 5977|      2|                    break;
 5978|      2|                }
 5979|     10|            }
 5980|  35.1k|            else
 5981|  35.1k|            {
 5982|  35.1k|                mpy_component = 1;
 5983|  35.1k|                p = pStart;
 5984|  35.1k|            }
 5985|  35.1k|        }
 5986|       |
 5987|  35.2k|#if ( FIX_GAF_2019_2==1 )
 5988|  35.2k|        if ((iComponent > nNumComponents - 1) || (iComponent < 0))
  ------------------
  |  Branch (5988:13): [True: 5, False: 35.2k]
  |  Branch (5988:50): [True: 10, False: 35.2k]
  ------------------
 5989|     15|        {
 5990|     15|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     15|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5991|     15|            goto exit_function;
 5992|     15|        }
 5993|  35.2k|        if (pInChI[iComponent].nNumberOfAtoms <= 0 || pInChI[iComponent].nNumberOfAtoms > MAX_ATOMS)
  ------------------
  |  |   15|  35.2k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (5993:13): [True: 0, False: 35.2k]
  |  Branch (5993:55): [True: 0, False: 35.2k]
  ------------------
 5994|      0|        {
 5995|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5996|      0|            goto exit_function;
 5997|      0|        }
 5998|  35.2k|#endif
 5999|  35.2k|        pStart = p;
 6000|  35.2k|        pIsotopicAtom = &pInChI[iComponent].IsotopicAtom;
 6001|  35.2k|        if (*pIsotopicAtom)
  ------------------
  |  Branch (6001:13): [True: 2, False: 35.2k]
  ------------------
 6002|      2|        {
 6003|      2|            ret = RI_ERR_PROGR; /* program error */
  ------------------
  |  |   17|      2|#define RI_ERR_PROGR   (-3)
  ------------------
 6004|      2|            goto exit_function;
 6005|      2|        }
 6006|       |
 6007|  35.2k|        if (p < pEnd && *pbAbc == -1)
  ------------------
  |  Branch (6007:13): [True: 1.25k, False: 33.9k]
  |  Branch (6007:25): [True: 0, False: 1.25k]
  ------------------
 6008|      0|        {
 6009|       |            /* check if compressed InChI */
 6010|      0|            *pbAbc = isupper(UCINT * p) ? 1 : 0;
  ------------------
  |  Branch (6010:22): [True: 0, False: 0]
  ------------------
 6011|      0|        }
 6012|  35.2k|        base = (*pbAbc == 1) ? ALPHA_BASE : 10;
  ------------------
  |  |  170|      0|#define ALPHA_BASE 27
  ------------------
  |  Branch (6012:16): [True: 0, False: 35.2k]
  ------------------
 6013|       |
 6014|  70.3k|    one_more_time:
 6015|  70.3k|        if (*pbAbc == 1)
  ------------------
  |  Branch (6015:13): [True: 0, False: 70.3k]
  ------------------
 6016|      0|        {
 6017|       |            /* process the componnt: At[+/-Charge]TDH,... */
 6018|       |            /* pass 1: find number of stereoatoms */
 6019|      0|            for (p = pStart, iAtom = 0; p < pEnd; iAtom++)
  ------------------
  |  Branch (6019:41): [True: 0, False: 0]
  ------------------
 6020|      0|            {
 6021|      0|                nAtom1 = (AT_NUMB)inchi_strtol(p, &p, base);
 6022|      0|#if ( CHECK_STRTOL_ATNUMB==1 )
 6023|      0|                if (nAtom1 > MAX_ATOMS || nAtom1 < 0)
  ------------------
  |  |   15|      0|#define MAX_ATOMS  32766
  ------------------
  |  Branch (6023:21): [True: 0, False: 0]
  |  Branch (6023:43): [True: 0, False: 0]
  ------------------
 6024|      0|                {
 6025|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6026|      0|                    goto exit_function;
 6027|      0|                }
 6028|      0|#endif
 6029|      0|                if (!nAtom1 ||
  ------------------
  |  Branch (6029:21): [True: 0, False: 0]
  ------------------
 6030|      0|                    nAtom1 > pInChI[iComponent].nNumberOfAtoms)
  ------------------
  |  Branch (6030:21): [True: 0, False: 0]
  ------------------
 6031|      0|                {
 6032|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6033|      0|                    goto exit_function;
 6034|      0|                }
 6035|      0|                memset(&isoAtom, 0, sizeof(isoAtom)); /* djb-rwth: memset_s C11/Annex K variant? */
 6036|      0|                isoAtom.nAtomNumber = nAtom1;
 6037|      0|                isoAtom.nIsoDifference = (NUM_H)inchi_strtol(p, &q, 10); /* alway in abc */
 6038|      0|                if (p == q)
  ------------------
  |  Branch (6038:21): [True: 0, False: 0]
  ------------------
 6039|      0|                {
 6040|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6041|      0|                    goto exit_function;
 6042|      0|                }
 6043|      0|                p = q;
 6044|      0|                if (*p == 't')
  ------------------
  |  Branch (6044:21): [True: 0, False: 0]
  ------------------
 6045|      0|                {
 6046|      0|                    isoAtom.nNum_T = 1;
 6047|      0|                    p++;
 6048|      0|                    if (isdigit(UCINT * p))
  ------------------
  |  Branch (6048:25): [True: 0, False: 0]
  ------------------
 6049|      0|                    {
 6050|      0|                        isoAtom.nNum_T = (NUM_H)inchi_strtol(p, &q, 10);
 6051|      0|                        p = q;
 6052|      0|                    }
 6053|      0|                }
 6054|      0|                if (*p == 'd')
  ------------------
  |  Branch (6054:21): [True: 0, False: 0]
  ------------------
 6055|      0|                {
 6056|      0|                    isoAtom.nNum_D = 1;
 6057|      0|                    p++;
 6058|      0|                    if (isdigit(UCINT * p))
  ------------------
  |  Branch (6058:25): [True: 0, False: 0]
  ------------------
 6059|      0|                    {
 6060|      0|                        isoAtom.nNum_D = (NUM_H)inchi_strtol(p, &q, 10);
 6061|      0|                        p = q;
 6062|      0|                    }
 6063|      0|                }
 6064|      0|                if (*p == 'h')
  ------------------
  |  Branch (6064:21): [True: 0, False: 0]
  ------------------
 6065|      0|                {
 6066|      0|                    isoAtom.nNum_H = 1;
 6067|      0|                    p++;
 6068|      0|                    if (isdigit(UCINT * p))
  ------------------
  |  Branch (6068:25): [True: 0, False: 0]
  ------------------
 6069|      0|                    {
 6070|      0|                        isoAtom.nNum_H = (NUM_H)inchi_strtol(p, &q, 10);
 6071|      0|                        p = q;
 6072|      0|                    }
 6073|      0|                }
 6074|      0|                if (p > pEnd || (!isoAtom.nIsoDifference && !isoAtom.nNum_T && !isoAtom.nNum_D && !isoAtom.nNum_H)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (6074:21): [True: 0, False: 0]
  |  Branch (6074:34): [True: 0, False: 0]
  |  Branch (6074:61): [True: 0, False: 0]
  |  Branch (6074:80): [True: 0, False: 0]
  |  Branch (6074:99): [True: 0, False: 0]
  ------------------
 6075|      0|                {
 6076|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6077|      0|                    goto exit_function;
 6078|      0|                }
 6079|      0|                if (*pIsotopicAtom)
  ------------------
  |  Branch (6079:21): [True: 0, False: 0]
  ------------------
 6080|      0|                {
 6081|      0|                    pIsotopicAtom[0][iAtom] = isoAtom;
 6082|      0|                }
 6083|      0|            }
 6084|      0|        }
 6085|  70.3k|        else
 6086|  70.3k|        {
 6087|       |            /* process the componnt: At[+/-Charge]TDH,... */
 6088|       |            /* pass 1: find number of stereoatoms */
 6089|  80.3k|            for (p = pStart, iAtom = 0; p < pEnd; iAtom++)
  ------------------
  |  Branch (6089:41): [True: 10.0k, False: 70.3k]
  ------------------
 6090|  10.0k|            {
 6091|  10.0k|                nAtom1 = (AT_NUMB)inchi_strtol(p, &q, 10);
 6092|  10.0k|#if ( CHECK_STRTOL_ATNUMB==1 )
 6093|  10.0k|                if (nAtom1 > MAX_ATOMS || nAtom1 < 0)
  ------------------
  |  |   15|  20.0k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (6093:21): [True: 9, False: 10.0k]
  |  Branch (6093:43): [True: 0, False: 10.0k]
  ------------------
 6094|      9|                {
 6095|      9|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      9|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6096|      9|                    goto exit_function;
 6097|      9|                }
 6098|  10.0k|#endif
 6099|  10.0k|                p = q;
 6100|  10.0k|                if (!nAtom1 ||
  ------------------
  |  Branch (6100:21): [True: 20, False: 9.98k]
  ------------------
 6101|  9.98k|                    nAtom1 > pInChI[iComponent].nNumberOfAtoms ||
  ------------------
  |  Branch (6101:21): [True: 18, False: 9.96k]
  ------------------
 6102|  9.96k|                    !(r = strchr((char*)parity_type, *p))) /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (6102:21): [True: 1, False: 9.96k]
  ------------------
 6103|     39|                {
 6104|     39|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     39|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6105|     39|                    goto exit_function;
 6106|     39|                }
 6107|  9.96k|                memset(&isoAtom, 0, sizeof(isoAtom)); /* djb-rwth: memset_s C11/Annex K variant? */
 6108|  9.96k|                isoAtom.nAtomNumber = nAtom1;
 6109|  9.96k|                if (p[0] == '+' && isdigit(UCINT p[1]))
  ------------------
  |  Branch (6109:21): [True: 1.00k, False: 8.96k]
  |  Branch (6109:36): [True: 999, False: 1]
  ------------------
 6110|    999|                {
 6111|    999|                    isoAtom.nIsoDifference = (NUM_H)inchi_strtol(p + 1, &q, 10);
 6112|    999|                    if (isoAtom.nIsoDifference >= 0) isoAtom.nIsoDifference++;
  ------------------
  |  Branch (6112:25): [True: 711, False: 288]
  ------------------
 6113|    999|                    p = q;
 6114|    999|                }
 6115|  8.96k|                else
 6116|  8.96k|                    if (p[0] == '-' && isdigit(UCINT p[1]))
  ------------------
  |  Branch (6116:25): [True: 1.68k, False: 7.28k]
  |  Branch (6116:40): [True: 1.67k, False: 4]
  ------------------
 6117|  1.67k|                    {
 6118|  1.67k|                        isoAtom.nIsoDifference = -(NUM_H)inchi_strtol(p + 1, &q, 10);
 6119|  1.67k|                        if (isoAtom.nIsoDifference == 0) isoAtom.nIsoDifference++;
  ------------------
  |  Branch (6119:29): [True: 362, False: 1.31k]
  ------------------
 6120|  1.67k|                        p = q;
 6121|  1.67k|                    }
 6122|  9.96k|                if (*p == 'T')
  ------------------
  |  Branch (6122:21): [True: 1.96k, False: 7.99k]
  ------------------
 6123|  1.96k|                {
 6124|  1.96k|                    isoAtom.nNum_T = 1;
 6125|  1.96k|                    p++;
 6126|  1.96k|                    if (isdigit(UCINT * p))
  ------------------
  |  Branch (6126:25): [True: 1.39k, False: 566]
  ------------------
 6127|  1.39k|                    {
 6128|  1.39k|                        isoAtom.nNum_T = (NUM_H)inchi_strtol(p, &q, 10);
 6129|  1.39k|                        p = q;
 6130|  1.39k|                    }
 6131|  1.96k|                }
 6132|  9.96k|                if (*p == 'D')
  ------------------
  |  Branch (6132:21): [True: 526, False: 9.43k]
  ------------------
 6133|    526|                {
 6134|    526|                    isoAtom.nNum_D = 1;
 6135|    526|                    p++;
 6136|    526|                    if (isdigit(UCINT * p))
  ------------------
  |  Branch (6136:25): [True: 208, False: 318]
  ------------------
 6137|    208|                    {
 6138|    208|                        isoAtom.nNum_D = (NUM_H)inchi_strtol(p, &q, 10);
 6139|    208|                        p = q;
 6140|    208|                    }
 6141|    526|                }
 6142|  9.96k|                if (*p == 'H')
  ------------------
  |  Branch (6142:21): [True: 6.34k, False: 3.61k]
  ------------------
 6143|  6.34k|                {
 6144|  6.34k|                    isoAtom.nNum_H = 1;
 6145|  6.34k|                    p++;
 6146|  6.34k|                    if (isdigit(UCINT * p))
  ------------------
  |  Branch (6146:25): [True: 1.59k, False: 4.74k]
  ------------------
 6147|  1.59k|                    {
 6148|  1.59k|                        isoAtom.nNum_H = (NUM_H)inchi_strtol(p, &q, 10);
 6149|  1.59k|                        p = q;
 6150|  1.59k|                    }
 6151|  6.34k|                }
 6152|  9.96k|                if (!isoAtom.nIsoDifference && !isoAtom.nNum_T && !isoAtom.nNum_D && !isoAtom.nNum_H)
  ------------------
  |  Branch (6152:21): [True: 7.28k, False: 2.67k]
  |  Branch (6152:48): [True: 5.35k, False: 1.93k]
  |  Branch (6152:67): [True: 4.89k, False: 463]
  |  Branch (6152:86): [True: 8, False: 4.88k]
  ------------------
 6153|      8|                {
 6154|      8|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      8|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6155|      8|                    goto exit_function;
 6156|      8|                }
 6157|  9.95k|                if (p < pEnd)
  ------------------
  |  Branch (6157:21): [True: 7.72k, False: 2.23k]
  ------------------
 6158|  7.72k|                {
 6159|  7.72k|                    if (*p == ',')
  ------------------
  |  Branch (6159:25): [True: 7.70k, False: 20]
  ------------------
 6160|  7.70k|                    {
 6161|  7.70k|                        p++;
 6162|  7.70k|                    }
 6163|     20|                    else
 6164|     20|                    {
 6165|     20|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     20|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6166|     20|                        goto exit_function;
 6167|     20|                    }
 6168|  7.72k|                }
 6169|  9.93k|                if (*pIsotopicAtom)
  ------------------
  |  Branch (6169:21): [True: 4.89k, False: 5.04k]
  ------------------
 6170|  4.89k|                {
 6171|  4.89k|                    pIsotopicAtom[0][iAtom] = isoAtom;
 6172|  4.89k|                }
 6173|  9.93k|            }
 6174|  70.3k|        }
 6175|  70.3k|        if (p != pEnd)
  ------------------
  |  Branch (6175:13): [True: 0, False: 70.3k]
  ------------------
 6176|      0|        {
 6177|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6178|      0|            goto exit_function;
 6179|      0|        }
 6180|       |
 6181|  70.3k|        if (!*pIsotopicAtom)
  ------------------
  |  Branch (6181:13): [True: 35.1k, False: 35.1k]
  ------------------
 6182|  35.1k|        {
 6183|       |            /* end of the 1st pass */
 6184|  35.1k|            len = iAtom;
 6185|       |            /* memory allocation */
 6186|  35.1k|            if (!(*pIsotopicAtom = (INChI_IsotopicAtom*)inchi_calloc((long long)len + 1, sizeof(**pIsotopicAtom)))) /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  35.1k|#define inchi_calloc   calloc
  ------------------
  |  Branch (6186:17): [True: 0, False: 35.1k]
  ------------------
 6187|      0|            {
 6188|      0|                ret = RI_ERR_ALLOC; /* memory allocation failed */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 6189|      0|                goto exit_function;
 6190|      0|            }
 6191|  35.1k|            goto one_more_time; /* goto the 2nd pass */
 6192|  35.1k|        }
 6193|  35.1k|        else
 6194|  35.1k|        {
 6195|       |            /* 2nd pass */
 6196|  35.1k|            if (len != iAtom)
  ------------------
  |  Branch (6196:17): [True: 0, False: 35.1k]
  ------------------
 6197|      0|            {
 6198|      0|                ret = RI_ERR_PROGR; /* program error */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 6199|      0|                goto exit_function;
 6200|      0|            }
 6201|  35.1k|            pInChI[iComponent].nNumberOfIsotopicAtoms = len;
 6202|  35.1k|        }
 6203|       |
 6204|       |        /* multiplier */
 6205|  35.5k|        for (i = 1; i < mpy_component; i++)
  ------------------
  |  Branch (6205:21): [True: 412, False: 35.1k]
  ------------------
 6206|    412|        {
 6207|    412|            ret = CopySegment(pInChI + iComponent + i, pInChI + iComponent, nCpyType, 0, 0);
 6208|    412|            if (!ret)
  ------------------
  |  Branch (6208:17): [True: 0, False: 412]
  ------------------
 6209|      0|            {
 6210|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6211|      0|            }
 6212|    412|            if (ret < 0)
  ------------------
  |  Branch (6212:17): [True: 0, False: 412]
  ------------------
 6213|      0|            {
 6214|      0|                goto exit_function;
 6215|      0|            }
 6216|    412|        }
 6217|       |
 6218|  35.1k|        iComponent += mpy_component;
 6219|  35.1k|        if (*pEnd)
  ------------------
  |  Branch (6219:13): [True: 33.9k, False: 1.21k]
  ------------------
 6220|  33.9k|        {
 6221|  33.9k|            pStart = pEnd + 1;
 6222|  33.9k|            continue;
 6223|  33.9k|        }
 6224|  1.21k|        else
 6225|  1.21k|        {
 6226|  1.21k|            break;
 6227|  1.21k|        }
 6228|       |
 6229|  35.1k|    }
 6230|       |
 6231|  1.22k|    if (nNumComponents != iComponent)
  ------------------
  |  Branch (6231:9): [True: 16, False: 1.20k]
  ------------------
 6232|     16|    {
 6233|     16|        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|     16|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6234|     16|        goto exit_function;
 6235|     16|    }
 6236|       |
 6237|  1.20k|    ret = iComponent + 1;
 6238|       |
 6239|  1.33k|exit_function:
 6240|       |
 6241|  1.33k|    return ret;
 6242|  1.20k|}
ichiread.c:ParseSegmentIsoExchgH:
 5560|    617|{
 5561|       |    /* Pass 1: count bonds and find actual numbers of  atom */
 5562|    617|    const char* p, * q, * pStart, * pEnd;
 5563|    617|    int  ret = 0, num, i, i_prev;
 5564|    617|    static const char abc_h[] = "hdt";
 5565|       |
 5566|    617|    if (str[0] != 'h')
  ------------------
  |  Branch (5566:9): [True: 436, False: 181]
  ------------------
 5567|    436|    {
 5568|    436|        return 0;
 5569|    436|    }
 5570|       |
 5571|    181|    pStart = (char*)str + 1;
 5572|       |
 5573|    181|    if (!(bMobileH == TAUT_YES && state == IST_MOBILE_H_ISO_EXCH_H))
  ------------------
  |  |  575|    362|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5573:11): [True: 181, False: 0]
  |  Branch (5573:35): [True: 181, False: 0]
  ------------------
 5574|      0|    {
 5575|      0|        return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5576|      0|    }
 5577|       |
 5578|    181|    if (!(strchr(pStart, ';'))) /* djb-rwth: removing redundant code */
  ------------------
  |  Branch (5578:9): [True: 179, False: 2]
  ------------------
 5579|    179|    {
 5580|    179|        pEnd = pStart + strlen(pStart);
 5581|    179|    }
 5582|      2|    else
 5583|      2|    {
 5584|      2|        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5585|      2|        goto exit_function;
 5586|      2|    }
 5587|    179|    p = pStart;
 5588|       |
 5589|    179|    if (p < pEnd && *pbAbc == -1)
  ------------------
  |  Branch (5589:9): [True: 170, False: 9]
  |  Branch (5589:21): [True: 0, False: 170]
  ------------------
 5590|      0|    {
 5591|       |        /* check if compressed InChI */
 5592|       |        /* compressed:    /hNtNdNh where N is a decimal number */
 5593|       |        /* uncompressed:  /hT[n]D[n]H[n] where n > 1 is a decimal number */
 5594|      0|        *pbAbc = isdigit(UCINT * p) ? 1 : 0;
  ------------------
  |  Branch (5594:18): [True: 0, False: 0]
  ------------------
 5595|      0|    }
 5596|       |
 5597|    179|    if (*pbAbc == 1)
  ------------------
  |  Branch (5597:9): [True: 0, False: 179]
  ------------------
 5598|      0|    {
 5599|      0|        i_prev = (int)sizeof(abc_h);
 5600|      0|        while (p < pEnd)
  ------------------
  |  Branch (5600:16): [True: 0, False: 0]
  ------------------
 5601|      0|        {
 5602|      0|            num = (int)inchi_strtol(p, &q, 10);
 5603|      0|#if ( CHECK_STRTOL_ATNUMB==1 )
 5604|      0|            if (num > MAX_ATOMS || num < 0)
  ------------------
  |  |   15|      0|#define MAX_ATOMS  32766
  ------------------
  |  Branch (5604:17): [True: 0, False: 0]
  |  Branch (5604:36): [True: 0, False: 0]
  ------------------
 5605|      0|            {
 5606|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5607|      0|                goto exit_function;
 5608|      0|            }
 5609|      0|#endif
 5610|      0|            if (0 >= num || p == q || q >= pEnd)
  ------------------
  |  Branch (5610:17): [True: 0, False: 0]
  |  Branch (5610:29): [True: 0, False: 0]
  |  Branch (5610:39): [True: 0, False: 0]
  ------------------
 5611|      0|            {
 5612|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5613|      0|                goto exit_function;
 5614|      0|            }
 5615|      0|            p = strchr((char*)abc_h, *q);
 5616|      0|            if (p && (i = (int)(p - abc_h)) < i_prev && (i < NUM_H_ISOTOPES)) /* djb-rwth: additional condition for buffer overrun prevention */
  ------------------
  |  |   72|      0|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (5616:17): [True: 0, False: 0]
  |  Branch (5616:22): [True: 0, False: 0]
  |  Branch (5616:57): [True: 0, False: 0]
  ------------------
 5617|      0|            {
 5618|      0|                nNumProtons[bMobileH].nNumRemovedIsotopicH[i] = (NUM_H)num;
 5619|      0|                p = q + 1;
 5620|      0|                i_prev = i;
 5621|      0|            }
 5622|      0|            else
 5623|      0|            {
 5624|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5625|      0|                goto exit_function;
 5626|      0|            }
 5627|      0|        }
 5628|      0|    }
 5629|    179|    else
 5630|    179|    {
 5631|    179|        if (*p == 'T')
  ------------------
  |  Branch (5631:13): [True: 77, False: 102]
  ------------------
 5632|     77|        {
 5633|     77|            nNumProtons[bMobileH].nNumRemovedIsotopicH[2] = 1;
 5634|     77|            p++;
 5635|     77|            if (isdigit(UCINT p[0]))
  ------------------
  |  Branch (5635:17): [True: 38, False: 39]
  ------------------
 5636|     38|            {
 5637|     38|                nNumProtons[bMobileH].nNumRemovedIsotopicH[2] = (NUM_H)inchi_strtol(p, &q, 10);
 5638|     38|                p = q;
 5639|     38|            }
 5640|     77|        }
 5641|    179|        if (*p == 'D')
  ------------------
  |  Branch (5641:13): [True: 51, False: 128]
  ------------------
 5642|     51|        {
 5643|     51|            nNumProtons[bMobileH].nNumRemovedIsotopicH[1] = 1;
 5644|     51|            p++;
 5645|     51|            if (isdigit(UCINT p[0]))
  ------------------
  |  Branch (5645:17): [True: 13, False: 38]
  ------------------
 5646|     13|            {
 5647|     13|                nNumProtons[bMobileH].nNumRemovedIsotopicH[1] = (NUM_H)inchi_strtol(p, &q, 10);
 5648|     13|                p = q;
 5649|     13|            }
 5650|     51|        }
 5651|    179|        if (*p == 'H')
  ------------------
  |  Branch (5651:13): [True: 92, False: 87]
  ------------------
 5652|     92|        {
 5653|     92|            nNumProtons[bMobileH].nNumRemovedIsotopicH[0] = 1;
 5654|     92|            p++;
 5655|     92|            if (isdigit(UCINT p[0]))
  ------------------
  |  Branch (5655:17): [True: 58, False: 34]
  ------------------
 5656|     58|            {
 5657|     58|                nNumProtons[bMobileH].nNumRemovedIsotopicH[0] = (NUM_H)inchi_strtol(p, &q, 10);
 5658|     58|                p = q;
 5659|     58|            }
 5660|     92|        }
 5661|    179|    }
 5662|    179|    if (p != pEnd)
  ------------------
  |  Branch (5662:9): [True: 5, False: 174]
  ------------------
 5663|      5|    {
 5664|      5|        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      5|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5665|      5|        goto exit_function;
 5666|      5|    }
 5667|    174|    ret = 1;
 5668|       |
 5669|    181|exit_function:
 5670|       |
 5671|    181|    return ret;
 5672|    174|}
ichiread.c:ParseSegmentPerm:
 5682|    817|{
 5683|    817|    int nNumComponents, iComponent1, iComponent2, numTrans;
 5684|    817|    const char* p, * q, * pStart, * pEnd, * pPermStart, * pPermEnd;
 5685|    817|    int  ret = 0;
 5686|    817|    INChI* pInChI = pInpInChI[bMobileH]; /* bMobileH should be TAUT_NON = 0 */
 5687|    817|    INChI tmp;
 5688|    817|    int   base = 10;
 5689|       |
 5690|    817|    if (str[0] != 'o')
  ------------------
  |  Branch (5690:9): [True: 714, False: 103]
  ------------------
 5691|    714|    {
 5692|    714|        return 0;
 5693|    714|    }
 5694|       |
 5695|       |    /* djb-rwth: fixing oss-fuzz issue #66746 */
 5696|    103|    if (!pInChI)
  ------------------
  |  Branch (5696:9): [True: 0, False: 103]
  ------------------
 5697|      0|    {
 5698|      0|        return RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 5699|      0|    }
 5700|       |
 5701|    103|    pStart = (char*)str + 1;
 5702|    103|    nNumComponents = ppnNumComponents[bMobileH];
 5703|       |
 5704|    103|    if (!(bMobileH == TAUT_NON && (state == IST_FIXED_H_PERMUTATION || state == IST_FIXED_H_ISO_PERMUTATION)))
  ------------------
  |  |  574|    206|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5704:11): [True: 103, False: 0]
  |  Branch (5704:36): [True: 92, False: 11]
  |  Branch (5704:72): [True: 11, False: 0]
  ------------------
 5705|      0|    {
 5706|      0|        return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5707|      0|    }
 5708|       |
 5709|    103|    if (!(strchr(pStart, ';'))) /* djb-rwth: removing redundant code */
  ------------------
  |  Branch (5709:9): [True: 99, False: 4]
  ------------------
 5710|     99|    {
 5711|     99|        pEnd = pStart + strlen(pStart);
 5712|     99|    }
 5713|      4|    else
 5714|      4|    {
 5715|      4|        return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   16|      4|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5716|      4|    }
 5717|    115|    while (pStart < pEnd)
  ------------------
  |  Branch (5717:12): [True: 41, False: 74]
  ------------------
 5718|     41|    {
 5719|       |        /* cycle over components; rearrange Fixed H components in order of Mobile H components */
 5720|       |        /* if /o(1,2,3) then reaarange Fixed H components in this way: tmp<-1, 1<-2, 2<-3, 3<-tmp */
 5721|     41|        if (*pStart != '(')
  ------------------
  |  Branch (5721:13): [True: 0, False: 41]
  ------------------
 5722|      0|        {
 5723|      0|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5724|      0|            goto exit_function;
 5725|      0|        }
 5726|     41|        pPermStart = pStart + 1;
 5727|     41|        memset(&tmp, 0, sizeof(tmp));  /* initialization 2006-03 */ /* djb-rwth: memset_s C11/Annex K variant? */
 5728|     41|        if (!(pPermEnd = strchr(pPermStart, ')')) || pPermEnd == pPermStart)
  ------------------
  |  Branch (5728:13): [True: 2, False: 39]
  |  Branch (5728:54): [True: 1, False: 38]
  ------------------
 5729|      3|        {
 5730|      3|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      3|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5731|      3|            goto exit_function;
 5732|      3|        }
 5733|       |
 5734|     38|        if (pPermStart < pPermEnd && *pbAbc == -1)
  ------------------
  |  Branch (5734:13): [True: 38, False: 0]
  |  Branch (5734:38): [True: 0, False: 38]
  ------------------
 5735|      0|        {
 5736|       |            /* check if compressed InChI */
 5737|      0|            *pbAbc = isupper(UCINT * pPermStart) ? 1 : 0;
  ------------------
  |  Branch (5737:22): [True: 0, False: 0]
  ------------------
 5738|      0|        }
 5739|     38|        base = (*pbAbc == 1) ? ALPHA_BASE : 10;
  ------------------
  |  |  170|      0|#define ALPHA_BASE 27
  ------------------
  |  Branch (5739:16): [True: 0, False: 38]
  ------------------
 5740|       |
 5741|       |        /* permutation cycle */
 5742|     38|        if (*pbAbc == 1)
  ------------------
  |  Branch (5742:13): [True: 0, False: 38]
  ------------------
 5743|      0|        {
 5744|      0|            for (p = pPermStart, iComponent2 = numTrans = 0; p < pPermEnd; iComponent2 = iComponent1, p = q)
  ------------------
  |  Branch (5744:62): [True: 0, False: 0]
  ------------------
 5745|      0|            {
 5746|       |                /* get first atom number */
 5747|      0|                if (0 >= (iComponent1 = (int)inchi_strtol(p, &q, base)) || iComponent1 > nNumComponents)
  ------------------
  |  Branch (5747:21): [True: 0, False: 0]
  |  Branch (5747:76): [True: 0, False: 0]
  ------------------
 5748|      0|                {
 5749|      0|                    ret = RI_ERR_SYNTAX;  /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5750|      0|                    goto exit_function;
 5751|      0|                }
 5752|      0|#if ( FIX_GAF_2019_2==1 )
 5753|      0|                if ((iComponent1 - 1 > nNumComponents - 1) || (iComponent1 - 1 < 0))
  ------------------
  |  Branch (5753:21): [True: 0, False: 0]
  |  Branch (5753:63): [True: 0, False: 0]
  ------------------
 5754|      0|                {
 5755|      0|                    ret = RI_ERR_SYNTAX;  /* syntax error */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5756|      0|                    goto exit_function;
 5757|      0|                }
 5758|      0|#endif
 5759|      0|                if (iComponent2)
  ------------------
  |  Branch (5759:21): [True: 0, False: 0]
  ------------------
 5760|      0|                {
 5761|      0|                    pInChI[iComponent2 - 1] = pInChI[iComponent1 - 1];
 5762|      0|                    numTrans++;
 5763|      0|                }
 5764|      0|                else
 5765|      0|                {
 5766|      0|                    tmp = pInChI[iComponent1 - 1]; /* on the 1st pass save Component1 */
 5767|      0|                }
 5768|      0|            }
 5769|      0|        }
 5770|     38|        else
 5771|     38|        {
 5772|    101|            for (p = pPermStart, iComponent2 = numTrans = 0; p < pPermEnd; iComponent2 = iComponent1, p = q + (*q == ','))
  ------------------
  |  Branch (5772:62): [True: 85, False: 16]
  ------------------
 5773|     85|            {
 5774|       |                /* get first atom number */
 5775|     85|                if (!isdigit(UCINT * p))
  ------------------
  |  Branch (5775:21): [True: 2, False: 83]
  ------------------
 5776|      2|                {
 5777|      2|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5778|      2|                    goto exit_function;
 5779|      2|                }
 5780|     83|                iComponent1 = (int)inchi_strtol(p, &q, 10);
 5781|     83|                if ((iComponent1 < 1) || (iComponent1 > nNumComponents)) /* djb-rwth: fixing oss-fuzz issue #66746 */
  ------------------
  |  Branch (5781:21): [True: 10, False: 73]
  |  Branch (5781:42): [True: 10, False: 63]
  ------------------
 5782|     20|                {
 5783|     20|                    ret = RI_ERR_SYNTAX;  /* syntax error */
  ------------------
  |  |   16|     20|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5784|     20|                    goto exit_function;
 5785|     20|                }
 5786|     63|                if (iComponent2)
  ------------------
  |  Branch (5786:21): [True: 32, False: 31]
  ------------------
 5787|     32|                {
 5788|     32|                    pInChI[iComponent2 - 1] = pInChI[iComponent1 - 1];
 5789|     32|                    numTrans++;
 5790|     32|                }
 5791|     31|                else
 5792|     31|                {
 5793|     31|                    tmp = pInChI[iComponent1 - 1]; /* on the 1st pass save Component1 */
 5794|     31|                }
 5795|     63|            }
 5796|     38|        }
 5797|     16|        pInChI[iComponent2 - 1] = tmp;
 5798|     16|        if (!numTrans || p != pPermEnd)
  ------------------
  |  Branch (5798:13): [True: 0, False: 16]
  |  Branch (5798:26): [True: 0, False: 16]
  ------------------
 5799|      0|        {
 5800|      0|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5801|      0|            goto exit_function;
 5802|      0|        }
 5803|     16|        else
 5804|     16|        {
 5805|     16|            pStart = p + 1;
 5806|     16|        }
 5807|     16|    }
 5808|     74|    ret = 1;
 5809|       |
 5810|     99|exit_function:
 5811|       |
 5812|     99|    return ret;
 5813|     74|}
ichiread.c:nFillOutProtonMobileH:
 9733|  4.57k|{
 9734|  4.57k|    int len = 1;
 9735|  4.57k|    pInChI->bDeleted = 1;
 9736|       |    /* formula */
 9737|  4.57k|    if (!pInChI->szHillFormula &&
  ------------------
  |  Branch (9737:9): [True: 4.57k, False: 0]
  ------------------
 9738|  4.57k|        !(pInChI->szHillFormula = (char*)inchi_calloc((long long)len + 1, sizeof(pInChI->szHillFormula[0])))) /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  4.57k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9738:9): [True: 0, False: 4.57k]
  ------------------
 9739|      0|    {
 9740|      0|        return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9741|      0|    }
 9742|  4.57k|    strcpy(pInChI->szHillFormula, "H");
 9743|  4.57k|    pInChI->nNumberOfAtoms = 1;
 9744|       |
 9745|       |    /* atoms */
 9746|  4.57k|    if (!pInChI->nAtom &&
  ------------------
  |  Branch (9746:9): [True: 4.57k, False: 0]
  ------------------
 9747|  4.57k|        !(pInChI->nAtom = (U_CHAR*)inchi_calloc((long long)len + 1, sizeof(pInChI->nAtom[0])))) /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  4.57k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9747:9): [True: 0, False: 4.57k]
  ------------------
 9748|      0|    {
 9749|      0|        return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9750|      0|    }
 9751|  4.57k|    pInChI->nAtom[0] = 1;
 9752|       |    /* charge */
 9753|  4.57k|    pInChI->nTotalCharge = 1;
 9754|       |    /* connection table */
 9755|  4.57k|    if (!pInChI->nConnTable &&
  ------------------
  |  Branch (9755:9): [True: 4.57k, False: 0]
  ------------------
 9756|  4.57k|        !(pInChI->nConnTable = (AT_NUMB*)inchi_calloc((long long)len + 1, sizeof(pInChI->nConnTable[0])))) /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  4.57k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9756:9): [True: 0, False: 4.57k]
  ------------------
 9757|      0|    {
 9758|      0|        return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9759|      0|    }
 9760|  4.57k|    pInChI->nConnTable[0] = 1;
 9761|  4.57k|    pInChI->lenConnTable = len;
 9762|       |    /* tautomer */
 9763|  4.57k|    if (!pInChI->nTautomer &&
  ------------------
  |  Branch (9763:9): [True: 4.57k, False: 0]
  ------------------
 9764|  4.57k|        !(pInChI->nTautomer = (AT_NUMB*)inchi_calloc((long long)len + 1, sizeof(pInChI->nTautomer[0])))) /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  4.57k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9764:9): [True: 0, False: 4.57k]
  ------------------
 9765|      0|    {
 9766|      0|        return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9767|      0|    }
 9768|       |    /* nNum_H */
 9769|  4.57k|    if (!pInChI->nNum_H &&
  ------------------
  |  Branch (9769:9): [True: 4.57k, False: 0]
  ------------------
 9770|  4.57k|        !(pInChI->nNum_H = (S_CHAR*)inchi_calloc((long long)len + 1, sizeof(pInChI->nNum_H[0])))) /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  4.57k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9770:9): [True: 0, False: 4.57k]
  ------------------
 9771|      0|    {
 9772|      0|        return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9773|      0|    }
 9774|  4.57k|    pInChI->nNum_H[0] = 0;
 9775|       |
 9776|  4.57k|    pInChI->nTautomer[0] = 0;
 9777|  4.57k|    pInChI->lenTautomer = 1;
 9778|       |
 9779|  4.57k|    return 0;
 9780|  4.57k|}
ichiread.c:nProtonCopyIsotopicInfo:
 9785|    592|{
 9786|    592|    if (pInChI_from->nNumberOfIsotopicAtoms)
  ------------------
  |  Branch (9786:9): [True: 0, False: 592]
  ------------------
 9787|      0|    {
 9788|      0|        if (pInChI_to->nNumberOfIsotopicAtoms &&
  ------------------
  |  Branch (9788:13): [True: 0, False: 0]
  ------------------
 9789|      0|            pInChI_from->nNumberOfIsotopicAtoms > pInChI_to->nNumberOfIsotopicAtoms)
  ------------------
  |  Branch (9789:13): [True: 0, False: 0]
  ------------------
 9790|      0|        {
 9791|       |
 9792|      0|            inchi_free(pInChI_to->IsotopicAtom);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 9793|      0|            pInChI_to->IsotopicAtom = NULL;
 9794|      0|            pInChI_to->nNumberOfIsotopicAtoms = 0;
 9795|      0|        }
 9796|      0|        if (!pInChI_to->IsotopicAtom &&
  ------------------
  |  Branch (9796:13): [True: 0, False: 0]
  ------------------
 9797|      0|            !(pInChI_to->IsotopicAtom =
  ------------------
  |  Branch (9797:13): [True: 0, False: 0]
  ------------------
 9798|      0|                (INChI_IsotopicAtom*)inchi_calloc(pInChI_from->nNumberOfIsotopicAtoms,
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 9799|      0|                    sizeof(pInChI_to->IsotopicAtom[0]))))
 9800|      0|        {
 9801|      0|            return RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9802|      0|        }
 9803|      0|        pInChI_to->nNumberOfIsotopicAtoms = pInChI_from->nNumberOfIsotopicAtoms;
 9804|      0|        memcpy(pInChI_to->IsotopicAtom, pInChI_from->IsotopicAtom,
 9805|      0|            pInChI_from->nNumberOfIsotopicAtoms * sizeof(pInChI_to->IsotopicAtom[0]));
 9806|      0|    }
 9807|    592|    else
 9808|    592|    {
 9809|    592|        if (pInChI_to->IsotopicAtom)
  ------------------
  |  Branch (9809:13): [True: 0, False: 592]
  ------------------
 9810|      0|        {
 9811|      0|            inchi_free(pInChI_to->IsotopicAtom);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 9812|      0|        }
 9813|    592|        pInChI_to->IsotopicAtom = NULL;
 9814|    592|        pInChI_to->nNumberOfIsotopicAtoms = 0;
 9815|    592|    }
 9816|       |
 9817|    592|    return 0;
 9818|    592|}
ichiread.c:CopySegment:
10282|  8.17k|{
10283|  8.17k|    int            ret = RI_ERR_ALLOC;
  ------------------
  |  |   15|  8.17k|#define RI_ERR_ALLOC   (-1)
  ------------------
10284|  8.17k|    int            len;
10285|       |
10286|  8.17k|    if (SegmentType == CPY_SP2 ||
  ------------------
  |  Branch (10286:9): [True: 6.92k, False: 1.24k]
  ------------------
10287|  1.24k|        SegmentType == CPY_SP3 ||
  ------------------
  |  Branch (10287:9): [True: 357, False: 888]
  ------------------
10288|    888|        SegmentType == CPY_SP3_M ||
  ------------------
  |  Branch (10288:9): [True: 318, False: 570]
  ------------------
10289|    570|        SegmentType == CPY_SP3_S)
  ------------------
  |  Branch (10289:9): [True: 0, False: 570]
  ------------------
10290|  7.60k|    {
10291|  7.60k|        INChI_Stereo** pstereoTo = NULL;
10292|  7.60k|        INChI_Stereo* stereoFrom = bIsotopicFrom == 1 ? pInChIFrom->StereoIsotopic :
  ------------------
  |  Branch (10292:36): [True: 64, False: 7.53k]
  ------------------
10293|  7.60k|            bIsotopicFrom == 0 ? pInChIFrom->Stereo : NULL;
  ------------------
  |  Branch (10293:13): [True: 745, False: 6.79k]
  ------------------
10294|  7.60k|        if (stereoFrom || bIsotopicFrom < 0)
  ------------------
  |  Branch (10294:13): [True: 806, False: 6.79k]
  |  Branch (10294:27): [True: 6.79k, False: 3]
  ------------------
10295|  7.59k|        {
10296|  7.59k|            if (SegmentType == CPY_SP2)
  ------------------
  |  Branch (10296:17): [True: 6.92k, False: 672]
  ------------------
10297|  6.92k|            {
10298|  6.92k|#if ( FIX_GAF_2019_1==1 )
10299|  6.92k|                if (bIsotopicFrom >= 0 &&
  ------------------
  |  Branch (10299:21): [True: 161, False: 6.76k]
  ------------------
10300|    161|                    (pInChIFrom->nNumberOfAtoms > MAX_ATOMS || pInChIFrom->nNumberOfAtoms < 0))
  ------------------
  |  |   15|    322|#define MAX_ATOMS  32766
  ------------------
  |  Branch (10300:22): [True: 0, False: 161]
  |  Branch (10300:64): [True: 0, False: 161]
  ------------------
10301|      0|                {
10302|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10303|      0|                    goto exit_function;
10304|      0|                }
10305|  6.92k|#endif
10306|  6.92k|                if (bIsotopicFrom < 0 ||
  ------------------
  |  Branch (10306:21): [True: 6.76k, False: 161]
  ------------------
10307|    161|                    (stereoFrom->b_parity &&
  ------------------
  |  Branch (10307:22): [True: 161, False: 0]
  ------------------
10308|    161|                        stereoFrom->nBondAtom1 &&
  ------------------
  |  Branch (10308:25): [True: 161, False: 0]
  ------------------
10309|    161|                        stereoFrom->nBondAtom2)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (10309:25): [True: 161, False: 0]
  ------------------
10310|  6.92k|                {
10311|  6.92k|                    S_CHAR* pst0_bp = NULL;     /* copied from below to obey C syntax - 2024-09-01 DT */
10312|  6.92k|                    AT_NUMB* pst0_nba1 = NULL;  /* copied from below to obey C syntax - 2024-09-01 DT */
10313|  6.92k|                    AT_NUMB* pst0_nba2 = NULL;  /* copied from below to obey C syntax - 2024-09-01 DT */
10314|       |
10315|  6.92k|                    len = (bIsotopicFrom < 0) ? 0 : stereoFrom->nNumberOfStereoBonds;
  ------------------
  |  Branch (10315:27): [True: 6.76k, False: 161]
  ------------------
10316|  6.92k|                    pstereoTo = bIsotopicTo ? &pInChITo->StereoIsotopic : &pInChITo->Stereo;
  ------------------
  |  Branch (10316:33): [True: 307, False: 6.62k]
  ------------------
10317|  6.92k|                    if (!pstereoTo[0])
  ------------------
  |  Branch (10317:25): [True: 6.90k, False: 23]
  ------------------
10318|  6.90k|                    {
10319|       |                        /* djb-rwth: fixing oss-fuzz issue #66985 */
10320|  6.90k|                        INChI_Stereo* pst0 = (INChI_Stereo*)inchi_calloc(1, sizeof(**pstereoTo));
  ------------------
  |  | 1146|  6.90k|#define inchi_calloc   calloc
  ------------------
10321|  6.90k|                        pstereoTo[0] = pst0;
10322|  6.90k|                        if (!pst0)
  ------------------
  |  Branch (10322:29): [True: 0, False: 6.90k]
  ------------------
10323|      0|                        {
10324|      0|                            goto exit_function;
10325|      0|                        }
10326|  6.90k|                    }
10327|  6.92k|                    if (pstereoTo[0]->nNumberOfStereoBonds > 0 || pstereoTo[0]->b_parity ||
  ------------------
  |  Branch (10327:25): [True: 0, False: 6.92k]
  |  Branch (10327:67): [True: 1, False: 6.92k]
  ------------------
10328|  6.92k|                        pstereoTo[0]->nBondAtom1 || pstereoTo[0]->nBondAtom2)
  ------------------
  |  Branch (10328:25): [True: 0, False: 6.92k]
  |  Branch (10328:53): [True: 0, False: 6.92k]
  ------------------
10329|      1|                    {
10330|      1|                        ret = RI_ERR_SYNTAX; /* stereo already exists */
  ------------------
  |  |   16|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
10331|      1|                        goto exit_function;
10332|      1|                    }
10333|       |                    /* allocate sp2 stereo */
10334|       |                    /* djb-rwth: fixing oss-fuzz issue #66985 */
10335|       |                    /* djb-rwth: cast operators added */
10336|  6.92k|                    pst0_bp = (S_CHAR*)inchi_calloc((long long)len + 1, sizeof(pstereoTo[0]->b_parity[0]));
  ------------------
  |  | 1146|  6.92k|#define inchi_calloc   calloc
  ------------------
10337|  6.92k|                    pst0_nba1 = (AT_NUMB*)inchi_calloc((long long)len + 1, sizeof(pstereoTo[0]->nBondAtom1[0]));
  ------------------
  |  | 1146|  6.92k|#define inchi_calloc   calloc
  ------------------
10338|  6.92k|                    pst0_nba2 = (AT_NUMB*)inchi_calloc((long long)len + 1, sizeof(pstereoTo[0]->nBondAtom2[0]));
  ------------------
  |  | 1146|  6.92k|#define inchi_calloc   calloc
  ------------------
10339|  6.92k|                    pstereoTo[0]->b_parity = pst0_bp;
10340|  6.92k|                    pstereoTo[0]->nBondAtom1 = pst0_nba1;
10341|  6.92k|                    pstereoTo[0]->nBondAtom2 = pst0_nba2;
10342|  6.92k|                    if (!pst0_bp || !pst0_nba1 || !pst0_nba2)
  ------------------
  |  Branch (10342:25): [True: 0, False: 6.92k]
  |  Branch (10342:37): [True: 0, False: 6.92k]
  |  Branch (10342:51): [True: 0, False: 6.92k]
  ------------------
10343|      0|                    {
10344|       |                        /* cleanup */
10345|      0|                        if (pst0_bp)
  ------------------
  |  Branch (10345:29): [True: 0, False: 0]
  ------------------
10346|      0|                        {
10347|      0|                            INCHI_HEAPCHK
10348|      0|                                inchi_free(pst0_bp);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
10349|      0|                            pst0_bp = NULL;
10350|      0|                        }
10351|      0|                        if (pst0_nba1)
  ------------------
  |  Branch (10351:29): [True: 0, False: 0]
  ------------------
10352|      0|                        {
10353|      0|                            INCHI_HEAPCHK
10354|      0|                                inchi_free(pst0_nba1);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
10355|      0|                            pst0_nba1 = NULL;
10356|      0|                        }
10357|      0|                        if (pstereoTo[0]->nBondAtom2)
  ------------------
  |  Branch (10357:29): [True: 0, False: 0]
  ------------------
10358|      0|                        {
10359|      0|                            INCHI_HEAPCHK
10360|      0|                                inchi_free(pst0_nba2);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
10361|      0|                            pst0_nba2 = NULL;
10362|      0|                        }
10363|      0|                        INCHI_HEAPCHK
10364|      0|                            goto exit_function;
10365|      0|                    }
10366|       |                    /* copy stereo */
10367|  6.92k|                    if (bIsotopicFrom >= 0 && len)
  ------------------
  |  Branch (10367:25): [True: 161, False: 6.76k]
  |  Branch (10367:47): [True: 157, False: 4]
  ------------------
10368|    157|                    {
10369|    157|#if ( FIX_GAF_2019_1==1 )
10370|    157|                        if (pInChIFrom->nNumberOfAtoms > MAX_ATOMS || pInChIFrom->nNumberOfAtoms < 0)
  ------------------
  |  |   15|    314|#define MAX_ATOMS  32766
  ------------------
  |  Branch (10370:29): [True: 0, False: 157]
  |  Branch (10370:71): [True: 0, False: 157]
  ------------------
10371|      0|                        {
10372|      0|                            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10373|      0|                            goto exit_function;
10374|      0|                        }
10375|    157|#endif
10376|    157|                        memcpy(pst0_bp, stereoFrom->b_parity, ((long long)len + 1) * sizeof(pst0_bp[0])); /* djb-rwth: cast operator added */
10377|    157|                        memcpy(pst0_nba1, stereoFrom->nBondAtom1, ((long long)len + 1) * sizeof(pst0_nba1[0])); /* djb-rwth: cast operator added */
10378|    157|                        memcpy(pst0_nba2, stereoFrom->nBondAtom2, ((long long)len + 1) * sizeof(pst0_nba2[0])); /* djb-rwth: cast operator added */
10379|    157|                    }
10380|  6.92k|                    pstereoTo[0]->nNumberOfStereoBonds = len;
10381|       |
10382|  6.92k|                    return len + 1;
10383|  6.92k|                }
10384|      0|                else
10385|      0|                {
10386|      0|                    return 0;
10387|      0|                }
10388|  6.92k|            }
10389|    672|            else
10390|    672|            {
10391|    672|                if (SegmentType == CPY_SP3)
  ------------------
  |  Branch (10391:21): [True: 354, False: 318]
  ------------------
10392|    354|                {
10393|    354|                    if (bIsotopicFrom < 0 ||
  ------------------
  |  Branch (10393:25): [True: 23, False: 331]
  ------------------
10394|    331|                        (stereoFrom->t_parity &&
  ------------------
  |  Branch (10394:26): [True: 331, False: 0]
  ------------------
10395|    331|                            stereoFrom->nNumber)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (10395:29): [True: 331, False: 0]
  ------------------
10396|    354|                    {
10397|       |
10398|    354|                        len = (bIsotopicFrom < 0) ? 0 : stereoFrom->nNumberOfStereoCenters;
  ------------------
  |  Branch (10398:31): [True: 23, False: 331]
  ------------------
10399|       |
10400|    354|                        pstereoTo = bIsotopicTo ? &pInChITo->StereoIsotopic : &pInChITo->Stereo;
  ------------------
  |  Branch (10400:37): [True: 199, False: 155]
  ------------------
10401|    354|                        if (!pstereoTo[0])
  ------------------
  |  Branch (10401:29): [True: 268, False: 86]
  ------------------
10402|    268|                        {
10403|    268|                            if (!(pstereoTo[0] = (INChI_Stereo*)inchi_calloc(1, sizeof(**pstereoTo))))
  ------------------
  |  | 1146|    268|#define inchi_calloc   calloc
  ------------------
  |  Branch (10403:33): [True: 0, False: 268]
  ------------------
10404|      0|                            {
10405|      0|                                goto exit_function;
10406|      0|                            }
10407|    268|                        }
10408|    354|                        if (pstereoTo[0]->nNumberOfStereoCenters > 0 || pstereoTo[0]->t_parity ||
  ------------------
  |  Branch (10408:29): [True: 0, False: 354]
  |  Branch (10408:73): [True: 0, False: 354]
  ------------------
10409|    354|                            pstereoTo[0]->nNumber)
  ------------------
  |  Branch (10409:29): [True: 0, False: 354]
  ------------------
10410|      0|                        {
10411|      0|                            ret = RI_ERR_SYNTAX; /* stereo already exists */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10412|      0|                            goto exit_function;
10413|      0|                        }
10414|       |                        /* allocate sp3 stereo */
10415|    354|                        if (!(pstereoTo[0]->t_parity = (S_CHAR*)inchi_calloc((long long)len + 1, sizeof(pstereoTo[0]->b_parity[0]))) ||
  ------------------
  |  | 1146|    354|#define inchi_calloc   calloc
  ------------------
  |  Branch (10415:29): [True: 0, False: 354]
  ------------------
10416|    354|                            !(pstereoTo[0]->nNumber = (AT_NUMB*)inchi_calloc((long long)len + 1, sizeof(pstereoTo[0]->nBondAtom1[0])))) /* djb-rwth: cast operators added */
  ------------------
  |  | 1146|    354|#define inchi_calloc   calloc
  ------------------
  |  Branch (10416:29): [True: 0, False: 354]
  ------------------
10417|      0|                        {
10418|       |                            /* cleanup */
10419|      0|                            if (pstereoTo[0]->t_parity)
  ------------------
  |  Branch (10419:33): [True: 0, False: 0]
  ------------------
10420|      0|                            {
10421|      0|                                inchi_free(pstereoTo[0]->t_parity);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
10422|      0|                                pstereoTo[0]->t_parity = NULL;
10423|      0|                            }
10424|      0|                            if (pstereoTo[0]->nNumber)
  ------------------
  |  Branch (10424:33): [True: 0, False: 0]
  ------------------
10425|      0|                            {
10426|      0|                                inchi_free(pstereoTo[0]->nNumber);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
10427|      0|                                pstereoTo[0]->nNumber = NULL;
10428|      0|                            }
10429|      0|                            goto exit_function;
10430|      0|                        }
10431|       |                        /* copy stereo */
10432|    354|                        if (bIsotopicFrom >= 0 && len)
  ------------------
  |  Branch (10432:29): [True: 331, False: 23]
  |  Branch (10432:51): [True: 306, False: 25]
  ------------------
10433|    306|                        {
10434|    306|                            memcpy(pstereoTo[0]->t_parity, stereoFrom->t_parity, ((long long)len + 1) * sizeof(pstereoTo[0]->t_parity[0])); /* djb-rwth: cast operator added */
10435|    306|                            memcpy(pstereoTo[0]->nNumber, stereoFrom->nNumber, ((long long)len + 1) * sizeof(pstereoTo[0]->nNumber[0])); /* djb-rwth: cast operator added */
10436|    306|                        }
10437|    354|                        pstereoTo[0]->nNumberOfStereoCenters = len;
10438|    354|                        return len + 1;
10439|    354|                    }
10440|      0|                    else
10441|      0|                    {
10442|      0|                        return 0;
10443|      0|                    }
10444|    354|                }
10445|    318|                else
10446|    318|                {
10447|    318|                    if (SegmentType == CPY_SP3_M)
  ------------------
  |  Branch (10447:25): [True: 318, False: 0]
  ------------------
10448|    318|                    {
10449|    318|                        pstereoTo = bIsotopicTo ? &pInChITo->StereoIsotopic : &pInChITo->Stereo;
  ------------------
  |  Branch (10449:37): [True: 167, False: 151]
  ------------------
10450|    318|                        if (!pstereoTo[0])
  ------------------
  |  Branch (10450:29): [True: 4, False: 314]
  ------------------
10451|      4|                        {
10452|      4|                            if (!(pstereoTo[0] = (INChI_Stereo*)inchi_calloc(1, sizeof(**pstereoTo))))
  ------------------
  |  | 1146|      4|#define inchi_calloc   calloc
  ------------------
  |  Branch (10452:33): [True: 0, False: 4]
  ------------------
10453|      0|                            {
10454|      0|                                goto exit_function;
10455|      0|                            }
10456|      4|                        }
10457|    318|                        if (pstereoTo[0]->nCompInv2Abs && NO_VALUE_INT != pstereoTo[0]->nCompInv2Abs)
  ------------------
  |  |   23|     40|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (10457:29): [True: 40, False: 278]
  |  Branch (10457:59): [True: 0, False: 40]
  ------------------
10458|      0|                        {
10459|      0|                            ret = RI_ERR_SYNTAX; /* stereo already exists */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10460|      0|                            goto exit_function;
10461|      0|                        }
10462|    318|                        if (bIsotopicFrom < 0)
  ------------------
  |  Branch (10462:29): [True: 4, False: 314]
  ------------------
10463|      4|                        {
10464|      4|                            pstereoTo[0]->nCompInv2Abs = 0;
10465|      4|                        }
10466|    314|                        else
10467|    314|                        {
10468|    314|                            pstereoTo[0]->nCompInv2Abs = stereoFrom->nCompInv2Abs;
10469|    314|                        }
10470|    318|                        return 1;
10471|    318|                    }
10472|      0|                    else
10473|      0|                    {
10474|       |                        /* use bTrivialInv to save /s1, /s2, /s3 */
10475|      0|                        if (SegmentType == CPY_SP3_S)
  ------------------
  |  Branch (10475:29): [True: 0, False: 0]
  ------------------
10476|      0|                        {
10477|      0|                            pstereoTo = bIsotopicFrom ? &pInChITo->StereoIsotopic : &pInChITo->Stereo;
  ------------------
  |  Branch (10477:41): [True: 0, False: 0]
  ------------------
10478|      0|                            if (!pstereoTo[0])
  ------------------
  |  Branch (10478:33): [True: 0, False: 0]
  ------------------
10479|      0|                            {
10480|      0|                                if (!(pstereoTo[0] = (INChI_Stereo*)inchi_calloc(1, sizeof(**pstereoTo))))
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (10480:37): [True: 0, False: 0]
  ------------------
10481|      0|                                {
10482|      0|                                    goto exit_function;
10483|      0|                                }
10484|      0|                            }
10485|      0|                            if (pstereoTo[0]->bTrivialInv)
  ------------------
  |  Branch (10485:33): [True: 0, False: 0]
  ------------------
10486|      0|                            {
10487|      0|                                ret = RI_ERR_SYNTAX; /* stereo already exists */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10488|      0|                                goto exit_function;
10489|      0|                            }
10490|      0|                            if (stereoFrom) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (10490:33): [True: 0, False: 0]
  ------------------
10491|      0|                                pstereoTo[0]->bTrivialInv = stereoFrom->bTrivialInv;
10492|      0|                            if (bIsotopicFrom < 0)
  ------------------
  |  Branch (10492:33): [True: 0, False: 0]
  ------------------
10493|      0|                            {
10494|      0|                                pstereoTo[0]->bTrivialInv = 0;
10495|      0|                            }
10496|      0|                            else
10497|      0|                            {
10498|      0|                                pstereoTo[0]->bTrivialInv = stereoFrom->bTrivialInv;
10499|      0|                            }
10500|      0|                            return 1;
10501|      0|                        }
10502|      0|                    }
10503|    318|                }
10504|    672|            }
10505|  7.59k|        }
10506|       |
10507|      3|        return 0; /* nothing to copy */
10508|  7.60k|    }
10509|       |
10510|    570|    else if (SegmentType == CPY_ISO_AT)
  ------------------
  |  Branch (10510:14): [True: 570, False: 0]
  ------------------
10511|    570|    {
10512|    570|        int nNumberOfIsotopicAtoms = pInChIFrom->nNumberOfIsotopicAtoms;
10513|    570|        INChI_IsotopicAtom** pIsotopicAtomTo = NULL;
10514|    570|        INChI_IsotopicAtom* IsotopicAtomFrom = pInChIFrom->IsotopicAtom;
10515|    570|        if (bIsotopicFrom < 0 || IsotopicAtomFrom)
  ------------------
  |  Branch (10515:13): [True: 38, False: 532]
  |  Branch (10515:34): [True: 532, False: 0]
  ------------------
10516|    570|        {
10517|    570|            len = (bIsotopicFrom < 0) ? 0 : nNumberOfIsotopicAtoms;
  ------------------
  |  Branch (10517:19): [True: 38, False: 532]
  ------------------
10518|    570|#if ( FIX_GAF_2019_3==1 )
10519|    570|            if (pInChITo->nNumberOfIsotopicAtoms < 1)
  ------------------
  |  Branch (10519:17): [True: 570, False: 0]
  ------------------
10520|    570|            {
10521|       |                /* forcibly free iso-related memory and set to NULL */
10522|    570|                qzfree(pInChITo->IsotopicAtom);
  ------------------
  |  | 1176|    570|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|     16|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 16, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 16, False: 554]
  |  |  |  Branch (1176:61): [Folded, False: 570]
  |  |  ------------------
  ------------------
10523|    570|            }
10524|    570|#endif
10525|    570|            pIsotopicAtomTo = &pInChITo->IsotopicAtom;
10526|    570|            if (!*pIsotopicAtomTo)
  ------------------
  |  Branch (10526:17): [True: 570, False: 0]
  ------------------
10527|    570|            {
10528|    570|                if (!(*pIsotopicAtomTo = (INChI_IsotopicAtom*)inchi_calloc((long long)len + 1, sizeof(**pIsotopicAtomTo)))) /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|    570|#define inchi_calloc   calloc
  ------------------
  |  Branch (10528:21): [True: 0, False: 570]
  ------------------
10529|      0|                {
10530|      0|                    goto exit_function;
10531|      0|                }
10532|    570|            }
10533|    570|            if (pInChITo->nNumberOfIsotopicAtoms)
  ------------------
  |  Branch (10533:17): [True: 0, False: 570]
  ------------------
10534|      0|            {
10535|      0|                ret = RI_ERR_SYNTAX; /* stereo already exists */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10536|      0|                goto exit_function;
10537|      0|            }
10538|    570|            if (bIsotopicFrom >= 0 && len)
  ------------------
  |  Branch (10538:17): [True: 532, False: 38]
  |  Branch (10538:39): [True: 486, False: 46]
  ------------------
10539|    486|            {
10540|    486|                memcpy(*pIsotopicAtomTo, IsotopicAtomFrom, ((long long)len + 1) * sizeof(**pIsotopicAtomTo)); /* djb-rwth: cast operator added */
10541|    486|            }
10542|    570|            pInChITo->nNumberOfIsotopicAtoms = len;
10543|    570|            return len + 1;
10544|    570|        }
10545|       |
10546|      0|        return 0;
10547|    570|    }
10548|       |
10549|      0|    ret = RI_ERR_PROGR; /* program error */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
10550|       |
10551|      1|exit_function:
10552|       |
10553|      1|    return ret;
10554|      0|}
ichiread.c:getInChIChar:
10580|  4.44M|{
10581|  4.44M|    if (pInp->type == INCHI_IOS_TYPE_STRING)
  ------------------
  |  | 1016|  4.44M|#define INCHI_IOS_TYPE_STRING 1
  ------------------
  |  Branch (10581:9): [True: 4.44M, False: 0]
  ------------------
10582|  4.44M|    {
10583|       |        /* input from string */
10584|  4.44M|        if (pInp->s.nPtr < pInp->s.nUsedLength)
  ------------------
  |  Branch (10584:13): [True: 4.43M, False: 6.00k]
  ------------------
10585|  4.43M|        {
10586|  4.43M|            return (int)pInp->s.pStr[pInp->s.nPtr++];
10587|  4.43M|        }
10588|  6.00k|        return RI_ERR_EOF;
  ------------------
  |  |   19|  6.00k|#define RI_ERR_EOF     (0)
  ------------------
10589|  4.44M|    }
10590|      0|    else
10591|      0|    {
10592|       |        /* input from plain file */
10593|      0|        int c;
10594|       |#if ( defined(_MSC_VER)&&defined(_WIN32) || defined(__BORLANDC__)&&defined(__WIN32__) || defined(__GNUC__)&&defined(__MINGW32__)&&defined(_WIN32) )
10595|       |        do
10596|       |        {
10597|       |            c = getc(pInp->f);
10598|       |            if (c == EOF)
10599|       |            {
10600|       |                c = RI_ERR_EOF;
10601|       |                break;
10602|       |            }
10603|       |        } while (c == '\r');
10604|       |#else
10605|      0|        c = getc(pInp->f);
10606|      0|        if (c == EOF)
  ------------------
  |  Branch (10606:13): [True: 0, False: 0]
  ------------------
10607|      0|        {
10608|      0|            c = RI_ERR_EOF;
  ------------------
  |  |   19|      0|#define RI_ERR_EOF     (0)
  ------------------
10609|      0|        }
10610|      0|#endif
10611|      0|        return c;
10612|      0|    }
10613|  4.44M|}
ichiread.c:nGetInChISegment:
10693|  50.5k|{
10694|  50.5k|    int c;
10695|  50.5k|    Line->len = 0;
10696|  4.44M|    while (0 < (c = AddInChIChar(pInp, Line, pszToken)))
  ------------------
  |  Branch (10696:12): [True: 4.39M, False: 50.5k]
  ------------------
10697|  4.39M|    {
10698|  4.39M|        ;
10699|  4.39M|    }
10700|  50.5k|    if (c < -2)
  ------------------
  |  Branch (10700:9): [True: 38.9k, False: 11.5k]
  ------------------
10701|  38.9k|    {
10702|  38.9k|        c = -(c + 2);
10703|  38.9k|    }
10704|  50.5k|    Line->c = c;
10705|       |
10706|  50.5k|    return c;
10707|  50.5k|}
ichiread.c:AddInChIChar:
10620|  4.44M|{
10621|  4.44M|    int c = getInChIChar(pInp);
10622|       |    /*
10623|       |    while ( c == '\r' ) {
10624|       |    c = getInChIChar( pInp );
10625|       |    }
10626|       |    */
10627|       |
10628|       |    INCHI_HEAPCHK
10629|       |
10630|  4.44M|        if (Line->len + 2 >= Line->len_alloc)
  ------------------
  |  Branch (10630:13): [True: 42.5k, False: 4.39M]
  ------------------
10631|  42.5k|        {
10632|  42.5k|            char* str = (char*)inchi_calloc((long long)Line->len_alloc + SEGM_LINE_ADD, sizeof(str[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  42.5k|#define inchi_calloc   calloc
  ------------------
                          char* str = (char*)inchi_calloc((long long)Line->len_alloc + SEGM_LINE_ADD, sizeof(str[0])); /* djb-rwth: cast operator added */
  ------------------
  |  |   50|  42.5k|#define SEGM_LINE_ADD 128
  ------------------
10633|  42.5k|            INCHI_HEAPCHK
10634|  42.5k|                if (str)
  ------------------
  |  Branch (10634:21): [True: 42.5k, False: 0]
  ------------------
10635|  42.5k|                {
10636|  42.5k|                    if (Line->len > 0 && Line->str)
  ------------------
  |  Branch (10636:25): [True: 29.9k, False: 12.5k]
  |  Branch (10636:42): [True: 29.9k, False: 0]
  ------------------
10637|  29.9k|                    {
10638|  29.9k|                        memcpy(str, Line->str, sizeof(str[0]) * Line->len);
10639|  29.9k|                        Line->len_alloc += SEGM_LINE_ADD;
  ------------------
  |  |   50|  29.9k|#define SEGM_LINE_ADD 128
  ------------------
10640|  29.9k|                        inchi_free(Line->str);
  ------------------
  |  | 1152|  29.9k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 29.9k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 29.9k]
  |  |  ------------------
  ------------------
10641|  29.9k|                        INCHI_HEAPCHK
10642|  29.9k|                    }
10643|  12.5k|                    else
10644|  12.5k|                    {
10645|  12.5k|                        Line->len_alloc += SEGM_LINE_ADD;
  ------------------
  |  |   50|  12.5k|#define SEGM_LINE_ADD 128
  ------------------
10646|  12.5k|                    }
10647|  42.5k|                    Line->str = str;
10648|  42.5k|                }
10649|      0|                else
10650|      0|                {
10651|      0|                    c = RI_ERR_ALLOC; /* fatal error */
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
10652|      0|                    goto exit_function;
10653|      0|                }
10654|  42.5k|        }
10655|  4.44M|    INCHI_HEAPCHK
10656|  4.44M|        if (c < 0)
  ------------------
  |  Branch (10656:13): [True: 0, False: 4.44M]
  ------------------
10657|      0|        {
10658|      0|            Line->str[Line->len] = '\0';
10659|      0|            INCHI_HEAPCHK
10660|      0|                c = RI_ERR_SYNTAX; /* fatal error: wrong char */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10661|      0|            goto exit_function;
10662|      0|        }
10663|       |
10664|  4.44M|    if (c && strchr(pszToken, c)) /*        /\            */
  ------------------
  |  Branch (10664:9): [True: 4.43M, False: 11.5k]
  |  Branch (10664:14): [True: 38.9k, False: 4.39M]
  ------------------
10665|  38.9k|    {
10666|  38.9k|        Line->str[Line->len] = '\0';
10667|  38.9k|        INCHI_HEAPCHK
10668|  38.9k|            c = -(c + 2);
10669|  38.9k|        goto exit_function;
10670|  38.9k|    }
10671|  4.40M|    else if (!c && !Line->len)
  ------------------
  |  Branch (10671:14): [True: 11.5k, False: 4.39M]
  |  Branch (10671:20): [True: 1.23k, False: 10.3k]
  ------------------
10672|  1.23k|    {
10673|  1.23k|        Line->str[Line->len] = c;
10674|  1.23k|        INCHI_HEAPCHK
10675|  1.23k|    }
10676|  4.40M|    else
10677|  4.40M|    {
10678|  4.40M|        Line->str[Line->len++] = c;
10679|  4.40M|        INCHI_HEAPCHK
10680|  4.40M|    }
10681|       |
10682|  4.44M|exit_function:
10683|       |
10684|       |    INCHI_HEAPCHK
10685|       |
10686|  4.44M|        return c; /* djb-rwth: addressing coverity ID #499500 -- c = getInChIChar(pInp) cannot be tainted */
10687|  4.44M|}
ichiread.c:getInchiStateReadErr:
  509|  2.34k|{
  510|  2.34k|    int i, bRecMet = 0;
  511|       |
  512|  2.34k|    if (stat >= IST_HAPPENED_IN_RECMET)
  ------------------
  |  |  342|  2.34k|#define IST_HAPPENED_IN_RECMET   100
  ------------------
  |  Branch (512:9): [True: 82, False: 2.26k]
  ------------------
  513|     82|    {
  514|     82|        bRecMet = 1;
  515|     82|        stat -= IST_HAPPENED_IN_RECMET;
  ------------------
  |  |  342|     82|#define IST_HAPPENED_IN_RECMET   100
  ------------------
  516|     82|    }
  517|  39.2k|    for (i = 0; 0 <= irErrMsg[i].stat && stat != irErrMsg[i].stat; i++)
  ------------------
  |  Branch (517:17): [True: 39.2k, False: 0]
  |  Branch (517:42): [True: 36.8k, False: 2.34k]
  ------------------
  518|  36.8k|    {
  519|  36.8k|        ;
  520|  36.8k|    }
  521|  2.34k|    sprintf(szMsg,
  522|  2.34k|#if ( FIX_DALKE_BUGS == 1 )
  523|  2.34k|        "%s%.100s",
  524|       |#else
  525|       |        "%s%s",
  526|       |#endif
  527|  2.34k|        irErrMsg[i].msg, bRecMet ? ", Reconnected layer" : "");
  ------------------
  |  Branch (527:26): [True: 82, False: 2.26k]
  ------------------
  528|       |
  529|  2.34k|}
ichiread.c:getInchiErrName:
  534|  1.93k|{
  535|  1.93k|    switch (nErr)
  ------------------
  |  Branch (535:13): [True: 1.89k, False: 31]
  ------------------
  536|  1.93k|    {
  537|     31|    case RI_ERR_ALLOC:
  ------------------
  |  |   15|     31|#define RI_ERR_ALLOC   (-1)
  ------------------
  |  Branch (537:5): [True: 31, False: 1.89k]
  ------------------
  538|     31|        return "Allocation failed";
  539|     18|    case RI_ERR_PROGR:
  ------------------
  |  |   17|     18|#define RI_ERR_PROGR   (-3)
  ------------------
  |  Branch (539:5): [True: 18, False: 1.91k]
  ------------------
  540|     18|        return "Program error";
  541|  1.85k|    case RI_ERR_SYNTAX:
  ------------------
  |  |   16|  1.85k|#define RI_ERR_SYNTAX  (-2)
  ------------------
  |  Branch (541:5): [True: 1.85k, False: 80]
  ------------------
  542|  1.85k|        return "Syntax error";
  543|      0|    case RI_ERR_EOL:
  ------------------
  |  |   18|      0|#define RI_ERR_EOL     (-4)
  ------------------
  |  Branch (543:5): [True: 0, False: 1.93k]
  ------------------
  544|      0|        return "End of line";
  545|  1.93k|    }
  546|     31|    return "Unknown error";
  547|  1.93k|}
ichiread.c:SetHillFormFromInChI:
  555|  5.02k|{
  556|  5.02k|    int iINChI, iTaut, iComp, num_diff;
  557|  5.02k|    INChI* pINChI;
  558|  5.02k|    char* szHillFormulaOld;
  559|  15.0k|    for (iINChI = 0, num_diff = 0; iINChI < INCHI_NUM; iINChI++)
  ------------------
  |  |  569|  15.0k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (559:36): [True: 10.0k, False: 5.02k]
  ------------------
  560|  10.0k|    {
  561|  30.1k|        for (iTaut = TAUT_NON; iTaut < TAUT_NUM; iTaut++)
  ------------------
  |  |  574|  10.0k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      for (iTaut = TAUT_NON; iTaut < TAUT_NUM; iTaut++)
  ------------------
  |  |  573|  30.1k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (561:32): [True: 20.1k, False: 10.0k]
  ------------------
  562|  20.1k|        {
  563|   117k|            for (iComp = 0; iComp < OneInput->nNumComponents[iINChI][iTaut]; iComp++)
  ------------------
  |  Branch (563:29): [True: 97.5k, False: 20.1k]
  ------------------
  564|  97.5k|            {
  565|  97.5k|                pINChI = &OneInput->pInpInChI[iINChI][iTaut][iComp];
  566|  97.5k|                if (!pINChI->nNumberOfAtoms || pINChI->bDeleted || !pINChI->szHillFormula || !pINChI->szHillFormula[0])
  ------------------
  |  Branch (566:21): [True: 0, False: 97.5k]
  |  Branch (566:48): [True: 7, False: 97.5k]
  |  Branch (566:68): [True: 0, False: 97.5k]
  |  Branch (566:94): [True: 0, False: 97.5k]
  ------------------
  567|      7|                {
  568|      7|                    continue;
  569|      7|                }
  570|  97.5k|                szHillFormulaOld = pINChI->szHillFormula;
  571|  97.5k|                pINChI->szHillFormula = AllocateAndFillHillFormula(pINChI);
  572|  97.5k|                num_diff += !pINChI->szHillFormula || !pINChI->szHillFormula[0] || strcmp(pINChI->szHillFormula, szHillFormulaOld);
  ------------------
  |  Branch (572:29): [True: 35.2k, False: 62.2k]
  |  Branch (572:55): [True: 0, False: 62.2k]
  |  Branch (572:84): [True: 44.1k, False: 18.1k]
  ------------------
  573|  97.5k|                inchi_free(szHillFormulaOld);
  ------------------
  |  | 1152|  97.5k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 97.5k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 97.5k]
  |  |  ------------------
  ------------------
  574|  97.5k|            }
  575|  20.1k|        }
  576|  10.0k|    }
  577|       |
  578|  5.02k|    return num_diff;
  579|  5.02k|}
ichiread.c:OutputInChIAsRequested:
 1212|  5.02k|{
 1213|  5.02k|    int      j, k, k1, k2, ret2 = 0, iINChI, iINChI1; /* djb-rwth: removing redundant variables */
 1214|  5.02k|    PINChI2* pINChI[INCHI_NUM], * newPTR1;
 1215|  5.02k|    PINChI_Aux2* pINChI_Aux[INCHI_NUM], * newPTR2;
 1216|  5.02k|    int bReqNonTaut;
 1217|  5.02k|    int bHasSomeReconnected;
 1218|       |
 1219|  5.02k|    INPUT_PARMS ip_local;
 1220|  5.02k|    STRUCT_DATA sd_local;
 1221|  5.02k|    INPUT_PARMS* ip = &ip_local;
 1222|  5.02k|    STRUCT_DATA* sd = &sd_local;
 1223|  5.02k|    NORM_CANON_FLAGS ncFlags;
 1224|  5.02k|    NORM_CANON_FLAGS* pncFlags = &ncFlags;
 1225|  5.02k|    int  nRet1, bSortPrintINChIFlags;
 1226|  5.02k|    int  bReqSplitOutputInChI;
 1227|  5.02k|    int  nNumOutputComponents;
 1228|       |
 1229|  5.02k|    INCHI_IOS_STRING temp_string_container;
 1230|  5.02k|    INCHI_IOS_STRING* strbuf = &temp_string_container;
 1231|  5.02k|    memset(strbuf, 0, sizeof(*strbuf)); /* djb-rwth: memset_s C11/Annex K variant? */
 1232|       |
 1233|  5.02k|    if (0 >= inchi_strbuf_init(strbuf, INCHI_STRBUF_INITIAL_SIZE, INCHI_STRBUF_SIZE_INCREMENT))
  ------------------
  |  |   65|  5.02k|#define INCHI_STRBUF_INITIAL_SIZE 262144
  ------------------
                  if (0 >= inchi_strbuf_init(strbuf, INCHI_STRBUF_INITIAL_SIZE, INCHI_STRBUF_SIZE_INCREMENT))
  ------------------
  |  |   66|  5.02k|#define INCHI_STRBUF_SIZE_INCREMENT 262144
  ------------------
  |  Branch (1233:9): [True: 0, False: 5.02k]
  ------------------
 1234|      0|    {
 1235|      0|        ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1236|      0|        goto exit_error;
 1237|      0|    }
 1238|       |
 1239|  5.02k|    nRet1 = 0;
 1240|  5.02k|    k1 = k2 = 0;
 1241|  5.02k|    memset(pncFlags, 0, sizeof(*pncFlags)); /* djb-rwth: memset_s C11/Annex K variant? */
 1242|  5.02k|    memset(pINChI, 0, sizeof(pINChI)); /* djb-rwth: memset_s C11/Annex K variant? */
 1243|  5.02k|    memset(pINChI_Aux, 0, sizeof(pINChI_Aux)); /* djb-rwth: memset_s C11/Annex K variant? */
 1244|       |
 1245|  5.02k|    *ip = *ip_inp;
 1246|  5.02k|    *sd = *sd_inp;
 1247|  5.02k|    bHasSomeReconnected = 0;
 1248|  5.02k|    bSortPrintINChIFlags = 0;
 1249|       |    /* djb-rwth: removing redundant code */
 1250|  5.02k|    bReqNonTaut = (0 != (ip->nMode & REQ_MODE_BASIC));
  ------------------
  |  |   15|  5.02k|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
 1251|  5.02k|    bReqSplitOutputInChI = (0 != (ip->bReadInChIOptions & READ_INCHI_SPLIT_OUTPUT));
  ------------------
  |  |  989|  5.02k|#define READ_INCHI_SPLIT_OUTPUT          0x00000002
  ------------------
 1252|       |
 1253|       |    INCHI_HEAPCHK
 1254|       |
 1255|  5.02k|        if (num_components[INCHI_BAS])
  ------------------
  |  |  570|  5.02k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1255:13): [True: 5.02k, False: 0]
  ------------------
 1256|  5.02k|        {
 1257|       |            /* djb-rwth: MYREALLOC2( PINChI2, PINChI_Aux2, pINChI[INCHI_BAS], pINChI_Aux[INCHI_BAS], num_components[INCHI_BAS], (long long)num_components[INCHI_BAS], k1 ); has been replaced and the whole block rewritten to address memory leaks and reading from freed memory locations */
 1258|       |
 1259|  5.02k|            do {
 1260|  5.02k|                if ((num_components[INCHI_BAS]) <= ((long long)num_components[INCHI_BAS]))
  ------------------
  |  |  570|  5.02k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              if ((num_components[INCHI_BAS]) <= ((long long)num_components[INCHI_BAS]))
  ------------------
  |  |  570|  5.02k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1260:21): [True: 5.02k, False: 0]
  ------------------
 1261|  5.02k|                {
 1262|  5.02k|                    newPTR1 = (PINChI2*)inchi_calloc(((long long)num_components[INCHI_BAS]) + 1, sizeof(PINChI2));
  ------------------
  |  | 1146|  5.02k|#define inchi_calloc   calloc
  ------------------
                                  newPTR1 = (PINChI2*)inchi_calloc(((long long)num_components[INCHI_BAS]) + 1, sizeof(PINChI2));
  ------------------
  |  |  570|  5.02k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1263|  5.02k|                    newPTR2 = (PINChI_Aux2*)inchi_calloc(((long long)num_components[INCHI_BAS]) + 1, sizeof(PINChI_Aux2));
  ------------------
  |  | 1146|  5.02k|#define inchi_calloc   calloc
  ------------------
                                  newPTR2 = (PINChI_Aux2*)inchi_calloc(((long long)num_components[INCHI_BAS]) + 1, sizeof(PINChI_Aux2));
  ------------------
  |  |  570|  5.02k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1264|  5.02k|                    if (newPTR1 && newPTR2) {
  ------------------
  |  Branch (1264:25): [True: 5.02k, False: 0]
  |  Branch (1264:36): [True: 5.02k, False: 0]
  ------------------
 1265|  5.02k|                        if ((pINChI[INCHI_BAS]) && (num_components[INCHI_BAS]) > 0)
  ------------------
  |  |  570|  5.02k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                                      if ((pINChI[INCHI_BAS]) && (num_components[INCHI_BAS]) > 0)
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1265:29): [True: 0, False: 5.02k]
  |  Branch (1265:52): [True: 0, False: 0]
  ------------------
 1266|      0|                            memcpy(newPTR1, (pINChI[INCHI_BAS]), (num_components[INCHI_BAS]) * sizeof(PINChI2));
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                                          memcpy(newPTR1, (pINChI[INCHI_BAS]), (num_components[INCHI_BAS]) * sizeof(PINChI2));
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1267|  5.02k|                        if ((pINChI_Aux[INCHI_BAS]) && (num_components[INCHI_BAS]) > 0)
  ------------------
  |  |  570|  5.02k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                                      if ((pINChI_Aux[INCHI_BAS]) && (num_components[INCHI_BAS]) > 0)
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1267:29): [True: 0, False: 5.02k]
  |  Branch (1267:56): [True: 0, False: 0]
  ------------------
 1268|      0|                            memcpy(newPTR2, (pINChI_Aux[INCHI_BAS]), (num_components[INCHI_BAS]) * sizeof(PINChI_Aux2));
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                                          memcpy(newPTR2, (pINChI_Aux[INCHI_BAS]), (num_components[INCHI_BAS]) * sizeof(PINChI_Aux2));
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1269|  5.02k|                        if (pINChI[INCHI_BAS])
  ------------------
  |  |  570|  5.02k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1269:29): [True: 0, False: 5.02k]
  ------------------
 1270|      0|                            inchi_free(pINChI[INCHI_BAS]);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1271|  5.02k|                        if (pINChI_Aux[INCHI_BAS])
  ------------------
  |  |  570|  5.02k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1271:29): [True: 0, False: 5.02k]
  ------------------
 1272|      0|                            inchi_free(pINChI_Aux[INCHI_BAS]);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1273|  5.02k|                        pINChI[INCHI_BAS] = newPTR1;
  ------------------
  |  |  570|  5.02k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1274|  5.02k|                        pINChI_Aux[INCHI_BAS] = newPTR2;
  ------------------
  |  |  570|  5.02k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1275|  5.02k|                        num_components[INCHI_BAS] = (long long)num_components[INCHI_BAS];
  ------------------
  |  |  570|  5.02k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                                      num_components[INCHI_BAS] = (long long)num_components[INCHI_BAS];
  ------------------
  |  |  570|  5.02k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1276|  5.02k|                        k1 = 0;
 1277|  5.02k|                    }
 1278|      0|                    else
 1279|      0|                    {
 1280|      0|                        inchi_free(newPTR1);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1281|      0|                        inchi_free(newPTR2);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1282|      0|                        k1 = 1;
 1283|      0|                    }
 1284|  5.02k|                }
 1285|      0|                else { k1 = 0; }
 1286|  5.02k|            } while (0);
  ------------------
  |  Branch (1286:22): [Folded, False: 5.02k]
  ------------------
 1287|  5.02k|        }
 1288|       |
 1289|  5.02k|    if (num_components[INCHI_REC])
  ------------------
  |  |  571|  5.02k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1289:9): [True: 25, False: 5.00k]
  ------------------
 1290|     25|    {
 1291|       |        /* djb-rwth: MYREALLOC2( PINChI2, PINChI_Aux2, pINChI[INCHI_REC], pINChI_Aux[INCHI_REC], num_components[INCHI_REC], (long long)num_components[INCHI_REC], k2 ); has been replaced and the whole block rewritten to address memory leaks and reading from freed memory locations */
 1292|       |
 1293|     25|        do {
 1294|     25|            if ((num_components[INCHI_REC]) <= ((long long)num_components[INCHI_REC]))
  ------------------
  |  |  571|     25|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          if ((num_components[INCHI_REC]) <= ((long long)num_components[INCHI_REC]))
  ------------------
  |  |  571|     25|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1294:17): [True: 25, False: 0]
  ------------------
 1295|     25|            {
 1296|     25|                newPTR1 = (PINChI2*)inchi_calloc(((long long)num_components[INCHI_REC]) + 1, sizeof(PINChI2));
  ------------------
  |  | 1146|     25|#define inchi_calloc   calloc
  ------------------
                              newPTR1 = (PINChI2*)inchi_calloc(((long long)num_components[INCHI_REC]) + 1, sizeof(PINChI2));
  ------------------
  |  |  571|     25|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1297|     25|                newPTR2 = (PINChI_Aux2*)inchi_calloc(((long long)num_components[INCHI_REC]) + 1, sizeof(PINChI_Aux2));
  ------------------
  |  | 1146|     25|#define inchi_calloc   calloc
  ------------------
                              newPTR2 = (PINChI_Aux2*)inchi_calloc(((long long)num_components[INCHI_REC]) + 1, sizeof(PINChI_Aux2));
  ------------------
  |  |  571|     25|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1298|     25|                if (newPTR1 && newPTR2) {
  ------------------
  |  Branch (1298:21): [True: 25, False: 0]
  |  Branch (1298:32): [True: 25, False: 0]
  ------------------
 1299|     25|                    if ((pINChI[INCHI_REC]) && (num_components[INCHI_REC]) > 0)
  ------------------
  |  |  571|     25|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                                  if ((pINChI[INCHI_REC]) && (num_components[INCHI_REC]) > 0)
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1299:25): [True: 0, False: 25]
  |  Branch (1299:48): [True: 0, False: 0]
  ------------------
 1300|      0|                        memcpy(newPTR1, (pINChI[INCHI_REC]), (num_components[INCHI_REC]) * sizeof(PINChI2));
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                                      memcpy(newPTR1, (pINChI[INCHI_REC]), (num_components[INCHI_REC]) * sizeof(PINChI2));
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1301|     25|                    if ((pINChI_Aux[INCHI_REC]) && (num_components[INCHI_REC]) > 0)
  ------------------
  |  |  571|     25|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                                  if ((pINChI_Aux[INCHI_REC]) && (num_components[INCHI_REC]) > 0)
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1301:25): [True: 0, False: 25]
  |  Branch (1301:52): [True: 0, False: 0]
  ------------------
 1302|      0|                        memcpy(newPTR2, (pINChI_Aux[INCHI_REC]), (num_components[INCHI_REC]) * sizeof(PINChI_Aux2));
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                                      memcpy(newPTR2, (pINChI_Aux[INCHI_REC]), (num_components[INCHI_REC]) * sizeof(PINChI_Aux2));
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1303|     25|                    if (pINChI[INCHI_REC])
  ------------------
  |  |  571|     25|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1303:25): [True: 0, False: 25]
  ------------------
 1304|      0|                        inchi_free(pINChI[INCHI_REC]);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1305|     25|                    if (pINChI_Aux[INCHI_REC])
  ------------------
  |  |  571|     25|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1305:25): [True: 0, False: 25]
  ------------------
 1306|      0|                        inchi_free(pINChI_Aux[INCHI_REC]);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1307|     25|                    pINChI[INCHI_REC] = newPTR1;
  ------------------
  |  |  571|     25|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1308|     25|                    pINChI_Aux[INCHI_REC] = newPTR2;
  ------------------
  |  |  571|     25|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1309|     25|                    num_components[INCHI_REC] = (long long)num_components[INCHI_REC];
  ------------------
  |  |  571|     25|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                                  num_components[INCHI_REC] = (long long)num_components[INCHI_REC];
  ------------------
  |  |  571|     25|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1310|     25|                    k2 = 0;
 1311|     25|                }
 1312|      0|                else
 1313|      0|                {
 1314|      0|                    inchi_free(newPTR1);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1315|      0|                    inchi_free(newPTR2);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1316|      0|                    k2 = 1;
 1317|      0|                }
 1318|     25|            }
 1319|      0|            else { k2 = 0; }
 1320|     25|        } while (0);
  ------------------
  |  Branch (1320:18): [Folded, False: 25]
  ------------------
 1321|     25|    }
 1322|       |
 1323|       |
 1324|       |    INCHI_HEAPCHK
 1325|       |
 1326|  5.02k|        if (k1 || k2 /*|| !pStr*/)
  ------------------
  |  Branch (1326:13): [True: 0, False: 5.02k]
  |  Branch (1326:19): [True: 0, False: 5.02k]
  ------------------
 1327|      0|        {
 1328|       |            /* djb-rwth: avoiding memory leak */
 1329|      0|            free(pINChI[INCHI_BAS]);
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1330|      0|            free(pINChI_Aux[INCHI_BAS]);
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1331|      0|            free(pINChI[INCHI_REC]);
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1332|      0|            free(pINChI_Aux[INCHI_REC]);
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1333|      0|            ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1334|      0|            goto exit_error;
 1335|      0|        }
 1336|       |
 1337|  5.02k|    if (num_components[INCHI_REC] &&
  ------------------
  |  |  571|  5.02k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1337:9): [True: 25, False: 5.00k]
  ------------------
 1338|     25|        (ip->bTautFlags & TG_FLAG_RECONNECT_COORD) &&
  ------------------
  |  |  932|     25|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  |  Branch (1338:9): [True: 0, False: 25]
  ------------------
 1339|      0|        (ip->bTautFlags & TG_FLAG_DISCONNECT_COORD))
  ------------------
  |  |  931|      0|#define TG_FLAG_DISCONNECT_COORD         0x00000080   /* find "coord. centers" and disconnect them */
  ------------------
  |  Branch (1339:9): [True: 0, False: 0]
  ------------------
 1340|      0|    {
 1341|      0|        sd->bTautFlagsDone[0] |= TG_FLAG_DISCONNECT_COORD_DONE;
  ------------------
  |  |  975|      0|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
 1342|      0|        bHasSomeReconnected = 1;
 1343|      0|    }
 1344|       |
 1345|  15.0k|    for (iINChI = 0; iINChI < INCHI_NUM; iINChI++)
  ------------------
  |  |  569|  15.0k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1345:22): [True: 10.0k, False: 5.02k]
  ------------------
 1346|  10.0k|    {
 1347|  30.1k|        for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  573|  30.1k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1347:21): [True: 20.1k, False: 10.0k]
  ------------------
 1348|  20.1k|        {
 1349|  20.1k|            if (bReqNonTaut || (j != TAUT_NON && OneInput->pInpInChI[iINChI][j])) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  574|  40.2k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1349:17): [True: 0, False: 20.1k]
  |  Branch (1349:33): [True: 10.0k, False: 10.0k]
  |  Branch (1349:50): [True: 5.05k, False: 5.00k]
  ------------------
 1350|  5.05k|            {
 1351|   102k|                for (k = 0; k < num_components[iINChI]; k++)
  ------------------
  |  Branch (1351:29): [True: 97.5k, False: 5.05k]
  ------------------
 1352|  97.5k|                {
 1353|       |                    /* allocate InChI & AuxInfo */
 1354|  97.5k|                    if (!(pINChI[iINChI][k][j] = (INChI*)inchi_calloc(1, sizeof(INChI))))
  ------------------
  |  | 1146|  97.5k|#define inchi_calloc   calloc
  ------------------
  |  Branch (1354:25): [True: 0, False: 97.5k]
  ------------------
 1355|      0|                    {
 1356|       |                        /* djb-rwth: avoiding memory leak */
 1357|      0|                        free(pINChI[INCHI_BAS]);
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1358|      0|                        free(pINChI_Aux[INCHI_BAS]);
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1359|      0|                        free(pINChI[INCHI_REC]);
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1360|      0|                        free(pINChI_Aux[INCHI_REC]);
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1361|      0|                        ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1362|      0|                        goto exit_error;
 1363|      0|                    }
 1364|  97.5k|                    if (!(pINChI_Aux[iINChI][k][j] = (INChI_Aux*)inchi_calloc(1, sizeof(INChI_Aux))))
  ------------------
  |  | 1146|  97.5k|#define inchi_calloc   calloc
  ------------------
  |  Branch (1364:25): [True: 0, False: 97.5k]
  ------------------
 1365|      0|                    {
 1366|       |                        /* djb-rwth: avoiding memory leak */
 1367|      0|                        free(pINChI[INCHI_BAS]);
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1368|      0|                        free(pINChI_Aux[INCHI_BAS]);
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1369|      0|                        free(pINChI[INCHI_REC]);
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1370|      0|                        free(pINChI_Aux[INCHI_REC]);
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1371|      0|                        ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1372|      0|                        goto exit_error;
 1373|      0|                    }
 1374|       |                    /* copy InChI & AuxInfo */
 1375|  97.5k|                    if (k < OneInput->nNumComponents[iINChI][j])
  ------------------
  |  Branch (1375:25): [True: 97.5k, False: 0]
  ------------------
 1376|  97.5k|                    {
 1377|       |
 1378|       |                        /* copy InChI */
 1379|  97.5k|                        *pINChI[iINChI][k][j] = OneInput->pInpInChI[iINChI][j][k];
 1380|  97.5k|                        memset(&OneInput->pInpInChI[iINChI][j][k], 0, sizeof(OneInput->pInpInChI[iINChI][j][k])); /* djb-rwth: memset_s C11/Annex K variant? */
 1381|       |                        INCHI_HEAPCHK
 1382|       |                            /* take care of protons in AuxInfo */
 1383|       |
 1384|  97.5k|                            if (nModeProtonIsoExchgH[iINChI] == MODE_PIXH_ADD_TO_EACH && j == TAUT_YES)
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1384:33): [True: 0, False: 97.5k]
  |  Branch (1384:90): [True: 0, False: 0]
  ------------------
 1385|      0|                            {
 1386|      0|                                pINChI_Aux[iINChI][k][j]->nNumRemovedProtons =
 1387|      0|                                    OneInput->nNumProtons[iINChI][j].pNumProtons[k].nNumRemovedProtons;
 1388|      0|                                for (k1 = 0; k1 < NUM_H_ISOTOPES; k1++)
  ------------------
  |  |   72|      0|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (1388:46): [True: 0, False: 0]
  ------------------
 1389|      0|                                {
 1390|      0|                                    pINChI_Aux[iINChI][k][j]->nNumRemovedIsotopicH[k1] =
 1391|      0|                                        OneInput->nNumProtons[iINChI][j].pNumProtons[k].nNumRemovedIsotopicH[k1];
 1392|      0|                                }
 1393|      0|                                INCHI_HEAPCHK
 1394|      0|                            }
 1395|  97.5k|                            else if ((!k && nModeProtonIsoExchgH[iINChI] == MODE_PIXH_ADD_TO_FIRST) ||
  ------------------
  |  Branch (1395:39): [True: 5.05k, False: 92.4k]
  |  Branch (1395:45): [True: 5.05k, False: 0]
  ------------------
 1396|  92.4k|                                (k + 1 == OneInput->nNumComponents[iINChI][j] &&
  ------------------
  |  Branch (1396:34): [True: 1.34k, False: 91.1k]
  ------------------
 1397|  1.34k|                                    nModeProtonIsoExchgH[iINChI] == MODE_PIXH_ADD_A_PIXH_COMPONENT)) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (1397:37): [True: 0, False: 1.34k]
  ------------------
 1398|  5.05k|                            {
 1399|       |                                /* add protons and exchangeable isotopic H to the first component's AuxInfo */
 1400|  5.05k|                                pINChI_Aux[iINChI][k][j]->nNumRemovedProtons = OneInput->nNumProtons[iINChI][j].nNumRemovedProtons;
 1401|  20.2k|                                for (k1 = 0; k1 < NUM_H_ISOTOPES; k1++)
  ------------------
  |  |   72|  20.2k|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (1401:46): [True: 15.1k, False: 5.05k]
  ------------------
 1402|  15.1k|                                {
 1403|  15.1k|                                    pINChI_Aux[iINChI][k][j]->nNumRemovedIsotopicH[k1] =
 1404|  15.1k|                                        OneInput->nNumProtons[iINChI][j].nNumRemovedIsotopicH[k1];
 1405|  15.1k|                                }
 1406|  5.05k|                                INCHI_HEAPCHK
 1407|  5.05k|                            }
 1408|  92.4k|                            else
 1409|  92.4k|                            {
 1410|  92.4k|                                pINChI_Aux[iINChI][k][j]->bDeleted = pINChI[iINChI][k][j]->bDeleted;
 1411|  92.4k|                            }
 1412|       |
 1413|  97.5k|                        if (j == TAUT_YES && pINChI[iINChI][k][j] && pINChI[iINChI][k][j]->nNumberOfAtoms &&
  ------------------
  |  |  575|   195k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1413:29): [True: 97.5k, False: 0]
  |  Branch (1413:46): [True: 97.5k, False: 0]
  |  Branch (1413:70): [True: 97.5k, False: 0]
  ------------------
 1414|  97.5k|                            !pINChI[iINChI][k][j]->nNum_H_fixed)
  ------------------
  |  Branch (1414:29): [True: 97.5k, False: 0]
  ------------------
 1415|  97.5k|                        {
 1416|       |                            /* serializer crashes if it is not allocated */
 1417|  97.5k|                            pINChI[iINChI][k][j]->nNum_H_fixed = (S_CHAR*)inchi_calloc((long long)pINChI[iINChI][k][j]->nNumberOfAtoms + 1, sizeof(pINChI[0][0][0]->nNum_H_fixed[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  97.5k|#define inchi_calloc   calloc
  ------------------
 1418|  97.5k|                        }
 1419|       |
 1420|  97.5k|                        if (j == TAUT_YES && k < OneInput->nNumComponents[iINChI][TAUT_NON] &&
  ------------------
  |  |  575|   195k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                      if (j == TAUT_YES && k < OneInput->nNumComponents[iINChI][TAUT_NON] &&
  ------------------
  |  |  574|  97.5k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1420:29): [True: 97.5k, False: 0]
  |  Branch (1420:46): [True: 0, False: 97.5k]
  ------------------
 1421|      0|                            pINChI[iINChI][k][j] && pINChI[iINChI][k][j]->nNumberOfAtoms &&
  ------------------
  |  Branch (1421:29): [True: 0, False: 0]
  |  Branch (1421:53): [True: 0, False: 0]
  ------------------
 1422|      0|                            pINChI[iINChI][k][TAUT_NON] && pINChI[iINChI][k][TAUT_NON]->nNumberOfAtoms &&
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                          pINChI[iINChI][k][TAUT_NON] && pINChI[iINChI][k][TAUT_NON]->nNumberOfAtoms &&
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1422:29): [True: 0, False: 0]
  |  Branch (1422:60): [True: 0, False: 0]
  ------------------
 1423|      0|                            !CompareReversedINChI(pINChI[iINChI][k][j], pINChI[iINChI][k][TAUT_NON], NULL, NULL))
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1423:29): [True: 0, False: 0]
  ------------------
 1424|      0|                        {
 1425|      0|                            pINChI[iINChI][k][TAUT_NON]->nNumberOfAtoms = 0; /* eliminate non-taut equal to taut */
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1426|      0|                        }
 1427|  97.5k|                    }
 1428|      0|                    else
 1429|      0|                    {
 1430|       |                        /* extra component, usually it is a Mobile H component */
 1431|       |                        /* corresponding to a free proton component in Fixed H */
 1432|      0|                        pINChI[iINChI][k][j]->bDeleted = 1;
 1433|      0|                        pINChI_Aux[iINChI][k][j]->bDeleted = 1;
 1434|      0|                    }
 1435|  97.5k|                } /* k */
 1436|  5.05k|            } /* if ( bReqNonTaut || j != TAUT_NON && OneInput->pInpInChI[iINChI][j] )  */
 1437|       |
 1438|  20.1k|            if (OneInput->pInpInChI[iINChI][j])
  ------------------
  |  Branch (1438:17): [True: 5.05k, False: 15.0k]
  ------------------
 1439|  5.05k|            {
 1440|  5.05k|                INCHI_HEAPCHK
 1441|  5.05k|                    inchi_free(OneInput->pInpInChI[iINChI][j]);
  ------------------
  |  | 1152|  5.05k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 5.05k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 5.05k]
  |  |  ------------------
  ------------------
 1442|  5.05k|                OneInput->pInpInChI[iINChI][j] = NULL;
 1443|  5.05k|            }
 1444|  20.1k|        } /* j */
 1445|  10.0k|    } /* iINChI */
 1446|       |
 1447|  5.02k|    if (bReqSplitOutputInChI)
  ------------------
  |  Branch (1447:9): [True: 0, False: 5.02k]
  ------------------
 1448|      0|    {
 1449|      0|        if (bHasSomeReconnected)
  ------------------
  |  Branch (1449:13): [True: 0, False: 0]
  ------------------
 1450|      0|        {
 1451|      0|            iINChI1 = INCHI_REC; /* only reconnected */
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1452|       |            /* djb-rwth: removing redundant code */
 1453|      0|            sd->num_components[INCHI_BAS] = sd->num_components[INCHI_REC];
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          sd->num_components[INCHI_BAS] = sd->num_components[INCHI_REC];
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1454|      0|        }
 1455|      0|        else
 1456|      0|        {
 1457|      0|            iINChI1 = 0;         /* only disconnected */
 1458|       |            /* djb-rwth: removing redundant code */
 1459|      0|        }
 1460|      0|        sd->num_components[INCHI_REC] = 0;  /* treat reconnected as connected */
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1461|      0|        nNumOutputComponents = sd->num_components[INCHI_BAS];
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1462|      0|    }
 1463|  5.02k|    else
 1464|  5.02k|    {
 1465|  5.02k|        iINChI1 = 0;
 1466|       |        /* djb-rwth: removing redundant code */
 1467|  5.02k|        nNumOutputComponents = 1;
 1468|  5.02k|    }
 1469|       |
 1470|  10.0k|    for (k1 = 0, k2 = (bReqSplitOutputInChI ? k1 + 1 : nNumOutputComponents); k1 < k2 && k1 < nNumOutputComponents; k1 = k2, k2++)
  ------------------
  |  Branch (1470:24): [True: 0, False: 5.02k]
  |  Branch (1470:79): [True: 10.0k, False: 0]
  |  Branch (1470:90): [True: 5.02k, False: 5.02k]
  ------------------
 1471|  5.02k|    {
 1472|       |
 1473|  5.02k|        if (bReqSplitOutputInChI)
  ------------------
  |  Branch (1473:13): [True: 0, False: 5.02k]
  ------------------
 1474|      0|        {
 1475|      0|            sd->num_components[INCHI_BAS] = 1;
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1476|      0|            sd->num_components[INCHI_REC] = 0;
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1477|       |            /* additional data */
 1478|      0|            sd->num_non_taut[INCHI_BAS] =
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1479|      0|                sd->num_taut[INCHI_BAS] =
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1480|      0|                sd->num_non_taut[INCHI_REC] =
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1481|      0|                sd->num_taut[INCHI_REC] = 0;
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1482|      0|            iINChI = iINChI1;
 1483|      0|            for (j = 0; j < TAUT_NUM && sd->num_components[iINChI]; j++)
  ------------------
  |  |  573|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1483:25): [True: 0, False: 0]
  |  Branch (1483:41): [True: 0, False: 0]
  ------------------
 1484|      0|            {
 1485|      0|                for (k = k1; k < k2; k++)
  ------------------
  |  Branch (1485:30): [True: 0, False: 0]
  ------------------
 1486|      0|                {
 1487|       |                    /*  find where the current processed structure is located */
 1488|      0|                    int cur_is_in_non_taut = (pINChI[iINChI][k][TAUT_NON] && pINChI[iINChI][k][TAUT_NON]->nNumberOfAtoms > 0);
  ------------------
  |  |  574|      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);
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1488:47): [True: 0, False: 0]
  |  Branch (1488:78): [True: 0, False: 0]
  ------------------
 1489|      0|                    int cur_is_in_taut = (pINChI[iINChI][k][TAUT_YES] && pINChI[iINChI][k][TAUT_YES]->nNumberOfAtoms > 0);
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                  int cur_is_in_taut = (pINChI[iINChI][k][TAUT_YES] && pINChI[iINChI][k][TAUT_YES]->nNumberOfAtoms > 0);
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1489:43): [True: 0, False: 0]
  |  Branch (1489:74): [True: 0, False: 0]
  ------------------
 1490|      0|                    int cur_is_non_taut = (cur_is_in_non_taut && 0 == pINChI[iINChI][k][TAUT_NON]->lenTautomer) ||
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1490:44): [True: 0, False: 0]
  |  Branch (1490:66): [True: 0, False: 0]
  ------------------
 1491|      0|                        (cur_is_in_taut && 0 == pINChI[iINChI][k][TAUT_YES]->lenTautomer); /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1491:26): [True: 0, False: 0]
  |  Branch (1491:44): [True: 0, False: 0]
  ------------------
 1492|      0|                    int cur_is_taut = cur_is_in_taut && 0 < pINChI[iINChI][k][TAUT_YES]->lenTautomer;
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1492:39): [True: 0, False: 0]
  |  Branch (1492:57): [True: 0, False: 0]
  ------------------
 1493|      0|                    if (cur_is_non_taut + cur_is_taut)
  ------------------
  |  Branch (1493:25): [True: 0, False: 0]
  ------------------
 1494|      0|                    {
 1495|       |                        /*  count tautomeric and non-tautomeric components of the structures */
 1496|       |                        /*
 1497|       |                        int j1 = cur_is_in_non_taut? TAUT_NON:TAUT_YES;
 1498|       |                        int j2 = cur_is_in_taut?     TAUT_YES:TAUT_NON;
 1499|       |                        */
 1500|      0|                        sd->num_non_taut[INCHI_BAS] += cur_is_non_taut;
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1501|      0|                        sd->num_taut[INCHI_BAS] += cur_is_taut;
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1502|      0|                    }
 1503|      0|                }
 1504|      0|            }
 1505|      0|            INCHI_HEAPCHK
 1506|      0|        }
 1507|  5.02k|        else
 1508|  5.02k|        {
 1509|  5.02k|            sd->num_components[INCHI_BAS] = inchi_max(OneInput->nNumComponents[INCHI_BAS][TAUT_YES],
  ------------------
  |  |  570|  5.02k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          sd->num_components[INCHI_BAS] = inchi_max(OneInput->nNumComponents[INCHI_BAS][TAUT_YES],
  ------------------
  |  |  138|  5.02k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 5.02k, False: 0]
  |  |  ------------------
  ------------------
 1510|  5.02k|                OneInput->nNumComponents[INCHI_BAS][TAUT_NON]);
 1511|  5.02k|            sd->num_components[INCHI_REC] = inchi_max(OneInput->nNumComponents[INCHI_REC][TAUT_YES],
  ------------------
  |  |  571|  5.02k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          sd->num_components[INCHI_REC] = inchi_max(OneInput->nNumComponents[INCHI_REC][TAUT_YES],
  ------------------
  |  |  138|  5.02k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 25, False: 5.00k]
  |  |  ------------------
  ------------------
 1512|  5.02k|                OneInput->nNumComponents[INCHI_REC][TAUT_NON]);
 1513|       |            /* additional data needed for SortAndPrintINChI() */
 1514|  15.0k|            for (iINChI = 0; iINChI < INCHI_NUM; iINChI++)
  ------------------
  |  |  569|  15.0k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1514:30): [True: 10.0k, False: 5.02k]
  ------------------
 1515|  10.0k|            {
 1516|  10.0k|                sd->num_non_taut[iINChI] =
 1517|  10.0k|                    sd->num_taut[iINChI] = 0;
 1518|  20.1k|                for (j = 0; j < TAUT_NUM && sd->num_components[iINChI]; j++)
  ------------------
  |  |  573|  40.3k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1518:29): [True: 15.1k, False: 5.05k]
  |  Branch (1518:45): [True: 10.1k, False: 5.00k]
  ------------------
 1519|  10.1k|                {
 1520|  20.2k|                    for (k = k1; k < k2; k++)
  ------------------
  |  Branch (1520:34): [True: 10.1k, False: 10.1k]
  ------------------
 1521|  10.1k|                    {
 1522|       |                        /*  find where the current processed structure is located */
 1523|  10.1k|                        int cur_is_in_non_taut = (pINChI[iINChI][k][TAUT_NON] && pINChI[iINChI][k][TAUT_NON]->nNumberOfAtoms > 0);
  ------------------
  |  |  574|  10.1k|#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);
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1523:51): [True: 0, False: 10.1k]
  |  Branch (1523:82): [True: 0, False: 0]
  ------------------
 1524|  10.1k|                        int cur_is_in_taut = (pINChI[iINChI][k][TAUT_YES] && pINChI[iINChI][k][TAUT_YES]->nNumberOfAtoms > 0);
  ------------------
  |  |  575|  10.1k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                      int cur_is_in_taut = (pINChI[iINChI][k][TAUT_YES] && pINChI[iINChI][k][TAUT_YES]->nNumberOfAtoms > 0);
  ------------------
  |  |  575|  10.1k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1524:47): [True: 10.1k, False: 0]
  |  Branch (1524:78): [True: 10.1k, False: 0]
  ------------------
 1525|  10.1k|                        int cur_is_non_taut = (cur_is_in_non_taut && 0 == pINChI[iINChI][k][TAUT_NON]->lenTautomer) ||
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1525:48): [True: 0, False: 10.1k]
  |  Branch (1525:70): [True: 0, False: 0]
  ------------------
 1526|  10.1k|                            (cur_is_in_taut && 0 == pINChI[iINChI][k][TAUT_YES]->lenTautomer); /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |  575|  10.1k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1526:30): [True: 10.1k, False: 0]
  |  Branch (1526:48): [True: 7.76k, False: 2.33k]
  ------------------
 1527|  10.1k|                        int cur_is_taut = cur_is_in_taut && 0 < pINChI[iINChI][k][TAUT_YES]->lenTautomer;
  ------------------
  |  |  575|  10.1k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1527:43): [True: 10.1k, False: 0]
  |  Branch (1527:61): [True: 2.33k, False: 7.76k]
  ------------------
 1528|  10.1k|                        if (cur_is_non_taut + cur_is_taut)
  ------------------
  |  Branch (1528:29): [True: 10.1k, False: 0]
  ------------------
 1529|  10.1k|                        {
 1530|       |                            /*  count tautomeric and non-tautomeric components of the structures */
 1531|       |                            /*
 1532|       |                            int j1 = cur_is_in_non_taut? TAUT_NON:TAUT_YES;
 1533|       |                            int j2 = cur_is_in_taut?     TAUT_YES:TAUT_NON;
 1534|       |                            */
 1535|  10.1k|                            sd->num_non_taut[iINChI] += cur_is_non_taut;
 1536|  10.1k|                            sd->num_taut[iINChI] += cur_is_taut;
 1537|  10.1k|                        }
 1538|  10.1k|                    }
 1539|  10.1k|                }
 1540|  10.0k|            }
 1541|  5.02k|            INCHI_HEAPCHK
 1542|  5.02k|        }
 1543|  5.02k|        if (bReqSplitOutputInChI)
  ------------------
  |  Branch (1543:13): [True: 0, False: 5.02k]
  ------------------
 1544|      0|        {
 1545|       |            /* output components one by one (for splitting input InChI into components) */
 1546|      0|            PINChI2* pInChI_2[INCHI_NUM];
 1547|      0|            PINChI_Aux2* pInChI_Aux_2[INCHI_NUM];
 1548|      0|            INChI* pInChI_1[1][2];
 1549|      0|            INChI_Aux* pInChI_Aux_1[1][2];
 1550|      0|            memset(pInChI_2, 0, sizeof(pInChI_2)); /* djb-rwth: memset_s C11/Annex K variant? */
 1551|      0|            memset(pInChI_Aux_2, 0, sizeof(pInChI_Aux_2)); /* djb-rwth: memset_s C11/Annex K variant? */
 1552|      0|            for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  573|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1552:25): [True: 0, False: 0]
  ------------------
 1553|      0|            {
 1554|      0|                pInChI_1[0][j] = pINChI[iINChI1][k1][j];
 1555|      0|                pInChI_Aux_1[0][j] = pINChI_Aux[iINChI1][k1][j];
 1556|      0|            }
 1557|      0|            pInChI_2[INCHI_BAS] = pInChI_1;
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1558|      0|            pInChI_Aux_2[INCHI_BAS] = pInChI_Aux_1;
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1559|       |            /* make sure purely reconnected InChI is marked as ReChI, not InChI */
 1560|      0|            if (bHasSomeReconnected &&
  ------------------
  |  Branch (1560:17): [True: 0, False: 0]
  ------------------
 1561|      0|                (bInChIHasReconnectedMetal(pInChI_1[0][TAUT_YES]) ||
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1561:18): [True: 0, False: 0]
  ------------------
 1562|      0|                    bInChIHasReconnectedMetal(pInChI_1[0][TAUT_NON])))
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1562:21): [True: 0, False: 0]
  ------------------
 1563|      0|            {
 1564|      0|                bSortPrintINChIFlags = FLAG_SORT_PRINT_ReChI_PREFIX;
  ------------------
  |  |  666|      0|#define FLAG_SORT_PRINT_ReChI_PREFIX 64  /* Output ReChI instead of InChI */
  ------------------
 1565|      0|            }
 1566|      0|            else
 1567|      0|            {
 1568|      0|                bSortPrintINChIFlags = 0;
 1569|      0|            }
 1570|      0|            INCHI_HEAPCHK
 1571|      0|                nRet1 = SortAndPrintINChI(pCG, pOut, strbuf, pLog, ip,
 1572|      0|                    NULL /*orig_inp_data*/,
 1573|      0|                    NULL  /*prep_inp_data*/,
 1574|      0|                    NULL /*composite_norm_data*/,
 1575|      0|                    NULL /*pOrigStruct*/,
 1576|      0|                    sd->num_components, sd->num_non_taut,
 1577|      0|                    sd->num_taut, sd->bTautFlags,
 1578|      0|                    sd->bTautFlagsDone, pncFlags, num_inp,
 1579|      0|                    pInChI_2, pInChI_Aux_2,
 1580|      0|                    &bSortPrintINChIFlags, save_opt_bits);
 1581|      0|            INCHI_HEAPCHK
 1582|      0|        }
 1583|  5.02k|        else
 1584|  5.02k|        {
 1585|  5.02k|            INCHI_HEAPCHK
 1586|       |
 1587|  5.02k|                bSortPrintINChIFlags = 0;
 1588|  5.02k|            nRet1 = SortAndPrintINChI(pCG, pOut, strbuf, pLog, ip,
 1589|  5.02k|                NULL /*orig_inp_data*/, NULL  /*prep_inp_data*/,
 1590|  5.02k|                NULL /*composite_norm_data*/, NULL /*pOrigStruct*/,
 1591|  5.02k|                sd->num_components, sd->num_non_taut, sd->num_taut,
 1592|  5.02k|                sd->bTautFlags, sd->bTautFlagsDone, pncFlags, num_inp,
 1593|  5.02k|                pINChI, pINChI_Aux, &bSortPrintINChIFlags,
 1594|  5.02k|                save_opt_bits);
 1595|  5.02k|            INCHI_HEAPCHK
 1596|  5.02k|        }
 1597|  5.02k|        if (nRet1 == _IS_FATAL || nRet1 == _IS_ERROR)
  ------------------
  |  |   13|  10.0k|#define _IS_FATAL   3
  ------------------
                      if (nRet1 == _IS_FATAL || nRet1 == _IS_ERROR)
  ------------------
  |  |   12|  5.02k|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (1597:13): [True: 0, False: 5.02k]
  |  Branch (1597:35): [True: 0, False: 5.02k]
  ------------------
 1598|      0|        {
 1599|      0|            break;
 1600|      0|        }
 1601|  5.02k|    }
 1602|       |
 1603|  5.02k|    INCHI_HEAPCHK
 1604|  5.02k|        FreeAllINChIArrays(pINChI, pINChI_Aux, num_components);
 1605|  5.02k|    INCHI_HEAPCHK
 1606|       |
 1607|  15.0k|        for (iINChI = 0; iINChI < INCHI_NUM; iINChI++)
  ------------------
  |  |  569|  15.0k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1607:26): [True: 10.0k, False: 5.02k]
  ------------------
 1608|  10.0k|        {
 1609|  30.1k|            for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  573|  30.1k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1609:25): [True: 20.1k, False: 10.0k]
  ------------------
 1610|  20.1k|            {
 1611|  20.1k|                if (OneInput->nNumProtons[iINChI][j].pNumProtons)
  ------------------
  |  Branch (1611:21): [True: 0, False: 20.1k]
  ------------------
 1612|      0|                {
 1613|      0|                    inchi_free(OneInput->nNumProtons[iINChI][j].pNumProtons);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1614|      0|                    OneInput->nNumProtons[iINChI][j].pNumProtons = NULL;
 1615|      0|                }
 1616|  20.1k|            }
 1617|  10.0k|        }
 1618|       |
 1619|       |    INCHI_HEAPCHK
 1620|       |
 1621|  5.02k|        if (nRet1 == _IS_FATAL || nRet1 == _IS_ERROR)
  ------------------
  |  |   13|  10.0k|#define _IS_FATAL   3
  ------------------
                      if (nRet1 == _IS_FATAL || nRet1 == _IS_ERROR)
  ------------------
  |  |   12|  5.02k|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (1621:13): [True: 0, False: 5.02k]
  |  Branch (1621:35): [True: 0, False: 5.02k]
  ------------------
 1622|      0|        {
 1623|      0|            ret2 = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1624|      0|        }
 1625|       |
 1626|  5.02k|exit_error:
 1627|       |
 1628|  5.02k|    inchi_strbuf_close(strbuf);
 1629|       |
 1630|  5.02k|    return ret2;
 1631|  5.02k|}

QueueCreate:
   33|   376k|{
   34|   376k|    QUEUE     *q = NULL;
   35|   376k|    QINT_TYPE *Val = NULL;
  ------------------
  |  |   16|   376k|#define QINT_TYPE qInt
  ------------------
   36|   376k|    if (nTotLength < 1 || nSize != ( int )sizeof( QINT_TYPE ) ||
  ------------------
  |  Branch (36:9): [True: 0, False: 376k]
  |  Branch (36:27): [True: 0, False: 376k]
  ------------------
   37|   376k|         !( q = (QUEUE     *) inchi_calloc( 1, sizeof( QUEUE ) ) ) ||
  ------------------
  |  | 1146|   376k|#define inchi_calloc   calloc
  ------------------
  |  Branch (37:10): [True: 0, False: 376k]
  ------------------
   38|   376k|         !( Val = (QINT_TYPE *) inchi_calloc( nTotLength, nSize ) ))
  ------------------
  |  | 1146|   376k|#define inchi_calloc   calloc
  ------------------
  |  Branch (38:10): [True: 0, False: 376k]
  ------------------
   39|      0|    {
   40|      0|        if (q) inchi_free( q );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (40:13): [True: 0, False: 0]
  ------------------
   41|      0|        return NULL;
   42|      0|    }
   43|   376k|    q->Val = Val;
   44|       |    /* q->nSize      = nSize; */
   45|   376k|    q->nTotLength = nTotLength;
   46|       |
   47|   376k|    return q;
   48|   376k|}
QueueAdd:
   53|   352k|{
   54|   352k|    if (q && Val && q->nLength < q->nTotLength)
  ------------------
  |  Branch (54:9): [True: 352k, False: 0]
  |  Branch (54:14): [True: 352k, False: 0]
  |  Branch (54:21): [True: 352k, False: 0]
  ------------------
   55|   352k|    {
   56|   352k|        q->Val[( q->nFirst + q->nLength ) % q->nTotLength] = *Val;
   57|   352k|        q->nLength++;
   58|   352k|        return q->nLength;
   59|   352k|    }
   60|       |
   61|      0|    return -1;
   62|   352k|}
QueueGet:
   67|   352k|{
   68|   352k|    if (q && Val && q->nLength > 0)
  ------------------
  |  Branch (68:9): [True: 352k, False: 0]
  |  Branch (68:14): [True: 352k, False: 0]
  |  Branch (68:21): [True: 352k, False: 0]
  ------------------
   69|   352k|    {
   70|   352k|        *Val = q->Val[q->nFirst];
   71|       |        /* new: do not allow to overwrite the retrieved value */
   72|   352k|        q->nFirst = ( q->nFirst == q->nTotLength - 1 ) ? 0 : q->nFirst + 1;
  ------------------
  |  Branch (72:21): [True: 0, False: 352k]
  ------------------
   73|   352k|        q->nLength--;
   74|       |        /* -- old --
   75|       |        if ( -- q->nLength ) {
   76|       |            q->nFirst = (q->nFirst == q->nTotLength - 1)? 0 : q->nFirst + 1;
   77|       |        }
   78|       |        */
   79|   352k|        return q->nLength;
   80|   352k|    }
   81|       |
   82|      0|    return -1;
   83|   352k|}
QueueGetAny:
   88|   352k|{
   89|   352k|    if (0 <= ord && ord < q->nTotLength)
  ------------------
  |  Branch (89:9): [True: 352k, False: 0]
  |  Branch (89:21): [True: 352k, False: 0]
  ------------------
   90|   352k|    {
   91|   352k|        *Val = q->Val[ord];
   92|   352k|        return  1; /*  success */
   93|   352k|    }
   94|      0|    else
   95|      0|    {
   96|      0|        return -1; /*  error */
   97|      0|    }
   98|   352k|}
QueueDelete:
  169|   376k|{
  170|   376k|    if (q)
  ------------------
  |  Branch (170:9): [True: 376k, False: 0]
  ------------------
  171|   376k|    {
  172|   376k|        if (q->Val) inchi_free( q->Val );
  ------------------
  |  | 1152|   376k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 376k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 376k]
  |  |  ------------------
  ------------------
  |  Branch (172:13): [True: 376k, False: 0]
  ------------------
  173|   376k|        inchi_free( q );
  ------------------
  |  | 1152|   376k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 376k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 376k]
  |  |  ------------------
  ------------------
  174|   376k|    }
  175|       |
  176|       |    return NULL;
  177|   376k|}
QueueReinit:
  182|  77.5k|{
  183|  77.5k|    if (q)
  ------------------
  |  Branch (183:9): [True: 77.5k, False: 0]
  ------------------
  184|  77.5k|    {
  185|  77.5k|        q->nFirst = 0;
  186|  77.5k|        q->nLength = 0;
  187|       |        /* memset( q->Val, 0, q->nTotLength*sizeof(q->Val[0])); */ /*  for debug only */
  188|  77.5k|        return q->nTotLength;
  189|  77.5k|    }
  190|       |
  191|      0|    return -1;
  192|  77.5k|}
QueueLength:
  197|   274k|{
  198|   274k|    if (q)
  ------------------
  |  Branch (198:9): [True: 274k, False: 0]
  ------------------
  199|   274k|    {
  200|   274k|        return q->nLength;
  201|   274k|    }
  202|      0|    else
  203|      0|    {
  204|      0|        return 0;
  205|      0|    }
  206|   274k|}
QueueWrittenLength:
  211|  77.5k|{
  212|  77.5k|    if (q)
  ------------------
  |  Branch (212:9): [True: 77.5k, False: 0]
  ------------------
  213|  77.5k|    {
  214|  77.5k|        int len = q->nFirst + q->nLength;
  215|  77.5k|        return ( len > q->nTotLength ) ? q->nTotLength : len;
  ------------------
  |  Branch (215:16): [True: 0, False: 77.5k]
  ------------------
  216|  77.5k|    }
  217|      0|    else
  218|      0|    {
  219|      0|        return 0;
  220|      0|    }
  221|  77.5k|}
GetMinRingSize:
  232|  77.5k|{
  233|  77.5k|    int qLen, i, j;
  234|  77.5k|    AT_RANK nCurLevel, nRingSize, nMinRingSize = MAX_ATOMS + 1;
  ------------------
  |  |   15|  77.5k|#define MAX_ATOMS  32766
  ------------------
  235|  77.5k|    qInt at_no, next;
  236|  77.5k|    int  iat_no, inext;
  237|       |
  238|   274k|    while ((qLen = QueueLength( q ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (238:12): [True: 196k, False: 77.3k]
  ------------------
  239|   196k|    {
  240|       |        /*  traverse the next level (next outer ring) */
  241|   548k|        for (i = 0; i < qLen; i++)
  ------------------
  |  Branch (241:21): [True: 352k, False: 196k]
  ------------------
  242|   352k|        {
  243|   352k|            if (0 <= QueueGet( q, &at_no ))
  ------------------
  |  Branch (243:17): [True: 352k, False: 0]
  ------------------
  244|   352k|            {
  245|   352k|                iat_no = (int) at_no;
  246|   352k|                nCurLevel = nAtomLevel[iat_no] + 1;
  247|   352k|                if (2 * nCurLevel > nMaxRingSize + 4)
  ------------------
  |  Branch (247:21): [True: 230, False: 351k]
  ------------------
  248|    230|                {
  249|       |                    /*  2*nCurLevel = nRingSize + 3 + k, k = 0 or 1  */
  250|    230|                    if (nMinRingSize < MAX_ATOMS + 1)
  ------------------
  |  |   15|    230|#define MAX_ATOMS  32766
  ------------------
  |  Branch (250:25): [True: 80, False: 150]
  ------------------
  251|     80|                    {
  252|     80|                        return ( nMinRingSize >= nMaxRingSize ) ? 0 : nMinRingSize;
  ------------------
  |  Branch (252:32): [True: 53, False: 27]
  ------------------
  253|     80|                    }
  254|    150|                    return 0; /*  min. ring size > nMaxRingSize */
  255|    230|                }
  256|  1.00M|                for (j = 0; j < atom[iat_no].valence; j++)
  ------------------
  |  Branch (256:29): [True: 650k, False: 351k]
  ------------------
  257|   650k|                {
  258|   650k|                    next = (qInt) atom[iat_no].neighbor[j];
  259|   650k|                    inext = (int) next;
  260|   650k|                    if (!nAtomLevel[inext])
  ------------------
  |  Branch (260:25): [True: 194k, False: 456k]
  ------------------
  261|   194k|                    {
  262|       |                        /*  the at_no neighbor has not been traversed yet. Add it to the queue */
  263|   194k|                        if (0 <= QueueAdd( q, &next ))
  ------------------
  |  Branch (263:29): [True: 194k, False: 0]
  ------------------
  264|   194k|                        {
  265|   194k|                            nAtomLevel[inext] = nCurLevel;
  266|   194k|                            cSource[inext] = cSource[iat_no]; /*  keep the path number */
  267|   194k|                        }
  268|      0|                        else
  269|      0|                        {
  270|      0|                            return -1; /*  error */
  271|      0|                        }
  272|   194k|                    }
  273|   456k|                    else
  274|   456k|                    {
  275|   456k|                        if (nAtomLevel[inext] + 1 >= nCurLevel &&
  ------------------
  |  Branch (275:29): [True: 83.6k, False: 372k]
  ------------------
  276|  83.6k|                                cSource[inext] != cSource[iat_no]
  ------------------
  |  Branch (276:33): [True: 73.4k, False: 10.2k]
  ------------------
  277|       |                                /*  && cSource[(int)next] != -1 */
  278|   456k|                              )
  279|  73.4k|                        {
  280|       |                            /*  found a ring closure */
  281|       |                            /*  debug */
  282|  73.4k|                            if (cSource[inext] == -1)
  ------------------
  |  Branch (282:33): [True: 0, False: 73.4k]
  ------------------
  283|      0|                            {
  284|      0|                                return -1;  /*  error */
  285|      0|                            }
  286|  73.4k|                            if (( nRingSize = nAtomLevel[inext] + nCurLevel - 2 ) < nMinRingSize)
  ------------------
  |  Branch (286:33): [True: 42.2k, False: 31.1k]
  ------------------
  287|  42.2k|                            {
  288|  42.2k|                                nMinRingSize = nRingSize;
  289|  42.2k|                            }
  290|       |                            /* return (nRingSize >= nMaxRingSize)? 0 : nRingSize; */
  291|  73.4k|                        }
  292|   456k|                    }
  293|   650k|                }
  294|   351k|            }
  295|      0|            else
  296|      0|            {
  297|      0|                return -1; /*  error */
  298|      0|            }
  299|   352k|        }
  300|   196k|    }
  301|       |
  302|  77.3k|    if (nMinRingSize < MAX_ATOMS + 1)
  ------------------
  |  |   15|  77.3k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (302:9): [True: 42.2k, False: 35.1k]
  ------------------
  303|  42.2k|    {
  304|  42.2k|        return ( nMinRingSize >= nMaxRingSize ) ? 0 : nMinRingSize;
  ------------------
  |  Branch (304:16): [True: 1.46k, False: 40.7k]
  ------------------
  305|  42.2k|    }
  306|       |
  307|  35.1k|    return 0;
  308|  77.3k|}
is_bond_in_Nmax_memb_ring:
  334|  77.5k|{
  335|  77.5k|    int  nMinRingSize = -1, i;
  336|  77.5k|    qInt n;
  337|  77.5k|    int  nTotLen;
  338|       |
  339|  77.5k|    if (nMaxRingSize < 3)
  ------------------
  |  Branch (339:9): [True: 0, False: 77.5k]
  ------------------
  340|      0|    {
  341|      0|        return 0;
  342|      0|    }
  343|       |
  344|  77.5k|    QueueReinit( q );
  345|       |
  346|       |    /*  mark the starting atom */
  347|  77.5k|    nAtomLevel[at_no] = 1;
  348|  77.5k|    cSource[at_no] = -1;
  349|       |    /*  add neighbors */
  350|   235k|    for (i = 0; i < atom[at_no].valence; i++)
  ------------------
  |  Branch (350:17): [True: 158k, False: 77.5k]
  ------------------
  351|   158k|    {
  352|   158k|        n = (qInt) atom[at_no].neighbor[i];
  353|   158k|        nAtomLevel[(int) n] = 2;
  354|   158k|        cSource[(int) n] = 1 + ( i == neigh_ord );
  355|   158k|        QueueAdd( q, &n );
  356|   158k|    }
  357|       |
  358|  77.5k|    nMinRingSize = GetMinRingSize( atom, q, nAtomLevel, cSource, nMaxRingSize );
  359|       |    /*  cleanup */
  360|  77.5k|    nTotLen = QueueWrittenLength( q );
  361|   429k|    for (i = 0; i < nTotLen; i++)
  ------------------
  |  Branch (361:17): [True: 352k, False: 77.5k]
  ------------------
  362|   352k|    {
  363|   352k|        if (0 < QueueGetAny( q, &n, i ))
  ------------------
  |  Branch (363:13): [True: 352k, False: 0]
  ------------------
  364|   352k|        {
  365|   352k|            nAtomLevel[(int) n] = 0;
  366|   352k|            cSource[(int) n] = 0;
  367|   352k|        }
  368|   352k|    }
  369|  77.5k|    nAtomLevel[at_no] = 0;
  370|  77.5k|    cSource[at_no] = 0;
  371|       |
  372|       |    /*
  373|       |    if ( nAtomLevel )
  374|       |        inchi_free ( nAtomLevel );
  375|       |    if ( cSource )
  376|       |        inchi_free ( cSource );
  377|       |    QueueDelete( q );
  378|       |    */
  379|       |
  380|  77.5k|    return nMinRingSize;
  381|  77.5k|}
is_atom_in_3memb_ring:
  386|  7.90k|{
  387|  7.90k|    AT_NUMB   neigh_neigh;
  388|  7.90k|    int       i, j, k, val, val_neigh, neigh;
  389|       |
  390|  7.90k|    if (atom[at_no].nNumAtInRingSystem < 3)
  ------------------
  |  Branch (390:9): [True: 1.43k, False: 6.46k]
  ------------------
  391|  1.43k|    {
  392|  1.43k|        return 0;
  393|  1.43k|    }
  394|       |
  395|  13.3k|    for (i = 0, val = atom[at_no].valence; i < val; i++)
  ------------------
  |  Branch (395:44): [True: 10.7k, False: 2.60k]
  ------------------
  396|  10.7k|    {
  397|  10.7k|        neigh = (int) atom[at_no].neighbor[i];
  398|  10.7k|        if (atom[at_no].nRingSystem != atom[neigh].nRingSystem)
  ------------------
  |  Branch (398:13): [True: 1.29k, False: 9.41k]
  ------------------
  399|  1.29k|        {
  400|  1.29k|            continue;
  401|  1.29k|        }
  402|  25.6k|        for (j = 0, val_neigh = atom[neigh].valence; j < val_neigh; j++)
  ------------------
  |  Branch (402:54): [True: 20.0k, False: 5.55k]
  ------------------
  403|  20.0k|        {
  404|  20.0k|            neigh_neigh = atom[neigh].neighbor[j];
  405|  20.0k|            if ((int) neigh_neigh == at_no)
  ------------------
  |  Branch (405:17): [True: 8.44k, False: 11.6k]
  ------------------
  406|  8.44k|            {
  407|  8.44k|                continue;
  408|  8.44k|            }
  409|  36.5k|            for (k = 0; k < val; k++)
  ------------------
  |  Branch (409:25): [True: 28.7k, False: 7.78k]
  ------------------
  410|  28.7k|            {
  411|  28.7k|                if (atom[at_no].neighbor[k] == neigh_neigh)
  ------------------
  |  Branch (411:21): [True: 3.86k, False: 24.8k]
  ------------------
  412|  3.86k|                {
  413|  3.86k|                    return 1;
  414|  3.86k|                }
  415|  28.7k|            }
  416|  11.6k|        }
  417|  9.41k|    }
  418|       |
  419|  2.60k|    return 0;
  420|  6.46k|}

clear_t_group_info:
  475|   146k|{
  476|   146k|    if (!ti)
  ------------------
  |  Branch (476:9): [True: 0, False: 146k]
  ------------------
  477|      0|    {
  478|      0|        return;
  479|      0|    }
  480|   146k|    else
  481|   146k|    {
  482|   146k|        T_GROUP   *t_group = ti->t_group;
  483|   146k|        int       max_num_t_groups = ti->max_num_t_groups;
  484|   146k|        AT_NUMB   *tGroupNumber = ti->tGroupNumber;
  485|   146k|        int       num_t_groups = ti->num_t_groups;
  486|   146k|        AT_NUMB   *nEndpointAtomNumber = ti->nEndpointAtomNumber;
  487|   146k|        int       nNumEndpoints = ti->nNumEndpoints;
  488|   146k|        AT_NUMB   *nIsotopicEndpointAtomNumber = ti->nIsotopicEndpointAtomNumber;
  489|   146k|        int       nNumIsotopicEndpoints = ti->nNumIsotopicEndpoints;
  490|   146k|        memset( ti, 0, sizeof( *ti ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  491|   146k|        if (t_group)
  ------------------
  |  Branch (491:13): [True: 0, False: 146k]
  ------------------
  492|      0|        {
  493|      0|            memset( t_group, 0, sizeof( t_group[0] )*max_num_t_groups ); /* djb-rwth: memset_s C11/Annex K variant? */
  494|      0|        }
  495|   146k|        else
  496|   146k|        {
  497|   146k|            max_num_t_groups = 0;
  498|   146k|        }
  499|   146k|        if (tGroupNumber)
  ------------------
  |  Branch (499:13): [True: 0, False: 146k]
  ------------------
  500|      0|        {
  501|      0|            memset( tGroupNumber, 0, sizeof( tGroupNumber[0] )*num_t_groups ); /* djb-rwth: memset_s C11/Annex K variant? */
  502|      0|        }
  503|   146k|        else
  504|   146k|        {
  505|   146k|            num_t_groups = 0;
  506|   146k|        }
  507|   146k|        if (nEndpointAtomNumber)
  ------------------
  |  Branch (507:13): [True: 0, False: 146k]
  ------------------
  508|      0|        {
  509|      0|            memset( nEndpointAtomNumber, 0, sizeof( nEndpointAtomNumber[0] )*nNumEndpoints ); /* djb-rwth: memset_s C11/Annex K variant? */
  510|      0|        }
  511|   146k|        else
  512|   146k|        {
  513|   146k|            nNumEndpoints = 0;
  514|   146k|        }
  515|   146k|        if (nIsotopicEndpointAtomNumber)
  ------------------
  |  Branch (515:13): [True: 0, False: 146k]
  ------------------
  516|      0|        {
  517|      0|            memset( nIsotopicEndpointAtomNumber, 0, sizeof( nIsotopicEndpointAtomNumber[0] )*nNumIsotopicEndpoints ); /* djb-rwth: memset_s C11/Annex K variant? */
  518|      0|        }
  519|   146k|        else
  520|   146k|        {
  521|   146k|            nNumIsotopicEndpoints = 0;
  522|   146k|        }
  523|       |
  524|   146k|        ti->t_group = t_group;
  525|   146k|        ti->max_num_t_groups = max_num_t_groups;
  526|   146k|        ti->tGroupNumber = tGroupNumber;
  527|   146k|        ti->num_t_groups = num_t_groups;
  528|   146k|        ti->nEndpointAtomNumber = nEndpointAtomNumber;
  529|   146k|        ti->nNumEndpoints = nNumEndpoints;
  530|   146k|        ti->nIsotopicEndpointAtomNumber = nIsotopicEndpointAtomNumber;
  531|       |
  532|   146k|        ti->nNumIsotopicEndpoints = nNumIsotopicEndpoints;
  533|   146k|    }
  534|       |
  535|   146k|    return;
  536|   146k|}
GetTgroupInfoFromInChI:
  544|   146k|{
  545|   146k|    int ret, i, j, k, itg, num_atoms, len_tg, num_t_groups; /* djb-rwth: removing redundant variables */
  546|   146k|    AT_NUMB   *tGroupNumber = NULL;
  547|       |    /* djb-rwth: removing redundant variables */
  548|   146k|    AT_NUMB   *tiGroupNumber = NULL;
  549|       |
  550|   146k|    ret = 0;
  551|       |
  552|   146k|    clear_t_group_info( ti );
  553|   146k|    if (pInChI && pInChI->lenTautomer > 1 &&
  ------------------
  |  Branch (553:9): [True: 146k, False: 0]
  |  Branch (553:19): [True: 1.24k, False: 145k]
  ------------------
  554|  1.24k|         pInChI->nTautomer && pInChI->nTautomer[0] > 0)
  ------------------
  |  Branch (554:10): [True: 1.24k, False: 0]
  |  Branch (554:31): [True: 1.24k, False: 0]
  ------------------
  555|  1.24k|    {
  556|  1.24k|        num_atoms = pInChI->nNumberOfAtoms;
  557|       |        /* djb-rwth: removing redundant code */
  558|  1.24k|        num_t_groups = pInChI->nTautomer[0];
  559|  1.24k|        len_tg = pInChI->lenTautomer - T_GROUP_HDR_LEN*pInChI->nTautomer[0] - 1; /* number of endpoints */
  ------------------
  |  |   72|  1.24k|#define           T_GROUP_HDR_LEN   (1+T_NUM_NO_ISOTOPIC /*+T_NUM_ISOTOPIC*/) /* LinearCTTautomer */
  |  |  ------------------
  |  |  |  |   69|  1.24k|#define           T_NUM_NO_ISOTOPIC 2
  |  |  ------------------
  ------------------
  560|       |
  561|       |        /* allocation ti->t_group */
  562|  1.24k|        if (ti->max_num_t_groups != num_atoms / 2 + 1 || !ti->t_group)
  ------------------
  |  Branch (562:13): [True: 1.24k, False: 0]
  |  Branch (562:58): [True: 0, False: 0]
  ------------------
  563|  1.24k|        {
  564|  1.24k|            ti->max_num_t_groups = num_atoms / 2 + 1;
  565|  1.24k|            if (ti->t_group)
  ------------------
  |  Branch (565:17): [True: 0, False: 1.24k]
  ------------------
  566|      0|                inchi_free( ti->t_group );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  567|  1.24k|            ti->t_group = (T_GROUP *) inchi_calloc( (long long)ti->max_num_t_groups + 1, sizeof( ti->t_group[0] ) ); /* djb-rwth: correcting 0 bytes allocation */
  ------------------
  |  | 1146|  1.24k|#define inchi_calloc   calloc
  ------------------
  568|  1.24k|        }
  569|       |
  570|       |        /* allocation ti->tGroupNumber */
  571|  1.24k|        if (ti->num_t_groups != num_t_groups || !ti->tGroupNumber)
  ------------------
  |  Branch (571:13): [True: 1.24k, False: 0]
  |  Branch (571:49): [True: 0, False: 0]
  ------------------
  572|  1.24k|        {
  573|  1.24k|            ti->num_t_groups = num_t_groups;
  574|  1.24k|            if (ti->tGroupNumber)
  ------------------
  |  Branch (574:17): [True: 0, False: 1.24k]
  ------------------
  575|      0|                inchi_free( ti->tGroupNumber );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  576|  1.24k|            ti->tGroupNumber = (AT_NUMB *) inchi_calloc( ( (long long)ti->num_t_groups + 1 )*TGSO_TOTAL_LEN, sizeof( ti->tGroupNumber[0] ) ); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  1.24k|#define inchi_calloc   calloc
  ------------------
                          ti->tGroupNumber = (AT_NUMB *) inchi_calloc( ( (long long)ti->num_t_groups + 1 )*TGSO_TOTAL_LEN, sizeof( ti->tGroupNumber[0] ) ); /* djb-rwth: cast operator added */
  ------------------
  |  |  141|  1.24k|#define TGSO_TOTAL_LEN   4
  ------------------
  577|  1.24k|        }
  578|       |
  579|       |        /* allocation ti->tGroupNumber */
  580|  1.24k|        if (len_tg != ti->nNumEndpoints || !ti->nEndpointAtomNumber)
  ------------------
  |  Branch (580:13): [True: 1.24k, False: 0]
  |  Branch (580:44): [True: 0, False: 0]
  ------------------
  581|  1.24k|        {
  582|  1.24k|            ti->nNumEndpoints = len_tg;
  583|  1.24k|            if (ti->nEndpointAtomNumber)
  ------------------
  |  Branch (583:17): [True: 0, False: 1.24k]
  ------------------
  584|      0|                inchi_free( ti->nEndpointAtomNumber );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  585|  1.24k|            ti->nEndpointAtomNumber = (AT_NUMB *) inchi_calloc( (long long)len_tg + 1, sizeof( ti->nEndpointAtomNumber[0] ) ); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  1.24k|#define inchi_calloc   calloc
  ------------------
  586|  1.24k|        }
  587|       |
  588|       |        /* check */
  589|  1.24k|        if (!ti->t_group || !ti->tGroupNumber || !ti->nEndpointAtomNumber)
  ------------------
  |  Branch (589:13): [True: 0, False: 1.24k]
  |  Branch (589:29): [True: 0, False: 1.24k]
  |  Branch (589:50): [True: 0, False: 1.24k]
  ------------------
  590|      0|        {
  591|      0|            ret = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  592|      0|            goto exit_function;
  593|      0|        }
  594|       |
  595|  1.24k|        tGroupNumber = ti->tGroupNumber;
  596|       |        /* djb-rwth: removing redundant code */
  597|  1.24k|        tiGroupNumber = tGroupNumber + TGSO_SYMM_IORDER * (long long)ti->num_t_groups; /* djb-rwth: cast operator added */
  ------------------
  |  |  139|  1.24k|#define TGSO_SYMM_IORDER 2  /* tiGroupNumber: isotopic symmetry rank sorting order */
  ------------------
  598|       |
  599|       |
  600|       |        INCHI_HEAPCHK
  601|       |
  602|  1.24k|            j = 1; /* index in pInChI->nTautomer[] */
  603|  1.24k|        i = 0; /* index in ti->nEndpointAtomNumber[] */
  604|       |
  605|       |        /* djb-rwth: fixing oss-fuzz issues #67681, #67641 */
  606|  3.52k|        for (itg = 0; itg < pInChI->nTautomer[0] && itg <= ti->max_num_t_groups; itg++)
  ------------------
  |  Branch (606:23): [True: 2.28k, False: 1.23k]
  |  Branch (606:53): [True: 2.28k, False: 4]
  ------------------
  607|  2.28k|        {
  608|  2.28k|            len_tg = pInChI->nTautomer[j]; /* t-group length not including pInChI->nTautomer[j] */
  609|  2.28k|            ti->t_group[itg].num[0] = pInChI->nTautomer[j + 1] + pInChI->nTautomer[j + 2]; /* num mobile H & (-) */
  610|  2.28k|            ti->t_group[itg].num[1] = pInChI->nTautomer[j + 2]; /* num mobile (-) */
  611|  2.28k|            tGroupNumber[itg] = tiGroupNumber[itg] = itg; /* index */
  612|  2.28k|            ti->t_group[itg].nGroupNumber = /*tSymmRank[itg] = tiSymmRank[itg] =*/ itg + 1; /* t-group number */
  613|  2.28k|            j += T_GROUP_HDR_LEN;   /* skip t-group header */
  ------------------
  |  |   72|  2.28k|#define           T_GROUP_HDR_LEN   (1+T_NUM_NO_ISOTOPIC /*+T_NUM_ISOTOPIC*/) /* LinearCTTautomer */
  |  |  ------------------
  |  |  |  |   69|  2.28k|#define           T_NUM_NO_ISOTOPIC 2
  |  |  ------------------
  ------------------
  614|  2.28k|            len_tg -= T_GROUP_HDR_LEN - 1;
  ------------------
  |  |   72|  2.28k|#define           T_GROUP_HDR_LEN   (1+T_NUM_NO_ISOTOPIC /*+T_NUM_ISOTOPIC*/) /* LinearCTTautomer */
  |  |  ------------------
  |  |  |  |   69|  2.28k|#define           T_NUM_NO_ISOTOPIC 2
  |  |  ------------------
  ------------------
  615|       |
  616|  2.28k|            ti->t_group[itg].nNumEndpoints = len_tg;
  617|  2.28k|            ti->t_group[itg].nFirstEndpointAtNoPos = i;
  618|       |
  619|  20.8k|            while (len_tg > 0)
  ------------------
  |  Branch (619:20): [True: 18.5k, False: 2.28k]
  ------------------
  620|  18.5k|            {
  621|  18.5k|                k = ti->nEndpointAtomNumber[i] = pInChI->nTautomer[j] - 1; /* djb-rwth: buffer overrun avoided implicitly in loop condition */
  622|  18.5k|#if ( FIX_GAF_2019_1==1 )
  623|  18.5k|                if (k<0 || k>num_atoms)
  ------------------
  |  Branch (623:21): [True: 0, False: 18.5k]
  |  Branch (623:28): [True: 0, False: 18.5k]
  ------------------
  624|      0|                {
  625|      0|                    ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  626|      0|                    goto exit_function;
  627|      0|                }
  628|  18.5k|#endif
  629|  18.5k|                if (at)
  ------------------
  |  Branch (629:21): [True: 16.5k, False: 2.01k]
  ------------------
  630|  16.5k|                {
  631|  16.5k|                    at[k].endpoint = itg + 1;
  632|  16.5k|                }
  633|  18.5k|                if (endpoint)
  ------------------
  |  Branch (633:21): [True: 2.01k, False: 16.5k]
  ------------------
  634|  2.01k|                {
  635|  2.01k|                    endpoint[k] = itg + 1;
  636|  2.01k|                }
  637|  18.5k|                len_tg--;
  638|  18.5k|                j++;
  639|  18.5k|                i++;
  640|  18.5k|            }
  641|  2.28k|        }
  642|       |
  643|  1.24k|        if (i != ti->nNumEndpoints)
  ------------------
  |  Branch (643:13): [True: 4, False: 1.23k]
  ------------------
  644|      4|        {
  645|      4|            ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      4|#define RI_ERR_PROGR   (-3)
  ------------------
  646|      4|        }
  647|       |
  648|  1.24k|        INCHI_HEAPCHK
  649|  1.24k|    }
  650|       |
  651|   146k|exit_function:
  652|   146k|    return ret;
  653|   146k|}
FillOutpStructEndpointFromInChI:
  658|  1.14k|{
  659|  1.14k|    int num_at = pInChI->nNumberOfAtoms;
  660|  1.14k|    AT_NUMB *endpoint = *pEndpoint;
  661|  1.14k|    int     itg, i, j, k, len_tg;
  662|       |
  663|  1.14k|    if (!endpoint && !( endpoint = (AT_NUMB*) inchi_malloc( num_at * sizeof( endpoint[0] ) ) ))
  ------------------
  |  | 1143|  1.14k|#define inchi_malloc   malloc
  ------------------
  |  Branch (663:9): [True: 1.14k, False: 0]
  |  Branch (663:22): [True: 0, False: 1.14k]
  ------------------
  664|      0|    {
  665|      0|        return RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  666|      0|    }
  667|       |
  668|  1.14k|    memset( endpoint, 0, num_at * sizeof( endpoint[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  669|  1.14k|    if (pInChI->lenTautomer <= 1 || !pInChI->nTautomer)
  ------------------
  |  Branch (669:9): [True: 548, False: 594]
  |  Branch (669:37): [True: 0, False: 594]
  ------------------
  670|    548|    {
  671|    548|        goto exit_function;
  672|    548|    }
  673|       |
  674|    594|    j = 1; /* index in pInChI->nTautomer[] */
  675|    594|    i = 0; /* index in ti->nEndpointAtomNumber[] */
  676|  1.30k|    for (itg = 0; itg < pInChI->nTautomer[0]; itg++)
  ------------------
  |  Branch (676:19): [True: 715, False: 594]
  ------------------
  677|    715|    {
  678|    715|        len_tg = pInChI->nTautomer[j]; /* t-group length not including pInChI->nTautomer[j] */
  679|    715|        j += T_GROUP_HDR_LEN;   /* skip t-group header */
  ------------------
  |  |   72|    715|#define           T_GROUP_HDR_LEN   (1+T_NUM_NO_ISOTOPIC /*+T_NUM_ISOTOPIC*/) /* LinearCTTautomer */
  |  |  ------------------
  |  |  |  |   69|    715|#define           T_NUM_NO_ISOTOPIC 2
  |  |  ------------------
  ------------------
  680|    715|        len_tg -= T_GROUP_HDR_LEN - 1;
  ------------------
  |  |   72|    715|#define           T_GROUP_HDR_LEN   (1+T_NUM_NO_ISOTOPIC /*+T_NUM_ISOTOPIC*/) /* LinearCTTautomer */
  |  |  ------------------
  |  |  |  |   69|    715|#define           T_NUM_NO_ISOTOPIC 2
  |  |  ------------------
  ------------------
  681|       |        /* ti->t_group[itg].nNumEndpoints = len_tg; */
  682|  2.73k|        for (; 0 < len_tg--; j++, i++)
  ------------------
  |  Branch (682:16): [True: 2.02k, False: 715]
  ------------------
  683|  2.02k|        {
  684|  2.02k|            k = pInChI->nTautomer[j] - 1;
  685|  2.02k|            endpoint[k] = itg + 1;
  686|  2.02k|        }
  687|    715|    }
  688|       |
  689|  1.14k|exit_function:
  690|  1.14k|    *pEndpoint = endpoint;
  691|       |
  692|  1.14k|    return 0;
  693|    594|}
cmp_charge_val:
  698|  1.00M|{
  699|  1.00M|    const CHARGE_VAL *p1 = (const CHARGE_VAL *) a1;
  700|  1.00M|    const CHARGE_VAL *p2 = (const CHARGE_VAL *) a2;
  701|  1.00M|    int    diff;
  702|       |
  703|  1.00M|    if ((diff = (int) p1->nValence - (int) p2->nValence))  /* smaller valence first */ /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (703:9): [True: 803k, False: 199k]
  ------------------
  704|   803k|        return diff;
  705|   199k|    if ((diff = abs( (int) p1->nCharge ) - abs( (int) p2->nCharge ))) /* smaller abs charge first */ /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (705:9): [True: 99.3k, False: 100k]
  ------------------
  706|  99.3k|        return diff;
  707|   100k|    if ((diff = (int) p2->nCharge - (int) p1->nCharge)) /* (+) first, (-) second */ /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (707:9): [True: 100k, False: 0]
  ------------------
  708|   100k|        return diff;
  709|      0|    return (int) p1->nValenceOrderingNumber - (int) p2->nValenceOrderingNumber;
  710|   100k|}
bMayBeACationInMobileHLayer:
  715|   307k|{
  716|   307k|    int    j, neigh;
  717|   307k|    U_CHAR cVal;  /* moved from below 2024-09-01 DT */
  718|   307k|    if (!bMobileH || !at[iat].num_H)
  ------------------
  |  Branch (718:9): [True: 15.6k, False: 291k]
  |  Branch (718:22): [True: 290k, False: 1.72k]
  ------------------
  719|   305k|    {
  720|   305k|        return 1;
  721|   305k|    }
  722|       |
  723|       |    /* cVal, cation valence */
  724|  1.72k|    switch ( at[iat].el_number ) {
  725|    333|        case EL_NUMBER_N: /* fallthrough */
  ------------------
  |  |   14|    333|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (725:9): [True: 333, False: 1.39k]
  ------------------
  726|    358|        case EL_NUMBER_P:
  ------------------
  |  |   18|    358|#define EL_NUMBER_P  ((U_CHAR)15)
  ------------------
  |  Branch (726:9): [True: 25, False: 1.69k]
  ------------------
  727|    358|            cVal = 4;
  728|    358|            break;
  729|    156|        case EL_NUMBER_O: /* fallthrough */
  ------------------
  |  |   15|    156|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (729:9): [True: 156, False: 1.56k]
  ------------------
  730|    387|        case EL_NUMBER_S:
  ------------------
  |  |   19|    387|#define EL_NUMBER_S  ((U_CHAR)16)
  ------------------
  |  Branch (730:9): [True: 231, False: 1.49k]
  ------------------
  731|    522|        case EL_NUMBER_SE:
  ------------------
  |  |   23|    522|#define EL_NUMBER_SE ((U_CHAR)34)
  ------------------
  |  Branch (731:9): [True: 135, False: 1.58k]
  ------------------
  732|    671|        case EL_NUMBER_TE:
  ------------------
  |  |   26|    671|#define EL_NUMBER_TE ((U_CHAR)52)
  ------------------
  |  Branch (732:9): [True: 149, False: 1.57k]
  ------------------
  733|    671|            cVal = 3;
  734|    671|            break;
  735|    694|        default:
  ------------------
  |  Branch (735:9): [True: 694, False: 1.02k]
  ------------------
  736|    694|            return 1;    
  737|  1.72k|    }
  738|       |
  739|  1.02k|    if (at[iat].valence + at[iat].num_H <= cVal)
  ------------------
  |  Branch (739:9): [True: 986, False: 43]
  ------------------
  740|    986|    {
  741|  1.80k|        for (j = 0; j < at[iat].valence; j++)
  ------------------
  |  Branch (741:21): [True: 825, False: 978]
  ------------------
  742|    825|        {
  743|    825|            neigh = at[iat].neighbor[j];
  744|    825|            if (at[neigh].valence == 4 && at[neigh].chem_bonds_valence == 4 && !at[neigh].num_H &&
  ------------------
  |  Branch (744:17): [True: 66, False: 759]
  |  Branch (744:43): [True: 66, False: 0]
  |  Branch (744:80): [True: 66, False: 0]
  ------------------
  745|     66|                    pVA[neigh].cNumValenceElectrons == 3 && pVA[neigh].cPeriodicRowNumber == 1)
  ------------------
  |  Branch (745:21): [True: 14, False: 52]
  |  Branch (745:61): [True: 8, False: 6]
  ------------------
  746|      8|            {
  747|      8|                return 1;
  748|      8|            }
  749|    825|        }
  750|    978|        return 0;
  751|    986|    }
  752|     43|    return 1;
  753|  1.02k|}
clean_charge_val:
  759|   147k|{
  760|   147k|    inp_ATOM *at = atom + iat;
  761|   147k|    int nPeriodicNum = at->el_number;
  762|   147k|    int num_bonds = at->valence;
  763|   147k|    int min_valence = at->valence + at->num_H;
  764|       |    /* in fixed-H case treat tautomeric -O as tautomeric to avoid #O(+) */
  765|   147k|    int bTautomeric = ( at->endpoint != 0 );
  766|   147k|    int bFixedHTautomeric = !bMobileH && ( endpoint && endpoint[iat] &&
  ------------------
  |  Branch (766:29): [True: 7.53k, False: 140k]
  |  Branch (766:44): [True: 7.53k, False: 0]
  |  Branch (766:56): [True: 1.57k, False: 5.96k]
  ------------------
  767|  1.57k|                            pVA[iat].cNumValenceElectrons == 6 && 1 == num_bonds &&
  ------------------
  |  Branch (767:29): [True: 715, False: 857]
  |  Branch (767:67): [True: 621, False: 94]
  ------------------
  768|    621|                            !at->num_H && !bIsMetal );
  ------------------
  |  Branch (768:29): [True: 549, False: 72]
  |  Branch (768:43): [True: 549, False: 0]
  ------------------
  769|       |    /* int bIsMetal      = is_el_a_metal( nPeriodicNum );*/
  770|   147k|    int bDoNotAddH = if_skip_add_H( nPeriodicNum );
  771|   147k|    int nPeriod, nNumEqAbsCharges;
  772|   147k|    int nNumValenceEl = get_sp_element_type( nPeriodicNum, &nPeriod ) - 1;
  773|       |
  774|   147k|    int i, j;
  775|       |
  776|   147k|    if (!len)
  ------------------
  |  Branch (776:9): [True: 486, False: 147k]
  ------------------
  777|    486|        return len;
  778|       |
  779|   147k|    insertions_sort( pCG, pChargeVal, len, sizeof( pChargeVal[0] ), cmp_charge_val );
  780|       |
  781|       |    /* metals -- very preliminary code */
  782|   147k|    if (bIsMetal && bDoNotAddH)
  ------------------
  |  Branch (782:9): [True: 0, False: 147k]
  |  Branch (782:21): [True: 0, False: 0]
  ------------------
  783|      0|    {
  784|       |/* keep the 1st found */
  785|      0|        return inchi_min( 1, len );
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  786|      0|    }
  787|       |    /* Mobile-H layer cannot have H on positively charged N, P (all IV), O, S, Se, Te (all III) */
  788|       |
  789|       |    /*
  790|       |    if ( abs( pChargeVal[0].nCharge ) > 1 && pChargeVal[0].nValence >= min_valence ) {
  791|       |        return inchi_min( 1, len );
  792|       |    }
  793|       |    */
  794|   147k|    nNumEqAbsCharges = 0;
  795|   779k|    for (i = j = 0; i < len && j < ( nNumEqAbsCharges ? 3 + nNumEqAbsCharges : 4 ); i++)
  ------------------
  |  Branch (795:21): [True: 657k, False: 122k]
  |  Branch (795:32): [True: 641k, False: 15.7k]
  |  Branch (795:38): [True: 16.2k, False: 640k]
  ------------------
  796|   641k|    {
  797|       |        /* for now accept only charge = 0, -1, +1 */
  798|   641k|        if (abs( pChargeVal[i].nCharge ) > 1)
  ------------------
  |  Branch (798:13): [True: 184k, False: 457k]
  ------------------
  799|   184k|        {
  800|   184k|            continue;
  801|   184k|        }
  802|   457k|        if (BOND_TYPE_TRIPLE + BOND_TYPE_DOUBLE * ( min_valence - 1 ) < pChargeVal[i].nValence)
  ------------------
  |  |   34|   457k|#define BOND_TYPE_TRIPLE    3
  ------------------
                      if (BOND_TYPE_TRIPLE + BOND_TYPE_DOUBLE * ( min_valence - 1 ) < pChargeVal[i].nValence)
  ------------------
  |  |   33|   457k|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (802:13): [True: 342, False: 456k]
  ------------------
  803|    342|        {
  804|    342|            continue; /* not more than one triple and the rest - double bonds per atom */
  805|    342|        }
  806|   456k|        if (( bTautomeric || (j && bFixedHTautomeric) ) && pChargeVal[i].nCharge < 0) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (806:15): [True: 3.61k, False: 453k]
  |  Branch (806:31): [True: 308k, False: 145k]
  |  Branch (806:36): [True: 1.44k, False: 306k]
  |  Branch (806:60): [True: 1.58k, False: 3.47k]
  ------------------
  807|  1.58k|        {
  808|  1.58k|            continue; /* negative charge must be included in the tautomeric group */
  809|  1.58k|        }
  810|   455k|        if (( bTautomeric || bFixedHTautomeric ) && pChargeVal[i].nCharge > 0)
  ------------------
  |  Branch (810:15): [True: 2.37k, False: 453k]
  |  Branch (810:30): [True: 1.64k, False: 451k]
  |  Branch (810:53): [True: 1.50k, False: 2.51k]
  ------------------
  811|  1.50k|        {
  812|  1.50k|            continue; /* positive charge for now cannot reach a tautomeric group */
  813|  1.50k|        }
  814|   453k|        if (j && !bMayBeACationInMobileHLayer( atom, pVA, iat, bMobileH ) && pChargeVal[i].nCharge > 0)
  ------------------
  |  Branch (814:13): [True: 307k, False: 146k]
  |  Branch (814:18): [True: 978, False: 306k]
  |  Branch (814:78): [True: 286, False: 692]
  ------------------
  815|    286|        {
  816|    286|            if (i + 1 < len &&
  ------------------
  |  Branch (816:17): [True: 234, False: 52]
  ------------------
  817|    234|                 pChargeVal[i].nValence == pChargeVal[i + 1].nValence &&
  ------------------
  |  Branch (817:18): [True: 81, False: 153]
  ------------------
  818|     81|                 pChargeVal[i].nCharge == -pChargeVal[i + 1].nCharge)
  ------------------
  |  Branch (818:18): [True: 81, False: 0]
  ------------------
  819|     81|            {
  820|       |                /* (-) if exists is always after (+) */
  821|     81|                i += 1; /* also skip the next element */
  822|     81|            }
  823|    286|            continue; /* in case of Mobile-H, a hydrogen cannot be on a (+)-charged heteroatom */
  824|    286|        }
  825|       |
  826|       |        /* accept same valence opposite charges only for C and its group in Periodic Table */
  827|   453k|        if (j && !bTautomeric &&
  ------------------
  |  Branch (827:13): [True: 307k, False: 146k]
  |  Branch (827:18): [True: 306k, False: 341]
  ------------------
  828|   306k|             pChargeVal[i].nValence == pChargeVal[j - 1].nValence &&
  ------------------
  |  Branch (828:14): [True: 59.4k, False: 247k]
  ------------------
  829|  59.4k|             pChargeVal[i].nCharge == -pChargeVal[j - 1].nCharge)
  ------------------
  |  Branch (829:14): [True: 59.4k, False: 0]
  ------------------
  830|  59.4k|        {
  831|  59.4k|            if (nNumValenceEl == VALUE_OCTET / 2 && pChargeVal[i].nCharge && !nNumEqAbsCharges)
  ------------------
  |  |   26|  59.4k|#define VALUE_OCTET    8     /* number of electrons in a full shell */
  ------------------
  |  Branch (831:17): [True: 30.6k, False: 28.8k]
  |  Branch (831:53): [True: 30.6k, False: 0]
  |  Branch (831:78): [True: 30.6k, False: 0]
  ------------------
  832|  30.6k|            {
  833|  30.6k|                pChargeVal[j++] = pChargeVal[i];
  834|  30.6k|                nNumEqAbsCharges++;
  835|  30.6k|            }
  836|  59.4k|            continue;
  837|  59.4k|        }
  838|       |        /* do not accept valence=5 for neutral NHn in case of not Mobile-H 2005-01-26 ???? */
  839|   394k|        if (nNumValenceEl == 5 && nPeriod == 1 && at->num_H &&
  ------------------
  |  Branch (839:13): [True: 195k, False: 198k]
  |  Branch (839:35): [True: 147k, False: 48.5k]
  |  Branch (839:51): [True: 2.56k, False: 144k]
  ------------------
  840|  2.56k|             j && !bMobileH &&
  ------------------
  |  Branch (840:14): [True: 1.42k, False: 1.14k]
  |  Branch (840:19): [True: 1.24k, False: 175]
  ------------------
  841|  1.24k|             pChargeVal[i].nValence == 5 && !pChargeVal[i].nCharge)
  ------------------
  |  Branch (841:14): [True: 521, False: 727]
  |  Branch (841:45): [True: 521, False: 0]
  ------------------
  842|    521|        {
  843|    521|            continue;
  844|    521|        }
  845|       |        /* do not accept gaps in allowed valences */
  846|   393k|        if (j && pChargeVal[i].nValence > pChargeVal[j - 1].nValence + 1)
  ------------------
  |  Branch (846:13): [True: 247k, False: 146k]
  |  Branch (846:18): [True: 9.07k, False: 238k]
  ------------------
  847|  9.07k|        {
  848|  9.07k|            break;
  849|  9.07k|        }
  850|   384k|        pChargeVal[j++] = pChargeVal[i];
  851|   384k|    }
  852|   147k|    len = j;
  853|   147k|    if (!nNumEqAbsCharges && num_bonds < 3 && len == 4)
  ------------------
  |  Branch (853:9): [True: 116k, False: 30.6k]
  |  Branch (853:30): [True: 92.5k, False: 23.9k]
  |  Branch (853:47): [True: 34.5k, False: 57.9k]
  ------------------
  854|  34.5k|    {
  855|  34.5k|        len--; /* prohibit =S#  where # is a triple bond */
  856|  34.5k|    }
  857|   147k|    return len;
  858|   147k|}
GetAtomRestoreInfo:
  880|  1.13M|{
  881|       |    /* #defines from util.c */
  882|  1.13M|#define MIN_ATOM_CHARGE        (-2)
  883|  1.13M|#define MAX_ATOM_CHARGE         2
  884|  1.13M|#define NEUTRAL_STATE          (-MIN_ATOM_CHARGE)
  885|  1.13M|#define NUM_ATOM_CHARGES       (MAX_ATOM_CHARGE - MIN_ATOM_CHARGE + 1)
  886|  1.13M|#define MAX_NUM_VALENCES        5  /* max. number + 1 to provide zero termination */
  887|       |
  888|  1.13M|    int i, j, j2, k, k2, charge, cur_charge, num_non_bonding_electrons;
  889|  1.13M|    int nNumStates, nNumSelectedStates, num_H, num_bonds;
  890|  1.13M|    int nOctetNeutralValenceExcess, nFirstNeutralValenceExcess;
  891|  1.13M|    int nFoundNeutralValenceExcess, nFoundNeutralValenceOrdNumber;
  892|  1.13M|    int nLastFoundValenceOrdNumber, nLastFoundValenceState;
  893|  1.13M|    int cn_bits, cn_bits_array[5], len_cn_bits_array;
  894|  1.13M|    inp_ATOM* at = atom + iat;
  895|  1.13M|    VAL_AT* pVA = pVArray + iat;
  896|  1.13M|    int nPeriodicNum = at->el_number;
  897|  1.13M|    int cur_chem_valence, cur_chem_valence_fixed, min_chem_valence, known_chem_valence;
  898|  1.13M|    int metal_bonds_chem_valence, not_metal_bonds_chem_valence, alt_bonds_delta_valence, bonds_chem_valence, bond_type;
  899|  1.13M|    CHARGE_VAL  ChargeVal[NUM_ATOM_CHARGES * MAX_NUM_VALENCES];
  900|       |
  901|  1.13M|    memset(ChargeVal, 0, sizeof(ChargeVal));
  902|       |
  903|  1.13M|    pVA->cDoNotAddH = if_skip_add_H(nPeriodicNum);  /* InChI never adds H to this atom */
  904|       |    /*pVA->cMetal     = is_el_a_metal( nPeriodicNum );*/ /* the atom is a metal */
  905|       |
  906|       |    /* count bonds to metal atoms; metals have already been marked */
  907|  1.13M|    metal_bonds_chem_valence = not_metal_bonds_chem_valence = alt_bonds_delta_valence = 0;
  908|       |
  909|  1.13M|    if (pVA->cMetal)
  ------------------
  |  Branch (909:9): [True: 449k, False: 683k]
  ------------------
  910|   449k|    {
  911|   449k|        j = at->valence; /* all bonds to metal */
  912|   496k|        for (i = k = j2 = k2 = 0; i < at->valence; i++)
  ------------------
  |  Branch (912:35): [True: 47.0k, False: 449k]
  ------------------
  913|  47.0k|        {
  914|  47.0k|            bond_type = (at->bond_type[i] & BOND_TYPE_MASK);
  ------------------
  |  |  189|  47.0k|#define BOND_TYPE_MASK        0x0f
  ------------------
  915|  47.0k|            if (bond_type <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   34|  47.0k|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (915:17): [True: 46.9k, False: 80]
  ------------------
  916|  46.9k|            {
  917|  46.9k|                metal_bonds_chem_valence += inchi_max(BOND_TYPE_SINGLE, bond_type);
  ------------------
  |  |  138|  46.9k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 46.9k]
  |  |  ------------------
  ------------------
  918|  46.9k|            }
  919|     80|            else
  920|     80|            {
  921|     80|                metal_bonds_chem_valence += BOND_TYPE_SINGLE;
  ------------------
  |  |   32|     80|#define BOND_TYPE_SINGLE    1
  ------------------
  922|     80|                k++; /* count alternating bonds */
  923|     80|            }
  924|  47.0k|        }
  925|   449k|    }
  926|   683k|    else
  927|   683k|    {
  928|  1.00M|        for (i = j = j2 = k = k2 = 0; i < at->valence; i++)
  ------------------
  |  Branch (928:39): [True: 325k, False: 683k]
  ------------------
  929|   325k|        {
  930|   325k|            bond_type = (at->bond_type[i] & BOND_TYPE_MASK);
  ------------------
  |  |  189|   325k|#define BOND_TYPE_MASK        0x0f
  ------------------
  931|   325k|            if (pVArray[(int)at->neighbor[i]].cMetal)
  ------------------
  |  Branch (931:17): [True: 40.5k, False: 285k]
  ------------------
  932|  40.5k|            {
  933|  40.5k|                j++;  /* number of bonds to metal atoms */
  934|  40.5k|                if (bond_type <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   34|  40.5k|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (934:21): [True: 40.4k, False: 73]
  ------------------
  935|  40.4k|                {
  936|  40.4k|                    metal_bonds_chem_valence += inchi_max(BOND_TYPE_SINGLE, bond_type);
  ------------------
  |  |  138|  40.4k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 40.4k]
  |  |  ------------------
  ------------------
  937|  40.4k|                }
  938|     73|                else
  939|     73|                {
  940|     73|                    metal_bonds_chem_valence += BOND_TYPE_SINGLE;
  ------------------
  |  |   32|     73|#define BOND_TYPE_SINGLE    1
  ------------------
  941|     73|                    k++; /* count alternating bonds */
  942|     73|                }
  943|  40.5k|            }
  944|   285k|            else
  945|   285k|            {
  946|   285k|                j2++;
  947|   285k|                if (bond_type <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   34|   285k|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (947:21): [True: 284k, False: 331]
  ------------------
  948|   284k|                {
  949|   284k|                    not_metal_bonds_chem_valence += inchi_max(BOND_TYPE_SINGLE, bond_type);
  ------------------
  |  |  138|   284k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 284k]
  |  |  ------------------
  ------------------
  950|   284k|                }
  951|    331|                else
  952|    331|                {
  953|    331|                    not_metal_bonds_chem_valence += BOND_TYPE_SINGLE;
  ------------------
  |  |   32|    331|#define BOND_TYPE_SINGLE    1
  ------------------
  954|    331|                    k2++; /* count alternating bonds */
  955|    331|                }
  956|   285k|            }
  957|   325k|        }
  958|   683k|    }
  959|       |
  960|  1.13M|    bonds_chem_valence = metal_bonds_chem_valence + not_metal_bonds_chem_valence;
  961|       |
  962|  1.13M|    if (at->chem_bonds_valence > bonds_chem_valence)
  ------------------
  |  Branch (962:9): [True: 302, False: 1.13M]
  ------------------
  963|    302|    {
  964|    302|        if (at->chem_bonds_valence - bonds_chem_valence > 1)
  ------------------
  |  Branch (964:13): [True: 0, False: 302]
  ------------------
  965|      0|        {
  966|      0|            at->chem_bonds_valence = bonds_chem_valence + 1;  /* should not happen */
  967|      0|        }
  968|    302|        alt_bonds_delta_valence = at->chem_bonds_valence - bonds_chem_valence;
  969|    302|    }
  970|       |
  971|  1.13M|    pVA->cNumBondsToMetal = j;
  972|       |
  973|  1.13M|    if (nPeriodicNum == EL_NUMBER_H)
  ------------------
  |  |   11|  1.13M|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
  |  Branch (973:9): [True: 46.4k, False: 1.08M]
  ------------------
  974|  46.4k|    {
  975|       |        /* ignore bridging H; ??? later add ??? */
  976|  46.4k|        return 0;
  977|  46.4k|    }
  978|       |
  979|  1.08M|    num_H = at->num_H;
  980|  1.08M|    num_bonds = at->valence;
  981|       |
  982|  1.08M|    if (!num_bonds && !num_H)
  ------------------
  |  Branch (982:9): [True: 912k, False: 174k]
  |  Branch (982:23): [True: 909k, False: 2.39k]
  ------------------
  983|   909k|    {
  984|   909k|        return 0; /* do not know the answer: isolated atom */
  985|   909k|    }
  986|       |    /* at the beginning all bonds are single */
  987|   176k|    min_chem_valence = num_bonds + num_H;
  988|   176k|    cur_chem_valence = bonds_chem_valence + alt_bonds_delta_valence + num_H; /* includes double & alternating bond contribution */
  989|       |
  990|       |    /* number of non-bonding electrons in case of all single bonds */
  991|   176k|    num_non_bonding_electrons = (int)pVA->cNumValenceElectrons - min_chem_valence;
  992|       |    /* Octet rule: charge = bonds_valence + NumValenceElectrons - 8 */
  993|   176k|    charge = min_chem_valence + (int)pVA->cNumValenceElectrons - VALUE_OCTET; /* wrong */
  ------------------
  |  |   26|   176k|#define VALUE_OCTET    8     /* number of electrons in a full shell */
  ------------------
  994|       |
  995|       |    /* typical (ad hoc) minimal neutral valence */
  996|   176k|    known_chem_valence = (pVA->cNumValenceElectrons > VALUE_OCTET / 2) ?
  ------------------
  |  |   26|   176k|#define VALUE_OCTET    8     /* number of electrons in a full shell */
  ------------------
  |  Branch (996:26): [True: 113k, False: 62.9k]
  ------------------
  997|   113k|        VALUE_OCTET - pVA->cNumValenceElectrons :
  ------------------
  |  |   26|   113k|#define VALUE_OCTET    8     /* number of electrons in a full shell */
  ------------------
  998|   176k|        pVA->cNumValenceElectrons;
  999|       |    /* excess of typical valence over all-single-bonds valence */
 1000|   176k|    nOctetNeutralValenceExcess = known_chem_valence - min_chem_valence;
 1001|       |    /*  (NB=num.bonds, NV=neutral valence, NVX=neutral valence excess, LFVS=last found valence state, val.=valence)
 1002|       |
 1003|       |       element NB  knownFst octet Last  octetNVX  firstNVX foundNVX chargeLFVS  LFVS
 1004|       |                   valence  val.  NV>=
 1005|       |
 1006|       |       -B       1    3        3    3        2         2   =     2        +2
 1007|       |       >B       2    3        3    3        1         1   =     1        +1
 1008|       |       >B-      3    3        3    3        0         0   =     0         0
 1009|       |       >B<      4    3        3    3       -1        -1   <>   N/A       -1
 1010|       |
 1011|       |       -C       1    4        4    4        3         3   =     3        N/A
 1012|       |       >C       2    4        4    4        2         2   =     2        +2  (-2)
 1013|       |       >C-      3    4        4    4        1         1   =     1        +1  (-1)
 1014|       |       >C<      4    4        4    4        0         0   =     0         0
 1015|       |       C(V)     5    4        4    N/A     -1        -1   <>   N/A       N/A
 1016|       |
 1017|       |       -Si      1    4        4    4        3         3   =     3        N/A
 1018|       |       >Si      2    4        4    4        2         2   =     2        +2  (-2)
 1019|       |       >Si-     3    4        4    4        1         1   =     1        +1  (-1)
 1020|       |       >Si-     4    4        4    4        0         0   =     0         0
 1021|       |       Si(V)    5    4        4    N/A     -1        -1   <>   N/A       -1
 1022|       |
 1023|       |       -N       1    3        3    3        2         2   =     2        -2
 1024|       |       >N       2    3        3    3        1         1   =     1        -1
 1025|       |       >N-      3    3        3    3        0         0   =     0         0  (+2)
 1026|       |       >N<      4    3        3    5       -1        -1   <>    1        +1
 1027|       |       N(V)     5    3        3    5       -2        -2   <>    0         0
 1028|       |       N(VI)    6    3        3    N/A     -3        -3   <>   N/A       N/A
 1029|       |       N(VII)   7    3        3    N/A     -4        -4   <>   N/A       N/A
 1030|       |
 1031|       |       -P       1    3        3    3        2         2   =     2        -2
 1032|       |       >P       2    3        3    3        1         1   =     1        -1
 1033|       |       >P-      3    3        3    3        0         0   =     0         0  (-2, +2)
 1034|       |       >P<      4    3        3    5       -1        -1   <>    1        +1  (-1)
 1035|       |       P(V)     5    3        3    5       -2        -2   <>    0         0  (-2)
 1036|       |       P(VI)    6    3        3    N/A     -3        -3   <>   N/A       -1
 1037|       |       P(VII)   7    3        3    N/A     -4        -4   <>   N/A       -2
 1038|       |       P(VIII)  8    3        3    N/A     -5        -5   <>   N/A       N/A
 1039|       |
 1040|       |       -O       1    2        2    2        1         1   =     1        -1
 1041|       |       >O       2    2        2    2        0         0   =     0         0
 1042|       |       >O-      3    2        2    N/A     -1        -1   <>   N/A       +1
 1043|       |       >O<      4    2        2    N/A     -2        -2   <>   N/A       +2
 1044|       |       O(V)     5    2        2    N/A     -3        -3   <>   N/A       +1
 1045|       |       O(VI)    6    2        2    N/A     -4        -4   <>   N/A       N/A
 1046|       |
 1047|       |       -S       1    2        2    2        1         1   =     1        -1
 1048|       |       >S       2    2        2    2        0         0   =     0         0       NPNP - prohibit
 1049|       |       >S-      3    2        2    4       -1        -1   <>    1        +1  (-1) PNPN
 1050|       |       >S<      4    2        2    4       -2        -2   <>    0         0  (+2)
 1051|       |       S(V)     5    2        2    6       -3        -3   <>    1        +1  (-1)
 1052|       |       S(VI)    6    2        2    6       -4        -4   <>    0         0
 1053|       |       S(VII)   7    2        2    N/A     -5        -5   <>    0        -1
 1054|       |       S(VIII)  8    2        2    N/A     -6        -6   <>   N/A       N/A
 1055|       |
 1056|       |       -F       1    1        1    1        0         0   =     0         0
 1057|       |       >F       2    1        1    1       -1        -1   <>   N/A       +1
 1058|       |       >F-      3    1        1    1       -2        -2   <>   N/A       +2
 1059|       |       >F<      4    1        1    1       -3        -3   <>   N/A       N/A
 1060|       |       F(V)     5    1        1    1       -4        -4   <>   N/A       +2
 1061|       |       F(VI)    6    1        1    1       -5        -5   <>   N/A       N/A
 1062|       |
 1063|       |       -Cl      1    1        1    1        0         0   =     0         0      NPNP - prohibit
 1064|       |       >Cl      2    1        1    3       -1        -1   <>    1        +1      PNPN - prohibit
 1065|       |       >Cl-     3    1        1    3       -2        -2   <>    0         0 (+2) NPNP
 1066|       |       >Cl<     4    1        1    5       -3        -3   <>    1        +1      PNPN
 1067|       |       Cl(V)    5    1        1    5       -4        -4   <>    0         0
 1068|       |       Cl(VI)   6    1        1    7       -5        -5   <>    1        +1
 1069|       |       Cl(VII)  7    1        1    7       -6        -6   <>    0         0
 1070|       |       Cl(VIII) 8    1        1    N/A     -7        -7   <>   N/A       N/A
 1071|       |
 1072|       |
 1073|       |      NB                 = num_bonds+num_H
 1074|       |
 1075|       |      knownFst valence   = nFirstNeutralValenceExcess + min_chem_valence
 1076|       |      octet val.         = nOctetNeutralValenceExcess + min_chem_valence
 1077|       |      Last NV>=          = nFoundNeutralValenceExcess + min_chem_valence
 1078|       |
 1079|       |      octetNVX           = nOctetNeutralValenceExcess
 1080|       |      firstNVX           = nFirstNeutralValenceExcess
 1081|       |      foundNVX           = nFoundNeutralValenceExcess
 1082|       |
 1083|       |      chargeLFVS         = ChargeVal[nLastFoundValenceState].nCharge
 1084|       |
 1085|       |    */
 1086|       |    /* minimal known neutral atom valence; different for Sn(2/4), Tl(1/3), Pb(2/4): (known/typical ad hoc) */
 1087|   176k|    known_chem_valence = get_el_valence( nPeriodicNum, 0, 0 );
 1088|       |
 1089|   176k|    if (pSrm->bMetalAddFlower)
  ------------------
  |  Branch (1089:9): [True: 176k, False: 0]
  ------------------
 1090|   176k|    {
 1091|       |        /* bond orders of bonds to metal may be as they are (pSrm->nMetalInitBondOrder==1)
 1092|       |                                        or decreased by one (pSrm->nMetalInitBondOrder==0)
 1093|       |           nMetalInitBondOrder == nMetalMinBondOrder + nMetalInitEdgeFlow
 1094|       |        */
 1095|   176k|        cur_chem_valence_fixed = cur_chem_valence - pVA->cNumBondsToMetal * ( 1 - pSrm->nMetalInitBondOrder );
 1096|   176k|        pVA->cInitOrigValenceToMetal = metal_bonds_chem_valence;
 1097|   176k|        pVA->cInitValenceToMetal = metal_bonds_chem_valence - pVA->cNumBondsToMetal * ( 1 - pSrm->nMetalInitBondOrder );
 1098|   176k|        pVA->cInitFlowToMetal = pVA->cInitValenceToMetal - pVA->cNumBondsToMetal * pSrm->nMetalMinBondOrder;
 1099|   176k|        if (pVA->cMetal)
  ------------------
  |  Branch (1099:13): [True: 26.9k, False: 149k]
  ------------------
 1100|  26.9k|        {
 1101|  26.9k|            pVA->cInitFreeValences += alt_bonds_delta_valence;
 1102|  26.9k|        }
 1103|   176k|        if (pSrm->nMetalInitEdgeFlow < pSrm->nMetalInitBondOrder - pSrm->nMetalMinBondOrder)
  ------------------
  |  Branch (1103:13): [True: 0, False: 176k]
  ------------------
 1104|      0|        {
 1105|       |            /* single bond has zero initial flow + 2 radicals at incident atoms */
 1106|      0|            if (pVA->cInitFlowToMetal <= pVA->cNumBondsToMetal)
  ------------------
  |  Branch (1106:17): [True: 0, False: 0]
  ------------------
 1107|      0|            {
 1108|      0|                if (pVA->cMetal)
  ------------------
  |  Branch (1108:21): [True: 0, False: 0]
  ------------------
 1109|      0|                {
 1110|      0|                    pVA->cInitFreeValences += pVA->cInitFlowToMetal;
 1111|      0|                }
 1112|      0|                pVA->cInitFlowToMetal = 0;
 1113|      0|            }
 1114|      0|            else
 1115|      0|            {
 1116|      0|                if (pVA->cMetal)
  ------------------
  |  Branch (1116:21): [True: 0, False: 0]
  ------------------
 1117|      0|                {
 1118|      0|                    pVA->cInitFreeValences += pVA->cNumBondsToMetal * ( 1 - pSrm->nMetalInitEdgeFlow );
 1119|      0|                }
 1120|      0|                pVA->cInitFlowToMetal -= pVA->cNumBondsToMetal * ( 1 - pSrm->nMetalInitEdgeFlow );
 1121|      0|            }
 1122|      0|        }
 1123|   176k|    }
 1124|      0|    else
 1125|      0|    {
 1126|       |        /* treat metal atoms as ordinary non-metal atoms */
 1127|      0|        cur_chem_valence_fixed = cur_chem_valence;
 1128|      0|        pVA->cInitFlowToMetal = metal_bonds_chem_valence - pVA->cNumBondsToMetal;
 1129|      0|        pVA->cInitValenceToMetal = metal_bonds_chem_valence;
 1130|      0|        pVA->cInitOrigValenceToMetal = metal_bonds_chem_valence;
 1131|      0|    }
 1132|       |
 1133|       |
 1134|   176k|    if (pVA->cMetal && pSrm->bMetalAddFlower)
  ------------------
  |  Branch (1134:9): [True: 26.9k, False: 149k]
  |  Branch (1134:24): [True: 26.9k, False: 0]
  ------------------
 1135|  26.9k|    {
 1136|  26.9k|        pVA->cnListIndex = cnListIndexMe + 1;
  ------------------
  |  |  467|  26.9k|#define cnListIndexMe (17)  /* index of {cnMe, cn_bits_Me,... } element of cnList[] */
  ------------------
 1137|       |        /*
 1138|       |        pVA->cInitOrigValenceToMetal += alt_bonds_delta_valence;
 1139|       |        pVA->cInitValenceToMetal     += alt_bonds_delta_valence;
 1140|       |        pVA->cInitFreeValences = (pSrm->nMetalInitBondOrder + alt_bonds_delta_valence
 1141|       |                                 - (pSrm->nMetalMinBondOrder + pSrm->nMetalInitEdgeFlow)) * pVA->cNumBondsToMetal;
 1142|       |        */
 1143|  26.9k|        return 0;  /* metal */
 1144|  26.9k|    }
 1145|       |
 1146|   149k|    if (!known_chem_valence)
  ------------------
  |  Branch (1146:9): [True: 2.23k, False: 147k]
  ------------------
 1147|  2.23k|    {
 1148|       |        /* a noble gas like He, Ne, ... */
 1149|  2.23k|        pVA->cInitFreeValences = at->chem_bonds_valence - at->valence;
 1150|  2.23k|        return TREAT_ATOM_AS_METAL; /* do not know anything about this atom; needs 2nd pass */
  ------------------
  |  |  258|  2.23k|#define TREAT_ATOM_AS_METAL 99
  ------------------
 1151|  2.23k|    }
 1152|       |
 1153|   147k|    nFirstNeutralValenceExcess = known_chem_valence - min_chem_valence;
 1154|       |
 1155|   147k|    nFoundNeutralValenceExcess = NO_VALUE_INT;
  ------------------
  |  |   23|   147k|#define NO_VALUE_INT    9999
  ------------------
 1156|   147k|    nFoundNeutralValenceOrdNumber = NO_VALUE_INT;
  ------------------
  |  |   23|   147k|#define NO_VALUE_INT    9999
  ------------------
 1157|   147k|    nLastFoundValenceOrdNumber = NO_VALUE_INT;
  ------------------
  |  |   23|   147k|#define NO_VALUE_INT    9999
  ------------------
 1158|   147k|    nLastFoundValenceState = NO_VALUE_INT;
  ------------------
  |  |   23|   147k|#define NO_VALUE_INT    9999
  ------------------
 1159|       |
 1160|       |    /* find the lowest known valence >= all-single-bonds valence */
 1161|   886k|    for (cur_charge = MIN_ATOM_CHARGE, nNumStates = 0; cur_charge <= MAX_ATOM_CHARGE; cur_charge++)
  ------------------
  |  |  882|   147k|#define MIN_ATOM_CHARGE        (-2)
  ------------------
                  for (cur_charge = MIN_ATOM_CHARGE, nNumStates = 0; cur_charge <= MAX_ATOM_CHARGE; cur_charge++)
  ------------------
  |  |  883|   886k|#define MAX_ATOM_CHARGE         2
  ------------------
  |  Branch (1161:56): [True: 738k, False: 147k]
  ------------------
 1162|   738k|    {
 1163|  4.43M|        for (i = 0; i < MAX_NUM_VALENCES; i++)
  ------------------
  |  |  886|  4.43M|#define MAX_NUM_VALENCES        5  /* max. number + 1 to provide zero termination */
  ------------------
  |  Branch (1163:21): [True: 3.69M, False: 738k]
  ------------------
 1164|  3.69M|        {
 1165|  3.69M|            known_chem_valence = get_el_valence(nPeriodicNum, cur_charge, i);
 1166|  3.69M|            if (cur_chem_valence_fixed > known_chem_valence || !known_chem_valence)
  ------------------
  |  Branch (1166:17): [True: 2.83M, False: 855k]
  |  Branch (1166:64): [True: 3.96k, False: 851k]
  ------------------
 1167|  2.84M|            {
 1168|  2.84M|                continue; /* known valence < all-single-bonds valence */
 1169|  2.84M|            }
 1170|   851k|            if (BOND_TYPE_TRIPLE + BOND_TYPE_DOUBLE * (num_bonds - 1) + num_H < known_chem_valence)
  ------------------
  |  |   34|   851k|#define BOND_TYPE_TRIPLE    3
  ------------------
                          if (BOND_TYPE_TRIPLE + BOND_TYPE_DOUBLE * (num_bonds - 1) + num_H < known_chem_valence)
  ------------------
  |  |   33|   851k|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (1170:17): [True: 193k, False: 657k]
  ------------------
 1171|   193k|            {
 1172|   193k|                continue; /* not more than one triple and the rest - double bonds per atom */
 1173|   193k|            }
 1174|       |
 1175|       |            /* keep all found */
 1176|   657k|            ChargeVal[nNumStates].nValence = known_chem_valence;
 1177|   657k|            ChargeVal[nNumStates].nCharge = cur_charge;
 1178|   657k|            ChargeVal[nNumStates].nValenceOrderingNumber = i;
 1179|   657k|            if (!cur_charge && nFoundNeutralValenceExcess == NO_VALUE_INT)
  ------------------
  |  |   23|   174k|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (1179:17): [True: 174k, False: 483k]
  |  Branch (1179:32): [True: 124k, False: 50.2k]
  ------------------
 1180|   124k|            {
 1181|       |                /* neutral state; compare to the lowest typical valence */
 1182|   124k|                nFoundNeutralValenceExcess = known_chem_valence - min_chem_valence;
 1183|   124k|                nFoundNeutralValenceOrdNumber = i;
 1184|   124k|            }
 1185|   657k|            if (min_chem_valence == known_chem_valence)
  ------------------
  |  Branch (1185:17): [True: 165k, False: 492k]
  ------------------
 1186|   165k|            {
 1187|   165k|                if (nLastFoundValenceState == NO_VALUE_INT)
  ------------------
  |  |   23|   165k|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (1187:21): [True: 130k, False: 35.1k]
  ------------------
 1188|   130k|                {
 1189|       |                    /* accept the first found */
 1190|   130k|                    nLastFoundValenceState = nNumStates;
 1191|   130k|                }
 1192|  35.1k|                else
 1193|  35.1k|                    if (abs(ChargeVal[nLastFoundValenceState].nCharge) >= abs(cur_charge))
  ------------------
  |  Branch (1193:25): [True: 24.0k, False: 11.0k]
  ------------------
 1194|  24.0k|                    {
 1195|       |                        /* accept smaller abs(charge); if abs(charges) are same, accept (+) */
 1196|  24.0k|                        nLastFoundValenceState = nNumStates;
 1197|  24.0k|                    }
 1198|   165k|            }
 1199|       |
 1200|   657k|            nNumStates++;
 1201|   657k|        }
 1202|   738k|    }
 1203|       |
 1204|       |    /***********************************************************************************/
 1205|       |    /* select only appropriate charge & valence so that a suitable ChargeStruct exists */
 1206|       |    /***********************************************************************************/
 1207|       |
 1208|   147k|    nNumSelectedStates = clean_charge_val( pCG, ChargeVal, nNumStates, atom,
 1209|   147k|                                           pVArray, iat, pVA->cMetal,
 1210|   147k|                                           bMobileH, endpoint );
 1211|       |
 1212|   147k|    if (!nNumSelectedStates)
  ------------------
  |  Branch (1212:9): [True: 1.41k, False: 146k]
  ------------------
 1213|  1.41k|    {
 1214|  1.41k|        return TREAT_ATOM_AS_METAL; /* nothing to do */
  ------------------
  |  |  258|  1.41k|#define TREAT_ATOM_AS_METAL 99
  ------------------
 1215|  1.41k|    }
 1216|       |
 1217|       |    /***********************************************************************************/
 1218|       |    /*       Find an appropriate ChargeStruct index for the ChargeVal found            */
 1219|       |    /***********************************************************************************/
 1220|   146k|    cn_bits = 0;
 1221|   146k|    memset( cn_bits_array, 0, sizeof( cn_bits_array ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 1222|       |    /***** set bits identifying a suitable ChargeStruct ******/
 1223|   526k|    for (i = len_cn_bits_array = 0; i < nNumSelectedStates && len_cn_bits_array < 4; i++)
  ------------------
  |  Branch (1223:37): [True: 380k, False: 146k]
  |  Branch (1223:63): [True: 380k, False: 0]
  ------------------
 1224|   380k|    {
 1225|   380k|        switch (ChargeVal[i].nCharge)
 1226|   380k|        {
 1227|   109k|            case -1:
  ------------------
  |  Branch (1227:13): [True: 109k, False: 271k]
  ------------------
 1228|   109k|                cn_bits_array[len_cn_bits_array] |= cn_bits_M; /* Minus 1 */
  ------------------
  |  |  418|   109k|#define cn_bits_M  4  /* Minus 1: charge = -1 */
  ------------------
 1229|   109k|                break;
 1230|   141k|            case 0:
  ------------------
  |  Branch (1230:13): [True: 141k, False: 238k]
  ------------------
 1231|   141k|                cn_bits_array[len_cn_bits_array] |= cn_bits_N; /* Neutral */
  ------------------
  |  |  416|   141k|#define cn_bits_N  1  /* Neutral: charge =  0 */
  ------------------
 1232|   141k|                break;
 1233|   129k|            case 1:
  ------------------
  |  Branch (1233:13): [True: 129k, False: 251k]
  ------------------
 1234|   129k|                cn_bits_array[len_cn_bits_array] |= cn_bits_P; /* Plus 1 */
  ------------------
  |  |  417|   129k|#define cn_bits_P  2  /* Plus 1:  charge = +1 */
  ------------------
 1235|   129k|                break;
 1236|      0|            default:
  ------------------
  |  Branch (1236:13): [True: 0, False: 380k]
  ------------------
 1237|      0|                return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1238|   380k|        }
 1239|   380k|        if (i + 1 < nNumSelectedStates &&
  ------------------
  |  Branch (1239:13): [True: 234k, False: 146k]
  ------------------
 1240|   234k|             ChargeVal[i].nValence == ChargeVal[i + 1].nValence &&
  ------------------
  |  Branch (1240:14): [True: 30.6k, False: 203k]
  ------------------
 1241|  30.6k|             ChargeVal[i].nCharge &&
  ------------------
  |  Branch (1241:14): [True: 30.6k, False: 0]
  ------------------
 1242|  30.6k|             ChargeVal[i].nCharge == -ChargeVal[i + 1].nCharge)
  ------------------
  |  Branch (1242:14): [True: 30.6k, False: 0]
  ------------------
 1243|  30.6k|        {
 1244|  30.6k|            ; /* add opposite charge to the same element of cn_bits_array[] */
 1245|  30.6k|        }
 1246|   349k|        else
 1247|   349k|        {
 1248|   349k|            len_cn_bits_array++;
 1249|   349k|        }
 1250|   380k|    }
 1251|   146k|    if (!len_cn_bits_array || len_cn_bits_array > 4)
  ------------------
  |  Branch (1251:9): [True: 0, False: 146k]
  |  Branch (1251:31): [True: 0, False: 146k]
  ------------------
 1252|      0|    {
 1253|      0|        return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1254|      0|    }
 1255|       |    /* accommodate added 4-state ChargeStruct: +/- cannot be in case of 4 states */
 1256|   146k|    if (len_cn_bits_array + 1 == nNumSelectedStates && nNumSelectedStates == 4)
  ------------------
  |  Branch (1256:9): [True: 30.6k, False: 115k]
  |  Branch (1256:56): [True: 711, False: 29.9k]
  ------------------
 1257|    711|    {
 1258|    711|        len_cn_bits_array--;
 1259|    711|        nNumSelectedStates--;
 1260|    711|        cn_bits_array[len_cn_bits_array] = 0;
 1261|    711|    }
 1262|       |    /* fix for terminal hydrogenless -C as in isocyano or CO: there is no just cnE_[] ChargeStruct */
 1263|   146k|    if (len_cn_bits_array == 1 &&
  ------------------
  |  Branch (1263:9): [True: 24.9k, False: 121k]
  ------------------
 1264|  24.9k|         cn_bits_array[0] == ( cn_bits_P | cn_bits_M ) &&
  ------------------
  |  |  417|  24.9k|#define cn_bits_P  2  /* Plus 1:  charge = +1 */
  ------------------
                       cn_bits_array[0] == ( cn_bits_P | cn_bits_M ) &&
  ------------------
  |  |  418|  24.9k|#define cn_bits_M  4  /* Minus 1: charge = -1 */
  ------------------
  |  Branch (1264:10): [True: 15.6k, False: 9.30k]
  ------------------
 1265|  15.6k|         ChargeVal[0].nValence + 1 > BOND_TYPE_TRIPLE + BOND_TYPE_DOUBLE * ( num_bonds - 1 ) + num_H)
  ------------------
  |  |   34|  15.6k|#define BOND_TYPE_TRIPLE    3
  ------------------
                       ChargeVal[0].nValence + 1 > BOND_TYPE_TRIPLE + BOND_TYPE_DOUBLE * ( num_bonds - 1 ) + num_H)
  ------------------
  |  |   33|  15.6k|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (1265:10): [True: 15.6k, False: 1]
  ------------------
 1266|  15.6k|    {
 1267|  15.6k|        cn_bits_array[len_cn_bits_array++] = cn_bits_N;
  ------------------
  |  |  416|  15.6k|#define cn_bits_N  1  /* Neutral: charge =  0 */
  ------------------
 1268|  15.6k|        ChargeVal[nNumSelectedStates].nValence = ChargeVal[nNumSelectedStates - 1].nValence;
 1269|  15.6k|        ChargeVal[nNumSelectedStates].nCharge = 0;
 1270|  15.6k|        ChargeVal[nNumSelectedStates].nValenceOrderingNumber = 0;
 1271|  15.6k|    }
 1272|       |
 1273|   149k|make_cn_bits:
 1274|   149k|    cn_bits = MAKE_CN_BITS( cn_bits_array[0], cn_bits_array[1], cn_bits_array[2], cn_bits_array[3] );
  ------------------
  |  |  421|   149k|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  ------------------
  |  |  |  |  419|   149k|#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))
  |  |  ------------------
  |  |  |  |  419|   149k|#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))
  |  |  ------------------
  |  |  |  |  419|   149k|#define cn_bits_shift 3
  |  |  ------------------
  ------------------
 1275|       |
 1276|       |    /*********** find ChargeStructure **************/
 1277|  1.16M|    for (i = 0, j = -1; i < cnListNumEl; i++)
  ------------------
  |  Branch (1277:25): [True: 1.16M, False: 3.55k]
  ------------------
 1278|  1.16M|    {
 1279|  1.16M|        if (cnList[i].bits == cn_bits)
  ------------------
  |  Branch (1279:13): [True: 146k, False: 1.01M]
  ------------------
 1280|   146k|        {
 1281|   146k|            j = i;
 1282|   146k|            break; /* found */
 1283|   146k|        }
 1284|  1.16M|    }
 1285|       |
 1286|   149k|    if (j < 0)
  ------------------
  |  Branch (1286:9): [True: 3.55k, False: 146k]
  ------------------
 1287|  3.55k|    {
 1288|       |        /* ChargeStructure was not found */
 1289|  3.55k|        if (1 < len_cn_bits_array && len_cn_bits_array + 1 == nNumSelectedStates)
  ------------------
  |  Branch (1289:13): [True: 3.55k, False: 1]
  |  Branch (1289:38): [True: 0, False: 3.55k]
  ------------------
 1290|      0|        {
 1291|       |/* a pair of opposite charges was combined */
 1292|      0|            len_cn_bits_array--;
 1293|      0|            cn_bits_array[len_cn_bits_array] = 0;
 1294|      0|            goto make_cn_bits;
 1295|      0|        }
 1296|  3.55k|        else if (nNumSelectedStates == 4)
  ------------------
  |  Branch (1296:18): [True: 3.55k, False: 1]
  ------------------
 1297|  3.55k|        {
 1298|       |            /* reduce number of states */
 1299|  3.55k|            len_cn_bits_array--;
 1300|  3.55k|            cn_bits_array[len_cn_bits_array] = 0;
 1301|  3.55k|            nNumSelectedStates--;
 1302|  3.55k|            goto make_cn_bits;
 1303|  3.55k|        }
 1304|      1|        return RI_ERR_PROGR; /* charge structure not found */
  ------------------
  |  |   17|      1|#define RI_ERR_PROGR   (-3)
  ------------------
 1305|  3.55k|    }
 1306|       |
 1307|       |    /********** ChargeStructure has been found **********/
 1308|   146k|    pVA->cnListIndex = j + 1; /* charge structure index + 1 */
 1309|   146k|    pVA->cInitCharge = cnList[j].nInitialCharge;
 1310|       |    /********** Calculate "Free Valence" ****************/
 1311|   146k|#if ( ALLOW_METAL_BOND_ZERO == 1 )
 1312|       |
 1313|       |#if ( INIT_METAL_BOND_ZERO == 1 )
 1314|       |    if (pVA->cMetal)
 1315|       |    {
 1316|       |        j = 0;
 1317|       |    }
 1318|       |    else
 1319|       |    {
 1320|       |        j = ChargeVal[0].nValence - cur_chem_valence_fixed;
 1321|       |    }
 1322|       |#else
 1323|   146k|    j = ChargeVal[0].nValence - cur_chem_valence_fixed;
 1324|   146k|#endif
 1325|       |
 1326|       |#else
 1327|       |    j = ChargeVal[0].nValence - cur_chem_valence_fixed;
 1328|       |#endif
 1329|   146k|    if (j < 0)
  ------------------
  |  Branch (1329:9): [True: 0, False: 146k]
  ------------------
 1330|      0|    {
 1331|      0|        return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1332|      0|    }
 1333|   146k|    pVA->cInitFreeValences = j; /* number of initial unsatisfied valences; should be combined with */
 1334|       |                                /* (cap - flow) of vertex=0 in the charge structure[pVA->cnListIndex-1] */
 1335|   146k|    return 1; /* success */
 1336|       |
 1337|   146k|#undef MIN_ATOM_CHARGE
 1338|   146k|#undef MAX_ATOM_CHARGE
 1339|   146k|#undef NEUTRAL_STATE
 1340|   146k|#undef NUM_ATOM_CHARGES
 1341|   146k|#undef MAX_NUM_VALENCES
 1342|   146k|}
get_sp_element_type:
 1395|  1.24M|{
 1396|  1.24M|    int row = 0, type = 0;
 1397|  1.24M|    if (nPeriodicNumber == 1)
  ------------------
  |  Branch (1397:9): [True: 44.3k, False: 1.20M]
  ------------------
 1398|  44.3k|    {
 1399|  44.3k|        type = 1; /* H: 1 */
 1400|  44.3k|        row = 0;
 1401|  44.3k|    }
 1402|  1.20M|    else if (nPeriodicNumber == 2)
  ------------------
  |  Branch (1402:14): [True: 2.44k, False: 1.19M]
  ------------------
 1403|  2.44k|    {
 1404|  2.44k|        type = 0; row = 0;
 1405|  2.44k|    }
 1406|  1.19M|    else if (nPeriodicNumber <= 10)
  ------------------
  |  Branch (1406:14): [True: 519k, False: 679k]
  ------------------
 1407|   519k|    {
 1408|       |        /* Li: 2, Be: 3, B: 4, C: 5, N: 6, O: 7, F: 8, Ne: 9; later subtract 1 */
 1409|   519k|        type = nPeriodicNumber - 1; row = 1;
 1410|   519k|    }
 1411|   679k|    else if (nPeriodicNumber <= 18)
  ------------------
  |  Branch (1411:14): [True: 212k, False: 467k]
  ------------------
 1412|   212k|    {
 1413|   212k|        type = nPeriodicNumber - 9; row = 2;
 1414|   212k|    }
 1415|   467k|    else if (nPeriodicNumber <= 20)
  ------------------
  |  Branch (1415:14): [True: 11.8k, False: 455k]
  ------------------
 1416|  11.8k|    {
 1417|  11.8k|        type = nPeriodicNumber - 17; row = 3;
 1418|  11.8k|    }
 1419|   455k|    else if (nPeriodicNumber <= 30)
  ------------------
  |  Branch (1419:14): [True: 83.4k, False: 371k]
  ------------------
 1420|  83.4k|    {
 1421|  83.4k|        type = 0; row = 3;
 1422|  83.4k|    }
 1423|   371k|    else if (nPeriodicNumber <= 36)
  ------------------
  |  Branch (1423:14): [True: 11.8k, False: 360k]
  ------------------
 1424|  11.8k|    {
 1425|  11.8k|        type = nPeriodicNumber - 27; row = 3;
 1426|  11.8k|    }
 1427|   360k|    else if (nPeriodicNumber <= 38)
  ------------------
  |  Branch (1427:14): [True: 532, False: 359k]
  ------------------
 1428|    532|    {
 1429|    532|        type = nPeriodicNumber - 35; row = 4;
 1430|    532|    }
 1431|   359k|    else if (nPeriodicNumber <= 48)
  ------------------
  |  Branch (1431:14): [True: 154k, False: 204k]
  ------------------
 1432|   154k|    {
 1433|   154k|        type = 0; row = 4;
 1434|   154k|    }
 1435|   204k|    else if (nPeriodicNumber <= 54)
  ------------------
  |  Branch (1435:14): [True: 20.7k, False: 184k]
  ------------------
 1436|  20.7k|    {
 1437|  20.7k|        type = nPeriodicNumber - 45; row = 4;
 1438|  20.7k|    }
 1439|   184k|    else if (nPeriodicNumber <= 56)
  ------------------
  |  Branch (1439:14): [True: 1.04k, False: 183k]
  ------------------
 1440|  1.04k|    {
 1441|  1.04k|        type = nPeriodicNumber - 53; row = 5;
 1442|  1.04k|    }
 1443|   183k|    else if (nPeriodicNumber <= 80)
  ------------------
  |  Branch (1443:14): [True: 79.6k, False: 103k]
  ------------------
 1444|  79.6k|    {
 1445|  79.6k|        type = 0; row = 5;
 1446|  79.6k|    }
 1447|   103k|    else if (nPeriodicNumber <= 86)
  ------------------
  |  Branch (1447:14): [True: 2.16k, False: 101k]
  ------------------
 1448|  2.16k|    {
 1449|  2.16k|        type = nPeriodicNumber - 77; row = 5;
 1450|  2.16k|    }
 1451|   101k|    else if (nPeriodicNumber <= 88)
  ------------------
  |  Branch (1451:14): [True: 1.60k, False: 99.7k]
  ------------------
 1452|  1.60k|    {
 1453|  1.60k|        type = nPeriodicNumber - 85; row = 6;
 1454|  1.60k|    }
 1455|  99.7k|    else
 1456|  99.7k|    {
 1457|  99.7k|        type = 0; row = 6;
 1458|  99.7k|    }
 1459|       |
 1460|  1.24M|    *nRow = row;
 1461|       |
 1462|  1.24M|    return type == 9 ? 0 : type;
  ------------------
  |  Branch (1462:12): [True: 999, False: 1.24M]
  ------------------
 1463|  1.24M|}
ReallocTCGroups:
 1468|  34.4k|{
 1469|  34.4k|    TC_GROUP *pTCGroup = (TC_GROUP *) inchi_malloc( sizeof( pTCGroup[0] )*( (long long)pTCGroups->max_tc_groups + nAdd ) ); /* djb-rwth: cast operator added */
  ------------------
  |  | 1143|  34.4k|#define inchi_malloc   malloc
  ------------------
 1470|       |
 1471|  34.4k|    if (pTCGroup)
  ------------------
  |  Branch (1471:9): [True: 34.4k, False: 0]
  ------------------
 1472|  34.4k|    {
 1473|  34.4k|        if (pTCGroups->num_tc_groups)
  ------------------
  |  Branch (1473:13): [True: 30, False: 34.3k]
  ------------------
 1474|     30|        {
 1475|     30|            memcpy(pTCGroup, pTCGroups->pTCG, sizeof(pTCGroup[0]) * pTCGroups->num_tc_groups);
 1476|     30|        }
 1477|  34.4k|        memset( pTCGroup + pTCGroups->max_tc_groups, 0, sizeof( pTCGroup[0] )*nAdd ); /* djb-rwth: memset_s C11/Annex K variant? */
 1478|  34.4k|        if (pTCGroups->pTCG)
  ------------------
  |  Branch (1478:13): [True: 30, False: 34.3k]
  ------------------
 1479|     30|        {
 1480|     30|            inchi_free( pTCGroups->pTCG );
  ------------------
  |  | 1152|     30|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 30, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 30]
  |  |  ------------------
  ------------------
 1481|     30|        }
 1482|  34.4k|        pTCGroups->pTCG = pTCGroup;
 1483|  34.4k|        pTCGroups->max_tc_groups += nAdd;
 1484|  34.4k|        return 0;
 1485|  34.4k|    }
 1486|       |
 1487|      0|    return RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1488|  34.4k|}
RegisterTCGroup:
 1494|   812k|{
 1495|   812k|    int i, ret = 0;
 1496|       |
 1497|       |    /* search */
 1498|  2.80M|    for (i = 0; i < pTCGroups->num_tc_groups; i++)
  ------------------
  |  Branch (1498:17): [True: 2.53M, False: 268k]
  ------------------
 1499|  2.53M|    {
 1500|  2.53M|        if (pTCGroups->pTCG[i].type == nGroupType &&
  ------------------
  |  Branch (1500:13): [True: 674k, False: 1.85M]
  ------------------
 1501|   674k|             pTCGroups->pTCG[i].ord_num == nGroupOrdNum)
  ------------------
  |  Branch (1501:14): [True: 543k, False: 131k]
  ------------------
 1502|   543k|        {
 1503|   543k|            break;
 1504|   543k|        }
 1505|  2.53M|    }
 1506|       |
 1507|   812k|    if (i == pTCGroups->num_tc_groups)
  ------------------
  |  Branch (1507:9): [True: 268k, False: 543k]
  ------------------
 1508|   268k|    {
 1509|       |        /* add one more group */
 1510|   268k|        if (pTCGroups->num_tc_groups == pTCGroups->max_tc_groups)
  ------------------
  |  Branch (1510:13): [True: 34.4k, False: 234k]
  ------------------
 1511|  34.4k|        {
 1512|  34.4k|            ret = ReallocTCGroups( pTCGroups, INC_NUM_TCGROUPS );
  ------------------
  |  |  158|  34.4k|#define INC_NUM_TCGROUPS 16
  ------------------
 1513|  34.4k|            if (ret)
  ------------------
  |  Branch (1513:17): [True: 0, False: 34.4k]
  ------------------
 1514|      0|            {
 1515|      0|                goto exit_function;
 1516|      0|            }
 1517|  34.4k|        }
 1518|       |
 1519|   268k|        ret = i + 1; /* added new group */
 1520|   268k|        pTCGroups->num_tc_groups++;
 1521|   268k|        pTCGroups->pTCG[i].type = nGroupType;
 1522|   268k|        pTCGroups->pTCG[i].ord_num = nGroupOrdNum;
 1523|   268k|    }
 1524|       |
 1525|   812k|    pTCGroups->pTCG[i].num_edges += nNumEdges;
 1526|       |
 1527|   812k|    pTCGroups->pTCG[i].st_cap += nVertexCap;
 1528|   812k|    pTCGroups->pTCG[i].st_flow += nVertexFlow;
 1529|       |
 1530|   812k|    pTCGroups->pTCG[i].edges_cap += nEdgeCap;
 1531|   812k|    pTCGroups->pTCG[i].edges_flow += nEdgeFlow;
 1532|       |
 1533|   812k|exit_function:
 1534|   812k|    return ret;
 1535|   812k|}
nTautEndpointEdgeCap:
 1540|  2.04k|{
 1541|       |    /* There are 3 sources of cap-flow = number of unsatisfied valences:
 1542|       |       -----------------------------------------------------------------
 1543|       |       1. pVA[i].cInitFreeValences
 1544|       |       2. pCN[0].v.cap - pCN[0].v.flow
 1545|       |       3. st[i].chem_bonds_valence - SUM(SINGLE, DOUBLE, TRIPLE bond orders)
 1546|       |          Reasons: (a) This sum will not include 'ALTERN' bonds
 1547|       |                   (b) until now at[i].chem_bonds_valence was used as a
 1548|       |                       number of satisfied valences. In case of adjacent
 1549|       |                       stereobonds marked as BOND_TYPE_ALTERN the value of
 1550|       |                       at[i].chem_bonds_valence may be = at[i].valence+1.
 1551|       |       4. Since tautomerism is defined for a neutral atom, do not add
 1552|       |          initial flows from the atom to the ChargeStruct
 1553|       |          CORRECTION: tautomeric endpoints do not have ChargeStruct.
 1554|       |
 1555|       |     */
 1556|  2.04k|    int j, k, nEdgeCap, bonds_valence, stereo_bond_excess_valence;
 1557|  2.04k|    MY_CONST C_NODE *pCN = pVA[i].cnListIndex > 0 ? cnList[pVA[i].cnListIndex - 1].pCN : NULL;
  ------------------
  |  |  268|  2.04k|#define MY_CONST  const
  ------------------
  |  Branch (1557:28): [True: 1.02k, False: 1.01k]
  ------------------
 1558|       |
 1559|       |
 1560|       |    /* 1: free valences to reach the minimum known atom valence */
 1561|  2.04k|    nEdgeCap = pVA[i].cInitFreeValences;
 1562|       |
 1563|       |    /* 2: atom free valence in the ChargeStruct */
 1564|  2.04k|    if (pCN)
  ------------------
  |  Branch (1564:9): [True: 1.02k, False: 1.01k]
  ------------------
 1565|  1.02k|    {
 1566|  1.02k|        nEdgeCap += pCN[0].v.cap - pCN[0].v.flow; /* normally should not happen */
 1567|  1.02k|    }
 1568|       |
 1569|       |    /* 3: atom free valence due to known from stereochemistry stereogenic bond types */
 1570|       |    /*
 1571|       |    for ( j = 0, bonds_valence = 0; j < at[i].valence; j ++ )
 1572|       |    {
 1573|       |        if ( at[i].bond_type[j] <= BOND_TYPE_TRIPLE )
 1574|       |        {
 1575|       |            bonds_valence += at[i].bond_type[j];
 1576|       |        }
 1577|       |    }
 1578|       |    */
 1579|       |
 1580|       |    /* bonds > SINGLE are assumed fixed stereobonds; fixed bond cannot increase t-group edge flow */
 1581|  2.07k|    for (stereo_bond_excess_valence = 0, j = 0; j < MAX_NUM_STEREO_BONDS && at[i].sb_parity[j]; j++)
  ------------------
  |  |  873|  4.14k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1581:49): [True: 2.07k, False: 0]
  |  Branch (1581:77): [True: 27, False: 2.04k]
  ------------------
 1582|     27|    {
 1583|     27|        k = at[i].sb_ord[j];
 1584|     27|        if (at[i].bond_type[k] < BOND_TYPE_TRIPLE)
  ------------------
  |  |   34|     27|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1584:13): [True: 16, False: 11]
  ------------------
 1585|     16|        {
 1586|     16|            stereo_bond_excess_valence += at[i].bond_type[k] - BOND_TYPE_SINGLE;
  ------------------
  |  |   32|     16|#define BOND_TYPE_SINGLE    1
  ------------------
 1587|     16|        }
 1588|     27|    }
 1589|       |
 1590|       |    /*
 1591|       |    bonds_valence = (at[i].chem_bonds_valence - bonds_valence) + (bonds_valence -at[i].valence - stereo_bond_excess_valence);
 1592|       |    */
 1593|  2.04k|    bonds_valence = ( at[i].chem_bonds_valence - at[i].valence ) - stereo_bond_excess_valence;
 1594|       |
 1595|       |
 1596|       |    /*---- add 1, 2, 3 ----*/
 1597|  2.04k|    if (bonds_valence >= 0)
  ------------------
  |  Branch (1597:9): [True: 2.04k, False: 0]
  ------------------
 1598|  2.04k|    {
 1599|  2.04k|        nEdgeCap += bonds_valence;
 1600|  2.04k|    }
 1601|      0|    else
 1602|      0|    {
 1603|      0|        nEdgeCap = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1604|      0|    }
 1605|       |
 1606|  2.04k|    return nEdgeCap;
 1607|  2.04k|}
BondFlowMaxcapMinorder:
 1663|  6.72M|{
 1664|       |
 1665|  6.72M|    int nFlow, nMaxcap, nMinorder, nInitorder, bNeedsFlower = 0;
 1666|  6.72M|    inp_ATOM *at = atom + iat;
 1667|  6.72M|    int       neigh = at->neighbor[ineigh];
 1668|  6.72M|    int       bond_type = at->bond_type[ineigh] & BOND_TYPE_MASK;
  ------------------
  |  |  189|  6.72M|#define BOND_TYPE_MASK        0x0f
  ------------------
 1669|  6.72M|    int       nMetal = ( 0 != pVA[iat].cMetal ) + ( 0 != pVA[neigh].cMetal );
 1670|  6.72M|    int       nEndpoint = ( 0 != at->endpoint ) + ( 0 != atom[neigh].endpoint );
 1671|  6.72M|    int       nStereo = ( at->p_parity || at->sb_parity[0] ) + ( atom[neigh].p_parity || atom[neigh].sb_parity[0] );
  ------------------
  |  Branch (1671:27): [True: 36.3k, False: 6.69M]
  |  Branch (1671:43): [True: 46.2k, False: 6.64M]
  |  Branch (1671:66): [True: 35.2k, False: 6.69M]
  |  Branch (1671:90): [True: 45.5k, False: 6.64M]
  ------------------
 1672|       |
 1673|  6.72M|    if (bond_type > BOND_TYPE_TRIPLE)
  ------------------
  |  |   34|  6.72M|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1673:9): [True: 1.08k, False: 6.72M]
  ------------------
 1674|  1.08k|    {
 1675|  1.08k|        bond_type = BOND_TYPE_SINGLE;
  ------------------
  |  |   32|  1.08k|#define BOND_TYPE_SINGLE    1
  ------------------
 1676|  1.08k|    }
 1677|       |
 1678|       |    /* M=metal, A=non-metal atom, e=endpoint */
 1679|  6.72M|    if ((nStereo && pSrm->bFixStereoBonds) || !nMetal || !pSrm->bMetalAddFlower) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1679:10): [True: 127k, False: 6.60M]
  |  Branch (1679:21): [True: 0, False: 127k]
  |  Branch (1679:47): [True: 5.00M, False: 1.71M]
  |  Branch (1679:58): [True: 0, False: 1.71M]
  ------------------
 1680|  5.00M|    {
 1681|       |        /* atom-atom rules, no metal atoms involved (1: A-A, A-Ae, Ae-Ae) */
 1682|  5.00M|        nMinorder = BOND_TYPE_SINGLE;
  ------------------
  |  |   32|  5.00M|#define BOND_TYPE_SINGLE    1
  ------------------
 1683|  5.00M|        nInitorder = bond_type;
 1684|  5.00M|        nFlow = nInitorder - nMinorder;
 1685|  5.00M|    }
 1686|  1.71M|    else if (nMetal && !nEndpoint)
  ------------------
  |  Branch (1686:14): [True: 1.71M, False: 0]
  |  Branch (1686:24): [True: 1.71M, False: 5.44k]
  ------------------
 1687|  1.71M|    {
 1688|       |        /* M-a, M-M */
 1689|       |        /* atom - metal or metal-metal, none of them is an endpoint (2: M-M, M-A) */
 1690|  1.71M|        nMinorder = pSrm->nMetalMinBondOrder;
 1691|  1.71M|        nInitorder = pSrm->nMetalInitBondOrder + bond_type - BOND_TYPE_SINGLE;
  ------------------
  |  |   32|  1.71M|#define BOND_TYPE_SINGLE    1
  ------------------
 1692|  1.71M|        nFlow = nInitorder - nMinorder;
 1693|  1.71M|        if (!pSrm->nMetalInitEdgeFlow &&
  ------------------
  |  Branch (1693:13): [True: 0, False: 1.71M]
  ------------------
 1694|      0|             pSrm->nMetalInitBondOrder > pSrm->nMetalMinBondOrder &&
  ------------------
  |  Branch (1694:14): [True: 0, False: 0]
  ------------------
 1695|      0|             nFlow > 0)
  ------------------
  |  Branch (1695:14): [True: 0, False: 0]
  ------------------
 1696|      0|        {
 1697|       |            /* reduce initial flow by 1 and increase st_cap on metal by 1 */
 1698|      0|            nFlow--;
 1699|      0|        }
 1700|  1.71M|        bNeedsFlower = ( 0 != pVA[iat].cMetal );
 1701|  1.71M|    }
 1702|  5.44k|    else
 1703|  5.44k|        if ((pVA[iat].cMetal && !at->endpoint && !pVA[neigh].cMetal && atom[neigh].endpoint) ||
  ------------------
  |  Branch (1703:14): [True: 2.93k, False: 2.50k]
  |  Branch (1703:33): [True: 2.88k, False: 50]
  |  Branch (1703:50): [True: 2.87k, False: 17]
  |  Branch (1703:72): [True: 2.87k, False: 0]
  ------------------
 1704|  2.57k|             (pVA[neigh].cMetal && !atom[neigh].endpoint && !pVA[iat].cMetal && at->endpoint)) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (1704:15): [True: 2.54k, False: 29]
  |  Branch (1704:36): [True: 2.52k, False: 17]
  |  Branch (1704:61): [True: 2.50k, False: 21]
  |  Branch (1704:81): [True: 2.50k, False: 0]
  ------------------
 1705|  5.37k|        {
 1706|       |            /* M-ae */
 1707|       |            /* metal connected to a non-metal endpoint (3: M-Ae) */
 1708|  5.37k|            nMinorder = pSrm->nMetal2EndpointMinBondOrder;
 1709|  5.37k|            nInitorder = pSrm->nMetal2EndpointInitBondOrder + bond_type - BOND_TYPE_SINGLE;
  ------------------
  |  |   32|  5.37k|#define BOND_TYPE_SINGLE    1
  ------------------
 1710|  5.37k|            nFlow = nInitorder - nMinorder;
 1711|  5.37k|            if (!pSrm->nMetal2EndpointInitEdgeFlow &&
  ------------------
  |  Branch (1711:17): [True: 5.37k, False: 0]
  ------------------
 1712|  5.37k|                 pSrm->nMetal2EndpointInitBondOrder > pSrm->nMetal2EndpointMinBondOrder &&
  ------------------
  |  Branch (1712:18): [True: 0, False: 5.37k]
  ------------------
 1713|      0|                 nFlow > 0)
  ------------------
  |  Branch (1713:18): [True: 0, False: 0]
  ------------------
 1714|      0|            {
 1715|       |                /* reduce initial flow by 1 and increase st_cap on metal by 1 */
 1716|      0|                nFlow--;
 1717|      0|            }
 1718|  5.37k|            bNeedsFlower = ( 0 != pVA[iat].cMetal );
 1719|  5.37k|        }
 1720|     67|        else
 1721|     67|        {
 1722|       |            /* endpoint is metal => no flower (4: M-Me, Me-Me, Me-A, Me-Ae) */
 1723|     67|            nMinorder = pSrm->nMetal2EndpointMinBondOrder;
 1724|     67|            nInitorder = pSrm->nMetal2EndpointInitBondOrder + bond_type - BOND_TYPE_SINGLE;
  ------------------
  |  |   32|     67|#define BOND_TYPE_SINGLE    1
  ------------------
 1725|     67|            nFlow = nInitorder - nMinorder;
 1726|     67|            if (!pSrm->nMetal2EndpointInitEdgeFlow &&
  ------------------
  |  Branch (1726:17): [True: 67, False: 0]
  ------------------
 1727|     67|                 pSrm->nMetal2EndpointInitBondOrder > pSrm->nMetal2EndpointMinBondOrder &&
  ------------------
  |  Branch (1727:18): [True: 0, False: 67]
  ------------------
 1728|      0|                 nFlow > 0)
  ------------------
  |  Branch (1728:18): [True: 0, False: 0]
  ------------------
 1729|      0|            {
 1730|       |/* reduce initial flow by 1 and increase st_cap on metal by 1 */
 1731|      0|                nFlow--;
 1732|      0|            }
 1733|     67|            bNeedsFlower = ( pVA[iat].cMetal && !at->endpoint );
  ------------------
  |  Branch (1733:30): [True: 67, False: 0]
  |  Branch (1733:49): [True: 17, False: 50]
  ------------------
 1734|     67|        }
 1735|       |
 1736|  6.72M|    nMaxcap = BOND_TYPE_TRIPLE - nMinorder;
  ------------------
  |  |   34|  6.72M|#define BOND_TYPE_TRIPLE    3
  ------------------
 1737|  6.72M|    if (pnMaxcap)
  ------------------
  |  Branch (1737:9): [True: 1.36M, False: 5.36M]
  ------------------
 1738|  1.36M|    {
 1739|  1.36M|        *pnMaxcap = nMaxcap;
 1740|  1.36M|    }
 1741|  6.72M|    if (pnMinorder)
  ------------------
  |  Branch (1741:9): [True: 6.72M, False: 0]
  ------------------
 1742|  6.72M|    {
 1743|  6.72M|        *pnMinorder = nMinorder;
 1744|  6.72M|    }
 1745|  6.72M|    if (pbNeedsFlower)
  ------------------
  |  Branch (1745:9): [True: 1.19M, False: 5.53M]
  ------------------
 1746|  1.19M|    {
 1747|  1.19M|        *pbNeedsFlower = bNeedsFlower;
 1748|  1.19M|    }
 1749|       |
 1750|  6.72M|    return nFlow;
 1751|  6.72M|}
AtomStcapStflow:
 1757|  1.22M|{
 1758|  1.22M|    int ineigh, bFlower;
 1759|  1.22M|    int nStflow = 0, nMaxBondCap, nMinBondOrder, bNeedsFlower = 0;
 1760|  1.22M|    int valence = atom[iat].valence;
 1761|  1.22M|    int nStcap = atom[iat].chem_bonds_valence;
 1762|  1.22M|    int nMGroupEdgeCap = 0, nMGroupEdgeFlow = 0, nFlow;
 1763|       |
 1764|  1.22M|    if (pSrm->bMetalAddFlower)
  ------------------
  |  Branch (1764:9): [True: 1.22M, False: 0]
  ------------------
 1765|  1.22M|    {
 1766|  1.22M|        nStcap -= pVA[iat].cInitOrigValenceToMetal - pVA[iat].cInitValenceToMetal;
 1767|  1.22M|    }
 1768|       |
 1769|  2.41M|    for (ineigh = 0; ineigh < valence; ineigh++)
  ------------------
  |  Branch (1769:22): [True: 1.19M, False: 1.22M]
  ------------------
 1770|  1.19M|    {
 1771|  1.19M|        nFlow = BondFlowMaxcapMinorder( atom, pVA, pSrm, iat, ineigh, &nMaxBondCap, &nMinBondOrder, &bFlower );
 1772|  1.19M|        nStflow += nFlow;
 1773|  1.19M|        nStcap -= nMinBondOrder;
 1774|  1.19M|        if (bFlower)
  ------------------
  |  Branch (1774:13): [True: 226k, False: 967k]
  ------------------
 1775|   226k|        {
 1776|   226k|            bNeedsFlower++;
 1777|   226k|            nMGroupEdgeFlow += nFlow;
 1778|   226k|            nMGroupEdgeCap += BOND_TYPE_TRIPLE - nMinBondOrder + pSrm->nMetalMaxCharge_D;
  ------------------
  |  |   34|   226k|#define BOND_TYPE_TRIPLE    3
  ------------------
 1779|   226k|        }
 1780|  1.19M|    }
 1781|       |
 1782|  1.22M|    if (pnStcap)
  ------------------
  |  Branch (1782:9): [True: 1.19M, False: 24.3k]
  ------------------
 1783|  1.19M|    {
 1784|  1.19M|        *pnStcap = bNeedsFlower ? nStflow : nStcap; /* initially, metal atoms are not radicals */
  ------------------
  |  Branch (1784:20): [True: 91.8k, False: 1.10M]
  ------------------
 1785|  1.19M|    }
 1786|  1.22M|    if (pnStflow)
  ------------------
  |  Branch (1786:9): [True: 1.19M, False: 24.3k]
  ------------------
 1787|  1.19M|    {
 1788|  1.19M|        *pnStflow = nStflow;
 1789|  1.19M|    }
 1790|  1.22M|    if (pnMGroupEdgeFlow)
  ------------------
  |  Branch (1790:9): [True: 48.7k, False: 1.17M]
  ------------------
 1791|  48.7k|    {
 1792|  48.7k|        *pnMGroupEdgeFlow = nMGroupEdgeCap - nMGroupEdgeFlow;
 1793|  48.7k|    }
 1794|  1.22M|    if (pnMGroupEdgeCap)
  ------------------
  |  Branch (1794:9): [True: 48.7k, False: 1.17M]
  ------------------
 1795|  48.7k|    {
 1796|  48.7k|        *pnMGroupEdgeCap = nMGroupEdgeCap;
 1797|  48.7k|    }
 1798|       |
 1799|  1.22M|    return bNeedsFlower; /* number of variable bonds to metal */
 1800|  1.22M|}
nCountBnsSizes:
 1837|  87.9k|{
 1838|  87.9k|    int i, j, n, k, ret = 0, nBonds, nOtherEdges, nVertices, bMetalAtoms, bNeedsFlower;
 1839|  87.9k|    int nTgroupEdges, nTgroupEdgesFromTg, nTotNegChargInTgroups, cap, flow;
 1840|  87.9k|    MY_CONST C_NODE *pCN = NULL;
  ------------------
  |  |  268|  87.9k|#define MY_CONST  const
  ------------------
 1841|  87.9k|    nVertices = nBonds = nOtherEdges = nTgroupEdges = nTgroupEdgesFromTg = nTotNegChargInTgroups = 0;
 1842|       |
 1843|       |    /* count metal atoms and electrons */
 1844|  1.18M|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (1844:17): [True: 1.09M, False: 87.9k]
  ------------------
 1845|  1.09M|    {
 1846|  1.09M|        pTCGroups->num_metal_atoms += ( pVA[i].cMetal != 0 );
 1847|  1.09M|        pTCGroups->num_metal_bonds += pVA[i].cNumBondsToMetal;
 1848|  1.09M|        pTCGroups->total_electrons += at[i].el_number;
 1849|  1.09M|        pTCGroups->total_electrons_metals += pVA[i].cMetal ? at[i].el_number : 0;
  ------------------
  |  Branch (1849:46): [True: 438k, False: 659k]
  ------------------
 1850|  1.09M|    }
 1851|  87.9k|    pTCGroups->total_electrons -= pTCGroups->total_charge;
 1852|  87.9k|    pTCGroups->num_metal_bonds /= 2;
 1853|       |
 1854|       |    /* register tautomeric groups */
 1855|  89.4k|    for (i = 0; i < ti->num_t_groups; i++)
  ------------------
  |  Branch (1855:17): [True: 1.45k, False: 87.9k]
  ------------------
 1856|  1.45k|    {
 1857|  1.45k|        ret = RegisterTCGroup( pTCGroups,
 1858|  1.45k|                               BNS_VERT_TYPE_TGROUP,
  ------------------
  |  |   47|  1.45k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 1859|  1.45k|                               ti->t_group[i].nGroupNumber,
 1860|  1.45k|                               ti->t_group[i].num[0] /* st_cap */,
 1861|  1.45k|                               0 /* st_flow */,
 1862|  1.45k|                               0 /* edge cap */,
 1863|  1.45k|                               0 /* edge flow */,
 1864|  1.45k|                               ti->t_group[i].nNumEndpoints /* num Edges */
 1865|  1.45k|        );
 1866|  1.45k|        if (ret < 0)
  ------------------
  |  Branch (1866:13): [True: 0, False: 1.45k]
  ------------------
 1867|      0|        {
 1868|      0|            goto exit_function;
 1869|      0|        }
 1870|       |
 1871|       |        /* edges to tautomeric groups */
 1872|  1.45k|        nOtherEdges += ti->t_group[i].nNumEndpoints;
 1873|  1.45k|        nTgroupEdgesFromTg += ti->t_group[i].nNumEndpoints;
 1874|       |        /* total negative charge in t-groups */
 1875|  1.45k|        nTotNegChargInTgroups += ti->t_group[i].num[1];
 1876|  1.45k|        if (ret > 0)
  ------------------
  |  Branch (1876:13): [True: 1.45k, False: 0]
  ------------------
 1877|  1.45k|        {
 1878|       |            /* should always happen since this is the first time this t-group is added */
 1879|  1.45k|            j = ret - 1;
 1880|  1.45k|            pTCGroups->pTCG[j].tg_num_H = ti->t_group[i].num[0] - ti->t_group[i].num[1];
 1881|  1.45k|            pTCGroups->pTCG[j].tg_num_Minus = ti->t_group[i].num[1];
 1882|  1.45k|        }
 1883|  1.45k|    }
 1884|       |
 1885|  87.9k|    bMetalAtoms = 0;
 1886|       |
 1887|   153k|repeat_for_metals:
 1888|       |
 1889|       |    /* count vertices and register ChargeValence groups */
 1890|       |    /* for now an atom may belong either to a t-group or to a ChargeValence group, but not to both */
 1891|  2.08M|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (1891:17): [True: 1.93M, False: 153k]
  ------------------
 1892|  1.93M|    {
 1893|       |        /* number of bonds */
 1894|  1.93M|        nBonds += at[i].valence;
 1895|       |        /* Process ChargeStruct vertices and edges */
 1896|  1.93M|        if (pVA[i].cnListIndex)
  ------------------
  |  Branch (1896:13): [True: 241k, False: 1.69M]
  ------------------
 1897|   241k|        {
 1898|       |            /* count vertices & edges in the ChargeValence Substructure attached to an atom */
 1899|       |            /* Important: unlike inp_ATOM, each edge e appears in pCN[*].e[*] only ONE time */
 1900|   241k|            int     len = cnList[j = pVA[i].cnListIndex - 1].len;
 1901|   241k|            int     bits = cnList[j].bits;
 1902|   241k|            int     type, neigh_type; /* djb-rwth: removing redundant variables */
 1903|   241k|            pCN = cnList[j].pCN;
 1904|       |
 1905|       |            /* first process all non-metals, after that -- all metals */
 1906|   241k|            if (( bits != cn_bits_Me ) != !bMetalAtoms)
  ------------------
  |  |  440|   241k|#define cn_bits_Me (-1)
  ------------------
  |  Branch (1906:17): [True: 81.8k, False: 159k]
  ------------------
 1907|  81.8k|            {
 1908|  81.8k|                continue;
 1909|  81.8k|            }
 1910|       |            /* djb-rwth: removing redundant code */
 1911|   777k|            for (j = 0; j < len; j++)
  ------------------
  |  Branch (1911:25): [True: 618k, False: 159k]
  ------------------
 1912|   618k|            {
 1913|   618k|                type = pCN[j].v.type; /* ChargeStruct vertex type: atom is the first, c-groups are last */
 1914|       |
 1915|       |                /* process all pCN[j] neighbors */
 1916|  1.09M|                for (k = 0; k < MAX_CN_VAL && ( n = pCN[j].e[k].neigh ); k++)
  ------------------
  |  |  397|  2.19M|#define MAX_CN_VAL 3
  ------------------
  |  Branch (1916:29): [True: 1.09M, False: 0]
  |  Branch (1916:47): [True: 478k, False: 618k]
  ------------------
 1917|   478k|                {
 1918|   478k|                    nOtherEdges++;  /* edges inside ChargeStruct */
 1919|   478k|                    n--; /* neighbor vertex position inside cnList[j].pCN */
 1920|   478k|                    neigh_type = pCN[n].v.type; /* type of the neighboring atom */
 1921|       |
 1922|   478k|                    if (IS_BNS_VT_C_GR( neigh_type ))
  ------------------
  |  |   78|   478k|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   71|   478k|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|   478k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|   478k|#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)
  |  |  ------------------
  |  |  |  |   49|   478k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (78:37): [True: 258k, False: 220k]
  |  |  ------------------
  ------------------
 1923|   258k|                    {
 1924|       |                        /* register this edge to a CN-group vertex */
 1925|   258k|                        cap = !bMetalAtoms ? pCN[j].e[k].cap : pCN[j].e[k].cap ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (1925:31): [True: 209k, False: 48.7k]
  |  Branch (1925:64): [True: 48.7k, False: 0]
  ------------------
 1926|   258k|                        flow = !bMetalAtoms ? pCN[j].e[k].flow : pCN[j].e[k].flow ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (1926:32): [True: 209k, False: 48.7k]
  |  Branch (1926:66): [True: 24.3k, False: 24.3k]
  ------------------
 1927|       |
 1928|   258k|                        ret = RegisterTCGroup( pTCGroups,
 1929|   258k|                                               neigh_type,
 1930|   258k|                                               0 /* ord_num*/,
 1931|   258k|                                               0 /* st_cap */,
 1932|   258k|                                               0 /* st_flow */,
 1933|   258k|                                               cap /* edge cap*/,
 1934|   258k|                                               flow /* edge flow */,
 1935|   258k|                                               1 /* nNumEdges*/ );
 1936|   258k|                        if (ret < 0)
  ------------------
  |  Branch (1936:29): [True: 0, False: 258k]
  ------------------
 1937|      0|                        {
 1938|      0|                            goto exit_function;
 1939|      0|                        }
 1940|   258k|                        if (ret > 0)
  ------------------
  |  Branch (1940:29): [True: 131k, False: 127k]
  ------------------
 1941|   131k|                        {
 1942|       |                            /* the group has just been created; add one more edge to (+/-) or supergroup */
 1943|   131k|                            ret = RegisterTCGroup( pTCGroups,
 1944|   131k|                                                   neigh_type,
 1945|   131k|                                                   0 /* ord_num*/,
 1946|   131k|                                                   0 /* st_cap */,
 1947|   131k|                                                   0 /* st_flow */,
 1948|   131k|                                                   0 /* edge cap*/,
 1949|   131k|                                                   0/* edge flow*/,
 1950|   131k|                                                   1 /* nNumEdges*/ );
 1951|   131k|                            if (ret < 0)
  ------------------
  |  Branch (1951:33): [True: 0, False: 131k]
  ------------------
 1952|      0|                            {
 1953|      0|                                goto exit_function;
 1954|      0|                            }
 1955|   131k|                            nOtherEdges++;
 1956|   131k|                        }
 1957|   258k|                    }
 1958|       |
 1959|   478k|                    if (IS_BNS_VT_C_GR( type ))
  ------------------
  |  |   78|   478k|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   71|   478k|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|   478k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|   478k|#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)
  |  |  ------------------
  |  |  |  |   49|   478k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (78:37): [True: 0, False: 478k]
  |  |  ------------------
  ------------------
 1960|      0|                    {
 1961|       |                        /* register this edge to a CN-group vertex; normally this does not happen */
 1962|       |
 1963|      0|                        cap = !bMetalAtoms ? pCN[j].e[k].cap : pCN[j].e[k].cap ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (1963:31): [True: 0, False: 0]
  |  Branch (1963:64): [True: 0, False: 0]
  ------------------
 1964|      0|                        flow = !bMetalAtoms ? pCN[j].e[k].flow : pCN[j].e[k].flow ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (1964:32): [True: 0, False: 0]
  |  Branch (1964:66): [True: 0, False: 0]
  ------------------
 1965|       |
 1966|      0|                        ret = RegisterTCGroup( pTCGroups, type, 0 /* ord_num*/,
 1967|      0|                                               0 /* st_cap */, 0 /* st_flow */,
 1968|      0|                                               cap /* edge cap*/, flow /* edge flow */, 1 /* nNumEdges*/ );
 1969|      0|                        if (ret < 0)
  ------------------
  |  Branch (1969:29): [True: 0, False: 0]
  ------------------
 1970|      0|                        {
 1971|      0|                            goto exit_function;
 1972|      0|                        }
 1973|      0|                        if (ret > 0)
  ------------------
  |  Branch (1973:29): [True: 0, False: 0]
  ------------------
 1974|      0|                        {
 1975|       |                            /* the group has just been created; add one more edge to (+/-) or supergroup */
 1976|      0|                            ret = RegisterTCGroup( pTCGroups, type, 0 /* ord_num*/,
 1977|      0|                                                   0 /* st_cap */, 0 /* st_flow */,
 1978|      0|                                                   0 /* edge cap*/, 0/* edge flow*/, 1 /* nNumEdges*/ );
 1979|      0|                            if (ret < 0)
  ------------------
  |  Branch (1979:33): [True: 0, False: 0]
  ------------------
 1980|      0|                            {
 1981|      0|                                goto exit_function;
 1982|      0|                            }
 1983|      0|                            nOtherEdges++;
 1984|      0|                        }
 1985|      0|                    }
 1986|   478k|                } /* end of the current vertex pCN[j] neighbors */
 1987|       |
 1988|       |                /* process  pCN[j] vertex */
 1989|       |
 1990|   618k|                if (type & BNS_VERT_TYPE_ATOM)
  ------------------
  |  |   45|   618k|#define BNS_VERT_TYPE_ATOM          0x0001
  ------------------
  |  Branch (1990:21): [True: 159k, False: 458k]
  ------------------
 1991|   159k|                {
 1992|   159k|                    continue;  /* do not count regular atoms here */
 1993|   159k|                }
 1994|   458k|                if (IS_BNS_VT_CHRG_STRUCT( type ))
  ------------------
  |  |   82|   458k|#define IS_BNS_VT_CHRG_STRUCT(X)    (((X) & BNS_VERT_TYPE__AUX) &&  ((X) & BNS_VERT_TYPE_TEMP))
  |  |  ------------------
  |  |  |  |   53|   458k|#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))
  |  |  ------------------
  |  |  |  |   51|   175k|#define BNS_VERT_TYPE_TEMP          0x0040
  |  |  ------------------
  |  |  |  Branch (82:38): [True: 175k, False: 283k]
  |  |  |  Branch (82:69): [True: 175k, False: 0]
  |  |  ------------------
  ------------------
 1995|   175k|                {
 1996|   175k|                    nVertices++;
 1997|   175k|                    continue;
 1998|   175k|                }
 1999|       |
 2000|   283k|                if (pSrm->bMetalAddFlower && IS_BNS_VT_M_GR( type ))
  ------------------
  |  |   80|   283k|#define IS_BNS_VT_M_GR(X)           ((X) == BNS_VERT_TYPE_METAL_GR )  /* metal flower base or vertices */
  |  |  ------------------
  |  |  |  |   57|   283k|#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 (80:37): [True: 24.3k, False: 258k]
  |  |  ------------------
  ------------------
  |  Branch (2000:21): [True: 283k, False: 0]
  ------------------
 2001|  24.3k|                {
 2002|       |                    /* special treatment: flow and cap are known as well as structure */
 2003|       |                    /* initial bond valence to metal is either 0 or 1 */
 2004|  24.3k|                    EdgeFlow nEdgeFlow, nEdgeCap;
 2005|       |
 2006|  24.3k|                    bNeedsFlower = AtomStcapStflow( at, pVA, pSrm, i, NULL /*pnStcap*/, NULL /*pnStflow*/,
 2007|  24.3k|                                                    &nEdgeCap, &nEdgeFlow );
 2008|  24.3k|                    if (!bNeedsFlower)
  ------------------
  |  Branch (2008:25): [True: 39, False: 24.3k]
  ------------------
 2009|     39|                    {
 2010|     39|                        ret = RI_ERR_PROGR;
  ------------------
  |  |   17|     39|#define RI_ERR_PROGR   (-3)
  ------------------
 2011|     39|                        goto exit_function;
 2012|     39|                    }
 2013|       |                    /*
 2014|       |                    GetAtomToMCGroupInitEdgeCapFlow( &nEdgeCap, &nEdgeFlow, pSrm, at,  pVA, i );
 2015|       |                    GetAtomToMCGroupInitEdgeCapFlow( &nEdgeCap, &nEdgeFlow, pSrm );
 2016|       |                    */
 2017|       |                    /* the 1st is the flower base */
 2018|       |                    /* atom - G0 edge and G0 vertex */
 2019|  24.3k|                    ret = RegisterTCGroup( pTCGroups,
 2020|  24.3k|                                           type,
 2021|  24.3k|                                           0 /* ord_num*/,
 2022|       |                                           /*pVA[i].cInitFreeValences*/
 2023|  24.3k|                                           0 /* st_cap */,
 2024|  24.3k|                                           0 /* st_flow */,
 2025|  24.3k|                                           (int) nEdgeCap,
 2026|  24.3k|                                           (int) nEdgeFlow,
 2027|  24.3k|                                           1 /* nNumEdges*/ );
 2028|  24.3k|                    if (ret < 0)
  ------------------
  |  Branch (2028:25): [True: 0, False: 24.3k]
  ------------------
 2029|      0|                    {
 2030|      0|                        goto exit_function;
 2031|      0|                    }
 2032|       |                    /* count edge atom-G0 */
 2033|  24.3k|                    nOtherEdges++;
 2034|  24.3k|                    if (ret > 0)
  ------------------
  |  Branch (2034:25): [True: 17.1k, False: 7.22k]
  ------------------
 2035|  17.1k|                    {
 2036|       |                        /* first time registration: add G0-G1 and G0-G2 edges to G0 */
 2037|       |
 2038|  17.1k|                        ret = RegisterTCGroup( pTCGroups,
 2039|  17.1k|                                               type,
 2040|  17.1k|                                               0 /* ord_num*/,
 2041|  17.1k|                                               0 /* st_cap */,
 2042|  17.1k|                                               0 /* st_flow */,
 2043|  17.1k|                                               0,/* edge cap*/
 2044|  17.1k|                                               0 /*edge flow*/,
 2045|  17.1k|                                               2 /* nNumEdges*/ );
 2046|       |
 2047|  17.1k|                        if (ret < 0)
  ------------------
  |  Branch (2047:29): [True: 0, False: 17.1k]
  ------------------
 2048|      0|                        {
 2049|      0|                            goto exit_function;
 2050|      0|                        }
 2051|       |
 2052|       |                        /* first time registration: add G1; it has 3 edges */
 2053|       |
 2054|  17.1k|                        ret = RegisterTCGroup( pTCGroups,
 2055|  17.1k|                                               type,
 2056|  17.1k|                                               1 /* ord_num*/,
 2057|  17.1k|                                               0 /* st_cap */,
 2058|  17.1k|                                               0 /* st_flow */,
 2059|  17.1k|                                               0,/* edge cap*/
 2060|  17.1k|                                               0 /*edge flow*/,
 2061|  17.1k|                                               3 /* nNumEdges*/ );
 2062|       |
 2063|  17.1k|                        if (ret <= 0)
  ------------------
  |  Branch (2063:29): [True: 0, False: 17.1k]
  ------------------
 2064|      0|                        {
 2065|      0|                            ret = !ret ? RI_ERR_PROGR : ret;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  |  Branch (2065:35): [True: 0, False: 0]
  ------------------
 2066|      0|                            goto exit_function;
 2067|      0|                        }
 2068|       |
 2069|       |                        /* first time registration: add G2; it has 3 edges */
 2070|       |
 2071|  17.1k|                        ret = RegisterTCGroup( pTCGroups,
 2072|  17.1k|                                               type,
 2073|  17.1k|                                               2 /* ord_num*/,
 2074|  17.1k|                                               0 /* st_cap */,
 2075|  17.1k|                                               0 /* st_flow */,
 2076|  17.1k|                                               0,/* edge cap*/
 2077|  17.1k|                                               0 /*edge flow*/,
 2078|  17.1k|                                               3 /* nNumEdges*/ );
 2079|       |
 2080|  17.1k|                        if (ret <= 0)
  ------------------
  |  Branch (2080:29): [True: 0, False: 17.1k]
  ------------------
 2081|      0|                        {
 2082|      0|                            ret = !ret ? RI_ERR_PROGR : ret;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  |  Branch (2082:35): [True: 0, False: 0]
  ------------------
 2083|      0|                            goto exit_function;
 2084|      0|                        }
 2085|       |
 2086|       |                        /* first time registration: add G3; it has 2 edges */
 2087|       |
 2088|  17.1k|                        ret = RegisterTCGroup( pTCGroups,
 2089|  17.1k|                                               type,
 2090|  17.1k|                                               3 /* ord_num*/,
 2091|  17.1k|                                               0 /* st_cap */,
 2092|  17.1k|                                               0 /* st_flow */,
 2093|  17.1k|                                               0,/* edge cap*/
 2094|  17.1k|                                               0 /*edge flow*/,
 2095|  17.1k|                                               2 /* nNumEdges*/ );
 2096|       |
 2097|  17.1k|                        if (ret <= 0)
  ------------------
  |  Branch (2097:29): [True: 0, False: 17.1k]
  ------------------
 2098|      0|                        {
 2099|      0|                            ret = !ret ? RI_ERR_PROGR : ret;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  |  Branch (2099:35): [True: 0, False: 0]
  ------------------
 2100|      0|                            goto exit_function;
 2101|      0|                        }
 2102|       |                        /* count added metal flower vertices: G0, G1, G2, G3 */
 2103|  17.1k|                        nVertices += 4;
 2104|       |                        /* count added metal flower edges: C0-C1, C0-C2, C1-C2, C1-C3, C2-C3 */
 2105|  17.1k|                        nOtherEdges += 5;
 2106|       |                        /* add connections of G0 to G1 and G2 */
 2107|  17.1k|                    }
 2108|  24.3k|                    continue;
 2109|  24.3k|                }
 2110|       |
 2111|   258k|                nVertices++; /* count BNS_VT_C_POS* types; all contain BNS_VERT_TYPE_C_GROUP bit */
 2112|   258k|                if (!IS_BNS_VT_C_GR( type ))
  ------------------
  |  |   78|   258k|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   71|   258k|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|   258k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|   258k|#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)
  |  |  ------------------
  |  |  |  |   49|   258k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  ------------------
  |  Branch (2112:21): [True: 0, False: 258k]
  ------------------
 2113|      0|                {  /* check */
 2114|      0|                    ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2115|      0|                    goto exit_function;
 2116|      0|                }
 2117|       |                /* add st_cap and st_flow for a charge group */
 2118|   258k|                cap = !bMetalAtoms ? pCN[j].v.cap : pCN[j].v.cap ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (2118:23): [True: 209k, False: 48.7k]
  |  Branch (2118:53): [True: 48.7k, False: 0]
  ------------------
 2119|   258k|                flow = !bMetalAtoms ? pCN[j].v.flow : pCN[j].v.flow ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (2119:24): [True: 209k, False: 48.7k]
  |  Branch (2119:55): [True: 24.3k, False: 24.3k]
  ------------------
 2120|       |
 2121|   258k|                ret = RegisterTCGroup( pTCGroups, type, 0 /* ord_num*/,
 2122|   258k|                                       cap /* st-cap*/, flow /* st-flow */,
 2123|   258k|                                       0 /* edge cap */, 0 /* edge flow */, 0 /* edges already counted */ );
 2124|   258k|                if (ret < 0)
  ------------------
  |  Branch (2124:21): [True: 0, False: 258k]
  ------------------
 2125|      0|                {
 2126|      0|                    goto exit_function;
 2127|      0|                }
 2128|   258k|            }
 2129|   159k|        }
 2130|  1.69M|        else
 2131|  1.69M|        {
 2132|  1.69M|            pCN = NULL;
 2133|  1.69M|        }
 2134|       |
 2135|       |        /* count edge caps to t-groups */
 2136|  1.85M|        if (at[i].endpoint)
  ------------------
  |  Branch (2136:13): [True: 2.04k, False: 1.84M]
  ------------------
 2137|  2.04k|        {
 2138|  2.04k|            int nEdgeCap = nTautEndpointEdgeCap( at, pVA, i );
 2139|  2.04k|            nTgroupEdges++;
 2140|  2.04k|            if (nEdgeCap < 0)
  ------------------
  |  Branch (2140:17): [True: 0, False: 2.04k]
  ------------------
 2141|      0|            {
 2142|      0|                ret = nEdgeCap;
 2143|      0|                goto exit_function;
 2144|      0|            }
 2145|       |
 2146|       |            /* add number of unsatisfied valences for a t-group; the unknown flow = 0 */
 2147|  2.04k|            ret = RegisterTCGroup( pTCGroups,
 2148|  2.04k|                                   BNS_VERT_TYPE_TGROUP,
  ------------------
  |  |   47|  2.04k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 2149|  2.04k|                                   at[i].endpoint,
 2150|  2.04k|                                   0 /* st_cap */,
 2151|  2.04k|                                   0 /* st_flow */,
 2152|  2.04k|                                   nEdgeCap /* edge cap */,
 2153|  2.04k|                                   0 /* edge flow */,
 2154|  2.04k|                                   0 /* t-group edges have already been counted */ );
 2155|  2.04k|            if (ret < 0)
  ------------------
  |  Branch (2155:17): [True: 0, False: 2.04k]
  ------------------
 2156|      0|            {
 2157|      0|                goto exit_function;
 2158|      0|            }
 2159|  2.04k|        }
 2160|  1.85M|    }
 2161|       |
 2162|   153k|    if (!bMetalAtoms && pTCGroups->num_metal_atoms)
  ------------------
  |  Branch (2162:9): [True: 87.9k, False: 65.4k]
  |  Branch (2162:25): [True: 65.5k, False: 22.4k]
  ------------------
 2163|  65.5k|    {
 2164|  65.5k|        bMetalAtoms = 1;
 2165|  65.5k|        nBonds = 0; /* added 2006-05-15 */
 2166|  65.5k|        goto repeat_for_metals;
 2167|  65.5k|    }
 2168|       |
 2169|       |    /* count real atoms and bonds */
 2170|  87.9k|    nBonds /= 2;
 2171|  87.9k|    pTCGroups->num_atoms = num_at;
 2172|  87.9k|    pTCGroups->num_bonds = nBonds;
 2173|       |
 2174|  87.9k|    pTCGroups->num_tgroups = ti->num_t_groups;
 2175|  87.9k|    pTCGroups->num_tgroup_edges = nTgroupEdges;
 2176|  87.9k|    pTCGroups->tgroup_charge = -nTotNegChargInTgroups;
 2177|       |
 2178|  87.9k|    if (0 <= ret && nTgroupEdgesFromTg != nTgroupEdges)
  ------------------
  |  Branch (2178:9): [True: 87.9k, False: 0]
  |  Branch (2178:21): [True: 89, False: 87.8k]
  ------------------
 2179|     89|    {
 2180|     89|        ret = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|     89|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|     89|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2181|     89|    }
 2182|       |
 2183|  87.9k|    nVertices += num_at;
 2184|       |
 2185|       |
 2186|       |    /* count other vertices */
 2187|  87.9k|    nVertices += ti->num_t_groups;
 2188|  87.9k|    nBonds += nOtherEdges;
 2189|       |
 2190|       |    /* return edges and vertices */
 2191|  87.9k|    pTCGroups->nVertices = nVertices;
 2192|  87.9k|    pTCGroups->nEdges = nBonds;
 2193|       |
 2194|       |
 2195|  87.9k|exit_function:
 2196|  87.9k|    return ret;
 2197|  87.9k|}
nAddSuperCGroups:
 2245|  87.8k|{
 2246|  87.8k|    int i, k, n, n1, n2, n3, ret = 0, nNumToConnect; /* djb-rwth: removing redundant variables */
 2247|       |
 2248|   287k|    for (i = 0; i < pTCGroups->num_tc_groups; i++)
  ------------------
  |  Branch (2248:17): [True: 200k, False: 87.8k]
  ------------------
 2249|   200k|    {
 2250|   200k|        if (pTCGroups->pTCG[i].type & BNS_VERT_TYPE_TGROUP)
  ------------------
  |  |   47|   200k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
  |  Branch (2250:13): [True: 594, False: 199k]
  ------------------
 2251|    594|        {
 2252|       |            /* djb-rwth: removing redundant code */
 2253|    594|            continue; /* t-group */
 2254|    594|        }
 2255|   199k|        if (IS_BNS_VT_C_GR( pTCGroups->pTCG[i].type ) ||
  ------------------
  |  |   78|   398k|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   71|   199k|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|   199k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|   199k|#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)
  |  |  ------------------
  |  |  |  |   49|   199k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (78:37): [True: 131k, False: 68.4k]
  |  |  ------------------
  ------------------
 2256|  68.4k|             IS_BNS_VT_M_GR( pTCGroups->pTCG[i].type ))
  ------------------
  |  |   80|  68.4k|#define IS_BNS_VT_M_GR(X)           ((X) == BNS_VERT_TYPE_METAL_GR )  /* metal flower base or vertices */
  |  |  ------------------
  |  |  |  |   57|  68.4k|#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 (80:37): [True: 68.4k, False: 0]
  |  |  ------------------
  ------------------
 2257|   199k|        {
 2258|       |            /* ChargeValence (cn) group */
 2259|   199k|            switch (pTCGroups->pTCG[i].type)
 2260|   199k|            {
 2261|  30.5k|                case BNS_VT_C_POS:
  ------------------
  |  |   63|  30.5k|#define BNS_VT_C_POS     BNS_VERT_TYPE_C_GROUP                               /* positive charge group, heteroat */
  |  |  ------------------
  |  |  |  |   49|  30.5k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  ------------------
  |  Branch (2261:17): [True: 30.5k, False: 168k]
  ------------------
 2262|  30.5k|                    k = TCG_Plus0;
 2263|  30.5k|                    break;
 2264|  27.7k|                case BNS_VT_C_NEG:
  ------------------
  |  |   64|  27.7k|#define BNS_VT_C_NEG     (BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE)  /* negative charge group, heteroat */
  |  |  ------------------
  |  |  |  |   49|  27.7k|#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 */
  |  |  ------------------
  |  |  |  |   54|  27.7k|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  |  |  ------------------
  ------------------
  |  Branch (2264:17): [True: 27.7k, False: 171k]
  ------------------
 2265|  27.7k|                    k = TCG_Minus0;
 2266|  27.7k|                    break;
 2267|  19.2k|                case BNS_VT_C_POS_C:
  ------------------
  |  |   65|  19.2k|#define BNS_VT_C_POS_C   (BNS_VT_C_POS | BNS_VERT_TYPE_CARBON_GR)            /* positive charge group, C, Si, Ge, Sn */
  |  |  ------------------
  |  |  |  |   63|  19.2k|#define BNS_VT_C_POS     BNS_VERT_TYPE_C_GROUP                               /* positive charge group, heteroat */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|  19.2k|#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 */
  |  |  ------------------
  |  |  |  |   56|  19.2k|#define BNS_VERT_TYPE_CARBON_GR     0x0400  /* charge of carbon atom; should be used with BNS_VT_C_POS, BNS_VT_C_NEG */
  |  |  ------------------
  ------------------
  |  Branch (2267:17): [True: 19.2k, False: 180k]
  ------------------
 2268|  19.2k|                    k = TCG_Plus_C0;
 2269|  19.2k|                    break;
 2270|  19.2k|                case BNS_VT_C_NEG_C:
  ------------------
  |  |   66|  19.2k|#define BNS_VT_C_NEG_C   (BNS_VT_C_NEG | BNS_VERT_TYPE_CARBON_GR)            /* negative charge group, C, Si, Ge, Sn */
  |  |  ------------------
  |  |  |  |   64|  19.2k|#define BNS_VT_C_NEG     (BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE)  /* negative charge group, heteroat */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|  19.2k|#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 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   54|  19.2k|#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 */
  |  |  ------------------
  |  |  |  |   56|  19.2k|#define BNS_VERT_TYPE_CARBON_GR     0x0400  /* charge of carbon atom; should be used with BNS_VT_C_POS, BNS_VT_C_NEG */
  |  |  ------------------
  ------------------
  |  Branch (2270:17): [True: 19.2k, False: 180k]
  ------------------
 2271|  19.2k|                    k = TCG_Minus_C0;
 2272|  19.2k|                    break;
 2273|  17.1k|                case BNS_VT_C_POS_M:
  ------------------
  |  |   67|  17.1k|#define BNS_VT_C_POS_M   (BNS_VT_C_POS | BNS_VERT_TYPE_METAL_GR)             /* positive charge group, metal */
  |  |  ------------------
  |  |  |  |   63|  17.1k|#define BNS_VT_C_POS     BNS_VERT_TYPE_C_GROUP                               /* positive charge group, heteroat */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|  17.1k|#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 */
  |  |  ------------------
  |  |  |  |   57|  17.1k|#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 (2273:17): [True: 17.1k, False: 182k]
  ------------------
 2274|  17.1k|                    k = TCG_Plus_M0;
 2275|  17.1k|                    break;
 2276|  17.1k|                case BNS_VT_C_NEG_M:
  ------------------
  |  |   68|  17.1k|#define BNS_VT_C_NEG_M   (BNS_VT_C_NEG | BNS_VERT_TYPE_METAL_GR)             /* negative charge group, metal */
  |  |  ------------------
  |  |  |  |   64|  17.1k|#define BNS_VT_C_NEG     (BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE)  /* negative charge group, heteroat */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|  17.1k|#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 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   54|  17.1k|#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 */
  |  |  ------------------
  |  |  |  |   57|  17.1k|#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 (2276:17): [True: 17.1k, False: 182k]
  ------------------
 2277|  17.1k|                    k = TCG_Minus_M0;
 2278|  17.1k|                    break;
 2279|  68.4k|                case BNS_VT_M_GROUP:
  ------------------
  |  |   69|  68.4k|#define BNS_VT_M_GROUP   BNS_VERT_TYPE_METAL_GR                              /* metal-group, flower vertex */
  |  |  ------------------
  |  |  |  |   57|  68.4k|#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 (2279:17): [True: 68.4k, False: 131k]
  ------------------
 2280|  68.4k|                    switch (pTCGroups->pTCG[i].ord_num)
 2281|  68.4k|                    {
 2282|  17.1k|                        case 0:
  ------------------
  |  Branch (2282:25): [True: 17.1k, False: 51.3k]
  ------------------
 2283|  17.1k|                            k = TCG_MeFlower0;
 2284|  17.1k|                            break;
 2285|  17.1k|                        case 1:
  ------------------
  |  Branch (2285:25): [True: 17.1k, False: 51.3k]
  ------------------
 2286|  17.1k|                            k = TCG_MeFlower1;
 2287|  17.1k|                            break;
 2288|  17.1k|                        case 2:
  ------------------
  |  Branch (2288:25): [True: 17.1k, False: 51.3k]
  ------------------
 2289|  17.1k|                            k = TCG_MeFlower2;
 2290|  17.1k|                            break;
 2291|  17.1k|                        case 3:
  ------------------
  |  Branch (2291:25): [True: 17.1k, False: 51.3k]
  ------------------
 2292|  17.1k|                            k = TCG_MeFlower3;
 2293|  17.1k|                            break;
 2294|      0|                        default:
  ------------------
  |  Branch (2294:25): [True: 0, False: 68.4k]
  ------------------
 2295|      0|                            ret = RI_ERR_PROGR; /* unexpected group type */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2296|      0|                            goto exit_function;
 2297|  68.4k|                    }
 2298|  68.4k|                    break;
 2299|       |
 2300|  68.4k|                default:
  ------------------
  |  Branch (2300:17): [True: 0, False: 199k]
  ------------------
 2301|      0|                    ret = RI_ERR_PROGR; /* unexpected group type */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2302|      0|                    goto exit_function;
 2303|   199k|            }
 2304|       |
 2305|   199k|            if (pTCGroups->nGroup[k] >= 0 || (pTCGroups->pTCG[i].ord_num && !IS_BNS_VT_M_GR( pTCGroups->pTCG[i].type ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   80|  51.3k|#define IS_BNS_VT_M_GR(X)           ((X) == BNS_VERT_TYPE_METAL_GR )  /* metal flower base or vertices */
  |  |  ------------------
  |  |  |  |   57|  51.3k|#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: 199k]
  |  Branch (2305:47): [True: 51.3k, False: 148k]
  |  Branch (2305:77): [True: 0, False: 51.3k]
  ------------------
 2306|      0|            {
 2307|      0|                ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2308|      0|                goto exit_function;
 2309|      0|            }
 2310|   199k|            pTCGroups->nGroup[k] = i; /* ordering number of the Charge group, starting from 0 */
 2311|   199k|        }
 2312|   199k|    }
 2313|       |
 2314|       |    /* add (+) supergroup */
 2315|  87.8k|    n1 = pTCGroups->nGroup[TCG_Plus0];
 2316|  87.8k|    n2 = pTCGroups->nGroup[TCG_Plus_C0];
 2317|  87.8k|    n3 = pTCGroups->nGroup[TCG_Plus_M0];
 2318|  87.8k|    nNumToConnect = ( n1 >= 0 ) + ( n2 >= 0 ) + ( n3 >= 0 );
 2319|       |
 2320|  87.8k|    if (nNumToConnect)
  ------------------
  |  Branch (2320:9): [True: 33.9k, False: 53.8k]
  ------------------
 2321|  33.9k|    {
 2322|       |        /* if both groups are present then add a supergroup */
 2323|  33.9k|        ret = RegisterTCGroup( pTCGroups,
 2324|  33.9k|                               BNS_VT_C_POS_ALL,
  ------------------
  |  |   71|  33.9k|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  ------------------
  |  |  |  |   50|  33.9k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  ------------------
  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  ------------------
  |  |  |  |   49|  33.9k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  ------------------
 2325|  33.9k|                               0,
 2326|  33.9k|                               0 /* st_cap */,
 2327|  33.9k|                               0 /* st_flow */,
 2328|  33.9k|                               0 /* edge cap */,
 2329|  33.9k|                               0 /* edge flow */,
 2330|  33.9k|                               1 + nNumToConnect
 2331|       |                                /* one more edge to connect to */
 2332|  33.9k|        /* an additional (+/-) vertex */ );
 2333|       |
 2334|  33.9k|        if (ret <= 0)
  ------------------
  |  Branch (2334:13): [True: 0, False: 33.9k]
  ------------------
 2335|      0|        {
 2336|      0|            ret = !ret ? RI_ERR_PROGR : ret;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  |  Branch (2336:19): [True: 0, False: 0]
  ------------------
 2337|      0|            goto exit_function;
 2338|      0|        }
 2339|       |
 2340|  33.9k|        pTCGroups->nGroup[TCG_Plus] = ret - 1; /* newly added group number */
 2341|  33.9k|        pTCGroups->nVertices += 2; /* two vertices including itself */
 2342|  33.9k|        pTCGroups->nEdges += 1 + nNumToConnect; /* one more edge to connect to an additional (+/-) vertex */
 2343|  33.9k|    }
 2344|       |
 2345|       |    /* add (-) supergroup */
 2346|  87.8k|    n1 = pTCGroups->nGroup[TCG_Minus0];
 2347|  87.8k|    n2 = pTCGroups->nGroup[TCG_Minus_C0];
 2348|  87.8k|    n3 = pTCGroups->nGroup[TCG_Minus_M0];
 2349|  87.8k|    nNumToConnect = ( n1 >= 0 ) + ( n2 >= 0 ) + ( n3 >= 0 );
 2350|  87.8k|    if (nNumToConnect)
  ------------------
  |  Branch (2350:9): [True: 33.2k, False: 54.5k]
  ------------------
 2351|  33.2k|    {
 2352|       |        /* if both groups are present then add a supergroup */
 2353|       |
 2354|  33.2k|        ret = RegisterTCGroup( pTCGroups,
 2355|  33.2k|                               BNS_VT_C_NEG_ALL,
  ------------------
  |  |   72|  33.2k|#define BNS_VT_C_NEG_ALL  (BNS_VT_C_POS_ALL | BNS_VERT_TYPE_C_NEGATIVE) /* supergroup (-) */
  |  |  ------------------
  |  |  |  |   71|  33.2k|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|  33.2k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|  33.2k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BNS_VT_C_NEG_ALL  (BNS_VT_C_POS_ALL | BNS_VERT_TYPE_C_NEGATIVE) /* supergroup (-) */
  |  |  ------------------
  |  |  |  |   54|  33.2k|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  |  |  ------------------
  ------------------
 2356|  33.2k|                               0,
 2357|  33.2k|                               0 /* st_cap */,
 2358|  33.2k|                               0 /* st_flow */,
 2359|  33.2k|                               0 /* edge cap */,
 2360|  33.2k|                               0 /* edge flow */,
 2361|  33.2k|                               1 + nNumToConnect /* one more edge to connect to an additional (+/-) vertex */ );
 2362|       |
 2363|  33.2k|        if (ret < 0)
  ------------------
  |  Branch (2363:13): [True: 0, False: 33.2k]
  ------------------
 2364|      0|        {
 2365|      0|            goto exit_function;
 2366|      0|        }
 2367|  33.2k|        pTCGroups->nGroup[TCG_Minus] = ret - 1; /* newly added group number */
 2368|  33.2k|        pTCGroups->nVertices += 2; /* needs two vertices including itself */
 2369|  33.2k|        pTCGroups->nEdges += 1 + nNumToConnect; /* one more edge to connect to an additional (+/-) vertex */
 2370|  33.2k|    }
 2371|       |
 2372|       |    /* add neutralization vertex: (+)-()=(-) connection */
 2373|  87.8k|    k = pTCGroups->nGroup[TCG_Minus];
 2374|  87.8k|    n = pTCGroups->nGroup[TCG_Plus];
 2375|  87.8k|    nNumToConnect = ( k >= 0 ) + ( n >= 0 );
 2376|  87.8k|    if (nNumToConnect)
  ------------------
  |  Branch (2376:9): [True: 34.1k, False: 53.6k]
  ------------------
 2377|  34.1k|    {
 2378|  34.1k|        pTCGroups->nVertices += 1;
 2379|  34.1k|        pTCGroups->nEdges += nNumToConnect; /* one edge per super-c-group */
 2380|  34.1k|    }
 2381|       |
 2382|  87.8k|    ret = 0;
 2383|       |
 2384|  87.8k|exit_function:
 2385|  87.8k|    return ret;
 2386|  87.8k|}
AddTGroups2TCGBnStruct:
 2395|  87.8k|{
 2396|  87.8k|    int ret = 0;
 2397|  87.8k|    inp_ATOM *at = pStruct->at;
 2398|  87.8k|    int       num_atoms = pStruct->num_atoms;
 2399|  87.8k|    int tot_st_cap, tot_st_flow;
 2400|       |    /* ret = ReInitBnStruct( pBNS ); */
 2401|       |
 2402|  87.8k|    if (pTCGroups->num_tgroups /* tgi && tgi->num_t_groups && tgi->t_group*/)
  ------------------
  |  Branch (2402:9): [True: 523, False: 87.2k]
  ------------------
 2403|    523|    {
 2404|    523|        int         i, k, endpoint, /*centerpoint,*/ fictpoint;
 2405|    523|        int         num_tg = pTCGroups->num_tgroups;
 2406|    523|        int         num_edges = pBNS->num_edges;
 2407|    523|        int         num_vertices = pBNS->num_vertices;
 2408|    523|        BNS_VERTEX *vert_ficpoint, *vert_ficpoint_prev;  /* fictitious vertex describing t-group */
 2409|    523|        BNS_VERTEX *vert_endpoint;
 2410|    523|        BNS_EDGE   *edge;      /* edge between that vertex and the tautomeric endpoint */
 2411|    523|        int        nMaxTGroupNumber = 0;
 2412|       |        /*ENDPOINT_INFO eif;*/
 2413|       |
 2414|       |        /* Debug: check overflow */
 2415|    523|        if (num_vertices + num_tg >= pBNS->max_vertices)
  ------------------
  |  Branch (2415:13): [True: 0, False: 523]
  ------------------
 2416|      0|        {
 2417|      0|            return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2418|      0|        }
 2419|    523|        if (num_edges + pTCGroups->num_tgroup_edges >= pBNS->max_edges)
  ------------------
  |  Branch (2419:13): [True: 0, False: 523]
  ------------------
 2420|      0|        {
 2421|      0|            return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2422|      0|        }
 2423|       |
 2424|       |        /* find the largest t-group ID */
 2425|  1.11k|        for (i = 0; i < pTCGroups->num_tc_groups; i++)
  ------------------
  |  Branch (2425:21): [True: 1.05k, False: 60]
  ------------------
 2426|  1.05k|        {
 2427|  1.05k|            if (pTCGroups->pTCG[i].type & BNS_VERT_TYPE_TGROUP)
  ------------------
  |  |   47|  1.05k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
  |  Branch (2427:17): [True: 594, False: 463]
  ------------------
 2428|    594|            {
 2429|    594|                k = pTCGroups->pTCG[i].ord_num;
 2430|    594|                if (k <= 0)
  ------------------
  |  Branch (2430:21): [True: 0, False: 594]
  ------------------
 2431|      0|                {
 2432|      0|                    return BNS_CPOINT_ERR; /* t-group does not have a number or has a wrong number */
  ------------------
  |  |   56|      0|#define BNS_CPOINT_ERR     (BNS_ERR +  8) /*(-9991)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2433|      0|                }
 2434|    594|                if (k > pTCGroups->num_tc_groups)
  ------------------
  |  Branch (2434:21): [True: 0, False: 594]
  ------------------
 2435|      0|                {
 2436|      0|                    return BNS_CPOINT_ERR; /* t-group has a wrong number */
  ------------------
  |  |   56|      0|#define BNS_CPOINT_ERR     (BNS_ERR +  8) /*(-9991)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2437|      0|                }
 2438|    594|                if (k != nMaxTGroupNumber + 1)
  ------------------
  |  Branch (2438:21): [True: 0, False: 594]
  ------------------
 2439|      0|                {
 2440|      0|                    return BNS_CPOINT_ERR; /* t-group numbers are not contiguously ascending */
  ------------------
  |  |   56|      0|#define BNS_CPOINT_ERR     (BNS_ERR +  8) /*(-9991)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2441|      0|                }
 2442|    594|                nMaxTGroupNumber = k;
 2443|    594|            }
 2444|    463|            else
 2445|    463|            {
 2446|    463|                break; /* t-groups are contiguous and first in the list */
 2447|    463|            }
 2448|  1.05k|        }
 2449|       |
 2450|    523|        if (i != num_tg)
  ------------------
  |  Branch (2450:13): [True: 0, False: 523]
  ------------------
 2451|      0|        {
 2452|      0|            return BNS_CPOINT_ERR; /* number of t-groups is wrong */
  ------------------
  |  |   56|      0|#define BNS_CPOINT_ERR     (BNS_ERR +  8) /*(-9991)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2453|      0|        }
 2454|       |
 2455|       |        /* since t-group IDs may be not contiguous, clear all vertices that will be added.
 2456|       |           all-zeroes-vertex will be ignored by the BNS
 2457|       |        */
 2458|    523|        memset( pBNS->vert + num_vertices, 0, nMaxTGroupNumber * sizeof( pBNS->vert[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2459|       |
 2460|       |        /* initialize new fictitious vertices */
 2461|    523|        vert_ficpoint_prev = pBNS->vert + num_vertices - 1;
 2462|       |
 2463|    523|        tot_st_cap = tot_st_flow = 0;
 2464|       |
 2465|  1.11k|        for (i = 0; i < num_tg; i++, vert_ficpoint_prev = vert_ficpoint)
  ------------------
  |  Branch (2465:21): [True: 594, False: 523]
  ------------------
 2466|    594|        {
 2467|       |            /*
 2468|       |              vert_ficpoint-1 is the last vertex;
 2469|       |              vert_ficpoint   is the vertex that is being added
 2470|       |              Note: nGroupNumber are not contiguous
 2471|       |            */
 2472|    594|            vert_ficpoint = pBNS->vert + num_vertices + pTCGroups->pTCG[i].ord_num - 1;
 2473|    594|            vert_ficpoint->iedge = vert_ficpoint_prev->iedge + vert_ficpoint_prev->max_adj_edges;
 2474|    594|            vert_ficpoint->max_adj_edges = pTCGroups->pTCG[i].num_edges + nMaxAddEdges + BNS_ADD_SUPER_TGROUP;
  ------------------
  |  |   85|    594|#define BNS_ADD_SUPER_TGROUP 1  /* reserve one more edge for a t-group to connect to a single super-t-group */
  ------------------
 2475|    594|            vert_ficpoint->num_adj_edges = 0;
 2476|    594|            vert_ficpoint->st_edge.flow = vert_ficpoint->st_edge.flow0 = 0;
 2477|    594|            vert_ficpoint->st_edge.cap = vert_ficpoint->st_edge.cap0 = pTCGroups->pTCG[i].st_cap;
 2478|    594|            tot_st_cap += pTCGroups->pTCG[i].st_cap;
 2479|    594|            vert_ficpoint->type = pTCGroups->pTCG[i].type;
 2480|    594|            pTCGroups->pTCG[i].nVertexNumber = (int) ( vert_ficpoint - pBNS->vert );
 2481|    594|        }
 2482|       |
 2483|  4.83k|        for (endpoint = 0; endpoint < num_atoms; endpoint++)
  ------------------
  |  Branch (2483:28): [True: 4.30k, False: 523]
  ------------------
 2484|  4.30k|        {
 2485|  4.30k|            if (!at[endpoint].endpoint)
  ------------------
  |  Branch (2485:17): [True: 3.17k, False: 1.13k]
  ------------------
 2486|  3.17k|                continue;
 2487|  1.13k|            fictpoint = at[endpoint].endpoint + num_vertices - 1;
 2488|  1.13k|            vert_ficpoint = pBNS->vert + fictpoint;  /* t-group vertex */
 2489|  1.13k|            vert_endpoint = pBNS->vert + endpoint;   /* endpoint vertex */
 2490|       |            /* Debug: check overflow */
 2491|  1.13k|            if (fictpoint >= pBNS->max_vertices ||
  ------------------
  |  Branch (2491:17): [True: 0, False: 1.13k]
  ------------------
 2492|  1.13k|                 num_edges >= pBNS->max_edges ||
  ------------------
  |  Branch (2492:18): [True: 0, False: 1.13k]
  ------------------
 2493|  1.13k|                 vert_ficpoint->num_adj_edges >= vert_ficpoint->max_adj_edges ||
  ------------------
  |  Branch (2493:18): [True: 0, False: 1.13k]
  ------------------
 2494|  1.13k|                 vert_endpoint->num_adj_edges >= vert_endpoint->max_adj_edges)
  ------------------
  |  Branch (2494:18): [True: 0, False: 1.13k]
  ------------------
 2495|      0|            {
 2496|      0|                ret = BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2497|      0|                break;
 2498|      0|            }
 2499|       |
 2500|       |#ifdef NEVER
 2501|       |            /* obtain donor/acceptor info */
 2502|       |            if (!nGetEndpointInfo( at, endpoint, &eif ))
 2503|       |            {
 2504|       |                ret = BNS_BOND_ERR;
 2505|       |                break;
 2506|       |            }
 2507|       |#endif
 2508|       |
 2509|  1.13k|            vert_endpoint->type |= BNS_VERT_TYPE_ENDPOINT;
  ------------------
  |  |   46|  1.13k|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 2510|       |
 2511|       |#ifdef NEVER
 2512|       |            /* set capacity = 1 to the edges from the endpoint to the centerpoint(s) */
 2513|       |            for (k = 0; k < vert_endpoint->num_adj_edges; k++)
 2514|       |            {
 2515|       |                int iedge = vert_endpoint->iedge[k];
 2516|       |                if (!pBNS->edge[iedge].cap)
 2517|       |                {
 2518|       |/* single bond, possibly between endpoint and centerpoint */
 2519|       |                    centerpoint = ( pBNS->edge[iedge].neighbor12 ^ endpoint );
 2520|       |                    if (centerpoint < pBNS->num_atoms &&
 2521|       |                         pBNS->vert[centerpoint].st_edge.cap >= 1)
 2522|       |                    {
 2523|       |                        int bond_type = ( at[endpoint].bond_type[k] & BOND_TYPE_MASK );
 2524|       |                        if (bond_type == BOND_TAUTOM ||
 2525|       |                            bond_type == BOND_ALTERN ||
 2526|       |                            bond_type == BOND_ALT12NS ||
 2527|       |                            bond_type == BOND_SINGLE)
 2528|       |                        {
 2529|       |                            pBNS->edge[iedge].cap = 1;
 2530|       |                        }
 2531|       |                    }
 2532|       |                }
 2533|       |            }
 2534|       |#endif
 2535|       |
 2536|       |            /* create a new edge connecting endpoint to the new fictitious t-group vertex vert_ficpoint */
 2537|  1.13k|            edge = pBNS->edge + num_edges;
 2538|  1.13k|            edge->cap = vert_endpoint->st_edge.cap - vert_endpoint->st_edge.flow;
 2539|  1.13k|            edge->cap = inchi_min( edge->cap, MAX_TGROUP_EDGE_CAP );
  ------------------
  |  |  139|  1.13k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 876, False: 255]
  |  |  ------------------
  ------------------
 2540|  1.13k|            edge->cap = inchi_max( edge->cap, 0 );
  ------------------
  |  |  138|  1.13k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 911, False: 220]
  |  |  ------------------
  ------------------
 2541|  1.13k|            edge->flow = 0;
 2542|  1.13k|            edge->pass = 0;
 2543|       |
 2544|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 1 )
 2545|       |            edge->forbidden &= pBNS->edge_forbidden_mask;
 2546|       |#endif
 2547|       |
 2548|       |#ifdef NEVER
 2549|       |            /* later include case when the charge change allows the endpoint to become tautomeric */
 2550|       |            /* mark endoint having moveable H atom with flow=1 */
 2551|       |
 2552|       |            /* -- old "no charges" version -- */
 2553|       |            /* if (at[endpoint].chem_bonds_valence == at[endpoint].valence) */
 2554|       |            /* -- the following line takes charges into account -- */
 2555|       |            if (eif.cDonor) /* means the endpoint has an H-atom to donate */
 2556|       |            {
 2557|       |                /* increment edge flow */
 2558|       |                edge->flow++;
 2559|       |                /* increment one vertex st-flow & cap */
 2560|       |                vert_ficpoint->st_edge.flow++;
 2561|       |                vert_ficpoint->st_edge.cap++;
 2562|       |                /* increment another vertex st-flow & cap */
 2563|       |                vert_endpoint->st_edge.flow++;
 2564|       |                vert_endpoint->st_edge.cap++;
 2565|       |            }
 2566|       |#endif
 2567|       |
 2568|       |            /* connect edge to endpoint and fictpoint and increment the counters of neighbors and edges */
 2569|  1.13k|            ret = ConnectTwoVertices( vert_endpoint, vert_ficpoint, edge, pBNS, 0 );
 2570|  1.13k|            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  1.13k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  1.13k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  1.13k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  1.13k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 1.13k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 1.13k]
  |  |  ------------------
  ------------------
 2571|      0|            {
 2572|      0|                break;
 2573|      0|            }
 2574|  1.13k|            num_edges++;
 2575|  1.13k|            edge->cap0 = edge->cap;
 2576|  1.13k|            edge->flow0 = edge->flow;
 2577|  1.13k|            pVA[endpoint].nTautGroupEdge = num_edges; /* edge index + 1 */
 2578|  1.13k|        }
 2579|       |
 2580|    523|        pBNS->num_edges = num_edges;
 2581|    523|        pBNS->num_vertices += nMaxTGroupNumber;
 2582|    523|        pBNS->num_t_groups = num_tg;
 2583|    523|        pBNS->tot_st_cap += tot_st_cap;
 2584|    523|        pBNS->tot_st_flow += tot_st_flow;
 2585|    523|    }
 2586|       |
 2587|  87.8k|    return ret;
 2588|  87.8k|}
ConnectTwoVertices:
 2593|   830k|{
 2594|   830k|    int ip1 = (int) ( p1 - pBNS->vert );
 2595|   830k|    int ip2 = (int) ( p2 - pBNS->vert );
 2596|   830k|    int ie = (int) ( e - pBNS->edge );
 2597|       |
 2598|       |    /* debug: check bounds */
 2599|   830k|    if (ip1 >= pBNS->max_vertices || ip1 < 0 ||
  ------------------
  |  Branch (2599:9): [True: 0, False: 830k]
  |  Branch (2599:38): [True: 0, False: 830k]
  ------------------
 2600|   830k|         ip2 >= pBNS->max_vertices || ip2 < 0 ||
  ------------------
  |  Branch (2600:10): [True: 0, False: 830k]
  |  Branch (2600:39): [True: 0, False: 830k]
  ------------------
 2601|   830k|         ie >= pBNS->max_edges || ie < 0 ||
  ------------------
  |  Branch (2601:10): [True: 0, False: 830k]
  |  Branch (2601:35): [True: 0, False: 830k]
  ------------------
 2602|   830k|         ( p1->iedge - pBNS->iedge ) < 0 ||
  ------------------
  |  Branch (2602:10): [True: 0, False: 830k]
  ------------------
 2603|   830k|         ( p1->iedge - pBNS->iedge ) + p1->max_adj_edges > pBNS->max_iedges ||
  ------------------
  |  Branch (2603:10): [True: 0, False: 830k]
  ------------------
 2604|   830k|         ( p2->iedge - pBNS->iedge ) < 0 ||
  ------------------
  |  Branch (2604:10): [True: 0, False: 830k]
  ------------------
 2605|   830k|         ( p2->iedge - pBNS->iedge ) + p2->max_adj_edges > pBNS->max_iedges ||
  ------------------
  |  Branch (2605:10): [True: 0, False: 830k]
  ------------------
 2606|   830k|         p1->num_adj_edges >= p1->max_adj_edges ||
  ------------------
  |  Branch (2606:10): [True: 0, False: 830k]
  ------------------
 2607|   830k|         p2->num_adj_edges >= p2->max_adj_edges)
  ------------------
  |  Branch (2607:10): [True: 0, False: 830k]
  ------------------
 2608|      0|    {
 2609|      0|        return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2610|      0|    }
 2611|       |    /* clear the edge */
 2612|   830k|    if (bClearEdge)
  ------------------
  |  Branch (2612:9): [True: 351k, False: 479k]
  ------------------
 2613|   351k|    {
 2614|   351k|        memset( e, 0, sizeof( *e ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2615|   351k|    }
 2616|   479k|    else
 2617|   479k|        if (e->neighbor1 || e->neighbor12)
  ------------------
  |  Branch (2617:13): [True: 0, False: 479k]
  |  Branch (2617:29): [True: 0, False: 479k]
  ------------------
 2618|      0|        {
 2619|      0|            return BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2620|      0|        }
 2621|       |
 2622|       |        /* connect */
 2623|   830k|    e->neighbor1 = inchi_min( ip1, ip2 );
  ------------------
  |  |  139|   830k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 427k, False: 403k]
  |  |  ------------------
  ------------------
 2624|   830k|    e->neighbor12 = ip1 ^ ip2;
 2625|   830k|    p1->iedge[p1->num_adj_edges] = ie;
 2626|   830k|    p2->iedge[p2->num_adj_edges] = ie;
 2627|   830k|    e->neigh_ord[ip1 > ip2] = p1->num_adj_edges++;
 2628|       |
 2629|   830k|    e->neigh_ord[ip1 < ip2] = p2->num_adj_edges++;
 2630|   830k|    return 0;
 2631|   830k|}
AddRadicalToMetal:
 2672|  34.1k|{
 2673|  34.1k|    int iG0 = pTCGroups->nGroup[TCG_MeFlower0]; /* index in pTCGroups->pTCG[] */
 2674|  34.1k|    int iG1 = pTCGroups->nGroup[TCG_MeFlower1];
 2675|  34.1k|    int iG2 = pTCGroups->nGroup[TCG_MeFlower2];
 2676|  34.1k|    int iG3 = pTCGroups->nGroup[TCG_MeFlower3];
 2677|  34.1k|    int n = (iG0 >= 0) + (iG1 >= 0) + (iG2 >= 0) + (iG3 >= 0);
 2678|  34.1k|    int vG0, vG1, vG2, vG3;  /* M-vertex number */
 2679|  34.1k|    BNS_VERTEX* pG0 = NULL, * pG1 = NULL, * pG2 = NULL, * pG3 = NULL;
 2680|       |
 2681|  34.1k|    if (pTCGroups->num_metal_atoms &&
  ------------------
  |  Branch (2681:9): [True: 17.2k, False: 16.9k]
  ------------------
 2682|  17.2k|        pSrm->bMetalAddFlower &&
  ------------------
  |  Branch (2682:9): [True: 17.2k, False: 0]
  ------------------
 2683|  17.2k|        *tot_st_cap % 2 &&
  ------------------
  |  Branch (2683:9): [True: 9.58k, False: 7.62k]
  ------------------
 2684|  9.58k|        n == 4)
  ------------------
  |  Branch (2684:9): [True: 9.53k, False: 46]
  ------------------
 2685|  9.53k|    {
 2686|  9.53k|        vG0 = pTCGroups->pTCG[iG0].nVertexNumber;
 2687|  9.53k|        vG1 = pTCGroups->pTCG[iG1].nVertexNumber;
 2688|  9.53k|        vG2 = pTCGroups->pTCG[iG2].nVertexNumber;
 2689|  9.53k|        vG3 = pTCGroups->pTCG[iG3].nVertexNumber;
 2690|       |
 2691|  9.53k|        pG0 = pBNS->vert + vG0;
 2692|  9.53k|        pG1 = pBNS->vert + vG1;
 2693|  9.53k|        pG2 = pBNS->vert + vG2;
 2694|  9.53k|        pG3 = pBNS->vert + vG3;
 2695|       |
 2696|       |        /* add 1 unit to metal flower st_cap */
 2697|  9.53k|        pG3->st_edge.cap++;
 2698|  9.53k|        pG3->st_edge.cap0++;
 2699|  9.53k|        (*tot_st_cap)++;
 2700|  9.53k|        return 1;
 2701|  9.53k|    }
 2702|       |
 2703|  24.6k|    return 0;
 2704|  34.1k|}
ConnectMetalFlower:
 2711|  34.1k|{
 2712|  34.1k|    int iG0 = pTCGroups->nGroup[TCG_MeFlower0]; /* index in pTCGroups->pTCG[] */
 2713|  34.1k|    int iG1 = pTCGroups->nGroup[TCG_MeFlower1];
 2714|  34.1k|    int iG2 = pTCGroups->nGroup[TCG_MeFlower2];
 2715|  34.1k|    int iG3 = pTCGroups->nGroup[TCG_MeFlower3];
 2716|  34.1k|    int n = ( iG0 >= 0 ) + ( iG1 >= 0 ) + ( iG2 >= 0 ) + ( iG3 >= 0 );
 2717|  34.1k|    int vG0, vG1, vG2, vG3;  /* M-vertex number */
 2718|  34.1k|    int cur_num_edges = *pcur_num_edges;
 2719|  34.1k|    int cur_num_vertices = *pcur_num_vertices;
 2720|  34.1k|    BNS_VERTEX *pG0 = NULL, *pG1 = NULL, *pG2 = NULL, *pG3 = NULL;
 2721|  34.1k|    BNS_EDGE   *ea = NULL, *eb = NULL, *ed = NULL, *ex = NULL, *ey = NULL, *e;
 2722|  34.1k|    int         ia, ib, id, ix, iy;
 2723|  34.1k|    int         c, f, dc, df, ca, fa, cb, fb, cd, fd, cx, fx, cy, fy;
 2724|  34.1k|    int         C0, F0, C1, F1, C2, F2, C3, F3, D;
 2725|  34.1k|    int         ret = 0, i;
 2726|       |
 2727|  34.1k|    if (0 == n)
  ------------------
  |  Branch (2727:9): [True: 17.0k, False: 17.1k]
  ------------------
 2728|  17.0k|    {
 2729|  17.0k|        goto exit_function;
 2730|  17.0k|    }
 2731|       |
 2732|  17.1k|    if (4 != n)
  ------------------
  |  Branch (2732:9): [True: 0, False: 17.1k]
  ------------------
 2733|      0|    {
 2734|      0|        ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2735|      0|        goto exit_function;
 2736|      0|    }
 2737|       |
 2738|  17.1k|    vG0 = pTCGroups->pTCG[iG0].nVertexNumber;
 2739|  17.1k|    vG1 = pTCGroups->pTCG[iG1].nVertexNumber;
 2740|  17.1k|    vG2 = pTCGroups->pTCG[iG2].nVertexNumber;
 2741|  17.1k|    vG3 = pTCGroups->pTCG[iG3].nVertexNumber;
 2742|       |
 2743|  17.1k|    pG0 = pBNS->vert + vG0;
 2744|  17.1k|    pG1 = pBNS->vert + vG1;
 2745|  17.1k|    pG2 = pBNS->vert + vG2;
 2746|  17.1k|    pG3 = pBNS->vert + vG3;
 2747|       |
 2748|       |    /* count G0 edges cap and flow (currently only atoms are connected to G0) */
 2749|  41.4k|    for (i = 0, c = 0, f = 0; i < pG0->num_adj_edges; i++)
  ------------------
  |  Branch (2749:31): [True: 24.3k, False: 17.1k]
  ------------------
 2750|  24.3k|    {
 2751|  24.3k|        e = pBNS->edge + pG0->iedge[i];
 2752|  24.3k|        c += e->cap;
 2753|  24.3k|        f += e->flow;
 2754|  24.3k|    }
 2755|       |
 2756|       |    /* consistency checks */
 2757|  17.1k|    if (!IS_BNS_VT_M_GR( pTCGroups->pTCG[iG0].type ) &&
  ------------------
  |  |   80|  34.2k|#define IS_BNS_VT_M_GR(X)           ((X) == BNS_VERT_TYPE_METAL_GR )  /* metal flower base or vertices */
  |  |  ------------------
  |  |  |  |   57|  17.1k|#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 (2757:9): [True: 0, False: 17.1k]
  ------------------
 2758|      0|        ( pTCGroups->pTCG[iG0].edges_cap != pG0->st_edge.cap ||
  ------------------
  |  Branch (2758:11): [True: 0, False: 0]
  ------------------
 2759|      0|            pTCGroups->pTCG[iG0].edges_flow != pG0->st_edge.flow ))
  ------------------
  |  Branch (2759:13): [True: 0, False: 0]
  ------------------
 2760|      0|    {
 2761|      0|        ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2762|      0|        goto exit_function;
 2763|      0|    }
 2764|       |
 2765|  17.1k|    if (pTCGroups->pTCG[iG0].edges_cap != c ||
  ------------------
  |  Branch (2765:9): [True: 0, False: 17.1k]
  ------------------
 2766|  17.1k|         pTCGroups->pTCG[iG0].edges_flow != f)
  ------------------
  |  Branch (2766:10): [True: 0, False: 17.1k]
  ------------------
 2767|      0|    {
 2768|      0|        ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2769|      0|        goto exit_function;
 2770|      0|    }
 2771|       |
 2772|       |    /* get new edges */
 2773|       |
 2774|  17.1k|    ea = pBNS->edge + (ia = cur_num_edges++);
 2775|  17.1k|    eb = pBNS->edge + (ib = cur_num_edges++);
 2776|  17.1k|    ed = pBNS->edge + (id = cur_num_edges++);
 2777|  17.1k|    ex = pBNS->edge + (ix = cur_num_edges++);
 2778|  17.1k|    ey = pBNS->edge + (iy = cur_num_edges++);
 2779|       |
 2780|       |    /* connect vertices with edges */
 2781|  17.1k|    ret = ConnectTwoVertices( pG0, pG1, eb, pBNS, 1 );
 2782|  17.1k|    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  17.1k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  17.1k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  17.1k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  17.1k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 17.1k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 17.1k]
  |  |  ------------------
  ------------------
 2783|      0|    {
 2784|      0|        goto exit_function;
 2785|      0|    }
 2786|       |
 2787|  17.1k|    ret = ConnectTwoVertices( pG0, pG2, ea, pBNS, 1 );
 2788|       |
 2789|  17.1k|    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  17.1k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  17.1k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  17.1k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  17.1k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 17.1k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 17.1k]
  |  |  ------------------
  ------------------
 2790|      0|    {
 2791|      0|        goto exit_function;
 2792|      0|    }
 2793|       |
 2794|  17.1k|    ret = ConnectTwoVertices( pG1, pG2, ed, pBNS, 1 );
 2795|       |
 2796|  17.1k|    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  17.1k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  17.1k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  17.1k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  17.1k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 17.1k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 17.1k]
  |  |  ------------------
  ------------------
 2797|      0|    {
 2798|      0|        goto exit_function;
 2799|      0|    }
 2800|       |
 2801|  17.1k|    ret = ConnectTwoVertices( pG1, pG3, ey, pBNS, 1 );
 2802|       |
 2803|  17.1k|    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  17.1k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  17.1k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  17.1k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  17.1k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 17.1k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 17.1k]
  |  |  ------------------
  ------------------
 2804|      0|    {
 2805|      0|        goto exit_function;
 2806|      0|    }
 2807|       |
 2808|  17.1k|    ret = ConnectTwoVertices( pG2, pG3, ex, pBNS, 1 );
 2809|       |
 2810|  17.1k|    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  17.1k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  17.1k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  17.1k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  17.1k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 17.1k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 17.1k]
  |  |  ------------------
  ------------------
 2811|      0|    {
 2812|      0|        goto exit_function;
 2813|      0|    }
 2814|       |
 2815|       |    /* calculate caps and flows */
 2816|       |
 2817|  17.1k|    dc = c % 2;
 2818|  17.1k|    c /= 2;
 2819|  17.1k|    df = f % 2;
 2820|  17.1k|    f /= 2;
 2821|       |
 2822|  17.1k|    D = pSrm->nMetalFlowerParam_D;
 2823|       |
 2824|  17.1k|    C0 = F0 = 2 * c + 2 * D + dc;
 2825|  17.1k|    C1 = F1 = c + 2 * D + dc - df;
 2826|  17.1k|    C2 = F2 = c + 2 * D;
 2827|  17.1k|    C3 = F3 = 0;
 2828|       |
 2829|  17.1k|    ca = c + 2 * D;
 2830|  17.1k|    fa = c + D - f;
 2831|       |
 2832|  17.1k|    cb = c + 2 * D + dc;
 2833|  17.1k|    fb = c + D + dc - ( f + df );
 2834|       |
 2835|  17.1k|    cd = c + 2 * D;
 2836|  17.1k|    fd = f + D;
 2837|       |
 2838|  17.1k|    cx = cy = D;
 2839|  17.1k|    fx = fy = 0;
 2840|       |
 2841|       |    /* check overflow */
 2842|  17.1k|    if (C0 >= EDGE_FLOW_ST_MASK || F0 >= EDGE_FLOW_ST_MASK ||
  ------------------
  |  |  128|  34.2k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                  if (C0 >= EDGE_FLOW_ST_MASK || F0 >= EDGE_FLOW_ST_MASK ||
  ------------------
  |  |  128|  34.2k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (2842:9): [True: 0, False: 17.1k]
  |  Branch (2842:36): [True: 0, False: 17.1k]
  ------------------
 2843|  17.1k|         C1 >= EDGE_FLOW_ST_MASK || F1 >= EDGE_FLOW_ST_MASK ||
  ------------------
  |  |  128|  34.2k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                       C1 >= EDGE_FLOW_ST_MASK || F1 >= EDGE_FLOW_ST_MASK ||
  ------------------
  |  |  128|  34.2k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (2843:10): [True: 0, False: 17.1k]
  |  Branch (2843:37): [True: 0, False: 17.1k]
  ------------------
 2844|  17.1k|         C2 >= EDGE_FLOW_ST_MASK || F2 >= EDGE_FLOW_ST_MASK ||
  ------------------
  |  |  128|  34.2k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                       C2 >= EDGE_FLOW_ST_MASK || F2 >= EDGE_FLOW_ST_MASK ||
  ------------------
  |  |  128|  34.2k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (2844:10): [True: 0, False: 17.1k]
  |  Branch (2844:37): [True: 0, False: 17.1k]
  ------------------
 2845|  17.1k|         C3 >= EDGE_FLOW_ST_MASK || F3 >= EDGE_FLOW_ST_MASK)
  ------------------
  |  |  128|  34.2k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                       C3 >= EDGE_FLOW_ST_MASK || F3 >= EDGE_FLOW_ST_MASK)
  ------------------
  |  |  128|  17.1k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (2845:10): [True: 0, False: 17.1k]
  |  Branch (2845:37): [True: 0, False: 17.1k]
  ------------------
 2846|      0|    {
 2847|      0|        return BNS_PROGRAM_ERR; /* cannot handle too large st-cap or st-flow */
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2848|      0|    }
 2849|       |
 2850|       |    /* set st caps and flows */
 2851|       |
 2852|  17.1k|    SetStCapFlow( pG0, tot_st_flow, tot_st_cap, C0, F0 );
 2853|  17.1k|    SetStCapFlow( pG1, tot_st_flow, tot_st_cap, C1, F1 );
 2854|  17.1k|    SetStCapFlow( pG2, tot_st_flow, tot_st_cap, C2, F2 );
 2855|  17.1k|    SetStCapFlow( pG3, tot_st_flow, tot_st_cap, C3, F3 );
 2856|       |
 2857|  17.1k|    SetEdgeCapFlow( ea, ca, fa );
 2858|  17.1k|    SetEdgeCapFlow( eb, cb, fb );
 2859|  17.1k|    SetEdgeCapFlow( ed, cd, fd );
 2860|  17.1k|    SetEdgeCapFlow( ex, cx, fx );
 2861|  17.1k|    SetEdgeCapFlow( ey, cy, fy );
 2862|       |
 2863|       |
 2864|  17.1k|    *pcur_num_edges = cur_num_edges;
 2865|  17.1k|    *pcur_num_vertices = cur_num_vertices;
 2866|       |
 2867|  17.1k|    ret = 0;
 2868|       |
 2869|  34.1k|exit_function:
 2870|       |
 2871|  34.1k|    return ret;
 2872|  17.1k|}
SetEdgeCapFlow:
 2877|  85.5k|{
 2878|  85.5k|    e->cap = e->cap0 = edge_cap;
 2879|  85.5k|    e->flow = e->flow0 = edge_flow;
 2880|  85.5k|}
AddEdgeFlow:
 2890|   265k|{
 2891|       |
 2892|       |    /* overflow check */
 2893|   265k|    if (e01->cap < 0 || edge_cap < 0 || (int) e01->cap + edge_cap >= EDGE_FLOW_MASK)
  ------------------
  |  |  133|   265k|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
  |  Branch (2893:9): [True: 0, False: 265k]
  |  Branch (2893:25): [True: 0, False: 265k]
  |  Branch (2893:41): [True: 0, False: 265k]
  ------------------
 2894|      0|    {
 2895|      0|        return BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2896|      0|    }
 2897|       |
 2898|   265k|    if (pDst->st_edge.cap < 0 || (int) pDst->st_edge.cap + edge_cap >= EDGE_FLOW_ST_MASK ||
  ------------------
  |  |  128|   531k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (2898:9): [True: 0, False: 265k]
  |  Branch (2898:34): [True: 0, False: 265k]
  ------------------
 2899|   265k|         pDst->st_edge.flow < 0 || (int) pDst->st_edge.flow + edge_flow >= EDGE_FLOW_ST_MASK ||
  ------------------
  |  |  128|   531k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (2899:10): [True: 0, False: 265k]
  |  Branch (2899:36): [True: 0, False: 265k]
  ------------------
 2900|   265k|         pSrc->st_edge.cap < 0 || pSrc->st_edge.flow < 0 ||
  ------------------
  |  Branch (2900:10): [True: 0, False: 265k]
  |  Branch (2900:35): [True: 0, False: 265k]
  ------------------
 2901|   265k|         (int) pSrc->st_edge.flow + edge_flow >= EDGE_FLOW_ST_MASK)
  ------------------
  |  |  128|   265k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (2901:10): [True: 0, False: 265k]
  ------------------
 2902|      0|    {
 2903|      0|        return BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2904|      0|    }
 2905|       |
 2906|       |    /* add flow */
 2907|   265k|    e01->cap += edge_cap;
 2908|   265k|    e01->flow += edge_flow;
 2909|   265k|    e01->cap0 = e01->cap;
 2910|   265k|    e01->flow0 = e01->flow;
 2911|       |
 2912|   265k|    pDst->st_edge.cap += edge_cap;
 2913|   265k|    pDst->st_edge.cap0 = pDst->st_edge.cap;
 2914|   265k|    *tot_st_cap += edge_cap;
 2915|       |
 2916|   265k|    pDst->st_edge.flow += edge_flow;
 2917|   265k|    pDst->st_edge.flow0 = pDst->st_edge.flow;
 2918|   265k|    *tot_st_flow += edge_flow;
 2919|       |
 2920|   265k|    pSrc->st_edge.flow += edge_flow;
 2921|   265k|    pSrc->st_edge.flow0 = pSrc->st_edge.flow;
 2922|   265k|    *tot_st_flow += edge_flow;
 2923|       |
 2924|       |/*
 2925|       |    pDst->st_edge.cap  += e01->cap;
 2926|       |    pDst->st_edge.cap0  = pDst->st_edge.cap;
 2927|       |    *tot_st_cap       += e01->cap;
 2928|       |
 2929|       |    pDst->st_edge.flow += e01->flow;
 2930|       |    pDst->st_edge.flow0 = pDst->st_edge.flow;
 2931|       |    *tot_st_flow      += e01->flow;
 2932|       |
 2933|       |    pSrc->st_edge.flow += e01->flow;
 2934|       |    pSrc->st_edge.flow0 = pSrc->st_edge.flow;
 2935|       |    *tot_st_flow      += e01->flow;
 2936|       |*/
 2937|   265k|    return 0;
 2938|   265k|}
ConnectSuperCGroup:
 3027|   102k|{
 3028|   102k|    BNS_EDGE   **e0X = NULL, *e;
 3029|   102k|    BNS_VERTEX **pvX = NULL, *pv0 = NULL, *pv1 = NULL, *pv = NULL;
 3030|   102k|    int         *jX = NULL, *iX = NULL;
 3031|   102k|    int        i, j, num_groups, j0, i1, j1, iXX, ret = 0, fst = 0;
 3032|   102k|    int        cur_num_vertices = *pcur_num_vertices;
 3033|   102k|    int        cur_num_edges = *pcur_num_edges;
 3034|       |
 3035|   102k|    if (nSuperCGroup >= 0)
  ------------------
  |  Branch (3035:9): [True: 68.3k, False: 34.1k]
  ------------------
 3036|  68.3k|    {
 3037|  68.3k|        i1 = pTCGroups->nGroup[nSuperCGroup]; /* the supergroup */
 3038|  68.3k|        if (i1 < 0)
  ------------------
  |  Branch (3038:13): [True: 1.10k, False: 67.2k]
  ------------------
 3039|  1.10k|            return 0;
 3040|  68.3k|    }
 3041|  34.1k|    else
 3042|  34.1k|    {
 3043|  34.1k|        i1 = -1;
 3044|  34.1k|        fst = 1;
 3045|  34.1k|    }
 3046|       |
 3047|   371k|    for (i = num_groups = 0; i < num_add; i++)
  ------------------
  |  Branch (3047:30): [True: 270k, False: 101k]
  ------------------
 3048|   270k|    {
 3049|   270k|        iXX = pTCGroups->nGroup[nAddGroups[i]];
 3050|   270k|        num_groups += ( iXX >= 0 && iXX != i1 );
  ------------------
  |  Branch (3050:25): [True: 198k, False: 71.8k]
  |  Branch (3050:37): [True: 198k, False: 0]
  ------------------
 3051|   270k|    }
 3052|   101k|    if (num_groups < 1)
  ------------------
  |  Branch (3052:9): [True: 0, False: 101k]
  ------------------
 3053|      0|    {  /* Y connect only 2 or more groups; V connects even 1 group */
 3054|      0|        return 0;
 3055|      0|    }
 3056|       |
 3057|   101k|    e0X = (BNS_EDGE   **) inchi_calloc( (long long)num_groups + 1, sizeof( e0X[0] ) ); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|   101k|#define inchi_calloc   calloc
  ------------------
 3058|   101k|    pvX = (BNS_VERTEX **) inchi_calloc( (long long)num_groups + 1, sizeof( pvX[0] ) ); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|   101k|#define inchi_calloc   calloc
  ------------------
 3059|   101k|    jX = (int         *) inchi_calloc( (long long)num_groups + 1, sizeof( jX[0] ) ); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|   101k|#define inchi_calloc   calloc
  ------------------
 3060|   101k|    iX = (int         *) inchi_calloc( (long long)num_groups + 1, sizeof( iX[0] ) ); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|   101k|#define inchi_calloc   calloc
  ------------------
 3061|       |
 3062|   101k|    if (!e0X || !pvX || !jX || !iX)
  ------------------
  |  Branch (3062:9): [True: 0, False: 101k]
  |  Branch (3062:17): [True: 0, False: 101k]
  |  Branch (3062:25): [True: 0, False: 101k]
  |  Branch (3062:32): [True: 0, False: 101k]
  ------------------
 3063|      0|    {
 3064|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 3065|      0|        goto exit_function;
 3066|      0|    }
 3067|       |
 3068|       |    /* create vert_ficpoint -- central Y-connection vertex */
 3069|       |
 3070|   101k|    j0 = cur_num_vertices;
 3071|   101k|    pv0 = pBNS->vert + j0; /* center of the Y-connection; has number j0 */
 3072|   101k|    pv0->iedge = ( pv0 - 1 )->iedge + ( pv0 - 1 )->max_adj_edges;
 3073|   101k|    pv0->max_adj_edges = num_groups + 1 + BNS_ADD_EDGES; /* Y-connection num. edges */
  ------------------
  |  |   89|   101k|#define BNS_ADD_EDGES        1  /* max. number of edges to add to each atom (except edges to a t-group or c-group) */
  ------------------
 3074|   101k|    pv0->num_adj_edges = 0; /* nothing connected yet */
 3075|   101k|    pv0->type = BNS_VT_YVCONNECTOR;
  ------------------
  |  |   75|   101k|#define BNS_VT_YVCONNECTOR  BNS_VERT_TYPE__AUX                                 /* group connection */
  |  |  ------------------
  |  |  |  |   53|   101k|#define BNS_VERT_TYPE__AUX          0x0080  /* vertex added to build charge substructures */
  |  |  ------------------
  ------------------
 3076|   101k|    cur_num_vertices++;
 3077|       |
 3078|   101k|    if (fst == 0)
  ------------------
  |  Branch (3078:9): [True: 67.2k, False: 34.1k]
  ------------------
 3079|  67.2k|    {
 3080|       |        /* find super c-group vertex pv1, number j1 */
 3081|  67.2k|        jX[0] = j1 = pTCGroups->pTCG[i1].nVertexNumber;
 3082|  67.2k|        iX[0] = i1;
 3083|  67.2k|        pvX[0] = pv1 = pBNS->vert + j1;
 3084|  67.2k|    }
 3085|       |
 3086|       |    /* find other c-group vertices */
 3087|   371k|    for (i = 0, j = 1; i < num_add; i++)
  ------------------
  |  Branch (3087:24): [True: 270k, False: 101k]
  ------------------
 3088|   270k|    {
 3089|   270k|        iXX = pTCGroups->nGroup[nAddGroups[i]];
 3090|   270k|        if (( iXX >= 0 ) && ( iXX != i1 ))
  ------------------
  |  Branch (3090:13): [True: 198k, False: 71.8k]
  |  Branch (3090:29): [True: 198k, False: 0]
  ------------------
 3091|   198k|        {
 3092|   198k|            iX[j] = iXX;
 3093|   198k|            jX[j] = pTCGroups->pTCG[iXX].nVertexNumber;
 3094|   198k|            pvX[j] = pBNS->vert + jX[j];
 3095|   198k|            j++;
 3096|   198k|        }
 3097|   270k|    }
 3098|       |
 3099|       |    /* grab (num_groups+1) free edges */
 3100|   367k|    for (i = fst; i <= num_groups; i++)
  ------------------
  |  Branch (3100:19): [True: 265k, False: 101k]
  ------------------
 3101|   265k|    {
 3102|   265k|        e = e0X[i] = pBNS->edge + cur_num_edges;
 3103|   265k|        pv = pvX[i];
 3104|   265k|        j = jX[i];
 3105|   265k|        iXX = iX[i];
 3106|       |        /* connect all to pv0 */
 3107|   265k|        ret = ConnectTwoVertices( pv0, pv, e, pBNS, 1 );
 3108|   265k|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|   265k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   265k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   265k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   265k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 265k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 265k]
  |  |  ------------------
  ------------------
 3109|      0|        {
 3110|      0|            goto exit_function;
 3111|      0|        }
 3112|   265k|        if (i)
  ------------------
  |  Branch (3112:13): [True: 198k, False: 67.2k]
  ------------------
 3113|   198k|        {
 3114|       |            /* from c-group to central Y-connecting vertex of from supergroup to (+/-) vertex */
 3115|   198k|            pTCGroups->pTCG[iX[i]].nForwardEdge = cur_num_edges;
 3116|   198k|        }
 3117|  67.2k|        else
 3118|  67.2k|        {
 3119|       |            /* from central Y-connecting vertex to supergroup */
 3120|  67.2k|            pTCGroups->pTCG[iX[i]].nBackwardEdge = cur_num_edges;
 3121|  67.2k|        }
 3122|   265k|        cur_num_edges++;
 3123|   265k|    }
 3124|       |
 3125|       |    /* set flow and cap for incoming into pv0 edges */
 3126|   299k|    for (i = 1; i <= num_groups; i++)
  ------------------
  |  Branch (3126:17): [True: 198k, False: 101k]
  ------------------
 3127|   198k|    {
 3128|   198k|        int nDelta = pTCGroups->pTCG[iX[i]].st_cap - pTCGroups->pTCG[iX[i]].edges_cap;
 3129|   198k|        int edge_cap = pTCGroups->pTCG[iX[i]].edges_cap + nDelta; /* added nDelta */
 3130|   198k|        int edge_flow = pTCGroups->pTCG[iX[i]].edges_cap - pTCGroups->pTCG[iX[i]].edges_flow /*-nDelta*/;
 3131|       |
 3132|   198k|        ret = AddEdgeFlow( edge_cap, edge_flow,
 3133|   198k|                     e0X[i], pvX[i]/*src*/, pv0 /* dest*/, tot_st_cap, tot_st_flow );
 3134|       |
 3135|   198k|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|   198k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   198k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   198k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   198k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 198k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 198k]
  |  |  ------------------
  ------------------
 3136|      0|        {
 3137|      0|            goto exit_function;
 3138|      0|        }
 3139|   198k|    }
 3140|       |
 3141|   101k|    if (fst == 0)
  ------------------
  |  Branch (3141:9): [True: 67.2k, False: 34.1k]
  ------------------
 3142|  67.2k|    {
 3143|       |        /* set flow and cap for going out of pv0 and into pv1 edge */
 3144|  67.2k|        int edge_cap = pv0->st_edge.cap;
 3145|  67.2k|        int edge_flow = pv0->st_edge.cap - pv0->st_edge.flow;
 3146|       |
 3147|  67.2k|        ret = AddEdgeFlow( pv0->st_edge.cap, pv0->st_edge.cap - pv0->st_edge.flow,
 3148|  67.2k|                     e0X[0], pv0/*src*/, pv1 /* dest*/, tot_st_cap, tot_st_flow );
 3149|       |
 3150|  67.2k|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  67.2k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  67.2k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  67.2k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  67.2k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 67.2k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 67.2k]
  |  |  ------------------
  ------------------
 3151|      0|        {
 3152|      0|            goto exit_function;
 3153|      0|        }
 3154|       |
 3155|  67.2k|        pTCGroups->pTCG[iX[0]].edges_cap += edge_cap;
 3156|  67.2k|        pTCGroups->pTCG[iX[0]].edges_flow += edge_flow;
 3157|  67.2k|        pTCGroups->pTCG[iX[0]].st_cap += edge_cap;
 3158|  67.2k|        pTCGroups->pTCG[iX[0]].st_flow += edge_flow;
 3159|  67.2k|    }
 3160|  34.1k|    else
 3161|  34.1k|    {
 3162|       |        /* no supergroup => change cap to flow */
 3163|  34.1k|        *tot_st_cap += pv0->st_edge.flow - pv0->st_edge.cap;
 3164|  34.1k|        pv0->st_edge.cap += pv0->st_edge.flow - pv0->st_edge.cap;
 3165|  34.1k|        pv0->st_edge.cap0 = pv0->st_edge.cap;
 3166|  34.1k|    }
 3167|       |
 3168|   101k|    *pcur_num_vertices = cur_num_vertices;
 3169|   101k|    *pcur_num_edges = cur_num_edges;
 3170|   101k|    ret = num_groups;
 3171|       |
 3172|   101k|exit_function:
 3173|   101k|    if (e0X) inchi_free( e0X );
  ------------------
  |  | 1152|   101k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 101k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 101k]
  |  |  ------------------
  ------------------
  |  Branch (3173:9): [True: 101k, False: 0]
  ------------------
 3174|   101k|    if (pvX) inchi_free( pvX );
  ------------------
  |  | 1152|   101k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 101k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 101k]
  |  |  ------------------
  ------------------
  |  Branch (3174:9): [True: 101k, False: 0]
  ------------------
 3175|   101k|    if (jX) inchi_free( jX );
  ------------------
  |  | 1152|   101k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 101k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 101k]
  |  |  ------------------
  ------------------
  |  Branch (3175:9): [True: 101k, False: 0]
  ------------------
 3176|   101k|    if (iX) inchi_free( iX );
  ------------------
  |  | 1152|   101k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 101k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 101k]
  |  |  ------------------
  ------------------
  |  Branch (3176:9): [True: 101k, False: 0]
  ------------------
 3177|       |
 3178|   101k|    return ret;
 3179|   101k|}
AddStCapFlow:
 3184|   358k|{
 3185|   358k|    vert_ficpoint->st_edge.flow += flow;
 3186|   358k|    *tot_st_flow += flow;
 3187|   358k|    vert_ficpoint->st_edge.cap += cap;
 3188|   358k|    *tot_st_cap += cap;
 3189|       |
 3190|   358k|    vert_ficpoint->st_edge.flow0 = vert_ficpoint->st_edge.flow;
 3191|   358k|    vert_ficpoint->st_edge.cap0 = vert_ficpoint->st_edge.cap;
 3192|   358k|}
SetStCapFlow:
 3197|  68.4k|{
 3198|  68.4k|    *tot_st_flow += flow - vert_ficpoint->st_edge.flow;
 3199|  68.4k|    vert_ficpoint->st_edge.flow = flow;
 3200|  68.4k|    *tot_st_cap += cap - vert_ficpoint->st_edge.cap;
 3201|  68.4k|    vert_ficpoint->st_edge.cap = cap;
 3202|       |
 3203|  68.4k|    vert_ficpoint->st_edge.flow0 = vert_ficpoint->st_edge.flow;
 3204|  68.4k|    vert_ficpoint->st_edge.cap0 = vert_ficpoint->st_edge.cap;
 3205|  68.4k|}
AddCGroups2TCGBnStruct:
 3216|  87.8k|{
 3217|  87.8k|    int ret = 0, ret1, ret2, ret3, bNeedsFlower; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 3218|  87.8k|    inp_ATOM *at = pStruct->at;
 3219|  87.8k|    int       num_atoms = pStruct->num_atoms;
 3220|       |    /*int       num_tg           = pTCGroups->num_tgroups;*/
 3221|  87.8k|    int       num_cg = pTCGroups->num_tc_groups - pTCGroups->num_tgroups;
 3222|  87.8k|    int       fst_cg_vertex = pBNS->num_vertices;
 3223|  87.8k|    int       fst_cg_group = pTCGroups->num_tgroups;
 3224|  87.8k|    int       num_vertices = pBNS->num_vertices;
 3225|  87.8k|    int       num_edges = pBNS->num_edges;
 3226|  87.8k|    int       cg_charge = 0;
 3227|  87.8k|    ICHICONST SRM *pSrm = pStruct->pSrm;
  ------------------
  |  |   13|  87.8k|#define ICHICONST      const
  ------------------
 3228|       |
 3229|       |    /* ret = ReInitBnStruct( pBNS ); */
 3230|       |
 3231|  87.8k|    if (num_cg > 0)
  ------------------
  |  Branch (3231:9): [True: 34.1k, False: 53.6k]
  ------------------
 3232|  34.1k|    {
 3233|       |    /* if ( cgi && cgi->num_c_groups && cgi->c_group ) */
 3234|  34.1k|        int         i, i1, i2, j, j1, j2, k, k1, k2, n, c_point, c_neigh, cap, flow;
 3235|  34.1k|        int         cur_num_vertices, cur_num_edges;
 3236|  34.1k|        BNS_VERTEX *vert_ficpoint, *vert_ficpoint_prev, *vert_ficpoint_base;  /* fictitious vertex describing charge c-group */
 3237|  34.1k|        BNS_VERTEX *pv1, *pv2;
 3238|  34.1k|        BNS_EDGE   *edge;      /* edge between that vertex and the tautomeric c_point */
 3239|  34.1k|        int        nMaxCGroupNumber = 0;
 3240|  34.1k|        MY_CONST C_NODE *pCN;
  ------------------
  |  |  268|  34.1k|#define MY_CONST  const
  ------------------
 3241|  34.1k|        int              cn_len, cn_bits, bMetalAtoms;
 3242|  34.1k|        int              type;
 3243|  34.1k|        int        tot_st_cap, tot_st_flow;
 3244|  34.1k|        int        nAddGroups[16];
 3245|       |
 3246|       |
 3247|       |        /* Debug: check overflow */
 3248|  34.1k|        if (num_vertices >= pBNS->max_vertices)
  ------------------
  |  Branch (3248:13): [True: 0, False: 34.1k]
  ------------------
 3249|      0|        {
 3250|      0|            return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3251|      0|        }
 3252|       |
 3253|  34.1k|        nMaxCGroupNumber = num_cg;
 3254|       |        /* clear all vertices not used until now */
 3255|  34.1k|        memset( pBNS->vert + num_vertices, 0, ( (long long)pBNS->max_vertices - num_vertices ) * sizeof( pBNS->vert[0] ) ); /* djb-rwth: cast operator added; memset_s C11/Annex K variant? */
 3256|  34.1k|        tot_st_cap = pBNS->tot_st_cap;
 3257|  34.1k|        tot_st_flow = pBNS->tot_st_flow;
 3258|       |
 3259|       |        /*****************************************/
 3260|       |        /* initialize new fictitious vertices    */
 3261|       |        /* representing c-point groups, c-groups */
 3262|       |        /*****************************************/
 3263|  34.1k|        vert_ficpoint_prev = pBNS->vert + fst_cg_vertex - 1;
 3264|       |
 3265|   300k|        for (i = 0; i < num_cg; i++)
  ------------------
  |  Branch (3265:21): [True: 266k, False: 34.1k]
  ------------------
 3266|   266k|        {
 3267|       |            /*
 3268|       |              vert_ficpoint-1 is the last vertex;
 3269|       |              vert_ficpoint   is the being added vertex
 3270|       |              Note: nGroupNumber are not contiguous
 3271|       |            */
 3272|   266k|            vert_ficpoint = vert_ficpoint_prev + 1;
 3273|   266k|            vert_ficpoint->iedge = vert_ficpoint_prev->iedge + vert_ficpoint_prev->max_adj_edges;
 3274|   266k|            vert_ficpoint->max_adj_edges = pTCGroups->pTCG[i + fst_cg_group].num_edges + nMaxAddEdges;
 3275|   266k|            vert_ficpoint->num_adj_edges = 0;
 3276|       |
 3277|   266k|            vert_ficpoint->st_edge.flow += pTCGroups->pTCG[i + fst_cg_group].st_flow;
 3278|   266k|            tot_st_flow += pTCGroups->pTCG[i + fst_cg_group].st_flow;
 3279|   266k|            vert_ficpoint->st_edge.cap += pTCGroups->pTCG[i + fst_cg_group].st_cap;
 3280|   266k|            tot_st_cap += pTCGroups->pTCG[i + fst_cg_group].st_cap;
 3281|       |
 3282|   266k|            vert_ficpoint->st_edge.flow0 = vert_ficpoint->st_edge.flow;
 3283|   266k|            vert_ficpoint->st_edge.cap0 = vert_ficpoint->st_edge.cap;
 3284|       |
 3285|   266k|            vert_ficpoint->type = pTCGroups->pTCG[i + fst_cg_group].type;
 3286|       |            /* save the vertex number */
 3287|   266k|            pTCGroups->pTCG[i + fst_cg_group].nVertexNumber = (int) ( vert_ficpoint - pBNS->vert );
 3288|       |
 3289|   266k|            vert_ficpoint_prev = vert_ficpoint; /* keep track of iedges */
 3290|   266k|        }
 3291|       |
 3292|  34.1k|        cur_num_vertices = (int) ( vert_ficpoint_prev - pBNS->vert ) + 1;
 3293|  34.1k|        cur_num_edges = num_edges;
 3294|       |
 3295|       |        /*************************************************************/
 3296|       |        /* pass 1:                                                   */
 3297|       |        /* create ChargeStruct for c-points and connect them to      */
 3298|       |        /* the vertices representing c-point groups;                 */
 3299|       |        /* set final atom st_cap, st_flow                            */
 3300|       |        /*************************************************************/
 3301|   228k|        for (c_point = 0; c_point < num_atoms; c_point++)
  ------------------
  |  Branch (3301:27): [True: 194k, False: 34.1k]
  ------------------
 3302|   194k|        {
 3303|   194k|            if (!( k = pVA[c_point].cnListIndex ))
  ------------------
  |  Branch (3303:17): [True: 35.0k, False: 158k]
  ------------------
 3304|  35.0k|                continue;  /* not a c-point */
 3305|       |
 3306|   158k|            k--;
 3307|   158k|            pCN = cnList[k].pCN;   /* pointer to the ChargeStruct */
 3308|   158k|            cn_len = cnList[k].len;   /* length of the ChargeStruct  */
 3309|   158k|            cn_bits = cnList[k].bits;  /* bits: for M-recognition */
 3310|       |            /* cn_bits = cnList[k].bits; */ /* ChargeStruct type */
 3311|   158k|            bMetalAtoms = ( cn_bits == cn_bits_Me );
  ------------------
  |  |  440|   158k|#define cn_bits_Me (-1)
  ------------------
 3312|   158k|            vert_ficpoint_base = vert_ficpoint_prev; /* add aux vertices after this */
 3313|       |
 3314|       |            /* create disconnected auxiliary vertices of the at[c_point] ChargeStruct; add to them st_flow & st_cap */
 3315|   775k|            for (i1 = 0; i1 < cn_len; i1++)
  ------------------
  |  Branch (3315:26): [True: 617k, False: 158k]
  ------------------
 3316|   617k|            {
 3317|   617k|                if (!IS_BNS_VT_CHRG_STRUCT( pCN[i1].v.type ))
  ------------------
  |  |   82|   617k|#define IS_BNS_VT_CHRG_STRUCT(X)    (((X) & BNS_VERT_TYPE__AUX) &&  ((X) & BNS_VERT_TYPE_TEMP))
  |  |  ------------------
  |  |  |  |   53|   617k|#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))
  |  |  ------------------
  |  |  |  |   51|   175k|#define BNS_VERT_TYPE_TEMP          0x0040
  |  |  ------------------
  |  |  |  Branch (82:38): [True: 175k, False: 441k]
  |  |  |  Branch (82:69): [True: 175k, False: 0]
  |  |  ------------------
  ------------------
 3318|   441k|                {
 3319|   441k|                    continue;
 3320|   441k|                }
 3321|       |                /* the atom is always the first; the attached c-points are always the last */
 3322|   175k|                vert_ficpoint = vert_ficpoint_base + i1; /* i1 = 1, 2,.. less number of attached c-points */
 3323|   175k|                vert_ficpoint->iedge = vert_ficpoint_prev->iedge + vert_ficpoint_prev->max_adj_edges;
 3324|   175k|                vert_ficpoint->max_adj_edges = pCN[i1].v.valence; /* do not add additional edges to aux vertices */
 3325|   175k|                vert_ficpoint->num_adj_edges = 0;
 3326|       |
 3327|   175k|                cap = !bMetalAtoms ? pCN[i1].v.cap : pCN[i1].v.cap ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (3327:23): [True: 151k, False: 24.3k]
  |  Branch (3327:54): [True: 24.3k, False: 0]
  ------------------
 3328|   175k|                flow = !bMetalAtoms ? pCN[i1].v.flow : pCN[i1].v.flow ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (3328:24): [True: 151k, False: 24.3k]
  |  Branch (3328:56): [True: 24.3k, False: 0]
  ------------------
 3329|       |
 3330|   175k|                AddStCapFlow( vert_ficpoint, &tot_st_flow, &tot_st_cap, cap, flow );
 3331|   175k|                vert_ficpoint->type = pCN[i1].v.type; /* =BNS_VERT_TYPE__AUX */
 3332|       |
 3333|   175k|                vert_ficpoint_prev = vert_ficpoint; /* the last one will be vert_ficpoint for the next c-point */
 3334|   175k|                cur_num_vertices = (int) ( vert_ficpoint - pBNS->vert ) + 1;
 3335|       |
 3336|   175k|                if (vert_ficpoint->iedge + vert_ficpoint->max_adj_edges - pBNS->iedge >= pBNS->max_iedges)
  ------------------
  |  Branch (3336:21): [True: 0, False: 175k]
  ------------------
 3337|      0|                {
 3338|      0|                    return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3339|      0|                }
 3340|   175k|                if (cur_num_vertices >= pBNS->max_vertices)
  ------------------
  |  Branch (3340:21): [True: 0, False: 175k]
  ------------------
 3341|      0|                {
 3342|      0|                    return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3343|      0|                }
 3344|   175k|            }
 3345|       |
 3346|       |            /* connect the vertices with new edges, add edge flow and cap */
 3347|   775k|            for (i1 = 0; i1 < cn_len; i1++)
  ------------------
  |  Branch (3347:26): [True: 617k, False: 158k]
  ------------------
 3348|   617k|            {
 3349|   617k|                pv1 = NULL;
 3350|   617k|                k1 = -1;
 3351|       |
 3352|       |                /* find vertex corresponding to i1 */
 3353|       |
 3354|   617k|                if (pCN[i1].v.type & BNS_VERT_TYPE_ATOM)
  ------------------
  |  |   45|   617k|#define BNS_VERT_TYPE_ATOM          0x0001
  ------------------
  |  Branch (3354:21): [True: 158k, False: 458k]
  ------------------
 3355|   158k|                {
 3356|   158k|                    pv1 = pBNS->vert + c_point; /* may be only one atom -- the current c_point at i1==0 */
 3357|       |                    /* add atom vertex st_cap and st_flow */
 3358|   158k|                    cap = !bMetalAtoms ? pCN[i1].v.cap : pCN[i1].v.cap ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (3358:27): [True: 134k, False: 24.3k]
  |  Branch (3358:58): [True: 0, False: 24.3k]
  ------------------
 3359|   158k|                    flow = !bMetalAtoms ? pCN[i1].v.flow : pCN[i1].v.flow ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (3359:28): [True: 134k, False: 24.3k]
  |  Branch (3359:60): [True: 0, False: 24.3k]
  ------------------
 3360|   158k|                    AddStCapFlow( pv1, &tot_st_flow, &tot_st_cap, cap, flow );
 3361|   158k|                }
 3362|       |
 3363|   458k|                else if (IS_BNS_VT_C_GR( pCN[i1].v.type ))
  ------------------
  |  |   78|   458k|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   71|   458k|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|   458k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|   458k|#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)
  |  |  ------------------
  |  |  |  |   49|   458k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (78:37): [True: 258k, False: 199k]
  |  |  ------------------
  ------------------
 3364|   258k|                {
 3365|       |                    /* find c-group vertex by looking for its type */
 3366|   639k|                    for (j = 0; j < num_cg; j++)
  ------------------
  |  Branch (3366:33): [True: 639k, False: 0]
  ------------------
 3367|   639k|                    {
 3368|   639k|                        if (pCN[i1].v.type == pBNS->vert[fst_cg_vertex + j].type)
  ------------------
  |  Branch (3368:29): [True: 258k, False: 381k]
  ------------------
 3369|   258k|                        {
 3370|   258k|                            pv1 = pBNS->vert + fst_cg_vertex + j;
 3371|   258k|                            break;
 3372|   258k|                        }
 3373|   639k|                    }
 3374|       |                    /* index of the pTCGroups->pTCG[] */
 3375|   258k|                    if (pv1)
  ------------------
  |  Branch (3375:25): [True: 258k, False: 0]
  ------------------
 3376|   258k|                    {
 3377|   258k|                        k1 = j + fst_cg_group;
 3378|   258k|                        if (pTCGroups->pTCG[k1].type != pCN[i1].v.type ||
  ------------------
  |  Branch (3378:29): [True: 0, False: 258k]
  ------------------
 3379|   258k|                             pTCGroups->pTCG[k1].ord_num)
  ------------------
  |  Branch (3379:30): [True: 0, False: 258k]
  ------------------
 3380|      0|                        {
 3381|      0|                            return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3382|      0|                        }
 3383|   258k|                    }
 3384|   258k|                }
 3385|       |
 3386|   199k|                else if (IS_BNS_VT_M_GR( pCN[i1].v.type ))
  ------------------
  |  |   80|   199k|#define IS_BNS_VT_M_GR(X)           ((X) == BNS_VERT_TYPE_METAL_GR )  /* metal flower base or vertices */
  |  |  ------------------
  |  |  |  |   57|   199k|#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 (80:37): [True: 24.3k, False: 175k]
  |  |  ------------------
  ------------------
 3387|  24.3k|                {
 3388|  24.3k|                    k1 = pTCGroups->nGroup[TCG_MeFlower0];
 3389|  24.3k|                    if (k1 < 0 ||
  ------------------
  |  Branch (3389:25): [True: 0, False: 24.3k]
  ------------------
 3390|  24.3k|                         pTCGroups->pTCG[k1].type != pCN[i1].v.type ||
  ------------------
  |  Branch (3390:26): [True: 0, False: 24.3k]
  ------------------
 3391|  24.3k|                             pTCGroups->pTCG[k1].ord_num ||
  ------------------
  |  Branch (3391:30): [True: 0, False: 24.3k]
  ------------------
 3392|  24.3k|                             !pSrm->bMetalAddFlower)
  ------------------
  |  Branch (3392:30): [True: 0, False: 24.3k]
  ------------------
 3393|      0|                    {
 3394|      0|                        return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3395|      0|                    }
 3396|  24.3k|                    pv1 = pBNS->vert + pTCGroups->pTCG[k1].nVertexNumber;
 3397|  24.3k|                }
 3398|       |
 3399|   175k|                else if (IS_BNS_VT_CHRG_STRUCT( pCN[i1].v.type ))
  ------------------
  |  |   82|   175k|#define IS_BNS_VT_CHRG_STRUCT(X)    (((X) & BNS_VERT_TYPE__AUX) &&  ((X) & BNS_VERT_TYPE_TEMP))
  |  |  ------------------
  |  |  |  |   53|   175k|#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))
  |  |  ------------------
  |  |  |  |   51|   175k|#define BNS_VERT_TYPE_TEMP          0x0040
  |  |  ------------------
  |  |  |  Branch (82:38): [True: 175k, False: 0]
  |  |  |  Branch (82:69): [True: 175k, False: 0]
  |  |  ------------------
  ------------------
 3400|   175k|                {
 3401|       |                    /* aux vertex */
 3402|   175k|                    pv1 = vert_ficpoint_base + i1;
 3403|   175k|                }
 3404|       |
 3405|   617k|                if (!pv1)
  ------------------
  |  Branch (3405:21): [True: 0, False: 617k]
  ------------------
 3406|      0|                {
 3407|      0|                    return BNS_BOND_ERR;
  ------------------
  |  |   52|      0|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3408|      0|                }
 3409|       |
 3410|       |                /* connect pairs of vertices with new edges */
 3411|  1.09M|                for (k = 0; k < MAX_CN_VAL && ( i2 = pCN[i1].e[k].neigh ); k++)
  ------------------
  |  |  397|  2.19M|#define MAX_CN_VAL 3
  ------------------
  |  Branch (3411:29): [True: 1.09M, False: 0]
  |  Branch (3411:47): [True: 478k, False: 617k]
  ------------------
 3412|   478k|                {
 3413|   478k|                    pv2 = NULL;
 3414|   478k|                    k2 = -1;
 3415|   478k|                    i2--; /* neighbor */
 3416|       |
 3417|       |                    /* find vertex corresponding to i2 */
 3418|       |
 3419|   478k|                    if (pCN[i2].v.type & BNS_VERT_TYPE_ATOM)
  ------------------
  |  |   45|   478k|#define BNS_VERT_TYPE_ATOM          0x0001
  ------------------
  |  Branch (3419:25): [True: 24.3k, False: 453k]
  ------------------
 3420|  24.3k|                    {
 3421|  24.3k|                        pv2 = pBNS->vert + c_point;
 3422|  24.3k|                        cap = !bMetalAtoms ? pCN[i2].v.cap : pCN[i2].v.cap ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (3422:31): [True: 0, False: 24.3k]
  |  Branch (3422:62): [True: 0, False: 24.3k]
  ------------------
 3423|  24.3k|                        flow = !bMetalAtoms ? pCN[i2].v.flow : pCN[i2].v.flow ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (3423:32): [True: 0, False: 24.3k]
  |  Branch (3423:64): [True: 0, False: 24.3k]
  ------------------
 3424|       |                        /* add atom vertex st_cap and st_flow; this normally should not happen */
 3425|  24.3k|                        AddStCapFlow( pv2, &tot_st_flow, &tot_st_cap, cap, flow );
 3426|  24.3k|                    }
 3427|       |
 3428|   453k|                    else if (IS_BNS_VT_C_GR( pCN[i2].v.type ))
  ------------------
  |  |   78|   453k|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   71|   453k|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|   453k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|   453k|#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)
  |  |  ------------------
  |  |  |  |   49|   453k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (78:37): [True: 258k, False: 195k]
  |  |  ------------------
  ------------------
 3429|   258k|                    {
 3430|       |                        /* find c-group vertex by looking for its type */
 3431|   639k|                        for (j = 0; j < num_cg; j++)
  ------------------
  |  Branch (3431:37): [True: 639k, False: 0]
  ------------------
 3432|   639k|                        {
 3433|   639k|                            if (pCN[i2].v.type == pBNS->vert[fst_cg_vertex + j].type)
  ------------------
  |  Branch (3433:33): [True: 258k, False: 381k]
  ------------------
 3434|   258k|                            {
 3435|   258k|                                pv2 = pBNS->vert + fst_cg_vertex + j;
 3436|   258k|                                break;
 3437|   258k|                            }
 3438|   639k|                        }
 3439|   258k|                        if (pv2)
  ------------------
  |  Branch (3439:29): [True: 258k, False: 0]
  ------------------
 3440|   258k|                        {
 3441|   258k|                            k2 = j + fst_cg_group;
 3442|   258k|                            if (pTCGroups->pTCG[k2].type != pCN[i2].v.type ||
  ------------------
  |  Branch (3442:33): [True: 0, False: 258k]
  ------------------
 3443|   258k|                                 pTCGroups->pTCG[k2].ord_num)
  ------------------
  |  Branch (3443:34): [True: 0, False: 258k]
  ------------------
 3444|      0|                            {
 3445|      0|                                return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3446|      0|                            }
 3447|   258k|                        }
 3448|   258k|                    }
 3449|       |
 3450|   195k|                    else if (IS_BNS_VT_M_GR( pCN[i2].v.type ))
  ------------------
  |  |   80|   195k|#define IS_BNS_VT_M_GR(X)           ((X) == BNS_VERT_TYPE_METAL_GR )  /* metal flower base or vertices */
  |  |  ------------------
  |  |  |  |   57|   195k|#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 (80:37): [True: 0, False: 195k]
  |  |  ------------------
  ------------------
 3451|      0|                    {
 3452|      0|                        k2 = pTCGroups->nGroup[TCG_MeFlower0];
 3453|      0|                        if (k2 < 0 ||
  ------------------
  |  Branch (3453:29): [True: 0, False: 0]
  ------------------
 3454|      0|                             pTCGroups->pTCG[k2].type != pCN[i2].v.type ||
  ------------------
  |  Branch (3454:30): [True: 0, False: 0]
  ------------------
 3455|      0|                                 pTCGroups->pTCG[k2].ord_num ||
  ------------------
  |  Branch (3455:34): [True: 0, False: 0]
  ------------------
 3456|      0|                                 !pSrm->bMetalAddFlower)
  ------------------
  |  Branch (3456:34): [True: 0, False: 0]
  ------------------
 3457|      0|                        {
 3458|      0|                            return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3459|      0|                        }
 3460|      0|                        pv2 = pBNS->vert + pTCGroups->pTCG[k2].nVertexNumber;
 3461|      0|                    }
 3462|       |
 3463|   195k|                    else if (IS_BNS_VT_CHRG_STRUCT( pCN[i2].v.type ))
  ------------------
  |  |   82|   195k|#define IS_BNS_VT_CHRG_STRUCT(X)    (((X) & BNS_VERT_TYPE__AUX) &&  ((X) & BNS_VERT_TYPE_TEMP))
  |  |  ------------------
  |  |  |  |   53|   195k|#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))
  |  |  ------------------
  |  |  |  |   51|   195k|#define BNS_VERT_TYPE_TEMP          0x0040
  |  |  ------------------
  |  |  |  Branch (82:38): [True: 195k, False: 0]
  |  |  |  Branch (82:69): [True: 195k, False: 0]
  |  |  ------------------
  ------------------
 3464|   195k|                    {
 3465|   195k|                        pv2 = vert_ficpoint_base + i2;
 3466|   195k|                    }
 3467|       |
 3468|       |                    /* connect pv1 and pv2 */
 3469|   478k|                    if (!pv1 || !pv2 || pv1 == pv2)
  ------------------
  |  Branch (3469:25): [True: 0, False: 478k]
  |  Branch (3469:33): [True: 0, False: 478k]
  |  Branch (3469:41): [True: 0, False: 478k]
  ------------------
 3470|      0|                    {
 3471|      0|                        return BNS_BOND_ERR;
  ------------------
  |  |   52|      0|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3472|      0|                    }
 3473|       |
 3474|   478k|                    j1 = (int)(pv1 - pBNS->vert);
 3475|   478k|                    j2 = (int)(pv2 - pBNS->vert);
 3476|       |
 3477|       |                    /* create a new edge connecting pv1 and pv2 */
 3478|   478k|                    edge = pBNS->edge + cur_num_edges;
 3479|   478k|                    if ((IS_BNS_VT_M_GR( pCN[i1].v.type ) && IS_BNS_VT_ATOM( pCN[i2].v.type )) ||
  ------------------
  |  |   80|   956k|#define IS_BNS_VT_M_GR(X)           ((X) == BNS_VERT_TYPE_METAL_GR )  /* metal flower base or vertices */
  |  |  ------------------
  |  |  |  |   57|   478k|#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 (80:37): [True: 24.3k, False: 453k]
  |  |  ------------------
  ------------------
                                  if ((IS_BNS_VT_M_GR( pCN[i1].v.type ) && IS_BNS_VT_ATOM( pCN[i2].v.type )) ||
  ------------------
  |  |   83|  24.3k|#define IS_BNS_VT_ATOM(X)           ((X) & BNS_VERT_TYPE_ATOM)
  |  |  ------------------
  |  |  |  |   45|  24.3k|#define BNS_VERT_TYPE_ATOM          0x0001
  |  |  ------------------
  |  |  |  Branch (83:37): [True: 24.3k, False: 0]
  |  |  ------------------
  ------------------
 3480|   453k|                         (IS_BNS_VT_M_GR( pCN[i2].v.type ) && IS_BNS_VT_ATOM( pCN[i1].v.type ))) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |   80|   907k|#define IS_BNS_VT_M_GR(X)           ((X) == BNS_VERT_TYPE_METAL_GR )  /* metal flower base or vertices */
  |  |  ------------------
  |  |  |  |   57|   453k|#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 (80:37): [True: 0, False: 453k]
  |  |  ------------------
  ------------------
                                       (IS_BNS_VT_M_GR( pCN[i2].v.type ) && IS_BNS_VT_ATOM( pCN[i1].v.type ))) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |   83|      0|#define IS_BNS_VT_ATOM(X)           ((X) & BNS_VERT_TYPE_ATOM)
  |  |  ------------------
  |  |  |  |   45|      0|#define BNS_VERT_TYPE_ATOM          0x0001
  |  |  ------------------
  |  |  |  Branch (83:37): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3481|  24.3k|                    {
 3482|       |                        /* at[c_point] is a metal or is treated as a metal; connect it to M-group */
 3483|       |                        /* metal - M-group (i.e. Metal-Flower) edge */
 3484|  24.3k|                        int nStCap, nStFlow;
 3485|  24.3k|                        bNeedsFlower = AtomStcapStflow( at, pVA, pSrm, c_point, &nStCap, &nStFlow, &edge->cap, &edge->flow );
 3486|       |                        /* GetAtomToMCGroupInitEdgeCapFlow( &edge->cap, &edge->flow, pSrm, at, pVA, c_point ); */
 3487|  24.3k|                        if (!bNeedsFlower)
  ------------------
  |  Branch (3487:29): [True: 0, False: 24.3k]
  ------------------
 3488|      0|                        {
 3489|      0|                            return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3490|      0|                        }
 3491|  24.3k|                        pVA[c_point].nMetalGroupEdge = cur_num_edges + 1;
 3492|       |                        /* pBNS->vert[c_point].st_edge.cap  += edge->flow;*/ /* where was this done ???*/
 3493|  24.3k|                        pBNS->vert[c_point].st_edge.flow += edge->flow;
 3494|  24.3k|                        pBNS->vert[c_point].st_edge.cap += edge->flow + pVA[c_point].cInitFreeValences;
 3495|  24.3k|                        pBNS->vert[c_point].st_edge.flow0 = pBNS->vert[c_point].st_edge.flow;
 3496|  24.3k|                        pBNS->vert[c_point].st_edge.cap0 = pBNS->vert[c_point].st_edge.cap;
 3497|  24.3k|                        tot_st_flow += edge->flow;
 3498|  24.3k|                        tot_st_cap += edge->flow + pVA[c_point].cInitFreeValences;
 3499|  24.3k|                    }
 3500|   453k|                    else
 3501|   453k|                    {
 3502|   453k|                        edge->cap = !bMetalAtoms ? pCN[i1].e[k].cap : pCN[i1].e[k].cap ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (3502:37): [True: 380k, False: 72.9k]
  |  Branch (3502:71): [True: 72.9k, False: 0]
  ------------------
 3503|   453k|                        edge->flow = !bMetalAtoms ? pCN[i1].e[k].flow : pCN[i1].e[k].flow ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (3503:38): [True: 380k, False: 72.9k]
  |  Branch (3503:73): [True: 24.3k, False: 48.6k]
  ------------------
 3504|   453k|                    }
 3505|       |
 3506|   478k|                    edge->forbidden = pCN[i1].e[k].bForbiddenEdge ? BNS_EDGE_FORBIDDEN_MASK : 0;
  ------------------
  |  |   39|  5.04k|#define BNS_EDGE_FORBIDDEN_MASK  1
  ------------------
  |  Branch (3506:39): [True: 5.04k, False: 473k]
  ------------------
 3507|       |
 3508|       |                    /* c-group incoming edges cap and flow needed in ConnectSuperCGroup() */
 3509|       |                    /*
 3510|       |                    if ( k1 >= 0 ) {
 3511|       |                        pTCGroups->pTCG[k1].edges_cap  += pCN[i1].e[k].cap;
 3512|       |                        pTCGroups->pTCG[k1].edges_flow += pCN[i1].e[k].flow;
 3513|       |                    }
 3514|       |                    if ( k2 >= 0 ) {
 3515|       |                        pTCGroups->pTCG[k2].edges_cap  += pCN[i1].e[k].cap;
 3516|       |                        pTCGroups->pTCG[k2].edges_flow += pCN[i1].e[k].flow;
 3517|       |                    }
 3518|       |                    */
 3519|       |
 3520|   478k|                    edge->pass = 0;
 3521|       |
 3522|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 1 )
 3523|       |                    edge->forbidden &= pBNS->edge_forbidden_mask;
 3524|       |#endif
 3525|       |
 3526|       |                    /* check edge overflow */
 3527|   478k|                    if (pv1->num_adj_edges >= pv1->max_adj_edges ||
  ------------------
  |  Branch (3527:25): [True: 0, False: 478k]
  ------------------
 3528|   478k|                         pv2->num_adj_edges >= pv2->max_adj_edges ||
  ------------------
  |  Branch (3528:26): [True: 0, False: 478k]
  ------------------
 3529|   478k|                         cur_num_edges >= pBNS->max_edges)
  ------------------
  |  Branch (3529:26): [True: 0, False: 478k]
  ------------------
 3530|      0|                    {
 3531|      0|                        return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3532|      0|                    }
 3533|       |
 3534|       |                    /* connect edge to the incident vertices and increment the counters of neighbors and edges */
 3535|       |
 3536|   478k|                    ret = ConnectTwoVertices( pv1, pv2, edge, pBNS, 0 );
 3537|       |
 3538|   478k|                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|   478k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   478k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   478k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   478k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 478k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 478k]
  |  |  ------------------
  ------------------
 3539|      0|                    {
 3540|      0|                        return ret;
 3541|      0|                    }
 3542|       |
 3543|   478k|                    edge->cap0 = edge->cap;
 3544|   478k|                    edge->flow0 = edge->flow;
 3545|       |
 3546|       |                    /* save the edge index */
 3547|   478k|                    type = IS_BNS_VT_C_GR( pv1->type ) ? pv1->type :
  ------------------
  |  |   78|   478k|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   71|   478k|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|   478k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|   478k|#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)
  |  |  ------------------
  |  |  |  |   49|   478k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (78:37): [True: 0, False: 478k]
  |  |  ------------------
  ------------------
 3548|   478k|                        IS_BNS_VT_C_GR( pv2->type ) ? pv2->type : 0;
  ------------------
  |  |   78|   478k|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   71|   478k|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|   478k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|   478k|#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)
  |  |  ------------------
  |  |  |  |   49|   478k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (78:37): [True: 258k, False: 220k]
  |  |  ------------------
  ------------------
 3549|   478k|                    if (type)
  ------------------
  |  Branch (3549:25): [True: 258k, False: 220k]
  ------------------
 3550|   258k|                    {
 3551|       |                        /* the edge connects to a c-group */
 3552|   258k|                        if (type & BNS_VERT_TYPE_C_NEGATIVE)
  ------------------
  |  |   54|   258k|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  ------------------
  |  Branch (3552:29): [True: 120k, False: 138k]
  ------------------
 3553|   120k|                        {
 3554|   120k|                            pVA[c_point].nCMinusGroupEdge = cur_num_edges + 1;
 3555|   120k|                        }
 3556|   138k|                        else
 3557|   138k|                        {
 3558|   138k|                            pVA[c_point].nCPlusGroupEdge = cur_num_edges + 1;
 3559|   138k|                        }
 3560|   258k|                    }
 3561|   478k|                    cur_num_edges++; /* end of new edge creation */
 3562|   478k|                }
 3563|   617k|            }
 3564|   158k|        }
 3565|       |
 3566|       |
 3567|       |        /*************************************************************/
 3568|       |        /* pass 2:                                                   */
 3569|       |        /* adjust bond cap, flow from the final atom st_cap, st_flow */
 3570|       |        /*************************************************************/
 3571|   228k|        for (c_point = 0; c_point < num_atoms; c_point++)
  ------------------
  |  Branch (3571:27): [True: 194k, False: 34.1k]
  ------------------
 3572|   194k|        {
 3573|   194k|            int st_cap, st_cap2, max_edge_flow;
 3574|   194k|            pv1 = pBNS->vert + c_point;  /* atom vertex */
 3575|   194k|            st_cap = pv1->st_edge.cap;
 3576|   782k|            for (k = 0; k < pv1->num_adj_edges; k++)
  ------------------
  |  Branch (3576:25): [True: 588k, False: 194k]
  ------------------
 3577|   588k|            {
 3578|   588k|                edge = pBNS->edge + pv1->iedge[k];      /* incident edge */
 3579|   588k|                c_neigh = edge->neighbor12 ^ c_point;   /* adjacent vertex */
 3580|   588k|                pv2 = pBNS->vert + c_neigh;
 3581|   588k|                if (c_neigh > c_point || !( pv2->type & BNS_VERT_TYPE_ATOM ))
  ------------------
  |  |   45|   168k|#define BNS_VERT_TYPE_ATOM          0x0001
  ------------------
  |  Branch (3581:21): [True: 419k, False: 168k]
  |  Branch (3581:42): [True: 0, False: 168k]
  ------------------
 3582|   419k|                {
 3583|   419k|                    continue;
 3584|   419k|                }
 3585|       |                /* adjacent vertex is an atom; the edge is a bond; process each bond only once */
 3586|   168k|                st_cap2 = pv2->st_edge.cap;
 3587|       |                /* the edge flow <= min( incident atom st_caps) */
 3588|   168k|                max_edge_flow = inchi_min( st_cap, st_cap2 );
  ------------------
  |  |  139|   168k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 68.9k, False: 99.8k]
  |  |  ------------------
  ------------------
 3589|       |                /* bond order <= triple bond (flow=2) */
 3590|   168k|                if (((pSrm->bMetalAddFlower && !pSrm->nMetalMinBondOrder &&
  ------------------
  |  Branch (3590:23): [True: 168k, False: 0]
  |  Branch (3590:48): [True: 168k, False: 0]
  ------------------
 3591|   168k|                    ( pVA[c_point].cMetal && pVA[c_point].cNumBondsToMetal)) ||
  ------------------
  |  Branch (3591:23): [True: 22.0k, False: 146k]
  |  Branch (3591:46): [True: 22.0k, False: 0]
  ------------------
 3592|   146k|                        (pVA[c_neigh].cMetal && pVA[c_neigh].cNumBondsToMetal) )) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (3592:26): [True: 16.6k, False: 130k]
  |  Branch (3592:49): [True: 16.6k, False: 0]
  ------------------
 3593|  38.7k|                {
 3594|  38.7k|                    max_edge_flow = inchi_min( max_edge_flow, MAX_BOND_EDGE_CAP + 1 );
  ------------------
  |  |  139|  38.7k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 11.9k, False: 26.7k]
  |  |  ------------------
  ------------------
 3595|  38.7k|                }
 3596|   130k|                else
 3597|   130k|                {
 3598|   130k|                    max_edge_flow = inchi_min( max_edge_flow, MAX_BOND_EDGE_CAP );
  ------------------
  |  |  139|   130k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 64.9k, False: 65.0k]
  |  |  ------------------
  ------------------
 3599|   130k|                }
 3600|   168k|                if (at[c_point].bond_type[k] == BOND_TYPE_SINGLE)
  ------------------
  |  |   32|   168k|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (3600:21): [True: 168k, False: 464]
  ------------------
 3601|   168k|                {
 3602|       |                    /* the bond has not been changed due to stereo */
 3603|   168k|                    edge->cap = edge->cap0 = max_edge_flow;
 3604|   168k|                }
 3605|   168k|            }
 3606|   194k|        }
 3607|       |
 3608|       |        /***********************************************************/
 3609|       |        /**************                                 ************/
 3610|       |        /************** connect M-flower with new edges ************/
 3611|       |        /**************                                 ************/
 3612|       |        /***********************************************************/
 3613|       |
 3614|  34.1k|        ret = ConnectMetalFlower( &cur_num_vertices, &cur_num_edges, &tot_st_cap, &tot_st_flow, pSrm, pBNS, pTCGroups );
 3615|       |
 3616|  34.1k|        if (ret < 0)
  ------------------
  |  Branch (3616:13): [True: 0, False: 34.1k]
  ------------------
 3617|      0|        {
 3618|      0|            goto exit_function;
 3619|      0|        }
 3620|       |
 3621|       |        /***********************************************************/
 3622|       |        /**************                                 ************/
 3623|       |        /************** add additional vertices & edges ************/
 3624|       |        /************** to connect c-groups             ************/
 3625|       |        /**************                                 ************/
 3626|       |        /***********************************************************/
 3627|       |
 3628|       |        /* (+) supergroup, Y-connection */
 3629|       |
 3630|  34.1k|        k = 0;
 3631|  34.1k|        nAddGroups[k++] = TCG_Plus0;
 3632|  34.1k|        nAddGroups[k++] = TCG_Plus_C0;
 3633|  34.1k|        nAddGroups[k++] = TCG_Plus_M0;
 3634|       |
 3635|  34.1k|        ret1 = ConnectSuperCGroup( TCG_Plus,
 3636|  34.1k|                                   nAddGroups,
 3637|  34.1k|                                   k,
 3638|  34.1k|                                   &cur_num_vertices,
 3639|  34.1k|                                   &cur_num_edges,
 3640|  34.1k|                                   &tot_st_cap,
 3641|  34.1k|                                   &tot_st_flow,
 3642|  34.1k|                                   pBNS,
 3643|  34.1k|                                   pTCGroups ); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 3644|       |
 3645|       |        /* (-) supergroup, Y-connection */
 3646|       |
 3647|  34.1k|        k = 0;
 3648|  34.1k|        nAddGroups[k++] = TCG_Minus0;
 3649|  34.1k|        nAddGroups[k++] = TCG_Minus_C0;
 3650|  34.1k|        nAddGroups[k++] = TCG_Minus_M0;
 3651|       |
 3652|  34.1k|        ret2 = ConnectSuperCGroup( TCG_Minus,
 3653|  34.1k|                                   nAddGroups,
 3654|  34.1k|                                   k,
 3655|  34.1k|                                   &cur_num_vertices,
 3656|  34.1k|                                   &cur_num_edges,
 3657|  34.1k|                                   &tot_st_cap,
 3658|  34.1k|                                   &tot_st_flow,
 3659|  34.1k|                                   pBNS,
 3660|  34.1k|                                   pTCGroups ); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 3661|       |
 3662|       |        /******** connect (+) and (-) ***************/
 3663|       |
 3664|  34.1k|        k = 0;
 3665|  34.1k|        nAddGroups[k++] = TCG_Plus;
 3666|  34.1k|        nAddGroups[k++] = TCG_Minus;
 3667|       |
 3668|  34.1k|        ret3 = ConnectSuperCGroup( -1,
 3669|  34.1k|                                    nAddGroups,
 3670|  34.1k|                                    k,
 3671|  34.1k|                                    &cur_num_vertices,
 3672|  34.1k|                                    &cur_num_edges,
 3673|  34.1k|                                    &tot_st_cap,
 3674|  34.1k|                                    &tot_st_flow,
 3675|  34.1k|                                    pBNS,
 3676|  34.1k|                                    pTCGroups );
 3677|       |
 3678|       |        /* Take care of the full charge */
 3679|       |
 3680|  34.1k|        cg_charge = pTCGroups->total_charge - pTCGroups->tgroup_charge - pTCGroups->charge_on_atoms;
 3681|  34.1k|        ret = 1;
 3682|  34.1k|        if (ret3 > 0)
  ------------------
  |  Branch (3682:13): [True: 34.1k, False: 0]
  ------------------
 3683|  34.1k|        {
 3684|       |            /* (+) and (-) or at least one of them have been connected */
 3685|  34.1k|            int nVertPlusMinus = cur_num_vertices - 1;
 3686|  34.1k|            BNS_VERTEX *pVertPlusMinus = pBNS->vert + nVertPlusMinus;
 3687|  34.1k|            BNS_VERTEX *pVertPlus = NULL, *pVertMinus = NULL, *pVert = NULL;
 3688|  34.1k|            BNS_EDGE   *pEdgePlus = NULL, *pEdgeMinus = NULL, *pEdge = NULL;
 3689|  34.1k|            n = pTCGroups->nGroup[TCG_Plus] >= 0;   /* (+)-supergroup exists */
 3690|  34.1k|            k = pTCGroups->nGroup[TCG_Minus] >= 0;  /* (-)-supergroup exists */
 3691|       |
 3692|  34.1k|            if (pVertPlusMinus->num_adj_edges == 2 && k + n == 2)
  ------------------
  |  Branch (3692:17): [True: 33.0k, False: 1.10k]
  |  Branch (3692:55): [True: 33.0k, False: 0]
  ------------------
 3693|  33.0k|            {
 3694|  33.0k|                pEdgePlus = pBNS->edge + pVertPlusMinus->iedge[0];  /* TCG_Plus was the 1st */
 3695|  33.0k|                pEdgeMinus = pBNS->edge + pVertPlusMinus->iedge[1];  /* TCG_Minus was the 2nd */
 3696|  33.0k|            }
 3697|       |
 3698|  1.10k|            else if (pVertPlusMinus->num_adj_edges == 1 && k + n == 1)
  ------------------
  |  Branch (3698:22): [True: 1.10k, False: 0]
  |  Branch (3698:60): [True: 1.10k, False: 0]
  ------------------
 3699|  1.10k|            {
 3700|  1.10k|                if (pTCGroups->nGroup[TCG_Plus] >= 0)
  ------------------
  |  Branch (3700:21): [True: 901, False: 203]
  ------------------
 3701|    901|                {
 3702|    901|                    pEdgePlus = pBNS->edge + pVertPlusMinus->iedge[0];
 3703|    901|                }
 3704|    203|                else if (pTCGroups->nGroup[TCG_Minus] >= 0)
  ------------------
  |  Branch (3704:26): [True: 203, False: 0]
  ------------------
 3705|    203|                {
 3706|    203|                    pEdgeMinus = pBNS->edge + pVertPlusMinus->iedge[0];
 3707|    203|                }
 3708|  1.10k|            }
 3709|       |
 3710|      0|            else if (k + n)
  ------------------
  |  Branch (3710:22): [True: 0, False: 0]
  ------------------
 3711|      0|            {
 3712|       |                /* program error check */
 3713|      0|                ret = BNS_BOND_ERR;
  ------------------
  |  |   52|      0|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3714|      0|                goto exit_function;
 3715|      0|            }
 3716|       |
 3717|  34.1k|            if (pEdgePlus)
  ------------------
  |  Branch (3717:17): [True: 33.9k, False: 203]
  ------------------
 3718|  33.9k|            {
 3719|  33.9k|                pVertPlus = pBNS->vert + ( pEdgePlus->neighbor12 ^ nVertPlusMinus );
 3720|  33.9k|            }
 3721|  34.1k|            if (pEdgeMinus)
  ------------------
  |  Branch (3721:17): [True: 33.2k, False: 901]
  ------------------
 3722|  33.2k|            {
 3723|  33.2k|                pVertMinus = pBNS->vert + ( pEdgeMinus->neighbor12 ^ nVertPlusMinus );
 3724|  33.2k|            }
 3725|       |
 3726|  34.1k|            pVert = pVertPlus ? pVertPlus : pVertMinus ? pVertMinus : NULL;
  ------------------
  |  Branch (3726:21): [True: 33.9k, False: 203]
  |  Branch (3726:45): [True: 203, False: 0]
  ------------------
 3727|  34.1k|            pEdge = pEdgePlus ? pEdgePlus : pEdgeMinus ? pEdgeMinus : NULL;
  ------------------
  |  Branch (3727:21): [True: 33.9k, False: 203]
  |  Branch (3727:45): [True: 203, False: 0]
  ------------------
 3728|  34.1k|            if (pEdgeMinus)
  ------------------
  |  Branch (3728:17): [True: 33.2k, False: 901]
  ------------------
 3729|  33.2k|            {
 3730|  33.2k|                pTCGroups->nEdgeMinus = (int) ( pEdgeMinus - pBNS->edge );
 3731|  33.2k|            }
 3732|  34.1k|            if (pEdgePlus)
  ------------------
  |  Branch (3732:17): [True: 33.9k, False: 203]
  ------------------
 3733|  33.9k|            {
 3734|  33.9k|                pTCGroups->nEdgePlus = (int) ( pEdgePlus - pBNS->edge );
 3735|  33.9k|            }
 3736|  34.1k|            if (pEdge)
  ------------------
  |  Branch (3736:17): [True: 34.1k, False: 0]
  ------------------
 3737|  34.1k|            {
 3738|  34.1k|                pTCGroups->nEdge4charge = (int) ( pEdge - pBNS->edge );
 3739|  34.1k|            }
 3740|       |
 3741|       |            /* set total charge */
 3742|       |
 3743|  34.1k|            if (pVert && pEdge)
  ------------------
  |  Branch (3743:17): [True: 34.1k, False: 0]
  |  Branch (3743:26): [True: 34.1k, False: 0]
  ------------------
 3744|  34.1k|            {
 3745|       |                /* do not check rescaps for now */
 3746|  34.1k|                if (cg_charge > 0)
  ------------------
  |  Branch (3746:21): [True: 604, False: 33.5k]
  ------------------
 3747|    604|                {
 3748|    604|                    pVertPlusMinus->st_edge.cap += cg_charge;
 3749|    604|                    tot_st_cap += cg_charge;
 3750|    604|                    pVertPlusMinus->st_edge.cap0 = pVertPlusMinus->st_edge.cap;
 3751|    604|                }
 3752|       |
 3753|  34.1k|                if (cg_charge < 0)
  ------------------
  |  Branch (3753:21): [True: 111, False: 34.0k]
  ------------------
 3754|    111|                {
 3755|    111|                    pVert->st_edge.cap -= cg_charge;
 3756|    111|                    tot_st_cap -= cg_charge;
 3757|    111|                    pVert->st_edge.cap0 = pVert->st_edge.cap;
 3758|       |
 3759|    111|                    if (pEdge->cap - pEdge->flow + cg_charge < 0)
  ------------------
  |  Branch (3759:25): [True: 38, False: 73]
  ------------------
 3760|     38|                    {
 3761|       |                        /* 2006-02-06: increase edge capacity to avoid clogging */
 3762|     38|                        pEdge->cap = pEdge->flow - cg_charge;
 3763|     38|                    }
 3764|    111|                }
 3765|  34.1k|                pTCGroups->added_charge = cg_charge;
 3766|  34.1k|            }
 3767|  34.1k|            if (!cg_charge || ( pVert && pEdge ))
  ------------------
  |  Branch (3767:17): [True: 33.4k, False: 715]
  |  Branch (3767:33): [True: 715, False: 0]
  |  Branch (3767:42): [True: 715, False: 0]
  ------------------
 3768|  34.1k|            {
 3769|  34.1k|                ret = 2;
 3770|  34.1k|            }
 3771|  34.1k|        }
 3772|       |
 3773|  34.1k|        AddRadicalToMetal( &tot_st_cap, &tot_st_flow, pSrm, pBNS, pTCGroups );
 3774|       |
 3775|       |
 3776|  34.1k|        pBNS->num_edges = cur_num_edges;
 3777|  34.1k|        pBNS->num_vertices = cur_num_vertices;
 3778|  34.1k|        pBNS->num_c_groups = num_cg;
 3779|  34.1k|        pBNS->tot_st_cap = tot_st_cap;
 3780|  34.1k|        pBNS->tot_st_flow = tot_st_flow;
 3781|  34.1k|    }
 3782|       |
 3783|  87.8k|exit_function:
 3784|  87.8k|    return ret;
 3785|  87.8k|}
nNumEdgesToCnVertex:
 3790|   159k|{
 3791|   159k|    int i, j, n, num_edges, v1 = v + 1;
 3792|   776k|    for (i = 0, num_edges = 0; i < len; i++)
  ------------------
  |  Branch (3792:32): [True: 617k, False: 159k]
  ------------------
 3793|   617k|    {
 3794|  1.09M|        for (j = 0; j < MAX_CN_VAL && ( n = pCN[i].e[j].neigh ); j++)
  ------------------
  |  |  397|  2.19M|#define MAX_CN_VAL 3
  ------------------
  |  Branch (3794:21): [True: 1.09M, False: 0]
  |  Branch (3794:39): [True: 478k, False: 617k]
  ------------------
 3795|   478k|        {
 3796|   478k|            num_edges += ( i == v || n == v1 );
  ------------------
  |  Branch (3796:28): [True: 225k, False: 252k]
  |  Branch (3796:38): [True: 24.3k, False: 228k]
  ------------------
 3797|   478k|        }
 3798|   617k|    }
 3799|   159k|    return num_edges;
 3800|   159k|}
AllocateAndInitTCGBnStruct:
 3848|  87.8k|{
 3849|  87.8k|    inp_ATOM *at = pStruct->at;
 3850|  87.8k|    int          num_atoms = pStruct->num_atoms;
 3851|  87.8k|    ICHICONST SRM *pSrm = pStruct->pSrm;
  ------------------
  |  |   13|  87.8k|#define ICHICONST      const
  ------------------
 3852|       |
 3853|  87.8k|    BN_STRUCT   *pBNS = NULL;
 3854|  87.8k|    BNS_VERTEX  *vert;
 3855|  87.8k|    BNS_IEDGE   *iedge;
 3856|       |
 3857|  87.8k|    int    neigh, num_changed_bonds = 0;
 3858|  87.8k|    U_CHAR bond_type, bond_mark;
 3859|  87.8k|    int bNeedsFlower1, bNeedsFlower2, min_order;
 3860|       |
 3861|  87.8k|    int i, j, k, m, n_edges, num_bonds, num_edges;
 3862|  87.8k|    int f1, f2, c1, c2, edge_cap, edge_flow, st_cap, st_flow, flag_alt_bond;
 3863|  87.8k|    int tot_st_cap, tot_st_flow;
 3864|  87.8k|    int max_tg, max_edges, max_vertices, len_alt_path, max_iedges, num_iedges, num_altp;
 3865|       |
 3866|       |    /* count vertices */
 3867|  87.8k|    max_tg = pTCGroups->num_tgroups;
 3868|       |    /* +1 for a super-tautomeric group */
 3869|       |    /* max_vertices = num_atoms + nMaxAddAtoms + max_tg + 1; */
 3870|  87.8k|    max_vertices = pTCGroups->nVertices + nMaxAddAtoms;
 3871|       |
 3872|       |    /* count edges */
 3873|  87.8k|    num_changed_bonds = 0;
 3874|  87.8k|    num_bonds = pTCGroups->num_bonds;
 3875|       |
 3876|       |    /* each atom has enough edges to belong to a tautomeric group + nMaxAddEdges */
 3877|       |    /* number of atoms is large enough to accommodate max. possible number of t-groups + nMaxAddAtoms */
 3878|       |    /* max_altp cannot be larger than BN_MAX_ALTP = 16 */
 3879|  87.8k|    num_edges = pTCGroups->nEdges;
 3880|       |
 3881|       |    /* +max_tg for edges between t-groups and super-tautomeric group */
 3882|  87.8k|    max_edges = num_edges + ( nMaxAddEdges + NUM_KINDS_OF_GROUPS )*max_vertices;
  ------------------
  |  |   86|  87.8k|#define NUM_KINDS_OF_GROUPS  2  /* 1 accounts for t-group kind, one more 1 accounts for c-group kind */
  ------------------
 3883|  87.8k|    max_iedges = 2 * max_edges + pTCGroups->nAddIedges;
 3884|  87.8k|    len_alt_path = max_vertices + iALTP_HDR_LEN + 1; /* may overflow if an edge is traversed in 2 directions */
 3885|  87.8k|    len_alt_path += inchi_max( max_vertices / 2, 16 ); /* to avoid the overflow */
  ------------------
  |  |  138|  87.8k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 7.07k, False: 80.7k]
  |  |  ------------------
  ------------------
 3886|       |
 3887|  87.8k|    if (!(pBNS = (BN_STRUCT*)inchi_calloc(1, sizeof(BN_STRUCT))) ||
  ------------------
  |  | 1146|  87.8k|#define inchi_calloc   calloc
  ------------------
  |  Branch (3887:9): [True: 0, False: 87.8k]
  ------------------
 3888|  87.8k|        !(pBNS->edge = (BNS_EDGE*)inchi_calloc(max_edges, sizeof(BNS_EDGE))) ||
  ------------------
  |  | 1146|  87.8k|#define inchi_calloc   calloc
  ------------------
  |  Branch (3888:9): [True: 0, False: 87.8k]
  ------------------
 3889|  87.8k|        !(pBNS->vert = (BNS_VERTEX*)inchi_calloc(max_vertices, sizeof(BNS_VERTEX))) ||
  ------------------
  |  | 1146|  87.8k|#define inchi_calloc   calloc
  ------------------
  |  Branch (3889:9): [True: 0, False: 87.8k]
  ------------------
 3890|  87.8k|        !(pBNS->iedge = (BNS_IEDGE*)inchi_calloc(max_iedges, sizeof(BNS_IEDGE))))
  ------------------
  |  | 1146|  87.8k|#define inchi_calloc   calloc
  ------------------
  |  Branch (3890:9): [True: 0, False: 87.8k]
  ------------------
 3891|      0|    {
 3892|      0|        return DeAllocateBnStruct( pBNS );
 3893|      0|    }
 3894|       |
 3895|       |    /* alt path init (standard spell) */
 3896|  1.49M|    for (num_altp = 0; num_altp < max_altp && num_altp < BN_MAX_ALTP; num_altp++)
  ------------------
  |  |   17|  1.40M|#define BN_MAX_ALTP  16
  ------------------
  |  Branch (3896:24): [True: 1.40M, False: 87.8k]
  |  Branch (3896:47): [True: 1.40M, False: 0]
  ------------------
 3897|  1.40M|    {
 3898|  1.40M|        if (!( pBNS->altp[num_altp] = (BNS_ALT_PATH*) inchi_calloc( len_alt_path, sizeof( BNS_ALT_PATH ) ) ))
  ------------------
  |  | 1146|  1.40M|#define inchi_calloc   calloc
  ------------------
  |  Branch (3898:13): [True: 0, False: 1.40M]
  ------------------
 3899|      0|        {
 3900|      0|            return DeAllocateBnStruct( pBNS );
 3901|      0|        }
 3902|  1.40M|        ALTP_ALLOCATED_LEN( pBNS->altp[num_altp] ) = len_alt_path;
  ------------------
  |  |  111|  1.40M|#define ALTP_ALLOCATED_LEN(altp)        (altp)[iALTP_MAX_LEN].number
  ------------------
 3903|  1.40M|        pBNS->len_alt_path = len_alt_path;  /* ??? duplication ??? */
 3904|       |        /* re-init */
 3905|  1.40M|        ALTP_DELTA( pBNS->altp[num_altp] ) = 0;
  ------------------
  |  |  112|  1.40M|#define ALTP_DELTA(altp)                 (altp)[iALTP_FLOW].flow[0]
  ------------------
 3906|  1.40M|        ALTP_START_ATOM( pBNS->altp[num_altp] ) = NO_VERTEX;
  ------------------
  |  |  103|  1.40M|#define ALTP_START_ATOM(altp)           (altp)[iALTP_START_ATOM].number
  ------------------
                      ALTP_START_ATOM( pBNS->altp[num_altp] ) = NO_VERTEX;
  ------------------
  |  |  118|  1.40M|#define NO_VERTEX    -2
  ------------------
 3907|  1.40M|        ALTP_END_ATOM( pBNS->altp[num_altp] ) = NO_VERTEX;
  ------------------
  |  |  102|  1.40M|#define ALTP_END_ATOM(altp)             (altp)[iALTP_END_ATOM].number
  ------------------
                      ALTP_END_ATOM( pBNS->altp[num_altp] ) = NO_VERTEX;
  ------------------
  |  |  118|  1.40M|#define NO_VERTEX    -2
  ------------------
 3908|  1.40M|        ALTP_PATH_LEN( pBNS->altp[num_altp] ) = 0;
  ------------------
  |  |  101|  1.40M|#define ALTP_PATH_LEN(altp)             (altp)[iALTP_PATH_LEN].number  /* number of bonds = number of atoms-1*/
  ------------------
 3909|  1.40M|    }
 3910|  87.8k|    pBNS->alt_path = NULL;
 3911|  87.8k|    pBNS->num_altp = 0;
 3912|  87.8k|    pBNS->max_altp = num_altp;
 3913|       |
 3914|       |
 3915|       |    /* fill vertices (no connectivity) */
 3916|  87.8k|    iedge = pBNS->iedge;
 3917|  87.8k|    num_iedges = 0;
 3918|  87.8k|    tot_st_cap = tot_st_flow = 0;
 3919|   920k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (3919:17): [True: 832k, False: 87.8k]
  ------------------
 3920|   832k|    {
 3921|       |        /* count edges incident to pBNS->vert[i] */
 3922|   832k|        k = at[i].valence + ( at[i].endpoint != 0 ) + ( nMaxAddEdges /*+ NUM_KINDS_OF_GROUPS*/ );
 3923|   832k|        if (( j = pVA[i].cnListIndex - 1 ) >= 0)
  ------------------
  |  Branch (3923:13): [True: 159k, False: 673k]
  ------------------
 3924|   159k|        {
 3925|       |            /* add number of neighbors in the ChargeStruct */
 3926|   159k|            k += nNumEdgesToCnVertex( cnList[j].pCN, cnList[j].len, 0 );
 3927|   159k|        }
 3928|       |        /* set max number of edges for the vertex */
 3929|   832k|        pBNS->vert[i].max_adj_edges = k;
 3930|   832k|        pBNS->vert[i].iedge = iedge;
 3931|   832k|        iedge += k;
 3932|       |        /* add atom vertex cap */
 3933|   832k|        st_cap = 0;
 3934|   832k|        st_flow = 0;
 3935|   832k|        bNeedsFlower1 = AtomStcapStflow( at, pVA, pSrm, i, &c1, &f1, NULL, NULL );
 3936|       |        /* pVA[i].cNumBondsToMetal = bNeedsFlower1; */
 3937|       |        /* GetAtomStCapFlow( at, pVA, pSrm, i, &c1, &f1 ); */
 3938|   832k|        st_cap += c1;
 3939|   832k|        st_cap += bNeedsFlower1 ? 0 : pVA[i].cInitFreeValences;
  ------------------
  |  Branch (3939:19): [True: 24.3k, False: 808k]
  ------------------
 3940|   832k|        pBNS->vert[i].st_edge.cap = st_cap; /* the 1st time st_cap is set */
 3941|   832k|        pBNS->vert[i].st_edge.cap0 = pBNS->vert[i].st_edge.cap;
 3942|   832k|        tot_st_cap += st_cap;
 3943|   832k|    }
 3944|       |
 3945|  87.8k|    num_iedges = (int) ( iedge - pBNS->iedge );
 3946|  87.8k|    if (max_iedges - num_iedges < ( nMaxAddEdges + NUM_KINDS_OF_GROUPS )*max_vertices)
  ------------------
  |  |   86|  87.8k|#define NUM_KINDS_OF_GROUPS  2  /* 1 accounts for t-group kind, one more 1 accounts for c-group kind */
  ------------------
  |  Branch (3946:9): [True: 0, False: 87.8k]
  ------------------
 3947|      0|    {
 3948|      0|        return DeAllocateBnStruct( pBNS );
 3949|      0|    }
 3950|       |
 3951|  87.8k|    pBNS->num_atoms = num_atoms;      /* number of real atoms */
 3952|  87.8k|    pBNS->num_added_atoms = 0;
 3953|  87.8k|    pBNS->num_t_groups = 0;              /* number of added t-groups */
 3954|  87.8k|    pBNS->num_c_groups = 0;
 3955|  87.8k|    pBNS->nMaxAddAtoms = nMaxAddAtoms;
 3956|  87.8k|    pBNS->nMaxAddEdges = nMaxAddEdges;
 3957|       |
 3958|  87.8k|    pBNS->num_vertices = num_atoms;      /* current number of vertices, in general a sum of
 3959|       |                                               pBNS->num_atoms
 3960|       |                                               pBNS->num_t_groups
 3961|       |                                               number of c-groups
 3962|       |                                               number of auxiliary vertices
 3963|       |                                               pBNS->num_added_atoms
 3964|       |                                            */
 3965|  87.8k|    pBNS->max_vertices = max_vertices;
 3966|       |
 3967|       |
 3968|  87.8k|    pBNS->num_bonds = num_bonds;      /* number of real edges (bonds) */
 3969|  87.8k|    pBNS->max_edges = max_edges;
 3970|  87.8k|    pBNS->max_iedges = max_iedges;
 3971|       |
 3972|       |
 3973|       |    /*
 3974|       |       To remove t-groups and added atoms:
 3975|       |
 3976|       |        for ( i = 0; i < pBNS->num_atoms; i ++ )
 3977|       |        {
 3978|       |            for ( j = pBNS->vert[i].num_adj_edges-1; 0 <= j; j -- )
 3979|       |            {
 3980|       |                k = pBNS->edge[pBNS->vert[i].iedge[j]].neighbor12 ^ i;
 3981|       |                if ( pBNS->vert[k].type & BNS_VERT_TYPE_ATOM )
 3982|       |                {
 3983|       |                    pBNS->vert[i].num_adj_edges = j+1;
 3984|       |                    break;
 3985|       |                }
 3986|       |            }
 3987|       |        }
 3988|       |
 3989|       |       pBNS->num_vertices    = pBNS->num_atoms;
 3990|       |       pBNS->num_edges       = pBNS->num_bonds;
 3991|       |       pBNS->num_added_atoms = 0;
 3992|       |       pBNS->num_t_groups    = 0;
 3993|       |       pBNS->num_added_edges = 0;
 3994|       |
 3995|       |       ALTP_DELTA(pBNS->alt_path)      = 0;
 3996|       |       ALTP_START_ATOM(pBNS->alt_path) = NO_VERTEX;
 3997|       |       ALTP_END_ATOM(pBNS->alt_path)   = NO_VERTEX;
 3998|       |       ALTP_PATH_LEN(pBNS->alt_path)   = 0;
 3999|       |
 4000|       |    */
 4001|       |
 4002|       |
 4003|       |    /* add and fill edges and connectivity */
 4004|   920k|    for (i = 0, n_edges = 0; i < num_atoms; i++)
  ------------------
  |  Branch (4004:30): [True: 832k, False: 87.8k]
  ------------------
 4005|   832k|    {
 4006|   832k|        vert = pBNS->vert + i; /* pointer to the ith vertex */
 4007|   832k|        st_cap = 0;
 4008|   832k|        st_flow = 0;
 4009|   832k|        flag_alt_bond = 0;
 4010|  1.17M|        for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (4010:21): [True: 339k, False: 832k]
  ------------------
 4011|   339k|        {
 4012|   339k|            neigh = at[i].neighbor[j];
 4013|       |            /* find this bond at the neighbor */
 4014|   553k|            for (k = 0; k < at[neigh].valence; k++)
  ------------------
  |  Branch (4014:25): [True: 553k, False: 0]
  ------------------
 4015|   553k|            {
 4016|   553k|                if (at[neigh].neighbor[k] == i)
  ------------------
  |  Branch (4016:21): [True: 339k, False: 214k]
  ------------------
 4017|   339k|                {
 4018|   339k|                    break;
 4019|   339k|                }
 4020|   553k|            }
 4021|   339k|            bond_type = ( at[i].bond_type[j] & BOND_TYPE_MASK );
  ------------------
  |  |  189|   339k|#define BOND_TYPE_MASK        0x0f
  ------------------
 4022|   339k|            bond_mark = ( at[i].bond_type[j] & ~BOND_TYPE_MASK );
  ------------------
  |  |  189|   339k|#define BOND_TYPE_MASK        0x0f
  ------------------
 4023|   339k|            if (bond_type != BOND_SINGLE && bond_type != BOND_DOUBLE && bond_type != BOND_TRIPLE)
  ------------------
  |  |  177|   339k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|   678k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                          if (bond_type != BOND_SINGLE && bond_type != BOND_DOUBLE && bond_type != BOND_TRIPLE)
  ------------------
  |  |  178|  1.35k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|   340k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
                          if (bond_type != BOND_SINGLE && bond_type != BOND_DOUBLE && bond_type != BOND_TRIPLE)
  ------------------
  |  |  179|    418|#define BOND_TRIPLE BOND_TYPE_TRIPLE  /* 3                                  */
  |  |  ------------------
  |  |  |  |   34|    418|#define BOND_TYPE_TRIPLE    3
  |  |  ------------------
  ------------------
  |  Branch (4023:17): [True: 1.35k, False: 337k]
  |  Branch (4023:45): [True: 418, False: 932]
  |  Branch (4023:73): [True: 418, False: 0]
  ------------------
 4024|    418|            {
 4025|       |                /* make unknown bonds single */
 4026|    418|                bond_type = BOND_SINGLE;
  ------------------
  |  |  177|    418|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|    418|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
 4027|    418|                at[i].bond_type[j] = bond_mark | bond_type;
 4028|    418|                num_changed_bonds++;
 4029|    418|            }
 4030|   339k|            if (neigh > i)
  ------------------
  |  Branch (4030:17): [True: 169k, False: 169k]
  ------------------
 4031|   169k|            {
 4032|       |                /* this is the first time we encounter this bond */
 4033|   169k|                bNeedsFlower1 = AtomStcapStflow( at, pVA, pSrm, i, &c1, &f1, NULL, NULL );
 4034|       |                /* GetAtomStCapFlow( at, pVA, pSrm, i, &c1, &f1 ); */
 4035|   169k|                c1 += bNeedsFlower1 ? 0 : pVA[i].cInitFreeValences;  /* elevate cap to the lowest valence in ChargeStruct */
  ------------------
  |  Branch (4035:23): [True: 21.1k, False: 148k]
  ------------------
 4036|   169k|                bNeedsFlower2 = AtomStcapStflow( at, pVA, pSrm, neigh, &c2, &f2, NULL, NULL );
 4037|       |                /* GetAtomStCapFlow( at, pVA, pSrm, neigh, &c2, &f2 ); */
 4038|   169k|                c2 += bNeedsFlower2 ? 0 : pVA[neigh].cInitFreeValences; /* elevate cap to the lowest valence in ChargeStruct */
  ------------------
  |  Branch (4038:23): [True: 22.0k, False: 147k]
  ------------------
 4039|       |
 4040|       |                /* at this point -O would have st_cap=st_flow=0 because the lowest valence=1 for charge=-1 */
 4041|       |                /* however, if -O belongs to a t-group its cap would be 1, flow = 0 */
 4042|       |                /*f1 = MAX_AT_FLOW(at[i]);*/
 4043|       |                /*f2 = MAX_AT_FLOW(at[neigh]);*/
 4044|       |
 4045|   169k|                edge_flow = BondFlowMaxcapMinorder( at, pVA, pSrm, i, j, &edge_cap, &min_order, NULL );
 4046|       |
 4047|   169k|                pBNS->edge[n_edges].neighbor1 = (AT_NUMB) i;
 4048|   169k|                pBNS->edge[n_edges].neighbor12 = (AT_NUMB) ( i ^ neigh );
 4049|   169k|                pBNS->edge[n_edges].flow =
 4050|   169k|                    pBNS->edge[n_edges].flow0 = edge_flow;
 4051|   169k|                pBNS->edge[n_edges].cap =
 4052|   169k|                    pBNS->edge[n_edges].cap0 = edge_cap;
 4053|   169k|                pBNS->edge[n_edges].neigh_ord[0] = j;  /* iedge to neigh index at vertex[i],     i < neigh */
 4054|   169k|                pBNS->edge[n_edges].neigh_ord[1] = k;  /* iedge to i     index at vertex[neigh], i < neigh */
 4055|   169k|                pBNS->edge[n_edges].pass = 0;
 4056|   169k|                pBNS->edge[n_edges].forbidden = 0; /* may be forbidden if edge_flow = 1: stereogenic fixed double bond */
 4057|   169k|                if (bond_type == BOND_TYPE_DOUBLE)
  ------------------
  |  |   33|   169k|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (4057:21): [True: 466, False: 169k]
  ------------------
 4058|    466|                {
 4059|       |                    /* forbid changing stereogenic double bonds */
 4060|    478|                    for (m = 0; m < MAX_NUM_STEREO_BONDS && at[i].sb_parity[m]; m++)
  ------------------
  |  |  873|    956|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (4060:33): [True: 478, False: 0]
  |  Branch (4060:61): [True: 437, False: 41]
  ------------------
 4061|    437|                    {
 4062|    437|                        if (at[i].sb_ord[m] == j)
  ------------------
  |  Branch (4062:29): [True: 425, False: 12]
  ------------------
 4063|    425|                        {
 4064|    425|                            pBNS->edge[n_edges].forbidden |= BNS_EDGE_FORBIDDEN_MASK;
  ------------------
  |  |   39|    425|#define BNS_EDGE_FORBIDDEN_MASK  1
  ------------------
 4065|    425|                            break;
 4066|    425|                        }
 4067|    437|                    }
 4068|    466|                }
 4069|   169k|                if (pBNS->vert[neigh].iedge) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (4069:21): [True: 169k, False: 0]
  ------------------
 4070|   169k|                {
 4071|   169k|                    vert->iedge[j] = pBNS->vert[neigh].iedge[k] = n_edges++; /* same iedge index as neighbor index in at[] */
 4072|   169k|                }
 4073|   169k|            }
 4074|   169k|            else
 4075|   169k|            {
 4076|       |                /* this is the second time we encounter this bond. It was stored at */
 4077|   169k|                int  iedge2 = pBNS->vert[neigh].iedge[k];
 4078|   169k|                edge_cap = pBNS->edge[iedge2].cap;
 4079|   169k|                edge_flow = pBNS->edge[iedge2].flow;
 4080|   169k|            }
 4081|   339k|            st_flow += edge_flow;
 4082|       |            /*
 4083|       |            st_cap  += edge_cap;
 4084|       |            */
 4085|   339k|        }
 4086|       |
 4087|   832k|        vert->num_adj_edges = j;
 4088|       |        /*
 4089|       |        vert->st_edge.cap   =
 4090|       |        vert->st_edge.cap0  = st_cap;
 4091|       |        */
 4092|   832k|        vert->st_edge.flow =
 4093|   832k|            vert->st_edge.flow0 = st_flow;
 4094|   832k|        vert->type = BNS_VERT_TYPE_ATOM;
  ------------------
  |  |   45|   832k|#define BNS_VERT_TYPE_ATOM          0x0001
  ------------------
 4095|       |        /*
 4096|       |        tot_st_cap  += vert->st_edge.cap;
 4097|       |        */
 4098|   832k|        tot_st_flow += vert->st_edge.flow;
 4099|   832k|    }
 4100|       |
 4101|  87.8k|    *pNum_changed_bonds = num_changed_bonds / 2;
 4102|       |
 4103|  87.8k|    pBNS->num_edges = n_edges;   /* number of edges */
 4104|  87.8k|    pBNS->num_iedges = num_iedges;
 4105|  87.8k|    pBNS->num_added_edges = 0;
 4106|       |
 4107|  87.8k|    pBNS->tot_st_cap = tot_st_cap;
 4108|  87.8k|    pBNS->tot_st_flow = tot_st_flow;
 4109|       |
 4110|       |/* exit_function: */
 4111|       |
 4112|  87.8k|    return pBNS;
 4113|  87.8k|}
IncrZeroBondsAndClearEndpts:
 4118|   146k|{
 4119|   146k|    int i, j;
 4120|  1.04M|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (4120:17): [True: 898k, False: 146k]
  ------------------
 4121|   898k|    {
 4122|   898k|        at[i].endpoint = 0;
 4123|   898k|        at[i].component = iComponent;
 4124|  1.25M|        for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (4124:21): [True: 354k, False: 898k]
  ------------------
 4125|   354k|        {
 4126|   354k|            if (!at[i].bond_type[j])
  ------------------
  |  Branch (4126:17): [True: 12.5k, False: 341k]
  ------------------
 4127|  12.5k|            {
 4128|  12.5k|                at[i].bond_type[j] = BOND_TYPE_SINGLE;
  ------------------
  |  |   32|  12.5k|#define BOND_TYPE_SINGLE    1
  ------------------
 4129|  12.5k|                at[i].chem_bonds_valence += BOND_TYPE_SINGLE;
  ------------------
  |  |   32|  12.5k|#define BOND_TYPE_SINGLE    1
  ------------------
 4130|  12.5k|            }
 4131|   354k|        }
 4132|   898k|    }
 4133|   146k|}
IncrZeroBonds:
 4138|  70.4k|{
 4139|  70.4k|    int i, j;
 4140|   229k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (4140:17): [True: 159k, False: 70.4k]
  ------------------
 4141|   159k|    {
 4142|   159k|        at[i].component = iComponent;
 4143|   283k|        for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (4143:21): [True: 123k, False: 159k]
  ------------------
 4144|   123k|        {
 4145|   123k|            if (!at[i].bond_type[j])
  ------------------
  |  Branch (4145:17): [True: 4.03k, False: 119k]
  ------------------
 4146|  4.03k|            {
 4147|  4.03k|                at[i].bond_type[j] = BOND_TYPE_SINGLE;
  ------------------
  |  |   32|  4.03k|#define BOND_TYPE_SINGLE    1
  ------------------
 4148|  4.03k|                at[i].chem_bonds_valence += BOND_TYPE_SINGLE;
  ------------------
  |  |   32|  4.03k|#define BOND_TYPE_SINGLE    1
  ------------------
 4149|  4.03k|            }
 4150|   123k|        }
 4151|   159k|    }
 4152|  70.4k|}
ClearEndpts:
 4157|  70.4k|{
 4158|  70.4k|    int i;
 4159|   229k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (4159:17): [True: 159k, False: 70.4k]
  ------------------
 4160|   159k|    {
 4161|   159k|        at[i].endpoint = 0;
 4162|   159k|    }
 4163|  70.4k|}
GetDeltaChargeFromVF:
 4195|  69.1k|{
 4196|  69.1k|    int i, v = NO_VERTEX;
  ------------------
  |  |  118|  69.1k|#define NO_VERTEX    -2
  ------------------
 4197|  69.1k|    int ieIn1 = ( !( vf->bUsed & VF_USED_IN ) && vf->e_In >= 0 && vf->delta_In ) ? vf->e_In + 1 : NO_VERTEX;
  ------------------
  |  | 4183|  69.1k|#define VF_USED_IN  1
  ------------------
                  int ieIn1 = ( !( vf->bUsed & VF_USED_IN ) && vf->e_In >= 0 && vf->delta_In ) ? vf->e_In + 1 : NO_VERTEX;
  ------------------
  |  |  118|  50.6k|#define NO_VERTEX    -2
  ------------------
  |  Branch (4197:19): [True: 35.4k, False: 33.6k]
  |  Branch (4197:50): [True: 18.4k, False: 17.0k]
  |  Branch (4197:67): [True: 18.4k, False: 0]
  ------------------
 4198|  69.1k|    int ieOut1 = ( !( vf->bUsed & VF_USED_OUT ) && vf->e_Out >= 0 && vf->delta_Out ) ? vf->e_Out + 1 : NO_VERTEX;
  ------------------
  |  | 4184|  69.1k|#define VF_USED_OUT 2
  ------------------
                  int ieOut1 = ( !( vf->bUsed & VF_USED_OUT ) && vf->e_Out >= 0 && vf->delta_Out ) ? vf->e_Out + 1 : NO_VERTEX;
  ------------------
  |  |  118|  52.2k|#define NO_VERTEX    -2
  ------------------
  |  Branch (4198:20): [True: 38.7k, False: 30.4k]
  |  Branch (4198:52): [True: 16.9k, False: 21.7k]
  |  Branch (4198:70): [True: 16.9k, False: 0]
  ------------------
 4199|  69.1k|    int nInitCharge, nPlusFlow, nMinusFlow, nDeltaCharge, nNumDeltaCharge, eCPlus, eCMinus;
 4200|       |
 4201|  69.1k|    if (!( vf->type & BNS_VERT_TYPE_C_GROUP ) ||
  ------------------
  |  |   49|  69.1k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
  |  Branch (4201:9): [True: 41.4k, False: 27.6k]
  ------------------
 4202|  27.6k|        ( vf->type & BNS_VERT_TYPE_SUPER_TGROUP ) ||
  ------------------
  |  |   50|  27.6k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  ------------------
  |  Branch (4202:9): [True: 0, False: 27.6k]
  ------------------
 4203|  27.6k|        ( ieIn1 == NO_VERTEX && ieOut1 == NO_VERTEX ))
  ------------------
  |  |  118|  55.3k|#define NO_VERTEX    -2
  ------------------
                      ( ieIn1 == NO_VERTEX && ieOut1 == NO_VERTEX ))
  ------------------
  |  |  118|  13.0k|#define NO_VERTEX    -2
  ------------------
  |  Branch (4203:11): [True: 13.0k, False: 14.6k]
  |  Branch (4203:33): [True: 1.20k, False: 11.7k]
  ------------------
 4204|  42.6k|    {
 4205|  42.6k|        return 0;
 4206|  42.6k|    }
 4207|  26.4k|    if (vf->type & BNS_VERT_TYPE_C_NEGATIVE)
  ------------------
  |  |   54|  26.4k|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  ------------------
  |  Branch (4207:9): [True: 12.3k, False: 14.1k]
  ------------------
 4208|  12.3k|    {
 4209|       |        /* negative charge edge */
 4210|  73.1k|        for (i = 0; i < pBNS->num_atoms; i++)
  ------------------
  |  Branch (4210:21): [True: 64.1k, False: 8.97k]
  ------------------
 4211|  64.1k|        {
 4212|  64.1k|            if (pVA[i].nCMinusGroupEdge == ieIn1 || pVA[i].nCMinusGroupEdge == ieOut1)
  ------------------
  |  Branch (4212:17): [True: 823, False: 63.3k]
  |  Branch (4212:53): [True: 2.54k, False: 60.8k]
  ------------------
 4213|  3.37k|            {
 4214|  3.37k|                v = i;
 4215|  3.37k|                break;
 4216|  3.37k|            }
 4217|  64.1k|        }
 4218|  12.3k|    }
 4219|  14.1k|    else
 4220|  14.1k|    {
 4221|       |        /* positive charge edge */
 4222|  87.1k|        for (i = 0; i < pBNS->num_atoms; i++)
  ------------------
  |  Branch (4222:21): [True: 75.8k, False: 11.3k]
  ------------------
 4223|  75.8k|        {
 4224|  75.8k|            if (pVA[i].nCPlusGroupEdge == ieIn1 || pVA[i].nCPlusGroupEdge == ieOut1)
  ------------------
  |  Branch (4224:17): [True: 1.46k, False: 74.3k]
  |  Branch (4224:52): [True: 1.32k, False: 73.0k]
  ------------------
 4225|  2.78k|            {
 4226|  2.78k|                v = i;
 4227|  2.78k|                break;
 4228|  2.78k|            }
 4229|  75.8k|        }
 4230|  14.1k|    }
 4231|       |
 4232|  26.4k|    if (v == NO_VERTEX)
  ------------------
  |  |  118|  26.4k|#define NO_VERTEX    -2
  ------------------
  |  Branch (4232:9): [True: 20.3k, False: 6.15k]
  ------------------
 4233|  20.3k|        return 0;
 4234|       |
 4235|  6.15k|    nInitCharge = pVA[v].cInitCharge;
 4236|  6.15k|    nPlusFlow = nMinusFlow = 0;
 4237|  6.15k|    nNumDeltaCharge = 0;
 4238|       |
 4239|  6.15k|    if (( eCPlus = pVA[v].nCPlusGroupEdge - 1 ) >= 0)
  ------------------
  |  Branch (4239:9): [True: 5.54k, False: 610]
  ------------------
 4240|  5.54k|    {
 4241|  5.54k|        nPlusFlow = pBNS->edge[eCPlus].cap
 4242|  5.54k|            - pBNS->edge[eCPlus].flow;
 4243|  5.54k|    }
 4244|       |
 4245|  6.15k|    if (( eCMinus = pVA[v].nCMinusGroupEdge - 1 ) >= 0)
  ------------------
  |  Branch (4245:9): [True: 4.33k, False: 1.82k]
  ------------------
 4246|  4.33k|    {
 4247|  4.33k|        nMinusFlow = -pBNS->edge[eCMinus].flow;
 4248|  4.33k|    }
 4249|  6.15k|    nInitCharge += nPlusFlow + nMinusFlow;
 4250|       |
 4251|  6.15k|    nDeltaCharge = 0;
 4252|       |
 4253|  6.15k|    if (!( vf[0].bUsed & VF_USED_OUT ))
  ------------------
  |  | 4184|  6.15k|#define VF_USED_OUT 2
  ------------------
  |  Branch (4253:9): [True: 5.87k, False: 289]
  ------------------
 4254|  5.87k|    {
 4255|  5.87k|        if (vf[0].e_Out == eCPlus || vf[0].e_Out == eCMinus)
  ------------------
  |  Branch (4255:13): [True: 1.32k, False: 4.54k]
  |  Branch (4255:38): [True: 2.54k, False: 1.99k]
  ------------------
 4256|  3.87k|        {
 4257|  3.87k|            nDeltaCharge -= vf[0].delta_Out;
 4258|  3.87k|            vf[0].bUsed |= VF_USED_OUT;
  ------------------
  |  | 4184|  3.87k|#define VF_USED_OUT 2
  ------------------
 4259|  3.87k|        }
 4260|  5.87k|    }
 4261|       |
 4262|  6.15k|    if (!( vf[0].bUsed & VF_USED_IN ))
  ------------------
  |  | 4183|  6.15k|#define VF_USED_IN  1
  ------------------
  |  Branch (4262:9): [True: 5.43k, False: 726]
  ------------------
 4263|  5.43k|    {
 4264|  5.43k|        if (vf[0].e_In == eCPlus || vf[0].e_In == eCMinus)
  ------------------
  |  Branch (4264:13): [True: 1.46k, False: 3.97k]
  |  Branch (4264:37): [True: 823, False: 3.14k]
  ------------------
 4265|  2.28k|        {
 4266|  2.28k|            nDeltaCharge -= vf[0].delta_In;
 4267|  2.28k|            vf[0].bUsed |= VF_USED_IN;
  ------------------
  |  | 4183|  2.28k|#define VF_USED_IN  1
  ------------------
 4268|  2.28k|        }
 4269|  5.43k|    }
 4270|       |
 4271|  6.15k|    if (!nInitCharge && nDeltaCharge)
  ------------------
  |  Branch (4271:9): [True: 4.81k, False: 1.34k]
  |  Branch (4271:25): [True: 4.81k, False: 0]
  ------------------
 4272|  4.81k|    {
 4273|  4.81k|        nNumDeltaCharge++;
 4274|  4.81k|    }
 4275|  1.34k|    else if (nInitCharge && 0 == nInitCharge + nDeltaCharge)
  ------------------
  |  Branch (4275:14): [True: 1.34k, False: 0]
  |  Branch (4275:29): [True: 1.33k, False: 7]
  ------------------
 4276|  1.33k|    {
 4277|  1.33k|        nNumDeltaCharge--;
 4278|  1.33k|    }
 4279|       |
 4280|  6.15k|    return nNumDeltaCharge;
 4281|  26.4k|}
EvaluateChargeChanges:
 4286|  19.1k|{
 4287|  19.1k|    int       pass, i, j, v0, v1, v2, v, ineigh1, /*ineigh2,*/ vLast, n, delta, ret, ie, err = 0;
 4288|  19.1k|    BNS_EDGE *edge;
 4289|  19.1k|    int       nDeltaH, nDeltaCharge, iPrev, nInitCharge, nPlusFlow, nMinusFlow;
 4290|  19.1k|    int       nNumDeltaH = 0;
 4291|  19.1k|    int       nNumDeltaCharge = 0;
 4292|  19.1k|    int       nNumVisitedAtoms = 0;
 4293|  19.1k|    VF   vf[NUM_VF + 1];
 4294|       |
 4295|  19.1k|    *pnDeltaH = 0;
 4296|  19.1k|    *pnDeltaCharge = 0;
 4297|  19.1k|    *pnNumVisitedAtoms = 0;
 4298|       |
 4299|  38.2k|    for (pass = pBNS->num_altp - 1, ret = 0; 0 <= pass; pass--)
  ------------------
  |  Branch (4299:46): [True: 19.1k, False: 19.1k]
  ------------------
 4300|  19.1k|    {
 4301|       |
 4302|  19.1k|        pBNS->alt_path = pBNS->altp[pass];
 4303|  19.1k|        v1 = ALTP_START_ATOM( pBNS->alt_path );
  ------------------
  |  |  103|  19.1k|#define ALTP_START_ATOM(altp)           (altp)[iALTP_START_ATOM].number
  ------------------
 4304|  19.1k|        n = ALTP_PATH_LEN( pBNS->alt_path );
  ------------------
  |  |  101|  19.1k|#define ALTP_PATH_LEN(altp)             (altp)[iALTP_PATH_LEN].number  /* number of bonds = number of atoms-1*/
  ------------------
 4305|  19.1k|        delta = ALTP_DELTA( pBNS->alt_path );
  ------------------
  |  |  112|  19.1k|#define ALTP_DELTA(altp)                 (altp)[iALTP_FLOW].flow[0]
  ------------------
 4306|  19.1k|        vLast = ALTP_END_ATOM( pBNS->alt_path );
  ------------------
  |  |  102|  19.1k|#define ALTP_END_ATOM(altp)             (altp)[iALTP_END_ATOM].number
  ------------------
 4307|  19.1k|        v0 = v2 = NO_VERTEX;
  ------------------
  |  |  118|  19.1k|#define NO_VERTEX    -2
  ------------------
 4308|       |
 4309|  19.1k|        memset( vf, 0, sizeof( vf ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4310|  95.5k|        for (i = 0; i < (int) ( sizeof( vf ) / sizeof( vf[0] ) ); i++)
  ------------------
  |  Branch (4310:21): [True: 76.4k, False: 19.1k]
  ------------------
 4311|  76.4k|        {
 4312|  76.4k|            vf[i].v = NO_VERTEX; /* = -2 */
  ------------------
  |  |  118|  76.4k|#define NO_VERTEX    -2
  ------------------
 4313|  76.4k|            vf[i].e_In = NO_VERTEX;
  ------------------
  |  |  118|  76.4k|#define NO_VERTEX    -2
  ------------------
 4314|  76.4k|            vf[i].e_Out = NO_VERTEX;
  ------------------
  |  |  118|  76.4k|#define NO_VERTEX    -2
  ------------------
 4315|  76.4k|        }
 4316|  19.1k|        iPrev = 0;
 4317|       |        /* add to the queue */
 4318|  19.1k|        if (ANY_VERT_TYPE( pBNS->vert[v1].type ))
  ------------------
  |  | 4167|  19.1k|#define ANY_VERT_TYPE(X) (((X) & (BNS_VERT_TYPE_ATOM | BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP)) && \
  |  |  ------------------
  |  |  |  |   45|  19.1k|#define BNS_VERT_TYPE_ATOM          0x0001
  |  |  ------------------
  |  |               #define ANY_VERT_TYPE(X) (((X) & (BNS_VERT_TYPE_ATOM | BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP)) && \
  |  |  ------------------
  |  |  |  |   47|  19.1k|#define BNS_VERT_TYPE_TGROUP        0x0004
  |  |  ------------------
  |  |               #define ANY_VERT_TYPE(X) (((X) & (BNS_VERT_TYPE_ATOM | BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP)) && \
  |  |  ------------------
  |  |  |  |   49|  19.1k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (4167:27): [True: 9.36k, False: 9.74k]
  |  |  ------------------
  |  | 4168|  19.1k|                           !((X) & (BNS_VERT_TYPE_SUPER_TGROUP)))
  |  |  ------------------
  |  |  |  |   50|  9.36k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  ------------------
  |  |  |  Branch (4168:28): [True: 6.50k, False: 2.86k]
  |  |  ------------------
  ------------------
 4319|  6.50k|        {
 4320|  6.50k|            if (pBNS->vert[v1].type & BNS_VERT_TYPE_ATOM)
  ------------------
  |  |   45|  6.50k|#define BNS_VERT_TYPE_ATOM          0x0001
  ------------------
  |  Branch (4320:17): [True: 5.65k, False: 851]
  ------------------
 4321|  5.65k|            {
 4322|  5.65k|                nNumVisitedAtoms++;
 4323|  5.65k|            }
 4324|  6.50k|            vf[2].type = pBNS->vert[v1].type;
 4325|  6.50k|            vf[2].v = v1;
 4326|  6.50k|            iPrev = 2;
 4327|  6.50k|        }
 4328|       |
 4329|  19.1k|        nNumDeltaH = 0;
 4330|  19.1k|        nNumDeltaCharge = 0;
 4331|  19.1k|        nNumVisitedAtoms = 0;
 4332|       |
 4333|   199k|        for (i = 0; i < n; i++, delta = -delta, v0 = v1, v1 = v2) /* djb-rwth: removing redundant code */
  ------------------
  |  Branch (4333:21): [True: 180k, False: 19.1k]
  ------------------
 4334|   180k|        {
 4335|   180k|            ineigh1 = ALTP_THIS_ATOM_NEIGHBOR( pBNS->alt_path, i );  /* v1->v2 neighbor */
  ------------------
  |  |  104|   180k|#define ALTP_THIS_ATOM_NEIGHBOR(altp,X) (altp)[iALTP_NEIGHBOR+(X)].ineigh[0]  /* 0 <= X < path_len */
  ------------------
 4336|       |            /*ineigh2 = ALTP_NEXT_ATOM_NEIGHBOR(pBNS->alt_path, i);*/  /* v2->v1 neighbor */
 4337|   180k|            edge = pBNS->edge + ( ie = pBNS->vert[v1].iedge[ineigh1] );
 4338|       |            /* follow the BN Structure, not the inp_ATOM, to take care of swithching to
 4339|       |               t-groups, c-groups or other fictitious edges/vertices
 4340|       |            */
 4341|       |
 4342|   180k|            if (iPrev)
  ------------------
  |  Branch (4342:17): [True: 73.0k, False: 107k]
  ------------------
 4343|  73.0k|            {
 4344|       |                /* add exit delta and edge */
 4345|  73.0k|                vf[2].e_Out = ie;
 4346|  73.0k|                vf[2].delta_Out = delta;
 4347|  73.0k|            }
 4348|       |
 4349|   180k|            v2 = edge->neighbor12 ^ v1;  /* next vertex */
 4350|   180k|            if (pBNS->vert[v2].type & BNS_VERT_TYPE_ATOM)
  ------------------
  |  |   45|   180k|#define BNS_VERT_TYPE_ATOM          0x0001
  ------------------
  |  Branch (4350:17): [True: 44.4k, False: 135k]
  ------------------
 4351|  44.4k|            {
 4352|  44.4k|                nNumVisitedAtoms++;
 4353|  44.4k|            }
 4354|       |
 4355|   180k|            if (( ANY_VERT_TYPE( pBNS->vert[v2].type ) || i == n - 1 ) &&
  ------------------
  |  | 4167|   360k|#define ANY_VERT_TYPE(X) (((X) & (BNS_VERT_TYPE_ATOM | BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP)) && \
  |  |  ------------------
  |  |  |  |   45|   180k|#define BNS_VERT_TYPE_ATOM          0x0001
  |  |  ------------------
  |  |               #define ANY_VERT_TYPE(X) (((X) & (BNS_VERT_TYPE_ATOM | BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP)) && \
  |  |  ------------------
  |  |  |  |   47|   180k|#define BNS_VERT_TYPE_TGROUP        0x0004
  |  |  ------------------
  |  |               #define ANY_VERT_TYPE(X) (((X) & (BNS_VERT_TYPE_ATOM | BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP)) && \
  |  |  ------------------
  |  |  |  |   49|   180k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (4167:27): [True: 90.9k, False: 89.4k]
  |  |  ------------------
  |  | 4168|   360k|                           !((X) & (BNS_VERT_TYPE_SUPER_TGROUP)))
  |  |  ------------------
  |  |  |  |   50|  90.9k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  ------------------
  |  |  |  Branch (4168:28): [True: 72.1k, False: 18.8k]
  |  |  ------------------
  ------------------
  |  Branch (4355:59): [True: 13.5k, False: 94.7k]
  ------------------
 4356|  85.6k|                ( vf[0].type & BNS_VERT_TYPE_C_GROUP ) && vf[0].bUsed != VF_USED_ALL)
  ------------------
  |  |   49|  85.6k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
                              ( vf[0].type & BNS_VERT_TYPE_C_GROUP ) && vf[0].bUsed != VF_USED_ALL)
  ------------------
  |  | 4185|  12.5k|#define VF_USED_ALL (VF_USED_IN | VF_USED_OUT)
  |  |  ------------------
  |  |  |  | 4183|  12.5k|#define VF_USED_IN  1
  |  |  ------------------
  |  |               #define VF_USED_ALL (VF_USED_IN | VF_USED_OUT)
  |  |  ------------------
  |  |  |  | 4184|  12.5k|#define VF_USED_OUT 2
  |  |  ------------------
  ------------------
  |  Branch (4356:17): [True: 12.5k, False: 73.1k]
  |  Branch (4356:59): [True: 11.7k, False: 757]
  ------------------
 4357|  11.7k|            {
 4358|       |                /* unused vertex is about to be discarded */
 4359|  11.7k|                nNumDeltaCharge += GetDeltaChargeFromVF( pBNS, pVA, &vf[0] );
 4360|  11.7k|            }
 4361|       |
 4362|   180k|            if (ANY_VERT_TYPE( pBNS->vert[v2].type ))
  ------------------
  |  | 4167|   180k|#define ANY_VERT_TYPE(X) (((X) & (BNS_VERT_TYPE_ATOM | BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP)) && \
  |  |  ------------------
  |  |  |  |   45|   180k|#define BNS_VERT_TYPE_ATOM          0x0001
  |  |  ------------------
  |  |               #define ANY_VERT_TYPE(X) (((X) & (BNS_VERT_TYPE_ATOM | BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP)) && \
  |  |  ------------------
  |  |  |  |   47|   180k|#define BNS_VERT_TYPE_TGROUP        0x0004
  |  |  ------------------
  |  |               #define ANY_VERT_TYPE(X) (((X) & (BNS_VERT_TYPE_ATOM | BNS_VERT_TYPE_TGROUP | BNS_VERT_TYPE_C_GROUP)) && \
  |  |  ------------------
  |  |  |  |   49|   180k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (4167:27): [True: 90.9k, False: 89.4k]
  |  |  ------------------
  |  | 4168|   180k|                           !((X) & (BNS_VERT_TYPE_SUPER_TGROUP)))
  |  |  ------------------
  |  |  |  |   50|  90.9k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  ------------------
  |  |  |  Branch (4168:28): [True: 72.1k, False: 18.8k]
  |  |  ------------------
  ------------------
 4363|  72.1k|            {
 4364|       |                /* shift the queue */
 4365|  72.1k|                vf[0] = vf[1];
 4366|  72.1k|                vf[1] = vf[2];
 4367|  72.1k|                vf[2] = vf[3]; /* make vf[2] empty */
 4368|       |                /* add next vertex */
 4369|  72.1k|                vf[2].v = v2;
 4370|  72.1k|                vf[2].type = pBNS->vert[v2].type;
 4371|  72.1k|                vf[2].e_In = ie;
 4372|  72.1k|                vf[2].delta_In = delta;
 4373|  72.1k|                iPrev = 2; /* indicates a newly added vertex */
 4374|  72.1k|            }
 4375|   108k|            else if (i == n - 1)
  ------------------
  |  Branch (4375:22): [True: 13.5k, False: 94.7k]
  ------------------
 4376|  13.5k|            {
 4377|       |                /* shift the queue */
 4378|  13.5k|                vf[0] = vf[1];
 4379|  13.5k|                vf[1] = vf[2];
 4380|  13.5k|                vf[2] = vf[3]; /* make vf[2] empty */
 4381|  13.5k|                iPrev = 1; /* indicates the last vertex */
 4382|  13.5k|            }
 4383|  94.7k|            else
 4384|  94.7k|            {
 4385|  94.7k|                iPrev = 0; /* no new vertex has been added */
 4386|  94.7k|            }
 4387|       |
 4388|   180k|            if (iPrev && ( vf[1].type & BNS_VERT_TYPE_ATOM ))
  ------------------
  |  |   45|  85.6k|#define BNS_VERT_TYPE_ATOM          0x0001
  ------------------
  |  Branch (4388:17): [True: 85.6k, False: 94.7k]
  |  Branch (4388:26): [True: 46.3k, False: 39.3k]
  ------------------
 4389|  46.3k|            {
 4390|       |                /* a new vertex has just been added and  */
 4391|       |                /* an atom is in the middle of the queue */
 4392|  46.3k|                EdgeIndex eCPlus, eCMinus;
 4393|  46.3k|                v = vf[1].v;
 4394|  46.3k|                nInitCharge = pVA[v].cInitCharge;
 4395|  46.3k|                nPlusFlow = nMinusFlow = 0;
 4396|  46.3k|                if (( eCPlus = pVA[v].nCPlusGroupEdge - 1 ) >= 0)
  ------------------
  |  Branch (4396:21): [True: 42.7k, False: 3.65k]
  ------------------
 4397|  42.7k|                {
 4398|  42.7k|                    nPlusFlow = pBNS->edge[eCPlus].cap
 4399|  42.7k|                        - pBNS->edge[eCPlus].flow;
 4400|  42.7k|                }
 4401|  46.3k|                if (( eCMinus = pVA[v].nCMinusGroupEdge - 1 ) >= 0)
  ------------------
  |  Branch (4401:21): [True: 34.8k, False: 11.5k]
  ------------------
 4402|  34.8k|                {
 4403|  34.8k|                    nMinusFlow = -pBNS->edge[eCMinus].flow;
 4404|  34.8k|                }
 4405|  46.3k|                nInitCharge += nPlusFlow + nMinusFlow;
 4406|       |
 4407|  46.3k|                nDeltaH = nDeltaCharge = 0;
 4408|       |
 4409|  46.3k|                if (vf[0].type & BNS_VERT_TYPE_TGROUP)
  ------------------
  |  |   47|  46.3k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
  |  Branch (4409:21): [True: 53, False: 46.3k]
  ------------------
 4410|     53|                {
 4411|     53|                    nDeltaH -= delta;
 4412|     53|                }
 4413|  46.3k|                else if (( vf[0].type & BNS_VERT_TYPE_C_GROUP ) &&
  ------------------
  |  |   49|  46.3k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
  |  Branch (4413:26): [True: 9.71k, False: 36.5k]
  ------------------
 4414|  9.71k|                         !( vf[0].bUsed & VF_USED_OUT ))
  ------------------
  |  | 4184|  9.71k|#define VF_USED_OUT 2
  ------------------
  |  Branch (4414:26): [True: 9.71k, False: 0]
  ------------------
 4415|  9.71k|                {
 4416|  9.71k|                    if (vf[0].e_Out == eCPlus || vf[0].e_Out == eCMinus)
  ------------------
  |  Branch (4416:25): [True: 5.51k, False: 4.19k]
  |  Branch (4416:50): [True: 4.19k, False: 0]
  ------------------
 4417|  9.71k|                    {
 4418|  9.71k|                        nDeltaCharge -= vf[0].delta_Out;
 4419|  9.71k|                        vf[0].bUsed |= VF_USED_OUT;
  ------------------
  |  | 4184|  9.71k|#define VF_USED_OUT 2
  ------------------
 4420|  9.71k|                    }
 4421|  9.71k|                }
 4422|       |
 4423|  46.3k|                if (vf[2].type & BNS_VERT_TYPE_TGROUP)
  ------------------
  |  |   47|  46.3k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
  |  Branch (4423:21): [True: 22, False: 46.3k]
  ------------------
 4424|     22|                {
 4425|     22|                    nDeltaH += delta;
 4426|     22|                }
 4427|  46.3k|                else if (( vf[2].type & BNS_VERT_TYPE_C_GROUP ) &&
  ------------------
  |  |   49|  46.3k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
  |  Branch (4427:26): [True: 12.9k, False: 33.3k]
  ------------------
 4428|  12.9k|                         !( vf[2].bUsed & VF_USED_IN ))
  ------------------
  |  | 4183|  12.9k|#define VF_USED_IN  1
  ------------------
  |  Branch (4428:26): [True: 12.9k, False: 0]
  ------------------
 4429|  12.9k|                {
 4430|  12.9k|                    if (vf[2].e_In == eCPlus || vf[2].e_In == eCMinus)
  ------------------
  |  Branch (4430:25): [True: 6.36k, False: 6.59k]
  |  Branch (4430:49): [True: 6.59k, False: 0]
  ------------------
 4431|  12.9k|                    {
 4432|  12.9k|                        nDeltaCharge -= vf[2].delta_In;
 4433|  12.9k|                        vf[2].bUsed |= VF_USED_IN;
  ------------------
  |  | 4183|  12.9k|#define VF_USED_IN  1
  ------------------
 4434|  12.9k|                    }
 4435|  12.9k|                }
 4436|       |
 4437|  46.3k|                if (!nInitCharge && nDeltaCharge)
  ------------------
  |  Branch (4437:21): [True: 29.3k, False: 17.0k]
  |  Branch (4437:37): [True: 11.8k, False: 17.5k]
  ------------------
 4438|  11.8k|                {
 4439|  11.8k|                    nNumDeltaCharge++;
 4440|  11.8k|                }
 4441|  34.5k|                else if (nInitCharge && 0 == nInitCharge + nDeltaCharge)
  ------------------
  |  Branch (4441:26): [True: 17.0k, False: 17.5k]
  |  Branch (4441:41): [True: 9.74k, False: 7.29k]
  ------------------
 4442|  9.74k|                {
 4443|  9.74k|                    nNumDeltaCharge--;
 4444|  9.74k|                }
 4445|       |
 4446|  46.3k|                nNumDeltaH += abs( nDeltaH );
 4447|       |                /* nNumDeltaCharge += abs(nDeltaCharge); */
 4448|  46.3k|                vf[1].bUsed = VF_USED_ALL;
  ------------------
  |  | 4185|  46.3k|#define VF_USED_ALL (VF_USED_IN | VF_USED_OUT)
  |  |  ------------------
  |  |  |  | 4183|  46.3k|#define VF_USED_IN  1
  |  |  ------------------
  |  |               #define VF_USED_ALL (VF_USED_IN | VF_USED_OUT)
  |  |  ------------------
  |  |  |  | 4184|  46.3k|#define VF_USED_OUT 2
  |  |  ------------------
  ------------------
 4449|  46.3k|            }
 4450|   180k|        }
 4451|       |
 4452|  76.4k|        for (j = 0; j < 3; j++)
  ------------------
  |  Branch (4452:21): [True: 57.3k, False: 19.1k]
  ------------------
 4453|  57.3k|        {
 4454|  57.3k|            nNumDeltaCharge += GetDeltaChargeFromVF( pBNS, pVA, &vf[j] );
 4455|  57.3k|        }
 4456|       |
 4457|  19.1k|        *pnDeltaH += nNumDeltaH;
 4458|  19.1k|        *pnDeltaCharge += nNumDeltaCharge;
 4459|  19.1k|        *pnNumVisitedAtoms += nNumVisitedAtoms;
 4460|       |
 4461|       |
 4462|  19.1k|        if (v2 != vLast)
  ------------------
  |  Branch (4462:13): [True: 0, False: 19.1k]
  ------------------
 4463|      0|        {
 4464|      0|            err = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 4465|      0|        }
 4466|  19.1k|    }
 4467|  19.1k|    return err ? err : ret;
  ------------------
  |  Branch (4467:12): [True: 0, False: 19.1k]
  ------------------
 4468|  19.1k|}
RunBnsTestOnce:
 4474|  40.9k|{
 4475|  40.9k|    int bChangeFlow = 0; /* do not change flow */
 4476|  40.9k|    int delta, ret, ret2, pass; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 4477|       |
 4478|  40.9k|    ReInitBnStructAltPaths( pBNS );
 4479|  40.9k|    pass = 0;
 4480|  40.9k|    pBNS->alt_path = pBNS->altp[pass];
 4481|  40.9k|    pBNS->num_altp = 0;
 4482|  40.9k|    pBNS->bChangeFlow = 0;
 4483|  40.9k|    delta = BalancedNetworkSearch( pBNS, pBD, bChangeFlow );
 4484|  40.9k|    if (delta > 0)
  ------------------
  |  Branch (4484:9): [True: 19.1k, False: 21.8k]
  ------------------
 4485|  19.1k|    {
 4486|  19.1k|        pBNS->alt_path = pBNS->altp[pass];
 4487|  19.1k|        *pvFirst = ALTP_START_ATOM( pBNS->alt_path );
  ------------------
  |  |  103|  19.1k|#define ALTP_START_ATOM(altp)           (altp)[iALTP_START_ATOM].number
  ------------------
 4488|  19.1k|        *pPathLen = ALTP_PATH_LEN( pBNS->alt_path );
  ------------------
  |  |  101|  19.1k|#define ALTP_PATH_LEN(altp)             (altp)[iALTP_PATH_LEN].number  /* number of bonds = number of atoms-1*/
  ------------------
 4489|  19.1k|        *pvLast = ALTP_END_ATOM( pBNS->alt_path );
  ------------------
  |  |  102|  19.1k|#define ALTP_END_ATOM(altp)             (altp)[iALTP_END_ATOM].number
  ------------------
 4490|  19.1k|        pBNS->num_altp++;
 4491|  19.1k|        ret2 = EvaluateChargeChanges( pBNS, pVA, pnDeltaH, pnDeltaCharge, pnNumVisitedAtoms ); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 4492|  19.1k|    }
 4493|  21.8k|    else
 4494|  21.8k|    {
 4495|  21.8k|        *pvFirst = NO_VERTEX;
  ------------------
  |  |  118|  21.8k|#define NO_VERTEX    -2
  ------------------
 4496|  21.8k|        *pPathLen = 0;
 4497|  21.8k|        *pvLast = NO_VERTEX;
  ------------------
  |  |  118|  21.8k|#define NO_VERTEX    -2
  ------------------
 4498|  21.8k|        ret2 = 0;
 4499|  21.8k|    }
 4500|       |
 4501|  40.9k|    ReInitBnStructAltPaths( pBNS );
 4502|       |
 4503|  40.9k|    ret = ReInitBnData( pBD );
 4504|       |
 4505|  40.9k|    return ( delta >= 0 && ret > 0 ) ? -ret
  ------------------
  |  Branch (4505:14): [True: 40.9k, False: 0]
  |  Branch (4505:28): [True: 0, False: 40.9k]
  ------------------
 4506|  40.9k|        : delta;
 4507|  40.9k|}
RunBnsRestoreOnce:
 4512|   138k|{
 4513|       |    /* run BNS for the first time */
 4514|   138k|    int nTotalDelta = 0, ret = 0;
 4515|   138k|    int nDelta;
 4516|       |
 4517|   138k|    ReInitBnStructAltPaths( pBNS );
 4518|       |
 4519|   138k|    do
 4520|   199k|    {
 4521|   199k|        nDelta = RunBalancedNetworkSearch( pBNS, pBD, BNS_EF_CHNG_FLOW );
  ------------------
  |  |  370|   199k|#define BNS_EF_CHNG_FLOW      1  /* change Balanced Network (BN) flow inside the BNS search */
  ------------------
 4522|   199k|        if (IS_BNS_ERROR( nDelta ))
  ------------------
  |  |   67|   199k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|   199k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|   199k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|   199k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 199k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 199k]
  |  |  ------------------
  ------------------
 4523|      0|        {
 4524|      0|            ret = nDelta;
 4525|      0|            goto exit_function;
 4526|      0|        }
 4527|   199k|        nTotalDelta += nDelta;
 4528|   199k|        ReInitBnStructAltPaths( pBNS );
 4529|   199k|        ret = ReInitBnData( pBD );
 4530|   199k|        if (ret > 0)
  ------------------
  |  Branch (4530:13): [True: 0, False: 199k]
  ------------------
 4531|      0|        {
 4532|      0|            ret = -ret;
 4533|      0|            goto exit_function;
 4534|      0|        }
 4535|   199k|    }
 4536|   199k|    while (nDelta > 0 && ret == 0);
  ------------------
  |  Branch (4536:12): [True: 60.9k, False: 138k]
  |  Branch (4536:26): [True: 60.9k, False: 0]
  ------------------
 4537|       |
 4538|   138k|    pBNS->tot_st_flow += 2 * nTotalDelta;
 4539|       |
 4540|   138k|    ret = nTotalDelta;
 4541|       |
 4542|   138k|exit_function:
 4543|   138k|    return ret;
 4544|   138k|}
comp_cc_cand:
 4550|  1.78k|{
 4551|  1.78k|    const CC_CAND *p1 = (const CC_CAND *) a1;
 4552|  1.78k|    const CC_CAND *p2 = (const CC_CAND *) a2;
 4553|  1.78k|    int            ret;
 4554|       |
 4555|  1.78k|    if ((ret = (int) p2->cMetal - (int) p1->cMetal)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4555:9): [True: 72, False: 1.71k]
  ------------------
 4556|     72|        return ret; /* metal first */
 4557|  1.71k|    if ((ret = (int) p2->cNumBondsToMetal - (int) p1->cNumBondsToMetal)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4557:9): [True: 55, False: 1.65k]
  ------------------
 4558|     55|        return ret; /* connected to metal first */
 4559|  1.65k|    if ((ret = (int) p2->cPeriodicRowNumber - (int) p1->cPeriodicRowNumber)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4559:9): [True: 271, False: 1.38k]
  ------------------
 4560|    271|        return ret; /* heaviest first */
 4561|  1.38k|    if ((ret = (int) p2->num_bonds - (int) p1->num_bonds)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4561:9): [True: 19, False: 1.36k]
  ------------------
 4562|     19|        return ret; /* more bonds first */
 4563|  1.36k|    if ((ret = (int) p1->chem_valence - (int) p2->chem_valence)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4563:9): [True: 16, False: 1.35k]
  ------------------
 4564|     16|        return ret; /* less bond order first */
 4565|  1.35k|    if ((!p1->cNumValenceElectrons && p2->cNumValenceElectrons)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4565:10): [True: 13, False: 1.33k]
  |  Branch (4565:39): [True: 0, False: 13]
  ------------------
 4566|      0|        return -1; /* no valence electrons first */
 4567|  1.35k|    if ((!p2->cNumValenceElectrons && p1->cNumValenceElectrons)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4567:10): [True: 13, False: 1.33k]
  |  Branch (4567:39): [True: 0, False: 13]
  ------------------
 4568|      0|        return -1; /* no valence electrons first */
 4569|  1.35k|    if (((int) p2->cNumValenceElectrons - (int) p1->cNumValenceElectrons)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4569:9): [True: 306, False: 1.04k]
  ------------------
 4570|    306|        return ret; /* more valence electrons first */
 4571|  1.04k|    ret = (int) p2->iat - (int) p1->iat; /* greater canon number first */
 4572|       |
 4573|  1.04k|    return ret;
 4574|  1.35k|}
get_pVA_atom_type:
 4594|  1.42k|{
 4595|  1.42k|    int type = 0, val;
 4596|  1.42k|    if (pVA[iat].cNumValenceElectrons == 4)
  ------------------
  |  Branch (4596:9): [True: 150, False: 1.27k]
  ------------------
 4597|    150|    {
 4598|    150|        if (pVA[iat].cPeriodicRowNumber == 1)
  ------------------
  |  Branch (4598:13): [True: 133, False: 17]
  ------------------
 4599|    133|        {
 4600|    133|            type |= EL_TYPE_C;
  ------------------
  |  |  390|    133|#define EL_TYPE_C     0x0010
  ------------------
 4601|    133|        }
 4602|    150|    }
 4603|       |
 4604|  1.27k|    else if (pVA[iat].cNumValenceElectrons == 6)
  ------------------
  |  Branch (4604:14): [True: 438, False: 833]
  ------------------
 4605|    438|    {
 4606|    438|        if (pVA[iat].cPeriodicRowNumber == 1)
  ------------------
  |  Branch (4606:13): [True: 138, False: 300]
  ------------------
 4607|    138|        {
 4608|    138|            type |= EL_TYPE_O;
  ------------------
  |  |  386|    138|#define EL_TYPE_O     0x0001
  ------------------
 4609|    138|        }
 4610|    300|        else if (pVA[iat].cPeriodicRowNumber < 5)
  ------------------
  |  Branch (4610:18): [True: 300, False: 0]
  ------------------
 4611|    300|        {
 4612|    300|            type |= EL_TYPE_S;
  ------------------
  |  |  387|    300|#define EL_TYPE_S     0x0002
  ------------------
 4613|    300|        }
 4614|    438|        if (bond_type == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|    876|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (4614:13): [True: 114, False: 324]
  ------------------
 4615|    114|            ( type & ( EL_TYPE_O | EL_TYPE_S ) ) &&
  ------------------
  |  |  386|    114|#define EL_TYPE_O     0x0001
  ------------------
                          ( type & ( EL_TYPE_O | EL_TYPE_S ) ) &&
  ------------------
  |  |  387|    114|#define EL_TYPE_S     0x0002
  ------------------
  |  Branch (4615:13): [True: 114, False: 0]
  ------------------
 4616|    114|             1 == nNoMetalBondsValence( at, iat ) &&
  ------------------
  |  Branch (4616:14): [True: 54, False: 60]
  ------------------
 4617|     54|             1 == nNoMetalNumBonds( at, iat ))
  ------------------
  |  Branch (4617:14): [True: 51, False: 3]
  ------------------
 4618|     51|        {
 4619|     51|            type |= EL_TYPE_OSt;
  ------------------
  |  |  393|     51|#define EL_TYPE_OSt   0x0100 /* terminal -OH, -O(-), -SH, -S(-), ... from fix_special_bonds(...) */
  ------------------
 4620|     51|        }
 4621|    438|    }
 4622|       |
 4623|    833|    else if (pVA[iat].cNumValenceElectrons == 5)
  ------------------
  |  Branch (4623:14): [True: 633, False: 200]
  ------------------
 4624|    633|    {
 4625|    633|        if (pVA[iat].cPeriodicRowNumber == 1)
  ------------------
  |  Branch (4625:13): [True: 513, False: 120]
  ------------------
 4626|    513|        {
 4627|    513|            type |= EL_TYPE_N;
  ------------------
  |  |  388|    513|#define EL_TYPE_N     0x0004
  ------------------
 4628|    513|        }
 4629|    120|        else
 4630|    120|        {
 4631|    120|            type |= EL_TYPE_P;
  ------------------
  |  |  389|    120|#define EL_TYPE_P     0x0008
  ------------------
 4632|    120|        }
 4633|    633|    }
 4634|       |
 4635|    200|    else if (!is_el_a_metal( pVA[iat].cPeriodicNumber ))
  ------------------
  |  Branch (4635:14): [True: 158, False: 42]
  ------------------
 4636|    158|    {
 4637|    158|        type |= EL_TYPE_X;
  ------------------
  |  |  391|    158|#define EL_TYPE_X     0x0020 /* any not metal */
  ------------------
 4638|    158|    }
 4639|       |
 4640|       |    /* check for possibility to be a tautomeric endpoint (that is, be a Mobile H site) */
 4641|  1.42k|    val = get_endpoint_valence( at[iat].el_number );
 4642|       |
 4643|  1.42k|    if (val && val > at[iat].valence && !at[iat].radical &&
  ------------------
  |  Branch (4643:9): [True: 951, False: 470]
  |  Branch (4643:16): [True: 621, False: 330]
  |  Branch (4643:41): [True: 587, False: 34]
  ------------------
 4644|    587|         -1 <= at[iat].charge && at[iat].charge <= 0 &&
  ------------------
  |  Branch (4644:10): [True: 587, False: 0]
  |  Branch (4644:34): [True: 580, False: 7]
  ------------------
 4645|    580|         val == at[iat].chem_bonds_valence - at[iat].charge + at[iat].num_H)
  ------------------
  |  Branch (4645:10): [True: 579, False: 1]
  ------------------
 4646|    579|    {
 4647|    579|        type |= EL_TYPE_PT;
  ------------------
  |  |  394|    579|#define EL_TYPE_PT    0x0200 /* may be a tautomeric endpoint */
  ------------------
 4648|    579|    }
 4649|       |
 4650|  1.42k|    return type;
 4651|  1.42k|}
AllocEdgeList:
 4656|  5.58M|{
 4657|  5.58M|    switch (nLen)
 4658|  5.58M|    {
 4659|  2.59M|        case EDGE_LIST_FREE:
  ------------------
  |  |  243|  2.59M|#define EDGE_LIST_FREE   (-2)
  ------------------
  |  Branch (4659:9): [True: 2.59M, False: 2.99M]
  ------------------
 4660|  2.59M|            if (NULL != pEdges->pnEdges)
  ------------------
  |  Branch (4660:17): [True: 350k, False: 2.24M]
  ------------------
 4661|   350k|            {
 4662|   350k|                inchi_free( pEdges->pnEdges );
  ------------------
  |  | 1152|   350k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 350k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 350k]
  |  |  ------------------
  ------------------
 4663|   350k|            }
 4664|       |            /* fall through */
 4665|  5.23M|        case EDGE_LIST_CLEAR:
  ------------------
  |  |  242|  5.23M|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  |  Branch (4665:9): [True: 2.63M, False: 2.94M]
  ------------------
 4666|  5.23M|            memset( pEdges, 0, sizeof( *pEdges ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4667|  5.23M|            break;
 4668|   351k|        default:
  ------------------
  |  Branch (4668:9): [True: 351k, False: 5.23M]
  ------------------
 4669|   351k|            if (nLen > 0 && nLen != pEdges->num_alloc)
  ------------------
  |  Branch (4669:17): [True: 351k, False: 19]
  |  Branch (4669:29): [True: 351k, False: 1]
  ------------------
 4670|   351k|            {
 4671|   351k|                EdgeIndex *tmp_edges = pEdges->pnEdges;
 4672|   351k|                int        tmp_num = pEdges->num_edges;
 4673|   351k|                pEdges->pnEdges = (EdgeIndex *) inchi_calloc( nLen, sizeof( pEdges->pnEdges[0] ) );
  ------------------
  |  | 1146|   351k|#define inchi_calloc   calloc
  ------------------
 4674|   351k|                if (!pEdges->pnEdges)
  ------------------
  |  Branch (4674:21): [True: 0, False: 351k]
  ------------------
 4675|      0|                {
 4676|      0|                    return RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 4677|      0|                }
 4678|   351k|                tmp_num = inchi_min( tmp_num, nLen );
  ------------------
  |  |  139|   351k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 351k, False: 0]
  |  |  ------------------
  ------------------
 4679|   351k|                if (tmp_edges && tmp_num > 0)
  ------------------
  |  Branch (4679:21): [True: 902, False: 350k]
  |  Branch (4679:34): [True: 373, False: 529]
  ------------------
 4680|    373|                {
 4681|    373|                    memcpy(pEdges->pnEdges, tmp_edges, tmp_num * sizeof(pEdges->pnEdges[0]));
 4682|    373|                    pEdges->num_edges = tmp_num;
 4683|    373|                }
 4684|   350k|                else
 4685|   350k|                {
 4686|   350k|                    pEdges->num_edges = 0;
 4687|   350k|                }
 4688|   351k|                if (tmp_edges)
  ------------------
  |  Branch (4688:21): [True: 902, False: 350k]
  ------------------
 4689|    902|                {
 4690|    902|                    inchi_free( tmp_edges );
  ------------------
  |  | 1152|    902|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 902, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 902]
  |  |  ------------------
  ------------------
 4691|    902|                }
 4692|   351k|                pEdges->num_alloc = nLen;
 4693|   351k|                return 0;
 4694|   351k|            }
 4695|     20|            break;
 4696|  5.58M|    }
 4697|       |
 4698|  5.23M|    return 0;
 4699|  5.58M|}
AddToEdgeList:
 4704|   823k|{
 4705|   823k|    if (pEdges->num_alloc == pEdges->num_edges)
  ------------------
  |  Branch (4705:9): [True: 143k, False: 680k]
  ------------------
 4706|   143k|    {
 4707|   143k|        int ret;
 4708|   143k|        if (nAddLen <= 0)
  ------------------
  |  Branch (4708:13): [True: 0, False: 143k]
  ------------------
 4709|      0|        {
 4710|      0|            return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 4711|      0|        }
 4712|   143k|        if ((ret = AllocEdgeList( pEdges, pEdges->num_alloc + nAddLen ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4712:13): [True: 0, False: 143k]
  ------------------
 4713|      0|        {
 4714|      0|            return ret;
 4715|      0|        }
 4716|   143k|    }
 4717|       |
 4718|   823k|    pEdges->pnEdges[pEdges->num_edges++] = (EdgeIndex) iedge;
 4719|   823k|    return 0;
 4720|   823k|}
RemoveFromEdgeListByIndex:
 4725|    293|{
 4726|    293|    int len;
 4727|    293|    if (0 <= ( len = pEdges->num_edges - index - 1 ))
  ------------------
  |  Branch (4727:9): [True: 293, False: 0]
  ------------------
 4728|    293|    {
 4729|    293|        if (len)
  ------------------
  |  Branch (4729:13): [True: 72, False: 221]
  ------------------
 4730|     72|        {
 4731|     72|            memmove(pEdges->pnEdges + index, pEdges->pnEdges + index + 1, len * sizeof(pEdges->pnEdges[0]));
 4732|     72|        }
 4733|    293|        pEdges->num_edges--;
 4734|    293|        pEdges->pnEdges[pEdges->num_edges] = 0;
 4735|    293|        return 0;
 4736|    293|    }
 4737|      0|    return -1;
 4738|    293|}
FindInEdgeList:
 4743|    542|{
 4744|    542|    int i;
 4745|    542|    EdgeIndex ie = iedge;
 4746|  1.64k|    for (i = pEdges->num_edges - 1; 0 <= i; i--)
  ------------------
  |  Branch (4746:37): [True: 1.16k, False: 487]
  ------------------
 4747|  1.16k|    {
 4748|  1.16k|        if (ie == pEdges->pnEdges[i])
  ------------------
  |  Branch (4748:13): [True: 55, False: 1.10k]
  ------------------
 4749|     55|        {
 4750|     55|            return i;
 4751|     55|        }
 4752|  1.16k|    }
 4753|       |
 4754|    487|    return -1;
 4755|    542|}
RemoveFromEdgeListByValue:
 4760|  1.08k|{
 4761|  1.08k|    int i, ret, n = 0;
 4762|  1.08k|    EdgeIndex ie = iedge;
 4763|  2.10k|    for (i = pEdges->num_edges - 1; 0 <= i; i--)
  ------------------
  |  Branch (4763:37): [True: 1.01k, False: 1.08k]
  ------------------
 4764|  1.01k|    {
 4765|  1.01k|        if (ie == pEdges->pnEdges[i])
  ------------------
  |  Branch (4765:13): [True: 293, False: 722]
  ------------------
 4766|    293|        {
 4767|    293|            if ((ret = RemoveFromEdgeListByIndex( pEdges, i ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4767:17): [True: 0, False: 293]
  ------------------
 4768|      0|            {
 4769|      0|                return ret;
 4770|      0|            }
 4771|    293|            n++;
 4772|    293|        }
 4773|  1.01k|    }
 4774|       |
 4775|  1.08k|    return n;
 4776|  1.08k|}
AllocBfsQueue:
 4781|   263k|{
 4782|   263k|    int ret = 0;
 4783|   263k|    switch (num_at)
 4784|   263k|    {
 4785|  87.9k|        case BFS_Q_FREE:
  ------------------
  |  |   61|  87.9k|#define BFS_Q_FREE   (-2)
  ------------------
  |  Branch (4785:9): [True: 87.9k, False: 175k]
  ------------------
 4786|  87.9k|            if (pQ->q)
  ------------------
  |  Branch (4786:17): [True: 87.9k, False: 0]
  ------------------
 4787|  87.9k|            {
 4788|  87.9k|                pQ->q = QueueDelete( pQ->q );
 4789|  87.9k|            }
 4790|  87.9k|            if (pQ->nAtomLevel)
  ------------------
  |  Branch (4790:17): [True: 87.9k, False: 0]
  ------------------
 4791|  87.9k|            {
 4792|  87.9k|                inchi_free( pQ->nAtomLevel );
  ------------------
  |  | 1152|  87.9k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 87.9k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 87.9k]
  |  |  ------------------
  ------------------
 4793|  87.9k|            }
 4794|  87.9k|            if (pQ->cSource)
  ------------------
  |  Branch (4794:17): [True: 87.9k, False: 0]
  ------------------
 4795|  87.9k|            {
 4796|  87.9k|                inchi_free( pQ->cSource );
  ------------------
  |  | 1152|  87.9k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 87.9k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 87.9k]
  |  |  ------------------
  ------------------
 4797|  87.9k|            }
 4798|       |            /* fall through */
 4799|   175k|        case BFS_Q_CLEAR:
  ------------------
  |  |   60|   175k|#define BFS_Q_CLEAR  (-1)
  ------------------
  |  Branch (4799:9): [True: 87.9k, False: 175k]
  ------------------
 4800|   175k|            memset( pQ, 0, sizeof( *pQ ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4801|   175k|            return 0;
 4802|       |
 4803|  87.9k|        default:
  ------------------
  |  Branch (4803:9): [True: 87.9k, False: 175k]
  ------------------
 4804|  87.9k|            if (num_at <= 0)
  ------------------
  |  Branch (4804:17): [True: 0, False: 87.9k]
  ------------------
 4805|      0|            {
 4806|      0|                ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 4807|      0|                goto exit_function;
 4808|      0|            }
 4809|  87.9k|            if (num_at > pQ->num_at)
  ------------------
  |  Branch (4809:17): [True: 87.9k, False: 0]
  ------------------
 4810|  87.9k|            {
 4811|  87.9k|                if (pQ->num_at)
  ------------------
  |  Branch (4811:21): [True: 0, False: 87.9k]
  ------------------
 4812|      0|                {
 4813|      0|                    AllocBfsQueue( pQ, BFS_Q_FREE, 0 );
  ------------------
  |  |   61|      0|#define BFS_Q_FREE   (-2)
  ------------------
 4814|      0|                }
 4815|  87.9k|                pQ->q = QueueCreate( num_at + 1, sizeof( qInt ) );
 4816|  87.9k|                pQ->nAtomLevel = (AT_RANK*) inchi_calloc( num_at, sizeof( pQ->nAtomLevel[0] ) );
  ------------------
  |  | 1146|  87.9k|#define inchi_calloc   calloc
  ------------------
 4817|  87.9k|                pQ->cSource = (S_CHAR *) inchi_calloc( num_at, sizeof( pQ->cSource[0] ) );
  ------------------
  |  | 1146|  87.9k|#define inchi_calloc   calloc
  ------------------
 4818|  87.9k|                if (!pQ->q || !pQ->cSource || !pQ->nAtomLevel)
  ------------------
  |  Branch (4818:21): [True: 0, False: 87.9k]
  |  Branch (4818:31): [True: 0, False: 87.9k]
  |  Branch (4818:47): [True: 0, False: 87.9k]
  ------------------
 4819|      0|                {
 4820|      0|                    ret = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 4821|      0|                    goto exit_function;
 4822|      0|                }
 4823|  87.9k|                pQ->num_at = num_at;
 4824|  87.9k|            }
 4825|  87.9k|            pQ->min_ring_size = min_ring_size;
 4826|   263k|    }
 4827|       |
 4828|  87.9k|exit_function:
 4829|  87.9k|    return ret;
 4830|   263k|}
RemoveForbiddenEdgeMask:
 4835|  1.07M|{
 4836|  1.07M|    int i, mask = ~forbidden_edge_mask;
 4837|  1.55M|    for (i = 0; i < pEdges->num_edges; i++)
  ------------------
  |  Branch (4837:17): [True: 477k, False: 1.07M]
  ------------------
 4838|   477k|    {
 4839|   477k|        pBNS->edge[pEdges->pnEdges[i]].forbidden &= mask;
 4840|   477k|    }
 4841|  1.07M|}
SetForbiddenEdgeMask:
 4846|   192k|{
 4847|   192k|    int i;
 4848|   403k|    for (i = 0; i < pEdges->num_edges; i++)
  ------------------
  |  Branch (4848:17): [True: 211k, False: 192k]
  ------------------
 4849|   211k|    {
 4850|   211k|        pBNS->edge[pEdges->pnEdges[i]].forbidden |= forbidden_edge_mask;
 4851|   211k|    }
 4852|   192k|}
RemoveForbiddenBondFlowBits:
 4857|  1.90k|{
 4858|  1.90k|    BNS_EDGE   *e;
 4859|  1.90k|    int         i;
 4860|  1.90k|    int         inv_forbidden_edge_mask = ~forbidden_edge_mask_int;
 4861|  12.5k|    for (i = 0, e = pBNS->edge; i < pBNS->num_bonds; i++, e++)
  ------------------
  |  Branch (4861:33): [True: 10.6k, False: 1.90k]
  ------------------
 4862|  10.6k|    {
 4863|  10.6k|        e->forbidden &= inv_forbidden_edge_mask;
 4864|  10.6k|    }
 4865|  1.90k|}
GetChargeFlowerUpperEdge:
 4881|   620k|{
 4882|   620k|    int ret = NO_VERTEX, i, j, k, i0, i1;
  ------------------
  |  |  118|   620k|#define NO_VERTEX    -2
  ------------------
 4883|   620k|    Vertex  v0, v1[3], vc, v_t, v;
 4884|   620k|    BNS_EDGE   *pe, *pe1[3], *pe_t;
 4885|   620k|    BNS_VERTEX *pv0, *pv1[3], *pv_t;
 4886|       |
 4887|   620k|    if (nChargeEdge < 0)
  ------------------
  |  Branch (4887:9): [True: 366k, False: 254k]
  ------------------
 4888|   366k|    {
 4889|   366k|        goto exit_function;
 4890|   366k|    }
 4891|       |
 4892|   254k|    pe = pBNS->edge + nChargeEdge;
 4893|   254k|    vc = pe->neighbor1; /* charge vertex */
 4894|   254k|    if (!IS_BNS_VT_C_GR( pBNS->vert[vc].type ))
  ------------------
  |  |   78|   254k|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   71|   254k|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|   254k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|   254k|#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)
  |  |  ------------------
  |  |  |  |   49|   254k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  ------------------
  |  Branch (4894:9): [True: 170k, False: 83.5k]
  ------------------
 4895|   170k|    {
 4896|   170k|        vc = vc ^ pe->neighbor12;
 4897|   170k|    }
 4898|       |
 4899|   254k|    v0 = vc ^ pe->neighbor12; /* ChargeStruct vertex ? */
 4900|   254k|    pv0 = pBNS->vert + v0;
 4901|   254k|    if (IS_BNS_VT_ATOM( pv0->type ))
  ------------------
  |  |   83|   254k|#define IS_BNS_VT_ATOM(X)           ((X) & BNS_VERT_TYPE_ATOM)
  |  |  ------------------
  |  |  |  |   45|   254k|#define BNS_VERT_TYPE_ATOM          0x0001
  |  |  ------------------
  |  |  |  Branch (83:37): [True: 170k, False: 83.5k]
  |  |  ------------------
  ------------------
 4902|   170k|    {
 4903|   170k|        goto exit_function; /* no charge flower exists */
 4904|   170k|    }
 4905|       |
 4906|       |    /* 2 edges from v0 */
 4907|   320k|    for (i = j = 0; i < pv0->num_adj_edges && j < 3; i++)
  ------------------
  |  Branch (4907:21): [True: 236k, False: 83.5k]
  |  Branch (4907:47): [True: 236k, False: 0]
  ------------------
 4908|   236k|    {
 4909|   236k|        pe1[j] = pBNS->edge + pv0->iedge[i];
 4910|   236k|        if (vc != ( v1[j] = pe1[j]->neighbor12 ^ v0 ) &&
  ------------------
  |  Branch (4910:13): [True: 153k, False: 83.5k]
  ------------------
 4911|   153k|            ( pv1[j] = pBNS->vert + v1[j],
  ------------------
  |  Branch (4911:13): [True: 104k, False: 48.8k]
  ------------------
 4912|   153k|                !IS_BNS_VT_ATOM( pv1[j]->type ) && !IS_BNS_VT_C_GR( pv1[j]->type ) ))
  ------------------
  |  |   83|   306k|#define IS_BNS_VT_ATOM(X)           ((X) & BNS_VERT_TYPE_ATOM)
  |  |  ------------------
  |  |  |  |   45|   153k|#define BNS_VERT_TYPE_ATOM          0x0001
  |  |  ------------------
  ------------------
                              !IS_BNS_VT_ATOM( pv1[j]->type ) && !IS_BNS_VT_C_GR( pv1[j]->type ) ))
  ------------------
  |  |   78|   274k|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   71|   121k|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|   121k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|   121k|#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)
  |  |  ------------------
  |  |  |  |   49|   121k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  ------------------
  |  Branch (4912:17): [True: 121k, False: 31.4k]
  |  Branch (4912:52): [True: 104k, False: 17.4k]
  ------------------
 4913|   104k|        {
 4914|   104k|            j++;
 4915|   104k|        }
 4916|   236k|    }
 4917|       |
 4918|  83.5k|    if (j != 2 || i != pv0->num_adj_edges)
  ------------------
  |  Branch (4918:9): [True: 31.4k, False: 52.1k]
  |  Branch (4918:19): [True: 0, False: 52.1k]
  ------------------
 4919|  31.4k|    {
 4920|  31.4k|        goto exit_function;
 4921|  31.4k|    }
 4922|       |
 4923|  52.1k|    if (pv1[1]->num_adj_edges == 2 &&
  ------------------
  |  Branch (4923:9): [True: 52.1k, False: 0]
  ------------------
 4924|  52.1k|         pv1[0]->num_adj_edges == 3)
  ------------------
  |  Branch (4924:10): [True: 52.1k, False: 0]
  ------------------
 4925|  52.1k|    {
 4926|  52.1k|        i0 = 1;
 4927|  52.1k|        i1 = 0;
 4928|  52.1k|    }
 4929|      0|    else if (pv1[0]->num_adj_edges == 2 &&
  ------------------
  |  Branch (4929:14): [True: 0, False: 0]
  ------------------
 4930|      0|         pv1[1]->num_adj_edges == 3)
  ------------------
  |  Branch (4930:10): [True: 0, False: 0]
  ------------------
 4931|      0|    {
 4932|      0|        i0 = 0;
 4933|      0|        i1 = 1;
 4934|      0|    }
 4935|      0|    else
 4936|      0|    {
 4937|      0|        goto exit_function;
 4938|      0|    }
 4939|       |
 4940|       |    /* additional check: traverse edges around v1[i1] */
 4941|  52.1k|    pv_t = pv1[i1];
 4942|  52.1k|    v_t = v1[i1];
 4943|   208k|    for (i = k = 0; i < pv_t->num_adj_edges; i++)
  ------------------
  |  Branch (4943:21): [True: 156k, False: 52.1k]
  ------------------
 4944|   156k|    {
 4945|   156k|        pe_t = pBNS->edge + pv_t->iedge[i];
 4946|   156k|        v = pe_t->neighbor12 ^ v_t; /* v1[i1] neighbor */
 4947|   156k|        if (v == v0)
  ------------------
  |  Branch (4947:13): [True: 52.1k, False: 104k]
  ------------------
 4948|  52.1k|        {
 4949|  52.1k|            k += 1;
 4950|  52.1k|        }
 4951|   156k|        if (v == v1[i0])
  ------------------
  |  Branch (4951:13): [True: 52.1k, False: 104k]
  ------------------
 4952|  52.1k|        {
 4953|  52.1k|            k += 2;
 4954|  52.1k|        }
 4955|   156k|        if (IS_BNS_VT_ATOM( pBNS->vert[v].type ))
  ------------------
  |  |   83|   156k|#define IS_BNS_VT_ATOM(X)           ((X) & BNS_VERT_TYPE_ATOM)
  |  |  ------------------
  |  |  |  |   45|   156k|#define BNS_VERT_TYPE_ATOM          0x0001
  |  |  ------------------
  |  |  |  Branch (83:37): [True: 52.1k, False: 104k]
  |  |  ------------------
  ------------------
 4956|  52.1k|        {
 4957|  52.1k|            k += 4;
 4958|  52.1k|        }
 4959|   156k|    }
 4960|  52.1k|    if (k != 7)
  ------------------
  |  Branch (4960:9): [True: 0, False: 52.1k]
  ------------------
 4961|      0|    {
 4962|      0|        goto exit_function;
 4963|      0|    }
 4964|       |
 4965|  52.1k|    ret = (int) ( pe1[i0] - pBNS->edge );
 4966|       |
 4967|   620k|exit_function:
 4968|   620k|    return ret;
 4969|  52.1k|}
MakeOneInChIOutOfStrFromINChI2:
 5061|  88.9k|{
 5062|  88.9k|    int ret;
 5063|  88.9k|    INPUT_PARMS ip_loc, *ip;
 5064|  88.9k|    STRUCT_DATA sd_loc, *sd;
 5065|       |
 5066|  88.9k|    ip_loc = *ip_inp;
 5067|  88.9k|    sd_loc = *sd_inp;
 5068|  88.9k|    ip = &ip_loc;
 5069|  88.9k|    sd = &sd_loc;
 5070|       |
 5071|  88.9k|    memset( sd, 0, sizeof( *sd ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5072|       |
 5073|       |    /* create structure out of BNS */
 5074|  88.9k|    memcpy(at2, at, ((long long)pStruct->num_atoms + (long long)pStruct->num_deleted_H) * sizeof(at2[0])); /* djb-rwth: cast operator added */
 5075|  88.9k|    pStruct->at = at2;
 5076|  88.9k|    ret = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 5077|  88.9k|    pStruct->at = at;
 5078|  88.9k|    if (ret < 0)
  ------------------
  |  Branch (5078:9): [True: 0, False: 88.9k]
  ------------------
 5079|      0|    {
 5080|      0|        goto exit_function;/*  out of RAM or other normalization problem */
 5081|      0|    }
 5082|       |
 5083|  88.9k|    pStruct->at = at;
 5084|       |
 5085|  88.9k|    ret = MakeOneInChIOutOfStrFromINChI( pCG, ic, ip, sd, pStruct,
 5086|  88.9k|                                         at2, at3, pTCGroups );
 5087|       |
 5088|  88.9k|    if (ret < 0)
  ------------------
  |  Branch (5088:9): [True: 52, False: 88.8k]
  ------------------
 5089|     52|    {
 5090|     52|        goto exit_function;/*  out of RAM or other normalization problem */
 5091|     52|    }
 5092|  88.8k|    if (at_norm)
  ------------------
  |  Branch (5092:9): [True: 88.8k, False: 0]
  ------------------
 5093|  88.8k|    {
 5094|  88.8k|        *at_norm = pStruct->pOne_norm_data[0]->at;
 5095|  88.8k|    }
 5096|  88.8k|    if (at_prep)
  ------------------
  |  Branch (5096:9): [True: 88.8k, False: 0]
  ------------------
 5097|  88.8k|    {
 5098|  88.8k|        if (pStruct->pOne_norm_data[0]->bTautPreprocessed && pStruct->pOne_norm_data[0]->at_fixed_bonds)
  ------------------
  |  Branch (5098:13): [True: 2.86k, False: 85.9k]
  |  Branch (5098:62): [True: 2.86k, False: 0]
  ------------------
 5099|  2.86k|        {
 5100|  2.86k|            *at_prep = pStruct->pOne_norm_data[0]->at_fixed_bonds;
 5101|  2.86k|        }
 5102|  85.9k|        else
 5103|       |        /* get preprocessed structure in case of Fixed-H */
 5104|  85.9k|            if (pStruct->iMobileH == TAUT_NON && pStruct->pOne_norm_data[1] && pStruct->pOne_norm_data[1]->bTautPreprocessed)
  ------------------
  |  |  574|   171k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5104:17): [True: 1.89k, False: 84.0k]
  |  Branch (5104:50): [True: 893, False: 1.00k]
  |  Branch (5104:80): [True: 593, False: 300]
  ------------------
 5105|    593|            {
 5106|    593|                *at_prep = pStruct->pOne_norm_data[1]->at_fixed_bonds;
 5107|    593|            }
 5108|  85.3k|            else
 5109|  85.3k|            {
 5110|  85.3k|                *at_prep = NULL;
 5111|  85.3k|            }
 5112|  88.8k|    }
 5113|  88.8k|    if (t_group_info)
  ------------------
  |  Branch (5113:9): [True: 88.8k, False: 0]
  ------------------
 5114|  88.8k|    {
 5115|  88.8k|        if (pStruct->iMobileH == TAUT_YES &&
  ------------------
  |  |  575|   177k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5115:13): [True: 86.9k, False: 1.89k]
  ------------------
 5116|  86.9k|             pStruct->One_ti.num_t_groups &&
  ------------------
  |  Branch (5116:14): [True: 1.80k, False: 85.1k]
  ------------------
 5117|  1.80k|             pStruct->One_ti.t_group && pStruct->One_ti.nEndpointAtomNumber)
  ------------------
  |  Branch (5117:14): [True: 1.80k, False: 0]
  |  Branch (5117:41): [True: 1.80k, False: 0]
  ------------------
 5118|  1.80k|        {
 5119|  1.80k|            *t_group_info = &pStruct->One_ti;
 5120|  1.80k|        }
 5121|  87.0k|        else
 5122|  87.0k|        {
 5123|  87.0k|            *t_group_info = NULL;
 5124|  87.0k|        }
 5125|  88.8k|    }
 5126|       |
 5127|  88.9k|exit_function:
 5128|  88.9k|    return ret;
 5129|  88.8k|}
MakeOneInChIOutOfStrFromINChI:
 5141|   146k|{
 5142|       |
 5143|   146k|    INCHI_MODE     bTautFlags = ip->bTautFlags | TG_FLAG_H_ALREADY_REMOVED;
  ------------------
  |  |  943|   146k|#define TG_FLAG_H_ALREADY_REMOVED        0x00020000   /* processing structure restored from InChI */
  ------------------
 5144|   146k|    INCHI_MODE     bTautFlagsDone = 0; /*(ip->bTautFlagsDone | sd->bTautFlagsDone[INCHI_BAS]);*/
 5145|   146k|    INChI       *cur_INChI[TAUT_NUM];
 5146|   146k|    INChI_Aux   *cur_INChI_Aux[TAUT_NUM];
 5147|   146k|    int           i, j, k;
 5148|   146k|    int           iComponent = pTCGroups->iComponent;
 5149|   146k|    int           len_at = pStruct->num_atoms + pStruct->num_deleted_H;
 5150|   146k|    int           num_atoms = pStruct->num_atoms;
 5151|   146k|    long          ulStructTime;
 5152|       |
 5153|   146k|    INP_ATOM_DATA InpCurAtData;
 5154|   146k|    INP_ATOM_DATA *inp_cur_data;
 5155|       |
 5156|   146k|    INP_ATOM_DATA InpNormAtData, InpNormTautData;
 5157|   146k|    INP_ATOM_DATA *inp_norm_data[TAUT_NUM]; /*  = { &InpNormAtData, &InpNormTautData }; */
 5158|       |
 5159|   146k|    int            bOrigCoord = 0;
 5160|   146k|    int            num_at, ret = RI_ERR_PROGR;
  ------------------
  |  |   17|   146k|#define RI_ERR_PROGR   (-3)
  ------------------
 5161|   146k|    struct tagInchiTime ulMaxTime;
 5162|       |
 5163|   146k|    T_GROUP_INFO *t_group_info = NULL;
 5164|       |    /* initialization */
 5165|   146k|    inp_cur_data = &InpCurAtData;
 5166|   146k|    inp_norm_data[TAUT_NON] = &InpNormAtData;
  ------------------
  |  |  574|   146k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5167|   146k|    inp_norm_data[TAUT_YES] = &InpNormTautData;
  ------------------
  |  |  575|   146k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5168|       |
 5169|   146k|    memset( inp_cur_data, 0, sizeof( *inp_cur_data ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5170|   146k|    memset( inp_norm_data[TAUT_NON], 0, sizeof( *inp_norm_data[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  ------------------
  |  |  574|   146k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5171|   146k|    memset( inp_norm_data[TAUT_YES], 0, sizeof( *inp_norm_data[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  ------------------
  |  |  575|   146k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5172|   146k|    ulStructTime = sd->ulStructTime;
 5173|   146k|    memset( sd, 0, sizeof( *sd ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5174|       |
 5175|       |    /* deallocate old results */
 5176|   146k|    free_t_group_info( &pStruct->One_ti );
 5177|   438k|    for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  573|   438k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (5177:17): [True: 292k, False: 146k]
  ------------------
 5178|   292k|    {
 5179|   292k|        Free_INChI( &pStruct->pOneINChI[k] );
 5180|   292k|        Free_INChI_Aux( &pStruct->pOneINChI_Aux[k] );
 5181|   292k|        if (pStruct->pOne_norm_data[k])
  ------------------
  |  Branch (5181:13): [True: 1.53k, False: 290k]
  ------------------
 5182|  1.53k|        {
 5183|  1.53k|            FreeInpAtomData( pStruct->pOne_norm_data[k] );
 5184|  1.53k|            inchi_free( pStruct->pOne_norm_data[k] );
  ------------------
  |  | 1152|  1.53k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 1.53k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 1.53k]
  |  |  ------------------
  ------------------
 5185|  1.53k|            pStruct->pOne_norm_data[k] = NULL;
 5186|  1.53k|        }
 5187|   292k|        cur_INChI[k] = NULL;
 5188|   292k|        cur_INChI_Aux[k] = NULL;
 5189|   292k|    }
 5190|       |
 5191|   146k|    memcpy(at3, at2, sizeof(at3[0]) * len_at);
 5192|       |
 5193|       |    /* prepare the structure */
 5194|   146k|    IncrZeroBondsAndClearEndpts( at3, num_atoms, iComponent + 1 );
 5195|       |
 5196|   146k|    CopySt2At( at3, pStruct->st, pStruct->num_atoms );
 5197|       |
 5198|   146k|    FixUnkn0DStereoBonds( at3, pStruct->num_atoms );
 5199|       |
 5200|   146k|    ret = ReconcileAllCmlBondParities( at3, pStruct->num_atoms, 0 );
 5201|       |
 5202|   146k|    if (ret < 0)
  ------------------
  |  Branch (5202:9): [True: 0, False: 146k]
  ------------------
 5203|      0|    {
 5204|      0|        goto exit_function;
 5205|      0|    }
 5206|       |
 5207|   146k|    if (0 < fix_odd_things( num_atoms, at3, 1, ip->bFixNonUniformDraw ))
  ------------------
  |  Branch (5207:9): [True: 2.99k, False: 143k]
  ------------------
 5208|  2.99k|    {
 5209|  2.99k|        if (sd->nErrorType < _IS_WARNING)
  ------------------
  |  |   11|  2.99k|#define _IS_WARNING 1
  ------------------
  |  Branch (5209:13): [True: 2.99k, False: 0]
  ------------------
 5210|  2.99k|        {
 5211|  2.99k|            sd->nErrorType = _IS_WARNING;
  ------------------
  |  |   11|  2.99k|#define _IS_WARNING 1
  ------------------
 5212|  2.99k|        }
 5213|  2.99k|        sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  570|  2.99k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  978|  2.99k|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
 5214|  2.99k|    }
 5215|       |
 5216|       |    /* allocate and set parameters */
 5217|   146k|    inp_cur_data->at = at3;
 5218|   146k|    inp_cur_data->num_at = num_atoms;
 5219|   146k|    inp_cur_data->num_removed_H = pStruct->num_deleted_H;
 5220|       |
 5221|   146k|    bTautFlagsDone &= ~( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE );
  ------------------
  |  |  981|   146k|#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 );
  ------------------
  |  |  982|   146k|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
 5222|       |
 5223|   146k|    if ((i = bNumHeterAtomHasIsotopicH( at3, num_atoms ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (5223:9): [True: 679, False: 145k]
  ------------------
 5224|    679|    {
 5225|    679|        if (i & 1)
  ------------------
  |  Branch (5225:13): [True: 56, False: 623]
  ------------------
 5226|     56|        {
 5227|     56|            bTautFlagsDone |= TG_FLAG_FOUND_ISOTOPIC_H_DONE;
  ------------------
  |  |  981|     56|#define TG_FLAG_FOUND_ISOTOPIC_H_DONE    0x00004000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
 5228|     56|        }
 5229|    679|        if (i & 2)
  ------------------
  |  Branch (5229:13): [True: 646, False: 33]
  ------------------
 5230|    646|        {
 5231|    646|            bTautFlagsDone |= TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE;
  ------------------
  |  |  982|    646|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
 5232|    646|        }
 5233|    679|    }
 5234|       |
 5235|   146k|    memset( &ulMaxTime, 0, sizeof( ulMaxTime ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5236|       |
 5237|       |    /*  allocate memory for non-tautimeric (k=0) and tautomeric (k=1) results */
 5238|   438k|    for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  573|   438k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (5238:17): [True: 292k, False: 146k]
  ------------------
 5239|   292k|    {
 5240|       |
 5241|   292k|        if (!pStruct->bMobileH || k == pStruct->bMobileH)
  ------------------
  |  Branch (5241:13): [True: 3.92k, False: 288k]
  |  Branch (5241:35): [True: 144k, False: 144k]
  ------------------
 5242|   148k|        {
 5243|       |            /* pStruct->bMobileH=0: k = 0, 1   => allow allocation of both Fixed-H and Mobile-H InChI
 5244|       |               pStruct->bMobileH=1: k = 1 only => allow allocation of only Mobile-H InChI              */
 5245|       |
 5246|       |            /* djb-rwth: introducing variables for correct nAllocMode expression */
 5247|   148k|            int nAM1 = 0, nAM2 = 0;
 5248|   148k|            int nAllocMode = 0;   /* copied from below 2024-09-01 DT */
 5249|       |
 5250|   148k|            if (k == TAUT_YES)
  ------------------
  |  |  575|   148k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5250:17): [True: 146k, False: 1.96k]
  ------------------
 5251|   146k|                nAM1 = REQ_MODE_TAUT;
  ------------------
  |  |   16|   146k|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
 5252|       |
 5253|   148k|            if (bTautFlagsDone & (TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE))
  ------------------
  |  |  981|   148k|#define TG_FLAG_FOUND_ISOTOPIC_H_DONE    0x00004000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
                          if (bTautFlagsDone & (TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE))
  ------------------
  |  |  982|   148k|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  |  Branch (5253:17): [True: 782, False: 147k]
  ------------------
 5254|    782|                nAM2 = ip->nMode & REQ_MODE_ISO;
  ------------------
  |  |   17|    782|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
 5255|       |
 5256|   148k|            nAllocMode = nAM1 | nAM2; /* djb-rwth: original sequence of bit-wise operations had to be rewritten */
 5257|       |
 5258|   148k|            if ((k == TAUT_NON && ( ip->nMode & REQ_MODE_BASIC )) ||
  ------------------
  |  |  574|   296k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                          if ((k == TAUT_NON && ( ip->nMode & REQ_MODE_BASIC )) ||
  ------------------
  |  |   15|  1.96k|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (5258:18): [True: 1.96k, False: 146k]
  |  Branch (5258:35): [True: 1.96k, False: 0]
  ------------------
 5259|   146k|                 (k == TAUT_YES && ( ip->nMode & REQ_MODE_TAUT ))) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |  575|   292k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                               (k == TAUT_YES && ( ip->nMode & REQ_MODE_TAUT ))) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |   16|   146k|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  |  Branch (5259:19): [True: 146k, False: 0]
  |  Branch (5259:36): [True: 146k, False: 0]
  ------------------
 5260|   148k|            {
 5261|       |                /*  alloc INChI and INChI_Aux only if ip->nMode allows this */
 5262|   148k|                cur_INChI[k] = Alloc_INChI( inp_cur_data->at, inp_cur_data->num_at, &inp_cur_data->num_bonds,
 5263|   148k|                                              &inp_cur_data->num_isotopic, nAllocMode );
 5264|   148k|                cur_INChI_Aux[k] = Alloc_INChI_Aux( inp_cur_data->num_at,
 5265|   148k|                                              inp_cur_data->num_isotopic, nAllocMode, bOrigCoord );
 5266|   148k|                if (cur_INChI_Aux[k])
  ------------------
  |  Branch (5266:21): [True: 148k, False: 0]
  ------------------
 5267|   148k|                {
 5268|   148k|                    cur_INChI_Aux[k]->bIsIsotopic = inp_cur_data->num_isotopic;
 5269|   148k|                }
 5270|       |
 5271|       |                /*  alloc memory for the output structure: non-tautomeric and tautomeric (for displaying) */
 5272|   148k|                CreateInpAtomData( inp_norm_data[k], inp_cur_data->num_at + inp_cur_data->num_removed_H, k );
 5273|       |
 5274|   148k|                inp_norm_data[k]->num_removed_H = inp_cur_data->num_removed_H;
 5275|   148k|            }
 5276|      0|            else
 5277|      0|            {
 5278|      0|                FreeInpAtomData( inp_norm_data[k] );
 5279|      0|            }
 5280|   148k|        }
 5281|   144k|        else
 5282|   144k|        {
 5283|   144k|            FreeInpAtomData( inp_norm_data[k] );
 5284|   144k|        }
 5285|   292k|    }
 5286|       |
 5287|   146k|    k = pStruct->bMobileH;
 5288|       |
 5289|       |    /* In case of Fixed-H we have to create InChI for both Fixed-H and Mobile-H */
 5290|       |
 5291|   146k|    num_at = Create_INChI( pCG,
 5292|   146k|                           ic,
 5293|   146k|                           (INPUT_PARMS *) ip,
 5294|   146k|                           cur_INChI,
 5295|   146k|                           cur_INChI_Aux,
 5296|   146k|                           NULL,
 5297|   146k|                           inp_cur_data->at,
 5298|   146k|                           inp_norm_data,
 5299|   146k|                           inp_cur_data->num_at + inp_cur_data->num_removed_H,
 5300|   146k|                           NULL,
 5301|   146k|                           ip->nMode,
 5302|   146k|                           &bTautFlags,
 5303|   146k|                           &bTautFlagsDone,
 5304|   146k|                           NULL /* &ulMaxTime*/,
 5305|   146k|                           &pStruct->One_ti,
 5306|   146k|                           sd->pStrErrStruct );
 5307|       |
 5308|   146k|    SetConnectedComponentNumber( inp_cur_data->at, inp_cur_data->num_at, iComponent + 1 ); /*  normalization alters structure component number */
 5309|       |
 5310|       |    /* Detect InChI errors */
 5311|       |
 5312|   146k|    if (num_at < 0)
  ------------------
  |  Branch (5312:9): [True: 52, False: 145k]
  ------------------
 5313|     52|    {
 5314|     52|        ret = num_at;
 5315|     52|    }
 5316|   145k|    else if (cur_INChI[k] && cur_INChI[k]->nErrorCode)
  ------------------
  |  Branch (5316:14): [True: 145k, False: 0]
  |  Branch (5316:30): [True: 0, False: 145k]
  ------------------
 5317|      0|    {
 5318|      0|        ret = cur_INChI[k]->nErrorCode;
 5319|      0|    }
 5320|   145k|    else if (cur_INChI_Aux[k] && cur_INChI_Aux[k]->nErrorCode)
  ------------------
  |  Branch (5320:14): [True: 145k, False: 0]
  |  Branch (5320:34): [True: 0, False: 145k]
  ------------------
 5321|      0|    {
 5322|      0|        ret = cur_INChI_Aux[k]->nErrorCode;
 5323|      0|    }
 5324|   145k|    else
 5325|   145k|    {
 5326|   145k|        ret = 0;
 5327|   145k|    }
 5328|       |
 5329|       |    /* Fill out the output */
 5330|       |
 5331|   146k|    if (!ret) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (5331:9): [True: 145k, False: 52]
  ------------------
 5332|   145k|    {
 5333|   145k|        int bMobileH = pStruct->bMobileH;
 5334|   145k|        if (bMobileH == TAUT_NON &&
  ------------------
  |  |  574|   291k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5334:13): [True: 1.92k, False: 144k]
  ------------------
 5335|  1.92k|             0 == cur_INChI[TAUT_NON]->nNumberOfAtoms &&
  ------------------
  |  |  574|  1.92k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5335:14): [True: 1.02k, False: 893]
  ------------------
 5336|  1.02k|             0 < cur_INChI[TAUT_YES]->nNumberOfAtoms)
  ------------------
  |  |  575|  1.02k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5336:14): [True: 1.02k, False: 0]
  ------------------
 5337|  1.02k|        {
 5338|       |            /* tautomerism or H(+) removal/addition was not discovered */
 5339|  1.02k|            bMobileH = TAUT_YES;
  ------------------
  |  |  575|  1.02k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5340|  1.02k|        }
 5341|       |
 5342|   145k|        if (cur_INChI[1])
  ------------------
  |  Branch (5342:13): [True: 145k, False: 0]
  ------------------
 5343|   145k|            pStruct->nChargeRevrs = cur_INChI[TAUT_YES]->nTotalCharge; /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  |  575|   145k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5344|       |
 5345|   145k|        pStruct->pOneINChI[0] = cur_INChI[bMobileH];
 5346|   145k|        pStruct->pOneINChI_Aux[0] = cur_INChI_Aux[bMobileH];
 5347|   145k|        pStruct->nOneINChI_bMobileH = bMobileH;
 5348|   145k|        cur_INChI[bMobileH] = NULL;  /* remove pointer to avoid deallocation at exit_function */
 5349|   145k|        cur_INChI_Aux[bMobileH] = NULL;  /* remove pointer to avoid deallocation at exit_function */
 5350|       |
 5351|   145k|        pStruct->nNumRemovedProtons = ( pStruct->iMobileH == TAUT_YES ) ? pStruct->One_ti.tni.nNumRemovedProtons : 0;
  ------------------
  |  |  575|   145k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5351:39): [True: 144k, False: 1.92k]
  ------------------
 5352|       |
 5353|       |
 5354|       |        /* set correct t-group numbers to endpoints */
 5355|       |
 5356|   145k|        t_group_info = &pStruct->One_ti;
 5357|       |
 5358|   145k|        if (t_group_info->num_t_groups && t_group_info->t_group && t_group_info->nEndpointAtomNumber)
  ------------------
  |  Branch (5358:13): [True: 2.44k, False: 143k]
  |  Branch (5358:43): [True: 2.44k, False: 0]
  |  Branch (5358:68): [True: 2.44k, False: 0]
  ------------------
 5359|  2.44k|        {
 5360|  2.44k|            inp_ATOM     *at_norm = inp_norm_data[TAUT_YES]->at;
  ------------------
  |  |  575|  2.44k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5361|  2.44k|            int          num_at_norm = inp_norm_data[TAUT_YES]->num_at;
  ------------------
  |  |  575|  2.44k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5362|  19.6k|            for (i = 0; i < num_at_norm; i++)
  ------------------
  |  Branch (5362:25): [True: 17.2k, False: 2.44k]
  ------------------
 5363|  17.2k|            {
 5364|  17.2k|                at_norm[i].endpoint = 0;
 5365|  17.2k|            }
 5366|  4.97k|            for (i = 0; i < t_group_info->num_t_groups; i++)
  ------------------
  |  Branch (5366:25): [True: 2.53k, False: 2.44k]
  ------------------
 5367|  2.53k|            {
 5368|  2.53k|                k = t_group_info->t_group[i].nFirstEndpointAtNoPos;
 5369|       |                /* add number of mobile (-) to the number of mobile H */
 5370|  2.53k|                t_group_info->t_group[i].num[0] += t_group_info->t_group[i].num[1];
 5371|  8.64k|                for (j = 0; j < t_group_info->t_group[i].nNumEndpoints; j++, k++)
  ------------------
  |  Branch (5371:29): [True: 6.11k, False: 2.53k]
  ------------------
 5372|  6.11k|                {
 5373|  6.11k|                    at_norm[t_group_info->nEndpointAtomNumber[k]].endpoint = t_group_info->t_group[i].nGroupNumber;
 5374|  6.11k|                }
 5375|  2.53k|            }
 5376|  2.44k|        }
 5377|       |
 5378|   145k|        pStruct->pOne_norm_data[0] = (INP_ATOM_DATA *) inchi_malloc( sizeof( pStruct->pOne_norm_data[0][0] ) );
  ------------------
  |  | 1143|   145k|#define inchi_malloc   malloc
  ------------------
 5379|       |
 5380|   145k|        if (pStruct->pOne_norm_data[0])
  ------------------
  |  Branch (5380:13): [True: 145k, False: 0]
  ------------------
 5381|   145k|        {
 5382|   145k|            memcpy(pStruct->pOne_norm_data[0], inp_norm_data[bMobileH], sizeof(pStruct->pOne_norm_data[0][0]));
 5383|   145k|            memset( inp_norm_data[bMobileH], 0, sizeof( *inp_norm_data[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5384|   145k|        }
 5385|      0|        else
 5386|      0|        {
 5387|      0|            ret = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 5388|      0|        }
 5389|       |
 5390|   145k|        if (bMobileH == TAUT_NON && cur_INChI[TAUT_YES]->nNumberOfAtoms > 0)
  ------------------
  |  |  574|   291k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      if (bMobileH == TAUT_NON && cur_INChI[TAUT_YES]->nNumberOfAtoms > 0)
  ------------------
  |  |  575|    893|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5390:13): [True: 893, False: 145k]
  |  Branch (5390:37): [True: 893, False: 0]
  ------------------
 5391|    893|        {
 5392|    893|            int bMobileHalt = ALT_TAUT( bMobileH ); /* = TAUT_YES */
  ------------------
  |  |  577|    893|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|    893|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 893]
  |  |  ------------------
  ------------------
 5393|    893|            pStruct->pOneINChI[1] = cur_INChI[bMobileHalt];
 5394|    893|            pStruct->pOneINChI_Aux[1] = cur_INChI_Aux[bMobileHalt];
 5395|    893|            cur_INChI[bMobileHalt] = NULL;
 5396|    893|            cur_INChI_Aux[bMobileHalt] = NULL;
 5397|    893|            pStruct->pOne_norm_data[1] = (INP_ATOM_DATA *) inchi_malloc( sizeof( pStruct->pOne_norm_data[0][0] ) );
  ------------------
  |  | 1143|    893|#define inchi_malloc   malloc
  ------------------
 5398|    893|            if (pStruct->pOne_norm_data[1])
  ------------------
  |  Branch (5398:17): [True: 893, False: 0]
  ------------------
 5399|    893|            {
 5400|    893|                memcpy(pStruct->pOne_norm_data[1], inp_norm_data[bMobileHalt], sizeof(pStruct->pOne_norm_data[0][0]));
 5401|    893|                memset( inp_norm_data[bMobileHalt], 0, sizeof( *inp_norm_data[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5402|    893|            }
 5403|      0|            else
 5404|      0|            {
 5405|      0|                ret = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 5406|      0|            }
 5407|    893|        }
 5408|   145k|    }
 5409|     52|    else
 5410|     52|    {
 5411|       |#if ( bRELEASE_VERSION != 1 )
 5412|       |#ifndef TARGET_API_LIB
 5413|       |        fprintf( stdout, "ERROR: Create_INChI returned %d\n", ret );
 5414|       |#endif
 5415|       |#endif
 5416|     52|    }
 5417|       |
 5418|   146k|exit_function:
 5419|       |    /* deallocate unused */
 5420|   438k|    for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  573|   438k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (5420:17): [True: 292k, False: 146k]
  ------------------
 5421|   292k|    {
 5422|   292k|        Free_INChI( &cur_INChI[k] );
 5423|   292k|        Free_INChI_Aux( &cur_INChI_Aux[k] );
 5424|   292k|        FreeInpAtomData( inp_norm_data[k] );
 5425|   292k|    }
 5426|   146k|    sd->ulStructTime = ulStructTime;
 5427|       |
 5428|   146k|    return ret;
 5429|   146k|}
ConnectDisconnectedH:
 5447|  71.7k|{
 5448|  71.7k|    int i, j, k, n, m, num_H;
 5449|  71.7k|    int tot_atoms = num_atoms + num_deleted_H;
 5450|       |
 5451|  71.7k|    for (i = num_atoms; i < tot_atoms; i = j)
  ------------------
  |  Branch (5451:25): [True: 61, False: 71.7k]
  ------------------
 5452|     61|    {
 5453|     61|        k = at[i].neighbor[0]; /* a[k] is the atom connected to the explicit hydrogen at[i] */
 5454|       |
 5455|    137|        for (j = i; j < tot_atoms && at[j].neighbor[0] == k; j++)
  ------------------
  |  Branch (5455:21): [True: 77, False: 60]
  |  Branch (5455:38): [True: 76, False: 1]
  ------------------
 5456|     76|        {
 5457|     76|            ;
 5458|     76|        }
 5459|       |
 5460|     61|        num_H = j - i; /* number of explicit H for at[k] */
 5461|     61|        if (num_H > at[k].num_H)
  ------------------
  |  Branch (5461:13): [True: 0, False: 61]
  ------------------
 5462|      0|        {
 5463|      0|            return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5464|      0|        }
 5465|     61|        if (num_H + at[k].valence > MAXVAL)
  ------------------
  |  |   60|     61|#define MAXVAL 50       /* maximum valence */ /* @nnuk : Changed from 20 -> 50 for testing purposes, to account for some structures with one atom having more than 20 bonds */
  ------------------
  |  Branch (5465:13): [True: 0, False: 61]
  ------------------
 5466|      0|        {
 5467|      0|            return RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5468|      0|        }
 5469|       |
 5470|       |        /* insert links to explicit H before all other links in the connection list */
 5471|     61|        n = at[k].valence;
 5472|     61|        memmove(at[k].neighbor + num_H, at[k].neighbor, sizeof(at[k].neighbor[0]) * n);
 5473|     61|        memmove(at[k].bond_stereo + num_H, at[k].bond_stereo, sizeof(at[k].bond_stereo[0]) * n);
 5474|     61|        memmove(at[k].bond_type + num_H, at[k].bond_type, sizeof(at[k].bond_type[0]) * n);
 5475|    137|        for (n = 0; n < num_H; n++)
  ------------------
  |  Branch (5475:21): [True: 76, False: 61]
  ------------------
 5476|     76|        {
 5477|     76|            at[k].neighbor[n] = i + n;
 5478|     76|            at[k].bond_stereo[n] = 0;
 5479|     76|            at[k].bond_type[n] = BOND_TYPE_SINGLE;
  ------------------
  |  |   32|     76|#define BOND_TYPE_SINGLE    1
  ------------------
 5480|     76|        }
 5481|       |
 5482|    119|        for (m = 0; m < MAX_NUM_STEREO_BONDS && at[k].sb_parity[m]; m++)
  ------------------
  |  |  873|    238|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (5482:21): [True: 119, False: 0]
  |  Branch (5482:49): [True: 58, False: 61]
  ------------------
 5483|     58|        {
 5484|     58|            at[k].sb_ord[m] += num_H;
 5485|     58|            if (at[k].sn_ord[m] < 0)
  ------------------
  |  Branch (5485:17): [True: 58, False: 0]
  ------------------
 5486|     58|            {
 5487|     58|                for (n = i; n < j; n++)
  ------------------
  |  Branch (5487:29): [True: 58, False: 0]
  ------------------
 5488|     58|                {
 5489|     58|                    if (at[n].orig_at_number == at[k].sn_orig_at_num[m])
  ------------------
  |  Branch (5489:25): [True: 58, False: 0]
  ------------------
 5490|     58|                    {
 5491|     58|                        at[k].sn_ord[m] = n - i;
 5492|     58|                        break;
 5493|     58|                    }
 5494|     58|                }
 5495|       |
 5496|     58|                if (n == j)
  ------------------
  |  Branch (5496:21): [True: 0, False: 58]
  ------------------
 5497|      0|                {
 5498|      0|                    return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5499|      0|                }
 5500|     58|            }
 5501|      0|            else
 5502|      0|            {
 5503|      0|                at[k].sn_ord[m] += num_H;
 5504|      0|            }
 5505|     58|        }
 5506|       |
 5507|     61|        at[k].valence += num_H;
 5508|     61|        at[k].chem_bonds_valence += num_H;
 5509|     61|        at[k].num_H -= num_H; /* cannot be negative */
 5510|       |
 5511|       |        /*memset( at[k].num_iso_H, 0, sizeof(at[0].num_iso_H) );*/ /* attached H must carry all isotopic shifts */
 5512|    137|        for (n = i; n < j; n++)
  ------------------
  |  Branch (5512:21): [True: 76, False: 61]
  ------------------
 5513|     76|        {
 5514|     76|            at[n].chem_bonds_valence = BOND_TYPE_SINGLE;
  ------------------
  |  |   32|     76|#define BOND_TYPE_SINGLE    1
  ------------------
 5515|     76|        }
 5516|       |
 5517|       |        /* isotopic H */
 5518|     76|        for (m = j - 1; i <= m && at[m].iso_atw_diff > 0; m--)
  ------------------
  |  Branch (5518:25): [True: 70, False: 6]
  |  Branch (5518:35): [True: 15, False: 55]
  ------------------
 5519|     15|        {
 5520|     15|            if (at[m].iso_atw_diff > NUM_H_ISOTOPES)
  ------------------
  |  |   25|     15|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (5520:17): [True: 0, False: 15]
  ------------------
 5521|      0|            {
 5522|      0|                return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5523|      0|            }
 5524|     15|            if (0 >= at[k].num_iso_H[(int) at[m].iso_atw_diff - 1] --)
  ------------------
  |  Branch (5524:17): [True: 0, False: 15]
  ------------------
 5525|      0|            {
 5526|      0|                return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5527|      0|            }
 5528|     15|        }
 5529|     61|    }
 5530|       |
 5531|       |    /* subtract isotopic H */
 5532|   236k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5532:17): [True: 165k, False: 71.3k]
  ------------------
 5533|   165k|    {
 5534|   660k|        for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |   25|   660k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (5534:21): [True: 495k, False: 165k]
  ------------------
 5535|   495k|        {
 5536|   495k|            at[i].num_H -= at[i].num_iso_H[m];
 5537|   495k|        }
 5538|   165k|        if (0 > at[i].num_H)
  ------------------
  |  Branch (5538:13): [True: 386, False: 164k]
  ------------------
 5539|    386|        {
 5540|    386|            return RI_ERR_PROGR;
  ------------------
  |  |   17|    386|#define RI_ERR_PROGR   (-3)
  ------------------
 5541|    386|        }
 5542|   165k|    }
 5543|       |
 5544|  71.3k|    return tot_atoms;
 5545|  71.7k|}
DisconnectedConnectedH:
 5561|  1.21k|{
 5562|  1.21k|    int i, j, k, n, m, num_H, num_iso_H;
 5563|  1.21k|    int tot_atoms = num_atoms + num_deleted_H;
 5564|  1.21k|    S_CHAR ctmp = '0';
 5565|       |
 5566|       |    /* add implicit isotopic H to total implicit H */
 5567|  11.2k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5567:17): [True: 10.0k, False: 1.21k]
  ------------------
 5568|  10.0k|    {
 5569|  40.2k|        for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |   25|  40.2k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (5569:21): [True: 30.1k, False: 10.0k]
  ------------------
 5570|  30.1k|        {
 5571|  30.1k|            at[i].num_H += at[i].num_iso_H[m];
 5572|  30.1k|        }
 5573|  10.0k|    }
 5574|       |
 5575|  1.22k|    for (i = num_atoms; i < tot_atoms; i = j)
  ------------------
  |  Branch (5575:25): [True: 6, False: 1.21k]
  ------------------
 5576|      6|    {
 5577|      6|        k = at[i].neighbor[0]; /* a[k] is the atom connected to the explicit hydrogen at[i] */
 5578|       |
 5579|     14|        for (j = i; j < tot_atoms && at[j].neighbor[0] == k; j++)
  ------------------
  |  Branch (5579:21): [True: 8, False: 6]
  |  Branch (5579:38): [True: 8, False: 0]
  ------------------
 5580|      8|        {
 5581|      8|            at[j].chem_bonds_valence = 0;
 5582|      8|        }
 5583|      6|        num_H = j - i; /* number of explicit H for at[k] */
 5584|       |
 5585|       |        /* verify correct number of explicit H */
 5586|     14|        for (n = 0; n < at[k].valence && at[k].neighbor[n] >= num_atoms; n++)
  ------------------
  |  Branch (5586:21): [True: 14, False: 0]
  |  Branch (5586:42): [True: 8, False: 6]
  ------------------
 5587|      8|        {
 5588|      8|            ;
 5589|      8|        }
 5590|      6|        if (n != num_H)
  ------------------
  |  Branch (5590:13): [True: 0, False: 6]
  ------------------
 5591|      0|        {
 5592|      0|            return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5593|      0|        }
 5594|       |
 5595|       |        /* remove bonds to explicit H located in front of all other bonds in the connection list */
 5596|      6|        at[k].valence -= num_H; /* djb-rwth: use of cast operators avoided */
 5597|      6|        n = at[k].valence; /* new number of bonds */ 
 5598|      6|        at[k].chem_bonds_valence -= num_H; /* new no-H valence */
 5599|      6|        if (n)
  ------------------
  |  Branch (5599:13): [True: 6, False: 0]
  ------------------
 5600|      6|        {
 5601|      6|            memmove(at[k].neighbor, at[k].neighbor + num_H, sizeof(at[k].neighbor[0]) * n);
 5602|      6|            memmove(at[k].bond_stereo, at[k].bond_stereo + num_H, sizeof(at[k].bond_stereo[0]) * n);
 5603|      6|            memmove(at[k].bond_type, at[k].bond_type + num_H, sizeof(at[k].bond_type[0]) * n);
 5604|      6|        }
 5605|       |        /* clear the 'tails' */
 5606|      6|        memset( at[k].neighbor + n, 0, sizeof( at[k].neighbor[0] ) * num_H ); /* djb-rwth: memset_s C11/Annex K variant? */
 5607|      6|        memset( at[k].bond_stereo + n, 0, sizeof( at[k].bond_stereo[0] ) * num_H ); /* djb-rwth: memset_s C11/Annex K variant? */
 5608|      6|        memset( at[k].bond_type + n, 0, sizeof( at[k].bond_type[0] ) * num_H ); /* djb-rwth: memset_s C11/Annex K variant? */
 5609|       |
 5610|     11|        for (m = 0; m < MAX_NUM_STEREO_BONDS && at[k].sb_parity[m]; m++)
  ------------------
  |  |  873|     22|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (5610:21): [True: 11, False: 0]
  |  Branch (5610:49): [True: 5, False: 6]
  ------------------
 5611|      5|        {
 5612|      5|            at[k].sb_ord[m] -= num_H;
 5613|      5|            if (0 <= at[k].sn_ord[m] && at[k].sn_ord[m] < num_H)
  ------------------
  |  Branch (5613:17): [True: 5, False: 0]
  |  Branch (5613:41): [True: 5, False: 0]
  ------------------
 5614|      5|            {
 5615|      5|                at[k].sn_ord[m] = -1; /* disconnected explicit H */
 5616|      5|            }
 5617|      5|        }
 5618|       |        /* add explicit isotopic H (already included in num_H) */
 5619|     10|        for (num_iso_H = 0, m = j - 1; i <= m && at[m].iso_atw_diff > 0; m--)
  ------------------
  |  Branch (5619:40): [True: 8, False: 2]
  |  Branch (5619:50): [True: 4, False: 4]
  ------------------
 5620|      4|        {
 5621|      4|            if (at[m].iso_atw_diff > NUM_H_ISOTOPES)
  ------------------
  |  |   25|      4|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (5621:17): [True: 0, False: 4]
  ------------------
 5622|      0|            {
 5623|      0|                return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5624|      0|            }
 5625|      4|            at[k].num_iso_H[(int) at[m].iso_atw_diff - 1] ++;
 5626|      4|        }
 5627|      6|        at[k].num_H += num_H; /* add all explicit H including isotopic */
 5628|      6|    }
 5629|       |
 5630|  1.21k|    return tot_atoms;
 5631|  1.21k|}
MakeInChIOutOfStrFromINChI2:
 5643|  70.8k|{
 5644|  70.8k|    char szTitle[MAX_SDF_HEADER + MAX_SDF_VALUE + 256];
 5645|       |
 5646|  70.8k|    int   len, ret;
 5647|       |    /*
 5648|       |    PINChI2     *pINChI[INCHI_NUM];
 5649|       |    PINChI_Aux2 *pINChI_Aux[INCHI_NUM];
 5650|       |    */
 5651|  70.8k|    INPUT_PARMS local_ip;
 5652|  70.8k|    STRUCT_DATA local_sd;
 5653|  70.8k|    INPUT_PARMS *ip = &local_ip;
 5654|  70.8k|    STRUCT_DATA *sd = &local_sd;
 5655|       |
 5656|  70.8k|    ORIG_ATOM_DATA OrigAtData; /* 0=> disconnected, 1=> original */
 5657|  70.8k|    ORIG_ATOM_DATA *orig_inp_data = &OrigAtData;
 5658|  70.8k|    ORIG_ATOM_DATA PrepAtData[2]; /* 0=> disconnected, 1=> original */
 5659|  70.8k|    ORIG_ATOM_DATA *prep_inp_data = PrepAtData;
 5660|       |
 5661|  70.8k|    INCHI_IOS_STRING temp_string_container;
 5662|  70.8k|    INCHI_IOS_STRING *strbuf = &temp_string_container;
 5663|  70.8k|    memset( strbuf, 0, sizeof( *strbuf ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5664|       |
 5665|  70.8k|    if (0 >= inchi_strbuf_init(strbuf, INCHI_STRBUF_INITIAL_SIZE, INCHI_STRBUF_SIZE_INCREMENT))
  ------------------
  |  |   65|  70.8k|#define INCHI_STRBUF_INITIAL_SIZE 262144
  ------------------
                  if (0 >= inchi_strbuf_init(strbuf, INCHI_STRBUF_INITIAL_SIZE, INCHI_STRBUF_SIZE_INCREMENT))
  ------------------
  |  |   66|  70.8k|#define INCHI_STRBUF_SIZE_INCREMENT 262144
  ------------------
  |  Branch (5665:9): [True: 0, False: 70.8k]
  ------------------
 5666|      0|    {
 5667|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 5668|      0|        goto early_exit_error; /* djb-rwth: avoiding garbage value */
 5669|      0|    }
 5670|       |
 5671|       |    /* djb-rwth: fixing oss-fuzz issue #70552 */
 5672|  70.8k|    if (!ip_inp || !sd_inp || !pStruct)
  ------------------
  |  Branch (5672:9): [True: 0, False: 70.8k]
  |  Branch (5672:20): [True: 0, False: 70.8k]
  |  Branch (5672:31): [True: 0, False: 70.8k]
  ------------------
 5673|      0|    {
 5674|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 5675|      0|        goto early_exit_error; /* djb-rwth: avoiding garbage value */
 5676|      0|    }
 5677|       |
 5678|  70.8k|    *ip = *ip_inp;
 5679|  70.8k|    ip->bDisplay = 0;
 5680|  70.8k|    ip->bDisplayCompositeResults = 0;
 5681|  70.8k|    ip->bDisplayEachComponentINChI = 0;
 5682|  70.8k|    ip->bDisplayIfRestoreWarnings = 0;
 5683|  70.8k|    ip->bINChIOutputOptions = INCHI_OUT_NO_AUX_INFO;
  ------------------
  |  |  129|  70.8k|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
 5684|       |
 5685|       |    /*
 5686|       |    if ( pStruct->bMobileH ) {
 5687|       |        ip->nMode &= ~REQ_MODE_BASIC;
 5688|       |        ip->nMode |= REQ_MODE_TAUT;
 5689|       |    } else {
 5690|       |        ip->nMode |= (REQ_MODE_TAUT | REQ_MODE_BASIC);
 5691|       |    }
 5692|       |    */
 5693|       |
 5694|  70.8k|    memset( sd, 0, sizeof( *sd ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5695|  70.8k|    sd->fPtrStart = -1;
 5696|  70.8k|    sd->fPtrEnd = -1;
 5697|       |
 5698|       |    /*
 5699|       |    if ( ip->nMode & REQ_MODE_STEREO ) {
 5700|       |        if ( ip->nMode & (REQ_MODE_RELATIVE_STEREO | REQ_MODE_RACEMIC_STEREO) ) {
 5701|       |            sd->bChiralFlag |= FLAG_INP_AT_NONCHIRAL;
 5702|       |        } else {
 5703|       |            sd->bChiralFlag |= FLAG_INP_AT_CHIRAL;
 5704|       |        }
 5705|       |    }
 5706|       |    */
 5707|       |
 5708|  70.8k|    memset( orig_inp_data, 0, sizeof( *orig_inp_data ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5709|  70.8k|    memset( prep_inp_data, 0, 2 * sizeof( *prep_inp_data ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5710|  70.8k|    memset( pStruct->RevInChI.pINChI, 0, sizeof( pStruct->RevInChI.pINChI ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5711|  70.8k|    memset( pStruct->RevInChI.pINChI_Aux, 0, sizeof( pStruct->RevInChI.pINChI_Aux ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5712|  70.8k|    memset( szTitle, 0, sizeof( szTitle ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5713|       |
 5714|  70.8k|    len = sizeof( orig_inp_data->at[0] )*( (long long)pStruct->num_atoms + (long long)pStruct->num_deleted_H ); /* djb-rwth: cast operators added */
 5715|       |
 5716|  70.8k|    orig_inp_data->at = (inp_ATOM *) inchi_malloc( len );
  ------------------
  |  | 1143|  70.8k|#define inchi_malloc   malloc
  ------------------
 5717|       |
 5718|  70.8k|    if (orig_inp_data->at)
  ------------------
  |  Branch (5718:9): [True: 70.8k, False: 0]
  ------------------
 5719|  70.8k|    {
 5720|       |        /*memcpy( orig_inp_data->at, pStruct->at2, len );*/
 5721|       |        /*ret = ConnectDisconnectedH( orig_inp_data->at, pStruct->num_atoms, pStruct->num_deleted_H );*/
 5722|       |
 5723|  70.8k|        CopySt2At( pStruct->at2, pStruct->st, pStruct->num_atoms );
 5724|       |
 5725|  70.8k|        ret = ConnectDisconnectedH( pStruct->at2, pStruct->num_atoms, pStruct->num_deleted_H );
 5726|  70.8k|        if (ret < 0)
  ------------------
  |  Branch (5726:13): [True: 386, False: 70.4k]
  ------------------
 5727|    386|        {
 5728|    386|            goto exit_error;
 5729|    386|        }
 5730|       |
 5731|  70.4k|        orig_inp_data->num_inp_atoms = ret;
 5732|       |        /* connections changed => reconcile parities even if they were reconciled before */
 5733|       |        /* remove t-group markings and increment zero-order bonds,
 5734|       |           otherwise MakeInChIOutOfStrFromINChI2() woild fail */
 5735|       |        /*
 5736|       |        IncrZeroBondsAndClearEndpts(pStruct->at2, pStruct->num_atoms, iComponent+1);
 5737|       |        */
 5738|       |
 5739|  70.4k|        IncrZeroBonds( pStruct->at2, pStruct->num_atoms, iComponent + 1 );
 5740|       |
 5741|       |        /* CopySt2At() moved to the position before ConnectDisconnectedH() because
 5742|       |           in case stereo exists only in Mobile-H layer and the processd here
 5743|       |           component is restored in Fixed-H layer the parities needed by
 5744|       |           ConnectDisconnectedH() must be there before calling
 5745|       |           ConnectDisconnectedH()
 5746|       |        */
 5747|       |        /*CopySt2At( pStruct->at2, pStruct->st, pStruct->num_atoms );*/
 5748|       |
 5749|  70.4k|        ret = ReconcileAllCmlBondParities( pStruct->at2, orig_inp_data->num_inp_atoms, 0 );
 5750|  70.4k|        if (ret < 0)
  ------------------
  |  Branch (5750:13): [True: 0, False: 70.4k]
  ------------------
 5751|      0|        {
 5752|      0|            goto exit_error;
 5753|      0|        }
 5754|       |
 5755|       |#if USE_BCF
 5756|       |        memcpy_s( orig_inp_data->at, (long long)len, pStruct->at2, len ); /* djb-rwth: function replaced with its safe C11 variant */
 5757|       |#else
 5758|  70.4k|        memcpy(orig_inp_data->at, pStruct->at2, len);
 5759|  70.4k|#endif
 5760|       |
 5761|  70.4k|        ClearEndpts( orig_inp_data->at, pStruct->num_atoms );
 5762|       |
 5763|  70.4k|        if (FixUnkn0DStereoBonds( orig_inp_data->at, pStruct->num_atoms ))
  ------------------
  |  Branch (5763:13): [True: 35, False: 70.4k]
  ------------------
 5764|     35|        {
 5765|     35|            ret = ReconcileAllCmlBondParities( pStruct->at2, orig_inp_data->num_inp_atoms, 0 );
 5766|     35|            if (ret < 0)
  ------------------
  |  Branch (5766:17): [True: 0, False: 35]
  ------------------
 5767|      0|            {
 5768|      0|                goto exit_error;
 5769|      0|            }
 5770|     35|        }
 5771|       |        /* keep endpoint[] markings in at2[] for subsequent add/remove protons */
 5772|  70.4k|    }
 5773|      0|    else
 5774|      0|    {
 5775|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 5776|      0|        goto exit_error;
 5777|      0|    }
 5778|       |
 5779|  70.4k|    memset( sd->num_components, 0, sizeof( sd->num_components ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5780|  70.4k|    memset( sd->num_taut, 0, sizeof( sd->num_taut ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5781|  70.4k|    memset( sd->num_non_taut, 0, sizeof( sd->num_non_taut ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5782|  70.4k|    memset( sd->bTautFlagsDone, 0, sizeof( sd->bTautFlagsDone ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5783|  70.4k|    memset( sd->bTautFlags, 0, sizeof( sd->bTautFlags ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5784|       |
 5785|       |
 5786|  70.4k|    ret = ProcessOneStructure( ic, pCG, sd, ip, szTitle,
 5787|  70.4k|                               pStruct->RevInChI.pINChI,
 5788|  70.4k|                               pStruct->RevInChI.pINChI_Aux,
 5789|  70.4k|                               NULL /*inp_file*/,
 5790|  70.4k|                               NULL /*log_file*/,
 5791|  70.4k|                               NULL /*out_file*/,
 5792|  70.4k|                               NULL /*prb_file*/,
 5793|  70.4k|                               orig_inp_data, prep_inp_data,
 5794|  70.4k|                               num_inp, strbuf,
 5795|  70.4k|                               0 /* save_opt_bits */ );
 5796|       |
 5797|  70.4k|    memcpy(pStruct->RevInChI.num_components, sd->num_components, sizeof(pStruct->RevInChI.num_components));
 5798|  70.4k|    memcpy(sd_inp->pStrErrStruct, sd->pStrErrStruct, sizeof(sd_inp->pStrErrStruct));
 5799|  70.4k|    pStruct->RevInChI.nRetVal = ret;
 5800|       |
 5801|       |    /* translate returned value */
 5802|  70.4k|    if (ret == _IS_ERROR || ret == _IS_FATAL || ret == _IS_UNKNOWN)
  ------------------
  |  |   12|   140k|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
                  if (ret == _IS_ERROR || ret == _IS_FATAL || ret == _IS_UNKNOWN)
  ------------------
  |  |   13|   140k|#define _IS_FATAL   3
  ------------------
                  if (ret == _IS_ERROR || ret == _IS_FATAL || ret == _IS_UNKNOWN)
  ------------------
  |  |   14|  70.4k|#define _IS_UNKNOWN 4    /* unknown error: used in INChI DLL only */
  ------------------
  |  Branch (5802:9): [True: 2, False: 70.4k]
  |  Branch (5802:29): [True: 2, False: 70.4k]
  |  Branch (5802:49): [True: 0, False: 70.4k]
  ------------------
 5803|      4|    {
 5804|      4|        ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      4|#define RI_ERR_PROGR   (-3)
  ------------------
 5805|      4|    }
 5806|  70.4k|    else if (ret == _IS_OKAY)
  ------------------
  |  |   10|  70.4k|#define _IS_OKAY    0
  ------------------
  |  Branch (5806:14): [True: 60.9k, False: 9.45k]
  ------------------
 5807|  60.9k|    {
 5808|  60.9k|        ret = 0;
 5809|  60.9k|    }
 5810|  9.45k|    else if (ret == _IS_WARNING)
  ------------------
  |  |   11|  9.45k|#define _IS_WARNING 1
  ------------------
  |  Branch (5810:14): [True: 9.45k, False: 0]
  ------------------
 5811|  9.45k|    {
 5812|  9.45k|        ret = 1;
 5813|  9.45k|    }
 5814|      0|    else
 5815|      0|    {
 5816|      0|        ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5817|      0|    }
 5818|       |
 5819|       |    /* save total charge from Mobile-H layer */
 5820|       |
 5821|  70.4k|    pStruct->nChargeRevrs = 0;
 5822|  70.4k|    if (ret >= 0)
  ------------------
  |  Branch (5822:9): [True: 70.4k, False: 4]
  ------------------
 5823|  70.4k|    {
 5824|  70.4k|        if (bRevInchiComponentExists( pStruct, INCHI_REC, TAUT_YES, 0 ))
  ------------------
  |  |  571|  70.4k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                      if (bRevInchiComponentExists( pStruct, INCHI_REC, TAUT_YES, 0 ))
  ------------------
  |  |  575|  70.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5824:13): [True: 0, False: 70.4k]
  ------------------
 5825|      0|        {
 5826|      0|            pStruct->nChargeRevrs = pStruct->RevInChI.pINChI[INCHI_REC][0][TAUT_YES]->nTotalCharge;
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          pStruct->nChargeRevrs = pStruct->RevInChI.pINChI[INCHI_REC][0][TAUT_YES]->nTotalCharge;
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5827|      0|        }
 5828|  70.4k|        else if (bRevInchiComponentExists( pStruct, INCHI_BAS, TAUT_YES, 0 ))
  ------------------
  |  |  570|  70.4k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      else if (bRevInchiComponentExists( pStruct, INCHI_BAS, TAUT_YES, 0 ))
  ------------------
  |  |  575|  70.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5828:18): [True: 70.2k, False: 156]
  ------------------
 5829|  70.2k|        {
 5830|  70.2k|            pStruct->nChargeRevrs = pStruct->RevInChI.pINChI[INCHI_BAS][0][TAUT_YES]->nTotalCharge;
  ------------------
  |  |  570|  70.2k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          pStruct->nChargeRevrs = pStruct->RevInChI.pINChI[INCHI_BAS][0][TAUT_YES]->nTotalCharge;
  ------------------
  |  |  575|  70.2k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5831|  70.2k|        }
 5832|  70.4k|    }
 5833|       |
 5834|       |    /* free structure data */
 5835|  70.4k|    FreeOrigAtData( orig_inp_data );
 5836|  70.4k|    FreeOrigAtData( prep_inp_data );
 5837|  70.4k|    FreeOrigAtData( prep_inp_data + 1 );
 5838|       |
 5839|  70.8k|exit_error:
 5840|  70.8k|#if ( FIX_GAF_2019_2==1 )
 5841|  70.8k|    if (orig_inp_data->at)
  ------------------
  |  Branch (5841:9): [True: 386, False: 70.4k]
  ------------------
 5842|    386|    {
 5843|    386|        FreeInpAtom(&orig_inp_data->at);
 5844|    386|    }
 5845|  70.8k|#endif
 5846|  70.8k|early_exit_error:
 5847|  70.8k|    inchi_strbuf_close( strbuf );
 5848|       |
 5849|  70.8k|    return ret;
 5850|  70.8k|}

CopyAt2St:
   23|    100|{
   24|    100|    int i;
   25|  66.2k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (25:17): [True: 66.1k, False: 100]
  ------------------
   26|  66.1k|    {
   27|  66.1k|        if (at[i].p_parity)
  ------------------
  |  Branch (27:13): [True: 10, False: 66.1k]
  ------------------
   28|     10|        {
   29|     10|            memcpy(st[i].p_orig_at_num, at[i].p_orig_at_num, sizeof(st[0].p_orig_at_num));
   30|     10|            st[i].p_parity = at[i].p_parity;
   31|     10|        }
   32|  66.1k|        if (at[i].sb_parity[0])
  ------------------
  |  Branch (32:13): [True: 53, False: 66.0k]
  ------------------
   33|     53|        {
   34|     53|            memcpy(st[i].sb_ord, at[i].sb_ord, sizeof(st[0].sb_ord));
   35|     53|            memcpy(st[i].sb_parity, at[i].sb_parity, sizeof(st[0].sb_parity));
   36|     53|            memcpy(st[i].sn_ord, at[i].sn_ord, sizeof(st[0].sn_ord));
   37|     53|            memcpy(st[i].sn_orig_at_num, at[i].sn_orig_at_num, sizeof(st[0].sn_orig_at_num));
   38|     53|        }
   39|  66.1k|    }
   40|    100|}
CopySt2At:
   45|   216k|{
   46|   216k|    int i;
   47|   216k|    if (!st)
  ------------------
  |  Branch (47:9): [True: 216k, False: 152]
  ------------------
   48|   216k|    {
   49|   216k|        return;
   50|   216k|    }
   51|       |
   52|    889|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (52:17): [True: 737, False: 152]
  ------------------
   53|    737|    {
   54|    737|        if (st[i].p_parity)
  ------------------
  |  Branch (54:13): [True: 44, False: 693]
  ------------------
   55|     44|        {
   56|     44|            memcpy(at[i].p_orig_at_num, st[i].p_orig_at_num, sizeof(at[0].p_orig_at_num));
   57|     44|            at[i].p_parity = st[i].p_parity;
   58|     44|        }
   59|    737|        if (st[i].sb_parity[0])
  ------------------
  |  Branch (59:13): [True: 335, False: 402]
  ------------------
   60|    335|        {
   61|    335|            memcpy(at[i].sb_ord, st[i].sb_ord, sizeof(st[0].sb_ord));
   62|    335|            memcpy(at[i].sb_parity, st[i].sb_parity, sizeof(at[0].sb_parity));
   63|    335|            memcpy(at[i].sn_ord, st[i].sn_ord, sizeof(at[0].sn_ord));
   64|    335|            memcpy(at[i].sn_orig_at_num, st[i].sn_orig_at_num, sizeof(at[0].sn_orig_at_num));
   65|    335|        }
   66|    737|    }
   67|    152|}
RestoreAtomConnectionsSetStereo:
   76|   145k|{
   77|   145k|    inp_ATOM_STEREO *st = NULL;
   78|   145k|    int           num_atoms, i, jv, jn, n_vertex, n_neigh, num_H, parity, num_atoms_limit;
   79|   145k|    int           nNumDeletedH = 0, iDeletedH = 0, idelH1, idelH2, ret = 0, len;
   80|   145k|    int           num_stereo_bonds2, num_stereo_centers2; /* djb-rwth: removing redundant variables */
   81|   145k|    INChI_Stereo *pStereo = NULL, *pStereo2 = NULL;
   82|   145k|    AT_NUMB       nCumulene[MAX_CUMULENE_LEN + 2];
   83|   145k|    inp_ATOM* at = NULL;  /* copied from below 2024-09-01 DT */
   84|       |
   85|   145k|    num_atoms = pInChI->nNumberOfAtoms;
   86|   145k|    if (num_atoms <= 0)
  ------------------
  |  Branch (86:9): [True: 0, False: 145k]
  ------------------
   87|      0|    {
   88|      0|        return 0;
   89|      0|    }
   90|       |
   91|       |    INCHI_HEAPCHK
   92|       |
   93|       |        /* atoms */
   94|   145k|    at = (inp_ATOM*)inchi_calloc(num_atoms, sizeof(pStruct->at[0]));
  ------------------
  |  | 1146|   145k|#define inchi_calloc   calloc
  ------------------
   95|   145k|    num_atoms_limit = num_atoms;
   96|   145k|    if (!at)
  ------------------
  |  Branch (96:9): [True: 0, False: 145k]
  ------------------
   97|      0|    {
   98|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
   99|      0|        goto exit_function;
  100|      0|    }
  101|   145k|    pStruct->at = at;
  102|   145k|    pStruct->num_atoms = num_atoms;
  103|       |
  104|       |    /* charge */
  105|   145k|    pStruct->charge = pInChI->nTotalCharge;
  106|       |
  107|       |    /* elements, terminal atoms H */
  108|  1.69M|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (108:17): [True: 1.55M, False: 145k]
  ------------------
  109|  1.55M|    {
  110|  1.55M|        at[i].el_number = pInChI->nAtom[i];
  111|  1.55M|        if (-1 == get_element_chemical_symbol( UCINT pInChI->nAtom[i], at[i].elname ))
  ------------------
  |  |   88|  1.55M|#define UCINT  (int)(unsigned char)
  ------------------
  |  Branch (111:13): [True: 0, False: 1.55M]
  ------------------
  112|      0|        {
  113|      0|            ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  114|      0|            goto exit_function;
  115|      0|        }
  116|  1.55M|        at[i].orig_at_number = iAtNoOffset + i + 1;
  117|  1.55M|        at[i].orig_compt_at_numb = i + 1;
  118|  1.55M|        at[i].component = iComponent + 1;
  119|  1.55M|        num_H = pInChI->nNum_H[i];
  120|       |        /* --- pInChI->nNum_H_fixed[i] was added to pInChI->nNum_H[i] ---
  121|       |        if ( pInChI->nNum_H_fixed ) {
  122|       |            num_H += pInChI->nNum_H_fixed[i];
  123|       |        }
  124|       |        */
  125|       |#if 0
  126|       |        ( FIX_GAF_ISSUES == 1 )
  127|       |            if (num_H < 0)
  128|       |            {
  129|       |                ret = RI_ERR_PROGR;
  130|       |                goto exit_function;
  131|       |            }
  132|       |#endif
  133|  1.55M|        at[i].num_H = num_H;
  134|  1.55M|    }
  135|       |
  136|       |    INCHI_HEAPCHK
  137|       |
  138|       |    /* connections */
  139|   467k|    for (i = 1, n_vertex = pInChI->nConnTable[0] - 1; i < pInChI->lenConnTable; i++)
  ------------------
  |  Branch (139:55): [True: 321k, False: 145k]
  ------------------
  140|   321k|    {
  141|   321k|        if (( n_neigh = pInChI->nConnTable[i] - 1 ) < n_vertex)
  ------------------
  |  Branch (141:13): [True: 170k, False: 151k]
  ------------------
  142|   170k|        {
  143|       |            /*  vertex - neighbor connection */
  144|   170k|            jv = at[n_vertex].valence++;
  145|   170k|            at[n_vertex].neighbor[jv] = n_neigh;
  146|   170k|            at[n_vertex].bond_type[jv] = BOND_TYPE_SINGLE;
  ------------------
  |  |   32|   170k|#define BOND_TYPE_SINGLE    1
  ------------------
  147|   170k|            at[n_vertex].chem_bonds_valence += at[n_vertex].bond_type[jv];
  148|       |            /*  neighbor - vertex connection */
  149|   170k|            jn = at[n_neigh].valence++;
  150|   170k|            at[n_neigh].neighbor[jn] = n_vertex;
  151|   170k|            at[n_neigh].bond_type[jn] = BOND_TYPE_SINGLE;
  ------------------
  |  |   32|   170k|#define BOND_TYPE_SINGLE    1
  ------------------
  152|   170k|            at[n_neigh].chem_bonds_valence += at[n_neigh].bond_type[jn];
  153|   170k|        }
  154|   151k|        else if (( n_vertex = n_neigh ) >= num_atoms)
  ------------------
  |  Branch (154:18): [True: 0, False: 151k]
  ------------------
  155|      0|        {
  156|      0|            ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  157|      0|            goto exit_function;
  158|      0|        }
  159|   321k|    }
  160|       |
  161|       |    INCHI_HEAPCHK
  162|       |
  163|       |    /* isotopic atoms */
  164|   145k|    if (pInChI->IsotopicAtom && pInChI->nNumberOfIsotopicAtoms)
  ------------------
  |  Branch (164:9): [True: 902, False: 144k]
  |  Branch (164:33): [True: 698, False: 204]
  ------------------
  165|    698|    {
  166|  3.20k|        for (i = 0; i < pInChI->nNumberOfIsotopicAtoms; i++)
  ------------------
  |  Branch (166:21): [True: 2.50k, False: 698]
  ------------------
  167|  2.50k|        {
  168|  2.50k|            n_vertex = pInChI->IsotopicAtom[i].nAtomNumber - 1;
  169|       |            /* djb-rwth: fixing oss-fuzz issues #68742, #30956 */
  170|  2.50k|            if (n_vertex < num_atoms)
  ------------------
  |  Branch (170:17): [True: 2.46k, False: 39]
  ------------------
  171|  2.46k|            {
  172|  2.46k|                at[n_vertex].iso_atw_diff = (char)pInChI->IsotopicAtom[i].nIsoDifference;
  173|  2.46k|                at[n_vertex].num_iso_H[0] = (char)pInChI->IsotopicAtom[i].nNum_H;
  174|  2.46k|                at[n_vertex].num_iso_H[1] = (char)pInChI->IsotopicAtom[i].nNum_D;
  175|  2.46k|                at[n_vertex].num_iso_H[2] = (char)pInChI->IsotopicAtom[i].nNum_T;
  176|  2.46k|            }
  177|  2.50k|        }
  178|    698|        pStruct->bIsotopic |= 1;
  179|    698|    }
  180|       |
  181|       |    INCHI_HEAPCHK
  182|       |
  183|       |    /* tautomeric groups */
  184|   145k|    if ((ret = GetTgroupInfoFromInChI( &pStruct->ti, at, NULL, pInChI ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (184:9): [True: 2, False: 145k]
  ------------------
  185|      2|    {
  186|      2|        goto exit_function;
  187|      2|    }
  188|       |
  189|       |    /* coordinates: data from unused members: pInChI->IsotopicTGroup and InChI->nNumberOfIsotopicTGroups */
  190|   145k|    if (pInChI->IsotopicTGroup && !pInChI->nNumberOfIsotopicTGroups)
  ------------------
  |  Branch (190:9): [True: 0, False: 145k]
  |  Branch (190:35): [True: 0, False: 0]
  ------------------
  191|      0|    {
  192|      0|        pStruct->pXYZ = (XYZ_COORD *) pInChI->IsotopicTGroup;
  193|      0|        pInChI->IsotopicTGroup = NULL;
  194|      0|    }
  195|       |
  196|       |    /* stereo */
  197|   145k|    if (pInChI->StereoIsotopic &&
  ------------------
  |  Branch (197:9): [True: 580, False: 144k]
  ------------------
  198|    580|        ( pInChI->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (198:9): [True: 232, False: 348]
  ------------------
  199|    580|            pInChI->StereoIsotopic->nNumberOfStereoCenters ))
  200|    232|    {
  201|    232|        pStereo = pInChI->StereoIsotopic;
  202|    232|    }
  203|   145k|    else if (pInChI->Stereo &&
  ------------------
  |  Branch (203:14): [True: 12.0k, False: 133k]
  ------------------
  204|  12.0k|        ( pInChI->Stereo->nNumberOfStereoBonds +
  ------------------
  |  Branch (204:9): [True: 726, False: 11.3k]
  ------------------
  205|  12.0k|            pInChI->Stereo->nNumberOfStereoCenters ))
  206|    726|    {
  207|    726|        pStereo = pInChI->Stereo;
  208|    726|    }
  209|   144k|    else
  210|   144k|    {
  211|   144k|        pStereo = NULL;
  212|   144k|    }
  213|       |
  214|       |    /* stereo2: Mobile-H in addition to Fixed-H*/
  215|   145k|    pStereo2 = NULL;
  216|   145k|    if (pInChIMobH && pInChIMobH->nNumberOfAtoms)
  ------------------
  |  Branch (216:9): [True: 1.28k, False: 144k]
  |  Branch (216:23): [True: 1.28k, False: 0]
  ------------------
  217|  1.28k|    {
  218|  1.28k|        if (pInChIMobH->StereoIsotopic &&
  ------------------
  |  Branch (218:13): [True: 35, False: 1.25k]
  ------------------
  219|     35|            ( pInChIMobH->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (219:13): [True: 20, False: 15]
  ------------------
  220|     35|                pInChIMobH->StereoIsotopic->nNumberOfStereoCenters ))
  221|     20|        {
  222|     20|            pStereo2 = pInChIMobH->StereoIsotopic;
  223|     20|        }
  224|  1.26k|        else
  225|  1.26k|        {
  226|  1.26k|            if (pInChIMobH->Stereo &&
  ------------------
  |  Branch (226:17): [True: 193, False: 1.07k]
  ------------------
  227|    193|                ( pInChIMobH->Stereo->nNumberOfStereoBonds +
  ------------------
  |  Branch (227:17): [True: 143, False: 50]
  ------------------
  228|    193|                  pInChIMobH->Stereo->nNumberOfStereoCenters ))
  229|    143|            {
  230|    143|                pStereo2 = pInChIMobH->Stereo;
  231|    143|            }
  232|  1.26k|        }
  233|  1.28k|    }
  234|       |
  235|       |    INCHI_HEAPCHK
  236|       |
  237|   145k|    num_stereo_bonds2 = 0; /* djb-rwth: removing redundant code */
  238|   145k|    num_stereo_centers2 = 0; /* djb-rwth: removing redundant code */
  239|       |    /* -- have already been done in the initialization --
  240|       |       iDeletedH = 0;
  241|       |       nNumDeletedH = 0;
  242|       |    */
  243|   145k|    if (pStereo || pStereo2)
  ------------------
  |  Branch (243:9): [True: 958, False: 144k]
  |  Branch (243:20): [True: 72, False: 144k]
  ------------------
  244|  1.03k|    {
  245|       |        /* count implicit H needed for parities and reallocate at[]; set at[n_vertex].at_type=1 for these atoms */
  246|  1.03k|        int len1 = pStereo ? pStereo->nNumberOfStereoCenters : 0;
  ------------------
  |  Branch (246:20): [True: 958, False: 72]
  ------------------
  247|  1.03k|        int len2 = pStereo2 ? pStereo2->nNumberOfStereoCenters : 0;
  ------------------
  |  Branch (247:20): [True: 163, False: 867]
  ------------------
  248|  1.03k|        int i2, diff, diff2;
  249|  1.81k|        for (i = i2 = 0; i < len1 || i2 < len2; )
  ------------------
  |  Branch (249:26): [True: 724, False: 1.09k]
  |  Branch (249:38): [True: 65, False: 1.03k]
  ------------------
  250|    789|        {
  251|    789|            if (i < len1 && i2 < len2)
  ------------------
  |  Branch (251:17): [True: 724, False: 65]
  |  Branch (251:29): [True: 66, False: 658]
  ------------------
  252|     66|            {
  253|     66|                diff = (int) pStereo->nNumber[i] - (int) pStereo2->nNumber[i2];
  254|     66|                if (diff <= 0)
  ------------------
  |  Branch (254:21): [True: 58, False: 8]
  ------------------
  255|     58|                {
  256|     58|                    n_vertex = pStereo->nNumber[i] - 1;
  257|     58|                    i++;
  258|     58|                    i2 += !diff;
  259|     58|                }
  260|      8|                else
  261|      8|                {
  262|      8|                    n_vertex = pStereo2->nNumber[i2] - 1;
  263|      8|                    num_stereo_centers2++;
  264|      8|                    i2++;
  265|      8|                }
  266|     66|            }
  267|    723|            else if (i < len1)
  ------------------
  |  Branch (267:22): [True: 658, False: 65]
  ------------------
  268|    658|            {
  269|    658|                n_vertex = pStereo->nNumber[i] - 1;
  270|    658|                i++;
  271|    658|            }
  272|     65|            else
  273|     65|            {
  274|     65|                n_vertex = pStereo2->nNumber[i2] - 1;
  275|     65|                num_stereo_centers2++;
  276|     65|                i2++;
  277|     65|            }
  278|       |
  279|    789|            jv = at[n_vertex].neighbor[0]; /* djb-rwth: avoiding unsequenced modification and access */
  280|    789|            jn = at[n_vertex].neighbor[1]; /* djb-rwth: avoiding unsequenced modification and access */
  281|       |            /* find whether it is an allene */
  282|    789|            if (at[n_vertex].valence == 2 &&
  ------------------
  |  Branch (282:17): [True: 83, False: 706]
  ------------------
  283|     83|                 at[n_vertex].num_H == 0 &&
  ------------------
  |  Branch (283:18): [True: 73, False: 10]
  ------------------
  284|     73|                 bCanAtomBeMiddleAllene( at[n_vertex].elname, 0, 0 ) &&
  ------------------
  |  Branch (284:18): [True: 56, False: 17]
  ------------------
  285|     56|                 at[jv].valence + at[jv].num_H == 3 &&
  ------------------
  |  Branch (285:18): [True: 47, False: 9]
  ------------------
  286|     47|                 bCanAtomBeTerminalAllene( at[jv].elname, 0, 0 ) &&
  ------------------
  |  Branch (286:18): [True: 39, False: 8]
  ------------------
  287|     39|                 at[jn].valence + at[jn].num_H == 3 &&
  ------------------
  |  Branch (287:18): [True: 31, False: 8]
  ------------------
  288|     31|                 bCanAtomBeTerminalAllene( at[jn].elname, 0, 0 ))
  ------------------
  |  Branch (288:18): [True: 26, False: 5]
  ------------------
  289|     26|            {
  290|       |                /* allene */
  291|     26|                if (!at[jv].at_type && at[jv].num_H)
  ------------------
  |  Branch (291:21): [True: 26, False: 0]
  |  Branch (291:40): [True: 0, False: 26]
  ------------------
  292|      0|                {
  293|      0|                    nNumDeletedH += at[jv].num_H;
  294|      0|                    at[jv].at_type++;  /* H should be added as an explicit H */
  295|      0|                }
  296|       |
  297|     26|                if (!at[jn].at_type && at[jn].num_H)
  ------------------
  |  Branch (297:21): [True: 26, False: 0]
  |  Branch (297:40): [True: 0, False: 26]
  ------------------
  298|      0|                {
  299|      0|                    nNumDeletedH += at[jn].num_H;
  300|      0|                    at[jn].at_type++;  /* H should be added as an explicit H */
  301|      0|                }
  302|     26|            }
  303|    763|            else
  304|    763|            {
  305|       |                /* stereogenic atom - sp3 */
  306|    763|                if (!at[n_vertex].at_type && at[n_vertex].num_H)
  ------------------
  |  Branch (306:21): [True: 763, False: 0]
  |  Branch (306:46): [True: 18, False: 745]
  ------------------
  307|     18|                {
  308|     18|                    nNumDeletedH += at[n_vertex].num_H;
  309|     18|                    at[n_vertex].at_type++; /* H should be added as an explicit H */
  310|     18|                }
  311|    763|            }
  312|    789|        }
  313|       |
  314|       |        INCHI_HEAPCHK
  315|       |
  316|  1.03k|        len1 = pStereo ? pStereo->nNumberOfStereoBonds : 0;
  ------------------
  |  Branch (316:16): [True: 958, False: 72]
  ------------------
  317|  1.03k|        len2 = pStereo2 ? pStereo2->nNumberOfStereoBonds : 0;
  ------------------
  |  Branch (317:16): [True: 163, False: 867]
  ------------------
  318|  1.75k|        for (i = i2 = 0; i < len1 || i2 < len2; )
  ------------------
  |  Branch (318:26): [True: 696, False: 1.05k]
  |  Branch (318:38): [True: 54, False: 1.00k]
  ------------------
  319|    750|        {
  320|    750|            if (i < len1 && i2 < len2)
  ------------------
  |  Branch (320:17): [True: 696, False: 54]
  |  Branch (320:29): [True: 68, False: 628]
  ------------------
  321|     68|            {
  322|     68|                diff = (int) pStereo->nBondAtom1[i] - (int) pStereo2->nBondAtom1[i2];
  323|     68|                diff2 = (int) pStereo->nBondAtom2[i] - (int) pStereo2->nBondAtom2[i2];
  324|     68|                if (diff < 0 || (diff == 0 && diff2 <= 0)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (324:21): [True: 10, False: 58]
  |  Branch (324:34): [True: 38, False: 20]
  |  Branch (324:47): [True: 32, False: 6]
  ------------------
  325|     42|                {
  326|     42|                    n_vertex = pStereo->nBondAtom1[i] - 1;
  327|     42|                    n_neigh = pStereo->nBondAtom2[i] - 1;
  328|     42|                    i++;
  329|     42|                    i2 += !diff && !diff2;
  ------------------
  |  Branch (329:27): [True: 32, False: 10]
  |  Branch (329:36): [True: 32, False: 0]
  ------------------
  330|     42|                }
  331|     26|                else
  332|     26|                {
  333|     26|                    n_vertex = pStereo2->nBondAtom1[i2] - 1;
  334|     26|                    n_neigh = pStereo2->nBondAtom2[i2] - 1;
  335|     26|                    num_stereo_bonds2++;
  336|     26|                    i2++;
  337|     26|                }
  338|     68|            }
  339|    682|            else if (i < len1)
  ------------------
  |  Branch (339:22): [True: 628, False: 54]
  ------------------
  340|    628|            {
  341|    628|                n_vertex = pStereo->nBondAtom1[i] - 1;
  342|    628|                n_neigh = pStereo->nBondAtom2[i] - 1;
  343|    628|                i++;
  344|    628|            }
  345|     54|            else
  346|     54|            {
  347|     54|                n_vertex = pStereo2->nBondAtom1[i2] - 1;
  348|     54|                n_neigh = pStereo2->nBondAtom2[i2] - 1;
  349|     54|                num_stereo_bonds2++;
  350|     54|                i2++;
  351|     54|            }
  352|       |
  353|       |            /* djb-rwth: fixing oss-fuzz issue #67650 */
  354|    750|            if ((n_vertex < num_atoms) && !is_in_the_list( at[n_vertex].neighbor,
  ------------------
  |  Branch (354:17): [True: 750, False: 0]
  |  Branch (354:43): [True: 74, False: 676]
  ------------------
  355|    750|                (AT_NUMB) n_neigh, at[n_vertex].valence ))
  356|     74|            {
  357|       |                /* must be a cumulene */
  358|     74|                if (!bFindCumuleneChain( at, (AT_NUMB) n_vertex, (AT_NUMB) n_neigh,
  ------------------
  |  Branch (358:21): [True: 30, False: 44]
  ------------------
  359|     74|                    nCumulene, MAX_CUMULENE_LEN + 1 ))
  ------------------
  |  |  207|     74|#define MAX_CUMULENE_LEN   2     /* max number of bonds in a cumulene chain - 1                     */
  ------------------
  360|     30|                {
  361|     30|                    ret = RI_ERR_SYNTAX; /* not a cumulene */
  ------------------
  |  |   16|     30|#define RI_ERR_SYNTAX  (-2)
  ------------------
  362|     30|                    goto exit_function;
  363|     30|                }
  364|     74|            }
  365|       |
  366|    720|            if ((n_vertex < num_atoms) && !at[n_vertex].at_type && at[n_vertex].num_H)
  ------------------
  |  Branch (366:17): [True: 720, False: 0]
  |  Branch (366:43): [True: 720, False: 0]
  |  Branch (366:68): [True: 49, False: 671]
  ------------------
  367|     49|            {
  368|     49|                nNumDeletedH += at[n_vertex].num_H;
  369|     49|                at[n_vertex].at_type++;  /* H should be added as an explicit H */
  370|     49|            }
  371|       |
  372|    720|            if (!at[n_neigh].at_type && at[n_neigh].num_H)
  ------------------
  |  Branch (372:17): [True: 714, False: 6]
  |  Branch (372:41): [True: 30, False: 684]
  ------------------
  373|     30|            {
  374|     30|                nNumDeletedH += at[n_neigh].num_H;
  375|     30|                at[n_neigh].at_type++;   /* H should be added as an explicit H */
  376|     30|            }
  377|    720|        }
  378|       |
  379|       |        INCHI_HEAPCHK
  380|       |
  381|  1.00k|        if (nNumDeletedH)
  ------------------
  |  Branch (381:13): [True: 89, False: 911]
  ------------------
  382|     89|        {
  383|       |            /* add explicit H */
  384|     89|#if ( FIX_GAF_2019_2==1 )           
  385|     89|            inp_ATOM *at2 = (inp_ATOM *)inchi_calloc(nNumDeletedH>0 ? num_atoms + nNumDeletedH : num_atoms,
  ------------------
  |  | 1146|     89|#define inchi_calloc   calloc
  ------------------
  |  Branch (385:54): [True: 88, False: 1]
  ------------------
  386|     89|                sizeof(at2[0]));
  387|       |#else
  388|       |            /* add explicit H */
  389|       |            inp_ATOM *at2 = (inp_ATOM *)inchi_calloc(num_atoms + nNumDeletedH, sizeof(at2[0]));
  390|       |#endif
  391|     89|            if (!at2)
  ------------------
  |  Branch (391:17): [True: 0, False: 89]
  ------------------
  392|      0|            {
  393|      0|                ret = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  394|      0|                goto exit_function;
  395|      0|            }
  396|     89|            pStruct->num_deleted_H = nNumDeletedH;
  397|       |#if USE_BCF
  398|       |            memcpy_s( at2, sizeof(at2[0])*num_atoms, at, num_atoms * sizeof(at2[0])); /* djb-rwth: function replaced with its safe C11 variant */
  399|       |#else
  400|     89|            memcpy(at2, at, num_atoms * sizeof(at2[0]));
  401|     89|#endif
  402|     89|            inchi_free( at );
  ------------------
  |  | 1152|     89|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 89, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 89]
  |  |  ------------------
  ------------------
  403|     89|            pStruct->at = at = at2;
  404|       |            /* fill out deleted H atom info */
  405|    223|            for (i = num_atoms; i < num_atoms + nNumDeletedH; i++) /* djb-rwth: unresolved issue -- revision required? -- buffer overrun cannot happen, loop not executed for nNumDeletedH <= 0 */
  ------------------
  |  Branch (405:33): [True: 134, False: 89]
  ------------------
  406|    134|            {
  407|    134|                strcpy( at[i].elname, "H" );
  408|    134|                at[i].el_number = EL_NUMBER_H;
  ------------------
  |  |   11|    134|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
  409|    134|                at[i].orig_at_number = iAtNoOffset + i + 1;
  410|    134|                at[i].orig_compt_at_numb = i + 1;
  411|    134|                at[i].component = iComponent + 1;
  412|    134|            }
  413|       |
  414|       |            /* connect deleted H */
  415|  1.48k|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (415:25): [True: 1.40k, False: 84]
  ------------------
  416|  1.40k|            {
  417|  1.40k|                if (at[i].at_type == 1)
  ------------------
  |  Branch (417:21): [True: 91, False: 1.31k]
  ------------------
  418|     91|                {
  419|     91|                    if (0 > ( ret = AddExplicitDeletedH( at, i, num_atoms,
  ------------------
  |  Branch (419:25): [True: 5, False: 86]
  ------------------
  420|     91|                        &iDeletedH, &idelH1,
  421|     91|                        nNumDeletedH, pStereo2 != NULL ) ))
  422|      5|                    {
  423|      5|                        goto exit_function;
  424|      5|                    }
  425|     91|                }
  426|  1.40k|            }
  427|     89|        }
  428|       |
  429|  1.00k|        INCHI_HEAPCHK
  430|  1.00k|    }
  431|       |
  432|   145k|    if (pStereo)
  ------------------
  |  Branch (432:9): [True: 923, False: 144k]
  ------------------
  433|    923|    {
  434|       |        /* mark stereo centers, they have already been connected the added explicit H, if any */
  435|    923|        int bInvertedParity = ( pStereo->nCompInv2Abs == -1 );
  436|  1.43k|        for (i = 0; i < pStereo->nNumberOfStereoCenters; i++)
  ------------------
  |  Branch (436:21): [True: 678, False: 759]
  ------------------
  437|    678|        {
  438|    678|            n_vertex = pStereo->nNumber[i] - 1;
  439|    678|            parity = pStereo->t_parity[i];
  440|    678|            if (bInvertedParity)
  ------------------
  |  Branch (440:17): [True: 0, False: 678]
  ------------------
  441|      0|            {
  442|      0|                parity = ( parity == AB_PARITY_EVEN ) ? AB_PARITY_ODD : ( parity == AB_PARITY_ODD ) ? AB_PARITY_EVEN : parity;
  ------------------
  |  |  220|      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;
  ------------------
  |  |  219|      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;
  ------------------
  |  |  219|      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;
  ------------------
  |  |  220|      0|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
  |  Branch (442:26): [True: 0, False: 0]
  |  Branch (442:73): [True: 0, False: 0]
  ------------------
  443|      0|            }
  444|       |            /* find whether it is allene */
  445|    678|            if (at[n_vertex].valence == 2 &&
  ------------------
  |  Branch (445:17): [True: 44, False: 634]
  ------------------
  446|     44|                 at[n_vertex].num_H == 0 &&
  ------------------
  |  Branch (446:18): [True: 39, False: 5]
  ------------------
  447|     39|                 bCanAtomBeMiddleAllene( at[n_vertex].elname, 0, 0 ) &&
  ------------------
  |  Branch (447:18): [True: 33, False: 6]
  ------------------
  448|       |                 /* allene has exactly 2 double bonds */
  449|     33|                 ( jv = at[n_vertex].neighbor[0], at[jv].valence + at[jv].num_H == 3 ) &&
  ------------------
  |  Branch (449:18): [True: 29, False: 4]
  ------------------
  450|     29|                 bCanAtomBeTerminalAllene( at[jv].elname, 0, 0 ) &&
  ------------------
  |  Branch (450:18): [True: 24, False: 5]
  ------------------
  451|     24|                 ( jn = at[n_vertex].neighbor[1], at[jn].valence + at[jn].num_H == 3 ) &&
  ------------------
  |  Branch (451:18): [True: 22, False: 2]
  ------------------
  452|     22|                 bCanAtomBeTerminalAllene( at[jn].elname, 0, 0 ))
  ------------------
  |  Branch (452:18): [True: 20, False: 2]
  ------------------
  453|     20|            {
  454|       |                /* allene: add explicit H if implicit H are present */
  455|       |                /* iDeletedH = current number of already added explicit H */
  456|       |                /* idelH1    = index in at[] of the explicit H added to atom jv */
  457|     20|                if (at[jv].num_H)
  ------------------
  |  Branch (457:21): [True: 0, False: 20]
  ------------------
  458|      0|                {
  459|      0|                    if (0 > ( ret = AddExplicitDeletedH( at, jv, num_atoms, &iDeletedH,
  ------------------
  |  Branch (459:25): [True: 0, False: 0]
  ------------------
  460|      0|                        &idelH1, nNumDeletedH,
  461|      0|                        pStereo2 != NULL ) ))
  462|      0|                    {
  463|      0|                        goto exit_function;
  464|      0|                    }
  465|      0|                }
  466|     20|                else
  467|     20|                {
  468|       |                    /* index of the stereo atom neighbor */
  469|     20|                    idelH1 = at[jv].neighbor[at[jv].neighbor[0] == n_vertex];
  470|     20|                }
  471|       |
  472|     20|                if (at[jn].num_H)
  ------------------
  |  Branch (472:21): [True: 0, False: 20]
  ------------------
  473|      0|                {
  474|       |                    /* iDeletedH = current number of already added explicit H */
  475|       |                    /* idelH2    = index of the explicit H added to atom jn */
  476|      0|                    if (0 > ( ret = AddExplicitDeletedH( at, jn, num_atoms, &iDeletedH, &idelH2, nNumDeletedH, pStereo2 != NULL ) ))
  ------------------
  |  Branch (476:25): [True: 0, False: 0]
  ------------------
  477|      0|                    {
  478|      0|                        goto exit_function;
  479|      0|                    }
  480|      0|                }
  481|     20|                else
  482|     20|                {
  483|     20|                    idelH2 = at[jn].neighbor[at[jn].neighbor[0] == n_vertex];
  484|     20|                }
  485|       |                /* allene: set bond types to double */
  486|       |                /*
  487|       |                if ( 0 > (ret = set_bond_type( at, (AT_NUMB)n_vertex, (AT_NUMB)jv, BOND_TYPE_DOUBLE ) ) ||
  488|       |                     0 > (ret = set_bond_type( at, (AT_NUMB)n_vertex, (AT_NUMB)jn, BOND_TYPE_DOUBLE ) ) ) {
  489|       |                    goto exit_function;
  490|       |                }
  491|       |                */
  492|       |                /* allene: make 0D parity */
  493|     20|                ret = set_cumulene_0D_parity( at, st, num_atoms, idelH1, jv, jn, idelH2, parity, 2 );
  494|     20|                if (ret < 0)
  ------------------
  |  Branch (494:21): [True: 0, False: 20]
  ------------------
  495|      0|                {
  496|      0|                    goto exit_function;
  497|      0|                }
  498|     20|            }
  499|    658|            else
  500|    658|            {
  501|       |                /* stereogenic sp3 atom */
  502|    658|                if (at[n_vertex].num_H)
  ------------------
  |  Branch (502:21): [True: 6, False: 652]
  ------------------
  503|      6|                {
  504|      6|                    if (0 > ( ret = AddExplicitDeletedH( at, n_vertex, num_atoms,
  ------------------
  |  Branch (504:25): [True: 0, False: 6]
  ------------------
  505|      6|                        &iDeletedH, &idelH1, nNumDeletedH,
  506|      6|                        pStereo2 != NULL ) ))
  507|      0|                    {
  508|      0|                        goto exit_function;
  509|      0|                    }
  510|      6|                }
  511|       |
  512|    658|                ret = set_atom_0D_parity( at, st, num_atoms, nNumDeletedH, n_vertex, parity );
  513|       |
  514|    658|                if (ret < 0)
  ------------------
  |  Branch (514:21): [True: 164, False: 494]
  ------------------
  515|    164|                {
  516|    164|                    goto exit_function;
  517|    164|                }
  518|       |                /* djb-rwth: removing redundant code */
  519|    658|            }
  520|       |
  521|    514|            if (ret < 0)
  ------------------
  |  Branch (521:17): [True: 0, False: 514]
  ------------------
  522|      0|            {
  523|      0|                goto exit_function;
  524|      0|            }
  525|    514|        }
  526|       |
  527|       |        INCHI_HEAPCHK
  528|       |
  529|       |        /* mark stereobonds */
  530|  1.39k|        for (i = 0; i < pStereo->nNumberOfStereoBonds; i++)
  ------------------
  |  Branch (530:21): [True: 639, False: 751]
  ------------------
  531|    639|        {
  532|    639|            jv = pStereo->nBondAtom1[i] - 1;
  533|    639|            jn = pStereo->nBondAtom2[i] - 1;
  534|    639|            parity = pStereo->b_parity[i];
  535|    639|            if ((jv < num_atoms) && !is_in_the_list( at[jv].neighbor, (AT_NUMB) jn, at[jv].valence )) /* djb-rwth: fixing GHI #126/16 */
  ------------------
  |  Branch (535:17): [True: 639, False: 0]
  |  Branch (535:37): [True: 37, False: 602]
  ------------------
  536|     37|            {
  537|       |                /* must be a cumulene */
  538|     37|                if (!bFindCumuleneChain( at, (AT_NUMB) jv, (AT_NUMB) jn, nCumulene, MAX_CUMULENE_LEN + 1 ))
  ------------------
  |  |  207|     37|#define MAX_CUMULENE_LEN   2     /* max number of bonds in a cumulene chain - 1                     */
  ------------------
  |  Branch (538:21): [True: 0, False: 37]
  ------------------
  539|      0|                {
  540|      0|                    return RI_ERR_SYNTAX; /* not a cumulene */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
  541|      0|                }
  542|     37|                len = MAX_CUMULENE_LEN + 1;
  ------------------
  |  |  207|     37|#define MAX_CUMULENE_LEN   2     /* max number of bonds in a cumulene chain - 1                     */
  ------------------
  543|     37|            }
  544|    602|            else
  545|    602|            {
  546|       |                /* a regular double or alt bond */
  547|    602|                nCumulene[0] = jv;
  548|    602|                nCumulene[1] = jn;
  549|    602|                len = 1; /* cumulene length is number of bonds, not number of atoms */
  550|    602|            }
  551|       |
  552|       |            /* cumulene or double bond: add explicit H if implicit H are present */
  553|    639|            if (at[jv].num_H)
  ------------------
  |  Branch (553:17): [True: 39, False: 600]
  ------------------
  554|     39|            {
  555|     39|                if (0 > ( ret = AddExplicitDeletedH( at, jv, num_atoms, &iDeletedH, &idelH1, nNumDeletedH, pStereo2 != NULL ) ))
  ------------------
  |  Branch (555:21): [True: 1, False: 38]
  ------------------
  556|      1|                {
  557|      1|                    goto exit_function;
  558|      1|                }
  559|     39|            }
  560|    600|            else
  561|    600|            {
  562|       |                /* double bond neighbor that has the smallest canonical number; it is either 0th or 1st */
  563|    600|                idelH1 = at[jv].neighbor[at[jv].neighbor[0] == nCumulene[1]];
  564|    600|            }
  565|    638|            if (at[jn].num_H)
  ------------------
  |  Branch (565:17): [True: 16, False: 622]
  ------------------
  566|     16|            {
  567|     16|                if (0 > ( ret = AddExplicitDeletedH( at, jn, num_atoms, &iDeletedH, &idelH2, nNumDeletedH, pStereo2 != NULL ) ))
  ------------------
  |  Branch (567:21): [True: 1, False: 15]
  ------------------
  568|      1|                {
  569|      1|                    goto exit_function;
  570|      1|                }
  571|     16|            }
  572|    622|            else
  573|    622|            {
  574|    622|                idelH2 = at[jn].neighbor[at[jn].neighbor[0] == nCumulene[len - 1]];
  575|    622|            }
  576|    637|            if (0 > ( ret = set_cumulene_0D_parity( at, st, num_atoms, idelH1, jv, jn, idelH2, parity, len ) ))
  ------------------
  |  Branch (576:17): [True: 6, False: 631]
  ------------------
  577|      6|            {
  578|      6|                goto exit_function;
  579|      6|            }
  580|    637|        }
  581|       |
  582|    759|        INCHI_HEAPCHK
  583|    759|    }
  584|       |
  585|       |    /* allocate memory for Mobile-H-only stereo */
  586|   145k|    if (num_stereo_centers2 + num_stereo_bonds2)
  ------------------
  |  Branch (586:9): [True: 100, False: 145k]
  ------------------
  587|    100|    {
  588|    100|        if (!( st = (inp_ATOM_STEREO *) inchi_calloc( num_atoms, sizeof( st[0] ) ) ))
  ------------------
  |  | 1146|    100|#define inchi_calloc   calloc
  ------------------
  |  Branch (588:13): [True: 0, False: 100]
  ------------------
  589|      0|        {
  590|      0|            ret = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  591|      0|            goto exit_function;
  592|      0|        }
  593|    100|        CopyAt2St( at, st, num_atoms );
  594|    100|    }
  595|       |
  596|   145k|    pStruct->st = st;
  597|   145k|    if (num_stereo_centers2)
  ------------------
  |  Branch (597:9): [True: 47, False: 145k]
  ------------------
  598|     47|    {
  599|       |        /* In case of Fixed-H */
  600|       |        /* mark additional Mobile-H stereo centers, they have already been connected the added explicit H, if any */
  601|     47|        int bInvertedParity = ( pStereo2->nCompInv2Abs == -1 );
  602|     88|        for (i = 0; i < pStereo2->nNumberOfStereoCenters; i++)
  ------------------
  |  Branch (602:21): [True: 64, False: 24]
  ------------------
  603|     64|        {
  604|     64|            n_vertex = pStereo2->nNumber[i] - 1;
  605|     64|            parity = pStereo2->t_parity[i];
  606|     64|            if (at[n_vertex].p_parity)
  ------------------
  |  Branch (606:17): [True: 3, False: 61]
  ------------------
  607|      3|            {
  608|      3|                continue; /* the parity has already been set for Fixed-H */
  609|      3|            }
  610|     61|            if (bInvertedParity)
  ------------------
  |  Branch (610:17): [True: 0, False: 61]
  ------------------
  611|      0|            {
  612|      0|                parity = ( parity == AB_PARITY_EVEN ) ? AB_PARITY_ODD : ( parity == AB_PARITY_ODD ) ? AB_PARITY_EVEN : parity;
  ------------------
  |  |  220|      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;
  ------------------
  |  |  219|      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;
  ------------------
  |  |  219|      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;
  ------------------
  |  |  220|      0|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
  |  Branch (612:26): [True: 0, False: 0]
  |  Branch (612:73): [True: 0, False: 0]
  ------------------
  613|      0|            }
  614|       |            /* find whether it is allene */
  615|     61|            if (at[n_vertex].valence == 2 &&
  ------------------
  |  Branch (615:17): [True: 17, False: 44]
  ------------------
  616|     17|                 at[n_vertex].num_H == 0 &&
  ------------------
  |  Branch (616:18): [True: 12, False: 5]
  ------------------
  617|     12|                 bCanAtomBeMiddleAllene( at[n_vertex].elname, 0, 0 ) &&
  ------------------
  |  Branch (617:18): [True: 11, False: 1]
  ------------------
  618|       |                 /* allene has exactly 2 double bonds */
  619|     11|                 ( jv = at[n_vertex].neighbor[0], at[jv].valence + at[jv].num_H == 3 ) &&
  ------------------
  |  Branch (619:18): [True: 10, False: 1]
  ------------------
  620|     10|                 bCanAtomBeTerminalAllene( at[jv].elname, 0, 0 ) &&
  ------------------
  |  Branch (620:18): [True: 9, False: 1]
  ------------------
  621|      9|                 ( jn = at[n_vertex].neighbor[1], at[jn].valence + at[jn].num_H == 3 ) &&
  ------------------
  |  Branch (621:18): [True: 8, False: 1]
  ------------------
  622|      8|                 bCanAtomBeTerminalAllene( at[jn].elname, 0, 0 ))
  ------------------
  |  Branch (622:18): [True: 7, False: 1]
  ------------------
  623|      7|            {
  624|       |                /* allene: add explicit H if implicit H are present */
  625|       |                /* iDeletedH = current number of already added explicit H */
  626|       |                /* idelH1    = index in at[] of the explicit H added to atom jv */
  627|      7|                if (at[jv].num_H)
  ------------------
  |  Branch (627:21): [True: 0, False: 7]
  ------------------
  628|      0|                {
  629|      0|                    if (0 > ( ret = AddExplicitDeletedH( at, jv, num_atoms, &iDeletedH, &idelH1, nNumDeletedH, pStereo2 != NULL ) ))
  ------------------
  |  Branch (629:25): [True: 0, False: 0]
  ------------------
  630|      0|                    {
  631|      0|                        goto exit_function;
  632|      0|                    }
  633|      0|                }
  634|      7|                else
  635|      7|                {
  636|       |                    /* index of the stereo atom neighbor */
  637|      7|                    idelH1 = at[jv].neighbor[at[jv].neighbor[0] == n_vertex];
  638|      7|                }
  639|      7|                if (at[jn].num_H)
  ------------------
  |  Branch (639:21): [True: 0, False: 7]
  ------------------
  640|      0|                {
  641|       |                    /* iDeletedH = current number of already added explicit H */
  642|       |                    /* idelH2    = index of the explicit H added to atom jn */
  643|      0|                    if (0 > ( ret = AddExplicitDeletedH( at, jn, num_atoms, &iDeletedH, &idelH2, nNumDeletedH, pStereo2 != NULL ) ))
  ------------------
  |  Branch (643:25): [True: 0, False: 0]
  ------------------
  644|      0|                    {
  645|      0|                        goto exit_function;
  646|      0|                    }
  647|      0|                }
  648|      7|                else
  649|      7|                {
  650|      7|                    idelH2 = at[jn].neighbor[at[jn].neighbor[0] == n_vertex];
  651|      7|                }
  652|       |                /* allene: set bond types to double */
  653|       |                /*
  654|       |                if ( 0 > (ret = set_bond_type( at, (AT_NUMB)n_vertex, (AT_NUMB)jv, BOND_TYPE_DOUBLE ) ) ||
  655|       |                     0 > (ret = set_bond_type( at, (AT_NUMB)n_vertex, (AT_NUMB)jn, BOND_TYPE_DOUBLE ) ) ) {
  656|       |                    goto exit_function;
  657|       |                }
  658|       |                */
  659|       |                /* allene: make 0D parity */
  660|      7|                ret = set_cumulene_0D_parity( at, st, num_atoms, idelH1, jv, jn, idelH2, parity, 2 );
  661|      7|                if (ret < 0)
  ------------------
  |  Branch (661:21): [True: 0, False: 7]
  ------------------
  662|      0|                {
  663|      0|                    goto exit_function;
  664|      0|                }
  665|      7|            }
  666|     54|            else
  667|     54|            {
  668|       |                /* stereogenic sp3 atom */
  669|     54|                if (at[n_vertex].num_H)
  ------------------
  |  Branch (669:21): [True: 11, False: 43]
  ------------------
  670|     11|                {
  671|     11|                    if (0 > ( ret = AddExplicitDeletedH( at, n_vertex, num_atoms, &iDeletedH, &idelH1, nNumDeletedH, pStereo2 != NULL ) ))
  ------------------
  |  Branch (671:25): [True: 0, False: 11]
  ------------------
  672|      0|                    {
  673|      0|                        goto exit_function;
  674|      0|                    }
  675|     11|                }
  676|     54|                ret = set_atom_0D_parity( at, st, num_atoms, nNumDeletedH, n_vertex, parity );
  677|     54|                if (ret < 0)
  ------------------
  |  Branch (677:21): [True: 23, False: 31]
  ------------------
  678|     23|                {
  679|     23|                    goto exit_function;
  680|     23|                }
  681|       |                /* djb-rwth: removing redundant code */
  682|     54|            }
  683|     38|            if (ret < 0)
  ------------------
  |  Branch (683:17): [True: 0, False: 38]
  ------------------
  684|      0|            {
  685|      0|                goto exit_function;
  686|      0|            }
  687|     38|        }
  688|     47|    }
  689|       |
  690|   145k|    if (num_stereo_bonds2)
  ------------------
  |  Branch (690:9): [True: 53, False: 145k]
  ------------------
  691|     53|    {
  692|       |        /* In case of Fixed-H */
  693|       |        /* mark additional Mobile-H stereobonds, they have already been connected the added explicit H, if any */
  694|    121|        for (i = 0; i < pStereo2->nNumberOfStereoBonds; i++)
  ------------------
  |  Branch (694:21): [True: 73, False: 48]
  ------------------
  695|     73|        {
  696|     73|            jv = pStereo2->nBondAtom1[i] - 1;
  697|     73|            jn = pStereo2->nBondAtom2[i] - 1;
  698|     73|            parity = pStereo2->b_parity[i];
  699|     73|            if (!is_in_the_list( at[jv].neighbor, (AT_NUMB) jn, at[jv].valence ))
  ------------------
  |  Branch (699:17): [True: 5, False: 68]
  ------------------
  700|      5|            {
  701|       |                /* must be a cumulene */
  702|      5|                if (!bFindCumuleneChain( at, (AT_NUMB) jv, (AT_NUMB) jn, nCumulene, MAX_CUMULENE_LEN + 1 ))
  ------------------
  |  |  207|      5|#define MAX_CUMULENE_LEN   2     /* max number of bonds in a cumulene chain - 1                     */
  ------------------
  |  Branch (702:21): [True: 0, False: 5]
  ------------------
  703|      0|                {
  704|      0|                    return RI_ERR_SYNTAX; /* not a cumulene */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
  705|      0|                }
  706|      5|                len = MAX_CUMULENE_LEN + 1;
  ------------------
  |  |  207|      5|#define MAX_CUMULENE_LEN   2     /* max number of bonds in a cumulene chain - 1                     */
  ------------------
  707|      5|            }
  708|     68|            else
  709|     68|            {
  710|       |                /* a regular double or alt bond */
  711|     68|                nCumulene[0] = jv;
  712|     68|                nCumulene[1] = jn;
  713|     68|                len = 1; /* cumulene length is number of bonds, not number of atoms */
  714|     68|            }
  715|       |            /* cumulene or double bond: add explicit H if implicit H are present */
  716|     73|            if (at[jv].num_H)
  ------------------
  |  Branch (716:17): [True: 6, False: 67]
  ------------------
  717|      6|            {
  718|      6|                if (0 > ( ret = AddExplicitDeletedH( at, jv, num_atoms, &iDeletedH, &idelH1, nNumDeletedH, pStereo2 != NULL ) ))
  ------------------
  |  Branch (718:21): [True: 0, False: 6]
  ------------------
  719|      0|                {
  720|      0|                    goto exit_function;
  721|      0|                }
  722|      6|            }
  723|     67|            else
  724|     67|            {
  725|       |                /* double bond neighbor that has the smallest canonical number */
  726|     67|                idelH1 = at[jv].neighbor[at[jv].neighbor[0] == nCumulene[1]];
  727|     67|            }
  728|     73|            if (at[jn].num_H)
  ------------------
  |  Branch (728:17): [True: 16, False: 57]
  ------------------
  729|     16|            {
  730|     16|                if (0 > ( ret = AddExplicitDeletedH( at, jn, num_atoms, &iDeletedH, &idelH2, nNumDeletedH, pStereo2 != NULL ) ))
  ------------------
  |  Branch (730:21): [True: 0, False: 16]
  ------------------
  731|      0|                {
  732|      0|                    goto exit_function;
  733|      0|                }
  734|     16|            }
  735|     57|            else
  736|     57|            {
  737|     57|                idelH2 = at[jn].neighbor[at[jn].neighbor[0] == nCumulene[len - 1]];
  738|     57|            }
  739|     73|            if (0 > ( ret = set_cumulene_0D_parity( at, st, num_atoms, idelH1, jv, jn, idelH2, parity, len ) ))
  ------------------
  |  Branch (739:17): [True: 5, False: 68]
  ------------------
  740|      5|            {
  741|      5|                goto exit_function;
  742|      5|            }
  743|     73|        }
  744|     53|    }
  745|       |
  746|   145k|    ret = num_atoms;
  747|       |
  748|   145k|exit_function:
  749|       |
  750|   145k|    return ret;
  751|   145k|}
SetStereoBondTypeFor0DParity:
  756|  1.28k|{
  757|  1.28k|    AT_NUMB nCumulene[MAX_CUMULENE_LEN + 2];
  758|  1.28k|    int j, n1, n2, k1, m2, ret, nLenCumulene = 0, bond_type;
  759|  1.28k|    k1 = at[i1].sb_ord[m1];
  760|  1.28k|    n1 = i1;
  761|  1.28k|    nCumulene[nLenCumulene++] = n1;
  762|  1.28k|    do
  763|  1.40k|    {
  764|  1.40k|        n2 = at[n1].neighbor[k1]; /* next atom */
  765|  1.40k|        nCumulene[nLenCumulene++] = n2;
  766|  1.61k|        for (m2 = 0; m2 < MAX_NUM_STEREO_BONDS && at[n2].sb_parity[m2]; m2++)
  ------------------
  |  |  873|  3.23k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (766:22): [True: 1.61k, False: 0]
  |  Branch (766:51): [True: 1.48k, False: 128]
  ------------------
  767|  1.48k|        {
  768|  1.48k|            if (n1 == at[n2].neighbor[(int) at[n2].sb_ord[m2]])
  ------------------
  |  Branch (768:17): [True: 1.27k, False: 209]
  ------------------
  769|  1.27k|            {
  770|       |                /* found the endatom */
  771|  1.27k|                goto found;
  772|  1.27k|            }
  773|  1.48k|        }
  774|    128|        if (at[n2].num_H || at[n2].valence != 2 || at[n2].endpoint)
  ------------------
  |  Branch (774:13): [True: 0, False: 128]
  |  Branch (774:29): [True: 0, False: 128]
  |  Branch (774:52): [True: 4, False: 124]
  ------------------
  775|      4|        {
  776|      4|            break; /* not a middle cumulene */
  777|      4|        }
  778|    124|        k1 = ( at[n2].neighbor[0] == n1 );
  779|    124|        n1 = n2;
  780|    124|    }
  781|  1.28k|    while (at[n1].valence == 2 && !at[n1].num_H && nLenCumulene < MAX_CUMULENE_LEN + 2 &&
  ------------------
  |  |  207|    124|#define MAX_CUMULENE_LEN   2     /* max number of bonds in a cumulene chain - 1                     */
  ------------------
  |  Branch (781:12): [True: 124, False: 0]
  |  Branch (781:35): [True: 124, False: 0]
  |  Branch (781:52): [True: 124, False: 0]
  ------------------
  782|    124|           bCanAtomBeMiddleAllene( at[n1].elname, at[n1].charge, at[n1].radical ));
  ------------------
  |  Branch (782:12): [True: 124, False: 0]
  ------------------
  783|      4|    return RI_ERR_SYNTAX; /* failed */
  ------------------
  |  |   16|      4|#define RI_ERR_SYNTAX  (-2)
  ------------------
  784|       |
  785|  1.27k|found:
  786|  1.27k|    if (nLenCumulene == 2)
  ------------------
  |  Branch (786:9): [True: 1.18k, False: 91]
  ------------------
  787|  1.18k|    {
  788|  1.18k|        bond_type = BOND_TYPE_STEREO; /* double bond or alternating bond */
  ------------------
  |  |  253|  1.18k|#define BOND_TYPE_STEREO (BOND_TYPE_SINGLE | BOND_MARK_STEREO)
  |  |  ------------------
  |  |  |  |   32|  1.18k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  |  |               #define BOND_TYPE_STEREO (BOND_TYPE_SINGLE | BOND_MARK_STEREO)
  |  |  ------------------
  |  |  |  |  252|  1.18k|#define BOND_MARK_STEREO 0x10
  |  |  ------------------
  ------------------
  789|  1.18k|    }
  790|     91|    else
  791|     91|    {
  792|     91|        bond_type = BOND_TYPE_DOUBLE; /* cumulene or allene */
  ------------------
  |  |   33|     91|#define BOND_TYPE_DOUBLE    2
  ------------------
  793|     91|    }
  794|       |
  795|  2.68k|    for (j = 1; j < nLenCumulene; j++)
  ------------------
  |  Branch (795:17): [True: 1.40k, False: 1.27k]
  ------------------
  796|  1.40k|    {
  797|       |        /* if bond_type = BOND_TYPE_DOUBLE then increments at->cham_bonds_valence: */
  798|       |        /* at->cham_bonds_valence += BOND_TYPE_DOUBLE-BOND_TYPE_SINGLE */
  799|  1.40k|        if (0 > ( ret = set_bond_type( at, (AT_NUMB) nCumulene[j - 1], (AT_NUMB) nCumulene[j], bond_type ) )) /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (799:13): [True: 0, False: 1.40k]
  ------------------
  800|      0|        {
  801|      0|            return RI_ERR_PROGR; /* failed */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  802|      0|        }
  803|  1.40k|    }
  804|  1.27k|    return nLenCumulene;
  805|  1.27k|}
SetStereoBondTypesFrom0DStereo:
  810|   145k|{
  811|   145k|    INChI_Stereo *pStereo;
  812|   145k|    inp_ATOM     *at = pStruct->at;
  813|   145k|    int           num_atoms = pStruct->num_atoms;
  814|   145k|    int           i, j, num_stereo_bonds, ret;
  815|       |
  816|   145k|    if (pInChI->StereoIsotopic &&
  ------------------
  |  Branch (816:9): [True: 498, False: 144k]
  ------------------
  817|    498|        ( pInChI->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (817:9): [True: 164, False: 334]
  ------------------
  818|    498|            pInChI->StereoIsotopic->nNumberOfStereoCenters ))
  819|    164|    {
  820|    164|        pStereo = pInChI->StereoIsotopic;
  821|    164|    }
  822|   144k|    else
  823|   144k|        if (pInChI->Stereo &&
  ------------------
  |  Branch (823:13): [True: 11.8k, False: 133k]
  ------------------
  824|  11.8k|            ( pInChI->Stereo->nNumberOfStereoBonds +
  ------------------
  |  Branch (824:13): [True: 581, False: 11.3k]
  ------------------
  825|  11.8k|                pInChI->Stereo->nNumberOfStereoCenters ))
  826|    581|        {
  827|    581|            pStereo = pInChI->Stereo;
  828|    581|        }
  829|   144k|        else
  830|   144k|        {
  831|   144k|            pStereo = NULL;
  832|   144k|        }
  833|       |
  834|       |    /************************ set bond types separately from stereo *******************/
  835|   145k|    if (pStereo)
  ------------------
  |  Branch (835:9): [True: 745, False: 144k]
  ------------------
  836|    745|    {
  837|    745|        num_stereo_bonds = 0;
  838|  5.08k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (838:21): [True: 4.34k, False: 741]
  ------------------
  839|  4.34k|        {
  840|       |            /* set BOND_TYPE_DOUBLE in allenes and cumulenes */
  841|       |            /* set BOND_TYPE_STEREO in double bond stereo */
  842|  5.62k|            for (j = 0; j < MAX_NUM_STEREO_BONDS && at[i].sb_parity[j]; j++)
  ------------------
  |  |  873|  11.2k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (842:25): [True: 5.60k, False: 17]
  |  Branch (842:53): [True: 1.28k, False: 4.32k]
  ------------------
  843|  1.28k|            {
  844|  1.28k|                num_stereo_bonds++;
  845|  1.28k|                if (0 > ( ret = SetStereoBondTypeFor0DParity( at, i, j ) ))
  ------------------
  |  Branch (845:21): [True: 4, False: 1.27k]
  ------------------
  846|      4|                {
  847|      4|                    goto exit_function;
  848|      4|                }
  849|  1.28k|            }
  850|  4.34k|        }
  851|    741|        if (num_stereo_bonds)
  ------------------
  |  Branch (851:13): [True: 434, False: 307]
  ------------------
  852|    434|        {
  853|    434|            int num_bond_type_stereo;
  854|    434|            int num_bond_type_altern;
  855|    434|            AT_NUMB neigh;
  856|       |            /* replace adjacent BOND_TYPE_STEREO with BOND_TYPE_ALTERN */
  857|  3.05k|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (857:25): [True: 2.61k, False: 434]
  ------------------
  858|  2.61k|            {
  859|  2.61k|                num_bond_type_stereo = 0;
  860|  2.61k|                num_bond_type_altern = 0;
  861|  7.81k|                for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (861:29): [True: 5.19k, False: 2.61k]
  ------------------
  862|  5.19k|                {
  863|  5.19k|                    num_bond_type_stereo += ( at[i].bond_type[j] == BOND_TYPE_STEREO );
  ------------------
  |  |  253|  5.19k|#define BOND_TYPE_STEREO (BOND_TYPE_SINGLE | BOND_MARK_STEREO)
  |  |  ------------------
  |  |  |  |   32|  5.19k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  |  |               #define BOND_TYPE_STEREO (BOND_TYPE_SINGLE | BOND_MARK_STEREO)
  |  |  ------------------
  |  |  |  |  252|  5.19k|#define BOND_MARK_STEREO 0x10
  |  |  ------------------
  ------------------
  864|  5.19k|                    num_bond_type_altern += ( at[i].bond_type[j] == BOND_TYPE_ALTERN );
  ------------------
  |  |   35|  5.19k|#define BOND_TYPE_ALTERN    4
  ------------------
  865|  5.19k|                }
  866|  2.61k|                if (num_bond_type_stereo + num_bond_type_altern > 1 && num_bond_type_stereo)
  ------------------
  |  Branch (866:21): [True: 143, False: 2.47k]
  |  Branch (866:72): [True: 121, False: 22]
  ------------------
  867|    121|                {
  868|    425|                    for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (868:33): [True: 304, False: 121]
  ------------------
  869|    304|                    {
  870|    304|                        if (at[i].bond_type[j] == BOND_TYPE_STEREO)
  ------------------
  |  |  253|    304|#define BOND_TYPE_STEREO (BOND_TYPE_SINGLE | BOND_MARK_STEREO)
  |  |  ------------------
  |  |  |  |   32|    304|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  |  |               #define BOND_TYPE_STEREO (BOND_TYPE_SINGLE | BOND_MARK_STEREO)
  |  |  ------------------
  |  |  |  |  252|    304|#define BOND_MARK_STEREO 0x10
  |  |  ------------------
  ------------------
  |  Branch (870:29): [True: 215, False: 89]
  ------------------
  871|    215|                        {
  872|    215|                            neigh = at[i].neighbor[j];
  873|       |                            /* does not change at[i].chem_bond_valence in case of BOND_TYPE_ALTERN */
  874|    215|                            if (0 > ( ret = set_bond_type( at, (AT_NUMB) i, neigh, BOND_TYPE_ALTERN ) ))
  ------------------
  |  |   35|    215|#define BOND_TYPE_ALTERN    4
  ------------------
  |  Branch (874:33): [True: 0, False: 215]
  ------------------
  875|      0|                            {
  876|      0|                                goto exit_function;
  877|      0|                            }
  878|    215|                        }
  879|    304|                    }
  880|    121|                }
  881|       |                /* at this point only isolated stereo bonds have type BOND_TYPE_STEREO */
  882|  2.61k|            }
  883|       |            /* increment at[i].chem_bonds_valence if at[i] has an altern. bond */
  884|       |            /* replace BOND_TYPE_STEREO with BOND_TYPE_DOUBLE and increment   */
  885|       |            /* chem_bonds_valence of the adjacent atoms */
  886|  3.05k|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (886:25): [True: 2.61k, False: 434]
  ------------------
  887|  2.61k|            {
  888|  2.61k|                num_bond_type_stereo = 0;
  889|  2.61k|                num_bond_type_altern = 0;
  890|  7.81k|                for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (890:29): [True: 5.19k, False: 2.61k]
  ------------------
  891|  5.19k|                {
  892|  5.19k|                    num_bond_type_stereo += ( at[i].bond_type[j] == BOND_TYPE_STEREO );
  ------------------
  |  |  253|  5.19k|#define BOND_TYPE_STEREO (BOND_TYPE_SINGLE | BOND_MARK_STEREO)
  |  |  ------------------
  |  |  |  |   32|  5.19k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  |  |               #define BOND_TYPE_STEREO (BOND_TYPE_SINGLE | BOND_MARK_STEREO)
  |  |  ------------------
  |  |  |  |  252|  5.19k|#define BOND_MARK_STEREO 0x10
  |  |  ------------------
  ------------------
  893|  5.19k|                    num_bond_type_altern += ( at[i].bond_type[j] == BOND_TYPE_ALTERN );
  ------------------
  |  |   35|  5.19k|#define BOND_TYPE_ALTERN    4
  ------------------
  894|  5.19k|                }
  895|  2.61k|                if (!num_bond_type_stereo && num_bond_type_altern)
  ------------------
  |  Branch (895:21): [True: 2.23k, False: 378]
  |  Branch (895:46): [True: 270, False: 1.96k]
  ------------------
  896|    270|                {
  897|       |                    /* an atom has only BOND_TYPE_ALTERN => adjacent BOND_TYPE_ALTERN case */
  898|    270|                    at[i].chem_bonds_valence += 1;
  899|    270|                }
  900|  2.34k|                else
  901|  2.34k|                {
  902|  2.34k|                    if (num_bond_type_stereo == 1)
  ------------------
  |  Branch (902:25): [True: 378, False: 1.96k]
  ------------------
  903|    378|                    {
  904|       |                        /* isolated BOND_TYPE_STEREO => replace with BOND_TYPE_DOUBLE */
  905|  1.20k|                        for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (905:37): [True: 822, False: 378]
  ------------------
  906|    822|                        {
  907|    822|                            if (at[i].bond_type[j] == BOND_TYPE_STEREO)
  ------------------
  |  |  253|    822|#define BOND_TYPE_STEREO (BOND_TYPE_SINGLE | BOND_MARK_STEREO)
  |  |  ------------------
  |  |  |  |   32|    822|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  |  |               #define BOND_TYPE_STEREO (BOND_TYPE_SINGLE | BOND_MARK_STEREO)
  |  |  ------------------
  |  |  |  |  252|    822|#define BOND_MARK_STEREO 0x10
  |  |  ------------------
  ------------------
  |  Branch (907:33): [True: 378, False: 444]
  ------------------
  908|    378|                            {
  909|    378|                                neigh = at[i].neighbor[j];
  910|       |                                /* replacing BOND_TYPE_STEREO with BOND_TYPE_DOUBLE */
  911|       |                                /* does not change at->chem_bonds_valence */
  912|    378|                                if (0 > ( ret = set_bond_type( at, (AT_NUMB) i, neigh, BOND_TYPE_DOUBLE ) ))
  ------------------
  |  |   33|    378|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (912:37): [True: 0, False: 378]
  ------------------
  913|      0|                                {
  914|      0|                                    goto exit_function;
  915|      0|                                }
  916|    378|                                at[i].chem_bonds_valence++;
  917|    378|                                at[(int) neigh].chem_bonds_valence++;
  918|    378|                            }
  919|    822|                        }
  920|    378|                    }
  921|  1.96k|                    else
  922|  1.96k|                    {
  923|  1.96k|                        if (num_bond_type_stereo + num_bond_type_altern)
  ------------------
  |  Branch (923:29): [True: 0, False: 1.96k]
  ------------------
  924|      0|                        {
  925|       |                            /* an atom still has both BOND_TYPE_STEREO and BOND_TYPE_ALTERN */
  926|      0|                            ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  927|      0|                            goto exit_function;
  928|      0|                        }
  929|  1.96k|                    }
  930|  2.34k|                }
  931|  2.61k|            }
  932|    434|            INCHI_HEAPCHK
  933|    434|        }
  934|    741|    }
  935|   145k|    ret = 0; /* success */
  936|       |
  937|   145k|exit_function:
  938|       |
  939|   145k|    return ret;
  940|   145k|}
CopyBnsToAtom:
  949|  1.33M|{
  950|  1.33M|    int i, j, charge, ret = 0, v1, nMinorder; /* djb-rwth: removing redundant variables */
  951|  1.33M|    int          num_at = pStruct->num_atoms;
  952|  1.33M|    inp_ATOM *at = pStruct->at;
  953|  1.33M|    ICHICONST SRM *pSrm = pStruct->pSrm;
  ------------------
  |  |   13|  1.33M|#define ICHICONST      const
  ------------------
  954|  1.33M|    BNS_VERTEX  *pv;
  955|  1.33M|    BNS_EDGE    *pe;
  956|  1.33M|    int          chem_bonds_valence, bond_order;
  957|       |
  958|       |    /* djb-rwth: removing redundant code */
  959|  13.9M|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (959:17): [True: 12.6M, False: 1.33M]
  ------------------
  960|  12.6M|    {
  961|  12.6M|        pv = pBNS->vert + i;
  962|       |        /* bonds */
  963|  12.6M|        chem_bonds_valence = 0;
  964|  17.9M|        for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (964:21): [True: 5.36M, False: 12.6M]
  ------------------
  965|  5.36M|        {
  966|  5.36M|            pe = pBNS->edge + pv->iedge[j];
  967|  5.36M|            BondFlowMaxcapMinorder( at, pVA, pSrm, i, j, NULL, &nMinorder, NULL );
  968|  5.36M|            bond_order = pe->flow + nMinorder;
  969|  5.36M|            if (!bAllowZeroBondOrder && !bond_order)
  ------------------
  |  Branch (969:17): [True: 0, False: 5.36M]
  |  Branch (969:41): [True: 0, False: 0]
  ------------------
  970|      0|            {
  971|      0|                bond_order = 1;
  972|      0|            }
  973|  5.36M|            chem_bonds_valence += bond_order;
  974|  5.36M|            at[i].bond_type[j] = bond_order;  /* BOND_MARK_HIGHLIGHT */
  975|  5.36M|        }
  976|  12.6M|        at[i].chem_bonds_valence = chem_bonds_valence;
  977|       |        /* charges (both may be present resulting in zero) */
  978|  12.6M|        at[i].charge = pVA[i].cInitCharge;
  979|  12.6M|        if (pVA[i].nCMinusGroupEdge)
  ------------------
  |  Branch (979:13): [True: 1.90M, False: 10.7M]
  ------------------
  980|  1.90M|        {
  981|  1.90M|            pe = pBNS->edge + pVA[i].nCMinusGroupEdge - 1;
  982|  1.90M|            if ((charge = pe->flow)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (982:17): [True: 507k, False: 1.39M]
  ------------------
  983|   507k|            {
  984|   507k|                at[i].charge -= charge;
  985|       |                /* djb-rwth: removing redundant code */
  986|   507k|            }
  987|  1.90M|        }
  988|  12.6M|        if (pVA[i].nCPlusGroupEdge)
  ------------------
  |  Branch (988:13): [True: 2.19M, False: 10.4M]
  ------------------
  989|  2.19M|        {
  990|  2.19M|            pe = pBNS->edge + pVA[i].nCPlusGroupEdge - 1;
  991|  2.19M|            if ((charge = pe->cap - pe->flow)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (991:17): [True: 509k, False: 1.68M]
  ------------------
  992|   509k|            {
  993|   509k|                at[i].charge += charge;
  994|       |                /* djb-rwth: removing redundant code */
  995|   509k|            }
  996|  2.19M|        }
  997|  12.6M|        if (pv->st_edge.cap > pv->st_edge.flow)
  ------------------
  |  Branch (997:13): [True: 277k, False: 12.3M]
  ------------------
  998|   277k|        {
  999|   277k|            at[i].radical = RADICAL_SINGLET + ( pv->st_edge.cap - pv->st_edge.flow );
  ------------------
  |  |   75|   277k|#define RADICAL_SINGLET 1
  ------------------
 1000|   277k|        }
 1001|  12.6M|    }
 1002|       |    /* find charge excess */
 1003|       |    /* djb-rwth: removing redundant variables/code */
 1004|       |    /* tautomeric H and (-) */
 1005|  1.34M|    for (i = 0; i < pBNS->num_t_groups; i++)
  ------------------
  |  Branch (1005:17): [True: 9.08k, False: 1.33M]
  ------------------
 1006|  9.08k|    {
 1007|       |        /* tautomeric groups are first non-atom vertices;
 1008|       |        order of them is same as in pTCGroups->pTCG[] */
 1009|  9.08k|        int num_H = pTCGroups->pTCG[i].tg_num_H;
 1010|  9.08k|        int num_Minus = pTCGroups->pTCG[i].tg_num_Minus;
 1011|  9.08k|        int bMinusFirst = ( pTCGroups->pTCG[i].tg_RestoreFlags & TGRF_MINUS_FIRST );
 1012|  9.08k|        int num_at_add;
 1013|  9.08k|        Vertex vMinus = NO_VERTEX;
  ------------------
  |  |  118|  9.08k|#define NO_VERTEX    -2
  ------------------
 1014|  9.08k|        pv = pBNS->vert + num_at + i;  /* t-group vertex */
 1015|  9.08k|        if (!( pv->type & BNS_VERT_TYPE_TGROUP ))
  ------------------
  |  |   47|  9.08k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
  |  Branch (1015:13): [True: 0, False: 9.08k]
  ------------------
 1016|      0|        {
 1017|      0|            return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1018|      0|        }
 1019|  9.08k|        if (pTCGroups->pTCG[i].tg_set_Minus > 0 && num_Minus > 0)
  ------------------
  |  Branch (1019:13): [True: 12, False: 9.07k]
  |  Branch (1019:52): [True: 12, False: 0]
  ------------------
 1020|     12|        {
 1021|     12|            vMinus = pTCGroups->pTCG[i].tg_set_Minus - 1;
 1022|     12|            num_Minus--;
 1023|     12|        }
 1024|       |
 1025|  9.08k|        if (bMinusFirst)
  ------------------
  |  Branch (1025:13): [True: 76, False: 9.01k]
  ------------------
 1026|     76|        {
 1027|    264|            for (j = 0; j < pv->num_adj_edges; j++)
  ------------------
  |  Branch (1027:25): [True: 188, False: 76]
  ------------------
 1028|    188|            {
 1029|    188|                pe = pBNS->edge + pv->iedge[j];
 1030|    188|                v1 = pe->neighbor1;
 1031|    188|                num_at_add = pe->flow;
 1032|    188|                if (v1 == vMinus)
  ------------------
  |  Branch (1032:21): [True: 12, False: 176]
  ------------------
 1033|     12|                {
 1034|     12|                    if (num_at_add)
  ------------------
  |  Branch (1034:25): [True: 12, False: 0]
  ------------------
 1035|     12|                    {
 1036|     12|                        at[v1].charge = -1;  /* no checking at[v1].charge == 0 for now ??? */
 1037|     12|                        num_at_add--;       /* no checking  num_at_add > 0 for now ??? */
 1038|     12|                    }
 1039|      0|                    else
 1040|      0|                    {
 1041|      0|                        num_Minus++;        /* error ??? */
 1042|      0|                    }
 1043|     12|                    vMinus = NO_VERTEX;
  ------------------
  |  |  118|     12|#define NO_VERTEX    -2
  ------------------
 1044|     12|                }
 1045|    188|                if (num_at_add > 0)
  ------------------
  |  Branch (1045:21): [True: 146, False: 42]
  ------------------
 1046|    146|                {
 1047|       |                    /* atom has tautomeric attachment; do not allow =N(-) */
 1048|    146|                    if (num_Minus && !at[v1].charge &&
  ------------------
  |  Branch (1048:25): [True: 140, False: 6]
  |  Branch (1048:38): [True: 140, False: 0]
  ------------------
 1049|    140|                         at[v1].valence == at[v1].chem_bonds_valence)
  ------------------
  |  Branch (1049:26): [True: 136, False: 4]
  ------------------
 1050|    136|                    {
 1051|    136|                        at[v1].charge--;
 1052|    136|                        num_at_add--;
 1053|    136|                        num_Minus--;
 1054|    136|                    }
 1055|    146|                    if (num_at_add > 0)
  ------------------
  |  Branch (1055:25): [True: 22, False: 124]
  ------------------
 1056|     22|                    {
 1057|     22|                        at[v1].num_H += num_at_add;
 1058|     22|                        num_H -= num_at_add;
 1059|       |                        /* djb-rwth: removing redundant code */
 1060|     22|                    }
 1061|    146|                }
 1062|    188|                at[v1].endpoint = i + 1;
 1063|    188|            }
 1064|     76|            if (( num_H + num_Minus != pv->st_edge.cap - pv->st_edge.flow ) && ( num_H || num_Minus || vMinus != NO_VERTEX ))
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (1064:17): [True: 0, False: 76]
  |  Branch (1064:82): [True: 0, False: 0]
  |  Branch (1064:91): [True: 0, False: 0]
  |  Branch (1064:104): [True: 0, False: 0]
  ------------------
 1065|      0|            {
 1066|      0|                return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1067|      0|            }
 1068|     76|        }
 1069|  9.01k|        else
 1070|  9.01k|        {
 1071|  26.6k|            for (j = pv->num_adj_edges - 1; 0 <= j; j--)
  ------------------
  |  Branch (1071:45): [True: 17.6k, False: 9.01k]
  ------------------
 1072|  17.6k|            {
 1073|  17.6k|                pe = pBNS->edge + pv->iedge[j];
 1074|  17.6k|                v1 = pe->neighbor1;
 1075|  17.6k|                num_at_add = pe->flow;
 1076|  17.6k|                if (v1 == vMinus)
  ------------------
  |  Branch (1076:21): [True: 0, False: 17.6k]
  ------------------
 1077|      0|                {
 1078|      0|                    if (num_at_add)
  ------------------
  |  Branch (1078:25): [True: 0, False: 0]
  ------------------
 1079|      0|                    {
 1080|      0|                        at[v1].charge = -1;  /* no checking at[v1].charge == 0 for now ??? */
 1081|      0|                        num_at_add--;       /* no checking  num_at_add > 0 for now ??? */
 1082|      0|                    }
 1083|      0|                    else
 1084|      0|                    {
 1085|      0|                        num_Minus++;        /* error ??? */
 1086|      0|                    }
 1087|      0|                    vMinus = NO_VERTEX;
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
 1088|      0|                }
 1089|  17.6k|                if (num_at_add > 0)
  ------------------
  |  Branch (1089:21): [True: 6.82k, False: 10.7k]
  ------------------
 1090|  6.82k|                {
 1091|       |                    /* atom has tautomeric attachment; do not allow =N(-) */
 1092|  6.82k|                    if (num_Minus && !at[v1].charge &&
  ------------------
  |  Branch (1092:25): [True: 5.00k, False: 1.82k]
  |  Branch (1092:38): [True: 5.00k, False: 0]
  ------------------
 1093|  5.00k|                         at[v1].valence == at[v1].chem_bonds_valence)
  ------------------
  |  Branch (1093:26): [True: 4.62k, False: 371]
  ------------------
 1094|  4.62k|                    {
 1095|  4.62k|                        at[v1].charge--;
 1096|  4.62k|                        num_at_add--;
 1097|  4.62k|                        num_Minus--;
 1098|  4.62k|                    }
 1099|  6.82k|                    if (num_at_add > 0)
  ------------------
  |  Branch (1099:25): [True: 3.63k, False: 3.19k]
  ------------------
 1100|  3.63k|                    {
 1101|  3.63k|                        at[v1].num_H += num_at_add;
 1102|  3.63k|                        num_H -= num_at_add;
 1103|       |                        /* djb-rwth: removing redundant code */
 1104|  3.63k|                    }
 1105|  6.82k|                }
 1106|  17.6k|                at[v1].endpoint = i + 1;
 1107|  17.6k|            }
 1108|  9.01k|            if (( num_H + num_Minus != pv->st_edge.cap - pv->st_edge.flow ) && ( num_H || num_Minus || vMinus != NO_VERTEX ))
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (1108:17): [True: 21, False: 8.99k]
  |  Branch (1108:82): [True: 6, False: 15]
  |  Branch (1108:91): [True: 15, False: 0]
  |  Branch (1108:104): [True: 0, False: 0]
  ------------------
 1109|     21|            {
 1110|     21|                return RI_ERR_PROGR;
  ------------------
  |  |   17|     21|#define RI_ERR_PROGR   (-3)
  ------------------
 1111|     21|            }
 1112|  9.01k|        }
 1113|  9.08k|    }
 1114|       |
 1115|  1.33M|    return ret;
 1116|  1.33M|}
CheckBnsConsistency:
 1125|   101k|{
 1126|   101k|    int nOutput = 0;
 1127|       |#ifndef TARGET_API_LIB
 1128|       |#if ( bRELEASE_VERSION == 0 )
 1129|       |    char s[128];
 1130|       |    int i, j, atom_charge, left_charge, charge, excess_charge, ret = 0;
 1131|       |    int v1, v2, flow, tot_st_flow, tot_st_cap, num_electrons, nNumMetalAtoms;
 1132|       |    int       num_at = pStruct->num_atoms;
 1133|       |    inp_ATOM *at = pStruct->at;
 1134|       |    BNS_VERTEX  *pv;
 1135|       |    BNS_EDGE    *pe;
 1136|       |#ifdef _DEBUG
 1137|       |    int       bDebugOutput = 0;
 1138|       |    bNoRad = 1;
 1139|       |    bDebugOutput = 1;
 1140|       |#endif
 1141|       |    /* count electrons and metals */
 1142|       |    num_electrons = -pTCGroups->total_charge;
 1143|       |    nNumMetalAtoms = 0;
 1144|       |    for (i = 0; i < pTCGroups->num_tgroups; i++)
 1145|       |    {
 1146|       |        num_electrons += pTCGroups->pTCG[i].tg_num_H;
 1147|       |    }
 1148|       |    for (i = 0; i < num_at; i++)
 1149|       |    {
 1150|       |        num_electrons += at[i].el_number + at[i].num_H;
 1151|       |        nNumMetalAtoms += pVA[i].cMetal;
 1152|       |    }
 1153|       |    /* create output string */
 1154|       |    sprintf( s, "%d:%d%sM%02dv%da%de%db%d* ",
 1155|       |                bNoRad, pTCGroups->iComponent + 1, num_electrons % 2 ? "O" : "E", nNumMetalAtoms,
 1156|       |                pBNS->num_vertices, num_at, pBNS->num_edges, pBNS->num_bonds );
 1157|       |
 1158|       |
 1159|       |    tot_st_flow = tot_st_cap = 0;
 1160|       |    atom_charge = left_charge = 0;
 1161|       |    if (pBNS->num_atoms != num_at)
 1162|       |    {
 1163|       |        fprintf( stdout, "\n%sNum. atoms discrepancy: %d(BNS) vs. %d(at) ", s, pBNS->num_atoms, num_at );
 1164|       |        nOutput++;
 1165|       |    }
 1166|       |    /* check edges */
 1167|       |#ifdef _DEBUG
 1168|       |    if (bDebugOutput && bNoRad)
 1169|       |    {
 1170|       |        fprintf( stderr, "\n\n------begin------------------------------------------------\n" );
 1171|       |        fprintf( stderr, "\n\fedge    cap       flow     v1   v2\n\n" );
 1172|       |        /*                  xxxx xxxx/xxxx xxxx/xxxx xxxx xxxx    */
 1173|       |    }
 1174|       |#endif
 1175|       |    for (i = 0; i < pBNS->num_edges; i++)
 1176|       |    {
 1177|       |        pe = pBNS->edge + i;
 1178|       |        v1 = pe->neighbor1;
 1179|       |        v2 = v1 ^ pe->neighbor12;
 1180|       |        if (pe->cap < pe->flow || pe->flow < 0)
 1181|       |        {
 1182|       |            fprintf( stdout, "\n%sedge %d (%d-%d) has cap=%d flow=%d  ", s, i, v1, v2, pe->cap, pe->flow );
 1183|       |            nOutput++;
 1184|       |        }
 1185|       |#ifdef _DEBUG
 1186|       |        if (bDebugOutput && bNoRad)
 1187|       |        {
 1188|       |            /*                xxxx  xxxx/xxxx xxxx/xxxx xxxx xxxx    */
 1189|       |            fprintf( stderr, "%4d %4d/%-4d %4d/%-4d %4d %4d\n", i, pe->cap, pe->cap0, pe->flow, pe->flow0, v1, v2 );
 1190|       |        }
 1191|       |#endif
 1192|       |    }
 1193|       |
 1194|       |
 1195|       |    /* check vertices */
 1196|       |#ifdef _DEBUG
 1197|       |    if (bDebugOutput && bNoRad)
 1198|       |    {
 1199|       |        fprintf( stderr, "\n\fvert   st-cap   st-flow   type iedge : neigh\n\n" );
 1200|       |        /*                   xxxx xxxx/xxxx xxxx/xxxx 0xXXX xxxx : xxx    */
 1201|       |    }
 1202|       |#endif
 1203|       |    for (i = 0; i < pBNS->num_vertices; i++)
 1204|       |    {
 1205|       |        pv = pBNS->vert + i;
 1206|       |#ifdef _DEBUG
 1207|       |        if (bDebugOutput && bNoRad)
 1208|       |        {
 1209|       |            /*                   xxxx xxxx/xxxx xxxx/xxxx 0xXXX xxxx : xxx    */
 1210|       |            int j;
 1211|       |            const char *s;
 1212|       |            char sAtom[6];
 1213|       |            switch (pv->type)
 1214|       |            {
 1215|       |                case BNS_VERT_TYPE_ATOM:
 1216|       |                    sprintf( sAtom, "At %-2.2s", i < num_at ? at[i].elname : "??" );
 1217|       |                    s = sAtom;
 1218|       |                    break;
 1219|       |                case BNS_VERT_TYPE_ATOM | BNS_VERT_TYPE_ENDPOINT:
 1220|       |                    s = "Endpt";
 1221|       |                    break;
 1222|       |                case BNS_VT_C_POS:
 1223|       |                    s = "(+)  ";
 1224|       |                    break;
 1225|       |                case BNS_VT_C_NEG:
 1226|       |                    s = "(-)  ";
 1227|       |                    break;
 1228|       |                case BNS_VT_C_POS_C:
 1229|       |                    s = "(+C) ";
 1230|       |                    break;
 1231|       |                case BNS_VT_C_NEG_C:
 1232|       |                    s = "(-C) ";
 1233|       |                    break;
 1234|       |                case BNS_VT_C_POS_M:
 1235|       |                    s = "(+M) ";
 1236|       |                    break;
 1237|       |                case BNS_VT_C_NEG_M:
 1238|       |                    s = "(-M) ";
 1239|       |                    break;
 1240|       |                case BNS_VT_C_POS_ALL:
 1241|       |                    s = "(+)Sg";
 1242|       |                    break;
 1243|       |                case BNS_VT_C_NEG_ALL:
 1244|       |                    s = "(-)Sg";
 1245|       |                    break;
 1246|       |                case BNS_VT_M_GROUP:
 1247|       |                    s = "M-grp";
 1248|       |                    break;
 1249|       |                case BNS_VERT_TYPE__AUX | BNS_VERT_TYPE_TEMP:
 1250|       |                    s = "ChStr";
 1251|       |                    break;
 1252|       |                case BNS_VERT_TYPE__AUX:
 1253|       |                    s = "Yconn";
 1254|       |                    break;
 1255|       |                case BNS_VERT_TYPE_TGROUP:
 1256|       |                    s = "T-grp";
 1257|       |                    break;
 1258|       |                default:
 1259|       |                    s = "Unkn.";
 1260|       |                    break;
 1261|       |            }
 1262|       |            fprintf( stderr, "%4d %4d/%-4d %4d/%-4d 0x%03X %5s",
 1263|       |                                i, pv->st_edge.cap, pv->st_edge.cap0, pv->st_edge.flow, pv->st_edge.flow0,
 1264|       |                                pv->type, s );
 1265|       |            for (j = 0; j < pv->num_adj_edges; j++)
 1266|       |            {
 1267|       |                fprintf( stderr, " %2d", pv->iedge[j] );
 1268|       |            }
 1269|       |            fprintf( stderr, ":" );
 1270|       |            for (j = 0; j < pv->num_adj_edges; j++)
 1271|       |            {
 1272|       |                pe = pBNS->edge + pv->iedge[j];
 1273|       |                fprintf( stderr, " %2d", pe->neighbor12 ^ i );
 1274|       |            }
 1275|       |            fprintf( stderr, "\n" );
 1276|       |        }
 1277|       |#endif
 1278|       |        tot_st_flow += pv->st_edge.flow;
 1279|       |        tot_st_cap += pv->st_edge.cap;
 1280|       |        if (pv->num_adj_edges > pv->max_adj_edges)
 1281|       |        {
 1282|       |            fprintf( stdout, "\n%s%s %d type 0x%X \"%s\" num_edges=%d > max=%d  ", s,
 1283|       |                i < num_at ? "atom" : "vertex", i,
 1284|       |                pv->type, at[i].elname, pv->num_adj_edges, pv->max_adj_edges );
 1285|       |            nOutput++;
 1286|       |        }
 1287|       |        if (i < num_at)
 1288|       |        {
 1289|       |            /* charge on atoms */
 1290|       |            charge = pVA[i].cInitCharge;
 1291|       |            if (pVA[i].nCMinusGroupEdge)
 1292|       |            {
 1293|       |                pe = pBNS->edge + pVA[i].nCMinusGroupEdge - 1;
 1294|       |                if (pe->flow > 0)
 1295|       |                {
 1296|       |                    charge -= pe->flow;
 1297|       |                }
 1298|       |            }
 1299|       |            if (pVA[i].nCPlusGroupEdge)
 1300|       |            {
 1301|       |                pe = pBNS->edge + pVA[i].nCPlusGroupEdge - 1;
 1302|       |                if (pe->cap > pe->flow)
 1303|       |                {
 1304|       |                    charge += pe->cap - pe->flow;
 1305|       |                }
 1306|       |            }
 1307|       |            if (bNoRad && pv->st_edge.flow != pv->st_edge.cap)
 1308|       |            {
 1309|       |                fprintf( stdout, "\n%s%s %d: type 0x%X \"%s\" unexpected st_cap=%d st_flow=%d ", s,
 1310|       |                    i < num_at ? "atom" : "vertex", i,
 1311|       |                    pv->type, at[i].elname, pv->st_edge.cap, pv->st_edge.flow );
 1312|       |                nOutput++;
 1313|       |            }
 1314|       |            else
 1315|       |                if (bNoRad && charge && !strcmp( at[i].elname, "C" ))
 1316|       |                {
 1317|       |                    /* ignore carbonyls */
 1318|       |                    if (i == 0 && num_at == 2 && !strcmp( at[1].elname, "O" ) &&
 1319|       |                         !at[0].num_H && !at[1].num_H && !pTCGroups->total_charge)
 1320|       |                    {
 1321|       |                        ; /* C(-)#O(+) structure */
 1322|       |                    }
 1323|       |                    else
 1324|       |                    {
 1325|       |                        fprintf( stdout, "\n%s%s %d: type 0x%X \"%s\" charge=%d ", s,
 1326|       |                            i < num_at ? "atom" : "vertex", i,
 1327|       |                            pv->type, at[i].elname, charge );
 1328|       |                        nOutput++;
 1329|       |                    }
 1330|       |                }
 1331|       |            atom_charge += charge;
 1332|       |        }
 1333|       |        else
 1334|       |            if (( charge = pv->st_edge.cap - pv->st_edge.flow ) > 0)
 1335|       |            {
 1336|       |                /* excess charge */
 1337|       |                if (!bNoRad && IS_BNS_VT_C_OR_CSUPER_GR( pv->type ))
 1338|       |                {
 1339|       |                    left_charge -= charge;
 1340|       |                }
 1341|       |                else
 1342|       |                    if (!bNoRad && IS_BNS_VT_YVCONNECTOR( pv->type ))
 1343|       |                    {
 1344|       |                        left_charge += charge;
 1345|       |                    }
 1346|       |                    else
 1347|       |                        if (!bNoRad && IS_BNS_VT_M_GR( pv->type ) &&
 1348|       |                             0 <= ( j = pTCGroups->nGroup[TCG_MeFlower3] ) &&
 1349|       |                             i == pTCGroups->pTCG[j].nVertexNumber)
 1350|       |                        {
 1351|       |                            ; /* additional "radical" on metal flower */
 1352|       |                        }
 1353|       |                        else
 1354|       |                            if (!( pv->type & BNS_VERT_TYPE_TGROUP ) || bNoRad)
 1355|       |                            {
 1356|       |                                /* t-groups before running BFS should have st_cap > st_flow */
 1357|       |                                fprintf( stdout, "\n%s%s %d: type 0x%X unexpected st_cap=%d st_flow=%d ", s,
 1358|       |                                    i < num_at ? "atom" : "vertex", i,
 1359|       |                                    pv->type, pv->st_edge.cap, pv->st_edge.flow );
 1360|       |                                nOutput++;
 1361|       |                            }
 1362|       |            }
 1363|       |        if (pv->st_edge.cap < pv->st_edge.flow || pv->st_edge.flow < 0)
 1364|       |        {
 1365|       |            fprintf( stdout, "\n%s%s %d: type 0x%X \"%s\" st_cap=%d st_flow=%d  ", s,
 1366|       |                i < num_at ? "atom" : "vertex", i,
 1367|       |                pv->type, i < num_at ? at[i].elname : "", pv->st_edge.cap, pv->st_edge.flow );
 1368|       |            nOutput++;
 1369|       |        }
 1370|       |        /* check edge_flow vs. st_flow consistency */
 1371|       |        for (j = 0, flow = 0; j < pv->num_adj_edges; j++)
 1372|       |        {
 1373|       |            pe = pBNS->edge + pv->iedge[j];
 1374|       |            flow += pe->flow;
 1375|       |        }
 1376|       |        if (flow != pv->st_edge.flow)
 1377|       |        {
 1378|       |            fprintf( stdout, "\n%s%s %d: type 0x%X \"%s\" st_flow=%d edge_flow=%d  ", s,
 1379|       |                i < num_at ? "atom" : "vertex", i,
 1380|       |                pv->type, i < num_at ? at[i].elname : "", pv->st_edge.flow, flow );
 1381|       |            nOutput++;
 1382|       |        }
 1383|       |    }
 1384|       |#ifdef _DEBUG
 1385|       |    if (bDebugOutput && bNoRad)
 1386|       |    {
 1387|       |        fprintf( stderr, "\n------end--------------------------------------------------\n" );
 1388|       |    }
 1389|       |#endif
 1390|       |    /*
 1391|       |    if ( num_electrons %= 2 ) {
 1392|       |        fprintf( stdout, "\n%d*Odd number of electrons (%d atoms) ", bNoRad, num_at );
 1393|       |        nOutput ++;
 1394|       |    }
 1395|       |    */
 1396|       |    /* tautomeric groups charge */
 1397|       |    for (i = 0, charge = 0; i < pTCGroups->num_tgroups; i++)
 1398|       |    {
 1399|       |        charge -= pTCGroups->pTCG[i].tg_num_Minus;
 1400|       |    }
 1401|       |    /* compare */
 1402|       |    if (charge != pTCGroups->tgroup_charge)
 1403|       |    {
 1404|       |        fprintf( stdout, "\n%sCounted t-group charge=%d while %d was saved  ", s,
 1405|       |               charge, pTCGroups->tgroup_charge );
 1406|       |        nOutput++;
 1407|       |    }
 1408|       |    /* add other charges */
 1409|       |    charge += atom_charge + left_charge;
 1410|       |    excess_charge = pTCGroups->total_charge - pTCGroups->added_charge - pTCGroups->tgroup_charge;
 1411|       |    if (charge != pTCGroups->total_charge && excess_charge != pTCGroups->total_charge - charge)
 1412|       |    {
 1413|       |        fprintf( stdout, "\n%sCounted total charge=%d while %d was saved; excess charge=%d  ", s,
 1414|       |            charge, pTCGroups->total_charge, excess_charge );
 1415|       |        nOutput++;
 1416|       |    }
 1417|       |    if (tot_st_cap != pBNS->tot_st_cap || tot_st_flow != pBNS->tot_st_flow)
 1418|       |    {
 1419|       |        fprintf( stdout, "\n%sCounted/saved total st_flow=%d/%d st_cap=%d/%d  ", s,
 1420|       |            tot_st_flow, pBNS->tot_st_flow, tot_st_cap, pBNS->tot_st_cap );
 1421|       |        nOutput++;
 1422|       |    }
 1423|       |    if (nOutput)
 1424|       |    {
 1425|       |        fprintf( stdout, "\n" );
 1426|       |    }
 1427|       |#endif
 1428|       |#endif
 1429|       |
 1430|   101k|    return nOutput;
 1431|   101k|}
AddExplicitDeletedH:
 1442|    185|{
 1443|    185|    inp_ATOM  *cur_H, *cur_at = at + jv;
 1444|    185|    int        tot_num_iso_H = NUM_ISO_H( cur_at, 0 );
  ------------------
  |  |   55|    185|#define NUM_ISO_H(AT, N) (AT[N].num_iso_H[0] + AT[N].num_iso_H[1] + AT[N].num_iso_H[2])
  ------------------
 1445|    185|    int        num_H = cur_at->num_H;
 1446|    185|    int        iso_H = 0;
 1447|    185|    S_CHAR     num_iso_H[NUM_H_ISOTOPES];
 1448|    185|    int        i;
 1449|       |
 1450|    185|    if (!at[jv].at_type)
  ------------------
  |  Branch (1450:9): [True: 0, False: 185]
  ------------------
 1451|      0|    {
 1452|      0|        return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1453|      0|    }
 1454|       |
 1455|    185|    if (at[jv].at_type > 1)
  ------------------
  |  Branch (1455:9): [True: 92, False: 93]
  ------------------
 1456|     92|    {
 1457|       |        /* explicit hydrogens have already been added; find them */
 1458|     94|        for (i = 0; i < *iDeletedH; i++)
  ------------------
  |  Branch (1458:21): [True: 94, False: 0]
  ------------------
 1459|     94|        {
 1460|     94|            if (at[num_at + i].neighbor[0] == jv)
  ------------------
  |  Branch (1460:17): [True: 92, False: 2]
  ------------------
 1461|     92|            {
 1462|     92|                *iH = num_at + i; /* return the first found H, it has the smallest canonical pseudo rank */
 1463|     92|                return 0;
 1464|     92|            }
 1465|     94|        }
 1466|      0|        return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1467|     92|    }
 1468|       |    /* add all explicit H disconnected from at[jv] in order H, 1H, D, T */
 1469|     93|    *iH = *iDeletedH + num_at; /* num_H includes all H, both isotopic and normal */
 1470|    372|    for (i = 0; i < NUM_H_ISOTOPES; i++)
  ------------------
  |  |   25|    372|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (1470:17): [True: 279, False: 93]
  ------------------
 1471|    279|    {
 1472|    279|        num_iso_H[i] = at[jv].num_iso_H[i];
 1473|    279|    }
 1474|    200|    for (; num_H && ( *iDeletedH ) < nNumDeletedH; ( *iDeletedH )++)
  ------------------
  |  Branch (1474:12): [True: 114, False: 86]
  |  Branch (1474:21): [True: 111, False: 3]
  ------------------
 1475|    111|    {
 1476|    111|        cur_H = at + num_at + ( *iDeletedH ); /* first available empty atom will be this explicit H */
 1477|    111|        cur_H->neighbor[cur_H->valence] = jv; /* connect this new atom H to the real atom */
 1478|    111|        cur_H->bond_type[cur_H->valence] = BOND_TYPE_SINGLE;
  ------------------
  |  |   32|    111|#define BOND_TYPE_SINGLE    1
  ------------------
 1479|    111|        cur_H->valence++;
 1480|    111|        if (num_H > tot_num_iso_H)
  ------------------
  |  Branch (1480:13): [True: 97, False: 14]
  ------------------
 1481|     97|        {
 1482|     97|            num_H--;
 1483|     97|            if (num_H != tot_num_iso_H)
  ------------------
  |  Branch (1483:17): [True: 15, False: 82]
  ------------------
 1484|     15|            {
 1485|       |                /* may happen when Mobile-H stereo included in Fixed-H processing */
 1486|     15|                if (bTwoStereo)
  ------------------
  |  Branch (1486:21): [True: 13, False: 2]
  ------------------
 1487|     13|                {
 1488|     13|                    continue;
 1489|     13|                }
 1490|      2|                else
 1491|      2|                {
 1492|      2|                    return RI_ERR_SYNTAX; /* two identical H neighbors of a stereo atom/bond */
  ------------------
  |  |   16|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 1493|      2|                }
 1494|     15|            }
 1495|     97|        }
 1496|     14|        else
 1497|     14|        {
 1498|     26|            while (iso_H < NUM_H_ISOTOPES && !num_iso_H[iso_H])
  ------------------
  |  |   25|     52|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (1498:20): [True: 25, False: 1]
  |  Branch (1498:46): [True: 12, False: 13]
  ------------------
 1499|     12|            {
 1500|     12|                iso_H++;
 1501|     12|            }
 1502|     14|            if (iso_H < NUM_H_ISOTOPES)
  ------------------
  |  |   25|     14|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (1502:17): [True: 13, False: 1]
  ------------------
 1503|     13|            {
 1504|     13|                cur_H->iso_atw_diff = iso_H + 1; /* isotopic shift + 1 */
 1505|     13|                num_H--;
 1506|     13|                tot_num_iso_H--;
 1507|     13|                num_iso_H[iso_H] --;
 1508|     13|                if (num_iso_H[iso_H])
  ------------------
  |  Branch (1508:21): [True: 1, False: 12]
  ------------------
 1509|      1|                {
 1510|      1|                    return RI_ERR_SYNTAX; /* two identical isotopic H neighbors of a stereo atom/bond */
  ------------------
  |  |   16|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 1511|      1|                }
 1512|     13|            }
 1513|      1|            else
 1514|      1|            {
 1515|      1|                return RI_ERR_SYNTAX; /* not enough isotopic H */
  ------------------
  |  |   16|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 1516|      1|            }
 1517|     14|        }
 1518|    111|    }
 1519|     89|    if (num_H)
  ------------------
  |  Branch (1519:9): [True: 3, False: 86]
  ------------------
 1520|      3|    {
 1521|      3|        return RI_ERR_SYNTAX;
  ------------------
  |  |   16|      3|#define RI_ERR_SYNTAX  (-2)
  ------------------
 1522|      3|    }
 1523|     86|    at[jv].at_type++; /* at[jv].at_type==2 => explicit hydrogens have already been added */
 1524|       |
 1525|     86|    return 0; /* success */
 1526|     89|}
bFindCumuleneChain:
 1538|    853|{
 1539|    853|    int i, len, iat, nat;
 1540|    853|    nCumulene[0] = i1;
 1541|  1.16k|    for (i = 0; i < at[i1].valence; i++)
  ------------------
  |  Branch (1541:17): [True: 1.13k, False: 30]
  ------------------
 1542|  1.13k|    {
 1543|  1.13k|        len = 0;
 1544|  1.13k|        iat = i1; /* current */
 1545|  1.13k|        nat = at[i1].neighbor[i]; /* next */
 1546|  1.13k|        if (len + 1 == nMaxLen)
  ------------------
  |  Branch (1546:13): [True: 837, False: 300]
  ------------------
 1547|    837|        {
 1548|    837|            if (nat == i2)
  ------------------
  |  Branch (1548:17): [True: 668, False: 169]
  ------------------
 1549|    668|            {
 1550|    668|                nCumulene[++len] = nat;
 1551|    668|                return 1; /* success */
 1552|    668|            }
 1553|    169|            continue; /* check next at[i1] neighbor */
 1554|    837|        }
 1555|    483|        while (at[nat].valence == 2 &&
  ------------------
  |  Branch (1555:16): [True: 435, False: 48]
  ------------------
 1556|    435|                at[nat].num_H == 0 &&
  ------------------
  |  Branch (1556:17): [True: 434, False: 1]
  ------------------
 1557|    434|                bCanAtomBeMiddleAllene( at[nat].elname, 0, 0 ))
  ------------------
  |  Branch (1557:17): [True: 361, False: 73]
  ------------------
 1558|    361|        {
 1559|    361|            nCumulene[++len] = nat;
 1560|    361|            nat = at[nat].neighbor[at[nat].neighbor[0] == iat]; /* new next */
 1561|    361|            if (len + 1 == nMaxLen)
  ------------------
  |  Branch (1561:17): [True: 178, False: 183]
  ------------------
 1562|    178|            {
 1563|    178|                if (nat == i2)
  ------------------
  |  Branch (1563:21): [True: 155, False: 23]
  ------------------
 1564|    155|                {
 1565|    155|                    nCumulene[++len] = nat;
 1566|    155|                    return 1; /* success */
 1567|    155|                }
 1568|     23|                break; /* check next at[i1] neighbor */
 1569|    178|            }
 1570|    183|            iat = nCumulene[len]; /* new current */
 1571|    183|        }
 1572|    300|    }
 1573|       |
 1574|     30|    return 0; /* failed */
 1575|    853|}
set_bond_type:
 1580|  1.99k|{
 1581|  1.99k|    AT_NUMB *p1 = is_in_the_list( at[i1].neighbor, i2, at[i1].valence );
 1582|  1.99k|    AT_NUMB *p2 = is_in_the_list( at[i2].neighbor, i1, at[i2].valence );
 1583|  1.99k|    if (p1 && p2)
  ------------------
  |  Branch (1583:9): [True: 1.99k, False: 0]
  |  Branch (1583:15): [True: 1.99k, False: 0]
  ------------------
 1584|  1.99k|    {
 1585|  1.99k|        int j1 = (int) ( p1 - at[i1].neighbor );
 1586|  1.99k|        int j2 = (int) ( p2 - at[i2].neighbor );
 1587|  1.99k|        int bTypePrev = at[i1].bond_type[j1];
 1588|  1.99k|        at[i1].bond_type[j1] = bType;
 1589|  1.99k|        at[i2].bond_type[j2] = bType;
 1590|  1.99k|        if (bTypePrev && bTypePrev <= BOND_TYPE_TRIPLE &&
  ------------------
  |  |   34|  3.99k|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1590:13): [True: 1.99k, False: 0]
  |  Branch (1590:26): [True: 808, False: 1.18k]
  ------------------
 1591|    808|             bType     && bType <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   34|    808|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1591:14): [True: 808, False: 0]
  |  Branch (1591:27): [True: 212, False: 596]
  ------------------
 1592|    212|        {
 1593|    212|            at[i1].chem_bonds_valence += bType - bTypePrev;
 1594|    212|            at[i2].chem_bonds_valence += bType - bTypePrev;
 1595|    212|        }
 1596|  1.99k|        return 0;
 1597|  1.99k|    }
 1598|       |
 1599|      0|    return RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 1600|  1.99k|}
set_cumulene_0D_parity:
 1613|    737|{
 1614|    737|    AT_NUMB nCumulene[MAX_CUMULENE_LEN + 2];
 1615|    737|    AT_NUMB *p1, *p2;
 1616|    737|    int     m1, m2, parity1, parity2, sb_ord_m1, sb_ord_m2, k1, k2, num_neigh1, num_neigh2;
 1617|       |    /* the following types must exactly match types in inp_ATOM and inp_ATOM_STEREO */
 1618|    737|    S_CHAR  *sb_ord1, *sn_ord1, *sb_parity1;
 1619|    737|    S_CHAR  *sb_ord2, *sn_ord2, *sb_parity2;
 1620|    737|    AT_NUMB *sn_orig_at_num1;
 1621|    737|    AT_NUMB *sn_orig_at_num2;
 1622|       |
 1623|       |
 1624|    737|    if (!bFindCumuleneChain( at, (AT_NUMB) i1, (AT_NUMB) i2, nCumulene, len ))
  ------------------
  |  Branch (1624:9): [True: 0, False: 737]
  ------------------
 1625|      0|    {
 1626|      0|        return RI_ERR_SYNTAX; /* not an allene */
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 1627|      0|    }
 1628|       |    /* stereo bond neighbors: index of a stereo bond in its end-atom adjacency lists */
 1629|    737|    if (( p1 = is_in_the_list( at[i1].neighbor, nCumulene[1], at[i1].valence ) ) &&
  ------------------
  |  Branch (1629:9): [True: 737, False: 0]
  ------------------
 1630|    737|        ( p2 = is_in_the_list( at[i2].neighbor, nCumulene[len - 1], at[i2].valence ) ))
  ------------------
  |  Branch (1630:9): [True: 737, False: 0]
  ------------------
 1631|    737|    {
 1632|    737|        sb_ord_m1 = (int) ( p1 - at[i1].neighbor ); /* indes of stereobond in the atom's adjacency list */
 1633|    737|        sb_ord_m2 = (int) ( p2 - at[i2].neighbor );
 1634|    737|    }
 1635|      0|    else
 1636|      0|    {
 1637|      0|        return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1638|      0|    }
 1639|    737|    num_neigh1 = at[i1].valence + at[i1].num_H;
 1640|    737|    num_neigh2 = at[i2].valence + at[i2].num_H;
 1641|       |
 1642|    737|    if (num_neigh1 < MIN_NUM_STEREO_BOND_NEIGH || num_neigh1 > MAX_NUM_STEREO_BOND_NEIGH ||
  ------------------
  |  |  875|  1.47k|#define MIN_NUM_STEREO_BOND_NEIGH 2
  ------------------
                  if (num_neigh1 < MIN_NUM_STEREO_BOND_NEIGH || num_neigh1 > MAX_NUM_STEREO_BOND_NEIGH ||
  ------------------
  |  |  874|  1.47k|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (1642:9): [True: 3, False: 734]
  |  Branch (1642:51): [True: 1, False: 733]
  ------------------
 1643|    733|         num_neigh2 < MIN_NUM_STEREO_BOND_NEIGH || num_neigh2 > MAX_NUM_STEREO_BOND_NEIGH)
  ------------------
  |  |  875|  1.47k|#define MIN_NUM_STEREO_BOND_NEIGH 2
  ------------------
                       num_neigh2 < MIN_NUM_STEREO_BOND_NEIGH || num_neigh2 > MAX_NUM_STEREO_BOND_NEIGH)
  ------------------
  |  |  874|    730|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (1643:10): [True: 3, False: 730]
  |  Branch (1643:52): [True: 1, False: 729]
  ------------------
 1644|      8|    {
 1645|      8|        return RI_ERR_SYNTAX;
  ------------------
  |  |   16|      8|#define RI_ERR_SYNTAX  (-2)
  ------------------
 1646|      8|    }
 1647|       |
 1648|       |
 1649|    729|    sb_ord1 = st ? st[i1].sb_ord : at[i1].sb_ord;
  ------------------
  |  Branch (1649:15): [True: 77, False: 652]
  ------------------
 1650|    729|    sb_ord2 = st ? st[i2].sb_ord : at[i2].sb_ord;
  ------------------
  |  Branch (1650:15): [True: 77, False: 652]
  ------------------
 1651|    729|    sb_parity1 = st ? st[i1].sb_parity : at[i1].sb_parity;
  ------------------
  |  Branch (1651:18): [True: 77, False: 652]
  ------------------
 1652|    729|    sb_parity2 = st ? st[i2].sb_parity : at[i2].sb_parity;
  ------------------
  |  Branch (1652:18): [True: 77, False: 652]
  ------------------
 1653|       |
 1654|       |    /* find the first unoccupied locations in the stereobond 0D descriptor lists; check whether the stereo has already been set */
 1655|    802|    for (m1 = k1 = 0; m1 < MAX_NUM_STEREO_BONDS && sb_parity1[m1] && !( k1 = sb_ord1[m1] == sb_ord_m1 ); m1++)
  ------------------
  |  |  873|  1.60k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1655:23): [True: 802, False: 0]
  |  Branch (1655:52): [True: 84, False: 718]
  |  Branch (1655:70): [True: 73, False: 11]
  ------------------
 1656|     73|        ;
 1657|    873|    for (m2 = k2 = 0; m2 < MAX_NUM_STEREO_BONDS && sb_parity2[m2] && !( k2 = sb_ord2[m2] == sb_ord_m2 ); m2++)
  ------------------
  |  |  873|  1.74k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1657:23): [True: 873, False: 0]
  |  Branch (1657:52): [True: 156, False: 717]
  |  Branch (1657:70): [True: 144, False: 12]
  ------------------
 1658|    144|        ;
 1659|    729|    if (m1 == MAX_NUM_STEREO_BONDS || m2 == MAX_NUM_STEREO_BONDS)
  ------------------
  |  |  873|  1.45k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
                  if (m1 == MAX_NUM_STEREO_BONDS || m2 == MAX_NUM_STEREO_BONDS)
  ------------------
  |  |  873|    729|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1659:9): [True: 0, False: 729]
  |  Branch (1659:39): [True: 0, False: 729]
  ------------------
 1660|      0|    {
 1661|      0|        return RI_ERR_SYNTAX;
  ------------------
  |  |   16|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 1662|      0|    }
 1663|    729|    if (k1 && k2)
  ------------------
  |  Branch (1663:9): [True: 11, False: 718]
  |  Branch (1663:15): [True: 10, False: 1]
  ------------------
 1664|     10|    {
 1665|     10|        return 0; /* the stereo descriptor of this bond/allene/cumulene has already been set */
 1666|     10|    }
 1667|    719|    if (k1 || k2)
  ------------------
  |  Branch (1667:9): [True: 1, False: 718]
  |  Branch (1667:15): [True: 2, False: 716]
  ------------------
 1668|      3|    {
 1669|      3|        return RI_ERR_SYNTAX; /* only half of a bond was set */
  ------------------
  |  |   16|      3|#define RI_ERR_SYNTAX  (-2)
  ------------------
 1670|      3|    }
 1671|       |
 1672|    716|    sn_ord1 = st ? st[i1].sn_ord : at[i1].sn_ord;
  ------------------
  |  Branch (1672:15): [True: 67, False: 649]
  ------------------
 1673|    716|    sn_ord2 = st ? st[i2].sn_ord : at[i2].sn_ord;
  ------------------
  |  Branch (1673:15): [True: 67, False: 649]
  ------------------
 1674|    716|    sn_orig_at_num1 = st ? st[i1].sn_orig_at_num : at[i1].sn_orig_at_num;
  ------------------
  |  Branch (1674:23): [True: 67, False: 649]
  ------------------
 1675|    716|    sn_orig_at_num2 = st ? st[i2].sn_orig_at_num : at[i2].sn_orig_at_num;
  ------------------
  |  Branch (1675:23): [True: 67, False: 649]
  ------------------
 1676|       |
 1677|       |    /* stereo bond neighbors connection index */
 1678|    716|    sb_ord1[m1] = sb_ord_m1;
 1679|    716|    sb_ord2[m2] = sb_ord_m2;
 1680|       |    /* stereo bond end atom neighbors */
 1681|    716|    sn_orig_at_num1[m1] = at[idelH1].orig_at_number;
 1682|    716|    if (idelH1 < num_at)
  ------------------
  |  Branch (1682:9): [True: 673, False: 43]
  ------------------
 1683|    673|    {
 1684|    673|        if ((p1 = is_in_the_list( at[i1].neighbor, (AT_NUMB) idelH1, at[i1].valence ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1684:13): [True: 673, False: 0]
  ------------------
 1685|    673|        {
 1686|    673|            sn_ord1[m1] = (int) ( p1 - at[i1].neighbor );
 1687|    673|        }
 1688|      0|        else
 1689|      0|        {
 1690|      0|            return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1691|      0|        }
 1692|    673|    }
 1693|     43|    else
 1694|     43|    {
 1695|     43|        sn_ord1[m1] = -1;
 1696|     43|    }
 1697|       |
 1698|    716|    sn_orig_at_num2[m2] = at[idelH2].orig_at_number;
 1699|    716|    if (idelH2 < num_at)
  ------------------
  |  Branch (1699:9): [True: 688, False: 28]
  ------------------
 1700|    688|    {
 1701|    688|        if ((p2 = is_in_the_list( at[i2].neighbor, (AT_NUMB) idelH2, at[i2].valence ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1701:13): [True: 688, False: 0]
  ------------------
 1702|    688|        {
 1703|    688|            sn_ord2[m2] = (int) ( p2 - at[i2].neighbor );
 1704|    688|        }
 1705|      0|        else
 1706|      0|        {
 1707|      0|            return RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1708|      0|        }
 1709|    688|    }
 1710|     28|    else
 1711|     28|    {
 1712|     28|        sn_ord2[m2] = -1;
 1713|     28|    }
 1714|    716|    if (ATOM_PARITY_WELL_DEF( parity ))
  ------------------
  |  |  259|    716|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    716|#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)
  |  |  ------------------
  |  |  |  |  236|    716|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 716, False: 0]
  |  |  |  Branch (259:75): [True: 481, False: 235]
  |  |  ------------------
  ------------------
 1715|    481|    {
 1716|       |        /* special case: 2 bonds to sb atom => inverse parity because */
 1717|       |        /* InChI parity refers to the lone pair as a neighbor */
 1718|    481|        int num_inv = ( num_neigh1 == MIN_NUM_STEREO_BOND_NEIGH ) + ( num_neigh2 == MIN_NUM_STEREO_BOND_NEIGH );
  ------------------
  |  |  875|    481|#define MIN_NUM_STEREO_BOND_NEIGH 2
  ------------------
                      int num_inv = ( num_neigh1 == MIN_NUM_STEREO_BOND_NEIGH ) + ( num_neigh2 == MIN_NUM_STEREO_BOND_NEIGH );
  ------------------
  |  |  875|    481|#define MIN_NUM_STEREO_BOND_NEIGH 2
  ------------------
 1719|    481|        if (num_inv % 2)
  ------------------
  |  Branch (1719:13): [True: 148, False: 333]
  ------------------
 1720|    148|        {
 1721|    148|            parity = ( parity == AB_PARITY_EVEN ) ? AB_PARITY_ODD : AB_PARITY_EVEN;
  ------------------
  |  |  220|    148|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
                          parity = ( parity == AB_PARITY_EVEN ) ? AB_PARITY_ODD : AB_PARITY_EVEN;
  ------------------
  |  |  219|     37|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
                          parity = ( parity == AB_PARITY_EVEN ) ? AB_PARITY_ODD : AB_PARITY_EVEN;
  ------------------
  |  |  220|    259|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
  |  Branch (1721:22): [True: 37, False: 111]
  ------------------
 1722|    148|        }
 1723|    481|        parity1 = AB_PARITY_EVEN;
  ------------------
  |  |  220|    481|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
 1724|    481|        parity2 = ( parity == AB_PARITY_EVEN ) ? AB_PARITY_EVEN : AB_PARITY_ODD;
  ------------------
  |  |  220|    481|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
                      parity2 = ( parity == AB_PARITY_EVEN ) ? AB_PARITY_EVEN : AB_PARITY_ODD;
  ------------------
  |  |  220|    227|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
                      parity2 = ( parity == AB_PARITY_EVEN ) ? AB_PARITY_EVEN : AB_PARITY_ODD;
  ------------------
  |  |  219|    735|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
  |  Branch (1724:19): [True: 227, False: 254]
  ------------------
 1725|    481|    }
 1726|    235|    else
 1727|    235|    {
 1728|    235|        parity1 = parity2 = parity;
 1729|    235|    }
 1730|    716|    sb_parity1[m1] = parity1;
 1731|    716|    sb_parity2[m2] = parity2;
 1732|       |
 1733|    716|    return 0;
 1734|    716|}
set_atom_0D_parity:
 1744|    712|{
 1745|    712|    int     m1 = 0, m2, i, j, tot_num_neigh;
 1746|       |    /* the following types must exactly match types in inp_ATOM and inp_ATOM_STEREO */
 1747|       |    /* Given parity from InChI, the order of stereo center neighbors is: */
 1748|       |    /* 1. The stereocenter itself if the total number of neighbors is 3 (not 4) */
 1749|       |    /* 2. Explicit H: non-isotopic, isotopic in order ofascending  atomic mass */
 1750|       |    /*         Explicit H have already been sorted in this order */
 1751|       |    /* 3. Normal neighboring atoms, atom numbers (=canonical numbers from InChI - 1) in ascending order */
 1752|       |    /*         Normal neighboring atoms have already been sorted in this order */
 1753|    712|    S_CHAR  *p_parity;
 1754|    712|    AT_NUMB *p_orig_at_num;
 1755|       |
 1756|    712|    if (!st || !at[i1].p_parity)
  ------------------
  |  Branch (1756:9): [True: 658, False: 54]
  |  Branch (1756:16): [True: 54, False: 0]
  ------------------
 1757|    712|    {
 1758|    712|        m1 = 0;
 1759|    712|        p_parity = st ? &st[i1].p_parity : &at[i1].p_parity;
  ------------------
  |  Branch (1759:20): [True: 54, False: 658]
  ------------------
 1760|    712|        p_orig_at_num = st ? st[i1].p_orig_at_num : at[i1].p_orig_at_num;
  ------------------
  |  Branch (1760:25): [True: 54, False: 658]
  ------------------
 1761|       |
 1762|    712|        tot_num_neigh = at[i1].valence + at[i1].num_H;
 1763|    712|        if (tot_num_neigh == MAX_NUM_STEREO_ATOM_NEIGH - 1)
  ------------------
  |  |  877|    712|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (1763:13): [True: 210, False: 502]
  ------------------
 1764|    210|        {
 1765|       |            /* only 3 neighbors: the atom itself is the first neighbor */
 1766|    210|            p_orig_at_num[m1++] = at[i1].orig_at_number;
 1767|    210|        }
 1768|    502|        else
 1769|    502|            if (tot_num_neigh != MAX_NUM_STEREO_ATOM_NEIGH)
  ------------------
  |  |  877|    502|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (1769:17): [True: 187, False: 315]
  ------------------
 1770|    187|            {
 1771|    187|                return RI_ERR_PROGR; /* wrong number of members */
  ------------------
  |  |   17|    187|#define RI_ERR_PROGR   (-3)
  ------------------
 1772|    187|            }
 1773|    525|        m2 = m1 + ( MAX_NUM_STEREO_ATOM_NEIGH - at[i1].valence );
  ------------------
  |  |  877|    525|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
 1774|       |        /* stereoneighbors: deleted explicit atoms H first, in order of increasing isotopic mass */
 1775|    525|        if (at[i1].num_H)
  ------------------
  |  Branch (1775:13): [True: 15, False: 510]
  ------------------
 1776|     15|        {
 1777|     38|            for (j = 0; m1 < m2 && j < num_deleted_H; j++)
  ------------------
  |  Branch (1777:25): [True: 37, False: 1]
  |  Branch (1777:36): [True: 23, False: 14]
  ------------------
 1778|     23|            {
 1779|     23|                if (at[j + num_at].neighbor[0] == i1)
  ------------------
  |  Branch (1779:21): [True: 23, False: 0]
  ------------------
 1780|     23|                {
 1781|     23|                    p_orig_at_num[m1++] = at[j + num_at].orig_at_number;
 1782|     23|                }
 1783|     23|            }
 1784|     15|        }
 1785|    525|        if (m1 + at[i1].valence != MAX_NUM_STEREO_ATOM_NEIGH)
  ------------------
  |  |  877|    525|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (1785:13): [True: 0, False: 525]
  ------------------
 1786|      0|        {
 1787|      0|            return RI_ERR_PROGR; /* wrong number of members */
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1788|      0|        }
 1789|       |        /* stereoneighbors: other than explicit H atoms */
 1790|  2.39k|        for (i = 0; i < at[i1].valence; i++)
  ------------------
  |  Branch (1790:21): [True: 1.86k, False: 525]
  ------------------
 1791|  1.86k|        {
 1792|  1.86k|            m2 = at[i1].neighbor[i];
 1793|  1.86k|            p_orig_at_num[m1++] = at[m2].orig_at_number;
 1794|  1.86k|        }
 1795|    525|        *p_parity = parity;
 1796|    525|    }
 1797|       |
 1798|    525|    return 0;
 1799|    712|}
MoveRadToAtomsAddCharges:
 1814|  87.8k|{
 1815|  87.8k|    int nNumRad, ret = 0, ret2;
 1816|  87.8k|    int i, j, k, num_rad_not_atom, num_moved = 0, num_candidates = 0, extra_charge = 0, added_charge, delta;
 1817|  87.8k|    BNS_EDGE   *pEdge;
 1818|  87.8k|    BNS_VERTEX *pv;
 1819|  87.8k|    Vertex      v1, v2;
 1820|  87.8k|    S_SHORT    *pnRad = NULL, *pnDelta = NULL;
 1821|  87.8k|    CC_CAND    *pCand = NULL;
 1822|  87.8k|    int         cnBits, bAtomRadRemoved = 0;
 1823|       |
 1824|  87.8k|    int num_at = pStruct->num_atoms;
 1825|  87.8k|    int num_deleted_H = pStruct->num_deleted_H;
 1826|  87.8k|    int len_at = num_at + num_deleted_H;
 1827|  87.8k|    int local_num_vertices = pBNS->num_vertices; /* djb-rwth: addressing LLVM warning */
 1828|       |
 1829|   632k|    for (i = pBNS->num_atoms, num_rad_not_atom = 0; i < local_num_vertices; i++)
  ------------------
  |  Branch (1829:53): [True: 544k, False: 87.8k]
  ------------------
 1830|   544k|    {
 1831|   544k|        num_rad_not_atom += pBNS->vert[i].st_edge.cap - pBNS->vert[i].st_edge.flow;
 1832|   544k|    }
 1833|  87.8k|    if (!num_rad_not_atom)
  ------------------
  |  Branch (1833:9): [True: 86.1k, False: 1.65k]
  ------------------
 1834|  86.1k|    {
 1835|  86.1k|        goto exit_function;
 1836|  86.1k|    }
 1837|       |    /****************************************************/
 1838|       |    /*                                                  */
 1839|       |    /*    Move radicals from ChargeStruct to atoms      */
 1840|       |    /*                                                  */
 1841|       |    /****************************************************/
 1842|       |
 1843|       |    /* allocate memory to keep track of moved radicals */
 1844|  1.65k|    pnRad = (S_SHORT *) inchi_malloc(local_num_vertices * sizeof( pnRad[0] ) );
  ------------------
  |  | 1143|  1.65k|#define inchi_malloc   malloc
  ------------------
 1845|  1.65k|    pnDelta = (S_SHORT *) inchi_calloc( pBNS->num_atoms, sizeof( pnDelta[0] ) );
  ------------------
  |  | 1146|  1.65k|#define inchi_calloc   calloc
  ------------------
 1846|  1.65k|    if (!pnRad || !pnDelta)
  ------------------
  |  Branch (1846:9): [True: 0, False: 1.65k]
  |  Branch (1846:19): [True: 0, False: 1.65k]
  ------------------
 1847|      0|    {
 1848|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1849|      0|        goto exit_function;
 1850|      0|    }
 1851|  35.2k|    for (i = 0; i < local_num_vertices; i++)
  ------------------
  |  Branch (1851:17): [True: 33.5k, False: 1.65k]
  ------------------
 1852|  33.5k|    {
 1853|  33.5k|        pnRad[i] = pBNS->vert[i].st_edge.cap - pBNS->vert[i].st_edge.flow;
 1854|  33.5k|    }
 1855|  3.08k|    while (1)
  ------------------
  |  Branch (1855:12): [True: 3.08k, Folded]
  ------------------
 1856|  3.08k|    {
 1857|       |        /* remove radicals from atoms */
 1858|  31.5k|        for (i = 0; i < pBNS->num_atoms; i++)
  ------------------
  |  Branch (1858:21): [True: 28.5k, False: 3.08k]
  ------------------
 1859|  28.5k|        {
 1860|  28.5k|            pnDelta[i] = pBNS->vert[i].st_edge.cap - pBNS->vert[i].st_edge.flow;
 1861|  28.5k|            pBNS->vert[i].st_edge.cap -= pnDelta[i];
 1862|  28.5k|            bAtomRadRemoved += ( 0 != pnDelta[i] );
 1863|  28.5k|        }
 1864|  3.08k|        ret = SetRadEndpoints( pBNS, pBD, RAD_SRCH_FROM_FICT );
 1865|  3.08k|        if (!ret)
  ------------------
  |  Branch (1865:13): [True: 1.65k, False: 1.43k]
  ------------------
 1866|  1.65k|        {
 1867|  1.65k|            break;
 1868|  1.65k|        }
 1869|  1.43k|        if (ret < 0)
  ------------------
  |  Branch (1869:13): [True: 0, False: 1.43k]
  ------------------
 1870|      0|        {
 1871|      0|            goto exit_function;
 1872|      0|        }
 1873|  1.43k|        nNumRad = ret;
 1874|  2.89k|        for (i = 0; i < nNumRad; i++)
  ------------------
  |  Branch (1874:21): [True: 1.45k, False: 1.43k]
  ------------------
 1875|  1.45k|        {
 1876|  1.45k|            pEdge = pBNS->edge + pBD->RadEdges[i];
 1877|  1.45k|            v1 = pEdge->neighbor1;
 1878|  1.45k|            v2 = pEdge->neighbor12 ^ v1;
 1879|  1.45k|            pBNS->vert[v1].st_edge.flow -= pEdge->flow;
 1880|  1.45k|            pBNS->vert[v2].st_edge.flow -= pEdge->flow;
 1881|  1.45k|            pBNS->tot_st_flow -= 2 * pEdge->flow;
 1882|  1.45k|            pEdge->flow = 0;
 1883|  1.45k|            pEdge->forbidden |= forbidden_mask;
 1884|  1.45k|            pBNS->edge_forbidden_mask |= forbidden_mask;
 1885|  1.45k|        }
 1886|  1.43k|        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 1887|  1.43k|        if (ret < 0)
  ------------------
  |  Branch (1887:13): [True: 0, False: 1.43k]
  ------------------
 1888|      0|        {
 1889|      0|            goto exit_function;
 1890|      0|        }
 1891|  1.43k|        else
 1892|  1.43k|        {
 1893|  1.43k|            num_moved += ret;
 1894|  1.43k|        }
 1895|  1.43k|        RemoveRadEndpoints( pBNS, pBD, NULL );
 1896|  1.43k|        if (ret == 0)
  ------------------
  |  Branch (1896:13): [True: 0, False: 1.43k]
  ------------------
 1897|      0|        {
 1898|      0|            break;  /* could not move more radicals */
 1899|      0|        }
 1900|  1.43k|        if (bAtomRadRemoved)
  ------------------
  |  Branch (1900:13): [True: 407, False: 1.03k]
  ------------------
 1901|    407|        {
 1902|       |            /* restore radicals to atoms */
 1903|  5.58k|            for (i = 0; i < pBNS->num_atoms; i++)
  ------------------
  |  Branch (1903:25): [True: 5.17k, False: 407]
  ------------------
 1904|  5.17k|            {
 1905|  5.17k|                pBNS->vert[i].st_edge.cap += pnDelta[i];
 1906|  5.17k|            }
 1907|    407|            bAtomRadRemoved = 0;
 1908|    407|        }
 1909|  1.43k|    }
 1910|  1.65k|    if (bAtomRadRemoved)
  ------------------
  |  Branch (1910:9): [True: 1.32k, False: 329]
  ------------------
 1911|  1.32k|    {
 1912|       |        /* restore radicals to atoms */
 1913|  13.2k|        for (i = 0; i < pBNS->num_atoms; i++)
  ------------------
  |  Branch (1913:21): [True: 11.9k, False: 1.32k]
  ------------------
 1914|  11.9k|        {
 1915|  11.9k|            pBNS->vert[i].st_edge.cap += pnDelta[i];
 1916|  11.9k|        }
 1917|       |        /* djb-rwth: removing redundant code */
 1918|  1.32k|    }
 1919|  1.65k|    pBNS->edge_forbidden_mask &= ~forbidden_mask;
 1920|       |
 1921|       |
 1922|       |    /****************************************************/
 1923|       |    /*                                                  */
 1924|       |    /*    Fix the charges                               */
 1925|       |    /*                                                  */
 1926|       |    /****************************************************/
 1927|  1.65k|    if (num_moved)
  ------------------
  |  Branch (1927:9): [True: 1.24k, False: 407]
  ------------------
 1928|  1.24k|    {
 1929|       |        /* find reqired charge */
 1930|  1.24k|        extra_charge = 0;
 1931|  14.6k|        for (i = pBNS->num_atoms, pv = pBNS->vert + i; i < local_num_vertices; i++, pv++)
  ------------------
  |  Branch (1931:56): [True: 13.4k, False: 1.22k]
  ------------------
 1932|  13.4k|        {
 1933|  13.4k|            if ((delta = pv->st_edge.cap - pv->st_edge.flow)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1933:17): [True: 377, False: 13.0k]
  ------------------
 1934|    377|            {
 1935|    377|                if (IS_BNS_VT_C_OR_CSUPER_GR( pv->type ))
  ------------------
  |  |   77|    377|#define IS_BNS_VT_C_OR_CSUPER_GR(X) ((X) & BNS_VT_C_POS)
  |  |  ------------------
  |  |  |  |   63|    377|#define BNS_VT_C_POS     BNS_VERT_TYPE_C_GROUP                               /* positive charge group, heteroat */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|    377|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (77:37): [True: 289, False: 88]
  |  |  ------------------
  ------------------
 1936|    289|                {
 1937|    289|                    extra_charge -= delta;
 1938|    289|                }
 1939|     88|                else
 1940|     88|                    if (BNS_VERT_TYPE__AUX == pv->type)
  ------------------
  |  |   53|     88|#define BNS_VERT_TYPE__AUX          0x0080  /* vertex added to build charge substructures */
  ------------------
  |  Branch (1940:25): [True: 72, False: 16]
  ------------------
 1941|     72|                    {
 1942|     72|                        extra_charge += delta;
 1943|     72|                    }
 1944|     16|                    else
 1945|     16|                    {
 1946|     16|                        ret = RI_ERR_PROGR;
  ------------------
  |  |   17|     16|#define RI_ERR_PROGR   (-3)
  ------------------
 1947|     16|                        goto exit_function;
 1948|     16|                    }
 1949|    377|            }
 1950|  13.4k|        }
 1951|  1.22k|        if (!extra_charge)
  ------------------
  |  Branch (1951:13): [True: 871, False: 357]
  ------------------
 1952|    871|        {
 1953|    871|            goto exit_function;
 1954|    871|        }
 1955|       |        /* find differences */
 1956|    357|        num_candidates = 0;
 1957|  7.71k|        for (i = 0; i < local_num_vertices; i++)
  ------------------
  |  Branch (1957:21): [True: 7.36k, False: 357]
  ------------------
 1958|  7.36k|        {
 1959|  7.36k|            pnRad[i] = ( pBNS->vert[i].st_edge.cap - pBNS->vert[i].st_edge.flow ); /* djb-rwth: garbage values on the right side of - -- discussion required; pnRad[i] = ( pBNS->vert[i].st_edge.cap - pBNS->vert[i].st_edge.flow ) - pnRad[i]; */
 1960|  7.36k|            if (pnRad[i] > 0 && i < pBNS->num_atoms && !pVA[i].nTautGroupEdge)
  ------------------
  |  Branch (1960:17): [True: 1.32k, False: 6.04k]
  |  Branch (1960:33): [True: 962, False: 358]
  |  Branch (1960:56): [True: 926, False: 36]
  ------------------
 1961|    926|            {
 1962|    926|                num_candidates++;
 1963|    926|            }
 1964|  7.36k|        }
 1965|    357|    }
 1966|    764|    if (num_moved && num_candidates > 0) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (1966:9): [True: 357, False: 407]
  |  Branch (1966:22): [True: 352, False: 5]
  ------------------
 1967|    352|    {
 1968|    352|        pCand = (CC_CAND *) inchi_calloc( num_candidates, sizeof( pCand[0] ) );
  ------------------
  |  | 1146|    352|#define inchi_calloc   calloc
  ------------------
 1969|    352|        if (!pCand)
  ------------------
  |  Branch (1969:13): [True: 0, False: 352]
  ------------------
 1970|      0|        {
 1971|      0|            ret = RI_ERR_ALLOC;
  ------------------
  |  |   15|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1972|      0|            goto exit_function;
 1973|      0|        }
 1974|       |        /* create atom */
 1975|    352|        memcpy(at2, at, len_at * sizeof(at2[0]));
 1976|    352|        pStruct->at = at2;
 1977|    352|        ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 1978|    352|        pStruct->at = at;
 1979|    352|        if (ret2 < 0)
  ------------------
  |  Branch (1979:13): [True: 0, False: 352]
  ------------------
 1980|      0|        {
 1981|      0|            ret = ret2;
 1982|      0|            goto exit_function;
 1983|      0|        }
 1984|       |
 1985|  7.61k|        for (i = 0, j = 0; i < local_num_vertices; i++)
  ------------------
  |  Branch (1985:28): [True: 7.26k, False: 352]
  ------------------
 1986|  7.26k|        {
 1987|  7.26k|            if (pnRad[i] > 0 && i < pBNS->num_atoms && !pVA[i].nTautGroupEdge)
  ------------------
  |  Branch (1987:17): [True: 1.30k, False: 5.95k]
  |  Branch (1987:33): [True: 954, False: 353]
  |  Branch (1987:56): [True: 926, False: 28]
  ------------------
 1988|    926|            {
 1989|    926|                pCand[j].iat = i;
 1990|    926|                pCand[j].num_bonds = at2[i].valence;
 1991|    926|                pCand[j].chem_valence = at2[i].chem_bonds_valence;
 1992|    926|                pCand[j].cMetal = pVA[i].cMetal;
 1993|    926|                pCand[j].cNumBondsToMetal = pVA[i].cNumBondsToMetal;
 1994|    926|                pCand[j].cNumValenceElectrons = pVA[i].cNumValenceElectrons;
 1995|    926|                pCand[j].cPeriodicRowNumber = pVA[i].cPeriodicRowNumber;
 1996|    926|                pCand[j].el_number = at2[i].el_number;
 1997|    926|                cnBits = ( pVA[i].cnListIndex > 0 ) ? cnList[pVA[i].cnListIndex - 1].bits : 0;
  ------------------
  |  Branch (1997:26): [True: 892, False: 34]
  ------------------
 1998|  2.54k|                while (cnBits > 0)
  ------------------
  |  Branch (1998:24): [True: 1.62k, False: 926]
  ------------------
 1999|  1.62k|                {
 2000|  1.62k|                    pCand[j].cNumChargeStates++;
 2001|  1.62k|                    cnBits >>= cn_bits_shift;
  ------------------
  |  |  419|  1.62k|#define cn_bits_shift 3
  ------------------
 2002|  1.62k|                }
 2003|    926|                j++;
 2004|    926|            }
 2005|  7.26k|        }
 2006|    352|        if (j > 1)
  ------------------
  |  Branch (2006:13): [True: 88, False: 264]
  ------------------
 2007|     88|        {
 2008|     88|            qsort( pCand, j, sizeof( pCand[0] ), comp_cc_cand );
 2009|     88|        }
 2010|    352|        added_charge = 0;
 2011|       |
 2012|  1.27k|        for (k = 0; k < j; k++)
  ------------------
  |  Branch (2012:21): [True: 926, False: 352]
  ------------------
 2013|    926|        {
 2014|    926|            int rest_of_charge = extra_charge - added_charge;
 2015|    926|            int charge_per_left_atom = ( abs( rest_of_charge ) + j - k - 1 ) / ( j - k );
 2016|    926|            int this_atom_add_charge = rest_of_charge > 0 ? charge_per_left_atom : -charge_per_left_atom;
  ------------------
  |  Branch (2016:40): [True: 263, False: 663]
  ------------------
 2017|    926|            pVA[pCand[k].iat].cInitCharge += this_atom_add_charge;
 2018|    926|            added_charge += this_atom_add_charge;
 2019|    926|            if (this_atom_add_charge)
  ------------------
  |  Branch (2019:17): [True: 606, False: 320]
  ------------------
 2020|    606|            {
 2021|  3.67k|                for (i = local_num_vertices - 1, pv = pBNS->vert + i; this_atom_add_charge && pBNS->num_atoms <= i; i--, pv--)
  ------------------
  |  Branch (2021:71): [True: 3.07k, False: 606]
  |  Branch (2021:95): [True: 3.07k, False: 0]
  ------------------
 2022|  3.07k|                {
 2023|  3.07k|                    if ((delta = pv->st_edge.cap - pv->st_edge.flow)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2023:25): [True: 610, False: 2.46k]
  ------------------
 2024|    610|                    {
 2025|    610|                        if (this_atom_add_charge < 0 && IS_BNS_VT_C_OR_CSUPER_GR( pv->type ))
  ------------------
  |  |   77|    347|#define IS_BNS_VT_C_OR_CSUPER_GR(X) ((X) & BNS_VT_C_POS)
  |  |  ------------------
  |  |  |  |   63|    347|#define BNS_VT_C_POS     BNS_VERT_TYPE_C_GROUP                               /* positive charge group, heteroat */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|    347|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (77:37): [True: 347, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2025:29): [True: 347, False: 263]
  ------------------
 2026|    347|                        {
 2027|    347|                            if (delta + this_atom_add_charge > 0)
  ------------------
  |  Branch (2027:33): [True: 59, False: 288]
  ------------------
 2028|     59|                            {
 2029|     59|                                delta = -this_atom_add_charge;
 2030|     59|                            }
 2031|    347|                            pv->st_edge.cap -= delta;
 2032|    347|                            pBNS->tot_st_cap -= delta;
 2033|    347|                            this_atom_add_charge += delta;
 2034|    347|                        }
 2035|    263|                        else
 2036|    263|                        {
 2037|    263|                            if (this_atom_add_charge > 0 && BNS_VERT_TYPE__AUX == pv->type)
  ------------------
  |  |   53|    263|#define BNS_VERT_TYPE__AUX          0x0080  /* vertex added to build charge substructures */
  ------------------
  |  Branch (2037:33): [True: 263, False: 0]
  |  Branch (2037:61): [True: 263, False: 0]
  ------------------
 2038|    263|                            {
 2039|    263|                                if (delta > this_atom_add_charge)
  ------------------
  |  Branch (2039:37): [True: 195, False: 68]
  ------------------
 2040|    195|                                {
 2041|    195|                                    delta = this_atom_add_charge;
 2042|    195|                                }
 2043|    263|                                pv->st_edge.cap -= delta;
 2044|    263|                                pBNS->tot_st_cap -= delta;
 2045|    263|                                this_atom_add_charge -= delta;
 2046|    263|                            }
 2047|    263|                        }
 2048|    610|                    }
 2049|  3.07k|                }
 2050|    606|            }
 2051|    926|        }
 2052|    352|    }
 2053|       |
 2054|  87.8k|exit_function:
 2055|  87.8k|    if (pnRad)
  ------------------
  |  Branch (2055:9): [True: 1.65k, False: 86.1k]
  ------------------
 2056|  1.65k|    {
 2057|  1.65k|        inchi_free( pnRad );
  ------------------
  |  | 1152|  1.65k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 1.65k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 1.65k]
  |  |  ------------------
  ------------------
 2058|  1.65k|    }
 2059|  87.8k|    if (pnDelta)
  ------------------
  |  Branch (2059:9): [True: 1.65k, False: 86.1k]
  ------------------
 2060|  1.65k|    {
 2061|  1.65k|        inchi_free( pnDelta );
  ------------------
  |  | 1152|  1.65k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 1.65k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 1.65k]
  |  |  ------------------
  ------------------
 2062|  1.65k|    }
 2063|  87.8k|    if (pCand)
  ------------------
  |  Branch (2063:9): [True: 352, False: 87.4k]
  ------------------
 2064|    352|    {
 2065|    352|        inchi_free( pCand );
  ------------------
  |  | 1152|    352|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 352, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 352]
  |  |  ------------------
  ------------------
 2066|    352|    }
 2067|       |
 2068|  87.8k|    return ret;
 2069|    764|}
AdjustTgroupsToForbiddenEdges2:
 2104|    486|{
 2105|    486|    int i, j, k;
 2106|    486|    int centerpoint_type, neigh_type;
 2107|    486|    int num_changes;
 2108|    486|    int num_donors, num_acceptors, num_donor_endpoints, num_acceptor_endpoints;
 2109|    486|    int neigh, tg_number, num_eql_mobile_gr, num_dif_mobile_gr, bond_type, has_mobile_H; /* djb-rwth: removing redundant variables */
 2110|    486|    int num_forbidden, ind_forbidden, forbidden, num_N, num_O, num_P, num_S, num_OSt;
 2111|    486|    int val, delta_val, delta_met, num_bonds_non_metal, bonds_valence_non_metal;
 2112|       |    /* djb-rwth: removing redundant variables */
 2113|    486|    int inv_forbidden_mask = ~forbidden_mask;
 2114|    486|    MOBILE_GR MobileGr[MAXVAL];
 2115|    486|    int       num_endpoints;
 2116|    486|    MGROUPS   MGroups[MAXVAL];
 2117|    486|    int       num_mgroups, num_diff_t_groups;
 2118|    486|    BNS_EDGE   *e, *e1, *e2, *ev, *ev1, *ev2;
 2119|    486|    BNS_VERTEX *pv1, *pv2;
 2120|    486|    num_changes = 0;
 2121|       |    /* search for possible centerpoints */
 2122|  4.59k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (2122:17): [True: 4.10k, False: 486]
  ------------------
 2123|  4.10k|    {
 2124|       |
 2125|  4.10k|        if (at[i].chem_bonds_valence == at[i].valence || at[i].num_H ||
  ------------------
  |  Branch (2125:13): [True: 2.68k, False: 1.42k]
  |  Branch (2125:58): [True: 44, False: 1.38k]
  ------------------
 2126|  1.38k|             at[i].endpoint || at[i].charge || at[i].radical ||
  ------------------
  |  Branch (2126:14): [True: 340, False: 1.04k]
  |  Branch (2126:32): [True: 313, False: 729]
  |  Branch (2126:48): [True: 37, False: 692]
  ------------------
 2127|    692|             !is_centerpoint_elem( at[i].el_number ) ||
  ------------------
  |  Branch (2127:14): [True: 121, False: 571]
  ------------------
 2128|    571|             !( centerpoint_type = get_pVA_atom_type( pVA, at, i, 0 ) ) ||
  ------------------
  |  Branch (2128:14): [True: 0, False: 571]
  ------------------
 2129|    571|             2 > ( delta_val = at[i].chem_bonds_valence - ( val = get_el_valence( at[i].el_number, 0, 0 ) ) ) ||
  ------------------
  |  Branch (2129:14): [True: 299, False: 272]
  ------------------
 2130|    272|             2 > ( delta_met = ( bonds_valence_non_metal = nNoMetalBondsValence( at, i ) ) - val )
  ------------------
  |  Branch (2130:14): [True: 4, False: 268]
  ------------------
 2131|  4.10k|           ) /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 2132|  3.83k|        {
 2133|  3.83k|            continue;
 2134|  3.83k|        }
 2135|       |
 2136|    268|        num_donors = num_acceptors = num_donor_endpoints = num_acceptor_endpoints = 0;
 2137|    268|        num_mgroups = num_endpoints = num_diff_t_groups = 0;
 2138|    268|        has_mobile_H = num_eql_mobile_gr = num_dif_mobile_gr = tg_number = 0; /* djb-rwth: removing redundant code */
 2139|    268|        ind_forbidden = -1;
 2140|    268|        num_forbidden = 0;
 2141|    268|        num_N = num_O = num_P = num_S = num_OSt = 0;
 2142|    268|        num_bonds_non_metal = nNoMetalNumBonds( at, i );
 2143|       |        /* djb-rwth: removing redundant code */
 2144|       |        /* djb-rwth: removing redundant code */
 2145|       |
 2146|  1.11k|        for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (2146:21): [True: 850, False: 268]
  ------------------
 2147|    850|        {
 2148|       |            /* collect neighbors info */
 2149|    850|            neigh = at[i].neighbor[j];
 2150|    850|            val = get_endpoint_valence( at[neigh].el_number );
 2151|    850|            forbidden = pBNS->edge[(int) pBNS->vert[i].iedge[j]].forbidden;
 2152|    850|            bond_type = ( at[i].bond_type[j] & BOND_TYPE_MASK );
  ------------------
  |  |  189|    850|#define BOND_TYPE_MASK        0x0f
  ------------------
 2153|    850|            neigh_type = get_pVA_atom_type( pVA, at, neigh, bond_type );
 2154|    850|            if (!forbidden && !at[neigh].endpoint)
  ------------------
  |  Branch (2154:17): [True: 761, False: 89]
  |  Branch (2154:31): [True: 481, False: 280]
  ------------------
 2155|    481|            {
 2156|       |                /* save forbidden bonds */
 2157|    481|                if (is_el_a_metal( at[neigh].el_number ))
  ------------------
  |  Branch (2157:21): [True: 44, False: 437]
  ------------------
 2158|     44|                {
 2159|     44|                    continue;
 2160|     44|                }
 2161|    437|                switch (bond_type)
 2162|    437|                {
 2163|    213|                    case BOND_TYPE_SINGLE:
  ------------------
  |  |   32|    213|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2163:21): [True: 213, False: 224]
  ------------------
 2164|    213|                        if (!at[neigh].num_H && at[neigh].charge != -1)
  ------------------
  |  Branch (2164:29): [True: 213, False: 0]
  |  Branch (2164:49): [True: 179, False: 34]
  ------------------
 2165|    179|                        {
 2166|    179|                            continue; /* not a donor */
 2167|    179|                        }
 2168|     34|                        break;
 2169|    186|                    case BOND_TYPE_DOUBLE:
  ------------------
  |  |   33|    186|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2169:21): [True: 186, False: 251]
  ------------------
 2170|    186|                        if (!neigh_type)
  ------------------
  |  Branch (2170:29): [True: 1, False: 185]
  ------------------
 2171|      1|                        {
 2172|      1|                            continue;
 2173|      1|                        }
 2174|    185|                        break;
 2175|    185|                    default:
  ------------------
  |  Branch (2175:21): [True: 38, False: 399]
  ------------------
 2176|     38|                        continue;
 2177|    437|                }
 2178|    437|            }
 2179|       |
 2180|    588|            MobileGr[num_endpoints].atom_number = neigh;
 2181|    588|            MobileGr[num_endpoints].ineigh = j;
 2182|    588|            MobileGr[num_endpoints].bond_type = bond_type;
 2183|    588|            MobileGr[num_endpoints].group_number = at[neigh].endpoint;
 2184|    588|            MobileGr[num_endpoints].endpoint_valence = val;
 2185|    588|            MobileGr[num_endpoints].forbidden = forbidden;
 2186|    588|            MobileGr[num_endpoints].atom_type_pVA = neigh_type;
 2187|    588|            MobileGr[num_endpoints].num_bonds = at[neigh].valence;
 2188|    588|            MobileGr[num_endpoints].bonds_valence = at[neigh].chem_bonds_valence;
 2189|    588|            MobileGr[num_endpoints].num_bonds_non_metal = nNoMetalNumBonds( at, neigh );
 2190|    588|            MobileGr[num_endpoints].bonds_valence_non_metal = nNoMetalBondsValence( at, neigh );
 2191|       |
 2192|    588|            if (forbidden & forbidden_mask)
  ------------------
  |  Branch (2192:17): [True: 87, False: 501]
  ------------------
 2193|     87|            {
 2194|     87|                num_forbidden++;
 2195|     87|                ind_forbidden = num_endpoints;
 2196|     87|            }
 2197|    588|            num_O += 0 != ( neigh_type & EL_TYPE_O ) && at[neigh].valence == 1; /* ignore -O- */
  ------------------
  |  |  386|    588|#define EL_TYPE_O     0x0001
  ------------------
  |  Branch (2197:22): [True: 124, False: 464]
  |  Branch (2197:57): [True: 109, False: 15]
  ------------------
 2198|    588|            num_N += 0 != ( neigh_type & EL_TYPE_N ) &&
  ------------------
  |  |  388|    588|#define EL_TYPE_N     0x0004
  ------------------
  |  Branch (2198:22): [True: 229, False: 359]
  ------------------
 2199|    229|                !( at[neigh].valence == 3 && at[neigh].chem_bonds_valence == 3 ); /* ignore -N< */
  ------------------
  |  Branch (2199:20): [True: 24, False: 205]
  |  Branch (2199:46): [True: 10, False: 14]
  ------------------
 2200|    588|            num_S += 0 != ( neigh_type & EL_TYPE_S ) && at[neigh].valence == 1; /* ignore -S- */
  ------------------
  |  |  387|    588|#define EL_TYPE_S     0x0002
  ------------------
  |  Branch (2200:22): [True: 123, False: 465]
  |  Branch (2200:57): [True: 78, False: 45]
  ------------------
 2201|    588|            num_P += 0 != ( neigh_type & EL_TYPE_P ) &&
  ------------------
  |  |  389|    588|#define EL_TYPE_P     0x0008
  ------------------
  |  Branch (2201:22): [True: 41, False: 547]
  ------------------
 2202|     41|                !( at[neigh].valence == 3 && at[neigh].chem_bonds_valence == 3 ); /* ignore -P< */
  ------------------
  |  Branch (2202:20): [True: 12, False: 29]
  |  Branch (2202:46): [True: 3, False: 9]
  ------------------
 2203|    588|            num_OSt += 0 != ( neigh_type & EL_TYPE_OSt );
  ------------------
  |  |  393|    588|#define EL_TYPE_OSt   0x0100 /* terminal -OH, -O(-), -SH, -S(-), ... from fix_special_bonds(...) */
  ------------------
 2204|    588|            num_acceptors += ( bond_type == BOND_TYPE_DOUBLE ) && ( neigh_type & EL_TYPE_PT );
  ------------------
  |  |   33|    588|#define BOND_TYPE_DOUBLE    2
  ------------------
                          num_acceptors += ( bond_type == BOND_TYPE_DOUBLE ) && ( neigh_type & EL_TYPE_PT );
  ------------------
  |  |  394|    354|#define EL_TYPE_PT    0x0200 /* may be a tautomeric endpoint */
  ------------------
  |  Branch (2204:30): [True: 354, False: 234]
  |  Branch (2204:67): [True: 228, False: 126]
  ------------------
 2205|    588|            num_donors += ( bond_type == BOND_TYPE_SINGLE ) && ( neigh_type & EL_TYPE_PT ) &&
  ------------------
  |  |   32|    588|#define BOND_TYPE_SINGLE    1
  ------------------
                          num_donors += ( bond_type == BOND_TYPE_SINGLE ) && ( neigh_type & EL_TYPE_PT ) &&
  ------------------
  |  |  394|    227|#define EL_TYPE_PT    0x0200 /* may be a tautomeric endpoint */
  ------------------
  |  Branch (2205:27): [True: 227, False: 361]
  |  Branch (2205:64): [True: 128, False: 99]
  ------------------
 2206|    128|                ( at[neigh].num_H || at[neigh].charge == -1 || at[neigh].endpoint );
  ------------------
  |  Branch (2206:19): [True: 21, False: 107]
  |  Branch (2206:38): [True: 59, False: 48]
  |  Branch (2206:64): [True: 47, False: 1]
  ------------------
 2207|    588|            if (at[neigh].endpoint)
  ------------------
  |  Branch (2207:17): [True: 315, False: 273]
  ------------------
 2208|    315|            {
 2209|    315|                num_acceptor_endpoints += ( bond_type == BOND_TYPE_DOUBLE );
  ------------------
  |  |   33|    315|#define BOND_TYPE_DOUBLE    2
  ------------------
 2210|    315|                num_donor_endpoints += ( bond_type == BOND_TYPE_SINGLE );
  ------------------
  |  |   32|    315|#define BOND_TYPE_SINGLE    1
  ------------------
 2211|    315|                if (!tg_number)
  ------------------
  |  Branch (2211:21): [True: 207, False: 108]
  ------------------
 2212|    207|                {
 2213|    207|                    tg_number = at[neigh].endpoint;
 2214|    207|                    num_eql_mobile_gr = 1;
 2215|    207|                }
 2216|    108|                else
 2217|    108|                {
 2218|    108|                    if (tg_number == at[neigh].endpoint)
  ------------------
  |  Branch (2218:25): [True: 101, False: 7]
  ------------------
 2219|    101|                    {
 2220|    101|                        num_eql_mobile_gr++;
 2221|    101|                    }
 2222|      7|                    else
 2223|      7|                    {
 2224|      7|                        num_dif_mobile_gr++;
 2225|      7|                    }
 2226|    108|                }
 2227|    315|            }
 2228|    273|            else
 2229|    273|            {
 2230|    273|                if (bond_type == BOND_TYPE_SINGLE && val)
  ------------------
  |  |   32|    546|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2230:21): [True: 61, False: 212]
  |  Branch (2230:54): [True: 49, False: 12]
  ------------------
 2231|     49|                {
 2232|     49|                    if (at[neigh].endpoint)
  ------------------
  |  Branch (2232:25): [True: 0, False: 49]
  ------------------
 2233|      0|                    {
 2234|      0|                        has_mobile_H |= 1;
 2235|       |                        /* djb-rwth: removing redundant code */
 2236|      0|                    }
 2237|     49|                    else
 2238|     49|                    {
 2239|     49|                        has_mobile_H |= ( 0 != at[neigh].num_H );
 2240|       |                        /* djb-rwth: removing redundant code */
 2241|     49|                    }
 2242|     49|                }
 2243|    273|            }
 2244|    588|            num_endpoints++;
 2245|       |
 2246|    588|            if (at[neigh].endpoint || ( neigh_type & EL_TYPE_PT ))
  ------------------
  |  |  394|    273|#define EL_TYPE_PT    0x0200 /* may be a tautomeric endpoint */
  ------------------
  |  Branch (2246:17): [True: 315, False: 273]
  |  Branch (2246:39): [True: 138, False: 135]
  ------------------
 2247|    453|            {
 2248|    563|                for (k = 0; k < num_mgroups; k++)
  ------------------
  |  Branch (2248:29): [True: 237, False: 326]
  ------------------
 2249|    237|                {
 2250|    237|                    if (MGroups[k].group_number == at[neigh].endpoint)
  ------------------
  |  Branch (2250:25): [True: 127, False: 110]
  ------------------
 2251|    127|                    {
 2252|    127|                        MGroups[k].num++;
 2253|    127|                        break;
 2254|    127|                    }
 2255|    237|                }
 2256|    453|                if (k == num_mgroups)
  ------------------
  |  Branch (2256:21): [True: 326, False: 127]
  ------------------
 2257|    326|                {
 2258|    326|                    MGroups[k].group_number = at[neigh].endpoint;
 2259|    326|                    MGroups[k].num = 1;
 2260|    326|                    num_mgroups++;
 2261|    326|                    num_diff_t_groups += ( 0 != at[neigh].endpoint );
 2262|    326|                }
 2263|    453|            }
 2264|    588|        }
 2265|    268|        if (!num_acceptors || !num_donors || /* num_acceptors > 2 ||*/
  ------------------
  |  Branch (2265:13): [True: 108, False: 160]
  |  Branch (2265:31): [True: 79, False: 81]
  ------------------
 2266|     81|             (num_eql_mobile_gr == num_endpoints && !num_forbidden) ||
  ------------------
  |  Branch (2266:15): [True: 16, False: 65]
  |  Branch (2266:53): [True: 4, False: 12]
  ------------------
 2267|     77|             (!tg_number && !has_mobile_H)) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (2267:15): [True: 5, False: 72]
  |  Branch (2267:29): [True: 5, False: 0]
  ------------------
 2268|    196|        {
 2269|    196|            continue; /* nothing to do */
 2270|    196|        }
 2271|       |
 2272|       |        /* case_5_1: */
 2273|       |        /***************** determine the case ************************/
 2274|     72|        if (3 == num_bonds_non_metal &&
  ------------------
  |  Branch (2274:13): [True: 35, False: 37]
  ------------------
 2275|     35|             4 == bonds_valence_non_metal &&
  ------------------
  |  Branch (2275:14): [True: 23, False: 12]
  ------------------
 2276|     23|             ( centerpoint_type == EL_TYPE_C ) &&
  ------------------
  |  |  390|     23|#define EL_TYPE_C     0x0010
  ------------------
  |  Branch (2276:14): [True: 0, False: 23]
  ------------------
 2277|      0|             2 == num_O && 1 == num_N + num_S && num_OSt &&
  ------------------
  |  Branch (2277:14): [True: 0, False: 0]
  |  Branch (2277:28): [True: 0, False: 0]
  |  Branch (2277:50): [True: 0, False: 0]
  ------------------
 2278|      0|             1 == num_forbidden && 3 == num_eql_mobile_gr)
  ------------------
  |  Branch (2278:14): [True: 0, False: 0]
  |  Branch (2278:36): [True: 0, False: 0]
  ------------------
 2279|      0|        {
 2280|       |            /********************************************************
 2281|       |             ***         InChI Tech. Man., Table 5, case 1        ***
 2282|       |             ********************************************************
 2283|       |                       2
 2284|       |                      OH                OH     X  =  N, S, Se, Te
 2285|       |                     /                 /       f  =  fixed bond
 2286|       |                 e  /                 /        tg =  Mobile-H vertex
 2287|       |              HX---C      -->    X===C
 2288|       |            ev2|| f  \\ ev1         f  \
 2289|       |               ||     \\                \
 2290|       |               tg------O                 OH
 2291|       |                        1
 2292|       |             Problem:
 2293|       |               XH, O, and O belong to the same Mobile-H group.
 2294|       |               Fixed bond prevents the correct structure restoration:
 2295|       |               H cannot migrate from X to O because HX-N bond is fixed
 2296|       |             Solution:
 2297|       |               Move H from X to allow XH-C bond change
 2298|       |               (this unfixes the bond, see SetForbiddenEdges(...) )
 2299|       |             *********************************************************/
 2300|      0|            int jXH = -1, jO1 = -1, jO2 = -1, n = 0;
 2301|      0|            for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (2301:25): [True: 0, False: 0]
  ------------------
 2302|      0|            {
 2303|      0|                if (( MobileGr[j].atom_type_pVA & ( EL_TYPE_N | EL_TYPE_S ) ) &&
  ------------------
  |  |  388|      0|#define EL_TYPE_N     0x0004
  ------------------
                              if (( MobileGr[j].atom_type_pVA & ( EL_TYPE_N | EL_TYPE_S ) ) &&
  ------------------
  |  |  387|      0|#define EL_TYPE_S     0x0002
  ------------------
  |  Branch (2303:21): [True: 0, False: 0]
  ------------------
 2304|      0|                    ( MobileGr[j].forbidden == forbidden_mask ) &&
  ------------------
  |  Branch (2304:21): [True: 0, False: 0]
  ------------------
 2305|      0|                     MobileGr[j].bond_type == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2305:22): [True: 0, False: 0]
  ------------------
 2306|      0|                     jXH < 0)
  ------------------
  |  Branch (2306:22): [True: 0, False: 0]
  ------------------
 2307|      0|                {
 2308|      0|                    jXH = j;
 2309|      0|                    n++;
 2310|      0|                }
 2311|      0|                else
 2312|      0|                {
 2313|      0|                    if (( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_O &&
  ------------------
  |  |  392|      0|#define EL_TYPE_MASK  0x003f
  ------------------
                                  if (( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_O &&
  ------------------
  |  |  386|      0|#define EL_TYPE_O     0x0001
  ------------------
  |  Branch (2313:25): [True: 0, False: 0]
  ------------------
 2314|      0|                            MobileGr[j].num_bonds_non_metal == 1 &&
  ------------------
  |  Branch (2314:29): [True: 0, False: 0]
  ------------------
 2315|      0|                            !MobileGr[j].forbidden)
  ------------------
  |  Branch (2315:29): [True: 0, False: 0]
  ------------------
 2316|      0|                    {
 2317|      0|                        if (MobileGr[j].bond_type == BOND_TYPE_DOUBLE && jO1 < 0)
  ------------------
  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2317:29): [True: 0, False: 0]
  |  Branch (2317:74): [True: 0, False: 0]
  ------------------
 2318|      0|                        {
 2319|      0|                            jO1 = j;
 2320|      0|                            n++;
 2321|      0|                        }
 2322|      0|                        else
 2323|      0|                        {
 2324|      0|                            if (MobileGr[j].bond_type == BOND_TYPE_SINGLE && jO2 < 0)
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2324:33): [True: 0, False: 0]
  |  Branch (2324:78): [True: 0, False: 0]
  ------------------
 2325|      0|                            {
 2326|      0|                                jO2 = j;
 2327|      0|                                n++;
 2328|      0|                            }
 2329|      0|                        }
 2330|      0|                    }
 2331|      0|                }
 2332|      0|            }
 2333|      0|            if (n != 3)
  ------------------
  |  Branch (2333:17): [True: 0, False: 0]
  ------------------
 2334|      0|            {
 2335|      0|                goto case_5_2;
 2336|      0|            }
 2337|       |            /* XH-C edge */
 2338|      0|            e = pBNS->edge + pBNS->vert[i].iedge[MobileGr[jXH].ineigh];
 2339|       |            /* C=O  edge */
 2340|      0|            ev1 = pBNS->edge + pBNS->vert[i].iedge[MobileGr[jO1].ineigh];
 2341|       |            /* XH-tg edge */
 2342|      0|            ev2 = pBNS->edge + pVA[MobileGr[jXH].atom_number].nTautGroupEdge - 1;
 2343|       |
 2344|      0|            if (!ev1->flow || !ev2->flow)
  ------------------
  |  Branch (2344:17): [True: 0, False: 0]
  |  Branch (2344:31): [True: 0, False: 0]
  ------------------
 2345|      0|            {
 2346|      0|                goto case_5_2;
 2347|      0|            }
 2348|       |
 2349|       |            /* do not remove forbidden edge bit */
 2350|      0|            e->flow++;
 2351|      0|            ev1->flow--;
 2352|      0|            ev2->flow--;
 2353|      0|            pBNS->vert[ev1->neighbor12 ^ i].st_edge.flow--;
 2354|      0|            pBNS->vert[ev2->neighbor12 ^ ev2->neighbor1].st_edge.flow--;
 2355|      0|            pBNS->tot_st_flow -= 2;
 2356|      0|            num_changes++;
 2357|      0|            continue;
 2358|      0|        }
 2359|     72|    case_5_2:
 2360|       |            /*********************************************************************/
 2361|     72|        if (3 == num_bonds_non_metal &&
  ------------------
  |  Branch (2361:13): [True: 35, False: 37]
  ------------------
 2362|     35|             5 == bonds_valence_non_metal &&
  ------------------
  |  Branch (2362:14): [True: 12, False: 23]
  ------------------
 2363|     12|             ( centerpoint_type == EL_TYPE_N ) &&
  ------------------
  |  |  388|     12|#define EL_TYPE_N     0x0004
  ------------------
  |  Branch (2363:14): [True: 8, False: 4]
  ------------------
 2364|      8|             2 == num_O && 1 == num_N + num_S &&
  ------------------
  |  Branch (2364:14): [True: 2, False: 6]
  |  Branch (2364:28): [True: 2, False: 0]
  ------------------
 2365|      2|             1 == num_forbidden && 3 == num_eql_mobile_gr)
  ------------------
  |  Branch (2365:14): [True: 2, False: 0]
  |  Branch (2365:36): [True: 1, False: 1]
  ------------------
 2366|      1|        {
 2367|       |            /********************************************************
 2368|       |             ***         InChI Tech. Man., Table 5, case 2        ***
 2369|       |             ********************************************************
 2370|       |
 2371|       |                      O                 OH     X  =  N, S, Se, Te
 2372|       |                     //                /       f  =  fixed bond
 2373|       |                 e  //                /        tg =  Mobile-H vertex
 2374|       |              HX---N      -->    X===N
 2375|       |            ev2|| f  \\ ev1         f  \\
 2376|       |               ||     \\                \\
 2377|       |               tg------O                 O
 2378|       |
 2379|       |             Problem:
 2380|       |               XH, O, and O belong to the same Mobile-H group.
 2381|       |               Fixed bond prevents the correct structure restoration:
 2382|       |               H cannot migrate from X to O because HX-N bond is fixed
 2383|       |             Solution:
 2384|       |               Move H from X to allow XH-N bond change
 2385|       |               (this unfixes the bond, see SetForbiddenEdges(...) )
 2386|       |             *********************************************************/
 2387|      1|            int jXH = -1, jO1 = -1, jO2 = -1, n = 0;
 2388|      4|            for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (2388:25): [True: 3, False: 1]
  ------------------
 2389|      3|            {
 2390|      3|                if (( MobileGr[j].atom_type_pVA & ( EL_TYPE_N | EL_TYPE_S ) ) &&
  ------------------
  |  |  388|      3|#define EL_TYPE_N     0x0004
  ------------------
                              if (( MobileGr[j].atom_type_pVA & ( EL_TYPE_N | EL_TYPE_S ) ) &&
  ------------------
  |  |  387|      3|#define EL_TYPE_S     0x0002
  ------------------
  |  Branch (2390:21): [True: 1, False: 2]
  ------------------
 2391|      1|                    ( MobileGr[j].forbidden == forbidden_mask ) &&
  ------------------
  |  Branch (2391:21): [True: 1, False: 0]
  ------------------
 2392|      1|                     MobileGr[j].bond_type == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|      4|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2392:22): [True: 1, False: 0]
  ------------------
 2393|      1|                     jXH < 0)
  ------------------
  |  Branch (2393:22): [True: 1, False: 0]
  ------------------
 2394|      1|                {
 2395|      1|                    jXH = j;
 2396|      1|                    n++;
 2397|      1|                }
 2398|      2|                else
 2399|      2|                {
 2400|      2|                    if (( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_O &&
  ------------------
  |  |  392|      2|#define EL_TYPE_MASK  0x003f
  ------------------
                                  if (( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_O &&
  ------------------
  |  |  386|      4|#define EL_TYPE_O     0x0001
  ------------------
  |  Branch (2400:25): [True: 2, False: 0]
  ------------------
 2401|      2|                            MobileGr[j].bond_type == BOND_TYPE_DOUBLE &&
  ------------------
  |  |   33|      4|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2401:29): [True: 2, False: 0]
  ------------------
 2402|      2|                            MobileGr[j].num_bonds_non_metal == 1 &&
  ------------------
  |  Branch (2402:29): [True: 2, False: 0]
  ------------------
 2403|      2|                            !MobileGr[j].forbidden)
  ------------------
  |  Branch (2403:29): [True: 2, False: 0]
  ------------------
 2404|      2|                    {
 2405|      2|                        if (jO1 < 0)
  ------------------
  |  Branch (2405:29): [True: 1, False: 1]
  ------------------
 2406|      1|                        {
 2407|      1|                            jO1 = j;
 2408|      1|                            n++;
 2409|      1|                        }
 2410|      1|                        else
 2411|      1|                        {
 2412|      1|                            if (jO2 < 0)
  ------------------
  |  Branch (2412:33): [True: 1, False: 0]
  ------------------
 2413|      1|                            {
 2414|      1|                                jO2 = j;
 2415|      1|                                n++;
 2416|      1|                            }
 2417|      1|                        }
 2418|      2|                    }
 2419|      2|                }
 2420|      3|            }
 2421|      1|            if (n != 3)
  ------------------
  |  Branch (2421:17): [True: 0, False: 1]
  ------------------
 2422|      0|            {
 2423|      0|                goto case_5_4;
 2424|      0|            }
 2425|       |            /* XH-N edge */
 2426|      1|            e = pBNS->edge + pBNS->vert[i].iedge[MobileGr[jXH].ineigh];
 2427|       |            /* N=O  edge */
 2428|      1|            ev1 = pBNS->edge + pBNS->vert[i].iedge[MobileGr[jO1].ineigh];
 2429|       |            /* XH-tg edge */
 2430|      1|            ev2 = pBNS->edge + pVA[MobileGr[jXH].atom_number].nTautGroupEdge - 1;
 2431|       |
 2432|      1|            if (!ev1->flow || !ev2->flow)
  ------------------
  |  Branch (2432:17): [True: 0, False: 1]
  |  Branch (2432:31): [True: 1, False: 0]
  ------------------
 2433|      1|            {
 2434|      1|                goto case_5_4;
 2435|      1|            }
 2436|       |            /* do not remove forbidden edge bit */
 2437|      0|            e->flow++;
 2438|      0|            ev1->flow--;
 2439|      0|            ev2->flow--;
 2440|      0|            pBNS->vert[ev1->neighbor12 ^ i].st_edge.flow--; /* first =O vertex */
 2441|      0|            pBNS->vert[ev2->neighbor12 ^ ev2->neighbor1].st_edge.flow--; /* taut group vertex tg */
 2442|      0|            pBNS->tot_st_flow -= 2;
 2443|      0|            num_changes++;
 2444|      0|            continue;
 2445|      1|        }
 2446|       |
 2447|     72|    case_5_4:
 2448|       |            /*********************************************************************/
 2449|     72|        if (3 == num_bonds_non_metal &&
  ------------------
  |  Branch (2449:13): [True: 35, False: 37]
  ------------------
 2450|     35|             5 == bonds_valence_non_metal &&
  ------------------
  |  Branch (2450:14): [True: 12, False: 23]
  ------------------
 2451|     12|             ( centerpoint_type & ( EL_TYPE_N | EL_TYPE_P ) ) &&
  ------------------
  |  |  388|     12|#define EL_TYPE_N     0x0004
  ------------------
                           ( centerpoint_type & ( EL_TYPE_N | EL_TYPE_P ) ) &&
  ------------------
  |  |  389|     12|#define EL_TYPE_P     0x0008
  ------------------
  |  Branch (2451:14): [True: 11, False: 1]
  ------------------
 2452|     11|             1 == num_O + num_S && 0 < num_N && 2 == ( num_N + num_P ) &&
  ------------------
  |  Branch (2452:14): [True: 4, False: 7]
  |  Branch (2452:36): [True: 4, False: 0]
  |  Branch (2452:49): [True: 2, False: 2]
  ------------------
 2453|      2|             1 == num_forbidden && num_O + num_S + num_N == num_eql_mobile_gr)
  ------------------
  |  Branch (2453:14): [True: 2, False: 0]
  |  Branch (2453:36): [True: 1, False: 1]
  ------------------
 2454|      1|        {
 2455|       |            /********************************************************
 2456|       |             ***         InChI Tech. Man., Table 5, case 4        ***
 2457|       |             ********************************************************
 2458|       |                                               O  =  O, S, Se, Te
 2459|       |                       X                 X     X  =  N, P, As
 2460|       |                     //                //      f  =  fixed bond
 2461|       |                 e  // ev2            //       tg =  Mobile-H vertex
 2462|       |               O===N      -->   HO---N
 2463|       |              || f  \  ev1         f  \\
 2464|       |              ||     \                 \\
 2465|       |              tg------NH                N
 2466|       |
 2467|       |            Problem:
 2468|       |              O, NH, and possibly X belong to the same Mobile-H group.
 2469|       |              Fixed bond prevents the correct structure restoration:
 2470|       |              H cannot migrate from NH to O because O=N bond is fixed
 2471|       |            Solution:
 2472|       |              Move H from NH to O to allow O=N bond change
 2473|       |              (this unfixes the bond, see fix_special_bonds(...) )
 2474|       |            *********************************************************/
 2475|      1|            int jO = -1, jNH = -1, jX = -1, n = 0;
 2476|      4|            for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (2476:25): [True: 3, False: 1]
  ------------------
 2477|      3|            {
 2478|      3|                if (( MobileGr[j].atom_type_pVA & ( EL_TYPE_O | EL_TYPE_S ) ) &&
  ------------------
  |  |  386|      3|#define EL_TYPE_O     0x0001
  ------------------
                              if (( MobileGr[j].atom_type_pVA & ( EL_TYPE_O | EL_TYPE_S ) ) &&
  ------------------
  |  |  387|      3|#define EL_TYPE_S     0x0002
  ------------------
  |  Branch (2478:21): [True: 1, False: 2]
  ------------------
 2479|      1|                     MobileGr[j].forbidden == forbidden_mask &&
  ------------------
  |  Branch (2479:22): [True: 1, False: 0]
  ------------------
 2480|      1|                     MobileGr[j].bond_type == BOND_TYPE_DOUBLE &&
  ------------------
  |  |   33|      4|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2480:22): [True: 1, False: 0]
  ------------------
 2481|      1|                     MobileGr[j].num_bonds_non_metal == 1 &&
  ------------------
  |  Branch (2481:22): [True: 1, False: 0]
  ------------------
 2482|      1|                     jO < 0)
  ------------------
  |  Branch (2482:22): [True: 1, False: 0]
  ------------------
 2483|      1|                {
 2484|      1|                    jO = j;
 2485|      1|                    n++;
 2486|      1|                }
 2487|      2|                else
 2488|      2|                {
 2489|      2|                    if (( MobileGr[j].atom_type_pVA & ( EL_TYPE_N | EL_TYPE_P ) ) &&
  ------------------
  |  |  388|      2|#define EL_TYPE_N     0x0004
  ------------------
                                  if (( MobileGr[j].atom_type_pVA & ( EL_TYPE_N | EL_TYPE_P ) ) &&
  ------------------
  |  |  389|      2|#define EL_TYPE_P     0x0008
  ------------------
  |  Branch (2489:25): [True: 2, False: 0]
  ------------------
 2490|      2|                            !MobileGr[j].forbidden)
  ------------------
  |  Branch (2490:29): [True: 2, False: 0]
  ------------------
 2491|      2|                    {
 2492|      2|                        if (MobileGr[j].bond_type == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|      4|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2492:29): [True: 1, False: 1]
  ------------------
 2493|      1|                            ( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_N && jNH < 0)
  ------------------
  |  |  392|      1|#define EL_TYPE_MASK  0x003f
  ------------------
                                          ( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_N && jNH < 0)
  ------------------
  |  |  388|      3|#define EL_TYPE_N     0x0004
  ------------------
  |  Branch (2493:29): [True: 1, False: 0]
  |  Branch (2493:90): [True: 1, False: 0]
  ------------------
 2494|      1|                        {
 2495|      1|                            jNH = j;
 2496|      1|                            n++;
 2497|      1|                        }
 2498|      1|                        else
 2499|      1|                        {
 2500|      1|                            if (MobileGr[j].bond_type == BOND_TYPE_DOUBLE && jX < 0)
  ------------------
  |  |   33|      2|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2500:33): [True: 1, False: 0]
  |  Branch (2500:78): [True: 1, False: 0]
  ------------------
 2501|      1|                            {
 2502|      1|                                jX = j;
 2503|      1|                                n++;
 2504|      1|                            }
 2505|      1|                        }
 2506|      2|                    }
 2507|      2|                }
 2508|      3|            }
 2509|      1|            if (n != 3)
  ------------------
  |  Branch (2509:17): [True: 0, False: 1]
  ------------------
 2510|      0|            {
 2511|      0|                goto case_5_6;
 2512|      0|            }
 2513|       |            /* O=N edge */
 2514|      1|            e = pBNS->edge + pBNS->vert[i].iedge[MobileGr[jO].ineigh];
 2515|       |            /* N-NH  edge */
 2516|      1|            ev1 = pBNS->edge + pBNS->vert[i].iedge[MobileGr[jNH].ineigh];
 2517|       |            /* N=X edge */
 2518|      1|            ev2 = pBNS->edge + pBNS->vert[i].iedge[MobileGr[jX].ineigh];
 2519|       |
 2520|      1|            if (!e->flow)
  ------------------
  |  Branch (2520:17): [True: 0, False: 1]
  ------------------
 2521|      0|            {
 2522|      0|                goto case_5_6;
 2523|      0|            }
 2524|       |            /* do not remove forbidden edge bit */
 2525|      1|            e->flow--;
 2526|      1|            ev1->flow++;
 2527|      1|            pBNS->vert[e->neighbor12 ^ i].st_edge.flow--;
 2528|      1|            pBNS->vert[ev1->neighbor12 ^ i].st_edge.flow--;
 2529|      1|            pBNS->tot_st_flow -= 2;
 2530|      1|            num_changes++;
 2531|      1|            continue;
 2532|      1|        }
 2533|     71|    case_5_6:
 2534|       |            /********* InChI Tech.Man. Table 5, case 6 **************/
 2535|     71|        if (2 == delta_met && 4 == num_bonds_non_metal &&
  ------------------
  |  Branch (2535:13): [True: 57, False: 14]
  |  Branch (2535:31): [True: 22, False: 35]
  ------------------
 2536|     22|             5 == bonds_valence_non_metal &&
  ------------------
  |  Branch (2536:14): [True: 22, False: 0]
  ------------------
 2537|     22|             1 == num_forbidden && 1 < num_eql_mobile_gr &&
  ------------------
  |  Branch (2537:14): [True: 9, False: 13]
  |  Branch (2537:36): [True: 8, False: 1]
  ------------------
 2538|      8|             !num_dif_mobile_gr &&
  ------------------
  |  Branch (2538:14): [True: 8, False: 0]
  ------------------
 2539|      8|             ( centerpoint_type & ( EL_TYPE_N | EL_TYPE_P ) ) &&
  ------------------
  |  |  388|      8|#define EL_TYPE_N     0x0004
  ------------------
                           ( centerpoint_type & ( EL_TYPE_N | EL_TYPE_P ) ) &&
  ------------------
  |  |  389|      8|#define EL_TYPE_P     0x0008
  ------------------
  |  Branch (2539:14): [True: 8, False: 0]
  ------------------
 2540|      8|             1 <= num_N && 2 <= num_N + num_O + num_S &&
  ------------------
  |  Branch (2540:14): [True: 8, False: 0]
  |  Branch (2540:28): [True: 8, False: 0]
  ------------------
 2541|      8|             1 == num_acceptor_endpoints && 0 < num_donor_endpoints)
  ------------------
  |  Branch (2541:14): [True: 7, False: 1]
  |  Branch (2541:45): [True: 7, False: 0]
  ------------------
 2542|      7|        {
 2543|      7|            int jN = -1, njFix = 0, jFix[4], n = 0;
 2544|       |            /* centerpoint is N, P, As, Sb
 2545|       |
 2546|       |                input             output
 2547|       |                -----             ------
 2548|       |                    end
 2549|       |                    po-
 2550|       |                    int
 2551|       |                    2
 2552|       |
 2553|       |                X  ZH              X  Z     Z=N,O,S,Se,Te [terminal endpoint]
 2554|       |                \ |                \ ||
 2555|       |                \| f   f           \||
 2556|       |                Y---N===N---       Y---N---NH---
 2557|       |                    e                  f
 2558|       |                cen  end         no bond
 2559|       |                ter  po-         fixed
 2560|       |                po-  int
 2561|       |                int  1        tautomerism O==N--NH is allowed
 2562|       |
 2563|       |                Problem: OH and =N- belong to a Mobile-H group, but
 2564|       |                        forbidden edge e does not allow them to be
 2565|       |                        tautomeric in the restored structure.
 2566|       |
 2567|       |                Solution:
 2568|       |
 2569|       |                1. Decrement flow in edge e
 2570|       |                2. Decrement st_edge flow in N and N connected by e
 2571|       |                3. Fix all single order bonds to not terminal tautomeric N around N(centerpoint)
 2572|       |                4. Run BNS to establist new flow distribution
 2573|       |            */
 2574|       |
 2575|       |            /* fixed bond */
 2576|     30|            for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (2576:25): [True: 23, False: 7]
  ------------------
 2577|     23|            {
 2578|     23|                neigh = MobileGr[j].atom_number;
 2579|     23|                if (MobileGr[j].bond_type == BOND_TYPE_DOUBLE &&
  ------------------
  |  |   33|     46|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2579:21): [True: 7, False: 16]
  ------------------
 2580|      7|                    ( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_N &&
  ------------------
  |  |  392|      7|#define EL_TYPE_MASK  0x003f
  ------------------
                                  ( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_N &&
  ------------------
  |  |  388|     30|#define EL_TYPE_N     0x0004
  ------------------
  |  Branch (2580:21): [True: 6, False: 1]
  ------------------
 2581|      6|                     MobileGr[j].num_bonds_non_metal == 2 &&
  ------------------
  |  Branch (2581:22): [True: 6, False: 0]
  ------------------
 2582|      6|                     MobileGr[j].bonds_valence_non_metal == 3 &&
  ------------------
  |  Branch (2582:22): [True: 6, False: 0]
  ------------------
 2583|      6|                     at[neigh].endpoint &&
  ------------------
  |  Branch (2583:22): [True: 6, False: 0]
  ------------------
 2584|      6|                     !at[neigh].num_H && !at[neigh].charge &&
  ------------------
  |  Branch (2584:22): [True: 6, False: 0]
  |  Branch (2584:42): [True: 6, False: 0]
  ------------------
 2585|      6|                     !at[neigh].radical &&
  ------------------
  |  Branch (2585:22): [True: 6, False: 0]
  ------------------
 2586|      6|                     ( MobileGr[j].forbidden & forbidden_mask ) && jN < 0)
  ------------------
  |  Branch (2586:22): [True: 6, False: 0]
  |  Branch (2586:68): [True: 6, False: 0]
  ------------------
 2587|      6|                {
 2588|      6|                    jN = j;
 2589|      6|                    n++;
 2590|      6|                }
 2591|     17|                else
 2592|     17|                {
 2593|     17|                    if (MobileGr[j].bond_type == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|     34|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2593:25): [True: 16, False: 1]
  ------------------
 2594|     16|                            at[neigh].endpoint)
  ------------------
  |  Branch (2594:29): [True: 13, False: 3]
  ------------------
 2595|     13|                    {
 2596|     13|                        if (MobileGr[j].num_bonds > 1)
  ------------------
  |  Branch (2596:29): [True: 11, False: 2]
  ------------------
 2597|     11|                        {
 2598|     11|                            jFix[njFix++] = j;
 2599|     11|                        }
 2600|     13|                        n++;
 2601|     13|                    }
 2602|     17|                }
 2603|     23|            }
 2604|       |
 2605|      7|            if (jN < 0 || n < 2 || 1 + njFix == n)
  ------------------
  |  Branch (2605:17): [True: 1, False: 6]
  |  Branch (2605:27): [True: 0, False: 6]
  |  Branch (2605:36): [True: 4, False: 2]
  ------------------
 2606|      5|            {
 2607|      5|                goto case_5_7;  /* nothing to do */
 2608|      5|            }
 2609|       |
 2610|      2|            e = pBNS->edge + pBNS->vert[i].iedge[MobileGr[jN].ineigh];  /* fixed edge */
 2611|      2|            if (!e->flow)
  ------------------
  |  Branch (2611:17): [True: 0, False: 2]
  ------------------
 2612|      0|            {
 2613|      0|                goto case_5_7;
 2614|      0|            }
 2615|      2|            e->flow--;
 2616|      2|            pBNS->vert[i].st_edge.flow--;
 2617|      2|            pBNS->vert[e->neighbor12 ^ i].st_edge.flow--;
 2618|      2|            pBNS->tot_st_flow -= 2;
 2619|       |
 2620|      4|            for (j = 0; j < njFix; j++)
  ------------------
  |  Branch (2620:25): [True: 2, False: 2]
  ------------------
 2621|      2|            {
 2622|       |/* edges to fix */
 2623|      2|                ev = pBNS->edge + pBNS->vert[i].iedge[(int) MobileGr[jFix[j]].ineigh];
 2624|      2|                ev->forbidden |= forbidden_mask;
 2625|      2|            }
 2626|      2|            num_changes++;
 2627|      2|            continue;
 2628|      2|        }
 2629|     69|    case_5_7:
 2630|       |            /*********************************************************************/
 2631|     69|        if (3 == num_bonds_non_metal &&
  ------------------
  |  Branch (2631:13): [True: 34, False: 35]
  ------------------
 2632|     34|             4 == bonds_valence_non_metal &&
  ------------------
  |  Branch (2632:14): [True: 23, False: 11]
  ------------------
 2633|     23|             ( centerpoint_type == EL_TYPE_S ) &&
  ------------------
  |  |  387|     23|#define EL_TYPE_S     0x0002
  ------------------
  |  Branch (2633:14): [True: 23, False: 0]
  ------------------
 2634|     23|             2 == num_O + num_S && 1 == num_OSt && 1 == num_N &&
  ------------------
  |  Branch (2634:14): [True: 1, False: 22]
  |  Branch (2634:36): [True: 1, False: 0]
  |  Branch (2634:52): [True: 1, False: 0]
  ------------------
 2635|      1|             1 == num_forbidden && 3 == num_eql_mobile_gr &&
  ------------------
  |  Branch (2635:14): [True: 1, False: 0]
  |  Branch (2635:36): [True: 0, False: 1]
  ------------------
 2636|      0|             MobileGr[ind_forbidden].bond_type == BOND_TYPE_SINGLE)
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2636:14): [True: 0, False: 0]
  ------------------
 2637|      0|        {
 2638|       |            /********************************************************
 2639|       |             ***         InChI Tech. Man., Table 5, case 7        ***
 2640|       |             ********************************************************
 2641|       |                                               O  =  O, S, Se, Te
 2642|       |                      OH                OH     S  =  S, Se, Te
 2643|       |                     /                 /       f  =  fixed bond
 2644|       |                 e  /ev2           f  /        tg =  Mobile-H vertex
 2645|       |              HN---S      -->    N===S         X  =  N or non-endpoint;
 2646|       |              || f  \\                \
 2647|       |            ev2||     \\ev1             \
 2648|       |               tg------O                 OH
 2649|       |                                                N, O, O
 2650|       |             Problem:                           =======
 2651|       |               O, NH, OH belong to the same Mobile-H group.
 2652|       |               Fixed bond prevents the correct structure restoration:
 2653|       |               H cannot migrate from NH to O because HN-S bond is fixed
 2654|       |             Solution:
 2655|       |               Move H from NH to =O to allow HN=S bond change by making a 2nd terminal -OH
 2656|       |               (this unfixes the bond, see fix_special_bonds(...) )
 2657|       |             *********************************************************/
 2658|      0|            int jO = -1, jNH = -1, jOH = -1, n = 0;
 2659|      0|            for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (2659:25): [True: 0, False: 0]
  ------------------
 2660|      0|            {
 2661|      0|                if (( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_N &&
  ------------------
  |  |  392|      0|#define EL_TYPE_MASK  0x003f
  ------------------
                              if (( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_N &&
  ------------------
  |  |  388|      0|#define EL_TYPE_N     0x0004
  ------------------
  |  Branch (2661:21): [True: 0, False: 0]
  ------------------
 2662|      0|                     MobileGr[j].forbidden == forbidden_mask &&
  ------------------
  |  Branch (2662:22): [True: 0, False: 0]
  ------------------
 2663|      0|                     MobileGr[j].bond_type == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2663:22): [True: 0, False: 0]
  ------------------
 2664|      0|                     MobileGr[j].num_bonds_non_metal <= 2 &&
  ------------------
  |  Branch (2664:22): [True: 0, False: 0]
  ------------------
 2665|      0|                     jNH < 0)
  ------------------
  |  Branch (2665:22): [True: 0, False: 0]
  ------------------
 2666|      0|                {
 2667|      0|                    jNH = j;
 2668|      0|                    n++;
 2669|      0|                }
 2670|      0|                else
 2671|      0|                {
 2672|      0|                    if (( MobileGr[j].atom_type_pVA & ( EL_TYPE_O | EL_TYPE_S ) ) &&
  ------------------
  |  |  386|      0|#define EL_TYPE_O     0x0001
  ------------------
                                  if (( MobileGr[j].atom_type_pVA & ( EL_TYPE_O | EL_TYPE_S ) ) &&
  ------------------
  |  |  387|      0|#define EL_TYPE_S     0x0002
  ------------------
  |  Branch (2672:25): [True: 0, False: 0]
  ------------------
 2673|      0|                            !MobileGr[j].forbidden &&
  ------------------
  |  Branch (2673:29): [True: 0, False: 0]
  ------------------
 2674|      0|                            MobileGr[j].num_bonds_non_metal == 1)
  ------------------
  |  Branch (2674:29): [True: 0, False: 0]
  ------------------
 2675|      0|                    {
 2676|      0|                        if (MobileGr[j].bond_type == BOND_TYPE_DOUBLE &&
  ------------------
  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2676:29): [True: 0, False: 0]
  ------------------
 2677|      0|                             jO < 0)
  ------------------
  |  Branch (2677:30): [True: 0, False: 0]
  ------------------
 2678|      0|                        {
 2679|      0|                            jO = j;
 2680|      0|                            n++;
 2681|      0|                        }
 2682|      0|                        else
 2683|      0|                        {
 2684|      0|                            if (jOH < 0)
  ------------------
  |  Branch (2684:33): [True: 0, False: 0]
  ------------------
 2685|      0|                            {
 2686|      0|                                jOH = j;
 2687|      0|                                n++;
 2688|      0|                            }
 2689|      0|                        }
 2690|      0|                    }
 2691|      0|                }
 2692|      0|            }
 2693|      0|            if (n != 3)
  ------------------
  |  Branch (2693:17): [True: 0, False: 0]
  ------------------
 2694|      0|            {
 2695|      0|                goto case_5_9a;
 2696|      0|            }
 2697|       |            /* NH-S edge */
 2698|      0|            e = pBNS->edge + pBNS->vert[i].iedge[MobileGr[jNH].ineigh];
 2699|       |            /* S=O  edge */
 2700|      0|            ev1 = pBNS->edge + pBNS->vert[i].iedge[MobileGr[jO].ineigh];
 2701|       |            /* XH-tg edge */
 2702|      0|            ev2 = pBNS->edge + pVA[MobileGr[jNH].atom_number].nTautGroupEdge - 1;
 2703|       |
 2704|      0|            if (!ev1->flow || !ev2->flow)
  ------------------
  |  Branch (2704:17): [True: 0, False: 0]
  |  Branch (2704:31): [True: 0, False: 0]
  ------------------
 2705|      0|            {
 2706|      0|                goto case_5_9a;
 2707|      0|            }
 2708|       |
 2709|       |            /* do not remove forbidden edge bit */
 2710|      0|            e->flow++;
 2711|      0|            ev1->flow--;
 2712|      0|            ev2->flow--;
 2713|      0|            pBNS->vert[ev1->neighbor12 ^ i].st_edge.flow--; /* first =O vertex */
 2714|      0|            pBNS->vert[ev2->neighbor12 ^ ev2->neighbor1].st_edge.flow--; /* taut group vertex tg */
 2715|      0|            pBNS->tot_st_flow -= 2;
 2716|      0|            num_changes++;
 2717|      0|            continue;
 2718|      0|        }
 2719|     69|    case_5_9a:
 2720|       |            /*********************************************************************/
 2721|     69|        if (3 == num_bonds_non_metal &&
  ------------------
  |  Branch (2721:13): [True: 34, False: 35]
  ------------------
 2722|     34|             4 == bonds_valence_non_metal &&
  ------------------
  |  Branch (2722:14): [True: 23, False: 11]
  ------------------
 2723|     23|             ( centerpoint_type == EL_TYPE_S ) &&
  ------------------
  |  |  387|     23|#define EL_TYPE_S     0x0002
  ------------------
  |  Branch (2723:14): [True: 23, False: 0]
  ------------------
 2724|     23|             1 == num_O + num_S && !num_OSt && 1 <= num_N &&
  ------------------
  |  Branch (2724:14): [True: 1, False: 22]
  |  Branch (2724:36): [True: 1, False: 0]
  |  Branch (2724:48): [True: 1, False: 0]
  ------------------
 2725|      1|             1 == num_forbidden &&
  ------------------
  |  Branch (2725:14): [True: 1, False: 0]
  ------------------
 2726|      1|             num_O + num_S + num_N == num_eql_mobile_gr &&
  ------------------
  |  Branch (2726:14): [True: 1, False: 0]
  ------------------
 2727|      1|             MobileGr[ind_forbidden].bond_type == BOND_TYPE_SINGLE)
  ------------------
  |  |   32|      1|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2727:14): [True: 0, False: 1]
  ------------------
 2728|      0|        {
 2729|       |            /********************************************************
 2730|       |             ***         InChI Tech. Man., Table 5, case 9a       ***
 2731|       |             ********************************************************
 2732|       |                                               O  =  O, S, Se, Te
 2733|       |                      X                 X      S  =  S, Se, Te
 2734|       |                     /                 /       f  =  fixed bond
 2735|       |                    /                 /        tg =  Mobile-H vertex
 2736|       |              HN---S      -->    N===S         X  =  N or non-endpoint;
 2737|       |              ||    \\ e              \       -X is not -O(terminal)
 2738|       |              ||    f\\               f\
 2739|       |              tg------O                 OH
 2740|       |                                               N, N, O  or N, O
 2741|       |            Problem:                           ================
 2742|       |              O, NH belong to the same Mobile-H group.
 2743|       |              Fixed bond prevents the correct structure restoration:
 2744|       |              H cannot migrate from NH to O because O=S bond is fixed
 2745|       |            Solution:
 2746|       |              Move H from NH to =O to allow O=S bond change by making a terminal -OH
 2747|       |              (this unfixes the bond, see fix_special_bonds(...) )
 2748|       |            *********************************************************/
 2749|      0|            int jO = -1, jNH = -1, jX = -1, n = 0; /* djb-rwth: ignoring LLVM warning: variable used */
 2750|      0|            for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (2750:25): [True: 0, False: 0]
  ------------------
 2751|      0|            {
 2752|      0|                if (( MobileGr[j].atom_type_pVA & ( EL_TYPE_O | EL_TYPE_S ) ) &&
  ------------------
  |  |  386|      0|#define EL_TYPE_O     0x0001
  ------------------
                              if (( MobileGr[j].atom_type_pVA & ( EL_TYPE_O | EL_TYPE_S ) ) &&
  ------------------
  |  |  387|      0|#define EL_TYPE_S     0x0002
  ------------------
  |  Branch (2752:21): [True: 0, False: 0]
  ------------------
 2753|      0|                     MobileGr[j].forbidden == forbidden_mask &&
  ------------------
  |  Branch (2753:22): [True: 0, False: 0]
  ------------------
 2754|      0|                     MobileGr[j].bond_type == BOND_TYPE_DOUBLE &&
  ------------------
  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2754:22): [True: 0, False: 0]
  ------------------
 2755|      0|                     MobileGr[j].num_bonds_non_metal == 1 &&
  ------------------
  |  Branch (2755:22): [True: 0, False: 0]
  ------------------
 2756|      0|                     jO < 0)
  ------------------
  |  Branch (2756:22): [True: 0, False: 0]
  ------------------
 2757|      0|                {
 2758|      0|                    jO = j;
 2759|      0|                    n++;
 2760|      0|                }
 2761|      0|                else
 2762|      0|                {
 2763|      0|                    if (( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_N &&
  ------------------
  |  |  392|      0|#define EL_TYPE_MASK  0x003f
  ------------------
                                  if (( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_N &&
  ------------------
  |  |  388|      0|#define EL_TYPE_N     0x0004
  ------------------
  |  Branch (2763:25): [True: 0, False: 0]
  ------------------
 2764|      0|                            !MobileGr[j].forbidden &&
  ------------------
  |  Branch (2764:29): [True: 0, False: 0]
  ------------------
 2765|      0|                            MobileGr[j].bond_type == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2765:29): [True: 0, False: 0]
  ------------------
 2766|      0|                            jNH < 0)
  ------------------
  |  Branch (2766:29): [True: 0, False: 0]
  ------------------
 2767|      0|                    {
 2768|      0|                        jNH = j;
 2769|      0|                        n++;
 2770|      0|                    }
 2771|      0|                    else
 2772|      0|                    {
 2773|      0|                        if (jX < 0)
  ------------------
  |  Branch (2773:29): [True: 0, False: 0]
  ------------------
 2774|      0|                        {
 2775|      0|                            jX = j;
 2776|      0|                            n++;
 2777|      0|                        }
 2778|      0|                    }
 2779|      0|                }
 2780|      0|            }
 2781|      0|            if (jO < 0 || jNH < 0)
  ------------------
  |  Branch (2781:17): [True: 0, False: 0]
  |  Branch (2781:27): [True: 0, False: 0]
  ------------------
 2782|      0|            {
 2783|      0|                goto case_5_8b_to_9b;
 2784|      0|            }
 2785|       |
 2786|      0|            e = pBNS->edge + pBNS->vert[i].iedge[MobileGr[ind_forbidden].ineigh];
 2787|      0|            if (!e->flow)
  ------------------
  |  Branch (2787:17): [True: 0, False: 0]
  ------------------
 2788|      0|            {
 2789|      0|                goto case_5_8b_to_9b;
 2790|      0|            }
 2791|      0|            e->flow--;
 2792|      0|            pBNS->vert[e->neighbor1].st_edge.flow--;
 2793|      0|            pBNS->vert[e->neighbor1 ^ e->neighbor12].st_edge.flow--;
 2794|      0|            pBNS->tot_st_flow -= 2;
 2795|      0|            num_changes++;
 2796|      0|            continue;
 2797|      0|        }
 2798|     69|    case_5_8b_to_9b: /* #1 */
 2799|       |            /*********************************************************************/
 2800|     69|        if (3 == num_bonds_non_metal &&
  ------------------
  |  Branch (2800:13): [True: 34, False: 35]
  ------------------
 2801|     34|             4 == bonds_valence_non_metal &&
  ------------------
  |  Branch (2801:14): [True: 23, False: 11]
  ------------------
 2802|     23|             ( centerpoint_type == EL_TYPE_S ) &&
  ------------------
  |  |  387|     23|#define EL_TYPE_S     0x0002
  ------------------
  |  Branch (2802:14): [True: 23, False: 0]
  ------------------
 2803|     23|             0 == num_O + num_S && 2 == num_N && 0 == num_P && !num_OSt &&
  ------------------
  |  Branch (2803:14): [True: 21, False: 2]
  |  Branch (2803:36): [True: 20, False: 1]
  |  Branch (2803:50): [True: 20, False: 0]
  |  Branch (2803:64): [True: 20, False: 0]
  ------------------
 2804|     20|             1 == num_forbidden &&
  ------------------
  |  Branch (2804:14): [True: 14, False: 6]
  ------------------
 2805|     14|             1 == num_eql_mobile_gr && 0 == num_dif_mobile_gr &&
  ------------------
  |  Branch (2805:14): [True: 12, False: 2]
  |  Branch (2805:40): [True: 12, False: 0]
  ------------------
 2806|     12|             1 == num_donor_endpoints && 0 == num_acceptor_endpoints &&
  ------------------
  |  Branch (2806:14): [True: 12, False: 0]
  |  Branch (2806:42): [True: 12, False: 0]
  ------------------
 2807|     12|             1 == num_donors && 1 == num_acceptors &&
  ------------------
  |  Branch (2807:14): [True: 12, False: 0]
  |  Branch (2807:33): [True: 12, False: 0]
  ------------------
 2808|     12|             MobileGr[ind_forbidden].bond_type == BOND_TYPE_SINGLE)
  ------------------
  |  |   32|     12|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2808:14): [True: 11, False: 1]
  ------------------
 2809|     11|        {
 2810|       |            /********************************************************
 2811|       |             ***         InChI Tech. Man., Table 5, case 8b->9b   ***
 2812|       |             ********************************************************
 2813|       |                             --->                    O  =  O, S, Se, Te
 2814|       |                      X                  X           S  =  S, Se, Te
 2815|       |             \      f/          \      f/            f  =  fixed bond
 2816|       |              \ ev  /  C=====Z   \     /  C-----ZH   tg =  Mobile-H vertex
 2817|       |               N===S   |     |    N===S  ||     ||   X  =  is N not an endpoint;
 2818|       |             not    \  |     |         \ ||     ||  -X is not terminal -O,-S,-Se,-Te or
 2819|       |             an      \ |  e  |          \||  e  ||        any N, P, As
 2820|       |            endpoint   NH=====tg          N------tg
 2821|       |                      is an                   f       N, N, X, fixed single
 2822|       |                    endpoint                          =====================
 2823|       |
 2824|       |             Problem:
 2825|       |               N is not a Mobile-H endpoint, NH is a Mobile-H endpoint
 2826|       |               Unfixed bond N==S prevents the correct structure restoration:
 2827|       |               H can migrate from NH to N because N=S bond is not fixed
 2828|       |             Solution:
 2829|       |               Move H from NH to =Z to make N=S bond fixed (Table 5, case 9)
 2830|       |               (this unfixes the bond, see fix_special_bonds(...) )
 2831|       |             *********************************************************/
 2832|     11|            int jN = -1, jNH = -1, jX = -1, n = 0;
 2833|     44|            for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (2833:25): [True: 33, False: 11]
  ------------------
 2834|     33|            {
 2835|     33|                if (( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_N &&
  ------------------
  |  |  392|     33|#define EL_TYPE_MASK  0x003f
  ------------------
                              if (( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_N &&
  ------------------
  |  |  388|     66|#define EL_TYPE_N     0x0004
  ------------------
  |  Branch (2835:21): [True: 23, False: 10]
  ------------------
 2836|     23|                     !( MobileGr[j].forbidden & forbidden_mask ))
  ------------------
  |  Branch (2836:22): [True: 22, False: 1]
  ------------------
 2837|     22|                {
 2838|     22|                    if (MobileGr[j].bond_type == BOND_TYPE_DOUBLE &&
  ------------------
  |  |   33|     44|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2838:25): [True: 11, False: 11]
  ------------------
 2839|     11|                         !at[MobileGr[j].atom_number].endpoint &&
  ------------------
  |  Branch (2839:26): [True: 11, False: 0]
  ------------------
 2840|     11|                         jN < 0)
  ------------------
  |  Branch (2840:26): [True: 11, False: 0]
  ------------------
 2841|     11|                    {
 2842|     11|                        jN = j;
 2843|     11|                        n++;
 2844|     11|                    }
 2845|     11|                    else
 2846|     11|                    {
 2847|     11|                        if (MobileGr[j].bond_type == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|     22|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2847:29): [True: 11, False: 0]
  ------------------
 2848|     11|                              MobileGr[j].num_bonds == 2 &&
  ------------------
  |  Branch (2848:31): [True: 11, False: 0]
  ------------------
 2849|     11|                              MobileGr[j].bonds_valence == 2 &&
  ------------------
  |  Branch (2849:31): [True: 11, False: 0]
  ------------------
 2850|     11|                              at[MobileGr[j].atom_number].endpoint &&
  ------------------
  |  Branch (2850:31): [True: 11, False: 0]
  ------------------
 2851|     11|                              jNH < 0)
  ------------------
  |  Branch (2851:31): [True: 11, False: 0]
  ------------------
 2852|     11|                        {
 2853|     11|                            jNH = j;
 2854|     11|                            n++;
 2855|     11|                        }
 2856|     11|                    }
 2857|     22|                }
 2858|     11|                else
 2859|     11|                {
 2860|     11|                    if (!( ( MobileGr[j].atom_type_pVA & ( EL_TYPE_N | EL_TYPE_P ) ) ||
  ------------------
  |  |  388|     11|#define EL_TYPE_N     0x0004
  ------------------
                                  if (!( ( MobileGr[j].atom_type_pVA & ( EL_TYPE_N | EL_TYPE_P ) ) ||
  ------------------
  |  |  389|     11|#define EL_TYPE_P     0x0008
  ------------------
  |  Branch (2860:28): [True: 1, False: 10]
  ------------------
 2861|     10|                        (( MobileGr[j].atom_type_pVA & ( EL_TYPE_O | EL_TYPE_S ) ) &&
  ------------------
  |  |  386|     10|#define EL_TYPE_O     0x0001
  ------------------
                                      (( MobileGr[j].atom_type_pVA & ( EL_TYPE_O | EL_TYPE_S ) ) &&
  ------------------
  |  |  387|     10|#define EL_TYPE_S     0x0002
  ------------------
  |  Branch (2861:26): [True: 6, False: 4]
  ------------------
 2862|      6|                           MobileGr[j].num_bonds > 1 )) &&
  ------------------
  |  Branch (2862:28): [True: 6, False: 0]
  ------------------
 2863|      4|                           ( MobileGr[j].forbidden & forbidden_mask ) &&
  ------------------
  |  Branch (2863:28): [True: 4, False: 0]
  ------------------
 2864|      4|                            MobileGr[j].bond_type == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|     15|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2864:29): [True: 4, False: 0]
  ------------------
 2865|      4|                            jX < 0) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2865:29): [True: 4, False: 0]
  ------------------
 2866|      4|                    {
 2867|      4|                        jX = j;
 2868|      4|                        n++;
 2869|      4|                    }
 2870|     11|                }
 2871|     33|            }
 2872|     11|            if (n != 3)
  ------------------
  |  Branch (2872:17): [True: 7, False: 4]
  ------------------
 2873|      7|            {
 2874|      7|                goto case_5_8c_to_9c;
 2875|      7|            }
 2876|       |
 2877|      4|            e = pBNS->edge + pVA[MobileGr[jNH].atom_number].nTautGroupEdge - 1;
 2878|      4|            if (!e->flow)
  ------------------
  |  Branch (2878:17): [True: 1, False: 3]
  ------------------
 2879|      1|            {
 2880|      1|                goto case_5_8c_to_9c; /* should not happen ??? */
 2881|      1|            }
 2882|      3|            e->flow--;
 2883|      3|            pBNS->vert[e->neighbor1].st_edge.flow--;
 2884|      3|            pBNS->vert[e->neighbor1 ^ e->neighbor12].st_edge.flow--;
 2885|      3|            pBNS->tot_st_flow -= 2;
 2886|      3|            e->forbidden |= forbidden_mask;
 2887|      3|            num_changes++;
 2888|      3|            continue;
 2889|      4|        }
 2890|     66|    case_5_8c_to_9c: /* #2 */
 2891|       |            /*********************************************************************/
 2892|     66|        if (3 == num_bonds_non_metal &&
  ------------------
  |  Branch (2892:13): [True: 31, False: 35]
  ------------------
 2893|     31|             4 == bonds_valence_non_metal &&
  ------------------
  |  Branch (2893:14): [True: 20, False: 11]
  ------------------
 2894|     20|             ( centerpoint_type == EL_TYPE_S ) &&
  ------------------
  |  |  387|     20|#define EL_TYPE_S     0x0002
  ------------------
  |  Branch (2894:14): [True: 20, False: 0]
  ------------------
 2895|     20|             0 == num_O + num_S && 3 == num_N && 0 == num_P &&
  ------------------
  |  Branch (2895:14): [True: 18, False: 2]
  |  Branch (2895:36): [True: 1, False: 17]
  |  Branch (2895:50): [True: 1, False: 0]
  ------------------
 2896|      1|             1 == num_forbidden &&
  ------------------
  |  Branch (2896:14): [True: 1, False: 0]
  ------------------
 2897|      1|             3 == num_eql_mobile_gr && 0 == num_dif_mobile_gr &&
  ------------------
  |  Branch (2897:14): [True: 0, False: 1]
  |  Branch (2897:40): [True: 0, False: 0]
  ------------------
 2898|      0|             2 == num_donor_endpoints && 1 == num_acceptor_endpoints &&
  ------------------
  |  Branch (2898:14): [True: 0, False: 0]
  |  Branch (2898:42): [True: 0, False: 0]
  ------------------
 2899|      0|             2 == num_donors && 1 == num_acceptors &&
  ------------------
  |  Branch (2899:14): [True: 0, False: 0]
  |  Branch (2899:33): [True: 0, False: 0]
  ------------------
 2900|      0|             MobileGr[ind_forbidden].bond_type == BOND_TYPE_SINGLE)
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2900:14): [True: 0, False: 0]
  ------------------
 2901|      0|        {
 2902|       |            /********************************************************
 2903|       |             ***         InChI Tech. Man., Table 5, case 8c->9c   ***
 2904|       |             ********************************************************
 2905|       |                is an endpoint --->                  O  =  O, S, Se, Te
 2906|       |                      NH2(X)             NH2(X)      S  =  S, Se, Te
 2907|       |             \       / pv1  pv2 \       /            f  =  fixed bond
 2908|       |              \ 1   /  C-----ZH  \     /  C=====Z    tg =  Mobile-H vertex
 2909|       |               N===S  ||     ||   N===S   |     |    X  =  is N not an endpoint;
 2910|       |            is an   \f||ev1  ||ev2     \f |     |   -X is not terminal -O,-S,-Se,-Te or
 2911|       |            endpoint   \||  e  ||         \ |  e  |         any N, P, As
 2912|       |                      2 N------tg          NH=====tg   C is a centerpoint of a t-group
 2913|       |                       is an                   f       N, N, X, fixed single
 2914|       |                     endpoint                          =====================
 2915|       |
 2916|       |              Problem:
 2917|       |                N is not a Mobile-H endpoint, NH is a Mobile-H endpoint
 2918|       |                Unfixed bond N==S prevents the correct structure restoration:
 2919|       |                H can migrate from NH to N because N=S bond is not fixed
 2920|       |              Solution:
 2921|       |                Move H from NH to =Z to make N=S bond fixed (Table 5, case 9)
 2922|       |                (this unfixes the bond, see fix_special_bonds(...) )
 2923|       |              *********************************************************/
 2924|      0|            int jN1 = -1, jN2 = -1, jX = -1, n = 0;
 2925|      0|            EdgeIndex ie1, ie2; /* djb-rwth: removing redundant variables */
 2926|      0|            for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (2926:25): [True: 0, False: 0]
  ------------------
 2927|      0|            {
 2928|      0|                if (( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_N &&
  ------------------
  |  |  392|      0|#define EL_TYPE_MASK  0x003f
  ------------------
                              if (( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_N &&
  ------------------
  |  |  388|      0|#define EL_TYPE_N     0x0004
  ------------------
  |  Branch (2928:21): [True: 0, False: 0]
  ------------------
 2929|      0|                     !( MobileGr[j].forbidden & forbidden_mask ))
  ------------------
  |  Branch (2929:22): [True: 0, False: 0]
  ------------------
 2930|      0|                {
 2931|      0|                    if (MobileGr[j].bond_type == BOND_TYPE_DOUBLE &&
  ------------------
  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2931:25): [True: 0, False: 0]
  ------------------
 2932|      0|                         at[MobileGr[j].atom_number].endpoint &&
  ------------------
  |  Branch (2932:26): [True: 0, False: 0]
  ------------------
 2933|      0|                         jN1 < 0)
  ------------------
  |  Branch (2933:26): [True: 0, False: 0]
  ------------------
 2934|      0|                    {
 2935|      0|                        jN1 = j;
 2936|      0|                        n++;
 2937|      0|                    }
 2938|      0|                    else
 2939|      0|                    {
 2940|      0|                        if (MobileGr[j].bond_type == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2940:29): [True: 0, False: 0]
  ------------------
 2941|      0|                                MobileGr[j].num_bonds == 2 &&
  ------------------
  |  Branch (2941:33): [True: 0, False: 0]
  ------------------
 2942|      0|                                MobileGr[j].bonds_valence == 3 &&
  ------------------
  |  Branch (2942:33): [True: 0, False: 0]
  ------------------
 2943|      0|                                MobileGr[j].forbidden == forbidden_mask &&
  ------------------
  |  Branch (2943:33): [True: 0, False: 0]
  ------------------
 2944|      0|                                at[MobileGr[j].atom_number].endpoint &&
  ------------------
  |  Branch (2944:33): [True: 0, False: 0]
  ------------------
 2945|      0|                                jN2 < 0)
  ------------------
  |  Branch (2945:33): [True: 0, False: 0]
  ------------------
 2946|      0|                        {
 2947|      0|                            jN2 = j;
 2948|      0|                            n++;
 2949|      0|                        }
 2950|      0|                        else
 2951|      0|                        {
 2952|      0|                            if (MobileGr[j].bond_type == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2952:33): [True: 0, False: 0]
  ------------------
 2953|      0|                                  MobileGr[j].num_bonds <= 2 &&
  ------------------
  |  Branch (2953:35): [True: 0, False: 0]
  ------------------
 2954|      0|                                  MobileGr[j].bonds_valence <= 3 &&
  ------------------
  |  Branch (2954:35): [True: 0, False: 0]
  ------------------
 2955|      0|                                  at[MobileGr[j].atom_number].endpoint &&
  ------------------
  |  Branch (2955:35): [True: 0, False: 0]
  ------------------
 2956|      0|                                  jX < 0)
  ------------------
  |  Branch (2956:35): [True: 0, False: 0]
  ------------------
 2957|      0|                            {
 2958|      0|                                jX = j;
 2959|      0|                                n++;
 2960|      0|                            }
 2961|      0|                        }
 2962|      0|                    }
 2963|      0|                }
 2964|      0|            }
 2965|      0|            if (n != 3)
  ------------------
  |  Branch (2965:17): [True: 0, False: 0]
  ------------------
 2966|      0|            {
 2967|      0|                goto case_5_9b_to_8b;
 2968|      0|            }
 2969|       |
 2970|      0|            e = pBNS->edge + pVA[MobileGr[jN2].atom_number].nTautGroupEdge - 1;
 2971|      0|            if (e->flow)
  ------------------
  |  Branch (2971:17): [True: 0, False: 0]
  ------------------
 2972|      0|            {
 2973|      0|                goto case_5_9b_to_8b; /* should not happen ??? */
 2974|      0|            }
 2975|      0|            pv1 = pBNS->vert + e->neighbor1;  /* must be jN2 */
 2976|      0|            pv2 = pBNS->vert + ( e->neighbor1 ^ e->neighbor12 );
 2977|       |            /* djb-rwth: removing redundant code */
 2978|      0|            ie1 = ie2 = -1;
 2979|      0|            for (j = 0; j < pv1->num_adj_edges; j++)
  ------------------
  |  Branch (2979:25): [True: 0, False: 0]
  ------------------
 2980|      0|            {
 2981|      0|                ev1 = pBNS->edge + pv1->iedge[j];
 2982|      0|                if (ev1->flow && !ev1->forbidden)
  ------------------
  |  Branch (2982:21): [True: 0, False: 0]
  |  Branch (2982:34): [True: 0, False: 0]
  ------------------
 2983|      0|                {
 2984|      0|                    ie1 = (int) ( ev1 - pBNS->edge );
 2985|      0|                    pv1 = pBNS->vert + ( ev1->neighbor12 ^ ( pv1 - pBNS->vert ) );
 2986|      0|                    break;
 2987|      0|                }
 2988|      0|            }
 2989|      0|            for (j = 0; j < pv2->num_adj_edges; j++)
  ------------------
  |  Branch (2989:25): [True: 0, False: 0]
  ------------------
 2990|      0|            {
 2991|      0|                ev2 = pBNS->edge + pv2->iedge[j];
 2992|      0|                if (ev2->flow && !ev2->forbidden)
  ------------------
  |  Branch (2992:21): [True: 0, False: 0]
  |  Branch (2992:34): [True: 0, False: 0]
  ------------------
 2993|      0|                {
 2994|      0|                    ie2 = (int) ( ev2 - pBNS->edge );
 2995|      0|                    pv2 = pBNS->vert + ( ev2->neighbor12 ^ ( pv2 - pBNS->vert ) );
 2996|      0|                    break;
 2997|      0|                }
 2998|      0|            }
 2999|      0|            if (ie1 < 0 || ie2 < 0)
  ------------------
  |  Branch (2999:17): [True: 0, False: 0]
  |  Branch (2999:28): [True: 0, False: 0]
  ------------------
 3000|      0|            {
 3001|      0|                goto case_5_9b_to_8b;
 3002|      0|            }
 3003|      0|            e->flow++;
 3004|      0|            e->forbidden |= forbidden_mask;
 3005|      0|            ev1->flow--;
 3006|      0|            ev2->flow--;
 3007|      0|            pv1->st_edge.flow--;
 3008|      0|            pv2->st_edge.flow--;
 3009|      0|            pBNS->tot_st_flow -= 2;
 3010|      0|            num_changes++;
 3011|      0|            continue;
 3012|      0|        }
 3013|     66|    case_5_9b_to_8b: /* #3 */
 3014|       |            /*********************************************************************/
 3015|     66|        if (3 == num_bonds_non_metal &&
  ------------------
  |  Branch (3015:13): [True: 31, False: 35]
  ------------------
 3016|     31|             4 == bonds_valence_non_metal &&
  ------------------
  |  Branch (3016:14): [True: 20, False: 11]
  ------------------
 3017|     20|             ( centerpoint_type == EL_TYPE_S ) &&
  ------------------
  |  |  387|     20|#define EL_TYPE_S     0x0002
  ------------------
  |  Branch (3017:14): [True: 20, False: 0]
  ------------------
 3018|     20|             0 == num_O + num_S && 2 == num_N && 0 == num_P &&
  ------------------
  |  Branch (3018:14): [True: 18, False: 2]
  |  Branch (3018:36): [True: 17, False: 1]
  |  Branch (3018:50): [True: 17, False: 0]
  ------------------
 3019|     17|             1 == num_forbidden &&
  ------------------
  |  Branch (3019:14): [True: 11, False: 6]
  ------------------
 3020|     11|             2 == num_eql_mobile_gr && 0 == num_dif_mobile_gr &&
  ------------------
  |  Branch (3020:14): [True: 2, False: 9]
  |  Branch (3020:40): [True: 2, False: 0]
  ------------------
 3021|      2|             1 == num_donor_endpoints && 1 == num_acceptor_endpoints &&
  ------------------
  |  Branch (3021:14): [True: 2, False: 0]
  |  Branch (3021:42): [True: 2, False: 0]
  ------------------
 3022|      2|             1 == num_donors && 1 == num_acceptors &&
  ------------------
  |  Branch (3022:14): [True: 2, False: 0]
  |  Branch (3022:33): [True: 2, False: 0]
  ------------------
 3023|      2|             MobileGr[ind_forbidden].bond_type == BOND_TYPE_DOUBLE)
  ------------------
  |  |   33|      2|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (3023:14): [True: 2, False: 0]
  ------------------
 3024|      2|        {
 3025|       |            /********************************************************
 3026|       |                ***         InChI Tech. Man., Table 5, case 9b->8b   ***
 3027|       |                ********************************************************
 3028|       |                            --->                      O  =  O, S, Se, Te
 3029|       |                    X    is an              X          S  =  S, Se, Te
 3030|       |            \       /   endpoint    \       /           f  =  fixed bond
 3031|       |                \ 1ev /  C-----ZH       \     /  C=====Z   tg =  Mobile-H vertex
 3032|       |                N===S  ||     ||        N===S   |     |   X  =  is N not an endpoint;
 3033|       |            is an  f  \ ||     ||          f  \  |     |  -X is not terminal -O,-S,-Se,-Te or
 3034|       |            endpoint     2\||  e  ||              \ |  e  |        any N, P, As
 3035|       |                            N------tg               NH=====tg
 3036|       |                        is an                          f      N, N, X, fixed double
 3037|       |                        endpoint                                 =====================
 3038|       |
 3039|       |                        Problem:
 3040|       |                        N1 and N2 are Mobile-H endpoints and belong to the same Mobile-H group.
 3041|       |                        Fixed bond N1==S prevents the correct structure restoration:
 3042|       |                        H cannot migrate ZH->N2->N1 because N1=S bond is fixed
 3043|       |                        Solution:
 3044|       |                        Move H from ZH to N2 to make N1=S bond unfixed and fix S-X bond (Table 5, case 8)
 3045|       |                        (see fix_special_bonds(...) for details )
 3046|       |                        *********************************************************/
 3047|      2|            int jN1 = -1, jN2 = -1, jX = -1, n = 0; /* djb-rwth: ignoring LLVM warning: variable used */
 3048|      2|            EdgeIndex ie1, ie2; /* djb-rwth: removing redundant variables */
 3049|      6|            for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (3049:25): [True: 4, False: 2]
  ------------------
 3050|      4|            {
 3051|      4|                if (( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_N)
  ------------------
  |  |  392|      4|#define EL_TYPE_MASK  0x003f
  ------------------
                              if (( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_N)
  ------------------
  |  |  388|      4|#define EL_TYPE_N     0x0004
  ------------------
  |  Branch (3051:21): [True: 4, False: 0]
  ------------------
 3052|      4|                {
 3053|      4|                    if (MobileGr[j].bond_type == BOND_TYPE_DOUBLE &&
  ------------------
  |  |   33|      8|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (3053:25): [True: 2, False: 2]
  ------------------
 3054|      2|                         at[MobileGr[j].atom_number].endpoint &&
  ------------------
  |  Branch (3054:26): [True: 2, False: 0]
  ------------------
 3055|      2|                         ( MobileGr[j].forbidden == forbidden_mask ) &&
  ------------------
  |  Branch (3055:26): [True: 2, False: 0]
  ------------------
 3056|      2|                         jN1 < 0)
  ------------------
  |  Branch (3056:26): [True: 2, False: 0]
  ------------------
 3057|      2|                    {
 3058|      2|                        jN1 = j;
 3059|      2|                        n++;
 3060|      2|                    }
 3061|      2|                    else
 3062|      2|                    {
 3063|      2|                        if (MobileGr[j].bond_type == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|      4|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (3063:29): [True: 2, False: 0]
  ------------------
 3064|      2|                              MobileGr[j].num_bonds == 2 &&
  ------------------
  |  Branch (3064:31): [True: 2, False: 0]
  ------------------
 3065|      2|                              MobileGr[j].bonds_valence == 3 &&
  ------------------
  |  Branch (3065:31): [True: 2, False: 0]
  ------------------
 3066|      2|                              at[MobileGr[j].atom_number].endpoint &&
  ------------------
  |  Branch (3066:31): [True: 2, False: 0]
  ------------------
 3067|      2|                              !( MobileGr[j].forbidden & forbidden_mask ) &&
  ------------------
  |  Branch (3067:31): [True: 2, False: 0]
  ------------------
 3068|      2|                              jN2 < 0)
  ------------------
  |  Branch (3068:31): [True: 2, False: 0]
  ------------------
 3069|      2|                        {
 3070|      2|                            jN2 = j;
 3071|      2|                            n++;
 3072|      2|                        }
 3073|      2|                    }
 3074|      4|                }
 3075|      0|                else
 3076|      0|                {
 3077|      0|                    if (!( ( MobileGr[j].atom_type_pVA & ( EL_TYPE_N | EL_TYPE_P ) ) ||
  ------------------
  |  |  388|      0|#define EL_TYPE_N     0x0004
  ------------------
                                  if (!( ( MobileGr[j].atom_type_pVA & ( EL_TYPE_N | EL_TYPE_P ) ) ||
  ------------------
  |  |  389|      0|#define EL_TYPE_P     0x0008
  ------------------
  |  Branch (3077:28): [True: 0, False: 0]
  ------------------
 3078|      0|                        (( MobileGr[j].atom_type_pVA & ( EL_TYPE_O | EL_TYPE_S ) ) &&
  ------------------
  |  |  386|      0|#define EL_TYPE_O     0x0001
  ------------------
                                      (( MobileGr[j].atom_type_pVA & ( EL_TYPE_O | EL_TYPE_S ) ) &&
  ------------------
  |  |  387|      0|#define EL_TYPE_S     0x0002
  ------------------
  |  Branch (3078:26): [True: 0, False: 0]
  ------------------
 3079|      0|                           MobileGr[j].num_bonds > 1 )) &&
  ------------------
  |  Branch (3079:28): [True: 0, False: 0]
  ------------------
 3080|      0|                            !( MobileGr[j].forbidden & forbidden_mask ) &&
  ------------------
  |  Branch (3080:29): [True: 0, False: 0]
  ------------------
 3081|      0|                            MobileGr[j].bond_type == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (3081:29): [True: 0, False: 0]
  ------------------
 3082|      0|                            jX < 0) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3082:29): [True: 0, False: 0]
  ------------------
 3083|      0|                    {
 3084|      0|                        jX = j;
 3085|      0|                        n++;
 3086|      0|                    }
 3087|      0|                }
 3088|      4|            }
 3089|      2|            if (jN1 < 0 || jN2 < 0)
  ------------------
  |  Branch (3089:17): [True: 0, False: 2]
  |  Branch (3089:28): [True: 0, False: 2]
  ------------------
 3090|      0|            {
 3091|      0|                goto case_5_9c_to_8c;
 3092|      0|            }
 3093|       |
 3094|      2|            ev = pBNS->edge + pBNS->vert[i].iedge[MobileGr[jN1].ineigh];
 3095|      2|            e = pBNS->edge + pVA[MobileGr[jN2].atom_number].nTautGroupEdge - 1;
 3096|      2|            if (e->flow)
  ------------------
  |  Branch (3096:17): [True: 0, False: 2]
  ------------------
 3097|      0|            {
 3098|      0|                goto case_5_9c_to_8c; /* should not happen ??? */
 3099|      0|            }
 3100|      2|            pv1 = pBNS->vert + e->neighbor1;  /* must be jN2 */
 3101|      2|            pv2 = pBNS->vert + ( e->neighbor1 ^ e->neighbor12 );
 3102|       |            /* djb-rwth: removing redundant code */
 3103|      2|            ie1 = ie2 = -1;
 3104|      2|            ev->forbidden &= inv_forbidden_mask;
 3105|      4|            for (j = 0; j < pv1->num_adj_edges; j++)
  ------------------
  |  Branch (3105:25): [True: 4, False: 0]
  ------------------
 3106|      4|            {
 3107|      4|                ev1 = pBNS->edge + pv1->iedge[j];
 3108|      4|                if (ev1->flow && !ev1->forbidden)
  ------------------
  |  Branch (3108:21): [True: 2, False: 2]
  |  Branch (3108:34): [True: 2, False: 0]
  ------------------
 3109|      2|                {
 3110|      2|                    ie1 = (int) ( ev1 - pBNS->edge );
 3111|      2|                    pv1 = pBNS->vert + ( ev1->neighbor12 ^ ( pv1 - pBNS->vert ) );
 3112|      2|                    break;
 3113|      2|                }
 3114|      4|            }
 3115|      5|            for (j = 0; j < pv2->num_adj_edges; j++)
  ------------------
  |  Branch (3115:25): [True: 5, False: 0]
  ------------------
 3116|      5|            {
 3117|      5|                ev2 = pBNS->edge + pv2->iedge[j];
 3118|      5|                if (ev2->flow && !ev2->forbidden)
  ------------------
  |  Branch (3118:21): [True: 2, False: 3]
  |  Branch (3118:34): [True: 2, False: 0]
  ------------------
 3119|      2|                {
 3120|      2|                    ie2 = (int) ( ev2 - pBNS->edge );
 3121|      2|                    pv2 = pBNS->vert + ( ev2->neighbor12 ^ ( pv2 - pBNS->vert ) );
 3122|      2|                    break;
 3123|      2|                }
 3124|      5|            }
 3125|      2|            if (ie1 < 0 || ie2 < 0)
  ------------------
  |  Branch (3125:17): [True: 0, False: 2]
  |  Branch (3125:28): [True: 0, False: 2]
  ------------------
 3126|      0|            {
 3127|      0|                ev->forbidden |= forbidden_mask; /* failed; restore the forbidden bit */
 3128|      0|                goto case_5_9c_to_8c;
 3129|      0|            }
 3130|      2|            e->flow++;
 3131|      2|            e->forbidden |= forbidden_mask;
 3132|      2|            ev1->flow--;
 3133|      2|            ev2->flow--;
 3134|      2|            pv1->st_edge.flow--;
 3135|      2|            pv2->st_edge.flow--;
 3136|      2|            pBNS->tot_st_flow -= 2;
 3137|      2|            num_changes++;
 3138|      2|            continue;
 3139|      2|        }
 3140|     64|    case_5_9c_to_8c: /* #4 */
 3141|       |            /*********************************************************************/
 3142|     64|        if (3 == num_bonds_non_metal &&
  ------------------
  |  Branch (3142:13): [True: 29, False: 35]
  ------------------
 3143|     29|             4 == bonds_valence_non_metal &&
  ------------------
  |  Branch (3143:14): [True: 18, False: 11]
  ------------------
 3144|     18|             ( centerpoint_type == EL_TYPE_S ) &&
  ------------------
  |  |  387|     18|#define EL_TYPE_S     0x0002
  ------------------
  |  Branch (3144:14): [True: 18, False: 0]
  ------------------
 3145|     18|             0 == num_O + num_S && 3 == num_N && 0 == num_P &&
  ------------------
  |  Branch (3145:14): [True: 16, False: 2]
  |  Branch (3145:36): [True: 1, False: 15]
  |  Branch (3145:50): [True: 1, False: 0]
  ------------------
 3146|      1|             0 == num_forbidden &&
  ------------------
  |  Branch (3146:14): [True: 0, False: 1]
  ------------------
 3147|      0|             2 == num_diff_t_groups && 2 == num_mgroups && /* all neighbors belong to 2 t-groups */
  ------------------
  |  Branch (3147:14): [True: 0, False: 0]
  |  Branch (3147:40): [True: 0, False: 0]
  ------------------
 3148|      0|             3 == num_eql_mobile_gr + num_dif_mobile_gr && /* all 3 neighbors belong to t-groups */
  ------------------
  |  Branch (3148:14): [True: 0, False: 0]
  ------------------
 3149|      0|             2 == num_donor_endpoints && 1 == num_acceptor_endpoints &&
  ------------------
  |  Branch (3149:14): [True: 0, False: 0]
  |  Branch (3149:42): [True: 0, False: 0]
  ------------------
 3150|      0|             2 == num_donors && 1 == num_acceptors)
  ------------------
  |  Branch (3150:14): [True: 0, False: 0]
  |  Branch (3150:33): [True: 0, False: 0]
  ------------------
 3151|      0|        {
 3152|       |            /********************************************************
 3153|       |             ***         InChI Tech. Man., Table 5, case 8c->9c   ***
 3154|       |             ********************************************************
 3155|       |                is an endpoint --->                  O  =  O, S, Se, Te
 3156|       |                tg1   NH2(X)             NH2(X)      S  =  S, Se, Te
 3157|       |             \       / pv1  pv2 \       /            f  =  fixed bond
 3158|       |              \(1)  /  C=====Z   \     /  C-----ZH   tg =  Mobile-H vertex
 3159|       |               N===S   |     |    N===S  ||     ||   X  =  is N not an endpoint;
 3160|       |            is an   \  |ev1  | ev2     \ ||     ||  -X is not terminal -O,-S,-Se,-Te or
 3161|       |            endpoint   \ |  e  |          \||  e  ||        any N, P, As
 3162|       |            tg1      (2)NH=====tg          N------tg   C is a centerpoint of a t-group
 3163|       |                       is an                   f       N, N, X, fixed single
 3164|       |                     endpoint                          =====================
 3165|       |                     tg2
 3166|       |              Problem:
 3167|       |                N (1) and NH2 are Mobile-H group 1 endpoiints, NH (2) is a Mobile-H group 2 endpoint
 3168|       |                Unfixed bonds N==S--NH(2) allows the two Mobile H groups to merge
 3169|       |                hence prevents the correct structure restoration:
 3170|       |                H can migrate from NH (2) to N (1) because S-NH(1) bond is not fixed
 3171|       |              Solution:
 3172|       |                Move H from NH(2) to =Z to make S-NH(2) bond fixed (Table 5, case 8c)
 3173|       |                (this unfixes the bond, see fix_special_bonds(...) )
 3174|       |              *********************************************************/
 3175|      0|            int jN1 = -1, jN2 = -1, jX = -1, n = 0;
 3176|       |            /* find t-group that is represented by only one neighbor */
 3177|      0|            for (j = 0, k = 0; j < num_mgroups; j++)
  ------------------
  |  Branch (3177:32): [True: 0, False: 0]
  ------------------
 3178|      0|            {
 3179|      0|                if (1 == MGroups[k].num && MGroups[k].group_number)
  ------------------
  |  Branch (3179:21): [True: 0, False: 0]
  |  Branch (3179:44): [True: 0, False: 0]
  ------------------
 3180|      0|                {
 3181|      0|                    k = MGroups[k].group_number;
 3182|      0|                    break;
 3183|      0|                }
 3184|      0|            }
 3185|      0|            if (!k)
  ------------------
  |  Branch (3185:17): [True: 0, False: 0]
  ------------------
 3186|      0|            {
 3187|      0|                goto case_5_9c_to_9d;
 3188|      0|            }
 3189|      0|            for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (3189:25): [True: 0, False: 0]
  ------------------
 3190|      0|            {
 3191|      0|                if (( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_N)
  ------------------
  |  |  392|      0|#define EL_TYPE_MASK  0x003f
  ------------------
                              if (( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_N)
  ------------------
  |  |  388|      0|#define EL_TYPE_N     0x0004
  ------------------
  |  Branch (3191:21): [True: 0, False: 0]
  ------------------
 3192|      0|                {
 3193|      0|                    if (MobileGr[j].bond_type == BOND_TYPE_DOUBLE &&
  ------------------
  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (3193:25): [True: 0, False: 0]
  ------------------
 3194|      0|                         at[MobileGr[j].atom_number].endpoint &&
  ------------------
  |  Branch (3194:26): [True: 0, False: 0]
  ------------------
 3195|      0|                         at[MobileGr[j].atom_number].endpoint != k &&
  ------------------
  |  Branch (3195:26): [True: 0, False: 0]
  ------------------
 3196|      0|                         jN1 < 0)
  ------------------
  |  Branch (3196:26): [True: 0, False: 0]
  ------------------
 3197|      0|                    {
 3198|      0|                        jN1 = j;
 3199|      0|                        n++;
 3200|      0|                    }
 3201|      0|                    else
 3202|      0|                    {
 3203|      0|                        if (MobileGr[j].bond_type == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (3203:29): [True: 0, False: 0]
  ------------------
 3204|      0|                                MobileGr[j].num_bonds == 2 &&
  ------------------
  |  Branch (3204:33): [True: 0, False: 0]
  ------------------
 3205|      0|                                MobileGr[j].bonds_valence == 2 &&
  ------------------
  |  Branch (3205:33): [True: 0, False: 0]
  ------------------
 3206|      0|                                at[MobileGr[j].atom_number].endpoint == k &&
  ------------------
  |  Branch (3206:33): [True: 0, False: 0]
  ------------------
 3207|      0|                                jN2 < 0)
  ------------------
  |  Branch (3207:33): [True: 0, False: 0]
  ------------------
 3208|      0|                        {
 3209|      0|                            jN2 = j;
 3210|      0|                            n++;
 3211|      0|                        }
 3212|      0|                        else
 3213|      0|                        {
 3214|      0|                            if (MobileGr[j].bond_type == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (3214:33): [True: 0, False: 0]
  ------------------
 3215|      0|                                  MobileGr[j].num_bonds <= 2 &&
  ------------------
  |  Branch (3215:35): [True: 0, False: 0]
  ------------------
 3216|      0|                                  MobileGr[j].bonds_valence <= 3 &&
  ------------------
  |  Branch (3216:35): [True: 0, False: 0]
  ------------------
 3217|      0|                                  at[MobileGr[j].atom_number].endpoint &&
  ------------------
  |  Branch (3217:35): [True: 0, False: 0]
  ------------------
 3218|      0|                                  at[MobileGr[j].atom_number].endpoint != k &&
  ------------------
  |  Branch (3218:35): [True: 0, False: 0]
  ------------------
 3219|      0|                                  jX < 0)
  ------------------
  |  Branch (3219:35): [True: 0, False: 0]
  ------------------
 3220|      0|                            {
 3221|      0|                                jX = j;
 3222|      0|                                n++;
 3223|      0|                            }
 3224|      0|                        }
 3225|      0|                    }
 3226|      0|                }
 3227|      0|            }
 3228|      0|            if (n != 3)
  ------------------
  |  Branch (3228:17): [True: 0, False: 0]
  ------------------
 3229|      0|            {
 3230|      0|                goto case_5_9c_to_9d;
 3231|      0|            }
 3232|       |
 3233|      0|            e = pBNS->edge + pVA[MobileGr[jN2].atom_number].nTautGroupEdge - 1;
 3234|      0|            if (!e->flow)
  ------------------
  |  Branch (3234:17): [True: 0, False: 0]
  ------------------
 3235|      0|            {
 3236|      0|                goto case_5_9c_to_9d; /* should not happen ??? */
 3237|      0|            }
 3238|      0|            e->flow--;
 3239|      0|            pBNS->vert[e->neighbor1].st_edge.flow--;
 3240|      0|            pBNS->vert[e->neighbor1 ^ e->neighbor12].st_edge.flow--;
 3241|      0|            pBNS->tot_st_flow -= 2;
 3242|      0|            e->forbidden |= forbidden_mask;
 3243|      0|            num_changes++;
 3244|      0|            continue;
 3245|      0|        }
 3246|     64|    case_5_9c_to_9d: /* #6 */
 3247|       |            /*********************************************************************/
 3248|     64|        if (3 == num_bonds_non_metal &&
  ------------------
  |  Branch (3248:13): [True: 29, False: 35]
  ------------------
 3249|     29|             4 == bonds_valence_non_metal &&
  ------------------
  |  Branch (3249:14): [True: 18, False: 11]
  ------------------
 3250|     18|             ( centerpoint_type == EL_TYPE_S ) &&
  ------------------
  |  |  387|     18|#define EL_TYPE_S     0x0002
  ------------------
  |  Branch (3250:14): [True: 18, False: 0]
  ------------------
 3251|     18|             0 == num_O + num_S && 3 == num_N && 0 == num_P &&
  ------------------
  |  Branch (3251:14): [True: 16, False: 2]
  |  Branch (3251:36): [True: 1, False: 15]
  |  Branch (3251:50): [True: 1, False: 0]
  ------------------
 3252|      1|             0 == num_forbidden &&
  ------------------
  |  Branch (3252:14): [True: 0, False: 1]
  ------------------
 3253|      0|             3 == num_mgroups && 2 == num_diff_t_groups &&
  ------------------
  |  Branch (3253:14): [True: 0, False: 0]
  |  Branch (3253:34): [True: 0, False: 0]
  ------------------
 3254|      0|             2 == num_donor_endpoints && 0 == num_acceptor_endpoints &&
  ------------------
  |  Branch (3254:14): [True: 0, False: 0]
  |  Branch (3254:42): [True: 0, False: 0]
  ------------------
 3255|      0|             2 == num_donors && 1 == num_acceptors)
  ------------------
  |  Branch (3255:14): [True: 0, False: 0]
  |  Branch (3255:33): [True: 0, False: 0]
  ------------------
 3256|      0|        {
 3257|       |            /********************************************************
 3258|       |             ***         InChI Tech. Man., Table 5, case 9b->8b   ***
 3259|       |             ********************************************************
 3260|       |                 3(X)      --->         e2|          O  =  O, S, Se, Te
 3261|       |                  NH---is an              N======    S  =  S, Se, Te
 3262|       |            \       /   endpoint    \       /           f  =  fixed bond
 3263|       |             \ 1   /  C=====Z        \  f  /  C-----Z   tg =  Mobile-H vertex
 3264|       |              N===S   |     |         N===S  ||     ||  X  =  is N not an endpoint;
 3265|       |            is an  ev  \  |     |           ev \ ||     || -X is not terminal -O,-S,-Se,-Te or
 3266|       |            endpoint     2\ |  e1 |               \||  e1 ||       any N, P, As
 3267|       |                           NH=====tg               N------tg
 3268|       |                        is an                          f      N, N, X, fixed double
 3269|       |                     endpoint                                 =====================
 3270|       |
 3271|       |                     Problem:
 3272|       |                       N1, N2, and N3 are Mobile-H endpoints and belong to the same Mobile-H group.
 3273|       |                       Fixed bond N1==S prevents the correct structure restoration:
 3274|       |                       H cannot migrate N3->N2->N1 because N1=S bond is fixed
 3275|       |                     Solution:
 3276|       |                       Move mobile H to N2 and N3 to make N1=S bond unfixed (Table 5, case 9c)
 3277|       |                       (see fix_special_bonds(...) for details )
 3278|       |                     *********************************************************/
 3279|      0|            int jN1 = -1, jN2 = -1, jX = -1, n = 0;
 3280|      0|            for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (3280:25): [True: 0, False: 0]
  ------------------
 3281|      0|            {
 3282|      0|                if (( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_N)
  ------------------
  |  |  392|      0|#define EL_TYPE_MASK  0x003f
  ------------------
                              if (( MobileGr[j].atom_type_pVA & EL_TYPE_MASK ) == EL_TYPE_N)
  ------------------
  |  |  388|      0|#define EL_TYPE_N     0x0004
  ------------------
  |  Branch (3282:21): [True: 0, False: 0]
  ------------------
 3283|      0|                {
 3284|      0|                    if (MobileGr[j].bond_type == BOND_TYPE_DOUBLE &&
  ------------------
  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (3284:25): [True: 0, False: 0]
  ------------------
 3285|      0|                         !at[MobileGr[j].atom_number].endpoint &&
  ------------------
  |  Branch (3285:26): [True: 0, False: 0]
  ------------------
 3286|      0|                         !( MobileGr[j].forbidden & forbidden_mask ) &&
  ------------------
  |  Branch (3286:26): [True: 0, False: 0]
  ------------------
 3287|      0|                         jN1 < 0)
  ------------------
  |  Branch (3287:26): [True: 0, False: 0]
  ------------------
 3288|      0|                    {
 3289|      0|                        jN1 = j;
 3290|      0|                        n++;
 3291|      0|                    }
 3292|      0|                    else
 3293|      0|                    {
 3294|      0|                        if (MobileGr[j].bond_type == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (3294:29): [True: 0, False: 0]
  ------------------
 3295|      0|                                MobileGr[j].num_bonds == 2 &&
  ------------------
  |  Branch (3295:33): [True: 0, False: 0]
  ------------------
 3296|      0|                                MobileGr[j].bonds_valence <= 3 &&
  ------------------
  |  Branch (3296:33): [True: 0, False: 0]
  ------------------
 3297|      0|                                at[MobileGr[j].atom_number].endpoint &&
  ------------------
  |  Branch (3297:33): [True: 0, False: 0]
  ------------------
 3298|      0|                                !( MobileGr[j].forbidden & forbidden_mask ))
  ------------------
  |  Branch (3298:33): [True: 0, False: 0]
  ------------------
 3299|      0|                        {
 3300|      0|                            if (jN2 < 0)
  ------------------
  |  Branch (3300:33): [True: 0, False: 0]
  ------------------
 3301|      0|                            {
 3302|      0|                                jN2 = j;
 3303|      0|                                n++;
 3304|      0|                            }
 3305|      0|                            else
 3306|      0|                            {
 3307|      0|                                if (jX < 0)
  ------------------
  |  Branch (3307:37): [True: 0, False: 0]
  ------------------
 3308|      0|                                {
 3309|      0|                                    jX = j;
 3310|      0|                                    n++;
 3311|      0|                                }
 3312|      0|                            }
 3313|      0|                        }
 3314|      0|                    }
 3315|      0|                }
 3316|      0|            }
 3317|      0|            if (n != 3)
  ------------------
  |  Branch (3317:17): [True: 0, False: 0]
  ------------------
 3318|      0|            {
 3319|      0|                goto case_end;
 3320|      0|            }
 3321|      0|            ev = pBNS->edge + pBNS->vert[i].iedge[MobileGr[jN1].ineigh];
 3322|      0|            if (!ev->flow) /* 2017-02-15 Fixed typo ("!e->flow") which has been here since v. 1.01 */
  ------------------
  |  Branch (3322:17): [True: 0, False: 0]
  ------------------
 3323|      0|            {
 3324|      0|                goto case_end;
 3325|      0|            }
 3326|      0|            e1 = pBNS->edge + pVA[MobileGr[jN2].atom_number].nTautGroupEdge - 1;
 3327|      0|            if (!e1->flow)
  ------------------
  |  Branch (3327:17): [True: 0, False: 0]
  ------------------
 3328|      0|            {
 3329|      0|                goto case_end; /* should not happen ??? */
 3330|      0|            }
 3331|      0|            e2 = pBNS->edge + pVA[MobileGr[jX].atom_number].nTautGroupEdge - 1;
 3332|      0|            if (!e2->flow)
  ------------------
  |  Branch (3332:17): [True: 0, False: 0]
  ------------------
 3333|      0|            {
 3334|      0|                goto case_end; /* should not happen ??? */
 3335|      0|            }
 3336|       |            /* take care of edge e1 */
 3337|      0|            e = e1;
 3338|      0|            e->flow--;
 3339|      0|            pBNS->vert[e->neighbor1].st_edge.flow--;
 3340|      0|            pBNS->vert[e->neighbor1 ^ e->neighbor12].st_edge.flow--;
 3341|      0|            pBNS->tot_st_flow -= 2;
 3342|      0|            e->forbidden |= forbidden_mask;
 3343|      0|            num_changes++;
 3344|       |            /* take care of edge e2 */
 3345|      0|            e = e2;
 3346|      0|            e->flow--;
 3347|      0|            pBNS->vert[e->neighbor1].st_edge.flow--;
 3348|      0|            pBNS->vert[e->neighbor1 ^ e->neighbor12].st_edge.flow--;
 3349|      0|            pBNS->tot_st_flow -= 2;
 3350|      0|            e->forbidden |= forbidden_mask;
 3351|      0|            num_changes++;
 3352|       |            /* take care of edge ev: do not let it change */
 3353|      0|            ev->forbidden |= forbidden_mask;
 3354|      0|            continue;
 3355|      0|        }
 3356|     64|    case_end:;
 3357|     64|    }
 3358|       |
 3359|       |/*exit_function:*/
 3360|    486|    return num_changes;
 3361|    486|}
RearrangePlusMinusEdgesFlow:
 3373|  87.8k|{
 3374|  87.8k|    int ret, ePlus, eMinus;
 3375|  87.8k|    EDGE_LIST NewlyFixedEdges;
 3376|  87.8k|    BNS_EDGE *pPlus, *pMinus;
 3377|  87.8k|    int i, k1, k2, num_found, num_tot, delta, v1, v2;
 3378|       |
 3379|  87.8k|    ret = 0;
 3380|       |
 3381|  87.8k|    AllocEdgeList( &NewlyFixedEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  87.8k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 3382|   920k|    for (i = 0, num_found = num_tot = 0; i < pBNS->num_atoms; i++)
  ------------------
  |  Branch (3382:42): [True: 832k, False: 87.8k]
  ------------------
 3383|   832k|    {
 3384|   832k|        eMinus = pVA[i].nCMinusGroupEdge - 1;
 3385|   832k|        ePlus = pVA[i].nCPlusGroupEdge - 1;
 3386|   832k|        num_tot += ( eMinus >= 0 ) + ( ePlus >= 0 );
 3387|   832k|        if (eMinus >= 0 && ePlus >= 0)
  ------------------
  |  Branch (3387:13): [True: 119k, False: 712k]
  |  Branch (3387:28): [True: 102k, False: 17.6k]
  ------------------
 3388|   102k|        {
 3389|   102k|            pPlus = pBNS->edge + ePlus;
 3390|   102k|            pMinus = pBNS->edge + eMinus;
 3391|   102k|            if (( pMinus->flow ) > 0 && ( pPlus->cap - pPlus->flow ) > 0) /* djb-rwth: removing redundant code */
  ------------------
  |  Branch (3391:17): [True: 19.4k, False: 82.8k]
  |  Branch (3391:41): [True: 14, False: 19.4k]
  ------------------
 3392|     14|            {
 3393|     14|                num_found++;
 3394|     14|            }
 3395|   102k|        }
 3396|   832k|    }
 3397|  87.8k|    if (!num_found)
  ------------------
  |  Branch (3397:9): [True: 87.7k, False: 14]
  ------------------
 3398|  87.7k|    {
 3399|  87.7k|        goto exit_function;
 3400|  87.7k|    }
 3401|     14|    if ((ret = AllocEdgeList( &NewlyFixedEdges, num_tot + pBNS->num_bonds ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3401:9): [True: 0, False: 14]
  ------------------
 3402|      0|    {
 3403|      0|        goto exit_function;
 3404|      0|    }
 3405|       |
 3406|    117|    for (i = 0, num_tot = 0; i < pBNS->num_atoms; i++) /* djb-rwth: removing redundant code */
  ------------------
  |  Branch (3406:30): [True: 103, False: 14]
  ------------------
 3407|    103|    {
 3408|    103|        eMinus = pVA[i].nCMinusGroupEdge - 1;
 3409|    103|        ePlus = pVA[i].nCPlusGroupEdge - 1;
 3410|    103|        num_tot += ( eMinus >= 0 ) + ( ePlus >= 0 );
 3411|    103|        if (eMinus >= 0 && ePlus >= 0)
  ------------------
  |  Branch (3411:13): [True: 74, False: 29]
  |  Branch (3411:28): [True: 65, False: 9]
  ------------------
 3412|     65|        {
 3413|     65|            pPlus = pBNS->edge + ePlus;
 3414|     65|            pMinus = pBNS->edge + eMinus;
 3415|     65|            if (( k1 = pMinus->flow ) > 0 && ( k2 = pPlus->cap - pPlus->flow ) > 0)
  ------------------
  |  Branch (3415:17): [True: 26, False: 39]
  |  Branch (3415:46): [True: 14, False: 12]
  ------------------
 3416|     14|            {
 3417|       |                /* rearrange */
 3418|     14|                v1 = pMinus->neighbor1;
 3419|     14|                v2 = pMinus->neighbor12 ^ v1;
 3420|     14|                delta = inchi_min( k1, k2 );
  ------------------
  |  |  139|     14|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 14]
  |  |  ------------------
  ------------------
 3421|     14|                pMinus->flow -= delta;
 3422|     14|                pBNS->vert[v1].st_edge.flow -= delta;
 3423|     14|                pBNS->vert[v2].st_edge.flow -= delta;
 3424|     14|                pBNS->tot_st_flow -= 2 * delta;
 3425|     14|            }
 3426|       |            /* fix charges */
 3427|     65|            pPlus->forbidden |= forbidden_edge_mask;
 3428|     65|            pMinus->forbidden |= forbidden_edge_mask;
 3429|     65|            if (( ret = AddToEdgeList( &NewlyFixedEdges, eMinus, 0 ) ) ||
  ------------------
  |  Branch (3429:17): [True: 0, False: 65]
  ------------------
 3430|     65|                ( ret = AddToEdgeList( &NewlyFixedEdges, ePlus, 0 ) ))
  ------------------
  |  Branch (3430:17): [True: 0, False: 65]
  ------------------
 3431|      0|            {
 3432|      0|                goto exit_function;
 3433|      0|            }
 3434|     65|        }
 3435|     38|        else
 3436|     38|        {
 3437|     38|            if (eMinus >= 0)
  ------------------
  |  Branch (3437:17): [True: 9, False: 29]
  ------------------
 3438|      9|            {
 3439|       |                /* fix charges */
 3440|      9|                pMinus = pBNS->edge + eMinus;
 3441|      9|                pMinus->forbidden |= forbidden_edge_mask;
 3442|      9|                if ((ret = AddToEdgeList( &NewlyFixedEdges, eMinus, 0 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3442:21): [True: 0, False: 9]
  ------------------
 3443|      0|                {
 3444|      0|                    goto exit_function;
 3445|      0|                }
 3446|      9|            }
 3447|     29|            else
 3448|     29|            {
 3449|     29|                if (ePlus >= 0)
  ------------------
  |  Branch (3449:21): [True: 10, False: 19]
  ------------------
 3450|     10|                {
 3451|       |                    /* fix charges */
 3452|     10|                    pPlus = pBNS->edge + ePlus;
 3453|     10|                    pPlus->forbidden |= forbidden_edge_mask;
 3454|     10|                    if ((ret = AddToEdgeList( &NewlyFixedEdges, ePlus, 0 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3454:25): [True: 0, False: 10]
  ------------------
 3455|      0|                    {
 3456|      0|                        goto exit_function;
 3457|      0|                    }
 3458|     10|                }
 3459|     29|            }
 3460|     38|        }
 3461|    103|    }
 3462|    114|    for (i = 0; i < pBNS->num_bonds; i++)
  ------------------
  |  Branch (3462:17): [True: 100, False: 14]
  ------------------
 3463|    100|    {
 3464|    100|        pBNS->edge[i].forbidden |= forbidden_edge_mask;
 3465|    100|        if ((ret = AddToEdgeList( &NewlyFixedEdges, i, 0 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3465:13): [True: 0, False: 100]
  ------------------
 3466|      0|        {
 3467|      0|            goto exit_function;
 3468|      0|        }
 3469|    100|    }
 3470|     14|    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 3471|     14|    RemoveForbiddenEdgeMask( pBNS, &NewlyFixedEdges, forbidden_edge_mask );
 3472|     14|    if (ret < 0)
  ------------------
  |  Branch (3472:9): [True: 0, False: 14]
  ------------------
 3473|      0|    {
 3474|      0|        goto exit_function;
 3475|      0|    }
 3476|       |
 3477|  87.8k|exit_function:
 3478|  87.8k|    AllocEdgeList( &NewlyFixedEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  87.8k|#define EDGE_LIST_FREE   (-2)
  ------------------
 3479|       |
 3480|  87.8k|    return ret;
 3481|     14|}
IncrementZeroOrderBondsToHeteroat:
 3495|  87.8k|{
 3496|  87.8k|#define FIX_BOND_ADD_ALLOC 128
 3497|  87.8k|    Vertex     vPathStart, vPathEnd;
 3498|  87.8k|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 3499|  87.8k|    BNS_EDGE   *pe, *peZero, *peNeighMeigh = NULL, *peMeFlower;
 3500|  87.8k|    BNS_VERTEX *pMeFlower = NULL, *pNeigh = NULL, *pNeighNeigh = NULL;
 3501|       |
 3502|  87.8k|    int i, j, k, ret2, ret, bFixedCarbonCharges, num_changes, bSuccess;
 3503|  87.8k|    int num_at = pStruct->num_atoms;
 3504|  87.8k|    int num_deleted_H = pStruct->num_deleted_H;
 3505|  87.8k|    int len_at = num_at + num_deleted_H;
 3506|  87.8k|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 3507|  87.8k|    Vertex vMeFlower0, vNeigh, vNeighMeigh = NO_VERTEX;
  ------------------
  |  |  118|  87.8k|#define NO_VERTEX    -2
  ------------------
 3508|       |
 3509|  87.8k|    EDGE_LIST CarbonChargeEdges;
 3510|  87.8k|    EDGE_LIST NewlyFixedEdges;
 3511|       |
 3512|  87.8k|    ret = 0;
 3513|  87.8k|    num_changes = 0;
 3514|       |
 3515|  87.8k|    bFixedCarbonCharges = 0;
 3516|  87.8k|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  87.8k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 3517|  87.8k|    AllocEdgeList( &NewlyFixedEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  87.8k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 3518|       |
 3519|  87.8k|    if (!pTCGroups->num_metal_atoms ||
  ------------------
  |  Branch (3519:9): [True: 22.3k, False: 65.4k]
  ------------------
 3520|  65.4k|         0 > ( k = pTCGroups->nGroup[TCG_MeFlower0] ) ||
  ------------------
  |  Branch (3520:10): [True: 48.3k, False: 17.0k]
  ------------------
 3521|  17.0k|         0 > ( vMeFlower0 = pTCGroups->pTCG[k].nVertexNumber ))
  ------------------
  |  Branch (3521:10): [True: 0, False: 17.0k]
  ------------------
 3522|  70.7k|    {
 3523|  70.7k|        goto exit_function;
 3524|  70.7k|    }
 3525|       |
 3526|  17.0k|    memcpy(at2, at, len_at * sizeof(at2[0]));
 3527|  17.0k|    pStruct->at = at2;
 3528|  17.0k|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 3529|  17.0k|    pStruct->at = at;
 3530|  17.0k|    if (ret2 < 0)
  ------------------
  |  Branch (3530:9): [True: 9, False: 17.0k]
  ------------------
 3531|      9|    {
 3532|      9|        ret = ret2;
 3533|      9|        goto exit_function;
 3534|      9|    }
 3535|   110k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (3535:17): [True: 93.7k, False: 17.0k]
  ------------------
 3536|  93.7k|    {
 3537|  93.7k|        if (!pVA[i].cMetal || pVA[i].nMetalGroupEdge <= 0)
  ------------------
  |  Branch (3537:13): [True: 69.4k, False: 24.3k]
  |  Branch (3537:31): [True: 0, False: 24.3k]
  ------------------
 3538|  69.4k|        {
 3539|  69.4k|            continue;
 3540|  69.4k|        }
 3541|  24.3k|        peMeFlower = pBNS->edge + pVA[i].nMetalGroupEdge - 1;
 3542|  24.3k|        if (vMeFlower0 != ( peMeFlower->neighbor12 ^ i ))
  ------------------
  |  Branch (3542:13): [True: 0, False: 24.3k]
  ------------------
 3543|      0|        {
 3544|      0|            ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3545|      0|            goto exit_function;
 3546|      0|        }
 3547|  24.3k|        pMeFlower = pBNS->vert + vMeFlower0;
 3548|       |
 3549|  67.4k|        for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (3549:21): [True: 43.1k, False: 24.2k]
  ------------------
 3550|  43.1k|        {
 3551|  43.1k|            if (!peMeFlower->flow)
  ------------------
  |  Branch (3551:17): [True: 17, False: 43.1k]
  ------------------
 3552|     17|            {
 3553|     17|                break; /* cannot do anything */
 3554|     17|            }
 3555|  43.1k|            if (!( at2[i].bond_type[j] & BOND_TYPE_MASK ))
  ------------------
  |  |  189|  43.1k|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (3555:17): [True: 13.9k, False: 29.2k]
  ------------------
 3556|  13.9k|            {
 3557|       |                /* found a zero order bond */
 3558|  13.9k|                if (!bFixedCarbonCharges)
  ------------------
  |  Branch (3558:21): [True: 9.80k, False: 4.10k]
  ------------------
 3559|  9.80k|                {
 3560|       |                    /* do not let carbon atoms get charged */
 3561|  9.80k|                    if (0 > ( ret = ForbidCarbonChargeEdges( pBNS, pTCGroups, &CarbonChargeEdges, forbidden_edge_mask ) ))
  ------------------
  |  Branch (3561:25): [True: 0, False: 9.80k]
  ------------------
 3562|      0|                    {
 3563|      0|                        goto exit_function;
 3564|      0|                    }
 3565|  9.80k|                    bFixedCarbonCharges++;
 3566|  9.80k|                }
 3567|  13.9k|                peZero = pBNS->edge + pBNS->vert[i].iedge[j];
 3568|  13.9k|                if (peZero->flow)
  ------------------
  |  Branch (3568:21): [True: 0, False: 13.9k]
  ------------------
 3569|      0|                {
 3570|      0|                    ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3571|      0|                    goto exit_function;
 3572|      0|                }
 3573|       |                /* fix other edges */
 3574|  43.0k|                for (k = 0; k < at2[i].valence; k++)
  ------------------
  |  Branch (3574:29): [True: 29.1k, False: 13.9k]
  ------------------
 3575|  29.1k|                {
 3576|  29.1k|                    pe = pBNS->edge + pBNS->vert[i].iedge[k];
 3577|  29.1k|                    if (pe->flow == 1 && !( pe->forbidden & forbidden_edge_mask ))
  ------------------
  |  Branch (3577:25): [True: 6.61k, False: 22.5k]
  |  Branch (3577:42): [True: 6.31k, False: 298]
  ------------------
 3578|  6.31k|                    {
 3579|  6.31k|                        if ((ret = AddToEdgeList( &NewlyFixedEdges, (int) ( pe - pBNS->edge ), FIX_BOND_ADD_ALLOC ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 3496|  6.31k|#define FIX_BOND_ADD_ALLOC 128
  ------------------
  |  Branch (3579:29): [True: 0, False: 6.31k]
  ------------------
 3580|      0|                        {
 3581|      0|                            goto exit_function;
 3582|      0|                        }
 3583|  6.31k|                        pe->forbidden |= forbidden_edge_mask;
 3584|  6.31k|                    }
 3585|  29.1k|                }
 3586|       |                /* do not create =N(+)= in a ring or #O(+) terminal */
 3587|  93.5k|                for (k = 0; k < num_at; k++)
  ------------------
  |  Branch (3587:29): [True: 79.6k, False: 13.9k]
  ------------------
 3588|  79.6k|                {
 3589|  79.6k|                    if (!pVA[k].cMetal && pVA[k].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (3589:25): [True: 51.7k, False: 27.9k]
  |  Branch (3589:43): [True: 15.7k, False: 36.0k]
  ------------------
 3590|  15.7k|                         at2[k].valence == 2 && !at2[k].num_H && pVA[k].cMinRingSize <= 6 &&
  ------------------
  |  Branch (3590:26): [True: 6.87k, False: 8.87k]
  |  Branch (3590:49): [True: 6.75k, False: 122]
  |  Branch (3590:66): [True: 6.62k, False: 128]
  ------------------
 3591|  6.62k|                         pVA[k].nCPlusGroupEdge > 0 &&
  ------------------
  |  Branch (3591:26): [True: 6.58k, False: 36]
  ------------------
 3592|  6.58k|                         ( pe = pBNS->edge + pVA[k].nCPlusGroupEdge - 1 )->flow == 1 &&
  ------------------
  |  Branch (3592:26): [True: 5.05k, False: 1.53k]
  ------------------
 3593|  5.05k|                         !( pe->forbidden & forbidden_edge_mask ))
  ------------------
  |  Branch (3593:26): [True: 4.74k, False: 309]
  ------------------
 3594|  4.74k|                    {
 3595|       |
 3596|  4.74k|                        if ((ret = AddToEdgeList( &NewlyFixedEdges, (int) ( pe - pBNS->edge ), FIX_BOND_ADD_ALLOC ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 3496|  4.74k|#define FIX_BOND_ADD_ALLOC 128
  ------------------
  |  Branch (3596:29): [True: 0, False: 4.74k]
  ------------------
 3597|      0|                        {
 3598|      0|                            goto exit_function;
 3599|      0|                        }
 3600|  4.74k|                        pe->forbidden |= forbidden_edge_mask;
 3601|  4.74k|                    }
 3602|  79.6k|                }
 3603|       |
 3604|       |                /* metal's neighbor connected by a zero-order bond */
 3605|  13.9k|                pNeigh = pBNS->vert + ( vNeigh = at2[i].neighbor[j] );
 3606|       |                /*for ( k = 0; k < pNeigh->num_adj_edges; k ++ )*/
 3607|  36.1k|                for (k = pNeigh->num_adj_edges - 1; 0 <= k; k--)
  ------------------
  |  Branch (3607:53): [True: 35.0k, False: 1.15k]
  ------------------
 3608|  35.0k|                {
 3609|  35.0k|                    peNeighMeigh = pBNS->edge + pNeigh->iedge[k];
 3610|  35.0k|                    if (!peNeighMeigh->flow)
  ------------------
  |  Branch (3610:25): [True: 18.6k, False: 16.4k]
  ------------------
 3611|  18.6k|                    {
 3612|  18.6k|                        continue;
 3613|  18.6k|                    }
 3614|  16.4k|                    vNeighMeigh = peNeighMeigh->neighbor12 ^ vNeigh;
 3615|  16.4k|                    if (vNeighMeigh != i && vNeighMeigh != vMeFlower0)
  ------------------
  |  Branch (3615:25): [True: 16.4k, False: 0]
  |  Branch (3615:45): [True: 12.7k, False: 3.65k]
  ------------------
 3616|  12.7k|                    {
 3617|       |                        /* metal neighbor's neighbor connected by a not-zero-order bond */
 3618|  12.7k|                        pNeighNeigh = pBNS->vert + vNeighMeigh;
 3619|  12.7k|                        break; /* found */
 3620|  12.7k|                    }
 3621|  16.4k|                }
 3622|  13.9k|                if (k < 0)
  ------------------
  |  Branch (3622:21): [True: 1.15k, False: 12.7k]
  ------------------
 3623|  1.15k|                {
 3624|  1.15k|                    continue; /* neighbor not found */
 3625|  1.15k|                }
 3626|  12.7k|                peZero->flow++;
 3627|  12.7k|                peZero->forbidden |= forbidden_edge_mask;
 3628|  12.7k|                peMeFlower->flow--;
 3629|  12.7k|                peNeighMeigh->flow--;
 3630|  12.7k|                pMeFlower->st_edge.flow--;
 3631|  12.7k|                pNeighNeigh->st_edge.flow--;
 3632|  12.7k|                pBNS->tot_st_flow -= 2;
 3633|       |                /* test */
 3634|  12.7k|                bSuccess = 0;
 3635|  12.7k|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 3636|  12.7k|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 3637|       |
 3638|  12.7k|                if (ret == 1 && ( (vPathEnd == vMeFlower0 && vPathStart == vNeighMeigh) ||
  ------------------
  |  Branch (3638:21): [True: 11.0k, False: 1.72k]
  |  Branch (3638:36): [True: 5.01k, False: 6.01k]
  |  Branch (3638:62): [True: 4.72k, False: 288]
  ------------------
 3639|  10.5k|                    (vPathEnd == vNeighMeigh && vPathStart == vMeFlower0) ) && abs( nDeltaCharge ) <= 2) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (3639:22): [True: 5.92k, False: 373]
  |  Branch (3639:49): [True: 5.86k, False: 63]
  |  Branch (3639:80): [True: 10.5k, False: 88]
  ------------------
 3640|  10.5k|                {
 3641|  10.5k|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 3642|  10.5k|                    if (ret > 0)
  ------------------
  |  Branch (3642:25): [True: 10.5k, False: 0]
  ------------------
 3643|  10.5k|                    {
 3644|  10.5k|                        ( *pnNumRunBNS )++;
 3645|  10.5k|                        *pnTotalDelta += ret;
 3646|  10.5k|                        num_changes++;
 3647|  10.5k|                        bSuccess = ret;
 3648|  10.5k|                    }
 3649|  10.5k|                    if ((ret = AddToEdgeList( &NewlyFixedEdges, (int) ( peZero - pBNS->edge ), FIX_BOND_ADD_ALLOC ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 3496|  10.5k|#define FIX_BOND_ADD_ALLOC 128
  ------------------
  |  Branch (3649:25): [True: 0, False: 10.5k]
  ------------------
 3650|      0|                    {
 3651|      0|                        goto exit_function;
 3652|      0|                    }
 3653|  10.5k|                }
 3654|  2.24k|                else
 3655|  2.24k|                {
 3656|  2.24k|                    peZero->flow--;
 3657|  2.24k|                    peZero->forbidden &= inv_forbidden_edge_mask;
 3658|  2.24k|                    peMeFlower->flow++;
 3659|  2.24k|                    peNeighMeigh->flow++;
 3660|  2.24k|                    pMeFlower->st_edge.flow++;
 3661|  2.24k|                    pNeighNeigh->st_edge.flow++;
 3662|  2.24k|                    pBNS->tot_st_flow += 2;
 3663|  2.24k|                }
 3664|  12.7k|                RemoveForbiddenEdgeMask( pBNS, &NewlyFixedEdges, forbidden_edge_mask );
 3665|  12.7k|                NewlyFixedEdges.num_edges = 0;
 3666|  12.7k|                if (bSuccess)
  ------------------
  |  Branch (3666:21): [True: 10.5k, False: 2.24k]
  ------------------
 3667|  10.5k|                {
 3668|       |                    /* update at2[] */
 3669|  10.5k|                    memcpy(at2, at, len_at * sizeof(at2[0]));
 3670|  10.5k|                    pStruct->at = at2;
 3671|  10.5k|                    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 3672|  10.5k|                    pStruct->at = at;
 3673|  10.5k|                    if (ret2 < 0)
  ------------------
  |  Branch (3673:25): [True: 0, False: 10.5k]
  ------------------
 3674|      0|                    {
 3675|      0|                        ret = ret2;
 3676|      0|                        goto exit_function;
 3677|      0|                    }
 3678|  10.5k|                }
 3679|  12.7k|            }
 3680|  43.1k|        }
 3681|  24.3k|    }
 3682|  17.0k|    ret = num_changes;
 3683|       |
 3684|  87.8k|exit_function:
 3685|  87.8k|    RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 3686|  87.8k|    RemoveForbiddenEdgeMask( pBNS, &NewlyFixedEdges, forbidden_edge_mask );
 3687|  87.8k|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  87.8k|#define EDGE_LIST_FREE   (-2)
  ------------------
 3688|  87.8k|    AllocEdgeList( &NewlyFixedEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  87.8k|#define EDGE_LIST_FREE   (-2)
  ------------------
 3689|       |
 3690|  87.8k|    return ret;
 3691|  17.0k|}
MovePlusFromS2DiaminoCarbon:
 3711|  87.7k|{
 3712|  87.7k|    int i, j, k, ret, ret2; /* djb-rwth: removing redundant variables */
 3713|  87.7k|    int delta;
 3714|  87.7k|    EdgeIndex        ePlusS, ePlusC, eMinusC, e;
 3715|  87.7k|    BNS_VERTEX *pvS, *pvC, *pv1, *pv2;
 3716|  87.7k|    BNS_EDGE   *pePlusS, *pePlusC, *pe1, *pe2, *peCN[3], *peSC, *pe;
 3717|  87.7k|    Vertex     vC, vN;
 3718|       |
 3719|  87.7k|    int num_at = pStruct->num_atoms;
 3720|  87.7k|    int num_deleted_H = pStruct->num_deleted_H;
 3721|  87.7k|    int len_at = num_at + num_deleted_H;
 3722|       |
 3723|  87.7k|    Vertex     vPathStart, vPathEnd, v1, v2;
 3724|  87.7k|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 3725|       |
 3726|  87.7k|    EDGE_LIST AllChargeEdges;
 3727|       |
 3728|  87.7k|    ret = 0;
 3729|       |    /* djb-rwth: removing redundant code */
 3730|       |
 3731|  87.7k|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  87.7k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 3732|       |
 3733|  87.7k|    memcpy(at2, at, len_at * sizeof(at2[0]));
 3734|  87.7k|    pStruct->at = at2;
 3735|  87.7k|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 3736|  87.7k|    pStruct->at = at;
 3737|  87.7k|    if (ret2 < 0)
  ------------------
  |  Branch (3737:9): [True: 12, False: 87.7k]
  ------------------
 3738|     12|    {
 3739|     12|        ret = ret2;
 3740|     12|        goto exit_function;
 3741|     12|    }
 3742|       |    /* find (NH2)C=S(+) */
 3743|   920k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (3743:17): [True: 832k, False: 87.7k]
  ------------------
 3744|   832k|    {
 3745|   832k|        pvS = pBNS->vert + i; /* djb-rwth: avoiding unsequenced modification and access */
 3746|   832k|        if (!pVA[i].cMetal && pVA[i].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (3746:13): [True: 513k, False: 318k]
  |  Branch (3746:31): [True: 215k, False: 298k]
  ------------------
 3747|   215k|             at2[i].valence == 2 &&
  ------------------
  |  Branch (3747:14): [True: 9.54k, False: 205k]
  ------------------
 3748|  9.54k|             pvS->st_edge.cap == pvS->st_edge.flow &&
  ------------------
  |  Branch (3748:14): [True: 9.50k, False: 41]
  ------------------
 3749|  9.50k|             0 <= ( ePlusS = pVA[i].nCPlusGroupEdge - 1 ) && !( pePlusS = pBNS->edge + ePlusS )->flow && /* S(+) */
  ------------------
  |  Branch (3749:14): [True: 9.44k, False: 61]
  |  Branch (3749:62): [True: 3.88k, False: 5.55k]
  ------------------
 3750|  3.88k|             ( pe1 = pBNS->edge + pvS->iedge[0] )->flow +
  ------------------
  |  Branch (3750:14): [True: 2.97k, False: 905]
  ------------------
 3751|  3.88k|             ( pe2 = pBNS->edge + pvS->iedge[1] )->flow == 1 /* -S(+)= */ &&
 3752|  2.97k|             pVA[vC = ( peSC = pe1->flow ? pe1 : pe2 )->neighbor12 ^ i].cNumValenceElectrons == 4 &&
  ------------------
  |  Branch (3752:14): [True: 1.62k, False: 1.35k]
  |  Branch (3752:32): [True: 2.05k, False: 920]
  ------------------
 3753|  1.62k|             at2[vC].valence == 3 &&
  ------------------
  |  Branch (3753:14): [True: 174, False: 1.45k]
  ------------------
 3754|    174|             0 <= ( ePlusC = pVA[vC].nCPlusGroupEdge - 1 ) && ( pePlusC = pBNS->edge + ePlusC )->flow &&
  ------------------
  |  Branch (3754:14): [True: 172, False: 2]
  |  Branch (3754:63): [True: 171, False: 1]
  ------------------
 3755|    171|             !( 0 <= ( eMinusC = pVA[vC].nCMinusGroupEdge - 1 ) && pBNS->edge[eMinusC].flow ))
  ------------------
  |  Branch (3755:17): [True: 171, False: 0]
  |  Branch (3755:68): [True: 1, False: 170]
  ------------------
 3756|    170|        {
 3757|       |            /* found >C=S(+)- */
 3758|    170|            pvC = pBNS->vert + vC;
 3759|    680|            for (j = k = 0; j < at[vC].valence; j++)
  ------------------
  |  Branch (3759:29): [True: 510, False: 170]
  ------------------
 3760|    510|            {
 3761|    510|                if (peSC != ( peCN[k] = pBNS->edge + pvC->iedge[j] ) && !peCN[k]->flow)
  ------------------
  |  Branch (3761:21): [True: 340, False: 170]
  |  Branch (3761:73): [True: 329, False: 11]
  ------------------
 3762|    329|                {
 3763|    329|                    k++; /* a single bond from C */
 3764|    329|                }
 3765|    510|            }
 3766|    170|            if (k != 2)
  ------------------
  |  Branch (3766:17): [True: 10, False: 160]
  ------------------
 3767|     10|            {
 3768|     10|                continue;
 3769|     10|            }
 3770|    160|            for (j = 0; j < k; j++)
  ------------------
  |  Branch (3770:25): [True: 160, False: 0]
  ------------------
 3771|    160|            {
 3772|    160|                vN = peCN[j]->neighbor12 ^ vC;
 3773|    160|                if (pVA[vN].cNumValenceElectrons != 5 ||
  ------------------
  |  Branch (3773:21): [True: 156, False: 4]
  ------------------
 3774|      4|                     pBNS->vert[vN].st_edge.cap != pBNS->vert[vN].st_edge.flow ||
  ------------------
  |  Branch (3774:22): [True: 0, False: 4]
  ------------------
 3775|      4|                     at2[vN].num_H != 2 ||
  ------------------
  |  Branch (3775:22): [True: 4, False: 0]
  ------------------
 3776|      0|                     at2[vN].endpoint || ( pStruct->endpoint && pStruct->endpoint[vN] ))
  ------------------
  |  Branch (3776:22): [True: 0, False: 0]
  |  Branch (3776:44): [True: 0, False: 0]
  |  Branch (3776:65): [True: 0, False: 0]
  ------------------
 3777|    160|                {
 3778|    160|                    break; /* does not fit the pattern */
 3779|    160|                }
 3780|    160|            }
 3781|    160|            if (j != k)
  ------------------
  |  Branch (3781:17): [True: 160, False: 0]
  ------------------
 3782|    160|            {
 3783|    160|                continue;
 3784|    160|            }
 3785|       |            /* fix all charges */
 3786|      0|            if (!AllChargeEdges.num_edges)
  ------------------
  |  Branch (3786:17): [True: 0, False: 0]
  ------------------
 3787|      0|            {
 3788|      0|                for (j = 0; j < num_at; j++)
  ------------------
  |  Branch (3788:29): [True: 0, False: 0]
  ------------------
 3789|      0|                {
 3790|      0|                    if (0 <= ( e = pVA[j].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (3790:25): [True: 0, False: 0]
  |  Branch (3790:68): [True: 0, False: 0]
  ------------------
 3791|      0|                        ( ret = AddToEdgeList( &AllChargeEdges, e, 2 * num_at ) ))
  ------------------
  |  Branch (3791:25): [True: 0, False: 0]
  ------------------
 3792|      0|                    {
 3793|      0|                        goto exit_function;
 3794|      0|                    }
 3795|      0|                    if (0 <= ( e = pVA[j].nCMinusGroupEdge - 1 ) && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (3795:25): [True: 0, False: 0]
  |  Branch (3795:69): [True: 0, False: 0]
  ------------------
 3796|      0|                        ( ret = AddToEdgeList( &AllChargeEdges, e, 2 * num_at ) ))
  ------------------
  |  Branch (3796:25): [True: 0, False: 0]
  ------------------
 3797|      0|                    {
 3798|      0|                        goto exit_function;
 3799|      0|                    }
 3800|      0|                }
 3801|      0|            }
 3802|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 3803|      0|            pePlusS->forbidden &= ~forbidden_edge_mask;
 3804|      0|            pe = pePlusC;
 3805|      0|            if (!pe->flow)
  ------------------
  |  Branch (3805:17): [True: 0, False: 0]
  ------------------
 3806|      0|                continue;
 3807|      0|            delta = 1;
 3808|      0|            pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 3809|      0|            pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 3810|       |
 3811|      0|            pe->flow -= delta;
 3812|      0|            pv1->st_edge.flow -= delta;
 3813|      0|            pv2->st_edge.flow -= delta;
 3814|      0|            pBNS->tot_st_flow -= 2 * delta;
 3815|       |
 3816|      0|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 3817|      0|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 3818|       |
 3819|      0|            if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (3819:17): [True: 0, False: 0]
  |  Branch (3819:32): [True: 0, False: 0]
  |  Branch (3819:50): [True: 0, False: 0]
  ------------------
 3820|      0|                (vPathEnd == v2 && vPathStart == v1) ) && nDeltaCharge == -1) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (3820:18): [True: 0, False: 0]
  |  Branch (3820:36): [True: 0, False: 0]
  |  Branch (3820:59): [True: 0, False: 0]
  ------------------
 3821|      0|            {
 3822|       |                /* Remover (+)charge from S => nDeltaCharge == -1 */
 3823|       |                /* Flow change on pe (+)charge edge (atom S) is not known to RunBnsTestOnce()) */
 3824|      0|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 3825|      0|                if (ret > 0)
  ------------------
  |  Branch (3825:21): [True: 0, False: 0]
  ------------------
 3826|      0|                {
 3827|      0|                    ( *pnNumRunBNS )++;
 3828|       |                    /* djb-rwth: removing redundant code */
 3829|      0|                }
 3830|      0|            }
 3831|      0|            else
 3832|      0|            {
 3833|      0|                pe->flow += delta;
 3834|      0|                pv1->st_edge.flow += delta;
 3835|      0|                pv2->st_edge.flow += delta;
 3836|      0|                pBNS->tot_st_flow += 2 * delta;
 3837|      0|            }
 3838|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 3839|      0|        }
 3840|   832k|    }
 3841|  87.7k|exit_function:
 3842|  87.7k|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  87.7k|#define EDGE_LIST_FREE   (-2)
  ------------------
 3843|       |
 3844|  87.7k|    return ret;
 3845|  87.7k|}
EliminateChargeSeparationOnHeteroatoms:
 3861|   100k|{
 3862|   100k|    int i, j, k, ret, ret2, num_pos, num_neg, num_min = 0, bFixedCarbonCharges;
 3863|   100k|    int vPlusSuper;  /* (+)super vertex */
 3864|   100k|    int ePlusSuper;  /* edge from vPlusSuper to (+/-) */
 3865|   100k|    int vPlusMinus;  /* (+/-) vertex */
 3866|   100k|    int nDeltaPlus1, nDeltaMinus1, delta;
 3867|   100k|    BNS_VERTEX *pvPlusSuper, *pvPlusMinus;
 3868|   100k|    BNS_EDGE   *pEdge;
 3869|       |
 3870|   100k|    int num_at = pStruct->num_atoms;
 3871|   100k|    int num_deleted_H = pStruct->num_deleted_H;
 3872|   100k|    int len_at = num_at + num_deleted_H;
 3873|   100k|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 3874|       |
 3875|   100k|    Vertex     vPathStart, vPathEnd;
 3876|   100k|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 3877|       |
 3878|   100k|    EDGE_LIST FixedLargeRingStereoEdges, CarbonChargeEdges;
 3879|       |
 3880|   100k|    ret = 0;
 3881|       |
 3882|   100k|    AllocEdgeList( &FixedLargeRingStereoEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|   100k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 3883|   100k|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|   100k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 3884|   100k|    bFixedCarbonCharges = 0;
 3885|       |
 3886|   100k|    if (forbidden_stereo_edge_mask)
  ------------------
  |  Branch (3886:9): [True: 13.1k, False: 87.7k]
  ------------------
 3887|  13.1k|    {
 3888|  86.6k|        for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (3888:21): [True: 73.4k, False: 13.1k]
  ------------------
 3889|  73.4k|        {
 3890|   203k|            for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (3890:25): [True: 130k, False: 73.4k]
  ------------------
 3891|   130k|            {
 3892|   130k|                if (pBNS->edge[k = pBNS->vert[i].iedge[j]].forbidden == forbidden_stereo_edge_mask)
  ------------------
  |  Branch (3892:21): [True: 186, False: 130k]
  ------------------
 3893|    186|                {
 3894|    186|                    int nMinRingSize = is_bond_in_Nmax_memb_ring( at2, i, j, pStruct->pbfsq->q,
 3895|    186|                                                             pStruct->pbfsq->nAtomLevel,
 3896|    186|                                                             pStruct->pbfsq->cSource, 99 /* max ring size */ );
 3897|    186|                    if (0 < nMinRingSize && ( ret = AddToEdgeList( &FixedLargeRingStereoEdges, k, 64 ) ))
  ------------------
  |  Branch (3897:25): [True: 128, False: 58]
  |  Branch (3897:45): [True: 0, False: 128]
  ------------------
 3898|      0|                    {
 3899|      0|                        goto exit_function;
 3900|      0|                    }
 3901|    186|                }
 3902|   130k|            }
 3903|  73.4k|        }
 3904|  13.1k|        if (!FixedLargeRingStereoEdges.num_edges)
  ------------------
  |  Branch (3904:13): [True: 13.0k, False: 52]
  ------------------
 3905|  13.0k|        {
 3906|  13.0k|            goto exit_function;
 3907|  13.0k|        }
 3908|     52|        else
 3909|     52|        {
 3910|       |             /* allow stereobonds in rings change */
 3911|     52|            RemoveForbiddenEdgeMask( pBNS, &FixedLargeRingStereoEdges, forbidden_stereo_edge_mask );
 3912|     52|        }
 3913|  13.1k|    }
 3914|       |
 3915|  87.8k|    memcpy(at2, at, len_at * sizeof(at2[0]));
 3916|  87.8k|    pStruct->at = at2;
 3917|  87.8k|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 3918|  87.8k|    pStruct->at = at;
 3919|  87.8k|    if (ret2 < 0)
  ------------------
  |  Branch (3919:9): [True: 0, False: 87.8k]
  ------------------
 3920|      0|    {
 3921|      0|        ret = ret2;
 3922|      0|        goto exit_function;
 3923|      0|    }
 3924|       |    /* count charges */
 3925|  87.8k|    num_pos = num_neg = 0;
 3926|   920k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (3926:17): [True: 833k, False: 87.8k]
  ------------------
 3927|   833k|    {
 3928|   833k|        if (!pVA[i].cMetal && !at2[i].radical)
  ------------------
  |  Branch (3928:13): [True: 514k, False: 318k]
  |  Branch (3928:31): [True: 495k, False: 18.6k]
  ------------------
 3929|   495k|        {
 3930|   495k|            num_pos += ( at2[i].charge > 0 );
 3931|   495k|            num_neg += ( at2[i].charge < 0 );
 3932|   495k|        }
 3933|   833k|    }
 3934|  87.8k|    num_min = inchi_min( num_pos, num_neg );
  ------------------
  |  |  139|  87.8k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 7.00k, False: 80.8k]
  |  |  ------------------
  ------------------
 3935|       |
 3936|       |
 3937|  87.8k|    if (num_min &&
  ------------------
  |  Branch (3937:9): [True: 15.1k, False: 72.6k]
  ------------------
 3938|  15.1k|        ( k = pTCGroups->nGroup[TCG_Plus] ) >= 0 &&
  ------------------
  |  Branch (3938:9): [True: 15.1k, False: 0]
  ------------------
 3939|  15.1k|        ( ePlusSuper = pTCGroups->pTCG[k].nForwardEdge ) > 0 &&
  ------------------
  |  Branch (3939:9): [True: 15.1k, False: 0]
  ------------------
 3940|  15.1k|        ( vPlusSuper = pTCGroups->pTCG[k].nVertexNumber ) >= num_at &&
  ------------------
  |  Branch (3940:9): [True: 15.1k, False: 0]
  ------------------
 3941|  15.1k|         !( pEdge = pBNS->edge + ePlusSuper )->forbidden)
  ------------------
  |  Branch (3941:10): [True: 15.1k, False: 0]
  ------------------
 3942|  15.1k|    {
 3943|       |
 3944|  15.1k|        vPlusMinus = pEdge->neighbor12 ^ vPlusSuper;
 3945|  15.1k|        pvPlusSuper = pBNS->vert + vPlusSuper;
 3946|  15.1k|        pvPlusMinus = pBNS->vert + vPlusMinus;
 3947|  15.1k|        num_min = inchi_min( num_min, pEdge->flow );
  ------------------
  |  |  139|  15.1k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 7.99k, False: 7.17k]
  |  |  ------------------
  ------------------
 3948|  15.1k|        nDeltaPlus1 = pvPlusSuper->st_edge.cap - pvPlusSuper->st_edge.flow;
 3949|  15.1k|        nDeltaMinus1 = pvPlusMinus->st_edge.cap - pvPlusMinus->st_edge.flow;
 3950|  15.1k|        if (num_min && ( !nDeltaPlus1 && !nDeltaMinus1 ))
  ------------------
  |  Branch (3950:13): [True: 15.1k, False: 0]
  |  Branch (3950:26): [True: 15.1k, False: 4]
  |  Branch (3950:42): [True: 15.1k, False: 27]
  ------------------
 3951|  15.1k|        {
 3952|  15.1k|            if (!bFixedCarbonCharges)
  ------------------
  |  Branch (3952:17): [True: 15.1k, False: 0]
  ------------------
 3953|  15.1k|            { /* 02-02-2006 */
 3954|       |              /* do not let carbon atoms get charged */
 3955|  15.1k|                if (0 > ( ret = ForbidCarbonChargeEdges( pBNS, pTCGroups, &CarbonChargeEdges, forbidden_edge_mask ) ))
  ------------------
  |  Branch (3955:21): [True: 0, False: 15.1k]
  ------------------
 3956|      0|                {
 3957|      0|                    goto exit_function;
 3958|      0|                }
 3959|  15.1k|                bFixedCarbonCharges++;
 3960|  15.1k|            }
 3961|  15.1k|            delta = 1;
 3962|  15.1k|            pEdge->forbidden |= forbidden_edge_mask;
 3963|  15.1k|            pBNS->edge_forbidden_mask |= forbidden_edge_mask;
 3964|  17.9k|            for (i = 0; i < num_min; i += delta)
  ------------------
  |  Branch (3964:25): [True: 15.9k, False: 1.98k]
  ------------------
 3965|  15.9k|            {
 3966|       |                /* cancel 1 pair of charges at a time   */
 3967|       |                /* an attempt to cancel all at once may */
 3968|       |                /* convert a pair of N(IV)(+) into a pair of N(V) neutral with total charge reduced by 2 */
 3969|  15.9k|                pEdge->flow -= delta;
 3970|  15.9k|                pvPlusSuper->st_edge.flow -= delta;
 3971|  15.9k|                pvPlusMinus->st_edge.flow -= delta;
 3972|  15.9k|                pBNS->tot_st_flow -= 2 * delta;
 3973|       |                /* test for charhe cancellation */
 3974|  15.9k|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 3975|  15.9k|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 3976|  15.9k|                if (ret < 0)
  ------------------
  |  Branch (3976:21): [True: 0, False: 15.9k]
  ------------------
 3977|      0|                {
 3978|      0|                    goto exit_function;
 3979|      0|                }
 3980|  15.9k|                if (ret == 1 && ( (vPathEnd == vPlusSuper && vPathStart == vPlusMinus) ||
  ------------------
  |  Branch (3980:21): [True: 3.35k, False: 12.6k]
  |  Branch (3980:36): [True: 468, False: 2.89k]
  |  Branch (3980:62): [True: 202, False: 266]
  ------------------
 3981|  3.15k|                    (vPathEnd == vPlusMinus && vPathStart == vPlusSuper) ) && nDeltaCharge < 0) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (3981:22): [True: 2.87k, False: 282]
  |  Branch (3981:48): [True: 2.63k, False: 244]
  |  Branch (3981:79): [True: 2.81k, False: 19]
  ------------------
 3982|  2.81k|                {
 3983|  2.81k|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 3984|  2.81k|                    ( *pnNumRunBNS )++;
 3985|  2.81k|                    if (ret < 0)
  ------------------
  |  Branch (3985:25): [True: 0, False: 2.81k]
  ------------------
 3986|      0|                    {
 3987|      0|                        goto exit_function;
 3988|      0|                    }
 3989|  2.81k|                    else
 3990|  2.81k|                        if (ret == 1)
  ------------------
  |  Branch (3990:29): [True: 2.81k, False: 0]
  ------------------
 3991|  2.81k|                        {
 3992|  2.81k|                            *pnTotalDelta += ret;
 3993|  2.81k|                        }
 3994|      0|                        else
 3995|      0|                        {
 3996|      0|                            ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3997|      0|                            goto exit_function;
 3998|      0|                        }
 3999|  2.81k|                }
 4000|  13.1k|                else
 4001|  13.1k|                {
 4002|  13.1k|                    pEdge->flow += delta;
 4003|  13.1k|                    pvPlusSuper->st_edge.flow += delta;
 4004|  13.1k|                    pvPlusMinus->st_edge.flow += delta;
 4005|  13.1k|                    pBNS->tot_st_flow += 2 * delta;
 4006|  13.1k|                    break;
 4007|  13.1k|                }
 4008|  15.9k|            }
 4009|  15.1k|            num_min -= i; /* how many pairs of charges left */
 4010|  15.1k|            pEdge->forbidden &= inv_forbidden_edge_mask;
 4011|  15.1k|        }
 4012|  15.1k|        nDeltaPlus1 = pvPlusSuper->st_edge.cap - pvPlusSuper->st_edge.flow;
 4013|  15.1k|        nDeltaMinus1 = pvPlusMinus->st_edge.cap - pvPlusMinus->st_edge.flow;
 4014|  15.1k|        if (num_min > 1 && ( !nDeltaPlus1 && !nDeltaMinus1 ))
  ------------------
  |  Branch (4014:13): [True: 2.51k, False: 12.6k]
  |  Branch (4014:30): [True: 2.51k, False: 2]
  |  Branch (4014:46): [True: 2.50k, False: 8]
  ------------------
 4015|  2.50k|        {
 4016|  2.50k|            delta = 2;
 4017|  2.50k|            pEdge->forbidden |= forbidden_edge_mask;
 4018|  2.50k|            pBNS->edge_forbidden_mask |= forbidden_edge_mask;
 4019|  2.50k|            for (i = 0; i < num_min; i += delta)
  ------------------
  |  Branch (4019:25): [True: 2.50k, False: 0]
  ------------------
 4020|  2.50k|            {
 4021|       |                /* cancel 2 pairs of opposite charges at a time   */
 4022|       |                /* 1. test cancellation of a pair of (+) charges */
 4023|  2.50k|                pvPlusSuper->st_edge.cap += delta;
 4024|  2.50k|                pBNS->tot_st_cap += delta;
 4025|  2.50k|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4026|  2.50k|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4027|  2.50k|                if (ret < 0)
  ------------------
  |  Branch (4027:21): [True: 0, False: 2.50k]
  ------------------
 4028|      0|                {
 4029|      0|                    goto exit_function;
 4030|      0|                }
 4031|  2.50k|                pvPlusSuper->st_edge.cap -= delta;
 4032|  2.50k|                pBNS->tot_st_cap -= delta;
 4033|  2.50k|                if (ret != 1 || ( vPathEnd != vPlusSuper || vPathStart != vPlusSuper ) || nDeltaCharge >= 0)
  ------------------
  |  Branch (4033:21): [True: 2.24k, False: 260]
  |  Branch (4033:35): [True: 4, False: 256]
  |  Branch (4033:61): [True: 26, False: 230]
  |  Branch (4033:91): [True: 1, False: 229]
  ------------------
 4034|  2.27k|                {
 4035|  2.27k|                    break;
 4036|  2.27k|                }
 4037|       |                /* 2. test cancellation of a pair of (-) charges */
 4038|    229|                pvPlusMinus->st_edge.cap += delta;
 4039|    229|                pBNS->tot_st_cap += delta;
 4040|    229|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4041|    229|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4042|    229|                if (ret < 0)
  ------------------
  |  Branch (4042:21): [True: 0, False: 229]
  ------------------
 4043|      0|                {
 4044|      0|                    goto exit_function;
 4045|      0|                }
 4046|    229|                pvPlusMinus->st_edge.cap -= delta;
 4047|    229|                pBNS->tot_st_cap -= delta;
 4048|    229|                if (ret != 1 || ( vPathEnd != vPlusMinus || vPathStart != vPlusMinus ) || nDeltaCharge >= 0)
  ------------------
  |  Branch (4048:21): [True: 228, False: 1]
  |  Branch (4048:35): [True: 0, False: 1]
  |  Branch (4048:61): [True: 1, False: 0]
  |  Branch (4048:91): [True: 0, False: 0]
  ------------------
 4049|    229|                {
 4050|    229|                    break;
 4051|    229|                }
 4052|       |                /* 3. Actually cancel the pair of charges */
 4053|      0|                pEdge->flow -= delta;
 4054|      0|                pvPlusSuper->st_edge.flow -= delta;
 4055|      0|                pvPlusMinus->st_edge.flow -= delta;
 4056|      0|                pBNS->tot_st_flow -= 2 * delta;
 4057|      0|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 4058|      0|                ( *pnNumRunBNS )++;
 4059|      0|                if (ret < 0)
  ------------------
  |  Branch (4059:21): [True: 0, False: 0]
  ------------------
 4060|      0|                {
 4061|      0|                    goto exit_function;
 4062|      0|                }
 4063|      0|                else
 4064|      0|                {
 4065|      0|                    if (ret == 2)
  ------------------
  |  Branch (4065:25): [True: 0, False: 0]
  ------------------
 4066|      0|                    {
 4067|      0|                        *pnTotalDelta += ret;
 4068|      0|                    }
 4069|      0|                    else
 4070|      0|                    {
 4071|      0|                        ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 4072|      0|                        goto exit_function;
 4073|      0|                    }
 4074|      0|                }
 4075|      0|            }
 4076|  2.50k|            num_min -= i; /* how many pairs of charges left */
 4077|  2.50k|            pEdge->forbidden &= inv_forbidden_edge_mask;
 4078|  2.50k|        }
 4079|  15.1k|    }
 4080|  87.8k|    memcpy(at2, at, len_at * sizeof(at2[0]));
 4081|  87.8k|    pStruct->at = at;
 4082|       |
 4083|   100k|exit_function:
 4084|   100k|    if (bFixedCarbonCharges)
  ------------------
  |  Branch (4084:9): [True: 15.1k, False: 85.7k]
  ------------------
 4085|  15.1k|    {
 4086|  15.1k|        RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 4087|  15.1k|        AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  15.1k|#define EDGE_LIST_FREE   (-2)
  ------------------
 4088|  15.1k|    }
 4089|   100k|    if (forbidden_stereo_edge_mask && FixedLargeRingStereoEdges.num_edges)
  ------------------
  |  Branch (4089:9): [True: 13.1k, False: 87.7k]
  |  Branch (4089:39): [True: 52, False: 13.0k]
  ------------------
 4090|     52|    {
 4091|     52|        SetForbiddenEdgeMask( pBNS, &FixedLargeRingStereoEdges, forbidden_stereo_edge_mask );
 4092|     52|    }
 4093|   100k|    AllocEdgeList( &FixedLargeRingStereoEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|   100k|#define EDGE_LIST_FREE   (-2)
  ------------------
 4094|       |
 4095|   100k|    return ret < 0 ? ret : num_min;
  ------------------
  |  Branch (4095:12): [True: 0, False: 100k]
  ------------------
 4096|  87.8k|}
RestoreCyanoGroup:
 4529|  87.7k|{
 4530|  87.7k|    Vertex     vPathStart, vPathEnd;
 4531|  87.7k|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 4532|  87.7k|    BNS_EDGE  *pe;
 4533|       |
 4534|  87.7k|    int i, j, ret2, ret;
 4535|  87.7k|    int num_at = pStruct->num_atoms;
 4536|  87.7k|    int num_deleted_H = pStruct->num_deleted_H;
 4537|  87.7k|    int len_at = num_at + num_deleted_H;
 4538|  87.7k|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 4539|  87.7k|    Vertex v1, v2;
 4540|       |
 4541|  87.7k|    EDGE_LIST CarbonChargeEdges;
 4542|       |
 4543|  87.7k|    ret = 0;
 4544|  87.7k|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  87.7k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 4545|       |
 4546|  87.7k|    memcpy(at2, at, len_at * sizeof(at2[0]));
 4547|  87.7k|    pStruct->at = at2;
 4548|  87.7k|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 4549|  87.7k|    pStruct->at = at;
 4550|  87.7k|    if (ret2 < 0)
  ------------------
  |  Branch (4550:9): [True: 0, False: 87.7k]
  ------------------
 4551|      0|    {
 4552|      0|        ret = ret2;
 4553|      0|        goto exit_function;
 4554|      0|    }
 4555|       |
 4556|   920k|    for (i = 0; i < num_at && 0 <= ret; i++)
  ------------------
  |  Branch (4556:17): [True: 832k, False: 87.7k]
  |  Branch (4556:31): [True: 832k, False: 0]
  ------------------
 4557|   832k|    {
 4558|   832k|        if (at2[i].valence == 1 &&
  ------------------
  |  Branch (4558:13): [True: 79.1k, False: 753k]
  ------------------
 4559|  79.1k|             at2[i].num_H == 0 &&
  ------------------
  |  Branch (4559:14): [True: 78.4k, False: 744]
  ------------------
 4560|  78.4k|             at2[i].chem_bonds_valence == 2 &&
  ------------------
  |  Branch (4560:14): [True: 20.9k, False: 57.4k]
  ------------------
 4561|  20.9k|             at2[i].charge == -1 &&
  ------------------
  |  Branch (4561:14): [True: 7.80k, False: 13.1k]
  ------------------
 4562|  7.80k|             at2[i].radical == 0 &&
  ------------------
  |  Branch (4562:14): [True: 7.13k, False: 671]
  ------------------
 4563|  7.13k|             pVA[i].cNumValenceElectrons == 5 &&  /* terminal N(-)=, P, As, Sb, Bi */
  ------------------
  |  Branch (4563:14): [True: 7.02k, False: 106]
  ------------------
 4564|  7.02k|             pVA[i].nCMinusGroupEdge > 0 &&
  ------------------
  |  Branch (4564:14): [True: 7.02k, False: 0]
  ------------------
 4565|  7.02k|             pVA[i].nTautGroupEdge == 0 &&
  ------------------
  |  Branch (4565:14): [True: 7.02k, False: 0]
  ------------------
 4566|  7.02k|             at2[j = at2[i].neighbor[0]].valence == 2 &&
  ------------------
  |  Branch (4566:14): [True: 2.88k, False: 4.13k]
  ------------------
 4567|  2.88k|             at2[j].num_H == 0 &&
  ------------------
  |  Branch (4567:14): [True: 2.87k, False: 10]
  ------------------
 4568|  2.87k|             at2[j].chem_bonds_valence == 4 &&
  ------------------
  |  Branch (4568:14): [True: 1.26k, False: 1.61k]
  ------------------
 4569|  1.26k|             at2[j].charge == 0 &&
  ------------------
  |  Branch (4569:14): [True: 25, False: 1.23k]
  ------------------
 4570|     25|             at2[j].radical == 0 &&
  ------------------
  |  Branch (4570:14): [True: 24, False: 1]
  ------------------
 4571|     24|             pVA[j].cNumValenceElectrons == 4 && /* C or Si or Ge or Sn or Pb */
  ------------------
  |  Branch (4571:14): [True: 18, False: 6]
  ------------------
 4572|     18|             pVA[i].cnListIndex > 0 &&
  ------------------
  |  Branch (4572:14): [True: 18, False: 0]
  ------------------
 4573|     18|             cnList[pVA[i].cnListIndex - 1].bits == cn_bits_MN)
  ------------------
  |  |  436|     18|#define cn_bits_MN  MAKE_CN_BITS(cn_bits_M, cn_bits_N, 0, 0)
  |  |  ------------------
  |  |  |  |  421|     18|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|     18|#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))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|     18|#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))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|     18|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4573:14): [True: 17, False: 1]
  ------------------
 4574|     17|        {
 4575|       |            /* found N(-)=C= */
 4576|     17|            pe = pBNS->edge + ( (long long)pVA[i].nCMinusGroupEdge - 1 ); /* N#N(+) triple bond edge */ /* djb-rwth: cast operator added */
 4577|       |
 4578|     17|            if (!pe->flow)
  ------------------
  |  Branch (4578:17): [True: 0, False: 17]
  ------------------
 4579|      0|            {
 4580|      0|                continue; /* wrong atom ??? Strange... */
 4581|      0|            }
 4582|     17|            v1 = pe->neighbor1;
 4583|     17|            v2 = pe->neighbor12 ^ v1;
 4584|     17|            pe->flow--;
 4585|     17|            pBNS->vert[v1].st_edge.flow--;
 4586|     17|            pBNS->vert[v2].st_edge.flow--;
 4587|     17|            pBNS->tot_st_flow -= 2;
 4588|     17|            pe->forbidden |= forbidden_edge_mask;
 4589|       |
 4590|       |            /* do not let carbon atoms get charged */
 4591|     17|            if (0 > ( ret = ForbidCarbonChargeEdges( pBNS, pTCGroups, &CarbonChargeEdges, forbidden_edge_mask ) ))
  ------------------
  |  Branch (4591:17): [True: 0, False: 17]
  ------------------
 4592|      0|            {
 4593|      0|                goto exit_function;
 4594|      0|            }
 4595|       |
 4596|     17|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4597|     17|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4598|       |
 4599|     17|            if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (4599:17): [True: 15, False: 2]
  |  Branch (4599:32): [True: 1, False: 14]
  |  Branch (4599:50): [True: 1, False: 0]
  ------------------
 4600|     14|                (vPathEnd == v2 && vPathStart == v1) ) && nDeltaCharge == 1) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (4600:18): [True: 14, False: 0]
  |  Branch (4600:36): [True: 9, False: 5]
  |  Branch (4600:59): [True: 6, False: 4]
  ------------------
 4601|      6|            {
 4602|      6|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 4603|      6|                ( *pnNumRunBNS )++;
 4604|      6|                *pnTotalDelta += ret;
 4605|      6|            }
 4606|     11|            else
 4607|     11|            {
 4608|     11|                pe->flow++;
 4609|     11|                pBNS->vert[v1].st_edge.flow++;
 4610|     11|                pBNS->vert[v2].st_edge.flow++;
 4611|     11|                pBNS->tot_st_flow += 2;
 4612|     11|            }
 4613|     17|            RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 4614|       |
 4615|     17|            pe->forbidden &= inv_forbidden_edge_mask; /* unmask the edges */
 4616|     17|        }
 4617|   832k|    }
 4618|       |
 4619|  87.7k|exit_function:
 4620|       |
 4621|  87.7k|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  87.7k|#define EDGE_LIST_FREE   (-2)
  ------------------
 4622|       |
 4623|  87.7k|    return ret;
 4624|  87.7k|}
RestoreIsoCyanoGroup:
 4638|  87.7k|{
 4639|  87.7k|#define INC_EDGE_LIST 16
 4640|  87.7k|    Vertex     vPathStart, vPathEnd;
 4641|  87.7k|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms, num_failed, num_success;
 4642|  87.7k|    BNS_EDGE  *pe;
 4643|  87.7k|    Vertex    v1, v2;
 4644|       |
 4645|  87.7k|    int i, j, ret2, ret, bIsCarbon;
 4646|  87.7k|    int num_at = pStruct->num_atoms;
 4647|  87.7k|    int num_deleted_H = pStruct->num_deleted_H;
 4648|  87.7k|    int len_at = num_at + num_deleted_H;
 4649|  87.7k|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 4650|  87.7k|    EdgeIndex eNMinusEdge, eNPlusEdge, eNPlusEdge1, eN34Edge;
 4651|  87.7k|    EdgeIndex eNFlowerEdge1;
 4652|       |
 4653|  87.7k|    EDGE_LIST CarbonChargeEdges, AllChargeEdges, IsoCyanoCarbonChargeEdges;
 4654|       |
 4655|  87.7k|    ret = 0;
 4656|  87.7k|    num_failed = num_success = 0;
 4657|  87.7k|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_CLEAR ); /* carbon charge edges */
  ------------------
  |  |  242|  87.7k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 4658|  87.7k|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_CLEAR );    /* heteroatom charge edges */
  ------------------
  |  |  242|  87.7k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 4659|  87.7k|    AllocEdgeList( &IsoCyanoCarbonChargeEdges, EDGE_LIST_CLEAR );   /* C in C(+)#N(+) charge edges */
  ------------------
  |  |  242|  87.7k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 4660|       |
 4661|  87.7k|    memcpy(at2, at, len_at * sizeof(at2[0]));
 4662|  87.7k|    pStruct->at = at2;
 4663|  87.7k|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 4664|  87.7k|    pStruct->at = at;
 4665|  87.7k|    if (ret2 < 0)
  ------------------
  |  Branch (4665:9): [True: 0, False: 87.7k]
  ------------------
 4666|      0|    {
 4667|      0|        ret = ret2;
 4668|      0|        goto exit_function;
 4669|      0|    }
 4670|       |    /* 1st attempt: take care of C(+)#N(+)-  => C(-)#N(+)- and remove 2 negative charges */
 4671|       |    /* This would produce nDeltaCharge = 2 */
 4672|  87.7k|    AllocEdgeList( &CarbonChargeEdges, 2 * num_at );
 4673|   920k|    for (i = 0; i < num_at && 0 <= ret; i++)
  ------------------
  |  Branch (4673:17): [True: 832k, False: 87.7k]
  |  Branch (4673:31): [True: 832k, False: 0]
  ------------------
 4674|   832k|    {
 4675|       |        /* accumulate edges for subsequent fixing them */
 4676|   832k|        bIsCarbon = ( pVA[i].cNumValenceElectrons == 4 && pVA[i].cPeriodicRowNumber == 1 );
  ------------------
  |  Branch (4676:23): [True: 92.9k, False: 739k]
  |  Branch (4676:59): [True: 88.2k, False: 4.73k]
  ------------------
 4677|       |        /* djb-rwth: removing redundant variables/code */
 4678|   832k|        if (( eNMinusEdge = pVA[i].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (4678:13): [True: 119k, False: 712k]
  ------------------
 4679|   119k|             !pBNS->edge[eNMinusEdge].forbidden)
  ------------------
  |  Branch (4679:14): [True: 119k, False: 0]
  ------------------
 4680|   119k|        {
 4681|   119k|            if (bIsCarbon)
  ------------------
  |  Branch (4681:17): [True: 25.6k, False: 94.2k]
  ------------------
 4682|  25.6k|            {
 4683|  25.6k|                if ((ret = AddToEdgeList( &CarbonChargeEdges, eNMinusEdge, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 4639|  25.6k|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (4683:21): [True: 0, False: 25.6k]
  ------------------
 4684|      0|                {
 4685|      0|                    goto exit_function;
 4686|      0|                }
 4687|  25.6k|            }
 4688|  94.2k|            else
 4689|  94.2k|            {
 4690|  94.2k|                if (!pVA[i].cMetal && !at2[i].endpoint && at2[i].charge != -1)
  ------------------
  |  Branch (4690:21): [True: 70.0k, False: 24.2k]
  |  Branch (4690:39): [True: 70.0k, False: 0]
  |  Branch (4690:59): [True: 46.6k, False: 23.4k]
  ------------------
 4691|  46.6k|                {
 4692|  46.6k|                    if ((ret = AddToEdgeList( &AllChargeEdges, eNMinusEdge, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 4639|  46.6k|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (4692:25): [True: 0, False: 46.6k]
  ------------------
 4693|      0|                    {
 4694|      0|                        goto exit_function;
 4695|      0|                    }
 4696|  46.6k|                }
 4697|  94.2k|            }
 4698|   119k|        }
 4699|   832k|        if (( eNPlusEdge = pVA[i].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (4699:13): [True: 138k, False: 694k]
  ------------------
 4700|   138k|             !pBNS->edge[eNPlusEdge].forbidden)
  ------------------
  |  Branch (4700:14): [True: 133k, False: 5.04k]
  ------------------
 4701|   133k|        {
 4702|   133k|            if (bIsCarbon)
  ------------------
  |  Branch (4702:17): [True: 25.6k, False: 107k]
  ------------------
 4703|  25.6k|            {
 4704|  25.6k|                if ((ret = AddToEdgeList( &CarbonChargeEdges, eNPlusEdge, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 4639|  25.6k|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (4704:21): [True: 0, False: 25.6k]
  ------------------
 4705|      0|                {
 4706|      0|                    goto exit_function;
 4707|      0|                }
 4708|  25.6k|            }
 4709|   107k|            else
 4710|   107k|            {
 4711|   107k|                if (!pVA[i].cMetal && !at2[i].endpoint)
  ------------------
  |  Branch (4711:21): [True: 83.1k, False: 24.2k]
  |  Branch (4711:39): [True: 83.1k, False: 0]
  ------------------
 4712|  83.1k|                {
 4713|  83.1k|                    if ((ret = AddToEdgeList( &AllChargeEdges, eNPlusEdge, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 4639|  83.1k|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (4713:25): [True: 0, False: 83.1k]
  ------------------
 4714|      0|                    {
 4715|      0|                        goto exit_function;
 4716|      0|                    }
 4717|  83.1k|                    if (pVA[i].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (4717:25): [True: 40.3k, False: 42.7k]
  ------------------
 4718|  40.3k|                         NO_VERTEX != ( eNFlowerEdge1 = GetChargeFlowerUpperEdge( pBNS, pVA, eNPlusEdge ) ) &&
  ------------------
  |  |  118|  40.3k|#define NO_VERTEX    -2
  ------------------
  |  Branch (4718:26): [True: 8.37k, False: 32.0k]
  ------------------
 4719|  8.37k|                         !pBNS->edge[eNFlowerEdge1].flow)
  ------------------
  |  Branch (4719:26): [True: 4.67k, False: 3.70k]
  ------------------
 4720|  4.67k|                    {
 4721|  4.67k|                        if ((ret = AddToEdgeList( &AllChargeEdges, eNFlowerEdge1, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 4639|  4.67k|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (4721:29): [True: 0, False: 4.67k]
  ------------------
 4722|      0|                        {
 4723|      0|                            goto exit_function;
 4724|      0|                        }
 4725|  4.67k|                    }
 4726|  83.1k|                }
 4727|   107k|            }
 4728|   133k|        }
 4729|   832k|        if (bIsCarbon &&
  ------------------
  |  Branch (4729:13): [True: 88.2k, False: 744k]
  ------------------
 4730|  88.2k|             0 <= eNMinusEdge &&
  ------------------
  |  Branch (4730:14): [True: 25.6k, False: 62.5k]
  ------------------
 4731|  25.6k|             0 <= eNPlusEdge &&
  ------------------
  |  Branch (4731:14): [True: 25.6k, False: 0]
  ------------------
 4732|  25.6k|             at2[i].valence == 1 &&
  ------------------
  |  Branch (4732:14): [True: 11.9k, False: 13.6k]
  ------------------
 4733|  11.9k|             at2[i].num_H == 0 &&
  ------------------
  |  Branch (4733:14): [True: 11.9k, False: 12]
  ------------------
 4734|  11.9k|             at2[i].radical == 0 &&
  ------------------
  |  Branch (4734:14): [True: 6.61k, False: 5.35k]
  ------------------
 4735|  6.61k|             !pBNS->edge[eNMinusEdge].forbidden &&
  ------------------
  |  Branch (4735:14): [True: 6.61k, False: 0]
  ------------------
 4736|  6.61k|             pBNS->edge[eNMinusEdge].flow == 0 &&
  ------------------
  |  Branch (4736:14): [True: 2.87k, False: 3.74k]
  ------------------
 4737|  2.87k|             !pBNS->edge[eNPlusEdge].forbidden &&
  ------------------
  |  Branch (4737:14): [True: 2.87k, False: 0]
  ------------------
 4738|  2.87k|             pBNS->edge[eNPlusEdge].flow == 0 &&   /* found terminal C(+) */
  ------------------
  |  Branch (4738:14): [True: 2.87k, False: 0]
  ------------------
 4739|       |
 4740|  2.87k|             at2[j = at2[i].neighbor[0]].valence == 2 &&
  ------------------
  |  Branch (4740:14): [True: 1.28k, False: 1.59k]
  ------------------
 4741|  1.28k|             at2[j].num_H == 0 &&
  ------------------
  |  Branch (4741:14): [True: 1.28k, False: 1]
  ------------------
 4742|  1.28k|             at2[j].radical == 0 &&
  ------------------
  |  Branch (4742:14): [True: 1.28k, False: 0]
  ------------------
 4743|  1.28k|             pVA[j].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (4743:14): [True: 585, False: 703]
  ------------------
 4744|    585|             ( eNPlusEdge1 = pVA[j].nCPlusGroupEdge - 1 ) >= 0 && 
  ------------------
  |  Branch (4744:14): [True: 585, False: 0]
  ------------------
 4745|    585|             pBNS->edge[eNPlusEdge].flow == 0) /* djb-rwth: ignoring LLVM warning: variable used */
  ------------------
  |  Branch (4745:14): [True: 585, False: 0]
  ------------------
 4746|    585|        {     /* -N(+)- */
 4747|       |
 4748|       |#ifdef NEVER /* I have not found a good reason to do this yet */
 4749|       |            /* fix (+) charge on -N(+)- as much as C charges are fixed */
 4750|       |            if (ret = AddToEdgeList( &CarbonChargeEdges, eNPlusEdge1, INC_EDGE_LIST ))
 4751|       |            {
 4752|       |                goto exit_function;
 4753|       |            }
 4754|       |            /* fix floer edge to prevent N(V) ??? */
 4755|       |            if (NO_VERTEX != ( eNFlowerEdge1 = GetChargeFlowerUpperEdge( pBNS, pVA, eNPlusEdge1 ) ) &&
 4756|       |                 !pBNS->edge[eNFlowerEdge1].flow)
 4757|       |            {
 4758|       |                if (ret = AddToEdgeList( &CarbonChargeEdges, eNFlowerEdge1, INC_EDGE_LIST ))
 4759|       |                {
 4760|       |                    goto exit_function;
 4761|       |                }
 4762|       |            }
 4763|       |#endif
 4764|       |            /*
 4765|       |               Carbon(+)         Carbon(-)
 4766|       |               ChargeStruct:     ChargeStruct:
 4767|       |
 4768|       |                         5(+C)             5(+C)
 4769|       |                        /                 //
 4770|       |               6(-C)  4          6(-C)  4
 4771|       |                   \ //             \\ /
 4772|       |                    3                 3
 4773|       |                    |                 |
 4774|       |                    2                 2
 4775|       |                    ||                ||
 4776|       |                   -C1-              -C1-
 4777|       |                    |                 |
 4778|       |
 4779|       |             3-6 is (-) Charge Edge; 4-5 is (+) Charge Edge
 4780|       |
 4781|       |             To convert the left pattern to the right one:
 4782|       |
 4783|       |             We need to release these charge edges and decrement
 4784|       |             edge 3-4 flow to change charge from (+) to (-)
 4785|       |
 4786|       |            */
 4787|       |
 4788|       |            /* find vertices 4 and 5 */
 4789|    585|            v1 = pBNS->edge[eNPlusEdge].neighbor1; /* one of two vertices incident with edge 4-5 */
 4790|    585|            v2 = pBNS->edge[eNPlusEdge].neighbor12 ^ v1;
 4791|    585|            if (IS_BNS_VT_C_GR( pBNS->vert[v1].type ))
  ------------------
  |  |   78|    585|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   71|    585|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    585|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|    585|#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)
  |  |  ------------------
  |  |  |  |   49|    585|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (78:37): [True: 585, False: 0]
  |  |  ------------------
  ------------------
 4792|    585|            {
 4793|       |                /* v1 is 5(+C) */
 4794|       |                /* djb-rwth: removing redundant variables */
 4795|    585|                v1 = v2;
 4796|       |                /* djb-rwth: removing redundant code */
 4797|    585|            }
 4798|       |            /* v1 should be 4, v2 - 5(+C) */
 4799|    585|            if (!IS_BNS_VT_CHRG_STRUCT( pBNS->vert[v1].type ) || pBNS->vert[v1].num_adj_edges != 2)
  ------------------
  |  |   82|  1.17k|#define IS_BNS_VT_CHRG_STRUCT(X)    (((X) & BNS_VERT_TYPE__AUX) &&  ((X) & BNS_VERT_TYPE_TEMP))
  |  |  ------------------
  |  |  |  |   53|    585|#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))
  |  |  ------------------
  |  |  |  |   51|    585|#define BNS_VERT_TYPE_TEMP          0x0040
  |  |  ------------------
  |  |  |  Branch (82:38): [True: 585, False: 0]
  |  |  |  Branch (82:69): [True: 585, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (4799:66): [True: 0, False: 585]
  ------------------
 4800|      0|            {
 4801|      0|                continue; /* mismatch */
 4802|      0|            }
 4803|       |            /* find edge 3-4 */
 4804|    585|            eN34Edge = pBNS->vert[v1].iedge[pBNS->vert[v1].iedge[0] == eNPlusEdge];
 4805|    585|            if (pBNS->edge[eN34Edge].forbidden || !pBNS->edge[eN34Edge].flow)
  ------------------
  |  Branch (4805:17): [True: 0, False: 585]
  |  Branch (4805:51): [True: 0, False: 585]
  ------------------
 4806|      0|            {
 4807|      0|                continue;
 4808|      0|            }
 4809|       |            /* save 3 edges: 6-3, 4-5, and 3-4 in this order */
 4810|    585|            if ((ret = AddToEdgeList( &IsoCyanoCarbonChargeEdges, eNMinusEdge, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 4639|    585|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (4810:17): [True: 0, False: 585]
  ------------------
 4811|      0|            {
 4812|      0|                goto exit_function;
 4813|      0|            }
 4814|    585|            if ((ret = AddToEdgeList( &IsoCyanoCarbonChargeEdges, eNPlusEdge, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 4639|    585|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (4814:17): [True: 0, False: 585]
  ------------------
 4815|      0|            {
 4816|      0|                goto exit_function;
 4817|      0|            }
 4818|    585|            if ((ret = AddToEdgeList( &IsoCyanoCarbonChargeEdges, eN34Edge, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 4639|    585|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (4818:17): [True: 0, False: 585]
  ------------------
 4819|      0|            {
 4820|      0|                goto exit_function;
 4821|      0|            }
 4822|    585|        }
 4823|   832k|    }
 4824|       |    /* 1st attempt: move (-) charges from heteroatoms to C(+) */
 4825|  87.7k|    SetForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 4826|  87.7k|    SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4827|  87.7k|    RemoveForbiddenEdgeMask( pBNS, &IsoCyanoCarbonChargeEdges, forbidden_edge_mask );
 4828|  88.3k|    for (i = IsoCyanoCarbonChargeEdges.num_edges - 3; 0 <= i; i -= 3)
  ------------------
  |  Branch (4828:55): [True: 585, False: 87.7k]
  ------------------
 4829|    585|    {
 4830|       |        /* djb-rwth: removing redundant code */
 4831|    585|        eN34Edge = IsoCyanoCarbonChargeEdges.pnEdges[i + 2];
 4832|       |
 4833|    585|        pe = pBNS->edge + eN34Edge;
 4834|    585|        pe->forbidden |= forbidden_edge_mask;
 4835|    585|        if (!pe->flow)
  ------------------
  |  Branch (4835:13): [True: 0, False: 585]
  ------------------
 4836|      0|        {
 4837|      0|            continue; /* already done */
 4838|      0|        }
 4839|       |
 4840|    585|        v1 = pe->neighbor1;
 4841|    585|        v2 = pe->neighbor12 ^ v1;
 4842|    585|        pe->flow--;
 4843|    585|        pBNS->vert[v1].st_edge.flow--;
 4844|    585|        pBNS->vert[v2].st_edge.flow--;
 4845|    585|        pBNS->tot_st_flow -= 2;
 4846|       |
 4847|    585|        ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4848|    585|                              &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4849|       |
 4850|    585|        if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (4850:13): [True: 274, False: 311]
  |  Branch (4850:28): [True: 3, False: 271]
  |  Branch (4850:46): [True: 3, False: 0]
  ------------------
 4851|    274|            (vPathEnd == v2 && vPathStart == v1) ) && nDeltaCharge <= -2) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (4851:14): [True: 271, False: 0]
  |  Branch (4851:32): [True: 271, False: 0]
  |  Branch (4851:55): [True: 274, False: 0]
  ------------------
 4852|    274|        {
 4853|    274|            ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 4854|    274|            ( *pnNumRunBNS )++;
 4855|    274|            *pnTotalDelta += ret;
 4856|    274|            num_success++;
 4857|    274|        }
 4858|    311|        else
 4859|    311|        {
 4860|    311|            pe->flow++;
 4861|    311|            pBNS->vert[v1].st_edge.flow++;
 4862|    311|            pBNS->vert[v2].st_edge.flow++;
 4863|    311|            pBNS->tot_st_flow += 2;
 4864|    311|            pe->forbidden &= inv_forbidden_edge_mask;
 4865|    311|            num_failed++;
 4866|    311|        }
 4867|    585|    }
 4868|  87.7k|    if (num_failed)
  ------------------
  |  Branch (4868:9): [True: 311, False: 87.4k]
  ------------------
 4869|    311|    {
 4870|       |        /* relax conditions: allow all heteroatoms to change charge */
 4871|    311|        RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4872|    622|        for (i = IsoCyanoCarbonChargeEdges.num_edges - 3; 0 <= i; i -= 3)
  ------------------
  |  Branch (4872:59): [True: 311, False: 311]
  ------------------
 4873|    311|        {
 4874|       |            /* djb-rwth: removing redundant code */
 4875|    311|            eN34Edge = IsoCyanoCarbonChargeEdges.pnEdges[i + 2];
 4876|       |
 4877|    311|            pe = pBNS->edge + eN34Edge;
 4878|    311|            pe->forbidden |= forbidden_edge_mask;
 4879|    311|            if (!pe->flow)
  ------------------
  |  Branch (4879:17): [True: 0, False: 311]
  ------------------
 4880|      0|            {
 4881|      0|                continue; /* already done */
 4882|      0|            }
 4883|       |
 4884|    311|            v1 = pe->neighbor1;
 4885|    311|            v2 = pe->neighbor12 ^ v1;
 4886|    311|            pe->flow--;
 4887|    311|            pBNS->vert[v1].st_edge.flow--;
 4888|    311|            pBNS->vert[v2].st_edge.flow--;
 4889|    311|            pBNS->tot_st_flow -= 2;
 4890|       |
 4891|    311|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4892|    311|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4893|       |
 4894|    311|            if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (4894:17): [True: 15, False: 296]
  |  Branch (4894:32): [True: 3, False: 12]
  |  Branch (4894:50): [True: 3, False: 0]
  ------------------
 4895|     15|                (vPathEnd == v2 && vPathStart == v1) ) && nDeltaCharge <= 2) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (4895:18): [True: 12, False: 0]
  |  Branch (4895:36): [True: 12, False: 0]
  |  Branch (4895:59): [True: 15, False: 0]
  ------------------
 4896|     15|            {
 4897|     15|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 4898|     15|                ( *pnNumRunBNS )++;
 4899|     15|                *pnTotalDelta += ret;
 4900|     15|                num_success++;
 4901|     15|            }
 4902|    296|            else
 4903|    296|            {
 4904|    296|                pe->flow++;
 4905|    296|                pBNS->vert[v1].st_edge.flow++;
 4906|    296|                pBNS->vert[v2].st_edge.flow++;
 4907|    296|                pBNS->tot_st_flow += 2;
 4908|    296|                pe->forbidden &= inv_forbidden_edge_mask; /* let it change if it wants */
 4909|    296|                num_failed++;
 4910|    296|            }
 4911|    311|        }
 4912|    311|    }
 4913|  87.7k|    RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 4914|  87.7k|    RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4915|  87.7k|    RemoveForbiddenEdgeMask( pBNS, &IsoCyanoCarbonChargeEdges, forbidden_edge_mask );
 4916|       |
 4917|       |
 4918|  87.7k|exit_function:
 4919|       |
 4920|  87.7k|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  87.7k|#define EDGE_LIST_FREE   (-2)
  ------------------
 4921|  87.7k|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  87.7k|#define EDGE_LIST_FREE   (-2)
  ------------------
 4922|  87.7k|    AllocEdgeList( &IsoCyanoCarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  87.7k|#define EDGE_LIST_FREE   (-2)
  ------------------
 4923|       |
 4924|  87.7k|    return ret;
 4925|  87.7k|#undef INC_EDGE_LIST
 4926|  87.7k|}
FixMetal_Nminus_Ominus:
 4940|  87.7k|{
 4941|  87.7k|#define INC_EDGE_LIST 16
 4942|  87.7k|    Vertex     vPathStart, vPathEnd;
 4943|  87.7k|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 4944|  87.7k|    int        num_success, n; /* djb-rwth: removing redundant variables */
 4945|  87.7k|    BNS_EDGE  *pe;
 4946|  87.7k|    Vertex    v1, v2;
 4947|       |
 4948|  87.7k|    int i, j, k, ret2, ret;
 4949|  87.7k|    int num_at = pStruct->num_atoms;
 4950|  87.7k|    int num_deleted_H = pStruct->num_deleted_H;
 4951|  87.7k|    int len_at = num_at + num_deleted_H;
 4952|  87.7k|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 4953|  87.7k|    EdgeIndex e, eNMinusEdge, eNMinusEdge1, eNMinusEdge2, eNPlusEdge2;
 4954|       |
 4955|  87.7k|    EDGE_LIST AllChargeEdges;
 4956|       |
 4957|  87.7k|    ret = 0;
 4958|  87.7k|    num_success = 0; /* djb-rwth: removing redundant code */
 4959|  87.7k|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  87.7k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 4960|       |
 4961|  87.7k|    memcpy(at2, at, len_at * sizeof(at2[0]));
 4962|  87.7k|    pStruct->at = at2;
 4963|  87.7k|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 4964|  87.7k|    pStruct->at = at;
 4965|  87.7k|    if (ret2 < 0)
  ------------------
  |  Branch (4965:9): [True: 0, False: 87.7k]
  ------------------
 4966|      0|    {
 4967|      0|        ret = ret2;
 4968|      0|        goto exit_function;
 4969|      0|    }
 4970|       |    /* attepmt #1 N#N(+)-N => N(-)=N(+)=N */
 4971|   920k|    for (i = 0; i < num_at && 0 <= ret; i++)
  ------------------
  |  Branch (4971:17): [True: 832k, False: 87.7k]
  |  Branch (4971:31): [True: 832k, False: 0]
  ------------------
 4972|   832k|    {
 4973|   832k|        if (at2[i].valence == 1 &&
  ------------------
  |  Branch (4973:13): [True: 79.1k, False: 753k]
  ------------------
 4974|  79.1k|             at2[i].num_H == 0 &&
  ------------------
  |  Branch (4974:14): [True: 78.4k, False: 744]
  ------------------
 4975|  78.4k|             at2[i].radical == 0 &&
  ------------------
  |  Branch (4975:14): [True: 64.9k, False: 13.4k]
  ------------------
 4976|  64.9k|             pVA[i].cNumValenceElectrons == 6 &&  /* terminal -O */
  ------------------
  |  Branch (4976:14): [True: 18.6k, False: 46.3k]
  ------------------
 4977|  18.6k|             ( eNMinusEdge = pVA[i].nCMinusGroupEdge - 1 ) >= 0 && pBNS->edge[eNMinusEdge].flow == 1 &&
  ------------------
  |  Branch (4977:14): [True: 18.4k, False: 241]
  |  Branch (4977:68): [True: 9.36k, False: 9.04k]
  ------------------
 4978|  9.36k|             !pBNS->edge[eNMinusEdge].forbidden && /* terminal O(-) */
  ------------------
  |  Branch (4978:14): [True: 9.36k, False: 0]
  ------------------
 4979|       |
 4980|  9.36k|             at2[j = at2[i].neighbor[0]].valence == 2 &&
  ------------------
  |  Branch (4980:14): [True: 2.10k, False: 7.26k]
  ------------------
 4981|  2.10k|             at2[j].num_H == 0 &&
  ------------------
  |  Branch (4981:14): [True: 2.09k, False: 11]
  ------------------
 4982|  2.09k|             at2[j].radical == 0 &&
  ------------------
  |  Branch (4982:14): [True: 2.05k, False: 37]
  ------------------
 4983|  2.05k|             pVA[j].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (4983:14): [True: 230, False: 1.82k]
  ------------------
 4984|    230|             ( eNMinusEdge1 = pVA[j].nCMinusGroupEdge - 1 ) >= 0 && pBNS->edge[eNMinusEdge1].flow == 1 &&
  ------------------
  |  Branch (4984:14): [True: 224, False: 6]
  |  Branch (4984:69): [True: 28, False: 196]
  ------------------
 4985|     28|             !pBNS->edge[eNMinusEdge1].forbidden &&
  ------------------
  |  Branch (4985:14): [True: 28, False: 0]
  ------------------
 4986|       |
 4987|     28|             pVA[k = at2[j].neighbor[at2[j].neighbor[0] == i]].cMetal &&
  ------------------
  |  Branch (4987:14): [True: 18, False: 10]
  ------------------
 4988|       |
 4989|     18|             ( eNMinusEdge2 = pVA[k].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (4989:14): [True: 18, False: 0]
  ------------------
 4990|     18|             !pBNS->edge[eNMinusEdge2].forbidden &&
  ------------------
  |  Branch (4990:14): [True: 18, False: 0]
  ------------------
 4991|     18|             ( eNPlusEdge2 = pVA[k].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (4991:14): [True: 18, False: 0]
  ------------------
 4992|     18|             !pBNS->edge[eNPlusEdge2].forbidden)
  ------------------
  |  Branch (4992:14): [True: 18, False: 0]
  ------------------
 4993|     18|        {
 4994|       |            /* found M(q)-N(-)-O(-); convert to M(q-2)-N=O */
 4995|       |
 4996|       |            /* find all charge edges to fix */
 4997|     18|            if (0 == AllChargeEdges.num_edges)
  ------------------
  |  Branch (4997:17): [True: 16, False: 2]
  ------------------
 4998|     16|            {
 4999|    117|                for (n = 0; n < num_at; n++)
  ------------------
  |  Branch (4999:29): [True: 101, False: 16]
  ------------------
 5000|    101|                {
 5001|    101|                    if (( e = pVA[n].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5001:25): [True: 68, False: 33]
  ------------------
 5002|     68|                         !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (5002:26): [True: 68, False: 0]
  ------------------
 5003|     68|                    {
 5004|     68|                        if ((ret = AddToEdgeList( &AllChargeEdges, e, num_at ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (5004:29): [True: 0, False: 68]
  ------------------
 5005|      0|                        {
 5006|      0|                            goto exit_function;
 5007|      0|                        }
 5008|     68|                    }
 5009|    101|                    if (( e = pVA[n].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5009:25): [True: 84, False: 17]
  ------------------
 5010|     84|                         !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (5010:26): [True: 77, False: 7]
  ------------------
 5011|     77|                    {
 5012|     77|                        if ((ret = AddToEdgeList( &AllChargeEdges, e, num_at ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (5012:29): [True: 0, False: 77]
  ------------------
 5013|      0|                        {
 5014|      0|                            goto exit_function;
 5015|      0|                        }
 5016|     77|                        if (pVA[n].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (5016:29): [True: 35, False: 42]
  ------------------
 5017|     35|                             NO_VERTEX != ( e = GetChargeFlowerUpperEdge( pBNS, pVA, e ) ) &&
  ------------------
  |  |  118|     35|#define NO_VERTEX    -2
  ------------------
  |  Branch (5017:30): [True: 14, False: 21]
  ------------------
 5018|     14|                             pBNS->edge[e].flow == 0)
  ------------------
  |  Branch (5018:30): [True: 3, False: 11]
  ------------------
 5019|      3|                        {
 5020|      3|                            if ((ret = AddToEdgeList( &AllChargeEdges, e, num_at ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (5020:33): [True: 0, False: 3]
  ------------------
 5021|      0|                            {
 5022|      0|                                goto exit_function;
 5023|      0|                            }
 5024|      3|                        }
 5025|     77|                    }
 5026|    101|                }
 5027|     16|            }
 5028|       |
 5029|       |            /* djb-rwth: removing redundant code */
 5030|       |            /* djb-rwth: removing redundant code */
 5031|       |
 5032|     18|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 5033|     18|            pBNS->edge[eNMinusEdge1].forbidden &= inv_forbidden_edge_mask;
 5034|     18|            pBNS->edge[eNMinusEdge2].forbidden &= inv_forbidden_edge_mask;
 5035|     18|            pBNS->edge[eNPlusEdge2].forbidden &= inv_forbidden_edge_mask;
 5036|       |
 5037|     18|            pe = pBNS->edge + eNMinusEdge; /* must be already fixed as a charge edge */
 5038|       |
 5039|     18|            v1 = pe->neighbor1;
 5040|     18|            v2 = pe->neighbor12 ^ v1;
 5041|     18|            pe->flow--;
 5042|     18|            pBNS->vert[v1].st_edge.flow--;
 5043|     18|            pBNS->vert[v2].st_edge.flow--;
 5044|     18|            pBNS->tot_st_flow -= 2;
 5045|       |
 5046|     18|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 5047|     18|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 5048|       |
 5049|     18|            if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (5049:17): [True: 9, False: 9]
  |  Branch (5049:32): [True: 2, False: 7]
  |  Branch (5049:50): [True: 0, False: 2]
  ------------------
 5050|      9|                (vPathEnd == v2 && vPathStart == v1) ) /*&& nDeltaCharge == nDeltaChargeMax*/) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (5050:18): [True: 6, False: 3]
  |  Branch (5050:36): [True: 6, False: 0]
  ------------------
 5051|      6|            { 
 5052|      6|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 5053|      6|                ( *pnNumRunBNS )++;
 5054|      6|                *pnTotalDelta += ret;
 5055|      6|                num_success++;
 5056|      6|            }
 5057|     12|            else
 5058|     12|            {
 5059|     12|                pe->flow++;
 5060|     12|                pBNS->vert[v1].st_edge.flow++;
 5061|     12|                pBNS->vert[v2].st_edge.flow++;
 5062|     12|                pBNS->tot_st_flow += 2;
 5063|       |                /* djb-rwth: removing redundant code */
 5064|     12|            }
 5065|     18|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 5066|     18|        }
 5067|   832k|    }
 5068|  87.7k|    ret = num_success;
 5069|       |
 5070|  87.7k|exit_function:
 5071|       |
 5072|  87.7k|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  87.7k|#define EDGE_LIST_FREE   (-2)
  ------------------
 5073|       |
 5074|  87.7k|    return ret;
 5075|  87.7k|#undef INC_EDGE_LIST
 5076|  87.7k|}
RestoreNNNgroup:
 5090|  87.7k|{
 5091|  87.7k|#define INC_EDGE_LIST 16
 5092|  87.7k|    Vertex     vPathStart, vPathEnd;
 5093|  87.7k|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms, num_failed, num_success, n, nDeltaChargeMax;
 5094|  87.7k|    BNS_EDGE  *pe;
 5095|  87.7k|    Vertex    v1, v2;
 5096|       |
 5097|  87.7k|    int i, j, k, ret2, ret;
 5098|  87.7k|    int num_at = pStruct->num_atoms;
 5099|  87.7k|    int num_deleted_H = pStruct->num_deleted_H;
 5100|  87.7k|    int len_at = num_at + num_deleted_H;
 5101|  87.7k|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 5102|  87.7k|    EdgeIndex eNMinusEdge, eNPlusEdge, eNMinusEdge1, eNPlusEdge1, eNMinusEdge2, eNPlusEdge2;
 5103|  87.7k|    EdgeIndex eNFlowerEdge1, eNFlowerEdge2;
 5104|       |
 5105|  87.7k|    EDGE_LIST CarbonChargeEdges, AllChargeEdges, NNNChargeEdges, CurNNNChargeEdges, AllNNNTermAtoms, AllNIIIChargeEdges;
 5106|       |
 5107|  87.7k|    ret = 0;
 5108|  87.7k|    num_failed = num_success = 0;
 5109|  87.7k|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  87.7k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5110|  87.7k|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  87.7k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5111|  87.7k|    AllocEdgeList( &NNNChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  87.7k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5112|  87.7k|    AllocEdgeList( &CurNNNChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  87.7k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5113|  87.7k|    AllocEdgeList( &AllNNNTermAtoms, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  87.7k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5114|  87.7k|    AllocEdgeList( &AllNIIIChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  87.7k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5115|       |
 5116|  87.7k|    memcpy(at2, at, len_at * sizeof(at2[0]));
 5117|  87.7k|    pStruct->at = at2;
 5118|  87.7k|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 5119|  87.7k|    pStruct->at = at;
 5120|  87.7k|    if (ret2 < 0)
  ------------------
  |  Branch (5120:9): [True: 0, False: 87.7k]
  ------------------
 5121|      0|    {
 5122|      0|        ret = ret2;
 5123|      0|        goto exit_function;
 5124|      0|    }
 5125|       |    /* attepmt #1 N#N(+)-N => N(-)=N(+)=N: naive approach; expecting tp move (-) from some other atom */
 5126|   920k|    for (i = 0; i < num_at && 0 <= ret; i++)
  ------------------
  |  Branch (5126:17): [True: 832k, False: 87.7k]
  |  Branch (5126:31): [True: 832k, False: 0]
  ------------------
 5127|   832k|    {
 5128|   832k|        if (at2[i].valence == 1 &&
  ------------------
  |  Branch (5128:13): [True: 79.1k, False: 753k]
  ------------------
 5129|  79.1k|             at2[i].num_H == 0 &&
  ------------------
  |  Branch (5129:14): [True: 78.4k, False: 744]
  ------------------
 5130|  78.4k|             at2[i].chem_bonds_valence == 3 &&
  ------------------
  |  Branch (5130:14): [True: 14.1k, False: 64.2k]
  ------------------
 5131|  14.1k|             at2[i].charge == 0 &&
  ------------------
  |  Branch (5131:14): [True: 6.71k, False: 7.46k]
  ------------------
 5132|  6.71k|             at2[i].radical == 0 &&
  ------------------
  |  Branch (5132:14): [True: 5.37k, False: 1.34k]
  ------------------
 5133|  5.37k|             pVA[i].cNumValenceElectrons == 5 &&  /* terminal N# */
  ------------------
  |  Branch (5133:14): [True: 4.07k, False: 1.30k]
  ------------------
 5134|  4.07k|             ( eNMinusEdge = pVA[i].nCMinusGroupEdge - 1 ) >= 0 && pBNS->edge[eNMinusEdge].flow == 0 &&
  ------------------
  |  Branch (5134:14): [True: 4.06k, False: 14]
  |  Branch (5134:68): [True: 4.06k, False: 0]
  ------------------
 5135|  4.06k|             !pBNS->edge[eNMinusEdge].forbidden &&
  ------------------
  |  Branch (5135:14): [True: 4.06k, False: 0]
  ------------------
 5136|  4.06k|             at2[j = at2[i].neighbor[0]].valence == 2 &&
  ------------------
  |  Branch (5136:14): [True: 2.05k, False: 2.00k]
  ------------------
 5137|  2.05k|             at2[j].num_H == 0 &&
  ------------------
  |  Branch (5137:14): [True: 2.04k, False: 6]
  ------------------
 5138|  2.04k|             at2[j].chem_bonds_valence == 4 &&
  ------------------
  |  Branch (5138:14): [True: 1.88k, False: 164]
  ------------------
 5139|  1.88k|             at2[j].charge == 1 &&
  ------------------
  |  Branch (5139:14): [True: 1.27k, False: 612]
  ------------------
 5140|  1.27k|             at2[j].radical == 0 &&
  ------------------
  |  Branch (5140:14): [True: 1.27k, False: 0]
  ------------------
 5141|  1.27k|             pVA[j].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5141:14): [True: 1.23k, False: 34]
  ------------------
 5142|  1.23k|             ( eNPlusEdge = pVA[j].nCPlusGroupEdge - 1 ) >= 0 && pBNS->edge[eNPlusEdge].flow == 0 &&
  ------------------
  |  Branch (5142:14): [True: 1.23k, False: 0]
  |  Branch (5142:66): [True: 1.23k, False: 0]
  ------------------
 5143|  1.23k|             !pBNS->edge[eNPlusEdge].forbidden &&
  ------------------
  |  Branch (5143:14): [True: 1.23k, False: 0]
  ------------------
 5144|  1.23k|             at2[k = at2[j].neighbor[at2[j].neighbor[0] == i]].valence == 2 &&
  ------------------
  |  Branch (5144:14): [True: 837, False: 401]
  ------------------
 5145|    837|             at2[k].num_H == 0 &&
  ------------------
  |  Branch (5145:14): [True: 819, False: 18]
  ------------------
 5146|    819|             at2[k].chem_bonds_valence == 3 &&
  ------------------
  |  Branch (5146:14): [True: 332, False: 487]
  ------------------
 5147|    332|             pVA[k].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5147:14): [True: 299, False: 33]
  ------------------
 5148|    299|             ( eNPlusEdge2 = pVA[k].nCPlusGroupEdge - 1 ) >= 0 && pBNS->edge[eNPlusEdge2].flow == 1 &&
  ------------------
  |  Branch (5148:14): [True: 299, False: 0]
  |  Branch (5148:67): [True: 292, False: 7]
  ------------------
 5149|    292|             !pBNS->edge[eNPlusEdge2].forbidden &&
  ------------------
  |  Branch (5149:14): [True: 292, False: 0]
  ------------------
 5150|    292|             pVA[i].cnListIndex > 0 &&
  ------------------
  |  Branch (5150:14): [True: 292, False: 0]
  ------------------
 5151|    292|             cnList[pVA[i].cnListIndex - 1].bits == cn_bits_MN)
  ------------------
  |  |  436|    292|#define cn_bits_MN  MAKE_CN_BITS(cn_bits_M, cn_bits_N, 0, 0)
  |  |  ------------------
  |  |  |  |  421|    292|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|    292|#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))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|    292|#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))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|    292|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (5151:14): [True: 292, False: 0]
  ------------------
 5152|    292|        {
 5153|       |            /* found N#N(+)-N~ where the last N (at2[k]) may be charged */
 5154|    292|            pe = pBNS->edge + pBNS->vert[i].iedge[0]; /* N#N(+) triple bond edge */
 5155|       |
 5156|    292|            v1 = pe->neighbor1;
 5157|    292|            v2 = pe->neighbor12 ^ v1;
 5158|    292|            pe->flow--;
 5159|    292|            pBNS->vert[v1].st_edge.flow--;
 5160|    292|            pBNS->vert[v2].st_edge.flow--;
 5161|    292|            pBNS->tot_st_flow -= 2;
 5162|       |
 5163|    292|            pe->forbidden |= forbidden_edge_mask;
 5164|    292|            pBNS->edge[eNPlusEdge].forbidden |= forbidden_edge_mask;
 5165|    292|            pBNS->edge[eNPlusEdge2].forbidden |= forbidden_edge_mask;
 5166|       |
 5167|       |
 5168|    292|            if (!CarbonChargeEdges.num_edges)
  ------------------
  |  Branch (5168:17): [True: 291, False: 1]
  ------------------
 5169|    291|            {
 5170|       |                /* do not let carbon atoms get charged */
 5171|    291|                AllocEdgeList( &CarbonChargeEdges, INC_EDGE_LIST );
  ------------------
  |  | 5091|    291|#define INC_EDGE_LIST 16
  ------------------
 5172|    291|                if (0 > ( ret = ForbidCarbonChargeEdges( pBNS, pTCGroups, &CarbonChargeEdges, forbidden_edge_mask ) ))
  ------------------
  |  Branch (5172:21): [True: 0, False: 291]
  ------------------
 5173|      0|                {
 5174|      0|                    goto exit_function;
 5175|      0|                }
 5176|    291|            }
 5177|      1|            else
 5178|      1|            {
 5179|      1|                SetForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 5180|      1|            }
 5181|    292|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 5182|    292|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 5183|       |
 5184|    292|            if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (5184:17): [True: 216, False: 76]
  |  Branch (5184:32): [True: 9, False: 207]
  |  Branch (5184:50): [True: 5, False: 4]
  ------------------
 5185|    211|                (vPathEnd == v2 && vPathStart == v1) ) && nDeltaCharge <= 0) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (5185:18): [True: 206, False: 5]
  |  Branch (5185:36): [True: 205, False: 1]
  |  Branch (5185:59): [True: 115, False: 95]
  ------------------
 5186|    115|            {
 5187|    115|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 5188|    115|                ( *pnNumRunBNS )++;
 5189|    115|                *pnTotalDelta += ret;
 5190|    115|                num_success++;
 5191|       |                /* fix charges on N(-)=N(+)=N- */
 5192|    115|                if ((ret = AddToEdgeList( &CarbonChargeEdges, eNMinusEdge, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|    115|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5192:21): [True: 0, False: 115]
  ------------------
 5193|      0|                {
 5194|      0|                    goto exit_function;
 5195|      0|                }
 5196|    115|                if ((ret = AddToEdgeList( &CarbonChargeEdges, eNPlusEdge, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|    115|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5196:21): [True: 0, False: 115]
  ------------------
 5197|      0|                {
 5198|      0|                    goto exit_function;
 5199|      0|                }
 5200|    115|            }
 5201|    177|            else
 5202|    177|            {
 5203|    177|                pe->flow++;
 5204|    177|                pBNS->vert[v1].st_edge.flow++;
 5205|    177|                pBNS->vert[v2].st_edge.flow++;
 5206|    177|                pBNS->tot_st_flow += 2;
 5207|    177|                num_failed++;
 5208|    177|            }
 5209|    292|            RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 5210|       |
 5211|    292|            pe->forbidden &= inv_forbidden_edge_mask;
 5212|    292|            pBNS->edge[eNPlusEdge].forbidden &= inv_forbidden_edge_mask;
 5213|    292|            pBNS->edge[eNPlusEdge2].forbidden &= inv_forbidden_edge_mask;
 5214|    292|        }
 5215|   832k|    }
 5216|       |
 5217|       |    /* 2nd attempt: take care of N#N(+)-N=-...=N-N(-) */
 5218|       |    /* This would produce nDeltaCharge >= 2 */
 5219|       |
 5220|  87.7k|    AllChargeEdges.num_edges = 0;
 5221|  87.7k|    AllNNNTermAtoms.num_edges = 0;
 5222|  87.7k|    NNNChargeEdges.num_edges = 0;
 5223|  87.7k|    AllNIIIChargeEdges.num_edges = 0;
 5224|       |
 5225|   920k|    for (i = 0; i < num_at && 0 <= ret; i++)
  ------------------
  |  Branch (5225:17): [True: 832k, False: 87.7k]
  |  Branch (5225:31): [True: 832k, False: 0]
  ------------------
 5226|   832k|    {
 5227|   832k|        if (( eNMinusEdge = pVA[i].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5227:13): [True: 119k, False: 712k]
  ------------------
 5228|   119k|             !pBNS->edge[eNMinusEdge].forbidden)
  ------------------
  |  Branch (5228:14): [True: 119k, False: 0]
  ------------------
 5229|   119k|        {
 5230|   119k|            if ((ret = AddToEdgeList( &AllChargeEdges, eNMinusEdge, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|   119k|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5230:17): [True: 0, False: 119k]
  ------------------
 5231|      0|            {
 5232|      0|                goto exit_function;
 5233|      0|            }
 5234|   119k|        }
 5235|   712k|        else
 5236|   712k|        {
 5237|   712k|            eNMinusEdge = -1;
 5238|   712k|        }
 5239|   832k|        if (( eNPlusEdge = pVA[i].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5239:13): [True: 138k, False: 694k]
  ------------------
 5240|   138k|             !pBNS->edge[eNPlusEdge].forbidden)
  ------------------
  |  Branch (5240:14): [True: 133k, False: 5.04k]
  ------------------
 5241|   133k|        {
 5242|   133k|            if ((ret = AddToEdgeList( &AllChargeEdges, eNPlusEdge, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|   133k|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5242:17): [True: 0, False: 133k]
  ------------------
 5243|      0|            {
 5244|      0|                goto exit_function;
 5245|      0|            }
 5246|   133k|            if (pVA[i].cNumValenceElectrons == 5 && at2[i].valence == 3 && at2[i].chem_bonds_valence == 3)
  ------------------
  |  Branch (5246:17): [True: 42.2k, False: 90.8k]
  |  Branch (5246:53): [True: 8.75k, False: 33.4k]
  |  Branch (5246:76): [True: 2.30k, False: 6.45k]
  ------------------
 5247|  2.30k|            {
 5248|  2.30k|                if ((ret = AddToEdgeList( &AllNIIIChargeEdges, eNPlusEdge, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|  2.30k|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5248:21): [True: 0, False: 2.30k]
  ------------------
 5249|      0|                {
 5250|      0|                    goto exit_function;
 5251|      0|                }
 5252|  2.30k|            }
 5253|       |            /* N flower edge */
 5254|   133k|            if (pVA[i].cNumValenceElectrons == 5 && pVA[i].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (5254:17): [True: 42.2k, False: 90.8k]
  |  Branch (5254:53): [True: 30.2k, False: 11.9k]
  ------------------
 5255|  30.2k|                 NO_VERTEX != ( eNFlowerEdge1 = GetChargeFlowerUpperEdge( pBNS, pVA, eNPlusEdge ) ) &&
  ------------------
  |  |  118|  30.2k|#define NO_VERTEX    -2
  ------------------
  |  Branch (5255:18): [True: 6.38k, False: 23.8k]
  ------------------
 5256|  6.38k|                 pBNS->edge[eNFlowerEdge1].flow == 0 &&
  ------------------
  |  Branch (5256:18): [True: 3.39k, False: 2.98k]
  ------------------
 5257|  3.39k|                 ( ret = AddToEdgeList( &AllChargeEdges, eNFlowerEdge1, INC_EDGE_LIST ) ))
  ------------------
  |  | 5091|  3.39k|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5257:18): [True: 0, False: 3.39k]
  ------------------
 5258|      0|            {
 5259|      0|                goto exit_function;
 5260|      0|            }
 5261|   133k|        }
 5262|       |        /* djb-rwth: removing redundant code */
 5263|       |
 5264|   832k|        if (0 <= eNMinusEdge &&
  ------------------
  |  Branch (5264:13): [True: 119k, False: 712k]
  ------------------
 5265|   119k|             at2[i].valence == 1 &&
  ------------------
  |  Branch (5265:14): [True: 60.2k, False: 59.6k]
  ------------------
 5266|  60.2k|             at2[i].num_H == 0 &&
  ------------------
  |  Branch (5266:14): [True: 60.1k, False: 160]
  ------------------
 5267|  60.1k|             at2[i].radical == 0 &&
  ------------------
  |  Branch (5267:14): [True: 47.3k, False: 12.7k]
  ------------------
 5268|  47.3k|             pVA[i].cNumValenceElectrons == 5 &&  /* terminal N# */
  ------------------
  |  Branch (5268:14): [True: 11.3k, False: 36.0k]
  ------------------
 5269|       |
 5270|  11.3k|             at2[j = at2[i].neighbor[0]].valence == 2 &&
  ------------------
  |  Branch (5270:14): [True: 4.78k, False: 6.53k]
  ------------------
 5271|  4.78k|             at2[j].num_H == 0 &&
  ------------------
  |  Branch (5271:14): [True: 4.76k, False: 16]
  ------------------
 5272|  4.76k|             at2[j].radical == 0 &&
  ------------------
  |  Branch (5272:14): [True: 4.75k, False: 7]
  ------------------
 5273|  4.75k|             pVA[j].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5273:14): [True: 3.41k, False: 1.33k]
  ------------------
 5274|  3.41k|             ( eNMinusEdge1 = pVA[j].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5274:14): [True: 3.41k, False: 6]
  ------------------
 5275|  3.41k|             ( eNPlusEdge1 = pVA[j].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5275:14): [True: 3.41k, False: 0]
  ------------------
 5276|  3.41k|             !pBNS->edge[eNMinusEdge1].forbidden &&
  ------------------
  |  Branch (5276:14): [True: 3.41k, False: 0]
  ------------------
 5277|  3.41k|             !pBNS->edge[eNPlusEdge1].forbidden &&
  ------------------
  |  Branch (5277:14): [True: 3.41k, False: 0]
  ------------------
 5278|       |
 5279|  3.41k|             at2[k = at2[j].neighbor[at2[j].neighbor[0] == i]].valence == 2 &&
  ------------------
  |  Branch (5279:14): [True: 2.38k, False: 1.02k]
  ------------------
 5280|  2.38k|             at2[k].num_H == 0 &&
  ------------------
  |  Branch (5280:14): [True: 2.36k, False: 23]
  ------------------
 5281|  2.36k|             at2[k].radical == 0 &&
  ------------------
  |  Branch (5281:14): [True: 2.20k, False: 163]
  ------------------
 5282|  2.20k|             pVA[k].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5282:14): [True: 1.22k, False: 973]
  ------------------
 5283|  1.22k|             ( eNMinusEdge2 = pVA[k].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5283:14): [True: 1.22k, False: 1]
  ------------------
 5284|  1.22k|             ( eNPlusEdge2 = pVA[k].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5284:14): [True: 1.22k, False: 0]
  ------------------
 5285|  1.22k|             !pBNS->edge[eNMinusEdge2].forbidden &&
  ------------------
  |  Branch (5285:14): [True: 1.22k, False: 0]
  ------------------
 5286|  1.22k|             !pBNS->edge[eNPlusEdge2].forbidden &&
  ------------------
  |  Branch (5286:14): [True: 1.22k, False: 0]
  ------------------
 5287|       |
 5288|  1.22k|             pVA[i].cnListIndex > 0 &&
  ------------------
  |  Branch (5288:14): [True: 1.22k, False: 0]
  ------------------
 5289|  1.22k|             cnList[pVA[i].cnListIndex - 1].bits == cn_bits_MN)
  ------------------
  |  |  436|  1.22k|#define cn_bits_MN  MAKE_CN_BITS(cn_bits_M, cn_bits_N, 0, 0)
  |  |  ------------------
  |  |  |  |  421|  1.22k|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|  1.22k|#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))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|  1.22k|#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))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|  1.22k|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (5289:14): [True: 1.21k, False: 10]
  ------------------
 5290|  1.21k|        {
 5291|       |            /* found N#N(+)-N~ or N(-)=N-N= where the last N (at2[k]) may be charged */
 5292|       |
 5293|       |            /* 1. N(-)=N(+)=N- */
 5294|  1.21k|            if (pBNS->edge[eNMinusEdge].flow == 1 &&  /* N(-) */
  ------------------
  |  Branch (5294:17): [True: 896, False: 322]
  ------------------
 5295|    896|                 pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5295:18): [True: 894, False: 2]
  |  Branch (5295:56): [True: 308, False: 586]
  ------------------
 5296|    308|                 pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 1    /* N */)
  ------------------
  |  Branch (5296:18): [True: 308, False: 0]
  |  Branch (5296:56): [True: 308, False: 0]
  ------------------
 5297|    308|            {
 5298|    308|                continue; /* already good */
 5299|    308|            }
 5300|       |            /* accumulate terminal atoms of all other NNN */
 5301|    910|            if ((ret = AddToEdgeList( &AllNNNTermAtoms, i, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|    910|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5301:17): [True: 0, False: 910]
  ------------------
 5302|      0|            {
 5303|      0|                goto exit_function;
 5304|      0|            }
 5305|       |            /* 2. N#N(+)-N= */
 5306|    910|            if (pBNS->edge[eNMinusEdge].flow == 0 && /* N */
  ------------------
  |  Branch (5306:17): [True: 322, False: 588]
  ------------------
 5307|    322|                 pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5307:18): [True: 321, False: 1]
  |  Branch (5307:56): [True: 256, False: 65]
  ------------------
 5308|    256|                 pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 1    /* N */)
  ------------------
  |  Branch (5308:18): [True: 183, False: 73]
  |  Branch (5308:56): [True: 178, False: 5]
  ------------------
 5309|    178|            {
 5310|       |/* unfix (-) edge on terminal N# */
 5311|    178|                if ((ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|    178|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5311:21): [True: 0, False: 178]
  ------------------
 5312|      0|                {
 5313|      0|                    goto exit_function;
 5314|      0|                }
 5315|    178|                continue;
 5316|    178|            }
 5317|       |            /* 3. N(-)=N-N= */
 5318|    732|            if (pBNS->edge[eNMinusEdge].flow == 1 && /* N(-) */
  ------------------
  |  Branch (5318:17): [True: 588, False: 144]
  ------------------
 5319|    588|                 pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 1 && /* N */
  ------------------
  |  Branch (5319:18): [True: 586, False: 2]
  |  Branch (5319:56): [True: 585, False: 1]
  ------------------
 5320|    585|                 pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 1    /* N */)
  ------------------
  |  Branch (5320:18): [True: 574, False: 11]
  |  Branch (5320:56): [True: 116, False: 458]
  ------------------
 5321|    116|            {
 5322|       |                /* unfix (+) edge on middle N */
 5323|    116|                if ((ret = AddToEdgeList( &NNNChargeEdges, eNPlusEdge1, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|    116|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5323:21): [True: 0, False: 116]
  ------------------
 5324|      0|                {
 5325|      0|                    goto exit_function;
 5326|      0|                }
 5327|    116|                continue;
 5328|    116|            }
 5329|       |            /* 4. N#N(+)-N(-)- */
 5330|    616|            if (pBNS->edge[eNMinusEdge].flow == 0 &&  /* N */
  ------------------
  |  Branch (5330:17): [True: 144, False: 472]
  ------------------
 5331|    144|                 pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5331:18): [True: 143, False: 1]
  |  Branch (5331:56): [True: 78, False: 65]
  ------------------
 5332|     78|                 pBNS->edge[eNMinusEdge2].flow == 1 && pBNS->edge[eNPlusEdge2].flow == 1    /* N(-) */)
  ------------------
  |  Branch (5332:18): [True: 73, False: 5]
  |  Branch (5332:56): [True: 72, False: 1]
  ------------------
 5333|     72|            {
 5334|       |                /* unfix (-) edge on the 1st and 3rd N */
 5335|     72|                if ((ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|     72|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5335:21): [True: 0, False: 72]
  ------------------
 5336|      0|                {
 5337|      0|                    goto exit_function;
 5338|      0|                }
 5339|     72|                if ((ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge2, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|     72|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5339:21): [True: 0, False: 72]
  ------------------
 5340|      0|                {
 5341|      0|                    goto exit_function;
 5342|      0|                }
 5343|     72|                continue;
 5344|     72|            }
 5345|       |            /* 5. N#N(+)-N(+)# */
 5346|    544|            if (pBNS->edge[eNMinusEdge].flow == 0 &&  /* N */
  ------------------
  |  Branch (5346:17): [True: 72, False: 472]
  ------------------
 5347|     72|                 pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5347:18): [True: 71, False: 1]
  |  Branch (5347:56): [True: 6, False: 65]
  ------------------
 5348|      6|                 pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 0    /* N(+) */)
  ------------------
  |  Branch (5348:18): [True: 5, False: 1]
  |  Branch (5348:56): [True: 4, False: 1]
  ------------------
 5349|      4|            {
 5350|       |                /* unfix (-) edge on the 1st and (+) edge on the 3rd N */
 5351|      4|                if ((ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|      4|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5351:21): [True: 0, False: 4]
  ------------------
 5352|      0|                {
 5353|      0|                    goto exit_function;
 5354|      0|                }
 5355|      4|                if ((ret = AddToEdgeList( &NNNChargeEdges, eNPlusEdge2, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|      4|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5355:21): [True: 0, False: 4]
  ------------------
 5356|      0|                {
 5357|      0|                    goto exit_function;
 5358|      0|                }
 5359|      4|                continue;
 5360|      4|            }
 5361|    544|        }
 5362|   832k|    }
 5363|       |    /* try to fix each NNN */
 5364|  88.6k|    for (n = AllNNNTermAtoms.num_edges - 1; 0 <= n; n--)
  ------------------
  |  Branch (5364:45): [True: 910, False: 87.7k]
  ------------------
 5365|    910|    {
 5366|    910|        i = AllNNNTermAtoms.pnEdges[n];
 5367|    910|        eNMinusEdge = pVA[i].nCMinusGroupEdge - 1;
 5368|       |        /*eNPlusEdge = pVA[i].nCPlusGroupEdge - 1;*/
 5369|    910|        j = at2[i].neighbor[0];
 5370|    910|        eNMinusEdge1 = pVA[j].nCMinusGroupEdge - 1;
 5371|    910|        eNPlusEdge1 = pVA[j].nCPlusGroupEdge - 1;
 5372|    910|        k = at2[j].neighbor[at2[j].neighbor[0] == i];
 5373|    910|        eNMinusEdge2 = pVA[k].nCMinusGroupEdge - 1;
 5374|    910|        eNPlusEdge2 = pVA[k].nCPlusGroupEdge - 1;
 5375|       |        /*SetForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );*/
 5376|       |        /* 1. N(-)=N(+)=N- */
 5377|    910|        if (pBNS->edge[eNMinusEdge].flow == 1 &&  /* N(-) */
  ------------------
  |  Branch (5377:13): [True: 588, False: 322]
  ------------------
 5378|    588|             pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5378:14): [True: 586, False: 2]
  |  Branch (5378:52): [True: 72, False: 514]
  ------------------
 5379|     72|             pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 1    /* N */)
  ------------------
  |  Branch (5379:14): [True: 72, False: 0]
  |  Branch (5379:52): [True: 72, False: 0]
  ------------------
 5380|     72|        {
 5381|       |
 5382|     72|            RemoveFromEdgeListByValue( &NNNChargeEdges, eNMinusEdge );
 5383|     72|            RemoveFromEdgeListByValue( &NNNChargeEdges, eNMinusEdge1 );
 5384|     72|            RemoveFromEdgeListByValue( &NNNChargeEdges, eNPlusEdge1 );
 5385|     72|            RemoveFromEdgeListByValue( &NNNChargeEdges, eNMinusEdge2 );
 5386|     72|            RemoveFromEdgeListByValue( &NNNChargeEdges, eNPlusEdge2 );
 5387|       |
 5388|     72|            pe = NULL;
 5389|     72|        }
 5390|       |
 5391|    838|        else
 5392|    838|        {
 5393|       |            /* 2. N#N(+)-N= */
 5394|    838|            if (pBNS->edge[eNMinusEdge].flow == 0 &&  /* N */
  ------------------
  |  Branch (5394:17): [True: 322, False: 516]
  ------------------
 5395|    322|                 pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5395:18): [True: 321, False: 1]
  |  Branch (5395:56): [True: 256, False: 65]
  ------------------
 5396|    256|                 pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 1    /* N */)
  ------------------
  |  Branch (5396:18): [True: 183, False: 73]
  |  Branch (5396:56): [True: 178, False: 5]
  ------------------
 5397|    178|            {
 5398|       |                /* decrement triple bond on terminal N# */
 5399|    178|                pe = pBNS->edge + pBNS->vert[i].iedge[0];
 5400|    178|            }
 5401|    660|            else
 5402|    660|            {
 5403|       |                /* 3. N(-)=N-N= */
 5404|    660|                if (pBNS->edge[eNMinusEdge].flow == 1 &&  /* N(-) */
  ------------------
  |  Branch (5404:21): [True: 516, False: 144]
  ------------------
 5405|    516|                     pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 1 && /* N */
  ------------------
  |  Branch (5405:22): [True: 514, False: 2]
  |  Branch (5405:60): [True: 513, False: 1]
  ------------------
 5406|    513|                     pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 1    /* N */)
  ------------------
  |  Branch (5406:22): [True: 502, False: 11]
  |  Branch (5406:60): [True: 44, False: 458]
  ------------------
 5407|     44|                {
 5408|       |                    /* decrement flow on (+) charge edge of the middle =N- */
 5409|     44|                    pe = pBNS->edge + eNPlusEdge1;
 5410|     44|                }
 5411|    616|                else
 5412|    616|                {
 5413|       |                    /* 4. N#N(+)-N(-)- */
 5414|    616|                    if (pBNS->edge[eNMinusEdge].flow == 0 &&  /* N */
  ------------------
  |  Branch (5414:25): [True: 144, False: 472]
  ------------------
 5415|    144|                         pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5415:26): [True: 143, False: 1]
  |  Branch (5415:64): [True: 78, False: 65]
  ------------------
 5416|     78|                         pBNS->edge[eNMinusEdge2].flow == 1 && pBNS->edge[eNPlusEdge2].flow == 1    /* N(-) */)
  ------------------
  |  Branch (5416:26): [True: 73, False: 5]
  |  Branch (5416:64): [True: 72, False: 1]
  ------------------
 5417|     72|                    {
 5418|       |                        /* decrement triple bond on terminal N# */
 5419|     72|                        pe = pBNS->edge + pBNS->vert[i].iedge[0];
 5420|     72|                    }
 5421|    544|                    else
 5422|    544|                    {/* 5. N#N(+)-N(+)# */
 5423|    544|                        if (pBNS->edge[eNMinusEdge].flow == 0 &&  /* N */
  ------------------
  |  Branch (5423:29): [True: 72, False: 472]
  ------------------
 5424|     72|                             pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5424:30): [True: 71, False: 1]
  |  Branch (5424:68): [True: 6, False: 65]
  ------------------
 5425|      6|                             pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 0    /* N(+) */)
  ------------------
  |  Branch (5425:30): [True: 5, False: 1]
  |  Branch (5425:68): [True: 4, False: 1]
  ------------------
 5426|      4|                        {
 5427|       |                            /* decrement triple bond on terminal N# */
 5428|      4|                            pe = pBNS->edge + pBNS->vert[i].iedge[0];
 5429|      4|                        }
 5430|    540|                        else
 5431|    540|                        {
 5432|    540|                            pe = NULL; /* unknown case */
 5433|    540|                        }
 5434|    544|                    }
 5435|    616|                }
 5436|    660|            }
 5437|    838|        }
 5438|       |
 5439|    910|        if (pe)
  ------------------
  |  Branch (5439:13): [True: 298, False: 612]
  ------------------
 5440|    298|        {
 5441|    298|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 5442|    298|            RemoveForbiddenEdgeMask( pBNS, &NNNChargeEdges, forbidden_edge_mask );
 5443|       |
 5444|    298|            v1 = pe->neighbor1;
 5445|    298|            v2 = pe->neighbor12 ^ v1;
 5446|    298|            pe->flow--;
 5447|    298|            pBNS->vert[v1].st_edge.flow--;
 5448|    298|            pBNS->vert[v2].st_edge.flow--;
 5449|    298|            pBNS->tot_st_flow -= 2;
 5450|       |
 5451|    298|            pe->forbidden |= forbidden_edge_mask;
 5452|       |
 5453|    298|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 5454|    298|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 5455|       |
 5456|    298|            if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (5456:17): [True: 150, False: 148]
  |  Branch (5456:32): [True: 3, False: 147]
  |  Branch (5456:50): [True: 0, False: 3]
  ------------------
 5457|    150|                (vPathEnd == v2 && vPathStart == v1) ) /*&& nDeltaCharge <= 2*/) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (5457:18): [True: 146, False: 4]
  |  Branch (5457:36): [True: 144, False: 2]
  ------------------
 5458|    144|            {
 5459|    144|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 5460|    144|                ( *pnNumRunBNS )++;
 5461|    144|                *pnTotalDelta += ret;
 5462|    144|                num_success++;
 5463|       |                /* fix charges on N(-)=N(+)=N- */
 5464|    144|                RemoveFromEdgeListByValue( &NNNChargeEdges, eNMinusEdge );
 5465|    144|                RemoveFromEdgeListByValue( &NNNChargeEdges, eNMinusEdge1 );
 5466|    144|                RemoveFromEdgeListByValue( &NNNChargeEdges, eNPlusEdge1 );
 5467|    144|                RemoveFromEdgeListByValue( &NNNChargeEdges, eNMinusEdge2 );
 5468|    144|                RemoveFromEdgeListByValue( &NNNChargeEdges, eNPlusEdge2 );
 5469|    144|            }
 5470|    154|            else
 5471|    154|            {
 5472|    154|                pe->flow++;
 5473|    154|                pBNS->vert[v1].st_edge.flow++;
 5474|    154|                pBNS->vert[v2].st_edge.flow++;
 5475|    154|                pBNS->tot_st_flow += 2;
 5476|    154|                num_failed++;
 5477|    154|            }
 5478|    298|            pe->forbidden &= inv_forbidden_edge_mask;
 5479|    298|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 5480|    298|        }
 5481|    910|    }
 5482|       |
 5483|       |    /* 3rd attempt */
 5484|       |
 5485|       |    /*
 5486|       |    AllChargeEdges.num_edges = 0;
 5487|       |    AllNNNTermAtoms.num_edges = 0;
 5488|       |    NNNChargeEdges.num_edges = 0;
 5489|       |    */
 5490|   920k|    for (i = 0; i < num_at && 0 <= ret; i++)
  ------------------
  |  Branch (5490:17): [True: 832k, False: 87.7k]
  |  Branch (5490:31): [True: 832k, False: 0]
  ------------------
 5491|   832k|    {
 5492|       |
 5493|   832k|        eNMinusEdge = pVA[i].nCMinusGroupEdge - 1;
 5494|       |        /*eNPlusEdge = pVA[i].nCPlusGroupEdge - 1;*/
 5495|       |
 5496|   832k|        if (0 <= eNMinusEdge &&
  ------------------
  |  Branch (5496:13): [True: 119k, False: 712k]
  ------------------
 5497|   119k|             at2[i].valence == 1 &&
  ------------------
  |  Branch (5497:14): [True: 60.2k, False: 59.6k]
  ------------------
 5498|  60.2k|             at2[i].num_H == 0 &&
  ------------------
  |  Branch (5498:14): [True: 60.1k, False: 160]
  ------------------
 5499|  60.1k|             at2[i].radical == 0 &&
  ------------------
  |  Branch (5499:14): [True: 47.3k, False: 12.7k]
  ------------------
 5500|  47.3k|             pVA[i].cNumValenceElectrons == 5 &&  /* terminal N# */
  ------------------
  |  Branch (5500:14): [True: 11.3k, False: 36.0k]
  ------------------
 5501|       |
 5502|  11.3k|             at2[j = at2[i].neighbor[0]].valence == 2 &&
  ------------------
  |  Branch (5502:14): [True: 4.78k, False: 6.53k]
  ------------------
 5503|  4.78k|             at2[j].num_H == 0 &&
  ------------------
  |  Branch (5503:14): [True: 4.76k, False: 16]
  ------------------
 5504|  4.76k|             at2[j].radical == 0 &&
  ------------------
  |  Branch (5504:14): [True: 4.75k, False: 7]
  ------------------
 5505|  4.75k|             pVA[j].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5505:14): [True: 3.41k, False: 1.33k]
  ------------------
 5506|  3.41k|             ( eNMinusEdge1 = pVA[j].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5506:14): [True: 3.41k, False: 6]
  ------------------
 5507|  3.41k|             ( eNPlusEdge1 = pVA[j].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5507:14): [True: 3.41k, False: 0]
  ------------------
 5508|  3.41k|             !pBNS->edge[eNMinusEdge1].forbidden &&
  ------------------
  |  Branch (5508:14): [True: 3.41k, False: 0]
  ------------------
 5509|  3.41k|             !pBNS->edge[eNPlusEdge1].forbidden &&
  ------------------
  |  Branch (5509:14): [True: 3.41k, False: 0]
  ------------------
 5510|       |
 5511|  3.41k|             at2[k = at2[j].neighbor[at2[j].neighbor[0] == i]].valence == 2 &&
  ------------------
  |  Branch (5511:14): [True: 2.38k, False: 1.02k]
  ------------------
 5512|  2.38k|             at2[k].num_H == 0 &&
  ------------------
  |  Branch (5512:14): [True: 2.36k, False: 23]
  ------------------
 5513|  2.36k|             at2[k].radical == 0 &&
  ------------------
  |  Branch (5513:14): [True: 2.20k, False: 163]
  ------------------
 5514|  2.20k|             pVA[k].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5514:14): [True: 1.22k, False: 973]
  ------------------
 5515|  1.22k|             ( eNMinusEdge2 = pVA[k].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5515:14): [True: 1.22k, False: 1]
  ------------------
 5516|  1.22k|             ( eNPlusEdge2 = pVA[k].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5516:14): [True: 1.22k, False: 0]
  ------------------
 5517|  1.22k|             !pBNS->edge[eNMinusEdge2].forbidden &&
  ------------------
  |  Branch (5517:14): [True: 1.22k, False: 0]
  ------------------
 5518|  1.22k|             !pBNS->edge[eNPlusEdge2].forbidden &&
  ------------------
  |  Branch (5518:14): [True: 1.22k, False: 0]
  ------------------
 5519|       |
 5520|  1.22k|             pVA[i].cnListIndex > 0 &&
  ------------------
  |  Branch (5520:14): [True: 1.22k, False: 0]
  ------------------
 5521|  1.22k|             cnList[pVA[i].cnListIndex - 1].bits == cn_bits_MN)
  ------------------
  |  |  436|  1.22k|#define cn_bits_MN  MAKE_CN_BITS(cn_bits_M, cn_bits_N, 0, 0)
  |  |  ------------------
  |  |  |  |  421|  1.22k|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|  1.22k|#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))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|  1.22k|#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))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|  1.22k|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (5521:14): [True: 1.21k, False: 10]
  ------------------
 5522|  1.21k|        {
 5523|       |            /* found N#N(+)-N~ or N(-)=N-N= where the last N (at2[k]) may be charged */
 5524|  1.21k|            NNNChargeEdges.num_edges = 0;
 5525|       |
 5526|  1.21k|            eNFlowerEdge1 = GetChargeFlowerUpperEdge( pBNS, pVA, eNPlusEdge1 );
 5527|  1.21k|            eNFlowerEdge2 = GetChargeFlowerUpperEdge( pBNS, pVA, eNPlusEdge2 );
 5528|       |
 5529|       |            /* 1. N(-)=N(+)=N- */
 5530|  1.21k|            if (pBNS->edge[eNMinusEdge].flow == 1 &&  /* N(-) */
  ------------------
  |  Branch (5530:17): [True: 1.04k, False: 177]
  ------------------
 5531|  1.04k|                 pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5531:18): [True: 1.03k, False: 2]
  |  Branch (5531:56): [True: 524, False: 515]
  ------------------
 5532|    524|                 pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 1    /* N */)
  ------------------
  |  Branch (5532:18): [True: 524, False: 0]
  |  Branch (5532:56): [True: 524, False: 0]
  ------------------
 5533|    524|            {
 5534|       |                /* fix charges on N(-)=N(+)=N- */
 5535|    524|                if ((ret = AddToEdgeList( &CarbonChargeEdges, eNMinusEdge, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|    524|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5535:21): [True: 0, False: 524]
  ------------------
 5536|      0|                {
 5537|      0|                    goto exit_function;
 5538|      0|                }
 5539|    524|                if ((ret = AddToEdgeList( &CarbonChargeEdges, eNPlusEdge1, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|    524|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5539:21): [True: 0, False: 524]
  ------------------
 5540|      0|                {
 5541|      0|                    goto exit_function;
 5542|      0|                }
 5543|    524|                if ((ret = AddToEdgeList( &CarbonChargeEdges, eNMinusEdge1, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|    524|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5543:21): [True: 0, False: 524]
  ------------------
 5544|      0|                {
 5545|      0|                    goto exit_function;
 5546|      0|                }
 5547|    524|                if ((ret = AddToEdgeList( &CarbonChargeEdges, eNPlusEdge2, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|    524|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5547:21): [True: 0, False: 524]
  ------------------
 5548|      0|                {
 5549|      0|                    goto exit_function;
 5550|      0|                }
 5551|    524|                if ((ret = AddToEdgeList( &CarbonChargeEdges, eNMinusEdge2, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|    524|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5551:21): [True: 0, False: 524]
  ------------------
 5552|      0|                {
 5553|      0|                    goto exit_function;
 5554|      0|                }
 5555|    524|                continue; /* already good */
 5556|    524|            }
 5557|       |            /* 2. N#N(+)-N= */
 5558|    694|            if (pBNS->edge[eNMinusEdge].flow == 0 && /* N */
  ------------------
  |  Branch (5558:17): [True: 177, False: 517]
  ------------------
 5559|    177|                 pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5559:18): [True: 176, False: 1]
  |  Branch (5559:56): [True: 111, False: 65]
  ------------------
 5560|    111|                 pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 1    /* N */)
  ------------------
  |  Branch (5560:18): [True: 110, False: 1]
  |  Branch (5560:56): [True: 105, False: 5]
  ------------------
 5561|    105|            {
 5562|       |                /* unfix (-) edge on terminal N# */
 5563|    105|                if ((ret = AddToEdgeList( &NNNChargeEdges, eNPlusEdge1, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|    105|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5563:21): [True: 0, False: 105]
  ------------------
 5564|      0|                {
 5565|      0|                    goto exit_function;
 5566|      0|                }
 5567|    105|                if ((ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge1, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|    105|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5567:21): [True: 0, False: 105]
  ------------------
 5568|      0|                {
 5569|      0|                    goto exit_function;
 5570|      0|                }
 5571|    105|                if ((ret = AddToEdgeList( &NNNChargeEdges, eNPlusEdge2, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|    105|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5571:21): [True: 0, False: 105]
  ------------------
 5572|      0|                {
 5573|      0|                    goto exit_function;
 5574|      0|                }
 5575|    105|                if ((ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge2, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|    105|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5575:21): [True: 0, False: 105]
  ------------------
 5576|      0|                {
 5577|      0|                    goto exit_function;
 5578|      0|                }
 5579|    105|                pe = pBNS->edge + pBNS->vert[i].iedge[0];
 5580|       |                /* djb-rwth: removing redundant code */
 5581|    105|                nDeltaChargeMax = ( num_failed && !num_success && pStruct->nNumRemovedProtonsMobHInChI > 0 ) ? 2 : 0;
  ------------------
  |  Branch (5581:37): [True: 105, False: 0]
  |  Branch (5581:51): [True: 104, False: 1]
  |  Branch (5581:67): [True: 0, False: 104]
  ------------------
 5582|    105|            }
 5583|    589|            else
 5584|    589|            {
 5585|       |                /* 3. N(-)=N-N= */
 5586|    589|                if (pBNS->edge[eNMinusEdge].flow == 1 && /* N(-) */
  ------------------
  |  Branch (5586:21): [True: 517, False: 72]
  ------------------
 5587|    517|                     pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 1 && /* N */
  ------------------
  |  Branch (5587:22): [True: 515, False: 2]
  |  Branch (5587:60): [True: 514, False: 1]
  ------------------
 5588|    514|                     pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 1    /* N */)
  ------------------
  |  Branch (5588:22): [True: 503, False: 11]
  |  Branch (5588:60): [True: 45, False: 458]
  ------------------
 5589|     45|                {
 5590|       |                    /* unfix (+) edge on middle N */
 5591|     45|                    if ((ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|     45|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5591:25): [True: 0, False: 45]
  ------------------
 5592|      0|                    {
 5593|      0|                        goto exit_function;
 5594|      0|                    }
 5595|     45|                    if ((ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge1, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|     45|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5595:25): [True: 0, False: 45]
  ------------------
 5596|      0|                    {
 5597|      0|                        goto exit_function;
 5598|      0|                    }
 5599|     45|                    if ((ret = AddToEdgeList( &NNNChargeEdges, eNPlusEdge2, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|     45|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5599:25): [True: 0, False: 45]
  ------------------
 5600|      0|                    {
 5601|      0|                        goto exit_function;
 5602|      0|                    }
 5603|     45|                    if ((ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge2, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|     45|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5603:25): [True: 0, False: 45]
  ------------------
 5604|      0|                    {
 5605|      0|                        goto exit_function;
 5606|      0|                    }
 5607|     45|                    if (NO_VERTEX != eNFlowerEdge1 &&
  ------------------
  |  |  118|     45|#define NO_VERTEX    -2
  ------------------
  |  Branch (5607:25): [True: 0, False: 45]
  ------------------
 5608|      0|                        ( ret = AddToEdgeList( &NNNChargeEdges, eNFlowerEdge1, INC_EDGE_LIST ) ))
  ------------------
  |  | 5091|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5608:25): [True: 0, False: 0]
  ------------------
 5609|      0|                    {
 5610|      0|                        goto exit_function;
 5611|      0|                    }
 5612|       |                    /* decrement flow on (+) charge edge of the middle =N- */
 5613|     45|                    pe = pBNS->edge + eNPlusEdge1;
 5614|     45|                    nDeltaChargeMax = 2;
 5615|     45|                }
 5616|    544|                else
 5617|    544|                {
 5618|       |                    /* 4. N#N(+)-N(-)- */
 5619|    544|                    if (pBNS->edge[eNMinusEdge].flow == 0 &&  /* N */
  ------------------
  |  Branch (5619:25): [True: 72, False: 472]
  ------------------
 5620|     72|                         pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5620:26): [True: 71, False: 1]
  |  Branch (5620:64): [True: 6, False: 65]
  ------------------
 5621|      6|                         pBNS->edge[eNMinusEdge2].flow == 1 && pBNS->edge[eNPlusEdge2].flow == 1    /* N(-) */)
  ------------------
  |  Branch (5621:26): [True: 1, False: 5]
  |  Branch (5621:64): [True: 0, False: 1]
  ------------------
 5622|      0|                    {
 5623|       |                        /* unfix (-) edge on the 1st and 3rd N */
 5624|      0|                        if ((ret = AddToEdgeList( &NNNChargeEdges, eNPlusEdge1, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5624:29): [True: 0, False: 0]
  ------------------
 5625|      0|                        {
 5626|      0|                            goto exit_function;
 5627|      0|                        }
 5628|      0|                        if ((ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge1, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5628:29): [True: 0, False: 0]
  ------------------
 5629|      0|                        {
 5630|      0|                            goto exit_function;
 5631|      0|                        }
 5632|      0|                        if ((ret = AddToEdgeList( &NNNChargeEdges, eNPlusEdge2, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5632:29): [True: 0, False: 0]
  ------------------
 5633|      0|                        {
 5634|      0|                            goto exit_function;
 5635|      0|                        }
 5636|       |                        /* decrement triple bond on terminal N# */
 5637|      0|                        pe = pBNS->edge + pBNS->vert[i].iedge[0];
 5638|      0|                        nDeltaChargeMax = 0;
 5639|      0|                    }
 5640|    544|                    else
 5641|    544|                    {
 5642|       |                        /* 5. N#N(+)-N(+)# */
 5643|    544|                        if (pBNS->edge[eNMinusEdge].flow == 0 &&  /* N */
  ------------------
  |  Branch (5643:29): [True: 72, False: 472]
  ------------------
 5644|     72|                             pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5644:30): [True: 71, False: 1]
  |  Branch (5644:68): [True: 6, False: 65]
  ------------------
 5645|      6|                             pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 0    /* N(+) */)
  ------------------
  |  Branch (5645:30): [True: 5, False: 1]
  |  Branch (5645:68): [True: 4, False: 1]
  ------------------
 5646|      4|                        {
 5647|       |                            /* unfix (-) edge on the 1st and (+) edge on the 3rd N */
 5648|      4|                            if ((ret = AddToEdgeList( &NNNChargeEdges, eNPlusEdge1, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|      4|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5648:33): [True: 0, False: 4]
  ------------------
 5649|      0|                            {
 5650|      0|                                goto exit_function;
 5651|      0|                            }
 5652|      4|                            if ((ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge1, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|      4|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5652:33): [True: 0, False: 4]
  ------------------
 5653|      0|                            {
 5654|      0|                                goto exit_function;
 5655|      0|                            }
 5656|      4|                            if ((ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge2, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|      4|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5656:33): [True: 0, False: 4]
  ------------------
 5657|      0|                            {
 5658|      0|                                goto exit_function;
 5659|      0|                            }
 5660|       |                            /* decrement triple bond on terminal N# */
 5661|      4|                            pe = pBNS->edge + pBNS->vert[i].iedge[0];
 5662|      4|                            nDeltaChargeMax = 0;
 5663|      4|                        }
 5664|    540|                        else
 5665|    540|                        {
 5666|    540|                            continue;
 5667|    540|                        }
 5668|    544|                    }
 5669|    544|                }
 5670|    589|            }
 5671|       |
 5672|    154|            if (NO_VERTEX != eNFlowerEdge1 && !pBNS->edge[eNFlowerEdge1].flow)
  ------------------
  |  |  118|    154|#define NO_VERTEX    -2
  ------------------
  |  Branch (5672:17): [True: 0, False: 154]
  |  Branch (5672:47): [True: 0, False: 0]
  ------------------
 5673|      0|            {
 5674|      0|                if ((ret = AddToEdgeList( &NNNChargeEdges, eNFlowerEdge1, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5674:21): [True: 0, False: 0]
  ------------------
 5675|      0|                {
 5676|      0|                    goto exit_function;
 5677|      0|                }
 5678|      0|            }
 5679|    154|            if (NO_VERTEX != eNFlowerEdge2 && !pBNS->edge[eNFlowerEdge2].flow)
  ------------------
  |  |  118|    154|#define NO_VERTEX    -2
  ------------------
  |  Branch (5679:17): [True: 0, False: 154]
  |  Branch (5679:47): [True: 0, False: 0]
  ------------------
 5680|      0|            {
 5681|      0|                if ((ret = AddToEdgeList( &NNNChargeEdges, eNFlowerEdge2, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5681:21): [True: 0, False: 0]
  ------------------
 5682|      0|                {
 5683|      0|                    goto exit_function;
 5684|      0|                }
 5685|      0|            }
 5686|       |
 5687|    154|            v1 = pe->neighbor1;
 5688|    154|            v2 = pe->neighbor12 ^ v1;
 5689|    154|            pe->flow--;
 5690|    154|            pBNS->vert[v1].st_edge.flow--;
 5691|    154|            pBNS->vert[v2].st_edge.flow--;
 5692|    154|            pBNS->tot_st_flow -= 2;
 5693|       |
 5694|    154|            pe->forbidden |= forbidden_edge_mask;
 5695|       |
 5696|    154|            if (!CarbonChargeEdges.num_edges)
  ------------------
  |  Branch (5696:17): [True: 141, False: 13]
  ------------------
 5697|    141|            {
 5698|       |                /* do not let carbon atoms get charged */
 5699|    141|                AllocEdgeList( &CarbonChargeEdges, INC_EDGE_LIST );
  ------------------
  |  | 5091|    141|#define INC_EDGE_LIST 16
  ------------------
 5700|    141|                if (0 > ( ret = ForbidCarbonChargeEdges( pBNS, pTCGroups, &CarbonChargeEdges, forbidden_edge_mask ) ))
  ------------------
  |  Branch (5700:21): [True: 0, False: 141]
  ------------------
 5701|      0|                {
 5702|      0|                    goto exit_function;
 5703|      0|                }
 5704|    141|            }
 5705|     13|            else
 5706|     13|            {
 5707|     13|                SetForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 5708|     13|            }
 5709|    154|            SetForbiddenEdgeMask( pBNS, &NNNChargeEdges, forbidden_edge_mask );
 5710|       |
 5711|    154|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 5712|    154|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 5713|       |
 5714|    154|            if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (5714:17): [True: 78, False: 76]
  |  Branch (5714:32): [True: 9, False: 69]
  |  Branch (5714:50): [True: 4, False: 5]
  ------------------
 5715|     74|                (vPathEnd == v2 && vPathStart == v1) ) && nDeltaCharge <= nDeltaChargeMax) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (5715:18): [True: 67, False: 7]
  |  Branch (5715:36): [True: 65, False: 2]
  |  Branch (5715:59): [True: 44, False: 25]
  ------------------
 5716|     44|            {
 5717|     44|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 5718|     44|                ( *pnNumRunBNS )++;
 5719|     44|                *pnTotalDelta += ret;
 5720|     44|                num_success++;
 5721|       |                /* fix charges on N(-)=N(+)=N- */
 5722|     44|                if ((ret = AddToEdgeList( &CarbonChargeEdges, eNMinusEdge, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|     44|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5722:21): [True: 0, False: 44]
  ------------------
 5723|      0|                {
 5724|      0|                    goto exit_function;
 5725|      0|                }
 5726|     44|                if ((ret = AddToEdgeList( &CarbonChargeEdges, eNPlusEdge1, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|     44|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5726:21): [True: 0, False: 44]
  ------------------
 5727|      0|                {
 5728|      0|                    goto exit_function;
 5729|      0|                }
 5730|     44|                if ((ret = AddToEdgeList( &CarbonChargeEdges, eNMinusEdge1, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|     44|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5730:21): [True: 0, False: 44]
  ------------------
 5731|      0|                {
 5732|      0|                    goto exit_function;
 5733|      0|                }
 5734|     44|                if ((ret = AddToEdgeList( &CarbonChargeEdges, eNPlusEdge2, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|     44|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5734:21): [True: 0, False: 44]
  ------------------
 5735|      0|                {
 5736|      0|                    goto exit_function;
 5737|      0|                }
 5738|     44|                if ((ret = AddToEdgeList( &CarbonChargeEdges, eNMinusEdge2, INC_EDGE_LIST ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5091|     44|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5738:21): [True: 0, False: 44]
  ------------------
 5739|      0|                {
 5740|      0|                    goto exit_function;
 5741|      0|                }
 5742|     44|            }
 5743|    110|            else
 5744|    110|            {
 5745|    110|                pe->flow++;
 5746|    110|                pBNS->vert[v1].st_edge.flow++;
 5747|    110|                pBNS->vert[v2].st_edge.flow++;
 5748|    110|                pBNS->tot_st_flow += 2;
 5749|    110|                num_failed++;
 5750|    110|            }
 5751|    154|            RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 5752|    154|            RemoveForbiddenEdgeMask( pBNS, &NNNChargeEdges, forbidden_edge_mask );
 5753|    154|            pe->forbidden &= inv_forbidden_edge_mask;
 5754|       |            /*pBNS->edge[eNPlusEdge].forbidden &= inv_forbidden_edge_mask;*/ /* BC: array index out of range */
 5755|    154|        }
 5756|   832k|    }
 5757|  87.7k|    RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 5758|       |
 5759|       |
 5760|  87.7k|exit_function:
 5761|       |
 5762|  87.7k|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  87.7k|#define EDGE_LIST_FREE   (-2)
  ------------------
 5763|  87.7k|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  87.7k|#define EDGE_LIST_FREE   (-2)
  ------------------
 5764|  87.7k|    AllocEdgeList( &NNNChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  87.7k|#define EDGE_LIST_FREE   (-2)
  ------------------
 5765|  87.7k|    AllocEdgeList( &CurNNNChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  87.7k|#define EDGE_LIST_FREE   (-2)
  ------------------
 5766|  87.7k|    AllocEdgeList( &AllNNNTermAtoms, EDGE_LIST_FREE );
  ------------------
  |  |  243|  87.7k|#define EDGE_LIST_FREE   (-2)
  ------------------
 5767|  87.7k|    AllocEdgeList( &AllNIIIChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  87.7k|#define EDGE_LIST_FREE   (-2)
  ------------------
 5768|       |
 5769|  87.7k|    return ret;
 5770|  87.7k|#undef INC_EDGE_LIST
 5771|  87.7k|}
EliminateNitrogen5Val3Bonds:
 5785|  87.7k|{
 5786|  87.7k|    int i, j, k, bForbiddenCarbonCharges, ret2, ret;
 5787|  87.7k|    int num_at = pStruct->num_atoms;
 5788|  87.7k|    int num_deleted_H = pStruct->num_deleted_H;
 5789|  87.7k|    int len_at = num_at + num_deleted_H;
 5790|  87.7k|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 5791|  87.7k|    EDGE_LIST CarbonChargeEdges;
 5792|       |
 5793|  87.7k|    ret = 0;
 5794|  87.7k|    bForbiddenCarbonCharges = 0;
 5795|  87.7k|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  87.7k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5796|       |
 5797|  87.7k|    memcpy(at2, at, len_at * sizeof(at2[0]));
 5798|  87.7k|    pStruct->at = at2;
 5799|  87.7k|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 5800|  87.7k|    if (ret2 < 0)
  ------------------
  |  Branch (5800:9): [True: 0, False: 87.7k]
  ------------------
 5801|      0|    {
 5802|      0|        ret = ret2;
 5803|      0|        goto exit_function;
 5804|      0|    }
 5805|       |
 5806|       |    /* forbid creation of other N(V) atoms */
 5807|       |    /* fix single bonds to metals */
 5808|   920k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (5808:17): [True: 832k, False: 87.7k]
  ------------------
 5809|   832k|    {
 5810|   832k|        if (pVA[i].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5810:13): [True: 104k, False: 728k]
  ------------------
 5811|   104k|             0 <= ( k = GetChargeFlowerUpperEdge( pBNS, pVA, pVA[i].nCPlusGroupEdge - 1 ) ) &&
  ------------------
  |  Branch (5811:14): [True: 8.37k, False: 96.1k]
  ------------------
 5812|  8.37k|             1 == pBNS->edge[k].flow)
  ------------------
  |  Branch (5812:14): [True: 3.69k, False: 4.67k]
  ------------------
 5813|  3.69k|        {
 5814|  3.69k|            pBNS->edge[k].forbidden |= forbidden_edge_mask;
 5815|  3.69k|        }
 5816|   829k|        else
 5817|   829k|            if (pVA[i].cMetal)
  ------------------
  |  Branch (5817:17): [True: 318k, False: 510k]
  ------------------
 5818|   318k|            {
 5819|   362k|                for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (5819:29): [True: 43.1k, False: 318k]
  ------------------
 5820|  43.1k|                {
 5821|  43.1k|                    if (BOND_TYPE_SINGLE == ( at2[i].bond_type[j] & BOND_TYPE_MASK ))
  ------------------
  |  |   32|  43.1k|#define BOND_TYPE_SINGLE    1
  ------------------
                                  if (BOND_TYPE_SINGLE == ( at2[i].bond_type[j] & BOND_TYPE_MASK ))
  ------------------
  |  |  189|  43.1k|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (5821:25): [True: 24.6k, False: 18.4k]
  ------------------
 5822|  24.6k|                    {
 5823|  24.6k|                        pBNS->edge[pBNS->vert[i].iedge[j]].forbidden |= forbidden_edge_mask;
 5824|  24.6k|                    }
 5825|  43.1k|                }
 5826|   318k|            }
 5827|   832k|    }
 5828|       |
 5829|       |    /*------------------------------------------------------------------------------
 5830|       |                 (+)  single line => flow = 0                            (+)-(Y)=(+)super
 5831|       |            01  //    double line => flow = 1                fix-> 01   // <-- fix
 5832|       |         1 --- 0                                                 1 === 0
 5833|       |          \\ //         edge eij connects vertices i < j:         \   /  02
 5834|       |        12  2   02 <--- edge number: e02 connects vertices v0   12  2(..) <- double 'radical'
 5835|       |            |                        v0 and v2                      |
 5836|       |           =N=      vertex N has number i                          =N=
 5837|       |            |                                                       |
 5838|       |    --------------------------------------------------------------------------------*/
 5839|   920k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (5839:17): [True: 832k, False: 87.7k]
  ------------------
 5840|   832k|    {
 5841|   832k|        if (pVA[i].cNumValenceElectrons == 5 && at2[i].valence == 3 &&
  ------------------
  |  Branch (5841:13): [True: 104k, False: 728k]
  |  Branch (5841:49): [True: 8.79k, False: 95.7k]
  ------------------
 5842|  8.79k|             at2[i].chem_bonds_valence == 5 && !at2[i].charge && !at2[i].radical &&
  ------------------
  |  Branch (5842:14): [True: 4.85k, False: 3.94k]
  |  Branch (5842:48): [True: 4.78k, False: 65]
  |  Branch (5842:66): [True: 4.78k, False: 0]
  ------------------
 5843|  4.78k|             !( at2[i].endpoint || (pStruct->endpoint && pStruct->endpoint[i]) ) && pVA[i].cnListIndex > 0 &&
  ------------------
  |  Branch (5843:17): [True: 3, False: 4.78k]
  |  Branch (5843:37): [True: 293, False: 4.49k]
  |  Branch (5843:58): [True: 52, False: 241]
  |  Branch (5843:85): [True: 4.73k, False: 0]
  ------------------
 5844|   832k|             cnList[pVA[i].cnListIndex - 1].bits == cn_bits_NPN &&
  ------------------
  |  |  425|  4.73k|#define cn_bits_NPN MAKE_CN_BITS(cn_bits_N, cn_bits_P, cn_bits_N, 0)
  |  |  ------------------
  |  |  |  |  421|   837k|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|  4.73k|#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))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|  4.73k|#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))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|  4.73k|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (5844:14): [True: 4.61k, False: 116]
  ------------------
 5845|  4.61k|             pVA[i].nCPlusGroupEdge > 0) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (5845:14): [True: 4.61k, False: 0]
  ------------------
 5846|  4.61k|        {
 5847|       |
 5848|  4.61k|            Vertex v, v0 = NO_VERTEX, v1 = NO_VERTEX, v2 = NO_VERTEX;
  ------------------
  |  |  118|  4.61k|#define NO_VERTEX    -2
  ------------------
                          Vertex v, v0 = NO_VERTEX, v1 = NO_VERTEX, v2 = NO_VERTEX;
  ------------------
  |  |  118|  4.61k|#define NO_VERTEX    -2
  ------------------
                          Vertex v, v0 = NO_VERTEX, v1 = NO_VERTEX, v2 = NO_VERTEX;
  ------------------
  |  |  118|  4.61k|#define NO_VERTEX    -2
  ------------------
 5849|  4.61k|            EdgeIndex iePlus, ie, ie12 = NO_VERTEX; /* djb-rwth: removing redundant variables */
  ------------------
  |  |  118|  4.61k|#define NO_VERTEX    -2
  ------------------
 5850|  4.61k|            BNS_VERTEX *pv0, *pv2 = NULL; /* djb-rwth: removing redundant variables */
 5851|  4.61k|            BNS_EDGE   *pePlus, *pe, *pe12 = NULL, *pe02 = NULL, *pe01 = NULL;
 5852|  4.61k|            Vertex     vPathStart, vPathEnd;
 5853|  4.61k|            int        nPathLen;
 5854|  4.61k|            int        nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 5855|       |
 5856|  4.61k|            iePlus = pVA[i].nCPlusGroupEdge - 1;
 5857|  4.61k|            pePlus = pBNS->edge + iePlus;
 5858|       |
 5859|  4.61k|            v0 = IS_BNS_VT_C_GR( pBNS->vert[pePlus->neighbor1].type ) ?
  ------------------
  |  |   78|  4.61k|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   71|  4.61k|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|  4.61k|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|  4.61k|#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)
  |  |  ------------------
  |  |  |  |   49|  4.61k|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (78:37): [True: 4.61k, False: 0]
  |  |  ------------------
  ------------------
 5860|  4.61k|                ( pePlus->neighbor1 ^ pePlus->neighbor12 ) : pePlus->neighbor1;
 5861|  4.61k|            pv0 = pBNS->vert + v0;
 5862|  18.4k|            for (j = 0; j < pv0->num_adj_edges; j++)
  ------------------
  |  Branch (5862:25): [True: 13.8k, False: 4.61k]
  ------------------
 5863|  13.8k|            {
 5864|  13.8k|                ie = pv0->iedge[j];
 5865|  13.8k|                if (ie == iePlus)
  ------------------
  |  Branch (5865:21): [True: 4.61k, False: 9.23k]
  ------------------
 5866|  4.61k|                {
 5867|  4.61k|                    continue;
 5868|  4.61k|                }
 5869|  9.23k|                pe = pBNS->edge + ie;
 5870|  9.23k|                if (pe->flow == 1 && v2 == NO_VERTEX)
  ------------------
  |  |  118|  4.61k|#define NO_VERTEX    -2
  ------------------
  |  Branch (5870:21): [True: 4.61k, False: 4.61k]
  |  Branch (5870:38): [True: 4.61k, False: 0]
  ------------------
 5871|  4.61k|                {
 5872|       |                    /* 0 - 2, edge 02 */
 5873|  4.61k|                    v2 = pe->neighbor12 ^ v0;
 5874|  4.61k|                    pv2 = pBNS->vert + v2;
 5875|       |                    /* djb-rwth: removing redundant code */
 5876|  4.61k|                    pe02 = pe;
 5877|  4.61k|                }
 5878|  4.61k|                else
 5879|  4.61k|                {
 5880|  4.61k|                    if (pe->flow == 0 && v1 == NO_VERTEX)
  ------------------
  |  |  118|  4.61k|#define NO_VERTEX    -2
  ------------------
  |  Branch (5880:25): [True: 4.61k, False: 0]
  |  Branch (5880:42): [True: 4.61k, False: 0]
  ------------------
 5881|  4.61k|                    {
 5882|       |                        /* 0 - 1, edge 01 */
 5883|  4.61k|                        v1 = pe->neighbor12 ^ v0;
 5884|       |                        /* djb-rwth: removing redundant code */
 5885|       |                        /* djb-rwth: removing redundant code */
 5886|  4.61k|                        pe01 = pe;
 5887|  4.61k|                    }
 5888|      0|                    else
 5889|      0|                    {
 5890|      0|                        ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5891|      0|                        goto exit_function;
 5892|      0|                    }
 5893|  4.61k|                }
 5894|  9.23k|            }
 5895|  4.61k|            if (v1 == NO_VERTEX || v2 == NO_VERTEX)
  ------------------
  |  |  118|  9.23k|#define NO_VERTEX    -2
  ------------------
                          if (v1 == NO_VERTEX || v2 == NO_VERTEX)
  ------------------
  |  |  118|  4.61k|#define NO_VERTEX    -2
  ------------------
  |  Branch (5895:17): [True: 0, False: 4.61k]
  |  Branch (5895:36): [True: 0, False: 4.61k]
  ------------------
 5896|      0|            {
 5897|      0|                ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5898|      0|                goto exit_function;
 5899|      0|            }
 5900|  18.4k|            for (j = 0; j < pv2->num_adj_edges; j++)
  ------------------
  |  Branch (5900:25): [True: 13.8k, False: 4.61k]
  ------------------
 5901|  13.8k|            {
 5902|  13.8k|                ie = pv2->iedge[j];
 5903|  13.8k|                pe = pBNS->edge + ie;
 5904|  13.8k|                v = pe->neighbor12 ^ v2;
 5905|  13.8k|                if (v == v0 || v == i)
  ------------------
  |  Branch (5905:21): [True: 4.61k, False: 9.23k]
  |  Branch (5905:32): [True: 4.61k, False: 4.61k]
  ------------------
 5906|  9.23k|                {
 5907|  9.23k|                    continue;
 5908|  9.23k|                }
 5909|  4.61k|                else
 5910|  4.61k|                {
 5911|  4.61k|                    if (v == v1 && pe->flow == 1)
  ------------------
  |  Branch (5911:25): [True: 4.61k, False: 0]
  |  Branch (5911:36): [True: 4.61k, False: 0]
  ------------------
 5912|  4.61k|                    {
 5913|       |                        /* 1 - 2, edge 12 */
 5914|  4.61k|                        ie12 = ie;
 5915|  4.61k|                        pe12 = pe;
 5916|  4.61k|                    }
 5917|      0|                    else
 5918|      0|                    {
 5919|      0|                        ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5920|      0|                        goto exit_function;
 5921|      0|                    }
 5922|  4.61k|                }
 5923|  13.8k|            }
 5924|  4.61k|            if (ie12 == NO_VERTEX)
  ------------------
  |  |  118|  4.61k|#define NO_VERTEX    -2
  ------------------
  |  Branch (5924:17): [True: 0, False: 4.61k]
  ------------------
 5925|      0|            {
 5926|      0|                ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5927|      0|                goto exit_function;
 5928|      0|            }
 5929|       |            /* rearrange cap and flow, forbid 2 edges */
 5930|  4.61k|            pe01->flow = 1;
 5931|  4.61k|            pe12->flow = 0;
 5932|  4.61k|            pe02->flow = 0;
 5933|  4.61k|            pv2->st_edge.flow -= 2;
 5934|  4.61k|            pBNS->tot_st_flow -= 2;
 5935|  4.61k|            pePlus->forbidden |= forbidden_edge_mask;
 5936|  4.61k|            pe01->forbidden |= forbidden_edge_mask;
 5937|       |
 5938|  4.61k|            if (!bForbiddenCarbonCharges)
  ------------------
  |  Branch (5938:17): [True: 4.12k, False: 489]
  ------------------
 5939|  4.12k|            {
 5940|  4.12k|                if (0 > ( ret = ForbidCarbonChargeEdges( pBNS, pTCGroups, &CarbonChargeEdges, forbidden_edge_mask ) ))
  ------------------
  |  Branch (5940:21): [True: 0, False: 4.12k]
  ------------------
 5941|      0|                {
 5942|      0|                    goto exit_function;
 5943|      0|                }
 5944|  4.12k|                bForbiddenCarbonCharges = 1;
 5945|  4.12k|            }
 5946|       |
 5947|       |
 5948|  4.61k|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 5949|  4.61k|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 5950|  4.61k|            if (ret == 1 && vPathEnd == v2 && vPathStart == v2 && nDeltaCharge <= ( pVA[i].cNumBondsToMetal ? 2 : 0 ))
  ------------------
  |  Branch (5950:17): [True: 1.79k, False: 2.82k]
  |  Branch (5950:29): [True: 1.72k, False: 70]
  |  Branch (5950:47): [True: 856, False: 867]
  |  Branch (5950:67): [True: 473, False: 383]
  |  Branch (5950:85): [True: 159, False: 697]
  ------------------
 5951|    473|            {
 5952|    473|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 5953|    473|            }
 5954|  4.14k|            else
 5955|  4.14k|            {
 5956|  4.14k|                pe01->flow = 0;
 5957|  4.14k|                pe12->flow = 1;
 5958|  4.14k|                pe02->flow = 1;
 5959|  4.14k|                pv2->st_edge.flow += 2;
 5960|  4.14k|                pBNS->tot_st_flow += 2;
 5961|  4.14k|            }
 5962|  4.61k|            pePlus->forbidden &= inv_forbidden_edge_mask;
 5963|  4.61k|            pe01->forbidden &= inv_forbidden_edge_mask;
 5964|       |
 5965|  4.61k|            if (ret < 0)
  ------------------
  |  Branch (5965:17): [True: 0, False: 4.61k]
  ------------------
 5966|      0|            {
 5967|      0|                goto exit_function;
 5968|      0|            }
 5969|  4.61k|            else
 5970|  4.61k|            {
 5971|  4.61k|                if (ret)
  ------------------
  |  Branch (5971:21): [True: 1.79k, False: 2.82k]
  ------------------
 5972|  1.79k|                {
 5973|  1.79k|                    memcpy(at2, at, len_at * sizeof(at2[0]));
 5974|  1.79k|                    pStruct->at = at2;
 5975|  1.79k|                    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 5976|  1.79k|                    if (ret2 < 0)
  ------------------
  |  Branch (5976:25): [True: 0, False: 1.79k]
  ------------------
 5977|      0|                    {
 5978|      0|                        ret = ret2;
 5979|      0|                        goto exit_function;
 5980|      0|                    }
 5981|  1.79k|                }
 5982|  4.61k|            }
 5983|  4.61k|        }
 5984|   832k|    }
 5985|       |
 5986|  87.7k|exit_function:
 5987|       |
 5988|       |    /* allow creation of other N(V) atoms */
 5989|   920k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (5989:17): [True: 832k, False: 87.7k]
  ------------------
 5990|   832k|    {
 5991|   832k|        if (pVA[i].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5991:13): [True: 104k, False: 728k]
  ------------------
 5992|   104k|             0 <= ( k = GetChargeFlowerUpperEdge( pBNS, pVA, pVA[i].nCPlusGroupEdge - 1 ) ) &&
  ------------------
  |  Branch (5992:14): [True: 8.37k, False: 96.1k]
  ------------------
 5993|  8.37k|             1 == pBNS->edge[k].flow && ( pBNS->edge[k].forbidden & forbidden_edge_mask ))
  ------------------
  |  Branch (5993:14): [True: 4.17k, False: 4.20k]
  |  Branch (5993:41): [True: 3.69k, False: 473]
  ------------------
 5994|  3.69k|        {
 5995|  3.69k|            pBNS->edge[k].forbidden &= inv_forbidden_edge_mask;
 5996|  3.69k|        }
 5997|   829k|        else
 5998|   829k|        {
 5999|   829k|            if (pVA[i].cMetal)
  ------------------
  |  Branch (5999:17): [True: 318k, False: 510k]
  ------------------
 6000|   318k|            {
 6001|   362k|                for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (6001:29): [True: 43.1k, False: 318k]
  ------------------
 6002|  43.1k|                {
 6003|  43.1k|                    if (BOND_TYPE_SINGLE == ( at2[i].bond_type[j] & BOND_TYPE_MASK ))
  ------------------
  |  |   32|  43.1k|#define BOND_TYPE_SINGLE    1
  ------------------
                                  if (BOND_TYPE_SINGLE == ( at2[i].bond_type[j] & BOND_TYPE_MASK ))
  ------------------
  |  |  189|  43.1k|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (6003:25): [True: 24.6k, False: 18.4k]
  ------------------
 6004|  24.6k|                    {
 6005|  24.6k|                        pBNS->edge[pBNS->vert[i].iedge[j]].forbidden &= inv_forbidden_edge_mask;
 6006|  24.6k|                    }
 6007|  43.1k|                }
 6008|   318k|            }
 6009|   829k|        }
 6010|   832k|    }
 6011|  87.7k|    RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 6012|  87.7k|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  87.7k|#define EDGE_LIST_FREE   (-2)
  ------------------
 6013|       |
 6014|  87.7k|    return ret;
 6015|  87.7k|}
Convert_SIV_to_SVI:
 6029|  87.7k|{
 6030|  87.7k|    int i, j, k, neigh, bForbiddenCarbonCharges, nFlowerEdge, delta, ret2, ret;
 6031|  87.7k|    int num_at = pStruct->num_atoms;
 6032|  87.7k|    int num_deleted_H = pStruct->num_deleted_H;
 6033|  87.7k|    int len_at = num_at + num_deleted_H;
 6034|  87.7k|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 6035|  87.7k|    EDGE_LIST CarbonChargeEdges, FlowerEdgesList;
 6036|       |
 6037|  87.7k|    ret = 0;
 6038|  87.7k|    bForbiddenCarbonCharges = 0;
 6039|  87.7k|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  87.7k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 6040|  87.7k|    AllocEdgeList( &FlowerEdgesList, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  87.7k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 6041|       |
 6042|  87.7k|    memcpy(at2, at, len_at * sizeof(at2[0]));
 6043|  87.7k|    pStruct->at = at2;
 6044|  87.7k|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 6045|  87.7k|    if (ret2 < 0)
  ------------------
  |  Branch (6045:9): [True: 0, False: 87.7k]
  ------------------
 6046|      0|    {
 6047|      0|        ret = ret2;
 6048|      0|        goto exit_function;
 6049|      0|    }
 6050|       |
 6051|       |    /* forbid creation of other S(IV) atoms */
 6052|       |    /* fix single bonds to metals and (N(IV), flow=1), (S(IV), flow=0) */
 6053|   920k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (6053:17): [True: 832k, False: 87.7k]
  ------------------
 6054|   832k|    {
 6055|   832k|        if (( pVA[i].cNumValenceElectrons == 5 /* N(IV)*/ || pVA[i].cNumValenceElectrons == 6 /* S(VI)*/ ) &&
  ------------------
  |  Branch (6055:15): [True: 104k, False: 728k]
  |  Branch (6055:62): [True: 215k, False: 512k]
  ------------------
 6056|   320k|             0 <= ( k = GetChargeFlowerUpperEdge( pBNS, pVA, pVA[i].nCPlusGroupEdge - 1 ) ) &&
  ------------------
  |  Branch (6056:14): [True: 15.2k, False: 304k]
  ------------------
 6057|  15.2k|             !pBNS->edge[k].forbidden &&
  ------------------
  |  Branch (6057:14): [True: 15.2k, False: 0]
  ------------------
 6058|  15.2k|             6 == pVA[i].cNumValenceElectrons + pBNS->edge[k].flow)
  ------------------
  |  Branch (6058:14): [True: 6.14k, False: 9.15k]
  ------------------
 6059|  6.14k|        {
 6060|       |
 6061|  6.14k|            pBNS->edge[k].forbidden |= forbidden_edge_mask;
 6062|  6.14k|            if ((ret = AddToEdgeList( &FlowerEdgesList, k, 64 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (6062:17): [True: 0, False: 6.14k]
  ------------------
 6063|      0|            {
 6064|      0|                goto exit_function;
 6065|      0|            }
 6066|  6.14k|        }
 6067|   826k|        else
 6068|   826k|        {
 6069|   826k|            if (pVA[i].cMetal)
  ------------------
  |  Branch (6069:17): [True: 318k, False: 507k]
  ------------------
 6070|   318k|            {
 6071|   362k|                for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (6071:29): [True: 43.1k, False: 318k]
  ------------------
 6072|  43.1k|                {
 6073|  43.1k|                    if (BOND_TYPE_SINGLE == ( at2[i].bond_type[j] & BOND_TYPE_MASK ))
  ------------------
  |  |   32|  43.1k|#define BOND_TYPE_SINGLE    1
  ------------------
                                  if (BOND_TYPE_SINGLE == ( at2[i].bond_type[j] & BOND_TYPE_MASK ))
  ------------------
  |  |  189|  43.1k|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (6073:25): [True: 24.6k, False: 18.4k]
  ------------------
 6074|  24.6k|                    {
 6075|       |
 6076|  24.6k|                        pBNS->edge[k = pBNS->vert[i].iedge[j]].forbidden |= forbidden_edge_mask;
 6077|  24.6k|                        if ((ret = AddToEdgeList( &FlowerEdgesList, k, 64 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (6077:29): [True: 0, False: 24.6k]
  ------------------
 6078|      0|                        {
 6079|      0|                            goto exit_function;
 6080|      0|                        }
 6081|  24.6k|                    }
 6082|  43.1k|                }
 6083|   318k|            }
 6084|   507k|            else
 6085|   507k|            {
 6086|       |                /* fix bonds to neighbors of S(IV) if they are not O,S,Se,Te with 2 or more bonds */
 6087|       |                 /* exactly same if(..) as below */
 6088|   507k|                if (pVA[i].cNumValenceElectrons == 6 && at2[i].valence == 4 &&
  ------------------
  |  Branch (6088:21): [True: 213k, False: 294k]
  |  Branch (6088:57): [True: 1.59k, False: 211k]
  ------------------
 6089|  1.59k|                     at2[i].chem_bonds_valence == 4 && !at2[i].charge && !at2[i].radical &&
  ------------------
  |  Branch (6089:22): [True: 571, False: 1.02k]
  |  Branch (6089:56): [True: 487, False: 84]
  |  Branch (6089:74): [True: 477, False: 10]
  ------------------
 6090|    477|                     !at2[i].endpoint && pVA[i].cnListIndex > 0 &&
  ------------------
  |  Branch (6090:22): [True: 476, False: 1]
  |  Branch (6090:42): [True: 476, False: 0]
  ------------------
 6091|   507k|                     cnList[pVA[i].cnListIndex - 1].bits == cn_bits_NPN &&
  ------------------
  |  |  425|    476|#define cn_bits_NPN MAKE_CN_BITS(cn_bits_N, cn_bits_P, cn_bits_N, 0)
  |  |  ------------------
  |  |  |  |  421|   508k|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|    476|#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))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|    476|#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))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|    476|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (6091:22): [True: 475, False: 1]
  ------------------
 6092|    475|                     0 <= ( nFlowerEdge = GetChargeFlowerUpperEdge( pBNS, pVA, pVA[i].nCPlusGroupEdge - 1 ) ) &&
  ------------------
  |  Branch (6092:22): [True: 475, False: 0]
  ------------------
 6093|    475|                     pBNS->edge[nFlowerEdge].flow > 0)
  ------------------
  |  Branch (6093:22): [True: 475, False: 0]
  ------------------
 6094|    475|                {
 6095|       |
 6096|  2.37k|                    for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (6096:33): [True: 1.90k, False: 475]
  ------------------
 6097|  1.90k|                    {
 6098|  1.90k|                        neigh = at2[i].neighbor[j];
 6099|  1.90k|                        if (pVA[neigh].cNumValenceElectrons != 6 && at2[neigh].valence > 1)
  ------------------
  |  Branch (6099:29): [True: 1.25k, False: 641]
  |  Branch (6099:69): [True: 767, False: 492]
  ------------------
 6100|    767|                        {
 6101|    767|                            k = pBNS->vert[i].iedge[j];
 6102|    767|                            if (!pBNS->edge[k].forbidden)
  ------------------
  |  Branch (6102:33): [True: 675, False: 92]
  ------------------
 6103|    675|                            {
 6104|    675|                                if ((ret = AddToEdgeList( &FlowerEdgesList, k, 64 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (6104:37): [True: 0, False: 675]
  ------------------
 6105|      0|                                {
 6106|      0|                                    goto exit_function;
 6107|      0|                                }
 6108|    675|                                pBNS->edge[k].forbidden |= forbidden_edge_mask;
 6109|    675|                            }
 6110|    767|                        }
 6111|  1.90k|                    }
 6112|    475|                }
 6113|   507k|            }
 6114|   826k|        }
 6115|   832k|    }
 6116|       |
 6117|       |    /*------------------------------------------------------------------------------
 6118|       |                        example: struct #301,
 6119|       |      |          |               disconnected porphyrin with four -SO3(-)
 6120|       |     -S-   =>   =S=
 6121|       |      |          |
 6122|       |
 6123|       |    -------------------------------------------------------------------------------*/
 6124|       |
 6125|       |    /*-------------------------------------------------------------------------------
 6126|       |     found:                                       super(+)=(Y)        super(+)=(Y)
 6127|       |                                                              \                   \
 6128|       |             (+)  single line => flow = 0                     (+)                 (+)
 6129|       |        01  //    double line => flow = 1         fix-> 01   //             01   //
 6130|       |     1 === 0      triple line => flow = 2          (.)1 --- 0(.)  --->    1 --- 0
 6131|       |      \   /       edge eij connects vertices i<j:      \   /  02  run      \\ //  02
 6132|       |    12  2   02 <--- edge number: e02 connects        12  2        BFS    12  2
 6133|       |       |||              vertices v0 and v2              |||                  |
 6134|       |       -S-      vertex S has number i                   -S-                 =S=
 6135|       |       / \                                              / \                 / \
 6136|       |    --------------------------------------------------------------------------------*/
 6137|   920k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (6137:17): [True: 832k, False: 87.7k]
  ------------------
 6138|   832k|    {
 6139|   832k|        if (pVA[i].cNumValenceElectrons == 6 && at2[i].valence == 4 &&
  ------------------
  |  Branch (6139:13): [True: 215k, False: 617k]
  |  Branch (6139:49): [True: 2.28k, False: 213k]
  ------------------
 6140|  2.28k|             at2[i].chem_bonds_valence == 4 && !at2[i].charge && !at2[i].radical &&
  ------------------
  |  Branch (6140:14): [True: 571, False: 1.71k]
  |  Branch (6140:48): [True: 487, False: 84]
  |  Branch (6140:66): [True: 477, False: 10]
  ------------------
 6141|    477|             !at2[i].endpoint && pVA[i].cnListIndex > 0 &&
  ------------------
  |  Branch (6141:14): [True: 476, False: 1]
  |  Branch (6141:34): [True: 476, False: 0]
  ------------------
 6142|   832k|             cnList[pVA[i].cnListIndex - 1].bits == cn_bits_NPN &&
  ------------------
  |  |  425|    476|#define cn_bits_NPN MAKE_CN_BITS(cn_bits_N, cn_bits_P, cn_bits_N, 0)
  |  |  ------------------
  |  |  |  |  421|   833k|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|    476|#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))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|    476|#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))
  |  |  |  |  ------------------
  |  |  |  |  |  |  419|    476|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (6142:14): [True: 469, False: 7]
  ------------------
 6143|       |             /* 01 is nFlowerEdge */
 6144|    469|             0 <= ( nFlowerEdge = GetChargeFlowerUpperEdge( pBNS, pVA, pVA[i].nCPlusGroupEdge - 1 ) ) &&
  ------------------
  |  Branch (6144:14): [True: 469, False: 0]
  ------------------
 6145|    469|             pBNS->edge[nFlowerEdge].flow > 0)
  ------------------
  |  Branch (6145:14): [True: 469, False: 0]
  ------------------
 6146|    469|        {
 6147|       |
 6148|    469|            Vertex     v1 = NO_VERTEX, v2 = NO_VERTEX;
  ------------------
  |  |  118|    469|#define NO_VERTEX    -2
  ------------------
                          Vertex     v1 = NO_VERTEX, v2 = NO_VERTEX;
  ------------------
  |  |  118|    469|#define NO_VERTEX    -2
  ------------------
 6149|    469|            BNS_VERTEX *pv1, *pv2;
 6150|    469|            BNS_EDGE   *pe;
 6151|    469|            Vertex     vPathStart, vPathEnd;
 6152|    469|            int        nPathLen;
 6153|    469|            int        nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 6154|       |
 6155|    469|            if (!bForbiddenCarbonCharges)
  ------------------
  |  Branch (6155:17): [True: 445, False: 24]
  ------------------
 6156|    445|            {
 6157|    445|                if (0 > ( ret = ForbidCarbonChargeEdges( pBNS, pTCGroups, &CarbonChargeEdges, forbidden_edge_mask ) ))
  ------------------
  |  Branch (6157:21): [True: 0, False: 445]
  ------------------
 6158|      0|                {
 6159|      0|                    goto exit_function;
 6160|      0|                }
 6161|    445|                bForbiddenCarbonCharges = 1;
 6162|    445|            }
 6163|       |
 6164|    469|            delta = 1;
 6165|    469|            pe = pBNS->edge + nFlowerEdge;                 /* edge  01 */
 6166|    469|            pv1 = pBNS->vert + ( v1 = pe->neighbor1 );       /* vertex 0 */
 6167|    469|            pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 ); /* vertex 1 */
 6168|       |
 6169|    469|            pe->forbidden |= forbidden_edge_mask;
 6170|    469|            pe->flow -= delta;
 6171|    469|            pv1->st_edge.flow -= delta;
 6172|    469|            pv2->st_edge.flow -= delta;
 6173|    469|            pBNS->tot_st_flow -= 2 * delta;
 6174|       |
 6175|    469|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 6176|    469|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 6177|    469|            if (ret == 1 &&
  ------------------
  |  Branch (6177:17): [True: 312, False: 157]
  ------------------
 6178|    312|                ( (vPathEnd == v1 && vPathStart == v2) || (vPathEnd == v2 && vPathStart == v1) ) &&
  ------------------
  |  Branch (6178:20): [True: 161, False: 151]
  |  Branch (6178:38): [True: 0, False: 161]
  |  Branch (6178:60): [True: 151, False: 161]
  |  Branch (6178:78): [True: 151, False: 0]
  ------------------
 6179|    151|                 nDeltaCharge <= ( pVA[i].cNumBondsToMetal ? 2 : 0 )) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (6179:18): [True: 137, False: 14]
  |  Branch (6179:36): [True: 93, False: 58]
  ------------------
 6180|    137|            {
 6181|    137|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 6182|    137|            }
 6183|    332|            else
 6184|    332|            {
 6185|    332|                pe->forbidden &= inv_forbidden_edge_mask;
 6186|    332|                pe->flow += delta;
 6187|    332|                pv1->st_edge.flow += delta;
 6188|    332|                pv2->st_edge.flow += delta;
 6189|    332|                pBNS->tot_st_flow += 2 * delta;
 6190|    332|            }
 6191|    469|            if (ret < 0)
  ------------------
  |  Branch (6191:17): [True: 0, False: 469]
  ------------------
 6192|      0|            {
 6193|      0|                goto exit_function;
 6194|      0|            }
 6195|    469|            else
 6196|    469|            {
 6197|    469|                if (ret)
  ------------------
  |  Branch (6197:21): [True: 312, False: 157]
  ------------------
 6198|    312|                {
 6199|    312|                    memcpy(at2, at, len_at * sizeof(at2[0]));
 6200|    312|                    pStruct->at = at2;
 6201|    312|                    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 6202|    312|                    if (ret2 < 0)
  ------------------
  |  Branch (6202:25): [True: 0, False: 312]
  ------------------
 6203|      0|                    {
 6204|      0|                        ret = ret2;
 6205|      0|                        goto exit_function;
 6206|      0|                    }
 6207|       |                    /* store the fixed edge to unfix it upon exit */
 6208|    312|                    if ((ret = AddToEdgeList( &FlowerEdgesList, nFlowerEdge, 64 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (6208:25): [True: 0, False: 312]
  ------------------
 6209|      0|                    {
 6210|      0|                        goto exit_function;
 6211|      0|                    }
 6212|    312|                }
 6213|    469|            }
 6214|    469|        }
 6215|   832k|    }
 6216|       |
 6217|  87.7k|exit_function:
 6218|       |
 6219|  87.7k|    RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 6220|  87.7k|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  87.7k|#define EDGE_LIST_FREE   (-2)
  ------------------
 6221|  87.7k|    RemoveForbiddenEdgeMask( pBNS, &FlowerEdgesList, forbidden_edge_mask );
 6222|  87.7k|    AllocEdgeList( &FlowerEdgesList, EDGE_LIST_FREE );
  ------------------
  |  |  243|  87.7k|#define EDGE_LIST_FREE   (-2)
  ------------------
 6223|       |
 6224|  87.7k|    return ret;
 6225|  87.7k|}
PlusFromDB_N_DB_O_to_Metal:
 6245|  87.7k|{
 6246|  87.7k|    int i, j, k, n, delta, ret2, ret, num_NO, num_M; /* djb-rwth: removing redundant variables */
 6247|  87.7k|    int num_at = pStruct->num_atoms;
 6248|  87.7k|    int num_deleted_H = pStruct->num_deleted_H;
 6249|  87.7k|    int len_at = num_at + num_deleted_H;
 6250|  87.7k|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 6251|  87.7k|    EDGE_LIST CarbonChargeEdges, NO_ChargeEdgeList, NO_EdgeList;
 6252|       |
 6253|  87.7k|    Vertex     v1, v2;
 6254|  87.7k|    BNS_VERTEX *pv1, *pv2;
 6255|  87.7k|    BNS_EDGE   *pe;
 6256|  87.7k|    Vertex     vPathStart, vPathEnd;
 6257|  87.7k|    int        nPathLen;
 6258|  87.7k|    int        nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 6259|       |
 6260|       |
 6261|  87.7k|    if (!pTCGroups->num_metal_atoms)
  ------------------
  |  Branch (6261:9): [True: 22.3k, False: 65.4k]
  ------------------
 6262|  22.3k|    {
 6263|  22.3k|        return 0;
 6264|  22.3k|    }
 6265|       |
 6266|  65.4k|    ret = 0;
 6267|       |    /* djb-rwth: removing redundant code */
 6268|  65.4k|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_CLEAR ); /* all charges */
  ------------------
  |  |  242|  65.4k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 6269|  65.4k|    AllocEdgeList( &NO_ChargeEdgeList, EDGE_LIST_CLEAR ); /* charges to be changed */
  ------------------
  |  |  242|  65.4k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 6270|  65.4k|    AllocEdgeList( &NO_EdgeList, EDGE_LIST_CLEAR );       /* N(+)=O edges */
  ------------------
  |  |  242|  65.4k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 6271|       |
 6272|  65.4k|    memcpy(at2, at, len_at * sizeof(at2[0]));
 6273|  65.4k|    pStruct->at = at2;
 6274|  65.4k|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 6275|  65.4k|    if (ret2 < 0)
  ------------------
  |  Branch (6275:9): [True: 0, False: 65.4k]
  ------------------
 6276|      0|    {
 6277|      0|        ret = ret2;
 6278|      0|        goto exit_function;
 6279|      0|    }
 6280|       |
 6281|  65.4k|    num_NO = num_M = 0;
 6282|       |
 6283|       |    /* forbid creation of other S(IV) atoms */
 6284|       |    /* fix single bonds to metals and (N(IV), flow=1), (S(IV), flow=0) */
 6285|   787k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (6285:17): [True: 722k, False: 65.4k]
  ------------------
 6286|   722k|    {
 6287|   722k|        if (!pVA[i].cMetal)
  ------------------
  |  Branch (6287:13): [True: 403k, False: 318k]
  ------------------
 6288|   403k|        {
 6289|   403k|            if (( k = pVA[i].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[k].forbidden)
  ------------------
  |  Branch (6289:17): [True: 49.1k, False: 354k]
  |  Branch (6289:60): [True: 47.0k, False: 2.17k]
  ------------------
 6290|  47.0k|            {
 6291|  47.0k|                if ((ret = AddToEdgeList( &CarbonChargeEdges, k, 64 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (6291:21): [True: 0, False: 47.0k]
  ------------------
 6292|      0|                {
 6293|      0|                    goto exit_function;
 6294|      0|                }
 6295|  47.0k|            }
 6296|   403k|            if (( k = pVA[i].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[k].forbidden)
  ------------------
  |  Branch (6296:17): [True: 39.7k, False: 363k]
  |  Branch (6296:61): [True: 39.7k, False: 0]
  ------------------
 6297|  39.7k|            {
 6298|  39.7k|                if ((ret = AddToEdgeList( &CarbonChargeEdges, k, 64 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (6298:21): [True: 0, False: 39.7k]
  ------------------
 6299|      0|                {
 6300|      0|                    goto exit_function;
 6301|      0|                }
 6302|  39.7k|            }
 6303|   403k|        }
 6304|   318k|        else
 6305|   318k|        {
 6306|   318k|            num_M++;
 6307|   318k|        }
 6308|       |        /*
 6309|       |        if ( pVA[i].cMetal )
 6310|       |        {
 6311|       |            if ( (k = pVA[i].nCPlusGroupEdge-1) >= 0 && !pBNS->edge[k].forbidden )
 6312|       |            {
 6313|       |                if ( ret = AddToEdgeList( &NO_ChargeEdgeList, k, 64 ) )
 6314|       |                {
 6315|       |                    goto exit_function;
 6316|       |                }
 6317|       |            }
 6318|       |            if ( (k = pVA[i].nCMinusGroupEdge-1) >= 0 && !pBNS->edge[k].forbidden )
 6319|       |            {
 6320|       |                if ( ret = AddToEdgeList( &NO_ChargeEdgeList, k, 64 ) )
 6321|       |                {
 6322|       |                    goto exit_function;
 6323|       |                }
 6324|       |            }
 6325|       |        }
 6326|       |        else
 6327|       |        */
 6328|   722k|        if (!pVA[i].cMetal &&
  ------------------
  |  Branch (6328:13): [True: 403k, False: 318k]
  ------------------
 6329|   403k|             pVA[i].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (6329:14): [True: 188k, False: 214k]
  ------------------
 6330|   188k|             at2[i].charge == 0 && !at2[i].num_H &&
  ------------------
  |  Branch (6330:14): [True: 180k, False: 8.27k]
  |  Branch (6330:36): [True: 180k, False: 416]
  ------------------
 6331|   180k|             1 == at2[i].valence && 2 == at2[i].chem_bonds_valence &&
  ------------------
  |  Branch (6331:14): [True: 5.83k, False: 174k]
  |  Branch (6331:37): [True: 5.79k, False: 35]
  ------------------
 6332|  5.79k|             pVA[j = at2[i].neighbor[0]].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (6332:14): [True: 1.65k, False: 4.14k]
  ------------------
 6333|  1.65k|             at2[j].charge == 1 && !at2[j].num_H &&
  ------------------
  |  Branch (6333:14): [True: 188, False: 1.47k]
  |  Branch (6333:36): [True: 178, False: 10]
  ------------------
 6334|    178|             2 == at2[j].valence && 4 == at2[j].chem_bonds_valence)
  ------------------
  |  Branch (6334:14): [True: 45, False: 133]
  |  Branch (6334:37): [True: 45, False: 0]
  ------------------
 6335|     45|        {
 6336|       |            /* found =N(+)=O */
 6337|     45|            if (( k = pVA[i].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[k].forbidden /* O */ &&
  ------------------
  |  Branch (6337:17): [True: 44, False: 1]
  |  Branch (6337:61): [True: 44, False: 0]
  ------------------
 6338|     44|                ( n = pVA[j].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[j].forbidden /* N */)
  ------------------
  |  Branch (6338:17): [True: 44, False: 0]
  |  Branch (6338:60): [True: 43, False: 1]
  ------------------
 6339|     43|            {
 6340|     43|                if (( ret = AddToEdgeList( &NO_ChargeEdgeList, k, 64 ) ) ||
  ------------------
  |  Branch (6340:21): [True: 0, False: 43]
  ------------------
 6341|     43|                    ( ret = AddToEdgeList( &NO_ChargeEdgeList, n, 64 ) ))
  ------------------
  |  Branch (6341:21): [True: 0, False: 43]
  ------------------
 6342|      0|                {
 6343|      0|                    goto exit_function;
 6344|      0|                }
 6345|     43|                k = pBNS->vert[i].iedge[0];  /* N(+)=O bond */
 6346|     43|                if (!pBNS->edge[k].forbidden)
  ------------------
  |  Branch (6346:21): [True: 43, False: 0]
  ------------------
 6347|     43|                {
 6348|     43|                    if ((ret = AddToEdgeList( &NO_EdgeList, k, 64 ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (6348:25): [True: 0, False: 43]
  ------------------
 6349|      0|                    {
 6350|      0|                        goto exit_function;
 6351|      0|                    }
 6352|     43|                    num_NO++;
 6353|     43|                }
 6354|     43|            }
 6355|     45|        }
 6356|   722k|    }
 6357|  65.4k|    if (num_M && num_NO)
  ------------------
  |  Branch (6357:9): [True: 65.4k, False: 0]
  |  Branch (6357:18): [True: 43, False: 65.3k]
  ------------------
 6358|     43|    {
 6359|     43|        SetForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 6360|     43|        SetForbiddenEdgeMask( pBNS, &NO_EdgeList, forbidden_edge_mask );
 6361|     43|        RemoveForbiddenEdgeMask( pBNS, &NO_ChargeEdgeList, forbidden_edge_mask );
 6362|       |        /* now only N(+), O(-) and metal charges are allowed to change */
 6363|     86|        for (i = 0; i < NO_EdgeList.num_edges; i++)
  ------------------
  |  Branch (6363:21): [True: 43, False: 43]
  ------------------
 6364|     43|        {
 6365|     43|            k = NO_EdgeList.pnEdges[i];
 6366|     43|            delta = 1;
 6367|     43|            pe = pBNS->edge + k;                 /* edge  N(+)=O */
 6368|     43|            pv1 = pBNS->vert + ( v1 = pe->neighbor1 );       /* vertex 0 */
 6369|     43|            pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 ); /* vertex 1 */
 6370|       |
 6371|     43|            pe->flow -= delta;
 6372|     43|            pv1->st_edge.flow -= delta;
 6373|     43|            pv2->st_edge.flow -= delta;
 6374|     43|            pBNS->tot_st_flow -= 2 * delta;
 6375|       |
 6376|     43|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 6377|     43|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 6378|     43|            if (ret == 1 &&
  ------------------
  |  Branch (6378:17): [True: 43, False: 0]
  ------------------
 6379|     43|                ( (vPathEnd == v1 && vPathStart == v2) || (vPathEnd == v2 && vPathStart == v1) ) &&
  ------------------
  |  Branch (6379:20): [True: 1, False: 42]
  |  Branch (6379:38): [True: 0, False: 1]
  |  Branch (6379:60): [True: 41, False: 2]
  |  Branch (6379:78): [True: 41, False: 0]
  ------------------
 6380|     41|                 nDeltaCharge == 0) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (6380:18): [True: 8, False: 33]
  ------------------
 6381|      8|            {
 6382|      8|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 6383|      8|            }
 6384|     35|            else
 6385|     35|            {
 6386|     35|                pe->forbidden &= inv_forbidden_edge_mask;
 6387|     35|                pe->flow += delta;
 6388|     35|                pv1->st_edge.flow += delta;
 6389|     35|                pv2->st_edge.flow += delta;
 6390|     35|                pBNS->tot_st_flow += 2 * delta;
 6391|     35|            }
 6392|     43|            if (ret < 0)
  ------------------
  |  Branch (6392:17): [True: 0, False: 43]
  ------------------
 6393|      0|            {
 6394|      0|                goto exit_function;
 6395|      0|            }
 6396|     43|        }
 6397|     43|    }
 6398|       |
 6399|  65.4k|exit_function:
 6400|  65.4k|    RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 6401|  65.4k|    RemoveForbiddenEdgeMask( pBNS, &NO_EdgeList, forbidden_edge_mask );
 6402|  65.4k|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  65.4k|#define EDGE_LIST_FREE   (-2)
  ------------------
 6403|  65.4k|    AllocEdgeList( &NO_EdgeList, EDGE_LIST_FREE );
  ------------------
  |  |  243|  65.4k|#define EDGE_LIST_FREE   (-2)
  ------------------
 6404|  65.4k|    AllocEdgeList( &NO_ChargeEdgeList, EDGE_LIST_FREE );
  ------------------
  |  |  243|  65.4k|#define EDGE_LIST_FREE   (-2)
  ------------------
 6405|       |
 6406|  65.4k|    return ret;
 6407|  65.4k|}
MoveMobileHToAvoidFixedBonds:
 6421|  87.7k|{
 6422|  87.7k|    int ret2, ret;
 6423|  87.7k|    int num_at = pStruct->num_atoms;
 6424|  87.7k|    int num_deleted_H = pStruct->num_deleted_H;
 6425|  87.7k|    int len_at = num_at + num_deleted_H;
 6426|  87.7k|    int nNumFixedEdges, nNumAdjEdges;
 6427|       |
 6428|  87.7k|    ret = 0;
 6429|       |
 6430|  87.7k|    if (pTCGroups->num_tgroups)
  ------------------
  |  Branch (6430:9): [True: 486, False: 87.2k]
  ------------------
 6431|    486|    {
 6432|    486|        memcpy(at2, at, len_at * sizeof(at2[0]));
 6433|    486|        pStruct->at = at2;
 6434|    486|        ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 6435|    486|        pStruct->at = at;
 6436|    486|        if (ret2 < 0)
  ------------------
  |  Branch (6436:13): [True: 0, False: 486]
  ------------------
 6437|      0|        {
 6438|      0|            ret = ret2;
 6439|      0|            goto exit_function;
 6440|      0|        }
 6441|    486|#if ( FIND_RING_SYSTEMS == 1 )
 6442|    486|        ret2 = MarkRingSystemsInp( at2, num_at, 0 );
 6443|    486|        if (ret2 < 0)
  ------------------
  |  Branch (6443:13): [True: 0, False: 486]
  ------------------
 6444|      0|        {
 6445|      0|            ret = ret2;
 6446|      0|            goto exit_function;
 6447|      0|        }
 6448|    486|#endif
 6449|       |        /* --- forbidden edges --- */
 6450|    486|        ret2 = SetForbiddenEdges( pBNS, at2, num_at, forbidden_edge_mask, 0, NULL );
 6451|       |
 6452|    486|        if (ret2 < 0)
  ------------------
  |  Branch (6452:13): [True: 0, False: 486]
  ------------------
 6453|      0|        {
 6454|      0|            ret2 = -( ret + 1 );
 6455|      0|        }
 6456|    486|        nNumFixedEdges = ret2;
 6457|    486|        ret = AdjustTgroupsToForbiddenEdges2( pBNS, at2, pVA, num_at, forbidden_edge_mask );
 6458|    486|        nNumAdjEdges = ret;
 6459|    486|        if (ret)
  ------------------
  |  Branch (6459:13): [True: 8, False: 478]
  ------------------
 6460|      8|        {
 6461|      8|            pBNS->edge_forbidden_mask |= forbidden_edge_mask;
 6462|      8|            ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 6463|      8|            ( *pnNumRunBNS )++;
 6464|      8|            if (ret < 0)
  ------------------
  |  Branch (6464:17): [True: 0, False: 8]
  ------------------
 6465|      0|            {
 6466|      0|                goto exit_function;
 6467|      0|            }
 6468|      8|            else
 6469|      8|            {
 6470|      8|                *pnTotalDelta += ret;
 6471|      8|            }
 6472|      8|        }
 6473|    486|        if (nNumFixedEdges || nNumAdjEdges)
  ------------------
  |  Branch (6473:13): [True: 69, False: 417]
  |  Branch (6473:31): [True: 0, False: 417]
  ------------------
 6474|     69|        {
 6475|       |            /* removes this edge mask from ALL edges */
 6476|     69|            RemoveForbiddenBondFlowBits( pBNS, forbidden_edge_mask );
 6477|     69|        }
 6478|    486|    }
 6479|       |
 6480|  87.7k|exit_function:
 6481|       |
 6482|  87.7k|    return ret;
 6483|  87.7k|}
RemoveRadFromMobileHEndpoint:
 6500|  86.6k|{
 6501|  86.6k|    int i, num_fixes, tot_num_fixes = 0;
 6502|       |
 6503|  86.6k|    int ret2, ret;
 6504|  86.6k|    int num_at = pStruct->num_atoms;
 6505|  86.6k|    int num_deleted_H = pStruct->num_deleted_H;
 6506|  86.6k|    int len_at = num_at + num_deleted_H;
 6507|       |
 6508|  86.6k|    int         itg, j, k, n, m;
 6509|  86.6k|    Vertex      vtg1, endpoint0 = NO_VERTEX, endpoint1, endpoint2, centerpoint;
  ------------------
  |  |  118|  86.6k|#define NO_VERTEX    -2
  ------------------
 6510|  86.6k|    Vertex      centerpoint_found = NO_VERTEX;
  ------------------
  |  |  118|  86.6k|#define NO_VERTEX    -2
  ------------------
 6511|  86.6k|    BNS_VERTEX *ptg1, *pEndp0 = NULL, *pEndp1, *pEndp2, *pCentp, *pCentp_found, *pEndp2_found = NULL;
 6512|  86.6k|    BNS_EDGE   *etg0 = NULL, *etg1, *etg2, *ecp0, *ecp1, *ecp2;
 6513|  86.6k|    BNS_EDGE   *etg1_found = NULL, *ecp0_found = NULL, *ecp1_found = NULL, *ecp2_found = NULL;
 6514|  86.6k|    int         num_endpoints, max_vertices, nMaxAddAtoms = 2; /* djb-rwth: removing redundant variables; fixing oss-fuzz issue #25732 */
 6515|       |
 6516|       |    /* djb-rwth: removing redundant code */
 6517|  86.6k|    memcpy(at2, at, len_at * sizeof(at2[0]));
 6518|  86.6k|    pStruct->at = at2;
 6519|  86.6k|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 6520|  86.6k|    if (ret2 < 0)
  ------------------
  |  Branch (6520:9): [True: 0, False: 86.6k]
  ------------------
 6521|      0|    {
 6522|      0|        ret = ret2;
 6523|      0|        goto exit_function;
 6524|      0|    }
 6525|  86.7k|    while (pBNS->tot_st_cap > pBNS->tot_st_flow && pTCGroups->num_tgroups)
  ------------------
  |  Branch (6525:12): [True: 13.3k, False: 73.3k]
  |  Branch (6525:52): [True: 335, False: 13.0k]
  ------------------
 6526|    335|    {
 6527|    335|        num_fixes = 0;
 6528|    700|        for (itg = 0; itg < pTCGroups->num_tgroups; itg++)
  ------------------
  |  Branch (6528:23): [True: 365, False: 335]
  ------------------
 6529|    365|        {
 6530|    365|            pCentp_found = NULL;
 6531|       |            /* djb-rwth: removing redundant code */
 6532|    365|            vtg1 = pTCGroups->pTCG[itg].nVertexNumber;      /* taut group vertex index */
 6533|    365|            ptg1 = pBNS->vert + vtg1;                       /* taut group vertex */
 6534|    365|            num_endpoints = pTCGroups->pTCG[itg].num_edges;
 6535|    966|            for (i = 0; i < num_endpoints; i++)
  ------------------
  |  Branch (6535:25): [True: 765, False: 201]
  ------------------
 6536|    765|            {
 6537|    765|                etg0 = pBNS->edge + ptg1->iedge[i];         /* edge from t-group to endpoint */
 6538|    765|                endpoint0 = etg0->neighbor12 ^ vtg1;        /* taut endpoint vertex index */
 6539|       |                /* djb-rwth: fixing oss-fuzz issues #68494, #25732 */
 6540|    765|                max_vertices = pTCGroups->nVertices + nMaxAddAtoms;
 6541|    765|                if (endpoint0 < max_vertices)
  ------------------
  |  Branch (6541:21): [True: 762, False: 3]
  ------------------
 6542|    762|                {
 6543|    762|                    pEndp0 = pBNS->vert + endpoint0;            /* taut endpoint vertex (possible location of mobile H */
 6544|    762|                    if (pEndp0->st_edge.cap > pEndp0->st_edge.flow)
  ------------------
  |  Branch (6544:25): [True: 164, False: 598]
  ------------------
 6545|    164|                    {
 6546|       |                        /* radical endpoint1 has been detected */
 6547|       |                        /* find a 1-3 centerpoint that has two or more endpoints */
 6548|       |                        /* connected to the t-group vertex by edges with flow>0 and */
 6549|       |                        /* to the centerpoint by edges with flow = 0 */
 6550|       |                        /* after that: (1) increment etg1 flow to eliminate radical */
 6551|       |                        /* (2) increment flow on one of the two other edges to the t-group */
 6552|       |                        /* (3) increment st_cap on the found centerpoint */
 6553|       |                        /* (4) rerun the BNS and re-create the structure */
 6554|    164|                        break;
 6555|    164|                    }
 6556|    762|                }
 6557|    765|            }
 6558|    365|            if (i == num_endpoints)
  ------------------
  |  Branch (6558:17): [True: 201, False: 164]
  ------------------
 6559|    201|            {
 6560|    201|                continue;
 6561|    201|            }
 6562|    164|            if (i < num_endpoints)
  ------------------
  |  Branch (6562:17): [True: 164, False: 0]
  ------------------
 6563|    164|            {
 6564|       |                /* tautomeric endpoint found; traverse its t-group edges */
 6565|    650|                for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (6565:29): [True: 486, False: 164]
  ------------------
 6566|    486|                {
 6567|    486|                    if (i == j)
  ------------------
  |  Branch (6567:25): [True: 164, False: 322]
  ------------------
 6568|    164|                    {
 6569|    164|                        continue; /* avoid the already found radical endpoint */
 6570|    164|                    }
 6571|    322|                    etg1 = pBNS->edge + ptg1->iedge[j];  /* another edge from t-group to another endpoinr */
 6572|    322|                    endpoint1 = etg1->neighbor12 ^ vtg1; /* another endpoint vertex index */
 6573|    322|                    pEndp1 = pBNS->vert + endpoint1;     /* another endpoint vertex */
 6574|    322|                    if (pEndp1->st_edge.cap > pEndp1->st_edge.flow)
  ------------------
  |  Branch (6574:25): [True: 47, False: 275]
  ------------------
 6575|     47|                    {
 6576|     47|                        continue; /* one more radical-endpoint! What is going on here??? */
 6577|     47|                    }
 6578|    275|                    if (!etg1->flow)
  ------------------
  |  Branch (6578:25): [True: 107, False: 168]
  ------------------
 6579|    107|                    {
 6580|    107|                        continue; /* avoid enpoints that do not have an attachment */
 6581|    107|                    }
 6582|    168|                    if (!( pEndp1->type & BNS_VERT_TYPE_ENDPOINT ))
  ------------------
  |  |   46|    168|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
  |  Branch (6582:25): [True: 1, False: 167]
  ------------------
 6583|      1|                    {
 6584|      1|                        continue; /* should not happen */
 6585|      1|                    }
 6586|       |                    /* traverse endpoint1 edges to find a single bond connecting it to the centerpoint */
 6587|    414|                    for (k = 0; k < at2[endpoint1].valence; k++)
  ------------------
  |  Branch (6587:33): [True: 247, False: 167]
  ------------------
 6588|    247|                    {
 6589|    247|                        ecp1 = pBNS->edge + pEndp1->iedge[k];
 6590|    247|                        if (ecp1->flow)
  ------------------
  |  Branch (6590:29): [True: 30, False: 217]
  ------------------
 6591|     30|                        {
 6592|     30|                            continue;
 6593|     30|                        }
 6594|    217|                        centerpoint = ecp1->neighbor12 ^ endpoint1;
 6595|    217|                        pCentp = pBNS->vert + centerpoint;
 6596|       |                        /* traverse centerpoint edges to find a single bond to the 2nd endpoint */
 6597|    861|                        for (n = 0; n < at2[centerpoint].valence; n++)
  ------------------
  |  Branch (6597:37): [True: 688, False: 173]
  ------------------
 6598|    688|                        {
 6599|    688|                            ecp2 = pBNS->edge + pCentp->iedge[n];
 6600|    688|                            if (ecp2->flow)
  ------------------
  |  Branch (6600:33): [True: 97, False: 591]
  ------------------
 6601|     97|                            {
 6602|     97|                                continue;
 6603|     97|                            }
 6604|    591|                            endpoint2 = ecp2->neighbor12 ^ centerpoint;
 6605|    591|                            if (endpoint2 <= endpoint1 || !pVA[endpoint2].nTautGroupEdge)
  ------------------
  |  Branch (6605:33): [True: 346, False: 245]
  |  Branch (6605:59): [True: 91, False: 154]
  ------------------
 6606|    437|                            {
 6607|    437|                                continue; /* don't go back: neighbors are in order of ascending ord. numbers */
 6608|    437|                            }
 6609|    154|                            pEndp2 = pBNS->vert + endpoint2;
 6610|    154|                            if (!( pEndp2->type & BNS_VERT_TYPE_ENDPOINT ))
  ------------------
  |  |   46|    154|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
  |  Branch (6610:33): [True: 0, False: 154]
  ------------------
 6611|      0|                            {
 6612|      0|                                continue;
 6613|      0|                            }
 6614|    154|                            etg2 = pBNS->edge + pVA[endpoint2].nTautGroupEdge - 1;
 6615|    154|                            if (!etg2->flow || ( etg2->neighbor12 ^ endpoint2 ) != vtg1)
  ------------------
  |  Branch (6615:33): [True: 92, False: 62]
  |  Branch (6615:48): [True: 0, False: 62]
  ------------------
 6616|     92|                            {
 6617|     92|                                continue;
 6618|     92|                            }
 6619|       |                            /* we have found the path:
 6620|       |                                              Endp1                                Endp1
 6621|       |                                       etg1 //     \ ecp1                   etg1 /     \\ ecp1
 6622|       |                                  etg0     //       \                  etg0     /       \\
 6623|       |                             Endp0-----tg1           Centp  -->   Endp0=====tg1           Centp
 6624|       |                              ^            \\       /                           \\       /
 6625|       |                      radical |        etg2 \\     / ecp2                   etg2 \\     / ecp2
 6626|       |                                              Endp2                                Endp2
 6627|       |                            */
 6628|       |
 6629|       |                            /* compare centerpoints */
 6630|     62|                            if (!pCentp_found ||
  ------------------
  |  Branch (6630:33): [True: 33, False: 29]
  ------------------
 6631|       |                                 /* try to avoid carbons */
 6632|     29|                                (( pVA[centerpoint].cNumValenceElectrons != 4 ||
  ------------------
  |  Branch (6632:36): [True: 23, False: 6]
  ------------------
 6633|      6|                                    pVA[centerpoint].cPeriodicRowNumber != 1 ) &&
  ------------------
  |  Branch (6633:37): [True: 0, False: 6]
  ------------------
 6634|     23|                                 pVA[centerpoint_found].cNumValenceElectrons == 4 &&
  ------------------
  |  Branch (6634:34): [True: 3, False: 20]
  ------------------
 6635|      3|                                 pVA[centerpoint_found].cPeriodicRowNumber == 1) ||
  ------------------
  |  Branch (6635:34): [True: 3, False: 0]
  ------------------
 6636|       |                                 /* try a better non-carbon */
 6637|     26|                                 (( pVA[centerpoint].cNumValenceElectrons != 4 ||
  ------------------
  |  Branch (6637:37): [True: 20, False: 6]
  ------------------
 6638|      6|                                     pVA[centerpoint].cPeriodicRowNumber != 1 ) &&
  ------------------
  |  Branch (6638:38): [True: 0, False: 6]
  ------------------
 6639|     20|                                     ( at[centerpoint].valence > at[centerpoint_found].valence ||
  ------------------
  |  Branch (6639:40): [True: 3, False: 17]
  ------------------
 6640|     17|                                         (at[centerpoint].valence == at[centerpoint_found].valence &&
  ------------------
  |  Branch (6640:43): [True: 16, False: 1]
  ------------------
 6641|     16|                                         at[centerpoint].el_number > at[centerpoint_found].el_number) ))) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (6641:42): [True: 5, False: 11]
  ------------------
 6642|     44|                            {
 6643|       |
 6644|     44|                                pCentp_found = pCentp;
 6645|     44|                                etg1_found = etg1;
 6646|     44|                                ecp1_found = ecp1;
 6647|     44|                                centerpoint_found = centerpoint;
 6648|     44|                                break;
 6649|     44|                            }
 6650|     62|                        }
 6651|    217|                    }
 6652|    167|                }
 6653|    164|            }
 6654|    164|            if (pCentp_found)
  ------------------
  |  Branch (6654:17): [True: 33, False: 131]
  ------------------
 6655|     33|            {
 6656|       |                /* ---- (1) */
 6657|     33|                etg0->flow++;
 6658|     33|                pEndp0->st_edge.flow++;
 6659|       |                /* ---- (2) */
 6660|     33|                etg1_found->flow--;
 6661|       |                /* ---- (3) */
 6662|     33|                ecp1_found->flow++;
 6663|       |                /* ---- (4) */
 6664|     33|                pCentp_found->st_edge.flow++;
 6665|     33|                pCentp_found->st_edge.cap++;
 6666|       |
 6667|     33|                pBNS->tot_st_flow += 2;
 6668|     33|                pBNS->tot_st_cap += 1;
 6669|     33|                pCentp_found = NULL;
 6670|     33|                num_fixes++;
 6671|     33|                tot_num_fixes++;   /* #1 Mob-H */
 6672|     33|                continue;
 6673|     33|            }
 6674|       |
 6675|       |            /* 2nd attempt: increment flow in centerpoint---radical_endpint edge */
 6676|    131|            if (i < num_endpoints)
  ------------------
  |  Branch (6676:17): [True: 131, False: 0]
  ------------------
 6677|    131|            {
 6678|       |                /* tautomeric endpoint found; traverse its t-group edges */
 6679|    487|                for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (6679:29): [True: 356, False: 131]
  ------------------
 6680|    356|                {
 6681|    356|                    if (i == j)
  ------------------
  |  Branch (6681:25): [True: 131, False: 225]
  ------------------
 6682|    131|                    {
 6683|    131|                        continue; /* avoid the found radical endpoint */
 6684|    131|                    }
 6685|    225|                    etg1 = pBNS->edge + ptg1->iedge[j];
 6686|    225|                    endpoint1 = etg1->neighbor12 ^ vtg1;
 6687|    225|                    pEndp1 = pBNS->vert + endpoint1;     /* another endpoint */
 6688|    225|                    if (pEndp1->st_edge.cap > pEndp1->st_edge.flow)
  ------------------
  |  Branch (6688:25): [True: 34, False: 191]
  ------------------
 6689|     34|                    {
 6690|     34|                        continue; /* one more radical-endpoint! What is going on here??? */
 6691|     34|                    }
 6692|    191|                    if (!etg1->flow)
  ------------------
  |  Branch (6692:25): [True: 101, False: 90]
  ------------------
 6693|    101|                    {
 6694|    101|                        continue; /* avoid enpoints that do not have an attachment */
 6695|    101|                    }
 6696|     90|                    if (!( pEndp1->type & BNS_VERT_TYPE_ENDPOINT ))
  ------------------
  |  |   46|     90|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
  |  Branch (6696:25): [True: 1, False: 89]
  ------------------
 6697|      1|                    {
 6698|      1|                        continue; /* should not happen */
 6699|      1|                    }
 6700|       |                    /* traverse endpoint1 edges to find the edge connecting it to the centerpoint */
 6701|    215|                    for (k = 0; k < at2[endpoint1].valence; k++)
  ------------------
  |  Branch (6701:33): [True: 126, False: 89]
  ------------------
 6702|    126|                    {
 6703|    126|                        ecp1 = pBNS->edge + pEndp1->iedge[k];
 6704|    126|                        if (ecp1->flow)
  ------------------
  |  Branch (6704:29): [True: 13, False: 113]
  ------------------
 6705|     13|                        {
 6706|     13|                            continue;
 6707|     13|                        }
 6708|    113|                        centerpoint = ecp1->neighbor12 ^ endpoint1;
 6709|    113|                        pCentp = pBNS->vert + centerpoint;
 6710|    113|                        if (pCentp->type & BNS_VERT_TYPE_ENDPOINT)
  ------------------
  |  |   46|    113|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
  |  Branch (6710:29): [True: 13, False: 100]
  ------------------
 6711|     13|                        {
 6712|     13|                            continue; /* do not set another endpoint's valence = an unusual value */
 6713|     13|                        }
 6714|       |
 6715|       |                        /* traverse centerpoint edges to find edge connecting it to the endpoint0 */
 6716|    100|                        ecp2 = NULL;
 6717|    100|                        pEndp2 = NULL;
 6718|    389|                        for (n = 0; n < at2[centerpoint].valence; n++)
  ------------------
  |  Branch (6718:37): [True: 303, False: 86]
  ------------------
 6719|    303|                        {
 6720|    303|                            ecp0 = pBNS->edge + pCentp->iedge[n];
 6721|    303|                            if (ecp0->flow)
  ------------------
  |  Branch (6721:33): [True: 57, False: 246]
  ------------------
 6722|     57|                            {
 6723|     57|                                endpoint2 = ecp0->neighbor12 ^ centerpoint;
 6724|     57|                                if (( pBNS->vert[endpoint2].type & BNS_VERT_TYPE_ENDPOINT ))
  ------------------
  |  |   46|     57|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
  |  Branch (6724:37): [True: 42, False: 15]
  ------------------
 6725|     42|                                {
 6726|     42|                                    continue; /* ignore endpoint2 if it is tautomeric endpoint */
 6727|     42|                                }
 6728|       |                                /* check whether ecp0 is stereogenic: if it is then we cannot decrement its flow */
 6729|     16|                                for (m = 0; m < MAX_NUM_STEREO_BONDS && at[centerpoint].sb_parity[m]; m++)
  ------------------
  |  |  873|     32|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (6729:45): [True: 16, False: 0]
  |  Branch (6729:73): [True: 2, False: 14]
  ------------------
 6730|      2|                                {
 6731|      2|                                    if (at[centerpoint].sb_ord[m] == n)
  ------------------
  |  Branch (6731:41): [True: 1, False: 1]
  ------------------
 6732|      1|                                    {
 6733|      1|                                        endpoint2 = NO_VERTEX;
  ------------------
  |  |  118|      1|#define NO_VERTEX    -2
  ------------------
 6734|      1|                                        break;
 6735|      1|                                    }
 6736|      2|                                }
 6737|     15|                                if (endpoint2 == NO_VERTEX)
  ------------------
  |  |  118|     15|#define NO_VERTEX    -2
  ------------------
  |  Branch (6737:37): [True: 1, False: 14]
  ------------------
 6738|      1|                                {
 6739|      1|                                    continue;
 6740|      1|                                }
 6741|     14|                                pEndp2 = pBNS->vert + endpoint2;  /* found */
 6742|     14|                                ecp2 = ecp0;
 6743|     14|                                break;
 6744|     15|                            }
 6745|    303|                        }
 6746|    349|                        for (n = 0; n < at[centerpoint].valence; n++)
  ------------------
  |  Branch (6746:37): [True: 288, False: 61]
  ------------------
 6747|    288|                        {
 6748|    288|                            ecp0 = pBNS->edge + pCentp->iedge[n];
 6749|    288|                            if (ecp0->flow)
  ------------------
  |  Branch (6749:33): [True: 59, False: 229]
  ------------------
 6750|     59|                            {
 6751|     59|                                continue;
 6752|     59|                            }
 6753|    229|                            if (endpoint0 != ( ecp0->neighbor12 ^ centerpoint ))
  ------------------
  |  Branch (6753:33): [True: 185, False: 44]
  ------------------
 6754|    185|                            {
 6755|    185|                                continue;
 6756|    185|                            }
 6757|       |                            /* Found:
 6758|       |                                              Endp2(not endpoint)           Endp2(not radical)
 6759|       |                                               ||                             |
 6760|       |                                               ||ecp2                         |ecp2
 6761|       |                                          ecp0 ||  ecp1                 ecp0  |  ecp1
 6762|       |                                     Endp0----Centp----Endp1       Endp0====Centp----Endp1
 6763|       |                                      ^  \             /      -->      \             /
 6764|       |                              radical |   \           /                 \           /
 6765|       |                                           \         /                   \         /
 6766|       |                                       etg0 \       / etg1           etg0 \       / etg1
 6767|       |                                             \     /                       \     /
 6768|       |                                               tg1                           tg1
 6769|       |
 6770|       |                             */
 6771|       |
 6772|       |                            /* compare centerpoints */
 6773|     44|                            if (!pCentp_found ||
  ------------------
  |  Branch (6773:33): [True: 35, False: 9]
  ------------------
 6774|       |                                 /* try to avoid carbons */
 6775|      9|                                (( pVA[centerpoint].cNumValenceElectrons != 4 ||
  ------------------
  |  Branch (6775:36): [True: 8, False: 1]
  ------------------
 6776|      1|                                    pVA[centerpoint].cPeriodicRowNumber != 1 ) &&
  ------------------
  |  Branch (6776:37): [True: 0, False: 1]
  ------------------
 6777|      8|                                 pVA[centerpoint_found].cNumValenceElectrons == 4 &&
  ------------------
  |  Branch (6777:34): [True: 2, False: 6]
  ------------------
 6778|      2|                                 pVA[centerpoint_found].cPeriodicRowNumber == 1) ||
  ------------------
  |  Branch (6778:34): [True: 2, False: 0]
  ------------------
 6779|       |                                 /* try a better non-carbon */
 6780|      7|                                 (( pVA[centerpoint].cNumValenceElectrons != 4 ||
  ------------------
  |  Branch (6780:37): [True: 6, False: 1]
  ------------------
 6781|      1|                                     pVA[centerpoint].cPeriodicRowNumber != 1 ) &&
  ------------------
  |  Branch (6781:38): [True: 0, False: 1]
  ------------------
 6782|      6|                                     ( at[centerpoint].valence > at[centerpoint_found].valence ||
  ------------------
  |  Branch (6782:40): [True: 1, False: 5]
  ------------------
 6783|      5|                                         (at[centerpoint].valence == at[centerpoint_found].valence &&
  ------------------
  |  Branch (6783:43): [True: 4, False: 1]
  ------------------
 6784|      4|                                         at[centerpoint].el_number > at[centerpoint_found].el_number)) )) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (6784:42): [True: 1, False: 3]
  ------------------
 6785|     39|                            {
 6786|       |
 6787|     39|                                pCentp_found = pCentp;
 6788|     39|                                etg1_found = etg1;
 6789|     39|                                ecp0_found = ecp0;
 6790|     39|                                centerpoint_found = centerpoint;
 6791|     39|                                pEndp2_found = pEndp2;
 6792|     39|                                ecp2_found = ecp2;
 6793|     39|                                break;
 6794|     39|                            }
 6795|     44|                        }
 6796|    100|                    }
 6797|     89|                }
 6798|    131|            }
 6799|    131|            if (pCentp_found)
  ------------------
  |  Branch (6799:17): [True: 35, False: 96]
  ------------------
 6800|     35|            {
 6801|     35|                ecp0_found->flow++;
 6802|     35|                if (ecp0_found->cap < ecp0_found->flow)
  ------------------
  |  Branch (6802:21): [True: 11, False: 24]
  ------------------
 6803|     11|                {
 6804|     11|                    ecp0_found->cap = ecp0_found->flow;
 6805|     11|                }
 6806|     35|                pEndp0->st_edge.flow++;
 6807|     35|                if (pEndp2_found && ecp2_found)
  ------------------
  |  Branch (6807:21): [True: 1, False: 34]
  |  Branch (6807:37): [True: 1, False: 0]
  ------------------
 6808|      1|                {
 6809|      1|                    ecp2_found->flow--;
 6810|      1|                    pEndp2_found->st_edge.flow--;
 6811|      1|                }
 6812|     34|                else
 6813|     34|                {
 6814|       |                    /* Endp2 not found */
 6815|     34|                    pCentp_found->st_edge.flow++;
 6816|     34|                    pCentp_found->st_edge.cap++;
 6817|     34|                    pBNS->tot_st_flow += 2; /* radical elimination */
 6818|     34|                    pBNS->tot_st_cap += 1;
 6819|     34|                }
 6820|       |
 6821|     35|                pCentp_found = NULL;
 6822|     35|                num_fixes++;
 6823|     35|                tot_num_fixes++;      /* #2 Mob-H */
 6824|     35|                continue;
 6825|     35|            }
 6826|       |            /* 3rd attempt: find =C= and move radical to it */
 6827|     96|            if (i < num_endpoints)
  ------------------
  |  Branch (6827:17): [True: 96, False: 0]
  ------------------
 6828|     96|            {
 6829|     96|                int jj, delta, bNotFixed = 1;
 6830|     96|                Vertex     vPathStart, vPathEnd, v1, v2;
 6831|     96|                int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 6832|    683|                for (jj = 0; jj < num_at && bNotFixed; jj++)
  ------------------
  |  Branch (6832:30): [True: 592, False: 91]
  |  Branch (6832:45): [True: 592, False: 0]
  ------------------
 6833|    592|                {
 6834|    592|                    if (at2[i].endpoint)
  ------------------
  |  Branch (6834:25): [True: 188, False: 404]
  ------------------
 6835|    188|                    {
 6836|    188|                        continue;
 6837|    188|                    }
 6838|    404|                    if (2 == at2[jj].valence && pBNS->vert[jj].st_edge.cap == pBNS->vert[jj].st_edge.flow &&
  ------------------
  |  Branch (6838:25): [True: 142, False: 262]
  |  Branch (6838:49): [True: 113, False: 29]
  ------------------
 6839|    113|                         4 == pVA[jj].cNumValenceElectrons &&
  ------------------
  |  Branch (6839:26): [True: 36, False: 77]
  ------------------
 6840|     36|                         !( ecp0 = pBNS->edge + pBNS->vert[jj].iedge[0] )->forbidden &&
  ------------------
  |  Branch (6840:26): [True: 32, False: 4]
  ------------------
 6841|     32|                         !( ecp1 = pBNS->edge + pBNS->vert[jj].iedge[1] )->forbidden &&
  ------------------
  |  Branch (6841:26): [True: 31, False: 1]
  ------------------
 6842|     31|                         1 == ecp0->flow && 1 == ecp1->flow &&
  ------------------
  |  Branch (6842:26): [True: 19, False: 12]
  |  Branch (6842:45): [True: 15, False: 4]
  ------------------
 6843|     15|                         !at2[(int) at2[i].neighbor[0]].sb_parity[0] &&
  ------------------
  |  Branch (6843:26): [True: 12, False: 3]
  ------------------
 6844|     12|                         !at2[(int) at2[i].neighbor[1]].sb_parity[0])
  ------------------
  |  Branch (6844:26): [True: 9, False: 3]
  ------------------
 6845|      9|                    {
 6846|       |                        /* found =C=; make a radical and try to cancel the two radicals */
 6847|      9|                        k = ecp0->neighbor12 ^ jj;
 6848|      9|                        if (at2[k].endpoint)
  ------------------
  |  Branch (6848:29): [True: 2, False: 7]
  ------------------
 6849|      2|                        {
 6850|      2|                            ecp0 = ecp1;
 6851|      2|                            k = ecp0->neighbor12 ^ jj;
 6852|      2|                            if (at2[k].endpoint)
  ------------------
  |  Branch (6852:33): [True: 1, False: 1]
  ------------------
 6853|      1|                            {
 6854|      1|                                continue;
 6855|      1|                            }
 6856|      2|                        }
 6857|      8|                        delta = 1;
 6858|       |                        /* decrement C valence */
 6859|      8|                        pBNS->vert[jj].st_edge.flow -= delta;
 6860|      8|                        pBNS->vert[jj].st_edge.cap -= delta;
 6861|       |                        /* decrement bond order */
 6862|      8|                        ecp0->flow -= delta;
 6863|       |                        /* reflect the changes in at2[k] to make it a radical */
 6864|      8|                        pBNS->vert[k].st_edge.flow -= delta;
 6865|      8|                        pBNS->tot_st_cap -= delta;
 6866|      8|                        pBNS->tot_st_flow -= 2 * delta;
 6867|       |
 6868|      8|                        v1 = endpoint0;
 6869|      8|                        v2 = k;
 6870|       |
 6871|      8|                        ret2 = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 6872|      8|                                              &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 6873|       |
 6874|      8|                        if (ret2 == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (6874:29): [True: 7, False: 1]
  |  Branch (6874:45): [True: 4, False: 3]
  |  Branch (6874:63): [True: 4, False: 0]
  ------------------
 6875|      5|                            (vPathEnd == v2 && vPathStart == v1) ) && nDeltaCharge == 0) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (6875:30): [True: 2, False: 1]
  |  Branch (6875:48): [True: 1, False: 1]
  |  Branch (6875:71): [True: 5, False: 0]
  ------------------
 6876|      5|                        {
 6877|      5|                            ret2 = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 6878|      5|                            if (ret2 > 0)
  ------------------
  |  Branch (6878:33): [True: 5, False: 0]
  ------------------
 6879|      5|                            {
 6880|      5|                                num_fixes++;
 6881|      5|                                tot_num_fixes++;   /* #3 Mob-H */
 6882|      5|                                pBNS->vert[jj].st_edge.cap += delta; /* create radical on =C- */
 6883|      5|                                pBNS->tot_st_cap += delta;
 6884|      5|                                pCentp_found = NULL;
 6885|       |                                /* djb-rwth: removing redundant code */
 6886|      5|                                break;
 6887|      5|                            }
 6888|      5|                        }
 6889|      3|                        else
 6890|      3|                        {
 6891|       |                            /* failed */
 6892|      3|                            pBNS->vert[jj].st_edge.flow += delta;
 6893|      3|                            pBNS->vert[jj].st_edge.cap += delta;
 6894|       |                            /* decrement bond order */
 6895|      3|                            ecp0->flow += delta;
 6896|       |                            /* reflect the changes in at2[k] to make it a radical */
 6897|      3|                            pBNS->vert[k].st_edge.flow += delta;
 6898|      3|                            pBNS->tot_st_cap += delta;
 6899|      3|                            pBNS->tot_st_flow += 2 * delta;
 6900|      3|                        }
 6901|      3|                        if (ret2 < 0)
  ------------------
  |  Branch (6901:29): [True: 0, False: 3]
  ------------------
 6902|      0|                        {
 6903|      0|                            ret = ret2;
 6904|      0|                            goto exit_function;
 6905|      0|                        }
 6906|      3|                    }
 6907|    404|                }
 6908|     96|            }
 6909|     96|        }
 6910|    335|        if (!num_fixes)
  ------------------
  |  Branch (6910:13): [True: 262, False: 73]
  ------------------
 6911|    262|        {
 6912|    262|            break;
 6913|    262|        }
 6914|    335|    }
 6915|  86.6k|    ret = tot_num_fixes;
 6916|       |
 6917|  86.6k|exit_function:
 6918|  86.6k|    pStruct->at = at;
 6919|  86.6k|    memcpy(at2, at, len_at * sizeof(at2[0]));
 6920|  86.6k|    return ret;
 6921|  86.6k|}
RemoveRadFromMobileHEndpointFixH:
 6938|  1.13k|{
 6939|  1.13k|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
 6940|  1.13k|    int i, num_fixes, tot_num_fixes = 0;
 6941|       |
 6942|  1.13k|    int ret2, ret;
 6943|  1.13k|    int num_at = pStruct->num_atoms;
 6944|  1.13k|    int num_deleted_H = pStruct->num_deleted_H;
 6945|  1.13k|    int len_at = num_at + num_deleted_H;
 6946|  1.13k|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 6947|  1.13k|    EDGE_LIST ChargeEdgeList, BondEdgeList;
 6948|  1.13k|    int         itg, j, k, n, m; /* djb-rwth: removing redundant variables */
 6949|  1.13k|    Vertex      endpoint0 = NO_VERTEX, endpoint1, endpoint2 = NO_VERTEX, centerpoint;
  ------------------
  |  |  118|  1.13k|#define NO_VERTEX    -2
  ------------------
                  Vertex      endpoint0 = NO_VERTEX, endpoint1, endpoint2 = NO_VERTEX, centerpoint;
  ------------------
  |  |  118|  1.13k|#define NO_VERTEX    -2
  ------------------
 6950|  1.13k|    Vertex      centerpoint_found = NO_VERTEX, endpoint2_found = NO_VERTEX;
  ------------------
  |  |  118|  1.13k|#define NO_VERTEX    -2
  ------------------
                  Vertex      centerpoint_found = NO_VERTEX, endpoint2_found = NO_VERTEX;
  ------------------
  |  |  118|  1.13k|#define NO_VERTEX    -2
  ------------------
 6951|  1.13k|    BNS_VERTEX *pEndp0 = NULL, *pEndp1, *pEndp2, *pCentp, *pCentp_found, *pEndp2_found = NULL;
 6952|  1.13k|    BNS_EDGE   *ecp0, *ecp1, *ecp2, *ecp0_found = NULL, *ecp1_found = NULL, *ecp2_found = NULL;
 6953|  1.13k|    int         num_endpoints; /* djb-rwth: removing redundant variables */
 6954|       |
 6955|  1.13k|    ret = 0;
 6956|       |
 6957|  1.13k|    if (pStruct->iMobileH != TAUT_NON)
  ------------------
  |  |  574|  1.13k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (6957:9): [True: 0, False: 1.13k]
  ------------------
 6958|      0|        return ret;
 6959|       |
 6960|  1.13k|    AllocEdgeList( &ChargeEdgeList, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  1.13k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 6961|  1.13k|    AllocEdgeList( &BondEdgeList, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  1.13k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 6962|       |
 6963|  1.13k|    memcpy(at2, at, len_at * sizeof(at2[0]));
 6964|  1.13k|    pStruct->at = at2;
 6965|  1.13k|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 6966|  1.13k|    if (ret2 < 0)
  ------------------
  |  Branch (6966:9): [True: 0, False: 1.13k]
  ------------------
 6967|      0|    {
 6968|      0|        ret = ret2;
 6969|      0|        goto exit_function;
 6970|      0|    }
 6971|  1.26k|    while (pBNS->tot_st_cap > pBNS->tot_st_flow && pStruct->ti.num_t_groups)
  ------------------
  |  Branch (6971:12): [True: 521, False: 747]
  |  Branch (6971:52): [True: 361, False: 160]
  ------------------
 6972|    361|    {
 6973|    361|        int iEndpoint = 0;
 6974|    361|        num_fixes = 0;
 6975|    768|        for (itg = 0; itg < pStruct->ti.num_t_groups; iEndpoint += num_endpoints, itg++)
  ------------------
  |  Branch (6975:23): [True: 407, False: 361]
  ------------------
 6976|    407|        {
 6977|    407|            pCentp_found = NULL;
 6978|       |            /* djb-rwth: removing redundant code */
 6979|    407|            num_endpoints = pStruct->ti.t_group[itg].nNumEndpoints;
 6980|  1.02k|            for (i = 0; i < num_endpoints; i++)
  ------------------
  |  Branch (6980:25): [True: 940, False: 80]
  ------------------
 6981|    940|            {
 6982|    940|                endpoint0 = pStruct->ti.nEndpointAtomNumber[iEndpoint + i];
 6983|    940|                pEndp0 = pBNS->vert + endpoint0;  /* taut endpoint vertex (possible location of mobile H */
 6984|    940|                if (pEndp0->st_edge.cap > pEndp0->st_edge.flow)
  ------------------
  |  Branch (6984:21): [True: 327, False: 613]
  ------------------
 6985|    327|                {
 6986|       |                    /* radical endpoint1 has been detected */
 6987|       |                    /* find a 1-3 centerpoint that has two or more endpoints */
 6988|       |                    /* connected to the t-group vertex by edges with flow>0 and */
 6989|       |                    /* to the centerpoint by edges with flow = 0 */
 6990|       |                    /* after that: (1) increment etg1 flow to eliminate radical */
 6991|       |                    /* (2) increment flow on one of the two other edges to the t-group */
 6992|       |                    /* (3) increment st_cap on the found centerpoint */
 6993|       |                    /* (4) rerun the BNS and re-create the structure */
 6994|    327|                    break;
 6995|    327|                }
 6996|    940|            }
 6997|       |
 6998|       |            /* 2nd attempt: increment flow in centerpoint---radical_endpoint edge */
 6999|    407|            pCentp_found = NULL;
 7000|    407|            if (i < num_endpoints)
  ------------------
  |  Branch (7000:17): [True: 327, False: 80]
  ------------------
 7001|    327|            {
 7002|       |                /* tautomeric endpoint found; traverse its t-group edges */
 7003|  2.03k|                for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (7003:29): [True: 1.70k, False: 327]
  ------------------
 7004|  1.70k|                {
 7005|  1.70k|                    if (i == j)
  ------------------
  |  Branch (7005:25): [True: 327, False: 1.37k]
  ------------------
 7006|    327|                    {
 7007|    327|                        continue; /* avoid the found radical endpoint */
 7008|    327|                    }
 7009|  1.37k|                    endpoint1 = pStruct->ti.nEndpointAtomNumber[iEndpoint + j];
 7010|  1.37k|                    pEndp1 = pBNS->vert + endpoint1;     /* another endpoint */
 7011|       |
 7012|  1.37k|                    if (pEndp1->st_edge.cap > pEndp1->st_edge.flow)
  ------------------
  |  Branch (7012:25): [True: 195, False: 1.18k]
  ------------------
 7013|    195|                    {
 7014|    195|                        continue; /* one more radical-endpoint! What is going on here??? */
 7015|    195|                    }
 7016|  1.18k|                    if (!at2[endpoint1].num_H && at2[endpoint1].charge != -1)
  ------------------
  |  Branch (7016:25): [True: 875, False: 308]
  |  Branch (7016:50): [True: 313, False: 562]
  ------------------
 7017|    313|                    {
 7018|    313|                        continue; /* avoid enpoints that do not have an attachment */
 7019|    313|                    }
 7020|    870|                    if (!pStruct->endpoint[endpoint1])
  ------------------
  |  Branch (7020:25): [True: 0, False: 870]
  ------------------
 7021|      0|                    {
 7022|      0|                        continue; /* should not happen */
 7023|      0|                    }
 7024|       |                    /* traverse endpoint1 edges to find the edge connecting it to the centerpoint */
 7025|  4.09k|                    for (k = 0; k < pEndp1->num_adj_edges; k++)
  ------------------
  |  Branch (7025:33): [True: 3.75k, False: 341]
  ------------------
 7026|  3.75k|                    {
 7027|  3.75k|                        ecp1 = pBNS->edge + pEndp1->iedge[k];
 7028|  3.75k|                        if (ecp1->flow)
  ------------------
  |  Branch (7028:29): [True: 1.17k, False: 2.57k]
  ------------------
 7029|  1.17k|                        {
 7030|  1.17k|                            continue;
 7031|  1.17k|                        }
 7032|  2.57k|                        centerpoint = ecp1->neighbor12 ^ endpoint1;
 7033|  2.57k|                        if (centerpoint >= pBNS->num_atoms)
  ------------------
  |  Branch (7033:29): [True: 529, False: 2.04k]
  ------------------
 7034|    529|                        {
 7035|    529|                            break; /* no more edges to atoms */
 7036|    529|                        }
 7037|  2.04k|                        pCentp = pBNS->vert + centerpoint;
 7038|  2.04k|                        if (pStruct->endpoint[centerpoint])
  ------------------
  |  Branch (7038:29): [True: 797, False: 1.25k]
  ------------------
 7039|    797|                        {
 7040|    797|                            continue; /* do not set another endpoint's valence = an unusual value */
 7041|    797|                        }
 7042|       |                        /* traverse centerpoint edges to find edge connecting it to the endpoint0 */
 7043|       |                        /* 1. Find a double bond to an endpoint */
 7044|  1.25k|                        ecp2 = NULL;
 7045|  1.25k|                        pEndp2 = NULL;
 7046|  2.91k|                        for (n = 0; n < at2[centerpoint].valence; n++) /* djb-rwth: removing redundant code */
  ------------------
  |  Branch (7046:37): [True: 2.22k, False: 688]
  ------------------
 7047|  2.22k|                        {
 7048|  2.22k|                            ecp0 = pBNS->edge + pCentp->iedge[n];
 7049|  2.22k|                            if (ecp0->flow)
  ------------------
  |  Branch (7049:33): [True: 768, False: 1.45k]
  ------------------
 7050|    768|                            {
 7051|    768|                                endpoint2 = ecp0->neighbor12 ^ centerpoint;
 7052|    768|                                if (pStruct->endpoint[endpoint2] /* ??? */)
  ------------------
  |  Branch (7052:37): [True: 195, False: 573]
  ------------------
 7053|    195|                                {
 7054|    195|                                    continue;
 7055|    195|                                }
 7056|       |                                /* check whether ecp0 is stereogenic: if it is then we cannot decrement its flow */
 7057|    583|                                for (m = 0; m < MAX_NUM_STEREO_BONDS && at[centerpoint].sb_parity[m]; m++)
  ------------------
  |  |  873|  1.16k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (7057:45): [True: 583, False: 0]
  |  Branch (7057:73): [True: 20, False: 563]
  ------------------
 7058|     20|                                {
 7059|     20|                                    if (at[centerpoint].sb_ord[m] == n)
  ------------------
  |  Branch (7059:41): [True: 10, False: 10]
  ------------------
 7060|     10|                                    {
 7061|     10|                                        endpoint2 = NO_VERTEX;
  ------------------
  |  |  118|     10|#define NO_VERTEX    -2
  ------------------
 7062|     10|                                        break;
 7063|     10|                                    }
 7064|     20|                                }
 7065|    573|                                if (endpoint2 == NO_VERTEX)
  ------------------
  |  |  118|    573|#define NO_VERTEX    -2
  ------------------
  |  Branch (7065:37): [True: 10, False: 563]
  ------------------
 7066|     10|                                {
 7067|     10|                                    continue;
 7068|     10|                                }
 7069|    563|                                pEndp2 = pBNS->vert + endpoint2;
 7070|    563|                                ecp2 = ecp0;
 7071|    563|                                break;
 7072|    573|                            }
 7073|  2.22k|                        }
 7074|  1.25k|                        if (!ecp2)
  ------------------
  |  Branch (7074:29): [True: 688, False: 563]
  ------------------
 7075|    688|                        {
 7076|    688|                            continue;
 7077|    688|                        }
 7078|       |                        /* 2. Find a single bond to an endpoint0 */
 7079|  2.01k|                        for (n = 0; n < at2[centerpoint].valence; n++) /* djb-rwth: removing redundant code */
  ------------------
  |  Branch (7079:37): [True: 1.48k, False: 531]
  ------------------
 7080|  1.48k|                        {
 7081|  1.48k|                            ecp0 = pBNS->edge + pCentp->iedge[n];
 7082|  1.48k|                            if (ecp0->flow)
  ------------------
  |  Branch (7082:33): [True: 673, False: 810]
  ------------------
 7083|    673|                            {
 7084|    673|                                continue;
 7085|    673|                            }
 7086|    810|                            if (endpoint0 != ( ecp0->neighbor12 ^ centerpoint ))
  ------------------
  |  Branch (7086:33): [True: 668, False: 142]
  ------------------
 7087|    668|                            {
 7088|    668|                                continue;
 7089|    668|                            }
 7090|       |                            /* Found:
 7091|       |                                              Endp2                         Endp2(not radical)
 7092|       |                                               ||                             |
 7093|       |                                               ||ecp2                         |ecp2
 7094|       |                                          ecp0 ||  ecp1                 ecp0  |  ecp1
 7095|       |                                     Endp0----Centp----Endp1       Endp0====Centp----Endp1
 7096|       |                                      ^  \             /      -->      \             /
 7097|       |                              radical |   \           /                 \           /
 7098|       |                                           \         /                   \         /
 7099|       |                                       etg0 \       / etg1           etg0 \       / etg1
 7100|       |                                             \     /                       \     /
 7101|       |                                               tg1                           tg1
 7102|       |
 7103|       |                             */
 7104|       |
 7105|       |                            /* compare centerpoints */
 7106|    142|                            if (!pCentp_found ||
  ------------------
  |  Branch (7106:33): [True: 32, False: 110]
  ------------------
 7107|       |                                 /* try to avoid carbons */
 7108|    110|                                (( pVA[centerpoint].cNumValenceElectrons != 4 ||
  ------------------
  |  Branch (7108:36): [True: 79, False: 31]
  ------------------
 7109|     31|                                    pVA[centerpoint].cPeriodicRowNumber != 1 ) &&
  ------------------
  |  Branch (7109:37): [True: 11, False: 20]
  ------------------
 7110|     90|                                 pVA[centerpoint_found].cNumValenceElectrons == 4 &&
  ------------------
  |  Branch (7110:34): [True: 11, False: 79]
  ------------------
 7111|     11|                                 pVA[centerpoint_found].cPeriodicRowNumber == 1) ||
  ------------------
  |  Branch (7111:34): [True: 0, False: 11]
  ------------------
 7112|       |                                 /* try a better non-carbon */
 7113|    110|                                 (( pVA[centerpoint].cNumValenceElectrons != 4 ||
  ------------------
  |  Branch (7113:37): [True: 79, False: 31]
  ------------------
 7114|     31|                                     pVA[centerpoint].cPeriodicRowNumber != 1 ) &&
  ------------------
  |  Branch (7114:38): [True: 11, False: 20]
  ------------------
 7115|     90|                                     ( at[centerpoint].valence > at[centerpoint_found].valence ||
  ------------------
  |  Branch (7115:40): [True: 0, False: 90]
  ------------------
 7116|     90|                                         (at[centerpoint].valence == at[centerpoint_found].valence &&
  ------------------
  |  Branch (7116:43): [True: 90, False: 0]
  ------------------
 7117|     90|                                         at[centerpoint].el_number > at[centerpoint_found].el_number)) )) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (7117:42): [True: 0, False: 90]
  ------------------
 7118|     32|                            {
 7119|       |
 7120|     32|                                pCentp_found = pCentp;
 7121|     32|                                ecp0_found = ecp0;
 7122|     32|                                centerpoint_found = centerpoint;
 7123|     32|                                pEndp2_found = pEndp2;
 7124|     32|                                ecp2_found = ecp2;
 7125|     32|                                break;
 7126|     32|                            }
 7127|    142|                        }
 7128|    563|                    }
 7129|    870|                }
 7130|    327|            }
 7131|       |            /* decrement st_flow, st_cap on Endp2; decrement flow on ecp2; decrement st_flow on Centp */
 7132|       |            /* result: radicals on Endp0 and Centp => run BNS */
 7133|    407|            if (pCentp_found)
  ------------------
  |  Branch (7133:17): [True: 32, False: 375]
  ------------------
 7134|     32|            {
 7135|       |                /* make ecp0 a double bond, make ecp2 a single bond, remove radical */
 7136|     32|                ecp0_found->flow++;
 7137|     32|                if (ecp0_found->cap < ecp0_found->flow)
  ------------------
  |  Branch (7137:21): [True: 0, False: 32]
  ------------------
 7138|      0|                {
 7139|      0|                    ecp0_found->cap = ecp0_found->flow;
 7140|      0|                }
 7141|     32|                pEndp0->st_edge.flow++;
 7142|     32|                if (pEndp2_found && ecp2_found)
  ------------------
  |  Branch (7142:21): [True: 32, False: 0]
  |  Branch (7142:37): [True: 32, False: 0]
  ------------------
 7143|     32|                {
 7144|     32|                    ecp2_found->flow--;
 7145|     32|                    pEndp2_found->st_edge.flow--;
 7146|     32|                }
 7147|      0|                else
 7148|      0|                {
 7149|       |                             /* Endp2 not found: only make ecp0 a double bond */
 7150|      0|                    pCentp_found->st_edge.flow++;
 7151|      0|                    pCentp_found->st_edge.cap++;
 7152|      0|                    pBNS->tot_st_flow += 2; /* radical elimination */
 7153|      0|                    pBNS->tot_st_cap += 1;
 7154|      0|                }
 7155|       |
 7156|     32|                pCentp_found = NULL;
 7157|     32|                num_fixes++;    /* #2 */
 7158|     32|                tot_num_fixes++;
 7159|     32|                continue;
 7160|     32|            }
 7161|       |            /* 1st attempt */
 7162|    375|            pCentp_found = NULL;
 7163|    375|            if (i < num_endpoints)
  ------------------
  |  Branch (7163:17): [True: 295, False: 80]
  ------------------
 7164|    295|            {
 7165|       |                /* tautomeric endpoint found; traverse its t-group edges */
 7166|  1.80k|                for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (7166:29): [True: 1.50k, False: 295]
  ------------------
 7167|  1.50k|                {
 7168|  1.50k|                    if (i == j)
  ------------------
  |  Branch (7168:25): [True: 295, False: 1.21k]
  ------------------
 7169|    295|                    {
 7170|    295|                        continue; /* avoid the found radical endpoint */
 7171|    295|                    }
 7172|  1.21k|                    endpoint1 = pStruct->ti.nEndpointAtomNumber[iEndpoint + j];
 7173|  1.21k|                    pEndp1 = pBNS->vert + endpoint1;     /* another endpoint */
 7174|  1.21k|                    if (pEndp1->st_edge.cap > pEndp1->st_edge.flow)
  ------------------
  |  Branch (7174:25): [True: 185, False: 1.02k]
  ------------------
 7175|    185|                    {
 7176|    185|                        continue; /* one more radical-endpoint! What is going on here??? */
 7177|    185|                    }
 7178|  1.02k|                    if (!at2[endpoint1].num_H && at2[endpoint1].charge != -1)
  ------------------
  |  Branch (7178:25): [True: 727, False: 299]
  |  Branch (7178:50): [True: 300, False: 427]
  ------------------
 7179|    300|                    {
 7180|    300|                        continue; /* avoid enpoints that do not have an attachment */
 7181|    300|                    }
 7182|    726|                    if (!pStruct->endpoint[endpoint1])
  ------------------
  |  Branch (7182:25): [True: 0, False: 726]
  ------------------
 7183|      0|                    {
 7184|      0|                        continue; /* should not happen */
 7185|      0|                    }
 7186|       |                    /* traverse endpoint1 edges to find the edge connecting it to the centerpoint */
 7187|  3.37k|                    for (k = 0; k < pEndp1->num_adj_edges; k++)
  ------------------
  |  Branch (7187:33): [True: 3.06k, False: 311]
  ------------------
 7188|  3.06k|                    {
 7189|  3.06k|                        ecp1 = pBNS->edge + pEndp1->iedge[k];
 7190|  3.06k|                        if (ecp1->flow)
  ------------------
  |  Branch (7190:29): [True: 1.01k, False: 2.04k]
  ------------------
 7191|  1.01k|                        {
 7192|  1.01k|                            continue;
 7193|  1.01k|                        }
 7194|  2.04k|                        centerpoint = ecp1->neighbor12 ^ endpoint1;
 7195|  2.04k|                        if (centerpoint >= pBNS->num_atoms)
  ------------------
  |  Branch (7195:29): [True: 415, False: 1.63k]
  ------------------
 7196|    415|                        {
 7197|    415|                            break;
 7198|    415|                        }
 7199|  1.63k|                        pCentp = pBNS->vert + centerpoint;
 7200|       |                        /* traverse centerpoint edges to find the 2nd endpoint */
 7201|  5.58k|                        for (n = 0; n < pCentp->num_adj_edges; n++) /* djb-rwth: removing redundant code */
  ------------------
  |  Branch (7201:37): [True: 4.87k, False: 709]
  ------------------
 7202|  4.87k|                        {
 7203|  4.87k|                            ecp2 = pBNS->edge + pCentp->iedge[n];
 7204|  4.87k|                            if (ecp2->flow)
  ------------------
  |  Branch (7204:33): [True: 1.72k, False: 3.15k]
  ------------------
 7205|  1.72k|                            {
 7206|  1.72k|                                continue;
 7207|  1.72k|                            }
 7208|  3.15k|                            endpoint2 = ecp2->neighbor12 ^ centerpoint;
 7209|  3.15k|                            if (endpoint2 >= pBNS->num_atoms)
  ------------------
  |  Branch (7209:33): [True: 777, False: 2.37k]
  ------------------
 7210|    777|                            {
 7211|    777|                                break;
 7212|    777|                            }
 7213|  2.37k|                            if (!pStruct->endpoint[endpoint2])
  ------------------
  |  Branch (7213:33): [True: 277, False: 2.09k]
  ------------------
 7214|    277|                            {
 7215|    277|                                continue;
 7216|    277|                            }
 7217|       |                            /* djb-rwth: removing redundant code */
 7218|       |
 7219|  2.09k|                            if (at2[endpoint2].num_H || at2[endpoint1].charge == -1)
  ------------------
  |  Branch (7219:33): [True: 738, False: 1.35k]
  |  Branch (7219:57): [True: 1.01k, False: 342]
  ------------------
 7220|  1.75k|                            {
 7221|  1.75k|                                continue;
 7222|  1.75k|                            }
 7223|       |
 7224|       |                            /* we have found the path:
 7225|       |
 7226|       |                            Endp1 has no attachments, Endp2 has.
 7227|       |
 7228|       |                                              Endp1                                Endp1
 7229|       |                                       etg1 //     \ ecp1                   etg1 /     \\ ecp1
 7230|       |                                  etg0     //       \                  etg0     /       \\
 7231|       |                             Endp0-----tg1           Centp  -->   Endp0=====tg1           Centp
 7232|       |                              ^            \\       /                           \\       /
 7233|       |                      radical |        etg2 \\     / ecp2                   etg2 \\     / ecp2
 7234|       |                                              Endp2                                Endp2
 7235|       |                            */
 7236|       |
 7237|       |                            /* compare centerpoints */
 7238|    342|                            if (!pCentp_found ||
  ------------------
  |  Branch (7238:33): [True: 113, False: 229]
  ------------------
 7239|       |                                 /* try to avoid carbons */
 7240|    229|                                (( pVA[centerpoint].cNumValenceElectrons != 4 ||
  ------------------
  |  Branch (7240:36): [True: 75, False: 154]
  ------------------
 7241|    154|                                    pVA[centerpoint].cPeriodicRowNumber != 1 ) &&
  ------------------
  |  Branch (7241:37): [True: 137, False: 17]
  ------------------
 7242|    212|                                 pVA[centerpoint_found].cNumValenceElectrons == 4 &&
  ------------------
  |  Branch (7242:34): [True: 67, False: 145]
  ------------------
 7243|     67|                                 pVA[centerpoint_found].cPeriodicRowNumber == 1) ||
  ------------------
  |  Branch (7243:34): [True: 10, False: 57]
  ------------------
 7244|       |                                 /* try a better non-carbon */
 7245|    219|                                 (( pVA[centerpoint].cNumValenceElectrons != 4 ||
  ------------------
  |  Branch (7245:37): [True: 65, False: 154]
  ------------------
 7246|    154|                                     pVA[centerpoint].cPeriodicRowNumber != 1 ) &&
  ------------------
  |  Branch (7246:38): [True: 137, False: 17]
  ------------------
 7247|    202|                                     ( at[centerpoint].valence > at[centerpoint_found].valence ||
  ------------------
  |  Branch (7247:40): [True: 19, False: 183]
  ------------------
 7248|    183|                                         (at[centerpoint].valence == at[centerpoint_found].valence &&
  ------------------
  |  Branch (7248:43): [True: 72, False: 111]
  ------------------
 7249|     72|                                         at[centerpoint].el_number > at[centerpoint_found].el_number)) )) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (7249:42): [True: 6, False: 66]
  ------------------
 7250|    148|                            {
 7251|       |
 7252|    148|                                pCentp_found = pCentp;
 7253|    148|                                ecp1_found = ecp1;
 7254|    148|                                centerpoint_found = centerpoint;
 7255|    148|                                break;
 7256|    148|                            }
 7257|    342|                        }
 7258|  1.63k|                    }
 7259|    726|                }
 7260|    295|            }
 7261|    375|            if (pCentp_found)
  ------------------
  |  Branch (7261:17): [True: 113, False: 262]
  ------------------
 7262|    113|            {
 7263|       |                /* create a new radical at the centerpoint and try to cancel them */
 7264|    113|                int delta = 1, ret3;
 7265|    113|                Vertex     vPathStart, vPathEnd, v1, v2;
 7266|    113|                int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 7267|       |
 7268|    113|                pCentp_found->st_edge.cap += delta;
 7269|    113|                pBNS->tot_st_cap += delta;
 7270|       |
 7271|    113|                v1 = (int) ( pCentp_found - pBNS->vert );
 7272|    113|                v2 = (int) ( pEndp0 - pBNS->vert );
 7273|       |
 7274|    113|                ret3 = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 7275|    113|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 7276|       |
 7277|    113|                if (ret3 == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (7277:21): [True: 104, False: 9]
  |  Branch (7277:37): [True: 10, False: 94]
  |  Branch (7277:55): [True: 6, False: 4]
  ------------------
 7278|     98|                    (vPathEnd == v2 && vPathStart == v1) ) && nDeltaCharge % 2 == 0) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (7278:22): [True: 88, False: 10]
  |  Branch (7278:40): [True: 88, False: 0]
  |  Branch (7278:63): [True: 91, False: 3]
  ------------------
 7279|     91|                {
 7280|     91|                    ret3 = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 7281|     91|                    if (ret3 > 0)
  ------------------
  |  Branch (7281:25): [True: 91, False: 0]
  ------------------
 7282|     91|                    {
 7283|     91|                        num_fixes++;
 7284|     91|                        tot_num_fixes++;   /* #1 */
 7285|     91|                        pCentp_found = NULL;
 7286|     91|                        continue;
 7287|     91|                    }
 7288|     91|                }
 7289|     22|                else
 7290|     22|                {
 7291|     22|                    pCentp_found->st_edge.cap -= delta;
 7292|     22|                    pBNS->tot_st_cap -= delta;
 7293|     22|                }
 7294|     22|                if (ret3 < 0)
  ------------------
  |  Branch (7294:21): [True: 0, False: 22]
  ------------------
 7295|      0|                {
 7296|      0|                    ret = ret3;
 7297|      0|                    goto exit_function;
 7298|      0|                }
 7299|     22|            }
 7300|       |            /*----------------------------------------------------------------------------------------
 7301|       |               3rd attempt:                                                         add radical to keep
 7302|       |              ==============           u,f=>unfixed, fixed edges                    (N electrons)%2
 7303|       |                        (-)                       (-)                      (-)          |
 7304|       |                     e0/  \\ e1          =>     u/  \\u            =>     //  \         v
 7305|       |                      /    \\ ecp1 ecp2         /    \\   u    f         //    \
 7306|       |                  C--X*     Y(-)--C==Z      C--X*     Y(-)--C*--Z      --X(-)   Y===C---Z*
 7307|       |                    rad.    endp     not      rad.   endp  rad not      rad.   endp    not
 7308|       |                   Endp0   Endp1     endp     endp         to  endp     endp           endp
 7309|       |                                    Endp2                cancel
 7310|       |
 7311|       |               Note: endpoints X and Y may belong to different t-groups
 7312|       |             ----------------------------------------------------------------------------------------*/
 7313|    284|            pCentp_found = NULL;
 7314|    284|            if (i < num_endpoints)
  ------------------
  |  Branch (7314:17): [True: 204, False: 80]
  ------------------
 7315|    204|            {
 7316|    204|                int  e0, e1;
 7317|    204|                if (( e0 = pVA[endpoint0].nCMinusGroupEdge - 1 ) < 0 || pBNS->edge[e0].forbidden)
  ------------------
  |  Branch (7317:21): [True: 7, False: 197]
  |  Branch (7317:73): [True: 0, False: 197]
  ------------------
 7318|      7|                {
 7319|      7|                    continue; /* no negative charge on Endp0 is possible */
 7320|      7|                }
 7321|       |                /* a radical-tautomeric endpoint found; traverse all endpoints */
 7322|  1.17k|                for (j = 0; j < pStruct->ti.nNumEndpoints; j++)
  ------------------
  |  Branch (7322:29): [True: 973, False: 197]
  ------------------
 7323|    973|                {
 7324|    973|                    if (iEndpoint + i == j)
  ------------------
  |  Branch (7324:25): [True: 197, False: 776]
  ------------------
 7325|    197|                    {
 7326|    197|                        continue; /* avoid the found radical endpoint */
 7327|    197|                    }
 7328|       |
 7329|    776|                    endpoint1 = pStruct->ti.nEndpointAtomNumber[j];
 7330|    776|                    pEndp1 = pBNS->vert + endpoint1;     /* another endpoint */
 7331|       |
 7332|    776|                    if (pEndp1->st_edge.cap > pEndp1->st_edge.flow)
  ------------------
  |  Branch (7332:25): [True: 111, False: 665]
  ------------------
 7333|    111|                    {
 7334|    111|                        continue; /* one more radical-endpoint! What is going on here??? */
 7335|    111|                    }
 7336|    665|                    if (( ( e1 = pVA[endpoint1].nCMinusGroupEdge - 1 ) < 0 || !pBNS->edge[e1].flow ) || pBNS->edge[e1].forbidden)
  ------------------
  |  Branch (7336:27): [True: 120, False: 545]
  |  Branch (7336:79): [True: 138, False: 407]
  |  Branch (7336:105): [True: 0, False: 407]
  ------------------
 7337|    258|                    {
 7338|    258|                        continue; /* no negative charge on Endp1 */
 7339|    258|                    }
 7340|    407|                    if (!pStruct->endpoint[endpoint1])
  ------------------
  |  Branch (7340:25): [True: 0, False: 407]
  ------------------
 7341|      0|                    {
 7342|      0|                        continue; /* should not happen */
 7343|      0|                    }
 7344|       |                    /* traverse endpoint1 edges to find the edge connecting it to the centerpoint */
 7345|  1.65k|                    for (k = 0; k < pEndp1->num_adj_edges; k++)
  ------------------
  |  Branch (7345:33): [True: 1.55k, False: 91]
  ------------------
 7346|  1.55k|                    {
 7347|  1.55k|                        ecp1 = pBNS->edge + pEndp1->iedge[k];   /* e1C */
 7348|  1.55k|                        if (ecp1->flow || ecp1->forbidden)
  ------------------
  |  Branch (7348:29): [True: 445, False: 1.11k]
  |  Branch (7348:43): [True: 0, False: 1.11k]
  ------------------
 7349|    445|                        {
 7350|    445|                            continue;
 7351|    445|                        }
 7352|  1.11k|                        centerpoint = ecp1->neighbor12 ^ endpoint1;
 7353|  1.11k|                        if (centerpoint >= pBNS->num_atoms)
  ------------------
  |  Branch (7353:29): [True: 234, False: 880]
  ------------------
 7354|    234|                        {
 7355|    234|                            break; /* no more edges to atoms */
 7356|    234|                        }
 7357|    880|                        pCentp = pBNS->vert + centerpoint;
 7358|    880|                        if (pStruct->endpoint[centerpoint])
  ------------------
  |  Branch (7358:29): [True: 155, False: 725]
  ------------------
 7359|    155|                        {
 7360|    155|                            continue; /* do not set another endpoint's valence = an unusual value */
 7361|    155|                        }
 7362|       |                        /* traverse centerpoint edges to find edge connecting it to the endpoint0 */
 7363|       |                        /* 1. Find a double bond to a not endpoint */
 7364|    725|                        ecp2 = NULL;
 7365|    725|                        pEndp2 = NULL;
 7366|  2.21k|                        for (n = 0; n < pCentp->num_adj_edges; n++) /* djb-rwth: removing redundant variables/code */
  ------------------
  |  Branch (7366:37): [True: 1.84k, False: 377]
  ------------------
 7367|  1.84k|                        {
 7368|  1.84k|                            ecp0 = pBNS->edge + pCentp->iedge[n];
 7369|  1.84k|                            if (ecp0->flow && !ecp0->forbidden)
  ------------------
  |  Branch (7369:33): [True: 822, False: 1.01k]
  |  Branch (7369:47): [True: 812, False: 10]
  ------------------
 7370|    812|                            {
 7371|    812|                                endpoint2 = ecp0->neighbor12 ^ centerpoint;
 7372|    812|                                if (endpoint2 >= pBNS->num_atoms || pStruct->endpoint[endpoint2])
  ------------------
  |  Branch (7372:37): [True: 315, False: 497]
  |  Branch (7372:69): [True: 149, False: 348]
  ------------------
 7373|    464|                                {
 7374|    464|                                    continue;
 7375|    464|                                }
 7376|       |                                /* check whether ecp0 is stereogenic: if it is then we cannot decrement its flow */
 7377|    358|                                for (m = 0; m < MAX_NUM_STEREO_BONDS && at[centerpoint].sb_parity[m]; m++)
  ------------------
  |  |  873|    716|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (7377:45): [True: 358, False: 0]
  |  Branch (7377:73): [True: 10, False: 348]
  ------------------
 7378|     10|                                {
 7379|     10|                                    if (at[centerpoint].sb_ord[m] == n)
  ------------------
  |  Branch (7379:41): [True: 0, False: 10]
  ------------------
 7380|      0|                                    {
 7381|      0|                                        endpoint2 = NO_VERTEX;
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
 7382|      0|                                        break;
 7383|      0|                                    }
 7384|     10|                                }
 7385|    348|                                if (endpoint2 == NO_VERTEX)
  ------------------
  |  |  118|    348|#define NO_VERTEX    -2
  ------------------
  |  Branch (7385:37): [True: 0, False: 348]
  ------------------
 7386|      0|                                {
 7387|      0|                                    continue;
 7388|      0|                                }
 7389|       |                                /* djb-rwth: removing redundant code */
 7390|    348|                                ecp2 = ecp0;           /* e2C */
 7391|    348|                                break;
 7392|    348|                            }
 7393|  1.84k|                        }
 7394|    725|                        if (!ecp2)
  ------------------
  |  Branch (7394:29): [True: 377, False: 348]
  ------------------
 7395|    377|                        {
 7396|    377|                            continue;
 7397|    377|                        }
 7398|       |                        /* compare centerpoints */
 7399|    348|                        if (!pCentp_found ||
  ------------------
  |  Branch (7399:29): [True: 65, False: 283]
  ------------------
 7400|       |                             /* try to find carbons */
 7401|    283|                             (!IS_C( endpoint2_found ) && IS_C( endpoint2 )) ||
  ------------------
  |  | 6939|    566|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  118|    283|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6939:18): [True: 283, False: 0]
  |  |  |  Branch (6939:36): [True: 212, False: 71]
  |  |  |  Branch (6939:72): [True: 185, False: 27]
  |  |  ------------------
  ------------------
                                           (!IS_C( endpoint2_found ) && IS_C( endpoint2 )) ||
  ------------------
  |  | 6939|     98|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  118|     98|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6939:18): [True: 98, False: 0]
  |  |  |  Branch (6939:36): [True: 30, False: 68]
  |  |  |  Branch (6939:72): [True: 16, False: 14]
  |  |  ------------------
  ------------------
 7402|    267|                             (IS_C( endpoint2_found ) && IS_C( endpoint2 ) &&
  ------------------
  |  | 6939|    534|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  118|    267|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6939:18): [True: 267, False: 0]
  |  |  |  Branch (6939:36): [True: 209, False: 58]
  |  |  |  Branch (6939:72): [True: 185, False: 24]
  |  |  ------------------
  ------------------
                                           (IS_C( endpoint2_found ) && IS_C( endpoint2 ) &&
  ------------------
  |  | 6939|    452|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  118|    185|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6939:18): [True: 185, False: 0]
  |  |  |  Branch (6939:36): [True: 138, False: 47]
  |  |  |  Branch (6939:72): [True: 130, False: 8]
  |  |  ------------------
  ------------------
 7403|    130|                             !IS_C( centerpoint_found ) && IS_C( centerpoint ))) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  | 6939|    397|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  118|    130|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6939:18): [True: 130, False: 0]
  |  |  |  Branch (6939:36): [True: 45, False: 85]
  |  |  |  Branch (6939:72): [True: 34, False: 11]
  |  |  ------------------
  ------------------
                                           !IS_C( centerpoint_found ) && IS_C( centerpoint ))) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  | 6939|     96|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  118|     96|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6939:18): [True: 96, False: 0]
  |  |  |  Branch (6939:36): [True: 12, False: 84]
  |  |  |  Branch (6939:72): [True: 1, False: 11]
  |  |  ------------------
  ------------------
 7404|     82|                        {
 7405|       |
 7406|     82|                            pCentp_found = pCentp;
 7407|     82|                            centerpoint_found = centerpoint;
 7408|     82|                            endpoint2_found = endpoint2;
 7409|     82|                            ecp2_found = ecp2;
 7410|     82|                            ecp1_found = ecp1;
 7411|     82|                            ecp0_found = pBNS->edge + e0;
 7412|     82|                            break;
 7413|     82|                        }
 7414|    348|                    }
 7415|    407|                }
 7416|    197|            }
 7417|       |            /* decrement st_flow, st_cap on Endp2; decrement flow on ecp2; decrement st_flow on Centp */
 7418|       |            /* result: radicals on Endp0 and Centp => run BNS */
 7419|    277|            if (pCentp_found)
  ------------------
  |  Branch (7419:17): [True: 65, False: 212]
  ------------------
 7420|     65|            {
 7421|     65|                Vertex     vPathStart, vPathEnd, v1, v2;
 7422|     65|                int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 7423|     65|                int        delta;
 7424|       |
 7425|     65|                Vertex    vEndp0 = ecp0_found->neighbor1;
 7426|     65|                Vertex    vEndp1 = ecp1_found->neighbor12 ^ centerpoint_found;
 7427|     65|                Vertex    vEndp2 = ecp2_found->neighbor12 ^ centerpoint_found;
 7428|     65|                BNS_EDGE *pe0 = ecp0_found;
 7429|     65|                BNS_EDGE *pe1 = pBNS->edge + ( (long long)pVA[vEndp1].nCMinusGroupEdge - 1 ); /* djb-rwth: cast operator added */
 7430|       |                /* djb-rwth: removing redundant code */
 7431|     65|                pEndp2 = pBNS->vert + vEndp2;
 7432|     65|                pCentp = pCentp_found;
 7433|     65|                if (!ChargeEdgeList.num_alloc)
  ------------------
  |  Branch (7433:21): [True: 56, False: 9]
  ------------------
 7434|     56|                {
 7435|    429|                    for (n = 0; n < pStruct->num_atoms; n++)
  ------------------
  |  Branch (7435:33): [True: 373, False: 56]
  ------------------
 7436|    373|                    {
 7437|    373|                        if (( k = pVA[n].nCMinusGroupEdge ) >= 0 && !pBNS->edge[k].forbidden &&
  ------------------
  |  Branch (7437:29): [True: 373, False: 0]
  |  Branch (7437:69): [True: 372, False: 1]
  ------------------
 7438|    372|                            ( ret = AddToEdgeList( &ChargeEdgeList, k, pStruct->num_atoms ) ))
  ------------------
  |  Branch (7438:29): [True: 0, False: 372]
  ------------------
 7439|      0|                        {
 7440|      0|                            goto exit_function;
 7441|      0|                        }
 7442|    373|                        if (( k = pVA[n].nCPlusGroupEdge ) >= 0 && !pBNS->edge[k].forbidden &&
  ------------------
  |  Branch (7442:29): [True: 373, False: 0]
  |  Branch (7442:68): [True: 370, False: 3]
  ------------------
 7443|    370|                            ( ret = AddToEdgeList( &ChargeEdgeList, k, pStruct->num_atoms ) ))
  ------------------
  |  Branch (7443:29): [True: 0, False: 370]
  ------------------
 7444|      0|                        {
 7445|      0|                            goto exit_function;
 7446|      0|                        }
 7447|    373|                    }
 7448|     56|                }
 7449|     65|                if (!BondEdgeList.num_alloc)
  ------------------
  |  Branch (7449:21): [True: 56, False: 9]
  ------------------
 7450|     56|                {
 7451|    397|                    for (n = 0; n < pBNS->num_bonds; n++)
  ------------------
  |  Branch (7451:33): [True: 341, False: 56]
  ------------------
 7452|    341|                    {
 7453|    341|                        if (( ret = AddToEdgeList( &BondEdgeList, n, pBNS->num_bonds ) ))
  ------------------
  |  Branch (7453:29): [True: 0, False: 341]
  ------------------
 7454|      0|                        {
 7455|      0|                            goto exit_function;
 7456|      0|                        }
 7457|    341|                    }
 7458|     56|                }
 7459|       |                /* fix all bonds and charges */
 7460|     65|                SetForbiddenEdgeMask( pBNS, &ChargeEdgeList, forbidden_edge_mask );
 7461|     65|                SetForbiddenEdgeMask( pBNS, &BondEdgeList, forbidden_edge_mask );
 7462|       |                /* prepare flow for testing */
 7463|     65|                delta = 1;
 7464|     65|                ecp2_found->flow -= delta;
 7465|     65|                pCentp->st_edge.flow -= delta;
 7466|     65|                pEndp2->st_edge.flow -= delta;
 7467|     65|                pBNS->tot_st_flow -= 2 * delta;
 7468|       |                /* unfix edges to be changed */
 7469|     65|                pe0->forbidden &= inv_forbidden_edge_mask;
 7470|     65|                pe1->forbidden &= inv_forbidden_edge_mask;
 7471|     65|                ecp1_found->forbidden &= inv_forbidden_edge_mask;
 7472|       |
 7473|     65|                pBNS->tot_st_cap += delta;
 7474|       |
 7475|     65|                v1 = vEndp0;
 7476|     65|                v2 = centerpoint_found;
 7477|     65|                ret2 = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 7478|     65|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 7479|       |
 7480|     65|                if (ret2 == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (7480:21): [True: 10, False: 55]
  |  Branch (7480:37): [True: 5, False: 5]
  |  Branch (7480:55): [True: 5, False: 0]
  ------------------
 7481|      7|                    (vPathEnd == v2 && vPathStart == v1) ) && nDeltaCharge == 0) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (7481:22): [True: 4, False: 1]
  |  Branch (7481:40): [True: 2, False: 2]
  |  Branch (7481:63): [True: 7, False: 0]
  ------------------
 7482|      7|                {
 7483|      7|                    ret2 = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 7484|      7|                    if (ret2 > 0)
  ------------------
  |  Branch (7484:25): [True: 7, False: 0]
  ------------------
 7485|      7|                    {
 7486|      7|                        num_fixes++;
 7487|      7|                        tot_num_fixes++; /* #3 */
 7488|      7|                        pCentp_found = NULL;
 7489|      7|                    }
 7490|      7|                }
 7491|     58|                else
 7492|     58|                {
 7493|       |                    /* roll back */
 7494|     58|                    ecp2_found->flow += delta;
 7495|     58|                    pCentp->st_edge.flow += delta;
 7496|     58|                    pEndp2->st_edge.flow += delta;
 7497|     58|                    pBNS->tot_st_flow += 2 * delta;
 7498|     58|                }
 7499|     65|                RemoveForbiddenEdgeMask( pBNS, &ChargeEdgeList, forbidden_edge_mask );
 7500|     65|                RemoveForbiddenEdgeMask( pBNS, &BondEdgeList, forbidden_edge_mask );
 7501|     65|                if (ret2 < 0)
  ------------------
  |  Branch (7501:21): [True: 0, False: 65]
  ------------------
 7502|      0|                {
 7503|      0|                    ret = ret2;
 7504|      0|                    goto exit_function;
 7505|      0|                }
 7506|     65|                if (!pCentp_found)
  ------------------
  |  Branch (7506:21): [True: 7, False: 58]
  ------------------
 7507|      7|                    continue;
 7508|     65|            }
 7509|    277|        }
 7510|    361|        if (!num_fixes)
  ------------------
  |  Branch (7510:13): [True: 231, False: 130]
  ------------------
 7511|    231|        {
 7512|    231|            break;
 7513|    231|        }
 7514|    361|    }
 7515|       |
 7516|       |    /************ again ***********************************************************/
 7517|  1.18k|    while (pBNS->tot_st_cap > pBNS->tot_st_flow && pStruct->ti.num_t_groups)
  ------------------
  |  Branch (7517:12): [True: 433, False: 747]
  |  Branch (7517:52): [True: 273, False: 160]
  ------------------
 7518|    273|    {
 7519|    273|        int iEndpoint = 0;
 7520|    273|        num_fixes = 0;
 7521|    584|        for (itg = 0; itg < pStruct->ti.num_t_groups; iEndpoint += num_endpoints, itg++)
  ------------------
  |  Branch (7521:23): [True: 311, False: 273]
  ------------------
 7522|    311|        {
 7523|    311|            pCentp_found = NULL;
 7524|       |            /* djb-rwth: removing redundant code */
 7525|    311|            num_endpoints = pStruct->ti.t_group[itg].nNumEndpoints;
 7526|    751|            for (i = 0; i < num_endpoints; i++)
  ------------------
  |  Branch (7526:25): [True: 642, False: 109]
  ------------------
 7527|    642|            {
 7528|    642|                endpoint0 = pStruct->ti.nEndpointAtomNumber[iEndpoint + i];
 7529|    642|                pEndp0 = pBNS->vert + endpoint0;  /* taut endpoint vertex (possible location of mobile H */
 7530|    642|                if (pEndp0->st_edge.cap > pEndp0->st_edge.flow)
  ------------------
  |  Branch (7530:21): [True: 202, False: 440]
  ------------------
 7531|    202|                {
 7532|       |                    /* radical endpoint1 has been detected */
 7533|       |                    /* find a 1-3 centerpoint that has two or more endpoints */
 7534|       |                    /* connected to the t-group vertex by edges with flow>0 and */
 7535|       |                    /* to the centerpoint by edges with flow = 0 */
 7536|       |                    /* after that: (1) increment etg1 flow to eliminate radical */
 7537|       |                    /* (2) increment flow on one of the two other edges to the t-group */
 7538|       |                    /* (3) increment st_cap on the found centerpoint */
 7539|       |                    /* (4) rerun the BNS and re-create the structure */
 7540|    202|                    break;
 7541|    202|                }
 7542|    642|            }
 7543|       |            /* 4th attempt */
 7544|    311|            if (i < num_endpoints)
  ------------------
  |  Branch (7544:17): [True: 202, False: 109]
  ------------------
 7545|    202|            {
 7546|       |                /* tautomeric endpoint found; traverse its t-group edges */
 7547|    202|                pEndp2_found = NULL;
 7548|    635|                for (j = 0; j < pEndp0->num_adj_edges; j++)
  ------------------
  |  Branch (7548:29): [True: 433, False: 202]
  ------------------
 7549|    433|                {
 7550|    433|                    ecp0 = pBNS->edge + pEndp0->iedge[j];
 7551|    433|                    centerpoint = ecp0->neighbor12 ^ endpoint0;
 7552|    433|                    if (centerpoint >= pBNS->num_atoms || ecp0->flow || pStruct->endpoint[centerpoint])
  ------------------
  |  Branch (7552:25): [True: 199, False: 234]
  |  Branch (7552:59): [True: 77, False: 157]
  |  Branch (7552:73): [True: 47, False: 110]
  ------------------
 7553|    323|                    {
 7554|    323|                        continue; /* ignore non-single bonds, orig. InChI endpoints, and fictitious atoms */
 7555|    323|                    }
 7556|    110|                    pCentp = pBNS->vert + centerpoint;
 7557|    537|                    for (k = 0; k < pCentp->num_adj_edges; k++)
  ------------------
  |  Branch (7557:33): [True: 427, False: 110]
  ------------------
 7558|    427|                    {
 7559|    427|                        ecp1 = pBNS->edge + pCentp->iedge[k];
 7560|    427|                        endpoint1 = ecp1->neighbor12 ^ centerpoint;
 7561|    427|                        if (endpoint1 >= pBNS->num_atoms || !ecp1->flow || pStruct->endpoint[endpoint1])
  ------------------
  |  Branch (7561:29): [True: 105, False: 322]
  |  Branch (7561:61): [True: 233, False: 89]
  |  Branch (7561:76): [True: 26, False: 63]
  ------------------
 7562|    364|                        {
 7563|    364|                            continue; /* ignore single bonds, orig. InChI endpoints, and fictitious atoms */
 7564|    364|                        }
 7565|     63|                        pEndp1 = pBNS->vert + endpoint1;
 7566|     63|                        if (endpoint1 == endpoint0 || pEndp1->st_edge.cap != pEndp1->st_edge.flow)
  ------------------
  |  Branch (7566:29): [True: 0, False: 63]
  |  Branch (7566:55): [True: 7, False: 56]
  ------------------
 7567|      7|                        {
 7568|      7|                            continue; /* ignore radicals */
 7569|      7|                        }
 7570|     56|                        if (!pEndp2_found ||
  ------------------
  |  Branch (7570:29): [True: 42, False: 14]
  ------------------
 7571|       |                             /* try to find carbons */
 7572|     14|                             (!IS_C( endpoint2_found ) && IS_C( endpoint1 )) ||
  ------------------
  |  | 6939|     28|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  118|     14|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6939:18): [True: 14, False: 0]
  |  |  |  Branch (6939:36): [True: 7, False: 7]
  |  |  |  Branch (6939:72): [True: 6, False: 1]
  |  |  ------------------
  ------------------
                                           (!IS_C( endpoint2_found ) && IS_C( endpoint1 )) ||
  ------------------
  |  | 6939|      8|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  118|      8|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6939:18): [True: 8, False: 0]
  |  |  |  Branch (6939:36): [True: 3, False: 5]
  |  |  |  Branch (6939:72): [True: 1, False: 2]
  |  |  ------------------
  ------------------
 7573|     13|                             (IS_C( endpoint2_found ) && IS_C( endpoint1 ) &&
  ------------------
  |  | 6939|     26|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  118|     13|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6939:18): [True: 13, False: 0]
  |  |  |  Branch (6939:36): [True: 7, False: 6]
  |  |  |  Branch (6939:72): [True: 6, False: 1]
  |  |  ------------------
  ------------------
                                           (IS_C( endpoint2_found ) && IS_C( endpoint1 ) &&
  ------------------
  |  | 6939|     19|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  118|      6|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6939:18): [True: 6, False: 0]
  |  |  |  Branch (6939:36): [True: 5, False: 1]
  |  |  |  Branch (6939:72): [True: 4, False: 1]
  |  |  ------------------
  ------------------
 7574|      4|                             !IS_C( centerpoint_found ) && IS_C( centerpoint ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 6939|     17|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  118|      4|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6939:18): [True: 4, False: 0]
  |  |  |  Branch (6939:36): [True: 1, False: 3]
  |  |  |  Branch (6939:72): [True: 1, False: 0]
  |  |  ------------------
  ------------------
                                           !IS_C( centerpoint_found ) && IS_C( centerpoint ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 6939|      3|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  118|      3|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6939:18): [True: 3, False: 0]
  |  |  |  Branch (6939:36): [True: 2, False: 1]
  |  |  |  Branch (6939:72): [True: 1, False: 1]
  |  |  ------------------
  ------------------
 7575|     44|                        {
 7576|     44|                            pEndp2_found = pEndp1;
 7577|       |                            /* djb-rwth: removing redundant code */
 7578|     44|                            endpoint2_found = endpoint1;
 7579|     44|                            centerpoint_found = centerpoint;
 7580|     44|                            ecp1_found = ecp0;
 7581|     44|                            ecp2_found = ecp1;
 7582|     44|                        }
 7583|     56|                    }
 7584|    110|                }
 7585|    202|                if (pEndp2_found)
  ------------------
  |  Branch (7585:21): [True: 42, False: 160]
  ------------------
 7586|     42|                {
 7587|       |                    /* move radical from pEndp0 to pEndp2 */
 7588|     42|                    pEndp0->st_edge.flow++;
 7589|     42|                    ecp1_found->flow++;
 7590|     42|                    ecp2_found->flow--;
 7591|     42|                    pEndp2_found->st_edge.flow--;
 7592|     42|                    pEndp2_found = NULL;
 7593|     42|                    pCentp_found = NULL;
 7594|     42|                    num_fixes++;    /* #4 */
 7595|     42|                    tot_num_fixes++;
 7596|     42|                    continue;
 7597|     42|                }
 7598|    202|            }
 7599|    311|        }
 7600|    273|        if (!num_fixes)
  ------------------
  |  Branch (7600:13): [True: 231, False: 42]
  ------------------
 7601|    231|        {
 7602|    231|            break;
 7603|    231|        }
 7604|    273|    }
 7605|       |
 7606|  1.13k|    ret = tot_num_fixes;
 7607|       |
 7608|  1.13k|exit_function:
 7609|  1.13k|    AllocEdgeList( &ChargeEdgeList, EDGE_LIST_FREE );
  ------------------
  |  |  243|  1.13k|#define EDGE_LIST_FREE   (-2)
  ------------------
 7610|  1.13k|    AllocEdgeList( &BondEdgeList, EDGE_LIST_FREE );
  ------------------
  |  |  243|  1.13k|#define EDGE_LIST_FREE   (-2)
  ------------------
 7611|       |
 7612|  1.13k|    pStruct->at = at;
 7613|  1.13k|    memcpy(at2, at, len_at * sizeof(at2[0]));
 7614|       |
 7615|  1.13k|    return ret;
 7616|  1.13k|#undef IS_C
 7617|  1.13k|}
MoveChargeToMakeCenerpoints:
 7633|  87.7k|{
 7634|  87.7k|    int i, j, neigh, num_endpoints, tg_group = 0, num_success;
 7635|  87.7k|    int ret2, ret, delta;
 7636|  87.7k|    int num_at = pStruct->num_atoms;
 7637|  87.7k|    int num_deleted_H = pStruct->num_deleted_H;
 7638|  87.7k|    int len_at = num_at + num_deleted_H;
 7639|  87.7k|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 7640|       |
 7641|       |    /* for RunBnsTestOnce */
 7642|  87.7k|    Vertex     vPathStart, vPathEnd;
 7643|  87.7k|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 7644|       |
 7645|  87.7k|    BNS_EDGE   *pEdgePlus, *pEdgeMinus;
 7646|  87.7k|    Vertex      v1p, v2p, v1m, v2m;
 7647|  87.7k|    BNS_VERTEX *pv1p, *pv2p, *pv1m, *pv2m;
 7648|       |
 7649|       |    /* djb-rwth: removing redundant code */
 7650|  87.7k|    num_success = 0;
 7651|       |
 7652|       |    /* to simplify, prepare new at[] from pBNS */
 7653|  87.7k|    memcpy(at2, at, len_at * sizeof(at2[0]));
 7654|  87.7k|    pStruct->at = at2;
 7655|  87.7k|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 7656|  87.7k|    pStruct->at = at;
 7657|  87.7k|    if (ret2 < 0)
  ------------------
  |  Branch (7657:9): [True: 0, False: 87.7k]
  ------------------
 7658|      0|    {
 7659|      0|        ret = ret2;
 7660|      0|        goto exit_function;
 7661|      0|    }
 7662|       |
 7663|   920k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (7663:17): [True: 832k, False: 87.7k]
  ------------------
 7664|   832k|    {
 7665|   832k|        if (pVA[i].cNumValenceElectrons != 4 && /* not C, Si, Ge */
  ------------------
  |  Branch (7665:13): [True: 739k, False: 92.9k]
  ------------------
 7666|   739k|             !pVA[i].cMetal && !pVA[i].nTautGroupEdge &&
  ------------------
  |  Branch (7666:14): [True: 423k, False: 316k]
  |  Branch (7666:32): [True: 422k, False: 947]
  ------------------
 7667|   422k|             !at2[i].num_H && at2[i].valence >= 3 &&
  ------------------
  |  Branch (7667:14): [True: 419k, False: 3.12k]
  |  Branch (7667:31): [True: 25.5k, False: 393k]
  ------------------
 7668|  25.5k|             at2[i].valence == at2[i].chem_bonds_valence &&
  ------------------
  |  Branch (7668:14): [True: 10.7k, False: 14.8k]
  ------------------
 7669|  10.7k|             !at2[i].charge && pVA[i].nCPlusGroupEdge > 0 &&
  ------------------
  |  Branch (7669:14): [True: 7.97k, False: 2.73k]
  |  Branch (7669:32): [True: 3.08k, False: 4.89k]
  ------------------
 7670|  3.08k|             is_centerpoint_elem( at2[i].el_number ))
  ------------------
  |  Branch (7670:14): [True: 3.06k, False: 12]
  ------------------
 7671|  3.06k|        {
 7672|  12.6k|            for (j = 0, num_endpoints = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (7672:44): [True: 9.58k, False: 3.06k]
  ------------------
 7673|  9.58k|            {
 7674|  9.58k|                neigh = at2[i].neighbor[j];
 7675|  9.58k|                if (at2[neigh].endpoint)
  ------------------
  |  Branch (7675:21): [True: 86, False: 9.50k]
  ------------------
 7676|     86|                {
 7677|     86|                    if (!num_endpoints)
  ------------------
  |  Branch (7677:25): [True: 53, False: 33]
  ------------------
 7678|     53|                    {
 7679|     53|                        tg_group = at2[neigh].endpoint;
 7680|     53|                    }
 7681|     33|                    else if (tg_group != at2[neigh].endpoint)
  ------------------
  |  Branch (7681:30): [True: 2, False: 31]
  ------------------
 7682|      2|                    {
 7683|      2|                        break; /* not a centerpoint */
 7684|      2|                    }
 7685|     84|                    num_endpoints++;
 7686|     84|                }
 7687|  9.58k|            }
 7688|       |
 7689|  3.06k|            if (j == at2[i].valence && num_endpoints > 1)
  ------------------
  |  Branch (7689:17): [True: 3.06k, False: 2]
  |  Branch (7689:40): [True: 26, False: 3.04k]
  ------------------
 7690|     26|            {
 7691|       |                /* found possible centerpoint */
 7692|     26|                pEdgePlus = pBNS->edge + ( (long long)pVA[i].nCPlusGroupEdge - 1 ); /* djb-rwth: cast operator added */
 7693|     26|                pEdgeMinus = ( pVA[i].nCMinusGroupEdge > 0 ) ? pBNS->edge + ((long long) pVA[i].nCMinusGroupEdge - 1 ) : NULL; /* djb-rwth: cast operator added */
  ------------------
  |  Branch (7693:30): [True: 1, False: 25]
  ------------------
 7694|     26|                if (pEdgePlus->flow + ( pEdgeMinus ? pEdgeMinus->flow : 0 ) != 1)
  ------------------
  |  Branch (7694:21): [True: 0, False: 26]
  |  Branch (7694:41): [True: 1, False: 25]
  ------------------
 7695|      0|                {
 7696|      0|                    continue;
 7697|      0|                }
 7698|     26|                v1p = pEdgePlus->neighbor1;
 7699|     26|                v2p = pEdgePlus->neighbor12 ^ v1p;
 7700|     26|                pv1p = pBNS->vert + v1p;
 7701|     26|                pv2p = pBNS->vert + v2p;
 7702|     26|                if (pEdgeMinus)
  ------------------
  |  Branch (7702:21): [True: 1, False: 25]
  ------------------
 7703|      1|                {
 7704|      1|                    v1m = pEdgeMinus->neighbor1;
 7705|      1|                    v2m = pEdgeMinus->neighbor12 ^ v1m;
 7706|      1|                    pv1m = pBNS->vert + v1m;
 7707|      1|                    pv2m = pBNS->vert + v2m;
 7708|      1|                }
 7709|     25|                else
 7710|     25|                {
 7711|     25|                    v1m = NO_VERTEX;
  ------------------
  |  |  118|     25|#define NO_VERTEX    -2
  ------------------
 7712|     25|                    v2m = NO_VERTEX;
  ------------------
  |  |  118|     25|#define NO_VERTEX    -2
  ------------------
 7713|     25|                    pv1m = NULL;
 7714|     25|                    pv2m = NULL;
 7715|     25|                }
 7716|     26|                ret = 0;
 7717|       |
 7718|       |                /* set new flow to run BNS Search */
 7719|     26|                if ((delta = pEdgePlus->flow)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (7719:21): [True: 26, False: 0]
  ------------------
 7720|     26|                {
 7721|       |                    /* positive charge <=> flow=0 on (=) edge */
 7722|     26|                    pEdgePlus->flow -= delta;
 7723|     26|                    pv1p->st_edge.flow -= delta;
 7724|     26|                    pv2p->st_edge.flow -= delta;
 7725|     26|                    pBNS->tot_st_flow -= 2 * delta;
 7726|     26|                    pEdgePlus->forbidden |= forbidden_edge_mask;
 7727|     26|                    if (pEdgeMinus)
  ------------------
  |  Branch (7727:25): [True: 1, False: 25]
  ------------------
 7728|      1|                    {
 7729|      1|                        pEdgeMinus->forbidden |= forbidden_edge_mask;
 7730|      1|                    }
 7731|       |
 7732|     26|                    ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 7733|     26|                                          &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 7734|       |
 7735|     26|                    if (ret < 0)
  ------------------
  |  Branch (7735:25): [True: 0, False: 26]
  ------------------
 7736|      0|                    {
 7737|      0|                        goto exit_function;
 7738|      0|                    }
 7739|       |
 7740|     26|                    if (ret == 1 && ( (vPathEnd == v1p && vPathStart == v2p) ||
  ------------------
  |  Branch (7740:25): [True: 22, False: 4]
  |  Branch (7740:40): [True: 8, False: 14]
  |  Branch (7740:59): [True: 4, False: 4]
  ------------------
 7741|     18|                        (vPathEnd == v2p && vPathStart == v1p) ) &&
  ------------------
  |  Branch (7741:26): [True: 14, False: 4]
  |  Branch (7741:45): [True: 8, False: 6]
  ------------------
 7742|     12|                                      nDeltaCharge == -1 /* charge moving to this atom disappers*/) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (7742:39): [True: 4, False: 8]
  ------------------
 7743|      4|                    {
 7744|      4|                        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 7745|      4|                        ( *pnNumRunBNS )++;
 7746|      4|                        if (ret < 0)
  ------------------
  |  Branch (7746:29): [True: 0, False: 4]
  ------------------
 7747|      0|                        {
 7748|      0|                            goto exit_function;
 7749|      0|                        }
 7750|      4|                        else if (ret == 1)
  ------------------
  |  Branch (7750:34): [True: 4, False: 0]
  ------------------
 7751|      4|                        {
 7752|      4|                            *pnTotalDelta += ret;
 7753|      4|                        }
 7754|      0|                        else
 7755|      0|                        {
 7756|      0|                            ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 7757|      0|                            goto exit_function;
 7758|      0|                        }
 7759|      4|                    }
 7760|     22|                    else
 7761|     22|                    {
 7762|     22|                        ret = 0;
 7763|     22|                        pEdgePlus->flow += delta;
 7764|     22|                        pv1p->st_edge.flow += delta;
 7765|     22|                        pv2p->st_edge.flow += delta;
 7766|     22|                        pBNS->tot_st_flow += 2 * delta;
 7767|     22|                    }
 7768|     26|                    pEdgePlus->forbidden &= inv_forbidden_edge_mask;
 7769|     26|                    if (pEdgeMinus)
  ------------------
  |  Branch (7769:25): [True: 1, False: 25]
  ------------------
 7770|      1|                    {
 7771|      1|                        pEdgeMinus->forbidden &= inv_forbidden_edge_mask;
 7772|      1|                    }
 7773|     26|                }
 7774|      0|                else
 7775|      0|                {
 7776|      0|                    if (pEdgeMinus && ( delta == pEdgeMinus->flow ) && pEdgePlus->flow == 0)
  ------------------
  |  Branch (7776:25): [True: 0, False: 0]
  |  Branch (7776:39): [True: 0, False: 0]
  |  Branch (7776:72): [True: 0, False: 0]
  ------------------
 7777|      0|                    {
 7778|       |                        /* positive charge <=> flow=0 on (=) edge and flow=0 on (-) edge */
 7779|      0|                        pEdgeMinus->flow -= delta;
 7780|      0|                        pv1m->st_edge.flow -= delta;
 7781|      0|                        pv2m->st_edge.flow -= delta;
 7782|      0|                        pBNS->tot_st_flow -= 2 * delta;
 7783|      0|                        pEdgePlus->forbidden |= forbidden_edge_mask;
 7784|      0|                        pEdgeMinus->forbidden |= forbidden_edge_mask;
 7785|      0|                        ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 7786|      0|                                              &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 7787|      0|                        if (ret < 0)
  ------------------
  |  Branch (7787:29): [True: 0, False: 0]
  ------------------
 7788|      0|                        {
 7789|      0|                            goto exit_function;
 7790|      0|                        }
 7791|      0|                        if (ret == 1 && ( (vPathEnd == v1m && vPathStart == v2m) ||
  ------------------
  |  Branch (7791:29): [True: 0, False: 0]
  |  Branch (7791:44): [True: 0, False: 0]
  |  Branch (7791:63): [True: 0, False: 0]
  ------------------
 7792|      0|                                          (vPathEnd == v2m && vPathStart == v1m) ) &&
  ------------------
  |  Branch (7792:44): [True: 0, False: 0]
  |  Branch (7792:63): [True: 0, False: 0]
  ------------------
 7793|      0|                                          nDeltaCharge == -1  /* charge moving to this atom disappers*/) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (7793:43): [True: 0, False: 0]
  ------------------
 7794|      0|                        {
 7795|      0|                            ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 7796|      0|                            ( *pnNumRunBNS )++;
 7797|      0|                            if (ret < 0)
  ------------------
  |  Branch (7797:33): [True: 0, False: 0]
  ------------------
 7798|      0|                            {
 7799|      0|                                goto exit_function;
 7800|      0|                            }
 7801|      0|                            else if (ret == 1)
  ------------------
  |  Branch (7801:38): [True: 0, False: 0]
  ------------------
 7802|      0|                            {
 7803|      0|                                *pnTotalDelta += ret;
 7804|      0|                            }
 7805|      0|                            else
 7806|      0|                            {
 7807|      0|                                ret = RI_ERR_PROGR;
  ------------------
  |  |   17|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 7808|      0|                                goto exit_function;
 7809|      0|                            }
 7810|      0|                        }
 7811|      0|                        else
 7812|      0|                        {
 7813|      0|                            ret = 0;
 7814|      0|                            pEdgeMinus->flow += delta;
 7815|      0|                            pv1m->st_edge.flow += delta;
 7816|      0|                            pv2m->st_edge.flow += delta;
 7817|      0|                            pBNS->tot_st_flow += 2 * delta;
 7818|      0|                        }
 7819|      0|                        pEdgePlus->forbidden &= inv_forbidden_edge_mask;
 7820|      0|                        pEdgeMinus->forbidden &= inv_forbidden_edge_mask;
 7821|      0|                    }
 7822|      0|                }
 7823|     26|                if (ret)
  ------------------
  |  Branch (7823:21): [True: 4, False: 22]
  ------------------
 7824|      4|                {
 7825|      4|                    num_success++;
 7826|      4|                    memcpy(at2, at, len_at * sizeof(at2[0]));
 7827|      4|                    pStruct->at = at2;
 7828|      4|                    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 7829|      4|                    pStruct->at = at;
 7830|      4|                    if (ret2 < 0)
  ------------------
  |  Branch (7830:25): [True: 0, False: 4]
  ------------------
 7831|      0|                    {
 7832|      0|                        ret = ret2;
 7833|      0|                        goto exit_function;
 7834|      0|                    }
 7835|      4|                }
 7836|     26|            }
 7837|  3.06k|        }
 7838|   832k|    }
 7839|       |
 7840|       |
 7841|  87.7k|    ret = num_success;
 7842|       |
 7843|  87.7k|exit_function:
 7844|       |
 7845|  87.7k|    return ret;
 7846|  87.7k|}

bHas_N_V:
   58|  1.13k|{
   59|  1.13k|    int i, num_found = 0;
   60|  9.48k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (60:17): [True: 8.35k, False: 1.13k]
  ------------------
   61|  8.35k|    {
   62|  8.35k|        if (at2[i].el_number == EL_NUMBER_N &&
  ------------------
  |  |   14|  16.7k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (62:13): [True: 2.23k, False: 6.11k]
  ------------------
   63|  2.23k|             !at2[i].charge &&
  ------------------
  |  Branch (63:14): [True: 1.36k, False: 871]
  ------------------
   64|  1.36k|             !at2[i].num_H &&
  ------------------
  |  Branch (64:14): [True: 1.09k, False: 273]
  ------------------
   65|  1.09k|             !at2[i].radical &&
  ------------------
  |  Branch (65:14): [True: 1.06k, False: 30]
  ------------------
   66|  1.06k|             at2[i].chem_bonds_valence == 5 &&
  ------------------
  |  Branch (66:14): [True: 241, False: 820]
  ------------------
   67|    241|             ( at2[i].valence == 3 ))
  ------------------
  |  Branch (67:14): [True: 151, False: 90]
  ------------------
   68|    151|        {
   69|    151|            num_found++;
   70|    151|        }
   71|  8.35k|    }
   72|       |
   73|  1.13k|    return num_found;
   74|  1.13k|}
FixFixedHRestoredStructure:
  320|  1.21k|{
  321|       |    /*--------- process extra or missing Fixed-H on non-tautomeric atoms ------*/
  322|       |    /* at2 should be the most recently restored atom, Fixed-H */
  323|  1.21k|    int i, j, k, delta, num_try, tot_succes, cur_success, ret = 0, bAllowedNFlowerEdges = 0, num_zero_ret;
  324|  1.21k|    CMP2FHINCHI c2i;
  325|  1.21k|    CMP2FHINCHI *pc2i = &c2i;
  326|       |
  327|  1.21k|    EDGE_LIST AllChargeEdges, CurrEdges, SFlowerEdges, NFlowerEdges, OtherNFlowerEdges, FixedLargeRingStereoEdges;
  328|  1.21k|    EDGE_LIST AllBondEdges;
  329|       |
  330|  1.21k|    EdgeIndex e;
  331|  1.21k|    BNS_EDGE  *pe;
  332|  1.21k|    Vertex v1, v2;
  333|  1.21k|    BNS_VERTEX *pv1, *pv2;
  334|       |
  335|  1.21k|    Vertex     vPathStart, vPathEnd;
  336|  1.21k|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
  337|       |
  338|  1.21k|    int        nNumRunBNS = 0, forbidden_edge_mask_inv = ~forbidden_edge_mask; /* djb-rwth: ignoring LLVM warning: variable used */
  339|       |
  340|       |    INCHI_HEAPCHK
  341|       |
  342|  1.21k|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  1.21k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  343|  1.21k|    AllocEdgeList( &CurrEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  1.21k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  344|  1.21k|    AllocEdgeList( &NFlowerEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  1.21k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  345|  1.21k|    AllocEdgeList( &SFlowerEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  1.21k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  346|  1.21k|    AllocEdgeList( &OtherNFlowerEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  1.21k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  347|  1.21k|    AllocEdgeList( &FixedLargeRingStereoEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  1.21k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  348|  1.21k|    AllocEdgeList( &AllBondEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  1.21k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  349|       |
  350|  1.21k|    tot_succes = 0;
  351|       |
  352|  1.21k|    if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (352:9): [True: 457, False: 756]
  |  Branch (352:37): [True: 0, False: 457]
  ------------------
  353|      0|    {
  354|      0|        goto exit_function;  /* no fixed-H found */
  355|      0|    }
  356|       |
  357|  10.0k|    for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (357:17): [True: 8.80k, False: 1.21k]
  ------------------
  358|  8.80k|    {
  359|  8.80k|        if (( e = pVA[i].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (359:13): [True: 5.36k, False: 3.44k]
  |  Branch (359:57): [True: 5.36k, False: 0]
  ------------------
  360|  5.36k|            ( ret = AddToEdgeList( &AllChargeEdges, e, INC_ADD_EDGE ) ))
  ------------------
  |  |   18|  5.36k|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (360:13): [True: 0, False: 5.36k]
  ------------------
  361|      0|        {
  362|      0|            goto exit_function;
  363|      0|        }
  364|  8.80k|        if (( e = pVA[i].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (364:13): [True: 7.16k, False: 1.64k]
  |  Branch (364:56): [True: 6.88k, False: 282]
  ------------------
  365|  6.88k|        {
  366|  6.88k|            if ((ret = AddToEdgeList( &AllChargeEdges, e, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|  6.88k|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (366:17): [True: 0, False: 6.88k]
  ------------------
  367|      0|            {
  368|      0|                goto exit_function;
  369|      0|            }
  370|       |
  371|       |            /* in addition, disallow N(V) creation by forbidding charge flower edge that has flow=1 */
  372|  6.88k|            if (pVA[i].cNumValenceElectrons == 5 && !pVA[i].cMetal && /* N, P, As */
  ------------------
  |  Branch (372:17): [True: 2.60k, False: 4.27k]
  |  Branch (372:53): [True: 2.52k, False: 79]
  ------------------
  373|  2.52k|                 NO_VERTEX != ( j = GetChargeFlowerUpperEdge( pBNS, pVA, e ) ))
  ------------------
  |  |  118|  2.52k|#define NO_VERTEX    -2
  ------------------
  |  Branch (373:18): [True: 813, False: 1.71k]
  ------------------
  374|    813|            {
  375|       |
  376|    813|                if (pBNS->edge[j].forbidden)
  ------------------
  |  Branch (376:21): [True: 0, False: 813]
  ------------------
  377|      0|                {
  378|      0|                    continue;
  379|      0|                }
  380|       |
  381|    813|                if (pBNS->edge[j].flow)
  ------------------
  |  Branch (381:21): [True: 543, False: 270]
  ------------------
  382|    543|                {
  383|    543|                    if ((ret = AddToEdgeList( &AllChargeEdges, j, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    543|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (383:25): [True: 0, False: 543]
  ------------------
  384|      0|                    {
  385|      0|                        goto exit_function;
  386|      0|                    }
  387|    543|                    if ((ret = AddToEdgeList( &NFlowerEdges, j, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    543|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (387:25): [True: 0, False: 543]
  ------------------
  388|      0|                    {
  389|      0|                        goto exit_function;
  390|      0|                    }
  391|    543|                }
  392|    270|                else
  393|    270|                {
  394|    270|                    if ((ret = AddToEdgeList( &OtherNFlowerEdges, j, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    270|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (394:25): [True: 0, False: 270]
  ------------------
  395|      0|                    {
  396|      0|                        goto exit_function;
  397|      0|                    }
  398|    270|                }
  399|    813|            }
  400|  6.07k|            else
  401|  6.07k|            {
  402|       |                /* in addition, disallow N(V) creation by forbidding charge flower edge that has flow=1 */
  403|  6.07k|                if (pVA[i].cNumValenceElectrons == 6 && !pVA[i].cMetal && /* N, P, As */
  ------------------
  |  Branch (403:21): [True: 2.33k, False: 3.73k]
  |  Branch (403:57): [True: 2.29k, False: 38]
  ------------------
  404|  2.29k|                     NO_VERTEX != ( j = GetChargeFlowerUpperEdge( pBNS, pVA, e ) ))
  ------------------
  |  |  118|  2.29k|#define NO_VERTEX    -2
  ------------------
  |  Branch (404:22): [True: 483, False: 1.81k]
  ------------------
  405|    483|                {
  406|       |
  407|    483|                    if (pBNS->edge[j].forbidden)
  ------------------
  |  Branch (407:25): [True: 0, False: 483]
  ------------------
  408|      0|                    {
  409|      0|                        continue;
  410|      0|                    }
  411|       |
  412|    483|                    if (pBNS->edge[j].flow)
  ------------------
  |  Branch (412:25): [True: 360, False: 123]
  ------------------
  413|    360|                    {
  414|    360|                        if ((ret = AddToEdgeList( &SFlowerEdges, j, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    360|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (414:29): [True: 0, False: 360]
  ------------------
  415|      0|                        {
  416|      0|                            goto exit_function;
  417|      0|                        }
  418|    360|                    }
  419|    483|                }
  420|  6.07k|            }
  421|  6.88k|        }
  422|  25.3k|        for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (422:21): [True: 16.5k, False: 8.80k]
  ------------------
  423|  16.5k|        {
  424|  16.5k|            k = at2[i].neighbor[j];
  425|  16.5k|            if (k < i && !pBNS->edge[e = pBNS->vert[i].iedge[j]].forbidden)
  ------------------
  |  Branch (425:17): [True: 8.28k, False: 8.28k]
  |  Branch (425:26): [True: 8.22k, False: 63]
  ------------------
  426|  8.22k|            {
  427|  8.22k|                if ((ret = AddToEdgeList( &AllBondEdges, e, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|  8.22k|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (427:21): [True: 0, False: 8.22k]
  ------------------
  428|      0|                {
  429|      0|                    goto exit_function;
  430|      0|                }
  431|  8.22k|            }
  432|  16.5k|        }
  433|  8.80k|    }
  434|  1.21k|    if (forbidden_stereo_edge_mask)
  ------------------
  |  Branch (434:9): [True: 1.21k, False: 0]
  ------------------
  435|  1.21k|    {
  436|  10.0k|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (436:21): [True: 8.80k, False: 1.21k]
  ------------------
  437|  8.80k|        {
  438|  25.3k|            for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (438:25): [True: 16.5k, False: 8.80k]
  ------------------
  439|  16.5k|            {
  440|  16.5k|                if (pBNS->edge[k = pBNS->vert[i].iedge[j]].forbidden == forbidden_stereo_edge_mask)
  ------------------
  |  Branch (440:21): [True: 126, False: 16.4k]
  ------------------
  441|    126|                {
  442|    126|                    int nMinRingSize = is_bond_in_Nmax_memb_ring( at2, i, j, pStruct->pbfsq->q,
  443|    126|                                                                  pStruct->pbfsq->nAtomLevel,
  444|    126|                                                                  pStruct->pbfsq->cSource, 99 /* max ring size */ );
  445|    126|                    if (0 < nMinRingSize && ( ret = AddToEdgeList( &FixedLargeRingStereoEdges, k, INC_ADD_EDGE ) ))
  ------------------
  |  |   18|     88|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (445:25): [True: 88, False: 38]
  |  Branch (445:45): [True: 0, False: 88]
  ------------------
  446|      0|                    {
  447|      0|                        goto exit_function;
  448|      0|                    }
  449|    126|                }
  450|  16.5k|            }
  451|  8.80k|        }
  452|  1.21k|    }
  453|       |
  454|  1.21k|    INCHI_HEAPCHK
  455|  1.21k|        if ((ret = FillOutExtraFixedHDataRestr( pStruct ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (455:13): [True: 0, False: 1.21k]
  ------------------
  456|      0|        {
  457|      0|            goto exit_function;
  458|      0|        }
  459|  1.21k|    INCHI_HEAPCHK
  460|  1.21k|        if ((ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (460:13): [True: 0, False: 1.21k]
  ------------------
  461|      0|        {
  462|      0|            goto exit_function;
  463|      0|        }
  464|       |
  465|       |    INCHI_HEAPCHK
  466|       |
  467|  1.21k|        if (!pc2i->bHasDifference ||
  ------------------
  |  Branch (467:13): [True: 66, False: 1.14k]
  ------------------
  468|  1.14k|             (!pc2i->len_c2at && pc2i->nNumTgRevrs == pc2i->nNumTgInChI &&
  ------------------
  |  Branch (468:15): [True: 10, False: 1.13k]
  |  Branch (468:34): [True: 10, False: 0]
  ------------------
  469|     10|             pc2i->nNumEndpRevrs == pc2i->nNumRemHInChI &&
  ------------------
  |  Branch (469:14): [True: 7, False: 3]
  ------------------
  470|      7|             pc2i->nNumEndpRevrs == pc2i->nNumEndpInChI &&
  ------------------
  |  Branch (470:14): [True: 7, False: 0]
  ------------------
  471|      7|             !pc2i->nNumTgDiffMinus && !pc2i->nNumTgDiffH)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (471:14): [True: 7, False: 0]
  |  Branch (471:40): [True: 7, False: 0]
  ------------------
  472|     73|        {
  473|     73|            goto exit_function; /* nothing to do */
  474|     73|        }
  475|       |
  476|       |    /*goto exit_function;*/ /* debug only*/
  477|       |
  478|  1.14k|    if (pc2i->len_c2at >= 2)
  ------------------
  |  Branch (478:9): [True: 1.03k, False: 106]
  ------------------
  479|  1.03k|    {
  480|       |        /*----------------------------------------------------*/
  481|       |        /* case 01: restored: O=AB-O(-)  original:  (-)O-AB=O */
  482|       |        /* FixH:              0    -1                 -1    0 */
  483|       |        /* MobH:              0     1                  1    0 */
  484|       |        /*                         non-taut      non-taut     */
  485|       |        /* O = O, S, Se; charged atoms O are not tautomeric   */
  486|       |        /* Solution: move (-) from B-O(-) to O=A              */
  487|       |        /*----------------------------------------------------*/
  488|  1.03k|        int num_DB_O = 0, num_SB_O_Minus = 0, iat;
  489|  1.03k|        cur_success = 0;
  490|       |
  491|  4.52k|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (491:21): [True: 3.48k, False: 1.03k]
  ------------------
  492|  3.48k|        {
  493|  3.48k|            iat = pc2i->c2at[i].atomNumber;
  494|  3.48k|            if (pc2i->c2at[i].nValElectr == 6 /* && !pc2i->c2at[i].endptInChI -- mod#1*/ &&
  ------------------
  |  Branch (494:17): [True: 1.76k, False: 1.72k]
  ------------------
  495|  1.76k|                (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (495:17): [True: 1.12k, False: 641]
  |  Branch (495:61): [True: 1.12k, False: 0]
  ------------------
  496|  1.12k|            {
  497|  1.12k|                if ( /* orig. InChI info: */
  498|  1.12k|                    num_SB_O_Minus < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  2.24k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (498:21): [True: 1.12k, False: 0]
  ------------------
  499|  1.12k|                    pc2i->c2at[i].nFixHInChI == 0 && pc2i->c2at[i].nMobHInChI == 0 &&
  ------------------
  |  Branch (499:21): [True: 1.02k, False: 94]
  |  Branch (499:54): [True: 1.02k, False: 0]
  ------------------
  500|       |                    /* reversed structure info: */
  501|  1.02k|                    pc2i->c2at[i].nFixHRevrs == -1 && pc2i->c2at[i].nMobHRevrs == 1 &&
  ------------------
  |  Branch (501:21): [True: 46, False: 982]
  |  Branch (501:55): [True: 46, False: 0]
  ------------------
  502|     46|                    pc2i->c2at[i].nAtChargeRevrs == -1 && !at2[iat].num_H && /* at2 is Fixed-H */
  ------------------
  |  Branch (502:21): [True: 46, False: 0]
  |  Branch (502:59): [True: 46, False: 0]
  ------------------
  503|     46|                    at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 1)
  ------------------
  |  Branch (503:21): [True: 46, False: 0]
  |  Branch (503:46): [True: 46, False: 0]
  ------------------
  504|     46|                {
  505|     46|                    iat_SB_O_Minus[num_SB_O_Minus++] = iat;
  506|     46|                    if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|     46|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (506:25): [True: 0, False: 46]
  ------------------
  507|      0|                    {
  508|      0|                        goto exit_function;
  509|      0|                    }
  510|     46|                }
  511|  1.07k|                else
  512|  1.07k|                {
  513|  1.07k|                    if ( /* orig. InChI info: */
  514|  1.07k|                        num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  2.15k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (514:25): [True: 1.07k, False: 0]
  ------------------
  515|  1.07k|                        pc2i->c2at[i].nFixHInChI == -1 && pc2i->c2at[i].nMobHInChI == 1 &&
  ------------------
  |  Branch (515:25): [True: 56, False: 1.02k]
  |  Branch (515:59): [True: 25, False: 31]
  ------------------
  516|       |                        /* reversed structure info: */
  517|     25|                        pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs == 0 &&
  ------------------
  |  Branch (517:25): [True: 25, False: 0]
  |  Branch (517:58): [True: 25, False: 0]
  ------------------
  518|     25|                        pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (518:25): [True: 16, False: 9]
  |  Branch (518:62): [True: 16, False: 0]
  ------------------
  519|     16|                        at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 2)
  ------------------
  |  Branch (519:25): [True: 16, False: 0]
  |  Branch (519:50): [True: 14, False: 2]
  ------------------
  520|     14|                    {
  521|     14|                        iat_DB_O[num_DB_O++] = iat;
  522|     14|                        if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|     14|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (522:29): [True: 0, False: 14]
  ------------------
  523|      0|                        {
  524|      0|                            goto exit_function;
  525|      0|                        }
  526|     14|                    }
  527|  1.07k|                }
  528|  1.12k|            }
  529|  3.48k|        }
  530|  1.03k|        if ((num_try = inchi_min(num_SB_O_Minus, num_DB_O))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|  1.03k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 14, False: 1.02k]
  |  |  ------------------
  ------------------
  |  Branch (530:13): [True: 0, False: 1.03k]
  ------------------
  531|      0|        {
  532|       |            /* detected; attempt to fix */
  533|      0|            SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
  534|      0|            RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
  535|      0|            delta = 1;
  536|      0|            for (i = 0; i < num_SB_O_Minus && cur_success < num_try; i++)
  ------------------
  |  Branch (536:25): [True: 0, False: 0]
  |  Branch (536:47): [True: 0, False: 0]
  ------------------
  537|      0|            {
  538|      0|                iat = iat_SB_O_Minus[i];
  539|      0|                pe = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
  540|      0|                if (!pe->flow)
  ------------------
  |  Branch (540:21): [True: 0, False: 0]
  ------------------
  541|      0|                    continue;
  542|      0|                pv1 = pBNS->vert + (v1 = pe->neighbor1);
  543|      0|                pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
  544|       |
  545|      0|                pe->forbidden |= forbidden_edge_mask;
  546|      0|                pe->flow -= delta; /* remove (-) from AB-O(-) */
  547|      0|                pv1->st_edge.flow -= delta;
  548|      0|                pv2->st_edge.flow -= delta;
  549|      0|                pBNS->tot_st_flow -= 2 * delta;
  550|       |
  551|      0|                ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
  552|      0|                    &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
  553|       |
  554|      0|                if (ret == 1 && ((vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (554:21): [True: 0, False: 0]
  |  Branch (554:35): [True: 0, False: 0]
  |  Branch (554:53): [True: 0, False: 0]
  ------------------
  555|      0|                    (vPathEnd == v2 && vPathStart == v1)) && nDeltaCharge == 1) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (555:22): [True: 0, False: 0]
  |  Branch (555:40): [True: 0, False: 0]
  |  Branch (555:62): [True: 0, False: 0]
  ------------------
  556|      0|                {
  557|       |                    /* Added (-)charge to O=AB => nDeltaCharge == -1 */
  558|       |                    /* Flow change on pe (-)charge edge (atom B-O(-)) is not known to RunBnsTestOnce()) */
  559|      0|                    ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
  560|      0|                    if (ret > 0)
  ------------------
  |  Branch (560:25): [True: 0, False: 0]
  ------------------
  561|      0|                    {
  562|      0|                        nNumRunBNS++;
  563|      0|                        cur_success++; /* 01 */
  564|      0|                    }
  565|      0|                }
  566|      0|                else
  567|      0|                {
  568|      0|                    pe->forbidden &= forbidden_edge_mask_inv;
  569|      0|                    pe->flow += delta;
  570|      0|                    pv1->st_edge.flow += delta;
  571|      0|                    pv2->st_edge.flow += delta;
  572|      0|                    pBNS->tot_st_flow += 2 * delta;
  573|      0|                }
  574|      0|                INCHI_HEAPCHK
  575|      0|            }
  576|      0|            RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
  577|      0|            CurrEdges.num_edges = 0; /* clear current edge list */
  578|      0|        }
  579|  1.03k|        if (cur_success)
  ------------------
  |  Branch (579:13): [True: 0, False: 1.03k]
  ------------------
  580|      0|        {
  581|      0|            tot_succes += cur_success;
  582|       |            /* recalculate InChI from the structure */
  583|      0|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic,
  ------------------
  |  Branch (583:17): [True: 0, False: 0]
  ------------------
  584|      0|                ip, sd, pBNS, pStruct,
  585|      0|                at, at2, at3, pVA,
  586|      0|                pTCGroups,
  587|      0|                ppt_group_info, ppat_norm,
  588|      0|                ppat_prep)))
  589|      0|            {
  590|      0|                goto exit_function;
  591|      0|            }
  592|      0|            if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (592:17): [True: 0, False: 0]
  ------------------
  593|      0|            {
  594|      0|                goto exit_function;
  595|      0|            }
  596|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (596:17): [True: 0, False: 0]
  |  Branch (596:45): [True: 0, False: 0]
  ------------------
  597|      0|            {
  598|      0|                goto exit_function;  /* no fixed-H found */
  599|      0|            }
  600|      0|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (600:17): [True: 0, False: 0]
  ------------------
  601|      0|            {
  602|      0|                goto exit_function;
  603|      0|            }
  604|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (604:17): [True: 0, False: 0]
  ------------------
  605|      0|            {
  606|      0|                goto exit_function; /* nothing to do */
  607|      0|            }
  608|      0|        }
  609|  1.03k|    }
  610|       |
  611|  1.14k|    if (pc2i->len_c2at >= 1)
  ------------------
  |  Branch (611:9): [True: 1.13k, False: 3]
  ------------------
  612|  1.13k|    {
  613|       |        /*--------------------------------------------------------------*/
  614|       |        /* case 02: restored: -O(+)=AB-NH2  original:  -O-AB=NH2(+)     */
  615|       |        /* FixH:               0        0               0      1        */
  616|       |        /* MobH:               0        2               0      1        */
  617|       |        /* O = P, As, Sb, O, S, Se, F, Cl, Br, I; not taut. in InChI    */
  618|       |        /* N = N, O, S, Se, Te; has H; tautomeric or not tautomeric     */
  619|       |        /* Solution: move (+) from O(+) to NH2                          */
  620|       |        /*--------------------------------------------------------------*/
  621|  1.13k|        int num_DB_O_Plus = 0, num_SB_NH = 0, iat;
  622|  1.13k|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
  623|  1.13k|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (623:32): [True: 1.13k, False: 0]
  |  Branch (623:45): [True: 1.13k, False: 0]
  ------------------
  624|  1.13k|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : NULL;
  ------------------
  |  Branch (624:13): [True: 0, False: 0]
  |  Branch (624:26): [True: 0, False: 0]
  ------------------
  625|  1.13k|        cur_success = 0;
  626|  1.13k|        num_zero_ret = 0;
  627|       |
  628|  4.72k|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (628:21): [True: 3.59k, False: 1.13k]
  ------------------
  629|  3.59k|        {
  630|  3.59k|            iat = pc2i->c2at[i].atomNumber;
  631|  3.59k|            if ( /* orig. InChI info: =NH2(+), =OH(+) */
  632|  3.59k|                num_SB_NH < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  7.18k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (632:17): [True: 3.59k, False: 0]
  ------------------
  633|  3.59k|                ((pc2i->c2at[i].nValElectr == 5 && pc2i->c2at[i].nPeriodNum == 1) ||
  ------------------
  |  Branch (633:19): [True: 1.25k, False: 2.33k]
  |  Branch (633:52): [True: 1.07k, False: 180]
  ------------------
  634|  2.51k|                    pc2i->c2at[i].nValElectr == 6) /* N, O, S, Se, Te */ &&
  ------------------
  |  Branch (634:21): [True: 1.83k, False: 685]
  ------------------
  635|       |                /*!pc2i->c2at[i].endptInChI &&*/ /* <=== relaxation */
  636|  2.90k|                (e = pVA[iat].nCPlusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (636:17): [True: 2.13k, False: 771]
  |  Branch (636:60): [True: 2.06k, False: 76]
  ------------------
  637|  2.06k|                pc2i->c2at[i].nFixHInChI>0 /*== 1 --modification#2*/ && /*pc2i->c2at[i].nMobHInChI ==  1 &&*/
  ------------------
  |  Branch (637:17): [True: 593, False: 1.46k]
  ------------------
  638|       |                /* reversed structure info: */
  639|    593|                pc2i->c2at[i].nFixHRevrs == 0 && /* pc2i->c2at[i].nMobHRevrs == 0 &&*/
  ------------------
  |  Branch (639:17): [True: 400, False: 193]
  ------------------
  640|    400|                pc2i->c2at[i].nAtChargeRevrs == 0 && at2[iat].num_H &&
  ------------------
  |  Branch (640:17): [True: 274, False: 126]
  |  Branch (640:54): [True: 274, False: 0]
  ------------------
  641|    274|                at2[iat].valence == at2[iat].chem_bonds_valence) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (641:17): [True: 254, False: 20]
  ------------------
  642|    254|            {
  643|    254|                iat_SB_NH[num_SB_NH++] = iat;
  644|    254|                if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    254|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (644:21): [True: 0, False: 254]
  ------------------
  645|      0|                {
  646|      0|                    goto exit_function;
  647|      0|                }
  648|    254|            }
  649|  3.59k|        }
  650|  9.53k|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (650:21): [True: 8.39k, False: 1.13k]
  ------------------
  651|  8.39k|        {
  652|       |            /* i = canonical number - 1 */
  653|  8.39k|            iat = nCanon2AtnoRevrs[i];
  654|  8.39k|            if ( /* in restored atom: charge=+1, no H, has double bond, P, As, O, S, Se, Te, F, Cl, Br, I */
  655|  8.39k|                num_DB_O_Plus < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  16.7k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (655:17): [True: 8.39k, False: 0]
  ------------------
  656|  8.39k|                at2[iat].charge == 1 && !at2[iat].num_H &&
  ------------------
  |  Branch (656:17): [True: 1.28k, False: 7.11k]
  |  Branch (656:41): [True: 914, False: 369]
  ------------------
  657|    914|                at2[iat].valence < at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (657:17): [True: 601, False: 313]
  |  Branch (657:67): [True: 548, False: 53]
  ------------------
  658|    548|                (pVA[iat].cNumValenceElectrons == 6 || pVA[iat].cNumValenceElectrons == 7 ||
  ------------------
  |  Branch (658:18): [True: 210, False: 338]
  |  Branch (658:56): [True: 40, False: 298]
  ------------------
  659|    298|                    (pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber > 1)) &&
  ------------------
  |  Branch (659:22): [True: 258, False: 40]
  |  Branch (659:60): [True: 37, False: 221]
  ------------------
  660|       |                /* in orig.InChI: not an endpoint, has no H */
  661|    287|                !pStruct->endpoint[i] &&
  ------------------
  |  Branch (661:17): [True: 263, False: 24]
  ------------------
  662|    263|                !(pStruct->fixed_H && pStruct->fixed_H[i]) &&
  ------------------
  |  Branch (662:19): [True: 263, False: 0]
  |  Branch (662:39): [True: 5, False: 258]
  ------------------
  663|    258|                !(nMobHInChI && nMobHInChI[i]) &&
  ------------------
  |  Branch (663:19): [True: 258, False: 0]
  |  Branch (663:33): [True: 1, False: 257]
  ------------------
  664|       |                /* has (+) edge */
  665|    257|                (e = pVA[iat].nCPlusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (665:17): [True: 257, False: 0]
  |  Branch (665:60): [True: 221, False: 36]
  ------------------
  666|    221|            {
  667|    221|                iat_DB_O_Plus[num_DB_O_Plus++] = iat;
  668|    221|                if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    221|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (668:21): [True: 0, False: 221]
  ------------------
  669|      0|                {
  670|      0|                    goto exit_function;
  671|      0|                }
  672|    221|            }
  673|  8.39k|        }
  674|  1.13k|        if ((num_try = inchi_min(num_DB_O_Plus, num_SB_NH))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|  1.13k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 156, False: 981]
  |  |  ------------------
  ------------------
  |  Branch (674:13): [True: 83, False: 1.05k]
  ------------------
  675|     83|        {
  676|       |            /* detected; attempt to fix */
  677|     83|            SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
  678|     83|            RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
  679|     83|            delta = 1;
  680|     93|        repeat_02_allow_NV:
  681|    191|            for (i = 0; i < num_SB_NH && cur_success < num_try; i++)
  ------------------
  |  Branch (681:25): [True: 100, False: 91]
  |  Branch (681:42): [True: 98, False: 2]
  ------------------
  682|     98|            {
  683|     98|                iat = iat_SB_NH[i];
  684|     98|                pe = pBNS->edge + pVA[iat].nCPlusGroupEdge - 1;
  685|     98|                if (!pe->flow)
  ------------------
  |  Branch (685:21): [True: 0, False: 98]
  ------------------
  686|      0|                    continue;
  687|     98|                pv1 = pBNS->vert + (v1 = pe->neighbor1);
  688|     98|                pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
  689|       |
  690|     98|                pe->forbidden |= forbidden_edge_mask;
  691|     98|                pe->flow -= delta;
  692|     98|                pv1->st_edge.flow -= delta;
  693|     98|                pv2->st_edge.flow -= delta;
  694|     98|                pBNS->tot_st_flow -= 2 * delta;
  695|       |
  696|     98|                ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
  697|     98|                    &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
  698|       |
  699|     98|                if (ret == 1 && ((vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (699:21): [True: 74, False: 24]
  |  Branch (699:35): [True: 5, False: 69]
  |  Branch (699:53): [True: 2, False: 3]
  ------------------
  700|     72|                    (vPathEnd == v2 && vPathStart == v1)) && nDeltaCharge == -1) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (700:22): [True: 67, False: 5]
  |  Branch (700:40): [True: 66, False: 1]
  |  Branch (700:62): [True: 67, False: 1]
  ------------------
  701|     67|                {
  702|       |                    /* Removed charge from O(+) => nDeltaCharge == -1 */
  703|       |                    /* Flow change on pe (+)charge edge (atom NH2) is not known to RunBnsTestOnce()) */
  704|     67|                    ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
  705|     67|                    if (ret > 0)
  ------------------
  |  Branch (705:25): [True: 67, False: 0]
  ------------------
  706|     67|                    {
  707|     67|                        nNumRunBNS++;
  708|     67|                        cur_success++; /* 02 */
  709|     67|                    }
  710|     67|                }
  711|     31|                else
  712|     31|                {
  713|     31|                    num_zero_ret += !ret;
  714|     31|                    pe->forbidden &= forbidden_edge_mask_inv;
  715|     31|                    pe->flow += delta;
  716|     31|                    pv1->st_edge.flow += delta;
  717|     31|                    pv2->st_edge.flow += delta;
  718|     31|                    pBNS->tot_st_flow += 2 * delta;
  719|     31|                }
  720|     98|                INCHI_HEAPCHK
  721|     98|            }
  722|     93|            if (num_zero_ret == num_try && !bAllowedNFlowerEdges && NFlowerEdges.num_edges)
  ------------------
  |  Branch (722:17): [True: 26, False: 67]
  |  Branch (722:44): [True: 19, False: 7]
  |  Branch (722:69): [True: 10, False: 9]
  ------------------
  723|     10|            {
  724|     10|                RemoveForbiddenEdgeMask(pBNS, &NFlowerEdges, forbidden_edge_mask);
  725|     10|                bAllowedNFlowerEdges = 1;
  726|     10|                goto repeat_02_allow_NV;
  727|     10|            }
  728|     83|            RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
  729|       |            /* djb-rwth: removing redundant code */
  730|     83|        }
  731|  1.13k|        CurrEdges.num_edges = 0; /* clear current edge list */
  732|  1.13k|        if (cur_success)
  ------------------
  |  Branch (732:13): [True: 67, False: 1.07k]
  ------------------
  733|     67|        {
  734|     67|            tot_succes += cur_success;
  735|       |            /* recalculate InChI from the structure */
  736|     67|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (736:17): [True: 1, False: 66]
  ------------------
  737|     67|                ppt_group_info, ppat_norm, ppat_prep)))
  738|      1|            {
  739|      1|                goto exit_function;
  740|      1|            }
  741|     66|            if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (741:17): [True: 0, False: 66]
  ------------------
  742|      0|            {
  743|      0|                goto exit_function;
  744|      0|            }
  745|     66|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (745:17): [True: 0, False: 66]
  |  Branch (745:45): [True: 0, False: 0]
  ------------------
  746|      0|            {
  747|      0|                goto exit_function;  /* no fixed-H found */
  748|      0|            }
  749|     66|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (749:17): [True: 0, False: 66]
  ------------------
  750|      0|            {
  751|      0|                goto exit_function;
  752|      0|            }
  753|     66|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (753:17): [True: 1, False: 65]
  ------------------
  754|      1|            {
  755|      1|                goto exit_function; /* nothing to do */
  756|      1|            }
  757|     66|        }
  758|  1.13k|    }
  759|       |
  760|  1.13k|    if (pc2i->len_c2at >= 1 && pc2i->nNumTgRevrs == 1 &&
  ------------------
  |  Branch (760:9): [True: 1.13k, False: 3]
  |  Branch (760:32): [True: 405, False: 730]
  ------------------
  761|    405|        ( pc2i->nNumEndpRevrs > pc2i->nNumEndpInChI || pc2i->nNumTgInChI > 1 ) /* ADP in Revrs */)
  ------------------
  |  Branch (761:11): [True: 200, False: 205]
  |  Branch (761:56): [True: 23, False: 182]
  ------------------
  762|    223|    {
  763|       |        /*--------------------------------------------------------------*/
  764|       |        /* case 03: restored: -N(-)-AB=O    original:  -N=AB-O(-)       */
  765|       |        /* FixH:               0       0                0     -1        */
  766|       |        /* MobH:               0       0                0      1        */
  767|       |        /* O = O, S, Se; N = N;                                         */
  768|       |        /* restored atoms are tautomeric; original atoms are not taut.  */
  769|       |        /* restored struct has 1 t-group; original has less endpoints   */
  770|       |        /*                                and possibly >1 t-groups      */
  771|       |        /* Solution: move (-) from N(-) to =O                           */
  772|       |        /*           these atoms are tautomeric in restored structure   */
  773|       |        /*--------------------------------------------------------------*/
  774|    223|        int num_SB_N_Minus = 0, num_DB_O = 0, iat;
  775|    223|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
  776|    223|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (776:41): [True: 223, False: 0]
  ------------------
  777|    223|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (777:41): [True: 223, False: 0]
  ------------------
  778|       |        /*
  779|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
  780|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
  781|       |        */
  782|    223|        cur_success = 0;
  783|       |
  784|  1.04k|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (784:21): [True: 817, False: 223]
  ------------------
  785|    817|        {
  786|    817|            iat = pc2i->c2at[i].atomNumber;
  787|    817|            if ( /* orig. InChI info: -O(-) */
  788|    817|                num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  1.63k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (788:17): [True: 817, False: 0]
  ------------------
  789|    817|                pc2i->c2at[i].nValElectr == 6 /* O, S, Se, Te */ &&
  ------------------
  |  Branch (789:17): [True: 336, False: 481]
  ------------------
  790|    336|                !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (790:17): [True: 308, False: 28]
  ------------------
  791|    308|                (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (791:17): [True: 231, False: 77]
  |  Branch (791:61): [True: 231, False: 0]
  ------------------
  792|    231|                pc2i->c2at[i].nFixHInChI == -1 && pc2i->c2at[i].nMobHInChI == 1 &&
  ------------------
  |  Branch (792:17): [True: 10, False: 221]
  |  Branch (792:51): [True: 5, False: 5]
  ------------------
  793|       |                /* reversed structure info: */
  794|      5|                pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (794:17): [True: 3, False: 2]
  ------------------
  795|      3|                pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs == 0 &&
  ------------------
  |  Branch (795:17): [True: 3, False: 0]
  |  Branch (795:50): [True: 3, False: 0]
  ------------------
  796|      3|                pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (796:17): [True: 1, False: 2]
  |  Branch (796:54): [True: 1, False: 0]
  ------------------
  797|      1|                at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 2)
  ------------------
  |  Branch (797:17): [True: 1, False: 0]
  |  Branch (797:42): [True: 1, False: 0]
  ------------------
  798|      1|            {
  799|      1|                iat_DB_O[num_DB_O++] = iat;
  800|      1|                if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|      1|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (800:21): [True: 0, False: 1]
  ------------------
  801|      0|                {
  802|      0|                    goto exit_function;
  803|      0|                }
  804|      1|            }
  805|    817|        }
  806|  1.88k|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (806:21): [True: 1.65k, False: 223]
  ------------------
  807|  1.65k|        {
  808|       |            /* i = canonical number - 1 */
  809|  1.65k|            iat = nCanon2AtnoRevrs[i];
  810|  1.65k|            if ( /* in restored atom N: charge=-1, no H, has no double bond, endpoint */
  811|  1.65k|                num_SB_N_Minus < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  3.31k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (811:17): [True: 1.65k, False: 0]
  ------------------
  812|  1.65k|                at2[iat].charge == -1 && /*!at2[iat].num_H &&*/
  ------------------
  |  Branch (812:17): [True: 323, False: 1.33k]
  ------------------
  813|    323|                at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (813:17): [True: 242, False: 81]
  |  Branch (813:68): [True: 235, False: 7]
  ------------------
  814|    235|                pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (814:17): [True: 71, False: 164]
  |  Branch (814:55): [True: 64, False: 7]
  ------------------
  815|     64|                at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint &&
  ------------------
  |  Branch (815:17): [True: 64, False: 0]
  |  Branch (815:38): [True: 51, False: 13]
  ------------------
  816|       |                /* in orig.InChI: not an endpoint, has no H */
  817|       |                /* !pStruct->endpoint[i] && */
  818|       |                /*
  819|       |                !(pStruct->fixed_H && pStruct->fixed_H[i]) &&
  820|       |                !(nMobHInChI && nMobHInChI[i] ) &&
  821|       |                */
  822|       |                /* has (-) edge */
  823|     51|                (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (823:17): [True: 51, False: 0]
  |  Branch (823:61): [True: 51, False: 0]
  ------------------
  824|     51|            {
  825|     51|                iat_SB_N_Minus[num_SB_N_Minus++] = iat;
  826|     51|                if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|     51|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (826:21): [True: 0, False: 51]
  ------------------
  827|      0|                {
  828|      0|                    goto exit_function;
  829|      0|                }
  830|     51|            }
  831|  1.65k|        }
  832|    223|        if ((num_try = inchi_min(num_SB_N_Minus, num_DB_O))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|    223|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 1, False: 222]
  |  |  ------------------
  ------------------
  |  Branch (832:13): [True: 0, False: 223]
  ------------------
  833|      0|        {
  834|       |            /* detected; attempt to fix */
  835|      0|            SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
  836|      0|            RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
  837|      0|            delta = 1;
  838|      0|            for (i = 0; i < num_SB_N_Minus && cur_success < num_try; i++)
  ------------------
  |  Branch (838:25): [True: 0, False: 0]
  |  Branch (838:47): [True: 0, False: 0]
  ------------------
  839|      0|            {
  840|      0|                iat = iat_SB_N_Minus[i];
  841|      0|                pe = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1; /* 2006-03-03: changed from CPlusGroupEdge */
  842|      0|                if (!pe->flow)
  ------------------
  |  Branch (842:21): [True: 0, False: 0]
  ------------------
  843|      0|                    continue;
  844|      0|                pv1 = pBNS->vert + (v1 = pe->neighbor1);
  845|      0|                pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
  846|       |
  847|      0|                pe->forbidden |= forbidden_edge_mask;
  848|      0|                pe->flow -= delta;
  849|      0|                pv1->st_edge.flow -= delta;
  850|      0|                pv2->st_edge.flow -= delta;
  851|      0|                pBNS->tot_st_flow -= 2 * delta;
  852|       |
  853|      0|                ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
  854|      0|                    &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
  855|       |
  856|      0|                if (ret == 1 && ((vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (856:21): [True: 0, False: 0]
  |  Branch (856:35): [True: 0, False: 0]
  |  Branch (856:53): [True: 0, False: 0]
  ------------------
  857|      0|                    (vPathEnd == v2 && vPathStart == v1)) && nDeltaCharge == 1) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (857:22): [True: 0, False: 0]
  |  Branch (857:40): [True: 0, False: 0]
  |  Branch (857:62): [True: 0, False: 0]
  ------------------
  858|      0|                {
  859|       |                    /* Added (-) charge to =O => nDeltaCharge == 1 */
  860|       |                    /* Flow change on pe (-)charge edge (atom -N(-)-) is not known to RunBnsTestOnce()) */
  861|      0|                    ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
  862|      0|                    if (ret > 0)
  ------------------
  |  Branch (862:25): [True: 0, False: 0]
  ------------------
  863|      0|                    {
  864|      0|                        nNumRunBNS++;
  865|      0|                        cur_success++; /* 03 */
  866|      0|                    }
  867|      0|                }
  868|      0|                else
  869|      0|                {
  870|      0|                    pe->forbidden &= forbidden_edge_mask_inv;
  871|      0|                    pe->flow += delta;
  872|      0|                    pv1->st_edge.flow += delta;
  873|      0|                    pv2->st_edge.flow += delta;
  874|      0|                    pBNS->tot_st_flow += 2 * delta;
  875|      0|                }
  876|      0|                INCHI_HEAPCHK
  877|      0|            }
  878|      0|            RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
  879|      0|        }
  880|    223|        CurrEdges.num_edges = 0; /* clear current edge list */
  881|    223|        if (cur_success)
  ------------------
  |  Branch (881:13): [True: 0, False: 223]
  ------------------
  882|      0|        {
  883|      0|            tot_succes += cur_success;
  884|       |            /* recalculate InChI from the structure */
  885|      0|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (885:17): [True: 0, False: 0]
  ------------------
  886|      0|                ppt_group_info, ppat_norm, ppat_prep)))
  887|      0|            {
  888|      0|                goto exit_function;
  889|      0|            }
  890|      0|            if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (890:17): [True: 0, False: 0]
  ------------------
  891|      0|            {
  892|      0|                goto exit_function;
  893|      0|            }
  894|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (894:17): [True: 0, False: 0]
  |  Branch (894:45): [True: 0, False: 0]
  ------------------
  895|      0|            {
  896|      0|                goto exit_function;  /* no fixed-H found */
  897|      0|            }
  898|      0|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (898:17): [True: 0, False: 0]
  ------------------
  899|      0|            {
  900|      0|                goto exit_function;
  901|      0|            }
  902|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (902:17): [True: 0, False: 0]
  ------------------
  903|      0|            {
  904|      0|                goto exit_function; /* nothing to do */
  905|      0|            }
  906|      0|        }
  907|    223|    }
  908|       |
  909|  1.13k|    if (pc2i->nNumTgRevrs == 1 && /* pc2i->nNumRemHInChI < 0 &&*/
  ------------------
  |  Branch (909:9): [True: 408, False: 730]
  ------------------
  910|    408|        ( pc2i->nNumEndpRevrs > pc2i->nNumEndpInChI || pc2i->nNumTgInChI > 1 ) /* ADP in Revrs */)
  ------------------
  |  Branch (910:11): [True: 200, False: 208]
  |  Branch (910:56): [True: 23, False: 185]
  ------------------
  911|    223|    {
  912|       |        /*--------------------------------------------------------------*/
  913|       |        /* case 03a:restored: -N(-)-AB=O    original:  -N=AB-O(-)       */
  914|       |        /* FixH:               0       0                0      0        */
  915|       |        /* MobH:               0       0                0      0        */
  916|       |        /* O = O, S, Se; N = N;                              taut       */
  917|       |        /* restored atoms are tautomeric; original atom is; N may be.   */
  918|       |        /* restored struct has 1 t-group; original has less endpoints   */
  919|       |        /*                                and possibly >1 t-groups      */
  920|       |        /* Solution: move (-) from N(-) to =O                           */
  921|       |        /*           these atoms are tautomeric in restored structure   */
  922|       |        /*--------------------------------------------------------------*/
  923|    223|        int num_SB_N_Minus = 0, num_DB_O = 0, iat;
  924|    223|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
  925|    223|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (925:41): [True: 223, False: 0]
  ------------------
  926|    223|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (926:41): [True: 223, False: 0]
  ------------------
  927|    223|        S_CHAR   *pnMobHInChI = ( pInChI[1] && pInChI[1]->nNum_H ) ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (927:35): [True: 223, False: 0]
  |  Branch (927:48): [True: 223, False: 0]
  ------------------
  928|    223|            ( pInChI[0] && pInChI[0]->nNum_H ) ? pInChI[0]->nNum_H : NULL;
  ------------------
  |  Branch (928:15): [True: 0, False: 0]
  |  Branch (928:28): [True: 0, False: 0]
  ------------------
  929|    223|        S_CHAR   *pnFixHInChI = pStruct->fixed_H;
  930|       |
  931|    223|        cur_success = 0;
  932|    223|        CurrEdges.num_edges = 0;
  933|       |
  934|  1.88k|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (934:21): [True: 1.65k, False: 223]
  ------------------
  935|  1.65k|        { /* i = canonical number - 1 */
  936|  1.65k|            iat = nCanon2AtnoRevrs[i];
  937|  1.65k|            if ( /* in restored atom N: charge=-1, no H, has no double bond, endpoint */
  938|  1.65k|                num_SB_N_Minus < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  3.31k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (938:17): [True: 1.65k, False: 0]
  ------------------
  939|  1.65k|                at2[iat].charge == -1 && /*!at2[iat].num_H &&*/
  ------------------
  |  Branch (939:17): [True: 323, False: 1.33k]
  ------------------
  940|    323|                at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (940:17): [True: 242, False: 81]
  |  Branch (940:68): [True: 235, False: 7]
  ------------------
  941|    235|                pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (941:17): [True: 71, False: 164]
  |  Branch (941:55): [True: 64, False: 7]
  ------------------
  942|     64|                at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint &&
  ------------------
  |  Branch (942:17): [True: 64, False: 0]
  |  Branch (942:38): [True: 51, False: 13]
  ------------------
  943|       |                /* in orig.InChI: may be an endpoint, has no H */
  944|       |                /* has (-) edge */
  945|     51|                (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (945:17): [True: 51, False: 0]
  |  Branch (945:61): [True: 51, False: 0]
  ------------------
  946|     51|            {
  947|     51|                iat_SB_N_Minus[num_SB_N_Minus++] = iat;
  948|     51|            }
  949|  1.60k|            else
  950|  1.60k|                if (num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  3.21k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (950:21): [True: 1.60k, False: 0]
  ------------------
  951|  1.60k|                    at2[iat].charge == 0 && /*!at2[iat].num_H &&*/
  ------------------
  |  Branch (951:21): [True: 1.06k, False: 538]
  ------------------
  952|  1.06k|                    at2[iat].valence + 1 == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (952:21): [True: 596, False: 473]
  |  Branch (952:76): [True: 576, False: 20]
  ------------------
  953|    576|                    pVA[iat].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (953:21): [True: 206, False: 370]
  ------------------
  954|    206|                    at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint && /* endpoint in Reconstructed */
  ------------------
  |  Branch (954:21): [True: 206, False: 0]
  |  Branch (954:42): [True: 140, False: 66]
  ------------------
  955|    140|                    (pStruct->endpoint[i] || /* endpoint or H(+) acceptor in original */
  ------------------
  |  Branch (955:22): [True: 34, False: 106]
  ------------------
  956|    106|                        (pnMobHInChI && pnMobHInChI[i] == 1 && pnFixHInChI && pnFixHInChI[i] == -1)) &&
  ------------------
  |  Branch (956:26): [True: 106, False: 0]
  |  Branch (956:41): [True: 5, False: 101]
  |  Branch (956:64): [True: 5, False: 0]
  |  Branch (956:79): [True: 2, False: 3]
  ------------------
  957|       |                    /* has (-) edge */
  958|     36|                    (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (958:21): [True: 36, False: 0]
  |  Branch (958:65): [True: 36, False: 0]
  ------------------
  959|     36|                {
  960|     36|                    iat_DB_O[num_DB_O++] = iat;
  961|     36|                    if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|     36|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (961:25): [True: 0, False: 36]
  ------------------
  962|      0|                    {
  963|      0|                        goto exit_function;
  964|      0|                    }
  965|     36|                }
  966|  1.65k|        }
  967|    223|        if ((num_try = inchi_min(num_SB_N_Minus, num_DB_O))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|    223|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 14, False: 209]
  |  |  ------------------
  ------------------
  |  Branch (967:13): [True: 22, False: 201]
  ------------------
  968|     22|        {
  969|       |            /* detected; attempt to fix */
  970|     22|            SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
  971|       |            /* allow charge transfer to all found =O */
  972|     22|            RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
  973|     22|            delta = 1;
  974|     44|            for (i = 0; i < num_SB_N_Minus && cur_success < num_try; i++)
  ------------------
  |  Branch (974:25): [True: 22, False: 22]
  |  Branch (974:47): [True: 22, False: 0]
  ------------------
  975|     22|            {
  976|     22|                iat = iat_SB_N_Minus[i];
  977|     22|                pe = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
  978|     22|                if (!pe->flow)
  ------------------
  |  Branch (978:21): [True: 0, False: 22]
  ------------------
  979|      0|                    continue;
  980|     22|                pv1 = pBNS->vert + (v1 = pe->neighbor1);
  981|     22|                pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
  982|       |
  983|     22|                pe->forbidden |= forbidden_edge_mask;
  984|     22|                pe->flow -= delta;
  985|     22|                pv1->st_edge.flow -= delta;
  986|     22|                pv2->st_edge.flow -= delta;
  987|     22|                pBNS->tot_st_flow -= 2 * delta;
  988|       |
  989|     22|                ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
  990|     22|                    &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
  991|       |
  992|     22|                if (ret == 1 && ((vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (992:21): [True: 21, False: 1]
  |  Branch (992:35): [True: 7, False: 14]
  |  Branch (992:53): [True: 7, False: 0]
  ------------------
  993|     20|                    (vPathEnd == v2 && vPathStart == v1)) && nDeltaCharge == 1) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (993:22): [True: 14, False: 0]
  |  Branch (993:40): [True: 13, False: 1]
  |  Branch (993:62): [True: 20, False: 0]
  ------------------
  994|     20|                {
  995|       |                    /* Added (-) charge to =O => nDeltaCharge == 1 */
  996|       |                    /* Flow change on pe (-)charge edge (atom -N(-)-) is not known to RunBnsTestOnce()) */
  997|     20|                    ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
  998|     20|                    if (ret > 0)
  ------------------
  |  Branch (998:25): [True: 20, False: 0]
  ------------------
  999|     20|                    {
 1000|     20|                        nNumRunBNS++;
 1001|     20|                        cur_success++; /* 03a */
 1002|     20|                    }
 1003|     20|                }
 1004|      2|                else
 1005|      2|                {
 1006|      2|                    pe->forbidden &= forbidden_edge_mask_inv;
 1007|      2|                    pe->flow += delta;
 1008|      2|                    pv1->st_edge.flow += delta;
 1009|      2|                    pv2->st_edge.flow += delta;
 1010|      2|                    pBNS->tot_st_flow += 2 * delta;
 1011|      2|                }
 1012|     22|                INCHI_HEAPCHK
 1013|     22|            }
 1014|     22|            RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 1015|     22|        }
 1016|    223|        CurrEdges.num_edges = 0; /* clear current edge list */
 1017|    223|        if (cur_success)
  ------------------
  |  Branch (1017:13): [True: 20, False: 203]
  ------------------
 1018|     20|        {
 1019|     20|            tot_succes += cur_success;
 1020|       |            /* recalculate InChI from the structure */
 1021|     20|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1021:17): [True: 1, False: 19]
  ------------------
 1022|     20|                ppt_group_info, ppat_norm, ppat_prep)))
 1023|      1|            {
 1024|      1|                goto exit_function;
 1025|      1|            }
 1026|     19|            if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1026:17): [True: 0, False: 19]
  ------------------
 1027|      0|            {
 1028|      0|                goto exit_function;
 1029|      0|            }
 1030|     19|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (1030:17): [True: 10, False: 9]
  |  Branch (1030:45): [True: 0, False: 10]
  ------------------
 1031|      0|            {
 1032|      0|                goto exit_function;  /* no fixed-H found */
 1033|      0|            }
 1034|     19|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1034:17): [True: 0, False: 19]
  ------------------
 1035|      0|            {
 1036|      0|                goto exit_function;
 1037|      0|            }
 1038|     19|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (1038:17): [True: 0, False: 19]
  ------------------
 1039|      0|            {
 1040|      0|                goto exit_function; /* nothing to do */
 1041|      0|            }
 1042|     19|        }
 1043|    223|    }
 1044|       |
 1045|  1.13k|    if (pc2i->len_c2at >= 1 && pc2i->nNumTgInChI == 1 && /* ADP in InChI */
  ------------------
  |  Branch (1045:9): [True: 1.13k, False: 3]
  |  Branch (1045:32): [True: 734, False: 400]
  ------------------
 1046|    734|        ( pc2i->nNumEndpRevrs < pc2i->nNumEndpInChI || pc2i->nNumTgRevrs > 1 ))
  ------------------
  |  Branch (1046:11): [True: 620, False: 114]
  |  Branch (1046:56): [True: 12, False: 102]
  ------------------
 1047|    632|    {
 1048|       |        /*--------------------------------------------------------------*/
 1049|       |        /* case 04: restored: OH(+)=AB-O- OH- orig.  HO-AB=O(+)- OH-    */
 1050|       |        /* FixH:               1       0   0          1      0   1      */
 1051|       |        /* MobH:               0       0   1          0      0   0      */
 1052|       |        /*                 non-taut.                taut        taut    */
 1053|       |        /*                                    ADP: one t-group or more endpoints */
 1054|       |        /* O(+) = N, P, As, As, O, S, Se; OH = N, O, S, Se, Te          */
 1055|       |        /* Solution: move (+) from O(+) to NH2                          */
 1056|       |        /*--------------------------------------------------------------*/
 1057|    632|        int num_SB_Neutr = 0, num_DB_Charged = 0, iat;
 1058|    632|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 1059|    632|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (1059:32): [True: 632, False: 0]
  |  Branch (1059:45): [True: 632, False: 0]
  ------------------
 1060|    632|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (1060:13): [True: 0, False: 0]
  |  Branch (1060:26): [True: 0, False: 0]
  ------------------
 1061|    632|        cur_success = 0;
 1062|       |
 1063|  5.50k|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (1063:21): [True: 4.87k, False: 632]
  ------------------
 1064|  4.87k|        { /* i = canonical number - 1 */
 1065|  4.87k|            iat = nCanon2AtnoRevrs[i];
 1066|  4.87k|            if ( /* in restored atom: charge=+1, has H, has double bond, N, O, S, Se, Te */
 1067|  4.87k|                num_DB_Charged < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  9.74k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (1067:17): [True: 4.87k, False: 0]
  ------------------
 1068|  4.87k|                at2[iat].charge == 1 && at2[iat].num_H &&
  ------------------
  |  Branch (1068:17): [True: 778, False: 4.09k]
  |  Branch (1068:41): [True: 209, False: 569]
  ------------------
 1069|    209|                at2[iat].valence < at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (1069:17): [True: 186, False: 23]
  |  Branch (1069:67): [True: 183, False: 3]
  ------------------
 1070|    183|                (pVA[iat].cNumValenceElectrons == 6 ||
  ------------------
  |  Branch (1070:18): [True: 122, False: 61]
  ------------------
 1071|     61|                    (pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1)) &&
  ------------------
  |  Branch (1071:22): [True: 50, False: 11]
  |  Branch (1071:60): [True: 49, False: 1]
  ------------------
 1072|       |                /* in orig.InChI: an endpoint, has fixed-H */
 1073|    171|                pStruct->endpoint[i] &&
  ------------------
  |  Branch (1073:17): [True: 79, False: 92]
  ------------------
 1074|     79|                (pStruct->fixed_H && pStruct->fixed_H[i]) &&
  ------------------
  |  Branch (1074:18): [True: 79, False: 0]
  |  Branch (1074:38): [True: 74, False: 5]
  ------------------
 1075|       |                /*!(nMobHInChI && nMobHInChI[i] ) &&*/
 1076|       |                /* has (+) edge */
 1077|     74|                (e = pVA[iat].nCPlusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1077:17): [True: 74, False: 0]
  |  Branch (1077:60): [True: 70, False: 4]
  ------------------
 1078|     70|            {
 1079|       |
 1080|     70|                iat_DB_Charged[num_DB_Charged++] = iat;
 1081|       |
 1082|     70|                if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|     70|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1082:21): [True: 0, False: 70]
  ------------------
 1083|      0|                {
 1084|      0|                    goto exit_function;
 1085|      0|                }
 1086|     70|            }
 1087|  4.80k|            else
 1088|  4.80k|            {
 1089|  4.80k|                if ( /* in restored atom: charge=0, has no H, has no double bond, N, P, O, S, Se, Te */
 1090|  4.80k|                    num_SB_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  9.60k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (1090:21): [True: 4.80k, False: 0]
  ------------------
 1091|  4.80k|                    at2[iat].charge == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (1091:21): [True: 3.24k, False: 1.55k]
  |  Branch (1091:45): [True: 2.87k, False: 373]
  ------------------
 1092|  2.87k|                    at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (1092:21): [True: 860, False: 2.01k]
  |  Branch (1092:72): [True: 665, False: 195]
  ------------------
 1093|    665|                    (pVA[iat].cNumValenceElectrons == 6 ||
  ------------------
  |  Branch (1093:22): [True: 231, False: 434]
  ------------------
 1094|    434|                        pVA[iat].cNumValenceElectrons == 5) &&
  ------------------
  |  Branch (1094:25): [True: 191, False: 243]
  ------------------
 1095|       |                    /* in orig.InChI: an endpoint, has fixed-H */
 1096|       |                    /* pStruct->endpoint[i] && */
 1097|    422|                    !(pStruct->fixed_H && pStruct->fixed_H[i]) &&
  ------------------
  |  Branch (1097:23): [True: 422, False: 0]
  |  Branch (1097:43): [True: 4, False: 418]
  ------------------
 1098|    418|                    !(nMobHInChI && nMobHInChI[i]) &&
  ------------------
  |  Branch (1098:23): [True: 418, False: 0]
  |  Branch (1098:37): [True: 0, False: 418]
  ------------------
 1099|       |                    /* has (+) edge */
 1100|    418|                    (e = pVA[iat].nCPlusGroupEdge - 1) >= 0 &&
  ------------------
  |  Branch (1100:21): [True: 369, False: 49]
  ------------------
 1101|    369|                    0 == pBNS->edge[e].forbidden)
  ------------------
  |  Branch (1101:21): [True: 369, False: 0]
  ------------------
 1102|    369|                {
 1103|       |
 1104|    369|                    iat_SB_Neutr[num_SB_Neutr++] = iat;
 1105|       |
 1106|    369|                    if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    369|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1106:25): [True: 0, False: 369]
  ------------------
 1107|      0|                    {
 1108|      0|                        goto exit_function;
 1109|      0|                    }
 1110|    369|                }
 1111|  4.80k|            }
 1112|  4.87k|        }
 1113|    632|        if ((num_try = inchi_min(num_SB_Neutr, num_DB_Charged))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|    632|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 19, False: 613]
  |  |  ------------------
  ------------------
  |  Branch (1113:13): [True: 50, False: 582]
  ------------------
 1114|     50|        {
 1115|       |            /* detected; attempt to fix */
 1116|     50|            SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 1117|     50|            RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
 1118|     50|            delta = 1;
 1119|    112|            for (i = 0; i < num_SB_Neutr && cur_success < num_try; i++)
  ------------------
  |  Branch (1119:25): [True: 68, False: 44]
  |  Branch (1119:45): [True: 62, False: 6]
  ------------------
 1120|     62|            {
 1121|     62|                iat = iat_SB_Neutr[i];
 1122|     62|                pe = pBNS->edge + pVA[iat].nCPlusGroupEdge - 1;
 1123|     62|                if (!pe->flow)
  ------------------
  |  Branch (1123:21): [True: 0, False: 62]
  ------------------
 1124|      0|                    continue;
 1125|     62|                pv1 = pBNS->vert + (v1 = pe->neighbor1);
 1126|     62|                pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
 1127|       |
 1128|     62|                pe->forbidden |= forbidden_edge_mask;
 1129|     62|                pe->flow -= delta;
 1130|     62|                pv1->st_edge.flow -= delta;
 1131|     62|                pv2->st_edge.flow -= delta;
 1132|     62|                pBNS->tot_st_flow -= 2 * delta;
 1133|       |
 1134|     62|                ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 1135|     62|                    &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 1136|       |
 1137|     62|                if (ret == 1 && ((vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (1137:21): [True: 48, False: 14]
  |  Branch (1137:35): [True: 3, False: 45]
  |  Branch (1137:53): [True: 1, False: 2]
  ------------------
 1138|     47|                    (vPathEnd == v2 && vPathStart == v1)) && nDeltaCharge == -1) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (1138:22): [True: 43, False: 4]
  |  Branch (1138:40): [True: 36, False: 7]
  |  Branch (1138:62): [True: 37, False: 0]
  ------------------
 1139|     37|                {
 1140|       |                    /* Removed charge from O(+) => nDeltaCharge == -1 */
 1141|       |                    /* Flow change on pe (+)charge edge (atom NH2) is not known to RunBnsTestOnce()) */
 1142|     37|                    ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
 1143|     37|                    if (ret > 0)
  ------------------
  |  Branch (1143:25): [True: 37, False: 0]
  ------------------
 1144|     37|                    {
 1145|     37|                        nNumRunBNS++;
 1146|     37|                        cur_success++; /* 04 */
 1147|     37|                    }
 1148|     37|                }
 1149|     25|                else
 1150|     25|                {
 1151|     25|                    pe->forbidden &= forbidden_edge_mask_inv;
 1152|     25|                    pe->flow += delta;
 1153|     25|                    pv1->st_edge.flow += delta;
 1154|     25|                    pv2->st_edge.flow += delta;
 1155|     25|                    pBNS->tot_st_flow += 2 * delta;
 1156|     25|                }
 1157|     62|                INCHI_HEAPCHK
 1158|     62|            }
 1159|     50|            RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 1160|     50|        }
 1161|    632|        CurrEdges.num_edges = 0; /* clear current edge list */
 1162|    632|        if (cur_success)
  ------------------
  |  Branch (1162:13): [True: 37, False: 595]
  ------------------
 1163|     37|        {
 1164|     37|            tot_succes += cur_success;
 1165|       |            /* recalculate InChI from the structure */
 1166|     37|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1166:17): [True: 0, False: 37]
  ------------------
 1167|     37|                ppt_group_info, ppat_norm, ppat_prep)))
 1168|      0|            {
 1169|      0|                goto exit_function;
 1170|      0|            }
 1171|     37|            if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1171:17): [True: 0, False: 37]
  ------------------
 1172|      0|            {
 1173|      0|                goto exit_function;
 1174|      0|            }
 1175|     37|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (1175:17): [True: 0, False: 37]
  |  Branch (1175:45): [True: 0, False: 0]
  ------------------
 1176|      0|            {
 1177|      0|                goto exit_function;  /* no fixed-H found */
 1178|      0|            }
 1179|     37|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1179:17): [True: 0, False: 37]
  ------------------
 1180|      0|            {
 1181|      0|                goto exit_function;
 1182|      0|            }
 1183|     37|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (1183:17): [True: 0, False: 37]
  ------------------
 1184|      0|            {
 1185|      0|                goto exit_function; /* nothing to do */
 1186|      0|            }
 1187|     37|        }
 1188|    632|    }
 1189|       |
 1190|  1.13k|    if (pc2i->len_c2at > 1)
  ------------------
  |  Branch (1190:9): [True: 1.01k, False: 121]
  ------------------
 1191|  1.01k|    {
 1192|       |        /*--------------------------------------------------------------*/
 1193|       |        /* case 05: restored:  O=AB-NH      original:(-)O-AB=NH(+)      */
 1194|       |        /* FixH:               0     0                 -1     1         */
 1195|       |        /* MobH:               0     1                  1     0         */
 1196|       |        /* O = O, S, Se; N = N, O, S, Se, Te; all atoms not tautomeric  */
 1197|       |        /* Solution: Separate charges                                   */
 1198|       |        /*--------------------------------------------------------------*/
 1199|  1.01k|        int num_DB_O = 0, num_SB_NH = 0, iat;
 1200|  1.01k|        cur_success = 0;
 1201|       |
 1202|  4.49k|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (1202:21): [True: 3.47k, False: 1.01k]
  ------------------
 1203|  3.47k|        {
 1204|  3.47k|            iat = pc2i->c2at[i].atomNumber;
 1205|  3.47k|            if ( /* orig. InChI info: =NH2(+), =OH(+) */
 1206|  3.47k|                num_SB_NH < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  6.95k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (1206:17): [True: 3.47k, False: 0]
  ------------------
 1207|  3.47k|                ((pc2i->c2at[i].nValElectr == 5 && pc2i->c2at[i].nPeriodNum == 1) ||
  ------------------
  |  Branch (1207:19): [True: 1.24k, False: 2.23k]
  |  Branch (1207:52): [True: 1.07k, False: 169]
  ------------------
 1208|  2.40k|                    pc2i->c2at[i].nValElectr == 6) /* N, O, S, Se, Te */ &&
  ------------------
  |  Branch (1208:21): [True: 1.74k, False: 661]
  ------------------
 1209|  2.81k|                !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (1209:17): [True: 1.61k, False: 1.20k]
  ------------------
 1210|  1.61k|                (e = pVA[iat].nCPlusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (1210:17): [True: 1.46k, False: 148]
  |  Branch (1210:60): [True: 1.41k, False: 44]
  ------------------
 1211|  1.41k|                pc2i->c2at[i].nFixHInChI == 1 && /*pc2i->c2at[i].nMobHInChI ==  1 &&*/
  ------------------
  |  Branch (1211:17): [True: 433, False: 985]
  ------------------
 1212|       |                /* reversed structure info: */
 1213|    433|                pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs &&
  ------------------
  |  Branch (1213:17): [True: 246, False: 187]
  |  Branch (1213:50): [True: 240, False: 6]
  ------------------
 1214|    240|                pc2i->c2at[i].nAtChargeRevrs == 0 && at2[iat].num_H &&
  ------------------
  |  Branch (1214:17): [True: 151, False: 89]
  |  Branch (1214:54): [True: 151, False: 0]
  ------------------
 1215|    151|                !pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (1215:17): [True: 151, False: 0]
  ------------------
 1216|    151|                at2[iat].valence == at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (1216:17): [True: 131, False: 20]
  ------------------
 1217|    131|            {
 1218|    131|                iat_SB_NH[num_SB_NH++] = iat;
 1219|    131|                if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    131|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1219:21): [True: 0, False: 131]
  ------------------
 1220|      0|                {
 1221|      0|                    goto exit_function;
 1222|      0|                }
 1223|    131|            }
 1224|  3.34k|            else
 1225|  3.34k|            {
 1226|  3.34k|                if ( /* orig. InChI info: -O(-) */
 1227|  3.34k|                    num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  6.69k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (1227:21): [True: 3.34k, False: 0]
  ------------------
 1228|  3.34k|                    (pc2i->c2at[i].nValElectr == 6) /* O, S, Se, Te */ &&
  ------------------
  |  Branch (1228:21): [True: 1.65k, False: 1.69k]
  ------------------
 1229|  1.65k|                    !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (1229:21): [True: 911, False: 742]
  ------------------
 1230|    911|                    (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (1230:21): [True: 569, False: 342]
  |  Branch (1230:65): [True: 569, False: 0]
  ------------------
 1231|    569|                    pc2i->c2at[i].nFixHInChI == -1 && pc2i->c2at[i].nMobHInChI == 1 &&
  ------------------
  |  Branch (1231:21): [True: 47, False: 522]
  |  Branch (1231:55): [True: 23, False: 24]
  ------------------
 1232|       |                    /* reversed structure info: */
 1233|     23|                    pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs == 0 &&
  ------------------
  |  Branch (1233:21): [True: 23, False: 0]
  |  Branch (1233:54): [True: 23, False: 0]
  ------------------
 1234|     23|                    pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (1234:21): [True: 16, False: 7]
  |  Branch (1234:58): [True: 16, False: 0]
  ------------------
 1235|     16|                    !pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (1235:21): [True: 15, False: 1]
  ------------------
 1236|     15|                    at2[iat].valence + 1 == at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (1236:21): [True: 13, False: 2]
  ------------------
 1237|     13|                {
 1238|     13|                    iat_DB_O[num_DB_O++] = iat;
 1239|     13|                    if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|     13|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1239:25): [True: 0, False: 13]
  ------------------
 1240|      0|                    {
 1241|      0|                        goto exit_function;
 1242|      0|                    }
 1243|     13|                }
 1244|  3.34k|            }
 1245|  3.47k|        }
 1246|  1.01k|        if ((num_try = inchi_min(num_DB_O, num_SB_NH))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|  1.01k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 114, False: 902]
  |  |  ------------------
  ------------------
  |  Branch (1246:13): [True: 9, False: 1.00k]
  ------------------
 1247|      9|        {
 1248|       |            /* detected; attempt to fix */
 1249|      9|            SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 1250|      9|            RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
 1251|      9|            delta = 1;
 1252|     18|            for (i = 0; i < num_SB_NH && cur_success < num_try; i++)
  ------------------
  |  Branch (1252:25): [True: 9, False: 9]
  |  Branch (1252:42): [True: 9, False: 0]
  ------------------
 1253|      9|            {
 1254|      9|                iat = iat_SB_NH[i];
 1255|      9|                pe = pBNS->edge + pVA[iat].nCPlusGroupEdge - 1;
 1256|      9|                if (!pe->flow)
  ------------------
  |  Branch (1256:21): [True: 0, False: 9]
  ------------------
 1257|      0|                    continue;
 1258|      9|                pv1 = pBNS->vert + (v1 = pe->neighbor1);
 1259|      9|                pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
 1260|       |
 1261|      9|                pe->forbidden |= forbidden_edge_mask;
 1262|      9|                pe->flow -= delta;
 1263|      9|                pv1->st_edge.flow -= delta;
 1264|      9|                pv2->st_edge.flow -= delta;
 1265|      9|                pBNS->tot_st_flow -= 2 * delta;
 1266|       |
 1267|      9|                ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 1268|      9|                    &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 1269|       |
 1270|      9|                if (ret == 1 && ((vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (1270:21): [True: 8, False: 1]
  |  Branch (1270:35): [True: 2, False: 6]
  |  Branch (1270:53): [True: 1, False: 1]
  ------------------
 1271|      7|                    (vPathEnd == v2 && vPathStart == v1)) && nDeltaCharge == 1) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (1271:22): [True: 6, False: 1]
  |  Branch (1271:40): [True: 5, False: 1]
  |  Branch (1271:62): [True: 6, False: 0]
  ------------------
 1272|      6|                {
 1273|       |                    /* Added charge to =O => nDeltaCharge == 1 */
 1274|       |                    /* Flow change on pe (+)charge edge (atom NH2) is not known to RunBnsTestOnce()) */
 1275|      6|                    ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
 1276|      6|                    if (ret > 0)
  ------------------
  |  Branch (1276:25): [True: 6, False: 0]
  ------------------
 1277|      6|                    {
 1278|      6|                        nNumRunBNS++;
 1279|      6|                        cur_success++; /* 05 */
 1280|      6|                    }
 1281|      6|                }
 1282|      3|                else
 1283|      3|                {
 1284|      3|                    pe->forbidden &= forbidden_edge_mask_inv;
 1285|      3|                    pe->flow += delta;
 1286|      3|                    pv1->st_edge.flow += delta;
 1287|      3|                    pv2->st_edge.flow += delta;
 1288|      3|                    pBNS->tot_st_flow += 2 * delta;
 1289|      3|                }
 1290|      9|                INCHI_HEAPCHK
 1291|      9|            }
 1292|      9|            RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 1293|      9|        }
 1294|  1.01k|        CurrEdges.num_edges = 0; /* clear current edge list */
 1295|  1.01k|        if (cur_success)
  ------------------
  |  Branch (1295:13): [True: 6, False: 1.01k]
  ------------------
 1296|      6|        {
 1297|      6|            tot_succes += cur_success;
 1298|       |            /* recalculate InChI from the structure */
 1299|      6|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1299:17): [True: 0, False: 6]
  ------------------
 1300|      6|                ppt_group_info, ppat_norm, ppat_prep)))
 1301|      0|            {
 1302|      0|                goto exit_function;
 1303|      0|            }
 1304|      6|            if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1304:17): [True: 0, False: 6]
  ------------------
 1305|      0|            {
 1306|      0|                goto exit_function;
 1307|      0|            }
 1308|      6|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (1308:17): [True: 0, False: 6]
  |  Branch (1308:45): [True: 0, False: 0]
  ------------------
 1309|      0|            {
 1310|      0|                goto exit_function;  /* no fixed-H found */
 1311|      0|            }
 1312|      6|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1312:17): [True: 0, False: 6]
  ------------------
 1313|      0|            {
 1314|      0|                goto exit_function;
 1315|      0|            }
 1316|      6|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (1316:17): [True: 1, False: 5]
  ------------------
 1317|      1|            {
 1318|      1|                goto exit_function; /* nothing to do */
 1319|      1|            }
 1320|      6|        }
 1321|  1.01k|    }
 1322|       |
 1323|  1.13k|    if (pStruct->fixed_H && pStruct->endpoint && pc2i->nChargeFixHInChI > 0 && pc2i->nChargeFixHInChI > pc2i->nChargeMobHInChI)
  ------------------
  |  Branch (1323:9): [True: 1.13k, False: 0]
  |  Branch (1323:29): [True: 1.13k, False: 0]
  |  Branch (1323:50): [True: 1, False: 1.13k]
  |  Branch (1323:80): [True: 0, False: 1]
  ------------------
 1324|      0|    {
 1325|       |        /*----------------------------------------------------------*/
 1326|       |        /* case 06c: restored -NH- or -NH(+)  orig: -NH-            */
 1327|       |        /*  Fixed-H            1       1             0              */
 1328|       |        /*  Mobile-H           0       0             1              */
 1329|       |        /*                     not tautomeric    not tautomeric     */
 1330|       |        /*           has adjacent (+)                               */
 1331|       |        /*           charges                                        */
 1332|       |        /*  Solution: move (+) charges to the -NH- unless it already*/
 1333|       |        /*            N = N, O, S, Se, Te                           */
 1334|       |        /*            has (+) charge blocked by adjacent (+)        */
 1335|       |        /*----------------------------------------------------------*/
 1336|      0|        int iat;
 1337|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 1338|       |        /*
 1339|       |        inp_ATOM *at_Mobile_H_Revrs = (pStruct->pOne_norm_data[1] &&
 1340|       |        pStruct->pOne_norm_data[1]->at)? pStruct->pOne_norm_data[1]->at : NULL;
 1341|       |        inp_ATOM *atfMobile_H_Revrs = pStruct->pOne_norm_data[TAUT_YES] &&
 1342|       |        pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds?
 1343|       |        pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds : NULL;
 1344|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 1345|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : NULL;
 1346|       |        */
 1347|      0|        EDGE_LIST CurChargeEdges;
 1348|      0|        EdgeIndex e2;
 1349|      0|        cur_success = 0;
 1350|      0|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|      0|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 1351|      0|        CurrEdges.num_edges = 0;
 1352|      0|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (1352:21): [True: 0, False: 0]
  ------------------
 1353|      0|        {
 1354|       |            /* atoms -NH- from which H(+) were removed by the Normalization in orig. InChI */
 1355|      0|            iat = pc2i->c2at[i].atomNumber;
 1356|      0|            if (( pc2i->c2at[i].nValElectr == 6 ||
  ------------------
  |  Branch (1356:19): [True: 0, False: 0]
  ------------------
 1357|      0|                  (pc2i->c2at[i].nValElectr == 5 && pc2i->c2at[i].nPeriodNum == 1) ) &&
  ------------------
  |  Branch (1357:20): [True: 0, False: 0]
  |  Branch (1357:53): [True: 0, False: 0]
  ------------------
 1358|      0|                 !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (1358:18): [True: 0, False: 0]
  ------------------
 1359|      0|                 ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1359:18): [True: 0, False: 0]
  |  Branch (1359:63): [True: 0, False: 0]
  ------------------
 1360|      0|            {
 1361|      0|                if ( /* orig. InChI info: -NH- */
 1362|      0|                     pc2i->c2at[i].nFixHInChI == 1 && pc2i->c2at[i].nMobHInChI == 0 &&
  ------------------
  |  Branch (1362:22): [True: 0, False: 0]
  |  Branch (1362:55): [True: 0, False: 0]
  ------------------
 1363|       |                     /* reversed structure info: */
 1364|      0|                     pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs == 1 && /* was not removed */
  ------------------
  |  Branch (1364:22): [True: 0, False: 0]
  |  Branch (1364:55): [True: 0, False: 0]
  ------------------
 1365|      0|                     /*pc2i->c2at[i].nAtChargeRevrs == 0 &&*/ at2[iat].num_H && /* at2 is Fixed-H */
  ------------------
  |  Branch (1365:63): [True: 0, False: 0]
  ------------------
 1366|      0|                     at2[iat].valence == at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (1366:22): [True: 0, False: 0]
  ------------------
 1367|      0|                {
 1368|      0|                    if ((ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1368:25): [True: 0, False: 0]
  ------------------
 1369|      0|                    {
 1370|      0|                        goto exit_function;
 1371|      0|                    }
 1372|      0|                }
 1373|      0|            }
 1374|      0|        }
 1375|      0|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (1375:21): [True: 0, False: 0]
  ------------------
 1376|      0|        {
 1377|       |            /* find adjacent charged atoms */
 1378|      0|            iat = nCanon2AtnoRevrs[i];
 1379|      0|            if (pStruct->endpoint[i] || at2[iat].charge != 1 || at2[iat].radical || pVA[iat].cMetal)
  ------------------
  |  Branch (1379:17): [True: 0, False: 0]
  |  Branch (1379:41): [True: 0, False: 0]
  |  Branch (1379:65): [True: 0, False: 0]
  |  Branch (1379:85): [True: 0, False: 0]
  ------------------
 1380|      0|            {
 1381|      0|                continue;
 1382|      0|            }
 1383|      0|            if (0 <= ( e = pVA[iat].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden && !pBNS->edge[e].flow && pVA[iat].cNumValenceElectrons >= 5)
  ------------------
  |  Branch (1383:17): [True: 0, False: 0]
  |  Branch (1383:62): [True: 0, False: 0]
  |  Branch (1383:90): [True: 0, False: 0]
  |  Branch (1383:113): [True: 0, False: 0]
  ------------------
 1384|      0|            {
 1385|       |                /* positively charged atom */
 1386|      0|                for (j = 0; j < at2[iat].valence; j++)
  ------------------
  |  Branch (1386:29): [True: 0, False: 0]
  ------------------
 1387|      0|                {
 1388|      0|                    if (at2[k = (int) at2[iat].neighbor[j]].charge == 1 && !pVA[k].cMetal &&
  ------------------
  |  Branch (1388:25): [True: 0, False: 0]
  |  Branch (1388:76): [True: 0, False: 0]
  ------------------
 1389|      0|                         0 <= ( e2 = pVA[k].nCPlusGroupEdge - 1 ) && !pBNS->edge[e2].forbidden && !pBNS->edge[e2].flow)
  ------------------
  |  Branch (1389:26): [True: 0, False: 0]
  |  Branch (1389:70): [True: 0, False: 0]
  |  Branch (1389:99): [True: 0, False: 0]
  ------------------
 1390|      0|                    {
 1391|      0|                        if (0 > FindInEdgeList( &CurrEdges, e ) &&
  ------------------
  |  Branch (1391:29): [True: 0, False: 0]
  ------------------
 1392|      0|                             0 > FindInEdgeList( &CurChargeEdges, e ) &&
  ------------------
  |  Branch (1392:30): [True: 0, False: 0]
  ------------------
 1393|      0|                             ( ret = AddToEdgeList( &CurChargeEdges, e, INC_ADD_EDGE ) ))
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1393:30): [True: 0, False: 0]
  ------------------
 1394|      0|                        {
 1395|      0|                            goto exit_case_06c;
 1396|      0|                        }
 1397|      0|                        if (0 > FindInEdgeList( &CurrEdges, e2 ) &&
  ------------------
  |  Branch (1397:29): [True: 0, False: 0]
  ------------------
 1398|      0|                             0 > FindInEdgeList( &CurChargeEdges, e2 ) &&
  ------------------
  |  Branch (1398:30): [True: 0, False: 0]
  ------------------
 1399|      0|                             ( ret = AddToEdgeList( &CurChargeEdges, e2, INC_ADD_EDGE ) ))
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1399:30): [True: 0, False: 0]
  ------------------
 1400|      0|                        {
 1401|      0|                            goto exit_case_06c;
 1402|      0|                        }
 1403|      0|                    }
 1404|      0|                }
 1405|      0|            }
 1406|      0|        }
 1407|      0|        if ((num_try = inchi_min( CurrEdges.num_edges, CurChargeEdges.num_edges ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1407:13): [True: 0, False: 0]
  ------------------
 1408|      0|        {
 1409|       |            /* detected; attempt to fix */
 1410|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1411|      0|            RemoveForbiddenEdgeMask( pBNS, &CurChargeEdges, forbidden_edge_mask );
 1412|      0|            delta = 1;
 1413|      0|            for (i = 0; i < CurrEdges.num_edges && cur_success < num_try; i++)
  ------------------
  |  Branch (1413:25): [True: 0, False: 0]
  |  Branch (1413:52): [True: 0, False: 0]
  ------------------
 1414|      0|            {
 1415|      0|                e = CurrEdges.pnEdges[i];
 1416|      0|                pe = pBNS->edge + e; /* (+)charge edge of -NH- or -OH */
 1417|      0|                if (!pe->flow)
  ------------------
  |  Branch (1417:21): [True: 0, False: 0]
  ------------------
 1418|      0|                    continue;
 1419|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 1420|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 1421|       |
 1422|      0|                pe->flow -= delta; /* add (+) to -NHm */
 1423|      0|                pv1->st_edge.flow -= delta;
 1424|      0|                pv2->st_edge.flow -= delta;
 1425|      0|                pBNS->tot_st_flow -= 2 * delta;
 1426|       |
 1427|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 1428|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 1429|       |
 1430|      0|                if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (1430:21): [True: 0, False: 0]
  |  Branch (1430:36): [True: 0, False: 0]
  |  Branch (1430:54): [True: 0, False: 0]
  ------------------
 1431|      0|                                  (vPathEnd == v2 && vPathStart == v1) ) && nDeltaCharge == -1) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1431:36): [True: 0, False: 0]
  |  Branch (1431:54): [True: 0, False: 0]
  |  Branch (1431:77): [True: 0, False: 0]
  ------------------
 1432|      0|                {
 1433|       |                    /* Removed (+)charge from -NH- => nDeltaCharge == -1 */
 1434|       |                    /* Flow change on pe (+)charge edge (atom NHm(+)) is not known to RunBnsTestOnce()) */
 1435|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 1436|      0|                    if (ret > 0)
  ------------------
  |  Branch (1436:25): [True: 0, False: 0]
  ------------------
 1437|      0|                    {
 1438|      0|                        nNumRunBNS++;
 1439|      0|                        cur_success++; /* 06c */
 1440|      0|                    }
 1441|      0|                }
 1442|      0|                else
 1443|      0|                {
 1444|      0|                    pe->flow += delta;
 1445|      0|                    pv1->st_edge.flow += delta;
 1446|      0|                    pv2->st_edge.flow += delta;
 1447|      0|                    pBNS->tot_st_flow += 2 * delta;
 1448|      0|                }
 1449|      0|                INCHI_HEAPCHK
 1450|      0|            }
 1451|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1452|      0|        }
 1453|      0|    exit_case_06c:
 1454|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 1455|      0|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 1456|      0|        if (ret < 0)
  ------------------
  |  Branch (1456:13): [True: 0, False: 0]
  ------------------
 1457|      0|        {
 1458|      0|            goto exit_function;
 1459|      0|        }
 1460|      0|        if (cur_success)
  ------------------
  |  Branch (1460:13): [True: 0, False: 0]
  ------------------
 1461|      0|        {
 1462|      0|            tot_succes += cur_success;
 1463|       |            /* recalculate InChI from the structure */
 1464|      0|            if (0 >( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1464:17): [True: 0, False: 0]
  ------------------
 1465|      0|                                                           ppt_group_info, ppat_norm, ppat_prep ) ))
 1466|      0|            {
 1467|      0|                goto exit_function;
 1468|      0|            }
 1469|      0|            if ((ret = FillOutExtraFixedHDataRestr( pStruct ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1469:17): [True: 0, False: 0]
  ------------------
 1470|      0|            {
 1471|      0|                goto exit_function;
 1472|      0|            }
 1473|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (1473:17): [True: 0, False: 0]
  |  Branch (1473:45): [True: 0, False: 0]
  ------------------
 1474|      0|            {
 1475|      0|                goto exit_function;  /* no fixed-H found */
 1476|      0|            }
 1477|      0|            if ((ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1477:17): [True: 0, False: 0]
  ------------------
 1478|      0|            {
 1479|      0|                goto exit_function;
 1480|      0|            }
 1481|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (1481:17): [True: 0, False: 0]
  ------------------
 1482|      0|            {
 1483|      0|                goto exit_function; /* nothing to do */
 1484|      0|            }
 1485|      0|        }
 1486|      0|    }
 1487|       |
 1488|  1.13k|    if (pc2i->len_c2at >= 2)
  ------------------
  |  Branch (1488:9): [True: 1.01k, False: 123]
  ------------------
 1489|  1.01k|    {
 1490|       |        /*------------------------------------------------------------*/
 1491|       |        /* case 06d: restored: XH(+)=-AB-NH    orig.: XH-=AB=NH(+)    */
 1492|       |        /* FixH:                1       1 0          0 1      1       */
 1493|       |        /* MobH:                0    taut 1          1 taut   0       */
 1494|       |        /*                                                            */
 1495|       |        /*                                                            */
 1496|       |        /* N  = N, O, S, Se; atoms N are not tautomeric in orig InChI */
 1497|       |        /* X  = N, O, S, Se, Te, F, Cl, Br, I; atom X is non-taut     */
 1498|       |        /* Solution: move (+) from X  to NH                           */
 1499|       |        /*------------------------------------------------------------*/
 1500|  1.01k|        int iat;
 1501|       |        /*
 1502|       |        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 1503|       |        inp_ATOM *at_Mobile_H_Revrs = (pStruct->pOne_norm_data[1] &&
 1504|       |        pStruct->pOne_norm_data[1]->at)? pStruct->pOne_norm_data[1]->at : NULL;
 1505|       |        inp_ATOM *atfMobile_H_Revrs = pStruct->pOne_norm_data[TAUT_YES] &&
 1506|       |        pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds?
 1507|       |        pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds :
 1508|       |        pStruct->pOne_norm_data[TAUT_NON]->at;
 1509|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 1510|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 1511|       |        */
 1512|  1.01k|        EDGE_LIST CurChargeEdges;
 1513|  1.01k|        cur_success = 0;
 1514|  1.01k|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|  1.01k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 1515|  1.01k|        CurrEdges.num_edges = 0;
 1516|  4.48k|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (1516:21): [True: 3.47k, False: 1.01k]
  ------------------
 1517|  3.47k|        {
 1518|  3.47k|            iat = pc2i->c2at[i].atomNumber;
 1519|       |            /* XH(+) */
 1520|  3.47k|            if ( /* reconstructed: non-taut and (+) */
 1521|  3.47k|                ( pc2i->c2at[i].nMobHRevrs + 1 == pc2i->c2at[i].nFixHRevrs &&
  ------------------
  |  Branch (1521:19): [True: 676, False: 2.79k]
  ------------------
 1522|    676|                  pc2i->c2at[i].nFixHRevrs > 0 && !pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (1522:19): [True: 286, False: 390]
  |  Branch (1522:51): [True: 41, False: 245]
  ------------------
 1523|     41|                  pc2i->c2at[i].nAtChargeRevrs == 1 &&
  ------------------
  |  Branch (1523:19): [True: 37, False: 4]
  ------------------
 1524|       |                  /* original InChI: non-taut & has H or an endpoint, has Fixed H */
 1525|     37|                  ( (!pc2i->c2at[i].nFixHInChI && pc2i->c2at[i].nMobHInChI == pc2i->c2at[i].nFixHRevrs) ||
  ------------------
  |  Branch (1525:22): [True: 19, False: 18]
  |  Branch (1525:51): [True: 19, False: 0]
  ------------------
 1526|     18|                    (pc2i->c2at[i].nFixHInChI == pc2i->c2at[i].nFixHRevrs && pc2i->c2at[i].endptInChI) ) ) &&
  ------------------
  |  Branch (1526:22): [True: 18, False: 0]
  |  Branch (1526:78): [True: 18, False: 0]
  ------------------
 1527|     37|                 0 <= ( e = pVA[iat].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden && !pBNS->edge[e].flow) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (1527:18): [True: 37, False: 0]
  |  Branch (1527:63): [True: 28, False: 9]
  |  Branch (1527:91): [True: 28, False: 0]
  ------------------
 1528|     28|            {
 1529|       |
 1530|     28|                if ((ret = AddToEdgeList( &CurChargeEdges, e, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|     28|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1530:21): [True: 0, False: 28]
  ------------------
 1531|      0|                {
 1532|      0|                    goto exit_case_06d;
 1533|      0|                }
 1534|     28|            }
 1535|  3.44k|            else
 1536|  3.44k|            {
 1537|       |                /* -NH- */
 1538|  3.44k|                if ( /* original InChI: has H and is not an endpoint */
 1539|  3.44k|                    ( pc2i->c2at[i].nMobHInChI + 1 == pc2i->c2at[i].nFixHInChI &&
  ------------------
  |  Branch (1539:23): [True: 660, False: 2.78k]
  ------------------
 1540|    660|                      pc2i->c2at[i].nFixHInChI > 0 && !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (1540:23): [True: 660, False: 0]
  |  Branch (1540:55): [True: 513, False: 147]
  ------------------
 1541|    513|                      pc2i->c2at[i].nAtChargeRevrs == 0 &&
  ------------------
  |  Branch (1541:23): [True: 367, False: 146]
  ------------------
 1542|       |                      /* reconstructed InChI: non-taut & has H or an endpoint, has Fixed H */
 1543|    367|                      ( (!pc2i->c2at[i].nFixHRevrs && pc2i->c2at[i].nMobHRevrs == pc2i->c2at[i].nFixHInChI) ||
  ------------------
  |  Branch (1543:26): [True: 204, False: 163]
  |  Branch (1543:55): [True: 198, False: 6]
  ------------------
 1544|    169|                        (pc2i->c2at[i].nFixHRevrs == pc2i->c2at[i].nFixHInChI && pc2i->c2at[i].endptRevrs) ) ) &&
  ------------------
  |  Branch (1544:26): [True: 163, False: 6]
  |  Branch (1544:82): [True: 163, False: 0]
  ------------------
 1545|    361|                     0 <= ( e = pVA[iat].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (1545:22): [True: 352, False: 9]
  |  Branch (1545:67): [True: 351, False: 1]
  ------------------
 1546|    351|                     pBNS->edge[e].flow) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (1546:22): [True: 351, False: 0]
  ------------------
 1547|    351|                {
 1548|       |
 1549|    351|                    if ((ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    351|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1549:25): [True: 0, False: 351]
  ------------------
 1550|      0|                    {
 1551|      0|                        goto exit_case_06d;
 1552|      0|                    }
 1553|    351|                }
 1554|  3.44k|            }
 1555|  3.47k|        }
 1556|  1.01k|        if ((num_try = inchi_min( CurrEdges.num_edges, CurChargeEdges.num_edges ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|  1.01k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 14, False: 999]
  |  |  ------------------
  ------------------
  |  Branch (1556:13): [True: 14, False: 999]
  ------------------
 1557|     14|        {
 1558|       |            /* detected; attempt to fix */
 1559|     14|            int bSFlowerEdgesMayBeForbidden = ( SFlowerEdges.num_edges > 0 );
 1560|     14|            int bSFlowerEdgesIsForbidden;
 1561|     14|            for (bSFlowerEdgesIsForbidden = bSFlowerEdgesMayBeForbidden;
 1562|     41|                  0 <= bSFlowerEdgesIsForbidden; bSFlowerEdgesIsForbidden--)
  ------------------
  |  Branch (1562:19): [True: 27, False: 14]
  ------------------
 1563|     27|            {
 1564|     27|                if (bSFlowerEdgesIsForbidden)
  ------------------
  |  Branch (1564:21): [True: 13, False: 14]
  ------------------
 1565|     13|                {
 1566|       |                    /* on the 1st pass disallow -S(+)= => =S=, allow only -S(+)= => -S- */
 1567|     13|                    SetForbiddenEdgeMask( pBNS, &SFlowerEdges, forbidden_edge_mask );
 1568|     13|                }
 1569|     27|                SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1570|     27|                RemoveForbiddenEdgeMask( pBNS, &CurChargeEdges, forbidden_edge_mask );
 1571|     27|                delta = 1;
 1572|     57|                for (i = 0; i < CurrEdges.num_edges && cur_success < num_try; i++)
  ------------------
  |  Branch (1572:29): [True: 32, False: 25]
  |  Branch (1572:56): [True: 30, False: 2]
  ------------------
 1573|     30|                {
 1574|     30|                    e = CurrEdges.pnEdges[i];
 1575|     30|                    pe = pBNS->edge + e; /* (+)charge edge of -NH- or -OH */
 1576|     30|                    if (!pe->flow)
  ------------------
  |  Branch (1576:25): [True: 0, False: 30]
  ------------------
 1577|      0|                        continue;
 1578|     30|                    pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 1579|     30|                    pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 1580|       |
 1581|     30|                    pe->flow -= delta; /* add (+) to -NHm */
 1582|     30|                    pv1->st_edge.flow -= delta;
 1583|     30|                    pv2->st_edge.flow -= delta;
 1584|     30|                    pBNS->tot_st_flow -= 2 * delta;
 1585|       |
 1586|     30|                    ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 1587|     30|                                          &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 1588|       |
 1589|     30|                    if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (1589:25): [True: 15, False: 15]
  |  Branch (1589:40): [True: 3, False: 12]
  |  Branch (1589:58): [True: 1, False: 2]
  ------------------
 1590|     14|                                      (vPathEnd == v2 && vPathStart == v1) ) && nDeltaCharge == -1) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (1590:40): [True: 10, False: 4]
  |  Branch (1590:58): [True: 5, False: 5]
  |  Branch (1590:81): [True: 6, False: 0]
  ------------------
 1591|      6|                    {
 1592|       |                        /* Removed (+)charge from -NH- => nDeltaCharge == -1 */
 1593|       |                        /* Flow change on pe (+)charge edge (atom NHm(+)) is not known to RunBnsTestOnce()) */
 1594|      6|                        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 1595|      6|                        if (ret > 0)
  ------------------
  |  Branch (1595:29): [True: 6, False: 0]
  ------------------
 1596|      6|                        {
 1597|      6|                            nNumRunBNS++;
 1598|      6|                            cur_success++; /* 06d */
 1599|      6|                        }
 1600|      6|                    }
 1601|     24|                    else
 1602|     24|                    {
 1603|     24|                        pe->flow += delta;
 1604|     24|                        pv1->st_edge.flow += delta;
 1605|     24|                        pv2->st_edge.flow += delta;
 1606|     24|                        pBNS->tot_st_flow += 2 * delta;
 1607|     24|                    }
 1608|     30|                    INCHI_HEAPCHK
 1609|     30|                }
 1610|     27|                RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1611|     27|                RemoveForbiddenEdgeMask( pBNS, &SFlowerEdges, forbidden_edge_mask );
 1612|     27|            }
 1613|     14|        }
 1614|  1.01k|    exit_case_06d:
 1615|  1.01k|        CurrEdges.num_edges = 0; /* clear current edge list */
 1616|  1.01k|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  1.01k|#define EDGE_LIST_FREE   (-2)
  ------------------
 1617|  1.01k|        if (cur_success)
  ------------------
  |  Branch (1617:13): [True: 6, False: 1.00k]
  ------------------
 1618|      6|        {
 1619|      6|            tot_succes += cur_success;
 1620|       |            /* recalculate InChI from the structure */
 1621|      6|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1621:17): [True: 0, False: 6]
  ------------------
 1622|      6|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 1623|      0|            {
 1624|      0|                goto exit_function;
 1625|      0|            }
 1626|      6|            if ((ret = FillOutExtraFixedHDataRestr( pStruct ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1626:17): [True: 0, False: 6]
  ------------------
 1627|      0|            {
 1628|      0|                goto exit_function;
 1629|      0|            }
 1630|      6|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (1630:17): [True: 0, False: 6]
  |  Branch (1630:45): [True: 0, False: 0]
  ------------------
 1631|      0|            {
 1632|      0|                goto exit_function;  /* no fixed-H found */
 1633|      0|            }
 1634|      6|            if ((ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1634:17): [True: 0, False: 6]
  ------------------
 1635|      0|            {
 1636|      0|                goto exit_function;
 1637|      0|            }
 1638|      6|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (1638:17): [True: 2, False: 4]
  ------------------
 1639|      2|            {
 1640|      2|                goto exit_function; /* nothing to do */
 1641|      2|            }
 1642|      6|        }
 1643|  1.01k|    }
 1644|       |
 1645|  1.13k|    if (pc2i->len_c2at >= 2)
  ------------------
  |  Branch (1645:9): [True: 1.00k, False: 125]
  ------------------
 1646|  1.00k|    {
 1647|       |        /*--------------------------------------------------------*/
 1648|       |        /* case 06: restored: NHn(+)=AB-NHm  orig.: NHn-AB=NHm(+) */
 1649|       |        /* FixH:               1        0            0     1      */
 1650|       |        /* MobH:              n-1       m            n    m-1     */
 1651|       |        /* N = N, O, S, Se; atoms N are not tautomeric            */
 1652|       |        /* Solution: move (+) from NHn(+) to NHn                  */
 1653|       |        /*--------------------------------------------------------*/
 1654|  1.00k|        int num_DB_NHn_Plus = 0, num_SB_NHm_Neutr = 0, iat;
 1655|  1.00k|        cur_success = 0;
 1656|       |
 1657|  4.47k|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (1657:21): [True: 3.46k, False: 1.00k]
  ------------------
 1658|  3.46k|        {
 1659|  3.46k|            iat = pc2i->c2at[i].atomNumber;
 1660|  3.46k|            if ((pc2i->c2at[i].nValElectr == 6 ||
  ------------------
  |  Branch (1660:18): [True: 1.73k, False: 1.73k]
  ------------------
 1661|  1.73k|                (pc2i->c2at[i].nValElectr == 5 && pc2i->c2at[i].nPeriodNum == 1)) &&
  ------------------
  |  Branch (1661:18): [True: 1.23k, False: 492]
  |  Branch (1661:51): [True: 1.07k, False: 169]
  ------------------
 1662|  2.80k|                !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (1662:17): [True: 1.59k, False: 1.20k]
  ------------------
 1663|  1.59k|                (e = pVA[iat].nCPlusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1663:17): [True: 1.44k, False: 146]
  |  Branch (1663:60): [True: 1.40k, False: 44]
  ------------------
 1664|  1.40k|            {
 1665|  1.40k|                if ( /* orig. InChI info: NHm */
 1666|  1.40k|                    num_SB_NHm_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  2.80k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (1666:21): [True: 1.40k, False: 0]
  ------------------
 1667|  1.40k|                    pc2i->c2at[i].nFixHInChI == 1 && /*pc2i->c2at[i].nMobHInChI == 0 &&*/
  ------------------
  |  Branch (1667:21): [True: 424, False: 978]
  ------------------
 1668|       |                    /* reversed structure info: */
 1669|    424|                    pc2i->c2at[i].nFixHRevrs == 0 && /*pc2i->c2at[i].nMobHRevrs == 1 &&*/
  ------------------
  |  Branch (1669:21): [True: 236, False: 188]
  ------------------
 1670|    236|                    pc2i->c2at[i].nAtChargeRevrs == 0 && at2[iat].num_H && /* at2 is Fixed-H */
  ------------------
  |  Branch (1670:21): [True: 145, False: 91]
  |  Branch (1670:58): [True: 145, False: 0]
  ------------------
 1671|    145|                    at2[iat].valence == at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (1671:21): [True: 126, False: 19]
  ------------------
 1672|    126|                {
 1673|    126|                    iat_SB_NHm_Neutr[num_SB_NHm_Neutr++] = iat;
 1674|    126|                    if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    126|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1674:25): [True: 0, False: 126]
  ------------------
 1675|      0|                    {
 1676|      0|                        goto exit_function;
 1677|      0|                    }
 1678|    126|                }
 1679|  1.27k|                else
 1680|  1.27k|                {
 1681|  1.27k|                    if ( /* orig. InChI info: */
 1682|  1.27k|                        num_DB_NHn_Plus < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  2.55k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (1682:25): [True: 1.27k, False: 0]
  ------------------
 1683|  1.27k|                        pc2i->c2at[i].nFixHInChI == 0 && /*pc2i->c2at[i].nMobHInChI &&*/
  ------------------
  |  Branch (1683:25): [True: 772, False: 504]
  ------------------
 1684|       |                        /* reversed structure info: */
 1685|    772|                        pc2i->c2at[i].nFixHRevrs == 1 && /*pc2i->c2at[i].nMobHRevrs ==  0 &&*/
  ------------------
  |  Branch (1685:25): [True: 69, False: 703]
  ------------------
 1686|     69|                        pc2i->c2at[i].nAtChargeRevrs == 1 && at2[iat].num_H &&
  ------------------
  |  Branch (1686:25): [True: 11, False: 58]
  |  Branch (1686:62): [True: 11, False: 0]
  ------------------
 1687|     11|                        at2[iat].valence < at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (1687:25): [True: 7, False: 4]
  ------------------
 1688|      7|                    {
 1689|      7|                        iat_DB_NHn_Plus[num_DB_NHn_Plus++] = iat;
 1690|      7|                        if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|      7|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1690:29): [True: 0, False: 7]
  ------------------
 1691|      0|                        {
 1692|      0|                            goto exit_function;
 1693|      0|                        }
 1694|      7|                    }
 1695|  1.27k|                }
 1696|  1.40k|            }
 1697|  3.46k|        }
 1698|  1.00k|        if ((num_try = inchi_min(num_SB_NHm_Neutr, num_DB_NHn_Plus))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|  1.00k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 4, False: 1.00k]
  |  |  ------------------
  ------------------
  |  Branch (1698:13): [True: 3, False: 1.00k]
  ------------------
 1699|      3|        {
 1700|       |            /* detected; attempt to fix */
 1701|      3|            SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 1702|      3|            RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
 1703|      3|            delta = 1;
 1704|      7|            for (i = 0; i < num_SB_NHm_Neutr && cur_success < num_try; i++)
  ------------------
  |  Branch (1704:25): [True: 4, False: 3]
  |  Branch (1704:49): [True: 4, False: 0]
  ------------------
 1705|      4|            {
 1706|      4|                iat = iat_SB_NHm_Neutr[i];
 1707|      4|                pe = pBNS->edge + pVA[iat].nCPlusGroupEdge - 1;
 1708|      4|                if (!pe->flow)
  ------------------
  |  Branch (1708:21): [True: 0, False: 4]
  ------------------
 1709|      0|                    continue;
 1710|      4|                pv1 = pBNS->vert + (v1 = pe->neighbor1);
 1711|      4|                pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
 1712|       |
 1713|      4|                pe->forbidden |= forbidden_edge_mask;
 1714|      4|                pe->flow -= delta; /* add (+) to -NHm */
 1715|      4|                pv1->st_edge.flow -= delta;
 1716|      4|                pv2->st_edge.flow -= delta;
 1717|      4|                pBNS->tot_st_flow -= 2 * delta;
 1718|       |
 1719|      4|                ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 1720|      4|                    &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 1721|       |
 1722|      4|                if (ret == 1 && ((vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (1722:21): [True: 1, False: 3]
  |  Branch (1722:35): [True: 1, False: 0]
  |  Branch (1722:53): [True: 0, False: 1]
  ------------------
 1723|      1|                    (vPathEnd == v2 && vPathStart == v1)) && nDeltaCharge == -1) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (1723:22): [True: 0, False: 1]
  |  Branch (1723:40): [True: 0, False: 0]
  |  Branch (1723:62): [True: 0, False: 0]
  ------------------
 1724|      0|                {
 1725|       |                    /* Removed (+)charge from -NHn => nDeltaCharge == -1 */
 1726|       |                    /* Flow change on pe (+)charge edge (atom NHm(+)) is not known to RunBnsTestOnce()) */
 1727|      0|                    ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
 1728|      0|                    if (ret > 0)
  ------------------
  |  Branch (1728:25): [True: 0, False: 0]
  ------------------
 1729|      0|                    {
 1730|      0|                        nNumRunBNS++;
 1731|      0|                        cur_success++; /* 06 */
 1732|      0|                    }
 1733|      0|                }
 1734|      4|                else
 1735|      4|                {
 1736|      4|                    pe->forbidden &= forbidden_edge_mask_inv;
 1737|      4|                    pe->flow += delta;
 1738|      4|                    pv1->st_edge.flow += delta;
 1739|      4|                    pv2->st_edge.flow += delta;
 1740|      4|                    pBNS->tot_st_flow += 2 * delta;
 1741|      4|                }
 1742|      4|                INCHI_HEAPCHK
 1743|      4|            }
 1744|      3|            RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 1745|      3|        }
 1746|  1.00k|        CurrEdges.num_edges = 0; /* clear current edge list */
 1747|  1.00k|        if (cur_success)
  ------------------
  |  Branch (1747:13): [True: 0, False: 1.00k]
  ------------------
 1748|      0|        {
 1749|      0|            tot_succes += cur_success;
 1750|       |            /* recalculate InChI from the structure */
 1751|      0|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1751:17): [True: 0, False: 0]
  ------------------
 1752|      0|                ppt_group_info, ppat_norm, ppat_prep)))
 1753|      0|            {
 1754|      0|                goto exit_function;
 1755|      0|            }
 1756|      0|            if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1756:17): [True: 0, False: 0]
  ------------------
 1757|      0|            {
 1758|      0|                goto exit_function;
 1759|      0|            }
 1760|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (1760:17): [True: 0, False: 0]
  |  Branch (1760:45): [True: 0, False: 0]
  ------------------
 1761|      0|            {
 1762|      0|                goto exit_function;  /* no fixed-H found */
 1763|      0|            }
 1764|      0|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1764:17): [True: 0, False: 0]
  ------------------
 1765|      0|            {
 1766|      0|                goto exit_function;
 1767|      0|            }
 1768|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (1768:17): [True: 0, False: 0]
  ------------------
 1769|      0|            {
 1770|      0|                goto exit_function; /* nothing to do */
 1771|      0|            }
 1772|      0|        }
 1773|  1.00k|    }
 1774|       |
 1775|  1.13k|    if (( (pc2i->nNumTgInChI > pc2i->nNumTgRevrs && pc2i->nNumTgRevrs == 1) ||
  ------------------
  |  Branch (1775:12): [True: 529, False: 605]
  |  Branch (1775:53): [True: 26, False: 503]
  ------------------
 1776|  1.10k|          pc2i->nNumEndpInChI < pc2i->nNumEndpRevrs ) &&
  ------------------
  |  Branch (1776:11): [True: 239, False: 869]
  ------------------
 1777|    265|         pStruct->nNumRemovedProtonsMobHInChI == pStruct->One_ti.tni.nNumRemovedProtons &&
  ------------------
  |  Branch (1777:10): [True: 156, False: 109]
  ------------------
 1778|    156|         pStruct->fixed_H && pStruct->endpoint && pStruct->pOne_norm_data[TAUT_YES] && pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds) /* djb-rwth: addressing LLVM warning; fixing a NULL pointer dereference */
  ------------------
  |  |  575|    156|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                       pStruct->fixed_H && pStruct->endpoint && pStruct->pOne_norm_data[TAUT_YES] && pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds) /* djb-rwth: addressing LLVM warning; fixing a NULL pointer dereference */
  ------------------
  |  |  575|    156|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1778:10): [True: 156, False: 0]
  |  Branch (1778:30): [True: 156, False: 0]
  |  Branch (1778:51): [True: 156, False: 0]
  |  Branch (1778:88): [True: 156, False: 0]
  ------------------
 1779|    156|    {
 1780|       |        /*----------------------------------------------------------*/
 1781|       |        /* case 06a: restored: N'(+)=-AB-NH    orig.: N'-=AB=NH(+)  */
 1782|       |        /* FixH:               0         1            0      1      */
 1783|       |        /* MobH:               0         0            0      0      */
 1784|       |        /*                    single t-group      multiple t-groups */
 1785|       |        /* N  = N, O, S, Se; atoms N are not tautomeric             */
 1786|       |        /* N' = N            atom N' is not tautomeric              */
 1787|       |        /* Solution: move (+) from N' to NH                         */
 1788|       |        /*----------------------------------------------------------*/
 1789|    156|        int iat;
 1790|    156|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 1791|       |        /*
 1792|       |        inp_ATOM *at_Mobile_H_Revrs = (pStruct->pOne_norm_data[1] &&
 1793|       |        pStruct->pOne_norm_data[1]->at)? pStruct->pOne_norm_data[1]->at : NULL;
 1794|       |        */
 1795|    156|        inp_ATOM *atfMobile_H_Revrs = pStruct->pOne_norm_data[TAUT_YES] &&
  ------------------
  |  |  575|    156|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1795:39): [True: 156, False: 0]
  ------------------
 1796|    156|            pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds ?
  ------------------
  |  |  575|    156|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1796:13): [True: 156, False: 0]
  ------------------
 1797|    156|            pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds : NULL;
  ------------------
  |  |  575|    156|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1798|    156|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (1798:32): [True: 156, False: 0]
  |  Branch (1798:45): [True: 156, False: 0]
  ------------------
 1799|    156|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (1799:13): [True: 0, False: 0]
  |  Branch (1799:26): [True: 0, False: 0]
  ------------------
 1800|    156|        EDGE_LIST CurChargeEdges;
 1801|    156|        cur_success = 0;
 1802|    156|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|    156|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 1803|    156|        CurrEdges.num_edges = 0;
 1804|  1.33k|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (1804:21): [True: 1.18k, False: 156]
  ------------------
 1805|  1.18k|        {
 1806|  1.18k|            iat = nCanon2AtnoRevrs[i];
 1807|  1.18k|            if (pStruct->endpoint[i])
  ------------------
  |  Branch (1807:17): [True: 96, False: 1.08k]
  ------------------
 1808|     96|            {
 1809|     96|                continue;
 1810|     96|            }
 1811|       |            /* -NH-, -OH */
 1812|  1.08k|            if (pStruct->fixed_H[i] && nMobHInChI && !nMobHInChI[i] &&
  ------------------
  |  Branch (1812:17): [True: 307, False: 779]
  |  Branch (1812:40): [True: 307, False: 0]
  |  Branch (1812:54): [True: 289, False: 18]
  ------------------
 1813|    289|                 at2[iat].charge == 0 && at2[iat].radical == 0 &&
  ------------------
  |  Branch (1813:18): [True: 220, False: 69]
  |  Branch (1813:42): [True: 214, False: 6]
  ------------------
 1814|    214|                 0 <= ( e = pVA[iat].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden && pBNS->edge[e].flow &&
  ------------------
  |  Branch (1814:18): [True: 184, False: 30]
  |  Branch (1814:63): [True: 184, False: 0]
  |  Branch (1814:91): [True: 184, False: 0]
  ------------------
 1815|    184|                 ( ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ) )) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  |   18|    184|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1815:18): [True: 0, False: 184]
  ------------------
 1816|      0|            {
 1817|      0|                goto exit_case_06a;
 1818|      0|            }
 1819|  1.08k|            else
 1820|  1.08k|            {
 1821|       |                /* >N(+)= */
 1822|  1.08k|                if (at2[iat].charge == 1 && !at2[iat].num_H &&
  ------------------
  |  Branch (1822:21): [True: 155, False: 931]
  |  Branch (1822:45): [True: 121, False: 34]
  ------------------
 1823|    121|                     pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (1823:22): [True: 21, False: 100]
  |  Branch (1823:60): [True: 18, False: 3]
  ------------------
 1824|     18|                     atfMobile_H_Revrs && atfMobile_H_Revrs[iat].charge == 0 &&
  ------------------
  |  Branch (1824:22): [True: 18, False: 0]
  |  Branch (1824:43): [True: 10, False: 8]
  ------------------
 1825|     10|                     0 <= ( e = pVA[iat].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden && !pBNS->edge[e].flow &&
  ------------------
  |  Branch (1825:22): [True: 10, False: 0]
  |  Branch (1825:67): [True: 10, False: 0]
  |  Branch (1825:95): [True: 10, False: 0]
  ------------------
 1826|     10|                     ( ret = AddToEdgeList( &CurChargeEdges, e, INC_ADD_EDGE ) ))
  ------------------
  |  |   18|     10|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1826:22): [True: 0, False: 10]
  ------------------
 1827|      0|                {
 1828|      0|                    goto exit_case_06a;
 1829|      0|                }
 1830|  1.08k|            }
 1831|  1.08k|        }
 1832|    156|        if ((num_try = inchi_min( CurrEdges.num_edges, CurChargeEdges.num_edges ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|    156|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 156]
  |  |  ------------------
  ------------------
  |  Branch (1832:13): [True: 10, False: 146]
  ------------------
 1833|     10|        {
 1834|       |            /* detected; attempt to fix */
 1835|     10|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1836|     10|            RemoveForbiddenEdgeMask( pBNS, &CurChargeEdges, forbidden_edge_mask );
 1837|     10|            delta = 1;
 1838|     20|            for (i = 0; i < CurrEdges.num_edges && cur_success < num_try; i++)
  ------------------
  |  Branch (1838:25): [True: 14, False: 6]
  |  Branch (1838:52): [True: 10, False: 4]
  ------------------
 1839|     10|            {
 1840|     10|                e = CurrEdges.pnEdges[i];
 1841|     10|                pe = pBNS->edge + e; /* (+)charge edge of -NH- or -OH */
 1842|     10|                if (!pe->flow)
  ------------------
  |  Branch (1842:21): [True: 0, False: 10]
  ------------------
 1843|      0|                    continue;
 1844|     10|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 1845|     10|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 1846|       |
 1847|     10|                pe->flow -= delta; /* add (+) to -NHm */
 1848|     10|                pv1->st_edge.flow -= delta;
 1849|     10|                pv2->st_edge.flow -= delta;
 1850|     10|                pBNS->tot_st_flow -= 2 * delta;
 1851|       |
 1852|     10|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 1853|     10|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 1854|       |
 1855|     10|                if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (1855:21): [True: 10, False: 0]
  |  Branch (1855:36): [True: 1, False: 9]
  |  Branch (1855:54): [True: 1, False: 0]
  ------------------
 1856|     10|                                  (vPathEnd == v2 && vPathStart == v1) ) && nDeltaCharge == -1) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (1856:36): [True: 9, False: 0]
  |  Branch (1856:54): [True: 9, False: 0]
  |  Branch (1856:77): [True: 10, False: 0]
  ------------------
 1857|     10|                {
 1858|       |                    /* Removed (+)charge from -NH- => nDeltaCharge == -1 */
 1859|       |                    /* Flow change on pe (+)charge edge (atom NHm(+)) is not known to RunBnsTestOnce()) */
 1860|     10|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 1861|     10|                    if (ret > 0)
  ------------------
  |  Branch (1861:25): [True: 10, False: 0]
  ------------------
 1862|     10|                    {
 1863|     10|                        nNumRunBNS++;
 1864|     10|                        cur_success++; /* 06a */
 1865|     10|                    }
 1866|     10|                }
 1867|      0|                else
 1868|      0|                {
 1869|      0|                    pe->flow += delta;
 1870|      0|                    pv1->st_edge.flow += delta;
 1871|      0|                    pv2->st_edge.flow += delta;
 1872|      0|                    pBNS->tot_st_flow += 2 * delta;
 1873|      0|                }
 1874|     10|                INCHI_HEAPCHK
 1875|     10|            }
 1876|     10|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1877|     10|        }
 1878|    156|    exit_case_06a:
 1879|    156|        CurrEdges.num_edges = 0; /* clear current edge list */
 1880|    156|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|    156|#define EDGE_LIST_FREE   (-2)
  ------------------
 1881|    156|        if (cur_success)
  ------------------
  |  Branch (1881:13): [True: 10, False: 146]
  ------------------
 1882|     10|        {
 1883|     10|            tot_succes += cur_success;
 1884|       |            /* recalculate InChI from the structure */
 1885|     10|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1885:17): [True: 1, False: 9]
  ------------------
 1886|     10|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 1887|      1|            {
 1888|      1|                goto exit_function;
 1889|      1|            }
 1890|      9|            if ((ret = FillOutExtraFixedHDataRestr( pStruct ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1890:17): [True: 0, False: 9]
  ------------------
 1891|      0|            {
 1892|      0|                goto exit_function;
 1893|      0|            }
 1894|      9|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (1894:17): [True: 0, False: 9]
  |  Branch (1894:45): [True: 0, False: 0]
  ------------------
 1895|      0|            {
 1896|      0|                goto exit_function;  /* no fixed-H found */
 1897|      0|            }
 1898|      9|            if ((ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1898:17): [True: 0, False: 9]
  ------------------
 1899|      0|            {
 1900|      0|                goto exit_function;
 1901|      0|            }
 1902|      9|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (1902:17): [True: 0, False: 9]
  ------------------
 1903|      0|            {
 1904|      0|                goto exit_function; /* nothing to do */
 1905|      0|            }
 1906|      9|        }
 1907|    156|    }
 1908|  1.13k|    if (( (pc2i->nNumTgInChI > pc2i->nNumTgRevrs && pc2i->nNumTgRevrs == 1) ||
  ------------------
  |  Branch (1908:12): [True: 533, False: 600]
  |  Branch (1908:53): [True: 26, False: 507]
  ------------------
 1909|  1.10k|          pc2i->nNumEndpInChI < pc2i->nNumEndpRevrs ) &&
  ------------------
  |  Branch (1909:11): [True: 233, False: 874]
  ------------------
 1910|    259|          ( pStruct->nNumRemovedProtonsMobHInChI == pStruct->One_ti.tni.nNumRemovedProtons ||
  ------------------
  |  Branch (1910:13): [True: 148, False: 111]
  ------------------
 1911|    111|            pStruct->nNumRemovedProtonsMobHInChI > pStruct->One_ti.tni.nNumRemovedProtons ) &&
  ------------------
  |  Branch (1911:13): [True: 76, False: 35]
  ------------------
 1912|    224|         pStruct->fixed_H && pStruct->endpoint && pStruct->pOne_norm_data[TAUT_YES] && pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds) /* djb-rwth: addressing LLVM warning; fixing a NULL pointer dereference */
  ------------------
  |  |  575|    224|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                       pStruct->fixed_H && pStruct->endpoint && pStruct->pOne_norm_data[TAUT_YES] && pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds) /* djb-rwth: addressing LLVM warning; fixing a NULL pointer dereference */
  ------------------
  |  |  575|    224|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1912:10): [True: 224, False: 0]
  |  Branch (1912:30): [True: 224, False: 0]
  |  Branch (1912:51): [True: 224, False: 0]
  |  Branch (1912:88): [True: 224, False: 0]
  ------------------
 1913|    224|    {
 1914|       |        /*----------------------------------------------------------*/
 1915|       |        /* case 06b: restored: X(+)=-AB-NH    orig.: X-=AB=NH(+)    */
 1916|       |        /* FixH:               0        1 1          0      1       */
 1917|       |        /* MobH:               0        0 t          0      0       */
 1918|       |        /*                    single t-group      multiple t-groups */
 1919|       |        /*                                        or no t-groupd    */
 1920|       |        /* N  = N, O, S, Se; atoms N are not tautomeric             */
 1921|       |        /* X  = O, S, Se, Te, F, Cl, Br, I; atom X is not tautomeric*/
 1922|       |        /* Solution: move (+) from X  to NH                         */
 1923|       |        /*----------------------------------------------------------*/
 1924|    224|        int iat;
 1925|    224|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 1926|       |        /*
 1927|       |        inp_ATOM *at_Mobile_H_Revrs = (pStruct->pOne_norm_data[1] &&
 1928|       |        pStruct->pOne_norm_data[1]->at)? pStruct->pOne_norm_data[1]->at : NULL;
 1929|       |        */
 1930|    224|        inp_ATOM *atfMobile_H_Revrs = pStruct->pOne_norm_data[TAUT_YES] &&
  ------------------
  |  |  575|    224|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1930:39): [True: 224, False: 0]
  ------------------
 1931|    224|            pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds ?
  ------------------
  |  |  575|    224|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1931:13): [True: 224, False: 0]
  ------------------
 1932|    224|            pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds : NULL;
  ------------------
  |  |  575|    224|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1933|    224|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (1933:32): [True: 224, False: 0]
  |  Branch (1933:45): [True: 224, False: 0]
  ------------------
 1934|    224|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (1934:13): [True: 0, False: 0]
  |  Branch (1934:26): [True: 0, False: 0]
  ------------------
 1935|    224|        EDGE_LIST CurChargeEdges;
 1936|    224|        cur_success = 0;
 1937|    224|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|    224|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 1938|    224|        CurrEdges.num_edges = 0;
 1939|  1.90k|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (1939:21): [True: 1.67k, False: 224]
  ------------------
 1940|  1.67k|        {
 1941|  1.67k|            iat = nCanon2AtnoRevrs[i];
 1942|  1.67k|            if (pStruct->endpoint[i])
  ------------------
  |  Branch (1942:17): [True: 190, False: 1.48k]
  ------------------
 1943|    190|            {
 1944|    190|                continue;
 1945|    190|            }
 1946|       |            /* -NH-, -OH */
 1947|  1.48k|            if (pStruct->fixed_H[i] && nMobHInChI && !nMobHInChI[i] &&
  ------------------
  |  Branch (1947:17): [True: 306, False: 1.18k]
  |  Branch (1947:40): [True: 306, False: 0]
  |  Branch (1947:54): [True: 287, False: 19]
  ------------------
 1948|    287|                 at2[iat].charge == 0 && at2[iat].radical == 0 &&
  ------------------
  |  Branch (1948:18): [True: 211, False: 76]
  |  Branch (1948:42): [True: 205, False: 6]
  ------------------
 1949|    205|                 0 <= ( e = pVA[iat].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden && pBNS->edge[e].flow &&
  ------------------
  |  Branch (1949:18): [True: 175, False: 30]
  |  Branch (1949:63): [True: 175, False: 0]
  |  Branch (1949:91): [True: 175, False: 0]
  ------------------
 1950|    175|                 ( ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ) )) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  |   18|    175|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1950:18): [True: 0, False: 175]
  ------------------
 1951|      0|            {
 1952|      0|                goto exit_case_06b;
 1953|      0|            }
 1954|  1.48k|            else
 1955|  1.48k|            {
 1956|       |                /* X(+)= */
 1957|  1.48k|                if (at2[iat].charge == 1 && !at2[iat].num_H &&
  ------------------
  |  Branch (1957:21): [True: 176, False: 1.31k]
  |  Branch (1957:45): [True: 138, False: 38]
  ------------------
 1958|    138|                    ( pVA[iat].cNumValenceElectrons == 6 || pVA[iat].cPeriodicRowNumber == 7 ) &&
  ------------------
  |  Branch (1958:23): [True: 60, False: 78]
  |  Branch (1958:61): [True: 0, False: 78]
  ------------------
 1959|     60|                     atfMobile_H_Revrs && atfMobile_H_Revrs[iat].charge == 1 &&
  ------------------
  |  Branch (1959:22): [True: 60, False: 0]
  |  Branch (1959:43): [True: 58, False: 2]
  ------------------
 1960|     58|                     0 <= ( e = pVA[iat].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden && !pBNS->edge[e].flow &&
  ------------------
  |  Branch (1960:22): [True: 58, False: 0]
  |  Branch (1960:67): [True: 50, False: 8]
  |  Branch (1960:95): [True: 49, False: 1]
  ------------------
 1961|     49|                     ( ret = AddToEdgeList( &CurChargeEdges, e, INC_ADD_EDGE ) ))
  ------------------
  |  |   18|     49|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1961:22): [True: 0, False: 49]
  ------------------
 1962|      0|                {
 1963|      0|                    goto exit_case_06b;
 1964|      0|                }
 1965|  1.48k|            }
 1966|  1.48k|        }
 1967|    224|        if ((num_try = inchi_min( CurrEdges.num_edges, CurChargeEdges.num_edges ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|    224|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 2, False: 222]
  |  |  ------------------
  ------------------
  |  Branch (1967:13): [True: 47, False: 177]
  ------------------
 1968|     47|        {
 1969|       |            /* detected; attempt to fix */
 1970|     47|            int bSFlowerEdgesMayBeForbidden = ( SFlowerEdges.num_edges > 0 );
 1971|     47|            int bSFlowerEdgesIsForbidden;
 1972|     47|            for (bSFlowerEdgesIsForbidden = bSFlowerEdgesMayBeForbidden;
 1973|    114|                  0 <= bSFlowerEdgesIsForbidden; bSFlowerEdgesIsForbidden--)
  ------------------
  |  Branch (1973:19): [True: 67, False: 47]
  ------------------
 1974|     67|            {
 1975|     67|                if (bSFlowerEdgesIsForbidden)
  ------------------
  |  Branch (1975:21): [True: 20, False: 47]
  ------------------
 1976|     20|                {
 1977|       |                    /* on the 1st pass disallow -S(+)= => =S=, allow only -S(+)= => -S- */
 1978|     20|                    SetForbiddenEdgeMask( pBNS, &SFlowerEdges, forbidden_edge_mask );
 1979|     20|                }
 1980|     67|                SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1981|     67|                RemoveForbiddenEdgeMask( pBNS, &CurChargeEdges, forbidden_edge_mask );
 1982|     67|                delta = 1;
 1983|    132|                for (i = 0; i < CurrEdges.num_edges && cur_success < num_try; i++)
  ------------------
  |  Branch (1983:29): [True: 95, False: 37]
  |  Branch (1983:56): [True: 65, False: 30]
  ------------------
 1984|     65|                {
 1985|     65|                    e = CurrEdges.pnEdges[i];
 1986|     65|                    pe = pBNS->edge + e; /* (+)charge edge of -NH- or -OH */
 1987|     65|                    if (!pe->flow)
  ------------------
  |  Branch (1987:25): [True: 0, False: 65]
  ------------------
 1988|      0|                        continue;
 1989|     65|                    pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 1990|     65|                    pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 1991|       |
 1992|     65|                    pe->flow -= delta; /* add (+) to -NHm */
 1993|     65|                    pv1->st_edge.flow -= delta;
 1994|     65|                    pv2->st_edge.flow -= delta;
 1995|     65|                    pBNS->tot_st_flow -= 2 * delta;
 1996|       |
 1997|     65|                    ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 1998|     65|                                          &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 1999|       |
 2000|     65|                    if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (2000:25): [True: 43, False: 22]
  |  Branch (2000:40): [True: 5, False: 38]
  |  Branch (2000:58): [True: 4, False: 1]
  ------------------
 2001|     42|                                      (vPathEnd == v2 && vPathStart == v1) ) && nDeltaCharge == -1) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (2001:40): [True: 38, False: 1]
  |  Branch (2001:58): [True: 38, False: 0]
  |  Branch (2001:81): [True: 42, False: 0]
  ------------------
 2002|     42|                    {
 2003|       |                        /* Removed (+)charge from -NH- => nDeltaCharge == -1 */
 2004|       |                        /* Flow change on pe (+)charge edge (atom NHm(+)) is not known to RunBnsTestOnce()) */
 2005|     42|                        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2006|     42|                        if (ret > 0)
  ------------------
  |  Branch (2006:29): [True: 42, False: 0]
  ------------------
 2007|     42|                        {
 2008|     42|                            nNumRunBNS++;
 2009|     42|                            cur_success++; /* 06b */
 2010|     42|                        }
 2011|     42|                    }
 2012|     23|                    else
 2013|     23|                    {
 2014|     23|                        pe->flow += delta;
 2015|     23|                        pv1->st_edge.flow += delta;
 2016|     23|                        pv2->st_edge.flow += delta;
 2017|     23|                        pBNS->tot_st_flow += 2 * delta;
 2018|     23|                    }
 2019|     65|                    INCHI_HEAPCHK
 2020|     65|                }
 2021|     67|                RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2022|     67|                RemoveForbiddenEdgeMask( pBNS, &SFlowerEdges, forbidden_edge_mask );
 2023|     67|            }
 2024|     47|        }
 2025|    224|    exit_case_06b:
 2026|    224|        CurrEdges.num_edges = 0; /* clear current edge list */
 2027|    224|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|    224|#define EDGE_LIST_FREE   (-2)
  ------------------
 2028|    224|        if (cur_success)
  ------------------
  |  Branch (2028:13): [True: 42, False: 182]
  ------------------
 2029|     42|        {
 2030|     42|            tot_succes += cur_success;
 2031|       |            /* recalculate InChI from the structure */
 2032|     42|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (2032:17): [True: 1, False: 41]
  ------------------
 2033|     42|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 2034|      1|            {
 2035|      1|                goto exit_function;
 2036|      1|            }
 2037|     41|            if ((ret = FillOutExtraFixedHDataRestr( pStruct ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2037:17): [True: 0, False: 41]
  ------------------
 2038|      0|            {
 2039|      0|                goto exit_function;
 2040|      0|            }
 2041|     41|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (2041:17): [True: 0, False: 41]
  |  Branch (2041:45): [True: 0, False: 0]
  ------------------
 2042|      0|            {
 2043|      0|                goto exit_function;  /* no fixed-H found */
 2044|      0|            }
 2045|     41|            if ((ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2045:17): [True: 0, False: 41]
  ------------------
 2046|      0|            {
 2047|      0|                goto exit_function;
 2048|      0|            }
 2049|     41|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (2049:17): [True: 0, False: 41]
  ------------------
 2050|      0|            {
 2051|      0|                goto exit_function; /* nothing to do */
 2052|      0|            }
 2053|     41|        }
 2054|    224|    }
 2055|       |
 2056|  1.13k|    if (pc2i->nNumTgInChI > 1 &&
  ------------------
  |  Branch (2056:9): [True: 47, False: 1.08k]
  ------------------
 2057|     47|        ( pStruct->nNumRemovedProtonsMobHInChI > 0 || pStruct->ti.tni.nNumRemovedProtons > 0 ) &&
  ------------------
  |  Branch (2057:11): [True: 0, False: 47]
  |  Branch (2057:55): [True: 0, False: 47]
  ------------------
 2058|      0|         pStruct->fixed_H && pStruct->endpoint &&
  ------------------
  |  Branch (2058:10): [True: 0, False: 0]
  |  Branch (2058:30): [True: 0, False: 0]
  ------------------
 2059|      0|         pStruct->pOne_norm_data[TAUT_YES] && pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds)
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                       pStruct->pOne_norm_data[TAUT_YES] && pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds)
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2059:10): [True: 0, False: 0]
  |  Branch (2059:47): [True: 0, False: 0]
  ------------------
 2060|      0|    {
 2061|       |        /*----------------------------------------------------------*/
 2062|       |        /* case 06e:restored: XHn(+)=-AB-YHm  orig.: XHn-=AB=YHm(+) */
 2063|       |        /* FixH:               1          0           1      1      */
 2064|       |        /* MobH:               0          1           t      t      */
 2065|       |        /*                   non-taut atoms       multiple t-groups */
 2066|       |        /*                                                          */
 2067|       |        /* 1. orig. t-group has more H on its endpoints counted     */
 2068|       |        /*          in atf and has no (+) on endpoint that has H    */
 2069|       |        /* 2. orig. t-group has less H on its endpoints counted     */
 2070|       |        /*          in atf and has (+) on endpoint that has H       */
 2071|       |        /*          in reconstructed struct and less H in atf       */
 2072|       |        /* Solution: move (+) from (2) to atom in (1) that has H    */
 2073|       |        /*                                                          */
 2074|       |        /*   tg1  reconstr:   XHn and more H than in orig t-group   */
 2075|       |        /*             atf:   XHn                                   */
 2076|       |        /*   tg2  reconstr:   XHm(+) and less H than in             */
 2077|       |        /*             atf:   XH(m-1)           orig in t-group     */
 2078|       |        /*                                                          */
 2079|       |        /* N  = N, O, S, Se; atoms N are not tautomeric             */
 2080|       |        /* X  = O, S, Se, Te, F, Cl, Br, I; atom X is not tautomeric*/
 2081|       |        /* Solution: move (+) from X  to NH                         */
 2082|       |        /*----------------------------------------------------------*/
 2083|       |
 2084|      0|        int iat, nNumWrongTg, jjoffs, jj, nNum2RemovePlus, nNum2AddPlus, nNum2MovePlus;
 2085|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 2086|       |        /*
 2087|       |        inp_ATOM *at_Mobile_H_Revrs = (pStruct->pOne_norm_data[1] &&
 2088|       |        pStruct->pOne_norm_data[1]->at)? pStruct->pOne_norm_data[1]->at : NULL;
 2089|       |        */
 2090|      0|        inp_ATOM *atfMobile_H_Revrs = pStruct->pOne_norm_data[TAUT_YES] &&
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2090:39): [True: 0, False: 0]
  ------------------
 2091|      0|            pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds ?
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2091:13): [True: 0, False: 0]
  ------------------
 2092|      0|            pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds :
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2093|      0|            pStruct->pOne_norm_data[TAUT_YES] &&
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2093:13): [True: 0, False: 0]
  ------------------
 2094|      0|            pStruct->pOne_norm_data[TAUT_YES]->at ?
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2094:13): [True: 0, False: 0]
  ------------------
 2095|      0|            pStruct->pOne_norm_data[TAUT_YES]->at : NULL;
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2096|       |        /*
 2097|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 2098|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 2099|       |        */
 2100|      0|        EDGE_LIST CurChargeEdges /* source of (+)*/, EndpList;
 2101|      0|        BNS_VERTEX *pv1n, *pv2n;
 2102|      0|        BNS_EDGE   *pe1n, *pe2n;
 2103|      0|        Vertex      v1n, v2n;
 2104|       |
 2105|      0|        cur_success = 0;
 2106|      0|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|      0|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 2107|      0|        AllocEdgeList( &EndpList, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|      0|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 2108|      0|        CurrEdges.num_edges = 0; /* receptors of (+) */
 2109|       |        
 2110|      0|        if (!atfMobile_H_Revrs)
  ------------------
  |  Branch (2110:13): [True: 0, False: 0]
  ------------------
 2111|      0|        {
 2112|      0|            goto exit_case_06e;
 2113|      0|        }
 2114|      0|        nNumWrongTg = FillTgDiffHChgFH(tdhc, MAX_DIFF_FIXH, at2, atfMobile_H_Revrs,
  ------------------
  |  |  456|      0|#define MAX_DIFF_FIXH 256
  ------------------
 2115|      0|            nCanon2AtnoRevrs, pVA, &pStruct->ti, &EndpList);
 2116|      0|        if (nNumWrongTg < 1)
  ------------------
  |  Branch (2116:13): [True: 0, False: 0]
  ------------------
 2117|      0|        {
 2118|      0|            goto exit_case_06e; /* for now only transfer (+) from one Mobile-H group to another */
 2119|      0|        }
 2120|      0|        nNum2RemovePlus = nNum2AddPlus = 0; /* djb-rwth: removing redundant code */
 2121|      0|        for (i = 0; i < nNumWrongTg; i++)
  ------------------
  |  Branch (2121:21): [True: 0, False: 0]
  ------------------
 2122|      0|        {
 2123|       |            /* detect t-group that has extra (+) on H */
 2124|      0|            if (tdhc[i].nNumHInchi > tdhc[i].nNumHNorml &&
  ------------------
  |  Branch (2124:17): [True: 0, False: 0]
  ------------------
 2125|      0|                tdhc[i].nNumPRevrs > tdhc[i].nNumPNorml && tdhc[i].n[fNumRPosChgH])
  ------------------
  |  |   23|      0|#define fNumRPosChgH 0 /* number of positive charges on endpoints that have H in at2[] */
  ------------------
  |  Branch (2125:17): [True: 0, False: 0]
  |  Branch (2125:60): [True: 0, False: 0]
  ------------------
 2126|      0|            {
 2127|       |                /* count how many (+) to remove */
 2128|       |                /* store XH(+) atom numbers */
 2129|      0|                int nNumNeeded = inchi_min(tdhc[i].nNumHInchi - tdhc[i].nNumHNorml, tdhc[i].n[fNumRPosChgH]);
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2130|      0|                nNum2RemovePlus += nNumNeeded;
 2131|      0|                jjoffs = tdhc[i].i[fNumRPosChgH];
  ------------------
  |  |   23|      0|#define fNumRPosChgH 0 /* number of positive charges on endpoints that have H in at2[] */
  ------------------
 2132|      0|                for (jj = 0; jj < tdhc[i].n[fNumRPosChgH]; jj++)
  ------------------
  |  |   23|      0|#define fNumRPosChgH 0 /* number of positive charges on endpoints that have H in at2[] */
  ------------------
  |  Branch (2132:30): [True: 0, False: 0]
  ------------------
 2133|      0|                {
 2134|      0|                    iat = EndpList.pnEdges[jjoffs + jj];
 2135|      0|                    e = pVA[iat].nCPlusGroupEdge - 1;
 2136|      0|                    if ((ret = AddToEdgeList(&CurChargeEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2136:25): [True: 0, False: 0]
  ------------------
 2137|      0|                    {
 2138|      0|                        goto exit_case_06e;
 2139|      0|                    }
 2140|      0|                }
 2141|      0|            }
 2142|      0|            else
 2143|      0|            {
 2144|       |                /* detect t-group that needs (+) on XH to reduce number of H */
 2145|      0|                if (tdhc[i].nNumHInchi < tdhc[i].nNumHNorml && tdhc[i].n[fNumRNeutrlH])
  ------------------
  |  |   27|      0|#define fNumRNeutrlH 4 /* number of neutral endp that have H in at2[] */
  ------------------
  |  Branch (2145:21): [True: 0, False: 0]
  |  Branch (2145:64): [True: 0, False: 0]
  ------------------
 2146|      0|                {
 2147|       |                    /* store XH atom numbers */
 2148|      0|                    int nNumNeeded = inchi_min(tdhc[i].nNumHNorml - tdhc[i].nNumHInchi, tdhc[i].n[fNumRNeutrlH]);
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2149|      0|                    nNum2AddPlus += nNumNeeded;
 2150|      0|                    jjoffs = tdhc[i].i[fNumRNeutrlH];
  ------------------
  |  |   27|      0|#define fNumRNeutrlH 4 /* number of neutral endp that have H in at2[] */
  ------------------
 2151|      0|                    for (jj = 0; jj < tdhc[i].n[fNumRNeutrlH]; jj++)
  ------------------
  |  |   27|      0|#define fNumRNeutrlH 4 /* number of neutral endp that have H in at2[] */
  ------------------
  |  Branch (2151:34): [True: 0, False: 0]
  ------------------
 2152|      0|                    {
 2153|      0|                        iat = EndpList.pnEdges[jjoffs + jj];
 2154|      0|                        e = pVA[iat].nCPlusGroupEdge - 1;
 2155|      0|                        if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2155:29): [True: 0, False: 0]
  ------------------
 2156|      0|                        {
 2157|      0|                            goto exit_case_06e;
 2158|      0|                        }
 2159|      0|                    }
 2160|      0|                }
 2161|      0|            }
 2162|      0|        }
 2163|      0|        nNum2MovePlus = inchi_min(nNum2RemovePlus, nNum2AddPlus);
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2164|      0|        if (CurrEdges.num_edges > 0 && CurChargeEdges.num_edges > 0)
  ------------------
  |  Branch (2164:13): [True: 0, False: 0]
  |  Branch (2164:40): [True: 0, False: 0]
  ------------------
 2165|      0|        {
 2166|      0|            for (i = 0; 0 < nNum2MovePlus && i < nNumWrongTg; i++)
  ------------------
  |  Branch (2166:25): [True: 0, False: 0]
  |  Branch (2166:46): [True: 0, False: 0]
  ------------------
 2167|      0|            {
 2168|       |                /* detect t-group that has extra (+) on H */
 2169|      0|                if (tdhc[i].nNumHInchi > tdhc[i].nNumHNorml &&
  ------------------
  |  Branch (2169:21): [True: 0, False: 0]
  ------------------
 2170|      0|                    tdhc[i].nNumPRevrs > tdhc[i].nNumPNorml && tdhc[i].n[fNumRPosChgH])
  ------------------
  |  |   23|      0|#define fNumRPosChgH 0 /* number of positive charges on endpoints that have H in at2[] */
  ------------------
  |  Branch (2170:21): [True: 0, False: 0]
  |  Branch (2170:64): [True: 0, False: 0]
  ------------------
 2171|      0|                {
 2172|      0|                    int nNum2Remove = tdhc[i].nNumHInchi - tdhc[i].nNumHNorml;
 2173|      0|                    if (nNum2Remove < tdhc[i].n[fNumRPosChgH])
  ------------------
  |  |   23|      0|#define fNumRPosChgH 0 /* number of positive charges on endpoints that have H in at2[] */
  ------------------
  |  Branch (2173:25): [True: 0, False: 0]
  ------------------
 2174|      0|                    {
 2175|      0|                        nNum2Remove = tdhc[i].n[fNumRPosChgH];
  ------------------
  |  |   23|      0|#define fNumRPosChgH 0 /* number of positive charges on endpoints that have H in at2[] */
  ------------------
 2176|      0|                    }
 2177|       |                    /* store XH(+) atom numbers */
 2178|      0|                    jjoffs = tdhc[i].i[fNumRPosChgH];
  ------------------
  |  |   23|      0|#define fNumRPosChgH 0 /* number of positive charges on endpoints that have H in at2[] */
  ------------------
 2179|      0|                    SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 2180|      0|                    RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
 2181|      0|                    for (jj = 0; 0 < nNum2MovePlus && 0 < nNum2Remove && jj < tdhc[i].n[fNumRPosChgH]; jj++)
  ------------------
  |  |   23|      0|#define fNumRPosChgH 0 /* number of positive charges on endpoints that have H in at2[] */
  ------------------
  |  Branch (2181:34): [True: 0, False: 0]
  |  Branch (2181:55): [True: 0, False: 0]
  |  Branch (2181:74): [True: 0, False: 0]
  ------------------
 2182|      0|                    {
 2183|      0|                        iat = EndpList.pnEdges[jjoffs + jj];
 2184|      0|                        e = pVA[iat].nCPlusGroupEdge - 1;
 2185|      0|                        pe = pBNS->edge + pVA[iat].nCPlusGroupEdge - 1;
 2186|      0|                        if (pe->flow)
  ------------------
  |  Branch (2186:29): [True: 0, False: 0]
  ------------------
 2187|      0|                            continue;
 2188|      0|                        pv1 = pBNS->vert + (v1 = pe->neighbor1);
 2189|      0|                        pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
 2190|       |
 2191|      0|                        for (j = pv1->num_adj_edges - 1; 0 <= j; j--)
  ------------------
  |  Branch (2191:58): [True: 0, False: 0]
  ------------------
 2192|      0|                        {
 2193|      0|                            pe1n = pBNS->edge + pv1->iedge[j];
 2194|      0|                            if (pe1n->flow && !pe1n->forbidden)
  ------------------
  |  Branch (2194:33): [True: 0, False: 0]
  |  Branch (2194:47): [True: 0, False: 0]
  ------------------
 2195|      0|                            {
 2196|      0|                                pv1n = pBNS->vert + (v1n = pe1n->neighbor12 ^ v1);
 2197|      0|                                break;
 2198|      0|                            }
 2199|      0|                        }
 2200|      0|                        if (j < 0)
  ------------------
  |  Branch (2200:29): [True: 0, False: 0]
  ------------------
 2201|      0|                        {
 2202|      0|                            continue; /* not found */
 2203|      0|                        }
 2204|      0|                        for (j = pv2->num_adj_edges - 2; 0 <= j; j--)
  ------------------
  |  Branch (2204:58): [True: 0, False: 0]
  ------------------
 2205|      0|                        {
 2206|      0|                            pe2n = pBNS->edge + pv2->iedge[j];
 2207|      0|                            if (pe2n->flow && !pe2n->forbidden)
  ------------------
  |  Branch (2207:33): [True: 0, False: 0]
  |  Branch (2207:47): [True: 0, False: 0]
  ------------------
 2208|      0|                            {
 2209|      0|                                pv2n = pBNS->vert + (v2n = pe2n->neighbor12 ^ v2);
 2210|      0|                                break;
 2211|      0|                            }
 2212|      0|                        }
 2213|      0|                        if (j < 0)
  ------------------
  |  Branch (2213:29): [True: 0, False: 0]
  ------------------
 2214|      0|                        {
 2215|      0|                            continue; /* not found */
 2216|      0|                        }
 2217|      0|                        delta = 1;
 2218|      0|                        pe->flow += delta;
 2219|      0|                        pe1n->flow -= delta;
 2220|      0|                        pe2n->flow -= delta;
 2221|      0|                        pv1n->st_edge.flow -= delta;
 2222|      0|                        pv2n->st_edge.flow -= delta;
 2223|      0|                        pBNS->tot_st_flow -= 2 * delta;
 2224|       |
 2225|      0|                        ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 2226|      0|                            &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 2227|       |
 2228|      0|                        if (ret == 1 && ((vPathEnd == v1n && vPathStart == v2n) ||
  ------------------
  |  Branch (2228:29): [True: 0, False: 0]
  |  Branch (2228:43): [True: 0, False: 0]
  |  Branch (2228:62): [True: 0, False: 0]
  ------------------
 2229|      0|                            (vPathEnd == v2n && vPathStart == v1n)) &&
  ------------------
  |  Branch (2229:30): [True: 0, False: 0]
  |  Branch (2229:49): [True: 0, False: 0]
  ------------------
 2230|      0|                            (nDeltaCharge == 0 || nDeltaCharge == 1)) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (2230:30): [True: 0, False: 0]
  |  Branch (2230:51): [True: 0, False: 0]
  ------------------
 2231|      0|                        {
 2232|      0|                            ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
 2233|      0|                            if (ret > 0)
  ------------------
  |  Branch (2233:33): [True: 0, False: 0]
  ------------------
 2234|      0|                            {
 2235|      0|                                nNumRunBNS++;
 2236|      0|                                nNum2Remove--;
 2237|      0|                                nNum2MovePlus--;
 2238|      0|                                cur_success++; /* 06e */
 2239|      0|                            }
 2240|      0|                        }
 2241|      0|                        else
 2242|      0|                        {
 2243|      0|                            pe->flow -= delta;
 2244|      0|                            pe1n->flow += delta;
 2245|      0|                            pe2n->flow += delta;
 2246|      0|                            pv1n->st_edge.flow += delta;
 2247|      0|                            pv2n->st_edge.flow += delta;
 2248|      0|                            pBNS->tot_st_flow += 2 * delta;
 2249|      0|                        }
 2250|      0|                        if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE)))
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2250:29): [True: 0, False: 0]
  ------------------
 2251|      0|                        {
 2252|      0|                            goto exit_case_06e;
 2253|      0|                        }
 2254|      0|                    }
 2255|      0|                    RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 2256|      0|                }
 2257|      0|            }
 2258|      0|        }
 2259|      0|    exit_case_06e:
 2260|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 2261|      0|        AllocEdgeList(&CurChargeEdges, EDGE_LIST_FREE);
  ------------------
  |  |  243|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 2262|      0|        AllocEdgeList(&EndpList, EDGE_LIST_FREE);
  ------------------
  |  |  243|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 2263|      0|        if (cur_success)
  ------------------
  |  Branch (2263:13): [True: 0, False: 0]
  ------------------
 2264|      0|        {
 2265|      0|            tot_succes += cur_success;
 2266|       |            /* recalculate InChI from the structure */
 2267|      0|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (2267:17): [True: 0, False: 0]
  ------------------
 2268|      0|                ppt_group_info, ppat_norm, ppat_prep)))
 2269|      0|            {
 2270|      0|                goto exit_function;
 2271|      0|            }
 2272|      0|            if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2272:17): [True: 0, False: 0]
  ------------------
 2273|      0|            {
 2274|      0|                goto exit_function;
 2275|      0|            }
 2276|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (2276:17): [True: 0, False: 0]
  |  Branch (2276:45): [True: 0, False: 0]
  ------------------
 2277|      0|            {
 2278|      0|                goto exit_function;  /* no fixed-H found */
 2279|      0|            }
 2280|      0|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2280:17): [True: 0, False: 0]
  ------------------
 2281|      0|            {
 2282|      0|                goto exit_function;
 2283|      0|            }
 2284|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (2284:17): [True: 0, False: 0]
  ------------------
 2285|      0|            {
 2286|      0|                goto exit_function; /* nothing to do */
 2287|      0|            }
 2288|      0|        }
 2289|      0|    }
 2290|       |
 2291|  1.13k|    if (pc2i->len_c2at >= 1)
  ------------------
  |  Branch (2291:9): [True: 1.12k, False: 3]
  ------------------
 2292|  1.12k|    {
 2293|       |        /*--------------------------------------------------------------*/
 2294|       |        /* case 07: restored:  O(-)-AB=O  original:  O=AB-O(-)          */
 2295|       |        /* FixH:               0       0             0     -1           */
 2296|       |        /* MobH:               0       0             0      1           */
 2297|       |        /*                    taut  (non-taut)     (taut) non-taut      */
 2298|       |        /*                    taut  (taut)     (non-taut) non-taut      */
 2299|       |        /* O = O, S, Se, Te                                             */
 2300|       |        /* Solution: move (-) from O(-)-AB to AB=O                      */
 2301|       |        /*--------------------------------------------------------------*/
 2302|  1.12k|        int num_SB_O_Minus = 0, num_DB_O_Neutr = 0, iat;
 2303|  1.12k|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 2304|  1.12k|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (2304:41): [True: 600, False: 529]
  ------------------
 2305|  1.12k|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (2305:41): [True: 600, False: 0]
  ------------------
 2306|  1.12k|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (2306:32): [True: 1.12k, False: 0]
  |  Branch (2306:45): [True: 1.12k, False: 0]
  ------------------
 2307|  1.12k|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (2307:13): [True: 0, False: 0]
  |  Branch (2307:26): [True: 0, False: 0]
  ------------------
 2308|  1.12k|        cur_success = 0;
 2309|       |
 2310|  4.65k|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (2310:21): [True: 3.52k, False: 1.12k]
  ------------------
 2311|  3.52k|        {
 2312|  3.52k|            iat = pc2i->c2at[i].atomNumber;
 2313|  3.52k|            if ( /* orig. InChI info: -O(-), non-taut */
 2314|  3.52k|                num_DB_O_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  7.04k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (2314:17): [True: 3.52k, False: 0]
  ------------------
 2315|  3.52k|                pc2i->c2at[i].nValElectr == 6 /* O, S, Se, Te */ &&
  ------------------
  |  Branch (2315:17): [True: 1.78k, False: 1.73k]
  ------------------
 2316|  1.78k|                !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (2316:17): [True: 1.02k, False: 766]
  ------------------
 2317|  1.02k|                (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (2317:17): [True: 571, False: 450]
  |  Branch (2317:61): [True: 571, False: 0]
  ------------------
 2318|    571|                pc2i->c2at[i].nFixHInChI == -1 && pc2i->c2at[i].nMobHInChI == 1 &&
  ------------------
  |  Branch (2318:17): [True: 50, False: 521]
  |  Branch (2318:51): [True: 25, False: 25]
  ------------------
 2319|       |                /* reversed structure info: */
 2320|     25|                pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs == 0 &&
  ------------------
  |  Branch (2320:17): [True: 25, False: 0]
  |  Branch (2320:50): [True: 25, False: 0]
  ------------------
 2321|     25|                pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (2321:17): [True: 10, False: 15]
  |  Branch (2321:54): [True: 10, False: 0]
  ------------------
 2322|     10|                at2[iat].valence < at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (2322:17): [True: 8, False: 2]
  ------------------
 2323|      8|            {
 2324|      8|                iat_DB_O_Neutr[num_DB_O_Neutr++] = iat;
 2325|      8|                if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|      8|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2325:21): [True: 0, False: 8]
  ------------------
 2326|      0|                {
 2327|      0|                    goto exit_function;
 2328|      0|                }
 2329|      8|            }
 2330|  3.52k|        }
 2331|  9.47k|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (2331:21): [True: 8.34k, False: 1.12k]
  ------------------
 2332|  8.34k|        {
 2333|       |            /* i = canonical number - 1 */
 2334|  8.34k|            iat = nCanon2AtnoRevrs[i];
 2335|  8.34k|            if ( /* in restored atom: charge=-1, no H, has single bond, O, S, Se, Te */
 2336|  8.34k|                num_SB_O_Minus < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  16.6k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (2336:17): [True: 8.34k, False: 0]
  ------------------
 2337|  8.34k|                at2[iat].charge == -1 && !at2[iat].num_H &&
  ------------------
  |  Branch (2337:17): [True: 1.40k, False: 6.93k]
  |  Branch (2337:42): [True: 1.19k, False: 216]
  ------------------
 2338|  1.19k|                at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (2338:17): [True: 947, False: 243]
  |  Branch (2338:68): [True: 913, False: 34]
  ------------------
 2339|    913|                pVA[iat].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (2339:17): [True: 764, False: 149]
  ------------------
 2340|    764|                at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint &&
  ------------------
  |  Branch (2340:17): [True: 471, False: 293]
  |  Branch (2340:38): [True: 347, False: 124]
  ------------------
 2341|       |                /* in orig.InChI: not an endpoint, has no H */
 2342|       |                /*pStruct->endpoint[i] && -- modificatuion#1 */
 2343|    347|                !(pStruct->fixed_H && pStruct->fixed_H[i]) &&
  ------------------
  |  Branch (2343:19): [True: 347, False: 0]
  |  Branch (2343:39): [True: 7, False: 340]
  ------------------
 2344|    340|                !(nMobHInChI && nMobHInChI[i]) &&
  ------------------
  |  Branch (2344:19): [True: 340, False: 0]
  |  Branch (2344:33): [True: 1, False: 339]
  ------------------
 2345|       |                /* has (-) edge */
 2346|    339|                (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (2346:17): [True: 339, False: 0]
  |  Branch (2346:61): [True: 339, False: 0]
  ------------------
 2347|    339|            {
 2348|    339|                iat_SB_O_Minus[num_SB_O_Minus++] = iat;
 2349|    339|                if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    339|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2349:21): [True: 0, False: 339]
  ------------------
 2350|      0|                {
 2351|      0|                    goto exit_function;
 2352|      0|                }
 2353|    339|            }
 2354|  8.34k|        }
 2355|  1.12k|        if ((num_try = inchi_min(num_SB_O_Minus, num_DB_O_Neutr))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|  1.12k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 7, False: 1.12k]
  |  |  ------------------
  ------------------
  |  Branch (2355:13): [True: 1, False: 1.12k]
  ------------------
 2356|      1|        {
 2357|       |            /* detected; attempt to fix */
 2358|      1|            SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 2359|      1|            RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
 2360|      1|            delta = 1;
 2361|      2|            for (i = 0; i < num_SB_O_Minus && cur_success < num_try; i++)
  ------------------
  |  Branch (2361:25): [True: 1, False: 1]
  |  Branch (2361:47): [True: 1, False: 0]
  ------------------
 2362|      1|            {
 2363|      1|                iat = iat_SB_O_Minus[i];
 2364|      1|                pe = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
 2365|      1|                if (!pe->flow)
  ------------------
  |  Branch (2365:21): [True: 0, False: 1]
  ------------------
 2366|      0|                    continue;
 2367|      1|                pv1 = pBNS->vert + (v1 = pe->neighbor1);
 2368|      1|                pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
 2369|       |
 2370|      1|                pe->forbidden |= forbidden_edge_mask;
 2371|      1|                pe->flow -= delta;
 2372|      1|                pv1->st_edge.flow -= delta;
 2373|      1|                pv2->st_edge.flow -= delta;
 2374|      1|                pBNS->tot_st_flow -= 2 * delta;
 2375|       |
 2376|      1|                ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 2377|      1|                    &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 2378|       |
 2379|      1|                if (ret == 1 && ((vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (2379:21): [True: 1, False: 0]
  |  Branch (2379:35): [True: 0, False: 1]
  |  Branch (2379:53): [True: 0, False: 0]
  ------------------
 2380|      1|                    (vPathEnd == v2 && vPathStart == v1)) && nDeltaCharge == 1) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2380:22): [True: 1, False: 0]
  |  Branch (2380:40): [True: 1, False: 0]
  |  Branch (2380:62): [True: 1, False: 0]
  ------------------
 2381|      1|                {
 2382|       |                    /* Moved (-) charge to AB=O => nDeltaCharge == 1 */
 2383|       |                    /* Flow change on pe (-)charge edge (O(-)-AB) is not known to RunBnsTestOnce()) */
 2384|      1|                    ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
 2385|      1|                    if (ret > 0)
  ------------------
  |  Branch (2385:25): [True: 1, False: 0]
  ------------------
 2386|      1|                    {
 2387|      1|                        nNumRunBNS++;
 2388|      1|                        cur_success++; /* 07 */
 2389|      1|                    }
 2390|      1|                }
 2391|      0|                else
 2392|      0|                {
 2393|      0|                    pe->forbidden &= forbidden_edge_mask_inv;
 2394|      0|                    pe->flow += delta;
 2395|      0|                    pv1->st_edge.flow += delta;
 2396|      0|                    pv2->st_edge.flow += delta;
 2397|      0|                    pBNS->tot_st_flow += 2 * delta;
 2398|      0|                }
 2399|      1|                INCHI_HEAPCHK
 2400|      1|            }
 2401|      1|            RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 2402|      1|        }
 2403|  1.12k|        CurrEdges.num_edges = 0; /* clear current edge list */
 2404|  1.12k|        if (cur_success)
  ------------------
  |  Branch (2404:13): [True: 1, False: 1.12k]
  ------------------
 2405|      1|        {
 2406|      1|            tot_succes += cur_success;
 2407|       |            /* recalculate InChI from the structure */
 2408|      1|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (2408:17): [True: 0, False: 1]
  ------------------
 2409|      1|                ppt_group_info, ppat_norm, ppat_prep)))
 2410|      0|            {
 2411|      0|                goto exit_function;
 2412|      0|            }
 2413|      1|            if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2413:17): [True: 0, False: 1]
  ------------------
 2414|      0|            {
 2415|      0|                goto exit_function;
 2416|      0|            }
 2417|      1|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (2417:17): [True: 0, False: 1]
  |  Branch (2417:45): [True: 0, False: 0]
  ------------------
 2418|      0|            {
 2419|      0|                goto exit_function;  /* no fixed-H found */
 2420|      0|            }
 2421|      1|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2421:17): [True: 0, False: 1]
  ------------------
 2422|      0|            {
 2423|      0|                goto exit_function;
 2424|      0|            }
 2425|      1|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (2425:17): [True: 0, False: 1]
  ------------------
 2426|      0|            {
 2427|      0|                goto exit_function; /* nothing to do */
 2428|      0|            }
 2429|      1|        }
 2430|  1.12k|    }
 2431|       |
 2432|  1.13k|    if (pc2i->len_c2at >= 1)
  ------------------
  |  Branch (2432:9): [True: 1.12k, False: 3]
  ------------------
 2433|  1.12k|    {
 2434|       |        /*--------------------------------------------------------------*/
 2435|       |        /* case 07a: restored: O(-)-N(V)B=O  original:  O=N(V)B-O(-)    */
 2436|       |        /* FixH:               0          0             0      -1       */
 2437|       |        /* MobH:               0          0             0       1       */
 2438|       |        /*                non-taut  (non-taut)  non-taut  non-taut      */
 2439|       |        /*                non-taut  (taut)      non-taut  non-taut      */
 2440|       |        /* O = O, S, Se, Te                                             */
 2441|       |        /* Solution: move (-) from O(-)-AB to AB=O                      */
 2442|       |        /*--------------------------------------------------------------*/
 2443|  1.12k|        int num_SB_O_Minus = 0, num_DB_O_Neutr = 0, iat, iN;
 2444|  1.12k|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 2445|  1.12k|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (2445:32): [True: 1.12k, False: 0]
  |  Branch (2445:45): [True: 1.12k, False: 0]
  ------------------
 2446|  1.12k|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (2446:13): [True: 0, False: 0]
  |  Branch (2446:26): [True: 0, False: 0]
  ------------------
 2447|  1.12k|        cur_success = 0;
 2448|       |
 2449|  4.65k|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (2449:21): [True: 3.52k, False: 1.12k]
  ------------------
 2450|  3.52k|        {
 2451|  3.52k|            iat = pc2i->c2at[i].atomNumber;
 2452|  3.52k|            if ( /* orig. InChI info: -O(-), non-taut */
 2453|  3.52k|                num_DB_O_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  7.04k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (2453:17): [True: 3.52k, False: 0]
  ------------------
 2454|  3.52k|                pc2i->c2at[i].nValElectr == 6 /* O, S, Se, Te */ &&
  ------------------
  |  Branch (2454:17): [True: 1.78k, False: 1.73k]
  ------------------
 2455|  1.78k|                !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (2455:17): [True: 1.02k, False: 766]
  ------------------
 2456|  1.02k|                (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (2456:17): [True: 571, False: 450]
  |  Branch (2456:61): [True: 571, False: 0]
  ------------------
 2457|    571|                pc2i->c2at[i].nFixHInChI == -1 && pc2i->c2at[i].nMobHInChI == 1 &&
  ------------------
  |  Branch (2457:17): [True: 50, False: 521]
  |  Branch (2457:51): [True: 25, False: 25]
  ------------------
 2458|       |                /* reversed structure info: */
 2459|     25|                pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs == 0 &&
  ------------------
  |  Branch (2459:17): [True: 25, False: 0]
  |  Branch (2459:50): [True: 25, False: 0]
  ------------------
 2460|     25|                pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (2460:17): [True: 9, False: 16]
  |  Branch (2460:54): [True: 9, False: 0]
  ------------------
 2461|      9|                at2[iat].valence < at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (2461:17): [True: 7, False: 2]
  ------------------
 2462|      7|            {
 2463|      7|                iat_DB_O_Neutr[num_DB_O_Neutr++] = iat;
 2464|      7|                if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|      7|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2464:21): [True: 0, False: 7]
  ------------------
 2465|      0|                {
 2466|      0|                    goto exit_function;
 2467|      0|                }
 2468|      7|            }
 2469|  3.52k|        }
 2470|  9.47k|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (2470:21): [True: 8.34k, False: 1.12k]
  ------------------
 2471|  8.34k|        {
 2472|       |            /* i = canonical number - 1 */
 2473|  8.34k|            iat = nCanon2AtnoRevrs[i];
 2474|  8.34k|            if ( /* in restored atom: charge=-1, no H, has single bond, O, S, Se, Te */
 2475|  8.34k|                num_SB_O_Minus < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  16.6k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (2475:17): [True: 8.34k, False: 0]
  ------------------
 2476|  8.34k|                at2[iat].charge == -1 && !at2[iat].num_H &&
  ------------------
  |  Branch (2476:17): [True: 1.40k, False: 6.93k]
  |  Branch (2476:42): [True: 1.19k, False: 216]
  ------------------
 2477|  1.19k|                at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (2477:17): [True: 947, False: 243]
  |  Branch (2477:68): [True: 913, False: 34]
  ------------------
 2478|    913|                pVA[iat].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (2478:17): [True: 764, False: 149]
  ------------------
 2479|       |                /*at_Mobile_H_Revrs && !at_Mobile_H_Revrs[iat].endpoint &&*/
 2480|       |                /* in orig.InChI: not an endpoint, has no H */
 2481|    764|                !pStruct->endpoint[i] &&
  ------------------
  |  Branch (2481:17): [True: 448, False: 316]
  ------------------
 2482|    448|                !(pStruct->fixed_H && pStruct->fixed_H[i]) &&
  ------------------
  |  Branch (2482:19): [True: 448, False: 0]
  |  Branch (2482:39): [True: 21, False: 427]
  ------------------
 2483|    427|                !(nMobHInChI && nMobHInChI[i]) &&
  ------------------
  |  Branch (2483:19): [True: 427, False: 0]
  |  Branch (2483:33): [True: 1, False: 426]
  ------------------
 2484|       |                /* has N(V) neighbor */
 2485|    426|                1 == at2[iat].valence && at2[iN = at2[iat].neighbor[0]].chem_bonds_valence == 5 &&
  ------------------
  |  Branch (2485:17): [True: 426, False: 0]
  |  Branch (2485:42): [True: 96, False: 330]
  ------------------
 2486|     96|                !at2[iN].charge && pVA[iN].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (2486:17): [True: 70, False: 26]
  |  Branch (2486:36): [True: 62, False: 8]
  ------------------
 2487|       |                /* has (-) edge */
 2488|     62|                (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (2488:17): [True: 62, False: 0]
  |  Branch (2488:61): [True: 62, False: 0]
  ------------------
 2489|     62|            {
 2490|     62|                iat_SB_O_Minus[num_SB_O_Minus++] = iat;
 2491|     62|                if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|     62|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2491:21): [True: 0, False: 62]
  ------------------
 2492|      0|                {
 2493|      0|                    goto exit_function;
 2494|      0|                }
 2495|     62|            }
 2496|  8.34k|        }
 2497|  1.12k|        if ((num_try = inchi_min(num_SB_O_Minus, num_DB_O_Neutr))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|  1.12k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 7, False: 1.12k]
  |  |  ------------------
  ------------------
  |  Branch (2497:13): [True: 0, False: 1.12k]
  ------------------
 2498|      0|        {
 2499|       |            /* detected; attempt to fix */
 2500|      0|            SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 2501|      0|            RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
 2502|      0|            delta = 1;
 2503|      0|            for (i = 0; i < num_SB_O_Minus && cur_success < num_try; i++)
  ------------------
  |  Branch (2503:25): [True: 0, False: 0]
  |  Branch (2503:47): [True: 0, False: 0]
  ------------------
 2504|      0|            {
 2505|      0|                iat = iat_SB_O_Minus[i];
 2506|      0|                pe = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
 2507|      0|                if (!pe->flow)
  ------------------
  |  Branch (2507:21): [True: 0, False: 0]
  ------------------
 2508|      0|                    continue;
 2509|      0|                pv1 = pBNS->vert + (v1 = pe->neighbor1);
 2510|      0|                pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
 2511|       |
 2512|      0|                pe->forbidden |= forbidden_edge_mask;
 2513|      0|                pe->flow -= delta;
 2514|      0|                pv1->st_edge.flow -= delta;
 2515|      0|                pv2->st_edge.flow -= delta;
 2516|      0|                pBNS->tot_st_flow -= 2 * delta;
 2517|       |
 2518|      0|                ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 2519|      0|                    &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 2520|       |
 2521|      0|                if (ret == 1 && ((vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (2521:21): [True: 0, False: 0]
  |  Branch (2521:35): [True: 0, False: 0]
  |  Branch (2521:53): [True: 0, False: 0]
  ------------------
 2522|      0|                    (vPathEnd == v2 && vPathStart == v1)) && nDeltaCharge == 1) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (2522:22): [True: 0, False: 0]
  |  Branch (2522:40): [True: 0, False: 0]
  |  Branch (2522:62): [True: 0, False: 0]
  ------------------
 2523|      0|                {
 2524|       |                    /* Moved (-) charge to AB=O => nDeltaCharge == 1 */
 2525|       |                    /* Flow change on pe (-)charge edge (O(-)-AB) is not known to RunBnsTestOnce()) */
 2526|      0|                    ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
 2527|      0|                    if (ret > 0)
  ------------------
  |  Branch (2527:25): [True: 0, False: 0]
  ------------------
 2528|      0|                    {
 2529|      0|                        nNumRunBNS++;
 2530|      0|                        cur_success++; /* 07 */
 2531|      0|                    }
 2532|      0|                }
 2533|      0|                else
 2534|      0|                {
 2535|      0|                    pe->forbidden &= forbidden_edge_mask_inv;
 2536|      0|                    pe->flow += delta;
 2537|      0|                    pv1->st_edge.flow += delta;
 2538|      0|                    pv2->st_edge.flow += delta;
 2539|      0|                    pBNS->tot_st_flow += 2 * delta;
 2540|      0|                }
 2541|      0|                INCHI_HEAPCHK
 2542|      0|            }
 2543|      0|            RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 2544|      0|        }
 2545|  1.12k|        CurrEdges.num_edges = 0; /* clear current edge list */
 2546|  1.12k|        if (cur_success)
  ------------------
  |  Branch (2546:13): [True: 0, False: 1.12k]
  ------------------
 2547|      0|        {
 2548|      0|            tot_succes += cur_success;
 2549|       |            /* recalculate InChI from the structure */
 2550|      0|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (2550:17): [True: 0, False: 0]
  ------------------
 2551|      0|                ppt_group_info, ppat_norm, ppat_prep)))
 2552|      0|            {
 2553|      0|                goto exit_function;
 2554|      0|            }
 2555|      0|            if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2555:17): [True: 0, False: 0]
  ------------------
 2556|      0|            {
 2557|      0|                goto exit_function;
 2558|      0|            }
 2559|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (2559:17): [True: 0, False: 0]
  |  Branch (2559:45): [True: 0, False: 0]
  ------------------
 2560|      0|            {
 2561|      0|                goto exit_function;  /* no fixed-H found */
 2562|      0|            }
 2563|      0|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2563:17): [True: 0, False: 0]
  ------------------
 2564|      0|            {
 2565|      0|                goto exit_function;
 2566|      0|            }
 2567|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (2567:17): [True: 0, False: 0]
  ------------------
 2568|      0|            {
 2569|      0|                goto exit_function; /* nothing to do */
 2570|      0|            }
 2571|      0|        }
 2572|  1.12k|    }
 2573|       |
 2574|  1.13k|    if ( /*(pc2i->len_c2at >= 1 || pc2i->nNumRemHRevrs) &&*/ pc2i->nNumTgInChI == 1 && /* ADP in InChI */
  ------------------
  |  Branch (2574:62): [True: 737, False: 395]
  ------------------
 2575|    737|        (pc2i->nNumEndpRevrs < pc2i->nNumEndpInChI || pc2i->nNumTgRevrs > 1))
  ------------------
  |  Branch (2575:10): [True: 624, False: 113]
  |  Branch (2575:55): [True: 12, False: 101]
  ------------------
 2576|    636|    {
 2577|       |        /*----------------------------------------------------------------*/
 2578|       |        /* case 08: restored: O(-)-AB=N- OH- orig.   O=AB-N(-)- OH-       */
 2579|       |        /* FixH:               1      0   0          0      0   1         */
 2580|       |        /* MobH:               0      0   1          0      0   0         */
 2581|       |        /*           may be taut or not  non-taut   taut  taut taut       */
 2582|       |        /*                                    ADP: one t-group or more endpoints */
 2583|       |        /* O(-) = S, Se, Te; N = N;                                       */
 2584|       |        /* Solution: move (-) from O(-) to =N-; avoid stereogenic DB on N */
 2585|       |        /*----------------------------------------------------------------*/
 2586|    636|        int num_DB_N_Neutr = 0, num_SB_O_Minus = 0, iat;
 2587|       |
 2588|    636|        AT_NUMB* nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 2589|    636|        S_CHAR* nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (2589:30): [True: 636, False: 0]
  |  Branch (2589:43): [True: 636, False: 0]
  ------------------
 2590|    636|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (2590:13): [True: 0, False: 0]
  |  Branch (2590:26): [True: 0, False: 0]
  ------------------
 2591|    636|        cur_success = 0;
 2592|       |
 2593|  5.54k|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (2593:21): [True: 4.90k, False: 636]
  ------------------
 2594|  4.90k|        {
 2595|       |            /* i = canonical number - 1 */
 2596|  4.90k|            iat = nCanon2AtnoRevrs[i];
 2597|  4.90k|            if ( /* in restored atom: charge=-1, has no H, has single bond, O, S, Se, Te */
 2598|  4.90k|                num_SB_O_Minus < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  9.81k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (2598:17): [True: 4.90k, False: 0]
  ------------------
 2599|  4.90k|                at2[iat].charge == -1 && !at2[iat].num_H &&
  ------------------
  |  Branch (2599:17): [True: 793, False: 4.11k]
  |  Branch (2599:42): [True: 728, False: 65]
  ------------------
 2600|    728|                at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (2600:17): [True: 575, False: 153]
  |  Branch (2600:68): [True: 551, False: 24]
  ------------------
 2601|    551|                pVA[iat].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (2601:17): [True: 460, False: 91]
  ------------------
 2602|       |                /* in orig.InChI: an endpoint, may have fixed-H */
 2603|    460|                pStruct->endpoint[i] &&
  ------------------
  |  Branch (2603:17): [True: 230, False: 230]
  ------------------
 2604|       |                /*!(pStruct->fixed_H && pStruct->fixed_H[i]) &&*/
 2605|    230|                !(nMobHInChI && nMobHInChI[i]) &&
  ------------------
  |  Branch (2605:19): [True: 230, False: 0]
  |  Branch (2605:33): [True: 0, False: 230]
  ------------------
 2606|       |                /* has (-) edge */
 2607|    230|                (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (2607:17): [True: 230, False: 0]
  |  Branch (2607:61): [True: 230, False: 0]
  ------------------
 2608|    230|            {
 2609|       |
 2610|    230|                iat_SB_O_Minus[num_SB_O_Minus++] = iat;
 2611|       |
 2612|    230|                if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    230|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2612:21): [True: 0, False: 230]
  ------------------
 2613|      0|                {
 2614|      0|                    goto exit_function;
 2615|      0|                }
 2616|    230|            }
 2617|  4.67k|            else
 2618|  4.67k|            {
 2619|  4.67k|                if ( /* in restored atom: charge=0, has no H, has double non-stereogenic bond, N */
 2620|  4.67k|                    num_DB_N_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  9.35k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (2620:21): [True: 4.67k, False: 0]
  ------------------
 2621|  4.67k|                    at2[iat].charge == 0 && !at2[iat].num_H && !at2[iat].sb_parity[0] &&
  ------------------
  |  Branch (2621:21): [True: 3.25k, False: 1.41k]
  |  Branch (2621:45): [True: 2.84k, False: 414]
  |  Branch (2621:64): [True: 2.82k, False: 16]
  ------------------
 2622|  2.82k|                    at2[iat].valence < at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (2622:21): [True: 1.87k, False: 957]
  |  Branch (2622:71): [True: 1.75k, False: 120]
  ------------------
 2623|  1.75k|                    pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (2623:21): [True: 689, False: 1.06k]
  |  Branch (2623:59): [True: 534, False: 155]
  ------------------
 2624|       |                    /* in orig.InChI: an endpoint, has no fixed-H */
 2625|    534|                    pStruct->endpoint[i] &&
  ------------------
  |  Branch (2625:21): [True: 276, False: 258]
  ------------------
 2626|    276|                    !(pStruct->fixed_H && pStruct->fixed_H[i]) &&
  ------------------
  |  Branch (2626:23): [True: 276, False: 0]
  |  Branch (2626:43): [True: 3, False: 273]
  ------------------
 2627|    273|                    !(nMobHInChI && nMobHInChI[i]) &&
  ------------------
  |  Branch (2627:23): [True: 273, False: 0]
  |  Branch (2627:37): [True: 0, False: 273]
  ------------------
 2628|       |                    /* has (-) edge */
 2629|    273|                    (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 &&
  ------------------
  |  Branch (2629:21): [True: 234, False: 39]
  ------------------
 2630|    234|                    0 == pBNS->edge[e].forbidden)
  ------------------
  |  Branch (2630:21): [True: 234, False: 0]
  ------------------
 2631|    234|                {
 2632|       |
 2633|    234|                    iat_DB_N_Neutr[num_DB_N_Neutr++] = iat;
 2634|       |
 2635|    234|                    if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    234|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2635:25): [True: 0, False: 234]
  ------------------
 2636|      0|                    {
 2637|      0|                        goto exit_function;
 2638|      0|                    }
 2639|    234|                }
 2640|  4.67k|            }
 2641|  4.90k|        }
 2642|    636|        if ((num_try = inchi_min(num_DB_N_Neutr, num_SB_O_Minus))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|    636|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 112, False: 524]
  |  |  ------------------
  ------------------
  |  Branch (2642:13): [True: 97, False: 539]
  ------------------
 2643|     97|        {
 2644|       |            /* detected; attempt to fix */
 2645|     97|            SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 2646|     97|            RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
 2647|       |            /* allow stereobonds in rings change */
 2648|     97|            if (forbidden_stereo_edge_mask)
  ------------------
  |  Branch (2648:17): [True: 97, False: 0]
  ------------------
 2649|     97|                RemoveForbiddenEdgeMask(pBNS, &FixedLargeRingStereoEdges, forbidden_stereo_edge_mask);
 2650|       |
 2651|     97|            delta = 1;
 2652|    198|            for (i = 0; i < num_SB_O_Minus && cur_success < num_try; i++)
  ------------------
  |  Branch (2652:25): [True: 116, False: 82]
  |  Branch (2652:47): [True: 101, False: 15]
  ------------------
 2653|    101|            {
 2654|    101|                iat = iat_SB_O_Minus[i];
 2655|    101|                pe = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
 2656|    101|                if (!pe->flow)
  ------------------
  |  Branch (2656:21): [True: 0, False: 101]
  ------------------
 2657|      0|                    continue;
 2658|    101|                pv1 = pBNS->vert + (v1 = pe->neighbor1);
 2659|    101|                pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
 2660|       |
 2661|    101|                pe->forbidden |= forbidden_edge_mask;
 2662|    101|                pe->flow -= delta;
 2663|    101|                pv1->st_edge.flow -= delta;
 2664|    101|                pv2->st_edge.flow -= delta;
 2665|    101|                pBNS->tot_st_flow -= 2 * delta;
 2666|       |
 2667|    101|                ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 2668|    101|                    &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 2669|       |
 2670|    101|                if (ret == 1 && ((vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (2670:21): [True: 80, False: 21]
  |  Branch (2670:35): [True: 3, False: 77]
  |  Branch (2670:53): [True: 2, False: 1]
  ------------------
 2671|     78|                    (vPathEnd == v2 && vPathStart == v1)) && nDeltaCharge == 1) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2671:22): [True: 77, False: 1]
  |  Branch (2671:40): [True: 72, False: 5]
  |  Branch (2671:62): [True: 74, False: 0]
  ------------------
 2672|     74|                {
 2673|       |                    /* Moved (-) charge to =N- => nDeltaCharge == 1 */
 2674|       |                    /* Flow change on pe (-)charge edge (atom (-)O-) is not known to RunBnsTestOnce()) */
 2675|     74|                    ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
 2676|     74|                    if (ret > 0)
  ------------------
  |  Branch (2676:25): [True: 74, False: 0]
  ------------------
 2677|     74|                    {
 2678|     74|                        nNumRunBNS++;
 2679|     74|                        cur_success++; /* 08 */
 2680|     74|                    }
 2681|     74|                }
 2682|     27|                else
 2683|     27|                {
 2684|     27|                    pe->forbidden &= forbidden_edge_mask_inv;
 2685|     27|                    pe->flow += delta;
 2686|     27|                    pv1->st_edge.flow += delta;
 2687|     27|                    pv2->st_edge.flow += delta;
 2688|     27|                    pBNS->tot_st_flow += 2 * delta;
 2689|     27|                }
 2690|    101|                INCHI_HEAPCHK
 2691|    101|            }
 2692|     97|            RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 2693|     97|            if (forbidden_stereo_edge_mask)
  ------------------
  |  Branch (2693:17): [True: 97, False: 0]
  ------------------
 2694|     97|                SetForbiddenEdgeMask(pBNS, &FixedLargeRingStereoEdges, forbidden_stereo_edge_mask);
 2695|     97|        }
 2696|    636|        CurrEdges.num_edges = 0; /* clear current edge list */
 2697|    636|        if (cur_success)
  ------------------
  |  Branch (2697:13): [True: 74, False: 562]
  ------------------
 2698|     74|        {
 2699|     74|            tot_succes += cur_success;
 2700|       |            /* recalculate InChI from the structure */
 2701|     74|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (2701:17): [True: 0, False: 74]
  ------------------
 2702|     74|                ppt_group_info, ppat_norm, ppat_prep)))
 2703|      0|            {
 2704|      0|                goto exit_function;
 2705|      0|            }
 2706|     74|            if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2706:17): [True: 0, False: 74]
  ------------------
 2707|      0|            {
 2708|      0|                goto exit_function;
 2709|      0|            }
 2710|     74|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (2710:17): [True: 44, False: 30]
  |  Branch (2710:45): [True: 0, False: 44]
  ------------------
 2711|      0|            {
 2712|      0|                goto exit_function;  /* no fixed-H found */
 2713|      0|            }
 2714|     74|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2714:17): [True: 0, False: 74]
  ------------------
 2715|      0|            {
 2716|      0|                goto exit_function;
 2717|      0|            }
 2718|     74|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (2718:17): [True: 0, False: 74]
  ------------------
 2719|      0|            {
 2720|      0|                goto exit_function; /* nothing to do */
 2721|      0|            }
 2722|     74|        }
 2723|    636|    }
 2724|       |
 2725|  1.13k|    if (pc2i->len_c2at >= 2)
  ------------------
  |  Branch (2725:9): [True: 993, False: 139]
  ------------------
 2726|    993|    {
 2727|       |        /*--------------------------------------------------------*/
 2728|       |        /* case 09: restored: NH2(+)=C--NH2 orig.: NH2-C(+)-NH2   */
 2729|       |        /* FixH:               2     |  2            0  |   0     */
 2730|       |        /* MobH:               0        0            2      2     */
 2731|       |        /* N = N,            taut      taut     non-taut  non-taut*/
 2732|       |        /* Solution: move (+) from NH2(+) to C                    */
 2733|       |        /*--------------------------------------------------------*/
 2734|    993|        int iat;
 2735|    993|        cur_success = 0;
 2736|  4.36k|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (2736:21): [True: 3.36k, False: 993]
  ------------------
 2737|  3.36k|        {
 2738|  3.36k|            iat = pc2i->c2at[i].atomNumber;
 2739|  3.36k|            if (( pc2i->c2at[i].nValElectr == 5 && pc2i->c2at[i].nPeriodNum == 1 ) &&
  ------------------
  |  Branch (2739:19): [True: 1.18k, False: 2.18k]
  |  Branch (2739:52): [True: 1.02k, False: 162]
  ------------------
 2740|       |                 /* orig. InChI info: */
 2741|  1.02k|                 !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (2741:18): [True: 563, False: 459]
  ------------------
 2742|    563|                 pc2i->c2at[i].nFixHInChI == 0 && pc2i->c2at[i].nMobHInChI &&
  ------------------
  |  Branch (2742:18): [True: 256, False: 307]
  |  Branch (2742:51): [True: 54, False: 202]
  ------------------
 2743|       |                 /* reversed structure info: */
 2744|     54|                 pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (2744:18): [True: 49, False: 5]
  ------------------
 2745|     49|                 pc2i->c2at[i].nFixHRevrs && !pc2i->c2at[i].nMobHRevrs &&
  ------------------
  |  Branch (2745:18): [True: 49, False: 0]
  |  Branch (2745:46): [True: 49, False: 0]
  ------------------
 2746|     49|                 pc2i->c2at[i].nAtChargeRevrs == 1 &&
  ------------------
  |  Branch (2746:18): [True: 4, False: 45]
  ------------------
 2747|      4|                 at2[iat].valence + 1 == at2[iat].chem_bonds_valence &&
  ------------------
  |  Branch (2747:18): [True: 4, False: 0]
  ------------------
 2748|      4|                 ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (2748:18): [True: 4, False: 0]
  |  Branch (2748:63): [True: 2, False: 2]
  ------------------
 2749|      2|            {
 2750|      2|                EdgeIndex eNC = NO_VERTEX, eCPlusC;
  ------------------
  |  |  118|      2|#define NO_VERTEX    -2
  ------------------
 2751|      2|                int       iNH2, iatC, iatNH2; /* djb-rwth: removing redundant variables */
 2752|       |                /* found NH2(+)=; locate =C< and find whether it has -NH2 neighbor */
 2753|      3|                for (j = 0; j < at2[iat].valence; j++)
  ------------------
  |  Branch (2753:29): [True: 3, False: 0]
  ------------------
 2754|      3|                {
 2755|      3|                    if (at2[iat].bond_type[j] == BOND_TYPE_DOUBLE)
  ------------------
  |  |   33|      3|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2755:25): [True: 2, False: 1]
  ------------------
 2756|      2|                        break;
 2757|      3|                }
 2758|      2|                if (j == at2[iat].valence)
  ------------------
  |  Branch (2758:21): [True: 0, False: 2]
  ------------------
 2759|      0|                {
 2760|      0|                    continue;
 2761|      0|                }
 2762|      2|                eNC = pBNS->vert[iat].iedge[j]; /* edge NH2(+)=C */
 2763|      2|                iatC = at2[iat].neighbor[j];
 2764|      2|                if (pVA[iatC].cNumValenceElectrons != 4 || pVA[iatC].cMetal || at2[iatC].charge ||
  ------------------
  |  Branch (2764:21): [True: 2, False: 0]
  |  Branch (2764:60): [True: 0, False: 0]
  |  Branch (2764:80): [True: 0, False: 0]
  ------------------
 2765|      0|                     at2[iatC].valence != 3 || at2[iatC].valence + 1 != at2[iatC].chem_bonds_valence ||
  ------------------
  |  Branch (2765:22): [True: 0, False: 0]
  |  Branch (2765:48): [True: 0, False: 0]
  ------------------
 2766|      0|                     ( eCPlusC = pVA[iatC].nCPlusGroupEdge - 1 ) < 0 || pBNS->edge[eCPlusC].forbidden)
  ------------------
  |  Branch (2766:22): [True: 0, False: 0]
  |  Branch (2766:73): [True: 0, False: 0]
  ------------------
 2767|      2|                {
 2768|      2|                    continue;
 2769|      2|                }
 2770|      0|                for (j = 0; j < at2[iatC].valence; j++)
  ------------------
  |  Branch (2770:29): [True: 0, False: 0]
  ------------------
 2771|      0|                {
 2772|      0|                    iatNH2 = at2[iatC].neighbor[j];
 2773|      0|                    if (iatNH2 == iat || pVA[iatNH2].cNumValenceElectrons != 5 ||
  ------------------
  |  Branch (2773:25): [True: 0, False: 0]
  |  Branch (2773:42): [True: 0, False: 0]
  ------------------
 2774|      0|                         pVA[iatNH2].cPeriodicRowNumber != 1 || !at2[iatNH2].num_H || at2[iatNH2].charge)
  ------------------
  |  Branch (2774:26): [True: 0, False: 0]
  |  Branch (2774:65): [True: 0, False: 0]
  |  Branch (2774:87): [True: 0, False: 0]
  ------------------
 2775|      0|                        continue;
 2776|       |                    /* djb-rwth: removing redundant code */
 2777|      0|                    for (iNH2 = 0; iNH2 < pc2i->len_c2at; iNH2++)
  ------------------
  |  Branch (2777:36): [True: 0, False: 0]
  ------------------
 2778|      0|                    {
 2779|      0|                        if (iatNH2 == pc2i->c2at[iNH2].atomNumber)
  ------------------
  |  Branch (2779:29): [True: 0, False: 0]
  ------------------
 2780|      0|                            break;
 2781|      0|                    }
 2782|      0|                    if (iNH2 == pc2i->len_c2at)
  ------------------
  |  Branch (2782:25): [True: 0, False: 0]
  ------------------
 2783|      0|                    {
 2784|      0|                        continue;
 2785|      0|                    }
 2786|       |
 2787|      0|                    if (( pc2i->c2at[iNH2].nValElectr == 5 && pc2i->c2at[iNH2].nPeriodNum == 1 ) &&
  ------------------
  |  Branch (2787:27): [True: 0, False: 0]
  |  Branch (2787:63): [True: 0, False: 0]
  ------------------
 2788|       |                         /* orig. InChI info: */
 2789|      0|                         !pc2i->c2at[iNH2].endptInChI &&
  ------------------
  |  Branch (2789:26): [True: 0, False: 0]
  ------------------
 2790|      0|                         pc2i->c2at[iNH2].nFixHInChI == 0 && pc2i->c2at[iNH2].nMobHInChI &&
  ------------------
  |  Branch (2790:26): [True: 0, False: 0]
  |  Branch (2790:62): [True: 0, False: 0]
  ------------------
 2791|       |                         /* reversed structure info: */
 2792|      0|                         pc2i->c2at[iNH2].endptRevrs &&
  ------------------
  |  Branch (2792:26): [True: 0, False: 0]
  ------------------
 2793|      0|                         pc2i->c2at[iNH2].nFixHRevrs && !pc2i->c2at[iNH2].nMobHRevrs &&
  ------------------
  |  Branch (2793:26): [True: 0, False: 0]
  |  Branch (2793:57): [True: 0, False: 0]
  ------------------
 2794|      0|                         pc2i->c2at[iNH2].nAtChargeRevrs == 0 &&
  ------------------
  |  Branch (2794:26): [True: 0, False: 0]
  ------------------
 2795|      0|                         at2[iatNH2].valence == at2[iatNH2].chem_bonds_valence)
  ------------------
  |  Branch (2795:26): [True: 0, False: 0]
  ------------------
 2796|      0|                    {
 2797|       |                        /* we have found NH2(+)=, =C<, and bond between them */
 2798|       |
 2799|      0|                        if ((ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2799:29): [True: 0, False: 0]
  ------------------
 2800|      0|                        {
 2801|      0|                            goto exit_function;
 2802|      0|                        }
 2803|      0|                        if ((ret = AddToEdgeList( &CurrEdges, eCPlusC, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2803:29): [True: 0, False: 0]
  ------------------
 2804|      0|                        {
 2805|      0|                            goto exit_function;
 2806|      0|                        }
 2807|      0|                        SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2808|      0|                        RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 2809|      0|                        delta = 1;
 2810|       |
 2811|      0|                        pe = pBNS->edge + eNC;
 2812|      0|                        if (!pe->flow)
  ------------------
  |  Branch (2812:29): [True: 0, False: 0]
  ------------------
 2813|      0|                            continue;
 2814|      0|                        pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 2815|      0|                        pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 2816|       |
 2817|      0|                        pe->forbidden |= forbidden_edge_mask;
 2818|      0|                        pe->flow -= delta; /* add (+) to -NHm */
 2819|      0|                        pv1->st_edge.flow -= delta;
 2820|      0|                        pv2->st_edge.flow -= delta;
 2821|      0|                        pBNS->tot_st_flow -= 2 * delta;
 2822|       |
 2823|      0|                        ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 2824|      0|                                              &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 2825|       |
 2826|      0|                        if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (2826:29): [True: 0, False: 0]
  |  Branch (2826:44): [True: 0, False: 0]
  |  Branch (2826:62): [True: 0, False: 0]
  ------------------
 2827|      0|                                          (vPathEnd == v2 && vPathStart == v1) ) && nDeltaCharge == 0) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (2827:44): [True: 0, False: 0]
  |  Branch (2827:62): [True: 0, False: 0]
  |  Branch (2827:85): [True: 0, False: 0]
  ------------------
 2828|      0|                        {
 2829|       |                            /* Removed (+)charge from -NHn => nDeltaCharge == -1 */
 2830|       |                            /* Flow change on pe (+)charge edge (atom NHm(+)) is not known to RunBnsTestOnce()) */
 2831|      0|                            ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2832|      0|                            if (ret > 0)
  ------------------
  |  Branch (2832:33): [True: 0, False: 0]
  ------------------
 2833|      0|                            {
 2834|      0|                                nNumRunBNS++;
 2835|      0|                                cur_success++; /* 09 */
 2836|      0|                            }
 2837|      0|                        }
 2838|      0|                        else
 2839|      0|                        {
 2840|      0|                            pe->flow += delta;
 2841|      0|                            pv1->st_edge.flow += delta;
 2842|      0|                            pv2->st_edge.flow += delta;
 2843|      0|                            pBNS->tot_st_flow += 2 * delta;
 2844|      0|                        }
 2845|      0|                        INCHI_HEAPCHK
 2846|      0|                            pe->forbidden &= forbidden_edge_mask_inv;
 2847|      0|                        RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2848|      0|                        CurrEdges.num_edges = 0; /* clear current edge list */
 2849|      0|                        break;
 2850|      0|                    }
 2851|      0|                }
 2852|      0|            }
 2853|  3.36k|        }
 2854|    993|        if (cur_success)
  ------------------
  |  Branch (2854:13): [True: 0, False: 993]
  ------------------
 2855|      0|        {
 2856|      0|            tot_succes += cur_success;
 2857|       |            /* recalculate InChI from the structure */
 2858|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (2858:17): [True: 0, False: 0]
  ------------------
 2859|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 2860|      0|            {
 2861|      0|                goto exit_function;
 2862|      0|            }
 2863|      0|            if ((ret = FillOutExtraFixedHDataRestr( pStruct ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2863:17): [True: 0, False: 0]
  ------------------
 2864|      0|            {
 2865|      0|                goto exit_function;
 2866|      0|            }
 2867|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (2867:17): [True: 0, False: 0]
  |  Branch (2867:45): [True: 0, False: 0]
  ------------------
 2868|      0|            {
 2869|      0|                goto exit_function;  /* no fixed-H found */
 2870|      0|            }
 2871|      0|            if ((ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2871:17): [True: 0, False: 0]
  ------------------
 2872|      0|            {
 2873|      0|                goto exit_function;
 2874|      0|            }
 2875|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (2875:17): [True: 0, False: 0]
  ------------------
 2876|      0|            {
 2877|      0|                goto exit_function; /* nothing to do */
 2878|      0|            }
 2879|      0|        }
 2880|    993|    }
 2881|       |
 2882|  1.13k|    if (pc2i->len_c2at >= 2)
  ------------------
  |  Branch (2882:9): [True: 993, False: 139]
  ------------------
 2883|    993|    {
 2884|       |        /*--------------------------------------------------------*/
 2885|       |        /* case 10: restored: NH2-X(+)-NH-  orig.: NH2(+)=X-NH-   */
 2886|       |        /* FixH:               0        0            2      1     */
 2887|       |        /* MobH:               2        1            0      0     */
 2888|       |        /* N = N,O,S,Se,Te non-taut  non-taut       taut   taut   */
 2889|       |        /* Solution: move (+) from X(+) to NH2 or NH              */
 2890|       |        /*--------------------------------------------------------*/
 2891|    993|        int iat;
 2892|    993|        cur_success = 0;
 2893|  4.36k|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (2893:21): [True: 3.36k, False: 993]
  ------------------
 2894|  3.36k|        {
 2895|  3.36k|            if (pc2i->c2at[i].nValue)
  ------------------
  |  Branch (2895:17): [True: 3, False: 3.36k]
  ------------------
 2896|      3|                continue;
 2897|  3.36k|            iat = pc2i->c2at[i].atomNumber;
 2898|  3.36k|            if (( pc2i->c2at[i].nValElectr == 6 ||
  ------------------
  |  Branch (2898:19): [True: 1.68k, False: 1.67k]
  ------------------
 2899|  1.67k|                  (pc2i->c2at[i].nValElectr == 5 && pc2i->c2at[i].nPeriodNum == 1) ) &&
  ------------------
  |  Branch (2899:20): [True: 1.18k, False: 492]
  |  Branch (2899:53): [True: 1.02k, False: 162]
  ------------------
 2900|       |                 /* orig. InChI info: */
 2901|  2.71k|                 pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (2901:18): [True: 1.17k, False: 1.53k]
  ------------------
 2902|  1.17k|                 pc2i->c2at[i].nFixHInChI && !pc2i->c2at[i].nMobHInChI &&
  ------------------
  |  Branch (2902:18): [True: 194, False: 981]
  |  Branch (2902:46): [True: 194, False: 0]
  ------------------
 2903|       |                 /* reversed structure info: */
 2904|    194|                 !pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (2904:18): [True: 194, False: 0]
  ------------------
 2905|    194|                 !pc2i->c2at[i].nFixHRevrs && pc2i->c2at[i].nMobHRevrs &&
  ------------------
  |  Branch (2905:18): [True: 175, False: 19]
  |  Branch (2905:47): [True: 166, False: 9]
  ------------------
 2906|    166|                 pc2i->c2at[i].nAtChargeRevrs == 0 &&
  ------------------
  |  Branch (2906:18): [True: 113, False: 53]
  ------------------
 2907|    113|                 at2[iat].valence == at2[iat].chem_bonds_valence &&
  ------------------
  |  Branch (2907:18): [True: 96, False: 17]
  ------------------
 2908|     96|                 ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2908:18): [True: 95, False: 1]
  |  Branch (2908:63): [True: 95, False: 0]
  ------------------
 2909|     95|            {
 2910|       |
 2911|     95|                EdgeIndex eCPlusC, eCPlusNH2, bContinue = 1;
 2912|     95|                int       iNH2, iatC, iatNH2, j1, j2; /* djb-rwth: removing redundant variables */
 2913|     95|                BNS_EDGE *pe_iat, *pe_iNH2;
 2914|       |                /* found NH2- locate -X(+) and find whether it has another -NH2 neighbor */
 2915|    255|                for (j1 = 0; j1 < at2[iat].valence && bContinue; j1++)
  ------------------
  |  Branch (2915:30): [True: 160, False: 95]
  |  Branch (2915:55): [True: 160, False: 0]
  ------------------
 2916|    160|                {
 2917|    160|                    if (at2[iat].bond_type[j1] == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|    320|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2917:25): [True: 139, False: 21]
  ------------------
 2918|    139|                         at2[iatC = at2[iat].neighbor[j1]].charge == 1 &&
  ------------------
  |  Branch (2918:26): [True: 39, False: 100]
  ------------------
 2919|     39|                         ( 4 <= pVA[iatC].cNumValenceElectrons && pVA[iatC].cNumValenceElectrons <= 6 ) &&
  ------------------
  |  Branch (2919:28): [True: 36, False: 3]
  |  Branch (2919:67): [True: 32, False: 4]
  ------------------
 2920|     32|                         at2[iatC].valence == at2[iatC].chem_bonds_valence &&
  ------------------
  |  Branch (2920:26): [True: 21, False: 11]
  ------------------
 2921|     21|                         ( eCPlusC = pVA[iatC].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[eCPlusC].forbidden)
  ------------------
  |  Branch (2921:26): [True: 21, False: 0]
  |  Branch (2921:78): [True: 14, False: 7]
  ------------------
 2922|     14|                    {
 2923|       |                        /* found a candidate for X; find another NH2 */
 2924|     65|                        for (j2 = 0; j2 < at2[iatC].valence && bContinue; j2++)
  ------------------
  |  Branch (2924:38): [True: 55, False: 10]
  |  Branch (2924:64): [True: 51, False: 4]
  ------------------
 2925|     51|                        {
 2926|     51|                            if (at2[iatC].bond_type[j2] == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|    102|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2926:33): [True: 51, False: 0]
  ------------------
 2927|     51|                                 iat != ( iatNH2 = at2[iatC].neighbor[j2] ) &&
  ------------------
  |  Branch (2927:34): [True: 38, False: 13]
  ------------------
 2928|     38|                                 at2[iatNH2].charge == 0 && at2[iatNH2].num_H &&
  ------------------
  |  Branch (2928:34): [True: 35, False: 3]
  |  Branch (2928:61): [True: 16, False: 19]
  ------------------
 2929|     16|                                 ( pVA[iatNH2].cNumValenceElectrons == 5 || pVA[iatNH2].cNumValenceElectrons == 6 ) &&
  ------------------
  |  Branch (2929:36): [True: 2, False: 14]
  |  Branch (2929:77): [True: 5, False: 9]
  ------------------
 2930|      7|                                 at2[iatNH2].valence == at2[iatNH2].chem_bonds_valence &&
  ------------------
  |  Branch (2930:34): [True: 7, False: 0]
  ------------------
 2931|      7|                                 ( eCPlusNH2 = pVA[iatNH2].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[eCPlusNH2].forbidden)
  ------------------
  |  Branch (2931:34): [True: 7, False: 0]
  |  Branch (2931:90): [True: 7, False: 0]
  ------------------
 2932|      7|                            {
 2933|     23|                                for (iNH2 = 0; iNH2 < pc2i->len_c2at; iNH2++)
  ------------------
  |  Branch (2933:48): [True: 21, False: 2]
  ------------------
 2934|     21|                                {
 2935|     21|                                    if (iatNH2 != pc2i->c2at[iNH2].atomNumber || pc2i->c2at[iNH2].nValue)
  ------------------
  |  Branch (2935:41): [True: 14, False: 7]
  |  Branch (2935:82): [True: 0, False: 7]
  ------------------
 2936|     14|                                        continue;
 2937|       |                                    /* check the second -NH */
 2938|       |                                    /* djb-rwth: removing redundant code */
 2939|      7|                                    if ( /* orig. InChI info: */
 2940|      7|                                         pc2i->c2at[iNH2].endptInChI &&
  ------------------
  |  Branch (2940:42): [True: 5, False: 2]
  ------------------
 2941|      5|                                         pc2i->c2at[iNH2].nFixHInChI && !pc2i->c2at[iNH2].nMobHInChI &&
  ------------------
  |  Branch (2941:42): [True: 5, False: 0]
  |  Branch (2941:73): [True: 5, False: 0]
  ------------------
 2942|       |                                         /* reversed structure info: */
 2943|      5|                                         !pc2i->c2at[iNH2].endptRevrs &&
  ------------------
  |  Branch (2943:42): [True: 5, False: 0]
  ------------------
 2944|      5|                                         !pc2i->c2at[iNH2].nFixHRevrs && pc2i->c2at[iNH2].nMobHRevrs &&
  ------------------
  |  Branch (2944:42): [True: 5, False: 0]
  |  Branch (2944:74): [True: 5, False: 0]
  ------------------
 2945|      5|                                         pc2i->c2at[iNH2].nAtChargeRevrs == 0)
  ------------------
  |  Branch (2945:42): [True: 5, False: 0]
  ------------------
 2946|      5|                                    {
 2947|       |                                        /* we have found NH-X(+)-NH; remove charge from X(+) */
 2948|      5|                                        pe_iat = pBNS->edge + pBNS->vert[iat].iedge[j1];
 2949|      5|                                        pe_iNH2 = pBNS->edge + pBNS->vert[iatC].iedge[j2];
 2950|       |                                        /* pick up one of -NH to move (+) to it */
 2951|      5|                                        if (!pe_iat->forbidden && pBNS->edge[e].flow)
  ------------------
  |  Branch (2951:45): [True: 5, False: 0]
  |  Branch (2951:67): [True: 5, False: 0]
  ------------------
 2952|      5|                                        {
 2953|      5|                                            pe = pBNS->edge + e;
 2954|      5|                                        }
 2955|      0|                                        else
 2956|      0|                                            if (!pe_iNH2->forbidden && pBNS->edge[eCPlusNH2].flow)
  ------------------
  |  Branch (2956:49): [True: 0, False: 0]
  |  Branch (2956:72): [True: 0, False: 0]
  ------------------
 2957|      0|                                            {
 2958|      0|                                                pe = pBNS->edge + eCPlusNH2;
 2959|      0|                                            }
 2960|      0|                                            else
 2961|      0|                                            {
 2962|      0|                                                continue; /* none of the two -X(+)- bonds may be changed */
 2963|      0|                                            }
 2964|      5|                                        if ((ret = AddToEdgeList( &CurrEdges, eCPlusC, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|      5|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2964:45): [True: 0, False: 5]
  ------------------
 2965|      0|                                        {
 2966|      0|                                            goto exit_function;
 2967|      0|                                        }
 2968|      5|                                        SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2969|      5|                                        RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 2970|      5|                                        delta = 1;
 2971|       |
 2972|      5|                                        pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 2973|      5|                                        pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 2974|       |
 2975|       |                                        /*pe->forbidden |= forbidden_edge_mask;*/
 2976|      5|                                        pe->flow -= delta; /* add (+) to -NHm */
 2977|      5|                                        pv1->st_edge.flow -= delta;
 2978|      5|                                        pv2->st_edge.flow -= delta;
 2979|      5|                                        pBNS->tot_st_flow -= 2 * delta;
 2980|       |
 2981|      5|                                        ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 2982|      5|                                                              &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 2983|       |
 2984|      5|                                        if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (2984:45): [True: 5, False: 0]
  |  Branch (2984:60): [True: 1, False: 4]
  |  Branch (2984:78): [True: 0, False: 1]
  ------------------
 2985|      5|                                                          (vPathEnd == v2 && vPathStart == v1) ) && nDeltaCharge == -1) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (2985:60): [True: 4, False: 1]
  |  Branch (2985:78): [True: 4, False: 0]
  |  Branch (2985:101): [True: 4, False: 0]
  ------------------
 2986|      4|                                        {
 2987|       |                                            /* Removed (+)charge from -NHn => nDeltaCharge == -1 */
 2988|       |                                            /* Flow change on pe (+)charge edge (atom NHm(+)) is not known to RunBnsTestOnce()) */
 2989|      4|                                            ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2990|      4|                                            if (ret > 0)
  ------------------
  |  Branch (2990:49): [True: 4, False: 0]
  ------------------
 2991|      4|                                            {
 2992|      4|                                                nNumRunBNS++;
 2993|      4|                                                cur_success++; /* 10 */
 2994|      4|                                                bContinue = 0;
 2995|      4|                                                pc2i->c2at[i].nValue = 1;    /* mark as used */
 2996|      4|                                                pc2i->c2at[iNH2].nValue = 1; /* mark as used */
 2997|      4|                                            }
 2998|      4|                                        }
 2999|      1|                                        else
 3000|      1|                                        {
 3001|      1|                                            pe->flow += delta;
 3002|      1|                                            pv1->st_edge.flow += delta;
 3003|      1|                                            pv2->st_edge.flow += delta;
 3004|      1|                                            pBNS->tot_st_flow += 2 * delta;
 3005|      1|                                        }
 3006|      5|                                        INCHI_HEAPCHK
 3007|       |
 3008|       |                                            /*pe->forbidden &= forbidden_edge_mask_inv;*/
 3009|      5|                                            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 3010|      5|                                        CurrEdges.num_edges = 0; /* clear current edge list */
 3011|      5|                                        break;
 3012|      5|                                    }
 3013|      7|                                } /* iNH2: pc2i->c2at[iNH2] cycle */
 3014|      7|                            }
 3015|     51|                        } /* j2: iatC neighbors cycle */
 3016|     14|                    }
 3017|    160|                } /* j1: iat neighbors cycle */
 3018|     95|            }
 3019|  3.36k|        } /* i: pc2i->c2at[i] cycle */
 3020|       |
 3021|    993|        if (cur_success)
  ------------------
  |  Branch (3021:13): [True: 4, False: 989]
  ------------------
 3022|      4|        {
 3023|       |            /*
 3024|       |            for ( i = 0; i < pc2i->len_c2at; i ++ ) {
 3025|       |            pc2i->c2at[i].nValue = 0;
 3026|       |            }
 3027|       |            */
 3028|      4|            tot_succes += cur_success;
 3029|       |            /* recalculate InChI from the structure */
 3030|      4|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (3030:17): [True: 0, False: 4]
  ------------------
 3031|      4|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 3032|      0|            {
 3033|      0|                goto exit_function;
 3034|      0|            }
 3035|      4|            if ((ret = FillOutExtraFixedHDataRestr( pStruct ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3035:17): [True: 0, False: 4]
  ------------------
 3036|      0|            {
 3037|      0|                goto exit_function;
 3038|      0|            }
 3039|      4|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (3039:17): [True: 0, False: 4]
  |  Branch (3039:45): [True: 0, False: 0]
  ------------------
 3040|      0|            {
 3041|      0|                goto exit_function;  /* no fixed-H found */
 3042|      0|            }
 3043|      4|            if ((ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3043:17): [True: 0, False: 4]
  ------------------
 3044|      0|            {
 3045|      0|                goto exit_function;
 3046|      0|            }
 3047|      4|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (3047:17): [True: 0, False: 4]
  ------------------
 3048|      0|            {
 3049|      0|                goto exit_function; /* nothing to do */
 3050|      0|            }
 3051|      4|        }
 3052|    993|    }
 3053|       |
 3054|  1.13k|    if ( /*pc2i->len_c2at >= 1 &&*/ pc2i->nNumTgInChI == 1 && /* ADP in InChI */
  ------------------
  |  Branch (3054:37): [True: 737, False: 395]
  ------------------
 3055|    737|        ( pc2i->nNumEndpRevrs < pc2i->nNumEndpInChI || pc2i->nNumTgRevrs > 1 ))
  ------------------
  |  Branch (3055:11): [True: 609, False: 128]
  |  Branch (3055:56): [True: 12, False: 116]
  ------------------
 3056|    621|    {
 3057|       |        /*--------------------------------------------------------------*/
 3058|       |        /* case 11: restored: NH(+)=AB-N< OH- orig.  NH-AB=N(+)< OH-    */
 3059|       |        /* FixH:               0       0   0          1      0   1      */
 3060|       |        /* MobH:               1       0   1          0      0   0      */
 3061|       |        /*                 non-taut.                taut        taut    */
 3062|       |        /*                                    ADP: one t-group or more endpoints */
 3063|       |        /* NH(+)= => N, O, S, Se; -N< => N                              */
 3064|       |        /* Solution: move (+) from NH(+) to -N<                         */
 3065|       |        /*--------------------------------------------------------------*/
 3066|    621|        int num_SB_Neutr = 0, num_DB_Charged = 0, iat;
 3067|    621|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 3068|    621|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (3068:32): [True: 621, False: 0]
  |  Branch (3068:45): [True: 621, False: 0]
  ------------------
 3069|    621|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (3069:13): [True: 0, False: 0]
  |  Branch (3069:26): [True: 0, False: 0]
  ------------------
 3070|    621|        cur_success = 0;
 3071|       |
 3072|       |        /* search for NH(+)= */
 3073|       |/* search for -N< */
 3074|  5.40k|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (3074:21): [True: 4.78k, False: 621]
  ------------------
 3075|  4.78k|        { /* i = canonical number - 1 */
 3076|  4.78k|            iat = nCanon2AtnoRevrs[i];
 3077|  4.78k|            if ( /* in restored atom: charge=0, has no H, has no double bond, N only */
 3078|  4.78k|                num_DB_Charged < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  9.57k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (3078:17): [True: 4.78k, False: 0]
  ------------------
 3079|  4.78k|                at2[iat].charge == 1 && at2[iat].num_H &&
  ------------------
  |  Branch (3079:17): [True: 760, False: 4.02k]
  |  Branch (3079:41): [True: 175, False: 585]
  ------------------
 3080|    175|                at2[iat].valence < at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (3080:17): [True: 154, False: 21]
  |  Branch (3080:67): [True: 151, False: 3]
  ------------------
 3081|    151|                ((pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1) ||
  ------------------
  |  Branch (3081:19): [True: 43, False: 108]
  |  Branch (3081:57): [True: 42, False: 1]
  ------------------
 3082|    109|                    pVA[iat].cNumValenceElectrons == 6) &&
  ------------------
  |  Branch (3082:21): [True: 94, False: 15]
  ------------------
 3083|       |                /* in orig.InChI: an endpoint, has fixed-H */
 3084|       |                /*pStruct->endpoint[i] &&*/
 3085|    136|                (pStruct->fixed_H && pStruct->fixed_H[i]) &&
  ------------------
  |  Branch (3085:18): [True: 136, False: 0]
  |  Branch (3085:38): [True: 126, False: 10]
  ------------------
 3086|       |                /*!(nMobHInChI && nMobHInChI[i] ) &&*/
 3087|       |                /* has (+) edge */
 3088|    126|                (e = pVA[iat].nCPlusGroupEdge - 1) >= 0 && 0 == pBNS->edge[e].forbidden) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3088:17): [True: 126, False: 0]
  |  Branch (3088:60): [True: 120, False: 6]
  ------------------
 3089|    120|            {
 3090|       |
 3091|    120|                iat_DB_Charged[num_DB_Charged++] = iat;
 3092|       |                /*
 3093|       |                if ( ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ) ) {
 3094|       |                goto exit_function;
 3095|       |                }
 3096|       |                */
 3097|    120|            }
 3098|  4.66k|            else
 3099|  4.66k|            {
 3100|  4.66k|                if ( /* in restored atom: charge=0, has no H, has no double bond, N only */
 3101|  4.66k|                    num_SB_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  9.33k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (3101:21): [True: 4.66k, False: 0]
  ------------------
 3102|  4.66k|                    at2[iat].charge == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (3102:21): [True: 3.19k, False: 1.47k]
  |  Branch (3102:45): [True: 2.79k, False: 396]
  ------------------
 3103|  2.79k|                    at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (3103:21): [True: 804, False: 1.99k]
  |  Branch (3103:72): [True: 607, False: 197]
  ------------------
 3104|    607|                    (pVA[iat].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (3104:22): [True: 188, False: 419]
  ------------------
 3105|    188|                        pVA[iat].cPeriodicRowNumber == 1) &&
  ------------------
  |  Branch (3105:25): [True: 149, False: 39]
  ------------------
 3106|       |                    /* in orig.InChI: an endpoint, has fixed-H */
 3107|       |                    /*pStruct->endpoint[i] &&*/
 3108|    149|                    !(pStruct->fixed_H && pStruct->fixed_H[i]) &&
  ------------------
  |  Branch (3108:23): [True: 149, False: 0]
  |  Branch (3108:43): [True: 0, False: 149]
  ------------------
 3109|    149|                    !(nMobHInChI && nMobHInChI[i]) &&
  ------------------
  |  Branch (3109:23): [True: 149, False: 0]
  |  Branch (3109:37): [True: 0, False: 149]
  ------------------
 3110|       |                    /* has (+) edge */
 3111|    149|                    (e = pVA[iat].nCPlusGroupEdge - 1) >= 0 && 0 == pBNS->edge[e].forbidden)
  ------------------
  |  Branch (3111:21): [True: 139, False: 10]
  |  Branch (3111:64): [True: 139, False: 0]
  ------------------
 3112|    139|                {
 3113|       |
 3114|    139|                    iat_SB_Neutr[num_SB_Neutr++] = iat;
 3115|    139|                    if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    139|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (3115:25): [True: 0, False: 139]
  ------------------
 3116|      0|                    {
 3117|      0|                        goto exit_function;
 3118|      0|                    }
 3119|    139|                }
 3120|  4.66k|            }
 3121|  4.78k|        }
 3122|    621|        if ((num_try = inchi_min(num_SB_Neutr, num_DB_Charged))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|    621|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 78, False: 543]
  |  |  ------------------
  ------------------
  |  Branch (3122:13): [True: 32, False: 589]
  ------------------
 3123|     32|        {
 3124|       |            /* detected; attempt to fix */
 3125|     32|            BNS_VERTEX* pv1n, * pv2n;
 3126|     32|            BNS_EDGE* pe1n, * pe2n;
 3127|     32|            Vertex      v1n, v2n;
 3128|     32|            SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 3129|     32|            RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
 3130|     32|            delta = 1;
 3131|     64|            for (i = 0; i < num_DB_Charged && cur_success < num_try; i++)
  ------------------
  |  Branch (3131:25): [True: 37, False: 27]
  |  Branch (3131:47): [True: 32, False: 5]
  ------------------
 3132|     32|            {
 3133|     32|                iat = iat_DB_Charged[i];
 3134|     32|                pe = pBNS->edge + pVA[iat].nCPlusGroupEdge - 1;
 3135|     32|                if (pe->flow)
  ------------------
  |  Branch (3135:21): [True: 0, False: 32]
  ------------------
 3136|      0|                    continue;
 3137|     32|                pv1 = pBNS->vert + (v1 = pe->neighbor1);
 3138|     32|                pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
 3139|       |
 3140|     75|                for (j = pv1->num_adj_edges - 1; 0 <= j; j--)
  ------------------
  |  Branch (3140:50): [True: 75, False: 0]
  ------------------
 3141|     75|                {
 3142|     75|                    pe1n = pBNS->edge + pv1->iedge[j];
 3143|     75|                    if (pe1n->flow && !pe1n->forbidden)
  ------------------
  |  Branch (3143:25): [True: 32, False: 43]
  |  Branch (3143:39): [True: 32, False: 0]
  ------------------
 3144|     32|                    {
 3145|     32|                        pv1n = pBNS->vert + (v1n = pe1n->neighbor12 ^ v1);
 3146|     32|                        break;
 3147|     32|                    }
 3148|     75|                }
 3149|     32|                if (j < 0)
  ------------------
  |  Branch (3149:21): [True: 0, False: 32]
  ------------------
 3150|      0|                {
 3151|      0|                    continue; /* not found */
 3152|      0|                }
 3153|       |
 3154|    125|                for (j = pv2->num_adj_edges - 2; 0 <= j; j--)
  ------------------
  |  Branch (3154:50): [True: 125, False: 0]
  ------------------
 3155|    125|                {
 3156|    125|                    pe2n = pBNS->edge + pv2->iedge[j];
 3157|    125|                    if (pe2n->flow && !pe2n->forbidden)
  ------------------
  |  Branch (3157:25): [True: 83, False: 42]
  |  Branch (3157:39): [True: 32, False: 51]
  ------------------
 3158|     32|                    {
 3159|     32|                        pv2n = pBNS->vert + (v2n = pe2n->neighbor12 ^ v2);
 3160|     32|                        break;
 3161|     32|                    }
 3162|    125|                }
 3163|     32|                if (j < 0)
  ------------------
  |  Branch (3163:21): [True: 0, False: 32]
  ------------------
 3164|      0|                {
 3165|      0|                    continue; /* not found */
 3166|      0|                }
 3167|       |
 3168|     32|                pe->flow += delta;
 3169|     32|                pe1n->flow -= delta;
 3170|     32|                pe2n->flow -= delta;
 3171|     32|                pv1n->st_edge.flow -= delta;
 3172|     32|                pv2n->st_edge.flow -= delta;
 3173|     32|                pBNS->tot_st_flow -= 2 * delta;
 3174|       |
 3175|     32|                ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 3176|     32|                    &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 3177|       |
 3178|     32|                if (ret == 1 && ((vPathEnd == v1n && vPathStart == v2n) ||
  ------------------
  |  Branch (3178:21): [True: 24, False: 8]
  |  Branch (3178:35): [True: 3, False: 21]
  |  Branch (3178:54): [True: 3, False: 0]
  ------------------
 3179|     21|                    (vPathEnd == v2n && vPathStart == v1n)) &&
  ------------------
  |  Branch (3179:22): [True: 19, False: 2]
  |  Branch (3179:41): [True: 18, False: 1]
  ------------------
 3180|     21|                    (nDeltaCharge == 0 || nDeltaCharge == 1)) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (3180:22): [True: 18, False: 3]
  |  Branch (3180:43): [True: 3, False: 0]
  ------------------
 3181|     21|                {
 3182|       |                    /* before setting flows the structure could be:
 3183|       |                    [NH+ neigh, v1n]=e1n=[NH+,v1]-pe-[+,v2]=e2n=[another at or its chargeStruct]
 3184|       |                    or
 3185|       |
 3186|       |                    [NH+ or ChStr, v1n]=pe1n=[NH+ or ChStr, v1]-pe-[+,v2]=pe2n=[at2 or ChStr, v2n]
 3187|       |                    ^    ^    ^
 3188|       |                    NH+(+)edge |  N (+) edge: only
 3189|       |                    |  these are not forbidden
 3190|       |                    |
 3191|       |                    hetero (+) vertex
 3192|       |
 3193|       |                    After setting flows (* mark radicals, =pe= is forbidden):
 3194|       |
 3195|       |                    *[NH+ or ChStr, v1n]-pe1n-[NH+ or ChStr, v1]=pe=[+,v2]-pe2n-[at2 or ChStr, v2n]*
 3196|       |                    ^    ^    ^
 3197|       |                    NH+(+)edge |  N (+) edge: only
 3198|       |                    |  these are not forbidden
 3199|       |                    |
 3200|       |                    hetero (+) vertex
 3201|       |
 3202|       |                    Flow in
 3203|       |                    pe1n and pe2n will or will not change, depending on the structure.
 3204|       |
 3205|       |                    Consider what happens if pe2n changes. It may only increment.
 3206|       |                    If pe2n flow increments then another (+)edge flow dectrements. If
 3207|       |                    [at2 or ChStr, v2n] is at2 then at2 charge would change from (+) to 0,
 3208|       |                    and another N charge would change from 0 to (+), giving tot. change of
 3209|       |                    number of charges  (-1)+(+1)=0. However, if [at2 or ChStr, v2n] is
 3210|       |                    ChargeStruct then at2 will not be on the alt path and only the creation
 3211|       |                    of another (+) will be detected.
 3212|       |                    */
 3213|       |                    /* Removed charge from O(+) => nDeltaCharge == -1 */
 3214|       |                    /* Flow change on pe (+)charge edge (atom NH2) is not known to RunBnsTestOnce()) */
 3215|     21|                    ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
 3216|     21|                    if (ret > 0)
  ------------------
  |  Branch (3216:25): [True: 21, False: 0]
  ------------------
 3217|     21|                    {
 3218|     21|                        nNumRunBNS++;
 3219|     21|                        cur_success++; /* 11 */
 3220|     21|                    }
 3221|     21|                }
 3222|     11|                else
 3223|     11|                {
 3224|     11|                    pe->flow -= delta;
 3225|     11|                    pe1n->flow += delta;
 3226|     11|                    pe2n->flow += delta;
 3227|     11|                    pv1n->st_edge.flow += delta;
 3228|     11|                    pv2n->st_edge.flow += delta;
 3229|     11|                    pBNS->tot_st_flow += 2 * delta;
 3230|     11|                }
 3231|     32|                INCHI_HEAPCHK
 3232|     32|            }
 3233|     32|            RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 3234|     32|        }
 3235|    621|        CurrEdges.num_edges = 0; /* clear current edge list */
 3236|    621|        if (cur_success)
  ------------------
  |  Branch (3236:13): [True: 21, False: 600]
  ------------------
 3237|     21|        {
 3238|     21|            tot_succes += cur_success;
 3239|       |            /* recalculate InChI from the structure */
 3240|     21|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (3240:17): [True: 0, False: 21]
  ------------------
 3241|     21|                ppt_group_info, ppat_norm, ppat_prep)))
 3242|      0|            {
 3243|      0|                goto exit_function;
 3244|      0|            }
 3245|     21|            if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3245:17): [True: 0, False: 21]
  ------------------
 3246|      0|            {
 3247|      0|                goto exit_function;
 3248|      0|            }
 3249|     21|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (3249:17): [True: 0, False: 21]
  |  Branch (3249:45): [True: 0, False: 0]
  ------------------
 3250|      0|            {
 3251|      0|                goto exit_function;  /* no fixed-H found */
 3252|      0|            }
 3253|     21|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3253:17): [True: 0, False: 21]
  ------------------
 3254|      0|            {
 3255|      0|                goto exit_function;
 3256|      0|            }
 3257|     21|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (3257:17): [True: 0, False: 21]
  ------------------
 3258|      0|            {
 3259|      0|                goto exit_function; /* nothing to do */
 3260|      0|            }
 3261|     21|        }
 3262|    621|    }
 3263|       |
 3264|  1.13k|    if (pc2i->len_c2at >= 1 && pc2i->nNumTgInChI == 1 &&
  ------------------
  |  Branch (3264:9): [True: 1.12k, False: 3]
  |  Branch (3264:32): [True: 734, False: 395]
  ------------------
 3265|    734|         pc2i->nNumRemHInChI >= -1 && /* 2006-03-03 */
  ------------------
  |  Branch (3265:10): [True: 734, False: 0]
  ------------------
 3266|    734|         ( pc2i->nNumEndpInChI > pc2i->nNumEndpRevrs || pc2i->nNumTgRevrs > 1 ) /* ADP in InChI */)
  ------------------
  |  Branch (3266:12): [True: 605, False: 129]
  |  Branch (3266:57): [True: 12, False: 117]
  ------------------
 3267|    617|    {
 3268|       |        /*--------------------------------------------------------------*/
 3269|       |        /* case 12: restored: O=AB-N<         original: (-)O-AB=N(+)<   */
 3270|       |        /* FixH:              0    0                     0        0     */
 3271|       |        /* MobH:              0    0                     0        0     */
 3272|       |        /*                   non-taut                   taut            */
 3273|       |        /* O = O, S, Se, N; N = N;                                         */
 3274|       |        /* restored atom O is not tautomeric; original atom O is taut.  */
 3275|       |        /* original struct has 1 t-group; restored has less endpoints   */
 3276|       |        /*                             and/or possibly >1 t-groups      */
 3277|       |        /* Solution: separate charges between O= and -N<                */
 3278|       |        /*           allow moving charge to N(V) to make it N(IV)(+)    */
 3279|       |        /*--------------------------------------------------------------*/
 3280|    617|        int bOnly_N_V = 1;
 3281|       |        /* djb-rwth: removing redundant code */
 3282|  1.14k|        while (1)
  ------------------
  |  Branch (3282:16): [True: 1.14k, Folded]
  ------------------
 3283|  1.14k|        {
 3284|  1.14k|            int num_SB_N_Neutr = 0, num_DB_O = 0, iat, num_N_V = 0, bN_V;
 3285|  1.14k|            AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 3286|  1.14k|            inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (3286:45): [True: 355, False: 788]
  ------------------
 3287|  1.14k|                                            pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (3287:45): [True: 355, False: 0]
  ------------------
 3288|  1.14k|            S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (3288:36): [True: 1.14k, False: 0]
  |  Branch (3288:49): [True: 1.14k, False: 0]
  ------------------
 3289|  1.14k|                pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (3289:17): [True: 0, False: 0]
  |  Branch (3289:30): [True: 0, False: 0]
  ------------------
 3290|  1.14k|            cur_success = 0;
 3291|       |
 3292|  4.89k|            for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (3292:25): [True: 3.75k, False: 1.14k]
  ------------------
 3293|  3.75k|            {
 3294|  3.75k|                iat = pc2i->c2at[i].atomNumber;
 3295|  3.75k|                if ( /* orig. InChI info: -O(-) */
 3296|  3.75k|                    num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  7.50k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (3296:21): [True: 3.75k, False: 0]
  ------------------
 3297|  3.75k|                    (pc2i->c2at[i].nValElectr == 6 /* O, S, Se, Te */ ||
  ------------------
  |  Branch (3297:22): [True: 2.02k, False: 1.73k]
  ------------------
 3298|  1.73k|                        (pc2i->c2at[i].nValElectr == 5 &&
  ------------------
  |  Branch (3298:26): [True: 1.11k, False: 619]
  ------------------
 3299|  1.11k|                        pc2i->c2at[i].nPeriodNum == 1) /* N */) && /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3299:25): [True: 912, False: 200]
  ------------------
 3300|  2.93k|                    pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (3300:21): [True: 2.01k, False: 917]
  ------------------
 3301|  2.01k|                    (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (3301:21): [True: 1.49k, False: 519]
  |  Branch (3301:65): [True: 1.49k, False: 0]
  ------------------
 3302|  1.49k|                    pc2i->c2at[i].nFixHInChI == 0 && pc2i->c2at[i].nMobHInChI == 0 &&
  ------------------
  |  Branch (3302:21): [True: 1.45k, False: 45]
  |  Branch (3302:54): [True: 1.45k, False: 0]
  ------------------
 3303|       |                    /* reversed structure info: */
 3304|  1.45k|                    !pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (3304:21): [True: 1.45k, False: 0]
  ------------------
 3305|  1.45k|                    pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs == 0 &&
  ------------------
  |  Branch (3305:21): [True: 1.42k, False: 27]
  |  Branch (3305:54): [True: 1.42k, False: 0]
  ------------------
 3306|  1.42k|                    pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (3306:21): [True: 992, False: 432]
  |  Branch (3306:58): [True: 992, False: 0]
  ------------------
 3307|    992|                    ((pc2i->c2at[i].nValElectr == 6) ?
  ------------------
  |  Branch (3307:21): [True: 923, False: 69]
  |  Branch (3307:22): [True: 700, False: 292]
  ------------------
 3308|    700|                        (at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 2) :
  ------------------
  |  Branch (3308:26): [True: 695, False: 5]
  |  Branch (3308:51): [True: 650, False: 45]
  ------------------
 3309|    992|                        (pc2i->c2at[i].nValElectr == 5) ?
  ------------------
  |  Branch (3309:25): [True: 292, False: 0]
  ------------------
 3310|    292|                        (at2[iat].valence == 2 && at2[iat].chem_bonds_valence == 3) :
  ------------------
  |  Branch (3310:26): [True: 278, False: 14]
  |  Branch (3310:51): [True: 273, False: 5]
  ------------------
 3311|    292|                        0))
 3312|    923|                {
 3313|       |
 3314|    923|                    iat_DB_O[num_DB_O++] = iat;
 3315|       |                    /*
 3316|       |                    if ( ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ) ) {
 3317|       |                    goto exit_function;
 3318|       |                    }
 3319|       |                    */
 3320|    923|                }
 3321|  3.75k|            }
 3322|  9.93k|            for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (3322:25): [True: 8.79k, False: 1.14k]
  ------------------
 3323|  8.79k|            {
 3324|       |                /* i = canonical number - 1 */
 3325|  8.79k|                iat = nCanon2AtnoRevrs[i];
 3326|  8.79k|                bN_V = 0;
 3327|  8.79k|                if ( /* in restored atom N: charge=0, no H, has no double bond, not an endpoint */
 3328|  8.79k|                    num_SB_N_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  17.5k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (3328:21): [True: 8.79k, False: 0]
  ------------------
 3329|  8.79k|                    at2[iat].charge == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (3329:21): [True: 5.79k, False: 2.99k]
  |  Branch (3329:45): [True: 5.01k, False: 784]
  ------------------
 3330|  5.01k|                    (at2[iat].valence == at2[iat].chem_bonds_valence ||
  ------------------
  |  Branch (3330:22): [True: 1.42k, False: 3.58k]
  ------------------
 3331|  3.58k|                        (bN_V = at2[iat].valence + 2 == at2[iat].chem_bonds_valence)) &&
  ------------------
  |  Branch (3331:25): [True: 702, False: 2.88k]
  ------------------
 3332|  2.12k|                    !pVA[iat].cMetal &&
  ------------------
  |  Branch (3332:21): [True: 1.68k, False: 438]
  ------------------
 3333|  1.68k|                    pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (3333:21): [True: 680, False: 1.00k]
  |  Branch (3333:59): [True: 499, False: 181]
  ------------------
 3334|    499|                    !(at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint) &&
  ------------------
  |  Branch (3334:23): [True: 129, False: 370]
  |  Branch (3334:44): [True: 0, False: 129]
  ------------------
 3335|       |                    /* in orig.InChI: not an endpoint, has no H */
 3336|    499|                    !pStruct->endpoint[i] &&
  ------------------
  |  Branch (3336:21): [True: 379, False: 120]
  ------------------
 3337|    379|                    !(pStruct->fixed_H && pStruct->fixed_H[i]) &&
  ------------------
  |  Branch (3337:23): [True: 379, False: 0]
  |  Branch (3337:43): [True: 8, False: 371]
  ------------------
 3338|    371|                    !(nMobHInChI && nMobHInChI[i]) &&
  ------------------
  |  Branch (3338:23): [True: 371, False: 0]
  |  Branch (3338:37): [True: 0, False: 371]
  ------------------
 3339|       |                    /* has (+) edge */
 3340|    371|                    (e = pVA[iat].nCPlusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (3340:21): [True: 309, False: 62]
  |  Branch (3340:64): [True: 309, False: 0]
  ------------------
 3341|    309|                {
 3342|       |
 3343|    309|                    if (bOnly_N_V && bN_V &&
  ------------------
  |  Branch (3343:25): [True: 204, False: 105]
  |  Branch (3343:38): [True: 100, False: 104]
  ------------------
 3344|    100|                        NO_VERTEX != (j = GetChargeFlowerUpperEdge(pBNS, pVA, e)) &&
  ------------------
  |  |  118|    100|#define NO_VERTEX    -2
  ------------------
  |  Branch (3344:25): [True: 97, False: 3]
  ------------------
 3345|     97|                        !pBNS->edge[j].forbidden && !pBNS->edge[j].flow)
  ------------------
  |  Branch (3345:25): [True: 97, False: 0]
  |  Branch (3345:53): [True: 97, False: 0]
  ------------------
 3346|     97|                    {
 3347|     97|                        if (!num_N_V)
  ------------------
  |  Branch (3347:29): [True: 95, False: 2]
  ------------------
 3348|     95|                        {
 3349|       |                            /* switch to N(V) only mode */
 3350|     95|                            CurrEdges.num_edges = 0;
 3351|     95|                            num_SB_N_Neutr = 0;
 3352|     95|                        }
 3353|     97|                        iat_SB_N_Neutr[num_SB_N_Neutr++] = iat;
 3354|     97|                        num_N_V++;
 3355|     97|                        if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|     97|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (3355:29): [True: 0, False: 97]
  ------------------
 3356|      0|                        {
 3357|      0|                            goto exit_function;
 3358|      0|                        }
 3359|     97|                        if ((ret = AddToEdgeList(&CurrEdges, j, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|     97|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (3359:29): [True: 0, False: 97]
  ------------------
 3360|      0|                        {
 3361|      0|                            goto exit_function;
 3362|      0|                        }
 3363|     97|                    }
 3364|    212|                    else
 3365|    212|                    {
 3366|    212|                        if (!num_N_V)
  ------------------
  |  Branch (3366:29): [True: 209, False: 3]
  ------------------
 3367|    209|                        {
 3368|    209|                            iat_SB_N_Neutr[num_SB_N_Neutr++] = iat;
 3369|    209|                            if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    209|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (3369:33): [True: 0, False: 209]
  ------------------
 3370|      0|                            {
 3371|      0|                                goto exit_function;
 3372|      0|                            }
 3373|       |                            /* in addition, permit N(V)=>N(IV)(+) change by allowing charge flower edge change flow */
 3374|    209|                            if (bN_V && NO_VERTEX != (j = GetChargeFlowerUpperEdge(pBNS, pVA, e)) &&
  ------------------
  |  |  118|     41|#define NO_VERTEX    -2
  ------------------
  |  Branch (3374:33): [True: 41, False: 168]
  |  Branch (3374:41): [True: 36, False: 5]
  ------------------
 3375|     36|                                !pBNS->edge[j].forbidden && !pBNS->edge[j].flow)
  ------------------
  |  Branch (3375:33): [True: 36, False: 0]
  |  Branch (3375:61): [True: 36, False: 0]
  ------------------
 3376|     36|                            {
 3377|     36|                                if ((ret = AddToEdgeList(&CurrEdges, j, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|     36|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (3377:37): [True: 0, False: 36]
  ------------------
 3378|      0|                                {
 3379|      0|                                    goto exit_function;
 3380|      0|                                }
 3381|     36|                            }
 3382|    209|                        }
 3383|    212|                    }
 3384|    309|                }
 3385|  8.79k|            }
 3386|  1.14k|            if ((num_try = inchi_min(num_SB_N_Neutr, num_DB_O))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|  1.14k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 482, False: 661]
  |  |  ------------------
  ------------------
  |  Branch (3386:17): [True: 173, False: 970]
  ------------------
 3387|    173|            {
 3388|       |                /* detected; attempt to fix */
 3389|    173|                BNS_EDGE* pe_CMinus;
 3390|    173|                SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 3391|    173|                RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
 3392|    173|                delta = 1;
 3393|    401|                for (i = 0; i < num_DB_O && cur_success < num_try; i++)
  ------------------
  |  Branch (3393:29): [True: 273, False: 128]
  |  Branch (3393:45): [True: 228, False: 45]
  ------------------
 3394|    228|                {
 3395|    228|                    iat = iat_DB_O[i];
 3396|    228|                    pe_CMinus = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
 3397|    228|                    pe_CMinus->forbidden &= forbidden_edge_mask_inv;
 3398|       |
 3399|    228|                    pe = pBNS->edge + pBNS->vert[iat].iedge[0]; /* double bond O=...*/
 3400|    228|                    if (!pe->flow)
  ------------------
  |  Branch (3400:25): [True: 38, False: 190]
  ------------------
 3401|     38|                        continue;
 3402|    190|                    pv1 = pBNS->vert + (v1 = pe->neighbor1);
 3403|    190|                    pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
 3404|       |
 3405|    190|                    pe->forbidden |= forbidden_edge_mask; /* change bond O=X to O(rad)-X(rad) */
 3406|    190|                    pe->flow -= delta;
 3407|    190|                    pv1->st_edge.flow -= delta;
 3408|    190|                    pv2->st_edge.flow -= delta;
 3409|    190|                    pBNS->tot_st_flow -= 2 * delta;
 3410|       |
 3411|    190|                    ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 3412|    190|                        &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 3413|       |
 3414|    190|                    if (ret == 1 && ((vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (3414:25): [True: 168, False: 22]
  |  Branch (3414:39): [True: 21, False: 147]
  |  Branch (3414:57): [True: 5, False: 16]
  ------------------
 3415|    163|                        (vPathEnd == v2 && vPathStart == v1)) && nDeltaCharge == 2) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (3415:26): [True: 131, False: 32]
  |  Branch (3415:44): [True: 120, False: 11]
  |  Branch (3415:66): [True: 91, False: 34]
  ------------------
 3416|     91|                    {
 3417|       |                        /* Added (-) charge to =O and (+) charge to N => nDeltaCharge == 2 */
 3418|     91|                        ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
 3419|     91|                        if (ret > 0)
  ------------------
  |  Branch (3419:29): [True: 91, False: 0]
  ------------------
 3420|     91|                        {
 3421|     91|                            nNumRunBNS++;
 3422|     91|                            cur_success++; /* 12 */
 3423|     91|                        }
 3424|     91|                    }
 3425|     99|                    else
 3426|     99|                    {
 3427|     99|                        pe->flow += delta;
 3428|     99|                        pv1->st_edge.flow += delta;
 3429|     99|                        pv2->st_edge.flow += delta;
 3430|     99|                        pBNS->tot_st_flow += 2 * delta;
 3431|     99|                    }
 3432|    190|                    pe->forbidden &= forbidden_edge_mask_inv; /* allow changes to O=X bond */
 3433|    190|                    INCHI_HEAPCHK
 3434|    190|                }
 3435|    173|                RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 3436|    173|            }
 3437|  1.14k|            CurrEdges.num_edges = 0; /* clear current edge list */
 3438|  1.14k|            if (cur_success)
  ------------------
  |  Branch (3438:17): [True: 91, False: 1.05k]
  ------------------
 3439|     91|            {
 3440|     91|                tot_succes += cur_success;
 3441|       |                /* recalculate InChI from the structure */
 3442|     91|                if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (3442:21): [True: 1, False: 90]
  ------------------
 3443|     91|                    ppt_group_info, ppat_norm, ppat_prep)))
 3444|      1|                {
 3445|      1|                    goto exit_function;
 3446|      1|                }
 3447|     90|                if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3447:21): [True: 0, False: 90]
  ------------------
 3448|      0|                {
 3449|      0|                    goto exit_function;
 3450|      0|                }
 3451|     90|                if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (3451:21): [True: 58, False: 32]
  |  Branch (3451:49): [True: 0, False: 58]
  ------------------
 3452|      0|                {
 3453|      0|                    goto exit_function;  /* no fixed-H found */
 3454|      0|                }
 3455|     90|                if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3455:21): [True: 0, False: 90]
  ------------------
 3456|      0|                {
 3457|      0|                    goto exit_function;
 3458|      0|                }
 3459|     90|                if (!pc2i->bHasDifference)
  ------------------
  |  Branch (3459:21): [True: 0, False: 90]
  ------------------
 3460|      0|                {
 3461|      0|                    goto exit_function; /* nothing to do */
 3462|      0|                }
 3463|     90|                break;
 3464|     90|            }
 3465|  1.05k|            else
 3466|  1.05k|            {
 3467|  1.05k|                if (bOnly_N_V)
  ------------------
  |  Branch (3467:21): [True: 526, False: 526]
  ------------------
 3468|    526|                {
 3469|    526|                    bOnly_N_V = 0;
 3470|    526|                }
 3471|    526|                else
 3472|    526|                {
 3473|    526|                    break;
 3474|    526|                }
 3475|  1.05k|            }
 3476|  1.14k|        }
 3477|    617|    }
 3478|       |
 3479|       |
 3480|  1.13k|    if (pc2i->nNumTgDiffMinus /*|| pc2i->nNumTgDiffH */ /* no ADP in InChI needed */)
  ------------------
  |  Branch (3480:9): [True: 66, False: 1.06k]
  ------------------
 3481|     66|    {
 3482|       |        /*--------------------------------------------------------------*/
 3483|       |        /*                         |                            |       */
 3484|       |        /* case 13: restored: O=AB=N=         original: (-)O-AB-N(+)=   */
 3485|       |        /* FixH:              0    0                     0        0     */
 3486|       |        /* MobH:              0    0                     0        0     */
 3487|       |        /*                        non-taut              taut   non-taut */
 3488|       |        /* O = O, S, Se, N; N = N, P, ...                               */
 3489|       |        /* t-group in original has same num. endpoints                  */
 3490|       |        /*       same num_H and less (-) than in the restored structure */
 3491|       |        /* original atom O is tautomeric, N is not taut in both         */
 3492|       |        /* original struct has 1 t-group; restored has less endpoints   */
 3493|       |        /*                             and/or possibly >1 t-groups      */
 3494|       |        /* Solution: separate charges between O= and -N<                */
 3495|       |        /*           allow moving charge to N(V) to make it N(IV)(+)    */
 3496|       |        /*--------------------------------------------------------------*/
 3497|     66|        int itg;
 3498|     66|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 3499|     66|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (3499:41): [True: 66, False: 0]
  ------------------
 3500|     66|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (3500:41): [True: 66, False: 0]
  ------------------
 3501|       |
 3502|     66|        S_CHAR   *num_Fixed_H_Revrs = pStruct->pOneINChI[0]->nNum_H_fixed ? pStruct->pOneINChI[0]->nNum_H_fixed : NULL;
  ------------------
  |  Branch (3502:39): [True: 66, False: 0]
  ------------------
 3503|     66|        S_CHAR   *pnMobHRevrs = ( pStruct->pOneINChI[1] && pStruct->pOneINChI[1]->nNum_H ) ?
  ------------------
  |  Branch (3503:35): [True: 66, False: 0]
  |  Branch (3503:60): [True: 66, False: 0]
  ------------------
 3504|     66|            pStruct->pOneINChI[1]->nNum_H :
 3505|     66|            ( pStruct->pOneINChI[0] && pStruct->pOneINChI[0]->nNum_H ) ?
  ------------------
  |  Branch (3505:15): [True: 0, False: 0]
  |  Branch (3505:40): [True: 0, False: 0]
  ------------------
 3506|      0|            pStruct->pOneINChI[0]->nNum_H : NULL;
 3507|     66|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (3507:32): [True: 66, False: 0]
  |  Branch (3507:45): [True: 66, False: 0]
  ------------------
 3508|     66|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (3508:13): [True: 0, False: 0]
  |  Branch (3508:26): [True: 0, False: 0]
  ------------------
 3509|       |        /* djb-rwth: removing redundant code */
 3510|       |        /* find whether this may help */
 3511|    139|        for (itg = 0; itg < pStruct->ti.num_t_groups && itg < pStruct->One_ti.num_t_groups; itg++)
  ------------------
  |  Branch (3511:23): [True: 78, False: 61]
  |  Branch (3511:57): [True: 73, False: 5]
  ------------------
 3512|     73|        {
 3513|     73|            if (pStruct->ti.t_group[itg].nNumEndpoints == pStruct->One_ti.t_group[itg].nNumEndpoints &&
  ------------------
  |  Branch (3513:17): [True: 68, False: 5]
  ------------------
 3514|     68|                 pStruct->ti.t_group[itg].num[0] - pStruct->ti.t_group[itg].num[1] ==
  ------------------
  |  Branch (3514:18): [True: 0, False: 68]
  ------------------
 3515|     68|                 pStruct->One_ti.t_group[itg].num[0] - pStruct->One_ti.t_group[itg].num[1] &&
 3516|      0|                 pStruct->ti.t_group[itg].num[1] > pStruct->One_ti.t_group[itg].num[1])
  ------------------
  |  Branch (3516:18): [True: 0, False: 0]
  ------------------
 3517|      0|            {
 3518|       |                /* restored InChI t-group has more (-) and same number of H */
 3519|      0|                int num_SB_N_Neutr = 0, num_DB_O = 0, iat;
 3520|      0|                cur_success = 0;
 3521|       |
 3522|      0|                for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (3522:29): [True: 0, False: 0]
  ------------------
 3523|      0|                { /* i = canonical number - 1 */
 3524|      0|                    iat = nCanon2AtnoRevrs[i];
 3525|      0|                    if ( /* orig. InChI info: -O(-) */
 3526|      0|                        num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (3526:25): [True: 0, False: 0]
  ------------------
 3527|      0|                        (pVA[i].cNumValenceElectrons == 6 /* O, S, Se, Te */) &&
  ------------------
  |  Branch (3527:25): [True: 0, False: 0]
  ------------------
 3528|      0|                        pStruct->endpoint[i] == itg + 1 &&
  ------------------
  |  Branch (3528:25): [True: 0, False: 0]
  ------------------
 3529|      0|                        (e = pVA[i].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (3529:25): [True: 0, False: 0]
  |  Branch (3529:67): [True: 0, False: 0]
  ------------------
 3530|      0|                        !(pStruct->fixed_H && pStruct->fixed_H[i]) &&
  ------------------
  |  Branch (3530:27): [True: 0, False: 0]
  |  Branch (3530:47): [True: 0, False: 0]
  ------------------
 3531|      0|                        !(nMobHInChI && nMobHInChI[i]) &&
  ------------------
  |  Branch (3531:27): [True: 0, False: 0]
  |  Branch (3531:41): [True: 0, False: 0]
  ------------------
 3532|       |                        /* reversed structure info: */
 3533|       |                        /*!pc2i->c2at[i].endptRevrs &&*/
 3534|      0|                        !(num_Fixed_H_Revrs && num_Fixed_H_Revrs[iat]) &&
  ------------------
  |  Branch (3534:27): [True: 0, False: 0]
  |  Branch (3534:48): [True: 0, False: 0]
  ------------------
 3535|      0|                        !(pnMobHRevrs && pnMobHRevrs[iat]) &&
  ------------------
  |  Branch (3535:27): [True: 0, False: 0]
  |  Branch (3535:42): [True: 0, False: 0]
  ------------------
 3536|      0|                        at2[iat].charge == 0 && at2[iat].num_H == 0 &&
  ------------------
  |  Branch (3536:25): [True: 0, False: 0]
  |  Branch (3536:49): [True: 0, False: 0]
  ------------------
 3537|      0|                        at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 2)
  ------------------
  |  Branch (3537:25): [True: 0, False: 0]
  |  Branch (3537:50): [True: 0, False: 0]
  ------------------
 3538|      0|                    {
 3539|       |
 3540|      0|                        iat_DB_O[num_DB_O++] = iat;
 3541|       |                        /*
 3542|       |                        if ( ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ) ) {
 3543|       |                        goto exit_function;
 3544|       |                        }
 3545|       |                        */
 3546|      0|                    }
 3547|      0|                    else
 3548|      0|                    {
 3549|      0|                        if ( /* in restored atom N: charge=0, no H, has no double bond, not an endpoint */
 3550|      0|                            num_SB_N_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (3550:29): [True: 0, False: 0]
  ------------------
 3551|      0|                            at2[iat].charge == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (3551:29): [True: 0, False: 0]
  |  Branch (3551:53): [True: 0, False: 0]
  ------------------
 3552|       |                            /*at2[iat].valence == at2[iat].chem_bonds_valence ||*/
 3553|      0|                            (at2[iat].valence == 4 && at2[iat].chem_bonds_valence == 5) &&
  ------------------
  |  Branch (3553:30): [True: 0, False: 0]
  |  Branch (3553:55): [True: 0, False: 0]
  ------------------
 3554|      0|                            !pVA[iat].cMetal &&
  ------------------
  |  Branch (3554:29): [True: 0, False: 0]
  ------------------
 3555|      0|                            pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber >= 1 &&
  ------------------
  |  Branch (3555:29): [True: 0, False: 0]
  |  Branch (3555:67): [True: 0, False: 0]
  ------------------
 3556|      0|                            !(at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint) &&
  ------------------
  |  Branch (3556:31): [True: 0, False: 0]
  |  Branch (3556:52): [True: 0, False: 0]
  ------------------
 3557|       |                            /* in orig.InChI: not an endpoint, has no H */
 3558|      0|                            !pStruct->endpoint[i] &&
  ------------------
  |  Branch (3558:29): [True: 0, False: 0]
  ------------------
 3559|      0|                            !(pStruct->fixed_H && pStruct->fixed_H[i]) &&
  ------------------
  |  Branch (3559:31): [True: 0, False: 0]
  |  Branch (3559:51): [True: 0, False: 0]
  ------------------
 3560|      0|                            !(nMobHInChI && nMobHInChI[i]) &&
  ------------------
  |  Branch (3560:31): [True: 0, False: 0]
  |  Branch (3560:45): [True: 0, False: 0]
  ------------------
 3561|       |                            /* has (+) edge */
 3562|      0|                            (e = pVA[iat].nCPlusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (3562:29): [True: 0, False: 0]
  |  Branch (3562:72): [True: 0, False: 0]
  ------------------
 3563|      0|                        {
 3564|       |
 3565|      0|                            iat_SB_N_Neutr[num_SB_N_Neutr++] = iat;
 3566|      0|                            if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (3566:33): [True: 0, False: 0]
  ------------------
 3567|      0|                            {
 3568|      0|                                goto exit_function;
 3569|      0|                            }
 3570|      0|                        }
 3571|      0|                    }
 3572|      0|                }
 3573|      0|                if ((num_try = inchi_min(num_SB_N_Neutr, num_DB_O))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (3573:21): [True: 0, False: 0]
  ------------------
 3574|      0|                {
 3575|       |                    /* detected; attempt to fix */
 3576|      0|                    BNS_EDGE* pe_CMinus;
 3577|      0|                    SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 3578|      0|                    RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
 3579|      0|                    delta = 1;
 3580|      0|                    for (i = 0; i < num_DB_O && cur_success < num_try; i++)
  ------------------
  |  Branch (3580:33): [True: 0, False: 0]
  |  Branch (3580:49): [True: 0, False: 0]
  ------------------
 3581|      0|                    {
 3582|      0|                        iat = iat_DB_O[i];
 3583|      0|                        pe_CMinus = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
 3584|      0|                        pe_CMinus->forbidden &= forbidden_edge_mask_inv;
 3585|       |
 3586|      0|                        pe = pBNS->edge + pBNS->vert[iat].iedge[0]; /* double bond O=...*/
 3587|      0|                        if (!pe->flow)
  ------------------
  |  Branch (3587:29): [True: 0, False: 0]
  ------------------
 3588|      0|                            continue;
 3589|      0|                        pv1 = pBNS->vert + (v1 = pe->neighbor1);
 3590|      0|                        pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
 3591|       |
 3592|      0|                        pe->forbidden |= forbidden_edge_mask; /* change bond O=X to O(rad)-X(rad) */
 3593|      0|                        pe->flow -= delta;
 3594|      0|                        pv1->st_edge.flow -= delta;
 3595|      0|                        pv2->st_edge.flow -= delta;
 3596|      0|                        pBNS->tot_st_flow -= 2 * delta;
 3597|       |
 3598|      0|                        ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 3599|      0|                            &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 3600|       |
 3601|      0|                        if (ret == 1 && ((vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (3601:29): [True: 0, False: 0]
  |  Branch (3601:43): [True: 0, False: 0]
  |  Branch (3601:61): [True: 0, False: 0]
  ------------------
 3602|      0|                            (vPathEnd == v2 && vPathStart == v1)) && nDeltaCharge == 2) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3602:30): [True: 0, False: 0]
  |  Branch (3602:48): [True: 0, False: 0]
  |  Branch (3602:70): [True: 0, False: 0]
  ------------------
 3603|      0|                        {
 3604|       |                            /* Added (-) charge to =O and (+) charge to N => nDeltaCharge == 2 */
 3605|      0|                            ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
 3606|      0|                            if (ret > 0)
  ------------------
  |  Branch (3606:33): [True: 0, False: 0]
  ------------------
 3607|      0|                            {
 3608|      0|                                nNumRunBNS++;
 3609|      0|                                cur_success++; /* 13 */
 3610|      0|                            }
 3611|      0|                        }
 3612|      0|                        else
 3613|      0|                        {
 3614|      0|                            pe->flow += delta;
 3615|      0|                            pv1->st_edge.flow += delta;
 3616|      0|                            pv2->st_edge.flow += delta;
 3617|      0|                            pBNS->tot_st_flow += 2 * delta;
 3618|      0|                        }
 3619|      0|                        pe->forbidden &= forbidden_edge_mask_inv; /* allow changes to O=X bond */
 3620|      0|                        INCHI_HEAPCHK
 3621|      0|                    }
 3622|      0|                    RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 3623|      0|                }
 3624|      0|                CurrEdges.num_edges = 0; /* clear current edge list */
 3625|      0|                if (cur_success)
  ------------------
  |  Branch (3625:21): [True: 0, False: 0]
  ------------------
 3626|      0|                {
 3627|      0|                    tot_succes += cur_success;
 3628|       |                    /* recalculate InChI from the structure */
 3629|      0|                    if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (3629:25): [True: 0, False: 0]
  ------------------
 3630|      0|                        ppt_group_info, ppat_norm, ppat_prep)))
 3631|      0|                    {
 3632|      0|                        goto exit_function;
 3633|      0|                    }
 3634|      0|                    if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3634:25): [True: 0, False: 0]
  ------------------
 3635|      0|                    {
 3636|      0|                        goto exit_function;
 3637|      0|                    }
 3638|      0|                    if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (3638:25): [True: 0, False: 0]
  |  Branch (3638:53): [True: 0, False: 0]
  ------------------
 3639|      0|                    {
 3640|      0|                        goto exit_function;  /* no fixed-H found */
 3641|      0|                    }
 3642|      0|                    if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3642:25): [True: 0, False: 0]
  ------------------
 3643|      0|                    {
 3644|      0|                        goto exit_function;
 3645|      0|                    }
 3646|      0|                    if (!pc2i->bHasDifference)
  ------------------
  |  Branch (3646:25): [True: 0, False: 0]
  ------------------
 3647|      0|                    {
 3648|      0|                        goto exit_function; /* nothing to do */
 3649|      0|                    }
 3650|      0|                    break;
 3651|      0|                }/* else
 3652|       |                    if ( bOnly_N_V ) {
 3653|       |                    bOnly_N_V = 0;
 3654|       |                    }
 3655|       |                    */
 3656|      0|            }
 3657|     73|        }
 3658|     66|    }
 3659|       |
 3660|  1.13k|    if (( (pc2i->nNumTgInChI <= 1 &&
  ------------------
  |  Branch (3660:12): [True: 1.08k, False: 47]
  ------------------
 3661|  1.08k|          pc2i->nNumRemHInChI > pc2i->nNumRemHRevrs) || pc2i->len_c2at ) &&
  ------------------
  |  Branch (3661:11): [True: 231, False: 853]
  |  Branch (3661:57): [True: 900, False: 0]
  ------------------
 3662|  1.13k|         bHas_N_V( at2, pStruct->num_atoms )) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (3662:10): [True: 148, False: 983]
  ------------------
 3663|    148|    {
 3664|       |        /*-----------------------------------------------------------------*/
 3665|       |        /*                         |                         |             */
 3666|       |        /* case 14: restored:-N=AB=N=CD-XH original: (-)N-AB-N(+)=CD-XH    */
 3667|       |        /* FixH:              0    0   0/1              0            1     */
 3668|       |        /* MobH:              0    0   1/0              0            0     */
 3669|       |        /*                   non-taut  n/t             any  non     any    */
 3670|       |        /*                                                  taut           */
 3671|       |        /* X = O, S, Se, N; N = N                                          */
 3672|       |        /* t-group in original may have more (-) than in restored          */
 3673|       |        /*       same num_H and less (-) than in the restored structure    */
 3674|       |        /* atom N(V)/N(IV)(+) is not taut in both                          */
 3675|       |        /* The following transformation should be possible:                */
 3676|       |        /*        |                         |                              */
 3677|       |        /*   N=AB=N=CD-XH    ->     (-)N-AB-N-CD=XH(+)                     */
 3678|       |        /* This allows ADP to remove H(+) from -XH                         */
 3679|       |        /* As the result, the original structure has 0 or 1 t-group        */
 3680|       |        /* Solution: separate charges between -N(III)= and  N(V)           */
 3681|       |        /*-----------------------------------------------------------------*/
 3682|    148|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 3683|    148|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (3683:41): [True: 66, False: 82]
  ------------------
 3684|    148|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (3684:41): [True: 66, False: 0]
  ------------------
 3685|       |
 3686|    148|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (3686:32): [True: 148, False: 0]
  |  Branch (3686:45): [True: 148, False: 0]
  ------------------
 3687|    148|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (3687:13): [True: 0, False: 0]
  |  Branch (3687:26): [True: 0, False: 0]
  ------------------
 3688|    148|        int num_N_V = 0, iat, i1, i2, i3, e1Flower, e1Plus, e2Plus, e2Minus, e3Plus;
 3689|    148|        int max_success = pc2i->nNumRemHInChI - pc2i->nNumRemHRevrs;
 3690|    148|        EDGE_LIST iat_X_List, iat_N_III_List;
 3691|    148|        AllocEdgeList( &iat_X_List, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|    148|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 3692|    148|        AllocEdgeList( &iat_N_III_List, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|    148|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 3693|    148|        cur_success = 0;
 3694|    148|        ret = 0;
 3695|       |
 3696|  1.31k|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (3696:21): [True: 1.16k, False: 148]
  ------------------
 3697|  1.16k|        {
 3698|  1.16k|            iat = nCanon2AtnoRevrs[i];
 3699|       |            /* search for N(V), 3 bonds */
 3700|  1.16k|            if ( /* restored structure */
 3701|  1.16k|                num_N_V < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  2.32k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (3701:17): [True: 1.16k, False: 0]
  ------------------
 3702|  1.16k|                at2[iat].chem_bonds_valence == 5 && at2[iat].valence == 3 &&
  ------------------
  |  Branch (3702:17): [True: 204, False: 960]
  |  Branch (3702:53): [True: 190, False: 14]
  ------------------
 3703|    190|                !at2[iat].charge && !at2[iat].radical &&
  ------------------
  |  Branch (3703:17): [True: 186, False: 4]
  |  Branch (3703:37): [True: 185, False: 1]
  ------------------
 3704|    185|                pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (3704:17): [True: 170, False: 15]
  |  Branch (3704:55): [True: 152, False: 18]
  ------------------
 3705|    152|                !(at_Mobile_H_Revrs && at_Mobile_H_Revrs[i].endpoint) &&
  ------------------
  |  Branch (3705:19): [True: 70, False: 82]
  |  Branch (3705:40): [True: 0, False: 70]
  ------------------
 3706|    152|                !at2[iat].num_H &&
  ------------------
  |  Branch (3706:17): [True: 151, False: 1]
  ------------------
 3707|    151|                (e = pVA[iat].nCPlusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (3707:17): [True: 151, False: 0]
  |  Branch (3707:60): [True: 151, False: 0]
  ------------------
 3708|    151|                pBNS->edge[e].flow /* no charge */ &&
  ------------------
  |  Branch (3708:17): [True: 151, False: 0]
  ------------------
 3709|    151|                NO_VERTEX != (j = GetChargeFlowerUpperEdge(pBNS, pVA, e)) && !pBNS->edge[j].forbidden &&
  ------------------
  |  |  118|    151|#define NO_VERTEX    -2
  ------------------
  |  Branch (3709:17): [True: 148, False: 3]
  |  Branch (3709:78): [True: 148, False: 0]
  ------------------
 3710|    148|                !pBNS->edge[j].flow /* neutral, valence=5 */ &&
  ------------------
  |  Branch (3710:17): [True: 148, False: 0]
  ------------------
 3711|       |                /* orig. InChI */
 3712|    148|                !pStruct->endpoint[i] &&
  ------------------
  |  Branch (3712:17): [True: 107, False: 41]
  ------------------
 3713|    107|                !(nMobHInChI && nMobHInChI[i]) && pStruct->fixed_H && !pStruct->fixed_H[i]) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (3713:19): [True: 107, False: 0]
  |  Branch (3713:33): [True: 4, False: 103]
  |  Branch (3713:51): [True: 103, False: 0]
  |  Branch (3713:71): [True: 102, False: 1]
  ------------------
 3714|    102|            {
 3715|    102|                iat_N_V_Array[num_N_V++] = iat;
 3716|    102|            }
 3717|  1.06k|            else
 3718|  1.06k|            {
 3719|       |                /* search for -N= */
 3720|  1.06k|                if ( /* restored structure */
 3721|  1.06k|                    at2[iat].chem_bonds_valence == 3 && at2[iat].valence == 2 &&
  ------------------
  |  Branch (3721:21): [True: 297, False: 765]
  |  Branch (3721:57): [True: 223, False: 74]
  ------------------
 3722|    223|                    !at2[iat].charge && !at2[iat].radical &&
  ------------------
  |  Branch (3722:21): [True: 185, False: 38]
  |  Branch (3722:41): [True: 180, False: 5]
  ------------------
 3723|    180|                    pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (3723:21): [True: 163, False: 17]
  |  Branch (3723:59): [True: 138, False: 25]
  ------------------
 3724|    138|                    !(at_Mobile_H_Revrs && at_Mobile_H_Revrs[i].endpoint) &&
  ------------------
  |  Branch (3724:23): [True: 85, False: 53]
  |  Branch (3724:44): [True: 28, False: 57]
  ------------------
 3725|    110|                    !at2[iat].num_H &&
  ------------------
  |  Branch (3725:21): [True: 107, False: 3]
  ------------------
 3726|    107|                    (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (3726:21): [True: 107, False: 0]
  |  Branch (3726:65): [True: 107, False: 0]
  ------------------
 3727|    107|                    !pBNS->edge[e].flow /* no charge */ &&
  ------------------
  |  Branch (3727:21): [True: 107, False: 0]
  ------------------
 3728|       |                    /* orig. InChI */
 3729|       |                    /*!pStruct->endpoint[i] &&*/
 3730|    107|                    !(nMobHInChI && nMobHInChI[i]) && pStruct->fixed_H && !pStruct->fixed_H[i]) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (3730:23): [True: 107, False: 0]
  |  Branch (3730:37): [True: 3, False: 104]
  |  Branch (3730:55): [True: 104, False: 0]
  |  Branch (3730:75): [True: 99, False: 5]
  ------------------
 3731|     99|                {
 3732|       |
 3733|     99|                    if ((ret = AddToEdgeList(&iat_N_III_List, iat, 32))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3733:25): [True: 0, False: 99]
  ------------------
 3734|      0|                    {
 3735|      0|                        goto exit_case_14;
 3736|      0|                    }
 3737|     99|                }
 3738|    963|                else
 3739|    963|                {
 3740|       |                    /* search for -OH -NH-, -NH2 */
 3741|    963|                    if ( /* restored structure */
 3742|    963|                        at2[iat].chem_bonds_valence == at2[iat].valence &&
  ------------------
  |  Branch (3742:25): [True: 324, False: 639]
  ------------------
 3743|    324|                        !at2[iat].charge && !at2[iat].radical &&
  ------------------
  |  Branch (3743:25): [True: 222, False: 102]
  |  Branch (3743:45): [True: 210, False: 12]
  ------------------
 3744|    210|                        ((pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1) ||
  ------------------
  |  Branch (3744:27): [True: 45, False: 165]
  |  Branch (3744:65): [True: 33, False: 12]
  ------------------
 3745|    177|                            pVA[iat].cNumValenceElectrons == 6) &&
  ------------------
  |  Branch (3745:29): [True: 66, False: 111]
  ------------------
 3746|     99|                        at2[iat].num_H &&
  ------------------
  |  Branch (3746:25): [True: 71, False: 28]
  ------------------
 3747|     71|                        (e = pVA[iat].nCPlusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (3747:25): [True: 71, False: 0]
  |  Branch (3747:68): [True: 71, False: 0]
  ------------------
 3748|     71|                        pBNS->edge[e].flow /* no charge */ &&
  ------------------
  |  Branch (3748:25): [True: 71, False: 0]
  ------------------
 3749|       |                        /* orig. InChI */
 3750|     71|                        !(nMobHInChI && nMobHInChI[i]) && pStruct->fixed_H && pStruct->fixed_H[i]) /* djb-rwth: addressing LLVM warning; fixing a NULL pointer dereference */
  ------------------
  |  Branch (3750:27): [True: 71, False: 0]
  |  Branch (3750:41): [True: 4, False: 67]
  |  Branch (3750:59): [True: 67, False: 0]
  |  Branch (3750:79): [True: 57, False: 10]
  ------------------
 3751|     57|                    {
 3752|       |
 3753|     57|                        if ((ret = AddToEdgeList(&iat_X_List, iat, 32))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3753:29): [True: 0, False: 57]
  ------------------
 3754|      0|                        {
 3755|      0|                            goto exit_case_14;
 3756|      0|                        }
 3757|     57|                    }
 3758|    963|                }
 3759|  1.06k|            }
 3760|  1.16k|        }
 3761|    148|        if (!max_success)
  ------------------
  |  Branch (3761:13): [True: 112, False: 36]
  ------------------
 3762|    112|        {
 3763|    112|            max_success = inchi_min(num_N_V, iat_N_III_List.num_edges);
  ------------------
  |  |  139|    112|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 30, False: 82]
  |  |  ------------------
  ------------------
 3764|    112|            max_success = inchi_min(max_success, iat_X_List.num_edges);
  ------------------
  |  |  139|    112|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 21, False: 91]
  |  |  ------------------
  ------------------
 3765|    112|        }
 3766|    148|        if (num_N_V && iat_N_III_List.num_edges && iat_X_List.num_edges)
  ------------------
  |  Branch (3766:13): [True: 102, False: 46]
  |  Branch (3766:24): [True: 51, False: 51]
  |  Branch (3766:52): [True: 28, False: 23]
  ------------------
 3767|     28|        {
 3768|     56|            for (i1 = 0; i1 < num_N_V && cur_success < max_success; i1++)
  ------------------
  |  Branch (3768:26): [True: 28, False: 28]
  |  Branch (3768:42): [True: 28, False: 0]
  ------------------
 3769|     28|            {
 3770|     28|                int iat_N_V = iat_N_V_Array[i1];
 3771|     28|                if (NO_VERTEX == iat_N_V ||
  ------------------
  |  |  118|     28|#define NO_VERTEX    -2
  ------------------
  |  Branch (3771:21): [True: 0, False: 28]
  ------------------
 3772|     28|                    0 >= (e1Plus = pVA[iat_N_V].nCPlusGroupEdge - 1) ||
  ------------------
  |  Branch (3772:21): [True: 0, False: 28]
  ------------------
 3773|     28|                    NO_VERTEX == (e1Flower = GetChargeFlowerUpperEdge(pBNS, pVA, e1Plus)) ||
  ------------------
  |  |  118|     28|#define NO_VERTEX    -2
  ------------------
  |  Branch (3773:21): [True: 0, False: 28]
  ------------------
 3774|     28|                    1 != pBNS->edge[e1Plus].flow ||
  ------------------
  |  Branch (3774:21): [True: 0, False: 28]
  ------------------
 3775|     28|                    0 != pBNS->edge[e1Flower].flow)
  ------------------
  |  Branch (3775:21): [True: 0, False: 28]
  ------------------
 3776|      0|                {
 3777|      0|                    continue;
 3778|      0|                }
 3779|     56|                for (i2 = iat_N_III_List.num_edges - 1; 0 <= i2 && cur_success < max_success; i2--)
  ------------------
  |  Branch (3779:57): [True: 33, False: 23]
  |  Branch (3779:68): [True: 33, False: 0]
  ------------------
 3780|     33|                {
 3781|     33|                    int iat_N_III = iat_N_III_List.pnEdges[i2];
 3782|     33|                    if (NO_VERTEX == iat_N_III ||
  ------------------
  |  |  118|     33|#define NO_VERTEX    -2
  ------------------
  |  Branch (3782:25): [True: 0, False: 33]
  ------------------
 3783|     33|                        0 >= (e2Minus = pVA[iat_N_III].nCMinusGroupEdge - 1) ||
  ------------------
  |  Branch (3783:25): [True: 0, False: 33]
  ------------------
 3784|     33|                        0 >= (e2Plus = pVA[iat_N_III].nCPlusGroupEdge - 1) ||
  ------------------
  |  Branch (3784:25): [True: 0, False: 33]
  ------------------
 3785|     33|                        0 != pBNS->edge[e2Minus].flow ||
  ------------------
  |  Branch (3785:25): [True: 0, False: 33]
  ------------------
 3786|     33|                        1 != pBNS->edge[e2Plus].flow)
  ------------------
  |  Branch (3786:25): [True: 0, False: 33]
  ------------------
 3787|      0|                    {
 3788|       |                        /* do not consider this atom anymore */
 3789|      0|                        iat_N_III_List.pnEdges[i2] = NO_VERTEX;
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
 3790|      0|                        continue;
 3791|      0|                    }
 3792|     66|                    for (i3 = iat_X_List.num_edges - 1; 0 <= i3 && cur_success < max_success; i3--)
  ------------------
  |  Branch (3792:57): [True: 38, False: 28]
  |  Branch (3792:68): [True: 38, False: 0]
  ------------------
 3793|     38|                    {
 3794|     38|                        int iat_X = iat_X_List.pnEdges[i3];
 3795|     38|                        BNS_VERTEX* pv1n, * pv2n;
 3796|     38|                        BNS_EDGE* pe1n, * pe2n, * pe1Plus, * pe2Minus, * pe3Plus;
 3797|     38|                        Vertex      v1n, v2n;
 3798|     38|                        ret = 0;
 3799|     38|                        if (NO_VERTEX == iat_X ||
  ------------------
  |  |  118|     38|#define NO_VERTEX    -2
  ------------------
  |  Branch (3799:29): [True: 0, False: 38]
  ------------------
 3800|     38|                            0 >= (e3Plus = pVA[iat_X].nCPlusGroupEdge - 1) ||
  ------------------
  |  Branch (3800:29): [True: 0, False: 38]
  ------------------
 3801|     38|                            1 != pBNS->edge[e3Plus].flow)
  ------------------
  |  Branch (3801:29): [True: 3, False: 35]
  ------------------
 3802|      3|                        {
 3803|       |                            /* do not consider this atom anymore */
 3804|      3|                            iat_X_List.pnEdges[i3] = NO_VERTEX;
  ------------------
  |  |  118|      3|#define NO_VERTEX    -2
  ------------------
 3805|      3|                            continue;
 3806|      3|                        }
 3807|       |                        /* all is ready to check whether the following applies:
 3808|       |                        forbid changes of all charges and N,P,... flowers
 3809|       |                        allow to change edges: e2Minus, e3Plus
 3810|       |                        Increment flow in e1Flower
 3811|       |                        The result should be: increase in number of charges by 2
 3812|       |                        */
 3813|     35|                        pe1Plus = pBNS->edge + e1Plus;  /* N(V) positive charge edge */
 3814|     35|                        pe2Minus = pBNS->edge + e2Minus; /* =N- negative charge edge */
 3815|     35|                        pe3Plus = pBNS->edge + e3Plus;  /* -XH positive charge edge */
 3816|     35|                        pe = pBNS->edge + e1Flower; /* N(V) flower edge */
 3817|     35|                        pv1 = pBNS->vert + (v1 = pe->neighbor1);
 3818|     35|                        pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
 3819|    105|                        for (j = pv1->num_adj_edges - 1; 0 <= j; j--)
  ------------------
  |  Branch (3819:58): [True: 105, False: 0]
  ------------------
 3820|    105|                        {
 3821|    105|                            pe1n = pBNS->edge + pv1->iedge[j];
 3822|    105|                            if (pe1n->flow && !pe1n->forbidden && pe1n != pe1Plus)
  ------------------
  |  Branch (3822:33): [True: 70, False: 35]
  |  Branch (3822:47): [True: 70, False: 0]
  |  Branch (3822:67): [True: 35, False: 35]
  ------------------
 3823|     35|                            {
 3824|     35|                                pv1n = pBNS->vert + (v1n = pe1n->neighbor12 ^ v1);
 3825|     35|                                break;
 3826|     35|                            }
 3827|    105|                        }
 3828|     35|                        if (j < 0)
  ------------------
  |  Branch (3828:29): [True: 0, False: 35]
  ------------------
 3829|      0|                        {
 3830|      0|                            continue; /* not found -- should not happen */
 3831|      0|                        }
 3832|     70|                        for (j = pv2->num_adj_edges - 1; 0 <= j; j--)
  ------------------
  |  Branch (3832:58): [True: 70, False: 0]
  ------------------
 3833|     70|                        { /* was -2; changed 2006-2-28 12:35pm*/
 3834|     70|                            pe2n = pBNS->edge + pv2->iedge[j];
 3835|     70|                            if (pe2n->flow && !pe2n->forbidden && pe2n != pe1Plus)
  ------------------
  |  Branch (3835:33): [True: 35, False: 35]
  |  Branch (3835:47): [True: 35, False: 0]
  |  Branch (3835:67): [True: 35, False: 0]
  ------------------
 3836|     35|                            {
 3837|     35|                                pv2n = pBNS->vert + (v2n = pe2n->neighbor12 ^ v2);
 3838|     35|                                break;
 3839|     35|                            }
 3840|     70|                        }
 3841|     35|                        if (j < 0)
  ------------------
  |  Branch (3841:29): [True: 0, False: 35]
  ------------------
 3842|      0|                        {
 3843|      0|                            continue; /* not found -- should not happen */
 3844|      0|                        }
 3845|     35|                        delta = 1;
 3846|     35|                        pe->flow += delta;
 3847|     35|                        pe1n->flow -= delta;
 3848|     35|                        pe2n->flow -= delta;
 3849|     35|                        pv1n->st_edge.flow -= delta;
 3850|     35|                        pv2n->st_edge.flow -= delta;
 3851|     35|                        pBNS->tot_st_flow -= 2 * delta;
 3852|       |
 3853|     35|                        SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 3854|     35|                        SetForbiddenEdgeMask(pBNS, &OtherNFlowerEdges, forbidden_edge_mask);
 3855|       |
 3856|       |                        /* allow two charges to change */
 3857|     35|                        pe2Minus->forbidden &= forbidden_edge_mask_inv;
 3858|     35|                        pe3Plus->forbidden &= forbidden_edge_mask_inv;
 3859|       |                        /* test #1 */
 3860|     35|                        ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 3861|     35|                            &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 3862|     35|                        INCHI_HEAPCHK
 3863|     35|                            if (ret < 0)
  ------------------
  |  Branch (3863:33): [True: 0, False: 35]
  ------------------
 3864|      0|                            {
 3865|      0|                                goto exit_case_14;
 3866|      0|                            }
 3867|     35|                            else
 3868|     35|                            {
 3869|     35|                                if (ret == 1 && ((vPathEnd == v1n && vPathStart == v2n) ||
  ------------------
  |  Branch (3869:37): [True: 22, False: 13]
  |  Branch (3869:51): [True: 20, False: 2]
  |  Branch (3869:70): [True: 11, False: 9]
  ------------------
 3870|     11|                                    (vPathEnd == v2n && vPathStart == v1n)) &&
  ------------------
  |  Branch (3870:38): [True: 9, False: 2]
  |  Branch (3870:57): [True: 0, False: 9]
  ------------------
 3871|     11|                                    nDeltaCharge == 2) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3871:37): [True: 5, False: 6]
  ------------------
 3872|      5|                                {
 3873|      5|                                    ; /* success */
 3874|      5|                                }
 3875|     30|                                else
 3876|     30|                                {
 3877|     30|                                    ret = 0;
 3878|     30|                                }
 3879|     35|                            }
 3880|       |                        /* restore BNS */
 3881|     35|                        pe2Minus->forbidden |= forbidden_edge_mask;
 3882|     35|                        pe3Plus->forbidden |= forbidden_edge_mask;
 3883|     35|                        pe->flow -= delta;
 3884|     35|                        pe1n->flow += delta;
 3885|     35|                        pe2n->flow += delta;
 3886|     35|                        pv1n->st_edge.flow += delta;
 3887|     35|                        pv2n->st_edge.flow += delta;
 3888|     35|                        pBNS->tot_st_flow += 2 * delta;
 3889|     35|                        if (ret == 1)
  ------------------
  |  Branch (3889:29): [True: 5, False: 30]
  ------------------
 3890|      5|                        {
 3891|       |                            /* test #2: check if charge separation is possible */
 3892|      5|                            pe->flow += delta;
 3893|      5|                            pe1n->flow -= delta;
 3894|      5|                            pe2n->flow -= delta;
 3895|      5|                            pv1n->st_edge.flow -= delta;
 3896|      5|                            pv2n->st_edge.flow -= delta;
 3897|      5|                            pBNS->tot_st_flow -= 2 * delta;
 3898|       |
 3899|       |                            /* allow two charges (N(V) and N(III)) to change */
 3900|      5|                            pe2Minus->forbidden &= forbidden_edge_mask_inv;
 3901|      5|                            pe1Plus->forbidden &= forbidden_edge_mask_inv;
 3902|       |                            /* test #2 */
 3903|      5|                            ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 3904|      5|                                &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 3905|      5|                            if (ret == 1 && ((vPathEnd == v1n && vPathStart == v2n) ||
  ------------------
  |  Branch (3905:33): [True: 5, False: 0]
  |  Branch (3905:47): [True: 5, False: 0]
  |  Branch (3905:66): [True: 5, False: 0]
  ------------------
 3906|      0|                                (vPathEnd == v2n && vPathStart == v1n)) &&
  ------------------
  |  Branch (3906:34): [True: 0, False: 0]
  |  Branch (3906:53): [True: 0, False: 0]
  ------------------
 3907|      5|                                nDeltaCharge == 2) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (3907:33): [True: 5, False: 0]
  ------------------
 3908|      5|                            {
 3909|       |                                /* success; actually change charges */
 3910|      5|                                ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
 3911|      5|                                if (ret > 0)
  ------------------
  |  Branch (3911:37): [True: 5, False: 0]
  ------------------
 3912|      5|                                {
 3913|      5|                                    nNumRunBNS++;
 3914|      5|                                    cur_success++; /* 14 */
 3915|      5|                                }
 3916|      5|                            }
 3917|      5|                            if (ret <= 0)
  ------------------
  |  Branch (3917:33): [True: 0, False: 5]
  ------------------
 3918|      0|                            {
 3919|       |                                /* failed: restore BNS flow */
 3920|      0|                                pe->flow -= delta;
 3921|      0|                                pe1n->flow += delta;
 3922|      0|                                pe2n->flow += delta;
 3923|      0|                                pv1n->st_edge.flow += delta;
 3924|      0|                                pv2n->st_edge.flow += delta;
 3925|      0|                                pBNS->tot_st_flow += 2 * delta;
 3926|      0|                            }
 3927|      5|                            INCHI_HEAPCHK
 3928|      5|                        }
 3929|     35|                        RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 3930|     35|                        RemoveForbiddenEdgeMask(pBNS, &OtherNFlowerEdges, forbidden_edge_mask);
 3931|     35|                        if (ret > 0)
  ------------------
  |  Branch (3931:29): [True: 5, False: 30]
  ------------------
 3932|      5|                        {
 3933|       |                            /* do not repeat for the same atoms */
 3934|      5|                            iat_N_V_Array[i1] = NO_VERTEX;
  ------------------
  |  |  118|      5|#define NO_VERTEX    -2
  ------------------
 3935|      5|                            iat_N_III_List.pnEdges[i2] = NO_VERTEX;
  ------------------
  |  |  118|      5|#define NO_VERTEX    -2
  ------------------
 3936|      5|                            iat_X_List.pnEdges[i3] = NO_VERTEX;
  ------------------
  |  |  118|      5|#define NO_VERTEX    -2
  ------------------
 3937|      5|                        }
 3938|     35|                        if (ret < 0)
  ------------------
  |  Branch (3938:29): [True: 0, False: 35]
  ------------------
 3939|      0|                        {
 3940|      0|                            goto exit_case_14;
 3941|      0|                        }
 3942|     35|                        if (ret > 0)
  ------------------
  |  Branch (3942:29): [True: 5, False: 30]
  ------------------
 3943|      5|                        {
 3944|      5|                            break;
 3945|      5|                        }
 3946|     35|                    } /* i3 cycle */
 3947|     33|                    if (ret > 0)
  ------------------
  |  Branch (3947:25): [True: 5, False: 28]
  ------------------
 3948|      5|                    {
 3949|      5|                        break;
 3950|      5|                    }
 3951|     33|                } /* i2 cycle */
 3952|     28|            }
 3953|     28|        }
 3954|    148|    exit_case_14:
 3955|    148|        AllocEdgeList(&iat_X_List, EDGE_LIST_FREE);
  ------------------
  |  |  243|    148|#define EDGE_LIST_FREE   (-2)
  ------------------
 3956|    148|        AllocEdgeList(&iat_N_III_List, EDGE_LIST_FREE);
  ------------------
  |  |  243|    148|#define EDGE_LIST_FREE   (-2)
  ------------------
 3957|    148|        RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 3958|    148|        RemoveForbiddenEdgeMask(pBNS, &OtherNFlowerEdges, forbidden_edge_mask);
 3959|    148|        CurrEdges.num_edges = 0; /* clear current edge list */
 3960|    148|        if (ret < 0)
  ------------------
  |  Branch (3960:13): [True: 0, False: 148]
  ------------------
 3961|      0|        {
 3962|      0|            goto exit_function;
 3963|      0|        }
 3964|    148|        if (cur_success)
  ------------------
  |  Branch (3964:13): [True: 5, False: 143]
  ------------------
 3965|      5|        {
 3966|      5|            tot_succes += cur_success;
 3967|       |            /* recalculate InChI from the structure */
 3968|      5|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (3968:17): [True: 0, False: 5]
  ------------------
 3969|      5|                ppt_group_info, ppat_norm, ppat_prep)))
 3970|      0|            {
 3971|      0|                goto exit_function;
 3972|      0|            }
 3973|      5|            if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3973:17): [True: 0, False: 5]
  ------------------
 3974|      0|            {
 3975|      0|                goto exit_function;
 3976|      0|            }
 3977|      5|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (3977:17): [True: 0, False: 5]
  |  Branch (3977:45): [True: 0, False: 0]
  ------------------
 3978|      0|            {
 3979|      0|                goto exit_function;  /* no fixed-H found */
 3980|      0|            }
 3981|      5|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3981:17): [True: 0, False: 5]
  ------------------
 3982|      0|            {
 3983|      0|                goto exit_function;
 3984|      0|            }
 3985|      5|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (3985:17): [True: 0, False: 5]
  ------------------
 3986|      0|            {
 3987|      0|                goto exit_function; /* nothing to do */
 3988|      0|            }
 3989|      5|        }
 3990|    148|    }
 3991|       |
 3992|  1.13k|    if (pc2i->nNumTgMRevrs > pc2i->nNumTgMInChI ||
  ------------------
  |  Branch (3992:9): [True: 114, False: 1.01k]
  ------------------
 3993|  1.01k|         pc2i->nNumRemHRevrs < pc2i->nNumRemHInChI ||
  ------------------
  |  Branch (3993:10): [True: 230, False: 787]
  ------------------
 3994|    787|         pc2i->nNumEndpRevrs < pc2i->nNumEndpInChI ||
  ------------------
  |  Branch (3994:10): [True: 496, False: 291]
  ------------------
 3995|    291|         (pc2i->nNumTgInChI <= 1 && pc2i->nNumTgRevrs > pc2i->nNumTgInChI)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3995:11): [True: 287, False: 4]
  |  Branch (3995:37): [True: 73, False: 214]
  ------------------
 3996|    913|    {
 3997|       |        /*--------------------------------------------------------------*/
 3998|       |        /* case 15: restored: -(+)O=AB-N<  orig: -O-AB=N(+)<            */
 3999|       |        /* (a) restored t-groups have more (-) than in original InChI   */
 4000|       |        /* (b) Mobile-H    charge: restored > original InChI *and*      */
 4001|       |        /*              removed H: restored < original InChI            */
 4002|       |        /* (c) restored t-groups have less endpnoits than in orig InChI */
 4003|       |        /* O = O, S, Se, Te; N = N                                      */
 4004|       |        /* Solution: move (+) from -O(+)= to -N<                        */
 4005|       |        /*--------------------------------------------------------------*/
 4006|    913|        int num_SB_Neutr = 0, num_DB_Charged = 0, iat;
 4007|    913|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 4008|    913|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (4008:32): [True: 913, False: 0]
  |  Branch (4008:45): [True: 913, False: 0]
  ------------------
 4009|    913|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (4009:13): [True: 0, False: 0]
  |  Branch (4009:26): [True: 0, False: 0]
  ------------------
 4010|    913|        cur_success = 0;
 4011|       |
 4012|       |        /* search for -O(+)= */
 4013|       |        /* search for -N< */
 4014|  7.85k|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (4014:21): [True: 6.94k, False: 913]
  ------------------
 4015|  6.94k|        { /* i = canonical number - 1 */
 4016|  6.94k|            iat = nCanon2AtnoRevrs[i];
 4017|  6.94k|            if ( /* -O(+)= in restored atom: charge=1, has no H, a double bond */
 4018|  6.94k|                num_DB_Charged < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  13.8k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (4018:17): [True: 6.94k, False: 0]
  ------------------
 4019|  6.94k|                at2[iat].charge == 1 && !at2[iat].num_H &&
  ------------------
  |  Branch (4019:17): [True: 1.13k, False: 5.80k]
  |  Branch (4019:41): [True: 879, False: 256]
  ------------------
 4020|    879|                at2[iat].valence < at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (4020:17): [True: 590, False: 289]
  |  Branch (4020:67): [True: 537, False: 53]
  ------------------
 4021|    537|                (pVA[iat].cNumValenceElectrons == 6) &&
  ------------------
  |  Branch (4021:17): [True: 133, False: 404]
  ------------------
 4022|       |                /* in orig.InChI: an endpoint, has fixed-H */
 4023|       |                /*pStruct->endpoint[i] &&*/
 4024|    133|                !(pStruct->fixed_H && pStruct->fixed_H[i]) &&
  ------------------
  |  Branch (4024:19): [True: 133, False: 0]
  |  Branch (4024:39): [True: 3, False: 130]
  ------------------
 4025|    130|                !(nMobHInChI && nMobHInChI[i]) &&
  ------------------
  |  Branch (4025:19): [True: 130, False: 0]
  |  Branch (4025:33): [True: 0, False: 130]
  ------------------
 4026|       |                /* has (+) edge */
 4027|    130|                (e = pVA[iat].nCPlusGroupEdge - 1) >= 0 && 0 == pBNS->edge[e].forbidden)
  ------------------
  |  Branch (4027:17): [True: 130, False: 0]
  |  Branch (4027:60): [True: 92, False: 38]
  ------------------
 4028|     92|            {
 4029|       |
 4030|     92|                iat_DB_Charged[num_DB_Charged++] = iat;
 4031|       |                /*
 4032|       |                if ( ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ) ) {
 4033|       |                goto exit_function;
 4034|       |                }
 4035|       |                */
 4036|     92|            }
 4037|  6.85k|            else
 4038|  6.85k|            {
 4039|  6.85k|                if ( /* -N< in restored atom: charge=0, has no H, has no double bond, N only */
 4040|  6.85k|                    num_SB_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  13.7k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (4040:21): [True: 6.85k, False: 0]
  ------------------
 4041|  6.85k|                    at2[iat].charge == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (4041:21): [True: 4.40k, False: 2.44k]
  |  Branch (4041:45): [True: 3.72k, False: 676]
  ------------------
 4042|  3.72k|                    at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (4042:21): [True: 983, False: 2.74k]
  |  Branch (4042:72): [True: 766, False: 217]
  ------------------
 4043|    766|                    (pVA[iat].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (4043:22): [True: 174, False: 592]
  ------------------
 4044|    174|                        pVA[iat].cPeriodicRowNumber == 1) &&
  ------------------
  |  Branch (4044:25): [True: 123, False: 51]
  ------------------
 4045|       |                    /* in orig.InChI: an endpoint, has fixed-H */
 4046|       |                    /*pStruct->endpoint[i] &&*/
 4047|    123|                    !(pStruct->fixed_H && pStruct->fixed_H[i]) &&
  ------------------
  |  Branch (4047:23): [True: 123, False: 0]
  |  Branch (4047:43): [True: 2, False: 121]
  ------------------
 4048|    121|                    !(nMobHInChI && nMobHInChI[i]) &&
  ------------------
  |  Branch (4048:23): [True: 121, False: 0]
  |  Branch (4048:37): [True: 1, False: 120]
  ------------------
 4049|       |                    /* has (+) edge */
 4050|    120|                    (e = pVA[iat].nCPlusGroupEdge - 1) >= 0 && 0 == pBNS->edge[e].forbidden)
  ------------------
  |  Branch (4050:21): [True: 105, False: 15]
  |  Branch (4050:64): [True: 105, False: 0]
  ------------------
 4051|    105|                {
 4052|       |
 4053|    105|                    iat_SB_Neutr[num_SB_Neutr++] = iat;
 4054|    105|                    if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    105|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (4054:25): [True: 0, False: 105]
  ------------------
 4055|      0|                    {
 4056|      0|                        goto exit_function;
 4057|      0|                    }
 4058|    105|                }
 4059|  6.85k|            }
 4060|  6.94k|        }
 4061|    913|        if ((num_try = inchi_min(num_SB_Neutr, num_DB_Charged))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|    913|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 76, False: 837]
  |  |  ------------------
  ------------------
  |  Branch (4061:13): [True: 14, False: 899]
  ------------------
 4062|     14|        {
 4063|       |            /* detected; attempt to fix */
 4064|     14|            BNS_VERTEX* pv1n, * pv2n;
 4065|     14|            BNS_EDGE* pe1n, * pe2n;
 4066|     14|            Vertex      v1n, v2n;
 4067|     14|            SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 4068|     14|            RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
 4069|     14|            delta = 1;
 4070|     28|            for (i = 0; i < num_DB_Charged && cur_success < num_try; i++)
  ------------------
  |  Branch (4070:25): [True: 15, False: 13]
  |  Branch (4070:47): [True: 14, False: 1]
  ------------------
 4071|     14|            {
 4072|     14|                iat = iat_DB_Charged[i];
 4073|     14|                pe = pBNS->edge + pVA[iat].nCPlusGroupEdge - 1;
 4074|     14|                if (pe->flow)
  ------------------
  |  Branch (4074:21): [True: 0, False: 14]
  ------------------
 4075|      0|                    continue;
 4076|     14|                pv1 = pBNS->vert + (v1 = pe->neighbor1);
 4077|     14|                pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
 4078|       |
 4079|     31|                for (j = pv1->num_adj_edges - 1; 0 <= j; j--)
  ------------------
  |  Branch (4079:50): [True: 31, False: 0]
  ------------------
 4080|     31|                {
 4081|     31|                    pe1n = pBNS->edge + pv1->iedge[j];
 4082|     31|                    if (pe1n->flow && !pe1n->forbidden)
  ------------------
  |  Branch (4082:25): [True: 14, False: 17]
  |  Branch (4082:39): [True: 14, False: 0]
  ------------------
 4083|     14|                    {
 4084|     14|                        pv1n = pBNS->vert + (v1n = pe1n->neighbor12 ^ v1);
 4085|     14|                        break;
 4086|     14|                    }
 4087|     31|                }
 4088|     14|                if (j < 0)
  ------------------
  |  Branch (4088:21): [True: 0, False: 14]
  ------------------
 4089|      0|                {
 4090|      0|                    continue; /* not found */
 4091|      0|                }
 4092|       |
 4093|     14|                for (j = pv2->num_adj_edges - 1; 0 <= j; j--)
  ------------------
  |  Branch (4093:50): [True: 14, False: 0]
  ------------------
 4094|     14|                { /* was -2; changed 2006-2-28 12:35pm*/
 4095|     14|                    pe2n = pBNS->edge + pv2->iedge[j];
 4096|     14|                    if (pe2n->flow && !pe2n->forbidden)
  ------------------
  |  Branch (4096:25): [True: 14, False: 0]
  |  Branch (4096:39): [True: 14, False: 0]
  ------------------
 4097|     14|                    {
 4098|     14|                        pv2n = pBNS->vert + (v2n = pe2n->neighbor12 ^ v2);
 4099|     14|                        break;
 4100|     14|                    }
 4101|     14|                }
 4102|     14|                if (j < 0)
  ------------------
  |  Branch (4102:21): [True: 0, False: 14]
  ------------------
 4103|      0|                {
 4104|      0|                    continue; /* not found */
 4105|      0|                }
 4106|       |
 4107|     14|                pe->flow += delta;
 4108|     14|                pe1n->flow -= delta;
 4109|     14|                pe2n->flow -= delta;
 4110|     14|                pv1n->st_edge.flow -= delta;
 4111|     14|                pv2n->st_edge.flow -= delta;
 4112|     14|                pBNS->tot_st_flow -= 2 * delta;
 4113|       |
 4114|     14|                ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4115|     14|                    &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 4116|       |
 4117|     14|                if (ret == 1 && ((vPathEnd == v1n && vPathStart == v2n) ||
  ------------------
  |  Branch (4117:21): [True: 7, False: 7]
  |  Branch (4117:35): [True: 2, False: 5]
  |  Branch (4117:54): [True: 2, False: 0]
  ------------------
 4118|      5|                    (vPathEnd == v2n && vPathStart == v1n)) &&
  ------------------
  |  Branch (4118:22): [True: 3, False: 2]
  |  Branch (4118:41): [True: 2, False: 1]
  ------------------
 4119|      4|                    (nDeltaCharge == 0 || nDeltaCharge == 1)) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (4119:22): [True: 0, False: 4]
  |  Branch (4119:43): [True: 4, False: 0]
  ------------------
 4120|      4|                {
 4121|       |                    /* Moved charge from O(+) to -N< => nDeltaCharge == 1 or 0 if pe2n = -N< charge edge */
 4122|       |                    /* Flow change on pe (+)charge edge (atom NH2) is not known to RunBnsTestOnce()) */
 4123|      4|                    ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
 4124|      4|                    if (ret > 0)
  ------------------
  |  Branch (4124:25): [True: 4, False: 0]
  ------------------
 4125|      4|                    {
 4126|      4|                        nNumRunBNS++;
 4127|      4|                        cur_success++; /* 15 */
 4128|      4|                    }
 4129|      4|                }
 4130|     10|                else
 4131|     10|                {
 4132|     10|                    pe->flow -= delta;
 4133|     10|                    pe1n->flow += delta;
 4134|     10|                    pe2n->flow += delta;
 4135|     10|                    pv1n->st_edge.flow += delta;
 4136|     10|                    pv2n->st_edge.flow += delta;
 4137|     10|                    pBNS->tot_st_flow += 2 * delta;
 4138|     10|                }
 4139|     14|                INCHI_HEAPCHK
 4140|     14|            }
 4141|     14|            RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 4142|     14|        }
 4143|    913|        CurrEdges.num_edges = 0; /* clear current edge list */
 4144|    913|        if (cur_success)
  ------------------
  |  Branch (4144:13): [True: 4, False: 909]
  ------------------
 4145|      4|        {
 4146|      4|            tot_succes += cur_success;
 4147|       |            /* recalculate InChI from the structure */
 4148|      4|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (4148:17): [True: 0, False: 4]
  ------------------
 4149|      4|                ppt_group_info, ppat_norm, ppat_prep)))
 4150|      0|            {
 4151|      0|                goto exit_function;
 4152|      0|            }
 4153|      4|            if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4153:17): [True: 0, False: 4]
  ------------------
 4154|      0|            {
 4155|      0|                goto exit_function;
 4156|      0|            }
 4157|      4|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (4157:17): [True: 2, False: 2]
  |  Branch (4157:45): [True: 0, False: 2]
  ------------------
 4158|      0|            {
 4159|      0|                goto exit_function;  /* no fixed-H found */
 4160|      0|            }
 4161|      4|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4161:17): [True: 0, False: 4]
  ------------------
 4162|      0|            {
 4163|      0|                goto exit_function;
 4164|      0|            }
 4165|      4|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (4165:17): [True: 0, False: 4]
  ------------------
 4166|      0|            {
 4167|      0|                goto exit_function; /* nothing to do */
 4168|      0|            }
 4169|      4|        }
 4170|    913|    }
 4171|       |
 4172|  1.13k|    if (pc2i->nNumTgDiffMinus)
  ------------------
  |  Branch (4172:9): [True: 65, False: 1.06k]
  ------------------
 4173|     65|    {
 4174|       |        /*----------------------------------------------------------------*/
 4175|       |        /* case 16: restored: O=X-NH(-)      orig.:  O(-)-X=NH            */
 4176|       |        /*            t-group: (H,-)                  (2H)                */
 4177|       |        /* O(-) = S, Se, Te; N = N;                                       */
 4178|       |        /* Solution: move (-) from O(-) to -NH(-)                         */
 4179|       |        /*----------------------------------------------------------------*/
 4180|     65|        int num_SB_N_Minus = 0, num_DB_O_Neutr = 0, iat, itg;
 4181|     65|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 4182|     65|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (4182:32): [True: 65, False: 0]
  |  Branch (4182:45): [True: 65, False: 0]
  ------------------
 4183|     65|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (4183:13): [True: 0, False: 0]
  |  Branch (4183:26): [True: 0, False: 0]
  ------------------
 4184|     65|        cur_success = 0; /* djb-rwth: ignoring LLVM warning: variable used */
 4185|       |
 4186|    136|        for (itg = 0; itg < pStruct->ti.num_t_groups && itg < pStruct->One_ti.num_t_groups; itg++)
  ------------------
  |  Branch (4186:23): [True: 77, False: 59]
  |  Branch (4186:57): [True: 72, False: 5]
  ------------------
 4187|     72|        {
 4188|     72|            if (pStruct->ti.t_group[itg].nNumEndpoints != pStruct->One_ti.t_group[itg].nNumEndpoints ||
  ------------------
  |  Branch (4188:17): [True: 5, False: 67]
  ------------------
 4189|     67|                pStruct->ti.t_group[itg].num[1] >= pStruct->One_ti.t_group[itg].num[1])
  ------------------
  |  Branch (4189:17): [True: 29, False: 38]
  ------------------
 4190|     34|            {
 4191|     34|                continue;
 4192|     34|            }
 4193|     38|            CurrEdges.num_edges = num_SB_N_Minus = num_DB_O_Neutr = 0;
 4194|     38|            cur_success = 0;
 4195|     38|            for (j = 0, k = pStruct->One_ti.t_group[itg].nFirstEndpointAtNoPos;
 4196|    146|                j < pStruct->One_ti.t_group[itg].nNumEndpoints; j++)
  ------------------
  |  Branch (4196:17): [True: 108, False: 38]
  ------------------
 4197|    108|            {
 4198|    108|                i = pStruct->One_ti.nEndpointAtomNumber[k + j]; /* canonical number in restored struct. */
 4199|    108|                iat = nCanon2AtnoRevrs[i];
 4200|    108|                if ( /* in restored atom: charge=0, has no H, has double bond, O, S, Se, Te */
 4201|    108|                    num_DB_O_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|    216|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (4201:21): [True: 108, False: 0]
  ------------------
 4202|    108|                    at2[iat].charge == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (4202:21): [True: 50, False: 58]
  |  Branch (4202:45): [True: 34, False: 16]
  ------------------
 4203|     34|                    at2[iat].valence < at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (4203:21): [True: 34, False: 0]
  |  Branch (4203:71): [True: 34, False: 0]
  ------------------
 4204|     34|                    pVA[iat].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (4204:21): [True: 31, False: 3]
  ------------------
 4205|       |                    /* in orig.InChI: an endpoint, may have fixed-H */
 4206|     31|                    pStruct->endpoint[i] &&
  ------------------
  |  Branch (4206:21): [True: 20, False: 11]
  ------------------
 4207|       |                    /*!(pStruct->fixed_H && pStruct->fixed_H[i]) &&*/
 4208|     20|                    !(nMobHInChI && nMobHInChI[i]) &&
  ------------------
  |  Branch (4208:23): [True: 20, False: 0]
  |  Branch (4208:37): [True: 0, False: 20]
  ------------------
 4209|       |                    /* has (-) edge */
 4210|     20|                    (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (4210:21): [True: 20, False: 0]
  |  Branch (4210:65): [True: 20, False: 0]
  ------------------
 4211|     20|                {
 4212|       |
 4213|     20|                    iat_DB_O_Neutr[num_DB_O_Neutr++] = iat;
 4214|       |
 4215|     20|                    if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|     20|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (4215:25): [True: 0, False: 20]
  ------------------
 4216|      0|                    {
 4217|      0|                        goto exit_function;
 4218|      0|                    }
 4219|     20|                }
 4220|     88|                else
 4221|     88|                {
 4222|     88|                    if ( /* in restored atom: charge=-1, has H, has double bond, N */
 4223|     88|                        num_SB_N_Minus < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|    176|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (4223:25): [True: 88, False: 0]
  ------------------
 4224|     88|                        at2[iat].charge == -1 && at2[iat].num_H &&
  ------------------
  |  Branch (4224:25): [True: 58, False: 30]
  |  Branch (4224:50): [True: 13, False: 45]
  ------------------
 4225|     13|                        at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (4225:25): [True: 8, False: 5]
  |  Branch (4225:76): [True: 8, False: 0]
  ------------------
 4226|      8|                        pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (4226:25): [True: 8, False: 0]
  |  Branch (4226:63): [True: 8, False: 0]
  ------------------
 4227|       |                        /* in orig.InChI: an endpoint, has no fixed-H */
 4228|      8|                        pStruct->endpoint[i] &&
  ------------------
  |  Branch (4228:25): [True: 4, False: 4]
  ------------------
 4229|      4|                        (pStruct->fixed_H && pStruct->fixed_H[i]) &&
  ------------------
  |  Branch (4229:26): [True: 4, False: 0]
  |  Branch (4229:46): [True: 4, False: 0]
  ------------------
 4230|      4|                        !(nMobHInChI && nMobHInChI[i]) &&
  ------------------
  |  Branch (4230:27): [True: 4, False: 0]
  |  Branch (4230:41): [True: 0, False: 4]
  ------------------
 4231|       |                        /* has (-) edge */
 4232|      4|                        (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 &&
  ------------------
  |  Branch (4232:25): [True: 4, False: 0]
  ------------------
 4233|      4|                        0 == pBNS->edge[e].forbidden)
  ------------------
  |  Branch (4233:25): [True: 4, False: 0]
  ------------------
 4234|      4|                    {
 4235|       |
 4236|      4|                        iat_SB_N_Minus[num_SB_N_Minus++] = iat;
 4237|       |                        /*
 4238|       |                        if ( ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ) ) {
 4239|       |                        goto exit_function;
 4240|       |                        }
 4241|       |                        */
 4242|      4|                    }
 4243|     88|                }
 4244|    108|            }
 4245|     38|            if ((num_try = inchi_min(num_SB_N_Minus, num_DB_O_Neutr))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|     38|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 15, False: 23]
  |  |  ------------------
  ------------------
  |  Branch (4245:17): [True: 3, False: 35]
  ------------------
 4246|      3|            {
 4247|       |                /* detected; attempt to fix */
 4248|      3|                SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 4249|      3|                RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
 4250|       |                /* allow stereobonds in rings change */
 4251|       |                /*
 4252|       |                if ( forbidden_stereo_edge_mask )
 4253|       |                RemoveForbiddenEdgeMask( pBNS, &FixedLargeRingStereoEdges, forbidden_stereo_edge_mask );
 4254|       |                */
 4255|      3|                delta = 1;
 4256|      6|                for (i = 0; i < num_SB_N_Minus && cur_success < num_try; i++)
  ------------------
  |  Branch (4256:29): [True: 3, False: 3]
  |  Branch (4256:51): [True: 3, False: 0]
  ------------------
 4257|      3|                {
 4258|      3|                    iat = iat_SB_N_Minus[i];
 4259|      3|                    pe = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
 4260|      3|                    if (!pe->flow)
  ------------------
  |  Branch (4260:25): [True: 0, False: 3]
  ------------------
 4261|      0|                        continue;
 4262|      3|                    pv1 = pBNS->vert + (v1 = pe->neighbor1);
 4263|      3|                    pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
 4264|       |
 4265|       |                    /*pe->forbidden |= forbidden_edge_mask;*/
 4266|      3|                    pe->flow -= delta;
 4267|      3|                    pv1->st_edge.flow -= delta;
 4268|      3|                    pv2->st_edge.flow -= delta;
 4269|      3|                    pBNS->tot_st_flow -= 2 * delta;
 4270|       |
 4271|      3|                    ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4272|      3|                        &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 4273|       |
 4274|      3|                    if (ret == 1 && ((vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (4274:25): [True: 3, False: 0]
  |  Branch (4274:39): [True: 0, False: 3]
  |  Branch (4274:57): [True: 0, False: 0]
  ------------------
 4275|      3|                        (vPathEnd == v2 && vPathStart == v1)) && nDeltaCharge == 1) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4275:26): [True: 3, False: 0]
  |  Branch (4275:44): [True: 2, False: 1]
  |  Branch (4275:66): [True: 2, False: 0]
  ------------------
 4276|      2|                    {
 4277|       |                        /* Moved (-) charge to =O => nDeltaCharge == 1 */
 4278|       |                        /* Flow change on pe (-)charge edge (atom -NH(-)) is not known to RunBnsTestOnce()) */
 4279|      2|                        ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
 4280|      2|                        if (ret > 0)
  ------------------
  |  Branch (4280:29): [True: 2, False: 0]
  ------------------
 4281|      2|                        {
 4282|      2|                            nNumRunBNS++;
 4283|      2|                            cur_success++; /* 16 */
 4284|      2|                        }
 4285|      2|                    }
 4286|      1|                    else
 4287|      1|                    {
 4288|      1|                        pe->forbidden &= forbidden_edge_mask_inv;
 4289|      1|                        pe->flow += delta;
 4290|      1|                        pv1->st_edge.flow += delta;
 4291|      1|                        pv2->st_edge.flow += delta;
 4292|      1|                        pBNS->tot_st_flow += 2 * delta;
 4293|      1|                    }
 4294|      3|                    INCHI_HEAPCHK
 4295|      3|                }
 4296|      3|                RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 4297|       |                /*
 4298|       |                if ( forbidden_stereo_edge_mask )
 4299|       |                SetForbiddenEdgeMask( pBNS, &FixedLargeRingStereoEdges, forbidden_stereo_edge_mask );
 4300|       |                */
 4301|      3|            }
 4302|     38|            CurrEdges.num_edges = 0; /* clear current edge list */
 4303|     38|            if (cur_success)
  ------------------
  |  Branch (4303:17): [True: 2, False: 36]
  ------------------
 4304|      2|            {
 4305|      2|                tot_succes += cur_success;
 4306|       |                /* recalculate InChI from the structure */
 4307|      2|                if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (4307:21): [True: 1, False: 1]
  ------------------
 4308|      2|                    ppt_group_info, ppat_norm, ppat_prep)))
 4309|      1|                {
 4310|      1|                    goto exit_function;
 4311|      1|                }
 4312|      1|                if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4312:21): [True: 0, False: 1]
  ------------------
 4313|      0|                {
 4314|      0|                    goto exit_function;
 4315|      0|                }
 4316|      1|                if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (4316:21): [True: 0, False: 1]
  |  Branch (4316:49): [True: 0, False: 0]
  ------------------
 4317|      0|                {
 4318|      0|                    goto exit_function;  /* no fixed-H found */
 4319|      0|                }
 4320|      1|                if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4320:21): [True: 0, False: 1]
  ------------------
 4321|      0|                {
 4322|      0|                    goto exit_function;
 4323|      0|                }
 4324|      1|                if (!pc2i->bHasDifference)
  ------------------
  |  Branch (4324:21): [True: 0, False: 1]
  ------------------
 4325|      0|                {
 4326|      0|                    goto exit_function; /* nothing to do */
 4327|      0|                }
 4328|      1|            }
 4329|     38|        }
 4330|     65|    }
 4331|       |
 4332|  1.13k|    if (pc2i->nNumRemHInChI < pc2i->nNumRemHRevrs)
  ------------------
  |  Branch (4332:9): [True: 173, False: 957]
  ------------------
 4333|    173|    {
 4334|       |        /*--------------------------------------------------------------*/
 4335|       |        /* case 17: restored: OH(+)=AB-O-     orig.  HO-AB=O(+)-        */
 4336|       |        /* number of removed H:  n+m                     n              */
 4337|       |        /* OH(+) = N, O, S, Se; -O- = P,As,O,S,Se,Te,F,Cl,Br,I          */
 4338|       |        /* Solution: move (+) from OH(+) to -O-                         */
 4339|       |        /*--------------------------------------------------------------*/
 4340|    173|        int num_SB_Neutr = 0, num_DB_Charged = 0, iat;
 4341|    173|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 4342|    173|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (4342:32): [True: 173, False: 0]
  |  Branch (4342:45): [True: 173, False: 0]
  ------------------
 4343|    173|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (4343:13): [True: 0, False: 0]
  |  Branch (4343:26): [True: 0, False: 0]
  ------------------
 4344|    173|        cur_success = 0;
 4345|       |
 4346|  1.36k|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (4346:21): [True: 1.19k, False: 173]
  ------------------
 4347|  1.19k|        { /* i = canonical number - 1 */
 4348|  1.19k|            iat = nCanon2AtnoRevrs[i];
 4349|  1.19k|            if ( /* in restored atom: charge=+1, has H, has double bond, N, O, S, Se, Te */
 4350|  1.19k|                num_DB_Charged < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  2.38k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (4350:17): [True: 1.19k, False: 0]
  ------------------
 4351|  1.19k|                at2[iat].charge == 1 && at2[iat].num_H &&
  ------------------
  |  Branch (4351:17): [True: 199, False: 993]
  |  Branch (4351:41): [True: 173, False: 26]
  ------------------
 4352|    173|                at2[iat].valence < at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (4352:17): [True: 146, False: 27]
  |  Branch (4352:67): [True: 146, False: 0]
  ------------------
 4353|    146|                (pVA[iat].cNumValenceElectrons == 6 ||
  ------------------
  |  Branch (4353:18): [True: 53, False: 93]
  ------------------
 4354|     93|                    (pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1)) &&
  ------------------
  |  Branch (4354:22): [True: 93, False: 0]
  |  Branch (4354:60): [True: 91, False: 2]
  ------------------
 4355|       |                /* has (+) edge */
 4356|    144|                (e = pVA[iat].nCPlusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (4356:17): [True: 144, False: 0]
  |  Branch (4356:60): [True: 137, False: 7]
  ------------------
 4357|    137|            {
 4358|       |
 4359|    137|                iat_DB_Charged[num_DB_Charged++] = iat;
 4360|       |                /*
 4361|       |                if ( ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ) ) {
 4362|       |                goto exit_function;
 4363|       |                }
 4364|       |                */
 4365|    137|            }
 4366|  1.05k|            else
 4367|  1.05k|            {
 4368|  1.05k|                if ( /* in restored atom: charge=0, has no H, has no double bond, N, P, O, S, Se, Te */
 4369|  1.05k|                    num_SB_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  2.11k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (4369:21): [True: 1.05k, False: 0]
  ------------------
 4370|  1.05k|                    at2[iat].charge == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (4370:21): [True: 807, False: 248]
  |  Branch (4370:45): [True: 658, False: 149]
  ------------------
 4371|    658|                    at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (4371:21): [True: 280, False: 378]
  |  Branch (4371:72): [True: 259, False: 21]
  ------------------
 4372|    259|                    (pVA[iat].cNumValenceElectrons == 6 || pVA[iat].cNumValenceElectrons == 7 ||
  ------------------
  |  Branch (4372:22): [True: 131, False: 128]
  |  Branch (4372:60): [True: 32, False: 96]
  ------------------
 4373|     96|                        (pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber > 1)) &&
  ------------------
  |  Branch (4373:26): [True: 30, False: 66]
  |  Branch (4373:64): [True: 15, False: 15]
  ------------------
 4374|       |                    /* in orig.InChI: not an endpoint */
 4375|    178|                    !pStruct->endpoint[i] &&
  ------------------
  |  Branch (4375:21): [True: 171, False: 7]
  ------------------
 4376|    171|                    !(pStruct->fixed_H && pStruct->fixed_H[i]) &&
  ------------------
  |  Branch (4376:23): [True: 171, False: 0]
  |  Branch (4376:43): [True: 7, False: 164]
  ------------------
 4377|    164|                    !(nMobHInChI && nMobHInChI[i]) &&
  ------------------
  |  Branch (4377:23): [True: 164, False: 0]
  |  Branch (4377:37): [True: 3, False: 161]
  ------------------
 4378|       |                    /* has (+) edge */
 4379|    161|                    (e = pVA[iat].nCPlusGroupEdge - 1) >= 0 &&
  ------------------
  |  Branch (4379:21): [True: 159, False: 2]
  ------------------
 4380|    159|                    0 == pBNS->edge[e].forbidden) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4380:21): [True: 159, False: 0]
  ------------------
 4381|    159|                {
 4382|       |
 4383|    159|                    iat_SB_Neutr[num_SB_Neutr++] = iat;
 4384|       |
 4385|    159|                    if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    159|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (4385:25): [True: 0, False: 159]
  ------------------
 4386|      0|                    {
 4387|      0|                        goto exit_function;
 4388|      0|                    }
 4389|    159|                }
 4390|  1.05k|            }
 4391|  1.19k|        }
 4392|    173|        if ((num_try = inchi_min(num_SB_Neutr, num_DB_Charged))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|    173|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 25, False: 148]
  |  |  ------------------
  ------------------
  |  Branch (4392:13): [True: 110, False: 63]
  ------------------
 4393|    110|        {
 4394|    110|            BNS_VERTEX* pv1n, * pv2n;
 4395|    110|            BNS_EDGE* pe1n, * pe2n;
 4396|    110|            Vertex      v1n, v2n;
 4397|       |
 4398|    110|            num_try = inchi_min(num_try, pc2i->nNumRemHRevrs - pc2i->nNumRemHInChI);
  ------------------
  |  |  139|    110|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 110]
  |  |  ------------------
  ------------------
 4399|       |            /* detected; attempt to fix */
 4400|    110|            SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 4401|    110|            RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
 4402|    110|            delta = 1;
 4403|    221|            for (i = 0; i < num_DB_Charged && cur_success < num_try; i++)
  ------------------
  |  Branch (4403:25): [True: 112, False: 109]
  |  Branch (4403:47): [True: 111, False: 1]
  ------------------
 4404|    111|            {
 4405|    111|                iat = iat_DB_Charged[i];
 4406|    111|                pe = pBNS->edge + pVA[iat].nCPlusGroupEdge - 1;
 4407|    111|                if (pe->flow)
  ------------------
  |  Branch (4407:21): [True: 0, False: 111]
  ------------------
 4408|      0|                {
 4409|      0|                    continue;
 4410|      0|                }
 4411|    111|                pv1 = pBNS->vert + (v1 = pe->neighbor1);
 4412|    111|                pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
 4413|       |
 4414|    220|                for (j = pv1->num_adj_edges - 1; 0 <= j; j--)
  ------------------
  |  Branch (4414:50): [True: 220, False: 0]
  ------------------
 4415|    220|                {
 4416|    220|                    pe1n = pBNS->edge + pv1->iedge[j];
 4417|    220|                    if (pe1n->flow && !pe1n->forbidden)
  ------------------
  |  Branch (4417:25): [True: 111, False: 109]
  |  Branch (4417:39): [True: 111, False: 0]
  ------------------
 4418|    111|                    {
 4419|    111|                        pv1n = pBNS->vert + (v1n = pe1n->neighbor12 ^ v1);
 4420|    111|                        break;
 4421|    111|                    }
 4422|    220|                }
 4423|    111|                if (j < 0)
  ------------------
  |  Branch (4423:21): [True: 0, False: 111]
  ------------------
 4424|      0|                {
 4425|      0|                    continue; /* not found */
 4426|      0|                }
 4427|       |
 4428|    115|                for (j = pv2->num_adj_edges - 1; 0 <= j; j--)
  ------------------
  |  Branch (4428:50): [True: 115, False: 0]
  ------------------
 4429|    115|                { /* was -2; changed 2006-2-28 12:35pm*/
 4430|    115|                    pe2n = pBNS->edge + pv2->iedge[j];
 4431|    115|                    if (pe2n->flow && !pe2n->forbidden)
  ------------------
  |  Branch (4431:25): [True: 111, False: 4]
  |  Branch (4431:39): [True: 111, False: 0]
  ------------------
 4432|    111|                    {
 4433|    111|                        pv2n = pBNS->vert + (v2n = pe2n->neighbor12 ^ v2);
 4434|    111|                        break;
 4435|    111|                    }
 4436|    115|                }
 4437|    111|                if (j < 0)
  ------------------
  |  Branch (4437:21): [True: 0, False: 111]
  ------------------
 4438|      0|                    continue; /* not found */
 4439|       |
 4440|    111|                pe->flow += delta;
 4441|    111|                pe1n->flow -= delta;
 4442|    111|                pe2n->flow -= delta;
 4443|    111|                pv1n->st_edge.flow -= delta;
 4444|    111|                pv2n->st_edge.flow -= delta;
 4445|    111|                pBNS->tot_st_flow -= 2 * delta;
 4446|       |
 4447|    111|                ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4448|    111|                    &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 4449|       |
 4450|    111|                if (ret == 1 && ((vPathEnd == v1n && vPathStart == v2n) ||
  ------------------
  |  Branch (4450:21): [True: 97, False: 14]
  |  Branch (4450:35): [True: 32, False: 65]
  |  Branch (4450:54): [True: 28, False: 4]
  ------------------
 4451|     69|                    (vPathEnd == v2n && vPathStart == v1n)) &&
  ------------------
  |  Branch (4451:22): [True: 61, False: 8]
  |  Branch (4451:41): [True: 59, False: 2]
  ------------------
 4452|     87|                    (nDeltaCharge == 0 || nDeltaCharge == 1)) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (4452:22): [True: 0, False: 87]
  |  Branch (4452:43): [True: 87, False: 0]
  ------------------
 4453|     87|                {
 4454|       |                    /* Moved charge from OH(+) to -O- => nDeltaCharge == 1 or 0 if pe2n = -O- charge edge */
 4455|       |                    /* Flow change on pe (+)charge edge (atom OH(+)) is not known to RunBnsTestOnce()) */
 4456|     87|                    ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
 4457|     87|                    if (ret > 0)
  ------------------
  |  Branch (4457:25): [True: 87, False: 0]
  ------------------
 4458|     87|                    {
 4459|     87|                        nNumRunBNS++;
 4460|     87|                        cur_success++; /* 17 */
 4461|     87|                    }
 4462|     87|                }
 4463|     24|                else
 4464|     24|                {
 4465|     24|                    pe->flow -= delta;
 4466|     24|                    pe1n->flow += delta;
 4467|     24|                    pe2n->flow += delta;
 4468|     24|                    pv1n->st_edge.flow += delta;
 4469|     24|                    pv2n->st_edge.flow += delta;
 4470|     24|                    pBNS->tot_st_flow += 2 * delta;
 4471|     24|                }
 4472|    111|                INCHI_HEAPCHK
 4473|    111|            }
 4474|    110|            RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 4475|    110|        }
 4476|    173|        CurrEdges.num_edges = 0; /* clear current edge list */
 4477|    173|        if (cur_success)
  ------------------
  |  Branch (4477:13): [True: 87, False: 86]
  ------------------
 4478|     87|        {
 4479|     87|            tot_succes += cur_success;
 4480|       |            /* recalculate InChI from the structure */
 4481|     87|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (4481:17): [True: 0, False: 87]
  ------------------
 4482|     87|                ppt_group_info, ppat_norm, ppat_prep)))
 4483|      0|            {
 4484|      0|                goto exit_function;
 4485|      0|            }
 4486|     87|            if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4486:17): [True: 0, False: 87]
  ------------------
 4487|      0|            {
 4488|      0|                goto exit_function;
 4489|      0|            }
 4490|     87|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (4490:17): [True: 0, False: 87]
  |  Branch (4490:45): [True: 0, False: 0]
  ------------------
 4491|      0|            {
 4492|      0|                goto exit_function;  /* no fixed-H found */
 4493|      0|            }
 4494|     87|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4494:17): [True: 0, False: 87]
  ------------------
 4495|      0|            {
 4496|      0|                goto exit_function;
 4497|      0|            }
 4498|     87|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (4498:17): [True: 0, False: 87]
  ------------------
 4499|      0|            {
 4500|      0|                goto exit_function; /* nothing to do */
 4501|      0|            }
 4502|     87|        }
 4503|    173|    }
 4504|       |
 4505|  1.13k|    if (( pc2i->nNumTgInChI && pStruct->endpoint &&
  ------------------
  |  Branch (4505:11): [True: 782, False: 348]
  |  Branch (4505:32): [True: 782, False: 0]
  ------------------
 4506|    782|          pc2i->nNumTgMInChI > pc2i->nNumTgMRevrs && pc2i->nNumEndpInChI > pc2i->nNumEndpRevrs ))
  ------------------
  |  Branch (4506:11): [True: 250, False: 532]
  |  Branch (4506:54): [True: 210, False: 40]
  ------------------
 4507|    210|    {
 4508|       |        /*-----------------------------------------------------------------*/
 4509|       |        /*                                                                 */
 4510|       |        /* case 18: restored:-N=AB-X                -(-)N-AB-X(+)          */
 4511|       |        /* FixH:              0    0                    0    0             */
 4512|       |        /* MobH:              0    0                    0    0             */
 4513|       |        /*                   non  non                 taut  non            */
 4514|       |        /*                  taut  taut                      taut           */
 4515|       |        /* X = any heteroatom   N=N                                        */
 4516|       |        /* t-group in original has (Hn,-m) in the restored: (Hn,-m+1)      */
 4517|       |        /*       same num_H and more (-) than in the restored structure    */
 4518|       |        /* atom X is not taut in both                                      */
 4519|       |        /* Solution: separate charges between -N(III)= and  X              */
 4520|       |        /*-----------------------------------------------------------------*/
 4521|    210|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 4522|    210|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (4522:41): [True: 134, False: 76]
  ------------------
 4523|    210|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (4523:41): [True: 134, False: 0]
  ------------------
 4524|    210|        int iat, e1, itg, max_success;
 4525|    210|        CurrEdges.num_edges = 0;
 4526|    210|        cur_success = 0;
 4527|    210|        ret = 0;
 4528|       |        /* search for -N= */
 4529|    331|        for (itg = 0; itg < pStruct->ti.num_t_groups && itg < pStruct->One_ti.num_t_groups; itg++)
  ------------------
  |  Branch (4529:23): [True: 234, False: 97]
  |  Branch (4529:57): [True: 121, False: 113]
  ------------------
 4530|    121|        {
 4531|    121|            if (pStruct->ti.t_group[itg].nNumEndpoints <= pStruct->One_ti.t_group[itg].nNumEndpoints ||
  ------------------
  |  Branch (4531:17): [True: 14, False: 107]
  ------------------
 4532|    107|                 pStruct->ti.t_group[itg].num[1] <= pStruct->One_ti.t_group[itg].num[1])
  ------------------
  |  Branch (4532:18): [True: 4, False: 103]
  ------------------
 4533|     18|            {
 4534|     18|                continue;
 4535|     18|            }
 4536|    103|            CurrEdges.num_edges = 0;
 4537|    103|            cur_success = 0;
 4538|    103|            for (j = 0, k = pStruct->ti.t_group[itg].nFirstEndpointAtNoPos;
 4539|    480|                  j < pStruct->ti.t_group[itg].nNumEndpoints; j++)
  ------------------
  |  Branch (4539:19): [True: 377, False: 103]
  ------------------
 4540|    377|            {
 4541|    377|                i = pStruct->ti.nEndpointAtomNumber[k + j]; /* canonical number in restored struct. */
 4542|    377|                iat = nCanon2AtnoRevrs[i];
 4543|    377|                if (!pStruct->endpoint[i] || !at_Mobile_H_Revrs || at_Mobile_H_Revrs[iat].endpoint ||
  ------------------
  |  Branch (4543:21): [True: 0, False: 377]
  |  Branch (4543:46): [True: 0, False: 377]
  |  Branch (4543:68): [True: 65, False: 312]
  ------------------
 4544|    312|                     pVA[i].cNumValenceElectrons != 5 || pVA[i].cPeriodicRowNumber != 1 ||
  ------------------
  |  Branch (4544:22): [True: 133, False: 179]
  |  Branch (4544:58): [True: 14, False: 165]
  ------------------
 4545|    165|                     2 != at2[iat].valence || at2[iat].num_H || at2[iat].radical ||
  ------------------
  |  Branch (4545:22): [True: 46, False: 119]
  |  Branch (4545:47): [True: 3, False: 116]
  |  Branch (4545:65): [True: 1, False: 115]
  ------------------
 4546|    115|                     (0 <= ( e1 = pVA[iat].nCPlusGroupEdge - 1 ) && !pBNS->edge[e1].flow) ||
  ------------------
  |  Branch (4546:23): [True: 115, False: 0]
  |  Branch (4546:69): [True: 3, False: 112]
  ------------------
 4547|    112|                     0 >( e = pVA[iat].nCMinusGroupEdge - 1 ) || pBNS->edge[e].forbidden || pBNS->edge[e].flow) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4547:22): [True: 0, False: 112]
  |  Branch (4547:66): [True: 0, False: 112]
  |  Branch (4547:93): [True: 55, False: 57]
  ------------------
 4548|    320|                {
 4549|    320|                    continue;
 4550|    320|                }
 4551|       |                /* found -N= */
 4552|     57|                if ((ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|     57|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (4552:21): [True: 0, False: 57]
  ------------------
 4553|      0|                {
 4554|      0|                    goto exit_function;
 4555|      0|                }
 4556|     57|            }
 4557|    103|        }
 4558|    210|        if (!( max_success = CurrEdges.num_edges ))
  ------------------
  |  Branch (4558:13): [True: 169, False: 41]
  ------------------
 4559|    169|        {
 4560|    169|            goto exit_case_18;
 4561|    169|        }
 4562|       |        /* search for X */
 4563|    315|        for (i = 0; i < pStruct->num_atoms && cur_success < max_success; i++)
  ------------------
  |  Branch (4563:21): [True: 290, False: 25]
  |  Branch (4563:47): [True: 274, False: 16]
  ------------------
 4564|    274|        {
 4565|    274|            iat = nCanon2AtnoRevrs[i];
 4566|    274|            if (pStruct->endpoint[i] || !pVA[i].cNumValenceElectrons || pVA[i].cNumValenceElectrons == 4 ||
  ------------------
  |  Branch (4566:17): [True: 117, False: 157]
  |  Branch (4566:41): [True: 1, False: 156]
  |  Branch (4566:73): [True: 24, False: 132]
  ------------------
 4567|    132|                 at2[iat].num_H || at2[iat].radical ||
  ------------------
  |  Branch (4567:18): [True: 23, False: 109]
  |  Branch (4567:36): [True: 1, False: 108]
  ------------------
 4568|    108|                 (0 <= ( e1 = pVA[iat].nCMinusGroupEdge - 1 ) && !pBNS->edge[e1].flow) ||
  ------------------
  |  Branch (4568:19): [True: 65, False: 43]
  |  Branch (4568:66): [True: 51, False: 14]
  ------------------
 4569|     57|                 0 >( e = pVA[iat].nCPlusGroupEdge - 1 ) || pBNS->edge[e].forbidden || pBNS->edge[e].flow != 1) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (4569:18): [True: 1, False: 56]
  |  Branch (4569:61): [True: 16, False: 40]
  |  Branch (4569:88): [True: 7, False: 33]
  ------------------
 4570|    241|            {
 4571|    241|                continue;
 4572|    241|            }
 4573|       |            /* try to move the charge */
 4574|     33|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4575|     33|            SetForbiddenEdgeMask( pBNS, &OtherNFlowerEdges, forbidden_edge_mask );
 4576|     33|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 4577|       |
 4578|     33|            pe = pBNS->edge + e;
 4579|     33|            if (!pe->flow)
  ------------------
  |  Branch (4579:17): [True: 0, False: 33]
  ------------------
 4580|      0|                continue;
 4581|     33|            pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 4582|     33|            pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 4583|       |
 4584|     33|            delta = 1;
 4585|     33|            pe->flow -= delta;
 4586|     33|            pv1->st_edge.flow -= delta;
 4587|     33|            pv2->st_edge.flow -= delta;
 4588|     33|            pBNS->tot_st_flow -= 2 * delta;
 4589|       |
 4590|     33|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4591|     33|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4592|       |
 4593|     33|            if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (4593:17): [True: 22, False: 11]
  |  Branch (4593:32): [True: 8, False: 14]
  |  Branch (4593:50): [True: 7, False: 1]
  ------------------
 4594|     20|                              (vPathEnd == v2 && vPathStart == v1) ) && nDeltaCharge == 1) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (4594:32): [True: 14, False: 1]
  |  Branch (4594:50): [True: 13, False: 1]
  |  Branch (4594:73): [True: 20, False: 0]
  ------------------
 4595|     20|            {
 4596|       |                /* Created (-) charge on -N= => nDeltaCharge == 1 */
 4597|       |                /* Flow change on pe (+)charge edge (atom X) is not known to RunBnsTestOnce()) */
 4598|     20|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 4599|     20|                if (ret > 0)
  ------------------
  |  Branch (4599:21): [True: 20, False: 0]
  ------------------
 4600|     20|                {
 4601|     20|                    nNumRunBNS++;
 4602|     20|                    cur_success++; /* 18 */
 4603|     20|                }
 4604|     20|            }
 4605|     13|            else
 4606|     13|            {
 4607|     13|                pe->flow += delta;
 4608|     13|                pv1->st_edge.flow += delta;
 4609|     13|                pv2->st_edge.flow += delta;
 4610|     13|                pBNS->tot_st_flow += 2 * delta;
 4611|     13|            }
 4612|     33|            INCHI_HEAPCHK
 4613|     33|        }
 4614|    210|    exit_case_18:
 4615|    210|        RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4616|    210|        RemoveForbiddenEdgeMask( pBNS, &OtherNFlowerEdges, forbidden_edge_mask );
 4617|    210|        CurrEdges.num_edges = 0; /* clear current edge list */
 4618|    210|        if (ret < 0)
  ------------------
  |  Branch (4618:13): [True: 0, False: 210]
  ------------------
 4619|      0|        {
 4620|      0|            goto exit_function;
 4621|      0|        }
 4622|    210|        if (cur_success)
  ------------------
  |  Branch (4622:13): [True: 20, False: 190]
  ------------------
 4623|     20|        {
 4624|     20|            tot_succes += cur_success;
 4625|       |            /* recalculate InChI from the structure */
 4626|     20|            if (0 >( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (4626:17): [True: 1, False: 19]
  ------------------
 4627|     20|                                                           ppt_group_info, ppat_norm, ppat_prep ) ))
 4628|      1|            {
 4629|      1|                goto exit_function;
 4630|      1|            }
 4631|     19|            if ((ret = FillOutExtraFixedHDataRestr( pStruct ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4631:17): [True: 0, False: 19]
  ------------------
 4632|      0|            {
 4633|      0|                goto exit_function;
 4634|      0|            }
 4635|     19|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (4635:17): [True: 8, False: 11]
  |  Branch (4635:45): [True: 0, False: 8]
  ------------------
 4636|      0|            {
 4637|      0|                goto exit_function;  /* no fixed-H found */
 4638|      0|            }
 4639|     19|            if ((ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4639:17): [True: 0, False: 19]
  ------------------
 4640|      0|            {
 4641|      0|                goto exit_function;
 4642|      0|            }
 4643|     19|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (4643:17): [True: 0, False: 19]
  ------------------
 4644|      0|            {
 4645|      0|                goto exit_function; /* nothing to do */
 4646|      0|            }
 4647|     19|        }
 4648|    210|    }
 4649|       |
 4650|  1.12k|    if (pc2i->len_c2at >= 1)
  ------------------
  |  Branch (4650:9): [True: 1.12k, False: 4]
  ------------------
 4651|  1.12k|    {
 4652|       |        /*--------------------------------------------------------------*/
 4653|       |        /* case 19 restored:       M--OH   original:  M(-)==OH(+)       */
 4654|       |        /* FixH:               metal  0                      1          */
 4655|       |        /* MobH:                      1                      0          */
 4656|       |        /* O =  O, S, Se, Te; not taut. in InChI                        */
 4657|       |        /* In restored structure has H; tautomeric or not tautomeric    */
 4658|       |        /* Solution: move (+) from -OH to M; charhe on M may vary       */
 4659|       |        /*--------------------------------------------------------------*/
 4660|  1.12k|        int iat;
 4661|  1.12k|        EdgeIndex eMPlus, eMMinus; /* djb-rwth: removing redundant variables/code */
 4662|  1.12k|        BNS_EDGE  *peOHPlus, *peMPlus, *peMMinus, *peOMBond;
 4663|  1.12k|        int       iatMetal, ChargeOnMetal, DeltaChargeExpected;
 4664|  1.12k|        cur_success = 0;
 4665|       |        /* djb-rwth: removing redundant code */
 4666|  4.66k|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (4666:21): [True: 3.53k, False: 1.12k]
  ------------------
 4667|  3.53k|        {
 4668|  3.53k|            iat = pc2i->c2at[i].atomNumber;
 4669|  3.53k|            if ( /* orig. InChI info: =NH2(+), =OH(+) */
 4670|  3.53k|                ( pc2i->c2at[i].nValElectr == 6 ) /* N, O, S, Se, Te */ &&
  ------------------
  |  Branch (4670:17): [True: 1.78k, False: 1.74k]
  ------------------
 4671|       |                 /*!pc2i->c2at[i].endptInChI &&*/ /* <=== relaxation */
 4672|  1.78k|                 ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden && pBNS->edge[e].flow &&
  ------------------
  |  Branch (4672:18): [True: 1.15k, False: 637]
  |  Branch (4672:63): [True: 1.09k, False: 56]
  |  Branch (4672:91): [True: 969, False: 126]
  ------------------
 4673|    969|                 pc2i->c2at[i].nFixHInChI == 1 && pc2i->c2at[i].nMobHInChI == 0 &&
  ------------------
  |  Branch (4673:18): [True: 278, False: 691]
  |  Branch (4673:51): [True: 272, False: 6]
  ------------------
 4674|       |                 /* reversed structure info: */
 4675|    272|                 pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs == 1 &&
  ------------------
  |  Branch (4675:18): [True: 188, False: 84]
  |  Branch (4675:51): [True: 173, False: 15]
  ------------------
 4676|    173|                 pc2i->c2at[i].nAtChargeRevrs == 0 && at2[iat].num_H &&
  ------------------
  |  Branch (4676:18): [True: 172, False: 1]
  |  Branch (4676:55): [True: 172, False: 0]
  ------------------
 4677|    172|                 at2[iat].valence == 1 &&
  ------------------
  |  Branch (4677:18): [True: 161, False: 11]
  ------------------
 4678|    161|                 at2[iat].valence == at2[iat].chem_bonds_valence &&
  ------------------
  |  Branch (4678:18): [True: 156, False: 5]
  ------------------
 4679|       |                 /* metal atom */
 4680|    156|                 pVA[iatMetal = at2[iat].neighbor[0]].cMetal &&
  ------------------
  |  Branch (4680:18): [True: 109, False: 47]
  ------------------
 4681|    109|                 ( eMPlus = pVA[iatMetal].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[eMPlus].forbidden &&
  ------------------
  |  Branch (4681:18): [True: 109, False: 0]
  |  Branch (4681:73): [True: 109, False: 0]
  ------------------
 4682|    109|                 ( eMMinus = pVA[iatMetal].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[eMMinus].forbidden &&
  ------------------
  |  Branch (4682:18): [True: 109, False: 0]
  |  Branch (4682:75): [True: 109, False: 0]
  ------------------
 4683|    109|                 !pBNS->edge[pBNS->vert[iat].iedge[0]].forbidden
  ------------------
  |  Branch (4683:18): [True: 109, False: 0]
  ------------------
 4684|  3.53k|                 ) /* djb-rwth: removing redundant code */
 4685|    109|            {
 4686|       |                /* -OH charge edges */
 4687|    109|                if ((ret = AddToEdgeList( &CurrEdges, iat, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    109|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (4687:21): [True: 0, False: 109]
  ------------------
 4688|      0|                {
 4689|      0|                    goto exit_function;
 4690|      0|                }
 4691|    109|            }
 4692|  3.53k|        }
 4693|  1.12k|        if (CurrEdges.num_edges)
  ------------------
  |  Branch (4693:13): [True: 108, False: 1.01k]
  ------------------
 4694|    108|        {
 4695|       |            /* detected; fix */
 4696|    108|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4697|    108|            SetForbiddenEdgeMask( pBNS, &NFlowerEdges, forbidden_edge_mask );
 4698|    108|            SetForbiddenEdgeMask( pBNS, &AllBondEdges, forbidden_edge_mask );
 4699|    217|            for (i = 0; i < CurrEdges.num_edges; i++)
  ------------------
  |  Branch (4699:25): [True: 109, False: 108]
  ------------------
 4700|    109|            {
 4701|       |                /* v1 is -OH, v2 is adjacent to it Metal */
 4702|    109|                iat = CurrEdges.pnEdges[i];
 4703|    109|                iatMetal = at2[iat].neighbor[0];
 4704|    109|                peOHPlus = pBNS->edge + ( (long long)pVA[iat].nCPlusGroupEdge - 1 ); /* djb-rwth: removing redundant variables/code */
 4705|    109|                peMPlus = pBNS->edge + ( (long long)pVA[iatMetal].nCPlusGroupEdge - 1 ); /* djb-rwth: removing redundant variables/code */
 4706|    109|                peMMinus = pBNS->edge + ( (long long)pVA[iatMetal].nCMinusGroupEdge - 1 ); /* djb-rwth: removing redundant variables/code */
 4707|    109|                peOMBond = pBNS->edge + ( pBNS->vert[iat].iedge[0] ); /* djb-rwth: removing redundant variables/code */
 4708|       |                /* remove forbidden edge masks */
 4709|    109|                peMPlus->forbidden &= forbidden_edge_mask_inv;
 4710|    109|                peMMinus->forbidden &= forbidden_edge_mask_inv;
 4711|    109|                peOMBond->forbidden &= forbidden_edge_mask_inv;
 4712|       |
 4713|    109|                ChargeOnMetal = ( peMPlus->cap - peMPlus->flow ) - peMMinus->flow;
 4714|    109|                if (1 == ChargeOnMetal)
  ------------------
  |  Branch (4714:21): [True: 4, False: 105]
  ------------------
 4715|      4|                {
 4716|       |                    /* We are going to subtract 1 from the charge on Metal */
 4717|       |                    /* Added (+)charge to -OH is not known to RunBnsTestOnce() */
 4718|      4|                    DeltaChargeExpected = -1; /* charge will become = 0 */
 4719|      4|                }
 4720|    105|                else
 4721|    105|                {
 4722|    105|                    if (0 == ChargeOnMetal)
  ------------------
  |  Branch (4722:25): [True: 63, False: 42]
  ------------------
 4723|     63|                    {
 4724|     63|                        DeltaChargeExpected = 1; /* charge on Metal will be created */
 4725|     63|                    }
 4726|     42|                    else
 4727|     42|                    {
 4728|     42|                        DeltaChargeExpected = 0;
 4729|     42|                    }
 4730|    105|                }
 4731|       |
 4732|    109|                delta = 1;
 4733|    109|                pe = peOHPlus;
 4734|    109|                if (!pe->flow)
  ------------------
  |  Branch (4734:21): [True: 0, False: 109]
  ------------------
 4735|      0|                    continue;
 4736|    109|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 4737|    109|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 4738|       |
 4739|    109|                pe->flow -= delta; /* remove (-) from AB-O(-) */
 4740|    109|                pv1->st_edge.flow -= delta;
 4741|    109|                pv2->st_edge.flow -= delta;
 4742|    109|                pBNS->tot_st_flow -= 2 * delta;
 4743|       |
 4744|    109|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4745|    109|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4746|       |
 4747|    109|                if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (4747:21): [True: 109, False: 0]
  |  Branch (4747:36): [True: 9, False: 100]
  |  Branch (4747:54): [True: 7, False: 2]
  ------------------
 4748|    107|                                  (vPathEnd == v2 && vPathStart == v1) ) && nDeltaCharge == DeltaChargeExpected) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (4748:36): [True: 100, False: 2]
  |  Branch (4748:54): [True: 100, False: 0]
  |  Branch (4748:77): [True: 107, False: 0]
  ------------------
 4749|    107|                {
 4750|    107|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 4751|    107|                    if (ret > 0)
  ------------------
  |  Branch (4751:25): [True: 107, False: 0]
  ------------------
 4752|    107|                    {
 4753|    107|                        nNumRunBNS++;
 4754|    107|                        cur_success++; /* 19 */
 4755|    107|                    }
 4756|    107|                }
 4757|      2|                else
 4758|      2|                {
 4759|      2|                    pe->flow += delta;
 4760|      2|                    pv1->st_edge.flow += delta;
 4761|      2|                    pv2->st_edge.flow += delta;
 4762|      2|                    pBNS->tot_st_flow += 2 * delta;
 4763|      2|                }
 4764|    109|                INCHI_HEAPCHK
 4765|       |                    /* set forbidden edge masks back */
 4766|    109|                    peMPlus->forbidden |= forbidden_edge_mask;
 4767|    109|                peMMinus->forbidden |= forbidden_edge_mask;
 4768|    109|                peOMBond->forbidden |= forbidden_edge_mask;
 4769|    109|            }
 4770|    108|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4771|    108|            RemoveForbiddenEdgeMask( pBNS, &NFlowerEdges, forbidden_edge_mask );
 4772|    108|            RemoveForbiddenEdgeMask( pBNS, &AllBondEdges, forbidden_edge_mask );
 4773|       |
 4774|    108|            CurrEdges.num_edges = 0; /* clear current edge list */
 4775|    108|            if (cur_success)
  ------------------
  |  Branch (4775:17): [True: 106, False: 2]
  ------------------
 4776|    106|            {
 4777|    106|                tot_succes += cur_success;
 4778|       |                /* recalculate InChI from the structure */
 4779|    106|                if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (4779:21): [True: 0, False: 106]
  ------------------
 4780|    106|                                                                ppt_group_info, ppat_norm, ppat_prep ) ))
 4781|      0|                {
 4782|      0|                    goto exit_function;
 4783|      0|                }
 4784|    106|                if ((ret = FillOutExtraFixedHDataRestr( pStruct ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4784:21): [True: 0, False: 106]
  ------------------
 4785|      0|                {
 4786|      0|                    goto exit_function;
 4787|      0|                }
 4788|    106|                if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (4788:21): [True: 0, False: 106]
  |  Branch (4788:49): [True: 0, False: 0]
  ------------------
 4789|      0|                {
 4790|      0|                    goto exit_function;  /* no fixed-H found */
 4791|      0|                }
 4792|    106|                if ((ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4792:21): [True: 0, False: 106]
  ------------------
 4793|      0|                {
 4794|      0|                    goto exit_function;
 4795|      0|                }
 4796|    106|                if (!pc2i->bHasDifference)
  ------------------
  |  Branch (4796:21): [True: 1, False: 105]
  ------------------
 4797|      1|                {
 4798|      1|                    goto exit_function; /* nothing to do */
 4799|      1|                }
 4800|    106|            }
 4801|    108|        }
 4802|  1.12k|    }
 4803|       |
 4804|  1.12k|    if (pc2i->len_c2at > 1 && pc2i->nNumTgRevrs && pc2i->nNumTgInChI)
  ------------------
  |  Branch (4804:9): [True: 1.01k, False: 115]
  |  Branch (4804:31): [True: 436, False: 577]
  |  Branch (4804:52): [True: 290, False: 146]
  ------------------
 4805|    290|    {
 4806|       |        /*--------------------------------------------------------------*/
 4807|       |        /* case 20: restored:  O(-)-AB=N-   original:   O=AB-N(-)-      */
 4808|       |        /* FixH:               0       0                0     -1        */
 4809|       |        /* MobH:               0       0                0      1        */
 4810|       |        /*                   taut    non-taut       non-taut taut       */
 4811|       |        /*                           or taut                  no H      */
 4812|       |        /*                           no H                               */
 4813|       |        /* O = O, S, Se; N = N, O, S, Se, Te;                           */
 4814|       |        /* restored atoms are taut/non-taut; original are opposite.     */
 4815|       |        /* Solution: move (-) from O(-) to =N-                          */
 4816|       |        /*--------------------------------------------------------------*/
 4817|    290|        int num_SB_O_Minus = 0, num_DB_N = 0, iat;
 4818|       |
 4819|    290|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 4820|       |        /*
 4821|       |        inp_ATOM *at_Mobile_H_Revrs = (pStruct->pOne_norm_data[1] &&
 4822|       |        pStruct->pOne_norm_data[1]->at)? pStruct->pOne_norm_data[1]->at : NULL;
 4823|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 4824|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 4825|       |        */
 4826|    290|        cur_success = 0;
 4827|       |
 4828|    290|        CurrEdges.num_edges = 0; /* clear current edge list */
 4829|  1.40k|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (4829:21): [True: 1.11k, False: 290]
  ------------------
 4830|  1.11k|        {
 4831|  1.11k|            iat = pc2i->c2at[i].atomNumber;
 4832|  1.11k|            if ( /* orig. InChI info: =O or -N= */
 4833|  1.11k|                num_DB_N < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  2.22k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (4833:17): [True: 1.11k, False: 0]
  ------------------
 4834|  1.11k|                pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (4834:17): [True: 540, False: 574]
  ------------------
 4835|    540|                (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (4835:17): [True: 378, False: 162]
  |  Branch (4835:61): [True: 378, False: 0]
  ------------------
 4836|    378|                pBNS->edge[e].flow == 0 &&
  ------------------
  |  Branch (4836:17): [True: 284, False: 94]
  ------------------
 4837|    284|                pc2i->c2at[i].nFixHInChI == 0 && pc2i->c2at[i].nMobHInChI == 0 &&
  ------------------
  |  Branch (4837:17): [True: 259, False: 25]
  |  Branch (4837:50): [True: 259, False: 0]
  ------------------
 4838|       |                /* if  more than 1 t-group are in orig. InChI then do not move (-) to N */
 4839|    259|                (pc2i->nNumTgInChI == 1 || pc2i->c2at[i].nValElectr == 6) &&
  ------------------
  |  Branch (4839:18): [True: 193, False: 66]
  |  Branch (4839:44): [True: 14, False: 52]
  ------------------
 4840|       |                /* reversed structure info: */
 4841|    207|                !pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (4841:17): [True: 207, False: 0]
  ------------------
 4842|    207|                pc2i->c2at[i].nFixHRevrs == 0 && /*pc2i->c2at[i].nMobHRevrs == 0 &&*/
  ------------------
  |  Branch (4842:17): [True: 207, False: 0]
  ------------------
 4843|    207|                pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (4843:17): [True: 181, False: 26]
  |  Branch (4843:54): [True: 181, False: 0]
  ------------------
 4844|    181|                at2[iat].valence + 1 == at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (4844:17): [True: 154, False: 27]
  ------------------
 4845|    154|            {
 4846|    154|                iat_DB_N[num_DB_N++] = iat;
 4847|    154|                if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    154|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (4847:21): [True: 0, False: 154]
  ------------------
 4848|      0|                {
 4849|      0|                    goto exit_function;
 4850|      0|                }
 4851|    154|            }
 4852|    960|            else
 4853|    960|            {
 4854|    960|                if ( /* orig. InChI info: -O(-) */
 4855|    960|                    num_SB_O_Minus < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  1.92k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (4855:21): [True: 960, False: 0]
  ------------------
 4856|    960|                    !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (4856:21): [True: 574, False: 386]
  ------------------
 4857|    574|                    (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (4857:21): [True: 444, False: 130]
  |  Branch (4857:65): [True: 444, False: 0]
  ------------------
 4858|    444|                    pBNS->edge[e].flow == 1 &&
  ------------------
  |  Branch (4858:21): [True: 173, False: 271]
  ------------------
 4859|    173|                    pc2i->c2at[i].nFixHInChI == 0 && pc2i->c2at[i].nMobHInChI == 0 &&
  ------------------
  |  Branch (4859:21): [True: 165, False: 8]
  |  Branch (4859:54): [True: 165, False: 0]
  ------------------
 4860|    165|                    pc2i->c2at[i].nValElectr == 6 &&
  ------------------
  |  Branch (4860:21): [True: 159, False: 6]
  ------------------
 4861|       |                    /* reversed structure info: */
 4862|    159|                    pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (4862:21): [True: 154, False: 5]
  ------------------
 4863|    154|                    pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs == 0 &&
  ------------------
  |  Branch (4863:21): [True: 154, False: 0]
  |  Branch (4863:54): [True: 154, False: 0]
  ------------------
 4864|    154|                    pc2i->c2at[i].nAtChargeRevrs == -1 && !at2[iat].num_H &&
  ------------------
  |  Branch (4864:21): [True: 154, False: 0]
  |  Branch (4864:59): [True: 154, False: 0]
  ------------------
 4865|    154|                    at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 1)
  ------------------
  |  Branch (4865:21): [True: 154, False: 0]
  |  Branch (4865:46): [True: 154, False: 0]
  ------------------
 4866|    154|                {
 4867|    154|                    iat_SB_O_Minus[num_SB_O_Minus++] = iat;
 4868|    154|                }
 4869|    960|            }
 4870|  1.11k|        }
 4871|    290|        if (!num_DB_N)
  ------------------
  |  Branch (4871:13): [True: 181, False: 109]
  ------------------
 4872|    181|        {
 4873|       |            /* search among N that are tautomeric in both cases */
 4874|  1.57k|            for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (4874:25): [True: 1.39k, False: 181]
  ------------------
 4875|  1.39k|            { /* i = canonical number - 1 */
 4876|  1.39k|                if (!pStruct->endpoint[i])
  ------------------
  |  Branch (4876:21): [True: 925, False: 470]
  ------------------
 4877|    925|                {
 4878|    925|                    continue;
 4879|    925|                }
 4880|    470|                iat = nCanon2AtnoRevrs[i];
 4881|    470|                if ( /* in restored atom O: charge=-1, no H, has no double bond, endpoint */
 4882|    470|                    num_DB_N < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|    940|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (4882:21): [True: 470, False: 0]
  ------------------
 4883|    470|                    at2[iat].charge == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (4883:21): [True: 246, False: 224]
  |  Branch (4883:45): [True: 194, False: 52]
  ------------------
 4884|    194|                    at2[iat].valence + 1 == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (4884:21): [True: 119, False: 75]
  |  Branch (4884:76): [True: 119, False: 0]
  ------------------
 4885|       |                    /* in orig.InChI: an endpoint, has no H */
 4886|    119|                    !(pStruct->fixed_H && pStruct->fixed_H[i]) &&
  ------------------
  |  Branch (4886:23): [True: 119, False: 0]
  |  Branch (4886:43): [True: 12, False: 107]
  ------------------
 4887|       |                    /*!(nMobHInChI && nMobHInChI[i] ) &&*/
 4888|       |                    /* has (-) edge */
 4889|    107|                    (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (4889:21): [True: 99, False: 8]
  |  Branch (4889:65): [True: 99, False: 0]
  ------------------
 4890|     99|                    !pBNS->edge[e].flow)
  ------------------
  |  Branch (4890:21): [True: 99, False: 0]
  ------------------
 4891|     99|                {
 4892|       |
 4893|     99|                    iat_DB_N[num_DB_N++] = iat;
 4894|     99|                    if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|     99|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (4894:25): [True: 0, False: 99]
  ------------------
 4895|      0|                    {
 4896|      0|                        goto exit_function;
 4897|      0|                    }
 4898|     99|                }
 4899|    470|            }
 4900|    181|        }
 4901|    290|        if ((num_try = inchi_min(num_SB_O_Minus, num_DB_N))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|    290|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 101, False: 189]
  |  |  ------------------
  ------------------
  |  Branch (4901:13): [True: 102, False: 188]
  ------------------
 4902|    102|        {
 4903|       |            /* detected; attempt to fix */
 4904|    102|            SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 4905|    102|            RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
 4906|    102|            delta = 1;
 4907|    218|            for (i = 0; i < num_SB_O_Minus && cur_success < num_try; i++)
  ------------------
  |  Branch (4907:25): [True: 119, False: 99]
  |  Branch (4907:47): [True: 116, False: 3]
  ------------------
 4908|    116|            {
 4909|    116|                iat = iat_SB_O_Minus[i];
 4910|    116|                pe = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
 4911|    116|                if (!pe->flow)
  ------------------
  |  Branch (4911:21): [True: 0, False: 116]
  ------------------
 4912|      0|                    continue;
 4913|    116|                pv1 = pBNS->vert + (v1 = pe->neighbor1);
 4914|    116|                pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
 4915|       |
 4916|    116|                pe->flow -= delta;
 4917|    116|                pv1->st_edge.flow -= delta;
 4918|    116|                pv2->st_edge.flow -= delta;
 4919|    116|                pBNS->tot_st_flow -= 2 * delta;
 4920|       |
 4921|    116|                ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4922|    116|                    &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 4923|       |
 4924|    116|                if (ret == 1 && ((vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (4924:21): [True: 53, False: 63]
  |  Branch (4924:35): [True: 2, False: 51]
  |  Branch (4924:53): [True: 2, False: 0]
  ------------------
 4925|     51|                    (vPathEnd == v2 && vPathStart == v1)) && nDeltaCharge == 1) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4925:22): [True: 51, False: 0]
  |  Branch (4925:40): [True: 48, False: 3]
  |  Branch (4925:62): [True: 50, False: 0]
  ------------------
 4926|     50|                {
 4927|       |                    /* Added (-) charge to =N- => nDeltaCharge == 1 */
 4928|       |                    /* Flow change on pe (-)charge edge (atom -O(-)) is not known to RunBnsTestOnce()) */
 4929|     50|                    ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
 4930|     50|                    if (ret > 0)
  ------------------
  |  Branch (4930:25): [True: 50, False: 0]
  ------------------
 4931|     50|                    {
 4932|     50|                        nNumRunBNS++;
 4933|     50|                        cur_success++; /* 20 */
 4934|     50|                    }
 4935|     50|                }
 4936|     66|                else
 4937|     66|                {
 4938|     66|                    pe->flow += delta;
 4939|     66|                    pv1->st_edge.flow += delta;
 4940|     66|                    pv2->st_edge.flow += delta;
 4941|     66|                    pBNS->tot_st_flow += 2 * delta;
 4942|     66|                }
 4943|    116|                INCHI_HEAPCHK
 4944|    116|            }
 4945|    102|            RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 4946|    102|        }
 4947|    290|        CurrEdges.num_edges = 0; /* clear current edge list */
 4948|    290|        if (cur_success)
  ------------------
  |  Branch (4948:13): [True: 49, False: 241]
  ------------------
 4949|     49|        {
 4950|     49|            tot_succes += cur_success;
 4951|       |            /* recalculate InChI from the structure */
 4952|     49|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (4952:17): [True: 1, False: 48]
  ------------------
 4953|     49|                ppt_group_info, ppat_norm, ppat_prep)))
 4954|      1|            {
 4955|      1|                goto exit_function;
 4956|      1|            }
 4957|     48|            if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4957:17): [True: 0, False: 48]
  ------------------
 4958|      0|            {
 4959|      0|                goto exit_function;
 4960|      0|            }
 4961|     48|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (4961:17): [True: 32, False: 16]
  |  Branch (4961:45): [True: 0, False: 32]
  ------------------
 4962|      0|            {
 4963|      0|                goto exit_function;  /* no fixed-H found */
 4964|      0|            }
 4965|     48|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4965:17): [True: 0, False: 48]
  ------------------
 4966|      0|            {
 4967|      0|                goto exit_function;
 4968|      0|            }
 4969|     48|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (4969:17): [True: 0, False: 48]
  ------------------
 4970|      0|            {
 4971|      0|                goto exit_function; /* nothing to do */
 4972|      0|            }
 4973|     48|        }
 4974|    290|    }
 4975|       |
 4976|  1.12k|    if (pc2i->len_c2at && pc2i->nNumTgRevrs && pc2i->nNumTgHInChI && pStruct->endpoint)
  ------------------
  |  Branch (4976:9): [True: 1.12k, False: 4]
  |  Branch (4976:27): [True: 450, False: 673]
  |  Branch (4976:48): [True: 0, False: 450]
  |  Branch (4976:70): [True: 0, False: 0]
  ------------------
 4977|      0|    {
 4978|       |        /*--------------------------------------------------------------*/
 4979|       |        /*                      O(-)                      O             */
 4980|       |        /*                      |                         ||            */
 4981|       |        /* case 21: restored: R=S=O         original:   R-S=O           */
 4982|       |        /*                      |                         |             */
 4983|       |        /*                      O(-)                      O(-)          */
 4984|       |        /*                           All O are taut     R is not taut   */
 4985|       |        /*                                                              */
 4986|       |        /* In addition, another atom O that should have been tautomeric */
 4987|       |        /* or has H(+) added in Mobile-H layer is not like that         */
 4988|       |        /* O = O, S, Se;  S=S, Se, Te                                  */
 4989|       |        /* Solution: move (-) from O(-) to =O                           */
 4990|       |        /*           these atoms are tautomeric in restored structure   */
 4991|       |        /*--------------------------------------------------------------*/
 4992|      0|        int num_SB_O_Minus = 0, num_DB_O = 0, iat, iS;
 4993|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 4994|      0|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (4994:41): [True: 0, False: 0]
  ------------------
 4995|      0|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (4995:41): [True: 0, False: 0]
  ------------------
 4996|       |        /*
 4997|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 4998|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 4999|       |        */
 5000|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 5001|      0|        cur_success = 0;
 5002|       |
 5003|      0|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (5003:21): [True: 0, False: 0]
  ------------------
 5004|      0|        {
 5005|      0|            iat = pc2i->c2at[i].atomNumber;
 5006|      0|            if ( /* orig. InChI info: =O    */
 5007|      0|                num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (5007:17): [True: 0, False: 0]
  ------------------
 5008|      0|                pc2i->c2at[i].nValElectr == 6 /* O, S, Se, Te */ &&
  ------------------
  |  Branch (5008:17): [True: 0, False: 0]
  ------------------
 5009|      0|                (pc2i->c2at[i].endptInChI || pc2i->c2at[i].nMobHInChI) &&
  ------------------
  |  Branch (5009:18): [True: 0, False: 0]
  |  Branch (5009:46): [True: 0, False: 0]
  ------------------
 5010|      0|                (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (5010:17): [True: 0, False: 0]
  |  Branch (5010:61): [True: 0, False: 0]
  ------------------
 5011|      0|                pc2i->c2at[i].nFixHInChI == 0 && /*pc2i->c2at[i].nMobHInChI ==  1 &&*/
  ------------------
  |  Branch (5011:17): [True: 0, False: 0]
  ------------------
 5012|       |                /* reversed structure info: */
 5013|      0|                !(pc2i->c2at[i].endptRevrs || pc2i->c2at[i].nMobHRevrs) &&
  ------------------
  |  Branch (5013:19): [True: 0, False: 0]
  |  Branch (5013:47): [True: 0, False: 0]
  ------------------
 5014|      0|                pc2i->c2at[i].nFixHRevrs == 0 &&
  ------------------
  |  Branch (5014:17): [True: 0, False: 0]
  ------------------
 5015|      0|                pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (5015:17): [True: 0, False: 0]
  |  Branch (5015:54): [True: 0, False: 0]
  ------------------
 5016|      0|                at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 2)
  ------------------
  |  Branch (5016:17): [True: 0, False: 0]
  |  Branch (5016:42): [True: 0, False: 0]
  ------------------
 5017|      0|            {
 5018|      0|                iat_DB_O[num_DB_O++] = iat;
 5019|      0|                if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5019:21): [True: 0, False: 0]
  ------------------
 5020|      0|                {
 5021|      0|                    goto exit_function;
 5022|      0|                }
 5023|      0|            }
 5024|      0|        }
 5025|      0|        for (i = 0; num_DB_O && i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (5025:21): [True: 0, False: 0]
  |  Branch (5025:33): [True: 0, False: 0]
  ------------------
 5026|      0|        {
 5027|       |            /* i = canonical number - 1 */
 5028|      0|            if (!pStruct->endpoint[i])
  ------------------
  |  Branch (5028:17): [True: 0, False: 0]
  ------------------
 5029|      0|            {
 5030|      0|                continue;
 5031|      0|            }
 5032|      0|            iat = nCanon2AtnoRevrs[i];
 5033|      0|            if ( /* in restored atom O: charge=-1, no H, has no double bond, endpoint */
 5034|      0|                num_SB_O_Minus < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (5034:17): [True: 0, False: 0]
  ------------------
 5035|      0|                at2[iat].charge == -1 && !at2[iat].num_H &&
  ------------------
  |  Branch (5035:17): [True: 0, False: 0]
  |  Branch (5035:42): [True: 0, False: 0]
  ------------------
 5036|      0|                at2[iat].valence == 1 && at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (5036:17): [True: 0, False: 0]
  |  Branch (5036:42): [True: 0, False: 0]
  |  Branch (5036:73): [True: 0, False: 0]
  ------------------
 5037|      0|                pVA[iat].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (5037:17): [True: 0, False: 0]
  ------------------
 5038|      0|                (at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint) &&
  ------------------
  |  Branch (5038:18): [True: 0, False: 0]
  |  Branch (5038:39): [True: 0, False: 0]
  ------------------
 5039|       |                /* in orig.InChI: an endpoint, has no H */
 5040|      0|                !(pStruct->fixed_H && pStruct->fixed_H[i]) &&
  ------------------
  |  Branch (5040:19): [True: 0, False: 0]
  |  Branch (5040:39): [True: 0, False: 0]
  ------------------
 5041|       |                /*!(nMobHInChI && nMobHInChI[i] ) &&*/
 5042|       |                /* has (-) edge */
 5043|      0|                (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (5043:17): [True: 0, False: 0]
  |  Branch (5043:61): [True: 0, False: 0]
  ------------------
 5044|      0|                pBNS->edge[e].flow)
  ------------------
  |  Branch (5044:17): [True: 0, False: 0]
  ------------------
 5045|      0|            {
 5046|      0|                int nNumTautSB = 0, nNumTautDB = 0, nNumOtherDB = 0, nNumOtherSB = 0, nNumOthers = 0, nNumNegEndp = 0; /* djb-rwth: ignoring LLVM warning: variables used */
 5047|       |                /* traverse neighbors of the centerpoint iS */
 5048|      0|                iS = at2[i].neighbor[0];
 5049|      0|                for (j = 0; j < num_SB_O_Minus; j++)
  ------------------
  |  Branch (5049:29): [True: 0, False: 0]
  ------------------
 5050|      0|                {
 5051|      0|                    if (iat_Central[j] == iS)
  ------------------
  |  Branch (5051:25): [True: 0, False: 0]
  ------------------
 5052|      0|                        break;
 5053|      0|                }
 5054|      0|                if (j < num_SB_O_Minus)
  ------------------
  |  Branch (5054:21): [True: 0, False: 0]
  ------------------
 5055|      0|                {
 5056|      0|                    continue;  /* have already been there */
 5057|      0|                }
 5058|      0|                for (j = 0; j < at[iS].valence; j++)
  ------------------
  |  Branch (5058:29): [True: 0, False: 0]
  ------------------
 5059|      0|                {
 5060|      0|                    int bond_type = at2[iS].bond_type[j];
 5061|      0|                    k = at2[iS].neighbor[j];
 5062|      0|                    if (k == i)
  ------------------
  |  Branch (5062:25): [True: 0, False: 0]
  ------------------
 5063|      0|                    {
 5064|      0|                        continue;
 5065|      0|                    }
 5066|      0|                    if (pStruct->endpoint[k] == pStruct->endpoint[i])
  ------------------
  |  Branch (5066:25): [True: 0, False: 0]
  ------------------
 5067|      0|                    {
 5068|      0|                        nNumTautSB += (bond_type == BOND_TYPE_SINGLE);
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
 5069|      0|                        nNumTautDB += (bond_type == BOND_TYPE_DOUBLE);
  ------------------
  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
 5070|      0|                    }
 5071|      0|                    else
 5072|      0|                    {
 5073|      0|                        if (bond_type == BOND_TYPE_DOUBLE)
  ------------------
  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (5073:29): [True: 0, False: 0]
  ------------------
 5074|      0|                        {
 5075|      0|                            nNumOtherDB++;
 5076|      0|                        }
 5077|      0|                        else
 5078|      0|                        {
 5079|      0|                            if (bond_type == BOND_TYPE_SINGLE)
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (5079:33): [True: 0, False: 0]
  ------------------
 5080|      0|                            {
 5081|      0|                                nNumOtherSB++;
 5082|      0|                            }
 5083|      0|                            else
 5084|      0|                            {
 5085|      0|                                nNumOthers++;
 5086|      0|                            }
 5087|      0|                        }
 5088|      0|                    }
 5089|      0|                    if (at2[k].endpoint == at2[i].endpoint && at2[k].valence == 1 &&
  ------------------
  |  Branch (5089:25): [True: 0, False: 0]
  |  Branch (5089:63): [True: 0, False: 0]
  ------------------
 5090|      0|                        at2[k].charge == -1 && pVA[k].cNumValenceElectrons == 6)
  ------------------
  |  Branch (5090:25): [True: 0, False: 0]
  |  Branch (5090:48): [True: 0, False: 0]
  ------------------
 5091|      0|                    {
 5092|      0|                        nNumNegEndp++;
 5093|      0|                    }
 5094|      0|                }
 5095|      0|                if (!nNumTautSB)
  ------------------
  |  Branch (5095:21): [True: 0, False: 0]
  ------------------
 5096|      0|                {
 5097|      0|                    continue;
 5098|      0|                }
 5099|      0|                if (!(nNumOtherDB && nNumTautDB))
  ------------------
  |  Branch (5099:23): [True: 0, False: 0]
  |  Branch (5099:38): [True: 0, False: 0]
  ------------------
 5100|      0|                {
 5101|      0|                    continue; /* ignore */
 5102|      0|                }
 5103|       |
 5104|      0|                iat_SB_O_Minus[num_SB_O_Minus] = iat;
 5105|      0|                iat_Central[num_SB_O_Minus++] = iS;
 5106|      0|            }
 5107|      0|        }
 5108|      0|        if ((num_try = inchi_min(num_SB_O_Minus, num_DB_O))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (5108:13): [True: 0, False: 0]
  ------------------
 5109|      0|        {
 5110|       |            /* detected; attempt to fix */
 5111|      0|            SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 5112|      0|            RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
 5113|      0|            delta = 1;
 5114|      0|            for (i = 0; i < num_SB_O_Minus && cur_success < num_try; i++)
  ------------------
  |  Branch (5114:25): [True: 0, False: 0]
  |  Branch (5114:47): [True: 0, False: 0]
  ------------------
 5115|      0|            {
 5116|      0|                iat = iat_SB_O_Minus[i];
 5117|      0|                pe = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
 5118|      0|                if (!pe->flow)
  ------------------
  |  Branch (5118:21): [True: 0, False: 0]
  ------------------
 5119|      0|                    continue;
 5120|      0|                pv1 = pBNS->vert + (v1 = pe->neighbor1);
 5121|      0|                pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
 5122|       |
 5123|      0|                pe->forbidden |= forbidden_edge_mask;
 5124|      0|                pe->flow -= delta;
 5125|      0|                pv1->st_edge.flow -= delta;
 5126|      0|                pv2->st_edge.flow -= delta;
 5127|      0|                pBNS->tot_st_flow -= 2 * delta;
 5128|       |
 5129|      0|                ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 5130|      0|                    &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 5131|       |
 5132|      0|                if (ret == 1 && ((vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (5132:21): [True: 0, False: 0]
  |  Branch (5132:35): [True: 0, False: 0]
  |  Branch (5132:53): [True: 0, False: 0]
  ------------------
 5133|      0|                    (vPathEnd == v2 && vPathStart == v1)) && nDeltaCharge == 1) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (5133:22): [True: 0, False: 0]
  |  Branch (5133:40): [True: 0, False: 0]
  |  Branch (5133:62): [True: 0, False: 0]
  ------------------
 5134|      0|                {
 5135|       |                    /* Added (-) charge to =O => nDeltaCharge == 1 */
 5136|       |                    /* Flow change on pe (-)charge edge (atom -N(-)-) is not known to RunBnsTestOnce()) */
 5137|      0|                    ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
 5138|      0|                    if (ret > 0)
  ------------------
  |  Branch (5138:25): [True: 0, False: 0]
  ------------------
 5139|      0|                    {
 5140|      0|                        nNumRunBNS++;
 5141|      0|                        cur_success++; /* 21 */
 5142|      0|                    }
 5143|      0|                }
 5144|      0|                else
 5145|      0|                {
 5146|      0|                    pe->flow += delta;
 5147|      0|                    pv1->st_edge.flow += delta;
 5148|      0|                    pv2->st_edge.flow += delta;
 5149|      0|                    pBNS->tot_st_flow += 2 * delta;
 5150|      0|                }
 5151|      0|                INCHI_HEAPCHK
 5152|      0|            }
 5153|      0|            RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 5154|      0|        }
 5155|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 5156|      0|        if (cur_success)
  ------------------
  |  Branch (5156:13): [True: 0, False: 0]
  ------------------
 5157|      0|        {
 5158|      0|            tot_succes += cur_success;
 5159|       |            /* recalculate InChI from the structure */
 5160|      0|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (5160:17): [True: 0, False: 0]
  ------------------
 5161|      0|                ppt_group_info, ppat_norm, ppat_prep)))
 5162|      0|            {
 5163|      0|                goto exit_function;
 5164|      0|            }
 5165|      0|            if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (5165:17): [True: 0, False: 0]
  ------------------
 5166|      0|            {
 5167|      0|                goto exit_function;
 5168|      0|            }
 5169|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (5169:17): [True: 0, False: 0]
  |  Branch (5169:45): [True: 0, False: 0]
  ------------------
 5170|      0|            {
 5171|      0|                goto exit_function;  /* no fixed-H found */
 5172|      0|            }
 5173|      0|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (5173:17): [True: 0, False: 0]
  ------------------
 5174|      0|            {
 5175|      0|                goto exit_function;
 5176|      0|            }
 5177|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (5177:17): [True: 0, False: 0]
  ------------------
 5178|      0|            {
 5179|      0|                goto exit_function; /* nothing to do */
 5180|      0|            }
 5181|      0|        }
 5182|      0|    }
 5183|       |
 5184|  1.12k|    if (pc2i->len_c2at && pc2i->nNumTgRevrs && pc2i->nNumEndpInChI < pc2i->nNumEndpRevrs)
  ------------------
  |  Branch (5184:9): [True: 1.12k, False: 4]
  |  Branch (5184:27): [True: 450, False: 673]
  |  Branch (5184:48): [True: 233, False: 217]
  ------------------
 5185|    233|    {
 5186|       |        /*--------------------------------------------------------------*/
 5187|       |        /*                      O                         O             */
 5188|       |        /*                      ||                        ||            */
 5189|       |        /* case 21a:restored: R=S-R' =X     original:   R-S-R' -X(-)    */
 5190|       |        /*                      |                         ||            */
 5191|       |        /*                      O(-)                      O(-)          */
 5192|       |        /*             All O and X are taut      O and X are not taut   */
 5193|       |        /*             it is possible that X is R                       */
 5194|       |        /*                                                              */
 5195|       |        /* O = O, S, Se;  S=S, Se, Te; X = N, O, S, Se, Te              */
 5196|       |        /* Solution: move (-) from O(-) to =X                           */
 5197|       |        /*           these atoms are tautomeric in restored structure   */
 5198|       |        /*--------------------------------------------------------------*/
 5199|    233|        int iat, iS;
 5200|       |        /*
 5201|       |        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 5202|       |        */
 5203|    233|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (5203:41): [True: 233, False: 0]
  ------------------
 5204|    233|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (5204:41): [True: 233, False: 0]
  ------------------
 5205|       |        /*
 5206|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 5207|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 5208|       |        */
 5209|    233|        EDGE_LIST  OtherSO, CentralS, SOMinus, MinusAcceptord;
 5210|    233|        CurrEdges.num_edges = 0; /* clear current edge list */
 5211|    233|        AllocEdgeList( &OtherSO, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|    233|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5212|    233|        AllocEdgeList( &CentralS, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|    233|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5213|    233|        AllocEdgeList( &SOMinus, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|    233|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5214|    233|        AllocEdgeList( &MinusAcceptord, EDGE_LIST_CLEAR );
  ------------------
  |  |  242|    233|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5215|    233|        cur_success = 0;
 5216|    233|        if (!at_Mobile_H_Revrs)
  ------------------
  |  Branch (5216:13): [True: 0, False: 233]
  ------------------
 5217|      0|        {
 5218|      0|            goto exit_case_21a;
 5219|      0|        }
 5220|  1.10k|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (5220:21): [True: 870, False: 233]
  ------------------
 5221|    870|        {
 5222|    870|            iat = pc2i->c2at[i].atomNumber;
 5223|    870|            if ( /* orig. InChI info: -X(-)    */
 5224|       |                 /*num_DB_O < MAX_DIFF_FIXH &&*/
 5225|       |                 /*pc2i->c2at[i].nValElectr == 6 */ /* O, S, Se, Te */
 5226|    870|                 !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (5226:18): [True: 823, False: 47]
  ------------------
 5227|    823|                 ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (5227:18): [True: 594, False: 229]
  |  Branch (5227:64): [True: 594, False: 0]
  ------------------
 5228|    594|                 pc2i->c2at[i].nFixHInChI == 0 && /*pc2i->c2at[i].nMobHInChI ==  1 &&*/
  ------------------
  |  Branch (5228:18): [True: 443, False: 151]
  ------------------
 5229|       |                                                  /* reversed structure info: */
 5230|    443|                 ( pc2i->c2at[i].endptRevrs || pc2i->c2at[i].nMobHRevrs ) &&
  ------------------
  |  Branch (5230:20): [True: 436, False: 7]
  |  Branch (5230:48): [True: 7, False: 0]
  ------------------
 5231|    443|                 pc2i->c2at[i].nFixHRevrs == 0 &&
  ------------------
  |  Branch (5231:18): [True: 436, False: 7]
  ------------------
 5232|    436|                 /*pc2i->c2at[i].nAtChargeRevrs == 0 &&*/ !at2[iat].num_H)
  ------------------
  |  Branch (5232:59): [True: 436, False: 0]
  ------------------
 5233|    436|            {
 5234|    436|                if (pVA[iat].cNumValenceElectrons == 6 && at2[iat].charge == -1 &&
  ------------------
  |  Branch (5234:21): [True: 257, False: 179]
  |  Branch (5234:59): [True: 118, False: 139]
  ------------------
 5235|    118|                     pBNS->edge[e].flow &&
  ------------------
  |  Branch (5235:22): [True: 118, False: 0]
  ------------------
 5236|    118|                     at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 1 &&
  ------------------
  |  Branch (5236:22): [True: 118, False: 0]
  |  Branch (5236:47): [True: 118, False: 0]
  ------------------
 5237|    118|                     pVA[iS = (int) at2[iat].neighbor[0]].cNumValenceElectrons == 6 && pVA[iS].cPeriodicRowNumber > 1 &&
  ------------------
  |  Branch (5237:22): [True: 30, False: 88]
  |  Branch (5237:88): [True: 28, False: 2]
  ------------------
 5238|     28|                     at2[iS].valence >= 4)
  ------------------
  |  Branch (5238:22): [True: 25, False: 3]
  ------------------
 5239|     25|                {
 5240|       |                    /* a candidate for S in -SO2- */
 5241|     25|                    int nNumTautSB = 0, nNumTautDB = 0, nNumOtherDB = 0, nNumOtherSB = 0; /* djb-rwth: ignoring LLVM warning: variables used */
 5242|     25|                    int nNumOthers = 0, nNumNegEndp = 0, nNumEndpO = 0;
 5243|       |                    /* check whether we have already found it */
 5244|     25|                    if (0 <= FindInEdgeList( &CentralS, iS ))
  ------------------
  |  Branch (5244:25): [True: 4, False: 21]
  ------------------
 5245|      4|                    {
 5246|      4|                        continue;
 5247|      4|                    }
 5248|    125|                    for (j = 0; j < at[iS].valence; j++)
  ------------------
  |  Branch (5248:33): [True: 104, False: 21]
  ------------------
 5249|    104|                    {
 5250|    104|                        int bond_type = at2[iS].bond_type[j];
 5251|    104|                        k = at2[iS].neighbor[j];
 5252|    104|                        if (k == iat)
  ------------------
  |  Branch (5252:29): [True: 21, False: 83]
  ------------------
 5253|     21|                        {
 5254|     21|                            continue;
 5255|     21|                        }
 5256|     83|                        if (pc2i->c2at[i].endptRevrs == at_Mobile_H_Revrs[k].endpoint && !at2[k].endpoint)
  ------------------
  |  Branch (5256:29): [True: 42, False: 41]
  |  Branch (5256:90): [True: 42, False: 0]
  ------------------
 5257|     42|                        {
 5258|     42|                            nNumTautSB += ( bond_type == BOND_TYPE_SINGLE );
  ------------------
  |  |   32|     42|#define BOND_TYPE_SINGLE    1
  ------------------
 5259|     42|                            nNumTautDB += ( bond_type == BOND_TYPE_DOUBLE );
  ------------------
  |  |   33|     42|#define BOND_TYPE_DOUBLE    2
  ------------------
 5260|     42|                            nNumEndpO += ( pVA[k].cNumValenceElectrons == 6 && at2[k].valence == 1 );
  ------------------
  |  Branch (5260:44): [True: 32, False: 10]
  |  Branch (5260:80): [True: 32, False: 0]
  ------------------
 5261|     42|                        }
 5262|     41|                        else
 5263|     41|                        {
 5264|     41|                            if (bond_type == BOND_TYPE_DOUBLE)
  ------------------
  |  |   33|     41|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (5264:33): [True: 8, False: 33]
  ------------------
 5265|      8|                            {
 5266|      8|                                nNumOtherDB++;
 5267|      8|                            }
 5268|     33|                            else
 5269|     33|                            {
 5270|     33|                                if (bond_type == BOND_TYPE_SINGLE)
  ------------------
  |  |   32|     33|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (5270:37): [True: 32, False: 1]
  ------------------
 5271|     32|                                {
 5272|     32|                                    nNumOtherSB++;
 5273|     32|                                }
 5274|      1|                                else
 5275|      1|                                {
 5276|      1|                                    nNumOthers++;
 5277|      1|                                }
 5278|     33|                            }
 5279|     41|                        }
 5280|     83|                        if (at2[k].endpoint == at2[i].endpoint && at2[k].valence == 1 &&
  ------------------
  |  Branch (5280:29): [True: 83, False: 0]
  |  Branch (5280:67): [True: 51, False: 32]
  ------------------
 5281|     51|                             at2[k].charge == -1 && pVA[k].cNumValenceElectrons == 6)
  ------------------
  |  Branch (5281:30): [True: 24, False: 27]
  |  Branch (5281:53): [True: 21, False: 3]
  ------------------
 5282|     21|                        {
 5283|     21|                            nNumNegEndp++;
 5284|     21|                        }
 5285|     83|                    }
 5286|     21|                    if (!nNumEndpO)
  ------------------
  |  Branch (5286:25): [True: 1, False: 20]
  ------------------
 5287|      1|                    {
 5288|      1|                        continue;
 5289|      1|                    }
 5290|     20|                    if (nNumTautSB + nNumTautDB + nNumOtherDB <= nNumEndpO)
  ------------------
  |  Branch (5290:25): [True: 9, False: 11]
  ------------------
 5291|      9|                    {
 5292|      9|                        continue; /* ignore */
 5293|      9|                    }
 5294|       |                    /* collect double bond taut =O */
 5295|     63|                    for (j = 0; j < at[iS].valence; j++)
  ------------------
  |  Branch (5295:33): [True: 52, False: 11]
  ------------------
 5296|     52|                    {
 5297|     52|                        int bond_type = at2[iS].bond_type[j];
 5298|     52|                        k = at2[iS].neighbor[j];
 5299|     52|                        if (pc2i->c2at[i].endptRevrs == at_Mobile_H_Revrs[k].endpoint &&
  ------------------
  |  Branch (5299:29): [True: 33, False: 19]
  ------------------
 5300|     33|                             !at2[k].endpoint && pVA[k].cNumValenceElectrons == 6 && at2[k].valence == 1 &&
  ------------------
  |  Branch (5300:30): [True: 33, False: 0]
  |  Branch (5300:50): [True: 25, False: 8]
  |  Branch (5300:86): [True: 25, False: 0]
  ------------------
 5301|     25|                             0 <= ( e = pVA[k].nCMinusGroupEdge - 1 ) && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (5301:30): [True: 20, False: 5]
  |  Branch (5301:74): [True: 20, False: 0]
  ------------------
 5302|     20|                        {
 5303|     20|                            if (bond_type == BOND_TYPE_DOUBLE && !at2[k].charge && !pBNS->edge[e].flow)
  ------------------
  |  |   33|     40|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (5303:33): [True: 5, False: 15]
  |  Branch (5303:66): [True: 5, False: 0]
  |  Branch (5303:84): [True: 5, False: 0]
  ------------------
 5304|      5|                            {
 5305|       |                                /* charges to be unchanged */
 5306|      5|                                if ((ret = AddToEdgeList( &OtherSO, e, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|      5|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5306:37): [True: 0, False: 5]
  ------------------
 5307|      0|                                {
 5308|      0|                                    goto exit_case_21a;
 5309|      0|                                }
 5310|      5|                            }
 5311|     15|                            else
 5312|     15|                            {
 5313|     15|                                if (bond_type == BOND_TYPE_SINGLE && at2[k].charge == -1 && pBNS->edge[e].flow)
  ------------------
  |  |   32|     30|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (5313:37): [True: 15, False: 0]
  |  Branch (5313:70): [True: 15, False: 0]
  |  Branch (5313:93): [True: 15, False: 0]
  ------------------
 5314|     15|                                {
 5315|       |                                    /* charges to be removed */
 5316|     15|                                    if ((ret = AddToEdgeList( &SOMinus, e, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|     15|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5316:41): [True: 0, False: 15]
  ------------------
 5317|      0|                                    {
 5318|      0|                                        goto exit_case_21a;
 5319|      0|                                    }
 5320|     15|                                }
 5321|     15|                            }
 5322|     20|                        }
 5323|     52|                    }
 5324|     11|                    if ((ret = AddToEdgeList( &CentralS, iS, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|     11|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5324:25): [True: 0, False: 11]
  ------------------
 5325|      0|                    {
 5326|      0|                        goto exit_case_21a;
 5327|      0|                    }
 5328|     11|                }
 5329|    411|                else
 5330|    411|                    if (at2[iat].charge == 0 && !pBNS->edge[e].flow &&
  ------------------
  |  Branch (5330:25): [True: 291, False: 120]
  |  Branch (5330:49): [True: 291, False: 0]
  ------------------
 5331|    291|                         at2[iat].valence + 1 == at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (5331:26): [True: 291, False: 0]
  ------------------
 5332|    291|                    {
 5333|       |                        /* changeable charges */
 5334|    291|                        if ((ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|    291|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5334:29): [True: 0, False: 291]
  ------------------
 5335|      0|                        {
 5336|      0|                            goto exit_function;
 5337|      0|                        }
 5338|    291|                    }
 5339|    436|            }
 5340|    870|        }
 5341|       |        /* remove unchangeable from changeable */
 5342|    238|        for (i = 0; i < OtherSO.num_edges; i++)
  ------------------
  |  Branch (5342:21): [True: 5, False: 233]
  ------------------
 5343|      5|        {
 5344|      5|            RemoveFromEdgeListByValue( &CurrEdges, OtherSO.pnEdges[i] );
 5345|      5|        }
 5346|       |
 5347|    233|        if ((num_try = inchi_min( SOMinus.num_edges, CurrEdges.num_edges ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|    233|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 169, False: 64]
  |  |  ------------------
  ------------------
  |  Branch (5347:13): [True: 2, False: 231]
  ------------------
 5348|      2|        {
 5349|       |            /* detected; attempt to fix */
 5350|      2|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 5351|      2|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 5352|      2|            delta = 1;
 5353|      4|            for (i = 0; i < SOMinus.num_edges && cur_success < num_try; i++)
  ------------------
  |  Branch (5353:25): [True: 2, False: 2]
  |  Branch (5353:50): [True: 2, False: 0]
  ------------------
 5354|      2|            {
 5355|      2|                pe = pBNS->edge + SOMinus.pnEdges[i];
 5356|      2|                if (!pe->flow)
  ------------------
  |  Branch (5356:21): [True: 0, False: 2]
  ------------------
 5357|      0|                    continue;
 5358|      2|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 5359|      2|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 5360|       |
 5361|       |                /*pe->forbidden |= forbidden_edge_mask;*/
 5362|      2|                pe->flow -= delta;
 5363|      2|                pv1->st_edge.flow -= delta;
 5364|      2|                pv2->st_edge.flow -= delta;
 5365|      2|                pBNS->tot_st_flow -= 2 * delta;
 5366|       |
 5367|      2|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 5368|      2|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 5369|       |
 5370|      2|                if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (5370:21): [True: 2, False: 0]
  |  Branch (5370:36): [True: 0, False: 2]
  |  Branch (5370:54): [True: 0, False: 0]
  ------------------
 5371|      2|                                  (vPathEnd == v2 && vPathStart == v1) ) && nDeltaCharge == 1) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (5371:36): [True: 2, False: 0]
  |  Branch (5371:54): [True: 2, False: 0]
  |  Branch (5371:77): [True: 2, False: 0]
  ------------------
 5372|      2|                {
 5373|       |                    /* Added (-) charge to =O => nDeltaCharge == 1 */
 5374|       |                    /* Flow change on pe (-)charge edge (atom -N(-)-) is not known to RunBnsTestOnce()) */
 5375|      2|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 5376|      2|                    if (ret > 0)
  ------------------
  |  Branch (5376:25): [True: 2, False: 0]
  ------------------
 5377|      2|                    {
 5378|      2|                        nNumRunBNS++;
 5379|      2|                        cur_success++; /* 21a */
 5380|      2|                    }
 5381|      2|                }
 5382|      0|                else
 5383|      0|                {
 5384|      0|                    pe->flow += delta;
 5385|      0|                    pv1->st_edge.flow += delta;
 5386|      0|                    pv2->st_edge.flow += delta;
 5387|      0|                    pBNS->tot_st_flow += 2 * delta;
 5388|      0|                }
 5389|      2|                INCHI_HEAPCHK
 5390|      2|            }
 5391|      2|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 5392|      2|        }
 5393|    233|    exit_case_21a:
 5394|    233|        CurrEdges.num_edges = 0; /* clear current edge list */
 5395|    233|        AllocEdgeList( &OtherSO, EDGE_LIST_FREE );
  ------------------
  |  |  243|    233|#define EDGE_LIST_FREE   (-2)
  ------------------
 5396|    233|        AllocEdgeList( &CentralS, EDGE_LIST_FREE );
  ------------------
  |  |  243|    233|#define EDGE_LIST_FREE   (-2)
  ------------------
 5397|    233|        AllocEdgeList( &SOMinus, EDGE_LIST_FREE );
  ------------------
  |  |  243|    233|#define EDGE_LIST_FREE   (-2)
  ------------------
 5398|    233|        AllocEdgeList( &MinusAcceptord, EDGE_LIST_FREE );
  ------------------
  |  |  243|    233|#define EDGE_LIST_FREE   (-2)
  ------------------
 5399|    233|        if (cur_success)
  ------------------
  |  Branch (5399:13): [True: 2, False: 231]
  ------------------
 5400|      2|        {
 5401|      2|            tot_succes += cur_success;
 5402|       |            /* recalculate InChI from the structure */
 5403|      2|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (5403:17): [True: 0, False: 2]
  ------------------
 5404|      2|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 5405|      0|            {
 5406|      0|                goto exit_function;
 5407|      0|            }
 5408|      2|            if ((ret = FillOutExtraFixedHDataRestr( pStruct ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (5408:17): [True: 0, False: 2]
  ------------------
 5409|      0|            {
 5410|      0|                goto exit_function;
 5411|      0|            }
 5412|      2|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (5412:17): [True: 0, False: 2]
  |  Branch (5412:45): [True: 0, False: 0]
  ------------------
 5413|      0|            {
 5414|      0|                goto exit_function;  /* no fixed-H found */
 5415|      0|            }
 5416|      2|            if ((ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (5416:17): [True: 0, False: 2]
  ------------------
 5417|      0|            {
 5418|      0|                goto exit_function;
 5419|      0|            }
 5420|      2|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (5420:17): [True: 0, False: 2]
  ------------------
 5421|      0|            {
 5422|      0|                goto exit_function; /* nothing to do */
 5423|      0|            }
 5424|      2|        }
 5425|    233|    }
 5426|       |
 5427|  1.12k|    if (pc2i->len_c2at)
  ------------------
  |  Branch (5427:9): [True: 1.12k, False: 4]
  ------------------
 5428|  1.12k|    {
 5429|       |        /*------------------------------------------------------------------*/
 5430|       |        /* case 22: restored: N(-)=N(+)=C...=O orig: N#N-N=...-O(-)         */
 5431|       |        /*     im InChI        -O(-) may have H(+) added by Normalization   */
 5432|       |        /*                           or may be tautomeric                   */
 5433|       |        /* Solution: move (-) from N(-) to =O                               */
 5434|       |        /*                                                                  */
 5435|       |        /*------------------------------------------------------------------*/
 5436|  1.12k|        int num_DB_O = 0, iat;
 5437|  1.12k|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 5438|  1.12k|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (5438:41): [True: 573, False: 550]
  ------------------
 5439|  1.12k|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (5439:41): [True: 573, False: 0]
  ------------------
 5440|  1.12k|        int iN2, iC;
 5441|  1.12k|        BNS_EDGE *peDB_O_Minus;
 5442|       |        /*
 5443|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 5444|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 5445|       |        */
 5446|  1.12k|        CurrEdges.num_edges = 0; /* clear current edge list */
 5447|  1.12k|        cur_success = 0;
 5448|       |
 5449|  4.63k|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (5449:21): [True: 3.50k, False: 1.12k]
  ------------------
 5450|  3.50k|        {
 5451|  3.50k|            iat = pc2i->c2at[i].atomNumber;
 5452|  3.50k|            if ( /* orig. InChI info: =O    */
 5453|  3.50k|                num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  7.01k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (5453:17): [True: 3.50k, False: 0]
  ------------------
 5454|  3.50k|                pc2i->c2at[i].nValElectr == 6 /* O, S, Se, Te */ &&
  ------------------
  |  Branch (5454:17): [True: 1.76k, False: 1.74k]
  ------------------
 5455|  1.76k|                (pc2i->c2at[i].endptInChI || pc2i->c2at[i].nMobHInChI) &&
  ------------------
  |  Branch (5455:18): [True: 715, False: 1.04k]
  |  Branch (5455:46): [True: 79, False: 969]
  ------------------
 5456|    794|                (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (5456:17): [True: 567, False: 227]
  |  Branch (5456:61): [True: 567, False: 0]
  ------------------
 5457|    567|                pc2i->c2at[i].nFixHInChI == 0 && /*pc2i->c2at[i].nMobHInChI ==  1 &&*/
  ------------------
  |  Branch (5457:17): [True: 530, False: 37]
  ------------------
 5458|       |                /* reversed structure info: */
 5459|    530|                !(pc2i->c2at[i].endptRevrs || pc2i->c2at[i].nMobHRevrs) &&
  ------------------
  |  Branch (5459:19): [True: 0, False: 530]
  |  Branch (5459:47): [True: 18, False: 512]
  ------------------
 5460|    512|                pc2i->c2at[i].nFixHRevrs == 0 &&
  ------------------
  |  Branch (5460:17): [True: 512, False: 0]
  ------------------
 5461|    512|                pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (5461:17): [True: 352, False: 160]
  |  Branch (5461:54): [True: 352, False: 0]
  ------------------
 5462|    352|                at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 2)
  ------------------
  |  Branch (5462:17): [True: 349, False: 3]
  |  Branch (5462:42): [True: 324, False: 25]
  ------------------
 5463|    324|            {
 5464|    324|                iat_DB_O[num_DB_O++] = iat;
 5465|    324|            }
 5466|  3.50k|        }
 5467|  2.84k|        for (i = 0; num_DB_O && i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (5467:21): [True: 1.93k, False: 905]
  |  Branch (5467:33): [True: 1.71k, False: 218]
  ------------------
 5468|  1.71k|        {
 5469|       |            /* i = canonical number - 1 */
 5470|  1.71k|            iat = nCanon2AtnoRevrs[i];
 5471|  1.71k|            if ( /* in restored atom O: charge=-1, no H, has no double bond, endpoint */
 5472|  1.71k|                at2[iat].charge == -1 && !at2[iat].num_H &&
  ------------------
  |  Branch (5472:17): [True: 294, False: 1.42k]
  |  Branch (5472:42): [True: 282, False: 12]
  ------------------
 5473|    282|                at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 2 && !pVA[iat].cMetal &&
  ------------------
  |  Branch (5473:17): [True: 186, False: 96]
  |  Branch (5473:42): [True: 36, False: 150]
  |  Branch (5473:78): [True: 36, False: 0]
  ------------------
 5474|     36|                pVA[iat].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5474:17): [True: 35, False: 1]
  ------------------
 5475|     35|                (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (5475:17): [True: 35, False: 0]
  |  Branch (5475:61): [True: 35, False: 0]
  ------------------
 5476|     35|                pBNS->edge[e].flow &&
  ------------------
  |  Branch (5476:17): [True: 35, False: 0]
  ------------------
 5477|     35|                !(at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint) &&
  ------------------
  |  Branch (5477:19): [True: 9, False: 26]
  |  Branch (5477:40): [True: 3, False: 6]
  ------------------
 5478|     32|                pVA[iN2 = at2[iat].neighbor[0]].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5478:17): [True: 23, False: 9]
  ------------------
 5479|     23|                at2[iat].bond_type[0] == BOND_TYPE_DOUBLE &&
  ------------------
  |  |   33|  1.74k|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (5479:17): [True: 23, False: 0]
  ------------------
 5480|     23|                at2[iN2].charge == 1 && at2[iN2].valence == 2 && at2[iN2].chem_bonds_valence == 4 &&
  ------------------
  |  Branch (5480:17): [True: 13, False: 10]
  |  Branch (5480:41): [True: 3, False: 10]
  |  Branch (5480:66): [True: 3, False: 0]
  ------------------
 5481|      3|                pVA[iC = at2[iN2].neighbor[at2[iN2].neighbor[0] == iN2]].cNumValenceElectrons == 4) /* djb-rwth: ignoring LLVM warning: variable used */
  ------------------
  |  Branch (5481:17): [True: 0, False: 3]
  ------------------
 5482|      0|            {
 5483|       |
 5484|      0|                if ((ret = AddToEdgeList(&CurrEdges, e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5484:21): [True: 0, False: 0]
  ------------------
 5485|      0|                {
 5486|      0|                    goto exit_function;
 5487|      0|                }
 5488|      0|            }
 5489|  1.71k|        }
 5490|  1.12k|        if ((num_try = inchi_min(CurrEdges.num_edges, num_DB_O))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  139|  1.12k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 218, False: 905]
  |  |  ------------------
  ------------------
  |  Branch (5490:13): [True: 0, False: 1.12k]
  ------------------
 5491|      0|        {
 5492|       |            /* detected; attempt to fix */
 5493|      0|            SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 5494|      0|            RemoveForbiddenEdgeMask(pBNS, &CurrEdges, forbidden_edge_mask);
 5495|      0|            delta = 1;
 5496|      0|            for (i = 0; i < num_DB_O && cur_success < num_try; i++)
  ------------------
  |  Branch (5496:25): [True: 0, False: 0]
  |  Branch (5496:41): [True: 0, False: 0]
  ------------------
 5497|      0|            {
 5498|      0|                iat = iat_DB_O[i];
 5499|       |
 5500|      0|                peDB_O_Minus = pBNS->edge + ((long long)pVA[iat].nCMinusGroupEdge - 1); /* djb-rwth: cast operator added */
 5501|      0|                pe = pBNS->edge + pBNS->vert[iat].iedge[0];
 5502|      0|                if (!pe->flow)
  ------------------
  |  Branch (5502:21): [True: 0, False: 0]
  ------------------
 5503|      0|                    continue;
 5504|      0|                pv1 = pBNS->vert + (v1 = pe->neighbor1);
 5505|      0|                pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
 5506|       |
 5507|      0|                pe->forbidden |= forbidden_edge_mask;
 5508|      0|                peDB_O_Minus->forbidden &= forbidden_edge_mask_inv;
 5509|       |
 5510|      0|                pe->flow -= delta;
 5511|      0|                pv1->st_edge.flow -= delta;
 5512|      0|                pv2->st_edge.flow -= delta;
 5513|      0|                pBNS->tot_st_flow -= 2 * delta;
 5514|       |
 5515|      0|                ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 5516|      0|                    &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 5517|       |
 5518|      0|                if (ret == 1 && ((vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (5518:21): [True: 0, False: 0]
  |  Branch (5518:35): [True: 0, False: 0]
  |  Branch (5518:53): [True: 0, False: 0]
  ------------------
 5519|      0|                    (vPathEnd == v2 && vPathStart == v1)) && nDeltaCharge == 0) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (5519:22): [True: 0, False: 0]
  |  Branch (5519:40): [True: 0, False: 0]
  |  Branch (5519:62): [True: 0, False: 0]
  ------------------
 5520|      0|                {
 5521|       |                    /* Added (-) charge to =O and removed from =N(-) => nDeltaCharge == 0 */
 5522|      0|                    ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
 5523|      0|                    if (ret > 0)
  ------------------
  |  Branch (5523:25): [True: 0, False: 0]
  ------------------
 5524|      0|                    {
 5525|      0|                        nNumRunBNS++;
 5526|      0|                        cur_success++; /* 22 */
 5527|      0|                    }
 5528|      0|                }
 5529|      0|                else
 5530|      0|                {
 5531|      0|                    pe->flow += delta;
 5532|      0|                    pv1->st_edge.flow += delta;
 5533|      0|                    pv2->st_edge.flow += delta;
 5534|      0|                    pBNS->tot_st_flow += 2 * delta;
 5535|      0|                }
 5536|      0|                INCHI_HEAPCHK
 5537|      0|                    pe->forbidden &= forbidden_edge_mask_inv;
 5538|      0|                peDB_O_Minus->forbidden |= forbidden_edge_mask;
 5539|      0|            }
 5540|      0|            RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 5541|      0|        }
 5542|  1.12k|        CurrEdges.num_edges = 0; /* clear current edge list */
 5543|  1.12k|        if (cur_success)
  ------------------
  |  Branch (5543:13): [True: 0, False: 1.12k]
  ------------------
 5544|      0|        {
 5545|      0|            tot_succes += cur_success;
 5546|       |            /* recalculate InChI from the structure */
 5547|      0|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (5547:17): [True: 0, False: 0]
  ------------------
 5548|      0|                ppt_group_info, ppat_norm, ppat_prep)))
 5549|      0|            {
 5550|      0|                goto exit_function;
 5551|      0|            }
 5552|      0|            if ((ret = FillOutExtraFixedHDataRestr(pStruct))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (5552:17): [True: 0, False: 0]
  ------------------
 5553|      0|            {
 5554|      0|                goto exit_function;
 5555|      0|            }
 5556|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (5556:17): [True: 0, False: 0]
  |  Branch (5556:45): [True: 0, False: 0]
  ------------------
 5557|      0|            {
 5558|      0|                goto exit_function;  /* no fixed-H found */
 5559|      0|            }
 5560|      0|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (5560:17): [True: 0, False: 0]
  ------------------
 5561|      0|            {
 5562|      0|                goto exit_function;
 5563|      0|            }
 5564|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (5564:17): [True: 0, False: 0]
  ------------------
 5565|      0|            {
 5566|      0|                goto exit_function; /* nothing to do */
 5567|      0|            }
 5568|      0|        }
 5569|  1.12k|    }
 5570|       |
 5571|  1.12k|    if (pc2i->len_c2at && pc2i->nNumTgInChI == 1)
  ------------------
  |  Branch (5571:9): [True: 1.12k, False: 4]
  |  Branch (5571:27): [True: 729, False: 394]
  ------------------
 5572|    729|    {
 5573|       |        /*------------------------------------------------------------------*/
 5574|       |        /* case 23: -NO2 are to be tautomeric but they are not AND          */
 5575|       |        /*          InChI has a SINGLE tautomeric group                     */
 5576|       |        /*                                                                  */
 5577|       |        /*                   (-)O                   (-)O                    */
 5578|       |        /* Solution: convert     \                      \                   */
 5579|       |        /*                        N-X=...-Z(-)   =>      N(+)=X- ...=Z      */
 5580|       |        /*                      //                      /                   */
 5581|       |        /*                     O                    (-)O                    */
 5582|       |        /*                                                                  */
 5583|       |        /*                     O                       O                    */
 5584|       |        /*        or            \\                      \\                  */
 5585|       |        /*                        N-X=...-Z(-)    =>      N=X-  ...=Z       */
 5586|       |        /*                      //                       /                  */
 5587|       |        /*                     O                     (-)O                   */
 5588|       |        /*                                                                  */
 5589|       |        /*                                                                  */
 5590|       |        /*  (a) move (-) from other tautomeric atom to O in O=N-X           */
 5591|       |        /*          or   from other atom that has to be tautomeric          */
 5592|       |        /*               but is not                                         */
 5593|       |        /*  (b) create (+) [ion pair creation] on N as in                   */
 5594|       |        /*                                                                  */
 5595|       |        /*       OH             OH                                          */
 5596|       |        /*      /              /                                            */
 5597|       |        /*  -C=N     =>  =C-N(+)                                            */
 5598|       |        /*     \\             \\                                            */
 5599|       |        /*       O              O                                           */
 5600|       |        /*                                                                  */
 5601|       |        /*------------------------------------------------------------------*/
 5602|    729|        int num_DB_O = 0, iat;
 5603|    729|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 5604|    729|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (5604:41): [True: 303, False: 426]
  ------------------
 5605|    729|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (5605:41): [True: 303, False: 0]
  ------------------
 5606|       |        /*
 5607|       |        inp_ATOM *atfMobile_H_Revrs = (pStruct->pOne_norm_data[1] &&
 5608|       |        pStruct->pOne_norm_data[1]->at_fixed_bonds)?
 5609|       |        pStruct->pOne_norm_data[1]->at_fixed_bonds : NULL;
 5610|       |        */
 5611|    729|        S_CHAR   *num_Fixed_H_Revrs = pStruct->pOneINChI[0]->nNum_H_fixed ? pStruct->pOneINChI[0]->nNum_H_fixed : NULL;
  ------------------
  |  Branch (5611:39): [True: 729, False: 0]
  ------------------
 5612|    729|        S_CHAR   *pnMobHRevrs = ( pStruct->pOneINChI[1] && pStruct->pOneINChI[1]->nNum_H ) ?
  ------------------
  |  Branch (5612:35): [True: 303, False: 426]
  |  Branch (5612:60): [True: 303, False: 0]
  ------------------
 5613|    303|            pStruct->pOneINChI[1]->nNum_H :
 5614|    729|            ( pStruct->pOneINChI[0] && pStruct->pOneINChI[0]->nNum_H ) ?
  ------------------
  |  Branch (5614:15): [True: 426, False: 0]
  |  Branch (5614:40): [True: 426, False: 0]
  ------------------
 5615|    426|            pStruct->pOneINChI[0]->nNum_H : NULL;
 5616|    729|        int iN, one_success;
 5617|    729|        BNS_EDGE *peDB_O_Minus;
 5618|    729|        int neigh, nNumO, nNumOthers;
 5619|    729|#define CHG_SET_NOOH         0
 5620|    729|#define CHG_SET_WRONG_TAUT   1
 5621|    729|#define CHG_SET_TAUT         2
 5622|    729|#define CHG_LAST_SET         2 /* the last index in trying */
 5623|    729|#define CHG_SET_O_FIXED      3
 5624|    729|#define CHG_SET_NUM          4
 5625|    729|        EDGE_LIST ChangeableEdges[CHG_SET_NUM];
 5626|    729|        memset( ChangeableEdges, 0, sizeof( ChangeableEdges ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5627|       |        /* equivalent to AllocEdgeList( &EdgeList, EDGE_LIST_CLEAR ); */
 5628|       |        /*
 5629|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 5630|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 5631|       |        */
 5632|    729|        CurrEdges.num_edges = 0; /* clear current edge list */
 5633|    729|        cur_success = 0;
 5634|       |
 5635|  3.03k|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (5635:21): [True: 2.30k, False: 729]
  ------------------
 5636|  2.30k|        {
 5637|  2.30k|            iat = pc2i->c2at[i].atomNumber;
 5638|  2.30k|            if ( /* orig. InChI info: taut in orig. InChI =O located in -NO2 that is not taut in Reconstructed InChI */
 5639|  2.30k|                num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  456|  4.61k|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (5639:17): [True: 2.30k, False: 0]
  ------------------
 5640|  2.30k|                pc2i->c2at[i].nValElectr == 6 /* O, S, Se, Te */ &&
  ------------------
  |  Branch (5640:17): [True: 1.26k, False: 1.04k]
  ------------------
 5641|  1.26k|                (pc2i->c2at[i].endptInChI /*|| pc2i->c2at[i].nMobHInChI*/) &&
  ------------------
  |  Branch (5641:17): [True: 695, False: 566]
  ------------------
 5642|    695|                (e = pVA[iat].nCMinusGroupEdge - 1) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (5642:17): [True: 523, False: 172]
  |  Branch (5642:61): [True: 523, False: 0]
  ------------------
 5643|    523|                pc2i->c2at[i].nFixHInChI == 0 && /*pc2i->c2at[i].nMobHInChI ==  1 &&*/
  ------------------
  |  Branch (5643:17): [True: 517, False: 6]
  ------------------
 5644|       |                /* reversed structure info: */
 5645|    517|                !(pc2i->c2at[i].endptRevrs /*|| pc2i->c2at[i].nMobHRevrs*/) &&
  ------------------
  |  Branch (5645:17): [True: 517, False: 0]
  ------------------
 5646|    517|                pc2i->c2at[i].nFixHRevrs == 0 &&
  ------------------
  |  Branch (5646:17): [True: 499, False: 18]
  ------------------
 5647|    499|                pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (5647:17): [True: 339, False: 160]
  |  Branch (5647:54): [True: 339, False: 0]
  ------------------
 5648|    339|                at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 2 &&
  ------------------
  |  Branch (5648:17): [True: 336, False: 3]
  |  Branch (5648:42): [True: 311, False: 25]
  ------------------
 5649|       |                /* find whether it belongs to NO2 */
 5650|    311|                pVA[iN = at2[iat].neighbor[0]].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5650:17): [True: 257, False: 54]
  ------------------
 5651|    257|                at2[iN].valence == 3 && (at2[iN].charge == 0 || at2[iN].charge == 1) &&
  ------------------
  |  Branch (5651:17): [True: 223, False: 34]
  |  Branch (5651:42): [True: 103, False: 120]
  |  Branch (5651:65): [True: 120, False: 0]
  ------------------
 5652|    223|                at2[iN].chem_bonds_valence == 5 - at2[iN].charge)
  ------------------
  |  Branch (5652:17): [True: 217, False: 6]
  ------------------
 5653|    217|            {
 5654|       |                /* find the second O */
 5655|    217|                nNumO = nNumOthers = 0;
 5656|    868|                for (k = 0; k < at2[iN].valence; k++)
  ------------------
  |  Branch (5656:29): [True: 651, False: 217]
  ------------------
 5657|    651|                {
 5658|    651|                    neigh = at2[iN].neighbor[k];
 5659|    651|                    if (neigh == iat)
  ------------------
  |  Branch (5659:25): [True: 217, False: 434]
  ------------------
 5660|    217|                    {
 5661|    217|                        continue;
 5662|    217|                    }
 5663|    434|                    if (pVA[neigh].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (5663:25): [True: 205, False: 229]
  ------------------
 5664|    205|                        pStruct->endpoint[neigh] &&
  ------------------
  |  Branch (5664:25): [True: 167, False: 38]
  ------------------
 5665|    167|                        !(at_Mobile_H_Revrs && at_Mobile_H_Revrs[neigh].endpoint) &&
  ------------------
  |  Branch (5665:27): [True: 30, False: 137]
  |  Branch (5665:48): [True: 0, False: 30]
  ------------------
 5666|    167|                        at2[neigh].valence == 1 && at2[neigh].num_H == 0 &&
  ------------------
  |  Branch (5666:25): [True: 139, False: 28]
  |  Branch (5666:52): [True: 139, False: 0]
  ------------------
 5667|    139|                        at2[neigh].radical == 0 && (at2[neigh].charge == 0 || at2[neigh].charge == -1) &&
  ------------------
  |  Branch (5667:25): [True: 138, False: 1]
  |  Branch (5667:53): [True: 86, False: 52]
  |  Branch (5667:79): [True: 52, False: 0]
  ------------------
 5668|    138|                        at2[neigh].chem_bonds_valence - at2[neigh].charge == 2)
  ------------------
  |  Branch (5668:25): [True: 138, False: 0]
  ------------------
 5669|    138|                    {
 5670|    138|                        nNumO++;
 5671|    138|                    }
 5672|    296|                    else
 5673|    296|                    {
 5674|    296|                        if (at2[iN].bond_type[k] == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|    592|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (5674:29): [True: 219, False: 77]
  ------------------
 5675|    219|                            at2[neigh].valence > 1 &&
  ------------------
  |  Branch (5675:29): [True: 213, False: 6]
  ------------------
 5676|    213|                            at2[neigh].valence < at2[neigh].chem_bonds_valence)
  ------------------
  |  Branch (5676:29): [True: 129, False: 84]
  ------------------
 5677|    129|                        {
 5678|    129|                            nNumOthers++;
 5679|    129|                        }
 5680|    296|                    }
 5681|    434|                }
 5682|    217|                if (nNumO != 1 || nNumOthers != 1)
  ------------------
  |  Branch (5682:21): [True: 79, False: 138]
  |  Branch (5682:35): [True: 56, False: 82]
  ------------------
 5683|    135|                {
 5684|    135|                    continue;
 5685|    135|                }
 5686|     84|                for (k = 0; k < num_DB_O; k++)
  ------------------
  |  Branch (5686:29): [True: 21, False: 63]
  ------------------
 5687|     21|                {
 5688|     21|                    if (iat_NO2[k] == iN)
  ------------------
  |  Branch (5688:25): [True: 19, False: 2]
  ------------------
 5689|     19|                    {
 5690|     19|                        break;
 5691|     19|                    }
 5692|     21|                }
 5693|     82|                if (k == num_DB_O)
  ------------------
  |  Branch (5693:21): [True: 63, False: 19]
  ------------------
 5694|     63|                {
 5695|     63|                    iat_NO2[num_DB_O] = iN;
 5696|     63|                    iat_DB_O[num_DB_O++] = iat;
 5697|     63|                }
 5698|       |                /* save the edge to avoid interference */
 5699|     82|                if ((ret = AddToEdgeList(&ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 5623|     82|#define CHG_SET_O_FIXED      3
  ------------------
                              if ((ret = AddToEdgeList(&ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|     82|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5699:21): [True: 0, False: 82]
  ------------------
 5700|      0|                {
 5701|      0|                    goto exit_case_23;
 5702|      0|                }
 5703|     82|            }
 5704|  2.30k|        }
 5705|    729|        if (num_DB_O)
  ------------------
  |  Branch (5705:13): [True: 62, False: 667]
  ------------------
 5706|     62|        {
 5707|       |            /* 1. search for =N(=O)-OH; assume =N(+)(-O(-))(-OH) does not happen */
 5708|    558|            for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (5708:25): [True: 496, False: 62]
  ------------------
 5709|    496|            {
 5710|       |                /* i = canonical number - 1 */
 5711|       |                /* find O=N(V) */
 5712|    496|                iat = nCanon2AtnoRevrs[i];
 5713|    496|                if (!pStruct->endpoint[i] || pVA[i].cNumValenceElectrons != 6 ||
  ------------------
  |  Branch (5713:21): [True: 236, False: 260]
  |  Branch (5713:46): [True: 84, False: 176]
  ------------------
 5714|    176|                    at2[iat].valence != 1 || at2[iat].charge ||
  ------------------
  |  Branch (5714:21): [True: 7, False: 169]
  |  Branch (5714:46): [True: 56, False: 113]
  ------------------
 5715|    113|                    0 > (e = pVA[iat].nCMinusGroupEdge - 1) ||
  ------------------
  |  Branch (5715:21): [True: 0, False: 113]
  ------------------
 5716|    113|                    at2[iat].num_H + at2[iat].chem_bonds_valence != 2 ||
  ------------------
  |  Branch (5716:21): [True: 7, False: 106]
  ------------------
 5717|    106|                    pVA[iN = at2[iat].neighbor[0]].cNumValenceElectrons != 5 ||
  ------------------
  |  Branch (5717:21): [True: 3, False: 103]
  ------------------
 5718|    103|                    0 > (e = pVA[iN].nCPlusGroupEdge - 1) ||
  ------------------
  |  Branch (5718:21): [True: 3, False: 100]
  ------------------
 5719|    100|                    pBNS->edge[e].forbidden || !pBNS->edge[e].flow ||
  ------------------
  |  Branch (5719:21): [True: 0, False: 100]
  |  Branch (5719:48): [True: 46, False: 54]
  ------------------
 5720|     54|                    at2[iN].charge || at2[iN].valence != 3 || at2[iN].chem_bonds_valence != 5) /* djb-rwth: ignoring LLVM warning: variable used */
  ------------------
  |  Branch (5720:21): [True: 3, False: 51]
  |  Branch (5720:39): [True: 6, False: 45]
  |  Branch (5720:63): [True: 1, False: 44]
  ------------------
 5721|    452|                {
 5722|    452|                    continue;
 5723|    452|                }
 5724|       |                /* find the second O, -OH */
 5725|     44|                nNumO = nNumOthers = 0;
 5726|    176|                for (k = 0; k < at2[iN].valence; k++)
  ------------------
  |  Branch (5726:29): [True: 132, False: 44]
  ------------------
 5727|    132|                {
 5728|    132|                    neigh = at2[iN].neighbor[k];
 5729|    132|                    if (neigh == iat)
  ------------------
  |  Branch (5729:25): [True: 44, False: 88]
  ------------------
 5730|     44|                    {
 5731|     44|                        continue;
 5732|     44|                    }
 5733|     88|                    if (pVA[neigh].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (5733:25): [True: 45, False: 43]
  ------------------
 5734|     45|                        pStruct->endpoint[neigh] &&
  ------------------
  |  Branch (5734:25): [True: 41, False: 4]
  ------------------
 5735|     41|                        at2[neigh].valence == 1 && at2[neigh].num_H == 1 &&
  ------------------
  |  Branch (5735:25): [True: 38, False: 3]
  |  Branch (5735:52): [True: 0, False: 38]
  ------------------
 5736|      0|                        at2[neigh].radical == 0 && (at2[neigh].charge == 0))
  ------------------
  |  Branch (5736:25): [True: 0, False: 0]
  |  Branch (5736:52): [True: 0, False: 0]
  ------------------
 5737|      0|                    {
 5738|      0|                        nNumO++;
 5739|      0|                    }
 5740|     88|                    else
 5741|     88|                        if (at2[iN].bond_type[k] == BOND_TYPE_DOUBLE &&
  ------------------
  |  |   33|    176|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (5741:29): [True: 44, False: 44]
  ------------------
 5742|     44|                            at2[neigh].valence >= 2 &&
  ------------------
  |  Branch (5742:29): [True: 4, False: 40]
  ------------------
 5743|      4|                            at2[neigh].valence < at2[neigh].chem_bonds_valence)
  ------------------
  |  Branch (5743:29): [True: 4, False: 0]
  ------------------
 5744|      4|                        {
 5745|      4|                            nNumOthers++;
 5746|      4|                        }
 5747|     88|                }
 5748|     44|                if (nNumO != 1 || nNumOthers != 1)
  ------------------
  |  Branch (5748:21): [True: 44, False: 0]
  |  Branch (5748:35): [True: 0, False: 0]
  ------------------
 5749|     44|                {
 5750|     44|                    continue;
 5751|     44|                }
 5752|       |                /* save edges to be changed */
 5753|      0|                if ((ret = AddToEdgeList(&ChangeableEdges[CHG_SET_NOOH], e, INC_ADD_EDGE)) ||
  ------------------
  |  | 5619|      0|#define CHG_SET_NOOH         0
  ------------------
                              if ((ret = AddToEdgeList(&ChangeableEdges[CHG_SET_NOOH], e, INC_ADD_EDGE)) ||
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5753:21): [True: 0, False: 0]
  ------------------
 5754|      0|                    (ret = AddToEdgeList(&ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE)))
  ------------------
  |  | 5623|      0|#define CHG_SET_O_FIXED      3
  ------------------
                                  (ret = AddToEdgeList(&ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE)))
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5754:21): [True: 0, False: 0]
  ------------------
 5755|      0|                {
 5756|      0|                    goto exit_case_23;
 5757|      0|                }
 5758|      0|                if (NO_VERTEX != (j = GetChargeFlowerUpperEdge(pBNS, pVA, e)) &&
  ------------------
  |  |  118|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (5758:21): [True: 0, False: 0]
  ------------------
 5759|      0|                    ((ret = AddToEdgeList(&ChangeableEdges[CHG_SET_NOOH], j, INC_ADD_EDGE)) ||
  ------------------
  |  | 5619|      0|#define CHG_SET_NOOH         0
  ------------------
                                  ((ret = AddToEdgeList(&ChangeableEdges[CHG_SET_NOOH], j, INC_ADD_EDGE)) ||
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5759:22): [True: 0, False: 0]
  ------------------
 5760|      0|                        (ret = AddToEdgeList(&ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE))))
  ------------------
  |  | 5623|      0|#define CHG_SET_O_FIXED      3
  ------------------
                                      (ret = AddToEdgeList(&ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE))))
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5760:25): [True: 0, False: 0]
  ------------------
 5761|      0|                {
 5762|      0|                    goto exit_case_23;
 5763|      0|                }
 5764|      0|            }
 5765|       |            /* 2. search for (-) atoms that are tautomeric but should not be  */
 5766|       |            /*           or that got H from Normalization but they shouldn't  */
 5767|    558|            for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (5767:25): [True: 496, False: 62]
  ------------------
 5768|    496|            { /* i = canonical number - 1 */
 5769|    496|                iat = nCanon2AtnoRevrs[i];
 5770|    496|                if (at2[iat].charge == -1 &&
  ------------------
  |  Branch (5770:21): [True: 102, False: 394]
  ------------------
 5771|    102|                    !pStruct->endpoint[i] &&
  ------------------
  |  Branch (5771:21): [True: 29, False: 73]
  ------------------
 5772|     29|                    (at_Mobile_H_Revrs &&
  ------------------
  |  Branch (5772:22): [True: 7, False: 22]
  ------------------
 5773|      7|                        (at_Mobile_H_Revrs[i].endpoint || at2[iat].num_H < at_Mobile_H_Revrs[i].num_H)))
  ------------------
  |  Branch (5773:26): [True: 3, False: 4]
  |  Branch (5773:59): [True: 4, False: 0]
  ------------------
 5774|      7|                {
 5775|       |
 5776|      7|                    if (0 <= (e = pVA[iat].nCMinusGroupEdge - 1) &&
  ------------------
  |  Branch (5776:25): [True: 7, False: 0]
  ------------------
 5777|      7|                        0 > FindInEdgeList(&ChangeableEdges[CHG_SET_O_FIXED], e) &&
  ------------------
  |  | 5623|      7|#define CHG_SET_O_FIXED      3
  ------------------
  |  Branch (5777:25): [True: 7, False: 0]
  ------------------
 5778|      7|                        !pBNS->edge[e].forbidden && pBNS->edge[e].flow &&
  ------------------
  |  Branch (5778:25): [True: 7, False: 0]
  |  Branch (5778:53): [True: 7, False: 0]
  ------------------
 5779|      7|                        (
 5780|      7|                            (ret = AddToEdgeList(&ChangeableEdges[CHG_SET_WRONG_TAUT], e, INC_ADD_EDGE)) ||
  ------------------
  |  | 5620|      7|#define CHG_SET_WRONG_TAUT   1
  ------------------
                                          (ret = AddToEdgeList(&ChangeableEdges[CHG_SET_WRONG_TAUT], e, INC_ADD_EDGE)) ||
  ------------------
  |  |   18|      7|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5780:29): [True: 0, False: 7]
  ------------------
 5781|      7|                            (ret = AddToEdgeList(&ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE))
  ------------------
  |  | 5623|      7|#define CHG_SET_O_FIXED      3
  ------------------
                                          (ret = AddToEdgeList(&ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE))
  ------------------
  |  |   18|      7|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5781:29): [True: 0, False: 7]
  ------------------
 5782|      7|                            ))
 5783|      0|                    {
 5784|      0|                        goto exit_case_23;
 5785|      0|                    }
 5786|      7|                }
 5787|    489|                else
 5788|    489|                {
 5789|       |                    /* negatively charged atom in Reconstructed structure got H(+) from Normalization */
 5790|       |                    /* and is not tautomeric; in the original structure it is tautomeric */
 5791|    489|                    if (at2[iat].charge == -1 &&
  ------------------
  |  Branch (5791:25): [True: 95, False: 394]
  ------------------
 5792|     95|                        pStruct->endpoint[i] &&
  ------------------
  |  Branch (5792:25): [True: 73, False: 22]
  ------------------
 5793|     73|                        !(at_Mobile_H_Revrs && at_Mobile_H_Revrs[i].endpoint) &&
  ------------------
  |  Branch (5793:27): [True: 19, False: 54]
  |  Branch (5793:48): [True: 5, False: 14]
  ------------------
 5794|     68|                        (num_Fixed_H_Revrs && num_Fixed_H_Revrs[i] == -1) &&
  ------------------
  |  Branch (5794:26): [True: 68, False: 0]
  |  Branch (5794:47): [True: 3, False: 65]
  ------------------
 5795|      3|                        (pnMobHRevrs && pnMobHRevrs[i] == 1) &&
  ------------------
  |  Branch (5795:26): [True: 3, False: 0]
  |  Branch (5795:41): [True: 3, False: 0]
  ------------------
 5796|      3|                        pStruct->fixed_H[i] == 0)
  ------------------
  |  Branch (5796:25): [True: 3, False: 0]
  ------------------
 5797|      3|                    {
 5798|       |
 5799|      3|                        if (0 <= (e = pVA[iat].nCMinusGroupEdge - 1) &&
  ------------------
  |  Branch (5799:29): [True: 3, False: 0]
  ------------------
 5800|      3|                            0 > FindInEdgeList(&ChangeableEdges[CHG_SET_O_FIXED], e) &&
  ------------------
  |  | 5623|      3|#define CHG_SET_O_FIXED      3
  ------------------
  |  Branch (5800:29): [True: 3, False: 0]
  ------------------
 5801|      3|                            !pBNS->edge[e].forbidden && pBNS->edge[e].flow &&
  ------------------
  |  Branch (5801:29): [True: 3, False: 0]
  |  Branch (5801:57): [True: 3, False: 0]
  ------------------
 5802|      3|                            (
 5803|      3|                                (ret = AddToEdgeList(&ChangeableEdges[CHG_SET_WRONG_TAUT], e, INC_ADD_EDGE)) ||
  ------------------
  |  | 5620|      3|#define CHG_SET_WRONG_TAUT   1
  ------------------
                                              (ret = AddToEdgeList(&ChangeableEdges[CHG_SET_WRONG_TAUT], e, INC_ADD_EDGE)) ||
  ------------------
  |  |   18|      3|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5803:33): [True: 0, False: 3]
  ------------------
 5804|      3|                                (ret = AddToEdgeList(&ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE))
  ------------------
  |  | 5623|      3|#define CHG_SET_O_FIXED      3
  ------------------
                                              (ret = AddToEdgeList(&ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE))
  ------------------
  |  |   18|      3|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5804:33): [True: 0, False: 3]
  ------------------
 5805|      3|                                ))
 5806|      0|                        {
 5807|      0|                            goto exit_case_23;
 5808|      0|                        }
 5809|      3|                    }
 5810|    489|                }
 5811|    496|            }
 5812|       |            /* 3. Search for (-) atoms that are tautomeric */
 5813|    558|            for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (5813:25): [True: 496, False: 62]
  ------------------
 5814|    496|            {
 5815|       |                /* i = canonical number - 1 */
 5816|    496|                iat = nCanon2AtnoRevrs[i];
 5817|    496|                if (pStruct->endpoint[i] &&
  ------------------
  |  Branch (5817:21): [True: 260, False: 236]
  ------------------
 5818|    260|                    (at_Mobile_H_Revrs && at_Mobile_H_Revrs[i].endpoint) &&
  ------------------
  |  Branch (5818:22): [True: 58, False: 202]
  |  Branch (5818:43): [True: 10, False: 48]
  ------------------
 5819|     10|                    at2[iat].charge == -1
  ------------------
  |  Branch (5819:21): [True: 5, False: 5]
  ------------------
 5820|    496|                    /*&& pVA[i].cNumValenceElectrons == 6*/)
 5821|      5|                {
 5822|      5|                    if (0 <= (e = pVA[iat].nCMinusGroupEdge - 1) &&
  ------------------
  |  Branch (5822:25): [True: 5, False: 0]
  ------------------
 5823|      5|                        !pBNS->edge[e].forbidden && pBNS->edge[e].flow &&
  ------------------
  |  Branch (5823:25): [True: 5, False: 0]
  |  Branch (5823:53): [True: 5, False: 0]
  ------------------
 5824|      5|                        0 > FindInEdgeList(&ChangeableEdges[CHG_SET_O_FIXED], e) &&
  ------------------
  |  | 5623|      5|#define CHG_SET_O_FIXED      3
  ------------------
  |  Branch (5824:25): [True: 5, False: 0]
  ------------------
 5825|      5|                        (ret = AddToEdgeList(&ChangeableEdges[CHG_SET_TAUT], e, INC_ADD_EDGE)))
  ------------------
  |  | 5621|      5|#define CHG_SET_TAUT         2
  ------------------
                                      (ret = AddToEdgeList(&ChangeableEdges[CHG_SET_TAUT], e, INC_ADD_EDGE)))
  ------------------
  |  |   18|      5|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5825:25): [True: 0, False: 5]
  ------------------
 5826|      0|                    {
 5827|      0|                        goto exit_case_23;
 5828|      0|                    }
 5829|      5|                }
 5830|    496|            }
 5831|       |
 5832|       |            /* ------- finally, try to move charges from O=N --------------*/
 5833|    125|            for (i = 0; i < num_DB_O; i++)
  ------------------
  |  Branch (5833:25): [True: 63, False: 62]
  ------------------
 5834|     63|            {
 5835|     63|                int nDeltaChargeExpected;
 5836|     63|                one_success = 0;
 5837|     63|                delta = 1;
 5838|     63|                iat = iat_DB_O[i];
 5839|     63|                peDB_O_Minus = pBNS->edge + ((long long)pVA[iat].nCMinusGroupEdge - 1);/* djb-rwth: cast operator added */
 5840|     63|                pe = pBNS->edge + pBNS->vert[iat].iedge[0];
 5841|       |
 5842|     63|                if (!pe->flow)
  ------------------
  |  Branch (5842:21): [True: 0, False: 63]
  ------------------
 5843|      0|                    continue;
 5844|     63|                pv1 = pBNS->vert + (v1 = pe->neighbor1);
 5845|     63|                pv2 = pBNS->vert + (v2 = pe->neighbor12 ^ v1);
 5846|       |
 5847|     63|                pe->forbidden |= forbidden_edge_mask;
 5848|       |
 5849|     63|                pe->flow -= delta;
 5850|     63|                pv1->st_edge.flow -= delta;
 5851|     63|                pv2->st_edge.flow -= delta;
 5852|     63|                pBNS->tot_st_flow -= 2 * delta;
 5853|       |
 5854|    249|                for (k = 0; !one_success && k <= CHG_LAST_SET; k++)
  ------------------
  |  | 5622|    245|#define CHG_LAST_SET         2 /* the last index in trying */
  ------------------
  |  Branch (5854:29): [True: 245, False: 4]
  |  Branch (5854:45): [True: 186, False: 59]
  ------------------
 5855|    186|                {
 5856|    186|                    if (!ChangeableEdges[k].num_edges)
  ------------------
  |  Branch (5856:25): [True: 171, False: 15]
  ------------------
 5857|    171|                    {
 5858|    171|                        continue;
 5859|    171|                    }
 5860|     15|                    nDeltaChargeExpected = (k == CHG_SET_NOOH) ? 2 : 0;
  ------------------
  |  | 5619|     15|#define CHG_SET_NOOH         0
  ------------------
  |  Branch (5860:44): [True: 0, False: 15]
  ------------------
 5861|       |
 5862|     15|                    SetForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 5863|     15|                    RemoveForbiddenEdgeMask(pBNS, &ChangeableEdges[k], forbidden_edge_mask);
 5864|       |                    /* allow (-) charge to move to N=O */
 5865|     15|                    peDB_O_Minus->forbidden &= forbidden_edge_mask_inv;
 5866|       |
 5867|     15|                    ret = RunBnsTestOnce(pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 5868|     15|                        &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms);
 5869|       |
 5870|     15|                    if (ret == 1 && ((vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (5870:25): [True: 4, False: 11]
  |  Branch (5870:39): [True: 1, False: 3]
  |  Branch (5870:57): [True: 1, False: 0]
  ------------------
 5871|      3|                        (vPathEnd == v2 && vPathStart == v1)) &&
  ------------------
  |  Branch (5871:26): [True: 3, False: 0]
  |  Branch (5871:44): [True: 3, False: 0]
  ------------------
 5872|      4|                        nDeltaCharge == nDeltaChargeExpected) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (5872:25): [True: 4, False: 0]
  ------------------
 5873|      4|                    {
 5874|       |                        /* Move (-) charge to =O and remove it an endpoint => nDeltaCharge == 0 */
 5875|      4|                        ret = RunBnsRestoreOnce(pBNS, pBD, pVA, pTCGroups);
 5876|      4|                        if (ret > 0)
  ------------------
  |  Branch (5876:29): [True: 4, False: 0]
  ------------------
 5877|      4|                        {
 5878|      4|                            nNumRunBNS++;
 5879|      4|                            one_success++; /* 23 */
 5880|      4|                        }
 5881|      4|                    }
 5882|     15|                    INCHI_HEAPCHK
 5883|     15|                }
 5884|     63|                cur_success += one_success;
 5885|       |
 5886|     63|                RemoveForbiddenEdgeMask(pBNS, &AllChargeEdges, forbidden_edge_mask);
 5887|     63|                pe->forbidden &= forbidden_edge_mask_inv;
 5888|       |
 5889|     63|                if (!one_success)
  ------------------
  |  Branch (5889:21): [True: 59, False: 4]
  ------------------
 5890|     59|                {
 5891|     59|                    pe->flow += delta;
 5892|     59|                    pv1->st_edge.flow += delta;
 5893|     59|                    pv2->st_edge.flow += delta;
 5894|     59|                    pBNS->tot_st_flow += 2 * delta;
 5895|     59|                }
 5896|     63|            }
 5897|     62|        }
 5898|    729|    exit_case_23:
 5899|  3.64k|        for (i = 0; i < CHG_SET_NUM; i++)
  ------------------
  |  | 5624|  3.64k|#define CHG_SET_NUM          4
  ------------------
  |  Branch (5899:21): [True: 2.91k, False: 729]
  ------------------
 5900|  2.91k|        {
 5901|  2.91k|            AllocEdgeList(&ChangeableEdges[i], EDGE_LIST_FREE);
  ------------------
  |  |  243|  2.91k|#define EDGE_LIST_FREE   (-2)
  ------------------
 5902|  2.91k|        }
 5903|       |
 5904|    729|        CurrEdges.num_edges = 0; /* clear current edge list */
 5905|    729|        if (cur_success)
  ------------------
  |  Branch (5905:13): [True: 4, False: 725]
  ------------------
 5906|      4|        {
 5907|      4|            tot_succes += cur_success;
 5908|       |            /* recalculate InChI from the structure */
 5909|      4|            if (0 > (ret = MakeOneInChIOutOfStrFromINChI2(pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (5909:17): [True: 0, False: 4]
  ------------------
 5910|      4|                ppt_group_info, ppat_norm, ppat_prep)))
 5911|      0|            {
 5912|      0|                goto exit_function;
 5913|      0|            }
 5914|      4|            if ((ret = FillOutExtraFixedHDataRestr(pStruct)))/* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (5914:17): [True: 0, False: 4]
  ------------------
 5915|      0|            {
 5916|      0|                goto exit_function;
 5917|      0|            }
 5918|      4|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (5918:17): [True: 3, False: 1]
  |  Branch (5918:45): [True: 0, False: 3]
  ------------------
 5919|      0|            {
 5920|      0|                goto exit_function;  /* no fixed-H found */
 5921|      0|            }
 5922|      4|            if ((ret = FillOutCMP2FHINCHI(pStruct, at2, pVA, pInChI, pc2i))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (5922:17): [True: 0, False: 4]
  ------------------
 5923|      0|            {
 5924|      0|                goto exit_function;
 5925|      0|            }
 5926|      4|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (5926:17): [True: 0, False: 4]
  ------------------
 5927|      0|            {
 5928|      0|                goto exit_function; /* nothing to do */
 5929|      0|            }
 5930|      4|        }
 5931|       |
 5932|    729|#undef CHG_SET_NOOH
 5933|    729|#undef CHG_SET_WRONG_TAUT
 5934|    729|#undef CHG_SET_TAUT
 5935|    729|#undef CHG_LAST_SET
 5936|    729|#undef CHG_SET_O_FIXED
 5937|    729|#undef CHG_SET_NUM
 5938|    729|    }
 5939|       |
 5940|  1.12k|    if (pc2i->len_c2at && pc2i->nNumTgInChI == 1)
  ------------------
  |  Branch (5940:9): [True: 1.12k, False: 4]
  |  Branch (5940:27): [True: 729, False: 394]
  ------------------
 5941|    729|    {
 5942|       |        /*------------------------------------------------------------------*/
 5943|       |        /* case 24: InChI norm. -N(-)-N(+)(IV) => -N=N(V) prevents tauto-   */
 5944|       |        /*          merism on -N(-)- in case of ADP                         */
 5945|       |        /*                                                                  */
 5946|       |        /* Solution: convert       N(V)=N-   ...=X    -> N(IV)(+)-N=...-X(-)*/
 5947|       |        /*                     N(IV)(+)-N(-)-...=X                          */
 5948|       |        /*                                                                  */
 5949|       |        /*      Orig InChI            taut      taut, 1 t-group only(ADP?)  */
 5950|       |        /*   Reconstructed struct   non-taut    possibly not taut           */
 5951|       |        /*                                                                  */
 5952|       |        /*   Details: 1a. store next to N(V) (+)edge its flower edge        */
 5953|       |        /*            1b. store next to N(-) edge NO_VERTEX                 */
 5954|       |        /*            2.  Release (-) edges of other missing endpoints or   */
 5955|       |        /*                all endpoints if no other is missing              */
 5956|       |        /*            3.  Decrement flow on (+) edge                        */
 5957|       |        /*                if flower edge is stored then expect DeltaCharge=2*/
 5958|       |        /*                otherwise DeltaCharge = 0                         */
 5959|       |        /*------------------------------------------------------------------*/
 5960|    729|        int iat;
 5961|    729|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 5962|    729|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (5962:41): [True: 300, False: 429]
  ------------------
 5963|    729|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (5963:41): [True: 300, False: 0]
  ------------------
 5964|    729|        inp_ATOM *atf = ( pStruct->pOne_norm_data[1] && pStruct->pOne_norm_data[1]->at_fixed_bonds ) ?
  ------------------
  |  Branch (5964:27): [True: 300, False: 429]
  |  Branch (5964:57): [True: 300, False: 0]
  ------------------
 5965|    729|            pStruct->pOne_norm_data[1]->at_fixed_bonds : NULL;
 5966|    729|        int iN, one_success;
 5967|    729|        EdgeIndex  ef, e1;
 5968|    729|        BNS_EDGE *pef;
 5969|    729|#define CHG_SET_MISSED_TAUT   0
 5970|    729|#define CHG_SET_OTHER_TAUT_O  1
 5971|    729|#define CHG_SET_OTHER_TAUT_N  2
 5972|    729|#define CHG_LAST_SET          2 /* the last index in trying */
 5973|    729|#define CHG_SET_NN            3
 5974|    729|#define CHG_SET_AVOID         4
 5975|    729|#define CHG_SET_NUM           5
 5976|    729|        EDGE_LIST ChangeableEdges[CHG_SET_NUM];
 5977|    729|        memset( ChangeableEdges, 0, sizeof( ChangeableEdges ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 5978|       |        /* equivalent to AllocEdgeList( &EdgeList, EDGE_LIST_CLEAR ); */
 5979|       |        /*
 5980|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 5981|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 5982|       |        */
 5983|    729|        CurrEdges.num_edges = 0; /* clear current edge list */
 5984|    729|        cur_success = 0;
 5985|  3.03k|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (5985:21): [True: 2.30k, False: 729]
  ------------------
 5986|  2.30k|        {
 5987|  2.30k|            iat = pc2i->c2at[i].atomNumber;
 5988|  2.30k|            if ( /* orig. InChI info: -N=N(V)    */
 5989|  2.30k|                 pc2i->c2at[i].nValElectr == 5 /* N or P */ &&
  ------------------
  |  Branch (5989:18): [True: 670, False: 1.63k]
  ------------------
 5990|    670|                 ( pc2i->c2at[i].endptInChI /* only N */ ) &&
  ------------------
  |  Branch (5990:18): [True: 554, False: 116]
  ------------------
 5991|    554|                 ( e1 = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e1].forbidden &&
  ------------------
  |  Branch (5991:18): [True: 400, False: 154]
  |  Branch (5991:65): [True: 400, False: 0]
  ------------------
 5992|    400|                 pc2i->c2at[i].nFixHInChI == 0 && pc2i->c2at[i].nMobHInChI == 0 &&
  ------------------
  |  Branch (5992:18): [True: 374, False: 26]
  |  Branch (5992:51): [True: 374, False: 0]
  ------------------
 5993|       |                 /* reversed structure info: */
 5994|    374|                 !pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (5994:18): [True: 374, False: 0]
  ------------------
 5995|    374|                 pc2i->c2at[i].nFixHRevrs == 0 &&
  ------------------
  |  Branch (5995:18): [True: 374, False: 0]
  ------------------
 5996|    374|                 pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (5996:18): [True: 186, False: 188]
  |  Branch (5996:55): [True: 186, False: 0]
  ------------------
 5997|    186|                 at2[iat].valence == 2 && at2[iat].chem_bonds_valence == 3 &&
  ------------------
  |  Branch (5997:18): [True: 158, False: 28]
  |  Branch (5997:43): [True: 155, False: 3]
  ------------------
 5998|       |                 /* find whether -N= has =N(V) neighbor; Note: operator comma: (A,B) returns B */
 5999|    155|                 ( iN = at2[iat].neighbor[at2[iat].bond_type[0] != BOND_TYPE_DOUBLE],
  ------------------
  |  |   33|    155|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (5999:18): [True: 104, False: 51]
  ------------------
 6000|    155|                   pVA[iN].cNumValenceElectrons == 5 ) &&
 6001|    104|                 at2[iN].chem_bonds_valence == 5 &&
  ------------------
  |  Branch (6001:18): [True: 60, False: 44]
  ------------------
 6002|     60|                 at2[iN].charge == 0 && !at2[iN].num_H && !at2[iN].radical &&
  ------------------
  |  Branch (6002:18): [True: 57, False: 3]
  |  Branch (6002:41): [True: 53, False: 4]
  |  Branch (6002:59): [True: 53, False: 0]
  ------------------
 6003|     53|                 0 <= ( e = pVA[iN].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden && pBNS->edge[e].flow &&
  ------------------
  |  Branch (6003:18): [True: 52, False: 1]
  |  Branch (6003:62): [True: 52, False: 0]
  |  Branch (6003:90): [True: 52, False: 0]
  ------------------
 6004|     52|                 0 > FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e ))
  ------------------
  |  | 5974|     52|#define CHG_SET_AVOID         4
  ------------------
  |  Branch (6004:18): [True: 50, False: 2]
  ------------------
 6005|     50|            {
 6006|       |
 6007|     50|                ef = GetChargeFlowerUpperEdge( pBNS, pVA, e ); /* == NO_VERTEX if N(V) has 4 bonds */
 6008|     50|                if (( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5973|     50|#define CHG_SET_NN            3
  ------------------
                              if (( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   18|     50|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6008:21): [True: 0, False: 50]
  ------------------
 6009|     50|                    ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], ef, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5973|     50|#define CHG_SET_NN            3
  ------------------
                                  ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], ef, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   18|     50|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6009:21): [True: 0, False: 50]
  ------------------
 6010|     50|                     ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], 1, INC_ADD_EDGE ) ) || /* expected nDeltaCharge */
  ------------------
  |  | 5973|     50|#define CHG_SET_NN            3
  ------------------
                                   ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], 1, INC_ADD_EDGE ) ) || /* expected nDeltaCharge */
  ------------------
  |  |   18|     50|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6010:22): [True: 0, False: 50]
  ------------------
 6011|     50|                     ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e1, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5974|     50|#define CHG_SET_AVOID         4
  ------------------
                                   ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e1, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   18|     50|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6011:22): [True: 0, False: 50]
  ------------------
 6012|     50|                     ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5974|     50|#define CHG_SET_AVOID         4
  ------------------
                                   ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   18|     50|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6012:22): [True: 0, False: 50]
  ------------------
 6013|     50|                     ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], ef, INC_ADD_EDGE ) ))
  ------------------
  |  | 5974|     50|#define CHG_SET_AVOID         4
  ------------------
                                   ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], ef, INC_ADD_EDGE ) ))
  ------------------
  |  |   18|     50|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6013:22): [True: 0, False: 50]
  ------------------
 6014|      0|                {
 6015|      0|                    goto exit_case_24;
 6016|      0|                }
 6017|       |                /* mark -N= so that (-) will not be moved to it */
 6018|     50|                if (0 <= ( e = pVA[iat].nCMinusGroupEdge ) && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (6018:21): [True: 50, False: 0]
  |  Branch (6018:63): [True: 49, False: 1]
  ------------------
 6019|     49|                     0 > FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e ) &&
  ------------------
  |  | 5974|     49|#define CHG_SET_AVOID         4
  ------------------
  |  Branch (6019:22): [True: 49, False: 0]
  ------------------
 6020|     49|                     ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ))
  ------------------
  |  | 5974|     49|#define CHG_SET_AVOID         4
  ------------------
                                   ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ))
  ------------------
  |  |   18|     49|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6020:22): [True: 0, False: 49]
  ------------------
 6021|      0|                {
 6022|      0|                    goto exit_case_24;
 6023|      0|                }
 6024|     50|            }
 6025|  2.25k|            else
 6026|  2.25k|            {
 6027|  2.25k|                if ( /* orig. InChI info: -N(-)N(IV)(+)    */
 6028|  2.25k|                     atf &&
  ------------------
  |  Branch (6028:22): [True: 1.02k, False: 1.23k]
  ------------------
 6029|  1.02k|                     pc2i->c2at[i].nValElectr == 5 /* N or P */ &&
  ------------------
  |  Branch (6029:22): [True: 251, False: 770]
  ------------------
 6030|    251|                     pc2i->c2at[i].endptInChI /* only N */ &&
  ------------------
  |  Branch (6030:22): [True: 209, False: 42]
  ------------------
 6031|    209|                     ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (6031:22): [True: 142, False: 67]
  |  Branch (6031:68): [True: 142, False: 0]
  ------------------
 6032|    142|                     pc2i->c2at[i].nFixHInChI == 0 && pc2i->c2at[i].nMobHInChI == 0 &&
  ------------------
  |  Branch (6032:22): [True: 127, False: 15]
  |  Branch (6032:55): [True: 127, False: 0]
  ------------------
 6033|       |                     /* reversed structure info: */
 6034|    127|                     !pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (6034:22): [True: 127, False: 0]
  ------------------
 6035|    127|                     pc2i->c2at[i].nFixHRevrs == 0 &&
  ------------------
  |  Branch (6035:22): [True: 127, False: 0]
  ------------------
 6036|    127|                     pc2i->c2at[i].nAtChargeRevrs == -1 && !at2[iat].num_H &&
  ------------------
  |  Branch (6036:22): [True: 84, False: 43]
  |  Branch (6036:60): [True: 84, False: 0]
  ------------------
 6037|     84|                     at2[iat].valence == 2 && at2[iat].chem_bonds_valence == 2 &&
  ------------------
  |  Branch (6037:22): [True: 73, False: 11]
  |  Branch (6037:47): [True: 73, False: 0]
  ------------------
 6038|     73|                     atf[iat].valence == 2 && atf[iat].chem_bonds_valence == 3 &&
  ------------------
  |  Branch (6038:22): [True: 73, False: 0]
  |  Branch (6038:47): [True: 69, False: 4]
  ------------------
 6039|       |                     /* find whether -N= has =N(V) neighbor; Note: operator comma: (A,B) returns B */
 6040|     69|                     ( iN = atf[iat].neighbor[atf[iat].bond_type[0] != BOND_TYPE_DOUBLE],
  ------------------
  |  |   33|     69|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (6040:22): [True: 68, False: 1]
  ------------------
 6041|     69|                       pVA[iN].cNumValenceElectrons == 5 ) &&
 6042|     68|                     at2[iN].charge == 1 && /* double bond neighbor */
  ------------------
  |  Branch (6042:22): [True: 66, False: 2]
  ------------------
 6043|     66|                     at2[iN].chem_bonds_valence == 4 &&
  ------------------
  |  Branch (6043:22): [True: 66, False: 0]
  ------------------
 6044|     66|                     atf[iN].charge == 0 &&
  ------------------
  |  Branch (6044:22): [True: 66, False: 0]
  ------------------
 6045|     66|                     atf[iN].chem_bonds_valence == 5 &&  /* InChI normalization created N(V)=N- out of N(IV)(+)-N(-)- */
  ------------------
  |  Branch (6045:22): [True: 64, False: 2]
  ------------------
 6046|     64|                     !at2[iN].num_H && !at2[iN].radical &&
  ------------------
  |  Branch (6046:22): [True: 64, False: 0]
  |  Branch (6046:40): [True: 64, False: 0]
  ------------------
 6047|     64|                     0 <= ( e = pVA[iat].nCMinusGroupEdge - 1 ) && !pBNS->edge[e].forbidden && pBNS->edge[e].flow &&
  ------------------
  |  Branch (6047:22): [True: 64, False: 0]
  |  Branch (6047:68): [True: 64, False: 0]
  |  Branch (6047:96): [True: 64, False: 0]
  ------------------
 6048|     64|                     0 > FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e ))
  ------------------
  |  | 5974|     64|#define CHG_SET_AVOID         4
  ------------------
  |  Branch (6048:22): [True: 64, False: 0]
  ------------------
 6049|     64|                {
 6050|       |                    /* save (-) edge */
 6051|     64|                    if (( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5973|     64|#define CHG_SET_NN            3
  ------------------
                                  if (( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   18|     64|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6051:25): [True: 0, False: 64]
  ------------------
 6052|     64|                        ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], NO_VERTEX, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5973|     64|#define CHG_SET_NN            3
  ------------------
                                      ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], NO_VERTEX, INC_ADD_EDGE ) ) ||
  ------------------
  |  |  118|     64|#define NO_VERTEX    -2
  ------------------
                                      ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], NO_VERTEX, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   18|     64|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6052:25): [True: 0, False: 64]
  ------------------
 6053|     64|                         ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], 1, INC_ADD_EDGE ) ) || /* expected nDeltaCharge */
  ------------------
  |  | 5973|     64|#define CHG_SET_NN            3
  ------------------
                                       ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], 1, INC_ADD_EDGE ) ) || /* expected nDeltaCharge */
  ------------------
  |  |   18|     64|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6053:26): [True: 0, False: 64]
  ------------------
 6054|     64|                         ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ))
  ------------------
  |  | 5974|     64|#define CHG_SET_AVOID         4
  ------------------
                                       ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ))
  ------------------
  |  |   18|     64|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6054:26): [True: 0, False: 64]
  ------------------
 6055|      0|                    {
 6056|      0|                        goto exit_case_24;
 6057|      0|                    }
 6058|     64|                }
 6059|  2.25k|            }
 6060|  2.30k|        }
 6061|    729|        if (!ChangeableEdges[CHG_SET_NN].num_edges)
  ------------------
  |  | 5973|    729|#define CHG_SET_NN            3
  ------------------
  |  Branch (6061:13): [True: 615, False: 114]
  ------------------
 6062|    615|        {
 6063|    615|            goto  exit_case_24;
 6064|    615|        }
 6065|       |        /* Collect all relevant tautomeric atoms */
 6066|  1.00k|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (6066:21): [True: 891, False: 114]
  ------------------
 6067|    891|        {
 6068|       |            /* i = canonical number - 1 */
 6069|    891|            if (!pStruct->endpoint[i])
  ------------------
  |  Branch (6069:17): [True: 515, False: 376]
  ------------------
 6070|    515|            {
 6071|    515|                continue;
 6072|    515|            }
 6073|    376|            iat = nCanon2AtnoRevrs[i];
 6074|    376|            if (at2[iat].charge || at2[iat].radical || at2[iat].valence == at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (6074:17): [True: 115, False: 261]
  |  Branch (6074:36): [True: 11, False: 250]
  |  Branch (6074:56): [True: 23, False: 227]
  ------------------
 6075|    149|            {
 6076|    149|                continue; /* cannot be an acceptor of (-) */
 6077|    149|            }
 6078|    227|            if (0 > ( e = pVA[iat].nCMinusGroupEdge - 1 ) || pBNS->edge[e].forbidden || pBNS->edge[e].flow)
  ------------------
  |  Branch (6078:17): [True: 34, False: 193]
  |  Branch (6078:62): [True: 0, False: 193]
  |  Branch (6078:89): [True: 1, False: 192]
  ------------------
 6079|     35|            {
 6080|     35|                continue;
 6081|     35|            }
 6082|    192|            if (0 <= FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e ))
  ------------------
  |  | 5974|    192|#define CHG_SET_AVOID         4
  ------------------
  |  Branch (6082:17): [True: 49, False: 143]
  ------------------
 6083|     49|            {
 6084|     49|                continue; /* has already been used */
 6085|     49|            }
 6086|       |            /* missing endpoint */
 6087|    143|            if (!( at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint ))
  ------------------
  |  Branch (6087:20): [True: 97, False: 46]
  |  Branch (6087:41): [True: 35, False: 62]
  ------------------
 6088|    108|            {
 6089|    108|                if (0 > FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e ) && (
  ------------------
  |  | 5974|    108|#define CHG_SET_AVOID         4
  ------------------
  |  Branch (6089:21): [True: 108, False: 0]
  ------------------
 6090|    108|                    ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_MISSED_TAUT], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5969|    108|#define CHG_SET_MISSED_TAUT   0
  ------------------
                                  ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_MISSED_TAUT], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   18|    108|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6090:21): [True: 0, False: 108]
  ------------------
 6091|    108|                    ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ))
  ------------------
  |  | 5974|    108|#define CHG_SET_AVOID         4
  ------------------
                                  ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ))
  ------------------
  |  |   18|    108|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6091:21): [True: 0, False: 108]
  ------------------
 6092|      0|                {
 6093|      0|                    goto exit_case_24;
 6094|      0|                }
 6095|    108|            }
 6096|     35|            else
 6097|     35|            {
 6098|       |                /* endpoint O */
 6099|     35|                if (pVA[iat].cNumValenceElectrons == 6)
  ------------------
  |  Branch (6099:21): [True: 35, False: 0]
  ------------------
 6100|     35|                {
 6101|     35|                    if (0 > FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e ) && (
  ------------------
  |  | 5974|     35|#define CHG_SET_AVOID         4
  ------------------
  |  Branch (6101:25): [True: 35, False: 0]
  ------------------
 6102|     35|                        ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_OTHER_TAUT_O], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5970|     35|#define CHG_SET_OTHER_TAUT_O  1
  ------------------
                                      ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_OTHER_TAUT_O], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   18|     35|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6102:25): [True: 0, False: 35]
  ------------------
 6103|     35|                        ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ))
  ------------------
  |  | 5974|     35|#define CHG_SET_AVOID         4
  ------------------
                                      ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ))
  ------------------
  |  |   18|     35|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6103:25): [True: 0, False: 35]
  ------------------
 6104|      0|                    {
 6105|      0|                        goto exit_case_24;
 6106|      0|                    }
 6107|     35|                }
 6108|      0|                else
 6109|      0|                {
 6110|       |                    /* endpoint N */
 6111|      0|                    if (pVA[iat].cNumValenceElectrons == 5)
  ------------------
  |  Branch (6111:25): [True: 0, False: 0]
  ------------------
 6112|      0|                    {
 6113|      0|                        if (0 > FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e ) && (
  ------------------
  |  | 5974|      0|#define CHG_SET_AVOID         4
  ------------------
  |  Branch (6113:29): [True: 0, False: 0]
  ------------------
 6114|      0|                            ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_OTHER_TAUT_N], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5971|      0|#define CHG_SET_OTHER_TAUT_N  2
  ------------------
                                          ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_OTHER_TAUT_N], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6114:29): [True: 0, False: 0]
  ------------------
 6115|      0|                            ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ))
  ------------------
  |  | 5974|      0|#define CHG_SET_AVOID         4
  ------------------
                                          ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ))
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6115:29): [True: 0, False: 0]
  ------------------
 6116|      0|                        {
 6117|      0|                            goto exit_case_24;
 6118|      0|                        }
 6119|      0|                    }
 6120|      0|                }
 6121|     35|            }
 6122|    143|        }
 6123|       |        /* ------- finally, try to move charges from -N(-)-N(+) or to N(V) --------------*/
 6124|    228|        for (i = 0; i < ChangeableEdges[CHG_SET_NN].num_edges; i += 3)
  ------------------
  |  | 5973|    228|#define CHG_SET_NN            3
  ------------------
  |  Branch (6124:21): [True: 114, False: 114]
  ------------------
 6125|    114|        {
 6126|    114|            int nDeltaChargeExpected;
 6127|    114|            one_success = 0;
 6128|    114|            delta = 1;
 6129|    114|            pe = pBNS->edge + ChangeableEdges[CHG_SET_NN].pnEdges[i];
  ------------------
  |  | 5973|    114|#define CHG_SET_NN            3
  ------------------
 6130|    114|            pef = ( NO_VERTEX != ChangeableEdges[CHG_SET_NN].pnEdges[i + 1] ) ?
  ------------------
  |  |  118|    114|#define NO_VERTEX    -2
  ------------------
                          pef = ( NO_VERTEX != ChangeableEdges[CHG_SET_NN].pnEdges[i + 1] ) ?
  ------------------
  |  | 5973|    114|#define CHG_SET_NN            3
  ------------------
  |  Branch (6130:19): [True: 36, False: 78]
  ------------------
 6131|    114|                pBNS->edge + ChangeableEdges[CHG_SET_NN].pnEdges[i + 1] : NULL;
  ------------------
  |  | 5973|     36|#define CHG_SET_NN            3
  ------------------
 6132|    114|            nDeltaChargeExpected = ChangeableEdges[CHG_SET_NN].pnEdges[i + 2];
  ------------------
  |  | 5973|    114|#define CHG_SET_NN            3
  ------------------
 6133|       |
 6134|    114|            if (!pe->flow)
  ------------------
  |  Branch (6134:17): [True: 0, False: 114]
  ------------------
 6135|      0|                continue;
 6136|    114|            pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 6137|    114|            pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 6138|       |
 6139|    114|            pe->flow -= delta;
 6140|    114|            pv1->st_edge.flow -= delta;
 6141|    114|            pv2->st_edge.flow -= delta;
 6142|    114|            pBNS->tot_st_flow -= 2 * delta;
 6143|       |
 6144|    328|            for (k = 0; !one_success && k <= CHG_LAST_SET; k++)
  ------------------
  |  | 5972|    250|#define CHG_LAST_SET          2 /* the last index in trying */
  ------------------
  |  Branch (6144:25): [True: 250, False: 78]
  |  Branch (6144:41): [True: 214, False: 36]
  ------------------
 6145|    214|            {
 6146|    214|                if (!ChangeableEdges[k].num_edges)
  ------------------
  |  Branch (6146:21): [True: 109, False: 105]
  ------------------
 6147|    109|                {
 6148|    109|                    continue;
 6149|    109|                }
 6150|    105|                SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 6151|    105|                RemoveForbiddenEdgeMask( pBNS, &ChangeableEdges[k], forbidden_edge_mask );
 6152|       |                /* allow change of N(V) flower edge */
 6153|    105|                if (pef)
  ------------------
  |  Branch (6153:21): [True: 31, False: 74]
  ------------------
 6154|     31|                {
 6155|     31|                    pef->forbidden &= forbidden_edge_mask_inv;
 6156|     31|                }
 6157|       |
 6158|    105|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 6159|    105|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 6160|       |
 6161|    105|                if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (6161:21): [True: 86, False: 19]
  |  Branch (6161:36): [True: 14, False: 72]
  |  Branch (6161:54): [True: 10, False: 4]
  ------------------
 6162|     76|                                  (vPathEnd == v2 && vPathStart == v1) ) &&
  ------------------
  |  Branch (6162:36): [True: 72, False: 4]
  |  Branch (6162:54): [True: 71, False: 1]
  ------------------
 6163|     81|                     nDeltaCharge == nDeltaChargeExpected) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (6163:22): [True: 78, False: 3]
  ------------------
 6164|     78|                {
 6165|       |                    /* Move (-) charge to =O and remove it an endpoint => nDeltaCharge == 0 */
 6166|     78|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 6167|     78|                    if (ret > 0)
  ------------------
  |  Branch (6167:25): [True: 78, False: 0]
  ------------------
 6168|     78|                    {
 6169|     78|                        nNumRunBNS++;
 6170|     78|                        one_success++; /* 24 */
 6171|     78|                    }
 6172|     78|                }
 6173|    105|                INCHI_HEAPCHK
 6174|    105|            }
 6175|    114|            cur_success += one_success;
 6176|       |
 6177|    114|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 6178|       |
 6179|    114|            if (!one_success)
  ------------------
  |  Branch (6179:17): [True: 36, False: 78]
  ------------------
 6180|     36|            {
 6181|     36|                pe->flow += delta;
 6182|     36|                pv1->st_edge.flow += delta;
 6183|     36|                pv2->st_edge.flow += delta;
 6184|     36|                pBNS->tot_st_flow += 2 * delta;
 6185|     36|            }
 6186|    114|        }
 6187|    729|    exit_case_24:
 6188|  4.37k|        for (i = 0; i < CHG_SET_NUM; i++)
  ------------------
  |  | 5975|  4.37k|#define CHG_SET_NUM           5
  ------------------
  |  Branch (6188:21): [True: 3.64k, False: 729]
  ------------------
 6189|  3.64k|        {
 6190|  3.64k|            AllocEdgeList( &ChangeableEdges[i], EDGE_LIST_FREE );
  ------------------
  |  |  243|  3.64k|#define EDGE_LIST_FREE   (-2)
  ------------------
 6191|  3.64k|        }
 6192|       |
 6193|    729|        CurrEdges.num_edges = 0; /* clear current edge list */
 6194|    729|        if (cur_success)
  ------------------
  |  Branch (6194:13): [True: 78, False: 651]
  ------------------
 6195|     78|        {
 6196|     78|            tot_succes += cur_success;
 6197|       |            /* recalculate InChI from the structure */
 6198|     78|            if (0 >( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (6198:17): [True: 0, False: 78]
  ------------------
 6199|     78|                                                           ppt_group_info, ppat_norm, ppat_prep ) ))
 6200|      0|            {
 6201|      0|                goto exit_function;
 6202|      0|            }
 6203|     78|            if ((ret = FillOutExtraFixedHDataRestr( pStruct ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (6203:17): [True: 0, False: 78]
  ------------------
 6204|      0|            {
 6205|      0|                goto exit_function;
 6206|      0|            }
 6207|     78|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (6207:17): [True: 48, False: 30]
  |  Branch (6207:45): [True: 0, False: 48]
  ------------------
 6208|      0|            {
 6209|      0|                goto exit_function;  /* no fixed-H found */
 6210|      0|            }
 6211|     78|            if ((ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (6211:17): [True: 0, False: 78]
  ------------------
 6212|      0|            {
 6213|      0|                goto exit_function;
 6214|      0|            }
 6215|     78|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (6215:17): [True: 0, False: 78]
  ------------------
 6216|      0|            {
 6217|      0|                goto exit_function; /* nothing to do */
 6218|      0|            }
 6219|     78|        }
 6220|    729|#undef CHG_SET_NN
 6221|    729|#undef CHG_SET_MISSED_TAUT
 6222|    729|#undef CHG_SET_OTHER_TAUT_O
 6223|    729|#undef CHG_SET_OTHER_TAUT_N
 6224|    729|#undef CHG_LAST_SET
 6225|    729|#undef CHG_SET_AVOID
 6226|    729|#undef CHG_SET_NUM
 6227|    729|    }
 6228|       |
 6229|       |    /* pStruct->nNumRemovedProtonsMobHInChI == pc2i->nNumRemHInChI */
 6230|       |
 6231|  1.12k|    if (pc2i->len_c2at && pc2i->nNumTgInChI == 1 &&
  ------------------
  |  Branch (6231:9): [True: 1.12k, False: 4]
  |  Branch (6231:27): [True: 729, False: 394]
  ------------------
 6232|    729|         pc2i->nNumRemHRevrs > pc2i->nNumRemHInChI && 0 > pc2i->nNumRemHInChI &&
  ------------------
  |  Branch (6232:10): [True: 16, False: 713]
  |  Branch (6232:55): [True: 0, False: 16]
  ------------------
 6233|      0|         ( pc2i->nNumEndpRevrs < pc2i->nNumEndpInChI ||
  ------------------
  |  Branch (6233:12): [True: 0, False: 0]
  ------------------
 6234|      0|           pc2i->nNumTgRevrs > pc2i->nNumTgInChI ))
  ------------------
  |  Branch (6234:12): [True: 0, False: 0]
  ------------------
 6235|      0|    {
 6236|       |        /*------------------------------------------------------------------*/
 6237|       |        /* case 25: Restored InChI does not have 2 or more added protons    */
 6238|       |        /*                         possibly taut. endpoints are missing     */
 6239|       |        /*                         has -N(-O(-))-O(-) group(s)              */
 6240|       |        /*          Original InChI has only one t-group                     */
 6241|       |        /*                                                                  */
 6242|       |        /* Solution: convert       -N(-O(-))-O(-) -> -N(+)(=O)-O(-)         */
 6243|       |        /*                         and direct 2(-) to the missing taut atoms*/
 6244|       |        /*           at first attempt try to move (-) to N only             */
 6245|       |        /*                                                                  */
 6246|       |        /*------------------------------------------------------------------*/
 6247|      0|        int iat;
 6248|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 6249|      0|        AT_NUMB  *nAtno2CanonRevrs = pStruct->nAtno2Canon[0];
 6250|      0|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (6250:41): [True: 0, False: 0]
  ------------------
 6251|      0|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (6251:41): [True: 0, False: 0]
  ------------------
 6252|       |        /*
 6253|       |        inp_ATOM *atf  = (pStruct->pOne_norm_data[1] && pStruct->pOne_norm_data[1]->at_fixed_bonds)?
 6254|       |        pStruct->pOne_norm_data[1]->at_fixed_bonds : NULL;
 6255|       |        */
 6256|      0|        int iN, neigh, one_success;
 6257|      0|        EdgeIndex  e1, bFirst;
 6258|      0|        BNS_EDGE *pef;
 6259|      0|#define CHG_SET_MISSED_TAUT_1   0
 6260|      0|#define CHG_SET_MISSED_TAUT_ALL 1
 6261|      0|#define CHG_SET_OTHER_TAUT_1    2
 6262|      0|#define CHG_SET_OTHER_TAUT_ALL  3
 6263|      0|#define CHG_LAST_SET            3 /* the last index in trying */
 6264|      0|#define CHG_SET_NO_IN_NO2M2     4
 6265|      0|#define CHG_SET_AVOID           5
 6266|      0|#define CHG_SET_NUM             6
 6267|      0|        EDGE_LIST ChangeableEdges[CHG_SET_NUM];
 6268|      0|        memset( ChangeableEdges, 0, sizeof( ChangeableEdges ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 6269|       |        /* equivalent to AllocEdgeList( &EdgeList, EDGE_LIST_CLEAR ); */
 6270|       |        /*
 6271|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 6272|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 6273|       |        */
 6274|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 6275|      0|        cur_success = 0;
 6276|       |        /* find all -N(-O(-))-O(-) */
 6277|      0|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (6277:21): [True: 0, False: 0]
  ------------------
 6278|      0|        {
 6279|      0|            iat = nCanon2AtnoRevrs[i];
 6280|      0|            if (pStruct->endpoint[i])
  ------------------
  |  Branch (6280:17): [True: 0, False: 0]
  ------------------
 6281|      0|            {
 6282|      0|                if (0 >( e = pVA[iat].nCMinusGroupEdge - 1 ) || pBNS->edge[e].forbidden ||
  ------------------
  |  Branch (6282:21): [True: 0, False: 0]
  |  Branch (6282:65): [True: 0, False: 0]
  ------------------
 6283|      0|                     0 <= FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e ))
  ------------------
  |  | 6265|      0|#define CHG_SET_AVOID           5
  ------------------
  |  Branch (6283:22): [True: 0, False: 0]
  ------------------
 6284|      0|                {
 6285|      0|                    continue;
 6286|      0|                }
 6287|      0|                bFirst = ( (pVA[iat].cNumValenceElectrons == 5 && pc2i->nNumTgInChI == 1) ||
  ------------------
  |  Branch (6287:29): [True: 0, False: 0]
  |  Branch (6287:67): [True: 0, False: 0]
  ------------------
 6288|      0|                           (pVA[iat].cNumValenceElectrons == 6 && pc2i->nNumTgInChI != 1) ); /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (6288:29): [True: 0, False: 0]
  |  Branch (6288:67): [True: 0, False: 0]
  ------------------
 6289|       |                /* many or no t-groups -> try O only first */
 6290|       |                /* single t-group -> try only N first */
 6291|      0|                if (!( at_Mobile_H_Revrs && at_Mobile_H_Revrs[i].endpoint ))
  ------------------
  |  Branch (6291:24): [True: 0, False: 0]
  |  Branch (6291:45): [True: 0, False: 0]
  ------------------
 6292|      0|                {
 6293|       |                    /* missed tautomeric endpoint */
 6294|      0|                    if (bFirst &&
  ------------------
  |  Branch (6294:25): [True: 0, False: 0]
  ------------------
 6295|      0|                        ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_MISSED_TAUT_1], e, INC_ADD_EDGE ) ))
  ------------------
  |  | 6259|      0|#define CHG_SET_MISSED_TAUT_1   0
  ------------------
                                      ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_MISSED_TAUT_1], e, INC_ADD_EDGE ) ))
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6295:25): [True: 0, False: 0]
  ------------------
 6296|      0|                    {
 6297|      0|                        goto exit_case_25;
 6298|      0|                    }
 6299|      0|                    if ((ret = AddToEdgeList( &ChangeableEdges[CHG_SET_MISSED_TAUT_ALL], e, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 6260|      0|#define CHG_SET_MISSED_TAUT_ALL 1
  ------------------
                                  if ((ret = AddToEdgeList( &ChangeableEdges[CHG_SET_MISSED_TAUT_ALL], e, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6299:25): [True: 0, False: 0]
  ------------------
 6300|      0|                    {
 6301|      0|                        goto exit_case_25;
 6302|      0|                    }
 6303|      0|                }
 6304|      0|                if (bFirst &&
  ------------------
  |  Branch (6304:21): [True: 0, False: 0]
  ------------------
 6305|      0|                    ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_OTHER_TAUT_1], e, INC_ADD_EDGE ) ))
  ------------------
  |  | 6261|      0|#define CHG_SET_OTHER_TAUT_1    2
  ------------------
                                  ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_OTHER_TAUT_1], e, INC_ADD_EDGE ) ))
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6305:21): [True: 0, False: 0]
  ------------------
 6306|      0|                {
 6307|      0|                    goto exit_case_25;
 6308|      0|                }
 6309|      0|                if ((ret = AddToEdgeList( &ChangeableEdges[CHG_SET_OTHER_TAUT_ALL], e, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 6262|      0|#define CHG_SET_OTHER_TAUT_ALL  3
  ------------------
                              if ((ret = AddToEdgeList( &ChangeableEdges[CHG_SET_OTHER_TAUT_ALL], e, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6309:21): [True: 0, False: 0]
  ------------------
 6310|      0|                {
 6311|      0|                    goto exit_case_25;
 6312|      0|                }
 6313|      0|                if ((ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 6265|      0|#define CHG_SET_AVOID           5
  ------------------
                              if ((ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6313:21): [True: 0, False: 0]
  ------------------
 6314|      0|                {
 6315|      0|                    goto exit_case_25;
 6316|      0|                }
 6317|      0|            }
 6318|      0|            else
 6319|      0|            {
 6320|      0|                if (at2[iat].valence == 1 && at2[iat].charge == -1 &&
  ------------------
  |  Branch (6320:21): [True: 0, False: 0]
  |  Branch (6320:46): [True: 0, False: 0]
  ------------------
 6321|      0|                     pVA[iat].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (6321:22): [True: 0, False: 0]
  ------------------
 6322|      0|                     pVA[iN = at2[iat].neighbor[0]].cNumValenceElectrons == 5 && /* -O(-) */
  ------------------
  |  Branch (6322:22): [True: 0, False: 0]
  ------------------
 6323|      0|                     !pStruct->endpoint[nAtno2CanonRevrs[iN]] &&
  ------------------
  |  Branch (6323:22): [True: 0, False: 0]
  ------------------
 6324|      0|                     at2[iN].valence == 3 && at2[iN].chem_bonds_valence == 3 &&
  ------------------
  |  Branch (6324:22): [True: 0, False: 0]
  |  Branch (6324:46): [True: 0, False: 0]
  ------------------
 6325|      0|                     !at2[iN].charge && !at2[iN].radical &&
  ------------------
  |  Branch (6325:22): [True: 0, False: 0]
  |  Branch (6325:41): [True: 0, False: 0]
  ------------------
 6326|      0|                     0 <= ( e = pVA[iN].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (6326:22): [True: 0, False: 0]
  |  Branch (6326:66): [True: 0, False: 0]
  ------------------
 6327|      0|                     pBNS->edge[e].flow && /* NPlus edge */
  ------------------
  |  Branch (6327:22): [True: 0, False: 0]
  ------------------
 6328|      0|                     0 <= ( e1 = pVA[iat].nCMinusGroupEdge - 1 ) && !pBNS->edge[e1].forbidden &&
  ------------------
  |  Branch (6328:22): [True: 0, False: 0]
  |  Branch (6328:69): [True: 0, False: 0]
  ------------------
 6329|      0|                     pBNS->edge[e1].flow &&  /* OMinus edge */
  ------------------
  |  Branch (6329:22): [True: 0, False: 0]
  ------------------
 6330|      0|                     0 > FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e ) &&
  ------------------
  |  | 6265|      0|#define CHG_SET_AVOID           5
  ------------------
  |  Branch (6330:22): [True: 0, False: 0]
  ------------------
 6331|      0|                     0 > FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e1 ))
  ------------------
  |  | 6265|      0|#define CHG_SET_AVOID           5
  ------------------
  |  Branch (6331:22): [True: 0, False: 0]
  ------------------
 6332|      0|                {
 6333|       |                    /* found >N-O(-) */
 6334|      0|                    int nNumO = 0, nNumOthers = 0;
 6335|      0|                    for (k = 0; k < at2[iN].valence; k++)
  ------------------
  |  Branch (6335:33): [True: 0, False: 0]
  ------------------
 6336|      0|                    {
 6337|      0|                        neigh = at2[iN].neighbor[k];
 6338|      0|                        if (neigh == iat)
  ------------------
  |  Branch (6338:29): [True: 0, False: 0]
  ------------------
 6339|      0|                        {
 6340|      0|                            continue;
 6341|      0|                        }
 6342|      0|                        if (pVA[neigh].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (6342:29): [True: 0, False: 0]
  ------------------
 6343|      0|                             !pStruct->endpoint[neigh] &&
  ------------------
  |  Branch (6343:30): [True: 0, False: 0]
  ------------------
 6344|      0|                             at2[neigh].valence == 1 && at2[neigh].num_H == 0 &&
  ------------------
  |  Branch (6344:30): [True: 0, False: 0]
  |  Branch (6344:57): [True: 0, False: 0]
  ------------------
 6345|      0|                             at2[neigh].radical == 0 && at2[neigh].charge == -1 &&
  ------------------
  |  Branch (6345:30): [True: 0, False: 0]
  |  Branch (6345:57): [True: 0, False: 0]
  ------------------
 6346|      0|                             at2[neigh].chem_bonds_valence == 1)
  ------------------
  |  Branch (6346:30): [True: 0, False: 0]
  ------------------
 6347|      0|                        {
 6348|      0|                            nNumO++;
 6349|      0|                        }
 6350|      0|                        else
 6351|      0|                        {
 6352|      0|                            if (at2[iN].bond_type[k] == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (6352:33): [True: 0, False: 0]
  ------------------
 6353|      0|                                 at2[neigh].valence > 1 &&
  ------------------
  |  Branch (6353:34): [True: 0, False: 0]
  ------------------
 6354|      0|                                 at2[neigh].valence < at2[neigh].chem_bonds_valence)
  ------------------
  |  Branch (6354:34): [True: 0, False: 0]
  ------------------
 6355|      0|                            {
 6356|      0|                                nNumOthers++;
 6357|      0|                            }
 6358|      0|                        }
 6359|      0|                    }
 6360|      0|                    if (nNumO != 1 && nNumOthers != 1)
  ------------------
  |  Branch (6360:25): [True: 0, False: 0]
  |  Branch (6360:39): [True: 0, False: 0]
  ------------------
 6361|      0|                    {
 6362|      0|                        continue;
 6363|      0|                    }
 6364|       |                    /* save charge edges: NPlus first, OMinus second */
 6365|      0|                    if (( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NO_IN_NO2M2], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 6264|      0|#define CHG_SET_NO_IN_NO2M2     4
  ------------------
                                  if (( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NO_IN_NO2M2], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6365:25): [True: 0, False: 0]
  ------------------
 6366|      0|                        ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NO_IN_NO2M2], e1, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 6264|      0|#define CHG_SET_NO_IN_NO2M2     4
  ------------------
                                      ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NO_IN_NO2M2], e1, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6366:25): [True: 0, False: 0]
  ------------------
 6367|      0|                         ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 6265|      0|#define CHG_SET_AVOID           5
  ------------------
                                       ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6367:26): [True: 0, False: 0]
  ------------------
 6368|      0|                         ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e1, INC_ADD_EDGE ) ))
  ------------------
  |  | 6265|      0|#define CHG_SET_AVOID           5
  ------------------
                                       ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e1, INC_ADD_EDGE ) ))
  ------------------
  |  |   18|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6368:26): [True: 0, False: 0]
  ------------------
 6369|      0|                    {
 6370|      0|                        goto exit_case_25;
 6371|      0|                    }
 6372|      0|                }
 6373|      0|            }
 6374|      0|        }
 6375|      0|        if (!ChangeableEdges[CHG_SET_NO_IN_NO2M2].num_edges ||
  ------------------
  |  | 6264|      0|#define CHG_SET_NO_IN_NO2M2     4
  ------------------
  |  Branch (6375:13): [True: 0, False: 0]
  ------------------
 6376|      0|             !ChangeableEdges[CHG_SET_OTHER_TAUT_ALL].num_edges)
  ------------------
  |  | 6262|      0|#define CHG_SET_OTHER_TAUT_ALL  3
  ------------------
  |  Branch (6376:14): [True: 0, False: 0]
  ------------------
 6377|      0|        {
 6378|      0|            goto exit_case_25;
 6379|      0|        }
 6380|       |        /* ------- finally, try to move charges from -NO2(2-) or to tautomeric endpoints ----*/
 6381|      0|        for (i = 0; i < ChangeableEdges[CHG_SET_NO_IN_NO2M2].num_edges; i += 2)
  ------------------
  |  | 6264|      0|#define CHG_SET_NO_IN_NO2M2     4
  ------------------
  |  Branch (6381:21): [True: 0, False: 0]
  ------------------
 6382|      0|        {
 6383|      0|            int nDeltaChargeExpected = 3;
 6384|       |            /* change flow on O(-) to make it neutral; 3 new charges will be created:
 6385|       |            N(+), and two (-) on InChI endpoints
 6386|       |            alternatively, if we change flow on N to make N(+) then O(-) will
 6387|       |            be nutralized (-1 charge) and two (-) charges on taut. endpoints will be
 6388|       |            created (+2); the total change in this case would be (-1)+(+2) = +1
 6389|       |            */
 6390|      0|            one_success = 0;
 6391|      0|            delta = 1;
 6392|      0|            pe = pBNS->edge + ChangeableEdges[CHG_SET_NO_IN_NO2M2].pnEdges[i + 1]; /* O(-) edge */
  ------------------
  |  | 6264|      0|#define CHG_SET_NO_IN_NO2M2     4
  ------------------
 6393|      0|            pef = pBNS->edge + ChangeableEdges[CHG_SET_NO_IN_NO2M2].pnEdges[i]; /* >N- (+) edge */
  ------------------
  |  | 6264|      0|#define CHG_SET_NO_IN_NO2M2     4
  ------------------
 6394|       |
 6395|      0|            if (!pe->flow)
  ------------------
  |  Branch (6395:17): [True: 0, False: 0]
  ------------------
 6396|      0|                continue;
 6397|      0|            pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 6398|      0|            pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 6399|       |
 6400|      0|            pe->flow -= delta;
 6401|      0|            pv1->st_edge.flow -= delta;
 6402|      0|            pv2->st_edge.flow -= delta;
 6403|      0|            pBNS->tot_st_flow -= 2 * delta;
 6404|       |
 6405|      0|            for (k = 0; !one_success && k <= CHG_LAST_SET; k++)
  ------------------
  |  | 6263|      0|#define CHG_LAST_SET            3 /* the last index in trying */
  ------------------
  |  Branch (6405:25): [True: 0, False: 0]
  |  Branch (6405:41): [True: 0, False: 0]
  ------------------
 6406|      0|            {
 6407|      0|                if (!ChangeableEdges[k].num_edges)
  ------------------
  |  Branch (6407:21): [True: 0, False: 0]
  ------------------
 6408|      0|                {
 6409|      0|                    continue;
 6410|      0|                }
 6411|      0|                SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 6412|      0|                RemoveForbiddenEdgeMask( pBNS, &ChangeableEdges[k], forbidden_edge_mask );
 6413|       |                /* allow change of N(V) flower edge */
 6414|      0|                pef->forbidden &= forbidden_edge_mask_inv;
 6415|       |
 6416|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 6417|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 6418|       |
 6419|      0|                if (ret == 1 && ( (vPathEnd == v1 && vPathStart == v2) ||
  ------------------
  |  Branch (6419:21): [True: 0, False: 0]
  |  Branch (6419:36): [True: 0, False: 0]
  |  Branch (6419:54): [True: 0, False: 0]
  ------------------
 6420|      0|                                  (vPathEnd == v2 && vPathStart == v1) ) &&
  ------------------
  |  Branch (6420:36): [True: 0, False: 0]
  |  Branch (6420:54): [True: 0, False: 0]
  ------------------
 6421|      0|                     nDeltaCharge == nDeltaChargeExpected) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (6421:22): [True: 0, False: 0]
  ------------------
 6422|      0|                {
 6423|       |                    /* Move (-) charge to =O and remove it an endpoint => nDeltaCharge == 0 */
 6424|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 6425|      0|                    if (ret > 0)
  ------------------
  |  Branch (6425:25): [True: 0, False: 0]
  ------------------
 6426|      0|                    {
 6427|      0|                        nNumRunBNS++;
 6428|      0|                        one_success++; /* 24 */
 6429|      0|                    }
 6430|      0|                }
 6431|      0|                INCHI_HEAPCHK
 6432|      0|            }
 6433|      0|            cur_success += one_success;
 6434|       |
 6435|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 6436|       |
 6437|      0|            if (!one_success)
  ------------------
  |  Branch (6437:17): [True: 0, False: 0]
  ------------------
 6438|      0|            {
 6439|      0|                pe->flow += delta;
 6440|      0|                pv1->st_edge.flow += delta;
 6441|      0|                pv2->st_edge.flow += delta;
 6442|      0|                pBNS->tot_st_flow += 2 * delta;
 6443|      0|            }
 6444|      0|        }
 6445|      0|    exit_case_25:
 6446|      0|        for (i = 0; i < CHG_SET_NUM; i++)
  ------------------
  |  | 6266|      0|#define CHG_SET_NUM             6
  ------------------
  |  Branch (6446:21): [True: 0, False: 0]
  ------------------
 6447|      0|        {
 6448|      0|            AllocEdgeList( &ChangeableEdges[i], EDGE_LIST_FREE );
  ------------------
  |  |  243|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 6449|      0|        }
 6450|       |
 6451|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 6452|      0|        if (cur_success)
  ------------------
  |  Branch (6452:13): [True: 0, False: 0]
  ------------------
 6453|      0|        {
 6454|      0|            tot_succes += cur_success;
 6455|       |            /* recalculate InChI from the structure */
 6456|      0|            if (0 >( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (6456:17): [True: 0, False: 0]
  ------------------
 6457|      0|                                                           ppt_group_info, ppat_norm, ppat_prep ) ))
 6458|      0|            {
 6459|      0|                goto exit_function;
 6460|      0|            }
 6461|      0|            if ((ret = FillOutExtraFixedHDataRestr( pStruct ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (6461:17): [True: 0, False: 0]
  ------------------
 6462|      0|            {
 6463|      0|                goto exit_function;
 6464|      0|            }
 6465|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (6465:17): [True: 0, False: 0]
  |  Branch (6465:45): [True: 0, False: 0]
  ------------------
 6466|      0|            {
 6467|      0|                goto exit_function;  /* no fixed-H found */
 6468|      0|            }
 6469|      0|            if ((ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (6469:17): [True: 0, False: 0]
  ------------------
 6470|      0|            {
 6471|      0|                goto exit_function;
 6472|      0|            }
 6473|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (6473:17): [True: 0, False: 0]
  ------------------
 6474|      0|            {
 6475|      0|                goto exit_function; /* nothing to do */
 6476|      0|            }
 6477|      0|        }
 6478|      0|#undef CHG_SET_NN
 6479|      0|#undef CHG_SET_MISSED_TAUT
 6480|      0|#undef CHG_SET_OTHER_TAUT_O
 6481|      0|#undef CHG_SET_OTHER_TAUT_N
 6482|      0|#undef CHG_LAST_SET
 6483|      0|#undef CHG_SET_AVOID
 6484|      0|#undef CHG_SET_NUM
 6485|      0|    }
 6486|       |
 6487|       |
 6488|  1.21k|exit_function:
 6489|       |
 6490|  1.21k|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  1.21k|#define EDGE_LIST_FREE   (-2)
  ------------------
 6491|  1.21k|    AllocEdgeList( &CurrEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  1.21k|#define EDGE_LIST_FREE   (-2)
  ------------------
 6492|  1.21k|    AllocEdgeList( &NFlowerEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  1.21k|#define EDGE_LIST_FREE   (-2)
  ------------------
 6493|  1.21k|    AllocEdgeList( &SFlowerEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  1.21k|#define EDGE_LIST_FREE   (-2)
  ------------------
 6494|  1.21k|    AllocEdgeList( &OtherNFlowerEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  1.21k|#define EDGE_LIST_FREE   (-2)
  ------------------
 6495|  1.21k|    AllocEdgeList( &FixedLargeRingStereoEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  1.21k|#define EDGE_LIST_FREE   (-2)
  ------------------
 6496|  1.21k|    AllocEdgeList( &AllBondEdges, EDGE_LIST_FREE );
  ------------------
  |  |  243|  1.21k|#define EDGE_LIST_FREE   (-2)
  ------------------
 6497|       |
 6498|  1.21k|    return ret < 0 ? ret : ( tot_succes && pc2i->bHasDifference );
  ------------------
  |  Branch (6498:12): [True: 8, False: 1.20k]
  |  Branch (6498:30): [True: 523, False: 682]
  |  Branch (6498:44): [True: 518, False: 5]
  ------------------
 6499|  1.12k|}

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

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

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

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

inchi_qsort:
   36|  1.21M|{
   37|  1.21M|    char *lo, *hi;              /* ends of sub-array currently sorting */
   38|  1.21M|    char *mid;                  /* points to middle of subarray */
   39|  1.21M|    char *loguy, *higuy;        /* traveling pointers for partition step */
   40|  1.21M|    size_t size;                /* size of the sub-array */
   41|  1.21M|    char *lostk[STKSIZ], *histk[STKSIZ];
   42|  1.21M|    int stkptr;                 /* stack for saving sub-array to be processed */
   43|       |
   44|  1.21M|    if (num < 2)
  ------------------
  |  Branch (44:9): [True: 779k, False: 432k]
  ------------------
   45|   779k|        return;                 /* nothing to do */
   46|       |
   47|   432k|    stkptr = 0;                 /* initialize stack */
   48|       |
   49|   432k|    lo = (char *) base;
   50|   432k|    hi = (char *) base + width * ( num - 1 );        /* initialize limits */
   51|       |
   52|       |    /* This entry point is for pseudo-recursion calling: setting
   53|       |    lo and hi and jumping to here is like recursion, but stkptr is
   54|       |    preserved, locals aren't, so we preserve stuff on the stack */
   55|  2.09M|recurse:
   56|       |
   57|  2.09M|    size = ( hi - lo ) / width + 1;        /* number of el's to sort */
   58|       |
   59|       |    /* First we pick a partitioning element.  The efficiency of the
   60|       |    algorithm demands that we find one that is approximately the median
   61|       |    of the values, but also that we select one fast.  We choose the
   62|       |    median of the first, middle, and last elements, to avoid bad
   63|       |    performance in the face of already sorted data, or data that is made
   64|       |    up of multiple sorted runs appended together.  Testing shows that a
   65|       |    median-of-three algorithm provides better performance than simply
   66|       |    picking the middle element for the latter case. */
   67|       |
   68|  2.09M|    mid = lo + ( size / 2 ) * width;      /* find middle element */
   69|       |
   70|       |    /* Sort the first, middle, last elements into order */
   71|  2.09M|    if (comp( lo, mid, pParam ) > 0)
  ------------------
  |  Branch (71:9): [True: 156k, False: 1.94M]
  ------------------
   72|   156k|    {
   73|   156k|        inchi_swap( lo, mid, width );
   74|   156k|    }
   75|  2.09M|    if (comp( lo, hi, pParam ) > 0)
  ------------------
  |  Branch (75:9): [True: 98.3k, False: 1.99M]
  ------------------
   76|  98.3k|    {
   77|  98.3k|        inchi_swap( lo, hi, width );
   78|  98.3k|    }
   79|  2.09M|    if (comp( mid, hi, pParam ) > 0)
  ------------------
  |  Branch (79:9): [True: 224k, False: 1.87M]
  ------------------
   80|   224k|    {
   81|   224k|        inchi_swap( mid, hi, width );
   82|   224k|    }
   83|       |
   84|       |    /* We now wish to partition the array into three pieces, one consisting
   85|       |    of elements <= partition element, one of elements equal to the
   86|       |    partition element, and one of elements > than it.  This is done
   87|       |    below; comments indicate conditions established at every step. */
   88|       |
   89|  2.09M|    loguy = lo;
   90|  2.09M|    higuy = hi;
   91|       |
   92|       |    /* Note that higuy decreases and loguy increases on every iteration,
   93|       |    so loop must terminate. */
   94|  2.09M|    for (;;)
   95|  2.40M|    {
   96|       |        /* lo <= loguy < hi, lo < higuy <= hi,
   97|       |        A[i] <= A[mid] for lo <= i <= loguy,
   98|       |        A[i] > A[mid] for higuy <= i < hi,
   99|       |        A[hi] >= A[mid] */
  100|       |
  101|       |        /* The doubled loop is to avoid calling comp(mid,mid), since some
  102|       |        existing comparison funcs don't work when passed the same
  103|       |        value for both pointers. */
  104|       |
  105|  2.40M|        if (mid > loguy)
  ------------------
  |  Branch (105:13): [True: 2.22M, False: 170k]
  ------------------
  106|  2.22M|        {
  107|  2.22M|            do
  108|  4.40M|            {
  109|  4.40M|                loguy += width;
  110|  4.40M|            }
  111|  4.40M|            while (loguy < mid && comp( loguy, mid, pParam ) <= 0);
  ------------------
  |  Branch (111:20): [True: 2.43M, False: 1.97M]
  |  Branch (111:35): [True: 2.17M, False: 257k]
  ------------------
  112|  2.22M|        }
  113|  2.40M|        if (mid <= loguy)
  ------------------
  |  Branch (113:13): [True: 2.14M, False: 257k]
  ------------------
  114|  2.14M|        {
  115|  2.14M|            do
  116|  2.25M|            {
  117|  2.25M|                loguy += width;
  118|  2.25M|            }
  119|  2.25M|            while (loguy <= hi && comp( loguy, mid, pParam ) <= 0);
  ------------------
  |  Branch (119:20): [True: 1.49M, False: 760k]
  |  Branch (119:35): [True: 110k, False: 1.38M]
  ------------------
  120|  2.14M|        }
  121|       |
  122|       |        /* lo < loguy <= hi+1, A[i] <= A[mid] for lo <= i < loguy,
  123|       |        either loguy > hi or A[loguy] > A[mid] */
  124|       |
  125|  2.40M|        do
  126|  4.34M|        {
  127|  4.34M|            higuy -= width;
  128|  4.34M|        }
  129|  4.34M|        while (higuy > mid && comp( higuy, mid, pParam ) > 0);
  ------------------
  |  Branch (129:16): [True: 2.21M, False: 2.13M]
  |  Branch (129:31): [True: 1.94M, False: 265k]
  ------------------
  130|       |
  131|       |         /* lo <= higuy < hi, A[i] > A[mid] for higuy < i < hi,
  132|       |         either higuy == lo or A[higuy] <= A[mid] */
  133|       |
  134|  2.40M|        if (higuy < loguy)
  ------------------
  |  Branch (134:13): [True: 2.09M, False: 302k]
  ------------------
  135|  2.09M|        {
  136|  2.09M|            break;
  137|  2.09M|        }
  138|       |
  139|       |        /* if loguy > hi or higuy == lo, then we would have exited, so
  140|       |        A[loguy] > A[mid], A[higuy] <= A[mid],
  141|       |        loguy <= hi, higuy > lo */
  142|       |
  143|   302k|        inchi_swap( loguy, higuy, width );
  144|       |
  145|       |        /* If the partition element was moved, follow it.  Only need
  146|       |        to check for mid == higuy, since before the swap,
  147|       |        A[loguy] > A[mid] implies loguy != mid. */
  148|       |
  149|   302k|        if (mid == higuy)
  ------------------
  |  Branch (149:13): [True: 125k, False: 176k]
  ------------------
  150|   125k|        {
  151|   125k|            mid = loguy;
  152|   125k|        }
  153|       |
  154|       |        /* A[loguy] <= A[mid], A[higuy] > A[mid]; so condition at top
  155|       |        of loop is re-established */
  156|   302k|    }
  157|       |
  158|       |    /*     A[i] <= A[mid] for lo <= i < loguy,
  159|       |    A[i] > A[mid] for higuy < i < hi,
  160|       |    A[hi] >= A[mid]
  161|       |    higuy < loguy
  162|       |    implying:
  163|       |    higuy == loguy-1
  164|       |    or higuy == hi - 1, loguy == hi + 1, A[hi] == A[mid] */
  165|       |
  166|       |    /* Find adjacent elements equal to the partition element.  The
  167|       |    doubled loop is to avoid calling comp(mid,mid), since some
  168|       |    existing comparison funcs don't work when passed the same value
  169|       |    for both pointers. */
  170|       |
  171|  2.09M|    higuy += width;
  172|  2.09M|    if (mid < higuy)
  ------------------
  |  Branch (172:9): [True: 1.33M, False: 760k]
  ------------------
  173|  1.33M|    {
  174|  1.33M|        do
  175|  1.33M|        {
  176|  1.33M|            higuy -= width;
  177|  1.33M|        }
  178|  1.33M|        while (higuy > mid && comp( higuy, mid, pParam ) == 0);
  ------------------
  |  Branch (178:16): [True: 89.2k, False: 1.24M]
  |  Branch (178:31): [True: 0, False: 89.2k]
  ------------------
  179|  1.33M|    }
  180|  2.09M|    if (mid >= higuy)
  ------------------
  |  Branch (180:9): [True: 2.00M, False: 89.2k]
  ------------------
  181|  2.00M|    {
  182|  2.00M|        do
  183|  2.00M|        {
  184|  2.00M|            higuy -= width;
  185|  2.00M|        }
  186|  2.00M|        while (higuy > lo && comp( higuy, mid, pParam ) == 0);
  ------------------
  |  Branch (186:16): [True: 789k, False: 1.21M]
  |  Branch (186:30): [True: 0, False: 789k]
  ------------------
  187|  2.00M|    }
  188|       |
  189|       |    /* OK, now we have the following:
  190|       |    higuy < loguy
  191|       |    lo <= higuy <= hi
  192|       |    A[i]  <= A[mid] for lo <= i <= higuy
  193|       |    A[i]  == A[mid] for higuy < i < loguy
  194|       |    A[i]  >  A[mid] for loguy <= i < hi
  195|       |    A[hi] >= A[mid] */
  196|       |
  197|       |    /* We've finished the partition, now we want to sort the subarrays
  198|       |    [lo, higuy] and [loguy, hi].
  199|       |    We do the smaller one first to minimize stack usage.
  200|       |    We only sort arrays of length 2 or more.*/
  201|       |
  202|  2.09M|    if (higuy - lo >= hi - loguy)
  ------------------
  |  Branch (202:9): [True: 1.97M, False: 123k]
  ------------------
  203|  1.97M|    {
  204|  1.97M|        if (lo < higuy)
  ------------------
  |  Branch (204:13): [True: 789k, False: 1.18M]
  ------------------
  205|   789k|        {
  206|   789k|            lostk[stkptr] = lo;
  207|   789k|            histk[stkptr] = higuy;
  208|   789k|            ++stkptr;
  209|   789k|        }                           /* save big recursion for later */
  210|       |
  211|  1.97M|        if (loguy < hi)
  ------------------
  |  Branch (211:13): [True: 662k, False: 1.31M]
  ------------------
  212|   662k|        {
  213|   662k|            lo = loguy;
  214|   662k|            goto recurse;           /* do small recursion */
  215|   662k|        }
  216|  1.97M|    }
  217|   123k|    else
  218|   123k|    {
  219|   123k|        if (loguy < hi)
  ------------------
  |  Branch (219:13): [True: 123k, False: 0]
  ------------------
  220|   123k|        {
  221|   123k|            lostk[stkptr] = loguy;
  222|   123k|            histk[stkptr] = hi;
  223|   123k|            ++stkptr;               /* save big recursion for later */
  224|   123k|        }
  225|       |
  226|   123k|        if (lo < higuy)
  ------------------
  |  Branch (226:13): [True: 89.3k, False: 34.3k]
  ------------------
  227|  89.3k|        {
  228|  89.3k|            hi = higuy;
  229|  89.3k|            goto recurse;           /* do small recursion */
  230|  89.3k|        }
  231|   123k|    }
  232|       |
  233|       |    /* We have sorted the array, except for any pending sorts on the stack.
  234|       |    Check if there are any, and do them. */
  235|       |
  236|  1.34M|    --stkptr;
  237|  1.34M|    if (stkptr >= 0)
  ------------------
  |  Branch (237:9): [True: 913k, False: 432k]
  ------------------
  238|   913k|    {
  239|   913k|        lo = lostk[stkptr];
  240|   913k|        hi = histk[stkptr];
  241|   913k|        goto recurse;           /* pop subarray from stack */
  242|   913k|    }
  243|   432k|    else
  244|   432k|    {
  245|   432k|        return;                 /* all subarrays done */
  246|   432k|    }
  247|  1.34M|}
inchi_swap:
  252|  2.47M|{
  253|  2.47M|    char tmp;
  254|  2.47M|    if (a != b)
  ------------------
  |  Branch (254:9): [True: 2.47M, False: 0]
  ------------------
  255|  2.47M|    {
  256|  15.9M|        while (width--)
  ------------------
  |  Branch (256:16): [True: 13.4M, False: 2.47M]
  ------------------
  257|  13.4M|        {
  258|  13.4M|            tmp = *a;
  259|  13.4M|            *a++ = *b;
  260|  13.4M|            *b++ = tmp;
  261|  13.4M|        }
  262|  2.47M|    }
  263|  2.47M|}
insertions_sort:
  273|  1.90M|{
  274|  1.90M|    char *i, *j, *pk = (char*) base;
  275|  1.90M|    int  num_trans = 0;
  276|  1.90M|    size_t k;
  277|  4.50M|    for (k = 1; k < num; k++, pk += width)
  ------------------
  |  Branch (277:17): [True: 2.59M, False: 1.90M]
  ------------------
  278|  2.59M|    {
  279|       |        /*for( i = pk, j = pk + width; j > (char*)base && (*compare)(i,j) > 0; j=i, i -= width )*/
  280|  2.59M|        for (i = j = pk + width;
  281|  3.40M|             j > ( char* )base && ( i -= width, ( *compare )( i, j, pCG ) ) > 0;
  ------------------
  |  Branch (281:14): [True: 3.24M, False: 152k]
  |  Branch (281:35): [True: 802k, False: 2.44M]
  ------------------
  282|  2.59M|             j = i)        /* changed to keep BoundsChecker happy 2007-09-24 DT */
  283|   802k|        {
  284|   802k|            inchi_swap( i, j, width );
  285|   802k|            num_trans++;
  286|   802k|        }
  287|  2.59M|    }
  288|       |
  289|  1.90M|    return num_trans;
  290|  1.90M|}
insertions_sort_AT_NUMBERS:
  300|  13.3M|{
  301|  13.3M|    AT_NUMB *i, *j, *pk, tmp;
  302|  13.3M|    int  k, num_trans = 0;
  303|   316M|    for (k = 1, pk = base; k < num; k++, pk++)
  ------------------
  |  Branch (303:28): [True: 303M, False: 13.3M]
  ------------------
  304|   303M|    {
  305|   303M|        for (j = ( i = pk ) + 1, tmp = *j; j > base && ( *compare )( i, &tmp, pCG ) > 0; j = i, i--)
  ------------------
  |  Branch (305:44): [True: 303M, False: 6.68k]
  |  Branch (305:56): [True: 11.4k, False: 303M]
  ------------------
  306|  11.4k|        {
  307|  11.4k|            *j = *i;
  308|  11.4k|            num_trans++;
  309|  11.4k|        }
  310|   303M|        *j = tmp;
  311|   303M|    }
  312|       |
  313|  13.3M|    return num_trans;
  314|  13.3M|}
insertions_sort_NeighList_AT_NUMBERS:
  321|   730k|{
  322|   730k|    AT_NUMB *i, *j, *pk, tmp;
  323|   730k|    AT_RANK rj; /* optimization */
  324|   730k|    int k, num = (int) *base++;
  325|  2.42M|    for (k = 1, pk = base; k < num; k++, pk++)
  ------------------
  |  Branch (325:28): [True: 1.69M, False: 730k]
  ------------------
  326|  1.69M|    {
  327|  1.98M|        for (j = ( i = pk ) + 1, rj = nRank[(int) *j]; j > base && nRank[(int) *i] > rj; j = i, i--)
  ------------------
  |  Branch (327:56): [True: 1.88M, False: 101k]
  |  Branch (327:68): [True: 291k, False: 1.59M]
  ------------------
  328|   291k|        {
  329|   291k|            tmp = *i;
  330|   291k|            *i = *j;
  331|   291k|            *j = tmp;
  332|   291k|        }
  333|  1.69M|    }
  334|   730k|}
insertions_sort_AT_RANK:
  341|  5.50k|{
  342|  5.50k|    AT_RANK *i, *j, *pk, tmp;
  343|  5.50k|    int  k, num_trans = 0;
  344|  10.4k|    for (k = 1, pk = base; k < num; k++, pk++)
  ------------------
  |  Branch (344:28): [True: 4.98k, False: 5.50k]
  ------------------
  345|  4.98k|    {
  346|  7.59k|        for (j = ( i = pk ) + 1, tmp = *j; j > base && *i > tmp; j = i, i--)
  ------------------
  |  Branch (346:44): [True: 6.55k, False: 1.03k]
  |  Branch (346:56): [True: 2.60k, False: 3.95k]
  ------------------
  347|  2.60k|        {
  348|  2.60k|            *j = *i;
  349|  2.60k|            num_trans++;
  350|  2.60k|        }
  351|  4.98k|        *j = tmp;
  352|  4.98k|    }
  353|       |
  354|  5.50k|    return num_trans;
  355|  5.50k|}
insertions_sort_NeighList_AT_NUMBERS3:
  362|  77.8k|{
  363|  77.8k|    AT_NUMB *i, *j, *pk, tmp;
  364|  77.8k|    AT_RANK rj;
  365|  77.8k|    int k, n, num = (int) *base++;
  366|   170k|    for (k = 1, pk = base, n = 0; k < num; k++, pk++)
  ------------------
  |  Branch (366:35): [True: 92.9k, False: 77.8k]
  ------------------
  367|  92.9k|    {
  368|  92.9k|        for (j = ( i = pk ) + 1, rj = nRank[(int) ( tmp = *j )];
  369|  98.0k|             j > base && nRank[(int) *i] > rj;
  ------------------
  |  Branch (369:14): [True: 94.0k, False: 3.95k]
  |  Branch (369:26): [True: 5.03k, False: 89.0k]
  ------------------
  370|  92.9k|             j = i, i--)
  371|  5.03k|        {
  372|  5.03k|            *j = *i;
  373|  5.03k|            n++;
  374|  5.03k|        }
  375|  92.9k|        *j = tmp;
  376|  92.9k|    }
  377|       |
  378|  77.8k|    return n;
  379|  77.8k|}
insertions_sort_NeighListBySymmAndCanonRank:
  389|   134k|{
  390|   134k|    AT_NUMB *i, *j, *pk, tmp;
  391|   134k|    int  diff;
  392|   134k|    int k, num = (int) *base++;
  393|   472k|    for (k = 1, pk = base; k < num; k++, pk++)
  ------------------
  |  Branch (393:28): [True: 338k, False: 134k]
  ------------------
  394|   338k|    {
  395|   338k|        for (j = ( i = pk ) + 1;
  396|   561k|             j > base &&    /*  always j > i */
  ------------------
  |  Branch (396:14): [True: 459k, False: 102k]
  ------------------
  397|   459k|             ( 0 > ( diff = (int) nSymmRank[(int) *i] - (int) nSymmRank[(int) *j] ) ||
  ------------------
  |  Branch (397:16): [True: 188k, False: 270k]
  ------------------
  398|   270k|             (!diff && nCanonRank[(int) *i] < nCanonRank[(int) *j]) ); /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (398:15): [True: 85.9k, False: 184k]
  |  Branch (398:24): [True: 35.4k, False: 50.5k]
  ------------------
  399|   338k|             j = i, i--)
  400|   223k|        {
  401|   223k|            tmp = *i;
  402|   223k|            *i = *j;
  403|   223k|            *j = tmp;
  404|   223k|        }
  405|   338k|    }
  406|       |
  407|   134k|}
CompNeighborsAT_NUMBER:
  419|   271k|{
  420|   271k|    CANON_GLOBALS *pCG = (CANON_GLOBALS *) p;
  421|   271k|#ifdef CT_NEIGH_INCREASE
  422|   271k|    return (int) pCG->m_pn_RankForSort[pCG->m_pNeighborsForSort[( int )*(const AT_NUMB*) a1]] -
  423|   271k|           (int) pCG->m_pn_RankForSort[pCG->m_pNeighborsForSort[( int )*(const AT_NUMB*) a2]];
  424|       |#else
  425|       |    return (int) ( (CANON_GLOBALS *) pCG )->m_pn_RankForSort[pNeighborsForSort[( int )*(const AT_NUMB*) a2]] -
  426|       |           (int) ( (CANON_GLOBALS *) pCG )->m_pn_RankForSort[pNeighborsForSort[( int )*(const AT_NUMB*) a1]];
  427|       |#endif
  428|   271k|}
comp_AT_RANK:
  433|  83.1k|{
  434|  83.1k|    return ( int )*(const AT_RANK*) a1 - ( int )*(const AT_RANK*) a2;
  435|  83.1k|}
CompRank:
  441|   386k|{
  442|   386k|    CANON_GLOBALS *pCG = (CANON_GLOBALS *) p;
  443|   386k|    int ret = (int) pCG->m_pn_RankForSort[( int )*(const AT_RANK*) a1] -
  444|   386k|              (int) pCG->m_pn_RankForSort[( int )*(const AT_RANK*) a2];
  445|       |
  446|   386k|    return ret;
  447|   386k|}
CompRanksOrd:
  452|  9.41M|{
  453|  9.41M|    int ret;
  454|  9.41M|    CANON_GLOBALS *pCG = (CANON_GLOBALS *) p;
  455|  9.41M|    ret = (int) pCG->m_pn_RankForSort[( int )*(const AT_RANK*) a1] -
  456|  9.41M|          (int) pCG->m_pn_RankForSort[( int )*(const AT_RANK*) a2];
  457|  9.41M|    if (!ret)
  ------------------
  |  Branch (457:9): [True: 3.89M, False: 5.51M]
  ------------------
  458|  3.89M|    {
  459|  3.89M|        ret = ( int )*(const AT_RANK*) a1 - ( int )*(const AT_RANK*) a2;
  460|  3.89M|    }
  461|       |
  462|  9.41M|    return ret;
  463|  9.41M|}
CompAtomInvariants2Only:
  468|  4.85M|{
  469|  4.85M|    CANON_GLOBALS *pCG = (CANON_GLOBALS *) p;
  470|  4.85M|    const ATOM_INVARIANT2 *pAI1 = pCG->m_pAtomInvariant2ForSort + ( int )*(const AT_RANK*) a1;
  471|  4.85M|    const ATOM_INVARIANT2 *pAI2 = pCG->m_pAtomInvariant2ForSort + ( int )*(const AT_RANK*) a2;
  472|  4.85M|    int i;
  473|  18.0M|    for (i = 0; i < AT_INV_BREAK1; i++)
  ------------------
  |  Branch (473:17): [True: 16.1M, False: 1.86M]
  ------------------
  474|  16.1M|    {
  475|  16.1M|        if (pAI1->val[i] == pAI2->val[i])
  ------------------
  |  Branch (475:13): [True: 13.1M, False: 2.99M]
  ------------------
  476|  13.1M|            continue;
  477|  2.99M|        return  (int) pAI1->val[i] - (int) pAI2->val[i];
  478|  16.1M|    }
  479|  1.86M|    if (pAI1->iso_sort_key != pAI2->iso_sort_key)
  ------------------
  |  Branch (479:9): [True: 3.46k, False: 1.85M]
  ------------------
  480|  3.46k|    {
  481|  3.46k|        return ( pAI1->iso_sort_key > pAI2->iso_sort_key ) ? 1 : -1;
  ------------------
  |  Branch (481:16): [True: 1.32k, False: 2.14k]
  ------------------
  482|  3.46k|    }
  483|  1.85M|    for (; i < AT_INV_LENGTH; i++)
  ------------------
  |  Branch (483:12): [True: 1.85M, False: 0]
  ------------------
  484|  1.85M|    {
  485|  1.85M|        if (pAI1->val[i] != pAI2->val[i])
  ------------------
  |  Branch (485:13): [True: 6, False: 1.85M]
  ------------------
  486|      6|        {
  487|      6|            continue;
  488|      6|        }
  489|  1.85M|        return  (int) pAI1->val[i] - (int) pAI2->val[i];
  490|  1.85M|    }
  491|      0|    if (pAI1->iso_aux_key != pAI2->iso_aux_key)
  ------------------
  |  Branch (491:9): [True: 0, False: 0]
  ------------------
  492|      0|    {
  493|      0|        return ( pAI1->iso_aux_key > pAI2->iso_aux_key ) ? 1 : -1;
  ------------------
  |  Branch (493:16): [True: 0, False: 0]
  ------------------
  494|      0|    }
  495|       |
  496|      0|    return 0;
  497|      0|}
CompAtomInvariants2:
  502|  3.95M|{
  503|       |    /*  Warning: the following line may be compiler implementation dependent */
  504|  3.95M|    int ret = CompAtomInvariants2Only( a1, a2, p );
  505|  3.95M|    if (!ret)
  ------------------
  |  Branch (505:9): [True: 1.43M, False: 2.52M]
  ------------------
  506|  1.43M|    {
  507|  1.43M|        ret = ( int )*(const AT_RANK*) a1 - ( int )*(const AT_RANK*) a2;
  508|  1.43M|    }
  509|       |
  510|  3.95M|    return ret;
  511|  3.95M|}
CompChemElemLex:
  517|   464k|{
  518|   464k|    return memcmp( a1, a2, 2 );
  519|   464k|}
CompareNeighListLex:
  526|   488M|{
  527|   488M|    int len1 = (int) *pp1++;
  528|   488M|    int len2 = (int) *pp2++;
  529|   488M|    int len = inchi_min( len1, len2 );
  ------------------
  |  |  139|   488M|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 488M]
  |  |  ------------------
  ------------------
  530|   488M|    int diff = 0;
  531|   488M|    int ret;
  532|       |    /* djb-rwth: fixing oss-fuzz issue #25642 */
  533|   489M|    while ((len > 0) && !diff) 
  ------------------
  |  Branch (533:12): [True: 1.42M, False: 488M]
  |  Branch (533:25): [True: 1.37M, False: 53.8k]
  ------------------
  534|  1.37M|    {
  535|  1.37M|        len--;
  536|  1.37M|        diff = (int)nRank[*pp1++] - (int)nRank[*pp2++];
  537|  1.37M|    };
  538|       |
  539|   488M|    ret = diff ? diff : (len1 - len2);
  ------------------
  |  Branch (539:11): [True: 89.0k, False: 488M]
  ------------------
  540|   488M|    return ret;
  541|   488M|}
CompareNeighListLexUpToMaxRank:
  548|   119M|{
  549|   119M|    int len1 = (int) *pp1++;
  550|   119M|    int len2 = (int) *pp2++;
  551|   119M|    int diff = 0;
  552|   119M|    int len;
  553|   120M|    while (0 < len1 && nRank[pp1[len1 - 1]] > nMaxAtNeighRank)
  ------------------
  |  Branch (553:12): [True: 503k, False: 119M]
  |  Branch (553:24): [True: 459k, False: 44.4k]
  ------------------
  554|   459k|    {
  555|   459k|        len1--;
  556|   459k|    }
  557|   119M|    while (0 < len2 && nRank[pp2[len2 - 1]] > nMaxAtNeighRank)
  ------------------
  |  Branch (557:12): [True: 272k, False: 119M]
  |  Branch (557:24): [True: 227k, False: 44.4k]
  ------------------
  558|   227k|    {
  559|   227k|        len2--;
  560|   227k|    }
  561|   119M|    len = inchi_min( len1, len2 );
  ------------------
  |  |  139|   119M|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 119M]
  |  |  ------------------
  ------------------
  562|   119M|    while (len-- > 0 && !( diff = (int) nRank[*pp1++] - (int) nRank[*pp2++] ))
  ------------------
  |  Branch (562:12): [True: 62.4k, False: 119M]
  |  Branch (562:25): [True: 53.0k, False: 9.40k]
  ------------------
  563|  53.0k|    {
  564|  53.0k|        ;
  565|  53.0k|    }
  566|       |
  567|   119M|    return diff ? diff : ( len1 - len2 );
  ------------------
  |  Branch (567:12): [True: 9.40k, False: 119M]
  ------------------
  568|   119M|}
compare_NeighLists:
  573|   244M|{
  574|   244M|    CANON_GLOBALS *pCG = (CANON_GLOBALS *) p;
  575|   244M|    return CompareNeighListLex( *op1, *op2, pCG->m_pn_RankForSort );
  576|   244M|}
CompNeighListRanks:
  581|  2.67M|{
  582|  2.67M|    CANON_GLOBALS *pCG = (CANON_GLOBALS *) p;
  583|  2.67M|    int ret;
  584|  2.67M|    ret = (int) pCG->m_pn_RankForSort[*( (const AT_RANK*) a1 )] -
  585|  2.67M|          (int) pCG->m_pn_RankForSort[*( (const AT_RANK*) a2 )];
  586|  2.67M|    if (!ret)
  ------------------
  |  Branch (586:9): [True: 1.12M, False: 1.55M]
  ------------------
  587|  1.12M|    {
  588|  1.12M|        ret = compare_NeighLists( pCG->m_pNeighList_RankForSort + *( (const AT_RANK*) a1 ),
  589|  1.12M|                                     pCG->m_pNeighList_RankForSort + *( (const AT_RANK*) a2 ), p );
  590|  1.12M|    }
  591|       |
  592|  2.67M|    return ret;
  593|  2.67M|}
CompNeighLists:
  598|   243M|{
  599|   243M|    CANON_GLOBALS *pCG = (CANON_GLOBALS *) p;
  600|   243M|    int ret;
  601|   243M|    ret = compare_NeighLists( pCG->m_pNeighList_RankForSort + *( (const AT_RANK*) a1 ),
  602|   243M|                              pCG->m_pNeighList_RankForSort + *( (const AT_RANK*) a2 ), p );
  603|       |
  604|   243M|    return ret;
  605|   243M|}
CompNeighListsUpToMaxRank:
  610|  59.7M|{
  611|  59.7M|    CANON_GLOBALS *pCG = (CANON_GLOBALS *) p;
  612|  59.7M|    int ret;
  613|  59.7M|    ret = CompareNeighListLexUpToMaxRank( pCG->m_pNeighList_RankForSort[*( (const AT_RANK*) a1 )],
  614|  59.7M|                                          pCG->m_pNeighList_RankForSort[*( (const AT_RANK*) a2 )],
  615|  59.7M|                                          pCG->m_pn_RankForSort, pCG->m_nMaxAtNeighRankForSort );
  616|       |
  617|  59.7M|    return ret;
  618|  59.7M|}
CompNeighListRanksOrd:
  623|  1.02M|{
  624|  1.02M|    int ret = CompNeighListRanks( a1, a2, p );
  625|  1.02M|    if (!ret)
  ------------------
  |  Branch (625:9): [True: 408k, False: 617k]
  ------------------
  626|   408k|    {
  627|   408k|        ret = ( int )*( (const AT_RANK*) a1 ) - ( int )*( (const AT_RANK*) a2 ); /*  keep original order if identical */
  628|   408k|    }
  629|       |
  630|  1.02M|    return ret;
  631|  1.02M|}
CompRanksInvOrd:
  636|  4.37k|{
  637|  4.37k|    return ( int )*(const AT_RANK*) a2 - ( int )*(const AT_RANK*) a1;
  638|  4.37k|}
CompNeighborsRanksCountEql:
  643|  63.3k|{
  644|  63.3k|    CANON_GLOBALS *pCG = (CANON_GLOBALS *) p;
  645|  63.3k|#ifdef CT_NEIGH_INCREASE
  646|  63.3k|    int ret = (int) pCG->m_pn_RankForSort[( int )*(const AT_RANK*) a1] -
  647|  63.3k|              (int) pCG->m_pn_RankForSort[( int )*(const AT_RANK*) a2];
  648|       |#else
  649|       |    int ret = (int) pCG->m_pn_RankForSort[( int )*(const AT_RANK*) a2] -
  650|       |              (int) pCG->m_pn_RankForSort[( int )*(const AT_RANK*) a1];
  651|       |#endif
  652|  63.3k|    pCG->m_nNumCompNeighborsRanksCountEql += !ret;
  653|       |
  654|  63.3k|    return ret;
  655|  63.3k|}
CreateNeighListFromLinearCT:
  667|  4.30k|{
  668|       |    /* Atom numbers in LinearCT are canonical numbers
  669|       |     * order: parent[i] > neigh[i][0] < neigh[i][1]...<neigh[i][n] < parent[i+1] > neigh[i+1][0] < ...
  670|       |     *        parent[i] < parent[i+1]
  671|       |     */
  672|  4.30k|    int i, j;
  673|  4.30k|    S_CHAR     *valence = NULL;
  674|  4.30k|    NEIGH_LIST *pp = NULL;
  675|  4.30k|    AT_NUMB    *pAtList = NULL;
  676|  4.30k|    AT_RANK     n_vertex, n_neigh;
  677|  4.30k|    int err = 1, num_bonds;
  678|  4.30k|    int length, start;
  679|       |
  680|  4.30k|    if ((int) LinearCT[0] > num_atoms)
  ------------------
  |  Branch (680:9): [True: 0, False: 4.30k]
  ------------------
  681|      0|    {
  682|      0|        goto exit_function;
  683|      0|    }
  684|  4.30k|    valence = (S_CHAR*)inchi_calloc((long long)num_atoms + 1, sizeof(valence[0]));
  ------------------
  |  | 1146|  4.30k|#define inchi_calloc   calloc
  ------------------
  685|  4.30k|    if (!valence) /* djb-rwth: cast operator added */
  ------------------
  |  Branch (685:9): [True: 0, False: 4.30k]
  ------------------
  686|      0|    {
  687|      0|        goto exit_function;
  688|      0|    }
  689|       |
  690|  53.0k|    for (i = 1, num_bonds = 0, n_vertex = LinearCT[0]; i < nLenCT; i++)
  ------------------
  |  Branch (690:56): [True: 48.7k, False: 4.30k]
  ------------------
  691|  48.7k|    {
  692|  48.7k|        if (( n_neigh = LinearCT[i] ) < n_vertex)
  ------------------
  |  Branch (692:13): [True: 26.2k, False: 22.4k]
  ------------------
  693|  26.2k|        {
  694|  26.2k|            valence[n_neigh] ++;
  695|  26.2k|            valence[n_vertex] ++;
  696|  26.2k|            num_bonds += 2;
  697|  26.2k|        }
  698|  22.4k|        else
  699|  22.4k|        {
  700|  22.4k|            if ((int) ( n_vertex = n_neigh ) > num_atoms)
  ------------------
  |  Branch (700:17): [True: 0, False: 22.4k]
  ------------------
  701|      0|            {
  702|      0|                goto exit_function;
  703|      0|            }
  704|  22.4k|        }
  705|  48.7k|    }
  706|  4.30k|    if ((int) n_vertex != num_atoms)
  ------------------
  |  Branch (706:9): [True: 0, False: 4.30k]
  ------------------
  707|      0|    {
  708|      0|        goto exit_function;
  709|      0|    }
  710|  4.30k|    length = num_bonds + num_atoms + 1;
  711|  4.30k|    pp = (NEIGH_LIST*)inchi_calloc(((long long)num_atoms + 1), sizeof(NEIGH_LIST));
  ------------------
  |  | 1146|  4.30k|#define inchi_calloc   calloc
  ------------------
  712|  4.30k|    pAtList = (AT_NUMB*)inchi_malloc(length * sizeof(AT_NUMB));
  ------------------
  |  | 1143|  4.30k|#define inchi_malloc   malloc
  ------------------
  713|  4.30k|    if (pp && pAtList) /* djb-rwth: cast operator added; addressing LLVM warning */
  ------------------
  |  Branch (713:9): [True: 4.30k, False: 0]
  |  Branch (713:15): [True: 4.30k, False: 0]
  ------------------
  714|  4.30k|    {
  715|       |        /*  Create empty connection table */
  716|  31.0k|        for (i = 1, length = 0; i <= num_atoms; i++)
  ------------------
  |  Branch (716:33): [True: 26.7k, False: 4.30k]
  ------------------
  717|  26.7k|        {
  718|  26.7k|            start = length;
  719|  26.7k|            length += ( valence[i] + 1 );
  720|  26.7k|            pp[i - 1] = pAtList + start;
  721|  26.7k|            pp[i - 1][0] = 0;
  722|  26.7k|        }
  723|       |        /*  Fill out the CT */
  724|  53.0k|        for (i = 1, n_vertex = LinearCT[0] - 1; i < nLenCT; i++)
  ------------------
  |  Branch (724:49): [True: 48.7k, False: 4.30k]
  ------------------
  725|  48.7k|        {
  726|  48.7k|            if (( n_neigh = LinearCT[i] - 1 ) < n_vertex)
  ------------------
  |  Branch (726:17): [True: 26.2k, False: 22.4k]
  ------------------
  727|  26.2k|            {
  728|       |                /*  Vertex - neighbor connection */
  729|  26.2k|                j = (int) ( ++pp[(int) n_vertex][0] );
  730|  26.2k|                pp[(int) n_vertex][j] = n_neigh;
  731|       |                /*  neighbor - vertex connection */
  732|  26.2k|                j = (int) ( ++pp[(int) n_neigh][0] );
  733|  26.2k|                pp[(int) n_neigh][j] = n_vertex;
  734|  26.2k|            }
  735|  22.4k|            else
  736|  22.4k|            {
  737|  22.4k|                if ((int) ( n_vertex = n_neigh ) >= num_atoms)
  ------------------
  |  Branch (737:21): [True: 0, False: 22.4k]
  ------------------
  738|      0|                {
  739|      0|                    goto exit_function;
  740|      0|                }
  741|  22.4k|            }
  742|  48.7k|        }
  743|  4.30k|        err = 0;
  744|  4.30k|    }
  745|       |
  746|  4.30k|exit_function:
  747|  4.30k|    if (valence)
  ------------------
  |  Branch (747:9): [True: 4.30k, False: 0]
  ------------------
  748|  4.30k|    {
  749|  4.30k|        inchi_free( valence );
  ------------------
  |  | 1152|  4.30k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 4.30k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 4.30k]
  |  |  ------------------
  ------------------
  750|  4.30k|    }
  751|  4.30k|    if (err) /* djb-rwth: ignoring LLVM warning */
  ------------------
  |  Branch (751:9): [True: 0, False: 4.30k]
  ------------------
  752|      0|    {
  753|      0|        if (pAtList)
  ------------------
  |  Branch (753:13): [True: 0, False: 0]
  ------------------
  754|      0|        {
  755|      0|            inchi_free( pAtList );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  756|      0|        }
  757|      0|        if (pp)
  ------------------
  |  Branch (757:13): [True: 0, False: 0]
  ------------------
  758|      0|        {
  759|      0|            inchi_free( pp );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  760|      0|            pp = NULL;
  761|      0|        }
  762|      0|    }
  763|       |
  764|  4.30k|    return pp; /* djb-rwth: ignoring LLVM warning: since a pointer is returned, memory should be freed in a function which calls *CreateNeighListFromLinearCT */
  765|  4.30k|}
CreateNeighList:
  780|   298k|{
  781|       |    /*  +1 to add NULL termination */
  782|   298k|    NEIGH_LIST *pp = (NEIGH_LIST *) inchi_calloc( ( (long long)num_at_tg + 1 ), sizeof( NEIGH_LIST ) ); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|   298k|#define inchi_calloc   calloc
  ------------------
  783|   298k|    T_GROUP   *t_group = NULL;
  784|   298k|    AT_NUMB   *nEndpointAtomNumber = NULL;
  785|   298k|    int        num_t_groups = 0;
  786|   298k|    int        nFirstEndpointAtNoPos;
  787|       |
  788|   298k|    AT_NUMB   *pAtList = NULL;
  789|   298k|    int        length, start, val, i, j;
  790|   298k|    if (pp)
  ------------------
  |  Branch (790:9): [True: 298k, False: 0]
  ------------------
  791|   298k|    {
  792|   298k|        if (num_at_tg > num_atoms)
  ------------------
  |  Branch (792:13): [True: 3.46k, False: 295k]
  ------------------
  793|  3.46k|        {
  794|  3.46k|            t_group = t_group_info->t_group;
  795|  3.46k|            num_t_groups = t_group_info->num_t_groups;
  796|  3.46k|            nEndpointAtomNumber = t_group_info->nEndpointAtomNumber;
  797|  3.46k|        }
  798|       |
  799|   298k|        if (!bDoubleBondSquare)
  ------------------
  |  Branch (799:13): [True: 298k, False: 0]
  ------------------
  800|   298k|        {
  801|  1.45M|            for (i = 0, length = 0; i < num_atoms; i++)
  ------------------
  |  Branch (801:37): [True: 1.15M, False: 298k]
  ------------------
  802|  1.15M|            {
  803|  1.15M|                length += (int) at[i].valence + ( num_t_groups && at[i].endpoint );
  ------------------
  |  Branch (803:51): [True: 22.5k, False: 1.13M]
  |  Branch (803:67): [True: 8.58k, False: 13.9k]
  ------------------
  804|  1.15M|            }
  805|   298k|            length += num_atoms;
  806|   302k|            for (i = 0; i < num_t_groups; i++)
  ------------------
  |  Branch (806:25): [True: 3.56k, False: 298k]
  ------------------
  807|  3.56k|            {
  808|  3.56k|                length += (int) t_group[i].nNumEndpoints;
  809|  3.56k|            }
  810|   298k|            length += num_t_groups;
  811|   298k|        }
  812|      0|        else
  813|      0|        {
  814|      0|            for (i = 0, length = 0; i < num_atoms; i++)
  ------------------
  |  Branch (814:37): [True: 0, False: 0]
  ------------------
  815|      0|            {
  816|      0|                val = (int) at[i].valence;
  817|      0|                for (j = 0; j < val; j++)
  ------------------
  |  Branch (817:29): [True: 0, False: 0]
  ------------------
  818|      0|                {
  819|      0|                    length += 1 + ( bDoubleBondSquare && BOND_DOUBLE == at[i].bond_type[j] );
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (819:37): [True: 0, False: 0]
  |  Branch (819:58): [True: 0, False: 0]
  ------------------
  820|      0|                }
  821|      0|                length += ( num_t_groups && at[i].endpoint );
  ------------------
  |  Branch (821:29): [True: 0, False: 0]
  |  Branch (821:45): [True: 0, False: 0]
  ------------------
  822|      0|            }
  823|      0|            length += num_atoms;
  824|      0|            for (i = 0; i < num_t_groups; i++)
  ------------------
  |  Branch (824:25): [True: 0, False: 0]
  ------------------
  825|      0|            {
  826|      0|                length += (int) t_group[i].nNumEndpoints;
  827|      0|            }
  828|      0|            length += num_t_groups;
  829|      0|        }
  830|   298k|        length++; /*  +1 to save number of neighbors */
  831|   298k|        pAtList = (AT_NUMB*)inchi_malloc(length * sizeof(AT_NUMB));
  ------------------
  |  | 1143|   298k|#define inchi_malloc   malloc
  ------------------
  832|   298k|        if (pAtList) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (832:13): [True: 298k, False: 0]
  ------------------
  833|   298k|        {
  834|   298k|            if (!bDoubleBondSquare)
  ------------------
  |  Branch (834:17): [True: 298k, False: 0]
  ------------------
  835|   298k|            {
  836|  1.45M|                for (i = 0, length = 0; i < num_atoms; i++)
  ------------------
  |  Branch (836:41): [True: 1.15M, False: 298k]
  ------------------
  837|  1.15M|                {
  838|  1.15M|                    val = at[i].valence;
  839|  1.15M|                    start = length++;
  840|  1.77M|                    for (j = 0; j < val; j++)
  ------------------
  |  Branch (840:33): [True: 619k, False: 1.15M]
  ------------------
  841|   619k|                    {
  842|   619k|                        pAtList[length++] = at[i].neighbor[j];
  843|   619k|                    }
  844|       |                    /*  add endpoint */
  845|  1.15M|                    if (num_t_groups && at[i].endpoint)
  ------------------
  |  Branch (845:25): [True: 22.5k, False: 1.13M]
  |  Branch (845:41): [True: 8.58k, False: 13.9k]
  ------------------
  846|  8.58k|                    {
  847|  8.58k|                        pAtList[length++] = num_atoms + (int) at[i].endpoint - 1;
  848|  8.58k|                    }
  849|  1.15M|                    pAtList[start] = length - start - 1;  /*  number of neighbors before the list of neighbors */
  850|  1.15M|                    pp[i] = pAtList + start;              /*  pointer to the <num.neigh.><list of neigh> */
  851|  1.15M|                }
  852|   298k|            }
  853|      0|            else
  854|      0|            {
  855|      0|                for (i = 0, length = 0; i < num_atoms; i++)
  ------------------
  |  Branch (855:41): [True: 0, False: 0]
  ------------------
  856|      0|                {
  857|      0|                    val = at[i].valence;
  858|      0|                    start = length++;
  859|      0|                    for (j = 0; j < val; j++)
  ------------------
  |  Branch (859:33): [True: 0, False: 0]
  ------------------
  860|      0|                    {
  861|      0|                        pAtList[length++] = at[i].neighbor[j]; /* djb-rwth: buffer overrun avoided implicitly */
  862|      0|                        if (bDoubleBondSquare && BOND_DOUBLE == at[i].bond_type[j])
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (862:29): [True: 0, False: 0]
  |  Branch (862:50): [True: 0, False: 0]
  ------------------
  863|      0|                        {
  864|      0|                            pAtList[length++] = at[i].neighbor[j]; /*  a list of neighbor orig. numbers */
  865|      0|                        }
  866|      0|                    }
  867|       |                    /*  Add endpoint */
  868|      0|                    if (num_t_groups && at[i].endpoint)
  ------------------
  |  Branch (868:25): [True: 0, False: 0]
  |  Branch (868:41): [True: 0, False: 0]
  ------------------
  869|      0|                    {
  870|      0|                        pAtList[length++] = num_atoms + (int) at[i].endpoint - 1;
  871|      0|                    }
  872|      0|                    pAtList[start] = length - start - 1;  /*  number of neighbors before the list of neighbors */
  873|      0|                    pp[i] = pAtList + start;              /*  pointer to the <num.neigh.><list of neigh> */
  874|      0|                }
  875|      0|            }
  876|       |
  877|       |            /*  Add t-groups */
  878|   302k|            for (i = 0; i < num_t_groups; i++)
  ------------------
  |  Branch (878:25): [True: 3.56k, False: 298k]
  ------------------
  879|  3.56k|            {
  880|  3.56k|                val = (int) t_group[i].nNumEndpoints;
  881|  3.56k|                start = length++;
  882|  3.56k|                nFirstEndpointAtNoPos = (int) t_group[i].nFirstEndpointAtNoPos;
  883|  12.1k|                for (j = 0; j < val; j++)
  ------------------
  |  Branch (883:29): [True: 8.58k, False: 3.56k]
  ------------------
  884|  8.58k|                {
  885|  8.58k|                    pAtList[length++] = nEndpointAtomNumber[nFirstEndpointAtNoPos + j];
  886|  8.58k|                }
  887|  3.56k|                pAtList[start] = length - start - 1;  /*  number of neighbors before the list of neighbors */
  888|  3.56k|                pp[num_atoms + i] = pAtList + start;    /*  pointer to the <num.neigh.><list of neigh> */
  889|  3.56k|            }
  890|   298k|        }
  891|      0|        else
  892|      0|        {
  893|      0|            inchi_free(pAtList); /* djb-rwth: fixing coverity ID #499598 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  894|      0|            inchi_free( pp );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  895|      0|            return NULL;
  896|      0|        }
  897|   298k|    } /* djb-rwth: ignoring LLVM warning */
  898|       |
  899|       |    /* djb-rwth: fixing coverity ID #499598 -- pp uses pAtList values */
  900|       |
  901|   298k|    return pp; /* djb-rwth: ignoring LLVM warning: since a pointer is returned, memory should be freed in a function which calls *CreateNeighList */
  902|   298k|}
FreeNeighList:
  907|  1.59M|{
  908|  1.59M|    if (pp)
  ------------------
  |  Branch (908:9): [True: 303k, False: 1.29M]
  ------------------
  909|   303k|    {
  910|   303k|        if (pp[0])
  ------------------
  |  Branch (910:13): [True: 303k, False: 0]
  ------------------
  911|   303k|        {
  912|   303k|            inchi_free( pp[0] );
  ------------------
  |  | 1152|   303k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 303k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 303k]
  |  |  ------------------
  ------------------
  913|   303k|        }
  914|   303k|        inchi_free( pp );
  ------------------
  |  | 1152|   303k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 303k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 303k]
  |  |  ------------------
  ------------------
  915|   303k|    }
  916|       |
  917|  1.59M|}
BreakAllTies:
  928|  4.02k|{
  929|  4.02k|    int i, nRet = -1, nNumRanks = 1 /* value does not matter*/;
  930|       |
  931|  4.02k|    AT_RANK *nPrevRank = *pRankStack++;
  932|  4.02k|    AT_RANK *nPrevAtomNumber = *pRankStack++;
  933|       |
  934|  4.02k|    AT_RANK *nNewRank = NULL;
  935|  4.02k|    AT_RANK *nNewAtomNumber = NULL;
  936|       |
  937|  4.02k|    if (!pRankStack[0])
  ------------------
  |  Branch (937:9): [True: 1.22k, False: 2.80k]
  ------------------
  938|  1.22k|    {
  939|  1.22k|        pRankStack[0] = (AT_RANK *) inchi_malloc( num_max * sizeof( *nNewRank ) );
  ------------------
  |  | 1143|  1.22k|#define inchi_malloc   malloc
  ------------------
  940|  1.22k|    }
  941|  4.02k|    if (!pRankStack[1])
  ------------------
  |  Branch (941:9): [True: 1.28k, False: 2.74k]
  ------------------
  942|  1.28k|    {
  943|  1.28k|        pRankStack[1] = (AT_RANK *) inchi_malloc( num_max * sizeof( *nNewAtomNumber ) );
  ------------------
  |  | 1143|  1.28k|#define inchi_malloc   malloc
  ------------------
  944|  1.28k|    }
  945|  4.02k|    if (!pRankStack[0] || !pRankStack[1])
  ------------------
  |  Branch (945:9): [True: 0, False: 4.02k]
  |  Branch (945:27): [True: 0, False: 4.02k]
  ------------------
  946|      0|    {
  947|      0|        return CT_OUT_OF_RAM;  /*   <BRKPT> */
  ------------------
  |  |   21|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  948|      0|    }
  949|  4.02k|    nNewRank = pRankStack[0];
  950|  4.02k|    nNewAtomNumber = pRankStack[1];
  951|       |
  952|  4.02k|    if (nNewRank && nNewAtomNumber)
  ------------------
  |  Branch (952:9): [True: 4.02k, False: 0]
  |  Branch (952:21): [True: 4.02k, False: 0]
  ------------------
  953|  4.02k|    {
  954|  4.02k|        memcpy(nNewAtomNumber, nPrevAtomNumber, num_atoms * sizeof(nNewAtomNumber[0]));
  955|  4.02k|        memcpy(nNewRank, nPrevRank, num_atoms * sizeof(nNewRank[0]));
  956|  23.9k|        for (i = 1, nRet = 0; i < num_atoms; i++)
  ------------------
  |  Branch (956:31): [True: 19.9k, False: 4.02k]
  ------------------
  957|  19.9k|        {
  958|       |            /*  12-12-2001: replaced Prev... with New... */
  959|  19.9k|            if (nNewRank[(int) nNewAtomNumber[i - 1]] == nNewRank[(int) nNewAtomNumber[i]])
  ------------------
  |  Branch (959:17): [True: 1.24k, False: 18.6k]
  ------------------
  960|  1.24k|            {
  961|  1.24k|                nNewRank[nNewAtomNumber[i - 1]] = (AT_RANK) i;
  962|  1.24k|                nNumRanks = DifferentiateRanks2( pCG, num_atoms, NeighList,
  963|  1.24k|                                                 nNumRanks, nNewRank, nTempRank,
  964|  1.24k|                                                 nNewAtomNumber,
  965|  1.24k|                                                 &pCS->lNumNeighListIter, 1 );
  966|  1.24k|                pCS->lNumBreakTies++;
  967|  1.24k|                nRet++;
  968|  1.24k|            }
  969|  19.9k|        }
  970|  4.02k|    }
  971|       |
  972|  4.02k|    return nRet;
  973|  4.02k|}

comp_AT_NUMB:
  106|  3.49k|{
  107|  3.49k|    return (int)(*(const AT_NUMB*)a1) - (int)(*(const AT_NUMB*)a2);
  108|  3.49k|}
dot_prod3:
  269|     10|{
  270|     10|    return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
  271|     10|}
cross_prod3:
  296|     10|{
  297|     10|    double tmp[3];
  298|       |
  299|     10|    tmp[0] = ( a[1] * b[2] - a[2] * b[1] );
  300|     10|    tmp[1] = -( a[0] * b[2] - a[2] * b[0] );
  301|     10|    tmp[2] = ( a[0] * b[1] - a[1] * b[0] );
  302|       |
  303|     10|    result[0] = tmp[0];
  304|     10|    result[1] = tmp[1];
  305|     10|    result[2] = tmp[2];
  306|       |
  307|     10|    return result;
  308|     10|}
bCanInpAtomBeAStereoCenter:
 1401|  2.18M|{
 1402|       |/*************************************************************************************
 1403|       | * current version
 1404|       | *************************************************************************************
 1405|       | *       Use #define to split the stereocenter description table into parts
 1406|       | *       to make it easier to read
 1407|       | *
 1408|       | *                      --------- 4 single bonds stereocenters -------
 1409|       | *                       0       1       2       3      4       5
 1410|       | *
 1411|       | *                       |       |       |       |      |       |
 1412|       | *                      -C-     -Si-    -Ge-    -Sn-   >As[+]  >B[-]
 1413|       | *                       |       |       |       |      |       |
 1414|       | */
 1415|  2.18M|#define SZELEM1         "C\000","Si",   "Ge",   "Sn",   "As", "B\000",
 1416|  2.18M|#define CCHARGE1         0,      0,      0,      0,      1,   -1,
 1417|  2.18M|#define CNUMBONDSANDH1   4,      4,      4,      4,      4,    4,
 1418|  2.18M|#define CCHEMVALENCEH1   4,      4,      4,      4,      4,    4,
 1419|  2.18M|#define CHAS3MEMBRING1   0,      0,      0,      0,      0,    0,
 1420|  2.18M|#define CREQUIRDNEIGH1   0,      0,      0,      0,      3,    0,
 1421|       |/*
 1422|       | *                      --------------- S, Se stereocenters ----------
 1423|       | *                       6       7       8       9      10     11    12    13
 1424|       | *
 1425|       | *                               |       |      ||             |     |     ||
 1426|       | *                      -S=     =S=     -S[+]   >S[+]   -Se=  =Se=  -Se[+] >Se[+]
 1427|       | *                       |       |       |       |       |     |     |      |
 1428|       | */
 1429|  2.18M|#define SZELEM2         "S\000","S\000","S\000","S\000","Se", "Se", "Se",  "Se",
 1430|  2.18M|#define CCHARGE2         0,      0,      1,      1,      0,    0,    1,     1,
 1431|  2.18M|#define CNUMBONDSANDH2   3,      4,      3,      4,      3,    4,    3,     4,
 1432|  2.18M|#define CCHEMVALENCEH2   4,      6,      3,      5,      4,    6,    3,     5,
 1433|  2.18M|#define CHAS3MEMBRING2   0,      0,      0,      0,      0,    0,    0,     0,
 1434|  2.18M|#define CREQUIRDNEIGH2   3,      3,      3,      3,      3,    3,    3,     3,
 1435|       |/*
 1436|       | *                      ------------------ N, P stereocenters -----------------
 1437|       | *                        14     15       16     17     18       19       20
 1438|       | *
 1439|       | *                                                             Phosphine Arsine
 1440|       | *                                      X---Y
 1441|       | *                        |      |       \ /     |       |       \ /      \ /
 1442|       | *                       =N-    >N[+]     N     >P[+]   =P-       P        As
 1443|       | *                        |      |        |      |       |        |        |
 1444|       | */
 1445|  2.18M|#define SZELEM3         "N\000","N\000","N\000","P\000","P\000","P\000", "As",
 1446|  2.18M|#define CCHARGE3         0,      1,      0,      1,      0,      0,       0,
 1447|  2.18M|#define CNUMBONDSANDH3   4,      4,      3,      4,      4,      3,       3,
 1448|  2.18M|#define CCHEMVALENCEH3   5,      4,      3,      4,      5,      3,       3,
 1449|  2.18M|#define CHAS3MEMBRING3   0,      0,      1,      0,      0,      0,       0,
 1450|  2.18M|#define CREQUIRDNEIGH3   3,      3,      1,      3,      3,      2,       2,
 1451|       |
 1452|  2.18M|#define PHOSPHINE_STEREO  19  /* the number must match Phosphine number in the comments, see above */
 1453|  2.18M|#define ARSINE_STEREO     20  /* the number must match Arsine number in the comments, see above */
 1454|       |
 1455|  2.18M|    static const char        szElem[][3] = { SZELEM1         SZELEM2         SZELEM3 };
  ------------------
  |  | 1415|  2.18M|#define SZELEM1         "C\000","Si",   "Ge",   "Sn",   "As", "B\000",
  ------------------
                  static const char        szElem[][3] = { SZELEM1         SZELEM2         SZELEM3 };
  ------------------
  |  | 1429|  2.18M|#define SZELEM2         "S\000","S\000","S\000","S\000","Se", "Se", "Se",  "Se",
  ------------------
                  static const char        szElem[][3] = { SZELEM1         SZELEM2         SZELEM3 };
  ------------------
  |  | 1445|  2.18M|#define SZELEM3         "N\000","N\000","N\000","P\000","P\000","P\000", "As",
  ------------------
 1456|  2.18M|    static const S_CHAR        cCharge[] = { CCHARGE1        CCHARGE2        CCHARGE3 };
  ------------------
  |  | 1416|  2.18M|#define CCHARGE1         0,      0,      0,      0,      1,   -1,
  ------------------
                  static const S_CHAR        cCharge[] = { CCHARGE1        CCHARGE2        CCHARGE3 };
  ------------------
  |  | 1430|  2.18M|#define CCHARGE2         0,      0,      1,      1,      0,    0,    1,     1,
  ------------------
                  static const S_CHAR        cCharge[] = { CCHARGE1        CCHARGE2        CCHARGE3 };
  ------------------
  |  | 1446|  2.18M|#define CCHARGE3         0,      1,      0,      1,      0,      0,       0,
  ------------------
 1457|  2.18M|    static const S_CHAR  cNumBondsAndH[] = { CNUMBONDSANDH1  CNUMBONDSANDH2  CNUMBONDSANDH3 };
  ------------------
  |  | 1417|  2.18M|#define CNUMBONDSANDH1   4,      4,      4,      4,      4,    4,
  ------------------
                  static const S_CHAR  cNumBondsAndH[] = { CNUMBONDSANDH1  CNUMBONDSANDH2  CNUMBONDSANDH3 };
  ------------------
  |  | 1431|  2.18M|#define CNUMBONDSANDH2   3,      4,      3,      4,      3,    4,    3,     4,
  ------------------
                  static const S_CHAR  cNumBondsAndH[] = { CNUMBONDSANDH1  CNUMBONDSANDH2  CNUMBONDSANDH3 };
  ------------------
  |  | 1447|  2.18M|#define CNUMBONDSANDH3   4,      4,      3,      4,      4,      3,       3,
  ------------------
 1458|  2.18M|    static const S_CHAR  cChemValenceH[] = { CCHEMVALENCEH1  CCHEMVALENCEH2  CCHEMVALENCEH3 };
  ------------------
  |  | 1418|  2.18M|#define CCHEMVALENCEH1   4,      4,      4,      4,      4,    4,
  ------------------
                  static const S_CHAR  cChemValenceH[] = { CCHEMVALENCEH1  CCHEMVALENCEH2  CCHEMVALENCEH3 };
  ------------------
  |  | 1432|  2.18M|#define CCHEMVALENCEH2   4,      6,      3,      5,      4,    6,    3,     5,
  ------------------
                  static const S_CHAR  cChemValenceH[] = { CCHEMVALENCEH1  CCHEMVALENCEH2  CCHEMVALENCEH3 };
  ------------------
  |  | 1448|  2.18M|#define CCHEMVALENCEH3   5,      4,      3,      4,      5,      3,       3,
  ------------------
 1459|  2.18M|    static const S_CHAR  cHas3MembRing[] = { CHAS3MEMBRING1  CHAS3MEMBRING2  CHAS3MEMBRING3 };
  ------------------
  |  | 1419|  2.18M|#define CHAS3MEMBRING1   0,      0,      0,      0,      0,    0,
  ------------------
                  static const S_CHAR  cHas3MembRing[] = { CHAS3MEMBRING1  CHAS3MEMBRING2  CHAS3MEMBRING3 };
  ------------------
  |  | 1433|  2.18M|#define CHAS3MEMBRING2   0,      0,      0,      0,      0,    0,    0,     0,
  ------------------
                  static const S_CHAR  cHas3MembRing[] = { CHAS3MEMBRING1  CHAS3MEMBRING2  CHAS3MEMBRING3 };
  ------------------
  |  | 1449|  2.18M|#define CHAS3MEMBRING3   0,      0,      1,      0,      0,      0,       0,
  ------------------
 1460|  2.18M|    static const S_CHAR  cRequirdNeigh[] = { CREQUIRDNEIGH1  CREQUIRDNEIGH2  CREQUIRDNEIGH3 };
  ------------------
  |  | 1420|  2.18M|#define CREQUIRDNEIGH1   0,      0,      0,      0,      3,    0,
  ------------------
                  static const S_CHAR  cRequirdNeigh[] = { CREQUIRDNEIGH1  CREQUIRDNEIGH2  CREQUIRDNEIGH3 };
  ------------------
  |  | 1434|  2.18M|#define CREQUIRDNEIGH2   3,      3,      3,      3,      3,    3,    3,     3,
  ------------------
                  static const S_CHAR  cRequirdNeigh[] = { CREQUIRDNEIGH1  CREQUIRDNEIGH2  CREQUIRDNEIGH3 };
  ------------------
  |  | 1450|  2.18M|#define CREQUIRDNEIGH3   3,      3,      1,      3,      3,      2,       2,
  ------------------
 1461|       |
 1462|  2.18M|    static const int n = sizeof( szElem ) / sizeof( szElem[0] );
 1463|       |    /* reqired neighbor types (bitmap):
 1464|       |       0 => check bonds only
 1465|       |       1 => no terminal hydrogen atom neighbors
 1466|       |       2 => no terminal -X and -XH together (don't care the bond type, charge, radical)
 1467|       |            (X = tautomeric endpoint atom)
 1468|       |       Note: whenever cChemValenceH[] > cNumBondsAndH[]
 1469|       |             the tautomeric and/or alternating bonds
 1470|       |             are permitted
 1471|       |
 1472|       |    */
 1473|  2.18M|    int i, ret = 0;
 1474|  47.9M|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (1474:17): [True: 45.8M, False: 2.16M]
  ------------------
 1475|  45.8M|    {
 1476|  45.8M|        if (!strcmp( at[cur_at].elname, szElem[i] ) &&
  ------------------
  |  Branch (1476:13): [True: 1.46M, False: 44.3M]
  ------------------
 1477|  1.46M|            ( at[cur_at].charge == cCharge[i]
  ------------------
  |  Branch (1477:13): [True: 809k, False: 659k]
  ------------------
 1478|       |#ifdef ALLOW_NO_CHARGE_ON_STEREO_CENTERS
 1479|       |              || at[cur_at].charge == 0
 1480|       |#endif
 1481|  1.46M|              ) &&
 1482|   809k|              ( !at[cur_at].radical || at[cur_at].radical == 1 ) &&
  ------------------
  |  Branch (1482:17): [True: 772k, False: 36.2k]
  |  Branch (1482:40): [True: 0, False: 36.2k]
  ------------------
 1483|   772k|             at[cur_at].valence + at[cur_at].num_H == cNumBondsAndH[i] &&
  ------------------
  |  Branch (1483:14): [True: 43.4k, False: 729k]
  ------------------
 1484|  43.4k|             at[cur_at].chem_bonds_valence + at[cur_at].num_H == cChemValenceH[i] &&
  ------------------
  |  Branch (1484:14): [True: 26.7k, False: 16.7k]
  ------------------
 1485|  26.7k|             ( cHas3MembRing[i] ? is_atom_in_3memb_ring( at, cur_at ) : 1 ) &&
  ------------------
  |  Branch (1485:14): [True: 22.6k, False: 4.04k]
  |  Branch (1485:16): [True: 7.90k, False: 18.8k]
  ------------------
 1486|  22.6k|             bInpAtomHasRequirdNeigh( at, cur_at, cRequirdNeigh[i], cChemValenceH[i] - cNumBondsAndH[i], bStereoAtZz ))
  ------------------
  |  Branch (1486:14): [True: 18.4k, False: 4.21k]
  ------------------
 1487|       |            /*
 1488|       |            if (!strcmp( at[cur_at].elname, szElem[i] ) &&
 1489|       |             at[cur_at].charge == cCharge[i] &&
 1490|       |             ( !at[cur_at].radical || at[cur_at].radical == 1 ) &&
 1491|       |             at[cur_at].valence + at[cur_at].num_H == cNumBondsAndH[i] &&
 1492|       |             at[cur_at].chem_bonds_valence + at[cur_at].num_H == cChemValenceH[i] &&
 1493|       |             ( cHas3MembRing[i] ? is_atom_in_3memb_ring( at, cur_at ) : 1 ) &&
 1494|       |             bInpAtomHasRequirdNeigh( at, cur_at, cRequirdNeigh[i], cChemValenceH[i] - cNumBondsAndH[i], bStereoAtZz ))*/
 1495|  18.4k|        {
 1496|  18.4k|            ret = cNumBondsAndH[i];
 1497|  18.4k|            break;
 1498|  18.4k|        }
 1499|  45.8M|    }
 1500|       |
 1501|  2.18M|    if (i == PHOSPHINE_STEREO && !( bPointedEdgeStereo & PES_BIT_PHOSPHINE_STEREO ))
  ------------------
  |  | 1452|  4.37M|#define PHOSPHINE_STEREO  19  /* the number must match Phosphine number in the comments, see above */
  ------------------
                  if (i == PHOSPHINE_STEREO && !( bPointedEdgeStereo & PES_BIT_PHOSPHINE_STEREO ))
  ------------------
  |  |   45|  1.26k|#define PES_BIT_PHOSPHINE_STEREO     2
  ------------------
  |  Branch (1501:9): [True: 1.26k, False: 2.18M]
  |  Branch (1501:34): [True: 892, False: 377]
  ------------------
 1502|    892|    {
 1503|    892|        ret = 0;
 1504|    892|    }
 1505|  2.18M|    if (i == ARSINE_STEREO && !( bPointedEdgeStereo & PES_BIT_ARSINE_STEREO ))
  ------------------
  |  | 1453|  4.37M|#define ARSINE_STEREO     20  /* the number must match Arsine number in the comments, see above */
  ------------------
                  if (i == ARSINE_STEREO && !( bPointedEdgeStereo & PES_BIT_ARSINE_STEREO ))
  ------------------
  |  |   46|    440|#define PES_BIT_ARSINE_STEREO        4
  ------------------
  |  Branch (1505:9): [True: 440, False: 2.18M]
  |  Branch (1505:31): [True: 434, False: 6]
  ------------------
 1506|    434|    {
 1507|    434|        ret = 0;
 1508|    434|    }
 1509|       |
 1510|  2.18M|    return ret;
 1511|  2.18M|}
bAtomHasValence3:
 1540|  4.16k|{
 1541|  4.16k|    static const char   szElem[][3] = { "N\000" };
 1542|  4.16k|    static const S_CHAR   cCharge[] = { 0, };
 1543|  4.16k|    int i, ret = 0;
 1544|  4.66k|    for (i = 0; i < (int) ( sizeof( szElem ) / sizeof( szElem[0] ) ); i++)
  ------------------
  |  Branch (1544:17): [True: 4.16k, False: 504]
  ------------------
 1545|  4.16k|    {
 1546|  4.16k|        if (!strcmp( elname, szElem[i] ) && ( charge == cCharge[i] ))
  ------------------
  |  Branch (1546:13): [True: 3.92k, False: 241]
  |  Branch (1546:45): [True: 3.66k, False: 263]
  ------------------
 1547|  3.66k|        {
 1548|  3.66k|            ret = ( !radical || radical == RADICAL_SINGLET );
  ------------------
  |  |   75|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (1548:21): [True: 3.66k, False: 0]
  |  Branch (1548:33): [True: 0, False: 0]
  ------------------
 1549|  3.66k|            break;
 1550|  3.66k|        }
 1551|  4.16k|    }
 1552|  4.16k|    return ret;
 1553|  4.16k|}
bCanAtomHaveAStereoBond:
 1560|   330k|{
 1561|   330k|    static const char   szElem[][3] = { "C\000", "Si", "Ge", "N\000", "N\000" };
 1562|   330k|    static const S_CHAR   cCharge[] = { 0,        0,    0,   0,       1, };
 1563|   330k|    static const int       n = sizeof( szElem ) / sizeof( szElem[0] );
 1564|   330k|    int i, ret = 0;
 1565|  1.57M|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (1565:17): [True: 1.38M, False: 181k]
  ------------------
 1566|  1.38M|    {
 1567|  1.38M|        if (!strcmp( elname, szElem[i] ) && ( charge == cCharge[i] ))
  ------------------
  |  Branch (1567:13): [True: 188k, False: 1.20M]
  |  Branch (1567:45): [True: 148k, False: 39.3k]
  ------------------
 1568|   148k|        {
 1569|   148k|            ret = ( !radical || radical == RADICAL_SINGLET );
  ------------------
  |  |   75|  7.27k|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (1569:21): [True: 141k, False: 7.27k]
  |  Branch (1569:33): [True: 0, False: 7.27k]
  ------------------
 1570|   148k|            break;
 1571|   148k|        }
 1572|  1.38M|    }
 1573|   330k|    return ret;
 1574|   330k|}
bCanAtomBeMiddleAllene:
 1581|  1.62k|{
 1582|  1.62k|    static const char   szElem[][3] = { "C\000", "Si", "Ge", };
 1583|  1.62k|    static const S_CHAR   cCharge[] = { 0,        0,    0, };
 1584|  1.62k|    static const int       n = sizeof( szElem ) / sizeof( szElem[0] );
 1585|  1.62k|    int i, ret = 0;
 1586|  2.71k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (1586:17): [True: 2.45k, False: 252]
  ------------------
 1587|  2.45k|    {
 1588|  2.45k|        if (!strcmp( elname, szElem[i] ) && ( charge == cCharge[i] ))
  ------------------
  |  Branch (1588:13): [True: 1.37k, False: 1.08k]
  |  Branch (1588:45): [True: 1.37k, False: 0]
  ------------------
 1589|  1.37k|        {
 1590|  1.37k|            ret = ( !radical || radical == RADICAL_SINGLET );
  ------------------
  |  |   75|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (1590:21): [True: 1.37k, False: 0]
  |  Branch (1590:33): [True: 0, False: 0]
  ------------------
 1591|  1.37k|            break;
 1592|  1.37k|        }
 1593|  2.45k|    }
 1594|  1.62k|    return ret;
 1595|  1.62k|}
bCanAtomBeTerminalAllene:
 1671|  24.0k|{
 1672|  24.0k|    static const char   szElem[][3] = { "C\000", "Si", "Ge", };
 1673|  24.0k|    static const S_CHAR   cCharge[] = { 0,        0,    0, };
 1674|  24.0k|    static const int       n = sizeof( szElem ) / sizeof( szElem[0] );
 1675|  24.0k|    int i, ret = 0;
 1676|  82.1k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (1676:17): [True: 62.8k, False: 19.2k]
  ------------------
 1677|  62.8k|    {
 1678|  62.8k|        if (!strcmp( elname, szElem[i] ) && ( charge == cCharge[i] ))
  ------------------
  |  Branch (1678:13): [True: 4.86k, False: 58.0k]
  |  Branch (1678:45): [True: 4.80k, False: 65]
  ------------------
 1679|  4.80k|        {
 1680|  4.80k|            ret = ( !radical || radical == RADICAL_SINGLET );
  ------------------
  |  |   75|     24|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (1680:21): [True: 4.77k, False: 24]
  |  Branch (1680:33): [True: 0, False: 24]
  ------------------
 1681|  4.80k|            break;
 1682|  4.80k|        }
 1683|  62.8k|    }
 1684|       |
 1685|  24.0k|    return ret;
 1686|  24.0k|}
GetHalfStereobond0DParity:
 1696|  1.02k|{
 1697|  1.02k|    int m, last_parity, cur_parity;
 1698|  1.02k|    int i, icur2nxt, icur2neigh, cur_order_parity, nxt_at;
 1699|  1.02k|    AT_NUMB nNextSbAtOrigNumb;
 1700|       |    /* find atom parities for all valid streobonds incident to at[cur_at] */
 1701|  2.13k|    for (m = 0, last_parity = 0; m < MAX_NUM_STEREO_BONDS && at[cur_at].sb_parity[m]; m++)
  ------------------
  |  |  873|  4.27k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1701:34): [True: 2.13k, False: 8]
  |  Branch (1701:62): [True: 1.11k, False: 1.01k]
  ------------------
 1702|  1.11k|    {
 1703|  1.11k|        icur2nxt = icur2neigh = -1; /* ordering number of neighbors in nSbNeighOrigAtNumb[] */
 1704|  1.11k|        cur_parity = 0;             /* parity for mth stereobond incident to the cur_at */
 1705|  1.11k|        nxt_at = at[cur_at].neighbor[(int)at[cur_at].sb_ord[m]]; /* djb-rwth: fixing coverity ID #499549 */
 1706|  1.11k|        if (0 <= at[cur_at].sb_ord[m] && at[cur_at].sb_ord[m] < at[cur_at].valence &&
  ------------------
  |  Branch (1706:13): [True: 1.11k, False: 0]
  |  Branch (1706:42): [True: 1.11k, False: 0]
  ------------------
 1707|  1.11k|             at[nxt_at].valence <= MAX_NUM_STEREO_BONDS && /* make sure it is a valid stereobond */
  ------------------
  |  |  873|  2.23k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1707:14): [True: 1.11k, False: 0]
  ------------------
 1708|  1.11k|             ( nNextSbAtOrigNumb = at[nxt_at].orig_at_number ))
  ------------------
  |  Branch (1708:14): [True: 1.11k, False: 0]
  ------------------
 1709|  1.11k|        {
 1710|       |            /* since at[cur_at].sn_ord[m] = -1 for explicit H use at[cur_at].sn_orig_at_num[m] */
 1711|  3.51k|            for (i = 0; i < nNumExplictAttachments; i++)
  ------------------
  |  Branch (1711:25): [True: 2.39k, False: 1.11k]
  ------------------
 1712|  2.39k|            {
 1713|  2.39k|                if (at[cur_at].sn_orig_at_num[m] == nSbNeighOrigAtNumb[i])
  ------------------
  |  Branch (1713:21): [True: 1.11k, False: 1.27k]
  ------------------
 1714|  1.11k|                {
 1715|  1.11k|                    icur2neigh = i; /* neighbor */
 1716|  1.11k|                }
 1717|  1.27k|                else
 1718|  1.27k|                {
 1719|  1.27k|                    if (nNextSbAtOrigNumb == nSbNeighOrigAtNumb[i])
  ------------------
  |  Branch (1719:25): [True: 1.11k, False: 157]
  ------------------
 1720|  1.11k|                    {
 1721|  1.11k|                        icur2nxt = i; /* atom connected by a stereobond */
 1722|  1.11k|                    }
 1723|  1.27k|                }
 1724|  2.39k|            }
 1725|  1.11k|            if (icur2neigh >= 0 && icur2nxt >= 0)
  ------------------
  |  Branch (1725:17): [True: 1.11k, False: 0]
  |  Branch (1725:36): [True: 1.11k, False: 0]
  ------------------
 1726|  1.11k|            {
 1727|  1.11k|                if (ATOM_PARITY_WELL_DEF( at[cur_at].sb_parity[m] ))
  ------------------
  |  |  259|  1.11k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  1.11k|#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)
  |  |  ------------------
  |  |  |  |  236|  1.11k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 1.11k, False: 0]
  |  |  |  Branch (259:75): [True: 889, False: 229]
  |  |  ------------------
  ------------------
 1728|    889|                {
 1729|       |                    /* parity of at[cur_atom] neighbor permutation to reach this order: { next_atom, neigh_atom, ...} */
 1730|    889|                    cur_order_parity = ( icur2nxt + icur2neigh + ( icur2nxt > icur2neigh ) - 1 ) % 2;
 1731|    889|                    cur_parity = 2 - ( cur_order_parity + at[cur_at].sb_parity[m] ) % 2;
 1732|    889|                }
 1733|    229|                else
 1734|    229|                {
 1735|       |                             /* unknowm/undef parities do not depend on the neighbor order */
 1736|    229|                    cur_parity = at[cur_at].sb_parity[m];
 1737|    229|                }
 1738|  1.11k|            }
 1739|  1.11k|        }
 1740|      0|        else
 1741|      0|        {
 1742|      0|            continue;
 1743|      0|        }
 1744|       |        /* use a well-known parity if available; if not then use preferably the unknown */
 1745|  1.11k|        if (!last_parity)
  ------------------
  |  Branch (1745:13): [True: 1.02k, False: 91]
  ------------------
 1746|  1.02k|        {
 1747|  1.02k|            last_parity = cur_parity;
 1748|  1.02k|        }
 1749|     91|        else
 1750|     91|        {
 1751|     91|            if (last_parity != cur_parity && cur_parity)
  ------------------
  |  Branch (1751:17): [True: 31, False: 60]
  |  Branch (1751:46): [True: 31, False: 0]
  ------------------
 1752|     31|            {
 1753|     31|                if (ATOM_PARITY_WELL_DEF( last_parity ))
  ------------------
  |  |  259|     31|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|     31|#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)
  |  |  ------------------
  |  |  |  |  236|     31|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 31, False: 0]
  |  |  |  Branch (259:75): [True: 15, False: 16]
  |  |  ------------------
  ------------------
 1754|     15|                {
 1755|     15|                    if (ATOM_PARITY_WELL_DEF( cur_parity ))
  ------------------
  |  |  259|     15|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|     15|#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)
  |  |  ------------------
  |  |  |  |  236|     15|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 15, False: 0]
  |  |  |  Branch (259:75): [True: 6, False: 9]
  |  |  ------------------
  ------------------
 1756|      6|                    {
 1757|      6|                        last_parity = 0; /* error: all well-defined parities should be same */
 1758|      6|                        break;
 1759|      6|                    }
 1760|     15|                }
 1761|     16|                else
 1762|     16|                {
 1763|     16|                    if (ATOM_PARITY_WELL_DEF( cur_parity ))
  ------------------
  |  |  259|     16|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|     16|#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)
  |  |  ------------------
  |  |  |  |  236|     16|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 16, False: 0]
  |  |  |  Branch (259:75): [True: 15, False: 1]
  |  |  ------------------
  ------------------
 1764|     15|                    {
 1765|       |                        /* replace unknown/undefined parity with well-known */
 1766|     15|                        last_parity = cur_parity;
 1767|     15|                    }
 1768|      1|                    else
 1769|      1|                    {
 1770|       |                        /* select min unknown/undefined parity (out of AB_PARITY_UNKN and AB_PARITY_UNDF) */
 1771|      1|                        last_parity = inchi_min( cur_parity, last_parity );
  ------------------
  |  |  139|      1|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1772|      1|                    }
 1773|     16|                }
 1774|     31|            }
 1775|     91|        }
 1776|  1.11k|    }
 1777|       |
 1778|  1.02k|    if (last_parity)
  ------------------
  |  Branch (1778:9): [True: 1.02k, False: 6]
  ------------------
 1779|  1.02k|    {
 1780|  1.02k|        bond_parity = last_parity;
 1781|  1.02k|        at[cur_at].bUsed0DParity |= nFlag; /* set flag: used stereobond 0D parity */
 1782|  1.02k|    }
 1783|       |
 1784|  1.02k|    return bond_parity;
 1785|  1.02k|}
FixSb0DParities:
 1801|    682|{
 1802|    682|    int k, parity1, parity2, abs_parity1, abs_parity2;
 1803|    682|    int j1, j2, parity_sign;
 1804|       |    /*
 1805|       |    AT_NUMB nSbNeighOrigAtNumb1[MAX_NUM_STEREO_BOND_NEIGH], nSbNeighOrigAtNumb2[MAX_NUM_STEREO_BOND_NEIGH];
 1806|       |    int     nNumExplictAttachments1, nNumExplictAttachments2;
 1807|       |    */
 1808|    682|    parity1 = parity2 = AB_PARITY_NONE;
  ------------------
  |  |  218|    682|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
 1809|    682|    j1 = j2 = -1;
 1810|    682|    parity_sign = ( *pparity1 < 0 || *pparity2 < 0 ) ? -1 : 1;
  ------------------
  |  Branch (1810:21): [True: 8, False: 674]
  |  Branch (1810:38): [True: 0, False: 674]
  ------------------
 1811|       |
 1812|    682|    abs_parity1 = abs( *pparity1 );
 1813|    682|    abs_parity2 = abs( *pparity2 );
 1814|       |
 1815|  1.17k|    for (k = 0; k < MAX_NUM_STEREO_BONDS && at[at_1].sb_parity[k]; k++)
  ------------------
  |  |  873|  2.35k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1815:17): [True: 1.17k, False: 0]
  |  Branch (1815:45): [True: 494, False: 682]
  ------------------
 1816|    494|    {
 1817|    494|        if (at[at_1].sb_ord[k] == i_next_at_1)
  ------------------
  |  Branch (1817:13): [True: 349, False: 145]
  ------------------
 1818|    349|        {
 1819|    349|            parity1 = at[at_1].sb_parity[k];
 1820|    349|            j1 = k;
 1821|    349|        }
 1822|    494|    }
 1823|  1.31k|    for (k = 0; k < MAX_NUM_STEREO_BONDS && at[at_2].sb_parity[k]; k++)
  ------------------
  |  |  873|  2.63k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1823:17): [True: 1.31k, False: 8]
  |  Branch (1823:45): [True: 637, False: 674]
  ------------------
 1824|    637|    {
 1825|    637|        if (at[at_2].sb_ord[k] == i_next_at_2)
  ------------------
  |  Branch (1825:13): [True: 349, False: 288]
  ------------------
 1826|    349|        {
 1827|    349|            parity2 = at[at_2].sb_parity[k];
 1828|    349|            j2 = k;
 1829|    349|        }
 1830|    637|    }
 1831|    682|    switch (( j1 >= 0 ) + 2 * ( j2 >= 0 ))
  ------------------
  |  Branch (1831:13): [True: 682, False: 0]
  ------------------
 1832|    682|    {
 1833|    333|        case 0:
  ------------------
  |  Branch (1833:9): [True: 333, False: 349]
  ------------------
 1834|       |            /* the bond has no 0D parity */
 1835|    333|            *pparity1 = *pparity2 = parity_sign * AB_PARITY_UNDF;
  ------------------
  |  |  222|    333|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 1836|    333|            return 0;
 1837|      0|        case 1:
  ------------------
  |  Branch (1837:9): [True: 0, False: 682]
  ------------------
 1838|      0|        case 2:
  ------------------
  |  Branch (1838:9): [True: 0, False: 682]
  ------------------
 1839|       |            /* 0D parity data error */
 1840|      0|            *pparity1 = *pparity2 = AB_PARITY_NONE;
  ------------------
  |  |  218|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
 1841|      0|            return -1;
 1842|    349|        case 3:
  ------------------
  |  Branch (1842:9): [True: 349, False: 333]
  ------------------
 1843|       |            /* the bond has 0D parity */
 1844|    349|            switch (!( ATOM_PARITY_WELL_DEF( abs_parity1 ) && ATOM_PARITY_WELL_DEF( parity1 ) ) +
  ------------------
  |  |  259|    698|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    349|#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)
  |  |  ------------------
  |  |  |  |  236|    349|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 349, False: 0]
  |  |  |  Branch (259:75): [True: 270, False: 79]
  |  |  ------------------
  ------------------
                          switch (!( ATOM_PARITY_WELL_DEF( abs_parity1 ) && ATOM_PARITY_WELL_DEF( parity1 ) ) +
  ------------------
  |  |  259|    270|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    270|#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)
  |  |  ------------------
  |  |  |  |  236|    270|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 270, False: 0]
  |  |  |  Branch (259:75): [True: 264, False: 6]
  |  |  ------------------
  ------------------
  |  Branch (1844:21): [True: 349, False: 0]
  ------------------
 1845|    349|                     2 * !( ATOM_PARITY_WELL_DEF( abs_parity2 ) && ATOM_PARITY_WELL_DEF( parity2 ) ))
  ------------------
  |  |  259|    698|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    349|#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)
  |  |  ------------------
  |  |  |  |  236|    349|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 349, False: 0]
  |  |  |  Branch (259:75): [True: 267, False: 82]
  |  |  ------------------
  ------------------
                                   2 * !( ATOM_PARITY_WELL_DEF( abs_parity2 ) && ATOM_PARITY_WELL_DEF( parity2 ) ))
  ------------------
  |  |  259|    267|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    267|#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)
  |  |  ------------------
  |  |  |  |  236|    267|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 267, False: 0]
  |  |  |  Branch (259:75): [True: 263, False: 4]
  |  |  ------------------
  ------------------
 1846|    349|            {
 1847|    257|                case 0:
  ------------------
  |  Branch (1847:17): [True: 257, False: 92]
  ------------------
 1848|       |                    /* both parities are well-defined; continue */
 1849|    257|                    break;
 1850|      6|                case 1:
  ------------------
  |  Branch (1850:17): [True: 6, False: 343]
  ------------------
 1851|       |                    /* 0D parity not well-defined for at_1 */
 1852|      6|                    *pparity1 = parity_sign * ( ATOM_PARITY_WELL_DEF( parity1 ) ? abs_parity1 :
  ------------------
  |  |  259|      6|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      6|#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)
  |  |  ------------------
  |  |  |  |  236|      6|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 6, False: 0]
  |  |  |  Branch (259:75): [True: 6, False: 0]
  |  |  ------------------
  ------------------
 1853|      6|                                               ATOM_PARITY_WELL_DEF( abs_parity1 ) ? parity1 :
  ------------------
  |  |  259|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      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)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 0, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1854|      0|                                               inchi_min( abs_parity1, parity1 ) );
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1855|      6|                    *pparity2 = parity_sign * abs_parity2;
 1856|      6|                    return -1;
 1857|      7|                case 2:
  ------------------
  |  Branch (1857:17): [True: 7, False: 342]
  ------------------
 1858|       |                    /* 0D parity not well-defined for at_2 */
 1859|      7|                    *pparity1 = parity_sign * abs_parity1;
 1860|      7|                    *pparity2 = parity_sign * ( ATOM_PARITY_WELL_DEF( parity2 ) ? abs_parity2 :
  ------------------
  |  |  259|      7|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      7|#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)
  |  |  ------------------
  |  |  |  |  236|      7|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 7, False: 0]
  |  |  |  Branch (259:75): [True: 7, False: 0]
  |  |  ------------------
  ------------------
 1861|      7|                                               ATOM_PARITY_WELL_DEF( abs_parity2 ) ? parity2 :
  ------------------
  |  |  259|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      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)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 0, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1862|      0|                                               inchi_min( abs_parity2, parity2 ) );
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1863|      7|                    return -1;
 1864|     79|                case 3:
  ------------------
  |  Branch (1864:17): [True: 79, False: 270]
  ------------------
 1865|     79|                    abs_parity1 = ( ATOM_PARITY_WELL_DEF( parity1 ) ? abs_parity1 :
  ------------------
  |  |  259|     79|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|     79|#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)
  |  |  ------------------
  |  |  |  |  236|     79|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 79, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 79]
  |  |  ------------------
  ------------------
 1866|     79|                                    ATOM_PARITY_WELL_DEF( abs_parity1 ) ? parity1 :
  ------------------
  |  |  259|     79|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|     79|#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)
  |  |  ------------------
  |  |  |  |  236|     79|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 79, False: 0]
  |  |  |  Branch (259:75): [True: 6, False: 73]
  |  |  ------------------
  ------------------
 1867|     79|                                    inchi_min( abs_parity1, parity1 ) );
  ------------------
  |  |  139|     73|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 73]
  |  |  ------------------
  ------------------
 1868|     79|                    abs_parity2 = ( ATOM_PARITY_WELL_DEF( parity2 ) ? abs_parity2 :
  ------------------
  |  |  259|     79|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|     79|#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)
  |  |  ------------------
  |  |  |  |  236|     79|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 79, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 79]
  |  |  ------------------
  ------------------
 1869|     79|                                    ATOM_PARITY_WELL_DEF( abs_parity2 ) ? parity2 :
  ------------------
  |  |  259|     79|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|     79|#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)
  |  |  ------------------
  |  |  |  |  236|     79|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 79, False: 0]
  |  |  |  Branch (259:75): [True: 4, False: 75]
  |  |  ------------------
  ------------------
 1870|     79|                                    inchi_min( abs_parity2, parity2 ) );
  ------------------
  |  |  139|     75|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 75]
  |  |  ------------------
  ------------------
 1871|     79|                    *pparity1 = *pparity2 = parity_sign * inchi_min( abs_parity1, abs_parity2 );
  ------------------
  |  |  139|     79|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 79]
  |  |  ------------------
  ------------------
 1872|       |                    /*return (parity1 == parity2)? 0 : -1;*/
 1873|     79|                    return -1;
 1874|    349|            }
 1875|    257|            break;
 1876|    682|    }
 1877|       |    /* we are here if both end-atoms of the bond have well-defined 0D parities */
 1878|       |    /*
 1879|       |    nNumExplictAttachments1 = GetSbNeighOrigAtNumb( at, at_1, at_removed_H, num_removed_H, nSbNeighOrigAtNumb1 );
 1880|       |    nNumExplictAttachments2 = GetSbNeighOrigAtNumb( at, at_2, at_removed_H, num_removed_H, nSbNeighOrigAtNumb2 );
 1881|       |    parity1 = GetHalfStereobond0DParity( at, at_1, nSbNeighOrigAtNumb1, nNumExplictAttachments1, *pparity1, 0 );
 1882|       |    parity2 = GetHalfStereobond0DParity( at, at_2, nSbNeighOrigAtNumb2, nNumExplictAttachments2, *pparity2, 0 );
 1883|       |    */
 1884|    257|    *pparity1 = parity_sign * abs_parity1;
 1885|    257|    *pparity2 = parity_sign * abs_parity2;
 1886|       |
 1887|    257|    if (chain_length % 2)
  ------------------
  |  Branch (1887:9): [True: 10, False: 247]
  ------------------
 1888|     10|    {
 1889|       |        /* allene; chain_length = (number of double bonds) - 1 */
 1890|       |        /*
 1891|       |        int zer1 = ( !z_dir1[0] && !z_dir1[1] && !z_dir1[2] );
 1892|       |        int zer2 = ( !z_dir2[0] && !z_dir2[1] && !z_dir2[2] );
 1893|       |        */
 1894|     10|        int bWrong_z_dir1 = ( 0 != ( at[at_1].bUsed0DParity & FlagSB_0D ) );
  ------------------
  |  |   60|     10|#define FlagSB_0D 2 /**< bUsed0DParity */
  ------------------
 1895|     10|        int bWrong_z_dir2 = ( 0 != ( at[at_2].bUsed0DParity & FlagSB_0D ) );
  ------------------
  |  |   60|     10|#define FlagSB_0D 2 /**< bUsed0DParity */
  ------------------
 1896|       |
 1897|     10|        if (bWrong_z_dir1 && bWrong_z_dir2)
  ------------------
  |  Branch (1897:13): [True: 10, False: 0]
  |  Branch (1897:30): [True: 10, False: 0]
  ------------------
 1898|     10|        {
 1899|     10|            goto set_default;
 1900|     10|        }
 1901|      0|        else
 1902|      0|        {
 1903|      0|            if (bWrong_z_dir1 || bWrong_z_dir2)
  ------------------
  |  Branch (1903:17): [True: 0, False: 0]
  |  Branch (1903:34): [True: 0, False: 0]
  ------------------
 1904|      0|            {
 1905|      0|                double r12[3], zi1[3], zi2[3], abs_r12, abs_zi2;
 1906|      0|                int    at_i1, at_i2, j; /* djb-rwth: ignoring LLVM warning: variables used */
 1907|      0|                S_CHAR   z_dir[3];
 1908|      0|                r12[0] = at[at_2].x - at[at_1].x;
 1909|      0|                r12[1] = at[at_2].y - at[at_1].y;
 1910|      0|                r12[2] = at[at_2].z - at[at_1].z;
 1911|      0|                abs_r12 = len3( r12 );
 1912|      0|                if (abs_r12 < MIN_BOND_LEN)
  ------------------
  |  |   39|      0|#define MIN_BOND_LEN          0.000001
  ------------------
  |  Branch (1912:21): [True: 0, False: 0]
  ------------------
 1913|      0|                {
 1914|      0|                    goto set_default;
 1915|      0|                }
 1916|       |                /* make r12[] point to the atom with 'good' z_dir[] */
 1917|      0|                if (bWrong_z_dir1)
  ------------------
  |  Branch (1917:21): [True: 0, False: 0]
  ------------------
 1918|      0|                {
 1919|      0|                    at_i1 = at_2; /* has good z_dir2[] */ /* djb-rwth: ignoring LLVM warning: variable used */
 1920|      0|                    at_i2 = at_1; /* has bad  z_dir1[] */ /* djb-rwth: ignoring LLVM warning: variable used */
 1921|      0|                    zi1[0] = z_dir2[0];
 1922|      0|                    zi1[1] = z_dir2[1];
 1923|      0|                    zi1[2] = z_dir2[2];
 1924|      0|                    mult3( r12, 1.0 / abs_r12, r12 ); /* make length = 1 */
 1925|      0|                }
 1926|      0|                else
 1927|      0|                {
 1928|      0|                    at_i1 = at_1; /* has good z_dir1[] */ /* djb-rwth: ignoring LLVM warning: variable used */
 1929|      0|                    at_i2 = at_2; /* has bad  z_dir2[] */ /* djb-rwth: ignoring LLVM warning: variable used */
 1930|      0|                    zi1[0] = z_dir1[0];
 1931|      0|                    zi1[1] = z_dir1[1];
 1932|      0|                    zi1[2] = z_dir1[2];
 1933|      0|                    mult3( r12, -1.0 / abs_r12, r12 ); /* make length = 1 */
 1934|      0|                }
 1935|      0|                cross_prod3( r12, zi1, zi2 );
 1936|      0|                abs_zi2 = len3( zi2 );
 1937|      0|                mult3( zi2, 100.0 / abs_zi2, zi2 ); /* make length = 100 */
 1938|      0|                for (j = 0; j < 3; j++)
  ------------------
  |  Branch (1938:29): [True: 0, False: 0]
  ------------------
 1939|      0|                {
 1940|      0|                    z_dir[j] = (S_CHAR) ( zi2[j] >= 0.0 ? floor( 0.5 + zi2[j] ) :
  ------------------
  |  Branch (1940:43): [True: 0, False: 0]
  ------------------
 1941|      0|                                                       -floor( 0.5 - zi2[j] ) ); /*  abs(z_dir) = 100 */
 1942|      0|                }
 1943|      0|                if (bWrong_z_dir1)
  ------------------
  |  Branch (1943:21): [True: 0, False: 0]
  ------------------
 1944|      0|                {
 1945|      0|                    memcpy(z_dir1, z_dir, sizeof(z_dir));
 1946|      0|                }
 1947|      0|                else
 1948|      0|                {
 1949|      0|                    memcpy(z_dir2, z_dir, sizeof(z_dir));
 1950|      0|                }
 1951|      0|            }
 1952|      0|        }
 1953|      0|        return 0;
 1954|       |
 1955|     10|    set_default:
 1956|       |        /* z_dir1[] = x-direction; z_dir2[] = z-direction; r12[] = y-direction */
 1957|     10|        z_dir1[0] = 100;
 1958|     10|        z_dir1[1] = z_dir1[2] = 0;
 1959|     10|        z_dir2[0] = z_dir2[1] = 0;
 1960|     10|        z_dir2[2] = 100;
 1961|     10|    }
 1962|       |
 1963|    257|    return 0;
 1964|    257|}
FixUnkn0DStereoBonds:
 1972|   216k|{
 1973|   216k|    int i, m, num = 0;
 1974|       |
 1975|       |    /* Add usual Unknown stereobond descriptors to each Unknown bond */
 1976|  1.27M|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (1976:17): [True: 1.05M, False: 216k]
  ------------------
 1977|  1.05M|    {
 1978|  1.05M|        for (m = 0; m < MAX_NUM_STEREO_BONDS && at[i].sb_parity[m]; m++)
  ------------------
  |  |  873|  2.11M|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1978:21): [True: 1.05M, False: 38]
  |  Branch (1978:49): [True: 2.27k, False: 1.05M]
  ------------------
 1979|  2.27k|        {
 1980|  2.27k|            if (AB_PARITY_UNKN == at[i].sb_parity[m])
  ------------------
  |  |  221|  2.27k|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
  |  Branch (1980:17): [True: 264, False: 2.01k]
  ------------------
 1981|    264|            {
 1982|    264|                at[i].bond_stereo[(int) at[i].sb_ord[m]] = STEREO_DBLE_EITHER;
  ------------------
  |  |   40|    264|#define STEREO_DBLE_EITHER   3
  ------------------
 1983|    264|                num++;
 1984|    264|            }
 1985|  2.27k|        }
 1986|  1.05M|    }
 1987|       |#ifdef NEVER
 1988|       |    if (num)
 1989|       |    {
 1990|       |        int j;
 1991|       |        /* how to remove Unknown stereo bond parities */
 1992|       |        for (i = 0; i < num_at; i++)
 1993|       |        {
 1994|       |            for (m = 0; m < MAX_NUM_STEREO_BONDS && at[i].sb_parity[m]; m++)
 1995|       |            {
 1996|       |                if (AB_PARITY_UNKN == at[i].sb_parity[m])
 1997|       |                {
 1998|       |                    for (j = m + 1; j < MAX_NUM_STEREO_BONDS; j++)
 1999|       |                    {
 2000|       |                        at[i].sb_parity[j - 1] = at[i].sb_parity[j];
 2001|       |                        at[i].sb_ord[j - 1] = at[i].sb_ord[j];
 2002|       |                        at[i].sn_ord[j - 1] = at[i].sn_ord[j];
 2003|       |                        at[i].sn_orig_at_num[j - 1] = at[i].sn_orig_at_num[j];
 2004|       |                    }
 2005|       |                    at[i].sb_parity[j - 1] = 0;
 2006|       |                    at[i].sb_ord[j - 1] = 0;
 2007|       |                    at[i].sn_ord[j - 1] = 0;
 2008|       |                    at[i].sn_orig_at_num[j - 1] = 0;
 2009|       |                }
 2010|       |            }
 2011|       |        }
 2012|       |    }
 2013|       |#endif
 2014|       |
 2015|   216k|    return num;
 2016|   216k|}
GetStereocenter0DParity:
 3705|  8.38k|{
 3706|  8.38k|    int parity = AB_PARITY_NONE;
  ------------------
  |  |  218|  8.38k|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
 3707|  8.38k|    if (at[cur_at].p_parity && ( j1 == MAX_NUM_STEREO_ATOM_NEIGH - 1 || j1 == MAX_NUM_STEREO_ATOM_NEIGH ))
  ------------------
  |  |  877|    614|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
                  if (at[cur_at].p_parity && ( j1 == MAX_NUM_STEREO_ATOM_NEIGH - 1 || j1 == MAX_NUM_STEREO_ATOM_NEIGH ))
  ------------------
  |  |  877|    402|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (3707:9): [True: 614, False: 7.77k]
  |  Branch (3707:34): [True: 212, False: 402]
  |  Branch (3707:73): [True: 402, False: 0]
  ------------------
 3708|    614|    {
 3709|    614|        int i, num_trans_inp, num_trans_neigh;
 3710|    614|        AT_NUMB nInpNeighOrigAtNumb[MAX_NUM_STEREO_ATOM_NEIGH];
 3711|  3.07k|        for (i = 0; i < MAX_NUM_STEREO_ATOM_NEIGH; i++)
  ------------------
  |  |  877|  3.07k|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (3711:21): [True: 2.45k, False: 614]
  ------------------
 3712|  2.45k|        {
 3713|  2.45k|            nInpNeighOrigAtNumb[i] = at[cur_at].p_orig_at_num[i];
 3714|  2.45k|            if (nInpNeighOrigAtNumb[i] == at[cur_at].orig_at_number)
  ------------------
  |  Branch (3714:17): [True: 211, False: 2.24k]
  ------------------
 3715|    211|            {
 3716|    211|                nInpNeighOrigAtNumb[i] = 0; /* lone pair or explicit H */
 3717|    211|            }
 3718|  2.45k|        }
 3719|       |
 3720|    614|        num_trans_inp = insertions_sort( pCG, nInpNeighOrigAtNumb, MAX_NUM_STEREO_ATOM_NEIGH, sizeof( nInpNeighOrigAtNumb[0] ), comp_AT_NUMB );
  ------------------
  |  |  877|    614|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
 3721|    614|        num_trans_neigh = insertions_sort( pCG, nSbNeighOrigAtNumb, j1, sizeof( nSbNeighOrigAtNumb[0] ), comp_AT_NUMB );
 3722|       |
 3723|    614|        if (j1 == MAX_NUM_STEREO_ATOM_NEIGH - 1)
  ------------------
  |  |  877|    614|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (3723:13): [True: 212, False: 402]
  ------------------
 3724|    212|        {
 3725|    212|            ;
 3726|       |            /*num_trans_neigh += j1;*/
 3727|       |            /* the lone pair or implicit H is implicitly at the top of the list */
 3728|    212|        }
 3729|    614|        if (!memcmp( nInpNeighOrigAtNumb + MAX_NUM_STEREO_ATOM_NEIGH - j1, nSbNeighOrigAtNumb, j1 * sizeof( AT_NUMB ) ))
  ------------------
  |  |  877|    614|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (3729:13): [True: 613, False: 1]
  ------------------
 3730|    613|        {
 3731|    613|            if (ATOM_PARITY_WELL_DEF( at[cur_at].p_parity ))
  ------------------
  |  |  259|    613|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    613|#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)
  |  |  ------------------
  |  |  |  |  236|    613|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 613, False: 0]
  |  |  |  Branch (259:75): [True: 539, False: 74]
  |  |  ------------------
  ------------------
 3732|    539|            {
 3733|    539|                parity = 2 - ( num_trans_inp + num_trans_neigh + at[cur_at].p_parity ) % 2;
 3734|    539|            }
 3735|     74|            else
 3736|     74|            {
 3737|     74|                parity = at[cur_at].p_parity;
 3738|     74|            }
 3739|    613|            at[cur_at].bUsed0DParity |= nFlag; /* 0D parity used for streocenter parity */
 3740|    613|        }
 3741|    614|    }
 3742|       |
 3743|  8.38k|    return parity;
 3744|  8.38k|}
set_stereo_parity:
 4375|   288k|{
 4376|   288k|    int num_3D_stereo_atoms = 0;
 4377|   288k|    int num_stereo_bonds = 0; /* added to fix allene stereo bug reported for FClC=C=CFCl by Burt Leland - 2009-02-05 DT */
 4378|       |
 4379|   288k|    int i, is_stereo, num_stereo, max_stereo_atoms = 0, max_stereo_bonds = 0;
 4380|   288k|    QUEUE *q = NULL;
 4381|   288k|    AT_RANK *nAtomLevel = NULL;
 4382|   288k|    S_CHAR  *cSource = NULL;
 4383|   288k|    AT_RANK min_sb_ring_size = 0;
 4384|       |
 4385|       |    /**********************************************************
 4386|       |     *
 4387|       |     * Note: this parity reflects only relative positions of
 4388|       |     *       the atoms-neighbors and their ordering in the
 4389|       |     *       lists of neighbors.
 4390|       |     *
 4391|       |     *       To obtain the actual parity, the parity of a number
 4392|       |     *       of neighbors transpositions (to obtain a sorted
 4393|       |     *       list of numbers assigned to the atoms) should be
 4394|       |     *       added.
 4395|       |     *
 4396|       |     **********************************************************/
 4397|       |
 4398|       |    /*********************************************************************************
 4399|       |
 4400|       |     An example of parity=1 for stereogenic center, tetrahedral asymmetric atom
 4401|       |
 4402|       |
 4403|       |
 4404|       |                  (1)
 4405|       |                   |
 4406|       |                   |
 4407|       |               [C] |
 4408|       |                   |
 4409|       |         (2)------(0)
 4410|       |                  /
 4411|       |                /
 4412|       |              /
 4413|       |            /
 4414|       |         (3)
 4415|       |
 4416|       |
 4417|       |     Notation: (n) is a tetrahedral atom neighbor; n is an index of a neighbor in
 4418|       |     the central_at->neighbor[] array : neighbor atom number is central_at->neighbor[n].
 4419|       |
 4420|       |     (0)-(1), (0)-(2), (0)-(3) are lines connecting atom [C] neighbors to neighbor (0)
 4421|       |     (0), (1) and (2) are in the plane
 4422|       |     (0)-(3) is directed from the plain to the viewer
 4423|       |     [C] is somewhere between (0), (1), (2), (3)
 4424|       |     Since (1)-(2)-(3)  are in a clockwise order when looking from (0), parity is 2, or even;
 4425|       |     otherwise parity would be 1, or odd.
 4426|       |
 4427|       |    **********************************************************************************
 4428|       |
 4429|       |      Examples of a stereogenic bond.
 4430|       |
 4431|       |      Notation:   [atom number], (index of a neighbor):
 4432|       |                  [1] and [2] are atoms connected by the stereogenic bond
 4433|       |                  numbers in () are indexes of neighbors of [1] or [2].
 4434|       |                  (12 x 16)z = z-component of [1]-[2] and [1]-[6] cross-product
 4435|       |
 4436|       |                                     atom [1]                     atom [2]
 4437|       |     [8]                    [4]      prod01 = (12 x 16)z < 0      prod01 = (21 x 24)z < 0
 4438|       |       \                    /        prod02 = (12 x 18)z > 0      prod02 = (21 x 25)z > 0
 4439|       |        (2)               (1)        0 transpositions because     0 transpositions because
 4440|       |          \              /           double bond is in 0 posit.   double bond is in 0 position
 4441|       |          [1]==(0)(0)==[2]           0 = (prod01 > prod02)        0 = (prod01 > prod02)
 4442|       |          /              \
 4443|       |        (1)               (2)        result: parity = 2, even     result: parity=2, even
 4444|       |       /                    \
 4445|       |     [6]                    [5]
 4446|       |
 4447|       |
 4448|       |
 4449|       |                                     atom [1]                     atom [2]
 4450|       |     [8]                    [5]      prod01 = (12 x 18)z > 0      prod01 = (21 x 24)z > 0
 4451|       |       \                    /        prod02 = (12 x 16)z < 0      prod02 = (21 x 25)z < 0
 4452|       |        (0)               (2)        2 transpositions to move     1 transposition to move
 4453|       |          \              /           at [2] from 2 to 0 pos.      at [1] from 1 to 0 position
 4454|       |          [1]==(2)(1)==[2]           1 = (prod01 > prod02)        1 = (prod01 > prod02)
 4455|       |          /              \
 4456|       |        (1)               (0)        result: parity = (1+2)       result: parity=(1+1)
 4457|       |       /                    \        2-(1+2)%2 = 1, odd           2-(1+1)%2 = 2, even
 4458|       |     [6]                    [4]
 4459|       |
 4460|       |
 4461|       |    ***********************************************************************************
 4462|       |    Note: atoms' numbers [1], [2], [4],... are not used to calculate parity at this
 4463|       |          point. They will be used for each numbering in the canonicalization.
 4464|       |    Note: parity=3 for a stereo atom means entered undefined bond direction
 4465|       |          parity=4 for an atom means parity cannot be determined from the given geometry
 4466|       |    ***********************************************************************************/
 4467|       |
 4468|   288k|    if (!at_output || !at)
  ------------------
  |  Branch (4468:9): [True: 0, False: 288k]
  |  Branch (4468:23): [True: 0, False: 288k]
  ------------------
 4469|      0|    {
 4470|      0|        return -1;
 4471|      0|    }
 4472|       |
 4473|       |    /*  Clear stereo descriptors */
 4474|  1.38M|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (4474:17): [True: 1.09M, False: 288k]
  ------------------
 4475|  1.09M|    {
 4476|  1.09M|        at_output[i].parity = 0;
 4477|  1.09M|        at_output[i].parity2 = 0;
 4478|  1.09M|        memset( &at_output[i].stereo_bond_neighbor[0], 0, sizeof( at_output[0].stereo_bond_neighbor ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4479|  1.09M|        memset( &at_output[i].stereo_bond_neighbor2[0], 0, sizeof( at_output[0].stereo_bond_neighbor2 ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4480|  1.09M|        memset( &at_output[i].stereo_bond_ord[0], 0, sizeof( at_output[0].stereo_bond_ord ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4481|  1.09M|        memset( &at_output[i].stereo_bond_ord2[0], 0, sizeof( at_output[0].stereo_bond_ord2 ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4482|  1.09M|        memset( &at_output[i].stereo_bond_z_prod[0], 0, sizeof( at_output[0].stereo_bond_z_prod ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4483|  1.09M|        memset( &at_output[i].stereo_bond_z_prod2[0], 0, sizeof( at_output[0].stereo_bond_z_prod2 ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4484|  1.09M|        memset( &at_output[i].stereo_bond_parity[0], 0, sizeof( at_output[0].stereo_bond_parity ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4485|  1.09M|        memset( &at_output[i].stereo_bond_parity2[0], 0, sizeof( at_output[0].stereo_bond_parity2 ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4486|  1.09M|    }
 4487|       |
 4488|       |    /*  Estimate max numbers of stereo atoms and bonds if isotopic H are added */
 4489|   288k|    if (nMaxNumStereoAtoms || nMaxNumStereoBonds)
  ------------------
  |  Branch (4489:9): [True: 288k, False: 0]
  |  Branch (4489:31): [True: 0, False: 0]
  ------------------
 4490|   288k|    {
 4491|  1.38M|        for (i = 0; i < num_at; i++) /* djb-rwth: removing redundant code */
  ------------------
  |  Branch (4491:21): [True: 1.09M, False: 288k]
  ------------------
 4492|  1.09M|        {
 4493|  1.09M|            int num;
 4494|  1.09M|            num = can_be_a_stereo_atom_with_isotopic_H( at, i, bPointedEdgeStereo, bStereoAtZz );
 4495|  1.09M|            if (num)
  ------------------
  |  Branch (4495:17): [True: 8.56k, False: 1.08M]
  ------------------
 4496|  8.56k|            {
 4497|  8.56k|                max_stereo_atoms += num;
 4498|  8.56k|            }
 4499|  1.08M|            else
 4500|  1.08M|            {
 4501|  1.08M|                if (( num = can_be_a_stereo_bond_with_isotopic_H( at, i, nMode ) ))
  ------------------
  |  Branch (4501:21): [True: 6.72k, False: 1.07M]
  ------------------
 4502|  6.72k|                {
 4503|       |                    /*  accept cumulenes */
 4504|  6.72k|                    max_stereo_bonds += num;
 4505|  6.72k|                }
 4506|  1.08M|            }
 4507|  1.09M|        }
 4508|   288k|        if (nMaxNumStereoAtoms)
  ------------------
  |  Branch (4508:13): [True: 288k, False: 0]
  ------------------
 4509|   288k|        {
 4510|   288k|            *nMaxNumStereoAtoms = max_stereo_atoms;
 4511|   288k|        }
 4512|   288k|        if (nMaxNumStereoBonds)
  ------------------
  |  Branch (4512:13): [True: 288k, False: 0]
  ------------------
 4513|   288k|        {
 4514|   288k|            *nMaxNumStereoBonds = max_stereo_bonds;
 4515|   288k|        }
 4516|   288k|    }
 4517|       |
 4518|       |    /*  Calculate stereo descriptors */
 4519|   288k|#if ( MIN_SB_RING_SIZE > 0 )
 4520|   288k|    min_sb_ring_size = (AT_RANK) ( ( ( nMode & REQ_MODE_MIN_SB_RING_MASK ) >> REQ_MODE_MIN_SB_RING_SHFT ) & AT_RANK_MASK );
  ------------------
  |  |   43|   288k|#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 );
  ------------------
  |  |   44|   288k|#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 );
  ------------------
  |  |   12|   288k|#define AT_RANK_MASK   ((AT_RANK)~0)
  ------------------
 4521|   288k|    if (min_sb_ring_size >= 3)
  ------------------
  |  Branch (4521:9): [True: 288k, False: 0]
  ------------------
 4522|   288k|    {
 4523|       |        /* Create BFS data structure for finding for each stereo bond its min. ring sizes */
 4524|   288k|        q = QueueCreate( num_at + 1, sizeof( qInt ) );
 4525|   288k|        nAtomLevel = (AT_RANK*) inchi_calloc( num_at, sizeof( nAtomLevel[0] ) );
  ------------------
  |  | 1146|   288k|#define inchi_calloc   calloc
  ------------------
 4526|   288k|        cSource = (S_CHAR *) inchi_calloc( num_at, sizeof( cSource[0] ) );
  ------------------
  |  | 1146|   288k|#define inchi_calloc   calloc
  ------------------
 4527|   288k|        if (!q || !cSource || !nAtomLevel)
  ------------------
  |  Branch (4527:13): [True: 0, False: 288k]
  |  Branch (4527:19): [True: 0, False: 288k]
  |  Branch (4527:31): [True: 0, False: 288k]
  ------------------
 4528|      0|        {
 4529|      0|            q = QueueDelete(q); /* djb-rwth: fixing coverity ID #499562 */
 4530|      0|            inchi_free(nAtomLevel); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4531|      0|            inchi_free(cSource); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4532|      0|            num_3D_stereo_atoms = CT_OUT_OF_RAM;
  ------------------
  |  |   21|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4533|      0|            goto exit_function;
 4534|      0|        }
 4535|   288k|    }
 4536|      0|    else
 4537|      0|    {
 4538|      0|        min_sb_ring_size = 2;
 4539|      0|    }
 4540|   288k|#endif
 4541|       |
 4542|       |    /* Main cycle: set stereo parities */
 4543|  1.38M|    for (i = 0, num_stereo = 0; i < num_at; i++)
  ------------------
  |  Branch (4543:33): [True: 1.09M, False: 288k]
  ------------------
 4544|  1.09M|    {
 4545|  1.09M|        is_stereo = set_stereo_atom_parity( pCG, at_output, at, i, at + num_at, num_removed_H,
 4546|  1.09M|                                            bPointedEdgeStereo, vABParityUnknown, bLooseTSACheck, bStereoAtZz );
 4547|  1.09M|        if (is_stereo)
  ------------------
  |  Branch (4547:13): [True: 8.38k, False: 1.08M]
  ------------------
 4548|  8.38k|        {
 4549|  8.38k|            num_3D_stereo_atoms += ATOM_PARITY_WELL_DEF( is_stereo );
  ------------------
  |  |  259|  8.38k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  8.38k|#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)
  |  |  ------------------
  |  |  |  |  236|  8.38k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 8.38k, False: 0]
  |  |  |  Branch (259:75): [True: 539, False: 7.85k]
  |  |  ------------------
  ------------------
 4550|  8.38k|        }
 4551|  1.08M|        else
 4552|  1.08M|        {
 4553|  1.08M|            is_stereo = set_stereo_bonds_parity( at_output, at, i, at + num_at,
 4554|  1.08M|                                                 num_removed_H, nMode,q,
 4555|  1.08M|                                                 nAtomLevel, cSource,
 4556|  1.08M|                                                 min_sb_ring_size,
 4557|  1.08M|                                                 bPointedEdgeStereo,
 4558|  1.08M|                                                 vABParityUnknown );
 4559|  1.08M|            if (RETURNED_ERROR( is_stereo ))
  ------------------
  |  |   44|  1.08M|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  1.08M|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  1.08M|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  1.08M|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  1.08M|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  1.08M|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 1.08M, False: 0]
  |  |  |  Branch (44:53): [True: 26, False: 1.08M]
  |  |  ------------------
  ------------------
 4560|     26|            {
 4561|     26|                num_3D_stereo_atoms = is_stereo;
 4562|     26|                break;
 4563|     26|            }
 4564|  1.08M|            num_stereo_bonds += ( is_stereo != 0 ); /* added to fix bug reported by Burt Leland - 2009-02-05 DT */
 4565|  1.08M|        }
 4566|  1.09M|        num_stereo += ( is_stereo != 0 );
 4567|       |        /* djb-rwth: removing redundant code */
 4568|  1.09M|    }
 4569|       |
 4570|       |    /* Added to fix bug reported by Burt Leland - 2009-02-05 DT */
 4571|   288k|    if (max_stereo_atoms < num_3D_stereo_atoms && nMaxNumStereoAtoms)
  ------------------
  |  Branch (4571:9): [True: 0, False: 288k]
  |  Branch (4571:51): [True: 0, False: 0]
  ------------------
 4572|      0|    {
 4573|      0|        *nMaxNumStereoAtoms = num_3D_stereo_atoms;
 4574|      0|    }
 4575|   288k|    if (max_stereo_bonds < num_stereo_bonds && nMaxNumStereoBonds)
  ------------------
  |  Branch (4575:9): [True: 13, False: 288k]
  |  Branch (4575:48): [True: 13, False: 0]
  ------------------
 4576|     13|    {
 4577|     13|        *nMaxNumStereoBonds = num_stereo_bonds;
 4578|     13|    }
 4579|       |
 4580|       |    /*
 4581|       |    if ( (nMode & REQ_MODE_SC_IGN_ALL_UU )
 4582|       |    REQ_MODE_SC_IGN_ALL_UU
 4583|       |    REQ_MODE_SB_IGN_ALL_UU
 4584|       |    */
 4585|       |
 4586|   288k|#if ( MIN_SB_RING_SIZE > 0 )
 4587|   288k|    if (q)
  ------------------
  |  Branch (4587:9): [True: 288k, False: 0]
  ------------------
 4588|   288k|    {
 4589|   288k|        q = QueueDelete( q ); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 4590|   288k|    }
 4591|   288k|    if (nAtomLevel)
  ------------------
  |  Branch (4591:9): [True: 288k, False: 0]
  ------------------
 4592|   288k|    {
 4593|   288k|        inchi_free( nAtomLevel );
  ------------------
  |  | 1152|   288k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 288k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 288k]
  |  |  ------------------
  ------------------
 4594|   288k|    }
 4595|   288k|    if (cSource)
  ------------------
  |  Branch (4595:9): [True: 288k, False: 0]
  ------------------
 4596|   288k|    {
 4597|   288k|        inchi_free( cSource );
  ------------------
  |  | 1152|   288k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 288k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 288k]
  |  |  ------------------
  ------------------
 4598|   288k|    }
 4599|       |
 4600|   288k|exit_function:
 4601|   288k|#endif
 4602|       |
 4603|   288k|    return num_3D_stereo_atoms;
 4604|   288k|}
ReconcileAllCmlBondParities:
 4631|   361k|{
 4632|   361k|    int i, ret = 0;
 4633|   361k|    S_CHAR *visited = (S_CHAR*) inchi_calloc( num_atoms, sizeof( *visited ) );
  ------------------
  |  | 1146|   361k|#define inchi_calloc   calloc
  ------------------
 4634|   361k|    if (!visited)
  ------------------
  |  Branch (4634:9): [True: 0, False: 361k]
  ------------------
 4635|      0|    {
 4636|      0|        return -1; /* out of RAM */
 4637|      0|    }
 4638|  2.57M|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (4638:17): [True: 2.21M, False: 361k]
  ------------------
 4639|  2.21M|    {
 4640|  2.21M|        if (at[i].sb_parity[0] && !visited[i] && !( bDisconnected && is_el_a_metal( at[i].el_number ) ))
  ------------------
  |  Branch (4640:13): [True: 3.02k, False: 2.20M]
  |  Branch (4640:35): [True: 1.94k, False: 1.08k]
  |  Branch (4640:53): [True: 0, False: 1.94k]
  |  Branch (4640:70): [True: 0, False: 0]
  ------------------
 4641|  1.94k|        {
 4642|  1.94k|            if ((ret = ReconcileCmlIncidentBondParities( at, i, -1, visited, bDisconnected ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4642:17): [True: 58, False: 1.88k]
  ------------------
 4643|     58|            {
 4644|     58|                break; /* error */
 4645|     58|            }
 4646|  1.94k|        }
 4647|  2.21M|    }
 4648|   361k|    inchi_free( visited );
  ------------------
  |  | 1152|   361k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 361k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 361k]
  |  |  ------------------
  ------------------
 4649|       |
 4650|   361k|    return ret;
 4651|   361k|}
ReconcileCmlIncidentBondParities:
 4660|  3.08k|{
 4661|       |    /* visited = 0 or parity => atom has not been visited
 4662|       |                 10 + parity => currently is on the stack + its final parity
 4663|       |                 20 + parity => has been visited; is not on the stack anymore + its final parity */
 4664|  3.08k|    int i, j, nxt_atom, ret = 0, len;
 4665|  3.08k|    int icur2nxt, icur2neigh;   /* cur atom neighbors */
 4666|  3.08k|    int inxt2cur, inxt2neigh;   /* next atom neighbors */
 4667|  3.08k|    int cur_parity, nxt_parity;
 4668|  3.08k|    int cur_order_parity, nxt_order_parity, cur_sb_parity, nxt_sb_parity, bCurMask, bNxtMask;
 4669|       |    /* !(bDisconnected && is_el_a_metal(at[i].el_number) */
 4670|       |
 4671|  3.08k|    if (at[cur_atom].valence > MAX_NUM_STEREO_BONDS)
  ------------------
  |  |  873|  3.08k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (4671:9): [True: 0, False: 3.08k]
  ------------------
 4672|      0|    {
 4673|      0|        return 0; /* ignore */
 4674|      0|    }
 4675|       |
 4676|  3.08k|    if (!at[cur_atom].sb_parity[0])
  ------------------
  |  Branch (4676:9): [True: 0, False: 3.08k]
  ------------------
 4677|      0|    {
 4678|      0|        return 1; /* wrong call */
 4679|      0|    }
 4680|       |
 4681|  3.08k|    if (visited[cur_atom] >= 10)
  ------------------
  |  Branch (4681:9): [True: 0, False: 3.08k]
  ------------------
 4682|      0|    {
 4683|      0|        return 2; /* program error */
 4684|      0|    }
 4685|       |
 4686|  3.08k|    cur_parity = visited[cur_atom] % 10;
 4687|       |
 4688|  3.08k|    visited[cur_atom] += 10;
 4689|       |
 4690|  6.49k|    for (i = 0; i < MAX_NUM_STEREO_BONDS && at[cur_atom].sb_parity[i]; i++)
  ------------------
  |  |  873|  12.9k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (4690:17): [True: 6.44k, False: 53]
  |  Branch (4690:45): [True: 3.53k, False: 2.91k]
  ------------------
 4691|  3.53k|    {
 4692|  3.53k|        icur2nxt = (int) at[cur_atom].sb_ord[i];
 4693|  3.53k|        len = get_opposite_sb_atom( at, cur_atom, icur2nxt, &nxt_atom, &inxt2cur, &j );
 4694|  3.53k|        if (!len)
  ------------------
  |  Branch (4694:13): [True: 24, False: 3.50k]
  ------------------
 4695|     24|        {
 4696|     24|            return 4; /* could not find the opposite atom: bond parity data error */
 4697|     24|        }
 4698|  3.50k|        if (nxt_atom == prev_atom)
  ------------------
  |  Branch (4698:13): [True: 1.12k, False: 2.38k]
  ------------------
 4699|  1.12k|        {
 4700|  1.12k|            continue;
 4701|  1.12k|        }
 4702|  2.38k|        if (visited[nxt_atom] >= 20)
  ------------------
  |  Branch (4702:13): [True: 592, False: 1.79k]
  ------------------
 4703|    592|        {
 4704|    592|            continue; /* back edge, second visit: ignore */
 4705|    592|        }
 4706|  1.79k|        if (at[nxt_atom].valence > MAX_NUM_STEREO_BONDS)
  ------------------
  |  |  873|  1.79k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (4706:13): [True: 0, False: 1.79k]
  ------------------
 4707|      0|        {
 4708|      0|            continue; /* may be treated only after metal disconnection */
 4709|      0|        }
 4710|       |
 4711|  1.79k|        if (bDisconnected && ( at[cur_atom].sb_parity[i] & SB_PARITY_FLAG ))
  ------------------
  |  |   62|      0|#define SB_PARITY_FLAG 0x38 /**< mask for disconnected metal parity if it is different */
  ------------------
  |  Branch (4711:13): [True: 0, False: 1.79k]
  |  Branch (4711:30): [True: 0, False: 0]
  ------------------
 4712|      0|        {
 4713|      0|            cur_sb_parity = ( at[cur_atom].sb_parity[i] >> SB_PARITY_SHFT );
  ------------------
  |  |   63|      0|#define SB_PARITY_SHFT 3    /**< number of right shift bits to get disconnected metal parity */
  ------------------
 4714|      0|            bCurMask = 3 << SB_PARITY_SHFT;
  ------------------
  |  |   63|      0|#define SB_PARITY_SHFT 3    /**< number of right shift bits to get disconnected metal parity */
  ------------------
 4715|      0|        }
 4716|  1.79k|        else
 4717|  1.79k|        {
 4718|  1.79k|            cur_sb_parity = ( at[cur_atom].sb_parity[i] & SB_PARITY_MASK );
  ------------------
  |  |   64|  1.79k|#define SB_PARITY_MASK 0x07
  ------------------
 4719|  1.79k|            bCurMask = 3;
 4720|  1.79k|        }
 4721|  1.79k|        if (bDisconnected && ( at[nxt_atom].sb_parity[j] & SB_PARITY_FLAG ))
  ------------------
  |  |   62|      0|#define SB_PARITY_FLAG 0x38 /**< mask for disconnected metal parity if it is different */
  ------------------
  |  Branch (4721:13): [True: 0, False: 1.79k]
  |  Branch (4721:30): [True: 0, False: 0]
  ------------------
 4722|      0|        {
 4723|      0|            nxt_sb_parity = ( at[nxt_atom].sb_parity[j] >> SB_PARITY_SHFT );
  ------------------
  |  |   63|      0|#define SB_PARITY_SHFT 3    /**< number of right shift bits to get disconnected metal parity */
  ------------------
 4724|      0|            bNxtMask = 3 << SB_PARITY_SHFT;
  ------------------
  |  |   63|      0|#define SB_PARITY_SHFT 3    /**< number of right shift bits to get disconnected metal parity */
  ------------------
 4725|      0|        }
 4726|  1.79k|        else
 4727|  1.79k|        {
 4728|  1.79k|            nxt_sb_parity = ( at[nxt_atom].sb_parity[j] & SB_PARITY_MASK );
  ------------------
  |  |   64|  1.79k|#define SB_PARITY_MASK 0x07
  ------------------
 4729|  1.79k|            bNxtMask = 3;
 4730|  1.79k|        }
 4731|       |
 4732|  1.79k|        if (!ATOM_PARITY_WELL_DEF( cur_sb_parity ) ||
  ------------------
  |  |  259|  3.59k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  1.79k|#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)
  |  |  ------------------
  |  |  |  |  236|  1.79k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 1.79k, False: 0]
  |  |  |  Branch (259:75): [True: 1.19k, False: 605]
  |  |  ------------------
  ------------------
 4733|  1.19k|             !ATOM_PARITY_WELL_DEF( nxt_sb_parity ))
  ------------------
  |  |  259|  1.19k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  1.19k|#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)
  |  |  ------------------
  |  |  |  |  236|  1.19k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 1.19k, False: 0]
  |  |  |  Branch (259:75): [True: 1.18k, False: 7]
  |  |  ------------------
  ------------------
 4734|    612|        {
 4735|    612|            if (cur_sb_parity == nxt_sb_parity)
  ------------------
  |  Branch (4735:17): [True: 605, False: 7]
  ------------------
 4736|    605|            {
 4737|    605|                continue;
 4738|       |                /* goto move_forward;       */
 4739|       |                /* bypass unknown/undefined */
 4740|    605|            }
 4741|      7|            return 3; /* sb parities do not match: bond parity data error */
 4742|    612|        }
 4743|       |
 4744|  1.18k|        icur2neigh = (int) at[cur_atom].sn_ord[i];
 4745|  1.18k|        inxt2neigh = (int) at[nxt_atom].sn_ord[j];
 4746|       |        /* Parity of at[cur_atom].neighbor[] premutation to reach this order: { next_atom, neigh_atom, ...} */
 4747|       |
 4748|       |        /* 1. move next_atom  from position=icur2nxt to position=0 =>
 4749|       |         *         icur2nxt permutations
 4750|       |         * 2. move neigh_atom from position=inxt2neigh+(inxt2cur > inxt2neigh) to position=1 =>
 4751|       |         *         inxt2neigh+(inxt2cur > inxt2neigh)-1 permutations.
 4752|       |         * Note if (inxt2cur > inxt2neigh) then move #1 increments neigh_atom position
 4753|       |         * Note add 4 because icur2neigh may be negative due to isotopic H removal
 4754|       |         */
 4755|  1.18k|        cur_order_parity = ( 4 + icur2nxt + icur2neigh + ( icur2neigh > icur2nxt ) ) % 2;
 4756|       |
 4757|       |        /* Same for next atom: */
 4758|       |        /* parity of at[nxt_atom].neighbor[] premutation to reach this order: { cur_atom, neigh_atom, ...} */
 4759|  1.18k|        nxt_order_parity = ( 4 + inxt2cur + inxt2neigh + ( inxt2neigh > inxt2cur ) ) % 2;
 4760|  1.18k|        nxt_parity = visited[nxt_atom] % 10;
 4761|       |
 4762|  1.18k|        if (!cur_parity)
  ------------------
  |  Branch (4762:13): [True: 960, False: 223]
  ------------------
 4763|    960|        {
 4764|    960|            cur_parity = 2 - ( cur_order_parity + cur_sb_parity ) % 2;
 4765|    960|            visited[cur_atom] += cur_parity;
 4766|    960|        }
 4767|    223|        else
 4768|    223|        {
 4769|    223|            if (cur_parity != 2 - ( cur_order_parity + cur_sb_parity ) % 2)
  ------------------
  |  Branch (4769:17): [True: 69, False: 154]
  ------------------
 4770|     69|            {
 4771|       |                /***** Reconcile bond parities *****/
 4772|       |
 4773|       |                /* Each bond parity is split into two values located at the end atoms.
 4774|       |                   For T (trans) the values are (1,1) or (2,2)
 4775|       |                   For C (cis)   the values are (1,2) or (2,1)
 4776|       |                   The fact that one pair = another with inverted parities, namely
 4777|       |                   Inv(1,1) = (2,2) and Inv(1,2) = (2,1), allows to
 4778|       |                   simultaneouly invert parities of the current bond end atoms
 4779|       |                   (at[cur_atom].sb_parity[i], at[nxt_atom].sb_parity[j])
 4780|       |                   so that the final current atom parity cur_parity
 4781|       |                   calculated later in stereochemical canonicalization for
 4782|       |                   each stereobond incident with the current atomis same.
 4783|       |                   Achieving this is called here RECONCILIATION.
 4784|       |                   If at the closure of an aromatic circuit the parities of
 4785|       |                   next atom cannot be reconciled with already calculated then
 4786|       |                   this function returns 5 (error).
 4787|       |                */
 4788|     69|                at[cur_atom].sb_parity[i] ^= bCurMask;
 4789|     69|                at[nxt_atom].sb_parity[j] ^= bNxtMask;
 4790|       |                /* djb-rwth: removing redundant code */
 4791|     69|                nxt_sb_parity ^= 3;
 4792|     69|            }
 4793|    223|        }
 4794|       |
 4795|  1.18k|        if (!nxt_parity)
  ------------------
  |  Branch (4795:13): [True: 1.14k, False: 36]
  ------------------
 4796|  1.14k|        {
 4797|  1.14k|            nxt_parity = 2 - ( nxt_order_parity + nxt_sb_parity ) % 2;
 4798|  1.14k|            visited[nxt_atom] += nxt_parity;
 4799|  1.14k|        }
 4800|     36|        else
 4801|     36|        {
 4802|     36|            if (nxt_parity != 2 - ( nxt_order_parity + nxt_sb_parity ) % 2)
  ------------------
  |  Branch (4802:17): [True: 27, False: 9]
  ------------------
 4803|     27|            {
 4804|     27|                return 5; /* algorithm does not work for Mebius-like structures */
 4805|     27|            }
 4806|     36|        }
 4807|       |
 4808|       |        /* Move_forward: */
 4809|  1.15k|        if (visited[nxt_atom] < 10)
  ------------------
  |  Branch (4809:13): [True: 1.14k, False: 9]
  ------------------
 4810|  1.14k|        {
 4811|  1.14k|            ret = ReconcileCmlIncidentBondParities( at, nxt_atom, cur_atom, visited, bDisconnected );
 4812|  1.14k|            if (ret)
  ------------------
  |  Branch (4812:17): [True: 63, False: 1.08k]
  ------------------
 4813|     63|            {
 4814|     63|                break;
 4815|     63|            }
 4816|  1.14k|        }
 4817|  1.15k|    }
 4818|  3.03k|    visited[cur_atom] += 10; /* all bonds incident to the current atom have
 4819|       |                                been processed or an error occurred. */
 4820|       |
 4821|  3.03k|    return ret;
 4822|  3.08k|}
get_opposite_sb_atom:
 4832|  5.07k|{
 4833|  5.07k|    AT_NUMB nxt_atom;
 4834|  5.07k|    int     j, len;
 4835|       |
 4836|  5.07k|    len = 0;
 4837|  5.26k|    while (len++ < 20)
  ------------------
  |  Branch (4837:12): [True: 5.26k, False: 0]
  ------------------
 4838|  5.26k|    {
 4839|       |        /* Arbitrarily set cumulene length limit to avoid infinite loop */
 4840|  5.26k|        nxt_atom = at[cur_atom].neighbor[icur2nxt];
 4841|  6.05k|        for (j = 0; j < MAX_NUM_STEREO_BONDS && at[nxt_atom].sb_parity[j]; j++)
  ------------------
  |  |  873|  12.1k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (4841:21): [True: 6.05k, False: 0]
  |  Branch (4841:49): [True: 5.81k, False: 235]
  ------------------
 4842|  5.81k|        {
 4843|  5.81k|            if (cur_atom == at[nxt_atom].neighbor[(int) at[nxt_atom].sb_ord[j]])
  ------------------
  |  Branch (4843:17): [True: 5.03k, False: 785]
  ------------------
 4844|  5.03k|            {
 4845|       |                /* Found the opposite atom */
 4846|  5.03k|                *pnxt_atom = nxt_atom;
 4847|  5.03k|                *pinxt2cur = at[nxt_atom].sb_ord[j];
 4848|  5.03k|                *pinxt_sb_parity_ord = j;
 4849|  5.03k|                return len;
 4850|  5.03k|            }
 4851|  5.81k|        }
 4852|    235|        if (j)
  ------------------
  |  Branch (4852:13): [True: 18, False: 217]
  ------------------
 4853|     18|        {
 4854|     18|            return 0; /* reached atom(s) with stereobond (sb) parity, the opposite atom has not been found */
 4855|     18|        }
 4856|    217|        if (at[nxt_atom].valence == 2 && 2 * BOND_TYPE_DOUBLE == at[nxt_atom].chem_bonds_valence)
  ------------------
  |  |   33|    217|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (4856:13): [True: 217, False: 0]
  |  Branch (4856:42): [True: 195, False: 22]
  ------------------
 4857|    195|        {
 4858|       |            /* Follow cumulene =X= path */
 4859|    195|            icur2nxt = ( at[nxt_atom].neighbor[0] == cur_atom );
 4860|    195|            cur_atom = nxt_atom;
 4861|    195|        }
 4862|     22|        else
 4863|     22|        {
 4864|     22|            return 0; /* neither atom with a sb parity not middle cumulene could be reached */
 4865|     22|        }
 4866|    217|    }
 4867|       |
 4868|      0|    return 0; /* too long chain of cumulene was found */
 4869|  5.07k|}
ichister.c:bInpAtomHasRequirdNeigh:
 1287|  22.6k|{
 1288|       |    /* RequirdNeighType:
 1289|       |          reqired neighbor types (bitmap):
 1290|       |               0 => any neighbors
 1291|       |               1 => no terminal hydrogen atom neighbors
 1292|       |               2 => no terminal -X and -XH together (don't care about -X, -XH bond type, charge, radical)
 1293|       |                    (X = tautomeric endpoint atom)
 1294|       |       NumDbleBonds:
 1295|       |          if non-zero then allow double, alternating and tautomeric bonds
 1296|       |    */
 1297|  22.6k|    int i, j, ni, nj, bond_type, num_1s, num_mult, num_other;
 1298|       |
 1299|  22.6k|    if (at[cur_at].endpoint)
  ------------------
  |  Branch (1299:9): [True: 258, False: 22.4k]
  ------------------
 1300|    258|    {
 1301|       |        /*  tautomeric endpoint cannot be a stereo center */
 1302|    258|        return 0;
 1303|    258|    }
 1304|       |
 1305|  22.4k|    if (( 1 & RequirdNeighType ) && at[cur_at].num_H)
  ------------------
  |  Branch (1305:9): [True: 18.1k, False: 4.21k]
  |  Branch (1305:37): [True: 1.27k, False: 16.9k]
  ------------------
 1306|  1.27k|    {
 1307|  1.27k|        return 0;
 1308|  1.27k|    }
 1309|       |
 1310|  21.1k|    if (2 & RequirdNeighType)
  ------------------
  |  Branch (1310:9): [True: 15.4k, False: 5.70k]
  ------------------
 1311|  15.4k|    {
 1312|  64.6k|        for (i = 0; i < at[cur_at].valence; i++)
  ------------------
  |  Branch (1312:21): [True: 51.3k, False: 13.3k]
  ------------------
 1313|  51.3k|        {
 1314|  51.3k|            ni = (int) at[cur_at].neighbor[i];
 1315|  51.3k|            if (at[ni].valence != 1 ||
  ------------------
  |  Branch (1315:17): [True: 30.3k, False: 20.9k]
  ------------------
 1316|  20.9k|                 !get_endpoint_valence( at[ni].el_number ))
  ------------------
  |  Branch (1316:18): [True: 8.13k, False: 12.8k]
  ------------------
 1317|  38.5k|            {
 1318|  38.5k|                continue;
 1319|  38.5k|            }
 1320|  25.7k|            for (j = i + 1; j < at[cur_at].valence; j++)
  ------------------
  |  Branch (1320:29): [True: 15.1k, False: 10.6k]
  ------------------
 1321|  15.1k|            {
 1322|  15.1k|                nj = (int) at[cur_at].neighbor[j];
 1323|  15.1k|                if (at[nj].valence != 1 ||
  ------------------
  |  Branch (1323:21): [True: 5.06k, False: 10.0k]
  ------------------
 1324|  10.0k|                     at[ni].el_number != at[nj].el_number ||
  ------------------
  |  Branch (1324:22): [True: 5.44k, False: 4.59k]
  ------------------
 1325|  4.59k|                     !get_endpoint_valence( at[nj].el_number ))
  ------------------
  |  Branch (1325:22): [True: 0, False: 4.59k]
  ------------------
 1326|  10.5k|                {
 1327|  10.5k|                    continue;
 1328|  10.5k|                }
 1329|       |                /*
 1330|       |                 * if (at[ni].num_H != at[nj].num_H) then the atoms (neighbors of at[cur_at]
 1331|       |                 * are tautomeric endpoints and are indistinguishable => cur_at is not stereogenic
 1332|       |                 * if (at[ni].num_H == at[nj].num_H) then the neighbors are indistinguishable
 1333|       |                 * and cur_at will be found non-sterogenic later
 1334|       |                 * get_endpoint_valence() check will not allow the neighbors to be carbons
 1335|       |                 * Therefore the following "if" is not needed; we may just return 0.
 1336|       |                 */
 1337|  4.59k|                if (at[ni].num_H != at[nj].num_H && strcmp( at[ni].elname, "C" ))
  ------------------
  |  Branch (1337:21): [True: 2.12k, False: 2.46k]
  |  Branch (1337:53): [True: 2.12k, False: 0]
  ------------------
 1338|  2.12k|                {
 1339|  2.12k|                    return 0; /*  found -X and -XH neighbors */
 1340|  2.12k|                }
 1341|  4.59k|            }
 1342|  12.8k|        }
 1343|  15.4k|    }
 1344|       |
 1345|  19.0k|    if (0==bStereoAtZz)
  ------------------
  |  Branch (1345:9): [True: 19.0k, False: 0]
  ------------------
 1346|  19.0k|    {
 1347|       |        /* No stereo allowed at centers connected to pseudoelement atoms "Zz","Zy" */
 1348|  19.0k|        int nbr, inbr;
 1349|  86.8k|        for (inbr = 0; inbr < at[cur_at].valence; inbr++)
  ------------------
  |  Branch (1349:24): [True: 67.8k, False: 18.9k]
  ------------------
 1350|  67.8k|        {
 1351|  67.8k|            nbr = (int) at[cur_at].neighbor[inbr];
 1352|  67.8k|            if (!strcmp( at[nbr].elname, "Zz" ) || !strcmp( at[nbr].elname, "Zy" ))
  ------------------
  |  Branch (1352:17): [True: 34, False: 67.8k]
  |  Branch (1352:52): [True: 26, False: 67.8k]
  ------------------
 1353|     60|            {
 1354|     60|                return 0;
 1355|     60|            }
 1356|  67.8k|        }
 1357|  19.0k|    }
 1358|       |
 1359|  18.9k|    num_1s = num_mult = num_other = 0;
 1360|       |
 1361|  86.6k|    for (i = 0; i < at[cur_at].valence; i++)
  ------------------
  |  Branch (1361:17): [True: 67.7k, False: 18.9k]
  ------------------
 1362|  67.7k|    {
 1363|  67.7k|        bond_type = ( at[cur_at].bond_type[i] & ~BOND_MARK_ALL );
  ------------------
  |  |  191|  67.7k|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 1364|  67.7k|        switch (bond_type)
 1365|  67.7k|        {
 1366|  49.2k|            case BOND_SINGLE:
  ------------------
  |  |  177|  49.2k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|  49.2k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (1366:13): [True: 49.2k, False: 18.5k]
  ------------------
 1367|  49.2k|                num_1s++;
 1368|  49.2k|                break;
 1369|  6.82k|            case BOND_DOUBLE:
  ------------------
  |  |  178|  6.82k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|  6.82k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (1369:13): [True: 6.82k, False: 60.9k]
  ------------------
 1370|  9.48k|            case BOND_ALTERN:
  ------------------
  |  |  180|  9.48k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|  9.48k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (1370:13): [True: 2.66k, False: 65.0k]
  ------------------
 1371|  14.7k|            case BOND_TAUTOM:
  ------------------
  |  |  185|  14.7k|#define BOND_TAUTOM              8
  ------------------
  |  Branch (1371:13): [True: 5.28k, False: 62.4k]
  ------------------
 1372|  18.0k|            case BOND_ALT12NS:
  ------------------
  |  |  186|  18.0k|#define BOND_ALT12NS             9
  ------------------
  |  Branch (1372:13): [True: 3.24k, False: 64.5k]
  ------------------
 1373|  18.0k|                num_mult++;
 1374|  18.0k|                break;
 1375|    491|            default:
  ------------------
  |  Branch (1375:13): [True: 491, False: 67.2k]
  ------------------
 1376|    491|                num_other++;
 1377|    491|                break;
 1378|  67.7k|        }
 1379|  67.7k|    }
 1380|       |
 1381|  18.9k|    if (num_other)
  ------------------
  |  Branch (1381:9): [True: 401, False: 18.5k]
  ------------------
 1382|    401|    {
 1383|    401|        return 0;
 1384|    401|    }
 1385|       |
 1386|  18.5k|    if ((NumDbleBonds && NumDbleBonds > num_mult) ||
  ------------------
  |  Branch (1386:10): [True: 10.3k, False: 8.18k]
  |  Branch (1386:26): [True: 0, False: 10.3k]
  ------------------
 1387|  18.5k|         (!NumDbleBonds && at[cur_at].valence != num_1s)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1387:11): [True: 8.18k, False: 10.3k]
  |  Branch (1387:28): [True: 94, False: 8.09k]
  ------------------
 1388|     94|    {
 1389|     94|        return 0;
 1390|     94|    }
 1391|       |
 1392|  18.4k|    return 1;
 1393|  18.5k|}
ichister.c:len3:
  187|  20.8k|{
  188|  20.8k|    double tmpar[ARR_DIM] = { 0.0 };
  189|       |#if USE_BCF
  190|       |    memcpy_s(tmpar, ARR_DIM * sizeof(c[0]), c, ARR_DIM * sizeof(c[0]));
  191|       |#else
  192|  20.8k|    memcpy(tmpar, c, ARR_DIM * sizeof(c[0]));
  ------------------
  |  |   26|  20.8k|#define ARR_DIM 3 /* djb-rwth: default dimension of arrays */
  ------------------
  193|  20.8k|#endif
  194|  20.8k|    return sqrt(pow(tmpar[0],2.0) + pow(tmpar[1],2.0) + pow(tmpar[2],2.0) );
  195|  20.8k|}
ichister.c:mult3:
  236|     30|{
  237|     30|    result[0] = a[0] * b;
  238|     30|    result[1] = a[1] * b;
  239|     30|    result[2] = a[2] * b;
  240|       |
  241|       |    /* return result; */
  242|     30|}
ichister.c:can_be_a_stereo_atom_with_isotopic_H:
 3659|  1.09M|{
 3660|  1.09M|    int nNumNeigh;
 3661|  1.09M|    if (( nNumNeigh = bCanInpAtomBeAStereoCenter( at, cur_at, bPointedEdgeStereo, bStereoAtZz ) ) &&
  ------------------
  |  Branch (3661:9): [True: 8.56k, False: 1.08M]
  ------------------
 3662|  8.56k|         at[cur_at].valence + at[cur_at].num_H == nNumNeigh &&
  ------------------
  |  Branch (3662:10): [True: 8.56k, False: 0]
  ------------------
 3663|  8.56k|         at[cur_at].num_H <= NUM_H_ISOTOPES
  ------------------
  |  |   25|  8.56k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3663:10): [True: 8.56k, False: 0]
  ------------------
 3664|  1.09M|       )
 3665|  8.56k|    {
 3666|  8.56k|        return 1;
 3667|  8.56k|    }
 3668|       |
 3669|  1.08M|    return 0;
 3670|  1.09M|}
ichister.c:can_be_a_stereo_bond_with_isotopic_H:
 2606|  1.08M|{
 2607|  1.08M|    int i, j, next_at, num_stereo_bonds, bFound;
 2608|  1.08M|    int bond_type, num_2s, num_alt;
 2609|  1.08M|    int num_2s_next, num_alt_next, num_wrong_bonds_1, num_wrong_bonds_2;
 2610|  1.08M|#if ( N_V_STEREOBONDS == 1 )
 2611|  1.08M|    int n2sh, num_2s_hetero[2], num_2s_hetero_next[2], next_next_at, type_N, type_N_next;
 2612|  1.08M|#endif
 2613|       |
 2614|  1.08M|    if (MAX_NUM_STEREO_BOND_NEIGH < at[cur_at].valence + at[cur_at].num_H ||
  ------------------
  |  |  874|  1.08M|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (2614:9): [True: 10.8k, False: 1.07M]
  ------------------
 2615|  1.07M|         MIN_NUM_STEREO_BOND_NEIGH > at[cur_at].valence + at[cur_at].num_H)
  ------------------
  |  |  875|  1.07M|#define MIN_NUM_STEREO_BOND_NEIGH 2
  ------------------
  |  Branch (2615:10): [True: 933k, False: 141k]
  ------------------
 2616|   944k|    {
 2617|   944k|        return 0;
 2618|   944k|    }
 2619|   141k|    if (!bCanAtomHaveAStereoBond( at[cur_at].elname, at[cur_at].charge, at[cur_at].radical ))
  ------------------
  |  Branch (2619:9): [True: 87.3k, False: 53.8k]
  ------------------
 2620|  87.3k|    {
 2621|  87.3k|        return 0;
 2622|  87.3k|    }
 2623|       |
 2624|       |    /*  Count bonds and find the second atom on the stereo bond */
 2625|  53.8k|    num_2s = num_alt = num_wrong_bonds_1 = 0;
 2626|  53.8k|#if ( N_V_STEREOBONDS == 1 )
 2627|  53.8k|    num_2s_hetero[0] = num_2s_hetero[1] = type_N = 0;
 2628|  53.8k|    if (0 == at[cur_at].num_H && 0 == at[cur_at].charge && 0 == at[cur_at].radical &&
  ------------------
  |  Branch (2628:9): [True: 49.9k, False: 3.89k]
  |  Branch (2628:34): [True: 43.8k, False: 6.06k]
  |  Branch (2628:60): [True: 43.8k, False: 0]
  ------------------
 2629|  43.8k|         3 == get_endpoint_valence( at[cur_at].el_number ))
  ------------------
  |  Branch (2629:10): [True: 27.5k, False: 16.3k]
  ------------------
 2630|  27.5k|    {
 2631|  27.5k|        if (2 == at[cur_at].valence && 3 == at[cur_at].chem_bonds_valence)
  ------------------
  |  Branch (2631:13): [True: 21.9k, False: 5.52k]
  |  Branch (2631:40): [True: 19.6k, False: 2.36k]
  ------------------
 2632|  19.6k|        {
 2633|  19.6k|            type_N = 1;
 2634|  19.6k|        }
 2635|  7.88k|        else
 2636|  7.88k|        {
 2637|  7.88k|            if (3 == at[cur_at].valence && 5 == at[cur_at].chem_bonds_valence)
  ------------------
  |  Branch (2637:17): [True: 5.52k, False: 2.36k]
  |  Branch (2637:44): [True: 4.44k, False: 1.07k]
  ------------------
 2638|  4.44k|            {
 2639|  4.44k|                type_N = 2; /* unfortunately includes >N# */
 2640|  4.44k|            }
 2641|  7.88k|        }
 2642|  27.5k|    }
 2643|  53.8k|#endif
 2644|   135k|    for (i = 0, num_stereo_bonds = 0; i < at[cur_at].valence; i++)
  ------------------
  |  Branch (2644:39): [True: 102k, False: 33.0k]
  ------------------
 2645|   102k|    {
 2646|   102k|        bFound = 0;
 2647|   102k|        next_at = at[cur_at].neighbor[i];
 2648|   102k|        bond_type = get_allowed_stereo_bond_type( (int) at[cur_at].bond_type[i] );
 2649|   102k|        if (bond_type == BOND_ALTERN)
  ------------------
  |  |  180|   102k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|   102k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (2649:13): [True: 7.58k, False: 94.8k]
  ------------------
 2650|  7.58k|        {
 2651|  7.58k|            num_alt++;
 2652|  7.58k|            if (cur_at > next_at && !( nMode & CMODE_NO_ALT_SBONDS ))
  ------------------
  |  |  777|  3.91k|#define CMODE_NO_ALT_SBONDS      0x000100 /* 6-14-2002: do not assign stereo to alternating bonds */
  ------------------
  |  Branch (2652:17): [True: 3.91k, False: 3.67k]
  |  Branch (2652:37): [True: 3.91k, False: 0]
  ------------------
 2653|  3.91k|            {
 2654|  3.91k|                bFound = 1;
 2655|  3.91k|            }
 2656|  7.58k|        }
 2657|  94.8k|        else
 2658|  94.8k|        {
 2659|  94.8k|            if (bond_type == BOND_DOUBLE)
  ------------------
  |  |  178|  94.8k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|  94.8k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (2659:17): [True: 28.3k, False: 66.5k]
  ------------------
 2660|  28.3k|            {
 2661|  28.3k|                num_2s++;
 2662|  28.3k|#if ( N_V_STEREOBONDS == 1 )
 2663|  28.3k|                if (0 <= ( n2sh = bIsSuitableHeteroInpAtom( at + next_at ) ))
  ------------------
  |  Branch (2663:21): [True: 9.21k, False: 19.1k]
  ------------------
 2664|  9.21k|                {
 2665|  9.21k|                    num_2s_hetero[n2sh] ++; /* n2sh=0 -> =N- or =NH; n2sh=1 -> =O */
 2666|  9.21k|                }
 2667|  28.3k|#endif
 2668|  28.3k|                if (cur_at > next_at)
  ------------------
  |  Branch (2668:21): [True: 11.7k, False: 16.5k]
  ------------------
 2669|  11.7k|                    bFound = 1;
 2670|  28.3k|            }
 2671|  66.5k|            else
 2672|  66.5k|            {
 2673|  66.5k|                if (bond_type != BOND_SINGLE && bond_type != BOND_TAUTOM)
  ------------------
  |  |  177|  66.5k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|   133k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                              if (bond_type != BOND_SINGLE && bond_type != BOND_TAUTOM)
  ------------------
  |  |  185|  32.0k|#define BOND_TAUTOM              8
  ------------------
  |  Branch (2673:21): [True: 32.0k, False: 34.5k]
  |  Branch (2673:49): [True: 24.3k, False: 7.68k]
  ------------------
 2674|  24.3k|                {
 2675|  24.3k|                    num_wrong_bonds_1++;
 2676|  24.3k|#if ( ONE_BAD_SB_NEIGHBOR == 1 )
 2677|  24.3k|                    if (num_wrong_bonds_1 > 1 || (num_wrong_bonds_1 && 2 >= at[cur_at].valence)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2677:25): [True: 2.09k, False: 22.2k]
  |  Branch (2677:51): [True: 22.2k, False: 0]
  |  Branch (2677:72): [True: 18.6k, False: 3.56k]
  ------------------
 2678|  20.7k|                    {
 2679|  20.7k|                        return 0; /* wrong bond type */
 2680|  20.7k|                    }
 2681|  3.56k|                    else
 2682|  3.56k|                    {
 2683|  3.56k|                        continue;
 2684|  3.56k|                    }
 2685|       |#else
 2686|       |                    return 0; /*  wrong bond type */
 2687|       |#endif
 2688|  24.3k|                }
 2689|  66.5k|            }
 2690|  94.8k|        }
 2691|       |
 2692|  78.1k|        if (bFound)
  ------------------
  |  Branch (2692:13): [True: 15.6k, False: 62.4k]
  ------------------
 2693|  15.6k|        {
 2694|       |            /*  check "next_at" atom on the opposite side of the bond */
 2695|  15.6k|            if (MAX_NUM_STEREO_BOND_NEIGH < at[next_at].valence + at[next_at].num_H ||
  ------------------
  |  |  874|  15.6k|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (2695:17): [True: 221, False: 15.4k]
  ------------------
 2696|  15.4k|                 MIN_NUM_STEREO_BOND_NEIGH > at[next_at].valence + at[next_at].num_H)
  ------------------
  |  |  875|  15.4k|#define MIN_NUM_STEREO_BOND_NEIGH 2
  ------------------
  |  Branch (2696:18): [True: 2.23k, False: 13.2k]
  ------------------
 2697|  2.45k|            {
 2698|  2.45k|                continue;
 2699|  2.45k|            }
 2700|  13.2k|            if (!bCanAtomHaveAStereoBond( at[next_at].elname, at[next_at].charge, at[next_at].radical ))
  ------------------
  |  Branch (2700:17): [True: 2.21k, False: 11.0k]
  ------------------
 2701|  2.21k|            {
 2702|  2.21k|                continue;
 2703|  2.21k|            }
 2704|       |            /*  next atom neighbors */
 2705|  11.0k|            num_2s_next = num_alt_next = num_wrong_bonds_2 = 0;
 2706|  11.0k|#if ( N_V_STEREOBONDS == 1 )
 2707|  11.0k|            num_2s_hetero_next[0] = num_2s_hetero_next[1] = type_N_next = 0;
 2708|  11.0k|            if (0 == at[next_at].num_H && 0 == at[next_at].charge && 0 == at[next_at].radical &&
  ------------------
  |  Branch (2708:17): [True: 10.6k, False: 378]
  |  Branch (2708:43): [True: 10.2k, False: 404]
  |  Branch (2708:70): [True: 10.2k, False: 0]
  ------------------
 2709|  10.2k|                 3 == get_endpoint_valence( at[next_at].el_number ))
  ------------------
  |  Branch (2709:18): [True: 6.97k, False: 3.26k]
  ------------------
 2710|  6.97k|            {
 2711|  6.97k|                if (2 == at[next_at].valence && 3 == at[next_at].chem_bonds_valence)
  ------------------
  |  Branch (2711:21): [True: 6.14k, False: 828]
  |  Branch (2711:49): [True: 5.58k, False: 556]
  ------------------
 2712|  5.58k|                {
 2713|  5.58k|                    type_N_next = 1; /* -N= */
 2714|  5.58k|                }
 2715|  1.38k|                else
 2716|  1.38k|                {
 2717|  1.38k|                    if (3 == at[next_at].valence && 5 == at[next_at].chem_bonds_valence)
  ------------------
  |  Branch (2717:25): [True: 828, False: 556]
  |  Branch (2717:53): [True: 806, False: 22]
  ------------------
 2718|    806|                    {
 2719|    806|                        type_N_next = 2; /* unfortunately includes >N# */
 2720|    806|                    }
 2721|  1.38k|                }
 2722|  6.97k|            }
 2723|  11.0k|#endif
 2724|  34.4k|            for (j = 0; j < at[next_at].valence; j++)
  ------------------
  |  Branch (2724:25): [True: 23.4k, False: 11.0k]
  ------------------
 2725|  23.4k|            {
 2726|  23.4k|                bond_type = get_allowed_stereo_bond_type( (int) at[next_at].bond_type[j] );
 2727|  23.4k|                if (bond_type == BOND_ALTERN)
  ------------------
  |  |  180|  23.4k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|  23.4k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (2727:21): [True: 6.41k, False: 17.0k]
  ------------------
 2728|  6.41k|                {
 2729|  6.41k|                    num_alt_next++;
 2730|  6.41k|                }
 2731|  17.0k|                else
 2732|  17.0k|                {
 2733|  17.0k|                    if (bond_type == BOND_DOUBLE)
  ------------------
  |  |  178|  17.0k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|  17.0k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (2733:25): [True: 10.4k, False: 6.52k]
  ------------------
 2734|  10.4k|                    {
 2735|  10.4k|                        num_2s_next++;
 2736|  10.4k|#if ( N_V_STEREOBONDS == 1 )
 2737|  10.4k|                        next_next_at = at[next_at].neighbor[j];
 2738|  10.4k|                        if (0 <= ( n2sh = bIsSuitableHeteroInpAtom( at + next_next_at ) ))
  ------------------
  |  Branch (2738:29): [True: 4.19k, False: 6.28k]
  ------------------
 2739|  4.19k|                        {
 2740|  4.19k|                            num_2s_hetero_next[n2sh] ++; /* n2sh=0 -> =N- or =NH; n2sh=1 -> =O */
 2741|  4.19k|                        }
 2742|  10.4k|#endif
 2743|  10.4k|                    }
 2744|  6.52k|                    else
 2745|  6.52k|                    {
 2746|  6.52k|                        if (bond_type != BOND_SINGLE && bond_type != BOND_TAUTOM)
  ------------------
  |  |  177|  6.52k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|  13.0k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                                      if (bond_type != BOND_SINGLE && bond_type != BOND_TAUTOM)
  ------------------
  |  |  185|  1.47k|#define BOND_TAUTOM              8
  ------------------
  |  Branch (2746:29): [True: 1.47k, False: 5.04k]
  |  Branch (2746:57): [True: 1.47k, False: 4]
  ------------------
 2747|  1.47k|                        {
 2748|  1.47k|                            num_wrong_bonds_2++;
 2749|  1.47k|#if ( ONE_BAD_SB_NEIGHBOR == 1 )
 2750|  1.47k|                            if (num_wrong_bonds_1 > 1 || (num_wrong_bonds_1 && 2 >= at[cur_at].valence)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2750:33): [True: 0, False: 1.47k]
  |  Branch (2750:59): [True: 3, False: 1.47k]
  |  Branch (2750:80): [True: 0, False: 3]
  ------------------
 2751|      0|                            {
 2752|      0|                                break; /* wrong bond type */
 2753|      0|                            }
 2754|  1.47k|                            else
 2755|  1.47k|                            {
 2756|  1.47k|                                continue;
 2757|  1.47k|                            }
 2758|       |#else
 2759|       |                            break; /*  wrong bond type */
 2760|       |#endif
 2761|  1.47k|                        }
 2762|  6.52k|                    }
 2763|  17.0k|                }
 2764|  23.4k|            }
 2765|       |            /* figure out whether the at[cur_at]--at[next_at] bond may not be stereogenic */
 2766|       |
 2767|  11.0k|#if ( N_V_STEREOBONDS == 1 )
 2768|  11.0k|            if (3 == ( type_N | type_N_next ) &&
  ------------------
  |  Branch (2768:17): [True: 1.77k, False: 9.24k]
  ------------------
 2769|  1.77k|                ( (2 == type_N && !bIsOxide( at, cur_at )) ||
  ------------------
  |  Branch (2769:20): [True: 1.01k, False: 763]
  |  Branch (2769:35): [True: 592, False: 419]
  ------------------
 2770|  1.18k|                    (2 == type_N_next && !bIsOxide( at, next_at )) )) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (2770:22): [True: 763, False: 419]
  |  Branch (2770:42): [True: 677, False: 86]
  ------------------
 2771|  1.26k|            {
 2772|  1.26k|                bFound = 0;
 2773|  1.26k|            }
 2774|  9.75k|            else
 2775|  9.75k|#endif
 2776|  9.75k|            {
 2777|  9.75k|                if (j < at[next_at].valence ||                  /* at[next_at] has a wrong bond type*/
  ------------------
  |  Branch (2777:21): [True: 0, False: 9.75k]
  ------------------
 2778|  9.75k|                    ( num_alt_next > 0 ) + ( num_2s_next > 0 ) != 1     /* only one type of stereogenic bond permitted */
  ------------------
  |  Branch (2778:21): [True: 71, False: 9.67k]
  ------------------
 2779|  9.75k|                       )
 2780|     71|                {
 2781|     71|                    bFound = 0;
 2782|     71|                }
 2783|  9.67k|                else
 2784|  9.67k|                {
 2785|  9.67k|                    if (2 < num_2s_next)
  ------------------
  |  Branch (2785:25): [True: 0, False: 9.67k]
  ------------------
 2786|      0|                    {
 2787|      0|                        bFound = 0;
 2788|      0|                    }
 2789|  9.67k|                    else
 2790|  9.67k|                    {
 2791|  9.67k|                        if (2 == num_2s_next)
  ------------------
  |  Branch (2791:29): [True: 2.34k, False: 7.33k]
  ------------------
 2792|  2.34k|                        {
 2793|  2.34k|                            if (2 == at[next_at].valence)
  ------------------
  |  Branch (2793:33): [True: 2.24k, False: 109]
  ------------------
 2794|  2.24k|                            {
 2795|  2.24k|                                ; /* only one double bond permitted except cumulenes */
 2796|  2.24k|#if ( N_V_STEREOBONDS == 1 )
 2797|  2.24k|                            }
 2798|    109|                            else
 2799|    109|                            {
 2800|    109|                                if (1 == ( num_2s_hetero_next[0] | num_2s_hetero_next[1] ) &&
  ------------------
  |  Branch (2800:37): [True: 61, False: 48]
  ------------------
 2801|     61|                                        3 == at[next_at].valence + at[next_at].num_H &&
  ------------------
  |  Branch (2801:41): [True: 54, False: 7]
  ------------------
 2802|     54|                                        5 == at[next_at].chem_bonds_valence + at[next_at].num_H &&
  ------------------
  |  Branch (2802:41): [True: 54, False: 0]
  ------------------
 2803|     54|                                        3 == get_endpoint_valence( at[next_at].el_number ) &&
  ------------------
  |  Branch (2803:41): [True: 41, False: 13]
  ------------------
 2804|     41|                                        ( !type_N || bIsOxide( at, next_at ) ))
  ------------------
  |  Branch (2804:43): [True: 10, False: 31]
  |  Branch (2804:54): [True: 15, False: 16]
  ------------------
 2805|     25|                                {
 2806|     25|                                    ; /*
 2807|       |                                       *   found:
 2808|       |                                       *
 2809|       |                                       *    \      /    \      /    \      /
 2810|       |                                       *     \    /      \    /      \    /
 2811|       |                                       *      N==C   or   N==C   or   N==N
 2812|       |                                       *    //    \     //    \     //    \
 2813|       |                                       *   O  ^    \   N  ^    \   O  ^    \
 2814|       |                                       *      |           |           |
 2815|       |                                       *      |           |           |
 2816|       |                                       *      at[next_at] at[next_at] at[next_at]
 2817|       |                                       */
 2818|     25|#endif
 2819|     25|                                }
 2820|     84|                                else
 2821|     84|                                {
 2822|     84|                                    bFound = 0;
 2823|     84|                                }
 2824|    109|                            }
 2825|  2.34k|                        }
 2826|  9.67k|                    }
 2827|  9.67k|                }
 2828|  9.75k|            }
 2829|  11.0k|        }
 2830|  73.4k|        if (bFound)
  ------------------
  |  Branch (2830:13): [True: 9.59k, False: 63.8k]
  ------------------
 2831|  9.59k|        {
 2832|  9.59k|            num_stereo_bonds++;
 2833|  9.59k|        }
 2834|  73.4k|    }
 2835|       |
 2836|  33.0k|    if (( num_alt > 0 ) + ( num_2s > 0 ) != 1 || !num_stereo_bonds)
  ------------------
  |  Branch (2836:9): [True: 7.72k, False: 25.3k]
  |  Branch (2836:50): [True: 17.8k, False: 7.50k]
  ------------------
 2837|  25.5k|    {
 2838|  25.5k|        return 0;
 2839|  25.5k|    }
 2840|       |
 2841|  7.50k|    if (num_2s > 1)
  ------------------
  |  Branch (2841:9): [True: 1.57k, False: 5.92k]
  ------------------
 2842|  1.57k|    {
 2843|  1.57k|#if ( N_V_STEREOBONDS == 1 )
 2844|  1.57k|        if (2 == num_2s &&
  ------------------
  |  Branch (2844:13): [True: 1.57k, False: 0]
  ------------------
 2845|  1.57k|             1 == ( num_2s_hetero[0] | num_2s_hetero[1] ) &&
  ------------------
  |  Branch (2845:14): [True: 1.06k, False: 516]
  ------------------
 2846|  1.06k|             3 == at[cur_at].valence + at[cur_at].num_H &&
  ------------------
  |  Branch (2846:14): [True: 802, False: 260]
  ------------------
 2847|    802|             5 == at[cur_at].chem_bonds_valence + at[cur_at].num_H &&
  ------------------
  |  Branch (2847:14): [True: 802, False: 0]
  ------------------
 2848|    802|             3 == get_endpoint_valence( at[cur_at].el_number ))
  ------------------
  |  Branch (2848:14): [True: 799, False: 3]
  ------------------
 2849|    799|        {
 2850|    799|            ;
 2851|    799|        }
 2852|    779|        else
 2853|    779|        {
 2854|    779|            return 0;
 2855|    779|        }
 2856|       |#else
 2857|       |        return 0;
 2858|       |#endif
 2859|  1.57k|    }
 2860|       |
 2861|  6.72k|    return num_stereo_bonds;
 2862|  7.50k|}
ichister.c:get_allowed_stereo_bond_type:
 2554|   308k|{
 2555|       |#if (ALLOW_TAUT_ATTACHMENTS_TO_STEREO_BONDS == 0 )
 2556|       |    if (( bond_type & ~BOND_MARK_ALL ) == BOND_TAUTOM)
 2557|       |    {
 2558|       |        return 0; /*  no tautomer bonds allowed */
 2559|       |    }
 2560|       |    else
 2561|       |#endif
 2562|       |#if ( EXCL_ALL_AROM_BOND_PARITY  == 1 )  /* { */
 2563|       |    /*  a stereo bond cannot belong to an aromatic atom */
 2564|       |        if (( bond_type &= ~BOND_MARK_ALL ) == BOND_ALTERN)
 2565|       |        {
 2566|       |            return 0;
 2567|       |        }
 2568|       |#else  /* } { */
 2569|   308k|#if ( ADD_6MEMB_AROM_BOND_PARITY == 1 )
 2570|       |    /*  accept any aromatic bond as a stereo bond */
 2571|   308k|    if (( bond_type &= ~BOND_MARK_ALL ) == BOND_ALTERN)
  ------------------
  |  |  191|   308k|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
                  if (( bond_type &= ~BOND_MARK_ALL ) == BOND_ALTERN)
  ------------------
  |  |  180|   308k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|   308k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (2571:9): [True: 31.1k, False: 276k]
  ------------------
 2572|       |#else
 2573|       |    /*  accept only aromatic bonds in non-6-member rings */
 2574|       |    if (( bond_type &= ~BOND_MARK_ALL ) == BOND_ALTERN) )
 2575|       |#endif
 2576|  31.1k|    {
 2577|  31.1k|        return BOND_ALTERN;
  ------------------
  |  |  180|  31.1k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|  31.1k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
 2578|  31.1k|    }
 2579|   276k|#endif  /* } */
 2580|   276k|    else
 2581|   276k|    {
 2582|       |        /*  at this point BOND_MARK_ALL bits have been removed from bond_type */
 2583|   276k|        if (bond_type == BOND_DOUBLE || bond_type == BOND_SINGLE)
  ------------------
  |  |  178|   276k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|   553k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
                      if (bond_type == BOND_DOUBLE || bond_type == BOND_SINGLE)
  ------------------
  |  |  177|   188k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|   188k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (2583:13): [True: 88.3k, False: 188k]
  |  Branch (2583:41): [True: 101k, False: 86.8k]
  ------------------
 2584|   190k|        {
 2585|   190k|            return bond_type;
 2586|   190k|        }
 2587|  86.8k|#if (ALLOW_TAUT_ATTACHMENTS_TO_STEREO_BONDS == 1 )
 2588|  86.8k|        else
 2589|  86.8k|        {
 2590|  86.8k|            if (bond_type == BOND_TAUTOM)
  ------------------
  |  |  185|  86.8k|#define BOND_TAUTOM              8
  ------------------
  |  Branch (2590:17): [True: 16.8k, False: 69.9k]
  ------------------
 2591|  16.8k|            {
 2592|  16.8k|                return BOND_TAUTOM;
  ------------------
  |  |  185|  16.8k|#define BOND_TAUTOM              8
  ------------------
 2593|  16.8k|            }
 2594|  86.8k|        }
 2595|   276k|#endif
 2596|   276k|    }
 2597|       |
 2598|  69.9k|    return 0; /*  wrong bond type */
 2599|   308k|}
ichister.c:bIsSuitableHeteroInpAtom:
 1600|  70.3k|{
 1601|  70.3k|    int val, num_H;
 1602|  70.3k|    if (0 == at->charge &&
  ------------------
  |  Branch (1602:9): [True: 57.3k, False: 12.9k]
  ------------------
 1603|  57.3k|        ( !at->radical || RADICAL_SINGLET == at->radical ) &&
  ------------------
  |  |   75|  2.23k|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (1603:11): [True: 55.1k, False: 2.23k]
  |  Branch (1603:27): [True: 0, False: 2.23k]
  ------------------
 1604|  55.1k|         0 < ( val = get_endpoint_valence( at->el_number ) ))
  ------------------
  |  Branch (1604:10): [True: 41.6k, False: 13.5k]
  ------------------
 1605|  41.6k|    {
 1606|  41.6k|        num_H = at->num_H;
 1607|  41.6k|        if (val == at->chem_bonds_valence + num_H)
  ------------------
  |  Branch (1607:13): [True: 26.5k, False: 15.0k]
  ------------------
 1608|  26.5k|        {
 1609|  26.5k|            switch (val)
  ------------------
  |  Branch (1609:21): [True: 26.5k, False: 0]
  ------------------
 1610|  26.5k|            {
 1611|  5.80k|                case 2: /* O */
  ------------------
  |  Branch (1611:17): [True: 5.80k, False: 20.7k]
  ------------------
 1612|  5.80k|                    if (!num_H && 1 == at->valence)
  ------------------
  |  Branch (1612:25): [True: 5.76k, False: 41]
  |  Branch (1612:35): [True: 5.76k, False: 0]
  ------------------
 1613|  5.76k|                    {
 1614|  5.76k|                        return 0; /* =O */
 1615|  5.76k|                    }
 1616|     41|                    break;        /* not found */
 1617|  20.7k|                case 3: /* N */
  ------------------
  |  Branch (1617:17): [True: 20.7k, False: 5.80k]
  ------------------
 1618|  20.7k|                    if ((1 == at->valence && 1 == num_H) ||
  ------------------
  |  Branch (1618:26): [True: 616, False: 20.1k]
  |  Branch (1618:46): [True: 616, False: 0]
  ------------------
 1619|  20.1k|                         (2 == at->valence && 0 == num_H)) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (1619:27): [True: 20.0k, False: 84]
  |  Branch (1619:47): [True: 19.9k, False: 127]
  ------------------
 1620|  20.5k|                    {
 1621|  20.5k|                        return 1; /* =N- or =NH */
 1622|  20.5k|                    }
 1623|    211|                    break;        /* not found */
 1624|  26.5k|            }
 1625|  26.5k|        }
 1626|  41.6k|    }
 1627|  44.0k|    return -1;
 1628|  70.3k|}
ichister.c:bIsOxide:
 1633|  3.37k|{
 1634|  3.37k|    int i, bond_type;
 1635|  3.37k|    inp_ATOM  *a = at + cur_at, *an;
 1636|  12.0k|    for (i = 0; i < a->valence; i++)
  ------------------
  |  Branch (1636:17): [True: 9.60k, False: 2.40k]
  ------------------
 1637|  9.60k|    {
 1638|  9.60k|        bond_type = ( a->bond_type[i] &= ~BOND_MARK_ALL );
  ------------------
  |  |  191|  9.60k|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 1639|  9.60k|        if (bond_type == BOND_DOUBLE)
  ------------------
  |  |  178|  9.60k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|  9.60k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (1639:13): [True: 5.70k, False: 3.90k]
  ------------------
 1640|  5.70k|        {
 1641|  5.70k|            an = at + (int) a->neighbor[i];
 1642|  5.70k|            if (1 == an->valence &&
  ------------------
  |  Branch (1642:17): [True: 1.48k, False: 4.22k]
  ------------------
 1643|  1.48k|                 !an->charge && !an->num_H && !an->radical &&
  ------------------
  |  Branch (1643:18): [True: 984, False: 498]
  |  Branch (1643:33): [True: 960, False: 24]
  |  Branch (1643:47): [True: 954, False: 6]
  ------------------
 1644|    954|                 2 == get_endpoint_valence( an->el_number ))
  ------------------
  |  Branch (1644:18): [True: 944, False: 10]
  ------------------
 1645|    944|            {
 1646|    944|                return 1;
 1647|    944|            }
 1648|  5.70k|        }
 1649|  3.90k|        else
 1650|  3.90k|        {
 1651|  3.90k|            if (bond_type == BOND_TAUTOM || bond_type == BOND_ALT12NS)
  ------------------
  |  |  185|  7.81k|#define BOND_TAUTOM              8
  ------------------
                          if (bond_type == BOND_TAUTOM || bond_type == BOND_ALT12NS)
  ------------------
  |  |  186|  3.90k|#define BOND_ALT12NS             9
  ------------------
  |  Branch (1651:17): [True: 0, False: 3.90k]
  |  Branch (1651:45): [True: 54, False: 3.85k]
  ------------------
 1652|     54|            {
 1653|     54|                an = at + (int) a->neighbor[i];
 1654|     54|                if (1 == an->valence &&
  ------------------
  |  Branch (1654:21): [True: 27, False: 27]
  ------------------
 1655|     27|                     2 == get_endpoint_valence( an->el_number ))
  ------------------
  |  Branch (1655:22): [True: 26, False: 1]
  ------------------
 1656|     26|                {
 1657|     26|                    return 1;
 1658|     26|                }
 1659|     54|            }
 1660|  3.90k|        }
 1661|  9.60k|    }
 1662|       |
 1663|  2.40k|    return 0;
 1664|  3.37k|}
ichister.c:set_stereo_atom_parity:
 3765|  1.09M|{
 3766|  1.09M|    int    j, k, next_at, num_z, j1, nType, num_explicit_H, tot_num_iso_H, nMustHaveNumNeigh;
 3767|  1.09M|    int    num_explicit_iso_H[NUM_H_ISOTOPES + 1];
 3768|       |                    /*  numbers of removed hydrogen atoms   */
 3769|  1.09M|    int    index_H[MAX_NUM_STEREO_ATOM_NEIGH];
 3770|       |                    /*  cannot have more than 4 elements: 1 H, 1 D, 1 T atom(s) */
 3771|  1.09M|    double z, sum_xyz[3], min_sine, triple_product;
 3772|  1.09M|    double at_coord[MAX_NUM_STEREO_ATOM_NEIGH][3];
 3773|  1.09M|    double bond_len_xy[4], rmax = 0.0, rmin = 0.0;
 3774|  1.09M|    double at_coord_center[3];
 3775|  1.09M|    int    parity, bAmbiguous = 0, bAddExplicitNeighbor = 0, b2D = 0, n2DTetrahedralAmbiguity = 0;
 3776|  1.09M|    int    bIgnoreIsotopicH = ( 0 != ( at[cur_at].cFlags & AT_FLAG_ISO_H_POINT ) );
  ------------------
  |  |   50|  1.09M|#define AT_FLAG_ISO_H_POINT 0x01 /**< may have isotopic H */
  ------------------
 3777|  1.09M|    AT_NUMB nSbNeighOrigAtNumb[MAX_NUM_STEREO_ATOM_NEIGH];
 3778|       |
 3779|  1.09M|    double vMinAngle = MIN_ANGLE;
  ------------------
  |  |   29|  1.09M|#define MIN_ANGLE             0.10    /*  5.73 degrees */ /* treshold for proximity to in-line angle of 180 deg */
  ------------------
 3780|  1.09M|    double vMinSine = MIN_SINE;
  ------------------
  |  |   30|  1.09M|#define MIN_SINE              0.03    /*min edge/plane angle in case the tetrahedra has significantly different edge length */
  ------------------
 3781|  1.09M|    if (LooseTSACheck)
  ------------------
  |  Branch (3781:9): [True: 0, False: 1.09M]
  ------------------
 3782|      0|    {
 3783|       |        /* Relax check for principal 3-atomic angles close to 180 deg, for 2D tetrahedron, to account for           */
 3784|       |        /* large cycles drawn as appear after applying some structure 'cleaning' algorithms/softwares               */
 3785|       |
 3786|      0|        if (at[cur_at].nNumAtInRingSystem >= 3) /* Ensure that central atom is in ring (ideally, one should check   */
  ------------------
  |  Branch (3786:13): [True: 0, False: 0]
  ------------------
 3787|       |                                                /* also that neighbors are in-ring, and for large enough ring)      */
 3788|      0|        {
 3789|      0|            vMinAngle = MIN_ANGLE_RELAXED;
  ------------------
  |  |   31|      0|#define MIN_ANGLE_RELAXED     0.001
  ------------------
 3790|      0|            vMinSine = MIN_SINE_RELAXED;
  ------------------
  |  |   32|      0|#define MIN_SINE_RELAXED      0.001
  ------------------
 3791|      0|        }
 3792|      0|    }
 3793|       |
 3794|  1.09M|    out_at[cur_at].parity =
 3795|  1.09M|        out_at[cur_at].parity2 =
 3796|  1.09M|        out_at[cur_at].stereo_atom_parity =
 3797|  1.09M|        out_at[cur_at].stereo_atom_parity2 =
 3798|  1.09M|        AB_PARITY_NONE;
  ------------------
  |  |  218|  1.09M|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
 3799|  1.09M|    parity = AB_PARITY_NONE;
  ------------------
  |  |  218|  1.09M|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
 3800|       |
 3801|  1.09M|    memset( num_explicit_iso_H, 0, sizeof( num_explicit_iso_H ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 3802|  1.09M|    num_explicit_H = 0;
 3803|       |
 3804|  1.09M|#if ( NEW_STEREOCENTER_CHECK == 1 )
 3805|  1.09M|    if (!( nMustHaveNumNeigh = bCanInpAtomBeAStereoCenter( at, cur_at, bPointedEdgeStereo, bStereoAtZz ) ) ||
  ------------------
  |  Branch (3805:9): [True: 1.08M, False: 8.56k]
  ------------------
 3806|  8.56k|         at[cur_at].num_H > NUM_H_ISOTOPES)
  ------------------
  |  |   25|  8.56k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3806:10): [True: 0, False: 8.56k]
  ------------------
 3807|  1.08M|    {
 3808|  1.08M|        goto exit_function;
 3809|  1.08M|    }
 3810|       |#else
 3811|       |    nMustHaveNumNeigh = MAX_NUM_STEREO_ATOM_NEIGH;
 3812|       |    if (!bCanAtomBeAStereoCenter( at[cur_at].elname, at[cur_at].charge, at[cur_at].radical ) ||
 3813|       |         at[cur_at].valence + at[cur_at].num_H != nMustHaveNumNeigh ||
 3814|       |         at[cur_at].num_H > NUM_H_ISOTOPES
 3815|       |       )
 3816|       |    {
 3817|       |        goto exit_function;
 3818|       |    }
 3819|       |    for (j = 0; j < at[cur_at].valence; j++)
 3820|       |    {
 3821|       |        if (( at[cur_at].bond_type[j] & ~BOND_MARK_ALL ) != BOND_SINGLE)
 3822|       |        {
 3823|       |            goto exit_function;
 3824|       |        }
 3825|       |    }
 3826|       |#endif
 3827|       |
 3828|       |    /*  numbers of isotopic H atoms */
 3829|  34.1k|    for (j = 0, tot_num_iso_H = 0; j < NUM_H_ISOTOPES; j++)
  ------------------
  |  |   25|  34.1k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3829:36): [True: 25.6k, False: 8.52k]
  ------------------
 3830|  25.6k|    {
 3831|  25.6k|        if (at[cur_at].num_iso_H[j] > 1)
  ------------------
  |  Branch (3831:13): [True: 39, False: 25.5k]
  ------------------
 3832|     39|        {
 3833|     39|            goto exit_function; /*  two or more identical hydrogen isotopic neighbors */
 3834|     39|        }
 3835|  25.5k|        tot_num_iso_H += at[cur_at].num_iso_H[j];
 3836|  25.5k|    }
 3837|  8.52k|    if (bIgnoreIsotopicH)
  ------------------
  |  Branch (3837:9): [True: 0, False: 8.52k]
  ------------------
 3838|      0|    {
 3839|      0|        tot_num_iso_H = 0; /* isotopic H considered subject to exchange => ignore isotopic */
 3840|      0|    }
 3841|       |    /*  number of non-isotopic H atoms */
 3842|  8.52k|    if (at[cur_at].num_H - tot_num_iso_H > 1)
  ------------------
  |  Branch (3842:9): [True: 129, False: 8.39k]
  ------------------
 3843|    129|    {
 3844|    129|        goto exit_function; /*  two or more identical hydrogen non-isotopic neighbors */
 3845|    129|    }
 3846|       |
 3847|       |    /*  count removed explicit terminal hydrogens attached to at[cur_at]. */
 3848|       |    /*  the result is num_explicit_H. */
 3849|       |    /*  Removed hydrogens are sorted in increasing isotopic shift order */
 3850|  8.39k|    if (at_removed_H && num_removed_H > 0)
  ------------------
  |  Branch (3850:9): [True: 8.39k, False: 0]
  |  Branch (3850:25): [True: 618, False: 7.77k]
  ------------------
 3851|    618|    {
 3852|  1.46k|        for (j = 0; j < num_removed_H; j++)
  ------------------
  |  Branch (3852:21): [True: 843, False: 618]
  ------------------
 3853|    843|        {
 3854|    843|            if (at_removed_H[j].neighbor[0] == cur_at)
  ------------------
  |  Branch (3854:17): [True: 103, False: 740]
  ------------------
 3855|    103|            {
 3856|    103|                k = at_removed_H[j].iso_atw_diff;
 3857|       |                /*  iso_atw_diff values: H=>0, 1H=>1, D=2H=>2, T=3H=>3 */
 3858|    103|                if (k < 0 || k > NUM_H_ISOTOPES || bIgnoreIsotopicH)
  ------------------
  |  |   25|    206|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3858:21): [True: 0, False: 103]
  |  Branch (3858:30): [True: 0, False: 103]
  |  Branch (3858:52): [True: 0, False: 103]
  ------------------
 3859|      0|                {
 3860|      0|                    k = 0; /*  treat wrong H isotopes as non-isotopic H */
 3861|      0|                }
 3862|    103|                num_explicit_iso_H[k] ++;
 3863|    103|                index_H[num_explicit_H++] = j;
 3864|    103|            }
 3865|    843|        }
 3866|    618|    }
 3867|       |
 3868|       |    /*  coordinates initialization */
 3869|  8.39k|    num_z = 0;
 3870|  8.39k|    sum_xyz[0] = sum_xyz[1] = sum_xyz[2] = 0.0;
 3871|       |
 3872|  8.39k|    at_coord_center[0]      =
 3873|  8.39k|        at_coord_center[1]  =
 3874|  8.39k|        at_coord_center[2]  =
 3875|  8.39k|        0.0;
 3876|       |
 3877|       |        /*  fill out stereo center neighbors coordinates */
 3878|       |        /*  and obtain the parity from the geometry */
 3879|       |
 3880|  25.1k|    for (k = 0, j1 = 0; k < 2; k++)
  ------------------
  |  Branch (3880:25): [True: 16.7k, False: 8.39k]
  ------------------
 3881|  16.7k|    {
 3882|  16.7k|        switch (k)
  ------------------
  |  Branch (3882:17): [True: 16.7k, False: 0]
  ------------------
 3883|  16.7k|        {
 3884|       |
 3885|  8.39k|            case 0:
  ------------------
  |  Branch (3885:13): [True: 8.39k, False: 8.39k]
  ------------------
 3886|       |                /*   add coordinates of removed hydrogens */
 3887|  8.49k|                for (j = 0; j < num_explicit_H; j++, j1++)
  ------------------
  |  Branch (3887:29): [True: 103, False: 8.39k]
  ------------------
 3888|    103|                {
 3889|    103|                    next_at = index_H[j];
 3890|       |                    /*  Use bond description located at removed_H atom */
 3891|       |                    /*  minus sign at get_z_coord: at_removed_H[] contains bonds TO at[cur_at], not FROM it. */
 3892|       |                    /*  Note: &at[(at_removed_H-at)+ next_at] == &at_removed_H[next_at] */
 3893|    103|                    z = -get_z_coord( at,
 3894|    103|                                      (int) ( at_removed_H - at ) + next_at,
 3895|    103|                                      0 /*neighbor #*/,
 3896|    103|                                      &nType,
 3897|    103|                                      -( bPointedEdgeStereo & PES_BIT_POINT_EDGE_STEREO ) );
  ------------------
  |  |   44|    103|#define PES_BIT_POINT_EDGE_STEREO    1
  ------------------
 3898|    103|                    switch (nType)
  ------------------
  |  Branch (3898:29): [True: 0, False: 103]
  ------------------
 3899|    103|                    {
 3900|      0|                        case ZTYPE_EITHER:
  ------------------
  |  |   24|      0|#define    ZTYPE_EITHER   9999
  ------------------
  |  Branch (3900:25): [True: 0, False: 103]
  ------------------
 3901|      0|                            parity = vABParityUnknown /*AB_PARITY_UNKN*/; /*  no parity: bond in "Either" direction. */
 3902|      0|                            goto exit_function;
 3903|      0|                        case ZTYPE_UP:
  ------------------
  |  |   22|      0|#define    ZTYPE_UP       1     /*  should be equal to -ZTYPE_DOWN */
  ------------------
  |  Branch (3903:25): [True: 0, False: 103]
  ------------------
 3904|      0|                        case ZTYPE_DOWN:
  ------------------
  |  |   20|      0|#define    ZTYPE_DOWN     (-1)  /*  should be equal to -ZTYPE_UP */
  ------------------
  |  Branch (3904:25): [True: 0, False: 103]
  ------------------
 3905|      0|                            nType = -nType; /*  at_removed_H[] contains bonds TO the center, not from */
 3906|      0|                            b2D++;
 3907|       |                            /*  no break; here */
 3908|      0|                        case ZTYPE_3D:
  ------------------
  |  |   23|      0|#define    ZTYPE_3D       3
  ------------------
  |  Branch (3908:25): [True: 0, False: 103]
  ------------------
 3909|      0|                            num_z++;
 3910|    103|                    }
 3911|       |
 3912|    103|                    if (j1 < MAX_NUM_STEREO_ATOM_NEIGH) /* djb-rwth: fixing oss-fuzz issue #71142 */
  ------------------
  |  |  877|    103|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (3912:25): [True: 103, False: 0]
  ------------------
 3913|    103|                    {
 3914|    103|                        nSbNeighOrigAtNumb[j1] = at_removed_H[next_at].orig_at_number;
 3915|    103|                        at_coord[j1][0] = at_removed_H[next_at].x - at[cur_at].x;
 3916|    103|                        at_coord[j1][1] = at_removed_H[next_at].y - at[cur_at].y;
 3917|    103|                        bond_len_xy[j1] = len2(at_coord[j1]);
 3918|       |                        /* bond_len_xy[j1] = sqrt(at_coord[j1][0]*at_coord[j1][0]+at_coord[j1][1]*at_coord[j1][1]); */
 3919|    103|                        at_coord[j1][2] = (nType == ZTYPE_3D ? z : nType == ZTYPE_UP
  ------------------
  |  |   23|    103|#define    ZTYPE_3D       3
  ------------------
                                      at_coord[j1][2] = (nType == ZTYPE_3D ? z : nType == ZTYPE_UP
  ------------------
  |  |   22|    103|#define    ZTYPE_UP       1     /*  should be equal to -ZTYPE_DOWN */
  ------------------
  |  Branch (3919:44): [True: 0, False: 103]
  |  Branch (3919:68): [True: 0, False: 103]
  ------------------
 3920|    103|                            ? bond_len_xy[j1] : nType == ZTYPE_DOWN
  ------------------
  |  |   20|    103|#define    ZTYPE_DOWN     (-1)  /*  should be equal to -ZTYPE_UP */
  ------------------
  |  Branch (3920:49): [True: 0, False: 103]
  ------------------
 3921|    103|                            ? -bond_len_xy[j1] : 0.0);
 3922|    103|                    }
 3923|      0|                    else
 3924|      0|                    {
 3925|      0|                        break;
 3926|      0|                    }
 3927|    103|                }
 3928|  8.39k|                break;
 3929|  8.39k|            case 1:
  ------------------
  |  Branch (3929:13): [True: 8.39k, False: 8.39k]
  ------------------
 3930|       |                /*  add all coordinates of other neighboring atoms */
 3931|  38.9k|                for (j = 0; j < at[cur_at].valence; j++, j1++)
  ------------------
  |  Branch (3931:29): [True: 30.5k, False: 8.39k]
  ------------------
 3932|  30.5k|                {
 3933|  30.5k|                    next_at = at[cur_at].neighbor[j];
 3934|  30.5k|                    z = get_z_coord( at, cur_at, j, &nType, ( bPointedEdgeStereo & PES_BIT_POINT_EDGE_STEREO ) );
  ------------------
  |  |   44|  30.5k|#define PES_BIT_POINT_EDGE_STEREO    1
  ------------------
 3935|  30.5k|                    switch (nType)
  ------------------
  |  Branch (3935:29): [True: 0, False: 30.5k]
  ------------------
 3936|  30.5k|                    {
 3937|      0|                        case ZTYPE_EITHER:
  ------------------
  |  |   24|      0|#define    ZTYPE_EITHER   9999
  ------------------
  |  Branch (3937:25): [True: 0, False: 30.5k]
  ------------------
 3938|      0|                            parity = vABParityUnknown /*AB_PARITY_UNKN*/; /*  unknown parity: bond in "Either" direction. */
 3939|      0|                            goto exit_function;
 3940|      0|                        case ZTYPE_UP:
  ------------------
  |  |   22|      0|#define    ZTYPE_UP       1     /*  should be equal to -ZTYPE_DOWN */
  ------------------
  |  Branch (3940:25): [True: 0, False: 30.5k]
  ------------------
 3941|      0|                        case ZTYPE_DOWN:
  ------------------
  |  |   20|      0|#define    ZTYPE_DOWN     (-1)  /*  should be equal to -ZTYPE_UP */
  ------------------
  |  Branch (3941:25): [True: 0, False: 30.5k]
  ------------------
 3942|      0|                            b2D++;
 3943|      0|                        case ZTYPE_3D:
  ------------------
  |  |   23|      0|#define    ZTYPE_3D       3
  ------------------
  |  Branch (3943:25): [True: 0, False: 30.5k]
  ------------------
 3944|      0|                            num_z++;
 3945|  30.5k|                    }
 3946|       |
 3947|  30.5k|                    if (j1 < MAX_NUM_STEREO_ATOM_NEIGH) /* djb-rwth: fixing oss-fuzz issue #71142 */
  ------------------
  |  |  877|  30.5k|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (3947:25): [True: 30.5k, False: 4]
  ------------------
 3948|  30.5k|                    {
 3949|  30.5k|                        nSbNeighOrigAtNumb[j1] = at[next_at].orig_at_number;
 3950|  30.5k|                        at_coord[j1][0] = at[next_at].x - at[cur_at].x;
 3951|  30.5k|                        at_coord[j1][1] = at[next_at].y - at[cur_at].y;
 3952|  30.5k|                        bond_len_xy[j1] = len2(at_coord[j1]);
 3953|       |                        /* bond_len_xy[j1] = sqrt(at_coord[j1][0]*at_coord[j1][0]+at_coord[j1][1]*at_coord[j1][1]); */
 3954|  30.5k|                        at_coord[j1][2] = (nType == ZTYPE_3D ? z :
  ------------------
  |  |   23|  30.5k|#define    ZTYPE_3D       3
  ------------------
  |  Branch (3954:44): [True: 0, False: 30.5k]
  ------------------
 3955|  30.5k|                            nType == ZTYPE_UP ? bond_len_xy[j1] :
  ------------------
  |  |   22|  30.5k|#define    ZTYPE_UP       1     /*  should be equal to -ZTYPE_DOWN */
  ------------------
  |  Branch (3955:29): [True: 0, False: 30.5k]
  ------------------
 3956|  30.5k|                            nType == ZTYPE_DOWN ? -bond_len_xy[j1] : 0.0);
  ------------------
  |  |   20|  30.5k|#define    ZTYPE_DOWN     (-1)  /*  should be equal to -ZTYPE_UP */
  ------------------
  |  Branch (3956:29): [True: 0, False: 30.5k]
  ------------------
 3957|  30.5k|                    }
 3958|      4|                    else
 3959|      4|                    {
 3960|      4|                        break;
 3961|      4|                    }
 3962|  30.5k|                }
 3963|  8.39k|                break;
 3964|  16.7k|        }
 3965|  16.7k|    }
 3966|       |    /* j1 is the number of explicit neighbors (that is, all neighbors except implicit H) */
 3967|  8.39k|    b2D = ( b2D == num_z && num_z );  /*  1 => two-dimensional */
  ------------------
  |  Branch (3967:13): [True: 8.39k, False: 0]
  |  Branch (3967:29): [True: 0, False: 8.39k]
  ------------------
 3968|       |
 3969|  8.39k|    if (MAX_NUM_STEREO_ATOM_NEIGH != at[cur_at].valence + num_explicit_H &&
  ------------------
  |  |  877|  8.39k|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (3969:9): [True: 2.96k, False: 5.43k]
  ------------------
 3970|  2.96k|         MAX_NUM_STEREO_ATOM_NEIGH - 1 != at[cur_at].valence + num_explicit_H)
  ------------------
  |  |  877|  2.96k|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (3970:10): [True: 6, False: 2.95k]
  ------------------
 3971|      6|    {
 3972|       |        /*  not enough geometry data to find the central atom parity */
 3973|      6|        if (nMustHaveNumNeigh == at[cur_at].valence + at[cur_at].num_H &&
  ------------------
  |  Branch (3973:13): [True: 6, False: 0]
  ------------------
 3974|      6|            at[cur_at].num_H > 1)
  ------------------
  |  Branch (3974:13): [True: 1, False: 5]
  ------------------
 3975|      1|        {
 3976|       |            /*  only isotopic parity is possible; no non-isotopic parity */
 3977|      1|            if (parity == vABParityUnknown /*AB_PARITY_UNKN*/)
  ------------------
  |  Branch (3977:17): [True: 0, False: 1]
  ------------------
 3978|      0|            {
 3979|      0|                parity = -vABParityUnknown /*AB_PARITY_UNKN*/; /*  the user marked the center as "unknown" */
 3980|      0|            }
 3981|      1|            else
 3982|      1|            {
 3983|      1|                parity = -AB_PARITY_UNDF; /*  not enough geometry; only isotopic parity is possible */
  ------------------
  |  |  222|      1|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 3984|      1|            }
 3985|      1|        }
 3986|      5|        else
 3987|      5|        {
 3988|      5|            parity = AB_PARITY_NONE;      /*  not a stereocenter at all */
  ------------------
  |  |  218|      5|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
 3989|      5|        }
 3990|      6|        goto exit_function;
 3991|      6|    }
 3992|       |    /*  make all vector lengths equal to 1; exit if too short. 9-10-2002 */
 3993|  8.38k|    for (j = 0; j < j1; j++)
  ------------------
  |  Branch (3993:17): [True: 8.38k, False: 0]
  ------------------
 3994|  8.38k|    {
 3995|  8.38k|        z = len3( at_coord[j] );
 3996|  8.38k|        if (z < MIN_BOND_LEN)
  ------------------
  |  |   39|  8.38k|#define MIN_BOND_LEN          0.000001
  ------------------
  |  Branch (3996:13): [True: 8.38k, False: 0]
  ------------------
 3997|  8.38k|        {
 3998|       |            /* bond length is too small: use 0D parities */
 3999|  8.38k|            if (AB_PARITY_NONE == ( parity = GetStereocenter0DParity( pCG, at, cur_at,
  ------------------
  |  |  218|  8.38k|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (3999:17): [True: 7.77k, False: 613]
  ------------------
 4000|  8.38k|                                                                      j1,nSbNeighOrigAtNumb,
 4001|  8.38k|                                                                      FlagSC_0D ) ))
  ------------------
  |  |   59|  8.38k|#define FlagSC_0D 1 /**< bUsed0DParity */
  ------------------
 4002|  7.77k|            {
 4003|  7.77k|                parity = AB_PARITY_UNDF;
  ------------------
  |  |  222|  7.77k|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 4004|  7.77k|            }
 4005|  8.38k|            goto exit_function;
 4006|  8.38k|        }
 4007|      0|#if ( STEREO_CENTER_BONDS_NORM == 1 )
 4008|      0|        else
 4009|      0|        {
 4010|      0|            mult3( at_coord[j], 1.0 / z, at_coord[j] );
 4011|      0|        }
 4012|      0|#endif
 4013|      0|        rmax = j ? inchi_max( rmax, z ) : z;
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (4013:16): [True: 0, False: 0]
  ------------------
 4014|      0|        rmin = j ? inchi_min( rmin, z ) : z;
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (4014:16): [True: 0, False: 0]
  ------------------
 4015|      0|    }
 4016|      0|    if (rmin / rmax < MIN_SINE)
  ------------------
  |  |   30|      0|#define MIN_SINE              0.03    /*min edge/plane angle in case the tetrahedra has significantly different edge length */
  ------------------
  |  Branch (4016:9): [True: 0, False: 0]
  ------------------
 4017|      0|    {
 4018|       |        /* bond ratio is too small: use 0D parities */
 4019|      0|        if (AB_PARITY_NONE == ( parity = GetStereocenter0DParity( pCG, at, cur_at, j1,
  ------------------
  |  |  218|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (4019:13): [True: 0, False: 0]
  ------------------
 4020|      0|            nSbNeighOrigAtNumb,
 4021|      0|            FlagSC_0D ) ))
  ------------------
  |  |   59|      0|#define FlagSC_0D 1 /**< bUsed0DParity */
  ------------------
 4022|      0|        {
 4023|      0|            parity = AB_PARITY_UNDF;
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 4024|      0|        }
 4025|      0|        goto exit_function;
 4026|      0|    }
 4027|      0|    for (j = 0; j < j1; j++)
  ------------------
  |  Branch (4027:17): [True: 0, False: 0]
  ------------------
 4028|      0|    {
 4029|      0|        add3( sum_xyz, at_coord[j], sum_xyz );
 4030|      0|    }
 4031|       |
 4032|       |    /*  Here j1 is a number of neighbors including explicit terminal isotopic H */
 4033|       |    /*  num_explicit_iso_H[0] = number of explicit non-isotopic hydrogen atom neighbors */
 4034|      0|    j = j1;
 4035|       |    /*  Add Explicit Neighbor */
 4036|      0|    if (j1 == MAX_NUM_STEREO_ATOM_NEIGH - 1)
  ------------------
  |  |  877|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (4036:9): [True: 0, False: 0]
  ------------------
 4037|      0|    {
 4038|       |        /*  Add an explicit neighbor if possible */
 4039|      0|        if (nMustHaveNumNeigh == MAX_NUM_STEREO_ATOM_NEIGH - 1)
  ------------------
  |  |  877|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (4039:13): [True: 0, False: 0]
  ------------------
 4040|      0|        {
 4041|      0|            bAddExplicitNeighbor = ADD_EXPLICIT_LONE_PAIR_NEIGH;
  ------------------
  |  | 3754|      0|#define ADD_EXPLICIT_LONE_PAIR_NEIGH 2
  ------------------
 4042|      0|        }
 4043|      0|        else
 4044|      0|        {
 4045|      0|            if (nMustHaveNumNeigh == MAX_NUM_STEREO_ATOM_NEIGH)
  ------------------
  |  |  877|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (4045:17): [True: 0, False: 0]
  ------------------
 4046|      0|            {
 4047|       |                /*  Check whether an explicit non-isotopic hydrogen can be added */
 4048|       |                /*  to an atom that is a stereogenic atom */
 4049|      0|                if (1 == at[cur_at].num_H - num_explicit_H &&     /*  the atom has only one one implicit hydrogen */
  ------------------
  |  Branch (4049:21): [True: 0, False: 0]
  ------------------
 4050|      0|                    1 == at[cur_at].num_H - tot_num_iso_H)
  ------------------
  |  Branch (4050:21): [True: 0, False: 0]
  ------------------
 4051|      0|                {
 4052|       |                    /*  this hydrogen is non-isotopic */
 4053|      0|                    bAddExplicitNeighbor = ADD_EXPLICIT_HYDROGEN_NEIGH;
  ------------------
  |  | 3753|      0|#define ADD_EXPLICIT_HYDROGEN_NEIGH  1
  ------------------
 4054|      0|                }
 4055|      0|            }
 4056|      0|        }
 4057|      0|    }
 4058|       |
 4059|      0|    if (bAddExplicitNeighbor)
  ------------------
  |  Branch (4059:9): [True: 0, False: 0]
  ------------------
 4060|      0|    {
 4061|       |        /***********************************************************
 4062|       |         * May happen only if (j1 == MAX_NUM_STEREO_ATOM_NEIGH-1)
 4063|       |         * 3 neighbors only, no H-neighbors. Create and add coordinates of an implicit H
 4064|       |         * or a fake 4th neighbor, that is, a lone pair
 4065|       |         */
 4066|      0|        if (parity == vABParityUnknown /*AB_PARITY_UNKN*/)
  ------------------
  |  Branch (4066:13): [True: 0, False: 0]
  ------------------
 4067|      0|        {
 4068|      0|            goto exit_function;  /*  the user insists the parity is unknown and the isotopic */
 4069|       |                                 /*  composition of the neighbors does not contradict */
 4070|      0|        }
 4071|      0|        else
 4072|      0|        {
 4073|      0|            if (num_z == 0 || are_3_vect_in_one_plane( at_coord, vMinSine ))
  ------------------
  |  Branch (4073:17): [True: 0, False: 0]
  |  Branch (4073:31): [True: 0, False: 0]
  ------------------
 4074|      0|            {
 4075|       |                /*  "hydrogen down" rule is needed to resolve an ambiguity */
 4076|      0|                if (num_z > 0)
  ------------------
  |  Branch (4076:21): [True: 0, False: 0]
  ------------------
 4077|      0|                {
 4078|      0|                    bAmbiguous |= AMBIGUOUS_STEREO;
  ------------------
  |  |  245|      0|#define AMBIGUOUS_STEREO           1
  ------------------
 4079|      0|                }
 4080|       |#if ( APPLY_IMPLICIT_H_DOWN_RULE == 1 )  /* { */
 4081|       |                /*  Although H should be at the top of the list, add it to the bottom. */
 4082|       |                /*  This will be taken care of later by inverting parity 1<->2 */
 4083|       |                at_coord[j][0] = 0.0;
 4084|       |                at_coord[j][1] = 0.0;
 4085|       |#if ( STEREO_CENTER_BONDS_NORM == 1 )
 4086|       |                at_coord[j][2] = -1.0;
 4087|       |#else
 4088|       |                at_coord[j][2] = -( bond_len_xy[0] + bond_len_xy[1] + bond_len_xy[2] ) / 3.0;
 4089|       |#endif
 4090|       |#else /* } APPLY_IMPLICIT_H_DOWN_RULE { */
 4091|       |#if (ALWAYS_SET_STEREO_PARITY == 1)
 4092|       |                parity = AB_PARITY_EVEN; /*  suppose atoms are pre-sorted (testing) */
 4093|       |#else
 4094|       |                /* All 3 bonds are in one plane: try to get 0D parities */
 4095|      0|                if (AB_PARITY_NONE == ( parity = GetStereocenter0DParity( pCG, at, cur_at,
  ------------------
  |  |  218|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (4095:21): [True: 0, False: 0]
  ------------------
 4096|      0|                                                                          j1,
 4097|      0|                                                                          nSbNeighOrigAtNumb,
 4098|      0|                                                                          FlagSC_0D ) ))
  ------------------
  |  |   59|      0|#define FlagSC_0D 1 /**< bUsed0DParity */
  ------------------
 4099|      0|                {
 4100|      0|                    parity = AB_PARITY_UNDF;
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 4101|      0|                }
 4102|       |                /*parity =  AB_PARITY_UNDF;*/ /*  no parity can be calculated found */
 4103|      0|#endif
 4104|      0|                goto exit_function;
 4105|      0|#endif /* } APPLY_IMPLICIT_H_DOWN_RULE */
 4106|      0|            }
 4107|      0|            else
 4108|      0|            {
 4109|       |                /*  we have enough information to find implicit hydrogen coordinates */
 4110|       |                /*
 4111|       |                at_coord[j][0] = -sum_x;
 4112|       |                at_coord[j][1] = -sum_y;
 4113|       |                at_coord[j][2] = -sum_z;
 4114|       |                */
 4115|       |                /* copy3(sum_xyz, at_coord[j]); -- djb-rwth: removing copy3 function */
 4116|      0|                memcpy(at_coord[j], sum_xyz, sizeof(sum_xyz));
 4117|      0|                change_sign3( at_coord[j], at_coord[j] );
 4118|      0|                z = len3( at_coord[j] );
 4119|       |#if ( FIX_STEREO_SCALING_BUG == 1 )
 4120|       |                if (z > 1.0)
 4121|       |                {
 4122|       |                    rmax *= z;
 4123|       |                }
 4124|       |                else
 4125|       |                {
 4126|       |                    rmin *= z;
 4127|       |                }
 4128|       |#else
 4129|       |                /* Comparing the original bond lengths to lenghts derived from normalized to 1 */
 4130|       |                /* This bug leads to pronouncing legitimate stereogenic atoms */
 4131|       |                /* connected by 3 bonds "undefined" if in a nicely drawn 2D structure */
 4132|       |                /* bond lengths are about 20 or greater. Reported by Reinhard Dunkel 2005-08-05 */
 4133|      0|                if (bPointedEdgeStereo & PES_BIT_FIX_SP3_BUG)
  ------------------
  |  |   47|      0|#define PES_BIT_FIX_SP3_BUG          8
  ------------------
  |  Branch (4133:21): [True: 0, False: 0]
  ------------------
 4134|      0|                {
 4135|       |                    /* coordinate scaling bug fixed here */
 4136|      0|                    if (z > 1.0)
  ------------------
  |  Branch (4136:25): [True: 0, False: 0]
  ------------------
 4137|      0|                    {
 4138|      0|                        rmax *= z;
 4139|      0|                    }
 4140|      0|                    else
 4141|      0|                    {
 4142|      0|                        rmin *= z;
 4143|      0|                    }
 4144|      0|                }
 4145|      0|                else
 4146|      0|                {
 4147|       |                    /* original InChI v.1 bug */
 4148|      0|                    rmax = inchi_max( rmax, z );
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4149|      0|                    rmin = inchi_min( rmin, z );
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4150|      0|                }
 4151|      0|#endif
 4152|      0|                if (z < MIN_BOND_LEN || rmin / rmax < MIN_SINE)
  ------------------
  |  |   39|      0|#define MIN_BOND_LEN          0.000001
  ------------------
                              if (z < MIN_BOND_LEN || rmin / rmax < MIN_SINE)
  ------------------
  |  |   30|      0|#define MIN_SINE              0.03    /*min edge/plane angle in case the tetrahedra has significantly different edge length */
  ------------------
  |  Branch (4152:21): [True: 0, False: 0]
  |  Branch (4152:41): [True: 0, False: 0]
  ------------------
 4153|      0|                {
 4154|       |                    /* the new 4th bond is too short: try to get 0D parities */
 4155|      0|                    if (AB_PARITY_NONE == ( parity = GetStereocenter0DParity( pCG, at, cur_at, j1, nSbNeighOrigAtNumb, FlagSC_0D ) ))
  ------------------
  |  |  218|      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 ) ))
  ------------------
  |  |   59|      0|#define FlagSC_0D 1 /**< bUsed0DParity */
  ------------------
  |  Branch (4155:25): [True: 0, False: 0]
  ------------------
 4156|      0|                    {
 4157|      0|                        parity = AB_PARITY_UNDF;
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 4158|      0|                    }
 4159|      0|                    goto exit_function;
 4160|      0|                }
 4161|       |#if ( STEREO_CENTER_BOND4_NORM == 1 )
 4162|       |                else
 4163|       |                {
 4164|       |                    mult3( at_coord[j], 1.0 / z, at_coord[j] );
 4165|       |                }
 4166|       |#endif
 4167|      0|            }
 4168|      0|        }
 4169|      0|    }
 4170|       |
 4171|      0|    else if (j1 != MAX_NUM_STEREO_ATOM_NEIGH)
  ------------------
  |  |  877|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (4171:14): [True: 0, False: 0]
  ------------------
 4172|      0|    {
 4173|      0|        if (parity == vABParityUnknown /*AB_PARITY_UNKN*/)
  ------------------
  |  Branch (4173:13): [True: 0, False: 0]
  ------------------
 4174|      0|        {
 4175|      0|            parity = -AB_PARITY_UNDF; /*  isotopic composition of H-neighbors contradicts 'unknown' */
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 4176|      0|        }
 4177|      0|        goto exit_function;
 4178|      0|    }
 4179|       |
 4180|      0|    else /*  j1 == MAX_NUM_STEREO_ATOM_NEIGH */
 4181|      0|    {
 4182|      0|        if (num_z == 0 || are_4at_in_one_plane( at_coord, vMinSine ))
  ------------------
  |  Branch (4182:13): [True: 0, False: 0]
  |  Branch (4182:27): [True: 0, False: 0]
  ------------------
 4183|      0|        {
 4184|       |            /*  all four neighours in xy plane: undefined geometry. */
 4185|      0|            if (num_z > 0)
  ------------------
  |  Branch (4185:17): [True: 0, False: 0]
  ------------------
 4186|      0|            {
 4187|      0|                bAmbiguous |= AMBIGUOUS_STEREO;
  ------------------
  |  |  245|      0|#define AMBIGUOUS_STEREO           1
  ------------------
 4188|      0|            }
 4189|      0|            if (parity != vABParityUnknown /*AB_PARITY_UNKN*/)
  ------------------
  |  Branch (4189:17): [True: 0, False: 0]
  ------------------
 4190|      0|            {
 4191|       |#if (ALWAYS_SET_STEREO_PARITY == 1)
 4192|       |                parity = AB_PARITY_EVEN; /*  suppose atoms are pre-sorted (testing) */
 4193|       |#else
 4194|       |                /* All 4 bonds are in one plane: try to get 0D parities */
 4195|      0|                if (AB_PARITY_NONE == ( parity = GetStereocenter0DParity( pCG, at, cur_at, j1, nSbNeighOrigAtNumb, FlagSC_0D ) ))
  ------------------
  |  |  218|      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 ) ))
  ------------------
  |  |   59|      0|#define FlagSC_0D 1 /**< bUsed0DParity */
  ------------------
  |  Branch (4195:21): [True: 0, False: 0]
  ------------------
 4196|      0|                {
 4197|      0|                    parity = AB_PARITY_UNDF;
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 4198|      0|                }
 4199|      0|                else if (ATOM_PARITY_WELL_DEF( parity ))
  ------------------
  |  |  259|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      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)
  |  |  ------------------
  |  |  |  |  236|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 0, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4200|      0|                {
 4201|      0|                    bAmbiguous &= ~AMBIGUOUS_STEREO; /* 0D parity has resolved the ambiguity */
  ------------------
  |  |  245|      0|#define AMBIGUOUS_STEREO           1
  ------------------
 4202|      0|                }
 4203|      0|#endif
 4204|      0|            }
 4205|      0|            goto exit_function;
 4206|      0|        }
 4207|      0|    }
 4208|       |
 4209|       |    /***********************************************************
 4210|       |    * At this point we have 4 neighboring atoms.
 4211|       |    * check for tetrahedral ambiguity in 2D case
 4212|       |    */
 4213|      0|    if (b2D)
  ------------------
  |  Branch (4213:9): [True: 0, False: 0]
  ------------------
 4214|      0|    {
 4215|       |
 4216|      0|        n2DTetrahedralAmbiguity = Get2DTetrahedralAmbiguity( pCG,at_coord,
 4217|      0|                                                             bAddExplicitNeighbor,
 4218|      0|                                                             ( bPointedEdgeStereo & PES_BIT_FIX_SP3_BUG ),
  ------------------
  |  |   47|      0|#define PES_BIT_FIX_SP3_BUG          8
  ------------------
 4219|      0|                                                             vMinAngle );
 4220|       |
 4221|      0|        if (0 < n2DTetrahedralAmbiguity)
  ------------------
  |  Branch (4221:13): [True: 0, False: 0]
  ------------------
 4222|      0|        {
 4223|      0|            if (T2D_WARN & n2DTetrahedralAmbiguity)
  ------------------
  |  |  362|      0|#define T2D_WARN  2
  ------------------
  |  Branch (4223:17): [True: 0, False: 0]
  ------------------
 4224|      0|            {
 4225|      0|                bAmbiguous |= AMBIGUOUS_STEREO;
  ------------------
  |  |  245|      0|#define AMBIGUOUS_STEREO           1
  ------------------
 4226|      0|            }
 4227|      0|            if (T2D_UNDF & n2DTetrahedralAmbiguity)
  ------------------
  |  |  363|      0|#define T2D_UNDF  4
  ------------------
  |  Branch (4227:17): [True: 0, False: 0]
  ------------------
 4228|      0|            {
 4229|      0|                if (parity != vABParityUnknown /*AB_PARITY_UNKN*/)
  ------------------
  |  Branch (4229:21): [True: 0, False: 0]
  ------------------
 4230|      0|                {
 4231|       |#if (ALWAYS_SET_STEREO_PARITY == 1)
 4232|       |                    parity = AB_PARITY_EVEN; /*  suppose atoms are pre-sorted (testing) */
 4233|       |#else
 4234|      0|                    parity = AB_PARITY_UNDF; /*  no parity */
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 4235|      0|#endif
 4236|      0|                }
 4237|      0|                goto exit_function;
 4238|      0|            }
 4239|      0|        }
 4240|      0|        else if (n2DTetrahedralAmbiguity < 0)
  ------------------
  |  Branch (4240:18): [True: 0, False: 0]
  ------------------
 4241|      0|        {
 4242|      0|            bAmbiguous |= AMBIGUOUS_STEREO_ERROR; /*  error */
  ------------------
  |  |  250|      0|#define AMBIGUOUS_STEREO_ERROR     32
  ------------------
 4243|      0|            parity = AB_PARITY_UNDF;
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 4244|      0|            goto exit_function;
 4245|      0|        }
 4246|      0|    }
 4247|       |
 4248|       |    /************************************************************/
 4249|       |    /*  Move coordinates origin to the neighbor #0 */
 4250|      0|    for (j = 1; j < MAX_NUM_STEREO_ATOM_NEIGH; j++)
  ------------------
  |  |  877|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (4250:17): [True: 0, False: 0]
  ------------------
 4251|      0|    {
 4252|      0|        diff3( at_coord[j], at_coord[0], at_coord[j] );
 4253|      0|    }
 4254|      0|    diff3( at_coord_center, at_coord[0], at_coord_center );
 4255|       |
 4256|       |    /*
 4257|       |    for ( k = 0; k < 3; k++ )
 4258|       |    {
 4259|       |        for ( j = 1; j < MAX_NUM_STEREO_ATOM_NEIGH; j ++ )
 4260|       |        {
 4261|       |            at_coord[j][k] -= at_coord[0][k];
 4262|       |        }
 4263|       |        at_coord_center[k] -= at_coord[0][k];
 4264|       |    }
 4265|       |    */
 4266|       |
 4267|       |
 4268|       |    /********************************************************
 4269|       |     *  Find the central (cur_at) atom's parity
 4270|       |     *  (orientation of atoms #1-3 when looking from #0)
 4271|       |     ********************************************************/
 4272|      0|    triple_product = triple_prod_and_min_abs_sine2( &at_coord[1], at_coord_center, bAddExplicitNeighbor, &min_sine, &bAmbiguous, vMinSine );
 4273|       |
 4274|       |    /*
 4275|       |     *  Check for tetrahedral ambiguity -- leave it out for now
 4276|       |     */
 4277|      0|    if (fabs( triple_product ) > ZERO_FLOAT && ( min_sine > vMinSine || (fabs( min_sine ) > ZERO_FLOAT && ( n2DTetrahedralAmbiguity & T2D_OKAY )) )) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   41|      0|#define ZERO_FLOAT            1.0e-12
  ------------------
                  if (fabs( triple_product ) > ZERO_FLOAT && ( min_sine > vMinSine || (fabs( min_sine ) > ZERO_FLOAT && ( n2DTetrahedralAmbiguity & T2D_OKAY )) )) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   41|      0|#define ZERO_FLOAT            1.0e-12
  ------------------
                  if (fabs( triple_product ) > ZERO_FLOAT && ( min_sine > vMinSine || (fabs( min_sine ) > ZERO_FLOAT && ( n2DTetrahedralAmbiguity & T2D_OKAY )) )) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  361|      0|#define T2D_OKAY  1
  ------------------
  |  Branch (4277:9): [True: 0, False: 0]
  |  Branch (4277:50): [True: 0, False: 0]
  |  Branch (4277:74): [True: 0, False: 0]
  |  Branch (4277:107): [True: 0, False: 0]
  ------------------
 4278|      0|    {
 4279|       |         /* Even => sorted in correct order, Odd=>transposed */
 4280|      0|        parity = triple_product > 0.0 ? AB_PARITY_EVEN : AB_PARITY_ODD;
  ------------------
  |  |  220|      0|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
                      parity = triple_product > 0.0 ? AB_PARITY_EVEN : AB_PARITY_ODD;
  ------------------
  |  |  219|      0|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
  |  Branch (4280:18): [True: 0, False: 0]
  ------------------
 4281|       |        /* if ( num_explicit_H && at[cur_at].removed_H_parity % 2 )  */
 4282|       |              /* odd transposition of the removed implicit H */
 4283|       |        /*     out_at[cur_at].parity = 3 - out_at[cur_at].parity; */
 4284|       |
 4285|       |        /*  moved; see below */
 4286|       |        /* out_at[cur_at].bAmbiguousStereo |= bAmbiguous; */
 4287|       |        /* at[cur_at].bAmbiguousStereo |= bAmbiguous; */
 4288|       |
 4289|       |        /*  for 4 attached atoms, moving the implicit H from index=3 to index=0 */
 4290|       |        /*  can be done in odd number (3) transpositions: (23)(12)(01), which inverts the parity */
 4291|      0|        if (j1 == MAX_NUM_STEREO_ATOM_NEIGH - 1)
  ------------------
  |  |  877|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (4291:13): [True: 0, False: 0]
  ------------------
 4292|      0|        {
 4293|      0|            parity = 3 - parity;
 4294|      0|        }
 4295|      0|    }
 4296|      0|    else
 4297|      0|    {
 4298|       |#if (ALWAYS_SET_STEREO_PARITY == 1)
 4299|       |        parity = AT_PARITY_EVEN; /*  suppose atoms are pre-sorted (testing) */
 4300|       |#else
 4301|      0|        if (num_z > 0)
  ------------------
  |  Branch (4301:13): [True: 0, False: 0]
  ------------------
 4302|      0|        {
 4303|      0|            bAmbiguous |= AMBIGUOUS_STEREO;
  ------------------
  |  |  245|      0|#define AMBIGUOUS_STEREO           1
  ------------------
 4304|      0|        }
 4305|      0|        parity = AB_PARITY_UNDF; /*  no parity: 4 bonds are in one plane. */
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 4306|      0|#endif
 4307|      0|    }
 4308|       |
 4309|  1.09M|exit_function:
 4310|       |
 4311|  1.09M|    if (parity)
  ------------------
  |  Branch (4311:9): [True: 8.38k, False: 1.08M]
  ------------------
 4312|  8.38k|    {
 4313|  8.38k|        out_at[cur_at].bAmbiguousStereo |= bAmbiguous;
 4314|  8.38k|        at[cur_at].bAmbiguousStereo |= bAmbiguous;
 4315|  8.38k|    }
 4316|       |
 4317|       |    /*  Non-isotopic parity */
 4318|  1.09M|    if (at[cur_at].num_H > 1 || parity <= 0)
  ------------------
  |  Branch (4318:9): [True: 746, False: 1.09M]
  |  Branch (4318:33): [True: 1.08M, False: 8.38k]
  ------------------
 4319|  1.08M|    {
 4320|  1.08M|        ; /*  no non-isotopic parity */
 4321|  1.08M|    }
 4322|  8.38k|    else
 4323|  8.38k|    {
 4324|  8.38k|        out_at[cur_at].parity = parity;
 4325|  8.38k|    }
 4326|       |
 4327|       |    /*  isotopic parity */
 4328|  1.09M|    if (parity == -AB_PARITY_UNDF || parity == -vABParityUnknown /*AB_PARITY_UNKN*/)
  ------------------
  |  |  222|  2.18M|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (4328:9): [True: 1, False: 1.09M]
  |  Branch (4328:38): [True: 0, False: 1.09M]
  ------------------
 4329|      1|    {
 4330|      1|        parity = -parity;
 4331|      1|    }
 4332|  1.09M|    if (parity < 0)
  ------------------
  |  Branch (4332:9): [True: 0, False: 1.09M]
  ------------------
 4333|      0|    {
 4334|      0|        parity = AB_PARITY_NONE;
  ------------------
  |  |  218|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
 4335|      0|    }
 4336|  1.09M|    out_at[cur_at].parity2 = parity;
 4337|       |
 4338|  1.09M|    parity = PARITY_VAL( out_at[cur_at].parity );
  ------------------
  |  |  262|  1.09M|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|  1.09M|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
 4339|  1.09M|    out_at[cur_at].stereo_atom_parity = ATOM_PARITY_WELL_DEF( parity ) ? AB_PARITY_CALC : parity;
  ------------------
  |  |  259|  1.09M|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  1.09M|#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)
  |  |  ------------------
  |  |  |  |  236|  8.38k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 8.38k, False: 1.08M]
  |  |  |  Branch (259:75): [True: 539, False: 7.84k]
  |  |  ------------------
  ------------------
                  out_at[cur_at].stereo_atom_parity = ATOM_PARITY_WELL_DEF( parity ) ? AB_PARITY_CALC : parity;
  ------------------
  |  |  224|    539|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  ------------------
 4340|  1.09M|    parity = PARITY_VAL( out_at[cur_at].parity2 );
  ------------------
  |  |  262|  1.09M|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  204|  1.09M|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
 4341|  1.09M|    out_at[cur_at].stereo_atom_parity2 = ATOM_PARITY_WELL_DEF( parity ) ? AB_PARITY_CALC : parity;
  ------------------
  |  |  259|  1.09M|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  1.09M|#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)
  |  |  ------------------
  |  |  |  |  236|  8.38k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 8.38k, False: 1.08M]
  |  |  |  Branch (259:75): [True: 539, False: 7.85k]
  |  |  ------------------
  ------------------
                  out_at[cur_at].stereo_atom_parity2 = ATOM_PARITY_WELL_DEF( parity ) ? AB_PARITY_CALC : parity;
  ------------------
  |  |  224|    539|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  ------------------
 4342|       |    /*
 4343|       |    out_at[cur_at].parity2 = out_at[cur_at].parity; // save for stereo + isotopic canon.
 4344|       |    if ( out_at[cur_at].parity ) {
 4345|       |        if ( num_explicit_H > 1 || j1 == MAX_NUM_STEREO_ATOM_NEIGH-1 && num_explicit_H ) {
 4346|       |            //              X   H      X
 4347|       |            // for example,  >C<   or   >C-D
 4348|       |            //              Y   D      Y
 4349|       |            // parity exists for stereo + isotopic atoms canonicalization only
 4350|       |            out_at[cur_at].parity  = 0;
 4351|       |        }
 4352|       |    }
 4353|       |    returning 0 means this can be an adjacent to a stereogenic bond atom
 4354|       |    */
 4355|       |
 4356|  1.09M|    return (int) out_at[cur_at].parity2;
 4357|      0|}
ichister.c:get_z_coord:
  117|  39.4k|{
  118|  39.4k|    int stereo_value = at[cur_atom].bond_stereo[neigh_no];
  119|  39.4k|    int stereo_type = abs( stereo_value );
  120|  39.4k|    int neigh = (int) at[cur_atom].neighbor[neigh_no];
  121|  39.4k|    double z = at[neigh].z - at[cur_atom].z;
  122|  39.4k|    int    bFlat;
  123|       |
  124|  39.4k|    if ((bFlat = ( fabs( z ) < ZERO_LENGTH ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   40|  39.4k|#define ZERO_LENGTH           MIN_BOND_LEN
  |  |  ------------------
  |  |  |  |   39|  39.4k|#define MIN_BOND_LEN          0.000001
  |  |  ------------------
  ------------------
  |  Branch (124:9): [True: 39.4k, False: 0]
  ------------------
  125|  39.4k|    {
  126|  39.4k|        int i;
  127|   171k|        for (i = 0; i < at[cur_atom].valence; i++)
  ------------------
  |  Branch (127:21): [True: 132k, False: 39.4k]
  ------------------
  128|   132k|        {
  129|   132k|            if (fabs( at[cur_atom].z - at[(int) at[cur_atom].neighbor[i]].z ) > ZERO_LENGTH)
  ------------------
  |  |   40|   132k|#define ZERO_LENGTH           MIN_BOND_LEN
  |  |  ------------------
  |  |  |  |   39|   132k|#define MIN_BOND_LEN          0.000001
  |  |  ------------------
  ------------------
  |  Branch (129:17): [True: 0, False: 132k]
  ------------------
  130|      0|            {
  131|      0|                bFlat = 0;
  132|      0|                break;
  133|      0|            }
  134|   132k|        }
  135|  39.4k|    }
  136|       |
  137|  39.4k|    if (bFlat)
  ------------------
  |  Branch (137:9): [True: 39.4k, False: 0]
  ------------------
  138|  39.4k|    {
  139|  39.4k|        if (!bPointedEdgeStereo || bPointedEdgeStereo * stereo_value >= 0)
  ------------------
  |  Branch (139:13): [True: 0, False: 39.4k]
  |  Branch (139:36): [True: 39.4k, False: 0]
  ------------------
  140|  39.4k|        {
  141|       |            /* bPointedEdgeStereo > 0: define stereo from pointed end of the stereo bond only */
  142|       |            /* bPointedEdgeStereo < 0: define stereo from wide end of the stereo bond only (case of removed H) */
  143|  39.4k|            switch (stereo_type)
  144|  39.4k|            {
  145|       |                /*  1=Up (solid triangle), 6=Down (Dashed triangle), 4=Either (zigzag triangle) */
  146|  39.4k|                case 0: /*  No stereo */
  ------------------
  |  Branch (146:17): [True: 39.4k, False: 18]
  ------------------
  147|  39.4k|                    *nType = ZTYPE_NONE;
  ------------------
  |  |   21|  39.4k|#define    ZTYPE_NONE     0
  ------------------
  148|  39.4k|                    break;
  149|      0|                case STEREO_SNGL_UP: /*  1= Up */
  ------------------
  |  |   37|      0|#define STEREO_SNGL_UP       1
  ------------------
  |  Branch (149:17): [True: 0, False: 39.4k]
  ------------------
  150|      0|                    *nType = ZTYPE_UP;
  ------------------
  |  |   22|      0|#define    ZTYPE_UP       1     /*  should be equal to -ZTYPE_DOWN */
  ------------------
  151|      0|                    break;
  152|      0|                case STEREO_SNGL_EITHER: /*  4 = Either */
  ------------------
  |  |   38|      0|#define STEREO_SNGL_EITHER   4
  ------------------
  |  Branch (152:17): [True: 0, False: 39.4k]
  ------------------
  153|      0|                    *nType = ZTYPE_EITHER;
  ------------------
  |  |   24|      0|#define    ZTYPE_EITHER   9999
  ------------------
  154|      0|                    break;
  155|      0|                case STEREO_SNGL_DOWN: /*  6 = Down */
  ------------------
  |  |   39|      0|#define STEREO_SNGL_DOWN     6
  ------------------
  |  Branch (155:17): [True: 0, False: 39.4k]
  ------------------
  156|      0|                    *nType = ZTYPE_DOWN;
  ------------------
  |  |   20|      0|#define    ZTYPE_DOWN     (-1)  /*  should be equal to -ZTYPE_UP */
  ------------------
  157|      0|                    break;
  158|     18|                default:
  ------------------
  |  Branch (158:17): [True: 18, False: 39.4k]
  ------------------
  159|     18|                    *nType = ZTYPE_NONE; /*  ignore unexpected values */
  ------------------
  |  |   21|     18|#define    ZTYPE_NONE     0
  ------------------
  160|  39.4k|            }
  161|  39.4k|            if (stereo_value < 0 && ( *nType == ZTYPE_DOWN || *nType == ZTYPE_UP ))
  ------------------
  |  |   20|      0|#define    ZTYPE_DOWN     (-1)  /*  should be equal to -ZTYPE_UP */
  ------------------
                          if (stereo_value < 0 && ( *nType == ZTYPE_DOWN || *nType == ZTYPE_UP ))
  ------------------
  |  |   22|      0|#define    ZTYPE_UP       1     /*  should be equal to -ZTYPE_DOWN */
  ------------------
  |  Branch (161:17): [True: 0, False: 39.4k]
  |  Branch (161:39): [True: 0, False: 0]
  |  Branch (161:63): [True: 0, False: 0]
  ------------------
  162|      0|                *nType = -*nType;
  163|  39.4k|        }
  164|      0|        else
  165|      0|        {
  166|      0|            *nType = ZTYPE_NONE; /* no stereo */
  ------------------
  |  |   21|      0|#define    ZTYPE_NONE     0
  ------------------
  167|      0|        }
  168|  39.4k|    }
  169|      0|    else
  170|      0|    {
  171|      0|        if (stereo_type == STEREO_SNGL_EITHER &&
  ------------------
  |  |   38|      0|#define STEREO_SNGL_EITHER   4
  ------------------
  |  Branch (171:13): [True: 0, False: 0]
  ------------------
  172|      0|            ( !bPointedEdgeStereo || bPointedEdgeStereo * stereo_value >= 0 ))
  ------------------
  |  Branch (172:15): [True: 0, False: 0]
  |  Branch (172:38): [True: 0, False: 0]
  ------------------
  173|      0|        {
  174|      0|            *nType = ZTYPE_EITHER;
  ------------------
  |  |   24|      0|#define    ZTYPE_EITHER   9999
  ------------------
  175|      0|        }
  176|      0|        else
  177|      0|        {
  178|      0|            *nType = ZTYPE_3D;
  ------------------
  |  |   23|      0|#define    ZTYPE_3D       3
  ------------------
  179|      0|        }
  180|      0|    }
  181|       |
  182|  39.4k|    return z;
  183|  39.4k|}
ichister.c:len2:
  200|  30.6k|{
  201|  30.6k|    double tmpar[ARR_DIM - 1] = { 0,0 };
  202|       |#if USE_BCF
  203|       |    memcpy_s(tmpar, (ARR_DIM - 1) * sizeof(c[0]), c, (ARR_DIM - 1) * sizeof(c[0]));
  204|       |#else
  205|  30.6k|    memcpy(tmpar, c, (ARR_DIM - 1) * sizeof(c[0]));
  ------------------
  |  |   26|  30.6k|#define ARR_DIM 3 /* djb-rwth: default dimension of arrays */
  ------------------
  206|  30.6k|#endif
  207|  30.6k|    return sqrt(pow(tmpar[0],2.0) + pow(tmpar[1],2.0));
  208|  30.6k|}
ichister.c:add3:
  225|     10|{
  226|     10|    result[0] = a[0] + b[0];
  227|     10|    result[1] = a[1] + b[1];
  228|     10|    result[2] = a[2] + b[2];
  229|       |
  230|       |    /* return result; */
  231|     10|}
ichister.c:triple_prod:
  313|     10|{
  314|     10|    double ab[3], dot_prod_ab_c, abs_c, abs_ab;
  315|     10|    cross_prod3( a, b, ab );
  316|       |    /* ab[0] =  (a[1]*b[2]-a[2]*b[1]); */
  317|       |    /* ab[1] = -(a[0]*b[2]-a[2]*b[0]); */
  318|       |    /* ab[2] =  (a[0]*b[1]-a[1]*b[0]); */
  319|     10|    dot_prod_ab_c = dot_prod3( ab, c );
  320|       |    /* dot_prod_ab_c   =  ab[0]*c[0] + ab[1]*c[1] + ab[2]*c[2]; */
  321|     10|    if (sine_value)
  ------------------
  |  Branch (321:9): [True: 0, False: 10]
  ------------------
  322|      0|    {
  323|      0|        abs_c = len3( c );
  324|       |        /* abs_c  = sqrt( c[0]*c[0]   + c[1]*c[1]   + c[2]*c[2] ); */
  325|      0|        abs_ab = len3( ab );
  326|       |        /* abs_ab = sqrt( ab[0]*ab[0] + ab[1]*ab[1] + ab[2]*ab[2] ); */
  327|       |
  328|      0|        if (abs_c > 1.e-7 /* otherwise c has zero length */ && abs_ab > 1.e-7 /* otherwise a is parallel to b*/)
  ------------------
  |  Branch (328:13): [True: 0, False: 0]
  |  Branch (328:64): [True: 0, False: 0]
  ------------------
  329|      0|        {
  330|      0|            *sine_value = MPY_SINE * dot_prod_ab_c / ( abs_c * abs_ab );
  ------------------
  |  |   44|      0|#define MPY_SINE              1.00  /*  was 3.0 */
  ------------------
  331|       |            /*  *sine_value = dot_prod_ab_c / ( abs_c * abs_ab); */
  332|      0|        }
  333|      0|        else
  334|      0|        {
  335|      0|            *sine_value = 0.0;
  336|      0|        }
  337|      0|    }
  338|       |
  339|     10|    return dot_prod_ab_c;
  340|     10|}
ichister.c:set_stereo_bonds_parity:
 2985|  1.08M|{
 2986|  1.08M|    int j, k, i_next_at_1, i_next_at_2, at_2, next_at_2, num_stereo_bonds, bFound, bAllene; /* djb-rwth: removing redundant variables */
 2987|  1.08M|    int bond_type, num_2s_1, num_alt_1;
 2988|  1.08M|    int num_2s_2, num_alt_2;
 2989|  1.08M|#if ( ONE_BAD_SB_NEIGHBOR == 1 )
 2990|  1.08M|    int num_wrong_bonds_1, num_wrong_bonds_2;
 2991|  1.08M|#endif
 2992|  1.08M|#if ( N_V_STEREOBONDS == 1 )
 2993|  1.08M|    int n2sh, num_2s_hetero[2], num_2s_hetero_next[2], next_next_at, type_N, type_N_next;
 2994|  1.08M|#endif
 2995|  1.08M|    int num_stored_isotopic_stereo_bonds; /* djb-rwth: removing redundant variables/code */
 2996|  1.08M|    int chain_length, num_chains, cur_chain_length;
 2997|  1.08M|    int all_at_2[MAX_NUM_STEREO_BONDS];
 2998|  1.08M|    int all_pos_1[MAX_NUM_STEREO_BONDS], all_pos_2[MAX_NUM_STEREO_BONDS];
 2999|  1.08M|    S_CHAR all_unkn[MAX_NUM_STEREO_BONDS];
 3000|  1.08M|    int /*at_1_parity, at_2_parity,*/ nUnknown, stop = 0;
 3001|       |
 3002|       |    /* at_1_parity = AB_PARITY_NONE; */ /*  do not know */
 3003|       |
 3004|       |    /*  Check valence */
 3005|  1.08M|    if (MAX_NUM_STEREO_BOND_NEIGH < at[at_1].valence + at[at_1].num_H ||
  ------------------
  |  |  874|  1.08M|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (3005:9): [True: 10.9k, False: 1.07M]
  ------------------
 3006|  1.07M|         MIN_NUM_STEREO_BOND_NEIGH > at[at_1].valence + at[at_1].num_H)
  ------------------
  |  |  875|  1.07M|#define MIN_NUM_STEREO_BOND_NEIGH 2
  ------------------
  |  Branch (3006:10): [True: 933k, False: 141k]
  ------------------
 3007|   944k|    {
 3008|   944k|        return 0;
 3009|   944k|    }
 3010|   141k|    if (!bCanAtomHaveAStereoBond( at[at_1].elname, at[at_1].charge, at[at_1].radical ))
  ------------------
  |  Branch (3010:9): [True: 87.3k, False: 53.8k]
  ------------------
 3011|  87.3k|    {
 3012|  87.3k|        return 0;
 3013|  87.3k|    }
 3014|  53.8k|    if (at[at_1].c_point)
  ------------------
  |  Branch (3014:9): [True: 1.88k, False: 51.9k]
  ------------------
 3015|  1.88k|    {
 3016|  1.88k|        return 0; /* rejects atoms that can lose or gain a (positive) charge. 01-24-2003 */
 3017|  1.88k|    }
 3018|       |
 3019|       |    /*  middle cumulene atoms, for example, =C=, should be ignored here */
 3020|       |    /*  only atoms at the ends of cumulene chains are considered. */
 3021|  51.9k|    if (!at[at_1].num_H && 2 == at[at_1].valence &&
  ------------------
  |  Branch (3021:9): [True: 48.3k, False: 3.61k]
  |  Branch (3021:28): [True: 36.3k, False: 12.0k]
  ------------------
 3022|  36.3k|         BOND_DOUBLE == get_allowed_stereo_bond_type( (int) at[at_1].bond_type[0] ) &&
  ------------------
  |  |  178|  36.3k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|  36.3k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (3022:10): [True: 11.4k, False: 24.8k]
  ------------------
 3023|  11.4k|         BOND_DOUBLE == get_allowed_stereo_bond_type( (int) at[at_1].bond_type[1] ))
  ------------------
  |  |  178|  11.4k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|  11.4k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (3023:10): [True: 2.87k, False: 8.60k]
  ------------------
 3024|  2.87k|    {
 3025|  2.87k|        return 0;
 3026|  2.87k|    }
 3027|       |
 3028|       |    /*  count bonds and find the second atom on the stereo bond */
 3029|  49.0k|    num_2s_1 = num_alt_1 = 0;
 3030|  49.0k|    chain_length = 0;
 3031|  49.0k|    num_chains = 0;
 3032|  49.0k|#if ( ONE_BAD_SB_NEIGHBOR == 1 )
 3033|  49.0k|    num_wrong_bonds_1 = 0;
 3034|  49.0k|#endif
 3035|  49.0k|#if ( N_V_STEREOBONDS == 1 )
 3036|  49.0k|    num_2s_hetero[0] = num_2s_hetero[1] = type_N = 0;
 3037|  49.0k|    if (0 == at[at_1].num_H && 0 == at[at_1].charge && 0 == at[at_1].radical &&
  ------------------
  |  Branch (3037:9): [True: 45.4k, False: 3.61k]
  |  Branch (3037:32): [True: 40.4k, False: 5.02k]
  |  Branch (3037:56): [True: 40.4k, False: 0]
  ------------------
 3038|  40.4k|         3 == get_endpoint_valence( at[at_1].el_number ))
  ------------------
  |  Branch (3038:10): [True: 26.6k, False: 13.8k]
  ------------------
 3039|  26.6k|    {
 3040|  26.6k|        if (2 == at[at_1].valence && 3 == at[at_1].chem_bonds_valence)
  ------------------
  |  Branch (3040:13): [True: 21.2k, False: 5.37k]
  |  Branch (3040:38): [True: 18.8k, False: 2.35k]
  ------------------
 3041|  18.8k|        {
 3042|  18.8k|            type_N = 1;
 3043|  18.8k|        }
 3044|  7.73k|        else
 3045|  7.73k|        {
 3046|  7.73k|            if (3 == at[at_1].valence && 5 == at[at_1].chem_bonds_valence)
  ------------------
  |  Branch (3046:17): [True: 5.37k, False: 2.35k]
  |  Branch (3046:42): [True: 4.44k, False: 934]
  ------------------
 3047|  4.44k|            {
 3048|  4.44k|                type_N = 2; /* unfortunately includes >N# */
 3049|  4.44k|            }
 3050|  7.73k|        }
 3051|  26.6k|    }
 3052|  49.0k|#endif
 3053|   158k|    for (i_next_at_1 = 0, num_stereo_bonds = 0; i_next_at_1 < at[at_1].valence; i_next_at_1++)
  ------------------
  |  Branch (3053:49): [True: 108k, False: 49.0k]
  ------------------
 3054|   108k|    {
 3055|   108k|        nUnknown = ( at[at_1].bond_stereo[i_next_at_1] == STEREO_DBLE_EITHER );
  ------------------
  |  |   40|   108k|#define STEREO_DBLE_EITHER   3
  ------------------
 3056|   108k|        bond_type = get_allowed_stereo_bond_type( (int) at[at_1].bond_type[i_next_at_1] );
 3057|   108k|        at_2 = -1; /* not found */
 3058|   108k|        if (bond_type == BOND_ALTERN ||
  ------------------
  |  |  180|   108k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|   217k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (3058:13): [True: 7.86k, False: 101k]
  ------------------
 3059|   101k|             bond_type == BOND_DOUBLE)
  ------------------
  |  |  178|   101k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|   101k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (3059:14): [True: 23.3k, False: 77.7k]
  ------------------
 3060|  31.1k|        {
 3061|  31.1k|            at_2 = at[at_1].neighbor[i_next_at_1]; /* djb-rwth: removing redundant code */
 3062|  31.1k|            next_at_2 = at_1;
 3063|  31.1k|        }
 3064|   108k|        switch (bond_type)
 3065|   108k|        {
 3066|  7.86k|            case BOND_ALTERN:
  ------------------
  |  |  180|  7.86k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|  7.86k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (3066:13): [True: 7.86k, False: 101k]
  ------------------
 3067|  7.86k|                num_alt_1++;
 3068|  7.86k|#if ( FIND_RING_SYSTEMS == 1 )
 3069|  7.86k|                if (at[at_1].nRingSystem != at[at_2].nRingSystem)
  ------------------
  |  Branch (3069:21): [True: 0, False: 7.86k]
  ------------------
 3070|      0|                {
 3071|      0|                    continue; /* reject alt. bond connecting different ring systems */
 3072|      0|                }
 3073|  7.86k|#endif
 3074|  7.86k|                if (( nMode & CMODE_NO_ALT_SBONDS ) ||
  ------------------
  |  |  777|  7.86k|#define CMODE_NO_ALT_SBONDS      0x000100 /* 6-14-2002: do not assign stereo to alternating bonds */
  ------------------
  |  Branch (3074:21): [True: 0, False: 7.86k]
  ------------------
 3075|  7.86k|                     !bCanAtomHaveAStereoBond( at[at_2].elname, at[at_2].charge, at[at_2].radical ))
  ------------------
  |  Branch (3075:22): [True: 1.10k, False: 6.76k]
  ------------------
 3076|  1.10k|                {
 3077|  1.10k|                    continue; /*  reject non-stereogenic bond to neighbor ord. #i_next_at_1 */
 3078|  1.10k|                }
 3079|  6.76k|                break;
 3080|  23.3k|            case BOND_DOUBLE:
  ------------------
  |  |  178|  23.3k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|  23.3k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (3080:13): [True: 23.3k, False: 85.6k]
  ------------------
 3081|       |                /*  check for cumulene/allene */
 3082|  23.3k|                num_2s_1++;
 3083|  23.3k|                cur_chain_length = 0;
 3084|  23.3k|                if (bCanAtomBeTerminalAllene( at[at_1].elname, at[at_1].charge, at[at_1].radical ))
  ------------------
  |  Branch (3084:21): [True: 4.30k, False: 19.0k]
  ------------------
 3085|  4.30k|                {
 3086|       |                    /*
 3087|       |                     * Example of cumulene
 3088|       |                     * chain length = 2:     >X=C=C=Y<
 3089|       |                     *                        | | | |
 3090|       |                     *  1st cumulene atom= at_1 | | at_2 =last cumlene chain atom
 3091|       |                     *  next to at_1=   next_at_1 next_at_2  =previous to at_2
 3092|       |                     *
 3093|       |                     *  chain length odd:  stereocenter on the middle atom ( 1=> allene )
 3094|       |                     *  chain length even: "long stereogenic bond"
 3095|       |                     */
 3096|  5.09k|                    while (( bAllene =
  ------------------
  |  Branch (3096:28): [True: 943, False: 4.14k]
  ------------------
 3097|  5.09k|                        !at[at_2].num_H && at[at_2].valence == 2 &&
  ------------------
  |  Branch (3097:25): [True: 4.91k, False: 172]
  |  Branch (3097:44): [True: 2.31k, False: 2.60k]
  ------------------
 3098|  2.31k|                        BOND_DOUBLE == get_allowed_stereo_bond_type( (int) at[at_2].bond_type[0] ) &&
  ------------------
  |  |  178|  2.31k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|  2.31k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (3098:25): [True: 1.99k, False: 322]
  ------------------
 3099|  1.99k|                        BOND_DOUBLE == get_allowed_stereo_bond_type( (int) at[at_2].bond_type[1] ) ) &&
  ------------------
  |  |  178|  1.99k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|  1.99k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (3099:25): [True: 943, False: 1.04k]
  ------------------
 3100|    943|                            bCanAtomBeMiddleAllene( at[at_2].elname, at[at_2].charge, at[at_2].radical ))
  ------------------
  |  Branch (3100:29): [True: 788, False: 155]
  ------------------
 3101|    788|                    {
 3102|    788|                        k = ( (int) at[at_2].neighbor[0] == next_at_2 ); /*  opposite neighbor position */
 3103|    788|                        next_at_2 = at_2;
 3104|    788|                        nUnknown += ( at[at_2].bond_stereo[k] == STEREO_DBLE_EITHER );
  ------------------
  |  |   40|    788|#define STEREO_DBLE_EITHER   3
  ------------------
 3105|    788|                        at_2 = (int) at[at_2].neighbor[k];
 3106|    788|                        cur_chain_length++;  /*  count =C= atoms */
 3107|    788|                    }
 3108|  4.30k|                    if (cur_chain_length)
  ------------------
  |  Branch (3108:25): [True: 682, False: 3.62k]
  ------------------
 3109|    682|                    {
 3110|    682|                        num_chains++;
 3111|    682|                        if (bAllene /* at the end of the chain atom Y is =Y=, not =Y< or =Y- */ ||
  ------------------
  |  Branch (3111:29): [True: 83, False: 599]
  ------------------
 3112|    599|                             !bCanAtomBeTerminalAllene( at[at_2].elname, at[at_2].charge, at[at_2].radical ))
  ------------------
  |  Branch (3112:30): [True: 248, False: 351]
  ------------------
 3113|    331|                        {
 3114|    331|                            cur_chain_length = 0; /* djb-rwth: ignoring LLVM warning: value used */
 3115|    331|                            continue; /*  ignore: does not fit cumulene description; go to check next at_1 neighbor */
 3116|    331|                        }
 3117|    351|                        chain_length = cur_chain_length; /*  accept a stereogenic cumulele */
 3118|    351|                    }
 3119|  4.30k|                }
 3120|  22.9k|#if ( N_V_STEREOBONDS == 1 )
 3121|  22.9k|                if (!cur_chain_length &&
  ------------------
  |  Branch (3121:21): [True: 22.6k, False: 351]
  ------------------
 3122|  22.6k|                     0 <= ( n2sh = bIsSuitableHeteroInpAtom( at + at_2 ) ))
  ------------------
  |  Branch (3122:22): [True: 8.69k, False: 13.9k]
  ------------------
 3123|  8.69k|                {
 3124|  8.69k|                    num_2s_hetero[n2sh] ++; /* n2sh=0 -> =N- or =NH; n2sh=1 -> =O */
 3125|  8.69k|                }
 3126|  22.9k|#endif
 3127|  22.9k|                if (!cur_chain_length &&
  ------------------
  |  Branch (3127:21): [True: 22.6k, False: 351]
  ------------------
 3128|  22.6k|                     !bCanAtomHaveAStereoBond( at[at_2].elname, at[at_2].charge, at[at_2].radical ))
  ------------------
  |  Branch (3128:22): [True: 10.8k, False: 11.7k]
  ------------------
 3129|  10.8k|                {
 3130|  10.8k|                    continue; /*  reject non-stereogenic bond to neighbor #i_next_at_1 */
 3131|  10.8k|                }
 3132|       |
 3133|  12.1k|                break;
 3134|       |
 3135|  42.2k|            case BOND_SINGLE:
  ------------------
  |  |  177|  42.2k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|  42.2k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (3135:13): [True: 42.2k, False: 66.6k]
  ------------------
 3136|  49.5k|            case BOND_TAUTOM:
  ------------------
  |  |  185|  49.5k|#define BOND_TAUTOM              8
  ------------------
  |  Branch (3136:13): [True: 7.27k, False: 101k]
  ------------------
 3137|  49.5k|                continue; /*  reject non-stereogenic bond to neighbor #i_next_at_1 */
 3138|  28.2k|            default:
  ------------------
  |  Branch (3138:13): [True: 28.2k, False: 80.7k]
  ------------------
 3139|  28.2k|#if ( ONE_BAD_SB_NEIGHBOR == 1 )
 3140|  28.2k|                num_wrong_bonds_1++;
 3141|  28.2k|                continue;
 3142|       |#else
 3143|       |                return 0; /*  wrong bond type; */
 3144|       |#endif
 3145|   108k|        }
 3146|       |
 3147|       |        /*  Check atom at the opposite end of possibly stereogenic bond */
 3148|       |
 3149|  18.8k|        bFound = ( at_2 >= 0 && at_1 > at_2 ); /*  i_next_at_1 = at_1 stereogenic bond neighbor attachment number */
  ------------------
  |  Branch (3149:20): [True: 18.8k, False: 0]
  |  Branch (3149:33): [True: 10.1k, False: 8.69k]
  ------------------
 3150|       |
 3151|  18.8k|        if (bFound)
  ------------------
  |  Branch (3151:13): [True: 10.1k, False: 8.69k]
  ------------------
 3152|  10.1k|        {
 3153|       |            /*  Check "at_2" atom on the opposite side of the bond or cumulene chain */
 3154|  10.1k|            if (MAX_NUM_STEREO_BOND_NEIGH < at[at_2].valence + at[at_2].num_H ||
  ------------------
  |  |  874|  10.1k|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (3154:17): [True: 170, False: 10.0k]
  ------------------
 3155|  10.0k|                 MIN_NUM_STEREO_BOND_NEIGH > at[at_2].valence + at[at_2].num_H)
  ------------------
  |  |  875|  10.0k|#define MIN_NUM_STEREO_BOND_NEIGH 2
  ------------------
  |  Branch (3155:18): [True: 49, False: 9.96k]
  ------------------
 3156|    219|                continue;
 3157|       |
 3158|       |            /*  Check at_2 neighbors and bonds */
 3159|  9.96k|            num_2s_2 = num_alt_2 = 0;
 3160|  9.96k|#if ( N_V_STEREOBONDS == 1 )
 3161|  9.96k|            num_2s_hetero_next[0] = num_2s_hetero_next[1] = type_N_next = 0;
 3162|  9.96k|            if (0 == at[at_2].num_H && 0 == at[at_2].charge && 0 == at[at_2].radical &&
  ------------------
  |  Branch (3162:17): [True: 9.60k, False: 363]
  |  Branch (3162:40): [True: 9.21k, False: 383]
  |  Branch (3162:64): [True: 9.21k, False: 0]
  ------------------
 3163|  9.21k|                 3 == get_endpoint_valence( at[at_2].el_number ))
  ------------------
  |  Branch (3163:18): [True: 6.71k, False: 2.50k]
  ------------------
 3164|  6.71k|            {
 3165|  6.71k|                if (2 == at[at_2].valence && 3 == at[at_2].chem_bonds_valence)
  ------------------
  |  Branch (3165:21): [True: 5.88k, False: 827]
  |  Branch (3165:46): [True: 5.32k, False: 556]
  ------------------
 3166|  5.32k|                {
 3167|  5.32k|                    type_N_next = 1; /* -N= */
 3168|  5.32k|                }
 3169|  1.38k|                else
 3170|  1.38k|                {
 3171|  1.38k|                    if (3 == at[at_2].valence && 5 == at[at_2].chem_bonds_valence)
  ------------------
  |  Branch (3171:25): [True: 827, False: 556]
  |  Branch (3171:50): [True: 805, False: 22]
  ------------------
 3172|    805|                    {
 3173|    805|                        type_N_next = 2; /* unfortunately includes >N# */
 3174|    805|                    }
 3175|  1.38k|                }
 3176|  6.71k|            }
 3177|  9.96k|#endif
 3178|  9.96k|            i_next_at_2 = -1;  /*  unassigned mark */
 3179|  9.96k|#if ( ONE_BAD_SB_NEIGHBOR == 1 )
 3180|  9.96k|            num_wrong_bonds_2 = 0;
 3181|  9.96k|#endif
 3182|  31.1k|            for (j = 0; j < at[at_2].valence; j++)
  ------------------
  |  Branch (3182:25): [True: 21.1k, False: 9.96k]
  ------------------
 3183|  21.1k|            {
 3184|  21.1k|                bond_type = get_allowed_stereo_bond_type( (int) at[at_2].bond_type[j] );
 3185|  21.1k|                if (!bond_type)
  ------------------
  |  Branch (3185:21): [True: 1.42k, False: 19.7k]
  ------------------
 3186|  1.42k|                {
 3187|  1.42k|#if ( ONE_BAD_SB_NEIGHBOR == 1 )
 3188|  1.42k|                    num_wrong_bonds_2++;
 3189|  1.42k|                    continue;  /*  this bond type is not allowed to be adjacent to a stereo bond */
 3190|       |#else
 3191|       |                    break;
 3192|       |#endif
 3193|  1.42k|                }
 3194|  19.7k|                if (bond_type == BOND_DOUBLE)
  ------------------
  |  |  178|  19.7k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|  19.7k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (3194:21): [True: 8.90k, False: 10.8k]
  ------------------
 3195|  8.90k|                {
 3196|  8.90k|                    num_2s_2++;
 3197|  8.90k|#if ( N_V_STEREOBONDS == 1 )
 3198|  8.90k|                    next_next_at = at[at_2].neighbor[j];
 3199|  8.90k|                    if (0 <= ( n2sh = bIsSuitableHeteroInpAtom( at + next_next_at ) ))
  ------------------
  |  Branch (3199:25): [True: 4.18k, False: 4.71k]
  ------------------
 3200|  4.18k|                    {
 3201|  4.18k|                        num_2s_hetero_next[n2sh] ++; /* n2sh=0 -> =N- or =NH; n2sh=1 -> =O */
 3202|  4.18k|                    }
 3203|  8.90k|#endif
 3204|  8.90k|                }
 3205|  10.8k|                else
 3206|  10.8k|                {
 3207|  10.8k|                    num_alt_2 += ( bond_type == BOND_ALTERN );
  ------------------
  |  |  180|  10.8k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|  10.8k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
 3208|  10.8k|                }
 3209|  19.7k|                if ((int) at[at_2].neighbor[j] == next_at_2)
  ------------------
  |  Branch (3209:21): [True: 9.96k, False: 9.77k]
  ------------------
 3210|  9.96k|                {
 3211|  9.96k|                    i_next_at_2 = j; /*  assigned */
 3212|  9.96k|                }
 3213|  19.7k|            }
 3214|  9.96k|            if (
 3215|  9.96k|#if ( ONE_BAD_SB_NEIGHBOR == 1 )
 3216|  9.96k|                 num_wrong_bonds_2 > 1 || (num_wrong_bonds_2 && 2 >= at[at_2].valence) || /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3216:18): [True: 6, False: 9.95k]
  |  Branch (3216:44): [True: 1.41k, False: 8.54k]
  |  Branch (3216:65): [True: 1.33k, False: 81]
  ------------------
 3217|       |#else
 3218|       |                 j < at[at_2].valence /* "next" has a wrong bond type*/ ||
 3219|       |#endif
 3220|  8.62k|( num_alt_2 > 0 ) + ( num_2s_2 > 0 ) != 1 || /* all double XOR all alt bonds only */
  ------------------
  |  Branch (3220:1): [True: 233, False: 8.39k]
  ------------------
 3221|       | /* num_2s_2 > 1  ||*/ /* only one double bond permitted */
 3222|  8.39k|                  i_next_at_2 < 0 /* atom next to the opposite atom not found */)
  ------------------
  |  Branch (3222:19): [True: 0, False: 8.39k]
  ------------------
 3223|  1.57k|            {
 3224|  1.57k|                bFound = 0;
 3225|  1.57k|            }
 3226|  8.39k|            else
 3227|  8.39k|                if (at[at_2].c_point)
  ------------------
  |  Branch (3227:21): [True: 33, False: 8.36k]
  ------------------
 3228|     33|                {
 3229|     33|                    bFound = 0; /* rejects atoms that can lose or gain a (positive) charge. 01-24-2003 */
 3230|     33|                }
 3231|  8.36k|                else
 3232|  8.36k|                    if (num_2s_2 > 2)
  ------------------
  |  Branch (3232:25): [True: 0, False: 8.36k]
  ------------------
 3233|      0|                    {
 3234|      0|                        bFound = 0;
 3235|      0|                    }
 3236|  8.36k|                    else
 3237|  8.36k|#if ( N_V_STEREOBONDS == 1 )
 3238|  8.36k|                        if ( 3==( type_N | type_N_next ) && ( (2==type_N && !bIsOxide( at, at_1 )) ||
  ------------------
  |  Branch (3238:30): [True: 1.53k, False: 6.82k]
  |  Branch (3238:64): [True: 1.01k, False: 528]
  |  Branch (3238:77): [True: 592, False: 419]
  ------------------
 3239|    947|                             (2==type_N_next && !bIsOxide( at, at_2 )) )) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (3239:31): [True: 528, False: 419]
  |  Branch (3239:49): [True: 514, False: 14]
  ------------------
 3240|  1.10k|                        {
 3241|  1.10k|                            bFound = 0;
 3242|  1.10k|                        }
 3243|  7.25k|                        else
 3244|  7.25k|#endif
 3245|  7.25k|                        {
 3246|  7.25k|                            if (2 == num_2s_2)
  ------------------
  |  Branch (3246:33): [True: 1.73k, False: 5.51k]
  ------------------
 3247|  1.73k|                            {
 3248|  1.73k|#if ( N_V_STEREOBONDS == 1 )
 3249|  1.73k|                                if (!chain_length &&
  ------------------
  |  Branch (3249:37): [True: 1.72k, False: 19]
  ------------------
 3250|  1.72k|                                     1 == ( num_2s_hetero_next[0] | num_2s_hetero_next[1] ) &&
  ------------------
  |  Branch (3250:38): [True: 489, False: 1.23k]
  ------------------
 3251|    489|                                     3 == at[at_2].valence + at[at_2].num_H &&
  ------------------
  |  Branch (3251:38): [True: 55, False: 434]
  ------------------
 3252|     55|                                     5 == at[at_2].chem_bonds_valence + at[at_2].num_H &&
  ------------------
  |  Branch (3252:38): [True: 55, False: 0]
  ------------------
 3253|     55|                                     3 == get_endpoint_valence( at[at_2].el_number ) &&
  ------------------
  |  Branch (3253:38): [True: 43, False: 12]
  ------------------
 3254|     43|                                     ( !type_N || bIsOxide( at, at_2 ) ))
  ------------------
  |  Branch (3254:40): [True: 9, False: 34]
  |  Branch (3254:51): [True: 17, False: 17]
  ------------------
 3255|     26|                                {
 3256|       |                                    /*
 3257|       |                                     *   found:
 3258|       |                                     *
 3259|       |                                     *    \      /    \      /    \      /
 3260|       |                                     *     \    /      \    /      \    /
 3261|       |                                     *      N==C   or   N==C   or   N==N
 3262|       |                                     *    //    \     //    \     //    \
 3263|       |                                     *   O  ^    \   N  ^    \   O  ^    \
 3264|       |                                     *      |           |           |
 3265|       |                                     *      |           |           |
 3266|       |                                     *      at[at_2]    at[at_2]    at[at_2]
 3267|       |                                     */
 3268|     26|                                    ;
 3269|     26|                                }
 3270|  1.71k|                                else
 3271|  1.71k|                                {
 3272|  1.71k|                                    bFound = 0;
 3273|  1.71k|                                }
 3274|       |#else
 3275|       |                                bFound = 0;
 3276|       |#endif
 3277|  1.73k|                                }
 3278|  7.25k|                            }
 3279|       |
 3280|  9.96k|            if (chain_length && num_alt_2)
  ------------------
  |  Branch (3280:17): [True: 170, False: 9.79k]
  |  Branch (3280:33): [True: 0, False: 170]
  ------------------
 3281|      0|            {
 3282|      0|                return 0; /*  allow no alt bonds in cumulenes */
 3283|      0|            }
 3284|  9.96k|        }
 3285|       |
 3286|  18.6k|        if (bFound)
  ------------------
  |  Branch (3286:13): [True: 5.54k, False: 13.1k]
  ------------------
 3287|  5.54k|        {
 3288|  5.54k|            all_pos_1[num_stereo_bonds] = i_next_at_1; /* neighbor to at_1 position */
 3289|  5.54k|            all_pos_2[num_stereo_bonds] = i_next_at_2; /* neighbor to at_2 position */
 3290|  5.54k|            all_at_2[num_stereo_bonds] = at_2;        /* at_2 */
 3291|  5.54k|            all_unkn[num_stereo_bonds] = nUnknown;    /* stereogenic bond has Unknown configuration */
 3292|       |            /*
 3293|       |            if ( (at[at_1].bUsed0DParity & 2) || (at[at_2].bUsed0DParity & 2) ) {
 3294|       |                for ( k = 0; k < MAX_NUM_STEREO_BONDS && at[at_1].sb_parity[k]; k ++ ) {
 3295|       |                    if ( at[at_1].sb_neigh[k] == i_next_at_1 ) {
 3296|       |                        if ( at[at_1].sb_parity[k] == AB_PARITY_UNKN && !nUnknown ) {
 3297|       |                            all_unkn[num_stereo_bonds] = 1;
 3298|       |                        }
 3299|       |                        break;
 3300|       |                    }
 3301|       |                }
 3302|       |            }
 3303|       |            */
 3304|  5.54k|            num_stereo_bonds++;
 3305|  5.54k|        }
 3306|  18.6k|    }
 3307|  49.0k|    if (num_chains > 1)
  ------------------
  |  Branch (3307:9): [True: 9, False: 49.0k]
  ------------------
 3308|      9|    {
 3309|      9|        return 0; /*  cannot be more than 1 cumulene chain. */
 3310|      9|    }
 3311|  49.0k|#if ( ONE_BAD_SB_NEIGHBOR == 1 )
 3312|  49.0k|    if (num_wrong_bonds_1 > 1 || (num_wrong_bonds_1 && 2 >= at[at_1].valence)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3312:9): [True: 6.97k, False: 42.0k]
  |  Branch (3312:35): [True: 13.6k, False: 28.4k]
  |  Branch (3312:56): [True: 12.4k, False: 1.16k]
  ------------------
 3313|  19.4k|    {
 3314|  19.4k|        return 0; /* wrong bond type */
 3315|  19.4k|    }
 3316|  29.6k|#endif
 3317|       |    /*  Accept only short chains for now */
 3318|       |    /*  chain_length=1: >C=C=C<      tetrahedral center, allene */
 3319|       |    /*  chain_length=2: >C=C=C=C<    stereogenic bond, cumulene */
 3320|  29.6k|    if (chain_length && ( num_stereo_bonds != 1 || num_alt_1 || chain_length > MAX_CUMULENE_LEN ))
  ------------------
  |  |  207|    151|#define MAX_CUMULENE_LEN   2     /* max number of bonds in a cumulene chain - 1                     */
  ------------------
  |  Branch (3320:9): [True: 333, False: 29.2k]
  |  Branch (3320:27): [True: 182, False: 151]
  |  Branch (3320:52): [True: 0, False: 151]
  |  Branch (3320:65): [True: 21, False: 130]
  ------------------
 3321|    203|    {
 3322|    203|        return 0;
 3323|    203|    }
 3324|       |
 3325|       |    /*  We need 1 double bond/chain XOR up to 3 arom. bonds */
 3326|       |    /*  to have a stereogenic bond */
 3327|  29.4k|    if (( num_alt_1 > 0 ) + ( num_2s_1 > 0 ) != 1 || !num_stereo_bonds /*|| num_2s_1 > 1*/)
  ------------------
  |  Branch (3327:9): [True: 7.21k, False: 22.1k]
  |  Branch (3327:54): [True: 17.6k, False: 4.55k]
  ------------------
 3328|  24.8k|        return 0;
 3329|       |
 3330|  4.55k|    if (num_2s_1 > 1)
  ------------------
  |  Branch (3330:9): [True: 488, False: 4.06k]
  ------------------
 3331|    488|    {
 3332|    488|#if ( N_V_STEREOBONDS == 1 )
 3333|    488|        if (2 == num_2s_1 &&
  ------------------
  |  Branch (3333:13): [True: 488, False: 0]
  ------------------
 3334|    488|             2 == type_N &&
  ------------------
  |  Branch (3334:14): [True: 394, False: 94]
  ------------------
 3335|    394|             1 == ( num_2s_hetero[0] | num_2s_hetero[1] ) &&
  ------------------
  |  Branch (3335:14): [True: 369, False: 25]
  ------------------
 3336|    369|             3 == at[at_1].valence + at[at_1].num_H &&
  ------------------
  |  Branch (3336:14): [True: 369, False: 0]
  ------------------
 3337|    369|             5 == at[at_1].chem_bonds_valence + at[at_1].num_H &&
  ------------------
  |  Branch (3337:14): [True: 369, False: 0]
  ------------------
 3338|    369|             3 == get_endpoint_valence( at[at_1].el_number ))
  ------------------
  |  Branch (3338:14): [True: 369, False: 0]
  ------------------
 3339|    369|        {
 3340|    369|            ;
 3341|    369|        }
 3342|    119|        else
 3343|    119|        {
 3344|    119|            return 0;
 3345|    119|        }
 3346|       |#else
 3347|       |        return 0;
 3348|       |#endif
 3349|    488|    }
 3350|       |
 3351|       |    /* ================== Calculate parities ====================== */
 3352|       |
 3353|       |
 3354|       |    /*  Find possibly stereo bonds and save them */
 3355|  4.43k|    num_stored_isotopic_stereo_bonds = 0;
 3356|       |    /* djb-rwth: removing redundant code */
 3357|  9.51k|    for (k = 0; k < num_stereo_bonds; k++)
  ------------------
  |  Branch (3357:17): [True: 5.09k, False: 4.41k]
  ------------------
 3358|  5.09k|    {
 3359|       |
 3360|  5.09k|        int cur_parity, next_parity, abs_cur_parity, abs_next_parity, dot_prod_z;
 3361|  5.09k|        S_CHAR z_dir1[3], z_dir2[3]; /*  3D vectors for half stereo bond parity direction */
 3362|  5.09k|        int  chain_len_bits = MAKE_BITS_CUMULENE_LEN( chain_length );
  ------------------
  |  |  212|  5.09k|#define MAKE_BITS_CUMULENE_LEN(X)   ((X)*MULT_STEREOBOND)
  |  |  ------------------
  |  |  |  |  209|  5.09k|#define MULT_STEREOBOND    0x08  /* multiplier for cumulene chain length
  |  |  ------------------
  ------------------
 3363|  5.09k|        int  cur_parity_defined, next_parity_defined;
 3364|  5.09k|        int  cur_action, next_action, result_action;
 3365|       |
 3366|  5.09k|        at_2 = all_at_2[k];
 3367|  5.09k|        i_next_at_1 = all_pos_1[k];
 3368|       |
 3369|  5.09k|#if ( MIN_SB_RING_SIZE > 0 )
 3370|  5.09k|        if (at[at_1].nRingSystem == at[at_2].nRingSystem)
  ------------------
  |  Branch (3370:13): [True: 4.23k, False: 857]
  ------------------
 3371|  4.23k|        {
 3372|       |            /*  check min. ring size only if both double bond/cumulene */
 3373|       |            /*  ending atoms belong to the same ring system */
 3374|  4.23k|            j = is_bond_in_Nmax_memb_ring( at, at_1, i_next_at_1, q, nAtomLevel, cSource, min_sb_ring_size );
 3375|  4.23k|            if (j > 0)
  ------------------
  |  Branch (3375:17): [True: 2.92k, False: 1.30k]
  ------------------
 3376|  2.92k|            {
 3377|  2.92k|                continue;
 3378|  2.92k|            }
 3379|  1.30k|            else
 3380|  1.30k|            {
 3381|  1.30k|                if (j < 0)
  ------------------
  |  Branch (3381:21): [True: 0, False: 1.30k]
  ------------------
 3382|      0|                {
 3383|      0|                    return CT_STEREOBOND_ERROR;
  ------------------
  |  |   31|      0|#define CT_STEREOBOND_ERROR  (CT_ERR_FIRST-12)  /*(-30012) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 3384|      0|                }
 3385|  1.30k|            }
 3386|  4.23k|        }
 3387|  2.16k|#endif
 3388|       |
 3389|  2.16k|        i_next_at_2 = all_pos_2[k];
 3390|  2.16k|        nUnknown = all_unkn[k];
 3391|  2.16k|        memset( z_dir1, 0, sizeof( z_dir1 ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 3392|  2.16k|        memset( z_dir2, 0, sizeof( z_dir2 ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 3393|       |
 3394|       |        /********************************************************************************
 3395|       |         * Find atom parities (negative means parity due to H-isotopes only)
 3396|       |         * and half stereo bond parity directions z_dir1, z_dir2.
 3397|       |         *
 3398|       |         * Bond can have unknown or undefined parity or no parity because of:
 3399|       |         * 1. Geometry (poorly defined, cannot calculate, for example linear =C-F
 3400|       |         *    or =CHD with no geometry) -- Undefined parity
 3401|       |         *                                                              H
 3402|       |         * 2. Identical H atoms (no parity in principle, for example =C<  )
 3403|       |         *    -- No parity                                              H
 3404|       |         *
 3405|       |         * 3. The user said double bond stereo is unknown
 3406|       |         *    or at least one of single bonds is in unknown direction
 3407|       |         *    -- Unknown parity
 3408|       |         *
 3409|       |         * These 3 cases (see above) are referred below as 1, 2, 3.
 3410|       |         * Each of the cases may be present or not (2 possibilities)
 3411|       |         * Total number of combination is 2*2*2=8
 3412|       |         *
 3413|       |         * Since a case when all 3 are not present is a well-defined parity,
 3414|       |         * we do not consider this case here. Then 2*2*2-1=7 cases are left.
 3415|       |         *
 3416|       |         * If several cases are present, list them below separated by "+".
 3417|       |         * For example, 1+2 means (1) undefined geometry and (2) no parity
 3418|       |         * is possible because of identical H atoms.
 3419|       |         *
 3420|       |         * N) Decision table, Non-isotopic, 2*2*2-1=7 cases:
 3421|       |         * =================================================
 3422|       |         * none     : 2+any: 1+2(e.g.=CH2); 1+2+3; 2; 2+3  AB_PARITY_NONE=0
 3423|       |         * undefined: 1                                    AB_PARITY_UNDF
 3424|       |         * unknown  : 1+3; 3                               AB_PARITY_UNKN
 3425|       |         *
 3426|       |         * I) Decision table, Isotopic, 2*2*2-1=7 cases:
 3427|       |         * =============================================
 3428|       |         * none     : none
 3429|       |         * undefined: 1; 1+2; 1+2+3; 2; 2+3
 3430|       |         * unknown  : 1+3; 3
 3431|       |         *
 3432|       |         * Note: When defining identical atoms H atoms in case 2,
 3433|       |         *       Isotopic and Non-isotopic cases are different:
 3434|       |         *  N: do NOT take into account the isotopic composition of H atoms
 3435|       |         *  I: DO take into account the isotopic composition of H atoms
 3436|       |         *     (it is assumed that H isotopes are always different)
 3437|       |         *
 3438|       |         * half_stereo_bond_parity() returns:
 3439|       |         * ==================================
 3440|       |         * Note: half_stereo_bond_parity() is unaware of case 3.
 3441|       |         *
 3442|       |         * can't be a half of a stereo bond    AB_PARITY_NONE
 3443|       |         * 1, isotopic & non-isotopic:         AB_PARITY_UNDF
 3444|       |         * 1, isotopic only                   -AB_PARITY_UNDF
 3445|       |         * 2, no parity: identical H isotopes  AB_PARITY_IISO
 3446|       |         * 3, 'Either' single bond(s)          AB_PARITY_UNKN ???
 3447|       |         * 3, 'Either' single bond(s), iso H  -AB_PARITY_UNKN ???
 3448|       |         * defined parity                      AB_PARITY_ODD,  AB_PARITY_EVEN
 3449|       |         * defined parity for isotopic only:  -AB_PARITY_ODD, -AB_PARITY_EVEN
 3450|       |         *
 3451|       |         * Resultant value for the stereo bond parity
 3452|       |         * ---+-------------------+-------+--------+----------------+
 3453|       |         * 3? | half_stereo_bond_ | N or I| case 1,| bond parity    |
 3454|       |         *    |  parity()=        |       | 2 or 3 |                |
 3455|       |         * ---+-------------------+-------+--------+----------------+
 3456|       |         *   ( AB_PARITY_ODD/EVEN) => N&I: -       => AB_PARITY_CALC (=6, calc.later)
 3457|       |         * 3+( AB_PARITY_ODD/EVEN) => N&I: 3       => AB_PARITY_UNKN (=3)
 3458|       |         *   (-AB_PARITY_ODD/EVEN) => N:   2       => AB_PARITY_NONE (=0)
 3459|       |         *   (-AB_PARITY_ODD/EVEN) => I:   -       => AB_PARITY_CALC
 3460|       |         * 3+(-AB_PARITY_ODD/EVEN) => N:   2+3     => AB_PARITY_UNDF (=4)
 3461|       |         * 3+(-AB_PARITY_ODD/EVEN) => I:   3       => AB_PARITY_UNKN
 3462|       |         *   ( AB_PARITY_IISO )    => N:   1+2, 2  => AB_PARITY_NONE (=0)
 3463|       |         *   ( AB_PARITY_IISO )    => I:   1+2, 2  => AB_PARITY_UNDF
 3464|       |         * 3+( AB_PARITY_IISO )    => N:  1+2+3,2+3=> AB_PARITY_NONE
 3465|       |         * 3+( AB_PARITY_IISO )    => I:  1+2+3,2+3=> AB_PARITY_UNDF
 3466|       |         *   ( AB_PARITY_UNDF )    => N&I: 1       => AB_PARITY_UNDF
 3467|       |         * 3+( AB_PARITY_UNDF )    => N&I: 1+3     => AB_PARITY_UNKN
 3468|       |         *   (-AB_PARITY_UNDF )    => N:   1+2     => AB_PARITY_NONE
 3469|       |         *   (-AB_PARITY_UNDF )    => I:   1       => AB_PARITY_UNDF
 3470|       |         * 3+(-AB_PARITY_UNDF )    => N:   1+2+3   => AB_PARITY_NONE
 3471|       |         * 3+(-AB_PARITY_UNDF )    => I:   1+3     => AB_PARITY_UNKN
 3472|       |         * ---+-------------------+-------+--------+----------------+
 3473|       |
 3474|       |         * If bond parity is undefined because abs(dot_prod_z) < MIN_DOT_PROD
 3475|       |         * then replace: AB_PARITY_CALC
 3476|       |         *         with: AB_PARITY_UNDF
 3477|       |         * Joining two half_bond_parity() results:
 3478|       |         *
 3479|       |         *
 3480|       |         * atom1 \ atom2   | AB_PARITY_NONE  AB_PARITY_UNKN  AB_PARITY_UNDF  AB_PARITY_CALC
 3481|       |         * ----------------+---------------------------------------------------------------
 3482|       |         *0=AB_PARITY_NONE | AB_PARITY_NONE  AB_PARITY_NONE  AB_PARITY_NONE  AB_PARITY_NONE
 3483|       |         *3=AB_PARITY_UNKN |                 AB_PARITY_UNKN  AB_PARITY_UNKN  AB_PARITY_UNKN
 3484|       |         *4=AB_PARITY_UNDF |                                 AB_PARITY_UNDF  AB_PARITY_UNDF
 3485|       |         *6=AB_PARITY_CALC |                                                 AB_PARITY_CALC
 3486|       |         *
 3487|       |         * that is, take min out of the two
 3488|       |         *********************************************************************************/
 3489|       |
 3490|  2.16k|        cur_parity = half_stereo_bond_parity( at, at_1, at_removed_H, num_removed_H,
 3491|  2.16k|                                                z_dir1, bPointedEdgeStereo, vABParityUnknown );
 3492|  2.16k|        next_parity = half_stereo_bond_parity( at, at_2, at_removed_H, num_removed_H,
 3493|  2.16k|                                                z_dir2, bPointedEdgeStereo, vABParityUnknown );
 3494|       |
 3495|  2.16k|        if (RETURNED_ERROR( cur_parity ) || RETURNED_ERROR( next_parity ))
  ------------------
  |  |   44|  4.33k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  2.16k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  2.16k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  2.16k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  2.16k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  2.16k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 2.16k, False: 0]
  |  |  |  Branch (44:53): [True: 10, False: 2.15k]
  |  |  ------------------
  ------------------
                      if (RETURNED_ERROR( cur_parity ) || RETURNED_ERROR( next_parity ))
  ------------------
  |  |   44|  2.15k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   40|  2.15k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  2.15k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   18|  2.15k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   41|  2.15k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  2.15k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (44:31): [True: 2.15k, False: 0]
  |  |  |  Branch (44:53): [True: 10, False: 2.14k]
  |  |  ------------------
  ------------------
 3496|     20|        {
 3497|     20|            return CT_CALC_STEREO_ERR;
  ------------------
  |  |   34|     20|#define CT_CALC_STEREO_ERR   (CT_ERR_FIRST-15)  /*(-30015) */
  |  |  ------------------
  |  |  |  |   18|     20|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 3498|     20|        }
 3499|  2.14k|        if (( at[at_1].bUsed0DParity & FlagSB_0D ) || ( at[at_2].bUsed0DParity & FlagSB_0D )) /* djb-rwth: condition corrected */
  ------------------
  |  |   60|  2.14k|#define FlagSB_0D 2 /**< bUsed0DParity */
  ------------------
                      if (( at[at_1].bUsed0DParity & FlagSB_0D ) || ( at[at_2].bUsed0DParity & FlagSB_0D )) /* djb-rwth: condition corrected */
  ------------------
  |  |   60|  1.70k|#define FlagSB_0D 2 /**< bUsed0DParity */
  ------------------
  |  Branch (3499:13): [True: 446, False: 1.70k]
  |  Branch (3499:55): [True: 236, False: 1.46k]
  ------------------
 3500|    682|        {
 3501|    682|            FixSb0DParities( at, /* at_removed_H, num_removed_H,*/ chain_length,
 3502|    682|                             at_1, i_next_at_1, z_dir1,
 3503|    682|                             at_2, i_next_at_2, z_dir2, &cur_parity, &next_parity );
 3504|    682|        }
 3505|       |
 3506|  2.14k|        if (cur_parity == AB_PARITY_NONE || abs( cur_parity ) == AB_PARITY_IISO)
  ------------------
  |  |  218|  4.29k|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
                      if (cur_parity == AB_PARITY_NONE || abs( cur_parity ) == AB_PARITY_IISO)
  ------------------
  |  |  223|  2.14k|#define AB_PARITY_IISO   5  /* 5 => no parity because of identical atoms */
  ------------------
  |  Branch (3506:13): [True: 0, False: 2.14k]
  |  Branch (3506:45): [True: 55, False: 2.09k]
  ------------------
 3507|     55|        {
 3508|     55|            continue;
 3509|     55|        }
 3510|  2.09k|        if (next_parity == AB_PARITY_NONE || abs( next_parity ) == AB_PARITY_IISO)
  ------------------
  |  |  218|  4.18k|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
                      if (next_parity == AB_PARITY_NONE || abs( next_parity ) == AB_PARITY_IISO)
  ------------------
  |  |  223|  2.09k|#define AB_PARITY_IISO   5  /* 5 => no parity because of identical atoms */
  ------------------
  |  Branch (3510:13): [True: 0, False: 2.09k]
  |  Branch (3510:46): [True: 36, False: 2.05k]
  ------------------
 3511|     36|        {
 3512|     36|            continue;
 3513|     36|        }
 3514|       |
 3515|  2.05k|        cur_action = half_stereo_bond_action( cur_parity, nUnknown, 0, vABParityUnknown ); /*  -1 => program error */
 3516|  2.05k|        next_action = half_stereo_bond_action( next_parity, nUnknown, 0, vABParityUnknown );
 3517|  2.05k|        result_action = inchi_min( cur_action, next_action );
  ------------------
  |  |  139|  2.05k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 3, False: 2.05k]
  |  |  ------------------
  ------------------
 3518|       |
 3519|  2.05k|        if (result_action == -1)
  ------------------
  |  Branch (3519:13): [True: 6, False: 2.04k]
  ------------------
 3520|      6|        {
 3521|      6|            stop = 1; /*  program error <BRKPT> */
 3522|      6|        }
 3523|       |
 3524|  2.05k|        abs_cur_parity = abs( cur_parity );
 3525|  2.05k|        abs_next_parity = abs( next_parity );
 3526|  2.05k|        cur_parity_defined = ATOM_PARITY_WELL_DEF( abs_cur_parity );
  ------------------
  |  |  259|  2.05k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  2.05k|#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)
  |  |  ------------------
  |  |  |  |  236|  2.05k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 2.05k, False: 0]
  |  |  |  Branch (259:75): [True: 263, False: 1.79k]
  |  |  ------------------
  ------------------
 3527|  2.05k|        next_parity_defined = ATOM_PARITY_WELL_DEF( abs_next_parity );
  ------------------
  |  |  259|  2.05k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|  2.05k|#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)
  |  |  ------------------
  |  |  |  |  236|  2.05k|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 2.05k, False: 0]
  |  |  |  Branch (259:75): [True: 257, False: 1.79k]
  |  |  ------------------
  ------------------
 3528|       |
 3529|  2.05k|        if (cur_parity_defined && next_parity_defined)
  ------------------
  |  Branch (3529:13): [True: 263, False: 1.79k]
  |  Branch (3529:35): [True: 257, False: 6]
  ------------------
 3530|    257|        {
 3531|       |            /*  find how the whole bond parity depend on geometry */
 3532|       |            /*  if dot_prod_z < 0 then bond_parity := 3-bond_parity */
 3533|       |            /*  can be done only for a well-defined geometry */
 3534|       |            /*
 3535|       |            dot_prod_z  = (chain_len_bits & BIT_CUMULENE_CHI)?
 3536|       |                           triple_prod_char( at, at_1, i_next_at_1, z_dir1, at_2, i_next_at_2, z_dir2 ) :
 3537|       |                           dot_prodchar3(z_dir1, z_dir2);
 3538|       |            */
 3539|       |
 3540|    257|            dot_prod_z = ( chain_len_bits && BOND_CHAIN_LEN( chain_len_bits ) % 2 )
  ------------------
  |  |  214|     10|#define BOND_CHAIN_LEN(X)           (GET_BITS_CUMULENE_LEN(X)/MULT_STEREOBOND) /* 0 => double bond, 1 => allene, 2 => cumulene,..*/
  |  |  ------------------
  |  |  |  |  213|     10|#define GET_BITS_CUMULENE_LEN(X)    ((X)&MASK_CUMULENE_LEN)
  |  |  |  |  ------------------
  |  |  |  |  |  |  205|     10|#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,..*/
  |  |  ------------------
  |  |  |  |  209|     10|#define MULT_STEREOBOND    0x08  /* multiplier for cumulene chain length
  |  |  ------------------
  ------------------
  |  Branch (3540:28): [True: 10, False: 247]
  |  Branch (3540:46): [True: 10, False: 0]
  ------------------
 3541|    257|                ?  triple_prod_char( at, at_1, i_next_at_1, z_dir1, at_2, i_next_at_2, z_dir2 )
 3542|    257|                :  dot_prodchar3( z_dir1, z_dir2 );
 3543|       |
 3544|    257|            if (abs( dot_prod_z ) < MIN_DOT_PROD)
  ------------------
  |  |  253|    257|#define MIN_DOT_PROD 50          /* min value of at->stereo_bond_z_prod[i] to define parity */
  ------------------
  |  Branch (3544:17): [True: 0, False: 257]
  ------------------
 3545|      0|            {
 3546|       |                /*  The geometry is not well-defined. Eliminate AB_PARITY_CALC */
 3547|      0|                result_action = inchi_min( result_action, AB_PARITY_UNDF );
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3548|      0|            }
 3549|    257|        }
 3550|  1.79k|        else
 3551|  1.79k|        {
 3552|  1.79k|            dot_prod_z = 0;
 3553|  1.79k|        }
 3554|       |
 3555|  2.05k|        if (result_action != AB_PARITY_NONE && result_action != -1)
  ------------------
  |  |  218|  4.11k|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (3555:13): [True: 2.04k, False: 12]
  |  Branch (3555:48): [True: 2.03k, False: 6]
  ------------------
 3556|  2.03k|        {
 3557|       |            /*  Stereo, no isotopes (only positive) */
 3558|  2.03k|            if (cur_parity > 0 && next_parity > 0)
  ------------------
  |  Branch (3558:17): [True: 2.03k, False: 0]
  |  Branch (3558:35): [True: 2.03k, False: 0]
  ------------------
 3559|  2.03k|            {
 3560|  2.03k|                if (save_a_stereo_bond( dot_prod_z, result_action | chain_len_bits,
  ------------------
  |  Branch (3560:21): [True: 2.03k, False: 0]
  ------------------
 3561|  2.03k|                    at_1, i_next_at_1, out_at[at_1].stereo_bond_neighbor,
 3562|  2.03k|                    out_at[at_1].stereo_bond_ord, out_at[at_1].stereo_bond_z_prod,
 3563|  2.03k|                    out_at[at_1].stereo_bond_parity,
 3564|  2.03k|                    at_2, i_next_at_2, out_at[at_2].stereo_bond_neighbor,
 3565|  2.03k|                    out_at[at_2].stereo_bond_ord, out_at[at_2].stereo_bond_z_prod,
 3566|  2.03k|                    out_at[at_2].stereo_bond_parity ))
 3567|  2.03k|                {
 3568|  2.03k|                    if (!out_at[at_1].parity ||
  ------------------
  |  Branch (3568:25): [True: 1.85k, False: 178]
  ------------------
 3569|    178|                         (cur_parity_defined && !ATOM_PARITY_WELL_DEF( abs( out_at[at_1].parity )) )) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  259|     34|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|     34|#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)
  |  |  ------------------
  |  |  |  |  236|     34|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 34, False: 0]
  |  |  |  Branch (259:75): [True: 10, False: 24]
  |  |  ------------------
  ------------------
  |  Branch (3569:27): [True: 34, False: 144]
  ------------------
 3570|  1.88k|                    {
 3571|  1.88k|                        out_at[at_1].parity = cur_parity;
 3572|  1.88k|                        memcpy(out_at[at_1].z_dir, z_dir1, sizeof(out_at[0].z_dir));
 3573|  1.88k|                    }
 3574|  2.03k|                    if (!out_at[at_2].parity ||
  ------------------
  |  Branch (3574:25): [True: 1.23k, False: 798]
  ------------------
 3575|    798|                         (next_parity_defined && !ATOM_PARITY_WELL_DEF( abs( out_at[at_2].parity )) )) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  259|    100|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    100|#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)
  |  |  ------------------
  |  |  |  |  236|    100|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 100, False: 0]
  |  |  |  Branch (259:75): [True: 10, False: 90]
  |  |  ------------------
  ------------------
  |  Branch (3575:27): [True: 100, False: 698]
  ------------------
 3576|  1.32k|                    {
 3577|  1.32k|                        out_at[at_2].parity = next_parity;
 3578|  1.32k|                        memcpy(out_at[at_2].z_dir, z_dir2, sizeof(out_at[0].z_dir));
 3579|  1.32k|                    }
 3580|  2.03k|                    out_at[at_1].bAmbiguousStereo |= at[at_1].bAmbiguousStereo;
 3581|  2.03k|                    out_at[at_2].bAmbiguousStereo |= at[at_2].bAmbiguousStereo;
 3582|       |                    /* djb-rwth: removing redundant code */
 3583|  2.03k|                }
 3584|  2.03k|            }
 3585|  2.03k|        }
 3586|       |
 3587|       |        /*  Stereo + isotopic (all non-zero) */
 3588|  2.05k|        cur_action = half_stereo_bond_action( cur_parity, nUnknown, 1, vABParityUnknown ); /*  -1 => program error */
 3589|  2.05k|        next_action = half_stereo_bond_action( next_parity, nUnknown, 1, vABParityUnknown );
 3590|  2.05k|        result_action = inchi_min( cur_action, next_action );
  ------------------
  |  |  139|  2.05k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 2.05k]
  |  |  ------------------
  ------------------
 3591|  2.05k|        cur_parity = abs_cur_parity;
 3592|  2.05k|        next_parity = abs_next_parity;
 3593|  2.05k|        if (result_action != AB_PARITY_NONE && result_action != -1)
  ------------------
  |  |  218|  4.11k|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (3593:13): [True: 2.05k, False: 0]
  |  Branch (3593:48): [True: 2.04k, False: 6]
  ------------------
 3594|  2.04k|        {
 3595|       |            /*  Stereo, isotopic */
 3596|  2.04k|            if (cur_parity > 0 && next_parity > 0)
  ------------------
  |  Branch (3596:17): [True: 2.04k, False: 0]
  |  Branch (3596:35): [True: 2.04k, False: 0]
  ------------------
 3597|  2.04k|            {
 3598|  2.04k|                if (save_a_stereo_bond( dot_prod_z, result_action | chain_len_bits,
  ------------------
  |  Branch (3598:21): [True: 2.04k, False: 0]
  ------------------
 3599|  2.04k|                    at_1, i_next_at_1, out_at[at_1].stereo_bond_neighbor2,
 3600|  2.04k|                    out_at[at_1].stereo_bond_ord2, out_at[at_1].stereo_bond_z_prod2,
 3601|  2.04k|                    out_at[at_1].stereo_bond_parity2,
 3602|  2.04k|                    at_2, i_next_at_2, out_at[at_2].stereo_bond_neighbor2,
 3603|  2.04k|                    out_at[at_2].stereo_bond_ord2, out_at[at_2].stereo_bond_z_prod2,
 3604|  2.04k|                    out_at[at_2].stereo_bond_parity2 ))
 3605|  2.04k|                {
 3606|  2.04k|                    if (!out_at[at_1].parity2 ||
  ------------------
  |  Branch (3606:25): [True: 1.87k, False: 178]
  ------------------
 3607|    178|                         (cur_parity_defined && !ATOM_PARITY_WELL_DEF( abs( out_at[at_1].parity2 )) )) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  259|     34|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|     34|#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)
  |  |  ------------------
  |  |  |  |  236|     34|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 34, False: 0]
  |  |  |  Branch (259:75): [True: 10, False: 24]
  |  |  ------------------
  ------------------
  |  Branch (3607:27): [True: 34, False: 144]
  ------------------
 3608|  1.89k|                    {
 3609|  1.89k|                        out_at[at_1].parity2 = cur_parity /*| chain_len_bits*/;
 3610|  1.89k|                        if (!out_at[at_1].parity)
  ------------------
  |  Branch (3610:29): [True: 12, False: 1.88k]
  ------------------
 3611|     12|                        {
 3612|     12|                            memcpy(out_at[at_1].z_dir, z_dir1, sizeof(out_at[0].z_dir));
 3613|     12|                        }
 3614|  1.89k|                    }
 3615|  2.04k|                    if (!out_at[at_2].parity2 || /* next line changed from abs(out_at[at_2].parity) 2006-03-05 */
  ------------------
  |  Branch (3615:25): [True: 1.25k, False: 798]
  ------------------
 3616|    798|                         (next_parity_defined && !ATOM_PARITY_WELL_DEF( abs( out_at[at_2].parity2 )) )) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  259|    100|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|    100|#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)
  |  |  ------------------
  |  |  |  |  236|    100|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 100, False: 0]
  |  |  |  Branch (259:75): [True: 10, False: 90]
  |  |  ------------------
  ------------------
  |  Branch (3616:27): [True: 100, False: 698]
  ------------------
 3617|  1.34k|                    {
 3618|  1.34k|                        out_at[at_2].parity2 = next_parity /*| chain_len_bits*/;
 3619|  1.34k|                        if (!out_at[at_2].parity)
  ------------------
  |  Branch (3619:29): [True: 12, False: 1.32k]
  ------------------
 3620|     12|                        {
 3621|     12|                            memcpy(out_at[at_2].z_dir, z_dir2, sizeof(out_at[0].z_dir));
 3622|     12|                        }
 3623|  1.34k|                    }
 3624|  2.04k|                    out_at[at_1].bAmbiguousStereo |= at[at_1].bAmbiguousStereo;
 3625|  2.04k|                    out_at[at_2].bAmbiguousStereo |= at[at_2].bAmbiguousStereo;
 3626|  2.04k|                    num_stored_isotopic_stereo_bonds++;
 3627|  2.04k|                }
 3628|  2.04k|            }
 3629|  2.04k|        }
 3630|      6|        else
 3631|      6|        {
 3632|      6|            if (result_action == -1)
  ------------------
  |  Branch (3632:17): [True: 6, False: 0]
  ------------------
 3633|      6|            {
 3634|      6|                stop = 1; /*  program error? <BRKPT> */
 3635|      6|            }
 3636|      6|        }
 3637|  2.05k|    }
 3638|       |
 3639|  4.41k|    if (stop)
  ------------------
  |  Branch (3639:9): [True: 6, False: 4.41k]
  ------------------
 3640|      6|    {
 3641|      6|        return CT_CALC_STEREO_ERR;
  ------------------
  |  |   34|      6|#define CT_CALC_STEREO_ERR   (CT_ERR_FIRST-15)  /*(-30015) */
  |  |  ------------------
  |  |  |  |   18|      6|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 3642|      6|    }
 3643|       |
 3644|  4.41k|    return /*num_stored_stereo_bonds+*/ num_stored_isotopic_stereo_bonds;
 3645|  4.41k|}
ichister.c:half_stereo_bond_parity:
 2093|  4.33k|{
 2094|  4.33k|    double at_coord[MAX_NUM_STEREO_BOND_NEIGH][3], c, s, tmp[3], tmp1, tmp2, min_tmp, max_tmp, z;
 2095|  4.33k|    double temp[3], pnt[3][3];
 2096|  4.33k|    int j, k, p0, p1, p2, next, bValence3 = 0, num_z, nType, num_either_single; /* djb-rwth: ignoring LLVM warning: variable used in switch statement; removing redundant variables */
 2097|  4.33k|    int nNumExplictAttachments;
 2098|  4.33k|    int bond_parity = AB_PARITY_UNDF;
  ------------------
  |  |  222|  4.33k|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 2099|  4.33k|    int    num_H = 0, num_iH, num_eH = 0, num_nH = 0 /* = num_iso_H[0] */;
 2100|  4.33k|    int    num_iso_H[NUM_H_ISOTOPES + 1];
 2101|  4.33k|    int    index_H[5]; /*  cannot have more than 4 elements: 1 H, 1 1H, 1 D, 1 T atom(s) */
 2102|       |    /*    const double one_pi = 2.0*atan2(1.0 , 0.0 ); */
 2103|  4.33k|    const double one_pi = 3.14159265358979323846; /* M_PI */
 2104|  4.33k|    const double two_pi = 2.0*one_pi;
 2105|  4.33k|    int    bIgnoreIsotopicH = ( 0 != ( at[cur_at].cFlags & AT_FLAG_ISO_H_POINT ) );
  ------------------
  |  |   50|  4.33k|#define AT_FLAG_ISO_H_POINT 0x01 /**< may have isotopic H */
  ------------------
 2106|  4.33k|    AT_NUMB nSbNeighOrigAtNumb[MAX_NUM_STEREO_BOND_NEIGH];
 2107|       |
 2108|       |
 2109|  4.33k|    if (z_dir && !z_dir[0] && !z_dir[1] && !z_dir[2])
  ------------------
  |  Branch (2109:9): [True: 4.33k, False: 0]
  |  Branch (2109:18): [True: 4.33k, False: 0]
  |  Branch (2109:31): [True: 4.33k, False: 0]
  |  Branch (2109:44): [True: 4.33k, False: 0]
  ------------------
 2110|  4.33k|    {
 2111|  4.33k|        z_dir[2] = 100;
 2112|  4.33k|    }
 2113|       |
 2114|  4.33k|    num_H = at[cur_at].num_H;
 2115|  4.33k|    if (num_H > NUM_H_ISOTOPES)
  ------------------
  |  |   25|  4.33k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (2115:9): [True: 0, False: 4.33k]
  ------------------
 2116|      0|    {
 2117|      0|        return 0; /*  at least 2 H atoms are isotopically identical */
 2118|      0|    }
 2119|       |
 2120|  4.33k|    if (MAX_NUM_STEREO_BOND_NEIGH < at[cur_at].valence + num_H ||
  ------------------
  |  |  874|  4.33k|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (2120:9): [True: 0, False: 4.33k]
  ------------------
 2121|  4.33k|         MIN_NUM_STEREO_BOND_NEIGH > at[cur_at].valence + num_H)
  ------------------
  |  |  875|  4.33k|#define MIN_NUM_STEREO_BOND_NEIGH 2
  ------------------
  |  Branch (2121:10): [True: 0, False: 4.33k]
  ------------------
 2122|      0|    {
 2123|      0|        return 0;
 2124|      0|    }
 2125|       |
 2126|  4.33k|    if (!bCanAtomHaveAStereoBond( at[cur_at].elname, at[cur_at].charge, at[cur_at].radical ))
  ------------------
  |  Branch (2126:9): [True: 0, False: 4.33k]
  ------------------
 2127|      0|    {
 2128|      0|        return 0;
 2129|      0|    }
 2130|       |
 2131|  4.33k|    if (!bIgnoreIsotopicH)
  ------------------
  |  Branch (2131:9): [True: 4.31k, False: 16]
  ------------------
 2132|  4.31k|    {
 2133|  17.0k|        for (j = 0, num_nH = num_H; j < NUM_H_ISOTOPES; j++)
  ------------------
  |  |   25|  17.0k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (2133:37): [True: 12.8k, False: 4.21k]
  ------------------
 2134|  12.8k|        {
 2135|  12.8k|            if (( k = (int) at[cur_at].num_iso_H[j] ) > 1)
  ------------------
  |  Branch (2135:17): [True: 97, False: 12.7k]
  ------------------
 2136|     97|            {
 2137|     97|                return AB_PARITY_IISO;  /*  two or more identical isotopic H atoms */
  ------------------
  |  |  223|     97|#define AB_PARITY_IISO   5  /* 5 => no parity because of identical atoms */
  ------------------
 2138|     97|            }
 2139|  12.7k|            num_nH -= k;
 2140|  12.7k|        }
 2141|  4.31k|    }
 2142|       |
 2143|       |    /*  at this point num_nH = number of non-isotopic H atoms */
 2144|  4.23k|    if (num_nH > 1)
  ------------------
  |  Branch (2144:9): [True: 23, False: 4.21k]
  ------------------
 2145|     23|    {
 2146|     23|        return AB_PARITY_IISO; /*  two or more identical non-isotopic H atoms */
  ------------------
  |  |  223|     23|#define AB_PARITY_IISO   5  /* 5 => no parity because of identical atoms */
  ------------------
 2147|     23|    }
 2148|       |
 2149|  4.21k|    if (num_nH < 0)
  ------------------
  |  Branch (2149:9): [True: 20, False: 4.19k]
  ------------------
 2150|     20|    {
 2151|     20|        return CT_ISO_H_ERR;  /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   28|     20|#define CT_ISO_H_ERR         (CT_ERR_FIRST- 9)  /*(-30009) */
  |  |  ------------------
  |  |  |  |   18|     20|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 2152|     20|    }
 2153|       |
 2154|  16.7k|    for (j = 0; j < MAX_NUM_STEREO_BOND_NEIGH; j++) /* djb-rwth: avoiding garbage values with proper initialisation */
  ------------------
  |  |  874|  16.7k|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (2154:17): [True: 12.5k, False: 4.19k]
  ------------------
 2155|  12.5k|    {
 2156|  50.3k|        for (k = 0; k < 3; k++)
  ------------------
  |  Branch (2156:21): [True: 37.7k, False: 12.5k]
  ------------------
 2157|  37.7k|        {
 2158|  37.7k|            at_coord[j][k] = 0; 
 2159|  37.7k|        }
 2160|  12.5k|    }
 2161|       |
 2162|       |    /********************************************************************
 2163|       |     * Note. At this point all (implicit and explicit) isotopic
 2164|       |     * terminal H neighbors are either different or not present.
 2165|       |     ********************************************************************/
 2166|       |
 2167|       |    /*  locate explicit hydrogen atoms */
 2168|       |    /*  (at_removed_H are sorted in ascending isotopic H mass order, non-isotopic first) */
 2169|  4.19k|    memset( num_iso_H, 0, sizeof( num_iso_H ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2170|  4.19k|    if (at_removed_H && num_removed_H > 0)
  ------------------
  |  Branch (2170:9): [True: 4.19k, False: 0]
  |  Branch (2170:25): [True: 429, False: 3.76k]
  ------------------
 2171|    429|    {
 2172|    937|        for (j = 0; j < num_removed_H; j++)
  ------------------
  |  Branch (2172:21): [True: 509, False: 428]
  ------------------
 2173|    509|        {
 2174|    509|            if (at_removed_H[j].neighbor[0] == cur_at)
  ------------------
  |  Branch (2174:17): [True: 212, False: 297]
  ------------------
 2175|    212|            {
 2176|    212|                k = bIgnoreIsotopicH ? 0 : at_removed_H[j].iso_atw_diff;
  ------------------
  |  Branch (2176:21): [True: 14, False: 198]
  ------------------
 2177|    212|                if (0 <= k && k <= NUM_H_ISOTOPES)
  ------------------
  |  |   25|    211|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (2177:21): [True: 211, False: 1]
  |  Branch (2177:31): [True: 211, False: 0]
  ------------------
 2178|    211|                {
 2179|    211|                    if (++num_iso_H[k] > 1)   /*  num_iso_H[0] = number of non-isotopic H atoms */
  ------------------
  |  Branch (2179:25): [True: 0, False: 211]
  ------------------
 2180|      0|                        return CT_ISO_H_ERR;    /*  program error in counting hydrogens */ /*   <BRKPT> */
  ------------------
  |  |   28|      0|#define CT_ISO_H_ERR         (CT_ERR_FIRST- 9)  /*(-30009) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 2181|    211|                    index_H[num_eH++] = j;
 2182|    211|                }
 2183|      1|                else
 2184|      1|                {
 2185|      1|                    return CT_ISO_H_ERR;  /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   28|      1|#define CT_ISO_H_ERR         (CT_ERR_FIRST- 9)  /*(-30009) */
  |  |  ------------------
  |  |  |  |   18|      1|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 2186|      1|                }
 2187|    212|            }
 2188|    509|        }
 2189|    428|        num_iH = num_H - num_eH; /*  number of implicit non-isotopic and isotopic H atoms */
 2190|    428|        if (num_iH > 1)
  ------------------
  |  Branch (2190:13): [True: 1, False: 427]
  ------------------
 2191|      1|        {
 2192|       |            /*  more than one implicit H: cannot reconstruct the geometry */
 2193|      1|            bond_parity = -AB_PARITY_UNDF;
  ------------------
  |  |  222|      1|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 2194|      1|            goto exit_function;
 2195|      1|        }
 2196|    428|    }
 2197|       |    /* djb-rwth: removing redundant code */
 2198|       |    /*  at this point num_iH = number of implicit non-isotopic and isotopic H atoms */
 2199|  4.19k|    if (at[cur_at].valence + num_eH < MIN_NUM_STEREO_BOND_NEIGH)
  ------------------
  |  |  875|  4.19k|#define MIN_NUM_STEREO_BOND_NEIGH 2
  ------------------
  |  Branch (2199:9): [True: 26, False: 4.16k]
  ------------------
 2200|     26|    {
 2201|       |        /*  =NH or =CHD when no explicit H is present */
 2202|     26|        return num_H == 1 ? AB_PARITY_UNDF : -AB_PARITY_UNDF;
  ------------------
  |  |  222|     24|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
                      return num_H == 1 ? AB_PARITY_UNDF : -AB_PARITY_UNDF;
  ------------------
  |  |  222|      2|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2202:16): [True: 24, False: 2]
  ------------------
 2203|     26|    }
 2204|       |
 2205|  4.16k|    bValence3 = bAtomHasValence3( at[cur_at].elname, at[cur_at].charge, at[cur_at].radical );
 2206|       |    /*
 2207|       |     * Can one explicit hydrogen be added to make asymmetric configuration?
 2208|       |     * For now we can add 1 H atom in case of an appropriate geometry if:
 2209|       |     * (a) one non-isotopic H (even if explicit isotopic H atoms are present), or
 2210|       |     * (b) one isotopic or non-isotopic H if NO explicit isotopic or non-isotopic H atom is present
 2211|       |     * This makes sense only in case chem. valence = 4. In case of chem. valence = 3, do not check.
 2212|       |     */
 2213|  4.16k|    if (at[cur_at].valence + num_eH == MIN_NUM_STEREO_BOND_NEIGH && !bValence3 &&
  ------------------
  |  |  875|  8.32k|#define MIN_NUM_STEREO_BOND_NEIGH 2
  ------------------
  |  Branch (2213:9): [True: 3.54k, False: 616]
  |  Branch (2213:69): [True: 87, False: 3.46k]
  ------------------
 2214|     87|         !(/*(a)*/ (1 == num_nH && !num_iso_H[0]) ||
  ------------------
  |  Branch (2214:21): [True: 77, False: 10]
  |  Branch (2214:36): [True: 50, False: 27]
  ------------------
 2215|     37|             /*(b)*/ (1 == num_H && !num_eH )) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (2215:23): [True: 30, False: 7]
  |  Branch (2215:37): [True: 3, False: 27]
  ------------------
 2216|  4.16k|       )
 2217|     34|    {
 2218|     34|        goto exit_function;
 2219|       |        /* return num_H == 1? AB_PARITY_UNDF : -AB_PARITY_UNDF; */
 2220|     34|    }
 2221|       |
 2222|       |    /*  store neighbors coordinates */
 2223|  4.13k|    num_z = num_either_single = 0; /* djb-rwth: ignoring LLVM warning: variable used for switch statement; removing redundant code */
 2224|  12.3k|    for (k = nNumExplictAttachments = 0; k < 2; k++)
  ------------------
  |  Branch (2224:42): [True: 8.26k, False: 4.13k]
  ------------------
 2225|  8.26k|    {
 2226|  8.26k|        switch (k)
  ------------------
  |  Branch (2226:17): [True: 8.26k, False: 0]
  ------------------
 2227|  8.26k|        {
 2228|  4.13k|            case 0:
  ------------------
  |  Branch (2228:13): [True: 4.13k, False: 4.13k]
  ------------------
 2229|  4.31k|                for (j = 0; j < num_eH; j++, nNumExplictAttachments++)
  ------------------
  |  Branch (2229:29): [True: 183, False: 4.13k]
  ------------------
 2230|    183|                {
 2231|    183|                    next = index_H[j];
 2232|    183|                    at_coord[nNumExplictAttachments][0] = at_removed_H[next].x - at[cur_at].x;
 2233|    183|                    at_coord[nNumExplictAttachments][1] = at_removed_H[next].y - at[cur_at].y;
 2234|    183|                    nSbNeighOrigAtNumb[nNumExplictAttachments] = at_removed_H[next].orig_at_number;
 2235|       |                    /* use the fact that (at_removed_H - at) = (number of atoms except removed explicit H) */
 2236|    183|                    z = -get_z_coord( at, (int) ( at_removed_H - at ) + next,
 2237|    183|                                      0 /*neighbor #*/,
 2238|    183|                                      &nType,
 2239|    183|                                      -( bPointedEdgeStereo & PES_BIT_POINT_EDGE_STEREO ) );
  ------------------
  |  |   44|    183|#define PES_BIT_POINT_EDGE_STEREO    1
  ------------------
 2240|    183|                    switch (nType)
  ------------------
  |  Branch (2240:29): [True: 0, False: 183]
  ------------------
 2241|    183|                    {
 2242|      0|                        case ZTYPE_EITHER:
  ------------------
  |  |   24|      0|#define    ZTYPE_EITHER   9999
  ------------------
  |  Branch (2242:25): [True: 0, False: 183]
  ------------------
 2243|      0|                            num_either_single++; /*  bond in "Either" direction. */
 2244|      0|                            break;
 2245|      0|                        case ZTYPE_UP:
  ------------------
  |  |   22|      0|#define    ZTYPE_UP       1     /*  should be equal to -ZTYPE_DOWN */
  ------------------
  |  Branch (2245:25): [True: 0, False: 183]
  ------------------
 2246|      0|                        case ZTYPE_DOWN:
  ------------------
  |  |   20|      0|#define    ZTYPE_DOWN     (-1)  /*  should be equal to -ZTYPE_UP */
  ------------------
  |  Branch (2246:25): [True: 0, False: 183]
  ------------------
 2247|      0|                            nType = -nType; /*  at_removed_H[] contains bonds TO the center, not from */
 2248|      0|                            z = len2( at_coord[nNumExplictAttachments] );
 2249|       |                            /*
 2250|       |                            z = sqrt( at_coord[nNumExplictAttachments][0]*at_coord[nNumExplictAttachments][0]
 2251|       |                                    + at_coord[nNumExplictAttachments][1]*at_coord[nNumExplictAttachments][1] );
 2252|       |                            */
 2253|      0|                            if (nType == ZTYPE_DOWN)
  ------------------
  |  |   20|      0|#define    ZTYPE_DOWN     (-1)  /*  should be equal to -ZTYPE_UP */
  ------------------
  |  Branch (2253:33): [True: 0, False: 0]
  ------------------
 2254|      0|                            {
 2255|      0|                                z = -z;
 2256|      0|                            }
 2257|       |                            /*  no break; here */
 2258|      0|                        case ZTYPE_3D:
  ------------------
  |  |   23|      0|#define    ZTYPE_3D       3
  ------------------
  |  Branch (2258:25): [True: 0, False: 183]
  ------------------
 2259|      0|                            num_z++;
 2260|    183|                    }
 2261|    183|                    at_coord[nNumExplictAttachments][2] = z;
 2262|    183|                }
 2263|  4.13k|                break;
 2264|  4.13k|            case 1:
  ------------------
  |  Branch (2264:13): [True: 4.13k, False: 4.13k]
  ------------------
 2265|  12.8k|                for (j = 0; j < at[cur_at].valence; j++, nNumExplictAttachments++)
  ------------------
  |  Branch (2265:29): [True: 8.69k, False: 4.13k]
  ------------------
 2266|  8.69k|                {
 2267|  8.69k|                    next = at[cur_at].neighbor[j];
 2268|  8.69k|                    at_coord[nNumExplictAttachments][0] = at[next].x - at[cur_at].x;
 2269|  8.69k|                    at_coord[nNumExplictAttachments][1] = at[next].y - at[cur_at].y;
 2270|  8.69k|                    nSbNeighOrigAtNumb[nNumExplictAttachments] = at[next].orig_at_number;
 2271|       |
 2272|  8.69k|                    z = get_z_coord( at, cur_at, j /*neighbor #*/, &nType, ( bPointedEdgeStereo & PES_BIT_POINT_EDGE_STEREO ) );
  ------------------
  |  |   44|  8.69k|#define PES_BIT_POINT_EDGE_STEREO    1
  ------------------
 2273|  8.69k|                    switch (nType)
  ------------------
  |  Branch (2273:29): [True: 0, False: 8.69k]
  ------------------
 2274|  8.69k|                    {
 2275|      0|                        case ZTYPE_EITHER:
  ------------------
  |  |   24|      0|#define    ZTYPE_EITHER   9999
  ------------------
  |  Branch (2275:25): [True: 0, False: 8.69k]
  ------------------
 2276|      0|                            num_either_single++; /*  bond in "Either" direction. */
 2277|      0|                            break;
 2278|      0|                        case ZTYPE_UP:
  ------------------
  |  |   22|      0|#define    ZTYPE_UP       1     /*  should be equal to -ZTYPE_DOWN */
  ------------------
  |  Branch (2278:25): [True: 0, False: 8.69k]
  ------------------
 2279|      0|                        case ZTYPE_DOWN:
  ------------------
  |  |   20|      0|#define    ZTYPE_DOWN     (-1)  /*  should be equal to -ZTYPE_UP */
  ------------------
  |  Branch (2279:25): [True: 0, False: 8.69k]
  ------------------
 2280|      0|                            z = len2( at_coord[nNumExplictAttachments] );
 2281|       |                            /*
 2282|       |                            z = sqrt( at_coord[nNumExplictAttachments][0]*at_coord[nNumExplictAttachments][0]
 2283|       |                                    + at_coord[nNumExplictAttachments][1]*at_coord[nNumExplictAttachments][1] );
 2284|       |                            */
 2285|      0|                            if (nType == ZTYPE_DOWN)
  ------------------
  |  |   20|      0|#define    ZTYPE_DOWN     (-1)  /*  should be equal to -ZTYPE_UP */
  ------------------
  |  Branch (2285:33): [True: 0, False: 0]
  ------------------
 2286|      0|                            {
 2287|      0|                                z = -z;
 2288|      0|                            }
 2289|       |                            /*  no break; here */
 2290|      0|                        case ZTYPE_3D:
  ------------------
  |  |   23|      0|#define    ZTYPE_3D       3
  ------------------
  |  Branch (2290:25): [True: 0, False: 8.69k]
  ------------------
 2291|      0|                            num_z++;
 2292|  8.69k|                    }
 2293|  8.69k|                    at_coord[nNumExplictAttachments][2] = z;
 2294|  8.69k|                }
 2295|  4.13k|                break;
 2296|  8.26k|        }
 2297|  8.26k|    }
 2298|       |
 2299|  4.13k|    if (num_either_single)
  ------------------
  |  Branch (2299:9): [True: 0, False: 4.13k]
  ------------------
 2300|      0|    {
 2301|      0|        bond_parity = vABParityUnknown /*AB_PARITY_UNKN*/;  /*  single bond is 'unknown' */
 2302|      0|        goto exit_function;
 2303|      0|    }
 2304|       |
 2305|       |    /* nNumExplictAttachments is a total number of attachments, including removed explicit terminal hydrogens */
 2306|  4.13k|    if (nNumExplictAttachments == 2)
  ------------------
  |  Branch (2306:9): [True: 3.51k, False: 616]
  ------------------
 2307|  3.51k|    {
 2308|       |        /*  create coordinates of the implicit hydrogen (or a fictitious atom in case of ==N-X ), */
 2309|       |        /*  coord[2][], attached to the cur_at. */
 2310|  14.0k|        for (j = 0; j < 3; j++)
  ------------------
  |  Branch (2310:21): [True: 10.5k, False: 3.51k]
  ------------------
 2311|  10.5k|        {
 2312|  10.5k|            at_coord[2][j] = -( at_coord[0][j] + at_coord[1][j] );
 2313|  10.5k|        }
 2314|  3.51k|        nSbNeighOrigAtNumb[nNumExplictAttachments] = 0; /* implicit H or lone pair */
 2315|  3.51k|    }
 2316|  16.5k|    for (j = 0; j < 3; j++)
  ------------------
  |  Branch (2316:17): [True: 12.3k, False: 4.13k]
  ------------------
 2317|  12.3k|    {
 2318|  12.3k|        tmp[j] = len3( at_coord[j] );
 2319|  12.3k|    }
 2320|  4.13k|    min_tmp = inchi_min( tmp[0], inchi_min( tmp[1], tmp[2] ) );
  ------------------
  |  |  139|  8.26k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 4.13k]
  |  |  |  Branch (139:32): [True: 0, False: 4.13k]
  |  |  |  Branch (139:41): [True: 0, False: 4.13k]
  |  |  ------------------
  ------------------
 2321|  4.13k|    max_tmp = inchi_max( tmp[0], inchi_max( tmp[1], tmp[2] ) );
  ------------------
  |  |  138|  8.26k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 4.13k]
  |  |  |  Branch (138:32): [True: 0, False: 4.13k]
  |  |  |  Branch (138:41): [True: 0, False: 4.13k]
  |  |  ------------------
  ------------------
 2322|  4.13k|    if (min_tmp < MIN_BOND_LEN || min_tmp < MIN_SINE*max_tmp)
  ------------------
  |  |   39|  8.26k|#define MIN_BOND_LEN          0.000001
  ------------------
                  if (min_tmp < MIN_BOND_LEN || min_tmp < MIN_SINE*max_tmp)
  ------------------
  |  |   30|      0|#define MIN_SINE              0.03    /*min edge/plane angle in case the tetrahedra has significantly different edge length */
  ------------------
  |  Branch (2322:9): [True: 4.13k, False: 0]
  |  Branch (2322:35): [True: 0, False: 0]
  ------------------
 2323|  4.13k|    {
 2324|       |        /*  all bonds or some of bonds are too short */
 2325|  4.13k|        if (at[cur_at].sb_parity[0])
  ------------------
  |  Branch (2325:13): [True: 1.02k, False: 3.10k]
  ------------------
 2326|  1.02k|        {
 2327|       |            /* use bond psrity; the reconciliation in ReconcileAllCmlBondParities()
 2328|       |            * has made all ways to calculate parity produce same result
 2329|       |            */
 2330|  1.02k|            bond_parity = GetHalfStereobond0DParity( at, cur_at, nSbNeighOrigAtNumb,
 2331|  1.02k|                                                     nNumExplictAttachments, bond_parity, FlagSB_0D );
  ------------------
  |  |   60|  1.02k|#define FlagSB_0D 2 /**< bUsed0DParity */
  ------------------
 2332|  1.02k|        }
 2333|       |
 2334|  4.13k|        goto exit_function;
 2335|  4.13k|    }
 2336|       |    /*  normalize lengths to 1 */
 2337|      0|    for (j = 0; j < 3; j++)
  ------------------
  |  Branch (2337:17): [True: 0, False: 0]
  ------------------
 2338|      0|    {
 2339|      0|        mult3( at_coord[j], 1.0 / tmp[j], at_coord[j] );
 2340|      0|    }
 2341|       |
 2342|       |    /*  find projections of at_coord vector differences on the plane containing their arrowhead ends */
 2343|      0|    for (j = 0; j < 3; j++)
  ------------------
  |  Branch (2343:17): [True: 0, False: 0]
  ------------------
 2344|      0|    {
 2345|       |        /*  pnt[0..2] = {0-1, 1-2, 2-0} */
 2346|      0|        tmp[j] = len3((double *)diff3( at_coord[j], at_coord[( j + 1 ) % 3], pnt[j] ) ); /* djb-rwth: cast operator added for compatibility */
 2347|      0|        if (tmp[j] < MIN_SINE)
  ------------------
  |  |   30|      0|#define MIN_SINE              0.03    /*min edge/plane angle in case the tetrahedra has significantly different edge length */
  ------------------
  |  Branch (2347:13): [True: 0, False: 0]
  ------------------
 2348|      0|        {
 2349|      0|            goto exit_function; /*  angle #i-cur_at-#j is too small */
 2350|      0|        }
 2351|      0|        mult3( pnt[j], 1.0 / tmp[j], pnt[j] ); /* 2003-10-06 */
 2352|      0|    }
 2353|       |    /*  find pnt[p2], a vector perpendicular to the plane, and its length tmp[p2] */
 2354|       |    /*  replace previous pnt[p2], tmp[p2] with new values; the old values do not have any additional */
 2355|       |    /*  information because pnt[p0]+pnt[p1]+pnt[p2]=0 */
 2356|       |    /*  10-6-2003: a cross-product of one pair pnt[j], pnt[(j+1)%3] can be very small. Find the larges one */
 2357|      0|    tmp1 = len3((double *)cross_prod3( pnt[0], pnt[1], temp ) ); /* djb-rwth: cast operator added for compatibility */
 2358|      0|    for (j = 1, k = 0; j < 3; j++)
  ------------------
  |  Branch (2358:24): [True: 0, False: 0]
  ------------------
 2359|      0|    {
 2360|      0|        tmp2 = len3((double *)cross_prod3( pnt[j], pnt[( j + 1 ) % 3], temp ) ); /* djb-rwth: cast operator added for compatibility */
 2361|      0|        if (tmp2 > tmp1)
  ------------------
  |  Branch (2361:13): [True: 0, False: 0]
  ------------------
 2362|      0|        {
 2363|      0|            tmp1 = tmp2;
 2364|      0|            k = j;
 2365|      0|        }
 2366|      0|    }
 2367|       |    /* previously p0=0, p1=1, p2=2 */
 2368|      0|    p0 = k;
 2369|      0|    p1 = ( k + 1 ) % 3;
 2370|      0|    p2 = ( k + 2 ) % 3;
 2371|      0|    tmp[p2] = len3((double *)cross_prod3( pnt[p0], pnt[p1], pnt[p2] ) ); /* djb-rwth: cast operator added for compatibility */
 2372|      0|    if (tmp[p2] < MIN_SINE*tmp[p0] * tmp[p1])
  ------------------
  |  |   30|      0|#define MIN_SINE              0.03    /*min edge/plane angle in case the tetrahedra has significantly different edge length */
  ------------------
  |  Branch (2372:9): [True: 0, False: 0]
  ------------------
 2373|      0|    {
 2374|      0|        goto exit_function; /*  pnt[p0] is almost colinear to pnt[p1] */
 2375|      0|    }
 2376|       |    /*  new basis: pnt[p0], pnt[p1], pnt[p2]; set z-coord sign and make abs(pnt[p2]) = 1 */
 2377|      0|    mult3( pnt[p2], ( pnt[p2][2] > 0.0 ? 1.0 : -1.0 ) / tmp[p2], pnt[p2] ); /*  unit vector in the new z-axis direction */
  ------------------
  |  Branch (2377:23): [True: 0, False: 0]
  ------------------
 2378|       |
 2379|      0|    min_tmp = dot_prod3( at_coord[0], pnt[p2] ); /*  non-planarity measure (sine): hight of at_coord[] pyramid */
 2380|      0|    mult3( pnt[p2], min_tmp, pnt[p0] ); /*  vector height of the pyramid, ideally 0 */
 2381|       |    /*  find new pnt[p0] = projection of at_coord[p0] on plane orthogonal to pnt[p2] */
 2382|      0|    tmp[p0] = len3((double *)diff3( at_coord[0], pnt[p0], pnt[p0] ) ); /* djb-rwth: cast operator added for compatibility */
 2383|      0|    mult3( pnt[p0], 1.0 / tmp[p0], pnt[p0] );  /*  new x axis basis vector */
 2384|      0|    cross_prod3( pnt[p2], pnt[p0], pnt[p1] ); /*  new y axis basis vector */
 2385|       |    /*  find at_coord in the new basis of {pnt[p0], pnt[p1], pnt[p2]} */
 2386|      0|    for (j = 0; j < 3; j++)
  ------------------
  |  Branch (2386:17): [True: 0, False: 0]
  ------------------
 2387|      0|    {
 2388|       |        /* copy3(at_coord[j], temp);-- djb-rwth: removing copy3 function */
 2389|      0|        memcpy(temp, at_coord[j], sizeof(at_coord[j]));
 2390|      0|        for (k = 0; k < 3; k++)
  ------------------
  |  Branch (2390:21): [True: 0, False: 0]
  ------------------
 2391|      0|        {
 2392|      0|            at_coord[j][k] = dot_prod3( temp, pnt[( k + p0 ) % 3] );
 2393|      0|        }
 2394|       |        /*  new xy plane projection length */
 2395|      0|        tmp[j] = sqrt( at_coord[j][0] * at_coord[j][0] + at_coord[j][1] * at_coord[j][1] );
 2396|       |        /*  make new xy plane projection length = 1 */
 2397|      0|        mult3( at_coord[j], 1.0 / tmp[j], at_coord[j] );
 2398|      0|    }
 2399|       |
 2400|      0|    s = fabs( at_coord[1][0] * at_coord[2][1] - at_coord[1][1] * at_coord[2][0] ); /*  1-2 sine */
 2401|      0|    c = at_coord[1][0] * at_coord[2][0] + at_coord[1][1] * at_coord[2][1];   /*  1-2 cosine */
 2402|      0|    if (s < MIN_SINE && c > 0.5)
  ------------------
  |  |   30|      0|#define MIN_SINE              0.03    /*min edge/plane angle in case the tetrahedra has significantly different edge length */
  ------------------
  |  Branch (2402:9): [True: 0, False: 0]
  |  Branch (2402:25): [True: 0, False: 0]
  ------------------
 2403|      0|    {
 2404|      0|        goto exit_function; /*  bonds to neigh. 1 and 2 have almost same direction; relative angles are undefined */
 2405|      0|    }
 2406|      0|    c = at_coord[0][0]; /*  cosine of the angle between new Ox axis and a bond to the neighbor 0. Should be 1 */
 2407|      0|    s = at_coord[0][1]; /*  sine. Should be 0 */
 2408|       |    /*  turn vectors so that vector #1 (at_coord[0]) becomes {1, 0} */
 2409|      0|    for (j = 0; j < MAX_NUM_STEREO_BOND_NEIGH; j++)
  ------------------
  |  |  874|      0|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (2409:17): [True: 0, False: 0]
  ------------------
 2410|      0|    {
 2411|      0|        tmp1 = c*at_coord[j][0] + s*at_coord[j][1];
 2412|      0|        tmp2 = -s*at_coord[j][0] + c*at_coord[j][1];
 2413|      0|        at_coord[j][0] = tmp1;
 2414|      0|        at_coord[j][1] = tmp2;
 2415|      0|    }
 2416|       |    /*  counterclockwise angles from the direction to neigh 0 to to directions to neighbors 1 and 2: */
 2417|      0|    tmp1 = atan2( at_coord[1][1], at_coord[1][0] ); /*  range -pi and +pi */
 2418|      0|    tmp2 = atan2( at_coord[2][1], at_coord[2][0] );
 2419|      0|    if (tmp1 < 0.0)
  ------------------
  |  Branch (2419:9): [True: 0, False: 0]
  ------------------
 2420|      0|    {
 2421|      0|        tmp1 += two_pi; /*  range 0 to 2*pi */
 2422|      0|    }
 2423|      0|    if (tmp2 < 0.0)
  ------------------
  |  Branch (2423:9): [True: 0, False: 0]
  ------------------
 2424|      0|    {
 2425|      0|        tmp2 += two_pi;
 2426|      0|    }
 2427|       |    /*-----------------------------------
 2428|       |                        Example
 2429|       |      1 \               case tmp1 < tmp2
 2430|       |         \              parity is odd
 2431|       |          \             (counterclockwise)
 2432|       |           A------- 0
 2433|       |          /
 2434|       |         /
 2435|       |      2 /
 2436|       |
 2437|       |    ------------------------------------*/
 2438|      0|    bond_parity = 2 - ( tmp1 < tmp2 );
 2439|      0|    for (j = 0; j < 3; j++)
  ------------------
  |  Branch (2439:17): [True: 0, False: 0]
  ------------------
 2440|      0|    {
 2441|      0|        if (z_dir)
  ------------------
  |  Branch (2441:13): [True: 0, False: 0]
  ------------------
 2442|      0|            z_dir[j] = (S_CHAR) ( pnt[p2][j] >= 0.0 ? floor( 0.5 + 100.0 * pnt[p2][j] ) :
  ------------------
  |  Branch (2442:35): [True: 0, False: 0]
  ------------------
 2443|      0|                                               -floor( 0.5 - 100.0 * pnt[p2][j] ) ); /*  abs(z_dir) = 100 */
 2444|      0|    }
 2445|       |    /*  check for ambiguity */
 2446|      0|    if (nNumExplictAttachments > 2)
  ------------------
  |  Branch (2446:9): [True: 0, False: 0]
  ------------------
 2447|      0|    {
 2448|      0|        min_tmp = inchi_min( tmp1, tmp2 );
  ------------------
  |  |  139|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2449|      0|        max_tmp = inchi_max( tmp1, tmp2 );
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2450|      0|        if (min_tmp > one_pi - MIN_SINE || max_tmp < one_pi + MIN_SINE || max_tmp - min_tmp > one_pi - MIN_SINE)
  ------------------
  |  |   30|      0|#define MIN_SINE              0.03    /*min edge/plane angle in case the tetrahedra has significantly different edge length */
  ------------------
                      if (min_tmp > one_pi - MIN_SINE || max_tmp < one_pi + MIN_SINE || max_tmp - min_tmp > one_pi - MIN_SINE)
  ------------------
  |  |   30|      0|#define MIN_SINE              0.03    /*min edge/plane angle in case the tetrahedra has significantly different edge length */
  ------------------
                      if (min_tmp > one_pi - MIN_SINE || max_tmp < one_pi + MIN_SINE || max_tmp - min_tmp > one_pi - MIN_SINE)
  ------------------
  |  |   30|      0|#define MIN_SINE              0.03    /*min edge/plane angle in case the tetrahedra has significantly different edge length */
  ------------------
  |  Branch (2450:13): [True: 0, False: 0]
  |  Branch (2450:44): [True: 0, False: 0]
  |  Branch (2450:75): [True: 0, False: 0]
  ------------------
 2451|      0|        {
 2452|      0|            at[cur_at].bAmbiguousStereo |= AMBIGUOUS_STEREO;
  ------------------
  |  |  245|      0|#define AMBIGUOUS_STEREO           1
  ------------------
 2453|      0|        }
 2454|      0|        else /* 3D ambiguity 8-28-2002 */
 2455|      0|        {
 2456|      0|            if (fabs( at_coord[0][2] ) > MAX_SINE)
  ------------------
  |  |   38|      0|#define MAX_SINE              0.70710678118654752440084436210485 /*  1/sqrt(2)=sin(pi/4) */
  ------------------
  |  Branch (2456:17): [True: 0, False: 0]
  ------------------
 2457|      0|            { /*  all fabs(at_coord[j][2] (j=0..2) must be equal */
 2458|      0|                at[cur_at].bAmbiguousStereo |= AMBIGUOUS_STEREO;
  ------------------
  |  |  245|      0|#define AMBIGUOUS_STEREO           1
  ------------------
 2459|      0|            }
 2460|      0|        }
 2461|      0|    }
 2462|      0|    else
 2463|      0|    {
 2464|      0|        if (nNumExplictAttachments == 2)
  ------------------
  |  Branch (2464:13): [True: 0, False: 0]
  ------------------
 2465|      0|        {  /* 10-6-2003: added */
 2466|      0|            min_tmp = fabs( tmp1 - one_pi );
 2467|      0|            if (min_tmp < MIN_SINE)
  ------------------
  |  |   30|      0|#define MIN_SINE              0.03    /*min edge/plane angle in case the tetrahedra has significantly different edge length */
  ------------------
  |  Branch (2467:17): [True: 0, False: 0]
  ------------------
 2468|      0|            {
 2469|      0|                bond_parity = AB_PARITY_UNDF; /* consider as undefined 10-6-2003 */
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 2470|      0|            }
 2471|      0|            else
 2472|      0|            {
 2473|      0|                if (min_tmp < MIN_ANGLE_DBOND)
  ------------------
  |  |   33|      0|#define MIN_ANGLE_DBOND       0.087156 /* 5 degrees = max angle considered as too small for unambiguous double bond stereo */
  ------------------
  |  Branch (2473:21): [True: 0, False: 0]
  ------------------
 2474|      0|                {
 2475|      0|                    at[cur_at].bAmbiguousStereo |= AMBIGUOUS_STEREO;
  ------------------
  |  |  245|      0|#define AMBIGUOUS_STEREO           1
  ------------------
 2476|      0|                }
 2477|      0|            }
 2478|      0|        }
 2479|      0|    }
 2480|       |
 2481|       |    /*  for 3 neighbors moving implicit H to the index=0 from index=2 position */
 2482|       |    /*  can be done in 2 transpositions and does not change atom's parity */
 2483|       |
 2484|  4.16k|exit_function:
 2485|       |
 2486|  4.16k|    if (num_H > 1 && bond_parity > 0 && !( bond_parity & AB_PARITY_0D ) /*&& PARITY_WELL_DEF(bond_parity)*/)
  ------------------
  |  |  225|      9|#define AB_PARITY_0D     8  /* 8 => bit signifies 0D case -- not used */
  ------------------
  |  Branch (2486:9): [True: 10, False: 4.15k]
  |  Branch (2486:22): [True: 9, False: 1]
  |  Branch (2486:41): [True: 9, False: 0]
  ------------------
 2487|      9|    {
 2488|       |        /*
 2489|       |         * stereo only if isotopes are counted.             Do not inverse
 2490|       |         * Examples:                                        sign for this:
 2491|       |         *     H                            D
 2492|       |         *    /                            /                    H
 2493|       |         * ==C                      or  ==CH                   /
 2494|       |         *    \                                             ==N  (bValence3=1)
 2495|       |         *     D
 2496|       |         * two explicit         one explicit H isotope (D),
 2497|       |         * isotopic H atoms     one implicit H
 2498|       |         */
 2499|      9|        bond_parity = -bond_parity; /*  refers to isotopically substituted structure only */
 2500|      9|    }
 2501|       |
 2502|  4.16k|    return bond_parity;
 2503|      0|}
ichister.c:half_stereo_bond_action:
 2870|  8.22k|{
 2871|  8.22k|#define AB_NEGATIVE 0x10
 2872|  8.22k|#define AB_UNKNOWN  0x20
 2873|  8.22k|    int nAction;
 2874|       |
 2875|  8.22k|    if (nParity == AB_PARITY_NONE)
  ------------------
  |  |  218|  8.22k|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (2875:9): [True: 0, False: 8.22k]
  ------------------
 2876|      0|    {
 2877|      0|        return AB_PARITY_NONE;
  ------------------
  |  |  218|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
 2878|      0|    }
 2879|       |
 2880|       |    /*  Unknown (type 1) in the parity value may come from the 'Either' single bond only */
 2881|       |    /*  Treat it as a known single bond geometry and unknown (Either) double bond */
 2882|  8.22k|    if (nParity == vABParityUnknown /*AB_PARITY_UNKN*/)
  ------------------
  |  Branch (2882:9): [True: 7.13k, False: 1.09k]
  ------------------
 2883|  7.13k|    {
 2884|  7.13k|        nParity = AB_PARITY_ODD | AB_UNKNOWN;
  ------------------
  |  |  219|  7.13k|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
                      nParity = AB_PARITY_ODD | AB_UNKNOWN;
  ------------------
  |  | 2872|  7.13k|#define AB_UNKNOWN  0x20
  ------------------
 2885|  7.13k|    }
 2886|  8.22k|    if (nParity == -vABParityUnknown /*AB_PARITY_UNKN*/)
  ------------------
  |  Branch (2886:9): [True: 26, False: 8.19k]
  ------------------
 2887|     26|    {
 2888|     26|        nParity = AB_PARITY_ODD | AB_UNKNOWN | AB_NEGATIVE;
  ------------------
  |  |  219|     26|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
                      nParity = AB_PARITY_ODD | AB_UNKNOWN | AB_NEGATIVE;
  ------------------
  |  | 2872|     26|#define AB_UNKNOWN  0x20
  ------------------
                      nParity = AB_PARITY_ODD | AB_UNKNOWN | AB_NEGATIVE;
  ------------------
  |  | 2871|     26|#define AB_NEGATIVE 0x10
  ------------------
 2889|     26|    }
 2890|       |
 2891|       |    /*  make positive, replace AB_PARITY_EVEN with AB_PARITY_ODD  */
 2892|  8.22k|    if (nParity < 0)
  ------------------
  |  Branch (2892:9): [True: 14, False: 8.20k]
  ------------------
 2893|     14|    {
 2894|     14|        nParity = ( ( nParity == -AB_PARITY_EVEN ) ? AB_PARITY_ODD : ( -nParity ) ) | AB_NEGATIVE;
  ------------------
  |  |  220|     14|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
                      nParity = ( ( nParity == -AB_PARITY_EVEN ) ? AB_PARITY_ODD : ( -nParity ) ) | AB_NEGATIVE;
  ------------------
  |  |  219|      8|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
                      nParity = ( ( nParity == -AB_PARITY_EVEN ) ? AB_PARITY_ODD : ( -nParity ) ) | AB_NEGATIVE;
  ------------------
  |  | 2871|     14|#define AB_NEGATIVE 0x10
  ------------------
  |  Branch (2894:21): [True: 8, False: 6]
  ------------------
 2895|     14|    }
 2896|  8.20k|    else
 2897|  8.20k|    {
 2898|  8.20k|        if (nParity == AB_PARITY_EVEN)
  ------------------
  |  |  220|  8.20k|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
  |  Branch (2898:13): [True: 686, False: 7.52k]
  ------------------
 2899|    686|        {
 2900|    686|            nParity = AB_PARITY_ODD;
  ------------------
  |  |  219|    686|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
 2901|    686|        }
 2902|  8.20k|    }
 2903|       |
 2904|       |    /*  Unknown (type 2): was detected in the double bond attribute */
 2905|       |    /*  (this 'unknown' came from 'Either' double bond) */
 2906|       |    /*  Treat both unknowns in the same way */
 2907|  8.22k|    if (bUnknown)
  ------------------
  |  Branch (2907:9): [True: 24, False: 8.19k]
  ------------------
 2908|     24|    {
 2909|     24|        nParity |= AB_UNKNOWN;
  ------------------
  |  | 2872|     24|#define AB_UNKNOWN  0x20
  ------------------
 2910|     24|    }
 2911|       |
 2912|  8.22k|    if (bIsotopic)
  ------------------
  |  Branch (2912:9): [True: 4.11k, False: 4.11k]
  ------------------
 2913|  4.11k|    {
 2914|  4.11k|        switch (nParity)
 2915|  4.11k|        {
 2916|    513|            case AB_PARITY_ODD:
  ------------------
  |  |  219|    513|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
  |  Branch (2916:13): [True: 513, False: 3.59k]
  ------------------
 2917|    520|            case AB_PARITY_ODD | AB_NEGATIVE:
  ------------------
  |  |  219|    520|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
                          case AB_PARITY_ODD | AB_NEGATIVE:
  ------------------
  |  | 2871|    520|#define AB_NEGATIVE 0x10
  ------------------
  |  Branch (2917:13): [True: 7, False: 4.10k]
  ------------------
 2918|    520|                nAction = AB_PARITY_CALC;
  ------------------
  |  |  224|    520|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  ------------------
 2919|    520|                break;
 2920|  3.56k|            case AB_PARITY_ODD | AB_UNKNOWN:
  ------------------
  |  |  219|  3.56k|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
                          case AB_PARITY_ODD | AB_UNKNOWN:
  ------------------
  |  | 2872|  3.56k|#define AB_UNKNOWN  0x20
  ------------------
  |  Branch (2920:13): [True: 3.56k, False: 545]
  ------------------
 2921|  3.56k|            case AB_PARITY_UNDF | AB_UNKNOWN:
  ------------------
  |  |  222|  3.56k|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
                          case AB_PARITY_UNDF | AB_UNKNOWN:
  ------------------
  |  | 2872|  3.56k|#define AB_UNKNOWN  0x20
  ------------------
  |  Branch (2921:13): [True: 0, False: 4.11k]
  ------------------
 2922|  3.57k|            case AB_PARITY_ODD | AB_UNKNOWN | AB_NEGATIVE:
  ------------------
  |  |  219|  3.57k|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
                          case AB_PARITY_ODD | AB_UNKNOWN | AB_NEGATIVE:
  ------------------
  |  | 2872|  3.57k|#define AB_UNKNOWN  0x20
  ------------------
                          case AB_PARITY_ODD | AB_UNKNOWN | AB_NEGATIVE:
  ------------------
  |  | 2871|  3.57k|#define AB_NEGATIVE 0x10
  ------------------
  |  Branch (2922:13): [True: 13, False: 4.09k]
  ------------------
 2923|  3.57k|            case AB_PARITY_UNDF | AB_UNKNOWN | AB_NEGATIVE:
  ------------------
  |  |  222|  3.57k|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
                          case AB_PARITY_UNDF | AB_UNKNOWN | AB_NEGATIVE:
  ------------------
  |  | 2872|  3.57k|#define AB_UNKNOWN  0x20
  ------------------
                          case AB_PARITY_UNDF | AB_UNKNOWN | AB_NEGATIVE:
  ------------------
  |  | 2871|  3.57k|#define AB_NEGATIVE 0x10
  ------------------
  |  Branch (2923:13): [True: 0, False: 4.11k]
  ------------------
 2924|  3.57k|                nAction = vABParityUnknown /*AB_PARITY_UNKN*/;
 2925|  3.57k|                break;
 2926|      0|            case AB_PARITY_IISO:
  ------------------
  |  |  223|      0|#define AB_PARITY_IISO   5  /* 5 => no parity because of identical atoms */
  ------------------
  |  Branch (2926:13): [True: 0, False: 4.11k]
  ------------------
 2927|      0|            case AB_PARITY_IISO | AB_UNKNOWN:
  ------------------
  |  |  223|      0|#define AB_PARITY_IISO   5  /* 5 => no parity because of identical atoms */
  ------------------
                          case AB_PARITY_IISO | AB_UNKNOWN:
  ------------------
  |  | 2872|      0|#define AB_UNKNOWN  0x20
  ------------------
  |  Branch (2927:13): [True: 0, False: 4.11k]
  ------------------
 2928|      0|                nAction = AB_PARITY_NONE;
  ------------------
  |  |  218|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
 2929|      0|                break;
 2930|      0|            case AB_PARITY_UNDF:
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2930:13): [True: 0, False: 4.11k]
  ------------------
 2931|      0|            case AB_PARITY_UNDF | AB_NEGATIVE:
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
                          case AB_PARITY_UNDF | AB_NEGATIVE:
  ------------------
  |  | 2871|      0|#define AB_NEGATIVE 0x10
  ------------------
  |  Branch (2931:13): [True: 0, False: 4.11k]
  ------------------
 2932|      0|                nAction = AB_PARITY_UNDF;
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 2933|      0|                break;
 2934|     12|            default:
  ------------------
  |  Branch (2934:13): [True: 12, False: 4.09k]
  ------------------
 2935|     12|                nAction = -1; /*  program error */
 2936|  4.11k|        }
 2937|  4.11k|    }
 2938|  4.11k|    else
 2939|  4.11k|    {
 2940|       |     /*  Non-isotopic */
 2941|  4.11k|        switch (nParity)
 2942|  4.11k|        {
 2943|    513|            case AB_PARITY_ODD:
  ------------------
  |  |  219|    513|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
  |  Branch (2943:13): [True: 513, False: 3.59k]
  ------------------
 2944|    513|                nAction = AB_PARITY_CALC;
  ------------------
  |  |  224|    513|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  ------------------
 2945|    513|                break;
 2946|  3.56k|            case AB_PARITY_ODD | AB_UNKNOWN:
  ------------------
  |  |  219|  3.56k|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
                          case AB_PARITY_ODD | AB_UNKNOWN:
  ------------------
  |  | 2872|  3.56k|#define AB_UNKNOWN  0x20
  ------------------
  |  Branch (2946:13): [True: 3.56k, False: 545]
  ------------------
 2947|  3.56k|            case AB_PARITY_UNDF | AB_UNKNOWN:
  ------------------
  |  |  222|  3.56k|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
                          case AB_PARITY_UNDF | AB_UNKNOWN:
  ------------------
  |  | 2872|  3.56k|#define AB_UNKNOWN  0x20
  ------------------
  |  Branch (2947:13): [True: 0, False: 4.11k]
  ------------------
 2948|  3.56k|                nAction = vABParityUnknown /*AB_PARITY_UNKN*/;
 2949|  3.56k|                break;
 2950|       |            /* case AB_PARITY_ODD  | AB_UNKNOWN | AB_NEGATIVE: */
 2951|      0|            case AB_PARITY_UNDF:
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2951:13): [True: 0, False: 4.11k]
  ------------------
 2952|      0|                nAction = AB_PARITY_UNDF;
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 2953|      0|                break;
 2954|     13|            case AB_PARITY_ODD | AB_UNKNOWN | AB_NEGATIVE:
  ------------------
  |  |  219|     13|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
                          case AB_PARITY_ODD | AB_UNKNOWN | AB_NEGATIVE:
  ------------------
  |  | 2872|     13|#define AB_UNKNOWN  0x20
  ------------------
                          case AB_PARITY_ODD | AB_UNKNOWN | AB_NEGATIVE:
  ------------------
  |  | 2871|     13|#define AB_NEGATIVE 0x10
  ------------------
  |  Branch (2954:13): [True: 13, False: 4.09k]
  ------------------
 2955|     20|            case AB_PARITY_ODD | AB_NEGATIVE:
  ------------------
  |  |  219|     20|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
                          case AB_PARITY_ODD | AB_NEGATIVE:
  ------------------
  |  | 2871|     20|#define AB_NEGATIVE 0x10
  ------------------
  |  Branch (2955:13): [True: 7, False: 4.10k]
  ------------------
 2956|     20|            case AB_PARITY_IISO:
  ------------------
  |  |  223|     20|#define AB_PARITY_IISO   5  /* 5 => no parity because of identical atoms */
  ------------------
  |  Branch (2956:13): [True: 0, False: 4.11k]
  ------------------
 2957|     20|            case AB_PARITY_IISO | AB_UNKNOWN:
  ------------------
  |  |  223|     20|#define AB_PARITY_IISO   5  /* 5 => no parity because of identical atoms */
  ------------------
                          case AB_PARITY_IISO | AB_UNKNOWN:
  ------------------
  |  | 2872|     20|#define AB_UNKNOWN  0x20
  ------------------
  |  Branch (2957:13): [True: 0, False: 4.11k]
  ------------------
 2958|     20|            case AB_PARITY_UNDF | AB_NEGATIVE:
  ------------------
  |  |  222|     20|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
                          case AB_PARITY_UNDF | AB_NEGATIVE:
  ------------------
  |  | 2871|     20|#define AB_NEGATIVE 0x10
  ------------------
  |  Branch (2958:13): [True: 0, False: 4.11k]
  ------------------
 2959|     20|            case AB_PARITY_UNDF | AB_UNKNOWN | AB_NEGATIVE:
  ------------------
  |  |  222|     20|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
                          case AB_PARITY_UNDF | AB_UNKNOWN | AB_NEGATIVE:
  ------------------
  |  | 2872|     20|#define AB_UNKNOWN  0x20
  ------------------
                          case AB_PARITY_UNDF | AB_UNKNOWN | AB_NEGATIVE:
  ------------------
  |  | 2871|     20|#define AB_NEGATIVE 0x10
  ------------------
  |  Branch (2959:13): [True: 0, False: 4.11k]
  ------------------
 2960|     20|                nAction = AB_PARITY_NONE;
  ------------------
  |  |  218|     20|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
 2961|     20|                break;
 2962|     12|            default:
  ------------------
  |  Branch (2962:13): [True: 12, False: 4.09k]
  ------------------
 2963|     12|                nAction = -1; /*  program error */
 2964|  4.11k|        }
 2965|  4.11k|    }
 2966|       |
 2967|  8.22k|    return nAction;
 2968|  8.22k|#undef AB_NEGATIVE
 2969|  8.22k|#undef AB_UNKNOWN
 2970|  8.22k|}
ichister.c:triple_prod_char:
 1190|     10|{
 1191|     10|    inp_ATOM *at1, *at2;
 1192|     10|    double    pnt[3][3], len;
 1193|     10|    int       i;
 1194|     10|    int       ret = 0;
 1195|       |
 1196|     10|    at1 = at + at_1;
 1197|     10|    at2 = at + at[at_1].neighbor[i_next_at_1];
 1198|       |
 1199|     10|    pnt[0][0] = at2->x - at1->x;
 1200|     10|    pnt[0][1] = at2->y - at1->y;
 1201|     10|    pnt[0][2] = at2->z - at1->z;
 1202|       |
 1203|     10|    at2 = at + at_2;
 1204|     10|    at1 = at + at[at_2].neighbor[i_next_at_2];
 1205|       |
 1206|     10|    pnt[1][0] = at2->x - at1->x;
 1207|     10|    pnt[1][1] = at2->y - at1->y;
 1208|     10|    pnt[1][2] = at2->z - at1->z;
 1209|       |    /*
 1210|       |     *  resultant pnt vector directions:
 1211|       |     *
 1212|       |     *         pnt[0]              pnt[1]
 1213|       |     *
 1214|       |     *   [at_1]---->[...]    [...]---->[at_2]
 1215|       |     *
 1216|       |     *
 1217|       |     *  add3 below: (pnt[0] + pnt[1]) -> pnt[1]
 1218|       |     */
 1219|     10|    add3( pnt[0], pnt[1], pnt[1] );
 1220|       |
 1221|     40|    for (i = 0; i < 3; i++)
  ------------------
  |  Branch (1221:17): [True: 30, False: 10]
  ------------------
 1222|     30|    {
 1223|     30|        pnt[0][i] = (double) z_dir1[i];
 1224|     30|        pnt[2][i] = (double) z_dir2[i];
 1225|     30|    }
 1226|     40|    for (i = 0; i < 3; i++)
  ------------------
  |  Branch (1226:17): [True: 30, False: 10]
  ------------------
 1227|     30|    {
 1228|     30|        len = len3( pnt[i] );
 1229|     30|        if (len < MIN_BOND_LEN)
  ------------------
  |  |   39|     30|#define MIN_BOND_LEN          0.000001
  ------------------
  |  Branch (1229:13): [True: 10, False: 20]
  ------------------
 1230|     10|        {
 1231|     10|            if (i == 1 && ( at[at_1].bUsed0DParity || at[at_2].bUsed0DParity ))
  ------------------
  |  Branch (1231:17): [True: 10, False: 0]
  |  Branch (1231:29): [True: 10, False: 0]
  |  Branch (1231:55): [True: 0, False: 0]
  ------------------
 1232|     10|            {
 1233|     10|                pnt[i][0] = 0.0;
 1234|     10|                pnt[i][1] = 1.0;
 1235|     10|                pnt[i][2] = 0.0;
 1236|     10|                len = 1.0; /* standard at_1-->at_2 vector coordinates in case of 0D allene */
 1237|     10|            }
 1238|      0|            else
 1239|      0|            {
 1240|      0|                goto exit_function; /*  too short bond */
 1241|      0|            }
 1242|     10|        }
 1243|     30|        mult3( pnt[i], 1.0 / len, pnt[i] );
 1244|     30|    }
 1245|       |
 1246|     10|    len = 100.0*triple_prod( pnt[0], pnt[1], pnt[2], NULL );
 1247|       |
 1248|       |    /*
 1249|       |     *   ^ pnt[0]
 1250|       |     *   |                         The orientation on this diagram
 1251|       |     *   |                         produces len = -100
 1252|       |     *  [at_1]------>[at_2]
 1253|       |     *        pnt[1]    /
 1254|       |     *                 /
 1255|       |     *                / pnt[2]  (up from the plane)
 1256|       |     *               v
 1257|       |     *
 1258|       |     * Note: len is invariant upon at_1 <--> at_2 transposition because
 1259|       |     *       triple product changes sign upon pnt[0]<-->pnt[2] transposition and
 1260|       |     *       triple product changes sign upon pnt[1]--> -pnt[1] change of direction:
 1261|       |     *
 1262|       |     * triple_prod(pnt[0],  pnt[1], pnt[2], NULL ) =
 1263|       |     * triple_prod(pnt[2], -pnt[1], pnt[0], NULL )
 1264|       |     *
 1265|       |     */
 1266|       |
 1267|     10|    ret = len >= 0.0 ? (int) ( floor( len + 0.5 ) ) : -(int) ( floor( 0.5 - len ) );
  ------------------
  |  Branch (1267:11): [True: 10, False: 0]
  ------------------
 1268|       |
 1269|     10|exit_function:
 1270|       |
 1271|     10|    return ret;
 1272|     10|}
ichister.c:dot_prodchar3:
  276|    247|{
  277|    247|    int prod = ( (int)a[0]*(int)b[0] + (int)a[1]*(int)b[1] + (int)a[2]*(int)b[2] ) / 100;
  278|    247|    if (prod > 100)
  ------------------
  |  Branch (278:9): [True: 0, False: 247]
  ------------------
  279|      0|    {
  280|      0|        prod = 100;
  281|      0|    }
  282|    247|    else
  283|    247|    {
  284|    247|        if (prod < -100)
  ------------------
  |  Branch (284:13): [True: 0, False: 247]
  ------------------
  285|      0|        {
  286|      0|            prod = -100;
  287|      0|        }
  288|    247|    }
  289|       |
  290|    247|    return prod;
  291|    247|}
ichister.c:save_a_stereo_bond:
 2521|  4.08k|{
 2522|  4.08k|    int i1, i2;
 2523|       |
 2524|  4.44k|    for (i1 = 0; i1 < MAX_NUM_STEREO_BONDS && stereo_bond_neighbor1[i1]; i1++)
  ------------------
  |  |  873|  8.88k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2524:18): [True: 4.44k, False: 0]
  |  Branch (2524:47): [True: 356, False: 4.08k]
  ------------------
 2525|    356|    {
 2526|    356|        ;
 2527|    356|    }
 2528|  5.68k|    for (i2 = 0; i2 < MAX_NUM_STEREO_BONDS && stereo_bond_neighbor2[i2]; i2++)
  ------------------
  |  |  873|  11.3k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2528:18): [True: 5.68k, False: 0]
  |  Branch (2528:47): [True: 1.59k, False: 4.08k]
  ------------------
 2529|  1.59k|    {
 2530|  1.59k|        ;
 2531|  1.59k|    }
 2532|       |
 2533|  4.08k|    if (i1 == MAX_NUM_STEREO_BONDS || i2 == MAX_NUM_STEREO_BONDS)
  ------------------
  |  |  873|  8.17k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
                  if (i1 == MAX_NUM_STEREO_BONDS || i2 == MAX_NUM_STEREO_BONDS)
  ------------------
  |  |  873|  4.08k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2533:9): [True: 0, False: 4.08k]
  |  Branch (2533:39): [True: 0, False: 4.08k]
  ------------------
 2534|      0|    {
 2535|      0|        return 0;
 2536|      0|    }
 2537|       |
 2538|  4.08k|    stereo_bond_parity1[i1] =
 2539|  4.08k|        stereo_bond_parity2[i2] = result_action;
 2540|       |
 2541|  4.08k|    stereo_bond_neighbor1[i1] = (AT_NUMB) ( at2 + 1 );
 2542|  4.08k|    stereo_bond_ord1[i1] = (S_CHAR) ord1;
 2543|  4.08k|    stereo_bond_neighbor2[i2] = (AT_NUMB) ( at1 + 1 );
 2544|  4.08k|    stereo_bond_ord2[i2] = (S_CHAR) ord2;
 2545|  4.08k|    stereo_bond_z_prod1[i1] =
 2546|  4.08k|        stereo_bond_z_prod2[i2] = (S_CHAR) z_prod;
 2547|       |
 2548|  4.08k|    return 1;
 2549|  4.08k|}

is_centerpoint_elem:
  123|  1.84M|{
  124|  1.84M|    switch (el_number) {
  125|   193k|        case EL_NUMBER_C: 
  ------------------
  |  |   13|   193k|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (125:9): [True: 193k, False: 1.64M]
  ------------------
  126|   545k|        case EL_NUMBER_N: 
  ------------------
  |  |   14|   545k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (126:9): [True: 352k, False: 1.49M]
  ------------------
  127|   649k|        case EL_NUMBER_P: 
  ------------------
  |  |   18|   649k|#define EL_NUMBER_P  ((U_CHAR)15)
  ------------------
  |  Branch (127:9): [True: 103k, False: 1.73M]
  ------------------
  128|   746k|        case EL_NUMBER_S: 
  ------------------
  |  |   19|   746k|#define EL_NUMBER_S  ((U_CHAR)16)
  ------------------
  |  Branch (128:9): [True: 97.4k, False: 1.74M]
  ------------------
  129|   777k|        case EL_NUMBER_I: 
  ------------------
  |  |   27|   777k|#define EL_NUMBER_I  ((U_CHAR)53)
  ------------------
  |  Branch (129:9): [True: 30.8k, False: 1.81M]
  ------------------
  130|   785k|        case EL_NUMBER_AS: 
  ------------------
  |  |   22|   785k|#define EL_NUMBER_AS ((U_CHAR)33)
  ------------------
  |  Branch (130:9): [True: 8.36k, False: 1.83M]
  ------------------
  131|   794k|        case EL_NUMBER_SB: 
  ------------------
  |  |   25|   794k|#define EL_NUMBER_SB ((U_CHAR)51)
  ------------------
  |  Branch (131:9): [True: 8.74k, False: 1.83M]
  ------------------
  132|   804k|        case EL_NUMBER_SE: 
  ------------------
  |  |   23|   804k|#define EL_NUMBER_SE ((U_CHAR)34)
  ------------------
  |  Branch (132:9): [True: 10.2k, False: 1.83M]
  ------------------
  133|   830k|        case EL_NUMBER_TE: 
  ------------------
  |  |   26|   830k|#define EL_NUMBER_TE ((U_CHAR)52)
  ------------------
  |  Branch (133:9): [True: 25.7k, False: 1.81M]
  ------------------
  134|   832k|        case EL_NUMBER_CL:
  ------------------
  |  |   20|   832k|#define EL_NUMBER_CL ((U_CHAR)17)
  ------------------
  |  Branch (134:9): [True: 1.61k, False: 1.84M]
  ------------------
  135|   833k|        case EL_NUMBER_BR:
  ------------------
  |  |   24|   833k|#define EL_NUMBER_BR ((U_CHAR)35)
  ------------------
  |  Branch (135:9): [True: 1.21k, False: 1.84M]
  ------------------
  136|   833k|            return 1;
  137|  1.00M|        default:
  ------------------
  |  Branch (137:9): [True: 1.00M, False: 833k]
  ------------------
  138|  1.00M|            return 0; 
  139|  1.84M|    }
  140|  1.84M|}
is_centerpoint_elem_strict:
  156|  62.2k|{
  157|  62.2k|    switch (el_number) {
  158|  6.48k|        case EL_NUMBER_C: 
  ------------------
  |  |   13|  6.48k|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (158:9): [True: 6.48k, False: 55.7k]
  ------------------
  159|  56.0k|        case EL_NUMBER_N: 
  ------------------
  |  |   14|  56.0k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (159:9): [True: 49.5k, False: 12.6k]
  ------------------
  160|  56.5k|        case EL_NUMBER_P: 
  ------------------
  |  |   18|  56.5k|#define EL_NUMBER_P  ((U_CHAR)15)
  ------------------
  |  Branch (160:9): [True: 584, False: 61.6k]
  ------------------
  161|  57.2k|        case EL_NUMBER_AS: 
  ------------------
  |  |   22|  57.2k|#define EL_NUMBER_AS ((U_CHAR)33)
  ------------------
  |  Branch (161:9): [True: 686, False: 61.5k]
  ------------------
  162|  57.2k|        case EL_NUMBER_SB: 
  ------------------
  |  |   25|  57.2k|#define EL_NUMBER_SB ((U_CHAR)51)
  ------------------
  |  Branch (162:9): [True: 16, False: 62.2k]
  ------------------
  163|  57.2k|            return 1;
  164|  4.92k|        default:
  ------------------
  |  Branch (164:9): [True: 4.92k, False: 57.2k]
  ------------------
  165|  4.92k|            return 0; 
  166|  62.2k|    }
  167|  62.2k|}
AddAtom2num:
  177|   144k|{  /*  bSubtract: 0=> add, 1=>subtract, 2=> fill */
  178|   144k|    inp_ATOM *at = atom + at_no;
  179|   144k|    int       k;
  180|   144k|    int       nMobile = ( at->charge == -1 );
  181|   144k|    if (bSubtract == 1)
  ------------------
  |  Branch (181:9): [True: 0, False: 144k]
  ------------------
  182|      0|    {
  183|       |        /* 1: subtract */
  184|      0|        num[1] -= nMobile;
  185|      0|        nMobile += at->num_H;
  186|      0|        num[0] -= nMobile;
  187|      0|        for (k = 0; k < T_NUM_ISOTOPIC; k++)
  ------------------
  |  |   70|      0|#define           T_NUM_ISOTOPIC    NUM_H_ISOTOPES /* was 2, now 3 */
  |  |  ------------------
  |  |  |  |   25|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  |  |  ------------------
  ------------------
  |  Branch (187:21): [True: 0, False: 0]
  ------------------
  188|      0|        {
  189|       |            /*  T (3H isotope) first because it has higher weight */
  190|      0|            num[T_NUM_NO_ISOTOPIC + k] -= at->num_iso_H[NUM_H_ISOTOPES - k - 1];
  ------------------
  |  |   69|      0|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
                          num[T_NUM_NO_ISOTOPIC + k] -= at->num_iso_H[NUM_H_ISOTOPES - k - 1];
  ------------------
  |  |   25|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  191|      0|        }
  192|      0|    }
  193|   144k|    else
  194|   144k|    {
  195|   144k|        if (bSubtract == 2)
  ------------------
  |  Branch (195:13): [True: 144k, False: 0]
  ------------------
  196|   144k|        {
  197|       |            /* fill */
  198|   144k|            memset( num, 0, ( T_NUM_NO_ISOTOPIC + T_NUM_ISOTOPIC ) * sizeof( num[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  ------------------
  |  |   69|   144k|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
                          memset( num, 0, ( T_NUM_NO_ISOTOPIC + T_NUM_ISOTOPIC ) * sizeof( num[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  ------------------
  |  |   70|   144k|#define           T_NUM_ISOTOPIC    NUM_H_ISOTOPES /* was 2, now 3 */
  |  |  ------------------
  |  |  |  |   25|   144k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  |  |  ------------------
  ------------------
  199|   144k|        }
  200|       |        /* else (0): add */
  201|   144k|        num[1] += nMobile;
  202|   144k|        nMobile += at->num_H;
  203|   144k|        num[0] += nMobile;
  204|   578k|        for (k = 0; k < T_NUM_ISOTOPIC; k++)
  ------------------
  |  |   70|   578k|#define           T_NUM_ISOTOPIC    NUM_H_ISOTOPES /* was 2, now 3 */
  |  |  ------------------
  |  |  |  |   25|   578k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  |  |  ------------------
  ------------------
  |  Branch (204:21): [True: 433k, False: 144k]
  ------------------
  205|   433k|        {
  206|       |            /*  T (3H isotope) first because it has higher weight */
  207|   433k|            num[T_NUM_NO_ISOTOPIC + k] += at->num_iso_H[NUM_H_ISOTOPES - k - 1];
  ------------------
  |  |   69|   433k|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
                          num[T_NUM_NO_ISOTOPIC + k] += at->num_iso_H[NUM_H_ISOTOPES - k - 1];
  ------------------
  |  |   25|   433k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  208|   433k|        }
  209|   144k|    }
  210|   144k|    return nMobile;
  211|   144k|}
AddAtom2DA:
  216|   144k|{   /*  bSubtract: 0=> add, 1=>subtract, 2=> fill */
  217|   144k|    inp_ATOM *at = atom + at_no;
  218|   144k|    int       nDelta, nAcidic_O;
  219|       |
  220|   144k|    if (at->charge < -1 || (at->charge == 1 && !at->c_point) || at->charge > 1) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (220:9): [True: 0, False: 144k]
  |  Branch (220:29): [True: 1.45k, False: 143k]
  |  Branch (220:48): [True: 0, False: 1.45k]
  |  Branch (220:65): [True: 0, False: 144k]
  ------------------
  221|      0|    {
  222|      0|        return;
  223|      0|    }
  224|       |
  225|   144k|    nDelta = ( bSubtract == 1 ) ? -1 : 1;
  ------------------
  |  Branch (225:14): [True: 0, False: 144k]
  ------------------
  226|       |
  227|       |    /* "Acidic" O, S, Se, Te recognition */
  228|   144k|    if (at->at_type & ATT_ACIDIC_CO)
  ------------------
  |  |   31|   144k|#define ATT_ACIDIC_CO 0x0001
  ------------------
  |  Branch (228:9): [True: 9.37k, False: 135k]
  ------------------
  229|  9.37k|    {
  230|  9.37k|        nAcidic_O = nDelta;
  231|  9.37k|    }
  232|   135k|    else
  233|   135k|    {
  234|   135k|        nAcidic_O = 0;
  235|   135k|    }
  236|       |
  237|   144k|    if (bSubtract == 2)
  ------------------
  |  Branch (237:9): [True: 144k, False: 0]
  ------------------
  238|   144k|    {
  239|       |        /* 2: fill, otherwise add */
  240|   144k|        memset( num_DA, 0, TG_NUM_DA * sizeof( num_DA[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  241|   144k|    }
  242|   144k|    if ((at->charge <= 0 && at->valence == at->chem_bonds_valence) ||
  ------------------
  |  Branch (242:10): [True: 143k, False: 1.45k]
  |  Branch (242:29): [True: 44.8k, False: 98.3k]
  ------------------
  243|       |         /* neutral or negative donor */
  244|  99.8k|         (at->charge > 0 && at->valence + 1 == at->chem_bonds_valence)
  ------------------
  |  Branch (244:11): [True: 1.45k, False: 98.3k]
  |  Branch (244:29): [True: 353, False: 1.09k]
  ------------------
  245|       |         /* positively charged donor */
  246|   144k|         ) /* djb-rwth: addressing LLVM warnings */
  247|  45.1k|    {
  248|  45.1k|        if (at->charge < 0)
  ------------------
  |  Branch (248:13): [True: 21.9k, False: 23.2k]
  ------------------
  249|  21.9k|        {
  250|  21.9k|            num_DA[TG_Num_dM] += nDelta;
  251|  21.9k|            num_DA[TG_Num_dO] += nAcidic_O;
  252|  21.9k|        }
  253|  23.2k|        else
  254|  23.2k|        {
  255|  23.2k|            if (at->num_H)
  ------------------
  |  Branch (255:17): [True: 23.2k, False: 0]
  ------------------
  256|  23.2k|            {
  257|  23.2k|                num_DA[TG_Num_dH] += nDelta;
  258|  23.2k|                num_DA[TG_Num_dO] += nAcidic_O;
  259|  23.2k|            }
  260|  23.2k|        }
  261|  45.1k|    }
  262|  99.4k|    else
  263|  99.4k|    {
  264|  99.4k|        if ((at->charge <= 0 && at->valence + 1 == at->chem_bonds_valence) ||
  ------------------
  |  Branch (264:14): [True: 98.3k, False: 1.09k]
  |  Branch (264:33): [True: 98.3k, False: 1]
  ------------------
  265|  1.09k|             (at->charge  > 0 && at->valence + 2 == at->chem_bonds_valence)) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (265:15): [True: 1.09k, False: 1]
  |  Branch (265:34): [True: 1.09k, False: 0]
  ------------------
  266|  99.4k|        {
  267|       |            /* acceptor */
  268|  99.4k|            if (at->charge < 0)
  ------------------
  |  Branch (268:17): [True: 13.6k, False: 85.8k]
  ------------------
  269|  13.6k|            {
  270|  13.6k|                num_DA[TG_Num_aM] += nDelta;
  271|  13.6k|            }
  272|  85.8k|            else
  273|  85.8k|            {
  274|  85.8k|                if (at->num_H)
  ------------------
  |  Branch (274:21): [True: 3.10k, False: 82.7k]
  ------------------
  275|  3.10k|                {
  276|  3.10k|                    num_DA[TG_Num_aH] += nDelta;
  277|  3.10k|                }
  278|  82.7k|                else
  279|  82.7k|                {
  280|  82.7k|                    num_DA[TG_Num_aO] += nAcidic_O; /* acidic O-acceptor has no H or charge */
  281|  82.7k|                }
  282|  85.8k|            }
  283|  99.4k|        }
  284|  99.4k|    }
  285|   144k|    return;
  286|   144k|}
AddEndPoint:
  296|  1.09k|{
  297|  1.09k|    pEndPoint->nAtomNumber = iat;
  298|  1.09k|    pEndPoint->nEquNumber = 0;
  299|  1.09k|    pEndPoint->nGroupNumber = at[iat].endpoint;
  300|  1.09k|    if (at[iat].endpoint)
  ------------------
  |  Branch (300:9): [True: 509, False: 583]
  ------------------
  301|    509|    {
  302|       |        /* already an endpoint */
  303|    509|        memset( pEndPoint->num, 0, sizeof( pEndPoint->num ) ); /* djb-rwth: memset_s C11/Annex K variant? */
  304|    509|    }
  305|    583|    else
  306|    583|    {
  307|       |        /* not an endpoint yet, make it an endpoint */
  308|    583|        AddAtom2num( pEndPoint->num, at, iat, 2 );  /* fill */
  309|    583|        AddAtom2DA( pEndPoint->num_DA, at, iat, 2 );
  310|       |        /*
  311|       |        nMobile  = pEndPoint->num[1] = (at[iat].charge == -1);
  312|       |        nMobile  = pEndPoint->num[0] = at[iat].num_H + nMobile;
  313|       |        for ( k = 0; k < T_NUM_ISOTOPIC; k ++ ) {
  314|       |        pEndPoint->num[T_NUM_NO_ISOTOPIC+k] = at[iat].num_iso_H[NUM_H_ISOTOPES-k-1];
  315|       |        }
  316|       |        */
  317|    583|    }
  318|       |
  319|  1.09k|    return 0;
  320|  1.09k|}
nGetEndpointInfo:
  325|  5.64M|{
  326|  5.64M|    int  nEndpointValence;
  327|  5.64M|    int  nMobile;
  328|  5.64M|    S_CHAR cChargeSubtype;
  329|       |
  330|  5.64M|    if (atom[iat].radical && atom[iat].radical != RADICAL_SINGLET)
  ------------------
  |  |   75|   134k|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (330:9): [True: 134k, False: 5.50M]
  |  Branch (330:30): [True: 134k, False: 0]
  ------------------
  331|   134k|    {
  332|   134k|        return 0; /* a radical */
  333|   134k|    }
  334|  5.50M|    if (!( nEndpointValence = get_endpoint_valence( atom[iat].el_number ) ))
  ------------------
  |  Branch (334:9): [True: 3.50M, False: 2.00M]
  ------------------
  335|  3.50M|    {
  336|  3.50M|        return 0; /* not an endpoint */
  337|  3.50M|    }
  338|  2.00M|    if (nEndpointValence <= atom[iat].valence)
  ------------------
  |  Branch (338:9): [True: 190k, False: 1.81M]
  ------------------
  339|   190k|    {
  340|   190k|        return 0; /* not an endpoint, for example >N(+)< or >N<  or >O(+)- or >O- or >N- or -O- */
  341|   190k|    }
  342|       |
  343|  1.81M|    if (atom[iat].charge == -1 || atom[iat].charge == 0)
  ------------------
  |  Branch (343:9): [True: 152k, False: 1.66M]
  |  Branch (343:35): [True: 1.62M, False: 33.5k]
  ------------------
  344|  1.78M|    {
  345|       |        /* not a positive charge-point */
  346|  1.78M|        if (nEndpointValence < atom[iat].chem_bonds_valence)
  ------------------
  |  Branch (346:13): [True: 13.3k, False: 1.76M]
  ------------------
  347|  13.3k|        {
  348|  13.3k|            return 0; /* abnormal valence > standard endpoint valence */
  349|  13.3k|        }
  350|  1.76M|        nMobile = atom[iat].num_H + ( atom[iat].charge == -1 );
  351|  1.76M|        if (nMobile + atom[iat].chem_bonds_valence != nEndpointValence)
  ------------------
  |  Branch (351:13): [True: 1.20M, False: 564k]
  ------------------
  352|  1.20M|        {
  353|  1.20M|            return 0; /* non-standard endpoint valence */
  354|  1.20M|        }
  355|   564k|        switch (atom[iat].chem_bonds_valence - atom[iat].valence)
  356|   564k|        {
  357|   177k|            case 0:
  ------------------
  |  Branch (357:13): [True: 177k, False: 387k]
  ------------------
  358|   177k|                eif->cDonor = 1;
  359|   177k|                eif->cAcceptor = 0;
  360|   177k|                break;
  361|   360k|            case 1:
  ------------------
  |  Branch (361:13): [True: 360k, False: 203k]
  ------------------
  362|   360k|                eif->cDonor = 0;
  363|   360k|                eif->cAcceptor = 1;
  364|   360k|                break;
  365|  26.8k|            default:
  ------------------
  |  Branch (365:13): [True: 26.8k, False: 537k]
  ------------------
  366|  26.8k|                return 0;
  367|   564k|        }
  368|   537k|        eif->cMobile = nMobile;
  369|   537k|        eif->cNeutralBondsValence = nEndpointValence - nMobile;
  370|   537k|        eif->cMoveableCharge = 0;
  371|   537k|#if ( KETO_ENOL_TAUT == 1 )
  372|   537k|        eif->cKetoEnolCode = 0;
  373|   537k|#endif
  374|   537k|        return nEndpointValence;
  375|   564k|    }
  376|  33.5k|    else
  377|  33.5k|    {
  378|  33.5k|        if (atom[iat].c_point &&
  ------------------
  |  Branch (378:13): [True: 5.89k, False: 27.6k]
  ------------------
  379|  5.89k|             0 <= GetChargeType( atom, iat, &cChargeSubtype ) &&
  ------------------
  |  Branch (379:14): [True: 5.89k, False: 0]
  ------------------
  380|  5.89k|             ( (int) cChargeSubtype & ( C_SUBTYPE_H_ACCEPT | C_SUBTYPE_H_DONOR ) ))
  ------------------
  |  |  107|  5.89k|#define C_SUBTYPE_H_ACCEPT    4
  ------------------
                           ( (int) cChargeSubtype & ( C_SUBTYPE_H_ACCEPT | C_SUBTYPE_H_DONOR ) ))
  ------------------
  |  |  108|  5.89k|#define C_SUBTYPE_H_DONOR     8
  ------------------
  |  Branch (380:14): [True: 5.89k, False: 0]
  ------------------
  381|  5.89k|        {
  382|       |            /* charge-point */
  383|  5.89k|            {
  384|  5.89k|                if (cChargeSubtype & C_SUBTYPE_H_ACCEPT)
  ------------------
  |  |  107|  5.89k|#define C_SUBTYPE_H_ACCEPT    4
  ------------------
  |  Branch (384:21): [True: 4.74k, False: 1.15k]
  ------------------
  385|  4.74k|                {
  386|  4.74k|                    eif->cDonor = 0;
  387|  4.74k|                    eif->cAcceptor = 1;
  388|  4.74k|                }
  389|  1.15k|                else
  390|  1.15k|                {
  391|  1.15k|                    if (cChargeSubtype & C_SUBTYPE_H_DONOR)
  ------------------
  |  |  108|  1.15k|#define C_SUBTYPE_H_DONOR     8
  ------------------
  |  Branch (391:25): [True: 1.15k, False: 0]
  ------------------
  392|  1.15k|                    {
  393|  1.15k|                        eif->cDonor = 1;
  394|  1.15k|                        eif->cAcceptor = 0;
  395|  1.15k|                    }
  396|      0|                    else
  397|      0|                    {
  398|      0|                        return 0;
  399|      0|                    }
  400|  1.15k|                }
  401|  5.89k|            }
  402|  5.89k|            eif->cMobile = atom[iat].num_H;
  403|  5.89k|            eif->cNeutralBondsValence = nEndpointValence - atom[iat].num_H;
  404|  5.89k|            eif->cMoveableCharge = atom[iat].charge;
  405|  5.89k|#if ( KETO_ENOL_TAUT == 1 )
  406|  5.89k|            eif->cKetoEnolCode = 0;
  407|  5.89k|#endif
  408|  5.89k|            return nEndpointValence;
  409|  5.89k|        }
  410|  33.5k|    }
  411|       |
  412|  27.6k|    return 0;
  413|  1.81M|}
RegisterEndPoints:
  999|  7.11k|{
 1000|  7.11k|    T_GROUP  *t_group = t_group_info->t_group;
 1001|  7.11k|    int      *pnum_t = &t_group_info->num_t_groups;
 1002|  7.11k|    int       max_num_t = t_group_info->max_num_t_groups;
 1003|  7.11k|    int       nNumZeroEqu, nNumNewTGroups;
 1004|  7.11k|    AT_NUMB   group, prev_group, prev_eqnum, nNextGroupNumber, nLeastGroupNumber;
 1005|  7.11k|    int       nNumGroups, num_t, difference;
 1006|  7.11k|    int       i, j, k, ret;
 1007|  7.11k|    AT_NUMB   nNewTgNumberStackArray[MAX_STACK_ARRAY_LEN + 1];
 1008|  7.11k|    AT_NUMB   nGroupNumberStackArray[MAX_STACK_ARRAY_LEN + 1];
 1009|  7.11k|    AT_NUMB   nGroupNewNumberStackArray[MAX_STACK_ARRAY_LEN + 1];
 1010|  7.11k|    AT_NUMB  *nNewTgNumber = nNewTgNumberStackArray;
 1011|  7.11k|    AT_NUMB  *nGroupNumber = nGroupNumberStackArray;
 1012|  7.11k|    AT_NUMB  *nGroupNewNumber = nGroupNewNumberStackArray;
 1013|       |
 1014|  7.11k|    if (nNumEndPoints <= 0)
  ------------------
  |  Branch (1014:9): [True: 0, False: 7.11k]
  ------------------
 1015|      0|    {
 1016|      0|        return 0; /* nothing to do */
 1017|      0|    }
 1018|  7.11k|    num_t = *pnum_t;
 1019|  7.11k|    difference = 0;
 1020|  7.11k|    nNextGroupNumber = 0;
 1021|  7.11k|    nNumZeroEqu = 0;
 1022|       |    /* djb-rwth: removing redundant code */
 1023|       |    /* find max group number; increment it to obtain next available group number */
 1024|  9.04k|    for (i = 0; i < num_t; i++)
  ------------------
  |  Branch (1024:17): [True: 1.93k, False: 7.11k]
  ------------------
 1025|  1.93k|    {
 1026|  1.93k|        if (nNextGroupNumber < t_group[i].nGroupNumber)
  ------------------
  |  Branch (1026:13): [True: 1.93k, False: 0]
  ------------------
 1027|  1.93k|        {
 1028|  1.93k|            nNextGroupNumber = t_group[i].nGroupNumber;
 1029|  1.93k|        }
 1030|  1.93k|    }
 1031|  7.11k|    nNextGroupNumber++;
 1032|       |
 1033|       |    /* find min non-zero group number nLeastGroupNumber;
 1034|       |    count zero EndPoint[i].nEquNumber
 1035|       |    if all EndPoint[i].nGroupNumber are equal and non-zero then exit: nothing to do.
 1036|       |    */
 1037|  7.11k|    nLeastGroupNumber = nNextGroupNumber;
 1038|  7.11k|    prev_group = EndPoint[0].nGroupNumber;
 1039|  7.11k|    prev_eqnum = EndPoint[0].nEquNumber;
 1040|  22.7k|    for (i = j = k = 0; i < nNumEndPoints; i++)
  ------------------
  |  Branch (1040:25): [True: 15.6k, False: 7.11k]
  ------------------
 1041|  15.6k|    {
 1042|  15.6k|        if ((group = EndPoint[i].nGroupNumber)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1042:13): [True: 2.32k, False: 13.2k]
  ------------------
 1043|  2.32k|        {
 1044|  2.32k|            if (group < nLeastGroupNumber)
  ------------------
  |  Branch (1044:17): [True: 1.46k, False: 861]
  ------------------
 1045|  1.46k|            {
 1046|  1.46k|                nLeastGroupNumber = group;
 1047|  1.46k|            }
 1048|  2.32k|        }
 1049|  15.6k|        j += ( prev_group == EndPoint[i].nGroupNumber ); /* count endpoints that belong to the 1st group */
 1050|  15.6k|        k += ( prev_eqnum == EndPoint[i].nEquNumber );   /* count endpoints that belongo to a group equivalent to the 1st group */
 1051|  15.6k|        nNumZeroEqu += !EndPoint[i].nEquNumber;        /* count endpoints that have been processed by FindAccessibleEndPoints() */
 1052|  15.6k|    }
 1053|  7.11k|    if (j == nNumEndPoints && prev_group && k == nNumEndPoints)
  ------------------
  |  Branch (1053:9): [True: 6.28k, False: 827]
  |  Branch (1053:31): [True: 565, False: 5.72k]
  |  Branch (1053:45): [True: 565, False: 0]
  ------------------
 1054|    565|    {
 1055|       |        /* all endpoints already belong to one t-group;
 1056|       |        the last comparison is not needed for now
 1057|       |        because EndPoint[i].nEquNumber cannot make
 1058|       |        endpont partitioning finer
 1059|       |        */
 1060|    565|        return 0;
 1061|    565|    }
 1062|       |
 1063|  6.54k|    nNumNewTGroups = 0;
 1064|       |
 1065|  6.54k|    if (!nNumZeroEqu)
  ------------------
  |  Branch (1065:9): [True: 6.05k, False: 496]
  ------------------
 1066|  6.05k|    {
 1067|       |        /* EndPoint[] has been processed by FindAccessibleEndPoints;
 1068|       |        * equal EndPoint[i].nEquNumber mark endpoints belonging to
 1069|       |        * the same t-group
 1070|       |        * Since now the next available t-group number, nNextGroupNumber,
 1071|       |        * is known,replace fict. IDs assigned by FindAccessibleEndPoints
 1072|       |        * with correct new t-group numbers.
 1073|       |        */
 1074|  19.2k|        for (i = 0; i < nNumEndPoints; i++)
  ------------------
  |  Branch (1074:21): [True: 13.2k, False: 6.05k]
  ------------------
 1075|  13.2k|        {
 1076|  13.2k|            if (( group = EndPoint[i].nEquNumber ) >= nNextGroupNumber)
  ------------------
  |  Branch (1076:17): [True: 12.0k, False: 1.24k]
  ------------------
 1077|  12.0k|            {
 1078|       |                /* replace fict. IDs assigned by FindAccessibleEndPoints() with new t-group numbers */
 1079|       |                /* these fict. IDs have values = (num_atoms+1), (num_atoms+2),...; they may be non-contiguous */
 1080|  12.0k|                for (j = 0; j < nNumNewTGroups; j++)
  ------------------
  |  Branch (1080:29): [True: 6.51k, False: 5.49k]
  ------------------
 1081|  6.51k|                {
 1082|  6.51k|                    if (group == nGroupNewNumber[j])
  ------------------
  |  Branch (1082:25): [True: 6.51k, False: 0]
  ------------------
 1083|  6.51k|                    {
 1084|  6.51k|                        break;
 1085|  6.51k|                    }
 1086|  6.51k|                }
 1087|  12.0k|                if (j == nNumNewTGroups)
  ------------------
  |  Branch (1087:21): [True: 5.49k, False: 6.51k]
  ------------------
 1088|  5.49k|                {
 1089|       |                    /* found new fict. ID = group */
 1090|  5.49k|                    if (j == MAX_STACK_ARRAY_LEN && nGroupNewNumber == nGroupNewNumberStackArray)
  ------------------
  |  |  112|  10.9k|#define MAX_STACK_ARRAY_LEN 127
  ------------------
  |  Branch (1090:25): [True: 0, False: 5.49k]
  |  Branch (1090:53): [True: 0, False: 0]
  ------------------
 1091|      0|                    {
 1092|       |                        /* stack array overflow; allocate more memory than may be needed */
 1093|      0|                        nGroupNewNumber = (AT_NUMB *) inchi_malloc( nNumEndPoints * sizeof( nGroupNewNumber[0] ) );
  ------------------
  |  | 1143|      0|#define inchi_malloc   malloc
  ------------------
 1094|      0|                        if (!nGroupNewNumber)
  ------------------
  |  Branch (1094:29): [True: 0, False: 0]
  ------------------
 1095|      0|                        {
 1096|      0|                            ret = -1;
 1097|      0|                            goto exit_function;
 1098|      0|                        }
 1099|      0|                        memcpy(nGroupNewNumber, nGroupNewNumberStackArray, nNumNewTGroups * sizeof(nGroupNewNumber[0]));
 1100|      0|                    }
 1101|       |                    /* save newly found fict. t-group ID to compare to the next values of EndPoint[].nEquNumber  */
 1102|  5.49k|                    nGroupNewNumber[j] = group;
 1103|  5.49k|                    nNumNewTGroups++;
 1104|  5.49k|                }
 1105|  12.0k|                EndPoint[i].nEquNumber = nNextGroupNumber + j;
 1106|  12.0k|            }
 1107|  13.2k|        }   /* after this point the values just stored in nGroupNewNumber[] will not
 1108|       |            be used. However, the obtained nNumNewTGroups value will be used */
 1109|  6.05k|    }
 1110|    496|    else
 1111|    496|    {
 1112|    496|        if (nNumZeroEqu == nNumEndPoints)
  ------------------
  |  Branch (1112:13): [True: 496, False: 0]
  ------------------
 1113|    496|        {
 1114|       |            /* EndPoint[] has NOT been processed by FindAccessibleEndPoints;
 1115|       |            all atoms and t-groups to which endpoints belong should
 1116|       |            be merged into a single t-group                              */
 1117|    496|            if (nLeastGroupNumber == nNextGroupNumber)
  ------------------
  |  Branch (1117:17): [True: 230, False: 266]
  ------------------
 1118|    230|            {
 1119|       |                /* flag to create a new t-group: none of the found
 1120|       |                endpoints belong to an already known t-group             */
 1121|    230|                nNumNewTGroups = 1; /* otherwise 0 */
 1122|    230|            }
 1123|       |            /* All EndPoint[*].nEquNumber are zeroes. All endpoints will
 1124|       |            * belong to one new or old t-group; its ID is nLeastGroupNumber.
 1125|       |            * Set  EndPoint[i].nEquNumber = nLeastGroupNumber;             */
 1126|  1.72k|            for (i = 0; i < nNumEndPoints; i++)
  ------------------
  |  Branch (1126:25): [True: 1.22k, False: 496]
  ------------------
 1127|  1.22k|            {
 1128|  1.22k|                EndPoint[i].nEquNumber = nLeastGroupNumber;
 1129|  1.22k|            }
 1130|    496|        }
 1131|      0|        else
 1132|      0|        {
 1133|      0|            ret = -1; /* program error: only some of EndPoint[i].nEquNumber are zero */ /*   <BRKPT> */
 1134|      0|            goto exit_function;
 1135|      0|        }
 1136|    496|    }
 1137|       |
 1138|  6.54k|    if (nNumNewTGroups)
  ------------------
  |  Branch (1138:9): [True: 5.72k, False: 827]
  ------------------
 1139|  5.72k|    {
 1140|       |        /* create new nNumNewTGroups t-group(s) */
 1141|  5.72k|        if (num_t + nNumNewTGroups > max_num_t)
  ------------------
  |  Branch (1141:13): [True: 0, False: 5.72k]
  ------------------
 1142|      0|        {
 1143|      0|            ret = -1; /* found too many t-groups */ /*   <BRKPT> */
 1144|      0|            goto exit_function;
 1145|      0|        }
 1146|       |        /* initialize new t-group(s) */
 1147|  5.72k|        memset( t_group + num_t, 0, nNumNewTGroups * sizeof( t_group[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 1148|  11.4k|        for (i = 0; i < nNumNewTGroups; i++)
  ------------------
  |  Branch (1148:21): [True: 5.72k, False: 5.72k]
  ------------------
 1149|  5.72k|        {
 1150|  5.72k|            t_group[num_t + i].nGroupNumber = nNextGroupNumber + i;
 1151|  5.72k|        }
 1152|  5.72k|    }
 1153|       |
 1154|       |    /* At this point:
 1155|       |    *   EndPoint[i].nGroupNumber == 0   => the endpoint atom does not belong to a t-group yet
 1156|       |    *   EndPoint[i].nGroupNumber  > 0   => current t-group ID of the endpoint atom
 1157|       |    *   EndPoint[i].nEquNumber      -->    new ID of a tautomeric group of this endpoint atom
 1158|       |    *   EndPoint[i].nAtomNumber     -->    number of the endpoint atom
 1159|       |    */
 1160|       |
 1161|  6.54k|    nNumGroups = 0; /* counts the groups to be renumbered */
 1162|  21.0k|    for (i = j = 0; i < nNumEndPoints; i++)
  ------------------
  |  Branch (1162:21): [True: 14.4k, False: 6.54k]
  ------------------
 1163|  14.4k|    {
 1164|  14.4k|        if ((group = EndPoint[i].nGroupNumber)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1164:13): [True: 1.17k, False: 13.2k]
  ------------------
 1165|  1.17k|        {
 1166|  1.17k|            if (group == EndPoint[i].nEquNumber)
  ------------------
  |  Branch (1166:17): [True: 940, False: 230]
  ------------------
 1167|    940|            {
 1168|    940|                continue; /* ignore: the endpoint belongs to the same t-group as before */
 1169|    940|            }
 1170|       |            /* save information for renumbering of the existing t-groups */
 1171|    233|            for (j = 0; j < nNumGroups; j++)
  ------------------
  |  Branch (1171:25): [True: 80, False: 153]
  ------------------
 1172|     80|            {
 1173|     80|                if (group == nGroupNumber[j])
  ------------------
  |  Branch (1173:21): [True: 77, False: 3]
  ------------------
 1174|     77|                {
 1175|     77|                    if (EndPoint[i].nEquNumber != nGroupNewNumber[j])
  ------------------
  |  Branch (1175:25): [True: 0, False: 77]
  ------------------
 1176|      0|                    {
 1177|      0|                        ret = -1; /* program error */ /*   <BRKPT> */
 1178|      0|                        goto exit_function;
 1179|      0|                    }
 1180|     77|                    break;
 1181|     77|                }
 1182|     80|            }
 1183|    230|            if (j == nNumGroups)
  ------------------
  |  Branch (1183:17): [True: 153, False: 77]
  ------------------
 1184|    153|            {
 1185|       |                /* discovered a new t-group number; store it together with its nEquNumber */
 1186|    153|                if (j == MAX_STACK_ARRAY_LEN)
  ------------------
  |  |  112|    153|#define MAX_STACK_ARRAY_LEN 127
  ------------------
  |  Branch (1186:21): [True: 0, False: 153]
  ------------------
 1187|      0|                {
 1188|      0|                    if (nGroupNewNumber == nGroupNewNumberStackArray)
  ------------------
  |  Branch (1188:25): [True: 0, False: 0]
  ------------------
 1189|      0|                    {
 1190|      0|                        nGroupNewNumber = (AT_NUMB *) inchi_malloc( nNumEndPoints * sizeof( nGroupNewNumber[0] ) );
  ------------------
  |  | 1143|      0|#define inchi_malloc   malloc
  ------------------
 1191|      0|                        if (!nGroupNewNumber)
  ------------------
  |  Branch (1191:29): [True: 0, False: 0]
  ------------------
 1192|      0|                        {
 1193|      0|                            ret = -1;
 1194|      0|                            goto exit_function;
 1195|      0|                        }
 1196|      0|                        memcpy(nGroupNewNumber, nGroupNewNumberStackArray, nNumGroups * sizeof(nGroupNewNumber[0]));
 1197|      0|                    }
 1198|      0|                    if (nGroupNumber == nGroupNumberStackArray)
  ------------------
  |  Branch (1198:25): [True: 0, False: 0]
  ------------------
 1199|      0|                    {
 1200|      0|                        nGroupNumber = (AT_NUMB *) inchi_malloc( nNumEndPoints * sizeof( nGroupNumber[0] ) );
  ------------------
  |  | 1143|      0|#define inchi_malloc   malloc
  ------------------
 1201|      0|                        if (!nGroupNumber)
  ------------------
  |  Branch (1201:29): [True: 0, False: 0]
  ------------------
 1202|      0|                        {
 1203|      0|                            ret = -1;
 1204|      0|                            goto exit_function;
 1205|      0|                        }
 1206|      0|                        memcpy(nGroupNumber, nGroupNumberStackArray, nNumGroups * sizeof(nGroupNumber[0]));
 1207|      0|                    }
 1208|      0|                }
 1209|       |
 1210|    153|                nGroupNumber[j] = group;  /* old t-group ID */
 1211|    153|                nGroupNewNumber[j] = EndPoint[i].nEquNumber; /* new t-group ID */
 1212|    153|                nNumGroups++;
 1213|    153|            }
 1214|    230|        }
 1215|  13.2k|        else
 1216|  13.2k|        {
 1217|       |            /* add a new endpoint to the newly created or previously existing t-groups */
 1218|  13.2k|            group = EndPoint[i].nEquNumber;
 1219|  13.2k|            if (group >= nNextGroupNumber)
  ------------------
  |  Branch (1219:17): [True: 12.5k, False: 784]
  ------------------
 1220|  12.5k|            {
 1221|       |                /* get index of a new t-group from equ number */
 1222|  12.5k|                j = num_t + group - nNextGroupNumber; /* newly assigned IDs are contiguous */
 1223|  12.5k|            }
 1224|    784|            else
 1225|    784|            {
 1226|       |                /* old t-group */
 1227|    784|                if (j >= num_t || group != t_group[j].nGroupNumber)
  ------------------
  |  Branch (1227:21): [True: 0, False: 784]
  |  Branch (1227:35): [True: 56, False: 728]
  ------------------
 1228|     56|                {
 1229|       |                    /* search only if j is not a needed group index */
 1230|    112|                    for (j = 0; j < num_t; j++)
  ------------------
  |  Branch (1230:33): [True: 112, False: 0]
  ------------------
 1231|    112|                    {
 1232|    112|                        if (group == t_group[j].nGroupNumber)
  ------------------
  |  Branch (1232:29): [True: 56, False: 56]
  ------------------
 1233|     56|                        {
 1234|     56|                            break;
 1235|     56|                        }
 1236|    112|                    }
 1237|     56|                    if (j == num_t)
  ------------------
  |  Branch (1237:25): [True: 0, False: 56]
  ------------------
 1238|      0|                    {
 1239|      0|                        ret = -1; /* program error: t-group not found */ /*   <BRKPT> */
 1240|      0|                        goto exit_function;
 1241|      0|                    }
 1242|     56|                }
 1243|    784|            }
 1244|       |            /* add aton to existing or new t-group */
 1245|  13.2k|            t_group[j].nNumEndpoints++;
 1246|  79.7k|            for (k = 0; k < (int) ( sizeof( t_group->num ) / sizeof( t_group->num[0] ) ); k++)
  ------------------
  |  Branch (1246:25): [True: 66.4k, False: 13.2k]
  ------------------
 1247|  66.4k|            {
 1248|  66.4k|                t_group[j].num[k] += EndPoint[i].num[k];
 1249|  66.4k|            }
 1250|  93.0k|            for (k = 0; k < (int) ( sizeof( t_group->num_DA ) / sizeof( t_group->num_DA[0] ) ); k++)
  ------------------
  |  Branch (1250:25): [True: 79.7k, False: 13.2k]
  ------------------
 1251|  79.7k|            {
 1252|  79.7k|                t_group[j].num_DA[k] += EndPoint[i].num_DA[k];
 1253|  79.7k|            }
 1254|       |            /* mark endpoint */
 1255|  13.2k|            at[EndPoint[i].nAtomNumber].endpoint = group;
 1256|  13.2k|            difference++;
 1257|  13.2k|        }
 1258|  14.4k|    }
 1259|       |
 1260|  6.54k|    difference += nNumGroups;
 1261|  6.54k|    num_t += nNumNewTGroups;
 1262|  6.54k|    if (!difference)
  ------------------
  |  Branch (1262:9): [True: 0, False: 6.54k]
  ------------------
 1263|      0|    {
 1264|      0|        ret = 0; /* nothing to do. Not necessarily a program error: happens if all EndPoint[i].nGroupNumber==EndPoint[i].nEquNumber  */
 1265|      0|        goto exit_function;
 1266|      0|    }
 1267|       |
 1268|  6.54k|    if (nNumGroups)
  ------------------
  |  Branch (1268:9): [True: 151, False: 6.39k]
  ------------------
 1269|    151|    {
 1270|       |        /* prepare for renumbering: find max t-group number */
 1271|    456|        for (i = 0, nNextGroupNumber = 0; i < num_t; i++)
  ------------------
  |  Branch (1271:43): [True: 305, False: 151]
  ------------------
 1272|    305|        {
 1273|    305|            if (nNextGroupNumber < t_group[i].nGroupNumber)
  ------------------
  |  Branch (1273:17): [True: 305, False: 0]
  ------------------
 1274|    305|            {
 1275|    305|                nNextGroupNumber = t_group[i].nGroupNumber;
 1276|    305|            }
 1277|    305|        }
 1278|    151|    }
 1279|       |    /* renumber and merge t-groups */
 1280|  6.70k|    for (i = 0; i < nNumGroups; i++)
  ------------------
  |  Branch (1280:17): [True: 153, False: 6.54k]
  ------------------
 1281|    153|    {
 1282|    153|        int i1, i2;
 1283|    153|        AT_NUMB group1 = nGroupNumber[i];
 1284|    153|        AT_NUMB group2 = nGroupNewNumber[i];
 1285|       |        /* add group1 to group2, then delete group1. */
 1286|    461|        for (j = 0, i1 = i2 = -1; j < num_t && ( i1 < 0 || i2 < 0 ); j++)
  ------------------
  |  Branch (1286:35): [True: 309, False: 152]
  |  Branch (1286:50): [True: 308, False: 1]
  |  Branch (1286:60): [True: 0, False: 1]
  ------------------
 1287|    308|        {
 1288|    308|            if (i1 < 0 && group1 == t_group[j].nGroupNumber)
  ------------------
  |  Branch (1288:17): [True: 308, False: 0]
  |  Branch (1288:27): [True: 153, False: 155]
  ------------------
 1289|    153|            {
 1290|    153|                i1 = j;
 1291|    153|            }
 1292|    308|            if (i2 < 0 && group2 == t_group[j].nGroupNumber)
  ------------------
  |  Branch (1292:17): [True: 154, False: 154]
  |  Branch (1292:27): [True: 153, False: 1]
  ------------------
 1293|    153|            {
 1294|    153|                i2 = j;
 1295|    153|            }
 1296|    308|        }
 1297|    153|        if (i1 < 0 || i2 < 0)
  ------------------
  |  Branch (1297:13): [True: 0, False: 153]
  |  Branch (1297:23): [True: 0, False: 153]
  ------------------
 1298|      0|        {
 1299|      0|            ret = -1; /* program error */ /*   <BRKPT> */
 1300|      0|            goto exit_function;
 1301|      0|        }
 1302|       |        /*  add t_group[i1] to t_group[i2] and remove t_group[i1] */
 1303|    918|        for (k = 0; k < (int) ( sizeof( t_group->num ) / sizeof( t_group->num[0] ) ); k++)
  ------------------
  |  Branch (1303:21): [True: 765, False: 153]
  ------------------
 1304|    765|        {
 1305|    765|            t_group[i2].num[k] += t_group[i1].num[k];
 1306|    765|        }
 1307|  1.07k|        for (k = 0; k < (int) ( sizeof( t_group->num_DA ) / sizeof( t_group->num_DA[0] ) ); k++)
  ------------------
  |  Branch (1307:21): [True: 918, False: 153]
  ------------------
 1308|    918|        {
 1309|    918|            t_group[i2].num_DA[k] += t_group[i1].num_DA[k];
 1310|    918|        }
 1311|    153|        t_group[i2].nNumEndpoints += t_group[i1].nNumEndpoints;
 1312|    153|        num_t--;
 1313|    153|        if (num_t > i1)
  ------------------
  |  Branch (1313:13): [True: 1, False: 152]
  ------------------
 1314|      1|        {
 1315|      1|            memmove(t_group + i1, t_group + i1 + 1, ((long long)num_t - (long long)i1) * sizeof(t_group[0])); /* djb-rwth: cast operators added */
 1316|      1|        }
 1317|    153|    }
 1318|       |
 1319|  6.54k|    if (nNumGroups)
  ------------------
  |  Branch (1319:9): [True: 151, False: 6.39k]
  ------------------
 1320|    151|    {
 1321|       |        /* there are groups to merge */
 1322|    151|        if (nNextGroupNumber >= MAX_STACK_ARRAY_LEN)
  ------------------
  |  |  112|    151|#define MAX_STACK_ARRAY_LEN 127
  ------------------
  |  Branch (1322:13): [True: 0, False: 151]
  ------------------
 1323|      0|        {
 1324|      0|            nNewTgNumber = (AT_NUMB *) inchi_malloc( ( (long long)nNextGroupNumber + 1 ) * sizeof( *nNewTgNumber ) ); /* djb-rwth: cast operator added */
  ------------------
  |  | 1143|      0|#define inchi_malloc   malloc
  ------------------
 1325|      0|            if (!nNewTgNumber)
  ------------------
  |  Branch (1325:17): [True: 0, False: 0]
  ------------------
 1326|      0|            {
 1327|      0|                ret = -1;
 1328|      0|                goto exit_function; /* error: out of RAM */
 1329|      0|            }
 1330|      0|        }
 1331|    151|        memset( nNewTgNumber, 0, ( (long long)nNextGroupNumber + 1 ) * sizeof( *nNewTgNumber ) ); /* djb-rwth: cast operator added; memset_s C11/Annex K variant? */
 1332|    303|        for (i = 0; i < num_t; i++)
  ------------------
  |  Branch (1332:21): [True: 152, False: 151]
  ------------------
 1333|    152|        {
 1334|    152|            nNewTgNumber[t_group[i].nGroupNumber] = i + 1; /* new t-group numbers */
 1335|    152|        }
 1336|    304|        for (j = 0; j < nNumGroups; j++)
  ------------------
  |  Branch (1336:21): [True: 153, False: 151]
  ------------------
 1337|    153|        {
 1338|    153|            if (!nNewTgNumber[nGroupNumber[j]] && nNewTgNumber[nGroupNewNumber[j]])
  ------------------
  |  Branch (1338:17): [True: 153, False: 0]
  |  Branch (1338:51): [True: 153, False: 0]
  ------------------
 1339|    153|            {
 1340|    153|                nNewTgNumber[nGroupNumber[j]] = nNewTgNumber[nGroupNewNumber[j]];
 1341|    153|            }
 1342|      0|            else
 1343|      0|            {
 1344|      0|                ret = -1; /* program error: all new numbers must have been marked */
 1345|      0|                goto exit_function;
 1346|      0|            }
 1347|    153|        }
 1348|       |        /* renumber t-groups */
 1349|    303|        for (i = 0; i < num_t; i++)
  ------------------
  |  Branch (1349:21): [True: 152, False: 151]
  ------------------
 1350|    152|        {
 1351|    152|            t_group[i].nGroupNumber = nNewTgNumber[t_group[i].nGroupNumber];
 1352|    152|        }
 1353|       |#if ( bRELEASE_VERSION != 1 )
 1354|       |        /* Check: debug only */
 1355|       |        for (i = 1; i < num_t; i++)
 1356|       |        {
 1357|       |            if (1 != t_group[i].nGroupNumber - t_group[i - 1].nGroupNumber)
 1358|       |            {
 1359|       |                ret = -1; /* debug */
 1360|       |                goto exit_function;
 1361|       |            }
 1362|       |        }
 1363|       |#endif
 1364|       |        /* renumber endpoints */
 1365|  1.32k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1365:21): [True: 1.17k, False: 151]
  ------------------
 1366|  1.17k|        {
 1367|  1.17k|            if ((group = at[i].endpoint)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1367:17): [True: 738, False: 440]
  ------------------
 1368|    738|            {
 1369|    738|                if (!( at[i].endpoint = nNewTgNumber[group] ) || nNextGroupNumber <= nNewTgNumber[group])
  ------------------
  |  Branch (1369:21): [True: 0, False: 738]
  |  Branch (1369:66): [True: 0, False: 738]
  ------------------
 1370|      0|                {
 1371|      0|                    ret = -1; /* program error */
 1372|      0|                    goto exit_function;
 1373|      0|                }
 1374|    738|            }
 1375|  1.17k|        }
 1376|    151|    }
 1377|  6.54k|    if (nNewTgNumber != nNewTgNumberStackArray)
  ------------------
  |  Branch (1377:9): [True: 0, False: 6.54k]
  ------------------
 1378|      0|    {
 1379|      0|        inchi_free( nNewTgNumber );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1380|      0|        nNewTgNumber = nNewTgNumberStackArray;
 1381|      0|    }
 1382|  6.54k|    if (nGroupNumber != nGroupNumberStackArray)
  ------------------
  |  Branch (1382:9): [True: 0, False: 6.54k]
  ------------------
 1383|      0|    {
 1384|      0|        inchi_free( nGroupNumber );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1385|      0|        nGroupNumber = nGroupNumberStackArray;
 1386|      0|    }
 1387|  6.54k|    if (nGroupNewNumber != nGroupNewNumberStackArray)
  ------------------
  |  Branch (1387:9): [True: 0, False: 6.54k]
  ------------------
 1388|      0|    {
 1389|      0|        inchi_free( nGroupNewNumber );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1390|      0|        nGroupNewNumber = nGroupNewNumberStackArray;
 1391|      0|    }
 1392|  6.54k|    if (!t_group_info->tGroupNumber)
  ------------------
  |  Branch (1392:9): [True: 0, False: 6.54k]
  ------------------
 1393|      0|    {
 1394|      0|        t_group_info->tGroupNumber = (AT_NUMB *) inchi_malloc( 2 * (long long)max_num_t * sizeof( t_group_info->tGroupNumber[0] ) ); /* djb-rwth: cast operator added */
  ------------------
  |  | 1143|      0|#define inchi_malloc   malloc
  ------------------
 1395|      0|        if (!t_group_info->tGroupNumber)
  ------------------
  |  Branch (1395:13): [True: 0, False: 0]
  ------------------
 1396|      0|        {
 1397|      0|            ret = -1;
 1398|      0|            goto exit_function;
 1399|      0|        }
 1400|      0|    }
 1401|       |    /* fill out t-group index 2004-02-27 */
 1402|  6.54k|    memset( t_group_info->tGroupNumber, 0, 2 * (long long)max_num_t * sizeof( t_group_info->tGroupNumber[0] ) ); /* djb-rwth: cast operator added; memset_s C11/Annex K variant? */
 1403|  13.4k|    for (i = 0; i < num_t; i++)
  ------------------
  |  Branch (1403:17): [True: 6.92k, False: 6.54k]
  ------------------
 1404|  6.92k|    {
 1405|  6.92k|        if (t_group[i].nNumEndpoints && t_group[i].nGroupNumber)
  ------------------
  |  Branch (1405:13): [True: 6.92k, False: 0]
  |  Branch (1405:41): [True: 6.92k, False: 0]
  ------------------
 1406|  6.92k|        {
 1407|  6.92k|            t_group_info->tGroupNumber[t_group[i].nGroupNumber] = i + 1;
 1408|  6.92k|        }
 1409|  6.92k|    }
 1410|       |
 1411|  6.54k|    if (pBNS && ( pBNS->tot_st_cap == pBNS->tot_st_flow || ALWAYS_ADD_TG_ON_THE_FLY ))
  ------------------
  |  |  539|  1.13k|#define ALWAYS_ADD_TG_ON_THE_FLY    1  /* 1 => disables radical calcellation by taut-charge movement */
  |  |  ------------------
  |  |  |  Branch (539:37): [True: 1.13k, Folded]
  |  |  ------------------
  ------------------
  |  Branch (1411:9): [True: 6.54k, False: 0]
  |  Branch (1411:19): [True: 5.41k, False: 1.13k]
  ------------------
 1412|  6.54k|    {
 1413|  6.54k|        T_GROUP_INFO tgi;
 1414|  6.54k|        int ret_bns;
 1415|  6.54k|        memset( &tgi, 0, sizeof( tgi ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 1416|  6.54k|        tgi.num_t_groups = num_t;
 1417|  6.54k|        tgi.t_group = t_group;
 1418|  6.54k|#if ( KETO_ENOL_TAUT == 1 )
 1419|  6.54k|        tgi.bTautFlags |= ( t_group_info->bTautFlags & TG_FLAG_KETO_ENOL_TAUT ); /* needed in AddTGroups2BnStruct() */
  ------------------
  |  |  946|  6.54k|#define TG_FLAG_KETO_ENOL_TAUT           0x00080000   /* turn on keto-enol tautomerism detection */
  ------------------
 1420|  6.54k|#endif
 1421|       |
 1422|  6.54k|#if ( TAUT_PT_22_00 == 1 )
 1423|  6.54k|        tgi.bTautFlags |= (t_group_info->bTautFlags & TG_FLAG_PT_22_00); /* needed in AddTGroups2BnStruct() */
  ------------------
  |  |  953|  6.54k|#define TG_FLAG_PT_22_00                 0x00800000
  ------------------
 1424|  6.54k|#endif
 1425|  6.54k|#if ( TAUT_PT_16_00 == 1 )
 1426|  6.54k|        tgi.bTautFlags |= (t_group_info->bTautFlags & TG_FLAG_PT_16_00); /* needed in AddTGroups2BnStruct() */
  ------------------
  |  |  954|  6.54k|#define TG_FLAG_PT_16_00                 0x01000000
  ------------------
 1427|  6.54k|#endif
 1428|  6.54k|#if ( TAUT_PT_06_00 == 1 )
 1429|  6.54k|        tgi.bTautFlags |= (t_group_info->bTautFlags & TG_FLAG_PT_06_00); /* needed in AddTGroups2BnStruct() */
  ------------------
  |  |  955|  6.54k|#define TG_FLAG_PT_06_00                 0x02000000
  ------------------
 1430|  6.54k|#endif
 1431|  6.54k|#if ( TAUT_PT_39_00 == 1 )
 1432|  6.54k|        tgi.bTautFlags |= (t_group_info->bTautFlags & TG_FLAG_PT_39_00); /* needed in AddTGroups2BnStruct() */
  ------------------
  |  |  956|  6.54k|#define TG_FLAG_PT_39_00                 0x04000000
  ------------------
 1433|  6.54k|#endif
 1434|  6.54k|#if ( TAUT_PT_13_00 == 1 )
 1435|  6.54k|        tgi.bTautFlags |= (t_group_info->bTautFlags & TG_FLAG_PT_13_00); /* needed in AddTGroups2BnStruct() */
  ------------------
  |  |  957|  6.54k|#define TG_FLAG_PT_13_00                 0x08000000
  ------------------
 1436|  6.54k|#endif
 1437|  6.54k|#if ( TAUT_PT_18_00 == 1 )
 1438|  6.54k|        tgi.bTautFlags |= (t_group_info->bTautFlags & TG_FLAG_PT_18_00); /* needed in AddTGroups2BnStruct() */
  ------------------
  |  |  958|  6.54k|#define TG_FLAG_PT_18_00                 0x10000000
  ------------------
 1439|  6.54k|#endif	
 1440|       |                                                                         /* reinitialize BN Structure */
 1441|  6.54k|        ret_bns = ReInitBnStruct( pBNS, at, num_atoms, 0 );
 1442|  6.54k|        if (IS_BNS_ERROR( ret_bns ))
  ------------------
  |  |   67|  6.54k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  6.54k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  6.54k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  6.54k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 6.54k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 6.54k]
  |  |  ------------------
  ------------------
 1443|      0|        {
 1444|      0|            return ret_bns;
 1445|      0|        }
 1446|  6.54k|        if (*pBNS->pbTautFlags & TG_FLAG_MOVE_POS_CHARGES)
  ------------------
  |  |  921|  6.54k|#define TG_FLAG_MOVE_POS_CHARGES         0x00000008   /* MOVE_CHARGES allow long-range movement of N(+), P(+) charges           */
  ------------------
  |  Branch (1446:13): [True: 6.54k, False: 0]
  ------------------
 1447|  6.54k|        {
 1448|       |            /* set new charge groups */
 1449|  6.54k|            ret_bns = AddCGroups2BnStruct( pCG, pBNS, at, num_atoms, cgi );
 1450|  6.54k|            if (IS_BNS_ERROR( ret_bns ))
  ------------------
  |  |   67|  6.54k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  6.54k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  6.54k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  6.54k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 6.54k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 6.54k]
  |  |  ------------------
  ------------------
 1451|      0|            {
 1452|      0|                return ret_bns;
 1453|      0|            }
 1454|  6.54k|        }
 1455|       |        /* set new tautomeric groups */
 1456|  6.54k|        ret_bns = AddTGroups2BnStruct( pCG, pBNS, at, num_atoms, &tgi );
 1457|  6.54k|        if (IS_BNS_ERROR( ret_bns ))
  ------------------
  |  |   67|  6.54k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  6.54k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  6.54k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  6.54k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 6.54k, False: 0]
  |  |  |  Branch (67:44): [True: 5, False: 6.54k]
  |  |  ------------------
  ------------------
 1458|      5|        {
 1459|      5|            return ret_bns;
 1460|      5|        }
 1461|  6.54k|    }
 1462|       |
 1463|  6.54k|    *pnum_t = num_t;
 1464|  6.54k|    return difference;
 1465|       |
 1466|      0|exit_function:
 1467|      0|    if (nNewTgNumber != nNewTgNumberStackArray)
  ------------------
  |  Branch (1467:9): [True: 0, False: 0]
  ------------------
 1468|      0|    {
 1469|      0|        inchi_free( nNewTgNumber );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1470|      0|    }
 1471|      0|    if (nGroupNumber != nGroupNumberStackArray)
  ------------------
  |  Branch (1471:9): [True: 0, False: 0]
  ------------------
 1472|      0|    {
 1473|      0|        inchi_free( nGroupNumber );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1474|      0|    }
 1475|      0|    if (nGroupNewNumber != nGroupNewNumberStackArray)
  ------------------
  |  Branch (1475:9): [True: 0, False: 0]
  ------------------
 1476|      0|    {
 1477|      0|        inchi_free( nGroupNewNumber );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1478|      0|    }
 1479|       |
 1480|      0|    return ret;
 1481|  6.54k|}
SetTautomericBonds:
 1491|  39.2k|{
 1492|  39.2k|    int k, n;
 1493|   128k|    for (k = n = 0; k < nNumBondPos; k++)
  ------------------
  |  Branch (1493:21): [True: 88.7k, False: 39.2k]
  ------------------
 1494|  88.7k|    {
 1495|  88.7k|        int neighbor_index = BondPos[k].neighbor_index;
 1496|  88.7k|        int center = BondPos[k].nAtomNumber;
 1497|  88.7k|        int bond_mark = at[center].bond_type[neighbor_index];
 1498|  88.7k|        int bond_type = bond_mark & ~BOND_MARK_ALL;
  ------------------
  |  |  191|  88.7k|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 1499|  88.7k|        int neighbor;
 1500|  88.7k|#if ( REPLACE_ALT_WITH_TAUT == 1 )
 1501|  88.7k|        if (bond_type != BOND_TAUTOM)
  ------------------
  |  |  185|  88.7k|#define BOND_TAUTOM              8
  ------------------
  |  Branch (1501:13): [True: 13.3k, False: 75.4k]
  ------------------
 1502|       |#else
 1503|       |        if (bond_type != BOND_ALTERN && bond_type != BOND_TAUTOM)
 1504|       |#endif
 1505|  13.3k|        {
 1506|  13.3k|            int ii;
 1507|       |            /*  change bond type to BOND_TAUTOM presering higher bits marks */
 1508|  13.3k|            bond_type = ( bond_mark & BOND_MARK_ALL ) | BOND_TAUTOM;
  ------------------
  |  |  191|  13.3k|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
                          bond_type = ( bond_mark & BOND_MARK_ALL ) | BOND_TAUTOM;
  ------------------
  |  |  185|  13.3k|#define BOND_TAUTOM              8
  ------------------
 1509|       |            /*  change center-neighbor bond */
 1510|  13.3k|            at[center].bond_type[neighbor_index] = bond_type;
 1511|  13.3k|            neighbor = at[center].neighbor[neighbor_index];
 1512|  14.8k|            for (ii = 0; ii < at[neighbor].valence; ii++)
  ------------------
  |  Branch (1512:26): [True: 14.8k, False: 0]
  ------------------
 1513|  14.8k|            {
 1514|  14.8k|                if (at[neighbor].neighbor[ii] == center)
  ------------------
  |  Branch (1514:21): [True: 13.3k, False: 1.47k]
  ------------------
 1515|  13.3k|                {
 1516|       |                    /*  neighbor-center bond found */
 1517|  13.3k|                    at[neighbor].bond_type[ii] = bond_type;
 1518|  13.3k|                    break;
 1519|  13.3k|                }
 1520|  14.8k|            }
 1521|  13.3k|            n++;
 1522|  13.3k|        }
 1523|  88.7k|    }
 1524|       |
 1525|  39.2k|    return n;
 1526|  39.2k|}
GetNeutralRepsIfNeeded:
 1537|  8.03k|{
 1538|  8.03k|    AT_NUMB ri = *pri;
 1539|  8.03k|    AT_NUMB rj = *prj;
 1540|  8.03k|    int     i, k;
 1541|  8.03k|    AT_NUMB c_point, endpoint, r;
 1542|       |
 1543|  8.03k|    if (( c_point = at[ri].c_point ) &&
  ------------------
  |  Branch (1543:9): [True: 383, False: 7.64k]
  ------------------
 1544|    383|        ( at[rj].c_point == c_point ) &&
  ------------------
  |  Branch (1544:9): [True: 341, False: 42]
  ------------------
 1545|    341|         ( at[ri].charge == 1 || at[rj].charge == 1 ) &&
  ------------------
  |  Branch (1545:12): [True: 101, False: 240]
  |  Branch (1545:34): [True: 158, False: 82]
  ------------------
 1546|    259|         cgi                                        &&
  ------------------
  |  Branch (1546:10): [True: 259, False: 0]
  ------------------
 1547|    259|         cgi->num_c_groups > 0)
  ------------------
  |  Branch (1547:10): [True: 259, False: 0]
  ------------------
 1548|    259|    {
 1549|       |        /* at[ri] and at[rj] belong to the same charge group, at least one is charged   */
 1550|    259|        for (k = 0; k < cgi->num_c_groups; k++) /* MS VC++ 2008 reports unreachable code here ??? */ /* djb-rwth: addressing coverity ID #499559 -- read the previous comment; can cgi->num_c_groups only have values 0 and 1? */
  ------------------
  |  Branch (1550:21): [True: 259, False: 0]
  ------------------
 1551|    259|        {
 1552|    259|            if (cgi->c_group[k].nGroupNumber == c_point)
  ------------------
  |  Branch (1552:17): [True: 219, False: 40]
  ------------------
 1553|    219|            {
 1554|       |                /* cgi->c_group[k] is found to be this charge group */
 1555|    219|                if (cgi->c_group[k].num_CPoints - cgi->c_group[k].num[0] < 2)
  ------------------
  |  Branch (1555:21): [True: 101, False: 118]
  ------------------
 1556|    101|                {
 1557|       |                    /* Only one neutral in the c-group: we will not be able to neutralize both */
 1558|       |                    /* when looking for the alt path to discover the tautomerism.              */
 1559|       |                    /* Therefore we need to find a neutral t-group representative at[rj]       */
 1560|    101|                    if ((endpoint = at[rj].endpoint)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1560:25): [True: 5, False: 96]
  ------------------
 1561|      5|                    {
 1562|     15|                        for (i = 0; i < nNumEndPoints; i++)
  ------------------
  |  Branch (1562:37): [True: 10, False: 5]
  ------------------
 1563|     10|                        {
 1564|     10|                            if (( r = EndPoint[i].nAtomNumber ) == *prj)
  ------------------
  |  Branch (1564:33): [True: 5, False: 5]
  ------------------
 1565|      5|                            {
 1566|      5|                                continue; /* ignore at[*prj] */
 1567|      5|                            }
 1568|      5|                            if (at[r].endpoint != endpoint)
  ------------------
  |  Branch (1568:33): [True: 5, False: 0]
  ------------------
 1569|      5|                            {
 1570|      5|                                continue; /* at[r] does not belong to the same t-group as at[*prj]; ignore the atom */
 1571|      5|                            }
 1572|      0|                            if (!at[r].c_point)
  ------------------
  |  Branch (1572:33): [True: 0, False: 0]
  ------------------
 1573|      0|                            {
 1574|      0|                                rj = r; /* found a neutral t-group representative */
 1575|      0|                                break;
 1576|      0|                            }
 1577|      0|                            if (at[r].c_point != c_point && c_point == at[rj].c_point)
  ------------------
  |  Branch (1577:33): [True: 0, False: 0]
  |  Branch (1577:61): [True: 0, False: 0]
  ------------------
 1578|      0|                            {
 1579|       |                                /* replace only once because of (c_point == at[rj].c_point) condition  */
 1580|      0|                                rj = r;
 1581|      0|                            }
 1582|      0|                        }
 1583|      5|                        if (rj == *prj /*&& at[ri].endpoint*/)
  ------------------
  |  Branch (1583:29): [True: 5, False: 0]
  ------------------
 1584|      5|                        {
 1585|       |                            /* !!! "&& at[ri].endpoint": only between 2 t-groups 2004-02-27;
 1586|       |                            the change disabled due to undiscovered yet possibility of ambiguity*/
 1587|       |                            /* no replacement has been found in EndPoint[]; try all atoms in the t-group */
 1588|     18|                            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1588:41): [True: 18, False: 0]
  ------------------
 1589|     18|                            {
 1590|     18|                                if (at[i].endpoint != endpoint)
  ------------------
  |  Branch (1590:37): [True: 12, False: 6]
  ------------------
 1591|     12|                                {
 1592|     12|                                    continue;
 1593|     12|                                }
 1594|      6|                                if (i == (int) *prj)
  ------------------
  |  Branch (1594:37): [True: 1, False: 5]
  ------------------
 1595|      1|                                {
 1596|      1|                                    continue;
 1597|      1|                                }
 1598|      5|                                if (!at[i].c_point)
  ------------------
  |  Branch (1598:37): [True: 5, False: 0]
  ------------------
 1599|      5|                                {
 1600|      5|                                    rj = (AT_NUMB) i; /* found neutral t-group representative */
 1601|      5|                                    break;
 1602|      5|                                }
 1603|      0|                                if (at[i].c_point != c_point && c_point == at[rj].c_point)
  ------------------
  |  Branch (1603:37): [True: 0, False: 0]
  |  Branch (1603:65): [True: 0, False: 0]
  ------------------
 1604|      0|                                {
 1605|       |                                    /* replace only once */
 1606|      0|                                    rj = (AT_NUMB) i;
 1607|      0|                                }
 1608|      0|                            }
 1609|      5|                        }
 1610|      5|                    }
 1611|       |                    /* at[ri] */
 1612|    101|                    if ((endpoint = at[ri].endpoint)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1612:25): [True: 49, False: 52]
  ------------------
 1613|     49|                    {
 1614|    155|                        for (i = 0; i < nNumEndPoints; i++)
  ------------------
  |  Branch (1614:37): [True: 132, False: 23]
  ------------------
 1615|    132|                        {
 1616|    132|                            if (( r = EndPoint[i].nAtomNumber ) == *pri)
  ------------------
  |  Branch (1616:33): [True: 49, False: 83]
  ------------------
 1617|     49|                            {
 1618|     49|                                continue;
 1619|     49|                            }
 1620|     83|                            if (at[r].endpoint != endpoint)
  ------------------
  |  Branch (1620:33): [True: 57, False: 26]
  ------------------
 1621|     57|                            {
 1622|     57|                                continue;
 1623|     57|                            }
 1624|     26|                            if (!at[r].c_point)
  ------------------
  |  Branch (1624:33): [True: 26, False: 0]
  ------------------
 1625|     26|                            {
 1626|     26|                                ri = r; /* found neutral t-group representative */
 1627|     26|                                break;
 1628|     26|                            }
 1629|      0|                            if (at[r].c_point != c_point && c_point == at[ri].c_point &&
  ------------------
  |  Branch (1629:33): [True: 0, False: 0]
  |  Branch (1629:61): [True: 0, False: 0]
  ------------------
 1630|      0|                                 at[r].c_point != at[rj].c_point)
  ------------------
  |  Branch (1630:34): [True: 0, False: 0]
  ------------------
 1631|      0|                            {
 1632|       |                                /* replace only once */
 1633|      0|                                ri = r;
 1634|      0|                            }
 1635|      0|                        }
 1636|     49|                        if (ri == *pri && at[rj].endpoint)
  ------------------
  |  Branch (1636:29): [True: 23, False: 26]
  |  Branch (1636:43): [True: 5, False: 18]
  ------------------
 1637|      5|                        {
 1638|       |                            /* !!! "&& at[rj].endpoint": only between 2 t-groups 2004-02-27;
 1639|       |                            the change disabled due to undiscovered yet possibility of ambiguity */
 1640|     19|                            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1640:41): [True: 19, False: 0]
  ------------------
 1641|     19|                            {
 1642|     19|                                if (at[i].endpoint != endpoint)
  ------------------
  |  Branch (1642:37): [True: 9, False: 10]
  ------------------
 1643|      9|                                {
 1644|      9|                                    continue;
 1645|      9|                                }
 1646|     10|                                if (i == (int) *pri)
  ------------------
  |  Branch (1646:37): [True: 5, False: 5]
  ------------------
 1647|      5|                                {
 1648|      5|                                    continue;
 1649|      5|                                }
 1650|      5|                                if (!at[i].c_point)
  ------------------
  |  Branch (1650:37): [True: 5, False: 0]
  ------------------
 1651|      5|                                {
 1652|      5|                                    ri = (AT_NUMB) i; /* found neutral t-group representative */
 1653|      5|                                    break;
 1654|      5|                                }
 1655|      0|                                if (at[i].c_point != c_point && c_point == at[ri].c_point &&
  ------------------
  |  Branch (1655:37): [True: 0, False: 0]
  |  Branch (1655:65): [True: 0, False: 0]
  ------------------
 1656|      0|                                     at[i].c_point != at[rj].c_point)
  ------------------
  |  Branch (1656:38): [True: 0, False: 0]
  ------------------
 1657|      0|                                {
 1658|       |                                    /* replace only once */
 1659|      0|                                    ri = (AT_NUMB) i;
 1660|      0|                                }
 1661|      0|                            }
 1662|      5|                        }
 1663|     49|                    }
 1664|    101|                }
 1665|    219|            }
 1666|    259|            break;
 1667|    259|        }
 1668|    259|        *prj = rj;
 1669|    259|        *pri = ri;
 1670|    259|    }
 1671|       |
 1672|  8.03k|    return 0;
 1673|  8.03k|}
FindAccessibleEndPoints:
 1688|  39.3k|{
 1689|  39.3k|    AT_NUMB nTGroupRepresenative[MAXVAL], nTGroupEqu[MAXVAL], nTGEndPointNo[MAXVAL], ri, rj;
 1690|  39.3k|    AT_NUMB nCurTGroupNumber, nMaxTGroupNumber, nNumTgroupNumbers, nMaxEquNumber;
 1691|  39.3k|    int   i, j, k, nNumDiffTGroupNumbers = 0, nNumFoundEqu, nErr;
 1692|       |
 1693|  39.3k|    if (*nNumEndPoints != *nNumBondPos)
  ------------------
  |  Branch (1693:9): [True: 0, False: 39.3k]
  ------------------
 1694|      0|        return 0;
 1695|       |    /* collect all group numbers. Fill EndPoint[i].nEquNumber */
 1696|   128k|    for (i = 0; i < *nNumEndPoints; i++)
  ------------------
  |  Branch (1696:17): [True: 88.8k, False: 39.3k]
  ------------------
 1697|  88.8k|    {
 1698|  88.8k|        nCurTGroupNumber = EndPoint[i].nEquNumber = EndPoint[i].nGroupNumber; /* initial equivalence */
 1699|  88.8k|        if (nCurTGroupNumber)
  ------------------
  |  Branch (1699:13): [True: 75.8k, False: 12.9k]
  ------------------
 1700|  75.8k|        {
 1701|       |            /* found endpoint that already belongs to a t-group */
 1702|  75.9k|            for (j = 0; j < nNumDiffTGroupNumbers; j++)
  ------------------
  |  Branch (1702:25): [True: 42.1k, False: 33.7k]
  ------------------
 1703|  42.1k|            {
 1704|  42.1k|                if (nTGroupEqu[j] == nCurTGroupNumber)
  ------------------
  |  Branch (1704:21): [True: 42.1k, False: 32]
  ------------------
 1705|  42.1k|                {
 1706|  42.1k|                    break;
 1707|  42.1k|                }
 1708|  42.1k|            }
 1709|  75.8k|            if (j == nNumDiffTGroupNumbers)
  ------------------
  |  Branch (1709:17): [True: 33.7k, False: 42.1k]
  ------------------
 1710|  33.7k|            {
 1711|  33.7k|                nTGroupRepresenative[nNumDiffTGroupNumbers] = EndPoint[i].nAtomNumber;
 1712|  33.7k|                nTGroupEqu[nNumDiffTGroupNumbers] = EndPoint[i].nGroupNumber;
 1713|  33.7k|                nTGEndPointNo[nNumDiffTGroupNumbers] = i;
 1714|  33.7k|                nNumDiffTGroupNumbers++;
 1715|  33.7k|            }
 1716|  75.8k|        }
 1717|  88.8k|    }
 1718|       |
 1719|       |    /* check whether each pair belongs to the same t-group and establish the equivalence(s) */
 1720|  73.0k|    for (i = 0, nNumFoundEqu = 0; i < nNumDiffTGroupNumbers; i++)
  ------------------
  |  Branch (1720:35): [True: 33.7k, False: 39.3k]
  ------------------
 1721|  33.7k|    {
 1722|  33.8k|        for (j = i + 1; j < nNumDiffTGroupNumbers; j++)
  ------------------
  |  Branch (1722:25): [True: 30, False: 33.7k]
  ------------------
 1723|     30|        {
 1724|     30|            ri = nTGroupRepresenative[i];
 1725|     30|            rj = nTGroupRepresenative[j];
 1726|       |            /* both at[ri] and at[rj] are known to belong to tautomeric groups */
 1727|     30|            GetNeutralRepsIfNeeded( &ri, &rj, at, num_atoms, EndPoint, *nNumEndPoints, cgi );
 1728|     30|            nErr = bExistsAnyAltPath( pCG, pBNS, pBD, at, num_atoms, ri, rj, taut_mode );
 1729|     30|            if (IS_BNS_ERROR( nErr ))
  ------------------
  |  |   67|     30|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|     30|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|     30|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|     30|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 30, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 30]
  |  |  ------------------
  ------------------
 1730|      0|            {
 1731|      0|                return nErr;
 1732|      0|            }
 1733|     30|            if (0 == nErr)
  ------------------
  |  Branch (1733:17): [True: 1, False: 29]
  ------------------
 1734|      1|            {
 1735|      1|                continue; /* alt path between at[ri] and at[rj] not found */
 1736|      1|            }
 1737|     29|            nCurTGroupNumber = inchi_min( nTGroupEqu[i], nTGroupEqu[j] );
  ------------------
  |  |  139|     29|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 21, False: 8]
  |  |  ------------------
  ------------------
 1738|     29|            nMaxTGroupNumber = inchi_max( nTGroupEqu[i], nTGroupEqu[j] );
  ------------------
  |  |  138|     29|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 8, False: 21]
  |  |  ------------------
  ------------------
 1739|     87|            for (k = 0; k < nNumDiffTGroupNumbers; k++)
  ------------------
  |  Branch (1739:25): [True: 58, False: 29]
  ------------------
 1740|     58|            {
 1741|     58|                if (nTGroupEqu[k] == nMaxTGroupNumber)
  ------------------
  |  Branch (1741:21): [True: 29, False: 29]
  ------------------
 1742|     29|                {
 1743|     29|                    nTGroupEqu[k] = nCurTGroupNumber;
 1744|     29|                    nNumFoundEqu++;
 1745|     29|                }
 1746|     58|            }
 1747|    101|            for (k = 0; k < *nNumEndPoints; k++)
  ------------------
  |  Branch (1747:25): [True: 72, False: 29]
  ------------------
 1748|     72|            {
 1749|     72|                if (EndPoint[k].nEquNumber == nMaxTGroupNumber)
  ------------------
  |  Branch (1749:21): [True: 31, False: 41]
  ------------------
 1750|     31|                {
 1751|     31|                    EndPoint[k].nEquNumber = nCurTGroupNumber;
 1752|     31|                }
 1753|     72|            }
 1754|     29|        }
 1755|  33.7k|    }
 1756|       |
 1757|  39.3k|    if (nNumFoundEqu)
  ------------------
  |  Branch (1757:9): [True: 29, False: 39.2k]
  ------------------
 1758|     29|    {
 1759|       |        /* leave in only non-equivalent representatives */
 1760|     58|        for (i = 1; i < nNumDiffTGroupNumbers; i++) /* djb-rwth: removing redundant code */
  ------------------
  |  Branch (1760:21): [True: 29, False: 29]
  ------------------
 1761|     29|        {
 1762|     29|            for (j = 0; j < i; j++)
  ------------------
  |  Branch (1762:25): [True: 29, False: 0]
  ------------------
 1763|     29|            {
 1764|     29|                if (nTGroupEqu[j] == nTGroupEqu[i])
  ------------------
  |  Branch (1764:21): [True: 29, False: 0]
  ------------------
 1765|     29|                {
 1766|     29|                    nTGroupEqu[i] = 0;  /* i > j; mark equivalent for removal*/
 1767|     29|                    break;
 1768|     29|                }
 1769|     29|            }
 1770|     29|        }
 1771|     87|        for (i = j = 0; i < nNumDiffTGroupNumbers; i++)
  ------------------
  |  Branch (1771:25): [True: 58, False: 29]
  ------------------
 1772|     58|        {
 1773|     58|            if (nTGroupEqu[i])
  ------------------
  |  Branch (1773:17): [True: 29, False: 29]
  ------------------
 1774|     29|            {
 1775|     29|                if (i != j)
  ------------------
  |  Branch (1775:21): [True: 0, False: 29]
  ------------------
 1776|      0|                { /* remove the marked */
 1777|      0|                    nTGroupEqu[j] = nTGroupEqu[i];
 1778|      0|                    nTGroupRepresenative[j] = nTGroupRepresenative[i];
 1779|      0|                    nTGEndPointNo[j] = nTGEndPointNo[i];
 1780|      0|                }
 1781|     29|                j++;
 1782|     29|            }
 1783|     58|        }
 1784|     29|        nNumDiffTGroupNumbers = j; /* number of known t-group representatives */
 1785|     29|    }
 1786|       |
 1787|       |    /* collect endpoints that have not been assigned to t-groups */
 1788|   128k|    for (i = 0, j = nNumDiffTGroupNumbers; i < *nNumEndPoints; i++)
  ------------------
  |  Branch (1788:44): [True: 88.8k, False: 39.3k]
  ------------------
 1789|  88.8k|    {
 1790|  88.8k|        if (EndPoint[i].nEquNumber)
  ------------------
  |  Branch (1790:13): [True: 75.8k, False: 12.9k]
  ------------------
 1791|  75.8k|        {
 1792|  75.8k|            continue;
 1793|  75.8k|        }
 1794|  12.9k|        nTGroupEqu[j] = 0;
 1795|  12.9k|        nTGroupRepresenative[j] = EndPoint[i].nAtomNumber;
 1796|  12.9k|        nTGEndPointNo[j] = i;
 1797|  12.9k|        j++;
 1798|  12.9k|    }
 1799|  39.3k|    nNumTgroupNumbers = j;
 1800|  39.3k|    nMaxEquNumber = num_atoms + 1; /* impossible atom or t-group number */
 1801|       |
 1802|       |                                   /* check whether each pair belongs to the same group and establish the equivalence(s) */
 1803|  85.9k|    for (i = 0, nNumFoundEqu = 0; i < nNumTgroupNumbers; i++)
  ------------------
  |  Branch (1803:35): [True: 46.6k, False: 39.3k]
  ------------------
 1804|  46.6k|    {
 1805|  55.2k|        for (j = i + 1; j < nNumTgroupNumbers; j++)
  ------------------
  |  Branch (1805:25): [True: 8.61k, False: 46.6k]
  ------------------
 1806|  8.61k|        {
 1807|  8.61k|            if ((nTGroupEqu[i] != nTGroupEqu[j] && ( i >= nNumDiffTGroupNumbers || j >= nNumDiffTGroupNumbers )) ||
  ------------------
  |  Branch (1807:18): [True: 1.94k, False: 6.66k]
  |  Branch (1807:54): [True: 1.16k, False: 783]
  |  Branch (1807:84): [True: 782, False: 1]
  ------------------
 1808|       |                 /* equivalence of a t-group and a non-t-group atom */
 1809|  6.66k|                 (!nTGroupEqu[i] && !nTGroupEqu[j])
  ------------------
  |  Branch (1809:19): [True: 6.05k, False: 610]
  |  Branch (1809:37): [True: 6.05k, False: 0]
  ------------------
 1810|       |                 /* equivalence of two non-t-group atoms */
 1811|  8.61k|                 ) /* djb-rwth: addressing LLVM warnings */
 1812|  8.00k|            {
 1813|  8.00k|                ri = nTGroupRepresenative[i];
 1814|  8.00k|                rj = nTGroupRepresenative[j];
 1815|       |                /*------------------------------!!!---------------------------------------------
 1816|       |                Explanation why GetNeutralRepsIfNeeded() may need to be changed 2004-02-27
 1817|       |                The change has been disabled due to undiscovered yet possibility of ambiguity
 1818|       |                to search for neutral only among EndPoint[] in case taut-not_taut pairs
 1819|       |
 1820|       |                Counterexample:   O=C-NH(+)=C-NH2
 1821|       |                1   2       3
 1822|       |
 1823|       |                Has already been found: 2-3 (+)-charge exchange
 1824|       |                1-2 tautomerism (charge removed to 3)
 1825|       |                Now testing: 2-3 tautomerism. If not commented out,
 1826|       |                GetNeutralRepsIfNeeded() would replace 2-3 test with 1-3 test because:
 1827|       |                o Charge group has only one neutral and both 2 and 3 belong to it,
 1828|       |                therefore we cannot neutralize both; search for neutral representative;
 1829|       |                o Since 1 and 2 belong to the same t-group and 1 is neutral,
 1830|       |                test 1-3 instead of 2-3.
 1831|       |                This breaks our condition:
 1832|       |                Test tautomeric H movement only between neutral atoms.
 1833|       |                -----------------------------------------------------------------------------*/
 1834|  8.00k|                GetNeutralRepsIfNeeded( &ri, &rj, at, num_atoms, EndPoint, *nNumEndPoints, cgi );
 1835|       |
 1836|  8.00k|                nErr = bExistsAnyAltPath( pCG, pBNS, pBD, at, num_atoms, ri, rj, taut_mode );
 1837|  8.00k|                if (IS_BNS_ERROR( nErr ))
  ------------------
  |  |   67|  8.00k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  8.00k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  8.00k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  8.00k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 8.00k, False: 0]
  |  |  |  Branch (67:44): [True: 3, False: 7.99k]
  |  |  ------------------
  ------------------
 1838|      3|                {
 1839|      3|                    return nErr;
 1840|      3|                }
 1841|  7.99k|                if (nErr <= 0)
  ------------------
  |  Branch (1841:21): [True: 875, False: 7.12k]
  ------------------
 1842|    875|                {
 1843|    875|                    continue;
 1844|    875|                }
 1845|  7.12k|                if (nTGroupEqu[i] && nTGroupEqu[j])
  ------------------
  |  Branch (1845:21): [True: 1.19k, False: 5.93k]
  |  Branch (1845:38): [True: 1, False: 1.19k]
  ------------------
 1846|      1|                {
 1847|       |                    /* found equivalence of two t-groups; at least one of them must be a new one */
 1848|      1|                    nCurTGroupNumber = inchi_min( nTGroupEqu[i], nTGroupEqu[j] );
  ------------------
  |  |  139|      1|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (139:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1849|      1|                    nMaxTGroupNumber = inchi_max( nTGroupEqu[i], nTGroupEqu[j] );
  ------------------
  |  |  138|      1|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 1, False: 0]
  |  |  ------------------
  ------------------
 1850|      4|                    for (k = 0; k < nNumTgroupNumbers; k++)
  ------------------
  |  Branch (1850:33): [True: 3, False: 1]
  ------------------
 1851|      3|                    {
 1852|      3|                        if (nTGroupEqu[k] == nMaxTGroupNumber)
  ------------------
  |  Branch (1852:29): [True: 1, False: 2]
  ------------------
 1853|      1|                        {
 1854|      1|                            nTGroupEqu[k] = nCurTGroupNumber;
 1855|      1|                            nNumFoundEqu++;
 1856|      1|                        }
 1857|      3|                    }
 1858|      4|                    for (k = 0; k < *nNumEndPoints; k++)
  ------------------
  |  Branch (1858:33): [True: 3, False: 1]
  ------------------
 1859|      3|                    {
 1860|      3|                        if (EndPoint[k].nEquNumber == nMaxTGroupNumber)
  ------------------
  |  Branch (1860:29): [True: 1, False: 2]
  ------------------
 1861|      1|                        {
 1862|      1|                            EndPoint[k].nEquNumber = nCurTGroupNumber;
 1863|      1|                        }
 1864|      3|                    }
 1865|      1|                }
 1866|  7.12k|                else
 1867|  7.12k|                {
 1868|  7.12k|                    if (nTGroupEqu[i])
  ------------------
  |  Branch (1868:25): [True: 1.19k, False: 5.93k]
  ------------------
 1869|  1.19k|                    { /* extend existing t-group */
 1870|  1.19k|                        nTGroupEqu[j] = nTGroupEqu[i];
 1871|  1.19k|                        EndPoint[nTGEndPointNo[j]].nEquNumber = nTGroupEqu[i];
 1872|  1.19k|                    }
 1873|  5.93k|                    else
 1874|  5.93k|                    {
 1875|  5.93k|                        if (nTGroupEqu[j])
  ------------------
  |  Branch (1875:29): [True: 440, False: 5.49k]
  ------------------
 1876|    440|                        { /* extend existing t-group */
 1877|    440|                            nTGroupEqu[i] = nTGroupEqu[j];
 1878|    440|                            EndPoint[nTGEndPointNo[i]].nEquNumber = nTGroupEqu[j];
 1879|    440|                        }
 1880|  5.49k|                        else
 1881|  5.49k|                        { /* establis a new t-group */
 1882|  5.49k|                            nTGroupEqu[i] =
 1883|  5.49k|                                nTGroupEqu[j] = nMaxEquNumber; /* assign a fict. ID to establish equivalence */
 1884|  5.49k|                            EndPoint[nTGEndPointNo[i]].nEquNumber =
 1885|  5.49k|                                EndPoint[nTGEndPointNo[j]].nEquNumber = nMaxEquNumber;
 1886|  5.49k|                            nMaxEquNumber++;
 1887|  5.49k|                        }
 1888|  5.93k|                    }
 1889|  7.12k|                }
 1890|  7.12k|            }
 1891|  8.61k|        }
 1892|  46.6k|    }
 1893|       |
 1894|       |    /* eliminate endpoints and bonds that do not belong to t-group(s)
 1895|       |    (they have not been found connected by an alt path to any other endpoint)
 1896|       |    */
 1897|   128k|    for (i = 0, j = 0; i < *nNumEndPoints; i++)
  ------------------
  |  Branch (1897:24): [True: 88.7k, False: 39.3k]
  ------------------
 1898|  88.7k|    {
 1899|  88.7k|        if (EndPoint[i].nEquNumber)
  ------------------
  |  Branch (1899:13): [True: 88.4k, False: 300]
  ------------------
 1900|  88.4k|        {
 1901|  88.4k|#if ( IGNORE_SINGLE_ENDPOINTS == 1 )  /* 1-28-2003 */
 1902|   298k|            for (k = 0, nNumFoundEqu = 0; k < *nNumEndPoints; k++)
  ------------------
  |  Branch (1902:43): [True: 209k, False: 88.4k]
  ------------------
 1903|   209k|            {
 1904|   209k|                nNumFoundEqu += ( EndPoint[i].nEquNumber == EndPoint[k].nEquNumber );
 1905|   209k|            }
 1906|  88.4k|            if (nNumFoundEqu <= 1)
  ------------------
  |  Branch (1906:17): [True: 66, False: 88.4k]
  ------------------
 1907|     66|            {
 1908|       |                /* one time it is equal to itself when i == k above */
 1909|       |                /* if EndPoint[i] is not "equivalent" to any other EndPoint then ignore it */
 1910|     66|                continue;
 1911|     66|            }
 1912|  88.4k|#endif
 1913|  88.4k|            if (i != j)
  ------------------
  |  Branch (1913:17): [True: 143, False: 88.2k]
  ------------------
 1914|    143|            {
 1915|       |                /* save endpoints that are found to be connected to other endpoints by alt paths */
 1916|    143|                EndPoint[j] = EndPoint[i];
 1917|    143|                BondPos[j] = BondPos[i];
 1918|    143|            }
 1919|  88.4k|            j++;
 1920|  88.4k|        }
 1921|  88.7k|    }
 1922|       |
 1923|       |#if ( IGNORE_SINGLE_ENDPOINTS != 1 )  /* 1-28-2003 */
 1924|       |    /* Do not allow a centerpoint to have only one tautomeric bond */
 1925|       |    /* Hack: we may have only one centerpoint */
 1926|       |    /* BondPos[*].nAtomNumber are centerpoints */
 1927|       |    if (j == 1)
 1928|       |    {
 1929|       |        /* check if there exist other centerpoint neighbors
 1930|       |        * connected to it by another tautomeric-bond
 1931|       |        */
 1932|       |        for (i = 0, k = 0; i < at[BondPos[0].nAtomNumber].valence; i++)
 1933|       |        {
 1934|       |            k += ( i != BondPos[0].neighbor_index &&
 1935|       |                   BOND_TAUTOM == ( at[BondPos[0].nAtomNumber].bond_type[i] & ~BOND_MARK_ALL ) );
 1936|       |        }
 1937|       |        if (!k)
 1938|       |        {
 1939|       |            j = 0;
 1940|       |        }
 1941|       |    }
 1942|       |#endif
 1943|       |
 1944|  39.3k|    *nNumEndPoints = *nNumBondPos = j;
 1945|       |
 1946|  39.3k|    return j;
 1947|  39.3k|}
bCanBeACPoint:
 2019|   135k|{
 2020|   135k|    int nChangeValence;
 2021|   135k|    int nNumBonds;
 2022|   135k|    int nBondsValence;
 2023|   135k|    int bNegCharge = ( at->charge == -1 );  /* add fict. bonds to (-) 2004-02-24*/
 2024|       |
 2025|   135k|    if (at->charge == cCharge && at->valence == at->chem_bonds_valence && at->num_H)
  ------------------
  |  Branch (2025:9): [True: 12.8k, False: 122k]
  |  Branch (2025:34): [True: 222, False: 12.6k]
  |  Branch (2025:75): [True: 71, False: 151]
  ------------------
 2026|     71|    {
 2027|       |        /* proton donors candidates >NH(+)-, >NH2(+), -NH3(+), >OH(+), -OH2(+) */
 2028|       |        /* charged, added p-transfer -- 01-28-2004 */
 2029|     71|        nChangeValence = at->charge * cChangeValence; /* +1 or -1; currently only +1 */
 2030|     71|        nBondsValence = at->chem_bonds_valence + at->num_H;
 2031|     71|        if (nBondsValence == neutral_bonds_valence + nChangeValence && nEndpointValence)
  ------------------
  |  Branch (2031:13): [True: 53, False: 18]
  |  Branch (2031:72): [True: 49, False: 4]
  ------------------
 2032|     49|        {
 2033|     49|            *cChargeSubtype = C_SUBTYPE_CHARGED_p_DONOR; /* ignore Phosphorus p-donors for now */
  ------------------
  |  | 1998|     49|#define C_SUBTYPE_CHARGED_p_DONOR           (C_SUBTYPE_CHARGED|C_SUBTYPE_p_DONOR)
  |  |  ------------------
  |  |  |  | 1988|     49|#define C_SUBTYPE_CHARGED     0
  |  |  ------------------
  |  |               #define C_SUBTYPE_CHARGED_p_DONOR           (C_SUBTYPE_CHARGED|C_SUBTYPE_p_DONOR)
  |  |  ------------------
  |  |  |  | 1989|     49|#define C_SUBTYPE_p_DONOR     1  /* new */
  |  |  ------------------
  ------------------
 2034|     49|        }
 2035|     71|        return 0;
 2036|     71|    }
 2037|       |
 2038|   135k|    else
 2039|   135k|    {
 2040|   135k|        if (at->charge == cCharge && at->valence < at->chem_bonds_valence)
  ------------------
  |  Branch (2040:13): [True: 12.8k, False: 122k]
  |  Branch (2040:38): [True: 12.6k, False: 151]
  ------------------
 2041|  12.6k|        {
 2042|       |            /* the requirement at->valence < at->chem_bonds_valence rejects
 2043|       |            candidates >NH(+)-, >NH2(+), -NH3(+), >N(+)<, >OH(+), -OH2(+), >O(+)-
 2044|       |            Moveable charge requires double bonds; these ions have no double bonds
 2045|       |            */
 2046|       |
 2047|       |            /* charged */
 2048|  12.6k|            nChangeValence = at->charge * cChangeValence; /* +1 or -1; currently only +1 */
 2049|  12.6k|            nBondsValence = at->chem_bonds_valence + at->num_H;
 2050|  12.6k|            nNumBonds = at->valence + at->num_H;
 2051|  12.6k|            if (nBondsValence == neutral_bonds_valence + nChangeValence)
  ------------------
  |  Branch (2051:17): [True: 12.1k, False: 534]
  ------------------
 2052|  12.1k|            {
 2053|       |                /* known valence */
 2054|  12.1k|                if (nNumBonds == neutral_valence)
  ------------------
  |  Branch (2054:21): [True: 2.58k, False: 9.53k]
  ------------------
 2055|  2.58k|                {
 2056|       |                    /* non-tautomeric: >N(+)=, =O(+)-
 2057|       |                    possibly tautomeric donor: =NH(+)-, =NH2(+), =OH(+) */
 2058|  2.58k|                    if (at->valence == neutral_valence || !nEndpointValence)
  ------------------
  |  Branch (2058:25): [True: 1.05k, False: 1.52k]
  |  Branch (2058:59): [True: 11, False: 1.51k]
  ------------------
 2059|  1.06k|                    {
 2060|       |                        /* non-tautomeric: >N(+)=, =O(+)-; any suitable P+: >P(+)=, =PH(+)-, =PH2(+) */
 2061|  1.06k|                        *cChargeSubtype = C_SUBTYPE_CHARGED_NON_TAUT;
  ------------------
  |  | 1997|  1.06k|#define C_SUBTYPE_CHARGED_NON_TAUT          (C_SUBTYPE_CHARGED)
  |  |  ------------------
  |  |  |  | 1988|  1.06k|#define C_SUBTYPE_CHARGED     0
  |  |  ------------------
  ------------------
 2062|  1.06k|                    }
 2063|  1.51k|                    else
 2064|  1.51k|                    {
 2065|       |                        /* possibly tautomeric donor: =NH(+)-, =NH2(+), =OH(+) */
 2066|  1.51k|                        *cChargeSubtype = C_SUBTYPE_CHARGED_H_DONOR;
  ------------------
  |  | 2001|  1.51k|#define C_SUBTYPE_CHARGED_H_DONOR           (C_SUBTYPE_CHARGED|C_SUBTYPE_H_DONOR |C_SUBTYPE_p_DONOR)
  |  |  ------------------
  |  |  |  | 1988|  1.51k|#define C_SUBTYPE_CHARGED     0
  |  |  ------------------
  |  |               #define C_SUBTYPE_CHARGED_H_DONOR           (C_SUBTYPE_CHARGED|C_SUBTYPE_H_DONOR |C_SUBTYPE_p_DONOR)
  |  |  ------------------
  |  |  |  | 1992|  1.51k|#define C_SUBTYPE_H_DONOR     8
  |  |  ------------------
  |  |               #define C_SUBTYPE_CHARGED_H_DONOR           (C_SUBTYPE_CHARGED|C_SUBTYPE_H_DONOR |C_SUBTYPE_p_DONOR)
  |  |  ------------------
  |  |  |  | 1989|  1.51k|#define C_SUBTYPE_p_DONOR     1  /* new */
  |  |  ------------------
  ------------------
 2067|  1.51k|                    }
 2068|  2.58k|                    return 1;
 2069|  2.58k|                }
 2070|  9.53k|                if (nNumBonds == neutral_valence - 1)
  ------------------
  |  Branch (2070:21): [True: 9.53k, False: 0]
  ------------------
 2071|  9.53k|                {
 2072|       |                    /* possibly tutomeric acceptor: =N(+)=, #N(+)-, #NH(+), #O(+) */
 2073|  9.53k|                    if (nEndpointValence)
  ------------------
  |  Branch (2073:25): [True: 8.63k, False: 904]
  ------------------
 2074|  8.63k|                    {
 2075|  8.63k|                        *cChargeSubtype = at->num_H ? C_SUBTYPE_CHARGED_H_ACCEPT_p_DONOR : C_SUBTYPE_CHARGED_H_ACCEPT;
  ------------------
  |  | 2000|     23|#define C_SUBTYPE_CHARGED_H_ACCEPT_p_DONOR  (C_SUBTYPE_CHARGED|C_SUBTYPE_H_ACCEPT|C_SUBTYPE_p_DONOR)
  |  |  ------------------
  |  |  |  | 1988|     23|#define C_SUBTYPE_CHARGED     0
  |  |  ------------------
  |  |               #define C_SUBTYPE_CHARGED_H_ACCEPT_p_DONOR  (C_SUBTYPE_CHARGED|C_SUBTYPE_H_ACCEPT|C_SUBTYPE_p_DONOR)
  |  |  ------------------
  |  |  |  | 1991|     23|#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)
  |  |  ------------------
  |  |  |  | 1989|     23|#define C_SUBTYPE_p_DONOR     1  /* new */
  |  |  ------------------
  ------------------
                                      *cChargeSubtype = at->num_H ? C_SUBTYPE_CHARGED_H_ACCEPT_p_DONOR : C_SUBTYPE_CHARGED_H_ACCEPT;
  ------------------
  |  | 1999|  17.2k|#define C_SUBTYPE_CHARGED_H_ACCEPT          (C_SUBTYPE_CHARGED|C_SUBTYPE_H_ACCEPT)
  |  |  ------------------
  |  |  |  | 1988|  8.61k|#define C_SUBTYPE_CHARGED     0
  |  |  ------------------
  |  |               #define C_SUBTYPE_CHARGED_H_ACCEPT          (C_SUBTYPE_CHARGED|C_SUBTYPE_H_ACCEPT)
  |  |  ------------------
  |  |  |  | 1991|  8.61k|#define C_SUBTYPE_H_ACCEPT    4
  |  |  ------------------
  ------------------
  |  Branch (2075:43): [True: 23, False: 8.61k]
  ------------------
 2076|  8.63k|                    }
 2077|    904|                    else
 2078|    904|                    {
 2079|       |                        /* =P(+)=, #P(+)-, #PH(+) */
 2080|    904|                        *cChargeSubtype = C_SUBTYPE_CHARGED_NON_TAUT;
  ------------------
  |  | 1997|    904|#define C_SUBTYPE_CHARGED_NON_TAUT          (C_SUBTYPE_CHARGED)
  |  |  ------------------
  |  |  |  | 1988|    904|#define C_SUBTYPE_CHARGED     0
  |  |  ------------------
  ------------------
 2081|    904|                    }
 2082|  9.53k|                    return 1; /* charge type, charged */
 2083|  9.53k|                }
 2084|  9.53k|            }
 2085|  12.6k|        }
 2086|   122k|        else
 2087|   122k|        {
 2088|   122k|            if (at->charge == 0 || bNegCharge)
  ------------------
  |  Branch (2088:17): [True: 107k, False: 14.9k]
  |  Branch (2088:36): [True: 14.7k, False: 151]
  ------------------
 2089|   122k|            {
 2090|       |                /* neutral atom or anion, all bonds are single */
 2091|   122k|                nBondsValence = at->chem_bonds_valence + at->num_H + bNegCharge; /* add fict. bonds to (-) 2004-02-24*/
 2092|   122k|                nNumBonds = at->valence + at->num_H + bNegCharge; /* add fict. bonds to (-) 2004-02-24*/
 2093|   122k|                if (nBondsValence == neutral_bonds_valence)
  ------------------
  |  Branch (2093:21): [True: 51.4k, False: 71.1k]
  ------------------
 2094|  51.4k|                {
 2095|  51.4k|                    if (nNumBonds == neutral_valence)
  ------------------
  |  Branch (2095:25): [True: 10.8k, False: 40.5k]
  ------------------
 2096|  10.8k|                    {
 2097|       |                        /* only single bonds: >N-, >NH, -NH2, -O-, -OH, >P- >PH -PH2 */
 2098|       |                        /*                    >N(-), -NH(-), -O(-). >P(-) -PH(-) */
 2099|  10.8k|                        {
 2100|  10.8k|                            if (at->valence == neutral_valence || !nEndpointValence)
  ------------------
  |  Branch (2100:33): [True: 4.90k, False: 5.94k]
  |  Branch (2100:67): [True: 521, False: 5.42k]
  ------------------
 2101|  5.42k|                            {
 2102|       |                                /* >N-, -O-, any P(3 single bonds): >P- >PH -PH2  */
 2103|  5.42k|                                *cChargeSubtype = C_SUBTYPE_NEUTRAL_NON_TAUT;
  ------------------
  |  | 2003|  5.42k|#define C_SUBTYPE_NEUTRAL_NON_TAUT          (C_SUBTYPE_NEUTRAL)
  |  |  ------------------
  |  |  |  | 1993|  5.42k|#define C_SUBTYPE_NEUTRAL    16
  |  |  ------------------
  ------------------
 2104|  5.42k|                            }
 2105|  5.42k|                            else
 2106|  5.42k|                            {
 2107|  5.42k|                                if (at->valence < neutral_valence /*&& nEndpointValence */)
  ------------------
  |  Branch (2107:37): [True: 5.41k, False: 6]
  ------------------
 2108|  5.41k|                                {
 2109|       |                                    /* num_H > 0: >NH -NH2 -OH */
 2110|       |                                    /* num_H = 0: none C_SUBTYPE_NEUTRAL_H_ACCEPT for now */
 2111|  5.41k|                                    *cChargeSubtype = at->num_H ? C_SUBTYPE_NEUTRAL_H_DONOR : C_SUBTYPE_NEUTRAL_H_ACCEPT;
  ------------------
  |  | 2006|  2.80k|#define C_SUBTYPE_NEUTRAL_H_DONOR           (C_SUBTYPE_NEUTRAL|C_SUBTYPE_H_DONOR)
  |  |  ------------------
  |  |  |  | 1993|  2.80k|#define C_SUBTYPE_NEUTRAL    16
  |  |  ------------------
  |  |               #define C_SUBTYPE_NEUTRAL_H_DONOR           (C_SUBTYPE_NEUTRAL|C_SUBTYPE_H_DONOR)
  |  |  ------------------
  |  |  |  | 1992|  2.80k|#define C_SUBTYPE_H_DONOR     8
  |  |  ------------------
  ------------------
                                                  *cChargeSubtype = at->num_H ? C_SUBTYPE_NEUTRAL_H_DONOR : C_SUBTYPE_NEUTRAL_H_ACCEPT;
  ------------------
  |  | 2004|  8.02k|#define C_SUBTYPE_NEUTRAL_H_ACCEPT          (C_SUBTYPE_NEUTRAL|C_SUBTYPE_H_ACCEPT)
  |  |  ------------------
  |  |  |  | 1993|  2.61k|#define C_SUBTYPE_NEUTRAL    16
  |  |  ------------------
  |  |               #define C_SUBTYPE_NEUTRAL_H_ACCEPT          (C_SUBTYPE_NEUTRAL|C_SUBTYPE_H_ACCEPT)
  |  |  ------------------
  |  |  |  | 1991|  2.61k|#define C_SUBTYPE_H_ACCEPT    4
  |  |  ------------------
  ------------------
  |  Branch (2111:55): [True: 2.80k, False: 2.61k]
  ------------------
 2112|  5.41k|                                }
 2113|      6|                                else
 2114|      6|                                {
 2115|      6|                                    return 0;
 2116|      6|                                }
 2117|  5.42k|                            }
 2118|  10.8k|                        }
 2119|  10.8k|                        return 1; /* charge type, neutral */
 2120|  10.8k|                    }
 2121|  40.5k|                    if (nNumBonds == neutral_valence - 1)
  ------------------
  |  Branch (2121:25): [True: 33.7k, False: 6.84k]
  ------------------
 2122|  33.7k|                    {
 2123|       |                        /* possibly tautomeric acceptor =N-, =NH, =O or non-taut =P-, =PH */
 2124|  33.7k|                        if (nEndpointValence)
  ------------------
  |  Branch (2124:29): [True: 30.9k, False: 2.74k]
  ------------------
 2125|  30.9k|                        {
 2126|       |                            /* =N-,  =NH, =O  */
 2127|  30.9k|                            *cChargeSubtype = C_SUBTYPE_NEUTRAL_H_ACCEPT_p_ACCEPT;
  ------------------
  |  | 2005|  30.9k|#define C_SUBTYPE_NEUTRAL_H_ACCEPT_p_ACCEPT (C_SUBTYPE_NEUTRAL|C_SUBTYPE_H_ACCEPT|C_SUBTYPE_p_ACCEPT)
  |  |  ------------------
  |  |  |  | 1993|  30.9k|#define C_SUBTYPE_NEUTRAL    16
  |  |  ------------------
  |  |               #define C_SUBTYPE_NEUTRAL_H_ACCEPT_p_ACCEPT (C_SUBTYPE_NEUTRAL|C_SUBTYPE_H_ACCEPT|C_SUBTYPE_p_ACCEPT)
  |  |  ------------------
  |  |  |  | 1991|  30.9k|#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)
  |  |  ------------------
  |  |  |  | 1990|  30.9k|#define C_SUBTYPE_p_ACCEPT    2  /* new */
  |  |  ------------------
  ------------------
 2128|  30.9k|                        }
 2129|  2.74k|                        else
 2130|  2.74k|                        {
 2131|       |                            /* =P-, =PH */
 2132|  2.74k|                            *cChargeSubtype = C_SUBTYPE_NEUTRAL_NON_TAUT;
  ------------------
  |  | 2003|  2.74k|#define C_SUBTYPE_NEUTRAL_NON_TAUT          (C_SUBTYPE_NEUTRAL)
  |  |  ------------------
  |  |  |  | 1993|  2.74k|#define C_SUBTYPE_NEUTRAL    16
  |  |  ------------------
  ------------------
 2133|  2.74k|                        }
 2134|  33.7k|                        return 1; /* charge type, (+) => neutral */
 2135|  33.7k|                    }
 2136|  40.5k|                }
 2137|   122k|            }
 2138|   122k|        }
 2139|   135k|    }
 2140|       |
 2141|  78.6k|    return 0;
 2142|   135k|}
GetChargeType:
 2147|   947k|{
 2148|   947k|    int i, n;
 2149|   947k|    S_CHAR    nEndpointValence;
 2150|   947k|    inp_ATOM *at = atom + iat;
 2151|       |
 2152|   947k|    *cChargeSubtype = 0;
 2153|       |    /* ignore ion pairs and charges != 1 */
 2154|   947k|    if (abs( at->charge ) == 1)
  ------------------
  |  Branch (2154:9): [True: 89.5k, False: 858k]
  ------------------
 2155|  89.5k|    {
 2156|   200k|        for (i = 0; i < at->valence; i++)
  ------------------
  |  Branch (2156:21): [True: 131k, False: 68.7k]
  ------------------
 2157|   131k|        {
 2158|   131k|            n = at->neighbor[i];
 2159|       |            /* allow negatively charged tautomeric neighbors 2004-02-26 */
 2160|   131k|            if (abs( atom[n].charge + at->charge ) < abs( atom[n].charge - at->charge ) && !atom[n].endpoint)
  ------------------
  |  Branch (2160:17): [True: 21.9k, False: 109k]
  |  Branch (2160:92): [True: 20.8k, False: 1.08k]
  ------------------
 2161|  20.8k|            {
 2162|  20.8k|                return -1; /* charges have different signs */
 2163|  20.8k|            }
 2164|   131k|        }
 2165|  89.5k|    }
 2166|   858k|    else
 2167|   858k|    {
 2168|   858k|        if (at->charge)
  ------------------
  |  Branch (2168:13): [True: 4.62k, False: 853k]
  ------------------
 2169|  4.62k|        {
 2170|  4.62k|            return -1; /* abs(charge) != 1 */
 2171|  4.62k|        }
 2172|   858k|    }
 2173|       |
 2174|       |    /* find candidates */
 2175|  6.12M|    for (i = 0; i < NUM_C_TYPES; i++)
  ------------------
  |  | 2008|  6.12M|#define NUM_C_TYPES  (int)(sizeof( CType )/sizeof(CType[0]))
  ------------------
  |  Branch (2175:17): [True: 5.25M, False: 865k]
  ------------------
 2176|  5.25M|    {
 2177|  5.25M|        if (!strcmp( at->elname, CType[i].elname ) &&
  ------------------
  |  Branch (2177:13): [True: 372k, False: 4.88M]
  ------------------
 2178|   372k|            ( !CType[i].num_bonds || (CType[i].num_bonds == at->valence && at->nNumAtInRingSystem >= 5) )) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2178:15): [True: 133k, False: 238k]
  |  Branch (2178:39): [True: 13.8k, False: 225k]
  |  Branch (2178:76): [True: 2.27k, False: 11.5k]
  ------------------
 2179|   135k|        {
 2180|   135k|            nEndpointValence = (S_CHAR) get_endpoint_valence( at->el_number );
 2181|   135k|            if (bCanBeACPoint( at, CType[i].charge, CType[i].cChangeValence, CType[i].neutral_bonds_valence,
  ------------------
  |  Branch (2181:17): [True: 56.6k, False: 78.7k]
  ------------------
 2182|   135k|                               CType[i].neutral_valence, nEndpointValence, cChargeSubtype ))
 2183|  56.6k|            {
 2184|  56.6k|                return CType[i].cChargeType;
 2185|  56.6k|            }
 2186|   135k|        }
 2187|  5.25M|    }
 2188|       |
 2189|   865k|    return -1;
 2190|   922k|}
CmpCCandidates:
 2195|  36.7k|{
 2196|  36.7k|    const C_CANDIDATE *c1 = (const C_CANDIDATE *) a1;
 2197|  36.7k|    const C_CANDIDATE *c2 = (const C_CANDIDATE *) a2;
 2198|  36.7k|    int ret;
 2199|  36.7k|    if ((ret = (int) c1->type - (int) c2->type)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2199:9): [True: 2.06k, False: 34.7k]
  ------------------
 2200|  2.06k|    {
 2201|  2.06k|        return ret;
 2202|  2.06k|    }
 2203|  34.7k|    if ((ret = (int) c1->subtype - (int) c2->subtype)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2203:9): [True: 15.4k, False: 19.2k]
  ------------------
 2204|  15.4k|    {
 2205|  15.4k|        return ret;
 2206|  15.4k|    }
 2207|  19.2k|    ret = (int) c1->atnumber - (int) c2->atnumber;
 2208|       |
 2209|  19.2k|    return ret;
 2210|  34.7k|}
RegisterCPoints:
 2223|  1.28k|{
 2224|  1.28k|    int num_c = *pnum_c, i, i1, i2;
 2225|  1.28k|    AT_NUMB nGroupNumber = 0, nNewGroupNumber;
 2226|       |
 2227|  1.28k|    if (at[point1].c_point == at[point2].c_point)
  ------------------
  |  Branch (2227:9): [True: 893, False: 387]
  ------------------
 2228|    893|    {
 2229|    893|        if (at[point1].c_point)
  ------------------
  |  Branch (2229:13): [True: 0, False: 893]
  ------------------
 2230|      0|        {
 2231|      0|            return 0;
 2232|      0|        }
 2233|    893|        memset( c_group + num_c, 0, sizeof( c_group[0] ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 2234|    893|        if (num_c < max_num_c)
  ------------------
  |  Branch (2234:13): [True: 893, False: 0]
  ------------------
 2235|    893|        {
 2236|    893|            c_group[num_c].num[0] = CHARGED_CPOINT( at, point1 ) + CHARGED_CPOINT( at, point2 );
  ------------------
  |  |  253|    893|#define CHARGED_CPOINT(X,i) ((X)[i].charge==1)
  ------------------
                          c_group[num_c].num[0] = CHARGED_CPOINT( at, point1 ) + CHARGED_CPOINT( at, point2 );
  ------------------
  |  |  253|    893|#define CHARGED_CPOINT(X,i) ((X)[i].charge==1)
  ------------------
 2237|    893|            c_group[num_c].num_CPoints += 2;
 2238|    893|            c_group[num_c].cGroupType = ctype;
 2239|       |            /* get next available c-group number */
 2240|    968|            for (i = 0; i < num_c; i++)
  ------------------
  |  Branch (2240:25): [True: 75, False: 893]
  ------------------
 2241|     75|            {
 2242|     75|                if (nGroupNumber < c_group[i].nGroupNumber)
  ------------------
  |  Branch (2242:21): [True: 75, False: 0]
  ------------------
 2243|     75|                {
 2244|     75|                    nGroupNumber = c_group[i].nGroupNumber;
 2245|     75|                }
 2246|     75|            }
 2247|    893|            nGroupNumber++;
 2248|    893|            c_group[num_c].nGroupNumber =
 2249|    893|                at[point1].c_point =
 2250|    893|                at[point2].c_point = nGroupNumber;
 2251|    893|            *pnum_c = num_c + 1;
 2252|       |            /* count protons */
 2253|    893|            if (at[point1].num_H)
  ------------------
  |  Branch (2253:17): [True: 153, False: 740]
  ------------------
 2254|    153|            {
 2255|    153|                c_group[num_c].num[1] ++;
 2256|    153|            }
 2257|    740|            else
 2258|    740|            {
 2259|    740|                if (at[point2].num_H)
  ------------------
  |  Branch (2259:21): [True: 58, False: 682]
  ------------------
 2260|     58|                {
 2261|     58|                    c_group[num_c].num[1] ++;
 2262|     58|                }
 2263|    682|                else
 2264|    682|                {
 2265|    682|                    if (( at[point1].endpoint || at[point2].endpoint ) && t_group_info && t_group_info->t_group && t_group_info->num_t_groups)
  ------------------
  |  Branch (2265:27): [True: 0, False: 682]
  |  Branch (2265:50): [True: 8, False: 674]
  |  Branch (2265:75): [True: 8, False: 0]
  |  Branch (2265:91): [True: 8, False: 0]
  |  Branch (2265:116): [True: 8, False: 0]
  ------------------
 2266|      8|                    {
 2267|       |                        /* !!! add later !!! */
 2268|      8|                    }
 2269|    682|                }
 2270|    740|            }
 2271|    893|            return 1;
 2272|    893|        }
 2273|       |
 2274|      0|        return BNS_CPOINT_ERR; /* overflow */
  ------------------
  |  |   56|      0|#define BNS_CPOINT_ERR     (BNS_ERR +  8) /*(-9991)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2275|    893|    }
 2276|       |
 2277|    387|    if (at[point1].c_point > at[point2].c_point)
  ------------------
  |  Branch (2277:9): [True: 274, False: 113]
  ------------------
 2278|    274|    {
 2279|       |        /* make sure at[point1].c_point < at[point2].c_point */
 2280|    274|        i = point1;
 2281|    274|        point1 = point2;
 2282|    274|        point2 = i;
 2283|    274|    }
 2284|       |
 2285|    387|    if (!at[point1].c_point)
  ------------------
  |  Branch (2285:9): [True: 355, False: 32]
  ------------------
 2286|    355|    {
 2287|       |        /* add a new c-endpoint to an existing c-group */
 2288|    355|        nGroupNumber = at[point2].c_point;
 2289|    406|        for (i = 0; i < num_c; i++)
  ------------------
  |  Branch (2289:21): [True: 406, False: 0]
  ------------------
 2290|    406|        {
 2291|    406|            if (nGroupNumber == c_group[i].nGroupNumber)
  ------------------
  |  Branch (2291:17): [True: 355, False: 51]
  ------------------
 2292|    355|            {
 2293|    355|                at[point1].c_point = at[point2].c_point;
 2294|    355|                c_group[i].num_CPoints++;
 2295|    355|                c_group[i].num[0] += CHARGED_CPOINT( at, point1 );
  ------------------
  |  |  253|    355|#define CHARGED_CPOINT(X,i) ((X)[i].charge==1)
  ------------------
 2296|    355|                return 1;
 2297|    355|            }
 2298|    406|        }
 2299|      0|        return BNS_CPOINT_ERR; /* program error: c-group not found */
  ------------------
  |  |   56|      0|#define BNS_CPOINT_ERR     (BNS_ERR +  8) /*(-9991)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2300|    355|    }
 2301|     32|    else
 2302|     32|    {
 2303|       |        /* merge two c-groups */
 2304|     32|        nNewGroupNumber = at[point1].c_point;
 2305|     32|        nGroupNumber = at[point2].c_point;
 2306|    108|        for (i = 0, i1 = i2 = -1; i < num_c && ( i1 < 0 || i2 < 0 ); i++)
  ------------------
  |  Branch (2306:35): [True: 77, False: 31]
  |  Branch (2306:50): [True: 35, False: 42]
  |  Branch (2306:60): [True: 41, False: 1]
  ------------------
 2307|     76|        {
 2308|     76|            if (nNewGroupNumber == c_group[i].nGroupNumber)
  ------------------
  |  Branch (2308:17): [True: 32, False: 44]
  ------------------
 2309|     32|            {
 2310|     32|                i1 = i;
 2311|     32|                continue;
 2312|     32|            }
 2313|     44|            if (nGroupNumber == c_group[i].nGroupNumber)
  ------------------
  |  Branch (2313:17): [True: 32, False: 12]
  ------------------
 2314|     32|            {
 2315|     32|                i2 = i;
 2316|     32|                continue;
 2317|     32|            }
 2318|     44|        }
 2319|     32|        if (i1 < 0 || i2 < 0)
  ------------------
  |  Branch (2319:13): [True: 0, False: 32]
  |  Branch (2319:23): [True: 0, False: 32]
  ------------------
 2320|      0|        {
 2321|      0|            return BNS_CPOINT_ERR; /* at least one not found */
  ------------------
  |  |   56|      0|#define BNS_CPOINT_ERR     (BNS_ERR +  8) /*(-9991)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2322|      0|        }
 2323|       |
 2324|     32|        c_group[i1].num[0] += c_group[i2].num[0];
 2325|     32|        c_group[i1].num_CPoints += c_group[i2].num_CPoints;
 2326|     32|        num_c--;
 2327|     32|        if (num_c > i2)
  ------------------
  |  Branch (2327:13): [True: 1, False: 31]
  ------------------
 2328|      1|        {
 2329|      1|            memmove(c_group + i2, c_group + i2 + 1, ((long long)num_c - i2) * sizeof(c_group[0])); /* djb-rwth: cast operators added */
 2330|      1|        }
 2331|     32|        *pnum_c = num_c;
 2332|       |        /* renumber c-groups */
 2333|     77|        for (i = 0; i < num_c; i++)
  ------------------
  |  Branch (2333:21): [True: 45, False: 32]
  ------------------
 2334|     45|        {
 2335|     45|            if (c_group[i].nGroupNumber > nGroupNumber)
  ------------------
  |  Branch (2335:17): [True: 1, False: 44]
  ------------------
 2336|      1|            {
 2337|      1|                c_group[i].nGroupNumber--;
 2338|      1|            }
 2339|     45|        }
 2340|       |        /* renumber c-points */
 2341|    276|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (2341:21): [True: 244, False: 32]
  ------------------
 2342|    244|        {
 2343|    244|            if (at[i].c_point > nGroupNumber)
  ------------------
  |  Branch (2343:17): [True: 3, False: 241]
  ------------------
 2344|      3|            {
 2345|      3|                at[i].c_point--;
 2346|      3|            }
 2347|    241|            else
 2348|    241|            {
 2349|    241|                if (at[i].c_point == nGroupNumber)
  ------------------
  |  Branch (2349:21): [True: 81, False: 160]
  ------------------
 2350|     81|                {
 2351|     81|                    at[i].c_point = nNewGroupNumber;
 2352|     81|                }
 2353|    241|            }
 2354|    244|        }
 2355|     32|        return 1;
 2356|     32|    }
 2357|       |
 2358|    387|}
MarkChargeGroups:
 2369|   294k|{
 2370|   294k|    int nNumChanges = 0;
 2371|       |
 2372|   294k|    if (c_group_info && c_group_info->c_candidate && c_group_info->max_num_candidates > 0)
  ------------------
  |  Branch (2372:9): [True: 294k, False: 0]
  |  Branch (2372:25): [True: 109k, False: 184k]
  |  Branch (2372:54): [True: 109k, False: 0]
  ------------------
 2373|   109k|    {
 2374|   109k|        int i, i1, i2, i3, j, num_tested;
 2375|   109k|        C_CANDIDATE *c_candidate = c_group_info->c_candidate;
 2376|   109k|        int          nMaxNumCandidates = c_group_info->max_num_candidates;
 2377|   109k|        int          nNumCandidates = c_group_info->num_candidates;
 2378|   109k|        S_CHAR       c_type, c_subtype;
 2379|   109k|        int          iat1, iat2, ret, nDelta;
 2380|       |
 2381|   109k|        if (nNumCandidates == -1)
  ------------------
  |  Branch (2381:13): [True: 5.26k, False: 104k]
  ------------------
 2382|  5.26k|        {
 2383|  5.26k|            nNumCandidates = 0; /* 2004-02-26 they could appear after t-group discovery */
 2384|       |                                /*return 0;*/
 2385|  5.26k|        }
 2386|   109k|        if (nNumCandidates == 0)
  ------------------
  |  Branch (2386:13): [True: 108k, False: 1.14k]
  ------------------
 2387|   108k|        {
 2388|  1.05M|            for (i = 0, nNumCandidates = 0; i < num_atoms; i++)
  ------------------
  |  Branch (2388:45): [True: 941k, False: 108k]
  ------------------
 2389|   941k|            {
 2390|   941k|                if (0 <= ( c_type = GetChargeType( at, i, &c_subtype ) ))
  ------------------
  |  Branch (2390:21): [True: 50.7k, False: 890k]
  ------------------
 2391|  50.7k|                {
 2392|  50.7k|                    if (nNumCandidates >= nMaxNumCandidates)
  ------------------
  |  Branch (2392:25): [True: 0, False: 50.7k]
  ------------------
 2393|      0|                    {
 2394|      0|                        return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2395|      0|                    }
 2396|  50.7k|                    c_candidate[nNumCandidates].atnumber = i;
 2397|  50.7k|                    c_candidate[nNumCandidates].type = c_type;
 2398|  50.7k|                    c_candidate[nNumCandidates].subtype = c_subtype;
 2399|  50.7k|                    nNumCandidates++;
 2400|  50.7k|                }
 2401|   941k|            }
 2402|   108k|            if (nNumCandidates <= 1)
  ------------------
  |  Branch (2402:17): [True: 95.3k, False: 13.4k]
  ------------------
 2403|  95.3k|            {
 2404|  95.3k|                c_group_info->num_candidates = -1; /* no candidate exists */
 2405|  95.3k|                return 0;
 2406|  95.3k|            }
 2407|   108k|        }
 2408|       |        /* sorting keys: (1) atom type (N,P); (2) uncharged=16/charged=0; (3) other;
 2409|       |        atom-charged-N .... i1
 2410|       |        ...
 2411|       |        atom-charged-N
 2412|       |        atom-neutral-N .... i2
 2413|       |        ...
 2414|       |        atom-neutral-N
 2415|       |        atom-charged-P .... i3 ... i1
 2416|       |        ...
 2417|       |        atom-charged-P
 2418|       |        atom-neutral-P ........... i2
 2419|       |        ...
 2420|       |        atom-neutral-P
 2421|       |        end.           ........... i3
 2422|       |        */
 2423|       |
 2424|  14.6k|        qsort( c_candidate, nNumCandidates, sizeof( c_candidate[0] ), CmpCCandidates );
 2425|       |
 2426|  14.6k|        i1 = 0;
 2427|  14.6k|        num_tested = 0;
 2428|       |        /* djb-rwth: removing redundant code */
 2429|       |
 2430|  19.4k|        while (i1 < nNumCandidates)
  ------------------
  |  Branch (2430:16): [True: 15.1k, False: 4.25k]
  ------------------
 2431|  15.1k|        {
 2432|       |            /* the the first charged candidate of a new atom type */
 2433|  42.3k|            for (; i1 < nNumCandidates && ( c_candidate[i1].subtype & C_SUBTYPE_NEUTRAL ); i1++)
  ------------------
  |  | 1993|  32.5k|#define C_SUBTYPE_NEUTRAL    16
  ------------------
  |  Branch (2433:20): [True: 32.5k, False: 9.78k]
  |  Branch (2433:43): [True: 27.1k, False: 5.38k]
  ------------------
 2434|  27.1k|            {
 2435|  27.1k|                ;
 2436|  27.1k|            }
 2437|  15.1k|            if (i1 == nNumCandidates)
  ------------------
  |  Branch (2437:17): [True: 9.78k, False: 5.38k]
  ------------------
 2438|  9.78k|            {
 2439|  9.78k|                break; /* not found */
 2440|  9.78k|            }
 2441|       |
 2442|       |            /* bypass other charged candidates of the same atom type */
 2443|  6.55k|            for (i2 = i1 + 1; i2 < nNumCandidates &&
  ------------------
  |  Branch (2443:31): [True: 5.97k, False: 583]
  ------------------
 2444|  5.97k|                  c_candidate[i2].type == c_candidate[i1].type &&
  ------------------
  |  Branch (2444:19): [True: 5.65k, False: 318]
  ------------------
 2445|  5.65k|                  !( c_candidate[i2].subtype & C_SUBTYPE_NEUTRAL );
  ------------------
  |  | 1993|  5.65k|#define C_SUBTYPE_NEUTRAL    16
  ------------------
  |  Branch (2445:19): [True: 1.17k, False: 4.48k]
  ------------------
 2446|  5.38k|                  i2++)
 2447|  1.17k|            {
 2448|  1.17k|                ;
 2449|  1.17k|            }
 2450|  5.38k|            if (i2 == nNumCandidates)
  ------------------
  |  Branch (2450:17): [True: 583, False: 4.80k]
  ------------------
 2451|    583|            {
 2452|    583|                break; /* no neutral candidates */
 2453|    583|            }
 2454|       |
 2455|       |            /* find next to the last neutral candidate of the same atom type */
 2456|  13.3k|            for (i3 = i2;  i3 < nNumCandidates &&
  ------------------
  |  Branch (2456:28): [True: 9.11k, False: 4.25k]
  ------------------
 2457|  9.11k|                  c_candidate[i3].type == c_candidate[i1].type;
  ------------------
  |  Branch (2457:19): [True: 8.56k, False: 550]
  ------------------
 2458|  8.56k|                  i3++)
 2459|  8.56k|            {
 2460|  8.56k|                ;
 2461|  8.56k|            }
 2462|       |
 2463|  4.80k|            if (i3 == i2)
  ------------------
  |  Branch (2463:17): [True: 318, False: 4.48k]
  ------------------
 2464|    318|            {
 2465|       |                /* no neutral candidates found */
 2466|    318|                if (i2 < nNumCandidates)
  ------------------
  |  Branch (2466:21): [True: 318, False: 0]
  ------------------
 2467|    318|                {
 2468|    318|                    i1 = i3;
 2469|    318|                    continue;  /* move to the next atom type */
 2470|    318|                }
 2471|      0|                break; /* nothing more to do */
 2472|    318|            }
 2473|       |
 2474|       |            /* found charged candidates: i1...i2-1;  neutral candidates: i2...i3-1 */
 2475|  9.98k|            for (i = i1; i < i2; i++)
  ------------------
  |  Branch (2475:26): [True: 5.50k, False: 4.48k]
  ------------------
 2476|  5.50k|            {
 2477|  5.50k|                iat1 = c_candidate[i].atnumber;
 2478|  16.4k|                for (j = i2; j < i3; j++)
  ------------------
  |  Branch (2478:30): [True: 10.9k, False: 5.49k]
  ------------------
 2479|  10.9k|                {
 2480|       |                    /* check alt path at[iat1]=-=-...-at[iat2]; at[iat1] is charged, at[iat2] is neutral */
 2481|  10.9k|                    num_tested++;
 2482|  10.9k|                    iat2 = c_candidate[j].atnumber;
 2483|  10.9k|                    if (at[iat1].c_point && at[iat1].c_point == at[iat2].c_point)
  ------------------
  |  Branch (2483:25): [True: 4.48k, False: 6.46k]
  |  Branch (2483:45): [True: 2.22k, False: 2.25k]
  ------------------
 2484|  2.22k|                    {
 2485|  2.22k|                        continue;
 2486|  2.22k|                    }
 2487|       |
 2488|  8.72k|                    ret = bExistsAltPath( pCG, pBNS, pBD, NULL, at, num_atoms, iat1, iat2, ALT_PATH_MODE_CHARGE );
  ------------------
  |  |  311|  8.72k|#define ALT_PATH_MODE_CHARGE     2
  ------------------
 2489|       |
 2490|  8.72k|                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  8.72k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  8.72k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  8.72k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  8.72k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 8.72k, False: 0]
  |  |  |  Branch (67:44): [True: 1, False: 8.72k]
  |  |  ------------------
  ------------------
 2491|      1|                    {
 2492|      1|                        return ret;
 2493|      1|                    }
 2494|  8.72k|                    if (ret & 1)
  ------------------
  |  Branch (2494:25): [True: 1.28k, False: 7.44k]
  ------------------
 2495|  1.28k|                    {
 2496|  1.28k|                        nDelta = ( ret & ~3 ) >> 2;
 2497|  1.28k|                        nNumChanges += ( ret & 2 );
 2498|       |
 2499|  1.28k|                        ret = RegisterCPoints( c_group_info->c_group, &c_group_info->num_c_groups,
 2500|  1.28k|                                               c_group_info->max_num_c_groups, t_group_info,
 2501|  1.28k|                                               iat1, iat2, c_candidate[i1].type, at, num_atoms );
 2502|       |
 2503|  1.28k|                        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  1.28k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  1.28k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  1.28k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  1.28k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 1.28k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 1.28k]
  |  |  ------------------
  ------------------
 2504|      0|                        {
 2505|      0|                            return ret;
 2506|      0|                        }
 2507|  1.28k|                        if (nDelta)
  ------------------
  |  Branch (2507:29): [True: 0, False: 1.28k]
  ------------------
 2508|      0|                        {
 2509|      0|                            goto quick_exit;
 2510|      0|                        }
 2511|  1.28k|                    }
 2512|  8.72k|                }
 2513|  5.50k|            }
 2514|  4.48k|            i1 = i3;
 2515|  4.48k|        }
 2516|       |
 2517|  14.6k|    quick_exit:
 2518|  14.6k|        if (c_group_info->num_candidates == 0)
  ------------------
  |  Branch (2518:13): [True: 11.6k, False: 3.00k]
  ------------------
 2519|  11.6k|        {
 2520|       |            /* first time: initialize */
 2521|  11.6k|            c_group_info->num_candidates = num_tested ? nNumCandidates : -1; /* no candidate exists */
  ------------------
  |  Branch (2521:44): [True: 3.23k, False: 8.37k]
  ------------------
 2522|  11.6k|        }
 2523|  14.6k|    }
 2524|       |
 2525|   199k|    return nNumChanges;
 2526|   294k|}
GetSaltChargeType:
 2534|  3.15M|{
 2535|       |    /*
 2536|       |    type (returned value):
 2537|       |    -1 => ignore
 2538|       |    0 => oxygen
 2539|       |    subtype:
 2540|       |    1 = SALT_DONOR_H   => has H
 2541|       |    2 = SALT_DONOR_Neg => has (-) charge
 2542|       |    4 = SALT_ACCEPTOR  => may be an acceptor of H or (-), but not necessarily
 2543|       |
 2544|       |    O-atom should be:
 2545|       |    - a terminal atom
 2546|       |    - connected to unsaturated, uncharged, non-radical atom C that has chemical valence 4:
 2547|       |    H-donors:             =CH-OH, =C(-X)-OH
 2548|       |    possible H-acceptors: -CH=O, >C=O
 2549|       |    H-acceptors are true if O is tautomeric
 2550|       |    */
 2551|       |
 2552|  3.15M|    int iC, tg, i, type;
 2553|       |
 2554|  3.15M|    *s_subtype = 0; /* initialize the output */
 2555|       |                    /* check whether it is a candidate */
 2556|  3.15M|    if (at[at_no].valence != 1 ||
  ------------------
  |  Branch (2556:9): [True: 2.83M, False: 321k]
  ------------------
 2557|   321k|         (at[at_no].radical && at[at_no].radical != RADICAL_SINGLET) ||
  ------------------
  |  |   75|  52.5k|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2557:11): [True: 52.5k, False: 269k]
  |  Branch (2557:32): [True: 52.5k, False: 0]
  ------------------
 2558|   269k|         at[at_no].charge < -1 ||
  ------------------
  |  Branch (2558:10): [True: 327, False: 268k]
  ------------------
 2559|   268k|         (at[at_no].charge > 0 && !at[at_no].c_point)) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (2559:11): [True: 28.8k, False: 239k]
  |  Branch (2559:35): [True: 28.8k, False: 3]
  ------------------
 2560|  2.91M|    {
 2561|  2.91M|        return -1;
 2562|  2.91M|    }
 2563|       |
 2564|   239k|    if (at[at_no].el_number == EL_NUMBER_O ||
  ------------------
  |  |   15|   479k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2564:9): [True: 41.2k, False: 198k]
  ------------------
 2565|   198k|         at[at_no].el_number == EL_NUMBER_S ||
  ------------------
  |  |   19|   438k|#define EL_NUMBER_S  ((U_CHAR)16)
  ------------------
  |  Branch (2565:10): [True: 30.2k, False: 168k]
  ------------------
 2566|   168k|         at[at_no].el_number == EL_NUMBER_SE ||
  ------------------
  |  |   23|   408k|#define EL_NUMBER_SE ((U_CHAR)34)
  ------------------
  |  Branch (2566:10): [True: 3.61k, False: 164k]
  ------------------
 2567|   164k|         at[at_no].el_number == EL_NUMBER_TE)
  ------------------
  |  |   26|   164k|#define EL_NUMBER_TE ((U_CHAR)52)
  ------------------
  |  Branch (2567:10): [True: 3.17k, False: 161k]
  ------------------
 2568|  78.2k|    {
 2569|  78.2k|        type = 0;  /* terminal oxygen atom, needs more to be checked... */
 2570|  78.2k|    }
 2571|   161k|    else
 2572|   161k|    {
 2573|   161k|        type = -1; /* ignore this atom */
 2574|   161k|    }
 2575|       |
 2576|   239k|    if (type < 0 ||
  ------------------
  |  Branch (2576:9): [True: 161k, False: 78.2k]
  ------------------
 2577|  78.2k|         at[at_no].chem_bonds_valence + at[at_no].num_H !=
  ------------------
  |  Branch (2577:10): [True: 401, False: 77.8k]
  ------------------
 2578|  78.2k|         get_el_valence( at[at_no].el_number, at[at_no].charge, 0 ))
 2579|   161k|    {
 2580|   161k|        return -1; /* non-standard valence or not an oxygen */
 2581|   161k|    }
 2582|       |
 2583|  77.8k|    iC = at[at_no].neighbor[0];
 2584|       |
 2585|  77.8k|#if ( SALT_WITH_PROTONS == 1 )
 2586|  77.8k|    if (at[iC].el_number != EL_NUMBER_C ||
  ------------------
  |  |   13|   155k|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (2586:9): [True: 66.5k, False: 11.3k]
  ------------------
 2587|  11.3k|         at[iC].chem_bonds_valence + at[iC].num_H != 4 || /* allow =C(H)-OH or -C(H)=O */
  ------------------
  |  Branch (2587:10): [True: 1.80k, False: 9.55k]
  ------------------
 2588|  9.55k|         at[iC].charge ||
  ------------------
  |  Branch (2588:10): [True: 27, False: 9.53k]
  ------------------
 2589|  9.53k|         (at[iC].radical && at[iC].radical != RADICAL_SINGLET) ||
  ------------------
  |  |   75|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2589:11): [True: 0, False: 9.53k]
  |  Branch (2589:29): [True: 0, False: 0]
  ------------------
 2590|  9.53k|         at[iC].valence == at[iC].chem_bonds_valence) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2590:10): [True: 1.18k, False: 8.34k]
  ------------------
 2591|  69.5k|    {
 2592|  69.5k|        return -1; /* oxigen is connected to a wrong atom */
 2593|  69.5k|    }
 2594|       |#else
 2595|       |    if (at[iC].el_number != EL_NUMBER_C ||
 2596|       |         at[iC].num_H ||
 2597|       |         at[iC].chem_bonds_valence != 4 ||  /* allow only no H on C */
 2598|       |         at[iC].charge ||
 2599|       |         at[iC].radical && at[iC].radical != RADICAL_SINGLET ||
 2600|       |         at[iC].valence == at[iC].chem_bonds_valence)
 2601|       |    {
 2602|       |        return -1; /* oxigen is connected to a wrong atom */
 2603|       |    }
 2604|       |#endif
 2605|  8.34k|    if (( tg = at[at_no].endpoint ) && t_group_info && t_group_info->t_group)
  ------------------
  |  Branch (2605:9): [True: 4.65k, False: 3.69k]
  |  Branch (2605:40): [True: 4.65k, False: 0]
  |  Branch (2605:56): [True: 4.65k, False: 0]
  ------------------
 2606|  4.65k|    {
 2607|       |        /* O-atom is in a tautomeric group */
 2608|  4.81k|        for (i = 0; i < t_group_info->num_t_groups; i++)
  ------------------
  |  Branch (2608:21): [True: 4.81k, False: 0]
  ------------------
 2609|  4.81k|        {
 2610|  4.81k|            if (tg == t_group_info->t_group[i].nGroupNumber)
  ------------------
  |  Branch (2610:17): [True: 4.65k, False: 161]
  ------------------
 2611|  4.65k|            {
 2612|       |                /*
 2613|       |                t_group_info->t_group[i].num[0] = number of attached H-atoms and negative charges
 2614|       |                t_group_info->t_group[i].num[1] = number of attached negative charges
 2615|       |                */
 2616|  4.65k|                if (t_group_info->t_group[i].num[0] > t_group_info->t_group[i].num[1])
  ------------------
  |  Branch (2616:21): [True: 3.67k, False: 974]
  ------------------
 2617|  3.67k|                {
 2618|  3.67k|                    *s_subtype |= SALT_DONOR_H; /* has H */
  ------------------
  |  |   62|  3.67k|#define SALT_DONOR_H      1
  ------------------
 2619|  3.67k|                }
 2620|  4.65k|                if (t_group_info->t_group[i].num[1])
  ------------------
  |  Branch (2620:21): [True: 1.32k, False: 3.32k]
  ------------------
 2621|  1.32k|                {
 2622|  1.32k|                    *s_subtype |= SALT_DONOR_Neg; /* has (-) */
  ------------------
  |  |   63|  1.32k|#define SALT_DONOR_Neg    2
  ------------------
 2623|  1.32k|                }
 2624|  4.65k|                *s_subtype |= SALT_ACCEPTOR; /* there is always an acceptor in a t-group */
  ------------------
  |  |   64|  4.65k|#define SALT_ACCEPTOR     4
  ------------------
 2625|  4.65k|                return type;
 2626|  4.65k|            }
 2627|  4.81k|        }
 2628|      0|        return -1; /* error: t-group not found */
 2629|  4.65k|    }
 2630|       |
 2631|       |    /* O is not not in a tautomeric group */
 2632|       |    /* assume valence(O-) < valence(O) < valence(O+) */
 2633|  3.69k|    if (at[at_no].charge == -1)
  ------------------
  |  Branch (2633:9): [True: 351, False: 3.34k]
  ------------------
 2634|    351|    {
 2635|    351|        *s_subtype |= SALT_DONOR_Neg; /* has (-) */
  ------------------
  |  |   63|    351|#define SALT_DONOR_Neg    2
  ------------------
 2636|    351|    }
 2637|  3.69k|    if (at[at_no].charge <= 0 && at[at_no].num_H)
  ------------------
  |  Branch (2637:9): [True: 3.69k, False: 0]
  |  Branch (2637:34): [True: 1.91k, False: 1.78k]
  ------------------
 2638|  1.91k|    {
 2639|  1.91k|        *s_subtype |= SALT_DONOR_H; /* has H */
  ------------------
  |  |   62|  1.91k|#define SALT_DONOR_H      1
  ------------------
 2640|  1.91k|    }
 2641|  3.69k|    if (at[at_no].charge == 0 && at[at_no].chem_bonds_valence == 2)
  ------------------
  |  Branch (2641:9): [True: 3.34k, False: 351]
  |  Branch (2641:34): [True: 1.44k, False: 1.90k]
  ------------------
 2642|  1.44k|    {
 2643|  1.44k|        *s_subtype |= SALT_ACCEPTOR;
  ------------------
  |  |   64|  1.44k|#define SALT_ACCEPTOR     4
  ------------------
 2644|  1.44k|    }
 2645|       |    /* since O cannot be a charge point, the following cannot happen: */
 2646|  3.69k|    if (at[at_no].charge == 1 && at[at_no].c_point && at[at_no].chem_bonds_valence == 2 && at[at_no].num_H)
  ------------------
  |  Branch (2646:9): [True: 0, False: 3.69k]
  |  Branch (2646:34): [True: 0, False: 0]
  |  Branch (2646:55): [True: 0, False: 0]
  |  Branch (2646:92): [True: 0, False: 0]
  ------------------
 2647|      0|    {
 2648|      0|        *s_subtype |= SALT_DONOR_H; /* has H */
  ------------------
  |  |   62|      0|#define SALT_DONOR_H      1
  ------------------
 2649|      0|    }
 2650|       |
 2651|  3.69k|    return type;
 2652|  8.34k|}
bDoNotMergeNonTautAtom:
 2657|  32.3k|{
 2658|  32.3k|    if (at[at_no].el_number == EL_NUMBER_N)
  ------------------
  |  |   14|  32.3k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (2658:9): [True: 20.9k, False: 11.4k]
  ------------------
 2659|  20.9k|    {
 2660|  20.9k|        return 1;
 2661|  20.9k|    }
 2662|  11.4k|    return 0;
 2663|  32.3k|}
GetOtherSaltChargeType:
 2672|  3.14M|{
 2673|       |    /*
 2674|       |    type (returned value):
 2675|       |    -1 => ignore
 2676|       |    1 => not an oxygen
 2677|       |    subtype:
 2678|       |    1 = SALT_DONOR_H   => has H
 2679|       |    2 = SALT_DONOR_Neg => has (-) charge
 2680|       |    4 = SALT_ACCEPTOR  => may be an acceptor of H or (-), but not necessarily
 2681|       |
 2682|       |    the atom should be:
 2683|       |    - a tautomeric endpoint atom
 2684|       |    - connected to possible centerpoint atom
 2685|       |
 2686|       |    another description of the atom searched here:
 2687|       |
 2688|       |    any possibly tautomeric atom adjacent to a possibly centerpoint
 2689|       |    that has at least one double bond (possibly if positively charged);
 2690|       |    if eif.cAcceptor then the bond between the atom and the centerpoint must be possibly double
 2691|       |    if eif.cAcceptor then the bond must be possibly single
 2692|       |    Donors that belong to a t-group are also acceptors
 2693|       |    */
 2694|       |
 2695|  3.14M|    int tg, i, j, type, endpoint_valence, num_centerpoints, bond_type, centerpoint;
 2696|  3.14M|    ENDPOINT_INFO eif;
 2697|       |
 2698|  3.14M|    *s_subtype = 0; /* initialize the output */
 2699|  3.14M|    if (!bAccept_O /* only N */ &&
  ------------------
  |  Branch (2699:9): [True: 0, False: 3.14M]
  ------------------
 2700|      0|        ( at[at_no].el_number == EL_NUMBER_O ||
  ------------------
  |  |   15|      0|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2700:11): [True: 0, False: 0]
  ------------------
 2701|      0|          at[at_no].el_number == EL_NUMBER_S ||
  ------------------
  |  |   19|      0|#define EL_NUMBER_S  ((U_CHAR)16)
  ------------------
  |  Branch (2701:11): [True: 0, False: 0]
  ------------------
 2702|      0|          at[at_no].el_number == EL_NUMBER_SE ||
  ------------------
  |  |   23|      0|#define EL_NUMBER_SE ((U_CHAR)34)
  ------------------
  |  Branch (2702:11): [True: 0, False: 0]
  ------------------
 2703|      0|          at[at_no].el_number == EL_NUMBER_TE ))
  ------------------
  |  |   26|      0|#define EL_NUMBER_TE ((U_CHAR)52)
  ------------------
  |  Branch (2703:11): [True: 0, False: 0]
  ------------------
 2704|      0|    {
 2705|      0|        return -1; /* we are not looking for oxygen here */
 2706|      0|    }
 2707|       |
 2708|  3.14M|    type = 1;
 2709|  3.14M|    if (!( endpoint_valence = nGetEndpointInfo( at, at_no, &eif ) )) /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (2709:9): [True: 2.98M, False: 160k]
  ------------------
 2710|  2.98M|    {
 2711|  2.98M|        return -1; /* not a possible endpoint */
 2712|  2.98M|    }
 2713|   160k|    else
 2714|   160k|    {
 2715|       |        /* at[at_no] is not not in a tautomeric group; use eif previously filled out by nGetEndpointInfo */
 2716|       |        /* check whether there is adjacent atom-candidate for a centerpoint */
 2717|   160k|        num_centerpoints = 0;
 2718|   221k|        for (j = 0; j < at[at_no].valence; j++)
  ------------------
  |  Branch (2718:21): [True: 181k, False: 40.3k]
  ------------------
 2719|   181k|        {
 2720|   181k|            bond_type = (int) at[at_no].bond_type[j] & BOND_TYPE_MASK;
  ------------------
  |  |  189|   181k|#define BOND_TYPE_MASK        0x0f
  ------------------
 2721|   181k|            centerpoint = (int) at[at_no].neighbor[j];  /*  a centerpoint candidate */
 2722|   181k|            if (( (eif.cAcceptor && ( bond_type == BOND_DOUBLE ||
  ------------------
  |  |  178|   133k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|   267k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (2722:20): [True: 133k, False: 47.5k]
  |  Branch (2722:39): [True: 77.1k, False: 56.7k]
  ------------------
 2723|  56.7k|                                     bond_type == BOND_ALTERN || /* possibly double */
  ------------------
  |  |  180|  56.7k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|   190k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (2723:38): [True: 11.5k, False: 45.2k]
  ------------------
 2724|  45.2k|                                     bond_type == BOND_ALT12NS ||
  ------------------
  |  |  186|   179k|#define BOND_ALT12NS             9
  ------------------
  |  Branch (2724:38): [True: 8.92k, False: 36.3k]
  ------------------
 2725|  36.3k|                                     bond_type == BOND_TAUTOM )) ||
  ------------------
  |  |  185|  36.3k|#define BOND_TAUTOM              8
  ------------------
  |  Branch (2725:38): [True: 18.9k, False: 17.3k]
  ------------------
 2726|  64.9k|                  (eif.cDonor && ( bond_type == BOND_SINGLE ||
  ------------------
  |  |  177|  47.5k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|  95.0k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (2726:20): [True: 47.5k, False: 17.3k]
  |  Branch (2726:36): [True: 30.4k, False: 17.0k]
  ------------------
 2727|  17.0k|                                  bond_type == BOND_ALTERN || /* possibly single */
  ------------------
  |  |  180|  17.0k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|  64.6k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (2727:35): [True: 227, False: 16.8k]
  ------------------
 2728|  16.8k|                                  bond_type == BOND_ALT12NS ||
  ------------------
  |  |  186|  64.3k|#define BOND_ALT12NS             9
  ------------------
  |  Branch (2728:35): [True: 341, False: 16.4k]
  ------------------
 2729|  16.4k|                                  bond_type == BOND_TAUTOM )) ) &&
  ------------------
  |  |  185|  16.4k|#define BOND_TAUTOM              8
  ------------------
  |  Branch (2729:35): [True: 16.4k, False: 3]
  ------------------
 2730|   164k|                                  ( at[centerpoint].chem_bonds_valence > at[centerpoint].valence ||
  ------------------
  |  Branch (2730:37): [True: 141k, False: 22.2k]
  ------------------
 2731|       |                                    /* check for possible endpoint added 2004-02-24 */
 2732|  22.2k|                                    (at[centerpoint].chem_bonds_valence == at[centerpoint].valence &&
  ------------------
  |  Branch (2732:38): [True: 22.2k, False: 0]
  ------------------
 2733|  22.2k|                                    ( at[centerpoint].endpoint || at[centerpoint].c_point )) /* tautomerism or charge may increment at[centerpoint].chem_bonds_valence*/ ) &&
  ------------------
  |  Branch (2733:39): [True: 1.08k, False: 21.1k]
  |  Branch (2733:67): [True: 371, False: 20.7k]
  ------------------
 2734|   143k|                 is_centerpoint_elem( at[centerpoint].el_number )) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (2734:18): [True: 119k, False: 23.4k]
  ------------------
 2735|   119k|            {
 2736|   119k|                num_centerpoints++;
 2737|   119k|                break; /* at least one possibly centerpoint neighbor has been found */
 2738|   119k|            }
 2739|   181k|        }
 2740|   160k|        if (!num_centerpoints)
  ------------------
  |  Branch (2740:13): [True: 40.3k, False: 119k]
  ------------------
 2741|  40.3k|        {
 2742|  40.3k|            return -1;
 2743|  40.3k|        }
 2744|       |        /* moved here from just after "type = 1;" line 2004-02-26 */
 2745|   119k|        if (( tg = at[at_no].endpoint ) && t_group_info && t_group_info->t_group)
  ------------------
  |  Branch (2745:13): [True: 34.2k, False: 85.6k]
  |  Branch (2745:44): [True: 34.2k, False: 0]
  |  Branch (2745:60): [True: 34.2k, False: 0]
  ------------------
 2746|  34.2k|        {
 2747|       |            /* atom is in a tautomeric group */
 2748|  35.6k|            for (i = 0; i < t_group_info->num_t_groups; i++)
  ------------------
  |  Branch (2748:25): [True: 35.6k, False: 0]
  ------------------
 2749|  35.6k|            {
 2750|  35.6k|                if (tg == t_group_info->t_group[i].nGroupNumber)
  ------------------
  |  Branch (2750:21): [True: 34.2k, False: 1.34k]
  ------------------
 2751|  34.2k|                {
 2752|       |                    /*
 2753|       |                    t_group_info->t_group[i].num[0] = number of attached H-atoms and negative charges
 2754|       |                    t_group_info->t_group[i].num[1] = number of attached negative charges
 2755|       |                    */
 2756|  34.2k|                    if (t_group_info->t_group[i].num[0] > t_group_info->t_group[i].num[1])
  ------------------
  |  Branch (2756:25): [True: 20.2k, False: 14.0k]
  ------------------
 2757|  20.2k|                    {
 2758|  20.2k|                        *s_subtype |= SALT_DONOR_H; /* has H */
  ------------------
  |  |   62|  20.2k|#define SALT_DONOR_H      1
  ------------------
 2759|  20.2k|                    }
 2760|  34.2k|                    if (t_group_info->t_group[i].num[1])
  ------------------
  |  Branch (2760:25): [True: 20.0k, False: 14.2k]
  ------------------
 2761|  20.0k|                    {
 2762|  20.0k|                        *s_subtype |= SALT_DONOR_Neg; /* has (-) */
  ------------------
  |  |   63|  20.0k|#define SALT_DONOR_Neg    2
  ------------------
 2763|  20.0k|                    }
 2764|  34.2k|                    *s_subtype |= SALT_ACCEPTOR; /* there is always an acceptor in a t-group */
  ------------------
  |  |   64|  34.2k|#define SALT_ACCEPTOR     4
  ------------------
 2765|  34.2k|                    return type;
 2766|  34.2k|                }
 2767|  35.6k|            }
 2768|      0|            return -1; /* error: t-group not found */
 2769|  34.2k|        }
 2770|       |
 2771|  85.6k|        if (eif.cAcceptor)
  ------------------
  |  Branch (2771:13): [True: 78.6k, False: 6.99k]
  ------------------
 2772|  78.6k|        {
 2773|  78.6k|            *s_subtype |= SALT_ACCEPTOR;
  ------------------
  |  |   64|  78.6k|#define SALT_ACCEPTOR     4
  ------------------
 2774|  78.6k|        }
 2775|  85.6k|        if (eif.cDonor)
  ------------------
  |  Branch (2775:13): [True: 6.99k, False: 78.6k]
  ------------------
 2776|  6.99k|        {
 2777|  6.99k|            if (at[at_no].charge == -1)
  ------------------
  |  Branch (2777:17): [True: 5.29k, False: 1.69k]
  ------------------
 2778|  5.29k|            {
 2779|  5.29k|                *s_subtype |= SALT_DONOR_Neg; /* has (-) */
  ------------------
  |  |   63|  5.29k|#define SALT_DONOR_Neg    2
  ------------------
 2780|  5.29k|            }
 2781|  6.99k|            if (at[at_no].num_H)
  ------------------
  |  Branch (2781:17): [True: 1.98k, False: 5.01k]
  ------------------
 2782|  1.98k|            {
 2783|  1.98k|                *s_subtype |= SALT_DONOR_H; /* has H */
  ------------------
  |  |   62|  1.98k|#define SALT_DONOR_H      1
  ------------------
 2784|  1.98k|            }
 2785|  6.99k|        }
 2786|  85.6k|    }
 2787|       |
 2788|  85.6k|    return type;
 2789|  3.14M|}
GetOtherSaltType:
 2794|  3.02M|{
 2795|       |    /*
 2796|       |    type (returned value):
 2797|       |    -1 => ignore
 2798|       |    2 => found:                           SH
 2799|       |    proton donor     -CH2-SH, >CH-SH, >C<    S(-)
 2800|       |    proton acceptor  -CH2-S(-), >CH-S(-), >C<
 2801|       |    subtype:
 2802|       |    1 = SALT_DONOR_H   => has H
 2803|       |    2 = SALT_DONOR_Neg => has (-) charge
 2804|       |    4 = SALT_ACCEPTOR  => may be an acceptor of H or (-), but not necessarily
 2805|       |
 2806|       |    non-O-atom should be:
 2807|       |    - a tautomeric endpoint atom
 2808|       |    - connected to possible middle point atom
 2809|       |    */
 2810|       |
 2811|  3.02M|    int type, endpoint_valence, centerpoint; /* djb-rwth: removing redundant variables */
 2812|  3.02M|    ENDPOINT_INFO eif;
 2813|       |
 2814|  3.02M|    if (at[at_no].valence != 1 || at[at_no].chem_bonds_valence != 1 ||
  ------------------
  |  Branch (2814:9): [True: 2.77M, False: 251k]
  |  Branch (2814:35): [True: 101k, False: 150k]
  ------------------
 2815|   150k|         1 != ( at[at_no].num_H == 1 ) + ( at[at_no].charge == -1 ))
  ------------------
  |  Branch (2815:10): [True: 111k, False: 39.0k]
  ------------------
 2816|  2.98M|    {
 2817|  2.98M|        return -1;
 2818|  2.98M|    }
 2819|       |
 2820|  39.0k|    *s_subtype = 0; /* initialize the output */
 2821|  39.0k|    if (!( at[at_no].el_number == EL_NUMBER_S ||
  ------------------
  |  |   19|  78.0k|#define EL_NUMBER_S  ((U_CHAR)16)
  ------------------
  |  Branch (2821:12): [True: 6.44k, False: 32.5k]
  ------------------
 2822|  32.5k|           at[at_no].el_number == EL_NUMBER_SE ||
  ------------------
  |  |   23|  71.5k|#define EL_NUMBER_SE ((U_CHAR)34)
  ------------------
  |  Branch (2822:12): [True: 810, False: 31.7k]
  ------------------
 2823|  31.7k|           at[at_no].el_number == EL_NUMBER_TE ))
  ------------------
  |  |   26|  31.7k|#define EL_NUMBER_TE ((U_CHAR)52)
  ------------------
  |  Branch (2823:12): [True: 902, False: 30.8k]
  ------------------
 2824|  30.8k|    {
 2825|  30.8k|        return -1; /* we are not looking for oxygen here */
 2826|  30.8k|    }
 2827|       |
 2828|  8.15k|    type = 2; /* non-tautomeric p-donor or acceptor: C-SH, C-S(-) */
 2829|       |
 2830|  8.15k|    if (!( endpoint_valence = nGetEndpointInfo( at, at_no, &eif ) ) ||
  ------------------
  |  Branch (2830:9): [True: 74, False: 8.07k]
  ------------------
 2831|  8.07k|         (eif.cMoveableCharge && !at[at_no].c_point) || !eif.cDonor || eif.cAcceptor) /* djb-rwth: addressing LLVM warning; ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (2831:11): [True: 0, False: 8.07k]
  |  Branch (2831:34): [True: 0, False: 0]
  |  Branch (2831:57): [True: 0, False: 8.07k]
  |  Branch (2831:72): [True: 0, False: 8.07k]
  ------------------
 2832|     74|    {
 2833|     74|        return -1; /* not a possible -SH or -S(-) */
 2834|     74|    }
 2835|  8.07k|    else
 2836|  8.07k|    {
 2837|       |        /* at[at_no] is not not in a tautomeric group; use eif previously filled out by nGetEndpointInfo */
 2838|       |        /* check whether there is adjacent atom-candidate for a centerpoint */
 2839|  8.07k|        centerpoint = (int) at[at_no].neighbor[0];
 2840|       |        /* djb-rwth: removing redundant code */
 2841|  8.07k|        if (at[centerpoint].el_number != EL_NUMBER_C ||
  ------------------
  |  |   13|  16.1k|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (2841:13): [True: 6.31k, False: 1.76k]
  ------------------
 2842|  1.76k|             at[centerpoint].charge ||
  ------------------
  |  Branch (2842:14): [True: 435, False: 1.33k]
  ------------------
 2843|  1.33k|             (at[centerpoint].radical && at[centerpoint].radical != RADICAL_SINGLET) ||
  ------------------
  |  |   75|    258|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2843:15): [True: 258, False: 1.07k]
  |  Branch (2843:42): [True: 258, False: 0]
  ------------------
 2844|  1.07k|             at[centerpoint].valence != at[centerpoint].chem_bonds_valence) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2844:14): [True: 0, False: 1.07k]
  ------------------
 2845|  7.00k|        {
 2846|  7.00k|            return -1; /* not a carbon with all single bonds */
 2847|  7.00k|        }
 2848|  1.07k|        if (at[at_no].num_H == 1)
  ------------------
  |  Branch (2848:13): [True: 820, False: 255]
  ------------------
 2849|    820|        {
 2850|    820|            *s_subtype |= SALT_p_DONOR;
  ------------------
  |  |   65|    820|#define SALT_p_DONOR      8  /* >C-SH   */
  ------------------
 2851|    820|        }
 2852|    255|        else
 2853|    255|        {
 2854|    255|            if (at[at_no].charge == -1)
  ------------------
  |  Branch (2854:17): [True: 255, False: 0]
  ------------------
 2855|    255|            {
 2856|    255|                *s_subtype |= SALT_p_ACCEPTOR;
  ------------------
  |  |   66|    255|#define SALT_p_ACCEPTOR  16  /* >C-S(-) */
  ------------------
 2857|    255|            }
 2858|      0|            else
 2859|      0|            {
 2860|      0|                return -1;
 2861|      0|            }
 2862|    255|        }
 2863|  1.07k|    }
 2864|       |
 2865|  1.07k|    return type;
 2866|  8.15k|}
comp_candidates:
 2896|  1.55k|{
 2897|  1.55k|    const S_CANDIDATE *s1 = (const S_CANDIDATE *) a1;
 2898|  1.55k|    const S_CANDIDATE *s2 = (const S_CANDIDATE *) a2;
 2899|  1.55k|    int ret;
 2900|  1.55k|    if (s1->type >= 0 /* enabled < */ && s2->type < 0 /* disabled */)
  ------------------
  |  Branch (2900:9): [True: 1.17k, False: 380]
  |  Branch (2900:42): [True: 528, False: 649]
  ------------------
 2901|    528|    {
 2902|    528|        return -1; /* enabled goes first */
 2903|    528|    }
 2904|  1.02k|    if (s1->type < 0 /* disabled > */ && s2->type >= 0 /* enabled */)
  ------------------
  |  Branch (2904:9): [True: 380, False: 649]
  |  Branch (2904:42): [True: 114, False: 266]
  ------------------
 2905|    114|    {
 2906|    114|        return 1;
 2907|    114|    }
 2908|    915|    if (s1->endpoint && !s2->endpoint)
  ------------------
  |  Branch (2908:9): [True: 435, False: 480]
  |  Branch (2908:25): [True: 124, False: 311]
  ------------------
 2909|    124|    {
 2910|    124|        return -1; /* tautomeric goes first; only tautomeric may be disabled */
 2911|    124|    }
 2912|    791|    if (!s1->endpoint && s2->endpoint)
  ------------------
  |  Branch (2912:9): [True: 480, False: 311]
  |  Branch (2912:26): [True: 50, False: 430]
  ------------------
 2913|     50|    {
 2914|     50|        return 1; /* tautomeric goes first; only tautomeric may be disabled */
 2915|     50|    }
 2916|    741|    if (s1->endpoint && s2->endpoint && ( ret = (int) s1->endpoint - (int) s2->endpoint ))
  ------------------
  |  Branch (2916:9): [True: 311, False: 430]
  |  Branch (2916:25): [True: 311, False: 0]
  |  Branch (2916:41): [True: 99, False: 212]
  ------------------
 2917|     99|    {
 2918|     99|        return ret;
 2919|     99|    }
 2920|       |
 2921|    642|    return (int) s1->atnumber - (int) s2->atnumber;
 2922|    741|}
MarkSaltChargeGroups2:
 2934|   252k|{
 2935|       |    /* BNS_EDGE_FORBIDDEN_TEMP */
 2936|   252k|#define ALT_PATH_FOUND    (MAX_ATOMS+1)
 2937|   252k|#define NO_ENDPOINT       (MAX_ATOMS+2)  /* the two defines must be different */
 2938|   252k|#define DISABLE_CANDIDATE 10
 2939|   252k|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
 2940|   252k|#define ACCEPTOR_PAIR 1
 2941|   252k|#define DONOR_PAIR    2
 2942|       |
 2943|   252k|    int nNumOtherChanges = 0, nTotNumChanges = 0; /* djb-rwth: removing redundant variables */
 2944|   252k|    S_CHAR      *cPair = NULL;
 2945|   252k|    T_ENDPOINT  *EndPoint = NULL;
 2946|   252k|    if (s_group_info && s_group_info->s_candidate && s_group_info->max_num_candidates > 0)
  ------------------
  |  Branch (2946:9): [True: 252k, False: 0]
  |  Branch (2946:25): [True: 252k, False: 0]
  |  Branch (2946:54): [True: 252k, False: 0]
  ------------------
 2947|   252k|    {
 2948|   252k|        int i, j, i1, j1;
 2949|   252k|        S_CANDIDATE *s_candidate = s_group_info->s_candidate;
 2950|   252k|        int          nMaxNumCandidates = s_group_info->max_num_candidates;
 2951|   252k|        int          nNumCandidates = s_group_info->num_candidates;
 2952|   252k|        int          nNumOtherCandidates; /* djb-rwth: removing redundant code */
 2953|       |        /* djb-rwth: removing redundant variables */
 2954|   252k|        int          nNumLeftCandidates = 0;
 2955|   252k|        int          nNumMarkedCandidates = 0;
 2956|   252k|        int          s_type, s_subtype;
 2957|   252k|        int          ret, nDelta;
 2958|   252k|        int          bHardAddedRemovedProtons = t_group_info && ( t_group_info->tni.bNormalizationFlags & FLAG_FORCE_SALT_TAUT );
  ------------------
  |  |  172|   252k|#define FLAG_FORCE_SALT_TAUT         ( FLAG_PROTON_NP_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  147|   252k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  173|   252k|                                       FLAG_PROTON_AC_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  150|   252k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  174|   252k|                                       FLAG_PROTON_AC_HARD_ADDED    )
  |  |  ------------------
  |  |  |  |  151|   252k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  ------------------
  |  Branch (2958:49): [True: 252k, False: 0]
  |  Branch (2958:65): [True: 176, False: 251k]
  ------------------
 2959|       |
 2960|   252k|        int          s_subtype_all = 0;
 2961|   252k|        int          nDonorPairs, nAcceptorPairs, nCurDonorPairs, nCurAcceptorPairs, bAlreadyTested;
 2962|       |        /*
 2963|       |        ENDPOINT_INFO    eif;
 2964|       |        */
 2965|       |
 2966|   252k|#if ( IGNORE_TGROUP_WITHOUT_H == 1 )
 2967|   252k|        int          bTGroupHasNegativeChargesOnly = 1;
 2968|   252k|#endif
 2969|       |        /*return 0;*/ /* debug only */
 2970|       |
 2971|       |        /* djb-rwth: removing redundant code */
 2972|       |
 2973|   252k|        if (nNumCandidates <= -2 || !t_group_info || !t_group_info->t_group)
  ------------------
  |  Branch (2973:13): [True: 0, False: 252k]
  |  Branch (2973:37): [True: 0, False: 252k]
  |  Branch (2973:54): [True: 0, False: 252k]
  ------------------
 2974|      0|        {
 2975|      0|            return 0;
 2976|      0|        }
 2977|       |
 2978|       |        /*************************************************************************/
 2979|       |        /* Find all candidates including those with differen s_type (other type) */
 2980|       |        /*************************************************************************/
 2981|  1.30M|        for (i = 0, nNumCandidates = nNumOtherCandidates = 0; i < num_atoms; i++) /* djb-rwth: removing redundant code */
  ------------------
  |  Branch (2981:63): [True: 1.05M, False: 252k]
  ------------------
 2982|  1.05M|        {
 2983|  1.05M|            if (0 == ( s_type = GetSaltChargeType( at, i, t_group_info, &s_subtype ) ) ||
  ------------------
  |  Branch (2983:17): [True: 2.73k, False: 1.04M]
  ------------------
 2984|       |                 /* -C=O or =C-OH, O = S, Se, Te */
 2985|  1.04M|                 1 == ( s_type = GetOtherSaltChargeType( at, i, t_group_info, &s_subtype, 1/* bAccept_O*/ ) ) ||
  ------------------
  |  Branch (2985:18): [True: 39.9k, False: 1.00M]
  ------------------
 2986|       |                 /* =Z-MH or -Z=M, Z = centerpoint, M = endpoint, other than above */
 2987|  1.00M|                 2 == ( s_type = GetOtherSaltType( at, i, &s_subtype ) ) ||
  ------------------
  |  Branch (2987:18): [True: 350, False: 1.00M]
  ------------------
 2988|  1.00M|                 ( bHardAddedRemovedProtons && 4 == ( s_type = bIsHardRemHCandidate( at, i, &s_subtype ) ) )
  ------------------
  |  Branch (2988:20): [True: 565, False: 1.00M]
  |  Branch (2988:48): [True: 99, False: 466]
  ------------------
 2989|       |                 /* >C-SH, >C-S(-); S=S,Se,Te */
 2990|  1.05M|                 )
 2991|  43.0k|            {
 2992|       |
 2993|  43.0k|                if (nNumCandidates >= nMaxNumCandidates)
  ------------------
  |  Branch (2993:21): [True: 0, False: 43.0k]
  ------------------
 2994|      0|                {
 2995|      0|                    return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2996|      0|                }
 2997|  43.0k|                s_candidate[nNumCandidates].atnumber = i;
 2998|  43.0k|                s_candidate[nNumCandidates].type = s_type;
 2999|  43.0k|                s_candidate[nNumCandidates].subtype = s_subtype;
 3000|  43.0k|                s_candidate[nNumCandidates].endpoint = at[i].endpoint;
 3001|  43.0k|                nNumCandidates++;
 3002|  43.0k|                nNumOtherCandidates += ( 1 == s_type );
 3003|  43.0k|                s_subtype_all |= s_subtype;
 3004|       |                /* djb-rwth: removing redundant code */
 3005|  43.0k|            }
 3006|  1.05M|        }
 3007|       |
 3008|   252k|        if (nNumCandidates <= 1 ||  /* TG_FLAG_ALLOW_NO_NEGTV_O <=> CHARGED_SALTS_ONLY=0 */
  ------------------
  |  Branch (3008:13): [True: 238k, False: 13.4k]
  ------------------
 3009|  13.4k|             !( s_subtype_all & SALT_ACCEPTOR ) ||
  ------------------
  |  |   64|  13.4k|#define SALT_ACCEPTOR     4
  ------------------
  |  Branch (3009:14): [True: 136, False: 13.3k]
  ------------------
 3010|  13.3k|             ( ( ( t_group_info->bTautFlags & TG_FLAG_ALLOW_NO_NEGTV_O ) ||
  ------------------
  |  |  923|  13.3k|#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 (3010:14): [True: 12.7k, False: 570]
  |  Branch (3010:18): [True: 0, False: 13.3k]
  ------------------
 3011|  13.3k|             ( t_group_info->bTautFlagsDone & TG_FLAG_FOUND_SALT_CHARGES_DONE ) ||
  ------------------
  |  |  980|  13.3k|#define TG_FLAG_FOUND_SALT_CHARGES_DONE  0x00002000   /* not assigned: preprocessing detected possibility of salt-type tautomerism */
  ------------------
  |  Branch (3011:14): [True: 0, False: 13.3k]
  ------------------
 3012|  13.3k|                 ( t_group_info->tni.bNormalizationFlags & FLAG_FORCE_SALT_TAUT ) ) ?
  ------------------
  |  |  172|  13.3k|#define FLAG_FORCE_SALT_TAUT         ( FLAG_PROTON_NP_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  147|  13.3k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  173|  13.3k|                                       FLAG_PROTON_AC_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  150|  13.3k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  174|  13.3k|                                       FLAG_PROTON_AC_HARD_ADDED    )
  |  |  ------------------
  |  |  |  |  151|  13.3k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  ------------------
  |  Branch (3012:18): [True: 175, False: 13.1k]
  ------------------
 3013|    175|               !( s_subtype_all & ( SALT_DONOR ) ) :
  ------------------
  |  |   70|    175|#define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   63|    175|#define SALT_DONOR_Neg    2
  |  |  ------------------
  |  |               #define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   62|    175|#define SALT_DONOR_H      1
  |  |  ------------------
  ------------------
 3014|  13.3k|               ( !( s_subtype_all & SALT_DONOR_Neg ) || nNumOtherCandidates == nNumCandidates ) )
  ------------------
  |  |   63|  13.1k|#define SALT_DONOR_Neg    2
  ------------------
  |  Branch (3014:18): [True: 9.89k, False: 3.24k]
  |  Branch (3014:57): [True: 2.80k, False: 436]
  ------------------
 3015|   252k|             )
 3016|   251k|        {
 3017|   251k|            s_group_info->num_candidates = 0; /* no candidate exists */
 3018|   251k|            return 0;
 3019|   251k|        }
 3020|       |
 3021|    570|        if (!( s_subtype_all & ( SALT_DONOR_Neg ) ))
  ------------------
  |  |   63|    570|#define SALT_DONOR_Neg    2
  ------------------
  |  Branch (3021:13): [True: 74, False: 496]
  ------------------
 3022|     74|        {
 3023|     74|            t_group_info->bTautFlagsDone |= TG_FLAG_ALLOW_NO_NEGTV_O_DONE;
  ------------------
  |  |  968|     74|#define TG_FLAG_ALLOW_NO_NEGTV_O_DONE    0x00000040
  ------------------
 3024|     74|        }
 3025|       |
 3026|       |        /************************************************************************************/
 3027|       |        /* Mark redundant candidates so that only one candidate from one t-group is left in */
 3028|       |        /************************************************************************************/
 3029|  2.35k|        for (i = 0; i < nNumCandidates; i++)
  ------------------
  |  Branch (3029:21): [True: 1.78k, False: 570]
  ------------------
 3030|  1.78k|        {
 3031|       |            /* djb-rwth: fixing oss-fuzz issue #45059 */
 3032|  1.78k|            if ((nNumCandidates < nMaxNumCandidates) && (2 == s_candidate[nNumCandidates].type))
  ------------------
  |  Branch (3032:17): [True: 1.77k, False: 11]
  |  Branch (3032:57): [True: 0, False: 1.77k]
  ------------------
 3033|      0|            {
 3034|      0|                s_candidate[i].type -= DISABLE_CANDIDATE; /* disable >C-SH candidates */
  ------------------
  |  | 2938|      0|#define DISABLE_CANDIDATE 10
  ------------------
 3035|      0|                nNumLeftCandidates++; /* count rejected */
 3036|      0|                continue;
 3037|      0|            }
 3038|  1.78k|            if (s_candidate[i].endpoint)
  ------------------
  |  Branch (3038:17): [True: 1.13k, False: 644]
  ------------------
 3039|  1.13k|            {
 3040|  1.46k|                for (j = i - 1; 0 <= j; j--)
  ------------------
  |  Branch (3040:33): [True: 1.00k, False: 467]
  ------------------
 3041|  1.00k|                {
 3042|  1.00k|                    if (s_candidate[i].endpoint == s_candidate[j].endpoint)
  ------------------
  |  Branch (3042:25): [True: 670, False: 332]
  ------------------
 3043|    670|                    {
 3044|    670|                        s_candidate[i].type -= DISABLE_CANDIDATE; /* disable subsequent redundant */
  ------------------
  |  | 2938|    670|#define DISABLE_CANDIDATE 10
  ------------------
 3045|    670|                        nNumLeftCandidates++; /* count rejected */
 3046|    670|                        break;
 3047|    670|                    }
 3048|  1.00k|                }
 3049|  1.13k|            }
 3050|  1.78k|        }
 3051|       |
 3052|    570|        nNumLeftCandidates = nNumCandidates - nNumLeftCandidates; /* subtract num. rejected from the total */
 3053|    570|        s_group_info->num_candidates = 0; /* reinit next time */
 3054|       |                                          /*********************************************************************/
 3055|       |                                          /* reorder so that all disabled are at the end, tautomeric are first */
 3056|       |                                          /*********************************************************************/
 3057|       |
 3058|    570|        qsort( s_candidate, nNumCandidates, sizeof( s_candidate[0] ), comp_candidates );
 3059|       |
 3060|    570|        if (nNumLeftCandidates) /* djb-rwth: avoiding zero-length allocation */
  ------------------
  |  Branch (3060:13): [True: 570, False: 0]
  ------------------
 3061|    570|            cPair = (S_CHAR *) inchi_calloc( (long long)nNumLeftCandidates * (long long)nNumLeftCandidates, sizeof( cPair[0] ) ); /* djb-rwth: cast operators added */
  ------------------
  |  | 1146|    570|#define inchi_calloc   calloc
  ------------------
 3062|    570|        if (!cPair)
  ------------------
  |  Branch (3062:13): [True: 0, False: 570]
  ------------------
 3063|      0|        {
 3064|       |            /*printf("BNS_OUT_OF_RAM-6\n");*/
 3065|      0|            nTotNumChanges = BNS_OUT_OF_RAM;
  ------------------
  |  |   49|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3066|      0|            goto quick_exit;
 3067|      0|        }
 3068|    570|        nDonorPairs = nAcceptorPairs = 0;
 3069|       |
 3070|       |        /**********************************************************************/
 3071|       |        /* Find whether we have at least one donor pair and one acceptor pair */
 3072|       |        /**********************************************************************/
 3073|  1.65k|        for (i = 0; i < nNumLeftCandidates; i++)
  ------------------
  |  Branch (3073:21): [True: 1.10k, False: 553]
  ------------------
 3074|  1.10k|        {
 3075|  1.10k|            nCurDonorPairs = nCurAcceptorPairs = 0;
 3076|  3.04k|            for (j = 0; j <= i; j++)
  ------------------
  |  Branch (3076:25): [True: 1.95k, False: 1.08k]
  ------------------
 3077|  1.95k|            {
 3078|  1.95k|                if (i == j && !s_candidate[i].endpoint)
  ------------------
  |  Branch (3078:21): [True: 1.08k, False: 876]
  |  Branch (3078:31): [True: 616, False: 467]
  ------------------
 3079|    616|                {
 3080|    616|                    continue;  /* same non-taut atom. However, success for i==j means     *
 3081|       |                               * that the whole tautomeric group may donate or accept 2H */
 3082|    616|                }
 3083|       |                /* check for acceptor pair */
 3084|  1.34k|                if (( s_candidate[i].subtype & SALT_ACCEPTOR ) && ( s_candidate[j].subtype & SALT_ACCEPTOR ) &&
  ------------------
  |  |   64|  1.34k|#define SALT_ACCEPTOR     4
  ------------------
                              if (( s_candidate[i].subtype & SALT_ACCEPTOR ) && ( s_candidate[j].subtype & SALT_ACCEPTOR ) &&
  ------------------
  |  |   64|  1.13k|#define SALT_ACCEPTOR     4
  ------------------
  |  Branch (3084:21): [True: 1.13k, False: 208]
  |  Branch (3084:67): [True: 1.00k, False: 132]
  ------------------
 3085|  1.00k|                    ( ret = bExistsAltPath( pCG, pBNS, pBD, NULL, at, num_atoms, s_candidate[i].atnumber,
  ------------------
  |  Branch (3085:21): [True: 239, False: 764]
  ------------------
 3086|  1.00k|                                            s_candidate[j].atnumber, ALT_PATH_MODE_ADD2H_TST ) ))
  ------------------
  |  |  317|  1.00k|#define ALT_PATH_MODE_ADD2H_TST  8   /* test-add 2 H along alt. path A=-=B => AH-=-BH; restore changed bonds */
  ------------------
 3087|    239|                {
 3088|    239|                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|    239|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|    239|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|    239|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    239|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 239, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 239]
  |  |  ------------------
  ------------------
 3089|      0|                    {
 3090|      0|                        nTotNumChanges = ret;
 3091|      0|                        goto quick_exit;
 3092|      0|                    }
 3093|    239|                    if (ret & 1)
  ------------------
  |  Branch (3093:25): [True: 239, False: 0]
  ------------------
 3094|    239|                    {
 3095|    239|                        nDelta = ( ret & ~3 ) >> 2;
 3096|       |                        /*nNumChanges += (ret & 2);*/
 3097|    239|                        if (nDelta)
  ------------------
  |  Branch (3097:29): [True: 0, False: 239]
  ------------------
 3098|      0|                        {
 3099|       |                            /* alt path unleashed previously localized radicals and they annihilated */
 3100|       |                            /* djb-rwth: removing redundant code */
 3101|      0|                            nTotNumChanges = BNS_RADICAL_ERR;
  ------------------
  |  |   59|      0|#define BNS_RADICAL_ERR    (BNS_ERR + 11) /*(-9988)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3102|      0|                            goto quick_exit;
 3103|      0|                        }
 3104|    239|                        cPAIR( i, j ) |= ACCEPTOR_PAIR; /* the result: mark the pair */
  ------------------
  |  | 2939|    239|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                                      cPAIR( i, j ) |= ACCEPTOR_PAIR; /* the result: mark the pair */
  ------------------
  |  | 2940|    239|#define ACCEPTOR_PAIR 1
  ------------------
 3105|       |                                                        /*cPAIR(j,i) |= ACCEPTOR_PAIR;*/
 3106|    239|                    }
 3107|    239|                }
 3108|       |                /* Check for donor pair */
 3109|  1.34k|                if (( s_candidate[i].subtype & SALT_DONOR ) && ( s_candidate[j].subtype & SALT_DONOR ) &&
  ------------------
  |  |   70|  1.34k|#define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   63|  1.34k|#define SALT_DONOR_Neg    2
  |  |  ------------------
  |  |               #define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   62|  1.34k|#define SALT_DONOR_H      1
  |  |  ------------------
  ------------------
                              if (( s_candidate[i].subtype & SALT_DONOR ) && ( s_candidate[j].subtype & SALT_DONOR ) &&
  ------------------
  |  |   70|    769|#define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   63|    769|#define SALT_DONOR_Neg    2
  |  |  ------------------
  |  |               #define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   62|    769|#define SALT_DONOR_H      1
  |  |  ------------------
  ------------------
  |  Branch (3109:21): [True: 769, False: 574]
  |  Branch (3109:64): [True: 611, False: 158]
  ------------------
 3110|    611|                    ( ret = bExistsAltPath( pCG, pBNS, pBD, NULL, at, num_atoms, s_candidate[i].atnumber,
  ------------------
  |  Branch (3110:21): [True: 70, False: 541]
  ------------------
 3111|    611|                                            s_candidate[j].atnumber, ALT_PATH_MODE_REM2H_TST ) ))
  ------------------
  |  |  316|    611|#define ALT_PATH_MODE_REM2H_TST  7   /* test-remove 2 H along alt. path AH-=-BH => A=-=B; restore changed bonds */
  ------------------
 3112|     70|                {
 3113|     70|                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|     70|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|     70|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|     70|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|     70|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 70, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 70]
  |  |  ------------------
  ------------------
 3114|      0|                    {
 3115|      0|                        nTotNumChanges = ret;
 3116|      0|                        goto quick_exit;
 3117|      0|                    }
 3118|     70|                    if (ret & 1)
  ------------------
  |  Branch (3118:25): [True: 70, False: 0]
  ------------------
 3119|     70|                    {
 3120|     70|                        nDelta = ( ret & ~3 ) >> 2;
 3121|       |                        /*nNumChanges += (ret & 2);*/
 3122|     70|                        if (nDelta)
  ------------------
  |  Branch (3122:29): [True: 0, False: 70]
  ------------------
 3123|      0|                        {
 3124|       |                            /* Alt path unleashed previously localized radicals and they annihilated */
 3125|       |                            /* djb-rwth: removing redundant code */
 3126|      0|                            nTotNumChanges = BNS_RADICAL_ERR;
  ------------------
  |  |   59|      0|#define BNS_RADICAL_ERR    (BNS_ERR + 11) /*(-9988)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3127|      0|                            goto quick_exit;
 3128|      0|                        }
 3129|     70|                        cPAIR( i, j ) |= DONOR_PAIR; /* the result: mark the pair */
  ------------------
  |  | 2939|     70|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                                      cPAIR( i, j ) |= DONOR_PAIR; /* the result: mark the pair */
  ------------------
  |  | 2941|     70|#define DONOR_PAIR    2
  ------------------
 3130|       |                                                     /*cPAIR(j,i) |= ACCEPTOR_PAIR;*/
 3131|     70|                    }
 3132|     70|                }
 3133|       |                /* Since the results will be used later to change bonds, check only now */
 3134|       |                /* when both results for (i,j) have been obtained. */
 3135|  1.34k|                if (cPAIR( i, j ) & ACCEPTOR_PAIR)
  ------------------
  |  | 2939|  1.34k|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                              if (cPAIR( i, j ) & ACCEPTOR_PAIR)
  ------------------
  |  | 2940|  1.34k|#define ACCEPTOR_PAIR 1
  ------------------
  |  Branch (3135:21): [True: 239, False: 1.10k]
  ------------------
 3136|    239|                {
 3137|    239|                    nCurAcceptorPairs++;
 3138|    239|                    if (nDonorPairs)
  ------------------
  |  Branch (3138:25): [True: 12, False: 227]
  ------------------
 3139|     12|                    {
 3140|       |                        /* Find donor pair (i1,j1) such that i!=i1, i!=j1, j!=i1, j!=j1 */
 3141|     34|                        for (i1 = 0; i1 < i; i1++)
  ------------------
  |  Branch (3141:38): [True: 31, False: 3]
  ------------------
 3142|     31|                        {
 3143|     69|                            for (j1 = 0; j1 <= i1; j1++)
  ------------------
  |  Branch (3143:42): [True: 47, False: 22]
  ------------------
 3144|     47|                            {
 3145|       |                                /* Here always j1 < i && i1 < i therefore we do not compare i to i1 or j1 */
 3146|     47|                                if (j1 != j && i1 != j && ( cPAIR( i1, j1 ) & DONOR_PAIR ))
  ------------------
  |  | 2939|     35|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                                              if (j1 != j && i1 != j && ( cPAIR( i1, j1 ) & DONOR_PAIR ))
  ------------------
  |  | 2941|     35|#define DONOR_PAIR    2
  ------------------
  |  Branch (3146:37): [True: 36, False: 11]
  |  Branch (3146:48): [True: 35, False: 1]
  |  Branch (3146:59): [True: 9, False: 26]
  ------------------
 3147|      9|                                {
 3148|       |                                    /* Both the donor and the acceptor pairs have been found */
 3149|      9|                                    goto bFound2Pairs;
 3150|      9|                                }
 3151|     47|                            }
 3152|     31|                        }
 3153|     12|                    }
 3154|    239|                }
 3155|  1.33k|                if (cPAIR( i, j ) & DONOR_PAIR)
  ------------------
  |  | 2939|  1.33k|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                              if (cPAIR( i, j ) & DONOR_PAIR)
  ------------------
  |  | 2941|  1.33k|#define DONOR_PAIR    2
  ------------------
  |  Branch (3155:21): [True: 70, False: 1.26k]
  ------------------
 3156|     70|                {
 3157|     70|                    nCurDonorPairs++;
 3158|     70|                    if (nAcceptorPairs)
  ------------------
  |  Branch (3158:25): [True: 8, False: 62]
  ------------------
 3159|      8|                    {
 3160|       |                        /* Find acceptor pair (i1,j1) such that i!=i1, i!=j1, j!=i1, j!=j1 */
 3161|     25|                        for (i1 = 0; i1 < i; i1++)
  ------------------
  |  Branch (3161:38): [True: 25, False: 0]
  ------------------
 3162|     25|                        {
 3163|     57|                            for (j1 = 0; j1 <= i1; j1++)
  ------------------
  |  Branch (3163:42): [True: 40, False: 17]
  ------------------
 3164|     40|                            {
 3165|       |                                /* Here always j1 < i && i1 < i therefore we do not compare i to i1 or j1 */
 3166|     40|                                if (j1 != j && i1 != j && ( cPAIR( i1, j1 ) & ACCEPTOR_PAIR ))
  ------------------
  |  | 2939|     23|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                                              if (j1 != j && i1 != j && ( cPAIR( i1, j1 ) & ACCEPTOR_PAIR ))
  ------------------
  |  | 2940|     23|#define ACCEPTOR_PAIR 1
  ------------------
  |  Branch (3166:37): [True: 26, False: 14]
  |  Branch (3166:48): [True: 23, False: 3]
  |  Branch (3166:59): [True: 8, False: 15]
  ------------------
 3167|      8|                                {
 3168|       |                                    /* Both the donor and the acceptor pairs have been found */
 3169|      8|                                    goto bFound2Pairs;
 3170|      8|                                }
 3171|     40|                            }
 3172|     25|                        }
 3173|      8|                    }
 3174|     70|                }
 3175|  1.33k|            }
 3176|  1.08k|            nDonorPairs += nCurDonorPairs;
 3177|  1.08k|            nAcceptorPairs += nCurAcceptorPairs;
 3178|  1.08k|        }
 3179|       |
 3180|       |        /* Nothing has been found */
 3181|       |        /* djb-rwth: removing redundant code */
 3182|    553|        inchi_free( cPair );
  ------------------
  |  | 1152|    553|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 553, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 553]
  |  |  ------------------
  ------------------
 3183|    553|        cPair = NULL;
 3184|    553|        goto quick_exit;
 3185|       |
 3186|       |
 3187|       |        /* Both the donor and the acceptor pairs have been found */
 3188|     17|    bFound2Pairs:
 3189|       |        /* first, try already found pairs */
 3190|     17|        i1 = i;
 3191|     17|        j1 = j;
 3192|       |
 3193|       |        /* Find all possible donor and acceptor pairs */
 3194|     17|        nNumMarkedCandidates = 0;
 3195|    105|        for (i = 0; i < nNumLeftCandidates; i++)
  ------------------
  |  Branch (3195:21): [True: 88, False: 17]
  ------------------
 3196|     88|        {
 3197|     88|            nCurDonorPairs = nCurAcceptorPairs = 0;
 3198|    366|            for (j = 0; j <= i; j++)
  ------------------
  |  Branch (3198:25): [True: 278, False: 88]
  ------------------
 3199|    278|            {
 3200|    278|                bAlreadyTested = ( i < i1 || (i == i1 && j <= j1 )); /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (3200:36): [True: 138, False: 140]
  |  Branch (3200:47): [True: 77, False: 63]
  |  Branch (3200:58): [True: 44, False: 33]
  ------------------
 3201|    278|                if ((bAlreadyTested && ( cPAIR( i, j ) & ACCEPTOR_PAIR )) || !bAlreadyTested) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 2939|    182|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                              if ((bAlreadyTested && ( cPAIR( i, j ) & ACCEPTOR_PAIR )) || !bAlreadyTested) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 2940|    182|#define ACCEPTOR_PAIR 1
  ------------------
  |  Branch (3201:22): [True: 182, False: 96]
  |  Branch (3201:40): [True: 24, False: 158]
  |  Branch (3201:78): [True: 96, False: 158]
  ------------------
 3202|    120|                {
 3203|       |                    /* Checking for acceptor pair */
 3204|    120|                    if (( s_candidate[i].subtype & SALT_ACCEPTOR ) && ( s_candidate[j].subtype & SALT_ACCEPTOR ) &&
  ------------------
  |  |   64|    120|#define SALT_ACCEPTOR     4
  ------------------
                                  if (( s_candidate[i].subtype & SALT_ACCEPTOR ) && ( s_candidate[j].subtype & SALT_ACCEPTOR ) &&
  ------------------
  |  |   64|     92|#define SALT_ACCEPTOR     4
  ------------------
  |  Branch (3204:25): [True: 92, False: 28]
  |  Branch (3204:71): [True: 74, False: 18]
  ------------------
 3205|     74|                        ( ret = bExistsAltPath( pCG, pBNS, pBD, NULL, at, num_atoms, s_candidate[i].atnumber,
  ------------------
  |  Branch (3205:25): [True: 37, False: 37]
  ------------------
 3206|     74|                                                s_candidate[j].atnumber, ALT_PATH_MODE_ADD2H_CHG ) ))
  ------------------
  |  |  315|     74|#define ALT_PATH_MODE_ADD2H_CHG  6   /* add 2 H along alt. path A=-=B => AH-=-BH    and change bonds to alternating */
  ------------------
 3207|     37|                    {
 3208|     37|                        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|     37|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|     37|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|     37|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|     37|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 37, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 37]
  |  |  ------------------
  ------------------
 3209|      0|                        {
 3210|      0|                            nTotNumChanges = ret;
 3211|      0|                            goto quick_exit;
 3212|      0|                        }
 3213|     37|                        if (ret & 1)
  ------------------
  |  Branch (3213:29): [True: 37, False: 0]
  ------------------
 3214|     37|                        {
 3215|     37|                            nDelta = ( ret & ~3 ) >> 2;
 3216|       |                            /* djb-rwth: removing redundant code */
 3217|     37|                            if (nDelta)
  ------------------
  |  Branch (3217:33): [True: 0, False: 37]
  ------------------
 3218|      0|                            {
 3219|       |                                /* Alt path unleashed previously localized radicals and they annihilated */
 3220|       |                                /* djb-rwth: removing redundant code */
 3221|      0|                                nTotNumChanges = BNS_RADICAL_ERR;
  ------------------
  |  |   59|      0|#define BNS_RADICAL_ERR    (BNS_ERR + 11) /*(-9988)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3222|      0|                                goto quick_exit;
 3223|      0|                            }
 3224|     37|                            cPAIR( i, j ) |= ACCEPTOR_PAIR;
  ------------------
  |  | 2939|     37|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                                          cPAIR( i, j ) |= ACCEPTOR_PAIR;
  ------------------
  |  | 2940|     37|#define ACCEPTOR_PAIR 1
  ------------------
 3225|       |                            /*cPAIR(j,i) |= ACCEPTOR_PAIR;*/
 3226|     37|                            nCurAcceptorPairs += !bAlreadyTested;
 3227|     37|                            if (!( s_candidate[i].subtype & SALT_SELECTED ))
  ------------------
  |  |   72|     37|#define SALT_SELECTED    32
  ------------------
  |  Branch (3227:33): [True: 30, False: 7]
  ------------------
 3228|     30|                            {
 3229|     30|                                s_candidate[i].subtype |= SALT_SELECTED;
  ------------------
  |  |   72|     30|#define SALT_SELECTED    32
  ------------------
 3230|     30|                                nNumMarkedCandidates++;
 3231|     30|                                if (!s_candidate[i].endpoint && s_candidate[i].type)
  ------------------
  |  Branch (3231:37): [True: 26, False: 4]
  |  Branch (3231:65): [True: 26, False: 0]
  ------------------
 3232|     26|                                {
 3233|     26|                                    nNumOtherChanges++;
 3234|     26|                                }
 3235|       |                                /* djb-rwth: removing redundant code */
 3236|     30|                            }
 3237|     37|                            if (!( s_candidate[j].subtype & SALT_SELECTED ))
  ------------------
  |  |   72|     37|#define SALT_SELECTED    32
  ------------------
  |  Branch (3237:33): [True: 27, False: 10]
  ------------------
 3238|     27|                            {
 3239|     27|                                s_candidate[j].subtype |= SALT_SELECTED;
  ------------------
  |  |   72|     27|#define SALT_SELECTED    32
  ------------------
 3240|     27|                                nNumMarkedCandidates++;
 3241|     27|                                if (!s_candidate[j].endpoint && s_candidate[j].type)
  ------------------
  |  Branch (3241:37): [True: 22, False: 5]
  |  Branch (3241:65): [True: 22, False: 0]
  ------------------
 3242|     22|                                {
 3243|     22|                                    nNumOtherChanges++;
 3244|     22|                                }
 3245|       |                                /* djb-rwth: removing redundant code */
 3246|     27|                            }
 3247|     37|                        }
 3248|     37|                    }
 3249|    120|                }
 3250|       |
 3251|    278|                if ((bAlreadyTested && ( cPAIR( i, j ) & DONOR_PAIR )) || !bAlreadyTested) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 2939|    182|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                              if ((bAlreadyTested && ( cPAIR( i, j ) & DONOR_PAIR )) || !bAlreadyTested) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 2941|    182|#define DONOR_PAIR    2
  ------------------
  |  Branch (3251:22): [True: 182, False: 96]
  |  Branch (3251:40): [True: 18, False: 164]
  |  Branch (3251:75): [True: 96, False: 164]
  ------------------
 3252|    114|                {
 3253|       |                    /* Checking for donor pair */
 3254|    114|                    if (( s_candidate[i].subtype & SALT_DONOR ) && ( s_candidate[j].subtype & SALT_DONOR ) &&
  ------------------
  |  |   70|    114|#define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   63|    114|#define SALT_DONOR_Neg    2
  |  |  ------------------
  |  |               #define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   62|    114|#define SALT_DONOR_H      1
  |  |  ------------------
  ------------------
                                  if (( s_candidate[i].subtype & SALT_DONOR ) && ( s_candidate[j].subtype & SALT_DONOR ) &&
  ------------------
  |  |   70|     87|#define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   63|     87|#define SALT_DONOR_Neg    2
  |  |  ------------------
  |  |               #define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   62|     87|#define SALT_DONOR_H      1
  |  |  ------------------
  ------------------
  |  Branch (3254:25): [True: 87, False: 27]
  |  Branch (3254:68): [True: 52, False: 35]
  ------------------
 3255|     52|                        ( ret = bExistsAltPath( pCG, pBNS, pBD, NULL, at, num_atoms, s_candidate[i].atnumber,
  ------------------
  |  Branch (3255:25): [True: 20, False: 32]
  ------------------
 3256|     52|                                                s_candidate[j].atnumber, ALT_PATH_MODE_REM2H_CHG ) ))
  ------------------
  |  |  314|     52|#define ALT_PATH_MODE_REM2H_CHG  5   /* remove 2 H along alt. path AH-=-BH => A=-=B and change bonds to alternating */
  ------------------
 3257|     20|                    {
 3258|     20|                        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|     20|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|     20|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|     20|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|     20|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 20, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 20]
  |  |  ------------------
  ------------------
 3259|      0|                        {
 3260|      0|                            nTotNumChanges = ret;
 3261|      0|                            goto quick_exit;
 3262|      0|                        }
 3263|     20|                        if (ret & 1)
  ------------------
  |  Branch (3263:29): [True: 20, False: 0]
  ------------------
 3264|     20|                        {
 3265|     20|                            nDelta = ( ret & ~3 ) >> 2;
 3266|       |                            /* djb-rwth: removing redundant code */
 3267|     20|                            if (nDelta)
  ------------------
  |  Branch (3267:33): [True: 0, False: 20]
  ------------------
 3268|      0|                            {
 3269|       |                                /* Alt path unleashed previously localized radicals and they annihilated */
 3270|       |                                /* djb-rwth: removing redundant code */
 3271|      0|                                nTotNumChanges = BNS_RADICAL_ERR;
  ------------------
  |  |   59|      0|#define BNS_RADICAL_ERR    (BNS_ERR + 11) /*(-9988)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3272|      0|                                goto quick_exit;
 3273|      0|                            }
 3274|     20|                            cPAIR( i, j ) |= DONOR_PAIR;
  ------------------
  |  | 2939|     20|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                                          cPAIR( i, j ) |= DONOR_PAIR;
  ------------------
  |  | 2941|     20|#define DONOR_PAIR    2
  ------------------
 3275|       |                            /*cPAIR(j,i) |= ACCEPTOR_PAIR;*/
 3276|     20|                            nCurDonorPairs += !bAlreadyTested;
 3277|     20|                            if (!( s_candidate[i].subtype & SALT_SELECTED ))
  ------------------
  |  |   72|     20|#define SALT_SELECTED    32
  ------------------
  |  Branch (3277:33): [True: 16, False: 4]
  ------------------
 3278|     16|                            {
 3279|     16|                                s_candidate[i].subtype |= SALT_SELECTED;
  ------------------
  |  |   72|     16|#define SALT_SELECTED    32
  ------------------
 3280|     16|                                nNumMarkedCandidates++;
 3281|     16|                                if (!s_candidate[i].endpoint && s_candidate[i].type)
  ------------------
  |  Branch (3281:37): [True: 16, False: 0]
  |  Branch (3281:65): [True: 16, False: 0]
  ------------------
 3282|     16|                                {
 3283|     16|                                    nNumOtherChanges++;
 3284|     16|                                }
 3285|       |                                /* djb-rwth: removing redundant code */
 3286|     16|                            }
 3287|     20|                            if (!( s_candidate[j].subtype & SALT_SELECTED ))
  ------------------
  |  |   72|     20|#define SALT_SELECTED    32
  ------------------
  |  Branch (3287:33): [True: 13, False: 7]
  ------------------
 3288|     13|                            {
 3289|     13|                                s_candidate[j].subtype |= SALT_SELECTED;
  ------------------
  |  |   72|     13|#define SALT_SELECTED    32
  ------------------
 3290|     13|                                nNumMarkedCandidates++;
 3291|     13|                                if (!s_candidate[j].endpoint && s_candidate[j].type)
  ------------------
  |  Branch (3291:37): [True: 10, False: 3]
  |  Branch (3291:65): [True: 10, False: 0]
  ------------------
 3292|     10|                                {
 3293|     10|                                    nNumOtherChanges++;
 3294|     10|                                }
 3295|       |                                /* djb-rwth: removing redundant code */
 3296|     13|                            }
 3297|     20|                        }
 3298|     20|                    }
 3299|    114|                }
 3300|    278|            }
 3301|     88|            nDonorPairs += nCurDonorPairs;
 3302|     88|            nAcceptorPairs += nCurAcceptorPairs;
 3303|     88|        }
 3304|       |
 3305|     17|        inchi_free( cPair );
  ------------------
  |  | 1152|     17|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 17, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 17]
  |  |  ------------------
  ------------------
 3306|     17|        cPair = NULL;
 3307|       |
 3308|     17|        if (nNumMarkedCandidates)
  ------------------
  |  Branch (3308:13): [True: 17, False: 0]
  ------------------
 3309|     17|        {
 3310|     17|            EndPoint = (T_ENDPOINT *) inchi_calloc( nNumMarkedCandidates, sizeof( EndPoint[0] ) );
  ------------------
  |  | 1146|     17|#define inchi_calloc   calloc
  ------------------
 3311|     17|            if (!EndPoint)
  ------------------
  |  Branch (3311:17): [True: 0, False: 17]
  ------------------
 3312|      0|            {
 3313|       |                /*printf("BNS_OUT_OF_RAM-7\n");*/
 3314|      0|                nTotNumChanges = BNS_OUT_OF_RAM;
  ------------------
  |  |   49|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3315|      0|                goto quick_exit;
 3316|      0|            }
 3317|    105|            for (i = 0, j = 0; i < nNumLeftCandidates; i++)
  ------------------
  |  Branch (3317:32): [True: 88, False: 17]
  ------------------
 3318|     88|            {
 3319|     88|                if (s_candidate[i].subtype & SALT_SELECTED)
  ------------------
  |  |   72|     88|#define SALT_SELECTED    32
  ------------------
  |  Branch (3319:21): [True: 86, False: 2]
  ------------------
 3320|     86|                {
 3321|     86|                    s_candidate[i].subtype ^= SALT_SELECTED; /* remove the flag */
  ------------------
  |  |   72|     86|#define SALT_SELECTED    32
  ------------------
 3322|     86|                    if (j < nNumMarkedCandidates)
  ------------------
  |  Branch (3322:25): [True: 86, False: 0]
  ------------------
 3323|     86|                    {
 3324|     86|                        i1 = s_candidate[i].atnumber; /* save a representative of the t-group to be created */
 3325|     86|                        AddEndPoint( EndPoint + j, at, i1 );
 3326|     86|                    }
 3327|     86|                    j++;
 3328|     86|                }
 3329|     88|            }
 3330|     17|            if (j != nNumMarkedCandidates)
  ------------------
  |  Branch (3330:17): [True: 0, False: 17]
  ------------------
 3331|      0|            {
 3332|      0|                nTotNumChanges = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3333|      0|                goto quick_exit;
 3334|      0|            }
 3335|       |
 3336|       |            /* Merge all marked atoms and their t-groups into one t-group */
 3337|     17|            ret = RegisterEndPoints( pCG, t_group_info, EndPoint,
 3338|     17|                                     nNumMarkedCandidates, at,
 3339|     17|                                     num_atoms, c_group_info, pBNS );
 3340|       |
 3341|     17|            if (ret == -1)
  ------------------
  |  Branch (3341:17): [True: 0, False: 17]
  ------------------
 3342|      0|            {
 3343|      0|                ret = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3344|      0|            }
 3345|     17|            if (ret < 0)
  ------------------
  |  Branch (3345:17): [True: 0, False: 17]
  ------------------
 3346|      0|            {
 3347|      0|                nTotNumChanges = ret;
 3348|      0|                goto quick_exit;
 3349|      0|            }
 3350|     17|            nTotNumChanges += ( ret > 0 );
 3351|     17|            inchi_free( EndPoint );
  ------------------
  |  | 1152|     17|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 17, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 17]
  |  |  ------------------
  ------------------
 3352|     17|            EndPoint = NULL;
 3353|       |
 3354|     17|            if (nNumMarkedCandidates)
  ------------------
  |  Branch (3354:17): [True: 17, False: 0]
  ------------------
 3355|     17|            {
 3356|     30|                for (i = nNumLeftCandidates; i < nNumCandidates; i++)
  ------------------
  |  Branch (3356:46): [True: 13, False: 17]
  ------------------
 3357|     13|                {
 3358|     13|                    s_candidate[i].type += DISABLE_CANDIDATE;
  ------------------
  |  | 2938|     13|#define DISABLE_CANDIDATE 10
  ------------------
 3359|     13|                    j1 = s_candidate[i].atnumber;
 3360|     13|                    if (at[j1].endpoint == at[i1].endpoint)
  ------------------
  |  Branch (3360:25): [True: 13, False: 0]
  ------------------
 3361|     13|                    {
 3362|     13|                        if (!s_candidate[i].endpoint && s_candidate[i].type)
  ------------------
  |  Branch (3362:29): [True: 0, False: 13]
  |  Branch (3362:57): [True: 0, False: 0]
  ------------------
 3363|      0|                        {
 3364|      0|                            nNumOtherChanges++;
 3365|      0|                        }
 3366|       |                        /* djb-rwth: removing redundant code */
 3367|     13|                    }
 3368|     13|                }
 3369|     17|            }
 3370|      0|            else
 3371|      0|            {
 3372|      0|                for (i = nNumLeftCandidates; i < nNumCandidates; i++)
  ------------------
  |  Branch (3372:46): [True: 0, False: 0]
  ------------------
 3373|      0|                {
 3374|      0|                    s_candidate[i].type += DISABLE_CANDIDATE;
  ------------------
  |  | 2938|      0|#define DISABLE_CANDIDATE 10
  ------------------
 3375|      0|                }
 3376|      0|            }
 3377|       |
 3378|       |            /* Find whether the new t-group have any movable H */
 3379|     34|            for (i = 0, bTGroupHasNegativeChargesOnly = 0; i < t_group_info->num_t_groups; i++)
  ------------------
  |  Branch (3379:60): [True: 17, False: 17]
  ------------------
 3380|     17|            {
 3381|     17|                if (t_group_info->t_group[i].nGroupNumber == at[i1].endpoint &&
  ------------------
  |  Branch (3381:21): [True: 17, False: 0]
  ------------------
 3382|     17|                     t_group_info->t_group[i].num[0] == t_group_info->t_group[i].num[1])
  ------------------
  |  Branch (3382:22): [True: 0, False: 17]
  ------------------
 3383|      0|                {
 3384|      0|                    bTGroupHasNegativeChargesOnly = 1;
 3385|      0|                    break;
 3386|      0|                }
 3387|     17|            }
 3388|     17|        }
 3389|     17|        nTotNumChanges = ( nTotNumChanges > 0 );
 3390|       |
 3391|     17|#if ( IGNORE_TGROUP_WITHOUT_H == 1 )
 3392|     17|        if (nTotNumChanges && bTGroupHasNegativeChargesOnly)
  ------------------
  |  Branch (3392:13): [True: 17, False: 0]
  |  Branch (3392:31): [True: 0, False: 17]
  ------------------
 3393|      0|        {
 3394|      0|            nTotNumChanges = 2;  /* means no moveable H has been affected */
 3395|      0|        }
 3396|     17|#endif
 3397|     17|    }
 3398|       |
 3399|    570|quick_exit:
 3400|    570|    if (nNumOtherChanges && nTotNumChanges == 1)
  ------------------
  |  Branch (3400:9): [True: 17, False: 553]
  |  Branch (3400:29): [True: 17, False: 0]
  ------------------
 3401|     17|    {
 3402|     17|        nTotNumChanges = 5; /* not only acidic atoms merged */
 3403|     17|    }
 3404|    570|    if (cPair)
  ------------------
  |  Branch (3404:9): [True: 0, False: 570]
  ------------------
 3405|      0|    {
 3406|      0|        inchi_free( cPair );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3407|       |        /*cPair = NULL;*/
 3408|      0|    }
 3409|    570|    if (EndPoint)
  ------------------
  |  Branch (3409:9): [True: 0, False: 570]
  ------------------
 3410|      0|    {
 3411|      0|        inchi_free( EndPoint );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3412|       |        /*EndPoint = NULL;*/
 3413|      0|    }
 3414|       |
 3415|    570|    return nTotNumChanges; /* 0=>no changes, 1=>new salt tautomerism found, 2=>only new charge tautomerism found */
 3416|   252k|#undef ALT_PATH_FOUND
 3417|   252k|#undef NO_ENDPOINT
 3418|   252k|}
MarkSaltChargeGroups:
 3456|   252k|{
 3457|       |
 3458|   252k|    int nNumChanges = 0, nTotNumChanges = 0;
 3459|   252k|    if (s_group_info && s_group_info->s_candidate && s_group_info->max_num_candidates > 0)
  ------------------
  |  Branch (3459:9): [True: 252k, False: 0]
  |  Branch (3459:25): [True: 252k, False: 0]
  |  Branch (3459:54): [True: 252k, False: 0]
  ------------------
 3460|   252k|    {
 3461|   252k|        int i, i1, i2, j, j1, j2, jj, ii1, ii2, jj1, jj2, /*k,*/ num_tested;
 3462|   252k|        S_CANDIDATE *s_candidate = s_group_info->s_candidate;
 3463|   252k|        int          nMaxNumCandidates = s_group_info->max_num_candidates;
 3464|   252k|        int          nNumCandidates = s_group_info->num_candidates;
 3465|   252k|        int          nNumOtherCandidates; /* djb-rwth: removing redundant code */
 3466|   252k|        int          nNumPOnlyCandidates; /* djb-rwth: removing redundant code */
 3467|   252k|        int          s_type, s_subtype;
 3468|   252k|        int          ret, nDelta, /*nMobile,*/ err = 0;
 3469|   252k|        int          s_subtype_all = 0;
 3470|   252k|        int          nGroupNumber;
 3471|   252k|        T_ENDPOINT   EndPoint[2];
 3472|       |#if ( MAX_LOCAL_TGNUM > 0 )
 3473|       |        TGroupData   tgData[MAX_LOCAL_TGNUM];
 3474|       |        TGroupData   *ptgData = tgData;
 3475|       |#endif
 3476|   252k|        int cond1 = 0, cond2a = 0, cond2b = 0, cond2c = 0, cond2 = 0;
 3477|       |
 3478|   252k|        if (nNumCandidates <= -1 || !t_group_info || !t_group_info->t_group)
  ------------------
  |  Branch (3478:13): [True: 0, False: 252k]
  |  Branch (3478:37): [True: 0, False: 252k]
  |  Branch (3478:54): [True: 0, False: 252k]
  ------------------
 3479|      0|        {
 3480|      0|            return 0;
 3481|      0|        }
 3482|       |
 3483|       |        /* count t-groups */
 3484|   257k|        for (i = 0, nGroupNumber = 0; i < t_group_info->num_t_groups; i++)
  ------------------
  |  Branch (3484:39): [True: 5.62k, False: 252k]
  ------------------
 3485|  5.62k|        {
 3486|  5.62k|            if (nGroupNumber < t_group_info->t_group[i].nGroupNumber)
  ------------------
  |  Branch (3486:17): [True: 5.62k, False: 0]
  ------------------
 3487|  5.62k|            {
 3488|  5.62k|                nGroupNumber = t_group_info->t_group[i].nGroupNumber; /* max. t-group number */
 3489|  5.62k|            }
 3490|  5.62k|        }
 3491|       |#if ( MAX_LOCAL_TGNUM > 0 )
 3492|       |        /* prepare memory */
 3493|       |        if (nGroupNumber >= MAX_LOCAL_TGNUM)
 3494|       |        {
 3495|       |            if (!( ptgData = (TGroupData*) inchi_calloc( nGroupNumber + 1, sizeof( TGroupData ) ) ))
 3496|       |            {
 3497|       |                err = BNS_OUT_OF_RAM;
 3498|       |                goto quick_exit;
 3499|       |            }
 3500|       |        }
 3501|       |        else
 3502|       |        {
 3503|       |            memset( ptgData, 0, sizeof( tgData ) );
 3504|       |        }
 3505|       |        ptgData[0].nGroupIndex = -1; /* data for non-tautomeric atoms */
 3506|       |        for (i = 0, nGroupNumber = 0; i < t_group_info->num_t_groups; i++)
 3507|       |        {
 3508|       |            if (nGroupNumber = t_group_info->t_group[i].nGroupNumber)
 3509|       |            {
 3510|       |                ptgData[nGroupNumber].nGroupIndex = i;
 3511|       |                ptgData[i].nGroupNumber = nGroupNumber;
 3512|       |            }
 3513|       |        }
 3514|       |#endif
 3515|   252k|        nNumCandidates = 0; /* always recalculate 2004-03-22 */
 3516|   252k|        num_tested = 0;
 3517|       |
 3518|   252k|        if (nNumCandidates == 0)
  ------------------
  |  Branch (3518:13): [True: 252k, False: 0]
  ------------------
 3519|   252k|        {
 3520|  1.30M|            for (i = 0, nNumCandidates = nNumOtherCandidates = nNumPOnlyCandidates = 0; i < num_atoms; i++)
  ------------------
  |  Branch (3520:89): [True: 1.05M, False: 252k]
  ------------------
 3521|  1.05M|            {
 3522|  1.05M|                if (0 == ( s_type = GetSaltChargeType( at, i, t_group_info, &s_subtype ) ) ||
  ------------------
  |  Branch (3522:21): [True: 2.87k, False: 1.04M]
  ------------------
 3523|       |                     /* -C=O or =C-OH, O = S, Se, Te */
 3524|  1.04M|#if ( INCL_NON_SALT_CANDIDATATES == 1 )
 3525|  1.04M|                     1 == ( s_type = GetOtherSaltChargeType( at, i, t_group_info, &s_subtype, 1 ) ) ||
  ------------------
  |  Branch (3525:22): [True: 40.1k, False: 1.00M]
  ------------------
 3526|       |                     /* =Z-MH or -Z=M, Z = centerpoint, M = endpoint, other than above */
 3527|  1.00M|#endif
 3528|  1.00M|                     2 == ( s_type = GetOtherSaltType( at, i, &s_subtype ) )
  ------------------
  |  Branch (3528:22): [True: 350, False: 1.00M]
  ------------------
 3529|       |                     /* >C-SH, >C-S(-); S=S,Se,Te */
 3530|  1.05M|                     )
 3531|  43.3k|                {
 3532|       |
 3533|  43.3k|                    if (nNumCandidates >= nMaxNumCandidates)
  ------------------
  |  Branch (3533:25): [True: 0, False: 43.3k]
  ------------------
 3534|      0|                    {
 3535|      0|                        err = BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3536|      0|                        goto quick_exit;
 3537|      0|                    }
 3538|  43.3k|                    s_candidate[nNumCandidates].atnumber = i;
 3539|  43.3k|                    s_candidate[nNumCandidates].type = s_type;
 3540|  43.3k|                    s_candidate[nNumCandidates].subtype = s_subtype;
 3541|  43.3k|                    s_candidate[nNumCandidates].endpoint = at[i].endpoint;
 3542|  43.3k|                    nNumCandidates++;
 3543|  43.3k|                    nNumOtherCandidates += ( 1 == s_type );
 3544|  43.3k|                    nNumPOnlyCandidates += ( 2 == s_type );
 3545|  43.3k|                    s_subtype_all |= s_subtype;
 3546|       |                    /*i1 = i;*/ /* save a representative of a tautomeric group */
 3547|  43.3k|                }
 3548|  1.05M|            } /* for */
 3549|       |
 3550|       |              /* changes: TG_FLAG_ALLOW_NO_NEGTV_O replaced CHARGED_SALTS_ONLY==0 */
 3551|   252k|            cond1 = s_subtype_all & SALT_ACCEPTOR;
  ------------------
  |  |   64|   252k|#define SALT_ACCEPTOR     4
  ------------------
 3552|   252k|            cond2a = t_group_info->bTautFlags & TG_FLAG_ALLOW_NO_NEGTV_O;
  ------------------
  |  |  923|   252k|#define TG_FLAG_ALLOW_NO_NEGTV_O         0x00000020   /* CHARGED_SALTS_ONLY=0 (debug) find long-range H-only tautomerism on =C-OH, >C=O */
  ------------------
 3553|   252k|            cond2b = t_group_info->bTautFlagsDone & TG_FLAG_FOUND_SALT_CHARGES_DONE;
  ------------------
  |  |  980|   252k|#define TG_FLAG_FOUND_SALT_CHARGES_DONE  0x00002000   /* not assigned: preprocessing detected possibility of salt-type tautomerism */
  ------------------
 3554|   252k|            cond2c = t_group_info->tni.bNormalizationFlags & FLAG_FORCE_SALT_TAUT;
  ------------------
  |  |  172|   252k|#define FLAG_FORCE_SALT_TAUT         ( FLAG_PROTON_NP_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  147|   252k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  173|   252k|                                       FLAG_PROTON_AC_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  150|   252k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  174|   252k|                                       FLAG_PROTON_AC_HARD_ADDED    )
  |  |  ------------------
  |  |  |  |  151|   252k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  ------------------
 3555|   252k|            if (cond2a || cond2b || cond2c)
  ------------------
  |  Branch (3555:17): [True: 0, False: 252k]
  |  Branch (3555:27): [True: 0, False: 252k]
  |  Branch (3555:37): [True: 211, False: 252k]
  ------------------
 3556|    211|            {
 3557|    211|                cond2 = !( s_subtype_all & ( SALT_DONOR_Neg | SALT_DONOR_H ) );
  ------------------
  |  |   63|    211|#define SALT_DONOR_Neg    2
  ------------------
                              cond2 = !( s_subtype_all & ( SALT_DONOR_Neg | SALT_DONOR_H ) );
  ------------------
  |  |   62|    211|#define SALT_DONOR_H      1
  ------------------
 3558|    211|            }
 3559|   252k|            else
 3560|   252k|            {
 3561|   252k|                cond2 = !( s_subtype_all & SALT_DONOR_Neg ) || nNumOtherCandidates == nNumCandidates;
  ------------------
  |  |   63|   252k|#define SALT_DONOR_Neg    2
  ------------------
  |  Branch (3561:25): [True: 247k, False: 4.67k]
  |  Branch (3561:64): [True: 4.11k, False: 561]
  ------------------
 3562|   252k|            }
 3563|   252k|            if (nNumCandidates <= 1 || !cond1 || cond2
  ------------------
  |  Branch (3563:17): [True: 238k, False: 13.5k]
  |  Branch (3563:40): [True: 136, False: 13.4k]
  |  Branch (3563:50): [True: 12.7k, False: 669]
  ------------------
 3564|       |                 /*(
 3565|       |                 ( cond2a || cond2b    || cond2c )
 3566|       |                 ?        !(s_subtype_all & (SALT_DONOR_Neg | SALT_DONOR_H))
 3567|       |                 :        ( !(s_subtype_all & SALT_DONOR_Neg) || nNumOtherCandidates==nNumCandidates) ) */
 3568|   252k|                 )
 3569|   251k|            {
 3570|   251k|                s_group_info->num_candidates = -1; /* no candidate exists */
 3571|   251k|                goto quick_exit;
 3572|   251k|            }
 3573|    669|            if (!( s_subtype_all & ( SALT_DONOR_Neg ) ))
  ------------------
  |  |   63|    669|#define SALT_DONOR_Neg    2
  ------------------
  |  Branch (3573:17): [True: 83, False: 586]
  ------------------
 3574|     83|            {
 3575|     83|                t_group_info->bTautFlagsDone |= TG_FLAG_ALLOW_NO_NEGTV_O_DONE;
  ------------------
  |  |  968|     83|#define TG_FLAG_ALLOW_NO_NEGTV_O_DONE    0x00000040
  ------------------
 3576|     83|            }
 3577|    669|        }
 3578|      0|        else
 3579|      0|        {
 3580|      0|            for (i = 0; i < nNumCandidates; i++)
  ------------------
  |  Branch (3580:25): [True: 0, False: 0]
  ------------------
 3581|      0|            {
 3582|      0|                i1 = s_candidate[i].atnumber;
 3583|      0|                if (0 <= ( s_type = GetSaltChargeType( at, i1, t_group_info, &s_subtype ) )
  ------------------
  |  Branch (3583:21): [True: 0, False: 0]
  ------------------
 3584|      0|#if ( INCL_NON_SALT_CANDIDATATES == 1 )
 3585|      0|                     || 0 < ( s_type = GetOtherSaltChargeType( at, i1, t_group_info, &s_subtype, 1 /* bAccept_O*/ ) )
  ------------------
  |  Branch (3585:25): [True: 0, False: 0]
  ------------------
 3586|      0|#endif
 3587|      0|                     )
 3588|      0|                {
 3589|      0|                    s_candidate[nNumCandidates].type = s_type;
 3590|      0|                    s_candidate[nNumCandidates].subtype = s_subtype;
 3591|      0|                    s_candidate[nNumCandidates].endpoint = at[i1].endpoint;
 3592|      0|                }
 3593|      0|            }
 3594|      0|        }
 3595|       |
 3596|       |        /* Look for alt paths connecting:
 3597|       |        SALT_DONOR_Neg to SALT_ACCEPTOR  : long distance migration of negative charges
 3598|       |        SALT_DONOR_H   to SALT_ACCEPTOR  : long distance migration of H-atoms
 3599|       |        */
 3600|    669|        do
 3601|    787|        {
 3602|    787|            nNumChanges = 0;
 3603|  3.15k|            for (i1 = 0; i1 < nNumCandidates; i1++)
  ------------------
  |  Branch (3603:26): [True: 2.36k, False: 787]
  ------------------
 3604|  2.36k|            {
 3605|  2.36k|                j1 = s_candidate[i1].atnumber;
 3606|  5.25k|                for (i2 = i1 + 1; i2 < nNumCandidates; i2++)
  ------------------
  |  Branch (3606:35): [True: 2.88k, False: 2.36k]
  ------------------
 3607|  2.88k|                {
 3608|       |                    /* prev. approach: do not test if both candidates are not "salt-type". Disabled 2004-03-18
 3609|       |                    if ( s_candidate[i1].type && s_candidate[i2].type )
 3610|       |                    continue;
 3611|       |                    */
 3612|  2.88k|                    j2 = s_candidate[i2].atnumber;
 3613|  2.88k|                    if (at[j1].endpoint && at[j1].endpoint == at[j2].endpoint)
  ------------------
  |  Branch (3613:25): [True: 2.01k, False: 878]
  |  Branch (3613:44): [True: 1.38k, False: 625]
  ------------------
 3614|  1.38k|                    {
 3615|  1.38k|                        continue;
 3616|  1.38k|                    }
 3617|  4.29k|                    for (j = 0; j < 2; j++)
  ------------------
  |  Branch (3617:33): [True: 2.93k, False: 1.35k]
  ------------------
 3618|  2.93k|                    {
 3619|  2.93k|                        if (j)
  ------------------
  |  Branch (3619:29): [True: 1.43k, False: 1.50k]
  ------------------
 3620|  1.43k|                        {
 3621|  1.43k|                            ii1 = i2; /* candidate 1 (donor)    ordering number */
 3622|  1.43k|                            ii2 = i1; /* candidate 2 (acceptor) ordering number */
 3623|  1.43k|                            jj1 = j2; /* candidate 1 (donor)    atom number */
 3624|  1.43k|                            jj2 = j1; /* candidate 2 (acceptor) atom number */
 3625|  1.43k|                        }
 3626|  1.50k|                        else
 3627|  1.50k|                        {
 3628|       |                            /* transposition */
 3629|  1.50k|                            ii1 = i1; /* candidate 1 (donor)    ordering number */
 3630|  1.50k|                            ii2 = i2; /* candidate 2 (acceptor) ordering number */
 3631|  1.50k|                            jj1 = j1; /* candidate 1 (donor)    atom number     */
 3632|  1.50k|                            jj2 = j2; /* candidate 2 (acceptor) atom number     */
 3633|  1.50k|                        }
 3634|       |
 3635|  2.93k|                        if (( s_candidate[ii1].subtype & ( SALT_DONOR_Neg | SALT_DONOR_H ) ) &&
  ------------------
  |  |   63|  2.93k|#define SALT_DONOR_Neg    2
  ------------------
                                      if (( s_candidate[ii1].subtype & ( SALT_DONOR_Neg | SALT_DONOR_H ) ) &&
  ------------------
  |  |   62|  2.93k|#define SALT_DONOR_H      1
  ------------------
  |  Branch (3635:29): [True: 1.70k, False: 1.23k]
  ------------------
 3636|  1.70k|                            ( s_candidate[ii2].subtype & SALT_ACCEPTOR ))
  ------------------
  |  |   64|  1.70k|#define SALT_ACCEPTOR     4
  ------------------
  |  Branch (3636:29): [True: 1.43k, False: 261]
  ------------------
 3637|  1.43k|                        {
 3638|       |                            /****printf("\nChkpt @ %-s:%-d ", __FILE__,__LINE__); fflush(stdout);*/
 3639|       |
 3640|  1.43k|                            ret = bExistsAltPath( pCG, pBNS, pBD, NULL, at, num_atoms, jj2, jj1, ALT_PATH_MODE_4_SALT );
  ------------------
  |  |  312|  1.43k|#define ALT_PATH_MODE_4_SALT     3   /* mark alt bonds along the path */
  ------------------
 3641|       |
 3642|  1.43k|                            num_tested++;
 3643|  1.43k|                            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  1.43k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  1.43k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  1.43k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  1.43k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 1.43k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 1.43k]
  |  |  ------------------
  ------------------
 3644|      0|                            {
 3645|      0|                                err = ret;
 3646|      0|                                goto quick_exit;
 3647|      0|                            }
 3648|       |
 3649|  1.43k|                            if (ret & 1)
  ------------------
  |  Branch (3649:33): [True: 146, False: 1.29k]
  ------------------
 3650|    146|                            {
 3651|    146|                                nDelta = ( ret & ~3 ) >> 2;
 3652|    146|                                nNumChanges += ( ret & 2 );
 3653|    438|                                for (i = 0; i < 2; i++)
  ------------------
  |  Branch (3653:45): [True: 292, False: 146]
  ------------------
 3654|    292|                                {
 3655|    292|                                    jj = i ? jj2 : jj1;
  ------------------
  |  Branch (3655:42): [True: 146, False: 146]
  ------------------
 3656|    292|                                    AddEndPoint( EndPoint + i, at, jj );
 3657|    292|                                }
 3658|       |
 3659|       |                                /* add/merge taut groups and reinit pBNS in the fly */
 3660|    146|                                ret = RegisterEndPoints( pCG, t_group_info,
 3661|    146|                                                         EndPoint, 2, at,
 3662|    146|                                                         num_atoms, c_group_info,
 3663|    146|                                                         pBNS );
 3664|    146|                                if (ret == -1)
  ------------------
  |  Branch (3664:37): [True: 0, False: 146]
  ------------------
 3665|      0|                                {
 3666|      0|                                    ret = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3667|      0|                                }
 3668|    146|                                if (ret < 0)
  ------------------
  |  Branch (3668:37): [True: 0, False: 146]
  ------------------
 3669|      0|                                {
 3670|      0|                                    err = ret;
 3671|      0|                                    goto quick_exit;
 3672|      0|                                }
 3673|    146|                                if (nDelta)
  ------------------
  |  Branch (3673:37): [True: 0, False: 146]
  ------------------
 3674|      0|                                {
 3675|      0|                                    err = BNS_RADICAL_ERR;
  ------------------
  |  |   59|      0|#define BNS_RADICAL_ERR    (BNS_ERR + 11) /*(-9988)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3676|      0|                                    goto quick_exit;
 3677|      0|                                }
 3678|    146|                                nNumChanges += ( ret > 0 );
 3679|    146|                                break; /* avoid redundant repetition */
 3680|    146|                            }
 3681|  1.43k|                        }
 3682|  2.93k|                    }
 3683|  1.50k|                }
 3684|  2.36k|            }
 3685|    787|            nTotNumChanges += nNumChanges;
 3686|    787|        } while (num_tested && nNumChanges);
  ------------------
  |  Branch (3686:18): [True: 514, False: 273]
  |  Branch (3686:32): [True: 118, False: 396]
  ------------------
 3687|       |
 3688|   252k|    quick_exit:
 3689|   252k|        if (!err)
  ------------------
  |  Branch (3689:13): [True: 252k, False: 0]
  ------------------
 3690|   252k|        {
 3691|   252k|            nTotNumChanges += nNumChanges; /* nNumChanges != 0 only in case of 'goto quick_exit' */
 3692|   252k|            if (s_group_info->num_candidates == 0)
  ------------------
  |  Branch (3692:17): [True: 551, False: 251k]
  ------------------
 3693|    551|            {
 3694|       |                /* first time: initialize */
 3695|    551|                s_group_info->num_candidates = num_tested ? nNumCandidates : -1; /* no candidate exists */
  ------------------
  |  Branch (3695:48): [True: 370, False: 181]
  ------------------
 3696|    551|            }
 3697|   252k|        }
 3698|      0|        else
 3699|      0|        {
 3700|      0|            nTotNumChanges = err;
 3701|      0|        }
 3702|       |#if ( MAX_LOCAL_TGNUM > 0 )
 3703|       |        if (ptgData != tgData)
 3704|       |        {
 3705|       |            inchi_free( ptgData );
 3706|       |        }
 3707|       |#endif
 3708|   252k|    }
 3709|       |
 3710|   252k|    return nTotNumChanges;
 3711|   252k|}
MergeSaltTautGroups:
 3925|   252k|{
 3926|       |    /* Count candidates to be connected: exclude pure donors that do not belong to any t-group */
 3927|   252k|    AT_NUMB    nCurTGroupNumber;
 3928|   252k|    int        i, j, /*k,*/ ret, iat, /*nMobile,*/ nMinNumEndpoints;
 3929|   252k|    int        s_subtype_all, s_subtype_taut;
 3930|   252k|    int        nMaxNumCandidates, nNumCandidates; /* djb-rwth: removing redundant variables */
 3931|   252k|    T_ENDPOINT EndPointStackArray[MAX_STACK_ARRAY_LEN]; /* will be reallocated if too short */
 3932|   252k|    T_ENDPOINT  *EndPoint = EndPointStackArray;
 3933|       |
 3934|       |
 3935|   252k|    if (!s_group_info || !s_group_info->s_candidate || /*s_group_info->num_candidates <= 0 ||*/
  ------------------
  |  Branch (3935:9): [True: 0, False: 252k]
  |  Branch (3935:26): [True: 0, False: 252k]
  ------------------
 3936|   252k|         !t_group_info || !t_group_info->t_group || !c_group_info)
  ------------------
  |  Branch (3936:10): [True: 0, False: 252k]
  |  Branch (3936:27): [True: 0, False: 252k]
  |  Branch (3936:53): [True: 0, False: 252k]
  ------------------
 3937|      0|    {
 3938|      0|        return 0;
 3939|      0|    }
 3940|   252k|    nMinNumEndpoints = 0;
 3941|   252k|    nMaxNumCandidates = s_group_info->max_num_candidates;
 3942|   252k|    nCurTGroupNumber = MAX_ATOMS;  /* impossible t-group number */
  ------------------
  |  |   15|   252k|#define MAX_ATOMS  32766
  ------------------
 3943|   252k|    s_subtype_all = s_subtype_taut = 0;
 3944|       |
 3945|       |    /* Collect tautomeric acidic O and previously non-tautomeric C-OH, C-SH, C-O(-), C-S(-)  */
 3946|       |    /* find whether previously found tautomeric atoms have both mobile H and (-) */
 3947|   252k|    if (1 || ( s_group_info->num_candidates < 0 ))
  ------------------
  |  Branch (3947:9): [True: 252k, Folded]
  |  Branch (3947:14): [True: 0, False: 0]
  ------------------
 3948|   252k|    {
 3949|       |        /* Can be only -O(-)  and -OH */
 3950|   252k|        int          s_type, s_subtype;
 3951|   252k|        S_CANDIDATE *s_candidate = s_group_info->s_candidate;
 3952|  1.30M|        for (i = 0, nNumCandidates = 0; i < num_atoms; i++) /* djb-rwth: removing redundant code */
  ------------------
  |  Branch (3952:41): [True: 1.05M, False: 252k]
  ------------------
 3953|  1.05M|        {
 3954|  1.05M|            s_subtype = 0;
 3955|  1.05M|            if (0 == ( s_type = GetSaltChargeType( at, i, t_group_info, &s_subtype ) ) ||
  ------------------
  |  Branch (3955:17): [True: 2.73k, False: 1.04M]
  ------------------
 3956|       |                 /* -C=O or =C-OH, O = S, Se, Te */
 3957|       |
 3958|       |                 /*(t_group_info->tni.bNormalizationFlags & FLAG_FORCE_SALT_TAUT) &&*/
 3959|  1.04M|                 1 == ( s_type = GetOtherSaltChargeType( at, i, t_group_info, &s_subtype, 1/* bAccept_O*/ ) ) ||
  ------------------
  |  Branch (3959:18): [True: 39.9k, False: 1.00M]
  ------------------
 3960|       |                 /* =Z-MH or -Z=M, Z = centerpoint, M = endpoint, other than above. M may be N */
 3961|       |
 3962|  1.00M|                 2 == ( s_type = GetOtherSaltType( at, i, &s_subtype ) ) ||
  ------------------
  |  Branch (3962:18): [True: 350, False: 1.00M]
  ------------------
 3963|       |                 /* >C-SH, >C-S(-); S=S,Se,Te */
 3964|       |
 3965|       |                 /* other proton donor or acceptor */
 3966|  1.00M|                (bHasAcidicHydrogen(at, i) && ((s_type = 3), (s_subtype = SALT_p_DONOR))) ||
  ------------------
  |  |   65|  1.76k|#define SALT_p_DONOR      8  /* >C-SH   */
  ------------------
  |  Branch (3966:18): [True: 1.76k, False: 1.00M]
  |  Branch (3966:47): [True: 1.76k, False: 0]
  ------------------
 3967|  1.00M|                (bHasAcidicMinus(at, i) && ((s_type = 3), (s_subtype = SALT_p_ACCEPTOR)))
  ------------------
  |  |   66|    581|#define SALT_p_ACCEPTOR  16  /* >C-S(-) */
  ------------------
  |  Branch (3967:18): [True: 581, False: 1.00M]
  |  Branch (3967:44): [True: 581, False: 0]
  ------------------
 3968|  1.05M|                )
 3969|  45.3k|            {
 3970|       |
 3971|  45.3k|                if (nNumCandidates >= nMaxNumCandidates)
  ------------------
  |  Branch (3971:21): [True: 0, False: 45.3k]
  ------------------
 3972|      0|                {
 3973|      0|                    return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3974|      0|                }
 3975|  45.3k|                if (at[i].endpoint)
  ------------------
  |  Branch (3975:21): [True: 12.9k, False: 32.3k]
  ------------------
 3976|  12.9k|                {
 3977|  12.9k|                    s_subtype_taut |= s_subtype;
 3978|  12.9k|                }
 3979|  32.3k|                else
 3980|  32.3k|                {
 3981|  32.3k|                    if (bDoNotMergeNonTautAtom( at, i ))
  ------------------
  |  Branch (3981:25): [True: 20.9k, False: 11.4k]
  ------------------
 3982|  20.9k|                    {
 3983|  20.9k|                        continue; /* ignore non-tautomeric N */
 3984|  20.9k|                    }
 3985|  32.3k|                }
 3986|  24.4k|                if (!( s_subtype & SALT_DONOR_ALL ) ||
  ------------------
  |  |   67|  24.4k|#define SALT_DONOR_ALL     (SALT_DONOR_Neg | SALT_DONOR_H | SALT_p_ACCEPTOR | SALT_p_DONOR)
  |  |  ------------------
  |  |  |  |   63|  24.4k|#define SALT_DONOR_Neg    2
  |  |  ------------------
  |  |               #define SALT_DONOR_ALL     (SALT_DONOR_Neg | SALT_DONOR_H | SALT_p_ACCEPTOR | SALT_p_DONOR)
  |  |  ------------------
  |  |  |  |   62|  24.4k|#define SALT_DONOR_H      1
  |  |  ------------------
  |  |               #define SALT_DONOR_ALL     (SALT_DONOR_Neg | SALT_DONOR_H | SALT_p_ACCEPTOR | SALT_p_DONOR)
  |  |  ------------------
  |  |  |  |   66|  24.4k|#define SALT_p_ACCEPTOR  16  /* >C-S(-) */
  |  |  ------------------
  |  |               #define SALT_DONOR_ALL     (SALT_DONOR_Neg | SALT_DONOR_H | SALT_p_ACCEPTOR | SALT_p_DONOR)
  |  |  ------------------
  |  |  |  |   65|  24.4k|#define SALT_p_DONOR      8  /* >C-SH   */
  |  |  ------------------
  ------------------
  |  Branch (3986:21): [True: 6.55k, False: 17.8k]
  ------------------
 3987|  17.8k|                    (( s_subtype & SALT_ACCEPTOR ) && !at[i].endpoint)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   64|  17.8k|#define SALT_ACCEPTOR     4
  ------------------
  |  Branch (3987:22): [True: 12.9k, False: 4.91k]
  |  Branch (3987:55): [True: 0, False: 12.9k]
  ------------------
 3988|  6.55k|                {
 3989|  6.55k|                    continue;  /* do not include non-taut acceptors like -C=O */
 3990|  6.55k|                }
 3991|  17.8k|                s_candidate[nNumCandidates].atnumber = i;
 3992|  17.8k|                s_candidate[nNumCandidates].type = s_type;
 3993|  17.8k|                s_candidate[nNumCandidates].subtype = s_subtype;
 3994|  17.8k|                s_candidate[nNumCandidates].endpoint = at[i].endpoint;
 3995|  17.8k|                nNumCandidates++;
 3996|  17.8k|                s_subtype_all |= s_subtype;
 3997|  17.8k|            }
 3998|  1.05M|        }
 3999|       |
 4000|       |        /*
 4001|       |        Forced merging occurs upon:
 4002|       |        ===========================
 4003|       |        (t_group_info->bTautFlags & TG_FLAG_ALLOW_NO_NEGTV_O) or
 4004|       |        (t_group_info->tni.bNormalizationFlags & FLAG_FORCE_SALT_TAUT)
 4005|       |
 4006|       |
 4007|       |        Allow forced merging in cases:
 4008|       |        {t-groups}  (H, (-)}  {H, (-), t-groups}
 4009|       |
 4010|       |
 4011|       |        Normal salt merging in cases:
 4012|       |        (H, (-)} {H, (-), t-groups},
 4013|       |
 4014|       |        Cannot merge H into t-groups if no (-) is present
 4015|       |        */
 4016|   252k|        if (( t_group_info->bTautFlags & TG_FLAG_ALLOW_NO_NEGTV_O ) ||
  ------------------
  |  |  923|   252k|#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 (4016:13): [True: 0, False: 252k]
  ------------------
 4017|   252k|            ( t_group_info->bTautFlagsDone & TG_FLAG_FOUND_SALT_CHARGES_DONE ) ||
  ------------------
  |  |  980|   252k|#define TG_FLAG_FOUND_SALT_CHARGES_DONE  0x00002000   /* not assigned: preprocessing detected possibility of salt-type tautomerism */
  ------------------
  |  Branch (4017:13): [True: 0, False: 252k]
  ------------------
 4018|   252k|             ( t_group_info->tni.bNormalizationFlags & FLAG_FORCE_SALT_TAUT ))
  ------------------
  |  |  172|   252k|#define FLAG_FORCE_SALT_TAUT         ( FLAG_PROTON_NP_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  147|   252k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  173|   252k|                                       FLAG_PROTON_AC_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  150|   252k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  174|   252k|                                       FLAG_PROTON_AC_HARD_ADDED    )
  |  |  ------------------
  |  |  |  |  151|   252k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  ------------------
  |  Branch (4018:14): [True: 172, False: 251k]
  ------------------
 4019|    172|        {
 4020|       |            /* Force merge even though no negative charges are present */
 4021|    172|            if (nNumCandidates <= 1 ||
  ------------------
  |  Branch (4021:17): [True: 53, False: 119]
  ------------------
 4022|    119|                (( !( s_subtype_all & SALT_DONOR_Neg2 ) || !( s_subtype_all & SALT_DONOR_H2 ) ) &&
  ------------------
  |  |   68|    119|#define SALT_DONOR_Neg2    (SALT_DONOR_Neg | SALT_p_ACCEPTOR)
  |  |  ------------------
  |  |  |  |   63|    119|#define SALT_DONOR_Neg    2
  |  |  ------------------
  |  |               #define SALT_DONOR_Neg2    (SALT_DONOR_Neg | SALT_p_ACCEPTOR)
  |  |  ------------------
  |  |  |  |   66|    119|#define SALT_p_ACCEPTOR  16  /* >C-S(-) */
  |  |  ------------------
  ------------------
                              (( !( s_subtype_all & SALT_DONOR_Neg2 ) || !( s_subtype_all & SALT_DONOR_H2 ) ) &&
  ------------------
  |  |   69|     52|#define SALT_DONOR_H2      (SALT_DONOR_H   | SALT_p_DONOR)
  |  |  ------------------
  |  |  |  |   62|     52|#define SALT_DONOR_H      1
  |  |  ------------------
  |  |               #define SALT_DONOR_H2      (SALT_DONOR_H   | SALT_p_DONOR)
  |  |  ------------------
  |  |  |  |   65|     52|#define SALT_p_DONOR      8  /* >C-SH   */
  |  |  ------------------
  ------------------
  |  Branch (4022:20): [True: 67, False: 52]
  |  Branch (4022:60): [True: 26, False: 26]
  ------------------
 4023|     93|                 !t_group_info->num_t_groups)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4023:18): [True: 0, False: 93]
  ------------------
 4024|     53|            {
 4025|     53|                s_group_info->num_candidates = -1; /* no candidate exists */
 4026|     53|                return 0;
 4027|     53|            }
 4028|    172|        }
 4029|   251k|        else
 4030|   251k|        {
 4031|       |            /* normal salt mode: merge if both -XH and -X(-) are present */
 4032|   251k|            if (nNumCandidates <= 1 ||
  ------------------
  |  Branch (4032:17): [True: 246k, False: 5.49k]
  ------------------
 4033|  5.49k|                ( !( s_subtype_all & SALT_DONOR_Neg2 ) || !( s_subtype_all & SALT_DONOR_H2 ) ))
  ------------------
  |  |   68|  5.49k|#define SALT_DONOR_Neg2    (SALT_DONOR_Neg | SALT_p_ACCEPTOR)
  |  |  ------------------
  |  |  |  |   63|  5.49k|#define SALT_DONOR_Neg    2
  |  |  ------------------
  |  |               #define SALT_DONOR_Neg2    (SALT_DONOR_Neg | SALT_p_ACCEPTOR)
  |  |  ------------------
  |  |  |  |   66|  5.49k|#define SALT_p_ACCEPTOR  16  /* >C-S(-) */
  |  |  ------------------
  ------------------
                              ( !( s_subtype_all & SALT_DONOR_Neg2 ) || !( s_subtype_all & SALT_DONOR_H2 ) ))
  ------------------
  |  |   69|  3.03k|#define SALT_DONOR_H2      (SALT_DONOR_H   | SALT_p_DONOR)
  |  |  ------------------
  |  |  |  |   62|  3.03k|#define SALT_DONOR_H      1
  |  |  ------------------
  |  |               #define SALT_DONOR_H2      (SALT_DONOR_H   | SALT_p_DONOR)
  |  |  ------------------
  |  |  |  |   65|  3.03k|#define SALT_p_DONOR      8  /* >C-SH   */
  |  |  ------------------
  ------------------
  |  Branch (4033:19): [True: 2.45k, False: 3.03k]
  |  Branch (4033:59): [True: 2.01k, False: 1.02k]
  ------------------
 4034|   250k|            {
 4035|   250k|                s_group_info->num_candidates = -1; /* no candidate exists */
 4036|   250k|                return 0;
 4037|   250k|            }
 4038|   251k|        }
 4039|       |        /* -- old code --
 4040|       |        if ( nNumCandidates <= 1 ||
 4041|       |        (((t_group_info->bTautFlags & TG_FLAG_ALLOW_NO_NEGTV_O) ||
 4042|       |        (t_group_info->tni.bNormalizationFlags & FLAG_FORCE_SALT_TAUT)) ?
 4043|       |        !(s_subtype_all & SALT_DONOR_ALL):
 4044|       |        !(s_subtype_all & SALT_DONOR_Neg2)
 4045|       |        )
 4046|       |        ) {
 4047|       |        s_group_info->num_candidates = -1;
 4048|       |        return 0;
 4049|       |        }
 4050|       |        */
 4051|  1.14k|        if (!( s_subtype_all & ( SALT_DONOR_Neg2 ) ))
  ------------------
  |  |   68|  1.14k|#define SALT_DONOR_Neg2    (SALT_DONOR_Neg | SALT_p_ACCEPTOR)
  |  |  ------------------
  |  |  |  |   63|  1.14k|#define SALT_DONOR_Neg    2
  |  |  ------------------
  |  |               #define SALT_DONOR_Neg2    (SALT_DONOR_Neg | SALT_p_ACCEPTOR)
  |  |  ------------------
  |  |  |  |   66|  1.14k|#define SALT_p_ACCEPTOR  16  /* >C-S(-) */
  |  |  ------------------
  ------------------
  |  Branch (4051:13): [True: 67, False: 1.07k]
  ------------------
 4052|     67|        {
 4053|     67|            t_group_info->bTautFlagsDone |= TG_FLAG_ALLOW_NO_NEGTV_O_DONE;
  ------------------
  |  |  968|     67|#define TG_FLAG_ALLOW_NO_NEGTV_O_DONE    0x00000040
  ------------------
 4054|     67|        }
 4055|  1.14k|        s_group_info->num_candidates = nNumCandidates;
 4056|  1.14k|    }
 4057|       |
 4058|  4.41k|    for (i = 0; i < s_group_info->num_candidates; i++)
  ------------------
  |  Branch (4058:17): [True: 3.27k, False: 1.14k]
  ------------------
 4059|  3.27k|    {
 4060|  3.27k|        iat = s_group_info->s_candidate[i].atnumber;
 4061|  3.27k|        if (( s_group_info->s_candidate[i].subtype & SALT_ACCEPTOR ) && !at[iat].endpoint)
  ------------------
  |  |   64|  3.27k|#define SALT_ACCEPTOR     4
  ------------------
  |  Branch (4061:13): [True: 2.96k, False: 303]
  |  Branch (4061:73): [True: 0, False: 2.96k]
  ------------------
 4062|      0|        {
 4063|      0|            continue; /* should not happen */
 4064|      0|        }
 4065|  3.27k|        s_subtype_all |= s_group_info->s_candidate[i].subtype;
 4066|  3.27k|        if (at[iat].endpoint != nCurTGroupNumber || !at[iat].endpoint)
  ------------------
  |  Branch (4066:13): [True: 1.45k, False: 1.82k]
  |  Branch (4066:53): [True: 142, False: 1.67k]
  ------------------
 4067|  1.59k|        {
 4068|  1.59k|            nMinNumEndpoints++;
 4069|  1.59k|        }
 4070|  3.27k|        nCurTGroupNumber = (int) at[iat].endpoint;
 4071|  3.27k|    }
 4072|  1.14k|    if (nMinNumEndpoints <= 1)
  ------------------
  |  Branch (4072:9): [True: 878, False: 267]
  ------------------
 4073|    878|    {
 4074|    878|        return 0; /* too few endpoints */
 4075|    878|    }
 4076|       |
 4077|       |    /* Make sure we have enough memory */
 4078|    267|    if (nMinNumEndpoints > MAX_STACK_ARRAY_LEN)
  ------------------
  |  |  112|    267|#define MAX_STACK_ARRAY_LEN 127
  ------------------
  |  Branch (4078:9): [True: 0, False: 267]
  ------------------
 4079|      0|    {
 4080|      0|        if (!( EndPoint = (T_ENDPOINT *) inchi_calloc( nMinNumEndpoints, sizeof( EndPoint[0] ) ) ))
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (4080:13): [True: 0, False: 0]
  ------------------
 4081|      0|        {
 4082|       |            /*printf("BNS_OUT_OF_RAM-8\n");*/
 4083|      0|            return BNS_OUT_OF_RAM;
  ------------------
  |  |   49|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 4084|      0|        }
 4085|      0|    }
 4086|       |
 4087|    267|    nCurTGroupNumber = MAX_ATOMS;  /* impossible t-group number */
  ------------------
  |  |   15|    267|#define MAX_ATOMS  32766
  ------------------
 4088|  1.17k|    for (i = j = 0; i < s_group_info->num_candidates; i++)
  ------------------
  |  Branch (4088:21): [True: 911, False: 267]
  ------------------
 4089|    911|    {
 4090|    911|        iat = s_group_info->s_candidate[i].atnumber;
 4091|    911|        if (s_group_info->s_candidate[i].subtype == SALT_ACCEPTOR && !at[iat].endpoint)
  ------------------
  |  |   64|  1.82k|#define SALT_ACCEPTOR     4
  ------------------
  |  Branch (4091:13): [True: 0, False: 911]
  |  Branch (4091:70): [True: 0, False: 0]
  ------------------
 4092|      0|        {
 4093|      0|            continue;
 4094|      0|        }
 4095|    911|        if (at[iat].endpoint != nCurTGroupNumber || !at[iat].endpoint)
  ------------------
  |  Branch (4095:13): [True: 572, False: 339]
  |  Branch (4095:53): [True: 142, False: 197]
  ------------------
 4096|    714|        {
 4097|    714|            AddEndPoint( EndPoint + j, at, iat );
 4098|    714|            j++;
 4099|    714|        }
 4100|    911|        nCurTGroupNumber = (int) at[iat].endpoint;
 4101|    911|    }
 4102|       |
 4103|    267|    ret = RegisterEndPoints( pCG, t_group_info, EndPoint, j, at,
 4104|    267|                             num_atoms, c_group_info, pBNS );
 4105|       |
 4106|    267|    if (ret == -1)
  ------------------
  |  Branch (4106:9): [True: 0, False: 267]
  ------------------
 4107|      0|    {
 4108|      0|        ret = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 4109|      0|    }
 4110|       |
 4111|    267|    if (EndPoint != EndPointStackArray)
  ------------------
  |  Branch (4111:9): [True: 0, False: 267]
  ------------------
 4112|      0|    {
 4113|      0|        inchi_free( EndPoint );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4114|      0|    }
 4115|       |
 4116|    267|    return ret;
 4117|    267|}
MakeIsotopicHGroup:
 4125|  4.89k|{
 4126|       |    /* All tautomeric atoms and all possible H+ donors and acceptors that have H */
 4127|  4.89k|    int        i, j, k, n, bHasH, tg, nError = 0;
 4128|       |    /* djb-rwth: removing redundant variables */
 4129|  4.89k|    int        nMaxNumCandidates, nNumCandidates, nNumNonTautCandidates;
 4130|       |
 4131|       |
 4132|  4.89k|    if (!s_group_info || !s_group_info->s_candidate || /*s_group_info->num_candidates <= 0 ||*/
  ------------------
  |  Branch (4132:9): [True: 0, False: 4.89k]
  |  Branch (4132:26): [True: 0, False: 4.89k]
  ------------------
 4133|  4.89k|         !t_group_info || !t_group_info->t_group)
  ------------------
  |  Branch (4133:10): [True: 0, False: 4.89k]
  |  Branch (4133:27): [True: 0, False: 4.89k]
  ------------------
 4134|      0|    {
 4135|      0|        return 0;
 4136|      0|    }
 4137|  4.89k|    nMaxNumCandidates = s_group_info->max_num_candidates;
 4138|       |    /* djb-rwth: removing redundant code */
 4139|  4.89k|    memset( t_group_info->num_iso_H, 0, sizeof( t_group_info->num_iso_H ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4140|  4.89k|    if (1 || ( s_group_info->num_candidates < 0 ))
  ------------------
  |  Branch (4140:9): [True: 4.89k, Folded]
  |  Branch (4140:14): [True: 0, False: 0]
  ------------------
 4141|  4.89k|    {
 4142|  4.89k|        int s_type, s_subtype;
 4143|  4.89k|        S_CANDIDATE *s_candidate = s_group_info->s_candidate;
 4144|  19.7k|        for (i = 0, nNumCandidates = nNumNonTautCandidates = 0; i < num_atoms; i++)
  ------------------
  |  Branch (4144:65): [True: 14.8k, False: 4.89k]
  ------------------
 4145|  14.8k|        {
 4146|  14.8k|            s_subtype = 0;
 4147|  14.8k|            s_type = 0;
 4148|  14.8k|            if (at[i].endpoint)
  ------------------
  |  Branch (4148:17): [True: 350, False: 14.4k]
  ------------------
 4149|    350|            {
 4150|    350|                if (( tg = t_group_info->tGroupNumber[at[i].endpoint] ) &&
  ------------------
  |  Branch (4150:21): [True: 350, False: 0]
  ------------------
 4151|    350|                     at[i].endpoint == t_group_info->t_group[tg -= 1].nGroupNumber)
  ------------------
  |  Branch (4151:22): [True: 350, False: 0]
  ------------------
 4152|    350|                {
 4153|    350|                    bHasH = (int) t_group_info->t_group[tg].num[0] - (int) t_group_info->t_group[tg].num[1];
 4154|    350|                }
 4155|      0|                else
 4156|      0|                {
 4157|      0|                    nError = BNS_PROGRAM_ERR;
  ------------------
  |  |   50|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 4158|      0|                    break;
 4159|      0|                }
 4160|    350|            }
 4161|  14.4k|            else
 4162|  14.4k|            {
 4163|  14.4k|                bHasH = (int) at[i].num_H;
 4164|  14.4k|            }
 4165|  14.8k|            if ((bHasH && at[i].endpoint) || /* tautomeric atoms */
  ------------------
  |  Branch (4165:18): [True: 844, False: 13.9k]
  |  Branch (4165:27): [True: 297, False: 547]
  ------------------
 4166|       |                                           /* non-tautomeric heteroatoms that
 4167|       |                                           (a) have H and
 4168|       |                                           (b) may be donors of H
 4169|       |                                           therefore may exchange isotopic-non-isotopic H */
 4170|  14.5k|                 (bHasH &&
  ------------------
  |  Branch (4170:19): [True: 547, False: 13.9k]
  ------------------
 4171|    547|                 ( 0 == ( s_type = GetSaltChargeType( at, i, t_group_info, &s_subtype ) ) ||
  ------------------
  |  Branch (4171:20): [True: 11, False: 536]
  ------------------
 4172|       |                   /* -C=O or =C-OH, O = S, Se, Te */
 4173|       |
 4174|       |                   /*(t_group_info->tni.bNormalizationFlags & FLAG_FORCE_SALT_TAUT) &&*/
 4175|    536|                   1 == ( s_type = GetOtherSaltChargeType( at, i, t_group_info, &s_subtype, 1/* bAccept_O*/ ) ) ||
  ------------------
  |  Branch (4175:20): [True: 23, False: 513]
  ------------------
 4176|       |                   /* =Z-MH or -Z=M, Z = centerpoint, M = endpoint, other than above. M may be N */
 4177|       |
 4178|    513|                   2 == ( s_type = GetOtherSaltType( at, i, &s_subtype ) ) ||
  ------------------
  |  Branch (4178:20): [True: 25, False: 488]
  ------------------
 4179|       |                   /* >C-SH, >C-S(-); S=S,Se,Te */
 4180|       |
 4181|       |                   /* other proton donor or acceptor */
 4182|    488|                     (bHasAcidicHydrogen(at, i) && ((s_type = 3), (s_subtype = SALT_p_DONOR))) ||
  ------------------
  |  |   65|    165|#define SALT_p_DONOR      8  /* >C-SH   */
  ------------------
  |  Branch (4182:23): [True: 165, False: 323]
  |  Branch (4182:52): [True: 165, False: 0]
  ------------------
 4183|    323|                     (bHasAcidicMinus(at, i) && ((s_type = 3), (s_subtype = SALT_p_ACCEPTOR))) ||
  ------------------
  |  |   66|     11|#define SALT_p_ACCEPTOR  16  /* >C-S(-) */
  ------------------
  |  Branch (4183:23): [True: 11, False: 312]
  |  Branch (4183:49): [True: 11, False: 0]
  ------------------
 4184|    312|                     (bHasOtherExchangableH(at, i) && ((s_type = 3), (s_subtype = SALT_DONOR_H)))))
  ------------------
  |  |   62|     11|#define SALT_DONOR_H      1
  ------------------
  |  Branch (4184:23): [True: 11, False: 301]
  |  Branch (4184:55): [True: 11, False: 0]
  ------------------
 4185|       |
 4186|  14.8k|                     )
 4187|    543|            {
 4188|    543|                if (nNumCandidates >= nMaxNumCandidates)
  ------------------
  |  Branch (4188:21): [True: 0, False: 543]
  ------------------
 4189|      0|                {
 4190|      0|                    return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   54|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 4191|      0|                }
 4192|    543|                s_candidate[nNumCandidates].atnumber = i;
 4193|    543|                s_candidate[nNumCandidates].type = s_type;
 4194|    543|                s_candidate[nNumCandidates].subtype = s_subtype;
 4195|    543|                s_candidate[nNumCandidates].endpoint = at[i].endpoint;
 4196|    543|                nNumCandidates++;
 4197|    543|                nNumNonTautCandidates += !at[i].endpoint;
 4198|       |                /* djb-rwth: removing redundant code */
 4199|    543|            }
 4200|  14.8k|        }
 4201|       |
 4202|  4.89k|        if (nError)
  ------------------
  |  Branch (4202:13): [True: 0, False: 4.89k]
  ------------------
 4203|      0|        {
 4204|      0|            return nError;
 4205|      0|        }
 4206|       |
 4207|  4.89k|        if (nNumCandidates > 0)
  ------------------
  |  Branch (4207:13): [True: 273, False: 4.62k]
  ------------------
 4208|    273|        {
 4209|    273|            t_group_info->nIsotopicEndpointAtomNumber = (AT_NUMB *) inchi_calloc( (long long)nNumNonTautCandidates + 1, sizeof( t_group_info->nIsotopicEndpointAtomNumber[0] ) ); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|    273|#define inchi_calloc   calloc
  ------------------
 4210|    273|            if (t_group_info->nIsotopicEndpointAtomNumber) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (4210:17): [True: 273, False: 0]
  ------------------
 4211|    273|            {
 4212|    273|                t_group_info->nIsotopicEndpointAtomNumber[0] = nNumNonTautCandidates;
 4213|    816|                for (i = 0, n = 1; i < nNumCandidates; i++)
  ------------------
  |  Branch (4213:36): [True: 543, False: 273]
  ------------------
 4214|    543|                {
 4215|    543|                    k = s_candidate[i].atnumber;
 4216|    543|                    if (!at[k].endpoint)
  ------------------
  |  Branch (4216:25): [True: 246, False: 297]
  ------------------
 4217|    246|                    {
 4218|    246|                        t_group_info->nIsotopicEndpointAtomNumber[n++] = k;
 4219|    246|                    }
 4220|  2.17k|                    for (j = 0; j < NUM_H_ISOTOPES; j++)
  ------------------
  |  |   25|  2.17k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (4220:33): [True: 1.62k, False: 543]
  ------------------
 4221|  1.62k|                    {
 4222|  1.62k|                        t_group_info->num_iso_H[j] += at[k].num_iso_H[j];
 4223|  1.62k|                    }
 4224|    543|                    at[k].cFlags |= AT_FLAG_ISO_H_POINT;
  ------------------
  |  |   50|    543|#define AT_FLAG_ISO_H_POINT 0x01 /**< may have isotopic H */
  ------------------
 4225|    543|                }
 4226|    273|                t_group_info->nNumIsotopicEndpoints = nNumNonTautCandidates + 1;
 4227|    273|            }
 4228|    273|        }
 4229|  4.89k|    }
 4230|       |
 4231|  4.89k|    return nNumCandidates;
 4232|  4.89k|}
MarkTautomerGroups:
 4308|   299k|{
 4309|   299k|    int i, j, k, m, endpoint_valence, centerpoint, endpoint, bond_type, nMobile, num_changes = 0, tot_changes = 0;
 4310|   299k|    T_ENDPOINT EndPoint[MAXVAL];
 4311|   299k|    T_BONDPOS  BondPos[MAXVAL];
 4312|   299k|    AT_NUMB    nGroupNumber;
 4313|   299k|    int        bDiffGroups;
 4314|   299k|    int  nNumEndPoints, nNumBondPos, nNumPossibleMobile;
 4315|   299k|    int  bNonTautBond, bAltBond; /* djb-rwth: removing redundant variables */
 4316|   299k|    int  nNumDonor, nNumAcceptor, bPossiblyEndpoint;
 4317|   299k|    int bIgnoreIsotopic; /* djb-rwth: removing redundant variables */
 4318|   299k|    ENDPOINT_INFO eif1, eif2;
 4319|   299k|    int nErr = 0;
 4320|       |
 4321|   299k|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
 4322|   299k|#define ACTUAL_ORDER(PBNS, IAT,IBOND, BTYPE)  ( ((PBNS) && (PBNS)->edge && (PBNS)->vert &&\
 4323|   299k|    ((BTYPE)==BOND_ALT_123 || (BTYPE)==BOND_ALT_13 || (BTYPE)==BOND_ALT_23))? (PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].flow+BOND_TYPE_SINGLE:(BTYPE))
 4324|       |
 4325|       |
 4326|   299k|    if (!t_group_info || !( t_group_info->bTautFlags & TG_FLAG_TEST_TAUT__ATOMS ))
  ------------------
  |  |  918|   263k|#define TG_FLAG_TEST_TAUT__ATOMS         0x00000001   /* find regular tautomerism */
  ------------------
  |  Branch (4326:9): [True: 36.3k, False: 263k]
  |  Branch (4326:26): [True: 0, False: 263k]
  ------------------
 4327|  36.3k|    {
 4328|  36.3k|        return 0;
 4329|  36.3k|    }
 4330|       |
 4331|       |    /*  Initial t_group allocation */
 4332|   263k|    if (!t_group_info->t_group && !t_group_info->max_num_t_groups)
  ------------------
  |  Branch (4332:9): [True: 252k, False: 11.0k]
  |  Branch (4332:35): [True: 252k, False: 0]
  ------------------
 4333|   252k|    {
 4334|   252k|        INCHI_MODE bTautFlags = t_group_info->bTautFlags;       /*  save initial setting */
 4335|   252k|        INCHI_MODE bTautFlagsDone = t_group_info->bTautFlagsDone;   /*  save previous findings, if any */
 4336|   252k|        TNI       tni = t_group_info->tni;
 4337|   252k|        AT_NUMB   *tGroupNumber = t_group_info->tGroupNumber;
 4338|   252k|        T_GROUP* tgi_tgr = NULL;  /* copied from below 2024-09-01 DT */
 4339|       |
 4340|   252k|        bIgnoreIsotopic = t_group_info->bIgnoreIsotopic;
 4341|   252k|        memset( t_group_info, 0, sizeof( *t_group_info ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 4342|   252k|        t_group_info->bIgnoreIsotopic = bIgnoreIsotopic; /*  restore initial setting */
 4343|   252k|        t_group_info->bTautFlags = bTautFlags;
 4344|   252k|        t_group_info->bTautFlagsDone = bTautFlagsDone;
 4345|   252k|        t_group_info->tni = tni;
 4346|   252k|        t_group_info->tGroupNumber = tGroupNumber;
 4347|   252k|        t_group_info->max_num_t_groups = num_atoms / 2 + 1; /*  upper limit */
 4348|       |        /* djb-rwth: fixing oss-fuzz issue #52978 */
 4349|   252k|        tgi_tgr = (T_GROUP*)inchi_calloc((long long)t_group_info->max_num_t_groups + 1, sizeof(t_group_info->t_group[0]));
  ------------------
  |  | 1146|   252k|#define inchi_calloc   calloc
  ------------------
 4350|   252k|        if (!tgi_tgr)
  ------------------
  |  Branch (4350:13): [True: 0, False: 252k]
  ------------------
 4351|      0|        {
 4352|      0|            t_group_info->max_num_t_groups = -1;
 4353|      0|            t_group_info->t_group = NULL;
 4354|      0|            return (-1); /*  failed, out of RAM */
 4355|      0|        }
 4356|   252k|        else
 4357|   252k|        {
 4358|   252k|            t_group_info->t_group = tgi_tgr;
 4359|   252k|        }
 4360|   252k|    }
 4361|       |
 4362|       |    /*  Check if t_group_info exists */
 4363|   263k|    if (!t_group_info->t_group || !t_group_info->max_num_t_groups)
  ------------------
  |  Branch (4363:9): [True: 0, False: 263k]
  |  Branch (4363:35): [True: 0, False: 263k]
  ------------------
 4364|      0|    {
 4365|      0|        return 0;
 4366|      0|    }
 4367|       |
 4368|   263k|    if (0 > t_group_info->max_num_t_groups)
  ------------------
  |  Branch (4368:9): [True: 0, False: 263k]
  ------------------
 4369|      0|    {
 4370|      0|        return t_group_info->max_num_t_groups;
 4371|      0|    }
 4372|       |
 4373|       |    /* djb-rwth: removing redundant code */
 4374|       |
 4375|       |    /*  1-3 tautomers */
 4376|  1.38M|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (4376:17): [True: 1.11M, False: 263k]
  ------------------
 4377|  1.11M|    {
 4378|       |        /*  Find possible endpoint Z = at[i] */
 4379|  1.11M|        if ((endpoint_valence = nGetEndpointInfo( at, i, &eif1 ))) /* djb-rwth: addressing LLVM warning; ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (4379:13): [True: 89.2k, False: 1.02M]
  ------------------
 4380|  89.2k|        {
 4381|       |            /*  1st endpoint candidate found. Find centerpoint candidate */
 4382|   212k|            for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (4382:25): [True: 123k, False: 89.2k]
  ------------------
 4383|   123k|            {
 4384|   123k|                bond_type = (int) at[i].bond_type[j] & ~BOND_MARK_ALL;
  ------------------
  |  |  191|   123k|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 4385|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 4386|       |                bond_type = ACTUAL_ORDER( pBNS, i, j, bond_type );
 4387|       |#endif
 4388|   123k|                centerpoint = (int) at[i].neighbor[j];  /*  a centerpoint candidate */
 4389|   123k|                if (( bond_type == BOND_DOUBLE ||
  ------------------
  |  |  178|   123k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|   246k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (4389:23): [True: 35.2k, False: 88.1k]
  ------------------
 4390|  88.1k|                      bond_type == BOND_ALTERN ||
  ------------------
  |  |  180|  88.1k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|   211k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (4390:23): [True: 7.87k, False: 80.2k]
  ------------------
 4391|  80.2k|                      bond_type == BOND_ALT12NS ||
  ------------------
  |  |  186|   203k|#define BOND_ALT12NS             9
  ------------------
  |  Branch (4391:23): [True: 5.60k, False: 74.6k]
  ------------------
 4392|  86.2k|                      bond_type == BOND_TAUTOM ) && is_centerpoint_elem( at[centerpoint].el_number )
  ------------------
  |  |  185|  74.6k|#define BOND_TAUTOM              8
  ------------------
  |  Branch (4392:23): [True: 37.5k, False: 37.1k]
  |  Branch (4392:53): [True: 77.7k, False: 8.45k]
  ------------------
 4393|  77.7k|                     && ALLOWED_EDGE( pBNS, i, j )
  ------------------
  |  | 4321|  77.7k|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (4321:42): [True: 0, False: 77.7k]
  |  |  |  Branch (4321:53): [True: 0, False: 77.7k]
  |  |  |  Branch (4321:70): [True: 0, False: 77.7k]
  |  |  |  Branch (4321:87): [True: 75.3k, False: 2.43k]
  |  |  ------------------
  ------------------
 4394|   123k|                     )
 4395|  75.3k|                {
 4396|       |                    /*  Test a centerpoint candidate. */
 4397|       |                    /*  find all endpoints including at[i] and store them into EndPoint[] */
 4398|  75.3k|                    nNumPossibleMobile = 0;
 4399|  75.3k|                    nGroupNumber = (AT_NUMB) num_atoms; /*  greater than any tautomeric group number */
 4400|  75.3k|                    bDiffGroups = -1;         /*  ignore the first difference */
 4401|  75.3k|                    nNumDonor = nNumAcceptor = 0;
 4402|   288k|                    for (k = 0, nNumEndPoints = 0, nNumBondPos = 0; k < at[centerpoint].valence; k++)
  ------------------
  |  Branch (4402:69): [True: 213k, False: 75.3k]
  ------------------
 4403|   213k|                    {
 4404|   213k|                        endpoint = at[centerpoint].neighbor[k]; /*  endpoint candidate */
 4405|   213k|                        bond_type = (int) at[centerpoint].bond_type[k] & ~BOND_MARK_ALL;
  ------------------
  |  |  191|   213k|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 4406|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 4407|       |                        bond_type = ACTUAL_ORDER( pBNS, centerpoint, k, bond_type );
 4408|       |#endif
 4409|       |                        /* djb-rwth: removing redundant code */
 4410|   213k|                            bNonTautBond =
 4411|   213k|                            bAltBond = /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 4412|   213k|                            bPossiblyEndpoint = 0;
 4413|   213k|                        if (!ALLOWED_EDGE( pBNS, centerpoint, k ))
  ------------------
  |  | 4321|   213k|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (4321:42): [True: 0, False: 213k]
  |  |  |  Branch (4321:53): [True: 0, False: 213k]
  |  |  |  Branch (4321:70): [True: 0, False: 213k]
  |  |  |  Branch (4321:87): [True: 207k, False: 5.78k]
  |  |  ------------------
  ------------------
 4414|  5.78k|                        {
 4415|  5.78k|                            continue;
 4416|  5.78k|                        }
 4417|   207k|                        else
 4418|   207k|                        {
 4419|   207k|                            if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM)
  ------------------
  |  |  180|   207k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|   415k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                          if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM)
  ------------------
  |  |  186|   401k|#define BOND_ALT12NS             9
  ------------------
                                          if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM)
  ------------------
  |  |  185|   179k|#define BOND_TAUTOM              8
  ------------------
  |  Branch (4419:33): [True: 14.5k, False: 193k]
  |  Branch (4419:61): [True: 13.2k, False: 179k]
  |  Branch (4419:90): [True: 81.2k, False: 98.6k]
  ------------------
 4420|   109k|                            {
 4421|       |                                /* djb-rwth: removing redundant code */
 4422|   109k|#if ( REPLACE_ALT_WITH_TAUT == 1 )
 4423|   109k|                                bAltBond = ( bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS ); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  180|   109k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|   218k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                              bAltBond = ( bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS ); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  186|  94.5k|#define BOND_ALT12NS             9
  ------------------
  |  Branch (4423:46): [True: 14.5k, False: 94.5k]
  |  Branch (4423:74): [True: 13.2k, False: 81.2k]
  ------------------
 4424|   109k|#endif
 4425|   109k|                            }
 4426|  98.6k|                            else
 4427|  98.6k|                            {
 4428|  98.6k|                                if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE)
  ------------------
  |  |  177|  98.6k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|   197k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                                              if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE)
  ------------------
  |  |  178|  43.5k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|  43.5k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (4428:37): [True: 55.1k, False: 43.5k]
  |  Branch (4428:65): [True: 38.2k, False: 5.25k]
  ------------------
 4429|  93.4k|                                {
 4430|  93.4k|                                    bNonTautBond = 1;
 4431|  93.4k|                                }
 4432|  5.25k|                                else
 4433|  5.25k|                                {
 4434|  5.25k|                                    continue;
 4435|  5.25k|                                }
 4436|  98.6k|                            }
 4437|   207k|                        }
 4438|       |
 4439|   202k|                        if (!( endpoint_valence = nGetEndpointInfo( at, endpoint, &eif1 ) )) /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (4439:29): [True: 58.6k, False: 143k]
  ------------------
 4440|  58.6k|                            continue; /*  not an endpoint element or can't have mobile groups */
 4441|       |                                      /*  save information about the found possible tautomeric endpoint */
 4442|       |                                      /*  2 = T_NUM_NO_ISOTOPIC non-isotopic values */
 4443|   143k|                        nMobile =
 4444|   143k|                            AddAtom2num( EndPoint[nNumEndPoints].num, at, endpoint, 2 ); /* fill out */
 4445|   143k|                        AddAtom2DA( EndPoint[nNumEndPoints].num_DA, at, endpoint, 2 );
 4446|       |                        /* --- why is isitopic info missing ? -- see below
 4447|       |                        nMobile  = EndPoint[nNumEndPoints].num[1] = (at[endpoint].charge == -1);
 4448|       |                        nMobile  = EndPoint[nNumEndPoints].num[0] = at[endpoint].num_H + nMobile;
 4449|       |                        */
 4450|   143k|                        if (bNonTautBond)
  ------------------
  |  Branch (4450:29): [True: 44.1k, False: 99.8k]
  ------------------
 4451|  44.1k|                        {
 4452|  44.1k|                            m = ( bond_type == BOND_SINGLE && ( nMobile || at[endpoint].endpoint ) );
  ------------------
  |  |  177|  44.1k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|  88.2k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (4452:35): [True: 10.8k, False: 33.2k]
  |  Branch (4452:65): [True: 6.32k, False: 4.50k]
  |  Branch (4452:76): [True: 224, False: 4.28k]
  ------------------
 4453|  44.1k|                            nNumDonor += m;
 4454|  44.1k|                            bPossiblyEndpoint += m;
 4455|  44.1k|                            m = ( bond_type == BOND_DOUBLE );
  ------------------
  |  |  178|  44.1k|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|  44.1k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
 4456|  44.1k|                            nNumAcceptor += m;
 4457|  44.1k|                            bPossiblyEndpoint += m;
 4458|  44.1k|                        }
 4459|  99.8k|                        else
 4460|  99.8k|                        {
 4461|       |                            /*  Tautomeric or alternating bond */
 4462|  99.8k|                            m = ( 0 != at[endpoint].endpoint || eif1.cDonor );
  ------------------
  |  Branch (4462:35): [True: 77.4k, False: 22.4k]
  |  Branch (4462:65): [True: 487, False: 21.9k]
  ------------------
 4463|  99.8k|                            nNumDonor += m;
 4464|  99.8k|                            bPossiblyEndpoint += m;
 4465|  99.8k|                            m = ( at[endpoint].endpoint ||
  ------------------
  |  Branch (4465:35): [True: 77.4k, False: 22.4k]
  ------------------
 4466|  22.4k|                                  eif1.cNeutralBondsValence > at[endpoint].valence );
  ------------------
  |  Branch (4466:35): [True: 21.9k, False: 487]
  ------------------
 4467|  99.8k|                            nNumAcceptor += m;
 4468|  99.8k|                            bPossiblyEndpoint += m;
 4469|  99.8k|                        }
 4470|   143k|                        if (!bPossiblyEndpoint)
  ------------------
  |  Branch (4470:29): [True: 4.28k, False: 139k]
  ------------------
 4471|  4.28k|                        {
 4472|  4.28k|                            continue;
 4473|  4.28k|                        }
 4474|   139k|                        EndPoint[nNumEndPoints].nGroupNumber = at[endpoint].endpoint; /* =0 if it is an endpoint for the 1st time */
 4475|   139k|                        EndPoint[nNumEndPoints].nEquNumber = 0;
 4476|   139k|                        EndPoint[nNumEndPoints].nAtomNumber = (AT_NUMB) endpoint;
 4477|   139k|                        if (nGroupNumber != at[endpoint].endpoint)
  ------------------
  |  Branch (4477:29): [True: 76.0k, False: 63.5k]
  ------------------
 4478|  76.0k|                        {
 4479|  76.0k|                            bDiffGroups++;
 4480|  76.0k|                            nGroupNumber = at[endpoint].endpoint;
 4481|  76.0k|                        }
 4482|       |
 4483|       |                        /*  save positions of all, not only possibly tautomeric bonds */
 4484|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 4485|       |                        if (bNonTautBond || bAltBond)
 4486|       |                        {
 4487|       |#endif
 4488|   139k|                            BondPos[nNumBondPos].nAtomNumber = (AT_NUMB) centerpoint;
 4489|   139k|                            BondPos[nNumBondPos].neighbor_index = (AT_NUMB) k; /* bond ordering number; used to change bonds to tautomeric only  */
 4490|   139k|                            nNumBondPos++;
 4491|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 4492|       |                        }
 4493|       |#endif
 4494|       |                        /*  mobile group is possible if (a) the endpoint has a mobile group or */
 4495|       |                        /*                              (b) the centerpoint is adjacent to another endpoint */
 4496|   139k|                        nNumPossibleMobile += ( nMobile > 0 || at[endpoint].endpoint );
  ------------------
  |  Branch (4496:49): [True: 60.5k, False: 79.0k]
  |  Branch (4496:64): [True: 32.1k, False: 46.9k]
  ------------------
 4497|   139k|                        nNumEndPoints++;
 4498|       |                        /*printf("Found %d %d %d %d\n", centerpoint+1, at[centerpoint].el_number, endpoint+1, at[endpoint].el_number);*/
 4499|   139k|                    }
 4500|  75.3k|                    if (nNumEndPoints > 1 && nNumPossibleMobile && nNumDonor && nNumAcceptor)
  ------------------
  |  Branch (4500:25): [True: 52.9k, False: 22.3k]
  |  Branch (4500:46): [True: 41.7k, False: 11.2k]
  |  Branch (4500:68): [True: 39.3k, False: 2.42k]
  |  Branch (4500:81): [True: 39.3k, False: 40]
  ------------------
 4501|  39.3k|                    {
 4502|       |                        /*
 4503|       |                        * a tautomeric group has been found
 4504|       |                        *
 4505|       |                        * at this point:
 4506|       |                        * nGroupNumber = 0 if all endpoints belong to a newly discovered tautomeric group
 4507|       |                        * bDiffGroups  > 0 if at least 2 tautomeric groups are to be merged (one of them can be new)
 4508|       |                        * case (nGroupNumber != 0 && bDiffGroups = 0 ) ignored because all endpoints belong to the same known t-group
 4509|       |                        * case (nGroupNumber != 0 && bDiffGroups < 0 ) cannot happen
 4510|       |                        */
 4511|       |
 4512|  39.3k|                        nErr = FindAccessibleEndPoints( pCG, EndPoint,
 4513|  39.3k|                                                        &nNumEndPoints,
 4514|  39.3k|                                                        BondPos, &nNumBondPos,
 4515|  39.3k|                                                        pBNS, pBD, at,
 4516|  39.3k|                                                        num_atoms, c_group_info,
 4517|  39.3k|                                                        ALT_PATH_MODE_TAUTOM );
  ------------------
  |  |  310|  39.3k|#define ALT_PATH_MODE_TAUTOM     1
  ------------------
 4518|       |
 4519|  39.3k|                        if (IS_BNS_ERROR( nErr ))
  ------------------
  |  |   67|  39.3k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  39.3k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  39.3k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  39.3k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 39.3k, False: 0]
  |  |  |  Branch (67:44): [True: 3, False: 39.3k]
  |  |  ------------------
  ------------------
 4520|      3|                        {
 4521|      3|                            return nErr;
 4522|      3|                        }
 4523|  39.3k|                        nErr = 0;
 4524|  39.3k|                        if (nNumEndPoints > 0) {
  ------------------
  |  Branch (4524:29): [True: 39.1k, False: 126]
  ------------------
 4525|  39.1k|                            if (!nGroupNumber || bDiffGroups > 0) {
  ------------------
  |  Branch (4525:33): [True: 5.82k, False: 33.3k]
  |  Branch (4525:50): [True: 297, False: 33.0k]
  ------------------
 4526|       |
 4527|  6.12k|                                num_changes = RegisterEndPoints(pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS);
 4528|  6.12k|                                if (num_changes == -1) {
  ------------------
  |  Branch (4528:37): [True: 0, False: 6.12k]
  ------------------
 4529|      0|                                    nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   24|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4530|      0|                                }
 4531|  6.12k|                                if (num_changes < 0) {
  ------------------
  |  Branch (4531:37): [True: 0, False: 6.12k]
  ------------------
 4532|      0|                                    nErr = num_changes;
 4533|      0|                                }
 4534|  6.12k|                                if (nErr)
  ------------------
  |  Branch (4534:37): [True: 0, False: 6.12k]
  ------------------
 4535|      0|                                    goto exit_function;
 4536|  6.12k|                                tot_changes += (num_changes>0);
 4537|  6.12k|                            }
 4538|  39.1k|                            if (nNumBondPos > 0) {
  ------------------
  |  Branch (4538:33): [True: 39.1k, False: 0]
  ------------------
 4539|       |                                /*  some of the bonds have not been marked as tautomeric yet */
 4540|  39.1k|                                num_changes = SetTautomericBonds(at, nNumBondPos, BondPos);
 4541|  39.1k|                                tot_changes += (num_changes>0);
 4542|  39.1k|                            }
 4543|  39.1k|                        }
 4544|  39.3k|                    }
 4545|  75.3k|                }
 4546|   123k|            }
 4547|  89.2k|        }
 4548|  1.11M|    }
 4549|       |
 4550|       |
 4551|   263k|#if ( TAUT_PT_22_00 == 1 ) /******* BEGIN PT_22_00 ********/
 4552|   263k|    if (t_group_info->bTautFlags & TG_FLAG_PT_22_00) {
  ------------------
  |  |  953|   263k|#define TG_FLAG_PT_22_00                 0x00800000
  ------------------
  |  Branch (4552:9): [True: 0, False: 263k]
  ------------------
 4553|       |        /*** [#1:1][CX4:2][NX2:3]=[CX3:4]>>[CX3:2]=[NX2:3][CX4:4][#1:1] ***/
 4554|       |        /*** Similar to the previous case of M=Q-ZH >> MH-Q=Z, with M,Z = "C" and Q = "N" ***/
 4555|      0|        for (i = 0; i < num_atoms; i++) {
  ------------------
  |  Branch (4555:21): [True: 0, False: 0]
  ------------------
 4556|       |            /*  find possible endpoint Z = at[i] */
 4557|      0|            if ((endpoint_valence = nGetEndpointInfo_PT_22_00(at, i, &eif1))) { /* djb-rwth: addressing LLVM warning; ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (4557:17): [True: 0, False: 0]
  ------------------
 4558|       |                /*  1st endpoint candidate found. Find centerpoint candidate */
 4559|      0|                for (j = 0; j < at[i].valence; j++) {
  ------------------
  |  Branch (4559:29): [True: 0, False: 0]
  ------------------
 4560|      0|                    bond_type = (int)at[i].bond_type[j] & ~BOND_MARK_ALL;
  ------------------
  |  |  191|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 4561|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 4562|       |                    bond_type = ACTUAL_ORDER(pBNS, i, j, bond_type);
 4563|       |#endif
 4564|      0|                    centerpoint = (int)at[i].neighbor[j];  /*  a centerpoint candidate */
 4565|      0|                    if ((bond_type == BOND_DOUBLE ||
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (4565:26): [True: 0, False: 0]
  ------------------
 4566|      0|                        bond_type == BOND_ALTERN ||
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (4566:25): [True: 0, False: 0]
  ------------------
 4567|      0|                        bond_type == BOND_ALT12NS ||
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (4567:25): [True: 0, False: 0]
  ------------------
 4568|      0|                        bond_type == BOND_TAUTOM) && at[centerpoint].el_number == EL_NUMBER_N
  ------------------
  |  |  185|      0|#define BOND_TAUTOM              8
  ------------------
                                      bond_type == BOND_TAUTOM) && at[centerpoint].el_number == EL_NUMBER_N
  ------------------
  |  |   14|      0|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (4568:25): [True: 0, False: 0]
  |  Branch (4568:54): [True: 0, False: 0]
  ------------------
 4569|      0|                        && ALLOWED_EDGE(pBNS, i, j)
  ------------------
  |  | 4321|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (4321:42): [True: 0, False: 0]
  |  |  |  Branch (4321:53): [True: 0, False: 0]
  |  |  |  Branch (4321:70): [True: 0, False: 0]
  |  |  |  Branch (4321:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4570|      0|                        ) {
 4571|       |                        /*  test a centerpoint candidate. */
 4572|       |                        /*  find all endpoints including at[i] and store them into EndPoint[] */
 4573|      0|                        nNumPossibleMobile = 0;
 4574|      0|                        nGroupNumber = (AT_NUMB)num_atoms; /*  greater than any tautomeric group number */
 4575|      0|                        bDiffGroups = -1;         /*  ignore the first difference */
 4576|      0|                        nNumDonor = nNumAcceptor = 0;
 4577|      0|                        for (k = 0, nNumEndPoints = 0, nNumBondPos = 0; k < at[centerpoint].valence; k++) {
  ------------------
  |  Branch (4577:73): [True: 0, False: 0]
  ------------------
 4578|      0|                            endpoint = at[centerpoint].neighbor[k]; /*  endpoint candidate */
 4579|      0|                            bond_type = (int)at[centerpoint].bond_type[k] & ~BOND_MARK_ALL;
  ------------------
  |  |  191|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 4580|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 4581|       |                            bond_type = ACTUAL_ORDER(pBNS, centerpoint, k, bond_type);
 4582|       |#endif
 4583|       |                            /* djb-rwth: removing redundant code */
 4584|      0|                                bNonTautBond =
 4585|      0|                                bAltBond = /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 4586|      0|                                bPossiblyEndpoint = 0;
 4587|      0|                            if (!ALLOWED_EDGE(pBNS, centerpoint, k)) {
  ------------------
  |  | 4321|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (4321:42): [True: 0, False: 0]
  |  |  |  Branch (4321:53): [True: 0, False: 0]
  |  |  |  Branch (4321:70): [True: 0, False: 0]
  |  |  |  Branch (4321:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4588|      0|                                continue;
 4589|      0|                            }
 4590|      0|                            else
 4591|      0|                                if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                              if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
                                              if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  185|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (4591:37): [True: 0, False: 0]
  |  Branch (4591:65): [True: 0, False: 0]
  |  Branch (4591:94): [True: 0, False: 0]
  ------------------
 4592|       |                                    /* djb-rwth: removing redundant code */
 4593|      0|#if ( REPLACE_ALT_WITH_TAUT == 1 )
 4594|      0|                                    bAltBond = (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                                  bAltBond = (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (4594:49): [True: 0, False: 0]
  |  Branch (4594:77): [True: 0, False: 0]
  ------------------
 4595|      0|#endif
 4596|      0|                                }
 4597|      0|                                else
 4598|      0|                                    if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE)
  ------------------
  |  |  177|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                                                  if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE)
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (4598:41): [True: 0, False: 0]
  |  Branch (4598:69): [True: 0, False: 0]
  ------------------
 4599|      0|                                        bNonTautBond = 1;
 4600|      0|                                    else
 4601|      0|                                        continue;
 4602|       |
 4603|      0|                            if (!(endpoint_valence = nGetEndpointInfo_PT_22_00(at, endpoint, &eif1))) /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (4603:33): [True: 0, False: 0]
  ------------------
 4604|      0|                                continue; /*  not an endpoint element or can't have mobile groups */
 4605|       |                                          /*  save information about the found possible tautomeric endpoint */
 4606|       |                                          /*  2 = T_NUM_NO_ISOTOPIC non-isotopic values */
 4607|      0|                            nMobile =
 4608|      0|                                AddAtom2num(EndPoint[nNumEndPoints].num, at, endpoint, 2); /* fill out */
 4609|      0|                            AddAtom2DA(EndPoint[nNumEndPoints].num_DA, at, endpoint, 2);
 4610|       |                            /* --- why is isitopic info missing ? -- see below
 4611|       |                            nMobile  = EndPoint[nNumEndPoints].num[1] = (at[endpoint].charge == -1);
 4612|       |                            nMobile  = EndPoint[nNumEndPoints].num[0] = at[endpoint].num_H + nMobile;
 4613|       |                            */
 4614|      0|                            if (bNonTautBond) {
  ------------------
  |  Branch (4614:33): [True: 0, False: 0]
  ------------------
 4615|      0|                                m = (bond_type == BOND_SINGLE && (nMobile || at[endpoint].endpoint));
  ------------------
  |  |  177|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (4615:38): [True: 0, False: 0]
  |  Branch (4615:67): [True: 0, False: 0]
  |  Branch (4615:78): [True: 0, False: 0]
  ------------------
 4616|      0|                                nNumDonor += m;
 4617|      0|                                bPossiblyEndpoint += m;
 4618|      0|                                m = (bond_type == BOND_DOUBLE);
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
 4619|      0|                                nNumAcceptor += m;
 4620|      0|                                bPossiblyEndpoint += m;
 4621|      0|                            }
 4622|      0|                            else {
 4623|       |                                /*  tautomeric or alternating bond */
 4624|      0|                                m = (0 != at[endpoint].endpoint || eif1.cDonor);
  ------------------
  |  Branch (4624:38): [True: 0, False: 0]
  |  Branch (4624:68): [True: 0, False: 0]
  ------------------
 4625|      0|                                nNumDonor += m;
 4626|      0|                                bPossiblyEndpoint += m;
 4627|      0|                                m = (at[endpoint].endpoint ||
  ------------------
  |  Branch (4627:38): [True: 0, False: 0]
  ------------------
 4628|      0|                                    eif1.cNeutralBondsValence > at[endpoint].valence);
  ------------------
  |  Branch (4628:37): [True: 0, False: 0]
  ------------------
 4629|      0|                                nNumAcceptor += m;
 4630|      0|                                bPossiblyEndpoint += m;
 4631|      0|                            }
 4632|      0|                            if (!bPossiblyEndpoint)
  ------------------
  |  Branch (4632:33): [True: 0, False: 0]
  ------------------
 4633|      0|                                continue;
 4634|      0|                            EndPoint[nNumEndPoints].nGroupNumber = at[endpoint].endpoint; /* =0 if it is an endpoint for the 1st time */
 4635|      0|                            EndPoint[nNumEndPoints].nEquNumber = 0;
 4636|      0|                            EndPoint[nNumEndPoints].nAtomNumber = (AT_NUMB)endpoint;
 4637|      0|                            if (nGroupNumber != at[endpoint].endpoint) {
  ------------------
  |  Branch (4637:33): [True: 0, False: 0]
  ------------------
 4638|      0|                                bDiffGroups++;
 4639|      0|                                nGroupNumber = at[endpoint].endpoint;
 4640|      0|                            }
 4641|       |
 4642|       |                            /*  save positions of all, not only possibly tautomeric bonds */
 4643|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 4644|       |                            if (bNonTautBond || bAltBond) {
 4645|       |#endif
 4646|      0|                                BondPos[nNumBondPos].nAtomNumber = (AT_NUMB)centerpoint;
 4647|      0|                                BondPos[nNumBondPos].neighbor_index = (AT_NUMB)k; /* bond ordering number; used to change bonds to tautomeric only  */
 4648|      0|                                nNumBondPos++;
 4649|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 4650|       |                            }
 4651|       |#endif
 4652|       |                            /*  mobile group is possible if (a) the endpoint has a mobile group or */
 4653|       |                            /*                              (b) the centerpoint is adjacent to another endpoint */
 4654|      0|                            nNumPossibleMobile += (nMobile>0 || at[endpoint].endpoint);
  ------------------
  |  Branch (4654:52): [True: 0, False: 0]
  |  Branch (4654:65): [True: 0, False: 0]
  ------------------
 4655|      0|                            nNumEndPoints++;
 4656|       |                            /*printf("Found %d %d %d %d\n", centerpoint+1, at[centerpoint].el_number, endpoint+1, at[endpoint].el_number);*/
 4657|      0|                        }
 4658|      0|                        if (nNumEndPoints > 1 && nNumPossibleMobile && nNumDonor && nNumAcceptor) {
  ------------------
  |  Branch (4658:29): [True: 0, False: 0]
  |  Branch (4658:50): [True: 0, False: 0]
  |  Branch (4658:72): [True: 0, False: 0]
  |  Branch (4658:85): [True: 0, False: 0]
  ------------------
 4659|       |                            /*
 4660|       |                            * a tautomeric group has been found
 4661|       |                            *
 4662|       |                            * at this point:
 4663|       |                            * nGroupNumber = 0 if all endpoints belong to a newly discovered tautomeric group
 4664|       |                            * bDiffGroups  > 0 if at least 2 tautomeric groups are to be merged (one of them can be new)
 4665|       |                            * case (nGroupNumber != 0 && bDiffGroups = 0 ) ignored because all endpoints belong to the same known t-group
 4666|       |                            * case (nGroupNumber != 0 && bDiffGroups < 0 ) cannot happen
 4667|       |                            */
 4668|       |
 4669|      0|                            nErr = FindAccessibleEndPoints(pCG,
 4670|      0|                                EndPoint, &nNumEndPoints,
 4671|      0|                                BondPos, &nNumBondPos,
 4672|      0|                                pBNS, pBD, at,
 4673|      0|                                num_atoms, c_group_info,
 4674|      0|                                ALT_PATH_MODE_TAUTOM_PT_22_00);
  ------------------
  |  |  324|      0|#define ALT_PATH_MODE_TAUTOM_PT_22_00 11
  ------------------
 4675|       |
 4676|      0|                            if (IS_BNS_ERROR(nErr)) {
  ------------------
  |  |   67|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 0, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4677|      0|                                return nErr;
 4678|      0|                            }
 4679|      0|                            nErr = 0;
 4680|       |
 4681|      0|                            if (nNumEndPoints > 0) {
  ------------------
  |  Branch (4681:33): [True: 0, False: 0]
  ------------------
 4682|      0|                                if (!nGroupNumber || bDiffGroups > 0) {
  ------------------
  |  Branch (4682:37): [True: 0, False: 0]
  |  Branch (4682:54): [True: 0, False: 0]
  ------------------
 4683|       |
 4684|      0|                                    num_changes = RegisterEndPoints(pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS);
 4685|      0|                                    if (num_changes == -1) {
  ------------------
  |  Branch (4685:41): [True: 0, False: 0]
  ------------------
 4686|      0|                                        nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   24|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4687|      0|                                    }
 4688|      0|                                    if (num_changes < 0) {
  ------------------
  |  Branch (4688:41): [True: 0, False: 0]
  ------------------
 4689|      0|                                        nErr = num_changes;
 4690|      0|                                    }
 4691|       |
 4692|      0|                                    if (nErr)
  ------------------
  |  Branch (4692:41): [True: 0, False: 0]
  ------------------
 4693|      0|                                        goto exit_function;
 4694|      0|                                    tot_changes += (num_changes>0);
 4695|      0|                                }
 4696|      0|                                if (nNumBondPos > 0) {
  ------------------
  |  Branch (4696:37): [True: 0, False: 0]
  ------------------
 4697|       |                                    /*  some of the bonds have not been marked as tautomeric yet */
 4698|      0|                                    num_changes = SetTautomericBonds(at, nNumBondPos, BondPos);
 4699|      0|                                    tot_changes += (num_changes>0);
 4700|      0|                                }
 4701|      0|                            }
 4702|      0|                        }
 4703|      0|                    }
 4704|      0|                }
 4705|      0|            }
 4706|      0|        }
 4707|      0|    }
 4708|   263k|#endif /********** END PT_22_00 ************/
 4709|       |
 4710|   263k|#if ( TAUT_PT_16_00 == 1 )    /******* BEGIN PT_16_00 ********/
 4711|   263k|    if (t_group_info->bTautFlags & TG_FLAG_PT_16_00) {
  ------------------
  |  |  954|   263k|#define TG_FLAG_PT_16_00                 0x01000000
  ------------------
  |  Branch (4711:9): [True: 0, False: 263k]
  ------------------
 4712|       |        /*** [#1:1][O;!R:2][N+0z1:3]=[CX3:4]>>[O;!R:2]=[N+0z1:3][CX4:4][#1:1] ***/
 4713|       |        /*** Similar to the previous case of M=Q-ZH >> MH-Q=Z, with M,Z = "C, O" and Q = "N" ***/
 4714|      0|        for (i = 0; i < num_atoms; i++) {
  ------------------
  |  Branch (4714:21): [True: 0, False: 0]
  ------------------
 4715|       |            /*  find possible endpoint Z = at[i] */
 4716|      0|            if ((endpoint_valence = nGetEndpointInfo_PT_16_00(at, i, &eif1))) { /* djb-rwth: addressing LLVM warning; ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (4716:17): [True: 0, False: 0]
  ------------------
 4717|       |                /*  1st endpoint candidate found. Find centerpoint candidate */
 4718|      0|                for (j = 0; j < at[i].valence; j++) {
  ------------------
  |  Branch (4718:29): [True: 0, False: 0]
  ------------------
 4719|      0|                    bond_type = (int)at[i].bond_type[j] & ~BOND_MARK_ALL;
  ------------------
  |  |  191|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 4720|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 4721|       |                    bond_type = ACTUAL_ORDER(pBNS, i, j, bond_type);
 4722|       |#endif
 4723|      0|                    centerpoint = (int)at[i].neighbor[j];  /*  a centerpoint candidate */
 4724|      0|                    if ((bond_type == BOND_DOUBLE ||
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (4724:26): [True: 0, False: 0]
  ------------------
 4725|      0|                        bond_type == BOND_ALTERN ||
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (4725:25): [True: 0, False: 0]
  ------------------
 4726|      0|                        bond_type == BOND_ALT12NS ||
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (4726:25): [True: 0, False: 0]
  ------------------
 4727|      0|                        bond_type == BOND_TAUTOM)
  ------------------
  |  |  185|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (4727:25): [True: 0, False: 0]
  ------------------
 4728|      0|                        && at[centerpoint].el_number == EL_NUMBER_N
  ------------------
  |  |   14|      0|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (4728:28): [True: 0, False: 0]
  ------------------
 4729|      0|                        && at[centerpoint].valence == 2
  ------------------
  |  Branch (4729:28): [True: 0, False: 0]
  ------------------
 4730|      0|                        && at[centerpoint].charge == 0
  ------------------
  |  Branch (4730:28): [True: 0, False: 0]
  ------------------
 4731|      0|                        && ALLOWED_EDGE(pBNS, i, j)
  ------------------
  |  | 4321|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (4321:42): [True: 0, False: 0]
  |  |  |  Branch (4321:53): [True: 0, False: 0]
  |  |  |  Branch (4321:70): [True: 0, False: 0]
  |  |  |  Branch (4321:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4732|      0|                        ) {
 4733|       |                        /*  test a centerpoint candidate. */
 4734|       |                        /*  find all endpoints including at[i] and store them into EndPoint[] */
 4735|      0|                        nNumPossibleMobile = 0;
 4736|      0|                        nGroupNumber = (AT_NUMB)num_atoms; /*  greater than any tautomeric group number */
 4737|      0|                        bDiffGroups = -1;         /*  ignore the first difference */
 4738|      0|                        nNumDonor = nNumAcceptor = 0;
 4739|      0|                        for (k = 0, nNumEndPoints = 0, nNumBondPos = 0; k < at[centerpoint].valence; k++) {
  ------------------
  |  Branch (4739:73): [True: 0, False: 0]
  ------------------
 4740|      0|                            endpoint = at[centerpoint].neighbor[k]; /*  endpoint candidate */
 4741|      0|                            bond_type = (int)at[centerpoint].bond_type[k] & ~BOND_MARK_ALL;
  ------------------
  |  |  191|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 4742|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 4743|       |                            bond_type = ACTUAL_ORDER(pBNS, centerpoint, k, bond_type);
 4744|       |#endif
 4745|       |                            /* djb-rwth: removing redundant code */
 4746|      0|                                bNonTautBond =
 4747|      0|                                bAltBond = /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 4748|      0|                                bPossiblyEndpoint = 0;
 4749|      0|                            if (!ALLOWED_EDGE(pBNS, centerpoint, k)) {
  ------------------
  |  | 4321|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (4321:42): [True: 0, False: 0]
  |  |  |  Branch (4321:53): [True: 0, False: 0]
  |  |  |  Branch (4321:70): [True: 0, False: 0]
  |  |  |  Branch (4321:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4750|      0|                                continue;
 4751|      0|                            }
 4752|      0|                            else
 4753|      0|                                if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                              if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
                                              if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  185|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (4753:37): [True: 0, False: 0]
  |  Branch (4753:65): [True: 0, False: 0]
  |  Branch (4753:94): [True: 0, False: 0]
  ------------------
 4754|       |                                    /* djb-rwth: removing redundant code */
 4755|      0|#if ( REPLACE_ALT_WITH_TAUT == 1 )
 4756|      0|                                    bAltBond = (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                                  bAltBond = (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (4756:49): [True: 0, False: 0]
  |  Branch (4756:77): [True: 0, False: 0]
  ------------------
 4757|      0|#endif
 4758|      0|                                }
 4759|      0|                                else
 4760|      0|                                    if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE)
  ------------------
  |  |  177|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                                                  if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE)
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (4760:41): [True: 0, False: 0]
  |  Branch (4760:69): [True: 0, False: 0]
  ------------------
 4761|      0|                                        bNonTautBond = 1;
 4762|      0|                                    else
 4763|      0|                                        continue;
 4764|       |
 4765|      0|                            if (!(endpoint_valence = nGetEndpointInfo_PT_16_00(at, endpoint, &eif1))) /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (4765:33): [True: 0, False: 0]
  ------------------
 4766|      0|                                continue; /*  not an endpoint element or can't have mobile groups */
 4767|      0|                            if (at[endpoint].el_number == EL_NUMBER_O &&
  ------------------
  |  |   15|      0|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (4767:33): [True: 0, False: 0]
  ------------------
 4768|      0|                                at[endpoint].nNumAtInRingSystem != 1)
  ------------------
  |  Branch (4768:33): [True: 0, False: 0]
  ------------------
 4769|      0|                                continue;
 4770|      0|                            if (endpoint != i && at[endpoint].el_number == at[i].el_number)
  ------------------
  |  Branch (4770:33): [True: 0, False: 0]
  |  Branch (4770:50): [True: 0, False: 0]
  ------------------
 4771|      0|                                continue;
 4772|       |                            /*  save information about the found possible tautomeric endpoint */
 4773|       |                            /*  2 = T_NUM_NO_ISOTOPIC non-isotopic values */
 4774|      0|                            nMobile =
 4775|      0|                                AddAtom2num(EndPoint[nNumEndPoints].num, at, endpoint, 2); /* fill out */
 4776|      0|                            AddAtom2DA(EndPoint[nNumEndPoints].num_DA, at, endpoint, 2);
 4777|       |                            /* --- why is isitopic info missing ? -- see below
 4778|       |                            nMobile  = EndPoint[nNumEndPoints].num[1] = (at[endpoint].charge == -1);
 4779|       |                            nMobile  = EndPoint[nNumEndPoints].num[0] = at[endpoint].num_H + nMobile;
 4780|       |                            */
 4781|      0|                            if (bNonTautBond) {
  ------------------
  |  Branch (4781:33): [True: 0, False: 0]
  ------------------
 4782|      0|                                m = (bond_type == BOND_SINGLE && (nMobile || at[endpoint].endpoint));
  ------------------
  |  |  177|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (4782:38): [True: 0, False: 0]
  |  Branch (4782:67): [True: 0, False: 0]
  |  Branch (4782:78): [True: 0, False: 0]
  ------------------
 4783|      0|                                nNumDonor += m;
 4784|      0|                                bPossiblyEndpoint += m;
 4785|      0|                                m = (bond_type == BOND_DOUBLE);
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
 4786|      0|                                nNumAcceptor += m;
 4787|      0|                                bPossiblyEndpoint += m;
 4788|      0|                            }
 4789|      0|                            else {
 4790|       |                                /*  tautomeric or alternating bond */
 4791|      0|                                m = (0 != at[endpoint].endpoint || eif1.cDonor);
  ------------------
  |  Branch (4791:38): [True: 0, False: 0]
  |  Branch (4791:68): [True: 0, False: 0]
  ------------------
 4792|      0|                                nNumDonor += m;
 4793|      0|                                bPossiblyEndpoint += m;
 4794|      0|                                m = (at[endpoint].endpoint ||
  ------------------
  |  Branch (4794:38): [True: 0, False: 0]
  ------------------
 4795|      0|                                    eif1.cNeutralBondsValence > at[endpoint].valence);
  ------------------
  |  Branch (4795:37): [True: 0, False: 0]
  ------------------
 4796|      0|                                nNumAcceptor += m;
 4797|      0|                                bPossiblyEndpoint += m;
 4798|      0|                            }
 4799|      0|                            if (!bPossiblyEndpoint)
  ------------------
  |  Branch (4799:33): [True: 0, False: 0]
  ------------------
 4800|      0|                                continue;
 4801|       |
 4802|      0|                            EndPoint[nNumEndPoints].nGroupNumber = at[endpoint].endpoint; /* =0 if it is an endpoint for the 1st time */
 4803|      0|                            EndPoint[nNumEndPoints].nEquNumber = 0;
 4804|      0|                            EndPoint[nNumEndPoints].nAtomNumber = (AT_NUMB)endpoint;
 4805|      0|                            if (nGroupNumber != at[endpoint].endpoint) {
  ------------------
  |  Branch (4805:33): [True: 0, False: 0]
  ------------------
 4806|      0|                                bDiffGroups++;
 4807|      0|                                nGroupNumber = at[endpoint].endpoint;
 4808|      0|                            }
 4809|       |
 4810|       |                            /*  save positions of all, not only possibly tautomeric bonds */
 4811|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 4812|       |                            if (bNonTautBond || bAltBond) {
 4813|       |#endif
 4814|      0|                                BondPos[nNumBondPos].nAtomNumber = (AT_NUMB)centerpoint;
 4815|      0|                                BondPos[nNumBondPos].neighbor_index = (AT_NUMB)k; /* bond ordering number; used to change bonds to tautomeric only  */
 4816|      0|                                nNumBondPos++;
 4817|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 4818|       |                            }
 4819|       |#endif
 4820|       |                            /*  mobile group is possible if (a) the endpoint has a mobile group or */
 4821|       |                            /*                              (b) the centerpoint is adjacent to another endpoint */
 4822|      0|                            nNumPossibleMobile += (nMobile>0 || at[endpoint].endpoint);
  ------------------
  |  Branch (4822:52): [True: 0, False: 0]
  |  Branch (4822:65): [True: 0, False: 0]
  ------------------
 4823|      0|                            nNumEndPoints++;
 4824|       |                            /*printf("Found %d %d %d %d\n", centerpoint+1, at[centerpoint].el_number, endpoint+1, at[endpoint].el_number);*/
 4825|      0|                        }
 4826|      0|                        if (nNumEndPoints > 1 && nNumPossibleMobile && nNumDonor && nNumAcceptor) {
  ------------------
  |  Branch (4826:29): [True: 0, False: 0]
  |  Branch (4826:50): [True: 0, False: 0]
  |  Branch (4826:72): [True: 0, False: 0]
  |  Branch (4826:85): [True: 0, False: 0]
  ------------------
 4827|       |                            /*
 4828|       |                            * a tautomeric group has been found
 4829|       |                            *
 4830|       |                            * at this point:
 4831|       |                            * nGroupNumber = 0 if all endpoints belong to a newly discovered tautomeric group
 4832|       |                            * bDiffGroups  > 0 if at least 2 tautomeric groups are to be merged (one of them can be new)
 4833|       |                            * case (nGroupNumber != 0 && bDiffGroups = 0 ) ignored because all endpoints belong to the same known t-group
 4834|       |                            * case (nGroupNumber != 0 && bDiffGroups < 0 ) cannot happen
 4835|       |                            */
 4836|      0|                            nErr = FindAccessibleEndPoints(pCG,
 4837|      0|                                EndPoint, &nNumEndPoints,
 4838|      0|                                BondPos, &nNumBondPos,
 4839|      0|                                pBNS, pBD, at,
 4840|      0|                                num_atoms, c_group_info,
 4841|      0|                                ALT_PATH_MODE_TAUTOM_PT_16_00);
  ------------------
  |  |  327|      0|#define ALT_PATH_MODE_TAUTOM_PT_16_00 12
  ------------------
 4842|       |
 4843|      0|                            if (IS_BNS_ERROR(nErr)) {
  ------------------
  |  |   67|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 0, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4844|      0|                                return nErr;
 4845|      0|                            }
 4846|      0|                            nErr = 0;
 4847|       |
 4848|      0|                            if (nNumEndPoints > 0) {
  ------------------
  |  Branch (4848:33): [True: 0, False: 0]
  ------------------
 4849|      0|                                if (!nGroupNumber || bDiffGroups > 0) {
  ------------------
  |  Branch (4849:37): [True: 0, False: 0]
  |  Branch (4849:54): [True: 0, False: 0]
  ------------------
 4850|       |
 4851|      0|                                    num_changes = RegisterEndPoints(pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS);
 4852|      0|                                    if (num_changes == -1) {
  ------------------
  |  Branch (4852:41): [True: 0, False: 0]
  ------------------
 4853|      0|                                        nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   24|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4854|      0|                                    }
 4855|      0|                                    if (num_changes < 0) {
  ------------------
  |  Branch (4855:41): [True: 0, False: 0]
  ------------------
 4856|      0|                                        nErr = num_changes;
 4857|      0|                                    }
 4858|       |
 4859|      0|                                    if (nErr)
  ------------------
  |  Branch (4859:41): [True: 0, False: 0]
  ------------------
 4860|      0|                                        goto exit_function;
 4861|      0|                                    tot_changes += (num_changes>0);
 4862|      0|                                }
 4863|      0|                                if (nNumBondPos > 0) {
  ------------------
  |  Branch (4863:37): [True: 0, False: 0]
  ------------------
 4864|       |                                    /*  some of the bonds have not been marked as tautomeric yet */
 4865|      0|                                    num_changes = SetTautomericBonds(at, nNumBondPos, BondPos);
 4866|      0|                                    tot_changes += (num_changes>0);
 4867|      0|                                }
 4868|      0|                            }
 4869|      0|                        }
 4870|      0|                    }
 4871|      0|                }
 4872|      0|            }
 4873|      0|        }
 4874|      0|    }
 4875|   263k|#endif /********** END PT_16_00 ************/     
 4876|       |
 4877|   263k|#if ( TAUT_PT_06_00 == 1 ) /******* BEGIN PT_06_00 ********/
 4878|   263k|    if (t_group_info->bTautFlags & TG_FLAG_PT_06_00) {
  ------------------
  |  |  955|   263k|#define TG_FLAG_PT_06_00                 0x02000000
  ------------------
  |  Branch (4878:9): [True: 0, False: 263k]
  ------------------
 4879|       |        /*** [CX{2-3}z{0-1},N,n,S,s,O,o,Se,Te:1]=[NX2,nX2,CX3,c,P,p:2][N,n,S,O,Se,Te:3][#1:4] >> [#1:4][CX4z{0-1},N,n,S,O,Se,Te:1][NX2,nX2,CX3z{0-1},c,P,p:2]=[N,n,S,s,O,o,Se,Te:3] ***/
 4880|       |        /*** Similar to the previous case of M=Q-ZH >> MH-Q=Z, with M = "C,N,S,O,Se,Te", Q = "N,C,P", and Z = "N,S,O,Se,Te" ***/
 4881|      0|        for (i = 0; i < num_atoms; i++) {
  ------------------
  |  Branch (4881:21): [True: 0, False: 0]
  ------------------
 4882|       |            /*  find possible endpoint Z = at[i] */
 4883|      0|            if ((endpoint_valence = nGetEndpointInfo_PT_06_00(at, i, &eif1))) { /* djb-rwth: addressing LLVM warning; ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (4883:17): [True: 0, False: 0]
  ------------------
 4884|       |                /*  1st endpoint candidate found. Find centerpoint candidate */
 4885|      0|                for (j = 0; j < at[i].valence; j++) {
  ------------------
  |  Branch (4885:29): [True: 0, False: 0]
  ------------------
 4886|      0|                    bond_type = (int)at[i].bond_type[j] & ~BOND_MARK_ALL;
  ------------------
  |  |  191|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 4887|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 4888|       |                    bond_type = ACTUAL_ORDER(pBNS, i, j, bond_type);
 4889|       |#endif
 4890|      0|                    centerpoint = (int)at[i].neighbor[j];  /*  a centerpoint candidate */
 4891|      0|                    if ((bond_type == BOND_DOUBLE ||
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (4891:26): [True: 0, False: 0]
  ------------------
 4892|      0|                        bond_type == BOND_ALTERN ||
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (4892:25): [True: 0, False: 0]
  ------------------
 4893|      0|                        bond_type == BOND_ALT12NS ||
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (4893:25): [True: 0, False: 0]
  ------------------
 4894|      0|                        bond_type == BOND_TAUTOM) &&
  ------------------
  |  |  185|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (4894:25): [True: 0, False: 0]
  ------------------
 4895|      0|                        (at[centerpoint].el_number == EL_NUMBER_N ||
  ------------------
  |  |   14|      0|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (4895:26): [True: 0, False: 0]
  ------------------
 4896|      0|                            at[centerpoint].el_number == EL_NUMBER_C ||
  ------------------
  |  |   13|      0|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (4896:29): [True: 0, False: 0]
  ------------------
 4897|      0|                            at[centerpoint].el_number == EL_NUMBER_P)
  ------------------
  |  |   18|      0|#define EL_NUMBER_P  ((U_CHAR)15)
  ------------------
  |  Branch (4897:29): [True: 0, False: 0]
  ------------------
 4898|      0|                        && ALLOWED_EDGE(pBNS, i, j)
  ------------------
  |  | 4321|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (4321:42): [True: 0, False: 0]
  |  |  |  Branch (4321:53): [True: 0, False: 0]
  |  |  |  Branch (4321:70): [True: 0, False: 0]
  |  |  |  Branch (4321:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4899|      0|                        ) {
 4900|       |                        /*  test a centerpoint candidate. */
 4901|       |                        /*  find all endpoints including at[i] and store them into EndPoint[] */
 4902|      0|                        nNumPossibleMobile = 0;
 4903|      0|                        nGroupNumber = (AT_NUMB)num_atoms; /*  greater than any tautomeric group number */
 4904|      0|                        bDiffGroups = -1;         /*  ignore the first difference */
 4905|      0|                        nNumDonor = nNumAcceptor = 0;
 4906|      0|                        for (k = 0, nNumEndPoints = 0, nNumBondPos = 0; k < at[centerpoint].valence; k++) {
  ------------------
  |  Branch (4906:73): [True: 0, False: 0]
  ------------------
 4907|      0|                            endpoint = at[centerpoint].neighbor[k]; /*  endpoint candidate */
 4908|      0|                            bond_type = (int)at[centerpoint].bond_type[k] & ~BOND_MARK_ALL;
  ------------------
  |  |  191|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 4909|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 4910|       |                            bond_type = ACTUAL_ORDER(pBNS, centerpoint, k, bond_type);
 4911|       |#endif
 4912|       |                            /* djb-rwth: removing redundant code */
 4913|      0|                                bNonTautBond =
 4914|      0|                                bAltBond = /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 4915|      0|                                bPossiblyEndpoint = 0;
 4916|      0|                            if (!ALLOWED_EDGE(pBNS, centerpoint, k)) {
  ------------------
  |  | 4321|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (4321:42): [True: 0, False: 0]
  |  |  |  Branch (4321:53): [True: 0, False: 0]
  |  |  |  Branch (4321:70): [True: 0, False: 0]
  |  |  |  Branch (4321:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4917|      0|                                continue;
 4918|      0|                            }
 4919|      0|                            else
 4920|      0|                                if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                              if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
                                              if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  185|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (4920:37): [True: 0, False: 0]
  |  Branch (4920:65): [True: 0, False: 0]
  |  Branch (4920:94): [True: 0, False: 0]
  ------------------
 4921|       |                                    /* djb-rwth: removing redundant code */
 4922|      0|#if ( REPLACE_ALT_WITH_TAUT == 1 )
 4923|      0|                                    bAltBond = (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                                  bAltBond = (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (4923:49): [True: 0, False: 0]
  |  Branch (4923:77): [True: 0, False: 0]
  ------------------
 4924|      0|#endif
 4925|      0|                                }
 4926|      0|                                else
 4927|      0|                                    if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE)
  ------------------
  |  |  177|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                                                  if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE)
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (4927:41): [True: 0, False: 0]
  |  Branch (4927:69): [True: 0, False: 0]
  ------------------
 4928|      0|                                        bNonTautBond = 1;
 4929|      0|                                    else
 4930|      0|                                        continue;
 4931|      0|                            if (!(endpoint_valence = nGetEndpointInfo_PT_06_00(at, endpoint, &eif1))) /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (4931:33): [True: 0, False: 0]
  ------------------
 4932|      0|                                continue; /*  not an endpoint element or can't have mobile groups */
 4933|      0|                            if (i != endpoint &&
  ------------------
  |  Branch (4933:33): [True: 0, False: 0]
  ------------------
 4934|      0|                                at[endpoint].el_number == EL_NUMBER_C &&
  ------------------
  |  |   13|      0|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (4934:33): [True: 0, False: 0]
  ------------------
 4935|      0|                                at[i].el_number == EL_NUMBER_C)
  ------------------
  |  |   13|      0|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (4935:33): [True: 0, False: 0]
  ------------------
 4936|      0|                                continue;
 4937|       |                            /*  save information about the found possible tautomeric endpoint */
 4938|       |                            /*  2 = T_NUM_NO_ISOTOPIC non-isotopic values */
 4939|      0|                            nMobile =
 4940|      0|                                AddAtom2num(EndPoint[nNumEndPoints].num, at, endpoint, 2); /* fill out */
 4941|      0|                            AddAtom2DA(EndPoint[nNumEndPoints].num_DA, at, endpoint, 2);
 4942|       |                            /* --- why is isitopic info missing ? -- see below
 4943|       |                            nMobile  = EndPoint[nNumEndPoints].num[1] = (at[endpoint].charge == -1);
 4944|       |                            nMobile  = EndPoint[nNumEndPoints].num[0] = at[endpoint].num_H + nMobile;
 4945|       |                            */
 4946|      0|                            if (bNonTautBond) {
  ------------------
  |  Branch (4946:33): [True: 0, False: 0]
  ------------------
 4947|      0|                                m = (bond_type == BOND_SINGLE && (nMobile || at[endpoint].endpoint));
  ------------------
  |  |  177|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (4947:38): [True: 0, False: 0]
  |  Branch (4947:67): [True: 0, False: 0]
  |  Branch (4947:78): [True: 0, False: 0]
  ------------------
 4948|      0|                                nNumDonor += m;
 4949|      0|                                bPossiblyEndpoint += m;
 4950|      0|                                m = (bond_type == BOND_DOUBLE);
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
 4951|      0|                                nNumAcceptor += m;
 4952|      0|                                bPossiblyEndpoint += m;
 4953|      0|                            }
 4954|      0|                            else {
 4955|       |                                /*  tautomeric or alternating bond */
 4956|      0|                                m = (0 != at[endpoint].endpoint || eif1.cDonor);
  ------------------
  |  Branch (4956:38): [True: 0, False: 0]
  |  Branch (4956:68): [True: 0, False: 0]
  ------------------
 4957|      0|                                nNumDonor += m;
 4958|      0|                                bPossiblyEndpoint += m;
 4959|      0|                                m = (at[endpoint].endpoint ||
  ------------------
  |  Branch (4959:38): [True: 0, False: 0]
  ------------------
 4960|      0|                                    eif1.cNeutralBondsValence > at[endpoint].valence);
  ------------------
  |  Branch (4960:37): [True: 0, False: 0]
  ------------------
 4961|      0|                                nNumAcceptor += m;
 4962|      0|                                bPossiblyEndpoint += m;
 4963|      0|                            }
 4964|      0|                            if (!bPossiblyEndpoint)
  ------------------
  |  Branch (4964:33): [True: 0, False: 0]
  ------------------
 4965|      0|                                continue;
 4966|      0|                            EndPoint[nNumEndPoints].nGroupNumber = at[endpoint].endpoint; /* =0 if it is an endpoint for the 1st time */
 4967|      0|                            EndPoint[nNumEndPoints].nEquNumber = 0;
 4968|      0|                            EndPoint[nNumEndPoints].nAtomNumber = (AT_NUMB)endpoint;
 4969|      0|                            if (nGroupNumber != at[endpoint].endpoint) {
  ------------------
  |  Branch (4969:33): [True: 0, False: 0]
  ------------------
 4970|      0|                                bDiffGroups++;
 4971|      0|                                nGroupNumber = at[endpoint].endpoint;
 4972|      0|                            }
 4973|       |
 4974|       |                            /*  save positions of all, not only possibly tautomeric bonds */
 4975|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 4976|       |                            if (bNonTautBond || bAltBond) {
 4977|       |#endif
 4978|      0|                                BondPos[nNumBondPos].nAtomNumber = (AT_NUMB)centerpoint;
 4979|      0|                                BondPos[nNumBondPos].neighbor_index = (AT_NUMB)k; /* bond ordering number; used to change bonds to tautomeric only  */
 4980|      0|                                nNumBondPos++;
 4981|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 4982|       |                            }
 4983|       |#endif
 4984|       |                            /*  mobile group is possible if (a) the endpoint has a mobile group or */
 4985|       |                            /*                              (b) the centerpoint is adjacent to another endpoint */
 4986|      0|                            nNumPossibleMobile += (nMobile>0 || at[endpoint].endpoint);
  ------------------
  |  Branch (4986:52): [True: 0, False: 0]
  |  Branch (4986:65): [True: 0, False: 0]
  ------------------
 4987|      0|                            nNumEndPoints++;
 4988|       |                            /*printf("Found %d %d %d %d\n", centerpoint+1, at[centerpoint].el_number, endpoint+1, at[endpoint].el_number);*/
 4989|      0|                        }
 4990|      0|                        if (nNumEndPoints > 1 && nNumPossibleMobile && nNumDonor && nNumAcceptor) {
  ------------------
  |  Branch (4990:29): [True: 0, False: 0]
  |  Branch (4990:50): [True: 0, False: 0]
  |  Branch (4990:72): [True: 0, False: 0]
  |  Branch (4990:85): [True: 0, False: 0]
  ------------------
 4991|       |                            /*printf("Real %d\n", nNumEndPoints);*/
 4992|       |                            /*
 4993|       |                            * a tautomeric group has been found
 4994|       |                            *
 4995|       |                            * at this point:
 4996|       |                            * nGroupNumber = 0 if all endpoints belong to a newly discovered tautomeric group
 4997|       |                            * bDiffGroups  > 0 if at least 2 tautomeric groups are to be merged (one of them can be new)
 4998|       |                            * case (nGroupNumber != 0 && bDiffGroups = 0 ) ignored because all endpoints belong to the same known t-group
 4999|       |                            * case (nGroupNumber != 0 && bDiffGroups < 0 ) cannot happen
 5000|       |                            */
 5001|       |
 5002|      0|                            nErr = FindAccessibleEndPoints(pCG,
 5003|      0|                                EndPoint, &nNumEndPoints,
 5004|      0|                                BondPos, &nNumBondPos,
 5005|      0|                                pBNS, pBD, at,
 5006|      0|                                num_atoms, c_group_info,
 5007|      0|                                ALT_PATH_MODE_TAUTOM_PT_06_00);
  ------------------
  |  |  330|      0|#define ALT_PATH_MODE_TAUTOM_PT_06_00 13
  ------------------
 5008|       |
 5009|      0|                            if (IS_BNS_ERROR(nErr)) {
  ------------------
  |  |   67|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 0, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5010|      0|                                return nErr;
 5011|      0|                            }
 5012|      0|                            nErr = 0;
 5013|       |
 5014|      0|                            if (nNumEndPoints > 0) {
  ------------------
  |  Branch (5014:33): [True: 0, False: 0]
  ------------------
 5015|      0|                                if (!nGroupNumber || bDiffGroups > 0) {
  ------------------
  |  Branch (5015:37): [True: 0, False: 0]
  |  Branch (5015:54): [True: 0, False: 0]
  ------------------
 5016|       |
 5017|      0|                                    num_changes = RegisterEndPoints(pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS);
 5018|      0|                                    if (num_changes == -1) {
  ------------------
  |  Branch (5018:41): [True: 0, False: 0]
  ------------------
 5019|      0|                                        nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   24|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 5020|      0|                                    }
 5021|      0|                                    if (num_changes < 0) {
  ------------------
  |  Branch (5021:41): [True: 0, False: 0]
  ------------------
 5022|      0|                                        nErr = num_changes;
 5023|      0|                                    }
 5024|       |
 5025|      0|                                    if (nErr)
  ------------------
  |  Branch (5025:41): [True: 0, False: 0]
  ------------------
 5026|      0|                                        goto exit_function;
 5027|      0|                                    tot_changes += (num_changes>0);
 5028|      0|                                }
 5029|      0|                                if (nNumBondPos > 0) {
  ------------------
  |  Branch (5029:37): [True: 0, False: 0]
  ------------------
 5030|       |                                    /*  some of the bonds have not been marked as tautomeric yet */
 5031|      0|                                    num_changes = SetTautomericBonds(at, nNumBondPos, BondPos);
 5032|      0|                                    tot_changes += (num_changes>0);
 5033|      0|                                }
 5034|      0|                            }
 5035|      0|                        }
 5036|      0|                    }
 5037|      0|                }
 5038|      0|            }
 5039|      0|        }
 5040|      0|    }
 5041|   263k|#endif /********** END PT_06_00 ************/
 5042|       |
 5043|   263k|#if ( TAUT_PT_39_00 == 1 )    /******* BEGIN PT_39_00 ********/
 5044|   263k|    if (t_group_info->bTautFlags & TG_FLAG_PT_39_00) {
  ------------------
  |  |  956|   263k|#define TG_FLAG_PT_39_00                 0x04000000
  ------------------
  |  Branch (5044:9): [True: 0, False: 263k]
  ------------------
 5045|       |        /*** [CX3,NX2:1]=[NX3+:2]([O-:3])[CX4:4][#1:5]>>[#1:5][CX4,NX3:1][NX3+:2]([O-:3])=[CX3:4] ***/
 5046|       |        /*** Similar to the previous case of M=Q-ZH >> MH-Q=Z, with M,Z = "C, N" and Q = "N+" ***/
 5047|      0|        for (i = 0; i < num_atoms; i++) {
  ------------------
  |  Branch (5047:21): [True: 0, False: 0]
  ------------------
 5048|       |            /*  find possible endpoint Z = at[i] */
 5049|      0|            if ((endpoint_valence = nGetEndpointInfo_PT_39_00(at, i, &eif1))) { /* djb-rwth: addressing LLVM warning; ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (5049:17): [True: 0, False: 0]
  ------------------
 5050|       |                /*  1st endpoint candidate found. Find centerpoint candidate */
 5051|      0|                for (j = 0; j < at[i].valence; j++) {
  ------------------
  |  Branch (5051:29): [True: 0, False: 0]
  ------------------
 5052|      0|                    bond_type = (int)at[i].bond_type[j] & ~BOND_MARK_ALL;
  ------------------
  |  |  191|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 5053|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 5054|       |                    bond_type = ACTUAL_ORDER(pBNS, i, j, bond_type);
 5055|       |#endif
 5056|      0|                    centerpoint = (int)at[i].neighbor[j];  /*  a centerpoint candidate */
 5057|      0|                    if ((bond_type == BOND_DOUBLE ||
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (5057:26): [True: 0, False: 0]
  ------------------
 5058|      0|                        bond_type == BOND_ALTERN ||
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (5058:25): [True: 0, False: 0]
  ------------------
 5059|      0|                        bond_type == BOND_ALT12NS ||
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (5059:25): [True: 0, False: 0]
  ------------------
 5060|      0|                        bond_type == BOND_TAUTOM)
  ------------------
  |  |  185|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (5060:25): [True: 0, False: 0]
  ------------------
 5061|      0|                        && at[centerpoint].el_number == EL_NUMBER_N
  ------------------
  |  |   14|      0|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (5061:28): [True: 0, False: 0]
  ------------------
 5062|      0|                        && at[centerpoint].valence == 3
  ------------------
  |  Branch (5062:28): [True: 0, False: 0]
  ------------------
 5063|      0|                        && ALLOWED_EDGE(pBNS, i, j)
  ------------------
  |  | 4321|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (4321:42): [True: 0, False: 0]
  |  |  |  Branch (4321:53): [True: 0, False: 0]
  |  |  |  Branch (4321:70): [True: 0, False: 0]
  |  |  |  Branch (4321:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5064|      0|                        ) {
 5065|      0|                        int num_O = 0;
 5066|      0|                        int num_N = 0;
 5067|       |                        /*  test a centerpoint candidate. */
 5068|       |                        /*  find all endpoints including at[i] and store them into EndPoint[] */
 5069|      0|                        nNumPossibleMobile = 0;
 5070|      0|                        nGroupNumber = (AT_NUMB)num_atoms; /*  greater than any tautomeric group number */
 5071|      0|                        bDiffGroups = -1;         /*  ignore the first difference */
 5072|      0|                        nNumDonor = nNumAcceptor = 0;
 5073|      0|                        for (k = 0, nNumEndPoints = 0, nNumBondPos = 0; k < at[centerpoint].valence; k++) {
  ------------------
  |  Branch (5073:73): [True: 0, False: 0]
  ------------------
 5074|      0|                            endpoint = at[centerpoint].neighbor[k]; /*  endpoint candidate */
 5075|      0|                            num_O += (at[endpoint].el_number == EL_NUMBER_O);
  ------------------
  |  |   15|      0|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
 5076|      0|                            num_N += (at[endpoint].el_number == EL_NUMBER_N);
  ------------------
  |  |   14|      0|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
 5077|      0|                            bond_type = (int)at[centerpoint].bond_type[k] & ~BOND_MARK_ALL;
  ------------------
  |  |  191|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 5078|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 5079|       |                            bond_type = ACTUAL_ORDER(pBNS, centerpoint, k, bond_type);
 5080|       |#endif
 5081|       |                            /* djb-rwth: removing redundant code */
 5082|      0|                                bNonTautBond =
 5083|      0|                                bAltBond = /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 5084|      0|                                bPossiblyEndpoint = 0;
 5085|      0|                            if (!ALLOWED_EDGE(pBNS, centerpoint, k)) {
  ------------------
  |  | 4321|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (4321:42): [True: 0, False: 0]
  |  |  |  Branch (4321:53): [True: 0, False: 0]
  |  |  |  Branch (4321:70): [True: 0, False: 0]
  |  |  |  Branch (4321:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5086|      0|                                continue;
 5087|      0|                            }
 5088|      0|                            else
 5089|      0|                                if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                              if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
                                              if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  185|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (5089:37): [True: 0, False: 0]
  |  Branch (5089:65): [True: 0, False: 0]
  |  Branch (5089:94): [True: 0, False: 0]
  ------------------
 5090|       |                                    /* djb-rwth: removing redundant code */
 5091|      0|#if ( REPLACE_ALT_WITH_TAUT == 1 )
 5092|      0|                                    bAltBond = (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                                  bAltBond = (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (5092:49): [True: 0, False: 0]
  |  Branch (5092:77): [True: 0, False: 0]
  ------------------
 5093|      0|#endif
 5094|      0|                                }
 5095|      0|                                else
 5096|      0|                                    if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE)
  ------------------
  |  |  177|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                                                  if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE)
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (5096:41): [True: 0, False: 0]
  |  Branch (5096:69): [True: 0, False: 0]
  ------------------
 5097|      0|                                        bNonTautBond = 1;
 5098|      0|                                    else
 5099|      0|                                        continue;
 5100|       |
 5101|      0|                            if (!(endpoint_valence = nGetEndpointInfo_PT_39_00(at, endpoint, &eif1))) /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (5101:33): [True: 0, False: 0]
  ------------------
 5102|      0|                                continue; /*  not an endpoint element or can't have mobile groups */
 5103|       |
 5104|       |
 5105|       |                                          /*  save information about the found possible tautomeric endpoint */
 5106|       |                                          /*  2 = T_NUM_NO_ISOTOPIC non-isotopic values */
 5107|      0|                            nMobile =
 5108|      0|                                AddAtom2num(EndPoint[nNumEndPoints].num, at, endpoint, 2); /* fill out */
 5109|      0|                            AddAtom2DA(EndPoint[nNumEndPoints].num_DA, at, endpoint, 2);
 5110|       |                            /* --- why is isitopic info missing ? -- see below
 5111|       |                            nMobile  = EndPoint[nNumEndPoints].num[1] = (at[endpoint].charge == -1);
 5112|       |                            nMobile  = EndPoint[nNumEndPoints].num[0] = at[endpoint].num_H + nMobile;
 5113|       |                            */
 5114|      0|                            if (bNonTautBond) {
  ------------------
  |  Branch (5114:33): [True: 0, False: 0]
  ------------------
 5115|      0|                                m = (bond_type == BOND_SINGLE && (nMobile || at[endpoint].endpoint));
  ------------------
  |  |  177|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (5115:38): [True: 0, False: 0]
  |  Branch (5115:67): [True: 0, False: 0]
  |  Branch (5115:78): [True: 0, False: 0]
  ------------------
 5116|      0|                                nNumDonor += m;
 5117|      0|                                bPossiblyEndpoint += m;
 5118|      0|                                m = (bond_type == BOND_DOUBLE);
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
 5119|      0|                                nNumAcceptor += m;
 5120|      0|                                bPossiblyEndpoint += m;
 5121|      0|                            }
 5122|      0|                            else {
 5123|       |                                /*  tautomeric or alternating bond */
 5124|      0|                                m = (0 != at[endpoint].endpoint || eif1.cDonor);
  ------------------
  |  Branch (5124:38): [True: 0, False: 0]
  |  Branch (5124:68): [True: 0, False: 0]
  ------------------
 5125|      0|                                nNumDonor += m;
 5126|      0|                                bPossiblyEndpoint += m;
 5127|      0|                                m = (at[endpoint].endpoint ||
  ------------------
  |  Branch (5127:38): [True: 0, False: 0]
  ------------------
 5128|      0|                                    eif1.cNeutralBondsValence > at[endpoint].valence);
  ------------------
  |  Branch (5128:37): [True: 0, False: 0]
  ------------------
 5129|      0|                                nNumAcceptor += m;
 5130|      0|                                bPossiblyEndpoint += m;
 5131|      0|                            }
 5132|      0|                            if (!bPossiblyEndpoint)
  ------------------
  |  Branch (5132:33): [True: 0, False: 0]
  ------------------
 5133|      0|                                continue;
 5134|       |
 5135|      0|                            EndPoint[nNumEndPoints].nGroupNumber = at[endpoint].endpoint; /* =0 if it is an endpoint for the 1st time */
 5136|      0|                            EndPoint[nNumEndPoints].nEquNumber = 0;
 5137|      0|                            EndPoint[nNumEndPoints].nAtomNumber = (AT_NUMB)endpoint;
 5138|      0|                            if (nGroupNumber != at[endpoint].endpoint) {
  ------------------
  |  Branch (5138:33): [True: 0, False: 0]
  ------------------
 5139|      0|                                bDiffGroups++;
 5140|      0|                                nGroupNumber = at[endpoint].endpoint;
 5141|      0|                            }
 5142|       |
 5143|       |                            /*  save positions of all, not only possibly tautomeric bonds */
 5144|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 5145|       |                            if (bNonTautBond || bAltBond) {
 5146|       |#endif
 5147|      0|                                BondPos[nNumBondPos].nAtomNumber = (AT_NUMB)centerpoint;
 5148|      0|                                BondPos[nNumBondPos].neighbor_index = (AT_NUMB)k; /* bond ordering number; used to change bonds to tautomeric only  */
 5149|      0|                                nNumBondPos++;
 5150|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 5151|       |                            }
 5152|       |#endif
 5153|       |                            /*  mobile group is possible if (a) the endpoint has a mobile group or */
 5154|       |                            /*                              (b) the centerpoint is adjacent to another endpoint */
 5155|      0|                            nNumPossibleMobile += (nMobile>0 || at[endpoint].endpoint);
  ------------------
  |  Branch (5155:52): [True: 0, False: 0]
  |  Branch (5155:65): [True: 0, False: 0]
  ------------------
 5156|      0|                            nNumEndPoints++;
 5157|       |                            /*printf("Found %d %d %d %d\n", centerpoint+1, at[centerpoint].el_number, endpoint+1, at[endpoint].el_number);*/
 5158|      0|                        }
 5159|      0|                        if (nNumEndPoints > 1 && nNumPossibleMobile && nNumDonor && nNumAcceptor && num_O == 1 && num_N < 2) {
  ------------------
  |  Branch (5159:29): [True: 0, False: 0]
  |  Branch (5159:50): [True: 0, False: 0]
  |  Branch (5159:72): [True: 0, False: 0]
  |  Branch (5159:85): [True: 0, False: 0]
  |  Branch (5159:101): [True: 0, False: 0]
  |  Branch (5159:115): [True: 0, False: 0]
  ------------------
 5160|       |                            /*
 5161|       |                            * a tautomeric group has been found
 5162|       |                            *
 5163|       |                            * at this point:
 5164|       |                            * nGroupNumber = 0 if all endpoints belong to a newly discovered tautomeric group
 5165|       |                            * bDiffGroups  > 0 if at least 2 tautomeric groups are to be merged (one of them can be new)
 5166|       |                            * case (nGroupNumber != 0 && bDiffGroups = 0 ) ignored because all endpoints belong to the same known t-group
 5167|       |                            * case (nGroupNumber != 0 && bDiffGroups < 0 ) cannot happen
 5168|       |                            */
 5169|      0|                            nErr = FindAccessibleEndPoints(pCG,
 5170|      0|                                EndPoint, &nNumEndPoints,
 5171|      0|                                BondPos, &nNumBondPos,
 5172|      0|                                pBNS, pBD, at,
 5173|      0|                                num_atoms, c_group_info,
 5174|      0|                                ALT_PATH_MODE_TAUTOM_PT_39_00);
  ------------------
  |  |  333|      0|#define ALT_PATH_MODE_TAUTOM_PT_39_00 14
  ------------------
 5175|       |
 5176|      0|                            if (IS_BNS_ERROR(nErr)) {
  ------------------
  |  |   67|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 0, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5177|      0|                                return nErr;
 5178|      0|                            }
 5179|      0|                            nErr = 0;
 5180|       |
 5181|      0|                            if (nNumEndPoints > 0) {
  ------------------
  |  Branch (5181:33): [True: 0, False: 0]
  ------------------
 5182|      0|                                if (!nGroupNumber || bDiffGroups > 0) {
  ------------------
  |  Branch (5182:37): [True: 0, False: 0]
  |  Branch (5182:54): [True: 0, False: 0]
  ------------------
 5183|       |
 5184|      0|                                    num_changes = RegisterEndPoints(pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS);
 5185|      0|                                    if (num_changes == -1) {
  ------------------
  |  Branch (5185:41): [True: 0, False: 0]
  ------------------
 5186|      0|                                        nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   24|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 5187|      0|                                    }
 5188|      0|                                    if (num_changes < 0) {
  ------------------
  |  Branch (5188:41): [True: 0, False: 0]
  ------------------
 5189|      0|                                        nErr = num_changes;
 5190|      0|                                    }
 5191|       |
 5192|      0|                                    if (nErr)
  ------------------
  |  Branch (5192:41): [True: 0, False: 0]
  ------------------
 5193|      0|                                        goto exit_function;
 5194|      0|                                    tot_changes += (num_changes>0);
 5195|      0|                                }
 5196|      0|                                if (nNumBondPos > 0) {
  ------------------
  |  Branch (5196:37): [True: 0, False: 0]
  ------------------
 5197|       |                                    /*  some of the bonds have not been marked as tautomeric yet */
 5198|      0|                                    num_changes = SetTautomericBonds(at, nNumBondPos, BondPos);
 5199|      0|                                    tot_changes += (num_changes>0);
 5200|      0|                                }
 5201|      0|                            }
 5202|      0|                        }
 5203|      0|                    }
 5204|      0|                }
 5205|      0|            }
 5206|      0|        }
 5207|      0|    }
 5208|   263k|#endif /********** END PT_39_00 ************/
 5209|       |
 5210|   263k|#if ( TAUT_PT_13_00 == 1 ) /******* BEGIN PT_13_00 ********/
 5211|   263k|    if (t_group_info->bTautFlags & TG_FLAG_PT_13_00) {
  ------------------
  |  |  957|   263k|#define TG_FLAG_PT_13_00                 0x08000000
  ------------------
  |  Branch (5211:9): [True: 0, False: 263k]
  ------------------
 5212|       |        /*** [O,S,Se,Te;X1:1]=[C:2]=[C:3][#1:4]>>[#1:4][O,S,Se,Te;X2:1][C:2]#[C:3] ***/
 5213|       |        /*** Similar to the previous case of M=Q-ZH >> MH-Q=Z, with M = "S,O,Se,Te", Q = "C", and Z = "C" ***/
 5214|      0|        for (i = 0; i < num_atoms; i++) {
  ------------------
  |  Branch (5214:21): [True: 0, False: 0]
  ------------------
 5215|       |            /*  find possible endpoint Z = at[i] */
 5216|      0|            if ((endpoint_valence = nGetEndpointInfo_PT_13_00(at, i, &eif1))) { /* djb-rwth: addressing LLVM warning; ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (5216:17): [True: 0, False: 0]
  ------------------
 5217|       |                /*  1st endpoint candidate found. Find centerpoint candidate */
 5218|      0|                for (j = 0; j < at[i].valence; j++) {
  ------------------
  |  Branch (5218:29): [True: 0, False: 0]
  ------------------
 5219|      0|                    bond_type = (int)at[i].bond_type[j] & ~BOND_MARK_ALL;
  ------------------
  |  |  191|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 5220|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 5221|       |                    bond_type = ACTUAL_ORDER(pBNS, i, j, bond_type);
 5222|       |#endif
 5223|      0|                    centerpoint = (int)at[i].neighbor[j];  /*  a centerpoint candidate */
 5224|      0|                    if ((bond_type == BOND_DOUBLE ||
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (5224:26): [True: 0, False: 0]
  ------------------
 5225|      0|                        bond_type == BOND_SINGLE ||
  ------------------
  |  |  177|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (5225:25): [True: 0, False: 0]
  ------------------
 5226|      0|                        bond_type == BOND_ALTERN ||
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (5226:25): [True: 0, False: 0]
  ------------------
 5227|      0|                        bond_type == BOND_ALT12NS ||
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (5227:25): [True: 0, False: 0]
  ------------------
 5228|      0|                        bond_type == BOND_ALT_13 ||
  ------------------
  |  |  183|      0|#define BOND_ALT_13              6   /* single/triple                       */
  ------------------
  |  Branch (5228:25): [True: 0, False: 0]
  ------------------
 5229|      0|                        bond_type == BOND_TAUTOM) &&
  ------------------
  |  |  185|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (5229:25): [True: 0, False: 0]
  ------------------
 5230|      0|                        at[centerpoint].el_number == EL_NUMBER_C &&
  ------------------
  |  |   13|      0|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (5230:25): [True: 0, False: 0]
  ------------------
 5231|      0|                        at[centerpoint].valence == 2 &&
  ------------------
  |  Branch (5231:25): [True: 0, False: 0]
  ------------------
 5232|      0|                        ALLOWED_EDGE(pBNS, i, j)
  ------------------
  |  | 4321|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (4321:42): [True: 0, False: 0]
  |  |  |  Branch (4321:53): [True: 0, False: 0]
  |  |  |  Branch (4321:70): [True: 0, False: 0]
  |  |  |  Branch (4321:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5233|      0|                        ) {
 5234|       |                        /*  test a centerpoint candidate. */
 5235|       |                        /*  find all endpoints including at[i] and store them into EndPoint[] */
 5236|      0|                        int num_O = 0;
 5237|      0|                        int num_C = 0;
 5238|      0|                        nNumPossibleMobile = 0;
 5239|      0|                        nGroupNumber = (AT_NUMB)num_atoms; /*  greater than any tautomeric group number */
 5240|      0|                        bDiffGroups = -1;         /*  ignore the first difference */
 5241|      0|                        nNumDonor = nNumAcceptor = 0;
 5242|      0|                        for (k = 0, nNumEndPoints = 0, nNumBondPos = 0; k < at[centerpoint].valence; k++) {
  ------------------
  |  Branch (5242:73): [True: 0, False: 0]
  ------------------
 5243|      0|                            endpoint = at[centerpoint].neighbor[k]; /*  endpoint candidate */
 5244|      0|                            bond_type = (int)at[centerpoint].bond_type[k] & ~BOND_MARK_ALL;
  ------------------
  |  |  191|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 5245|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 5246|       |                            bond_type = ACTUAL_ORDER(pBNS, centerpoint, k, bond_type);
 5247|       |#endif		
 5248|       |                            /* djb-rwth: removing redundant code */
 5249|      0|                                bNonTautBond =
 5250|      0|                                bAltBond = /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 5251|      0|                                bPossiblyEndpoint = 0;
 5252|      0|                            if (!ALLOWED_EDGE(pBNS, centerpoint, k)) {
  ------------------
  |  | 4321|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (4321:42): [True: 0, False: 0]
  |  |  |  Branch (4321:53): [True: 0, False: 0]
  |  |  |  Branch (4321:70): [True: 0, False: 0]
  |  |  |  Branch (4321:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5253|      0|                                continue;
 5254|      0|                            }
 5255|      0|                            else
 5256|      0|                                if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_ALT_13 || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                              if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_ALT_13 || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
                                              if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_ALT_13 || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  183|      0|#define BOND_ALT_13              6   /* single/triple                       */
  ------------------
                                              if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_ALT_13 || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  185|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (5256:37): [True: 0, False: 0]
  |  Branch (5256:65): [True: 0, False: 0]
  |  Branch (5256:94): [True: 0, False: 0]
  |  Branch (5256:122): [True: 0, False: 0]
  ------------------
 5257|       |                                    /* djb-rwth: removing redundant code */
 5258|      0|#if ( REPLACE_ALT_WITH_TAUT == 1 )
 5259|      0|                                    bAltBond = (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_ALT_13); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                                  bAltBond = (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_ALT_13); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
                                                  bAltBond = (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_ALT_13); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  183|      0|#define BOND_ALT_13              6   /* single/triple                       */
  ------------------
  |  Branch (5259:49): [True: 0, False: 0]
  |  Branch (5259:77): [True: 0, False: 0]
  |  Branch (5259:106): [True: 0, False: 0]
  ------------------
 5260|      0|#endif
 5261|      0|                                }
 5262|      0|                                else
 5263|      0|                                    if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE || bond_type == BOND_TRIPLE)
  ------------------
  |  |  177|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                                                  if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE || bond_type == BOND_TRIPLE)
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
                                                  if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE || bond_type == BOND_TRIPLE)
  ------------------
  |  |  179|      0|#define BOND_TRIPLE BOND_TYPE_TRIPLE  /* 3                                  */
  |  |  ------------------
  |  |  |  |   34|      0|#define BOND_TYPE_TRIPLE    3
  |  |  ------------------
  ------------------
  |  Branch (5263:41): [True: 0, False: 0]
  |  Branch (5263:69): [True: 0, False: 0]
  |  Branch (5263:97): [True: 0, False: 0]
  ------------------
 5264|      0|                                        bNonTautBond = 1;
 5265|      0|                                    else
 5266|      0|                                        continue;
 5267|      0|                            if (!(endpoint_valence = nGetEndpointInfo_PT_13_00(at, endpoint, &eif1)))
  ------------------
  |  Branch (5267:33): [True: 0, False: 0]
  ------------------
 5268|      0|                                continue; /*  not an endpoint element or can't have mobile groups */
 5269|       |
 5270|       |                                          /*  save information about the found possible tautomeric endpoint */
 5271|       |                                          /*  2 = T_NUM_NO_ISOTOPIC non-isotopic values */
 5272|      0|                            nMobile =
 5273|      0|                                AddAtom2num(EndPoint[nNumEndPoints].num, at, endpoint, 2); /* fill out */
 5274|      0|                            AddAtom2DA(EndPoint[nNumEndPoints].num_DA, at, endpoint, 2);
 5275|       |                            /* --- why is isitopic info missing ? -- see below
 5276|       |                            nMobile  = EndPoint[nNumEndPoints].num[1] = (at[endpoint].charge == -1);
 5277|       |                            nMobile  = EndPoint[nNumEndPoints].num[0] = at[endpoint].num_H + nMobile;
 5278|       |                            */
 5279|      0|                            if (bNonTautBond) {
  ------------------
  |  Branch (5279:33): [True: 0, False: 0]
  ------------------
 5280|      0|                                m = (nMobile || at[endpoint].endpoint);
  ------------------
  |  Branch (5280:38): [True: 0, False: 0]
  |  Branch (5280:49): [True: 0, False: 0]
  ------------------
 5281|      0|                                nNumDonor += m;
 5282|      0|                                bPossiblyEndpoint += m;
 5283|      0|                                m = (nMobile == 0);
 5284|      0|                                nNumAcceptor += m;
 5285|      0|                                bPossiblyEndpoint += m;
 5286|      0|                            }
 5287|      0|                            else {
 5288|       |                                /*  tautomeric or alternating bond */
 5289|      0|                                m = (eif1.cDonor != 0);
 5290|      0|                                nNumDonor += m;
 5291|      0|                                bPossiblyEndpoint += m;
 5292|      0|                                m = (eif1.cNeutralBondsValence > at[endpoint].valence);
 5293|      0|                                nNumAcceptor += m;
 5294|      0|                                bPossiblyEndpoint += m;
 5295|      0|                            }
 5296|       |
 5297|       |
 5298|      0|                            if (!bPossiblyEndpoint)
  ------------------
  |  Branch (5298:33): [True: 0, False: 0]
  ------------------
 5299|      0|                                continue;
 5300|       |
 5301|      0|                            num_O += (endpoint_valence == 2);
 5302|      0|                            num_C += (endpoint_valence == 4);
 5303|      0|                            EndPoint[nNumEndPoints].nGroupNumber = at[endpoint].endpoint; /* =0 if it is an endpoint for the 1st time */
 5304|      0|                            EndPoint[nNumEndPoints].nEquNumber = 0;
 5305|      0|                            EndPoint[nNumEndPoints].nAtomNumber = (AT_NUMB)endpoint;
 5306|      0|                            if (nGroupNumber != at[endpoint].endpoint) {
  ------------------
  |  Branch (5306:33): [True: 0, False: 0]
  ------------------
 5307|      0|                                bDiffGroups++;
 5308|      0|                                nGroupNumber = at[endpoint].endpoint;
 5309|      0|                            }
 5310|       |
 5311|       |                            /*  save positions of all, not only possibly tautomeric bonds */
 5312|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 5313|       |                            if (bNonTautBond || bAltBond) {
 5314|       |#endif
 5315|      0|                                BondPos[nNumBondPos].nAtomNumber = (AT_NUMB)centerpoint;
 5316|      0|                                BondPos[nNumBondPos].neighbor_index = (AT_NUMB)k; /* bond ordering number; used to change bonds to tautomeric only  */
 5317|      0|                                nNumBondPos++;
 5318|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 5319|       |                            }
 5320|       |#endif
 5321|       |                            /*  mobile group is possible if (a) the endpoint has a mobile group or */
 5322|       |                            /*                              (b) the centerpoint is adjacent to another endpoint */
 5323|      0|                            nNumPossibleMobile += (nMobile>0);
 5324|      0|                            nNumEndPoints++;
 5325|       |                            /*printf("Found %d %d %d %d\n", centerpoint+1, at[centerpoint].el_number, endpoint+1, at[endpoint].el_number);*/
 5326|      0|                        }
 5327|      0|                        if (nNumEndPoints > 1 && nNumPossibleMobile && nNumDonor && nNumAcceptor && num_O == 1 && num_C == 1) {
  ------------------
  |  Branch (5327:29): [True: 0, False: 0]
  |  Branch (5327:50): [True: 0, False: 0]
  |  Branch (5327:72): [True: 0, False: 0]
  |  Branch (5327:85): [True: 0, False: 0]
  |  Branch (5327:101): [True: 0, False: 0]
  |  Branch (5327:115): [True: 0, False: 0]
  ------------------
 5328|       |                            /*printf("Real %d\n", nNumEndPoints);*/
 5329|       |                            /*
 5330|       |                            * a tautomeric group has been found
 5331|       |                            *
 5332|       |                            * at this point:
 5333|       |                            * nGroupNumber = 0 if all endpoints belong to a newly discovered tautomeric group
 5334|       |                            * bDiffGroups  > 0 if at least 2 tautomeric groups are to be merged (one of them can be new)
 5335|       |                            * case (nGroupNumber != 0 && bDiffGroups = 0 ) ignored because all endpoints belong to the same known t-group
 5336|       |                            * case (nGroupNumber != 0 && bDiffGroups < 0 ) cannot happen
 5337|       |                            */
 5338|       |
 5339|      0|                            nErr = FindAccessibleEndPoints(pCG,
 5340|      0|                                EndPoint, &nNumEndPoints,
 5341|      0|                                BondPos, &nNumBondPos,
 5342|      0|                                pBNS, pBD, at,
 5343|      0|                                num_atoms, c_group_info,
 5344|      0|                                ALT_PATH_MODE_TAUTOM_PT_13_00);
  ------------------
  |  |  336|      0|#define ALT_PATH_MODE_TAUTOM_PT_13_00 15
  ------------------
 5345|       |
 5346|      0|                            if (IS_BNS_ERROR(nErr)) {
  ------------------
  |  |   67|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 0, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5347|      0|                                return nErr;
 5348|      0|                            }
 5349|      0|                            nErr = 0;
 5350|       |
 5351|      0|                            if (nNumEndPoints > 0) {
  ------------------
  |  Branch (5351:33): [True: 0, False: 0]
  ------------------
 5352|      0|                                if (!nGroupNumber || bDiffGroups > 0) {
  ------------------
  |  Branch (5352:37): [True: 0, False: 0]
  |  Branch (5352:54): [True: 0, False: 0]
  ------------------
 5353|       |
 5354|      0|                                    num_changes = RegisterEndPoints(pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS);
 5355|      0|                                    if (num_changes == -1) {
  ------------------
  |  Branch (5355:41): [True: 0, False: 0]
  ------------------
 5356|      0|                                        nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   24|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 5357|      0|                                    }
 5358|      0|                                    if (num_changes < 0) {
  ------------------
  |  Branch (5358:41): [True: 0, False: 0]
  ------------------
 5359|      0|                                        nErr = num_changes;
 5360|      0|                                    }
 5361|       |
 5362|      0|                                    if (nErr)
  ------------------
  |  Branch (5362:41): [True: 0, False: 0]
  ------------------
 5363|      0|                                        goto exit_function;
 5364|      0|                                    tot_changes += (num_changes>0);
 5365|      0|                                }
 5366|      0|                                if (nNumBondPos > 0) {
  ------------------
  |  Branch (5366:37): [True: 0, False: 0]
  ------------------
 5367|       |                                    /*  some of the bonds have not been marked as tautomeric yet */
 5368|      0|                                    num_changes = SetTautomericBonds(at, nNumBondPos, BondPos);
 5369|      0|                                    tot_changes += (num_changes>0);
 5370|      0|                                }
 5371|      0|                            }
 5372|      0|                        }
 5373|      0|                    }
 5374|      0|                }
 5375|      0|            }
 5376|      0|        }
 5377|      0|    }
 5378|   263k|#endif /********** END PT_13_00 ************/
 5379|       |
 5380|   263k|#if ( TAUT_PT_18_00 == 1 ) /******* BEGIN PT_18_00 ********/
 5381|   263k|    if (t_group_info->bTautFlags & TG_FLAG_PT_18_00) {
  ------------------
  |  |  958|   263k|#define TG_FLAG_PT_18_00                 0x10000000
  ------------------
  |  Branch (5381:9): [True: 0, False: 263k]
  ------------------
 5382|       |        /*** [#1:1][O:2][C:3]#[N:4]>>[O:2]=[C:3]=[N:4][#1:1] ***/
 5383|       |        /*** Similar to the previous case of M=Q-ZH >> MH-Q=Z, with M = "O", Q = "C", and Z = "N" ***/
 5384|      0|        for (i = 0; i < num_atoms; i++) {
  ------------------
  |  Branch (5384:21): [True: 0, False: 0]
  ------------------
 5385|       |            /*  find possible endpoint Z = at[i] */
 5386|      0|            if ((endpoint_valence = nGetEndpointInfo_PT_18_00(at, i, &eif1))) { /* djb-rwth: addressing LLVM warning; ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (5386:17): [True: 0, False: 0]
  ------------------
 5387|       |                /*  1st endpoint candidate found. Find centerpoint candidate */
 5388|      0|                for (j = 0; j < at[i].valence; j++) {
  ------------------
  |  Branch (5388:29): [True: 0, False: 0]
  ------------------
 5389|      0|                    bond_type = (int)at[i].bond_type[j] & ~BOND_MARK_ALL;
  ------------------
  |  |  191|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 5390|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 5391|       |                    bond_type = ACTUAL_ORDER(pBNS, i, j, bond_type);
 5392|       |#endif
 5393|      0|                    centerpoint = (int)at[i].neighbor[j];  /*  a centerpoint candidate */
 5394|       |                                                           /*printf("Centerpoint: %d\n", centerpoint+1);*/
 5395|      0|                    if ((bond_type == BOND_DOUBLE ||
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (5395:26): [True: 0, False: 0]
  ------------------
 5396|      0|                        bond_type == BOND_SINGLE ||
  ------------------
  |  |  177|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (5396:25): [True: 0, False: 0]
  ------------------
 5397|      0|                        bond_type == BOND_ALTERN ||
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (5397:25): [True: 0, False: 0]
  ------------------
 5398|      0|                        bond_type == BOND_ALT12NS ||
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (5398:25): [True: 0, False: 0]
  ------------------
 5399|      0|                        bond_type == BOND_ALT_13 ||
  ------------------
  |  |  183|      0|#define BOND_ALT_13              6   /* single/triple                       */
  ------------------
  |  Branch (5399:25): [True: 0, False: 0]
  ------------------
 5400|      0|                        bond_type == BOND_TAUTOM) &&
  ------------------
  |  |  185|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (5400:25): [True: 0, False: 0]
  ------------------
 5401|      0|                        at[centerpoint].el_number == EL_NUMBER_C &&
  ------------------
  |  |   13|      0|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (5401:25): [True: 0, False: 0]
  ------------------
 5402|      0|                        at[centerpoint].valence == 2 &&
  ------------------
  |  Branch (5402:25): [True: 0, False: 0]
  ------------------
 5403|      0|                        ALLOWED_EDGE(pBNS, i, j)
  ------------------
  |  | 4321|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (4321:42): [True: 0, False: 0]
  |  |  |  Branch (4321:53): [True: 0, False: 0]
  |  |  |  Branch (4321:70): [True: 0, False: 0]
  |  |  |  Branch (4321:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5404|      0|                        ) {
 5405|       |                        /*  test a centerpoint candidate. */
 5406|       |                        /*  find all endpoints including at[i] and store them into EndPoint[] */
 5407|      0|                        int num_O = 0;
 5408|      0|                        int num_N = 0;
 5409|      0|                        nNumPossibleMobile = 0;
 5410|      0|                        nGroupNumber = (AT_NUMB)num_atoms; /*  greater than any tautomeric group number */
 5411|      0|                        bDiffGroups = -1;         /*  ignore the first difference */
 5412|      0|                        nNumDonor = nNumAcceptor = 0;
 5413|      0|                        for (k = 0, nNumEndPoints = 0, nNumBondPos = 0; k < at[centerpoint].valence; k++) {
  ------------------
  |  Branch (5413:73): [True: 0, False: 0]
  ------------------
 5414|      0|                            endpoint = at[centerpoint].neighbor[k]; /*  endpoint candidate */
 5415|       |                                                                    /*printf("Endpoint: %d\n", endpoint+1);*/
 5416|      0|                            bond_type = (int)at[centerpoint].bond_type[k] & ~BOND_MARK_ALL;
  ------------------
  |  |  191|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 5417|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 5418|       |                            bond_type = ACTUAL_ORDER(pBNS, centerpoint, k, bond_type);
 5419|       |#endif
 5420|       |
 5421|       |                            /* djb-rwth: removing redundant code */
 5422|      0|                                bNonTautBond =
 5423|      0|                                bAltBond = /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 5424|      0|                                bPossiblyEndpoint = 0;
 5425|      0|                            if (!ALLOWED_EDGE(pBNS, centerpoint, k)) {
  ------------------
  |  | 4321|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (4321:42): [True: 0, False: 0]
  |  |  |  Branch (4321:53): [True: 0, False: 0]
  |  |  |  Branch (4321:70): [True: 0, False: 0]
  |  |  |  Branch (4321:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5426|      0|                                continue;
 5427|      0|                            }
 5428|      0|                            else
 5429|      0|                                if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_ALT_13 || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                              if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_ALT_13 || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
                                              if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_ALT_13 || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  183|      0|#define BOND_ALT_13              6   /* single/triple                       */
  ------------------
                                              if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_ALT_13 || bond_type == BOND_TAUTOM) {
  ------------------
  |  |  185|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (5429:37): [True: 0, False: 0]
  |  Branch (5429:65): [True: 0, False: 0]
  |  Branch (5429:94): [True: 0, False: 0]
  |  Branch (5429:122): [True: 0, False: 0]
  ------------------
 5430|       |                                    /* djb-rwth: removing redundant code */
 5431|      0|#if ( REPLACE_ALT_WITH_TAUT == 1 )
 5432|      0|                                    bAltBond = (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_ALT_13); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                                  bAltBond = (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_ALT_13); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
                                                  bAltBond = (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_ALT_13); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  183|      0|#define BOND_ALT_13              6   /* single/triple                       */
  ------------------
  |  Branch (5432:49): [True: 0, False: 0]
  |  Branch (5432:77): [True: 0, False: 0]
  |  Branch (5432:106): [True: 0, False: 0]
  ------------------
 5433|      0|#endif
 5434|      0|                                }
 5435|      0|                                else
 5436|      0|                                    if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE || bond_type == BOND_TRIPLE)
  ------------------
  |  |  177|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                                                  if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE || bond_type == BOND_TRIPLE)
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
                                                  if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE || bond_type == BOND_TRIPLE)
  ------------------
  |  |  179|      0|#define BOND_TRIPLE BOND_TYPE_TRIPLE  /* 3                                  */
  |  |  ------------------
  |  |  |  |   34|      0|#define BOND_TYPE_TRIPLE    3
  |  |  ------------------
  ------------------
  |  Branch (5436:41): [True: 0, False: 0]
  |  Branch (5436:69): [True: 0, False: 0]
  |  Branch (5436:97): [True: 0, False: 0]
  ------------------
 5437|      0|                                        bNonTautBond = 1;
 5438|      0|                                    else
 5439|      0|                                        continue;
 5440|      0|                            if (!(endpoint_valence = nGetEndpointInfo_PT_18_00(at, endpoint, &eif1)))
  ------------------
  |  Branch (5440:33): [True: 0, False: 0]
  ------------------
 5441|      0|                                continue; /*  not an endpoint element or can't have mobile groups */
 5442|       |
 5443|       |                                          /*  save information about the found possible tautomeric endpoint */
 5444|       |                                          /*  2 = T_NUM_NO_ISOTOPIC non-isotopic values */
 5445|      0|                            nMobile = eif1.cMobile;
 5446|      0|                            AddAtom2num(EndPoint[nNumEndPoints].num, at, endpoint, 2); /* fill out */
 5447|      0|                            AddAtom2DA(EndPoint[nNumEndPoints].num_DA, at, endpoint, 2);
 5448|       |                            /* --- why is isitopic info missing ? -- see below
 5449|       |                            nMobile  = EndPoint[nNumEndPoints].num[1] = (at[endpoint].charge == -1);
 5450|       |                            nMobile  = EndPoint[nNumEndPoints].num[0] = at[endpoint].num_H + nMobile;
 5451|       |                            */
 5452|       |
 5453|      0|                            if (bond_type == BOND_DOUBLE && endpoint_valence == 3 && nMobile == 0)
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (5453:33): [True: 0, False: 0]
  |  Branch (5453:61): [True: 0, False: 0]
  |  Branch (5453:86): [True: 0, False: 0]
  ------------------
 5454|      0|                                continue;
 5455|       |
 5456|      0|                            if (bNonTautBond) {
  ------------------
  |  Branch (5456:33): [True: 0, False: 0]
  ------------------
 5457|       |                                /*printf("AAA %d\n", nMobile);*/
 5458|      0|                                m = (nMobile || at[endpoint].endpoint);
  ------------------
  |  Branch (5458:38): [True: 0, False: 0]
  |  Branch (5458:49): [True: 0, False: 0]
  ------------------
 5459|      0|                                nNumDonor += m;
 5460|      0|                                bPossiblyEndpoint += m;
 5461|      0|                                m = (nMobile == 0);
 5462|      0|                                nNumAcceptor += m;
 5463|      0|                                bPossiblyEndpoint += m;
 5464|      0|                            }
 5465|      0|                            else {
 5466|       |                                /*  tautomeric or alternating bond */
 5467|       |                                /*printf("BBB %d %d %d\n", eif1.cDonor, eif1.cNeutralBondsValence, at[endpoint].valence);*/
 5468|      0|                                m = (eif1.cDonor != 0);
 5469|      0|                                nNumDonor += m;
 5470|      0|                                bPossiblyEndpoint += m;
 5471|      0|                                m = (eif1.cAcceptor != 0);
 5472|      0|                                nNumAcceptor += m;
 5473|      0|                                bPossiblyEndpoint += m;
 5474|      0|                            }
 5475|       |
 5476|       |
 5477|      0|                            if (!bPossiblyEndpoint)
  ------------------
  |  Branch (5477:33): [True: 0, False: 0]
  ------------------
 5478|      0|                                continue;
 5479|       |
 5480|      0|                            num_O += (endpoint_valence == 2);
 5481|      0|                            num_N += (endpoint_valence == 3);
 5482|      0|                            EndPoint[nNumEndPoints].nGroupNumber = at[endpoint].endpoint; /* =0 if it is an endpoint for the 1st time */
 5483|      0|                            EndPoint[nNumEndPoints].nEquNumber = 0;
 5484|      0|                            EndPoint[nNumEndPoints].nAtomNumber = (AT_NUMB)endpoint;
 5485|      0|                            if (nGroupNumber != at[endpoint].endpoint) {
  ------------------
  |  Branch (5485:33): [True: 0, False: 0]
  ------------------
 5486|      0|                                bDiffGroups++;
 5487|      0|                                nGroupNumber = at[endpoint].endpoint;
 5488|      0|                            }
 5489|       |
 5490|       |                            /*  save positions of all, not only possibly tautomeric bonds */
 5491|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 5492|       |                            if (bNonTautBond || bAltBond) {
 5493|       |#endif
 5494|      0|                                BondPos[nNumBondPos].nAtomNumber = (AT_NUMB)centerpoint;
 5495|      0|                                BondPos[nNumBondPos].neighbor_index = (AT_NUMB)k; /* bond ordering number; used to change bonds to tautomeric only  */
 5496|      0|                                nNumBondPos++;
 5497|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 5498|       |                            }
 5499|       |#endif
 5500|       |                            /*  mobile group is possible if (a) the endpoint has a mobile group or */
 5501|       |                            /*                              (b) the centerpoint is adjacent to another endpoint */
 5502|      0|                            nNumPossibleMobile += (nMobile>0);
 5503|      0|                            nNumEndPoints++;
 5504|       |                            /*printf("Found %d %d %d %d\n", centerpoint+1, at[centerpoint].el_number, endpoint+1, at[endpoint].el_number);*/
 5505|      0|                        }
 5506|      0|                        if (nNumEndPoints > 1 && nNumPossibleMobile && nNumDonor && nNumAcceptor && num_O == 1 && num_N == 1) {
  ------------------
  |  Branch (5506:29): [True: 0, False: 0]
  |  Branch (5506:50): [True: 0, False: 0]
  |  Branch (5506:72): [True: 0, False: 0]
  |  Branch (5506:85): [True: 0, False: 0]
  |  Branch (5506:101): [True: 0, False: 0]
  |  Branch (5506:115): [True: 0, False: 0]
  ------------------
 5507|       |                            /*printf("Real %d\n", nNumEndPoints);*/
 5508|       |                            /*
 5509|       |                            * a tautomeric group has been found
 5510|       |                            *
 5511|       |                            * at this point:
 5512|       |                            * nGroupNumber = 0 if all endpoints belong to a newly discovered tautomeric group
 5513|       |                            * bDiffGroups  > 0 if at least 2 tautomeric groups are to be merged (one of them can be new)
 5514|       |                            * case (nGroupNumber != 0 && bDiffGroups = 0 ) ignored because all endpoints belong to the same known t-group
 5515|       |                            * case (nGroupNumber != 0 && bDiffGroups < 0 ) cannot happen
 5516|       |                            */
 5517|       |
 5518|      0|                            nErr = FindAccessibleEndPoints(pCG,
 5519|      0|                                EndPoint, &nNumEndPoints,
 5520|      0|                                BondPos, &nNumBondPos,
 5521|      0|                                pBNS, pBD, at,
 5522|      0|                                num_atoms, c_group_info,
 5523|      0|                                ALT_PATH_MODE_TAUTOM_PT_18_00);
  ------------------
  |  |  339|      0|#define ALT_PATH_MODE_TAUTOM_PT_18_00 16
  ------------------
 5524|       |
 5525|      0|                            if (IS_BNS_ERROR(nErr)) {
  ------------------
  |  |   67|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 0, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5526|      0|                                return nErr;
 5527|      0|                            }
 5528|      0|                            nErr = 0;
 5529|       |
 5530|      0|                            if (nNumEndPoints > 0) {
  ------------------
  |  Branch (5530:33): [True: 0, False: 0]
  ------------------
 5531|      0|                                if (!nGroupNumber || bDiffGroups > 0) {
  ------------------
  |  Branch (5531:37): [True: 0, False: 0]
  |  Branch (5531:54): [True: 0, False: 0]
  ------------------
 5532|       |
 5533|      0|                                    num_changes = RegisterEndPoints(pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS);
 5534|      0|                                    if (num_changes == -1) {
  ------------------
  |  Branch (5534:41): [True: 0, False: 0]
  ------------------
 5535|      0|                                        nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   24|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 5536|      0|                                    }
 5537|      0|                                    if (num_changes < 0) {
  ------------------
  |  Branch (5537:41): [True: 0, False: 0]
  ------------------
 5538|      0|                                        nErr = num_changes;
 5539|      0|                                    }
 5540|       |
 5541|      0|                                    if (nErr)
  ------------------
  |  Branch (5541:41): [True: 0, False: 0]
  ------------------
 5542|      0|                                        goto exit_function;
 5543|      0|                                    tot_changes += (num_changes>0);
 5544|      0|                                }
 5545|      0|                                if (nNumBondPos > 0) {
  ------------------
  |  Branch (5545:37): [True: 0, False: 0]
  ------------------
 5546|       |                                    /*  some of the bonds have not been marked as tautomeric yet */
 5547|      0|                                    num_changes = SetTautomericBonds(at, nNumBondPos, BondPos);
 5548|      0|                                    tot_changes += (num_changes>0);
 5549|      0|                                }
 5550|      0|                            }
 5551|      0|                        }
 5552|      0|                    }
 5553|      0|                }
 5554|      0|            }
 5555|      0|        }
 5556|      0|    }
 5557|   263k|#endif /********** END PT_18_00 ************/    
 5558|       |
 5559|       |
 5560|   263k|#if ( KETO_ENOL_TAUT == 1 )  /***** post v.1 feature *****/
 5561|   263k|    if (t_group_info->bTautFlags & TG_FLAG_KETO_ENOL_TAUT)
  ------------------
  |  |  946|   263k|#define TG_FLAG_KETO_ENOL_TAUT           0x00080000   /* turn on keto-enol tautomerism detection */
  ------------------
  |  Branch (5561:9): [True: 0, False: 263k]
  ------------------
 5562|      0|    {
 5563|       |        /* 1,3 keto-enol tautomerism */
 5564|      0|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5564:21): [True: 0, False: 0]
  ------------------
 5565|      0|        {
 5566|       |            /*  Find possible endpoint Z = at[i] */
 5567|      0|            if ((endpoint_valence = nGetEndpointInfo_KET( at, i, &eif1 ))) /* djb-rwth: addressing LLVM warning; ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (5567:17): [True: 0, False: 0]
  ------------------
 5568|      0|            {
 5569|       |                /*  1st endpoint candidate found. Find centerpoint candidate */
 5570|      0|                for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (5570:29): [True: 0, False: 0]
  ------------------
 5571|      0|                {
 5572|      0|                    bond_type = (int) at[i].bond_type[j] & ~BOND_MARK_ALL;
  ------------------
  |  |  191|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 5573|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 5574|       |                    bond_type = ACTUAL_ORDER( pBNS, i, j, bond_type );
 5575|       |#endif
 5576|      0|                    centerpoint = (int) at[i].neighbor[j];  /*  a centerpoint candidate */
 5577|      0|                    if (( bond_type == BOND_DOUBLE ||
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (5577:27): [True: 0, False: 0]
  ------------------
 5578|      0|                          bond_type == BOND_ALTERN ||
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (5578:27): [True: 0, False: 0]
  ------------------
 5579|      0|                          bond_type == BOND_ALT12NS ||
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (5579:27): [True: 0, False: 0]
  ------------------
 5580|      0|                          bond_type == BOND_TAUTOM ) &&
  ------------------
  |  |  185|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (5580:27): [True: 0, False: 0]
  ------------------
 5581|      0|                         is_centerpoint_elem_KET( at[centerpoint].el_number ) &&
  ------------------
  |  Branch (5581:26): [True: 0, False: 0]
  ------------------
 5582|      0|                         !at[centerpoint].charge && !at[centerpoint].radical &&
  ------------------
  |  Branch (5582:26): [True: 0, False: 0]
  |  Branch (5582:53): [True: 0, False: 0]
  ------------------
 5583|       |                         /* only normal carbon is allowed */
 5584|      0|                         4 == at[centerpoint].chem_bonds_valence + at[centerpoint].num_H
  ------------------
  |  Branch (5584:26): [True: 0, False: 0]
  ------------------
 5585|      0|                         && ALLOWED_EDGE( pBNS, i, j ))
  ------------------
  |  | 4321|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (4321:42): [True: 0, False: 0]
  |  |  |  Branch (4321:53): [True: 0, False: 0]
  |  |  |  Branch (4321:70): [True: 0, False: 0]
  |  |  |  Branch (4321:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5586|      0|                    {
 5587|      0|                        int num_O = 0;
 5588|      0|                        int num_C = 0;
 5589|       |                        /*  Test a centerpoint candidate. */
 5590|       |                        /*  find all endpoints including at[i] and store them into EndPoint[] */
 5591|      0|                        nNumPossibleMobile = 0;
 5592|      0|                        nGroupNumber = (AT_NUMB) num_atoms; /*  greater than any tautomeric group number */
 5593|      0|                        bDiffGroups = -1;         /*  ignore the first difference */
 5594|      0|                        nNumDonor = nNumAcceptor = 0;
 5595|      0|                        for (k = 0, nNumEndPoints = 0, nNumBondPos = 0; k < at[centerpoint].valence; k++)
  ------------------
  |  Branch (5595:73): [True: 0, False: 0]
  ------------------
 5596|      0|                        {
 5597|      0|                            endpoint = at[centerpoint].neighbor[k]; /*  endpoint candidate */
 5598|      0|                            bond_type = (int) at[centerpoint].bond_type[k] & ~BOND_MARK_ALL;
  ------------------
  |  |  191|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 5599|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 5600|       |                            bond_type = ACTUAL_ORDER( pBNS, centerpoint, k, bond_type );
 5601|       |#endif
 5602|       |                            /* djb-rwth: removing redundant code */
 5603|      0|                                bNonTautBond =
 5604|      0|                                bAltBond = /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 5605|      0|                                bPossiblyEndpoint = 0;
 5606|      0|                            if (!ALLOWED_EDGE( pBNS, centerpoint, k ))
  ------------------
  |  | 4321|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (4321:42): [True: 0, False: 0]
  |  |  |  Branch (4321:53): [True: 0, False: 0]
  |  |  |  Branch (4321:70): [True: 0, False: 0]
  |  |  |  Branch (4321:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5607|      0|                            {
 5608|      0|                                continue;
 5609|      0|                            }
 5610|      0|                            else
 5611|      0|                            {
 5612|      0|                                if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM)
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                              if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM)
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
                                              if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM)
  ------------------
  |  |  185|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (5612:37): [True: 0, False: 0]
  |  Branch (5612:65): [True: 0, False: 0]
  |  Branch (5612:94): [True: 0, False: 0]
  ------------------
 5613|      0|                                {
 5614|       |                                    /* djb-rwth: removing redundant code */
 5615|      0|#if ( REPLACE_ALT_WITH_TAUT == 1 )
 5616|      0|                                    bAltBond = ( bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS ); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  180|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                                  bAltBond = ( bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS ); /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
  ------------------
  |  |  186|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (5616:50): [True: 0, False: 0]
  |  Branch (5616:78): [True: 0, False: 0]
  ------------------
 5617|      0|#endif
 5618|      0|                                }
 5619|      0|                                else
 5620|      0|                                {
 5621|      0|                                    if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE)
  ------------------
  |  |  177|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                                                  if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE)
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (5621:41): [True: 0, False: 0]
  |  Branch (5621:69): [True: 0, False: 0]
  ------------------
 5622|      0|                                    {
 5623|      0|                                        bNonTautBond = 1;
 5624|      0|                                    }
 5625|      0|                                    else
 5626|      0|                                    {
 5627|      0|                                        continue;
 5628|      0|                                    }
 5629|      0|                                }
 5630|      0|                            }
 5631|       |
 5632|      0|                            if (!( endpoint_valence = nGetEndpointInfo_KET( at, endpoint, &eif2 ) ))
  ------------------
  |  Branch (5632:33): [True: 0, False: 0]
  ------------------
 5633|      0|                            {
 5634|      0|                                continue;
 5635|      0|                            }
 5636|       |                            /*
 5637|       |                            if ( 3 != eif1.cKetoEnolCode + eif2.cKetoEnolCode && endpoint != i )
 5638|       |                            continue;
 5639|       |                            */
 5640|       |                            /*  save information about the found possible tautomeric endpoint */
 5641|       |                            /*  2 = T_NUM_NO_ISOTOPIC non-isotopic values */
 5642|      0|                            nMobile = AddAtom2num( EndPoint[nNumEndPoints].num, at, endpoint, 2 ); /* fill out */
 5643|      0|                            AddAtom2DA( EndPoint[nNumEndPoints].num_DA, at, endpoint, 2 );
 5644|       |                            /* --- why is isitopic info missing ? -- see below
 5645|       |                            nMobile  = EndPoint[nNumEndPoints].num[1] = (at[endpoint].charge == -1);
 5646|       |                            nMobile  = EndPoint[nNumEndPoints].num[0] = at[endpoint].num_H + nMobile;
 5647|       |                            */
 5648|      0|                            if (bNonTautBond)
  ------------------
  |  Branch (5648:33): [True: 0, False: 0]
  ------------------
 5649|      0|                            {
 5650|      0|                                m = ( bond_type == BOND_SINGLE && ( nMobile || at[endpoint].endpoint ) );
  ------------------
  |  |  177|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (5650:39): [True: 0, False: 0]
  |  Branch (5650:69): [True: 0, False: 0]
  |  Branch (5650:80): [True: 0, False: 0]
  ------------------
 5651|      0|                                nNumDonor += m;
 5652|      0|                                bPossiblyEndpoint += m;
 5653|      0|                                m = ( bond_type == BOND_DOUBLE );
  ------------------
  |  |  178|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
 5654|      0|                                nNumAcceptor += m;
 5655|      0|                                bPossiblyEndpoint += m;
 5656|      0|                            }
 5657|      0|                            else
 5658|      0|                            {
 5659|       |                                /*  Tautomeric or alternating bond */
 5660|      0|                                m = ( 0 != at[endpoint].endpoint || eif1.cDonor );
  ------------------
  |  Branch (5660:39): [True: 0, False: 0]
  |  Branch (5660:69): [True: 0, False: 0]
  ------------------
 5661|      0|                                nNumDonor += m;
 5662|      0|                                bPossiblyEndpoint += m;
 5663|      0|                                m = ( at[endpoint].endpoint ||
  ------------------
  |  Branch (5663:39): [True: 0, False: 0]
  ------------------
 5664|      0|                                      eif1.cNeutralBondsValence > at[endpoint].valence );
  ------------------
  |  Branch (5664:39): [True: 0, False: 0]
  ------------------
 5665|      0|                                nNumAcceptor += m;
 5666|      0|                                bPossiblyEndpoint += m;
 5667|      0|                            }
 5668|      0|                            if (!bPossiblyEndpoint)
  ------------------
  |  Branch (5668:33): [True: 0, False: 0]
  ------------------
 5669|      0|                            {
 5670|      0|                                continue;
 5671|      0|                            }
 5672|       |
 5673|      0|                            num_O += ( endpoint_valence == 2 );
 5674|      0|                            num_C += ( endpoint_valence == 4 );
 5675|       |
 5676|      0|                            EndPoint[nNumEndPoints].nGroupNumber = at[endpoint].endpoint; /* =0 if it is an endpoint for the 1st time */
 5677|      0|                            EndPoint[nNumEndPoints].nEquNumber = 0;
 5678|      0|                            EndPoint[nNumEndPoints].nAtomNumber = (AT_NUMB) endpoint;
 5679|      0|                            if (nGroupNumber != at[endpoint].endpoint)
  ------------------
  |  Branch (5679:33): [True: 0, False: 0]
  ------------------
 5680|      0|                            {
 5681|      0|                                bDiffGroups++;
 5682|      0|                                nGroupNumber = at[endpoint].endpoint;
 5683|      0|                            }
 5684|       |
 5685|       |                            /*  Save positions of all, not only possibly tautomeric bonds */
 5686|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 5687|       |                            if (bNonTautBond || bAltBond)
 5688|       |                            {
 5689|       |#endif
 5690|      0|                                BondPos[nNumBondPos].nAtomNumber = (AT_NUMB) centerpoint;
 5691|      0|                                BondPos[nNumBondPos].neighbor_index = (AT_NUMB) k; /* bond ordering number; used to change bonds to tautomeric only  */
 5692|      0|                                nNumBondPos++;
 5693|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 5694|       |                            }
 5695|       |#endif
 5696|       |                            /*  Mobile group is possible if (a) the endpoint has a mobile group or */
 5697|       |                            /*                              (b) the centerpoint is adjacent to another endpoint */
 5698|      0|                            nNumPossibleMobile += ( nMobile > 0 || at[endpoint].endpoint );
  ------------------
  |  Branch (5698:53): [True: 0, False: 0]
  |  Branch (5698:68): [True: 0, False: 0]
  ------------------
 5699|      0|                            nNumEndPoints++;
 5700|      0|                        }
 5701|      0|                        if (nNumEndPoints > 1 && nNumPossibleMobile &&
  ------------------
  |  Branch (5701:29): [True: 0, False: 0]
  |  Branch (5701:50): [True: 0, False: 0]
  ------------------
 5702|      0|                             nNumDonor && nNumAcceptor &&
  ------------------
  |  Branch (5702:30): [True: 0, False: 0]
  |  Branch (5702:43): [True: 0, False: 0]
  ------------------
 5703|      0|                             num_O == 1 && num_C)
  ------------------
  |  Branch (5703:30): [True: 0, False: 0]
  |  Branch (5703:44): [True: 0, False: 0]
  ------------------
 5704|      0|                        {
 5705|       |                            /*
 5706|       |                            * A tautomeric group has been found
 5707|       |                            *
 5708|       |                            * at this point:
 5709|       |                            * nGroupNumber = 0 if all endpoints belong to a newly discovered tautomeric group
 5710|       |                            * bDiffGroups  > 0 if at least 2 tautomeric groups are to be merged (one of them can be new)
 5711|       |                            * case (nGroupNumber != 0 && bDiffGroups = 0 ) ignored because all endpoints belong to the same known t-group
 5712|       |                            * case (nGroupNumber != 0 && bDiffGroups < 0 ) cannot happen
 5713|       |                            */
 5714|       |
 5715|      0|                            nErr = FindAccessibleEndPoints( pCG, EndPoint, &nNumEndPoints, BondPos, &nNumBondPos,
 5716|      0|                                                            pBNS, pBD, at, num_atoms, c_group_info, ALT_PATH_MODE_TAUTOM_KET );
  ------------------
  |  |  320|      0|#define ALT_PATH_MODE_TAUTOM_KET 10  /* same as ALT_PATH_MODE_TAUTOM, applies to C=-OH or CH-=O; H may be (-) */
  ------------------
 5717|       |
 5718|      0|                            if (IS_BNS_ERROR( nErr ))
  ------------------
  |  |   67|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 0, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5719|      0|                            {
 5720|      0|                                return nErr;
 5721|      0|                            }
 5722|      0|                            nErr = 0;
 5723|       |
 5724|      0|                            if (nNumEndPoints > 0)
  ------------------
  |  Branch (5724:33): [True: 0, False: 0]
  ------------------
 5725|      0|                            {
 5726|      0|                                if (!nGroupNumber || bDiffGroups > 0)
  ------------------
  |  Branch (5726:37): [True: 0, False: 0]
  |  Branch (5726:54): [True: 0, False: 0]
  ------------------
 5727|      0|                                {
 5728|       |
 5729|      0|                                    num_changes = RegisterEndPoints( pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS );
 5730|      0|                                    if (num_changes == -1)
  ------------------
  |  Branch (5730:41): [True: 0, False: 0]
  ------------------
 5731|      0|                                    {
 5732|      0|                                        nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   24|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 5733|      0|                                    }
 5734|      0|                                    if (num_changes < 0)
  ------------------
  |  Branch (5734:41): [True: 0, False: 0]
  ------------------
 5735|      0|                                    {
 5736|      0|                                        nErr = num_changes;
 5737|      0|                                    }
 5738|      0|                                    if (nErr)
  ------------------
  |  Branch (5738:41): [True: 0, False: 0]
  ------------------
 5739|      0|                                    {
 5740|      0|                                        goto exit_function;
 5741|      0|                                    }
 5742|      0|                                    tot_changes += ( num_changes > 0 );
 5743|      0|                                }
 5744|      0|                                if (nNumBondPos > 0)
  ------------------
  |  Branch (5744:37): [True: 0, False: 0]
  ------------------
 5745|      0|                                {
 5746|       |                                    /*  Some of the bonds have not been marked as tautomeric yet */
 5747|      0|                                    num_changes = SetTautomericBonds( at, nNumBondPos, BondPos );
 5748|      0|                                    tot_changes += ( num_changes > 0 );
 5749|      0|                                }
 5750|      0|                            }
 5751|      0|                        }
 5752|      0|                    }
 5753|      0|                }
 5754|      0|            }
 5755|      0|        }
 5756|      0|    }
 5757|   263k|#endif  /* KETO_ENOL_TAUT */
 5758|       |
 5759|   263k|#if ( TAUT_OTHER == 1 ) /* { */
 5760|   263k|    if (!tot_changes)
  ------------------
  |  Branch (5760:9): [True: 257k, False: 5.48k]
  ------------------
 5761|   257k|    {
 5762|   257k|#define MAX_ALT_PATH_LEN 8
 5763|   257k|        int nMaxLenDfsPath = MAX_ALT_PATH_LEN;
  ------------------
  |  | 5762|   257k|#define MAX_ALT_PATH_LEN 8
  ------------------
 5764|   257k|        int i1, i2;
 5765|   257k|        AT_RANK *nDfsPathPos = (AT_RANK  *) inchi_calloc( num_atoms, sizeof( nDfsPathPos[0] ) );
  ------------------
  |  | 1146|   257k|#define inchi_calloc   calloc
  ------------------
 5766|   257k|        DFS_PATH DfsPath[MAX_ALT_PATH_LEN];
 5767|   257k|        int      ret;
 5768|       |
 5769|   257k|        if (!nDfsPathPos) /* djb-rwth: removing redundant code as address of DfsPath will always evaluate to true */
  ------------------
  |  Branch (5769:13): [True: 0, False: 257k]
  ------------------
 5770|      0|        {
 5771|      0|            tot_changes = CT_OUT_OF_RAM;  /*   <BRKPT> */
  ------------------
  |  |   21|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 5772|      0|            goto free_memory;
 5773|      0|        }
 5774|       |
 5775|   257k|#if ( TAUT_15_NON_RING      == 1 ) /***** post v.1 feature *****/
 5776|   257k|        if (t_group_info->bTautFlags & TG_FLAG_1_5_TAUT)
  ------------------
  |  |  947|   257k|#define TG_FLAG_1_5_TAUT                 0x00100000   /* turn on 1,5 tautomerism detection */
  ------------------
  |  Branch (5776:13): [True: 0, False: 257k]
  ------------------
 5777|      0|        {
 5778|       |            /*  1,5 tautomerism; one of the endpoints should no be on a ring  */
 5779|       |            /*
 5780|       |            O                OH                 O
 5781|       |            ||               |                  ||
 5782|       |            A--pos-          A--pos-            A--pos-
 5783|       |            /   sib-        //   sib-     ?     /   sib-
 5784|       |            C    ly          C    ly            CH   ly
 5785|       |            \\   a     <-->   \   a       <-->   \   a
 5786|       |            B--ring          B--ring            B--ring
 5787|       |            |                ||                 ||
 5788|       |            NH               N                  N
 5789|       |
 5790|       |            Note: few recent modifications now allow the terminal N be in a ring, too
 5791|       |            */
 5792|      0|            for (i1 = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (5792:26): [True: 0, False: 0]
  ------------------
 5793|      0|            {
 5794|       |                /*  Find possible endpoint Z = at[i1] */
 5795|      0|                if (!( endpoint_valence = nGetEndpointInfo( at, i1, &eif1 ) ) /*||
  ------------------
  |  Branch (5795:21): [True: 0, False: 0]
  ------------------
 5796|      0|                                                                              at[i1].nNumAtInRingSystem > 1*/) /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 5797|      0|                {
 5798|      0|                    continue; /*  not a possibly endpoint */
 5799|      0|                }
 5800|       |
 5801|      0|                if (1)
  ------------------
  |  Branch (5801:21): [True: 0, Folded]
  ------------------
 5802|      0|                {
 5803|      0|                    nNumEndPoints = 0;
 5804|      0|                    nNumBondPos = 0;
 5805|       |
 5806|      0|                    ret = nGet15TautInAltPath( pCG, at, i1, nDfsPathPos,
 5807|      0|                                               DfsPath, nMaxLenDfsPath,
 5808|      0|                                               EndPoint, sizeof( EndPoint ) / sizeof( EndPoint[0] ),
 5809|      0|                                               BondPos, sizeof( BondPos ) / sizeof( BondPos[0] ),
 5810|      0|                                               &nNumEndPoints, &nNumBondPos,
 5811|      0|                                               pBNS, pBD, num_atoms );
 5812|       |
 5813|      0|                    if (ret > 0)
  ------------------
  |  Branch (5813:25): [True: 0, False: 0]
  ------------------
 5814|      0|                    {
 5815|      0|                        if (nNumEndPoints)
  ------------------
  |  Branch (5815:29): [True: 0, False: 0]
  ------------------
 5816|      0|                        {
 5817|      0|                            num_changes = RegisterEndPoints( pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS );
 5818|      0|                            if (num_changes == -1)
  ------------------
  |  Branch (5818:33): [True: 0, False: 0]
  ------------------
 5819|      0|                            {
 5820|      0|                                nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   24|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 5821|      0|                            }
 5822|      0|                            if (num_changes < 0)
  ------------------
  |  Branch (5822:33): [True: 0, False: 0]
  ------------------
 5823|      0|                            {
 5824|      0|                                nErr = num_changes;
 5825|      0|                            }
 5826|      0|                            if (nErr)
  ------------------
  |  Branch (5826:33): [True: 0, False: 0]
  ------------------
 5827|      0|                            {
 5828|      0|                                goto free_memory;
 5829|      0|                            }
 5830|      0|                            tot_changes += ( num_changes > 0 );
 5831|      0|                        }
 5832|      0|                        if (nNumBondPos)
  ------------------
  |  Branch (5832:29): [True: 0, False: 0]
  ------------------
 5833|      0|                        {
 5834|      0|                            tot_changes += ( 0 < SetTautomericBonds( at, nNumBondPos, BondPos ) );
 5835|      0|                        }
 5836|      0|                    }
 5837|      0|                    else
 5838|      0|                    {
 5839|      0|                        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 0, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5840|      0|                        {
 5841|      0|                            nErr = ret;
 5842|      0|                            goto free_memory;
 5843|      0|                        }
 5844|      0|                    }
 5845|      0|                }
 5846|      0|            }
 5847|      0|        }
 5848|   257k|#endif
 5849|       |
 5850|   257k|#if ( TAUT_4PYRIDINOL_RINGS == 1 )
 5851|       |        /*  6-member rings */
 5852|       |        /*
 5853|       |        O              OH             OH
 5854|       |        ||             |              |
 5855|       |        /  \          //  \           /  \\
 5856|       |        ||   ||  <-->  |    ||  <-->  ||   |
 5857|       |        \  /          \\  /           \  //
 5858|       |        NH             N              N
 5859|       |        */
 5860|  1.34M|        for (i1 = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (5860:22): [True: 1.08M, False: 257k]
  ------------------
 5861|  1.08M|        {
 5862|       |            /*  Find possible endpoint Z = at[i1] */
 5863|  1.08M|            if (3 != ( endpoint_valence = nGetEndpointInfo( at, i1, &eif1 ) ) ||
  ------------------
  |  Branch (5863:17): [True: 1.04M, False: 37.4k]
  ------------------
 5864|  37.4k|                 2 != at[i1].valence) /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (5864:18): [True: 9.35k, False: 28.0k]
  ------------------
 5865|  1.05M|            {
 5866|  1.05M|                continue; /*  not a nitrogen atom or a wrong valence */
 5867|  1.05M|            }
 5868|       |
 5869|  28.0k|            if (at[i1].nNumAtInRingSystem >= 6)
  ------------------
  |  Branch (5869:17): [True: 6.09k, False: 22.0k]
  ------------------
 5870|  6.09k|            {
 5871|  6.09k|                nNumEndPoints = 0;
 5872|  6.09k|                nNumBondPos = 0;
 5873|       |
 5874|  6.09k|                ret = nGet15TautIn6MembAltRing( pCG, at, i1, nDfsPathPos,
 5875|  6.09k|                                                DfsPath, nMaxLenDfsPath, EndPoint,
 5876|  6.09k|                                                sizeof( EndPoint ) / sizeof( EndPoint[0] ),
 5877|  6.09k|                                                BondPos,
 5878|  6.09k|                                                sizeof( BondPos ) / sizeof( BondPos[0] ),
 5879|  6.09k|                                                &nNumEndPoints, &nNumBondPos,
 5880|  6.09k|                                                pBNS, pBD, num_atoms );
 5881|  6.09k|                if (ret > 0)
  ------------------
  |  Branch (5881:21): [True: 41, False: 6.05k]
  ------------------
 5882|     41|                {
 5883|     41|                    if (nNumEndPoints)
  ------------------
  |  Branch (5883:25): [True: 41, False: 0]
  ------------------
 5884|     41|                    {
 5885|     41|                        num_changes = RegisterEndPoints( pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS );
 5886|     41|                        if (num_changes == -1)
  ------------------
  |  Branch (5886:29): [True: 0, False: 41]
  ------------------
 5887|      0|                        {
 5888|      0|                            nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   24|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 5889|      0|                        }
 5890|     41|                        if (num_changes < 0)
  ------------------
  |  Branch (5890:29): [True: 0, False: 41]
  ------------------
 5891|      0|                        {
 5892|      0|                            nErr = num_changes;
 5893|      0|                        }
 5894|     41|                        if (nErr)
  ------------------
  |  Branch (5894:29): [True: 0, False: 41]
  ------------------
 5895|      0|                        {
 5896|      0|                            goto free_memory;
 5897|      0|                        }
 5898|     41|                        tot_changes += ( num_changes > 0 );
 5899|     41|                    }
 5900|     41|                    if (nNumBondPos)
  ------------------
  |  Branch (5900:25): [True: 11, False: 30]
  ------------------
 5901|     11|                    {
 5902|     11|                        tot_changes += ( 0 < SetTautomericBonds( at, nNumBondPos, BondPos ) );
 5903|     11|                    }
 5904|     41|                }
 5905|  6.05k|                else
 5906|  6.05k|                {
 5907|  6.05k|                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  6.05k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  6.05k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  6.05k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  6.05k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 6.05k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 6.05k]
  |  |  ------------------
  ------------------
 5908|      0|                    {
 5909|      0|                        nErr = ret;
 5910|      0|                        goto free_memory;
 5911|      0|                    }
 5912|  6.05k|                }
 5913|  6.09k|            }
 5914|  28.0k|        }
 5915|   257k|#endif /* TAUT_4PYRIDINOL_RINGS */
 5916|       |
 5917|   257k|#if ( TAUT_PYRAZOLE_RINGS == 1 )
 5918|       |        /* 5-member rings:
 5919|       |
 5920|       |        Z               Z
 5921|       |        /  \\           //  \
 5922|       |        X     Y  <-->   X     Y
 5923|       |        \\   /          \    //
 5924|       |        N--NH           HN--N
 5925|       |
 5926|       |        ^             ^
 5927|       |        search for these NH
 5928|       |        */
 5929|       |        /*  5-member rings (pyrazole derivatives): look for the neighboring N */
 5930|  1.34M|        for (i1 = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (5930:22): [True: 1.08M, False: 257k]
  ------------------
 5931|  1.08M|        {
 5932|  1.08M|            if (2 == at[i1].valence &&
  ------------------
  |  Branch (5932:17): [True: 109k, False: 975k]
  ------------------
 5933|   109k|                 at[i1].nNumAtInRingSystem >= 5 &&
  ------------------
  |  Branch (5933:18): [True: 21.9k, False: 87.1k]
  ------------------
 5934|  21.9k|                 3 == ( endpoint_valence = nGetEndpointInfo( at, i1, &eif1 ) )
  ------------------
  |  Branch (5934:18): [True: 10.1k, False: 11.7k]
  ------------------
 5935|  1.08M|                 ) /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 5936|  10.1k|            {
 5937|  10.1k|                nMobile = at[i1].num_H + ( at[i1].charge == -1 );
 5938|  30.5k|                for (j = 0; j < at[i1].valence; j++)
  ------------------
  |  Branch (5938:29): [True: 20.3k, False: 10.1k]
  ------------------
 5939|  20.3k|                {
 5940|  20.3k|                    int nMobile2, endpoint_valence2;
 5941|  20.3k|                    i2 = at[i1].neighbor[j];
 5942|       |
 5943|       |                    /*  may be important */
 5944|  20.3k|                    if (i2 >= i1)
  ------------------
  |  Branch (5944:25): [True: 10.7k, False: 9.67k]
  ------------------
 5945|  10.7k|                    {
 5946|  10.7k|                        continue; /*  do not try same pair 2 times */
 5947|  10.7k|                    }
 5948|       |
 5949|  9.67k|                    if (at[i2].nRingSystem != at[i1].nRingSystem)
  ------------------
  |  Branch (5949:25): [True: 0, False: 9.67k]
  ------------------
 5950|      0|                    {
 5951|      0|                        continue;
 5952|      0|                    }
 5953|       |
 5954|  9.67k|                    bond_type = ( at[i1].bond_type[j] & ~BOND_MARK_ALL );
  ------------------
  |  |  191|  9.67k|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 5955|  9.67k|                    if ((bond_type != BOND_SINGLE &&
  ------------------
  |  |  177|  9.67k|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|  19.3k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (5955:26): [True: 7.93k, False: 1.73k]
  ------------------
 5956|  7.93k|                         bond_type != BOND_TAUTOM &&
  ------------------
  |  |  185|  17.6k|#define BOND_TAUTOM              8
  ------------------
  |  Branch (5956:26): [True: 5.13k, False: 2.80k]
  ------------------
 5957|  5.13k|                         bond_type != BOND_ALT12NS &&
  ------------------
  |  |  186|  14.8k|#define BOND_ALT12NS             9
  ------------------
  |  Branch (5957:26): [True: 3.99k, False: 1.14k]
  ------------------
 5958|  3.99k|                         bond_type != BOND_ALTERN) ||  /* added 1-15-2002 */
  ------------------
  |  |  180|  3.99k|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|  3.99k|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (5958:26): [True: 2.00k, False: 1.99k]
  ------------------
 5959|  7.67k|                         2 != at[i2].valence ||
  ------------------
  |  Branch (5959:26): [True: 1.18k, False: 6.49k]
  ------------------
 5960|  6.49k|                         3 != ( endpoint_valence2 = nGetEndpointInfo( at, i2, &eif2 ) )) /* djb-rwth: addressing LLVM warning; variable used to store function return value */
  ------------------
  |  Branch (5960:26): [True: 1.28k, False: 5.20k]
  ------------------
 5961|  4.46k|                    {
 5962|  4.46k|                        continue; /*  not a nitrogen atom or a wrong valence or not a single bond */
 5963|  4.46k|                    }
 5964|  5.20k|                    nMobile2 = at[i2].num_H + ( at[i2].charge == -1 );  /*  number of mobile groups */
 5965|       |#if ( TAUT_IGNORE_EQL_ENDPOINTS == 1 )
 5966|       |                    if (at[i1].endpoint && at[i1].endpoint == at[i2].endpoint)
 5967|       |                    {
 5968|       |                        continue; /* atoms already belong to the same t-group */
 5969|       |                    }
 5970|       |#endif
 5971|  5.20k|                    if (!at[i1].endpoint && !at[i2].endpoint && 1 != nMobile + nMobile2)
  ------------------
  |  Branch (5971:25): [True: 3.47k, False: 1.72k]
  |  Branch (5971:45): [True: 2.96k, False: 518]
  |  Branch (5971:65): [True: 2.80k, False: 158]
  ------------------
 5972|  2.80k|                    {
 5973|  2.80k|                        continue;
 5974|  2.80k|                    }
 5975|       |
 5976|  2.40k|                    ret = nGet12TautIn5MembAltRing( pCG, at, i1, j, nDfsPathPos,
 5977|  2.40k|                                                    DfsPath, nMaxLenDfsPath,
 5978|  2.40k|                                                    EndPoint,
 5979|  2.40k|                                                    sizeof( EndPoint ) / sizeof( EndPoint[0] ),
 5980|  2.40k|                                                    BondPos,
 5981|  2.40k|                                                    sizeof( BondPos ) / sizeof( BondPos[0] ),
 5982|  2.40k|                                                    &nNumEndPoints, &nNumBondPos,
 5983|  2.40k|                                                    pBNS, pBD, num_atoms );
 5984|  2.40k|                    if (ret > 0)
  ------------------
  |  Branch (5984:25): [True: 245, False: 2.16k]
  ------------------
 5985|    245|                    {
 5986|    245|                        if (nNumEndPoints)
  ------------------
  |  Branch (5986:29): [True: 245, False: 0]
  ------------------
 5987|    245|                        {
 5988|    245|                            num_changes = RegisterEndPoints( pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS );
 5989|    245|                            if (num_changes == -1)
  ------------------
  |  Branch (5989:33): [True: 0, False: 245]
  ------------------
 5990|      0|                            {
 5991|      0|                                nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   24|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 5992|      0|                            }
 5993|    245|                            if (num_changes < 0)
  ------------------
  |  Branch (5993:33): [True: 0, False: 245]
  ------------------
 5994|      0|                            {
 5995|      0|                                nErr = num_changes;
 5996|      0|                            }
 5997|    245|                            if (nErr)
  ------------------
  |  Branch (5997:33): [True: 0, False: 245]
  ------------------
 5998|      0|                                goto free_memory;
 5999|    245|                            tot_changes += ( num_changes > 0 );
 6000|    245|                        }
 6001|    245|                        if (nNumBondPos)
  ------------------
  |  Branch (6001:29): [True: 21, False: 224]
  ------------------
 6002|     21|                        {
 6003|     21|                            tot_changes += ( 0 < SetTautomericBonds( at, nNumBondPos, BondPos ) );
 6004|     21|                        }
 6005|    245|                    }
 6006|  2.16k|                    else
 6007|  2.16k|                    {
 6008|  2.16k|                        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|  2.16k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|  2.16k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|  2.16k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  2.16k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 2.16k, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 2.16k]
  |  |  ------------------
  ------------------
 6009|      0|                        {
 6010|      0|                            nErr = ret;
 6011|      0|                            goto free_memory;
 6012|      0|                        }
 6013|  2.16k|                    }
 6014|  2.40k|                }
 6015|  10.1k|            }
 6016|  1.08M|        }
 6017|   257k|#endif /* TAUT_PYRAZOLE_RINGS */
 6018|       |
 6019|   257k|#if ( TAUT_TROPOLONE_7 == 1 || TAUT_TROPOLONE_5 == 1 ) /* { */
 6020|       |        /********************************************************
 6021|       |        *                                         A  B
 6022|       |        *                                         | ||
 6023|       |        * 7-member rings (tropolones): look for M=Q--R--ZH,
 6024|       |        *                                       ^ ^  ^  ^
 6025|       |        *                               endpoint1 i1 i2 endpoint2
 6026|       |        * where A-Q-R=B belong to a 7-member alt. (except Q-R bond) ring: ..=A-(Q-R)=B-..
 6027|       |        * Bond Q-R should be single or tautomeric or alternating
 6028|       |        * M=Q and R-ZH should be chain (non-ring) bonds
 6029|       |        * Same for 5-member rings
 6030|       |        */
 6031|  1.34M|        for (i1 = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (6031:22): [True: 1.08M, False: 257k]
  ------------------
 6032|  1.08M|        {
 6033|  1.08M|            if (at[i1].nNumAtInRingSystem >=
  ------------------
  |  Branch (6033:17): [True: 30.8k, False: 1.05M]
  ------------------
 6034|  1.08M|#if ( TAUT_TROPOLONE_5 == 1 )
 6035|  1.08M|                 5
 6036|       |#else
 6037|       |                 7
 6038|       |#endif
 6039|  30.8k|                 &&
 6040|  30.8k|                 bIsCenterPointStrict( at, i1 ) &&
  ------------------
  |  Branch (6040:18): [True: 15.5k, False: 15.2k]
  ------------------
 6041|  15.5k|#if ( TAUT_RINGS_ATTACH_CHAIN == 1 )
 6042|  15.5k|                 at[i1].bCutVertex &&
  ------------------
  |  Branch (6042:18): [True: 2.50k, False: 13.0k]
  ------------------
 6043|  2.50k|#endif
 6044|  2.50k|                 at[i1].valence == 3 && !at[i1].endpoint)
  ------------------
  |  Branch (6044:18): [True: 1.65k, False: 854]
  |  Branch (6044:41): [True: 1.65k, False: 0]
  ------------------
 6045|  1.65k|            {
 6046|  1.65k|                int nMobile1, endpoint1, endpoint1_valence, bond_type1;
 6047|  1.65k|                int nMobile2, endpoint2, endpoint2_valence, bond_type2;
 6048|  6.61k|                for (j = 0; j < at[i1].valence; j++)
  ------------------
  |  Branch (6048:29): [True: 4.96k, False: 1.65k]
  ------------------
 6049|  4.96k|                {
 6050|  4.96k|                    i2 = at[i1].neighbor[j];
 6051|       |                    /* may be important
 6052|       |                    if ( i2 > i1 )
 6053|       |                    continue;
 6054|       |                    do not try same pair 2 times
 6055|       |                    */
 6056|  4.96k|                    if (at[i2].nRingSystem != at[i1].nRingSystem ||
  ------------------
  |  Branch (6056:25): [True: 1.62k, False: 3.34k]
  ------------------
 6057|  3.34k|                         !bIsCenterPointStrict( at, i2 ) ||
  ------------------
  |  Branch (6057:26): [True: 1.13k, False: 2.21k]
  ------------------
 6058|  2.21k|#if ( TAUT_RINGS_ATTACH_CHAIN == 1 )
 6059|  2.21k|                         !at[i2].bCutVertex ||
  ------------------
  |  Branch (6059:26): [True: 1.35k, False: 857]
  ------------------
 6060|    857|#endif
 6061|    857|                         at[i2].valence != 3 || at[i2].endpoint)
  ------------------
  |  Branch (6061:26): [True: 91, False: 766]
  |  Branch (6061:49): [True: 0, False: 766]
  ------------------
 6062|  4.19k|                    {
 6063|  4.19k|                        continue;
 6064|  4.19k|                    }
 6065|    766|                    bond_type = ( at[i1].bond_type[j] & ~BOND_MARK_ALL );
  ------------------
  |  |  191|    766|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 6066|    766|                    if (bond_type != BOND_SINGLE &&
  ------------------
  |  |  177|    766|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|  1.53k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (6066:25): [True: 217, False: 549]
  ------------------
 6067|    217|                         bond_type != BOND_TAUTOM &&
  ------------------
  |  |  185|    983|#define BOND_TAUTOM              8
  ------------------
  |  Branch (6067:26): [True: 144, False: 73]
  ------------------
 6068|    144|                         bond_type != BOND_ALT12NS &&
  ------------------
  |  |  186|    910|#define BOND_ALT12NS             9
  ------------------
  |  Branch (6068:26): [True: 86, False: 58]
  ------------------
 6069|     86|                         bond_type != BOND_ALTERN)
  ------------------
  |  |  180|     86|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|     86|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (6069:26): [True: 50, False: 36]
  ------------------
 6070|     50|                    {
 6071|     50|                        continue; /*  not a single bond between Q-R */
 6072|     50|                    }
 6073|       |
 6074|       |                    /*  Find endpoints */
 6075|  2.86k|                    for (k = 0; k < at[i1].valence; k++)
  ------------------
  |  Branch (6075:33): [True: 2.14k, False: 716]
  ------------------
 6076|  2.14k|                    {
 6077|  2.14k|                        endpoint1 = at[i1].neighbor[k];
 6078|  2.14k|                        if (endpoint1 == i2)
  ------------------
  |  Branch (6078:29): [True: 716, False: 1.43k]
  ------------------
 6079|    716|                        {
 6080|    716|                            continue; /*  j == k */
 6081|    716|                        }
 6082|  1.43k|                        if (!( endpoint1_valence = nGetEndpointInfo( at, endpoint1, &eif1 ) ))
  ------------------
  |  Branch (6082:29): [True: 773, False: 659]
  ------------------
 6083|    773|                        {
 6084|    773|                            continue; /*  not an endpoint1 element or can't have mobile groups */
 6085|    773|                        }
 6086|    659|#if ( TAUT_RINGS_ATTACH_CHAIN == 1 )
 6087|    659|                        if (at[endpoint1].nRingSystem == at[i1].nRingSystem)
  ------------------
  |  Branch (6087:29): [True: 101, False: 558]
  ------------------
 6088|    101|                        {
 6089|    101|                            continue;
 6090|    101|                        }
 6091|    558|#endif
 6092|    558|                        nMobile1 = at[endpoint1].num_H + ( at[endpoint1].charge == -1 );  /*  number of mobile groups */
 6093|    558|                        if (nMobile1 + at[endpoint1].chem_bonds_valence != endpoint1_valence)
  ------------------
  |  Branch (6093:29): [True: 0, False: 558]
  ------------------
 6094|      0|                            continue; /*  abnormal endpoint1 valence; ignore. */
 6095|    558|                        bond_type1 = ( at[i1].bond_type[k] & ~BOND_MARK_ALL );
  ------------------
  |  |  191|    558|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 6096|       |
 6097|    558|                        if (bond_type1 != BOND_SINGLE &&
  ------------------
  |  |  177|    558|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|  1.11k|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (6097:29): [True: 486, False: 72]
  ------------------
 6098|    486|                             bond_type1 != BOND_DOUBLE &&
  ------------------
  |  |  178|    486|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|  1.04k|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (6098:30): [True: 348, False: 138]
  ------------------
 6099|    348|                             bond_type1 != BOND_TAUTOM &&
  ------------------
  |  |  185|    906|#define BOND_TAUTOM              8
  ------------------
  |  Branch (6099:30): [True: 71, False: 277]
  ------------------
 6100|     71|                             bond_type1 != BOND_ALT12NS &&
  ------------------
  |  |  186|    629|#define BOND_ALT12NS             9
  ------------------
  |  Branch (6100:30): [True: 28, False: 43]
  ------------------
 6101|     28|                             bond_type1 != BOND_ALTERN)
  ------------------
  |  |  180|     28|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|     28|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (6101:30): [True: 0, False: 28]
  ------------------
 6102|      0|                        {
 6103|      0|                            continue;
 6104|      0|                        }
 6105|  2.23k|                        for (m = 0; m < at[i2].valence; m++)
  ------------------
  |  Branch (6105:37): [True: 1.67k, False: 558]
  ------------------
 6106|  1.67k|                        {
 6107|  1.67k|                            endpoint2 = at[i2].neighbor[m];
 6108|  1.67k|                            if (endpoint2 == i1)
  ------------------
  |  Branch (6108:33): [True: 558, False: 1.11k]
  ------------------
 6109|    558|                            {
 6110|    558|                                continue;
 6111|    558|                            }
 6112|  1.11k|                            if (!( endpoint2_valence = nGetEndpointInfo( at, endpoint2, &eif2 ) )) /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (6112:33): [True: 537, False: 579]
  ------------------
 6113|    537|                            {
 6114|    537|                                continue; /*  not an endpoint2 element or can't have mobile groups */
 6115|    537|                            }
 6116|    579|#if ( TAUT_RINGS_ATTACH_CHAIN == 1 )
 6117|    579|                            if (at[endpoint2].nRingSystem == at[i2].nRingSystem)
  ------------------
  |  Branch (6117:33): [True: 93, False: 486]
  ------------------
 6118|     93|                            {
 6119|     93|                                continue;
 6120|     93|                            }
 6121|    486|#endif
 6122|    486|                            nMobile2 = at[endpoint2].num_H + ( at[endpoint2].charge == -1 );  /*  number of mobile groups */
 6123|    486|                            bond_type2 = ( at[i2].bond_type[m] & ~BOND_MARK_ALL );
  ------------------
  |  |  191|    486|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 6124|       |
 6125|    486|                            if (bond_type2 != BOND_SINGLE &&
  ------------------
  |  |  177|    486|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|    972|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (6125:33): [True: 425, False: 61]
  ------------------
 6126|    425|                                 bond_type2 != BOND_DOUBLE &&
  ------------------
  |  |  178|    425|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|    911|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (6126:34): [True: 299, False: 126]
  ------------------
 6127|    299|                                 bond_type2 != BOND_TAUTOM &&
  ------------------
  |  |  185|    785|#define BOND_TAUTOM              8
  ------------------
  |  Branch (6127:34): [True: 29, False: 270]
  ------------------
 6128|     29|                                 bond_type2 != BOND_ALT12NS &&
  ------------------
  |  |  186|    515|#define BOND_ALT12NS             9
  ------------------
  |  Branch (6128:34): [True: 20, False: 9]
  ------------------
 6129|     20|                                 bond_type2 != BOND_ALTERN)
  ------------------
  |  |  180|     20|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   35|     20|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (6129:34): [True: 0, False: 20]
  ------------------
 6130|      0|                            {
 6131|      0|                                continue;
 6132|      0|                            }
 6133|       |
 6134|       |                            /*  Final test for possible tautomerism */
 6135|    486|                            nMobile = 0;
 6136|       |
 6137|    486|                            if (ALLOWED_EDGE( pBNS, i1, k ) && ALLOWED_EDGE( pBNS, i2, m ))
  ------------------
  |  | 4321|    972|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (4321:42): [True: 0, False: 486]
  |  |  |  Branch (4321:53): [True: 0, False: 486]
  |  |  |  Branch (4321:70): [True: 0, False: 486]
  |  |  |  Branch (4321:87): [True: 486, False: 0]
  |  |  ------------------
  ------------------
                                          if (ALLOWED_EDGE( pBNS, i1, k ) && ALLOWED_EDGE( pBNS, i2, m ))
  ------------------
  |  | 4321|    486|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (4321:42): [True: 0, False: 486]
  |  |  |  Branch (4321:53): [True: 0, False: 486]
  |  |  |  Branch (4321:70): [True: 0, False: 486]
  |  |  |  Branch (4321:87): [True: 486, False: 0]
  |  |  ------------------
  ------------------
 6138|    486|                            {
 6139|       |                                /*  Can mobile group move from 1 to 2? */
 6140|    486|                                nMobile += ( at[endpoint1].endpoint || nMobile1 ) &&  /*  from endpoint1 */
  ------------------
  |  Branch (6140:46): [True: 292, False: 194]
  |  Branch (6140:72): [True: 101, False: 93]
  ------------------
 6141|    393|                                    ( bond_type1 != BOND_DOUBLE ) &&
  ------------------
  |  |  178|    393|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|    393|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (6141:37): [True: 364, False: 29]
  ------------------
 6142|       |
 6143|    364|                                    ( at[endpoint2].endpoint ||          /*  to endpoint2 */
  ------------------
  |  Branch (6143:39): [True: 281, False: 83]
  ------------------
 6144|     83|                                      eif2.cNeutralBondsValence > at[endpoint2].valence ) &&
  ------------------
  |  Branch (6144:39): [True: 48, False: 35]
  ------------------
 6145|    329|                                      ( bond_type2 != BOND_SINGLE );
  ------------------
  |  |  177|    329|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|    329|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (6145:39): [True: 329, False: 0]
  ------------------
 6146|       |
 6147|       |                                /*  Can mobile group move from 2 to 1? */
 6148|    486|                                nMobile += ( at[endpoint2].endpoint || nMobile2 ) &&  /*  from endpoint2 */
  ------------------
  |  Branch (6148:46): [True: 291, False: 195]
  |  Branch (6148:72): [True: 94, False: 101]
  ------------------
 6149|    385|                                    ( bond_type2 != BOND_DOUBLE ) && /*changed from BOND_SINGLE 2004-02-26 */
  ------------------
  |  |  178|    385|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|    385|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (6149:37): [True: 358, False: 27]
  ------------------
 6150|       |
 6151|    358|                                    ( at[endpoint1].endpoint ||          /*  to endpoint1 */
  ------------------
  |  Branch (6151:39): [True: 280, False: 78]
  ------------------
 6152|     78|                                      eif1.cNeutralBondsValence > at[endpoint1].valence ) &&
  ------------------
  |  Branch (6152:39): [True: 42, False: 36]
  ------------------
 6153|    322|                                      ( bond_type1 != BOND_SINGLE );
  ------------------
  |  |  177|    322|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|    322|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (6153:39): [True: 322, False: 0]
  ------------------
 6154|    486|                            }
 6155|    486|                            if (!nMobile)
  ------------------
  |  Branch (6155:33): [True: 110, False: 376]
  ------------------
 6156|    110|                            {
 6157|    110|                                continue;
 6158|    110|                            }
 6159|       |
 6160|    376|                            if (bond_type1 == bond_type2 &&
  ------------------
  |  Branch (6160:33): [True: 263, False: 113]
  ------------------
 6161|    263|                                ( bond_type1 == BOND_SINGLE || bond_type1 == BOND_DOUBLE ))
  ------------------
  |  |  177|    263|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   32|    526|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                                              ( bond_type1 == BOND_SINGLE || bond_type1 == BOND_DOUBLE ))
  ------------------
  |  |  178|    263|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   33|    263|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (6161:35): [True: 0, False: 263]
  |  Branch (6161:64): [True: 0, False: 263]
  ------------------
 6162|      0|                            {
 6163|      0|                                continue;
 6164|      0|                            }
 6165|       |
 6166|       |                            /* -- old --
 6167|       |                            if ( !at[endpoint1].endpoint && !at[endpoint2].endpoint && 1 != nMobile1 + nMobile2 )
 6168|       |                            continue;
 6169|       |                            */
 6170|       |                            /* -- new --
 6171|       |
 6172|       |                            if ( !at[endpoint1].endpoint && !at[endpoint2].endpoint ) {
 6173|       |                            if ( !(bond_type1 == BOND_SINGLE || bond_type1 == BOND_DOUBLE) ||
 6174|       |                            !(bond_type2 == BOND_SINGLE || bond_type2 == BOND_DOUBLE) ) {
 6175|       |                            // at this point bond_type1 != bond_type2
 6176|       |                            continue;
 6177|       |                            }
 6178|       |                            if ( bond_type1 == BOND_SINGLE && !nMobile1 ||
 6179|       |                            bond_type2 == BOND_SINGLE && !nMobile2 ||
 6180|       |                            0 == nMobile1 + nMobile2 ) {
 6181|       |                            continue;
 6182|       |                            }
 6183|       |                            }
 6184|       |                            */
 6185|       |
 6186|    376|#if ( TAUT_TROPOLONE_7 == 1 )
 6187|    376|                            if (at[i1].nNumAtInRingSystem >= 7)
  ------------------
  |  Branch (6187:33): [True: 0, False: 376]
  ------------------
 6188|      0|                            {
 6189|       |
 6190|      0|                                ret = nGet14TautIn7MembAltRing( pCG, at, i1,
 6191|      0|                                                                j, k, m, nDfsPathPos,
 6192|      0|                                                                DfsPath, nMaxLenDfsPath,
 6193|      0|                                                                EndPoint,
 6194|      0|                                                                sizeof( EndPoint ) / sizeof( EndPoint[0] ),
 6195|      0|                                                                BondPos,
 6196|      0|                                                                sizeof( BondPos ) / sizeof( BondPos[0] ),
 6197|      0|                                                                &nNumEndPoints, &nNumBondPos,
 6198|      0|                                                                pBNS, pBD, num_atoms );
 6199|      0|                                if (ret > 0)
  ------------------
  |  Branch (6199:37): [True: 0, False: 0]
  ------------------
 6200|      0|                                {
 6201|      0|                                    if (nNumEndPoints)
  ------------------
  |  Branch (6201:41): [True: 0, False: 0]
  ------------------
 6202|      0|                                    {
 6203|      0|                                        num_changes = RegisterEndPoints( pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS );
 6204|      0|                                        if (num_changes == -1)
  ------------------
  |  Branch (6204:45): [True: 0, False: 0]
  ------------------
 6205|      0|                                        {
 6206|      0|                                            nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   24|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 6207|      0|                                        }
 6208|      0|                                        if (num_changes < 0)
  ------------------
  |  Branch (6208:45): [True: 0, False: 0]
  ------------------
 6209|      0|                                        {
 6210|      0|                                            nErr = num_changes;
 6211|      0|                                        }
 6212|      0|                                        if (nErr)
  ------------------
  |  Branch (6212:45): [True: 0, False: 0]
  ------------------
 6213|      0|                                        {
 6214|      0|                                            goto free_memory;
 6215|      0|                                        }
 6216|      0|                                        tot_changes += ( num_changes > 0 );
 6217|      0|                                    }
 6218|      0|                                    if (nNumBondPos)
  ------------------
  |  Branch (6218:41): [True: 0, False: 0]
  ------------------
 6219|      0|                                    {
 6220|      0|                                        tot_changes += ( 0 < SetTautomericBonds( at, nNumBondPos, BondPos ) );
 6221|      0|                                    }
 6222|      0|                                }
 6223|      0|                                else
 6224|      0|                                {
 6225|      0|                                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 0, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 6226|      0|                                    {
 6227|      0|                                        nErr = ret;
 6228|      0|                                        goto free_memory;
 6229|      0|                                    }
 6230|      0|                                }
 6231|      0|                            }
 6232|    376|#endif
 6233|       |
 6234|    376|#if ( TAUT_TROPOLONE_5 == 1 )
 6235|    376|                            if (at[i1].nNumAtInRingSystem >= 5)
  ------------------
  |  Branch (6235:33): [True: 376, False: 0]
  ------------------
 6236|    376|                            {
 6237|       |
 6238|    376|                                ret = nGet14TautIn5MembAltRing( pCG, at, i1, j, k, m, nDfsPathPos,
 6239|    376|                                                                DfsPath, nMaxLenDfsPath,
 6240|    376|                                                                EndPoint, sizeof( EndPoint ) / sizeof( EndPoint[0] ),
 6241|    376|                                                                BondPos, sizeof( BondPos ) / sizeof( BondPos[0] ),
 6242|    376|                                                                &nNumEndPoints, &nNumBondPos,
 6243|    376|                                                                pBNS, pBD, num_atoms );
 6244|    376|                                if (ret > 0)
  ------------------
  |  Branch (6244:37): [True: 276, False: 100]
  ------------------
 6245|    276|                                {
 6246|    276|                                    if (nNumEndPoints)
  ------------------
  |  Branch (6246:41): [True: 276, False: 0]
  ------------------
 6247|    276|                                    {
 6248|    276|                                        num_changes = RegisterEndPoints( pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS );
 6249|    276|                                        if (num_changes == -1)
  ------------------
  |  Branch (6249:45): [True: 0, False: 276]
  ------------------
 6250|      0|                                        {
 6251|      0|                                            nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   24|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 6252|      0|                                        }
 6253|    276|                                        if (num_changes < 0)
  ------------------
  |  Branch (6253:45): [True: 0, False: 276]
  ------------------
 6254|      0|                                        {
 6255|      0|                                            nErr = num_changes;
 6256|      0|                                        }
 6257|    276|                                        if (nErr)
  ------------------
  |  Branch (6257:45): [True: 0, False: 276]
  ------------------
 6258|      0|                                        {
 6259|      0|                                            goto free_memory;
 6260|      0|                                        }
 6261|    276|                                        tot_changes += ( num_changes > 0 );
 6262|    276|                                    }
 6263|    276|                                    if (nNumBondPos)
  ------------------
  |  Branch (6263:41): [True: 44, False: 232]
  ------------------
 6264|     44|                                    {
 6265|     44|                                        tot_changes += ( 0 < SetTautomericBonds( at, nNumBondPos, BondPos ) );
 6266|     44|                                    }
 6267|    276|                                }
 6268|    100|                                else
 6269|    100|                                {
 6270|    100|                                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   67|    100|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   47|    100|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   65|    100|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|    100|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (67:26): [True: 100, False: 0]
  |  |  |  Branch (67:44): [True: 0, False: 100]
  |  |  ------------------
  ------------------
 6271|      0|                                    {
 6272|      0|                                        nErr = ret;
 6273|      0|                                        goto free_memory;
 6274|      0|                                    }
 6275|    100|                                }
 6276|    376|                            }
 6277|    376|#endif
 6278|    376|                        }
 6279|    558|                    }
 6280|    716|                }
 6281|  1.65k|            }
 6282|  1.08M|        }
 6283|   257k|#endif /* } TAUT_TROPOLONE */
 6284|       |
 6285|   257k|    free_memory:
 6286|   257k|        if (nDfsPathPos)
  ------------------
  |  Branch (6286:13): [True: 257k, False: 0]
  ------------------
 6287|   257k|        {
 6288|   257k|            inchi_free( nDfsPathPos );
  ------------------
  |  | 1152|   257k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 257k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 257k]
  |  |  ------------------
  ------------------
 6289|   257k|        }
 6290|   257k|#undef MAX_ALT_PATH_LEN
 6291|   257k|    }
 6292|   263k|#endif  /* } FIND_RING_SYSTEMS */
 6293|       |
 6294|   263k|exit_function:
 6295|       |
 6296|   263k|    return nErr < 0 ? nErr : tot_changes;
  ------------------
  |  Branch (6296:12): [True: 0, False: 263k]
  ------------------
 6297|   263k|}
free_t_group_info:
 6302|   707k|{
 6303|   707k|    if (t_group_info)
  ------------------
  |  Branch (6303:9): [True: 707k, False: 0]
  ------------------
 6304|   707k|    {
 6305|   707k|        if (t_group_info->t_group)
  ------------------
  |  Branch (6305:13): [True: 131k, False: 576k]
  ------------------
 6306|   131k|        {
 6307|   131k|            inchi_free( t_group_info->t_group );
  ------------------
  |  | 1152|   131k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 131k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 131k]
  |  |  ------------------
  ------------------
 6308|   131k|        }
 6309|   707k|        if (t_group_info->nEndpointAtomNumber)
  ------------------
  |  Branch (6309:13): [True: 7.17k, False: 700k]
  ------------------
 6310|  7.17k|        {
 6311|  7.17k|            inchi_free( t_group_info->nEndpointAtomNumber );
  ------------------
  |  | 1152|  7.17k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 7.17k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 7.17k]
  |  |  ------------------
  ------------------
 6312|  7.17k|        }
 6313|   707k|        if (t_group_info->tGroupNumber)
  ------------------
  |  Branch (6313:13): [True: 7.17k, False: 700k]
  ------------------
 6314|  7.17k|        {
 6315|  7.17k|            inchi_free( t_group_info->tGroupNumber );
  ------------------
  |  | 1152|  7.17k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 7.17k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 7.17k]
  |  |  ------------------
  ------------------
 6316|  7.17k|        }
 6317|   707k|        if (t_group_info->nIsotopicEndpointAtomNumber)
  ------------------
  |  Branch (6317:13): [True: 462, False: 707k]
  ------------------
 6318|    462|        {
 6319|    462|            inchi_free( t_group_info->nIsotopicEndpointAtomNumber );
  ------------------
  |  | 1152|    462|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 462, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 462]
  |  |  ------------------
  ------------------
 6320|    462|        }
 6321|   707k|        memset( t_group_info, 0, sizeof( *t_group_info ) ); /* djb-rwth: memset_s C11/Annex K variant? */
 6322|   707k|    }
 6323|       |
 6324|   707k|    return 0;
 6325|   707k|}
make_a_copy_of_t_group_info:
 6331|  40.8k|{
 6332|  40.8k|    int err = 0, len;
 6333|  40.8k|    free_t_group_info( t_group_info );
 6334|  40.8k|    if (t_group_info_orig && t_group_info)
  ------------------
  |  Branch (6334:9): [True: 40.8k, False: 0]
  |  Branch (6334:30): [True: 40.8k, False: 0]
  ------------------
 6335|  40.8k|    {
 6336|  40.8k|        if (( len = t_group_info_orig->max_num_t_groups ) > 0)
  ------------------
  |  Branch (6336:13): [True: 40.8k, False: 0]
  ------------------
 6337|  40.8k|        {
 6338|  40.8k|            T_GROUP* tgi_tg = NULL;  /* Copied from below 2024-09-01 DT */
 6339|       |            /* djb-rwth: fixing oss-fuzz issue #52978 */
 6340|  40.8k|            tgi_tg = (T_GROUP*)inchi_malloc(((long long)len+1) * sizeof(t_group_info->t_group[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1143|  40.8k|#define inchi_malloc   malloc
  ------------------
 6341|  40.8k|            if (tgi_tg && t_group_info_orig->t_group)
  ------------------
  |  Branch (6341:17): [True: 40.8k, False: 0]
  |  Branch (6341:27): [True: 40.8k, False: 0]
  ------------------
 6342|  40.8k|            {
 6343|  40.8k|                t_group_info->t_group = tgi_tg;
 6344|  40.8k|                memcpy(tgi_tg,
 6345|  40.8k|                    t_group_info_orig->t_group,
 6346|  40.8k|                    len * sizeof(t_group_info->t_group[0])); /* djb-rwth: cast operator added */
 6347|  40.8k|            }
 6348|      0|            else
 6349|      0|            {
 6350|      0|                if (tgi_tg) /* djb-rwth: avoiding memory leak */
  ------------------
  |  Branch (6350:21): [True: 0, False: 0]
  ------------------
 6351|      0|                {
 6352|      0|                    inchi_free(tgi_tg);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6353|      0|                }
 6354|      0|                err++;
 6355|      0|            }
 6356|  40.8k|        }
 6357|  40.8k|        if (( len = t_group_info_orig->nNumEndpoints ) > 0)
  ------------------
  |  Branch (6357:13): [True: 3.47k, False: 37.4k]
  ------------------
 6358|  3.47k|        {
 6359|  3.47k|            if ((t_group_info->nEndpointAtomNumber =
  ------------------
  |  Branch (6359:17): [True: 3.47k, False: 0]
  ------------------
 6360|  3.47k|                (AT_NUMB*) inchi_malloc( len * sizeof( t_group_info->nEndpointAtomNumber[0] ) ))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 1143|  3.47k|#define inchi_malloc   malloc
  ------------------
 6361|  3.47k|            {
 6362|  3.47k|                memcpy(t_group_info->nEndpointAtomNumber,
 6363|  3.47k|                    t_group_info_orig->nEndpointAtomNumber,
 6364|  3.47k|                    len * sizeof(t_group_info->nEndpointAtomNumber[0]));
 6365|  3.47k|            }
 6366|      0|            else
 6367|      0|            {
 6368|      0|                err++;
 6369|      0|            }
 6370|  3.47k|        }
 6371|  40.8k|        if (( len = t_group_info_orig->num_t_groups ) > 0)
  ------------------
  |  Branch (6371:13): [True: 3.47k, False: 37.4k]
  ------------------
 6372|  3.47k|        {
 6373|  3.47k|            if ((t_group_info->tGroupNumber =
  ------------------
  |  Branch (6373:17): [True: 3.47k, False: 0]
  ------------------
 6374|  3.47k|                (AT_NUMB*) inchi_malloc( (long long)len * TGSO_TOTAL_LEN * sizeof( t_group_info->tGroupNumber[0] ) ))) /* djb-rwth: cast operator added; djb-rwth: addressing LLVM warning */
  ------------------
  |  | 1143|  3.47k|#define inchi_malloc   malloc
  ------------------
                              (AT_NUMB*) inchi_malloc( (long long)len * TGSO_TOTAL_LEN * sizeof( t_group_info->tGroupNumber[0] ) ))) /* djb-rwth: cast operator added; djb-rwth: addressing LLVM warning */
  ------------------
  |  |  141|  3.47k|#define TGSO_TOTAL_LEN   4
  ------------------
 6375|  3.47k|            {
 6376|  3.47k|                memcpy(t_group_info->tGroupNumber,
 6377|  3.47k|                    t_group_info_orig->tGroupNumber,
 6378|  3.47k|                    (long long)len * TGSO_TOTAL_LEN * sizeof(t_group_info->tGroupNumber[0])); /* djb-rwth: cast operator added */
  ------------------
  |  |  141|  3.47k|#define TGSO_TOTAL_LEN   4
  ------------------
 6379|  3.47k|            }
 6380|      0|            else
 6381|      0|            {
 6382|      0|                err++;
 6383|      0|            }
 6384|  3.47k|        }
 6385|  40.8k|        if (( len = t_group_info_orig->nNumIsotopicEndpoints ) > 0)
  ------------------
  |  Branch (6385:13): [True: 270, False: 40.6k]
  ------------------
 6386|    270|        {
 6387|       |            /* djb-rwth: fixing oss-fuzz issue #53519 */
 6388|    270|            AT_NUMB* tgi_niean = (AT_NUMB*)inchi_malloc(len * sizeof(t_group_info->nIsotopicEndpointAtomNumber[0]));
  ------------------
  |  | 1143|    270|#define inchi_malloc   malloc
  ------------------
 6389|    270|            AT_NUMB* tgior_niean = (AT_NUMB*)inchi_realloc(t_group_info_orig->nIsotopicEndpointAtomNumber, len * sizeof(t_group_info_orig->nIsotopicEndpointAtomNumber[0]));
  ------------------
  |  | 1149|    270|#define inchi_realloc   realloc
  ------------------
 6390|    270|            if (tgi_niean && tgior_niean) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (6390:17): [True: 270, False: 0]
  |  Branch (6390:30): [True: 270, False: 0]
  ------------------
 6391|    270|            {
 6392|    270|                t_group_info->nIsotopicEndpointAtomNumber = tgi_niean;
 6393|    270|                t_group_info_orig->nIsotopicEndpointAtomNumber = tgior_niean;
 6394|    270|                memcpy(tgi_niean,
 6395|    270|                    tgior_niean,
 6396|    270|                    len * sizeof(t_group_info->nIsotopicEndpointAtomNumber[0]));
 6397|    270|            }
 6398|      0|            else
 6399|      0|            {
 6400|       |                /* djb-rwth: avoiding memory leaks */
 6401|      0|                if (tgi_niean)
  ------------------
  |  Branch (6401:21): [True: 0, False: 0]
  ------------------
 6402|      0|                {
 6403|      0|                    inchi_free(tgi_niean);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6404|      0|                }
 6405|      0|                if (tgior_niean)
  ------------------
  |  Branch (6405:21): [True: 0, False: 0]
  ------------------
 6406|      0|                {
 6407|      0|                    inchi_free(tgior_niean);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6408|      0|                }
 6409|      0|                err++;
 6410|      0|            }
 6411|    270|        }
 6412|  40.8k|        if (!err)
  ------------------
  |  Branch (6412:13): [True: 40.8k, False: 0]
  ------------------
 6413|  40.8k|        {
 6414|  40.8k|            t_group_info->nNumEndpoints = t_group_info_orig->nNumEndpoints;
 6415|  40.8k|            t_group_info->num_t_groups = t_group_info_orig->num_t_groups;
 6416|  40.8k|            t_group_info->max_num_t_groups = t_group_info_orig->max_num_t_groups;
 6417|  40.8k|            t_group_info->bIgnoreIsotopic = t_group_info_orig->bIgnoreIsotopic;
 6418|  40.8k|            t_group_info->nNumIsotopicEndpoints = t_group_info_orig->nNumIsotopicEndpoints;
 6419|  40.8k|            t_group_info->tni = t_group_info_orig->tni;
 6420|       |            /*
 6421|       |            t_group_info->nNumRemovedExplicitH       = t_group_info_orig->nNumRemovedExplicitH;
 6422|       |            t_group_info->nNumRemovedProtons         = t_group_info_orig->nNumRemovedProtons;
 6423|       |            t_group_info->bNormalizationFlags        = t_group_info_orig->bNormalizationFlags;
 6424|       |            */
 6425|       |            /*
 6426|       |            t_group_info->bHardAddedRemovedProtons   = t_group_info_orig->bHardAddedRemovedProtons;
 6427|       |            t_group_info->bSimpleAddedRemovedProtons = t_group_info_orig->bSimpleAddedRemovedProtons;
 6428|       |            t_group_info->nNumCanceledCharges        = t_group_info_orig->nNumCanceledCharges;
 6429|       |            */
 6430|  40.8k|        }
 6431|  40.8k|        t_group_info->bTautFlags = t_group_info_orig->bTautFlags;
 6432|  40.8k|        t_group_info->bTautFlagsDone = t_group_info_orig->bTautFlagsDone;
 6433|  40.8k|    }
 6434|       |
 6435|  40.8k|    return err;
 6436|  40.8k|}
set_tautomer_iso_sort_keys:
 6443|  40.8k|{
 6444|  40.8k|    T_GROUP       *t_group;
 6445|  40.8k|    T_GROUP_ISOWT Mult = 1;
 6446|  40.8k|    int     i, j, num_t_groups, num_iso_t_groups = 0;
 6447|       |
 6448|  40.8k|    if (!t_group_info || !( t_group = t_group_info->t_group ) ||
  ------------------
  |  Branch (6448:9): [True: 0, False: 40.8k]
  |  Branch (6448:26): [True: 0, False: 40.8k]
  ------------------
 6449|  40.8k|         0 >= ( num_t_groups = t_group_info->num_t_groups ) || t_group_info->nNumIsotopicEndpoints)
  ------------------
  |  Branch (6449:10): [True: 37.4k, False: 3.47k]
  |  Branch (6449:64): [True: 117, False: 3.36k]
  ------------------
 6450|  37.5k|    {
 6451|  37.5k|        return 0;
 6452|  37.5k|    }
 6453|       |
 6454|  6.79k|    for (i = 0; i < num_t_groups; i++)
  ------------------
  |  Branch (6454:17): [True: 3.43k, False: 3.36k]
  ------------------
 6455|  3.43k|    {
 6456|  3.43k|        t_group[i].iWeight = 0;
 6457|  3.43k|        j = T_NUM_ISOTOPIC - 1;
  ------------------
  |  |   70|  3.43k|#define           T_NUM_ISOTOPIC    NUM_H_ISOTOPES /* was 2, now 3 */
  |  |  ------------------
  |  |  |  |   25|  3.43k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  |  |  ------------------
  ------------------
 6458|  3.43k|        Mult = 1;
 6459|  3.43k|        do
 6460|  10.3k|        {
 6461|  10.3k|            t_group[i].iWeight += Mult * (T_GROUP_ISOWT) t_group[i].num[T_NUM_NO_ISOTOPIC + j];
  ------------------
  |  |   69|  10.3k|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
 6462|  10.3k|        } while (--j >= 0 && ( Mult *= T_GROUP_ISOWT_MULT ));
  ------------------
  |  |   81|  6.87k|#define T_GROUP_ISOWT_MULT   1024 /* (max. number of identical isotopic hydrogens in a taut. group) + 1 */
  ------------------
  |  Branch (6462:18): [True: 6.87k, False: 3.43k]
  |  Branch (6462:30): [True: 6.87k, False: 0]
  ------------------
 6463|       |
 6464|  3.43k|        num_iso_t_groups += ( t_group[i].iWeight != 0 );
 6465|  3.43k|    }
 6466|       |
 6467|  3.36k|    return num_iso_t_groups;
 6468|  40.8k|}
CountTautomerGroups:
 6487|   252k|{
 6488|   252k|    int i, j, ret = 0, nNumEndpoints, max_t_group, num_groups_noH;
 6489|       |
 6490|   252k|    AT_NUMB    nGroupNumber, nNewGroupNumber, *nCurrEndpointAtNoPos = NULL;
 6491|       |
 6492|   252k|    T_GROUP   *t_group;
 6493|   252k|    int        num_t;
 6494|       |    /* int bIgnoreIsotopic, max_num_t; */
 6495|   252k|    AT_NUMB   *nTautomerGroupNumber = NULL;
 6496|   252k|    AT_NUMB   *nEndpointAtomNumber = NULL;
 6497|   252k|    AT_NUMB   *tGroupNumber = NULL;
 6498|       |
 6499|   252k|    if (!t_group_info || !t_group_info->t_group || 0 >= t_group_info->max_num_t_groups)
  ------------------
  |  Branch (6499:9): [True: 0, False: 252k]
  |  Branch (6499:26): [True: 0, False: 252k]
  |  Branch (6499:52): [True: 0, False: 252k]
  ------------------
 6500|      0|    {
 6501|      0|        return 0; /* empty t-groups */
 6502|      0|    }
 6503|   252k|    num_t = t_group_info->num_t_groups;
 6504|   252k|    t_group = t_group_info->t_group;
 6505|       |    /*
 6506|       |    max_num_t       =  t_group_info->max_num_t_groups;
 6507|       |    bIgnoreIsotopic =  t_group_info->bIgnoreIsotopic;
 6508|       |    */
 6509|   252k|    num_groups_noH = 0;
 6510|       |
 6511|       |    /* the following 2 arrays are to be rebuilt here */
 6512|       |    /* djb-rwth: fixing oss-fuzz issue #70006 */
 6513|   252k|    if (t_group_info->nEndpointAtomNumber)
  ------------------
  |  Branch (6513:9): [True: 0, False: 252k]
  ------------------
 6514|      0|    {
 6515|       |        /* free( t_group_info->nEndpointAtomNumber ); */ 
 6516|      0|        t_group_info->nEndpointAtomNumber = NULL;
 6517|      0|    }
 6518|   252k|    if (t_group_info->tGroupNumber)
  ------------------
  |  Branch (6518:9): [True: 0, False: 252k]
  ------------------
 6519|      0|    {
 6520|       |        /* inchi_free( t_group_info->tGroupNumber ); */
 6521|      0|        t_group_info->tGroupNumber = NULL;
 6522|      0|    }
 6523|       |
 6524|       |    /*  Find max_t_group */
 6525|   257k|    for (i = 0, max_t_group = 0; i < t_group_info->num_t_groups; i++)
  ------------------
  |  Branch (6525:34): [True: 5.56k, False: 252k]
  ------------------
 6526|  5.56k|    {
 6527|  5.56k|        if (max_t_group < t_group[i].nGroupNumber)
  ------------------
  |  Branch (6527:13): [True: 5.56k, False: 0]
  ------------------
 6528|  5.56k|            max_t_group = t_group[i].nGroupNumber;
 6529|  5.56k|    }
 6530|       |    /*  Allocate memory for temp storage of numbers of endpoints  */
 6531|   252k|    if (max_t_group &&
  ------------------
  |  Branch (6531:9): [True: 5.45k, False: 246k]
  ------------------
 6532|  5.45k|         !( nTautomerGroupNumber = (AT_NUMB*) inchi_calloc( (long long)max_t_group + 1, sizeof( nTautomerGroupNumber[0] ) ) /*temp*/ )) /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  5.45k|#define inchi_calloc   calloc
  ------------------
  |  Branch (6532:10): [True: 0, False: 5.45k]
  ------------------
 6533|      0|    {
 6534|      0|        goto err_exit_function; /*  program error: out of RAM */ /*   <BRKPT> */
 6535|      0|    }
 6536|       |
 6537|       |    /*  Count endpoints for each tautomer group */
 6538|  1.30M|    for (i = 0, nNumEndpoints = 0; i < num_atoms; i++)
  ------------------
  |  Branch (6538:36): [True: 1.04M, False: 252k]
  ------------------
 6539|  1.04M|    {
 6540|  1.04M|        if (( j = at[i].endpoint ) == 0)
  ------------------
  |  Branch (6540:13): [True: 1.03M, False: 13.2k]
  ------------------
 6541|  1.03M|        {
 6542|  1.03M|            continue;
 6543|  1.03M|        }
 6544|  13.2k|        if (j > max_t_group) /*  debug only */
  ------------------
  |  Branch (6544:13): [True: 0, False: 13.2k]
  ------------------
 6545|      0|        {
 6546|      0|            goto err_exit_function; /*  program error */ /*   <BRKPT> */
 6547|      0|        }
 6548|  13.2k|        if (nTautomerGroupNumber) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (6548:13): [True: 13.2k, False: 0]
  ------------------
 6549|  13.2k|            nTautomerGroupNumber[j] ++;
 6550|  13.2k|        nNumEndpoints++;
 6551|  13.2k|    }
 6552|       |
 6553|   252k|    if (!nNumEndpoints)
  ------------------
  |  Branch (6553:9): [True: 246k, False: 5.45k]
  ------------------
 6554|   246k|    {
 6555|   246k|        goto exit_function; /*  not a tautomer */
 6556|   246k|    }
 6557|       |
 6558|       |    /*  allocate temporary array */
 6559|  5.45k|    if (!( nEndpointAtomNumber = (AT_NUMB*) inchi_calloc( nNumEndpoints, sizeof( nEndpointAtomNumber[0] ) ) ) ||
  ------------------
  |  | 1146|  5.45k|#define inchi_calloc   calloc
  ------------------
  |  Branch (6559:9): [True: 0, False: 5.45k]
  ------------------
 6560|  5.45k|         !( nCurrEndpointAtNoPos = (AT_NUMB*) inchi_calloc( num_t, sizeof( nCurrEndpointAtNoPos[0] ) ) /*temp*/ ))
  ------------------
  |  | 1146|  5.45k|#define inchi_calloc   calloc
  ------------------
  |  Branch (6560:10): [True: 0, False: 5.45k]
  ------------------
 6561|      0|    {
 6562|      0|        goto err_exit_function; /*   program error: out of RAM */ /*   <BRKPT> */
 6563|      0|    }
 6564|       |
 6565|       |    /*
 6566|       |    * Remove missing endpoints from t_group. Since only one
 6567|       |    * disconnected part is processed, some endpoints groups may have disappeared.
 6568|       |    * Mark t_groups containing charges only for subsequent removal
 6569|       |    */
 6570|  11.0k|    for (i = 0, nNewGroupNumber = 0; i < num_t; /*i ++*/)
  ------------------
  |  Branch (6570:38): [True: 5.56k, False: 5.45k]
  ------------------
 6571|  5.56k|    {
 6572|  5.56k|        int bNoH = 0, nNumH;
 6573|  5.56k|        nGroupNumber = t_group[i].nGroupNumber;
 6574|  11.1k|        for (j = 1, nNumH = t_group[i].num[0]; j < T_NUM_NO_ISOTOPIC; j++)
  ------------------
  |  |   69|  11.1k|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
  |  Branch (6574:48): [True: 5.56k, False: 5.56k]
  ------------------
 6575|  5.56k|        {
 6576|  5.56k|            nNumH -= (int) t_group[i].num[j];
 6577|  5.56k|        }
 6578|  5.56k|        if (nTautomerGroupNumber) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (6578:13): [True: 5.56k, False: 0]
  ------------------
 6579|  5.56k|        {
 6580|  5.56k|            if (t_group[i].nNumEndpoints != nTautomerGroupNumber[(int)nGroupNumber]
  ------------------
  |  Branch (6580:17): [True: 0, False: 5.56k]
  ------------------
 6581|  5.56k|#if ( IGNORE_TGROUP_WITHOUT_H == 1 )
 6582|  5.56k|                || (bNoH = (t_group[i].num[0] == t_group[i].num[1]))  /* only for (H,-) t-groups; (+) t-groups are not removed */
  ------------------
  |  Branch (6582:20): [True: 1.98k, False: 3.57k]
  ------------------
 6583|  5.56k|#endif
 6584|  5.56k|                ) /* djb-rwth: fixing a NULL pointer dereference */
 6585|  1.98k|            {
 6586|  1.98k|                if (!nTautomerGroupNumber[(int)nGroupNumber] || bNoH)
  ------------------
  |  Branch (6586:21): [True: 0, False: 1.98k]
  |  Branch (6586:65): [True: 1.98k, False: 0]
  ------------------
 6587|  1.98k|                {
 6588|       |                    /*  The group belongs to another disconnected part of the structure or has only charges */
 6589|       |                    /*  Remove the group */
 6590|  1.98k|                    num_t--;
 6591|  1.98k|                    if (i < num_t)
  ------------------
  |  Branch (6591:25): [True: 8, False: 1.97k]
  ------------------
 6592|      8|                        memmove(t_group + i, t_group + i + 1, ((long long)num_t - (long long)i) * sizeof(t_group[0])); /* djb-rwth: cast operators added */
 6593|  1.98k|                    if (bNoH)
  ------------------
  |  Branch (6593:25): [True: 1.98k, False: 0]
  ------------------
 6594|  1.98k|                    {
 6595|       |                        /*  Group contains no mobile hydrogen atoms, only charges. Prepare to remove it. */
 6596|  1.98k|                        nTautomerGroupNumber[(int)nGroupNumber] = 0;
 6597|  1.98k|                        num_groups_noH++;
 6598|  1.98k|                    }
 6599|       |                    /*i --;*/
 6600|  1.98k|                }
 6601|      0|                else
 6602|      0|                {
 6603|       |                    /*  Different number of endpoints */
 6604|      0|                    goto err_exit_function; /*  program error */ /*   <BRKPT> */
 6605|      0|                }
 6606|  1.98k|            }
 6607|  3.57k|            else
 6608|  3.57k|            {
 6609|       |                /*  Renumber t_group and prepare to renumber at[i].endpoint */
 6610|  3.57k|                nTautomerGroupNumber[(int)nGroupNumber] =
 6611|  3.57k|                    t_group[i].nGroupNumber = ++nNewGroupNumber; /*  = i+1 */
 6612|       |                /*  get first group atom orig. number position in the nEndpointAtomNumber[] */
 6613|       |                /*  and in the tautomer endpoint canon numbers part of the connection table */
 6614|  3.57k|                t_group[i].nFirstEndpointAtNoPos = nCurrEndpointAtNoPos[i] =
 6615|  3.57k|                    i ? (t_group[i - 1].nFirstEndpointAtNoPos + t_group[i - 1].nNumEndpoints) : 0;
  ------------------
  |  Branch (6615:21): [True: 101, False: 3.47k]
  ------------------
 6616|  3.57k|                t_group[i].num[0] = nNumH;
 6617|       |#if ( REMOVE_TGROUP_CHARGE == 1 )
 6618|       |                t_group[i].num[1] = 0;  /* remove only (-) charges */
 6619|       |#endif
 6620|       |                /* -- wrong condition. Disabled.
 6621|       |                if ( t_group[i].nGroupNumber != i + 1 ) { // for debug only
 6622|       |                goto err_exit_function; // program error
 6623|       |                }
 6624|       |                */
 6625|  3.57k|                i++;
 6626|  3.57k|            }
 6627|  5.56k|        }
 6628|  5.56k|    }
 6629|  5.45k|    if (num_t != nNewGroupNumber)
  ------------------
  |  Branch (6629:9): [True: 0, False: 5.45k]
  ------------------
 6630|      0|    {
 6631|       |        /*  for debug only */
 6632|      0|        goto err_exit_function; /*  program error */ /*   <BRKPT> */
 6633|      0|    }
 6634|       |
 6635|       |    /*  Check if any tautomer group was left */
 6636|  5.45k|    if (!nNewGroupNumber)
  ------------------
  |  Branch (6636:9): [True: 1.97k, False: 3.47k]
  ------------------
 6637|  1.97k|    {
 6638|  1.97k|        if (!num_groups_noH)
  ------------------
  |  Branch (6638:13): [True: 0, False: 1.97k]
  ------------------
 6639|      0|        {
 6640|      0|            goto err_exit_function; /*  program error: not a tautomer */ /*   <BRKPT> */
 6641|      0|        }
 6642|  1.97k|        else
 6643|  1.97k|        {
 6644|  1.97k|            goto exit_function;
 6645|  1.97k|        }
 6646|  1.97k|    }
 6647|       |
 6648|       |    /*
 6649|       |    * An array for tautomer group sorting later, at the time of storing Connection Table
 6650|       |    * Later the sorting consists out of 2 steps:
 6651|       |    * 1) Sort t_group[i].nNumEndpoints endpoint atom ranks within each endpoint group
 6652|       |    *    starting from t_group[i].nFirstEndpointAtNoPos; i = 0..t_group_info->num_t_groups-1
 6653|       |    * 2) Sort the groups indexes t_group_info->tGroupNumber[]
 6654|       |    */
 6655|  3.47k|    if (!( tGroupNumber =
  ------------------
  |  Branch (6655:9): [True: 0, False: 3.47k]
  ------------------
 6656|  3.47k|        (AT_NUMB*) inchi_calloc( (long long)nNewGroupNumber * (long long)TGSO_TOTAL_LEN, sizeof( tGroupNumber[0] ) ) )) /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  3.47k|#define inchi_calloc   calloc
  ------------------
                      (AT_NUMB*) inchi_calloc( (long long)nNewGroupNumber * (long long)TGSO_TOTAL_LEN, sizeof( tGroupNumber[0] ) ) )) /* djb-rwth: cast operator added */
  ------------------
  |  |  141|  3.47k|#define TGSO_TOTAL_LEN   4
  ------------------
 6657|      0|    {
 6658|      0|        goto err_exit_function; /*  out of RAM */
 6659|      0|    }
 6660|  7.05k|    for (i = 0; i < nNewGroupNumber; i++)
  ------------------
  |  Branch (6660:17): [True: 3.57k, False: 3.47k]
  ------------------
 6661|  3.57k|    {
 6662|  3.57k|        tGroupNumber[i] = (AT_NUMB) i; /*  initialization: original t_group number = (at[i]->endpoint-1) */
 6663|  3.57k|    }
 6664|       |    /*
 6665|       |    * Renumber endpoint atoms and save their orig. atom
 6666|       |    * numbers for filling out the tautomer part of the LinearCT.
 6667|       |    * nCurrEndpointAtNoPos[j] is an index of the atom number in the nEndpointAtomNumber[]
 6668|       |    */
 6669|  26.0k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (6669:17): [True: 22.6k, False: 3.47k]
  ------------------
 6670|  22.6k|    {
 6671|  22.6k|        if ((j = (int) at[i].endpoint)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (6671:13): [True: 8.61k, False: 14.0k]
  ------------------
 6672|  8.61k|        {
 6673|  8.61k|            j = (int) ( at[i].endpoint = nTautomerGroupNumber[j] ) - 1; /*  new t_group number */
 6674|  8.61k|            if (j >= 0 && j < num_t) /* djb-rwth: fixing buffer overflow */
  ------------------
  |  Branch (6674:17): [True: 8.61k, False: 0]
  |  Branch (6674:27): [True: 8.61k, False: 0]
  ------------------
 6675|  8.61k|            {
 6676|       |                /*  j=-1 in case of no mobile hydrogen atoms (charges only), group being removed */
 6677|  8.61k|                if (nCurrEndpointAtNoPos[j] >=   /*  debug only */
  ------------------
  |  Branch (6677:21): [True: 0, False: 8.61k]
  ------------------
 6678|  8.61k|                     t_group[j].nFirstEndpointAtNoPos + t_group[j].nNumEndpoints)
 6679|      0|                {
 6680|      0|                    goto err_exit_function; /*  program error */ /*   <BRKPT> */
 6681|      0|                }
 6682|  8.61k|                nEndpointAtomNumber[(int) nCurrEndpointAtNoPos[j] ++] = (AT_NUMB) i;
 6683|  8.61k|            }
 6684|      0|            else
 6685|      0|            {
 6686|      0|                nNumEndpoints--; /*  endpoint has been removed */
 6687|      0|            }
 6688|  8.61k|        }
 6689|  22.6k|    }
 6690|  3.47k|    t_group_info->num_t_groups = nNewGroupNumber;
 6691|  3.47k|    t_group_info->nNumEndpoints = nNumEndpoints;
 6692|  3.47k|    t_group_info->nEndpointAtomNumber = nEndpointAtomNumber;
 6693|  3.47k|    t_group_info->tGroupNumber = tGroupNumber; /* only the 1st segment filled */
 6694|  3.47k|    inchi_free( nTautomerGroupNumber );
  ------------------
  |  | 1152|  3.47k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 3.47k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 3.47k]
  |  |  ------------------
  ------------------
 6695|  3.47k|    inchi_free( nCurrEndpointAtNoPos );
  ------------------
  |  | 1152|  3.47k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 3.47k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 3.47k]
  |  |  ------------------
  ------------------
 6696|  3.47k|    return nNumEndpoints + T_GROUP_HDR_LEN * nNewGroupNumber + 1; /*  nLenLinearCTTautomer */
  ------------------
  |  |   72|  3.47k|#define           T_GROUP_HDR_LEN   (1+T_NUM_NO_ISOTOPIC /*+T_NUM_ISOTOPIC*/) /* LinearCTTautomer */
  |  |  ------------------
  |  |  |  |   69|  3.47k|#define           T_NUM_NO_ISOTOPIC 2
  |  |  ------------------
  ------------------
 6697|       |
 6698|      0|err_exit_function:
 6699|      0|    ret = CT_TAUCOUNT_ERR;
  ------------------
  |  |   24|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 6700|       |
 6701|   248k|exit_function:
 6702|       |
 6703|       |    /*  release allocated memory; set "no tautomeric group" */
 6704|   248k|    if (nEndpointAtomNumber)
  ------------------
  |  Branch (6704:9): [True: 1.97k, False: 246k]
  ------------------
 6705|  1.97k|    {
 6706|  1.97k|        inchi_free( nEndpointAtomNumber );
  ------------------
  |  | 1152|  1.97k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 1.97k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 1.97k]
  |  |  ------------------
  ------------------
 6707|  1.97k|    }
 6708|   248k|    if (nTautomerGroupNumber)
  ------------------
  |  Branch (6708:9): [True: 1.97k, False: 246k]
  ------------------
 6709|  1.97k|    {
 6710|  1.97k|        inchi_free( nTautomerGroupNumber );
  ------------------
  |  | 1152|  1.97k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 1.97k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 1.97k]
  |  |  ------------------
  ------------------
 6711|  1.97k|    }
 6712|   248k|    if (tGroupNumber)
  ------------------
  |  Branch (6712:9): [True: 0, False: 248k]
  ------------------
 6713|      0|    {
 6714|      0|        inchi_free( tGroupNumber );
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6715|      0|    }
 6716|   248k|    if (nCurrEndpointAtNoPos)
  ------------------
  |  Branch (6716:9): [True: 1.97k, False: 246k]
  ------------------
 6717|  1.97k|    {
 6718|  1.97k|        inchi_free( nCurrEndpointAtNoPos );
  ------------------
  |  | 1152|  1.97k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 1.97k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 1.97k]
  |  |  ------------------
  ------------------
 6719|  1.97k|    }
 6720|   248k|    t_group_info->nNumEndpoints = 0;
 6721|   248k|    t_group_info->num_t_groups = 0;
 6722|   248k|    if (!ret && ( ( t_group_info->tni.bNormalizationFlags & FLAG_NORM_CONSIDER_TAUT ) ||
  ------------------
  |  |  156|   248k|#define FLAG_NORM_CONSIDER_TAUT      ( FLAG_PROTON_NPO_SIMPLE_REMOVED | \
  |  |  ------------------
  |  |  |  |  146|   248k|#define FLAG_PROTON_NPO_SIMPLE_REMOVED 0x0001
  |  |  ------------------
  |  |  157|   248k|                                       FLAG_PROTON_NP_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  147|   248k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  158|   248k|                                       FLAG_PROTON_AC_SIMPLE_ADDED    | \
  |  |  ------------------
  |  |  |  |  148|   248k|#define FLAG_PROTON_AC_SIMPLE_ADDED    0x0004
  |  |  ------------------
  |  |  159|   248k|                                       FLAG_PROTON_AC_SIMPLE_REMOVED  | \
  |  |  ------------------
  |  |  |  |  149|   248k|#define FLAG_PROTON_AC_SIMPLE_REMOVED  0x0008
  |  |  ------------------
  |  |  160|   248k|                                       FLAG_PROTON_AC_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  150|   248k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  161|   248k|                                       FLAG_PROTON_AC_HARD_ADDED      | \
  |  |  ------------------
  |  |  |  |  151|   248k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  |  |  162|   248k|                                       FLAG_PROTON_SINGLE_REMOVED     | \
  |  |  ------------------
  |  |  |  |  153|   248k|#define FLAG_PROTON_SINGLE_REMOVED     0x0080
  |  |  ------------------
  |  |  163|   248k|                                       FLAG_PROTON_CHARGE_CANCEL    )
  |  |  ------------------
  |  |  |  |  152|   248k|#define FLAG_PROTON_CHARGE_CANCEL      0x0040
  |  |  ------------------
  ------------------
  |  Branch (6722:9): [True: 248k, False: 0]
  |  Branch (6722:19): [True: 37.2k, False: 211k]
  ------------------
 6723|   211k|                  (t_group_info->nNumIsotopicEndpoints > 1 && ( t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE ) )) )) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  981|    122|#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 ) )) )) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  982|    122|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  |  Branch (6723:20): [True: 122, False: 211k]
  |  Branch (6723:63): [True: 122, False: 0]
  ------------------
 6724|  37.4k|    {
 6725|  37.4k|        ret = 1; /* only protons have been (re)moved or neitralization happened */
 6726|  37.4k|    }
 6727|       |
 6728|   248k|    return ret;
 6729|      0|}
CompRankTautomer:
 6974|  5.19k|{
 6975|  5.19k|    AT_RANK *pn_tRankForSort = (AT_RANK *) p;
 6976|  5.19k|    int ret = (int) pn_tRankForSort[(int) ( *(const AT_RANK*) a1 )] -
 6977|  5.19k|        (int) pn_tRankForSort[(int) ( *(const AT_RANK*) a2 )];
 6978|       |
 6979|  5.19k|    return ret;
 6980|  5.19k|}
SortTautomerGroupsAndEndpoints:
 6989|   252k|{
 6990|   252k|    int i, nFirstEndpointAtNoPos, nNumEndpoints;
 6991|   252k|    AT_RANK *pn_tRankForSort;
 6992|   252k|    AT_NUMB  *nEndpointAtomNumber;
 6993|   252k|    int       num_t_groups = num_at_tg - num_atoms;
 6994|   252k|    T_GROUP   *t_group = NULL;
 6995|       |
 6996|       |    /*  Check if sorting is required */
 6997|   252k|    if (num_t_groups <= 0 || t_group_info->nNumEndpoints < 2)
  ------------------
  |  Branch (6997:9): [True: 248k, False: 3.52k]
  |  Branch (6997:30): [True: 0, False: 3.52k]
  ------------------
 6998|   248k|    {
 6999|   248k|        return 0; /*  no tautomer data */
 7000|   248k|    }
 7001|       |
 7002|  3.52k|    t_group = t_group_info->t_group;
 7003|       |
 7004|       |    /*  Sort endpoints within the groups */
 7005|  7.15k|    for (i = 0; i < num_t_groups; i++)
  ------------------
  |  Branch (7005:17): [True: 3.63k, False: 3.52k]
  ------------------
 7006|  3.63k|    {
 7007|  3.63k|        if (t_group[i].nNumEndpoints < 2)
  ------------------
  |  Branch (7007:13): [True: 0, False: 3.63k]
  ------------------
 7008|      0|        {
 7009|      0|            continue;  /*  program error; should not happen */ /*   <BRKPT> */
 7010|      0|        }
 7011|       |
 7012|       |        /*  Set globals for sorting */
 7013|  3.63k|        nFirstEndpointAtNoPos = t_group[i].nFirstEndpointAtNoPos;
 7014|  3.63k|        nNumEndpoints = t_group[i].nNumEndpoints;
 7015|  3.63k|        if (nNumEndpoints + nFirstEndpointAtNoPos > t_group_info->nNumEndpoints)
  ------------------
  |  Branch (7015:13): [True: 0, False: 3.63k]
  ------------------
 7016|      0|        {
 7017|       |            /*  for debug only */
 7018|      0|            return CT_TAUCOUNT_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   24|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 7019|      0|        }
 7020|  3.63k|        nEndpointAtomNumber = t_group_info->nEndpointAtomNumber + (int) nFirstEndpointAtNoPos;
 7021|  3.63k|        pn_tRankForSort = nRank;
 7022|       |
 7023|  3.63k|        insertions_sort( pn_tRankForSort, nEndpointAtomNumber, nNumEndpoints,
 7024|  3.63k|                         sizeof( nEndpointAtomNumber[0] ), CompRankTautomer );
 7025|  3.63k|    }
 7026|       |
 7027|       |    /*  Sort the tautomeric groups according to their ranks only
 7028|       |    (that is, ignoring the isotopic composition of the mobile groups and ranks of the endpoints) */
 7029|  3.52k|    if (t_group_info->num_t_groups > 1)
  ------------------
  |  Branch (7029:9): [True: 115, False: 3.40k]
  ------------------
 7030|    115|    {
 7031|       |        /*  Set globals for sorting */
 7032|       |        /*  a hack: the ranks of all tautomeric groups are */
 7033|       |        /*  located at nRank[num_atoms..num_at_tg-1] */
 7034|    115|        pn_tRankForSort = nRank + num_atoms;
 7035|       |        /*  Sort */
 7036|       |        /*  ordering numbers to sort : t_group_info->tGroupNumber; */
 7037|       |
 7038|    115|        insertions_sort( pn_tRankForSort, t_group_info->tGroupNumber,
 7039|    115|                         num_t_groups, sizeof( t_group_info->tGroupNumber[0] ),
 7040|    115|                         CompRankTautomer );
 7041|    115|    }
 7042|       |
 7043|  3.52k|    return t_group_info->num_t_groups;
 7044|  3.52k|}

base26_triplet_1:
 1139|  12.6k|{
 1140|  12.6k|    UINT32 b0, b1, h;
 1141|  12.6k|    b0 = (UINT32) a[0];             /* 1111 1111  */
 1142|  12.6k|#ifndef FIX_BASE26_ENC_BUG
 1143|  12.6k|    b1 = (UINT32) ( a[1] & 0x3f );  /* 0011 1111  */
 1144|  12.6k|    h = (UINT32) ( b0 | b1 << 8 );
 1145|       |#else
 1146|       |    b1 = (UINT32) ( a[1] & 0xfc );  /* 1111 1100  */
 1147|       |    h = (UINT32) ( b0 << 8 | b1 ) >> 2;
 1148|       |#endif
 1149|  12.6k|    return t26[h];
 1150|  12.6k|}
base26_triplet_2:
 1157|  12.6k|{
 1158|  12.6k|    UINT32 b0, b1, b2, h;
 1159|  12.6k|#ifndef FIX_BASE26_ENC_BUG
 1160|  12.6k|    b0 = (UINT32) ( a[1] & 0xc0 );   /* 1100 0000  */
 1161|  12.6k|    b1 = (UINT32) ( a[2] );         /* 1111 1111  */
 1162|  12.6k|    b2 = (UINT32) ( a[3] & 0x0f );  /* 0000 1111  */
 1163|  12.6k|    h = (UINT32) ( b0 | b1 << 8 | b2 << 16 ) >> 6;
 1164|       |#else
 1165|       |    b0 = (UINT32) ( a[1] & 0x03 );   /* 0000 0011 */
 1166|       |    b1 = (UINT32) ( a[2] );         /* 1111 1111 */
 1167|       |    b2 = (UINT32) ( a[3] & 0xf0 );  /* 1111 0000 */
 1168|       |    h = (UINT32) ( b0 << 16 | b1 << 8 | b2 ) >> 4;
 1169|       |#endif
 1170|  12.6k|    return t26[h];
 1171|  12.6k|}
base26_triplet_3:
 1178|  6.32k|{
 1179|  6.32k|    UINT32 b0, b1, b2, h;
 1180|  6.32k|#ifndef FIX_BASE26_ENC_BUG
 1181|  6.32k|    b0 = (UINT32) ( a[3] & 0xf0 );   /* 1111 0000  */
 1182|  6.32k|    b1 = (UINT32) ( a[4] );         /* 1111 1111  */
 1183|  6.32k|    b2 = (UINT32) ( a[5] & 0x03 );  /* 0000 0011  */
 1184|  6.32k|    h = (UINT32) ( b0 | b1 << 8 | b2 << 16 ) >> 4;
 1185|       |#else
 1186|       |    b0 = (UINT32) ( a[3] & 0x0f );   /* 0000 1111 */
 1187|       |    b1 = (UINT32) ( a[4] );         /* 1111 1111  */
 1188|       |    b2 = (UINT32) ( a[5] & 0xc0 );  /* 1100 0000  */
 1189|       |    h = (UINT32) ( b0 << 16 | b1 << 8 | b2 ) >> 6;
 1190|       |#endif
 1191|  6.32k|    return t26[h];
 1192|  6.32k|}
base26_triplet_4:
 1199|  6.32k|{
 1200|  6.32k|    UINT32 b0, b1, h;
 1201|  6.32k|#ifndef FIX_BASE26_ENC_BUG
 1202|  6.32k|    b0 = (UINT32) ( a[5] & 0xfc );   /* 1111 1100  */
 1203|  6.32k|    b1 = (UINT32) ( a[6] );         /* 1111 1111  */
 1204|  6.32k|    h = (UINT32) ( b0 | b1 << 8 ) >> 2;
 1205|       |#else
 1206|       |    b0 = (UINT32) ( a[5] & 0x3f );   /* 0011 1111  */
 1207|       |    b1 = (UINT32) ( a[6] );         /* 1111 1111  */
 1208|       |    h = (UINT32) ( b0 << 8 | b1 );
 1209|       |#endif
 1210|  6.32k|    return t26[h];
 1211|  6.32k|}
base26_dublet_for_bits_28_to_36:
 1228|  6.32k|{
 1229|  6.32k|    UINT32 b0, b1, h;
 1230|  6.32k|#ifndef FIX_BASE26_ENC_BUG
 1231|  6.32k|    b0 = (UINT32) ( a[3] & 0xf0 );    /* 1111 0000  */
 1232|  6.32k|    b1 = (UINT32) ( a[4] & 0x1f );    /* 0001 1111  */
 1233|  6.32k|    h = (UINT32) ( b0 | b1 << 8 ) >> 4;
 1234|       |#else
 1235|       |    b0 = (UINT32) ( a[3] & 0x0f );    /* 0000 1111  */
 1236|       |    b1 = (UINT32) ( a[4] & 0xf8 );    /* 1111 1000  */
 1237|       |    h = (UINT32) ( b0 << 8 | b1 ) >> 3;
 1238|       |#endif
 1239|  6.32k|    return d26[h];
 1240|  6.32k|}
base26_dublet_for_bits_56_to_64:
 1253|  6.32k|{
 1254|  6.32k|    UINT32 b0, b1, h;
 1255|  6.32k|#ifndef FIX_BASE26_ENC_BUG
 1256|  6.32k|    b0 = (UINT32) ( a[7] );            /* 1111 1111  */
 1257|  6.32k|    b1 = (UINT32) ( a[8] & 0x01 );    /* 0000 0001  */
 1258|  6.32k|    h = (UINT32) ( b0 | b1 << 8 );
 1259|       |#else
 1260|       |    b0 = (UINT32) ( a[7] );            /* 1111 1111  */
 1261|       |    b1 = (UINT32) ( a[8] & 0x80 );    /* 1000 0000  */
 1262|       |    h = (UINT32) ( b0 << 8 | b1 ) >> 7;
 1263|       |#endif
 1264|  6.32k|    return d26[h];
 1265|  6.32k|}

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

CreateInpAtom:
 1121|   648k|{
 1122|   648k|    void *p = NULL;
 1123|   648k|    if (num_atoms >= 0)
  ------------------
  |  Branch (1123:9): [True: 648k, False: 0]
  ------------------
 1124|   648k|    {
 1125|   648k|        p = inchi_calloc(num_atoms, sizeof(inp_ATOM));
  ------------------
  |  | 1146|   648k|#define inchi_calloc   calloc
  ------------------
 1126|   648k|    }
 1127|       |
 1128|       |    // void *p = inchi_calloc(num_atoms, sizeof(inp_ATOM));
 1129|   648k|    return (inp_ATOM *)p;
 1130|   648k|}
FreeInpAtom:
 1134|  3.33M|{
 1135|  3.33M|    if (at && *at)
  ------------------
  |  Branch (1135:9): [True: 3.33M, False: 0]
  |  Branch (1135:15): [True: 790k, False: 2.54M]
  ------------------
 1136|   790k|    {
 1137|   790k|        inchi_free(*at);
  ------------------
  |  | 1152|   790k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 790k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 790k]
  |  |  ------------------
  ------------------
 1138|   790k|        *at = NULL;
 1139|   790k|    }
 1140|       |
 1141|  3.33M|    return;
 1142|  3.33M|}
FreeInpAtomData:
 1146|  1.47M|{
 1147|  1.47M|    if (inp_at_data)
  ------------------
  |  Branch (1147:9): [True: 1.33M, False: 144k]
  ------------------
 1148|  1.33M|    {
 1149|  1.33M|        FreeInpAtom(&inp_at_data->at);
 1150|  1.33M|        FreeInpAtom(&inp_at_data->at_fixed_bonds);
 1151|       |
 1152|       |        /*@nnuk*/
 1153|  1.33M|        if (inp_at_data->keep_explicit_HDT)
  ------------------
  |  Branch (1153:13): [True: 0, False: 1.33M]
  ------------------
 1154|      0|        {
 1155|      0|            inchi_free(inp_at_data->keep_explicit_HDT);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1156|      0|            inp_at_data->keep_explicit_HDT = NULL;
 1157|      0|        }
 1158|       |
 1159|  1.33M|        memset(inp_at_data, 0, sizeof(*inp_at_data)); /* djb-rwth: memset_s C11/Annex K variant? */
 1160|  1.33M|    }
 1161|       |
 1162|  1.47M|    return;
 1163|  1.47M|}
CreateInpAtomData:
 1169|   395k|{
 1170|   395k|    FreeInpAtomData(inp_at_data);
 1171|       |
 1172|   395k|    if ((inp_at_data->at = CreateInpAtom(num_atoms)) &&
  ------------------
  |  Branch (1172:9): [True: 395k, False: 0]
  ------------------
 1173|   395k|        (!create_at_fixed_bonds || (inp_at_data->at_fixed_bonds = CreateInpAtom(num_atoms))))
  ------------------
  |  Branch (1173:10): [True: 143k, False: 252k]
  |  Branch (1173:36): [True: 252k, False: 0]
  ------------------
 1174|   395k|    {
 1175|   395k|        inp_at_data->num_at = num_atoms;
 1176|   395k|        return 1;
 1177|   395k|    }
 1178|       |
 1179|      0|    FreeInpAtomData(inp_at_data);
 1180|       |
 1181|      0|    return 0;
 1182|   395k|}
FreeCompAtomData:
 1186|   423k|{
 1187|   423k|    FreeInpAtom(&inp_at_data->at);
 1188|       |
 1189|   423k|    if (inp_at_data->nOffsetAtAndH)
  ------------------
  |  Branch (1189:9): [True: 820, False: 422k]
  ------------------
 1190|    820|    {
 1191|    820|        inchi_free(inp_at_data->nOffsetAtAndH);
  ------------------
  |  | 1152|    820|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 820, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 820]
  |  |  ------------------
  ------------------
 1192|    820|    }
 1193|   423k|    memset(inp_at_data, 0, sizeof(*inp_at_data)); /* djb-rwth: memset_s C11/Annex K variant? */
 1194|   423k|}
FreeOrigAtData:
 1320|   211k|{
 1321|   211k|    if (!orig_at_data)
  ------------------
  |  Branch (1321:9): [True: 0, False: 211k]
  ------------------
 1322|      0|    {
 1323|      0|        return;
 1324|      0|    }
 1325|       |
 1326|   211k|    FreeInpAtom(&orig_at_data->at);
 1327|       |
 1328|   211k|    if (orig_at_data->nCurAtLen)
  ------------------
  |  Branch (1328:9): [True: 70.4k, False: 140k]
  ------------------
 1329|  70.4k|    {
 1330|  70.4k|        inchi_free(orig_at_data->nCurAtLen);
  ------------------
  |  | 1152|  70.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 70.4k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 70.4k]
  |  |  ------------------
  ------------------
 1331|  70.4k|    }
 1332|       |
 1333|   211k|    if (orig_at_data->nOldCompNumber)
  ------------------
  |  Branch (1333:9): [True: 70.4k, False: 140k]
  ------------------
 1334|  70.4k|    {
 1335|  70.4k|        inchi_free(orig_at_data->nOldCompNumber);
  ------------------
  |  | 1152|  70.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 70.4k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 70.4k]
  |  |  ------------------
  ------------------
 1336|  70.4k|    }
 1337|       |
 1338|   211k|    if (orig_at_data->szCoord)
  ------------------
  |  Branch (1338:9): [True: 0, False: 211k]
  ------------------
 1339|      0|    {
 1340|      0|        inchi_free(orig_at_data->szCoord);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1341|      0|    }
 1342|       |
 1343|   211k|    if (orig_at_data->nEquLabels)
  ------------------
  |  Branch (1343:9): [True: 0, False: 211k]
  ------------------
 1344|      0|    {
 1345|      0|        inchi_free(orig_at_data->nEquLabels);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1346|      0|    }
 1347|       |
 1348|   211k|    if (orig_at_data->nSortedOrder)
  ------------------
  |  Branch (1348:9): [True: 0, False: 211k]
  ------------------
 1349|      0|    {
 1350|      0|        inchi_free(orig_at_data->nSortedOrder);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1351|      0|    }
 1352|       |
 1353|       |    /* v 1.05 */
 1354|   211k|    FreeExtOrigAtData(orig_at_data->polymer, orig_at_data->v3000);
 1355|       |
 1356|   211k|    memset(orig_at_data, 0, sizeof(*orig_at_data)); /* djb-rwth: memset_s C11/Annex K variant? */
 1357|       |
 1358|   211k|    return;
 1359|   211k|}
FreeExtOrigAtData:
 1365|   231k|{
 1366|   231k|    int k;
 1367|       |
 1368|   231k|    OAD_Polymer_Free(pd);
 1369|   231k|    pd = NULL;
 1370|       |
 1371|   231k|    if (v3k)
  ------------------
  |  Branch (1371:9): [True: 0, False: 231k]
  ------------------
 1372|      0|    {
 1373|      0|        if (v3k->atom_index_orig)
  ------------------
  |  Branch (1373:13): [True: 0, False: 0]
  ------------------
 1374|      0|        {
 1375|      0|            inchi_free(v3k->atom_index_orig);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1376|      0|            v3k->atom_index_orig = NULL;
 1377|      0|        }
 1378|      0|        if (v3k->atom_index_fin)
  ------------------
  |  Branch (1378:13): [True: 0, False: 0]
  ------------------
 1379|      0|        {
 1380|      0|            inchi_free(v3k->atom_index_fin);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1381|      0|            v3k->atom_index_fin = NULL;
 1382|      0|        }
 1383|      0|        if (v3k->n_haptic_bonds && v3k->lists_haptic_bonds)
  ------------------
  |  Branch (1383:13): [True: 0, False: 0]
  |  Branch (1383:36): [True: 0, False: 0]
  ------------------
 1384|      0|        {
 1385|      0|            for (k = 0; k < v3k->n_haptic_bonds; k++)
  ------------------
  |  Branch (1385:25): [True: 0, False: 0]
  ------------------
 1386|      0|                if (v3k->lists_haptic_bonds[k])
  ------------------
  |  Branch (1386:21): [True: 0, False: 0]
  ------------------
 1387|      0|                {
 1388|      0|                    inchi_free(v3k->lists_haptic_bonds[k]);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1389|      0|                    v3k->lists_haptic_bonds[k] = NULL;
 1390|      0|                }
 1391|      0|            inchi_free(v3k->lists_haptic_bonds);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1392|      0|            v3k->lists_haptic_bonds = NULL;
 1393|      0|        }
 1394|      0|        if (v3k->n_steabs && v3k->lists_steabs)
  ------------------
  |  Branch (1394:13): [True: 0, False: 0]
  |  Branch (1394:30): [True: 0, False: 0]
  ------------------
 1395|      0|        {
 1396|      0|            for (k = 0; k < v3k->n_steabs; k++)
  ------------------
  |  Branch (1396:25): [True: 0, False: 0]
  ------------------
 1397|      0|                if (v3k->lists_steabs[k])
  ------------------
  |  Branch (1397:21): [True: 0, False: 0]
  ------------------
 1398|      0|                {
 1399|      0|                    inchi_free(v3k->lists_steabs[k]);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1400|      0|                    v3k->lists_steabs[k] = NULL;
 1401|      0|                }
 1402|      0|            inchi_free(v3k->lists_steabs);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1403|      0|            v3k->lists_steabs = NULL;
 1404|      0|        }
 1405|      0|        if (v3k->n_sterel && v3k->lists_sterel)
  ------------------
  |  Branch (1405:13): [True: 0, False: 0]
  |  Branch (1405:30): [True: 0, False: 0]
  ------------------
 1406|      0|        {
 1407|      0|            for (k = 0; k < v3k->n_sterel; k++)
  ------------------
  |  Branch (1407:25): [True: 0, False: 0]
  ------------------
 1408|      0|                if (v3k->lists_sterel[k])
  ------------------
  |  Branch (1408:21): [True: 0, False: 0]
  ------------------
 1409|      0|                {
 1410|      0|                    inchi_free(v3k->lists_sterel[k]);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1411|      0|                    v3k->lists_sterel[k] = NULL;
 1412|      0|                }
 1413|      0|            inchi_free(v3k->lists_sterel);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1414|      0|            v3k->lists_sterel = NULL;
 1415|      0|        }
 1416|      0|        if (v3k->n_sterac && v3k->lists_sterac)
  ------------------
  |  Branch (1416:13): [True: 0, False: 0]
  |  Branch (1416:30): [True: 0, False: 0]
  ------------------
 1417|      0|        {
 1418|      0|            for (k = 0; k < v3k->n_sterac; k++)
  ------------------
  |  Branch (1418:25): [True: 0, False: 0]
  ------------------
 1419|      0|                if (v3k->lists_sterac[k])
  ------------------
  |  Branch (1419:21): [True: 0, False: 0]
  ------------------
 1420|      0|                {
 1421|      0|                    inchi_free(v3k->lists_sterac[k]);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1422|      0|                    v3k->lists_sterac[k] = NULL;
 1423|      0|                }
 1424|      0|            inchi_free(v3k->lists_sterac);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1425|      0|            v3k->lists_sterac = NULL;
 1426|      0|        }
 1427|      0|        memset(v3k, 0, sizeof(*v3k)); /* djb-rwth: memset_s C11/Annex K variant? */
 1428|      0|        inchi_free(v3k);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1429|      0|    }
 1430|       |
 1431|   231k|    return;
 1432|   231k|}

IntArray_Alloc:
  476|  1.78k|{
  477|  1.78k|    if ((items->item = (int *)inchi_calloc(nitems, sizeof(int)))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  | 1146|  1.78k|#define inchi_calloc   calloc
  ------------------
  |  Branch (477:9): [True: 1.78k, False: 0]
  ------------------
  478|  1.78k|    {
  479|  1.78k|        items->increment = items->allocated = nitems;
  480|  1.78k|        items->used = 0;
  481|  1.78k|        return 0;
  482|  1.78k|    }
  483|       |
  484|      0|    return -1;
  485|  1.78k|}
IntArray_ReAlloc:
  491|    762|{
  492|    762|    if (items)
  ------------------
  |  Branch (492:9): [True: 762, False: 0]
  ------------------
  493|    762|    {
  494|    762|        if (items->item && items->allocated > 0 && items->increment > 0)
  ------------------
  |  Branch (494:13): [True: 762, False: 0]
  |  Branch (494:28): [True: 762, False: 0]
  |  Branch (494:52): [True: 762, False: 0]
  ------------------
  495|    762|        {
  496|    762|            void *p = items->item;
  497|    762|            if ((items->item =
  ------------------
  |  Branch (497:17): [True: 762, False: 0]
  ------------------
  498|    762|                     (int *)inchi_calloc((long long)items->allocated + (long long)items->increment, sizeof(items->item[0])))) /* djb-rwth: cast operators added; addressing LLVM warning */
  ------------------
  |  | 1146|    762|#define inchi_calloc   calloc
  ------------------
  499|    762|            {
  500|    762|                memcpy(items->item, p, items->used * sizeof(items->item[0]));
  501|    762|                inchi_free(p);
  ------------------
  |  | 1152|    762|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 762, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 762]
  |  |  ------------------
  ------------------
  502|    762|                items->allocated += items->increment;
  503|    762|                return 0;
  504|    762|            }
  505|      0|            inchi_free(p);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  506|      0|        }
  507|    762|    }
  508|       |
  509|      0|    return -1;
  510|    762|}
IntArray_Append:
  516|  7.83k|{
  517|  7.83k|    if (items)
  ------------------
  |  Branch (517:9): [True: 7.83k, False: 0]
  ------------------
  518|  7.83k|    {
  519|  7.83k|        if (items->used + 1 > items->allocated)
  ------------------
  |  Branch (519:13): [True: 762, False: 7.06k]
  ------------------
  520|    762|        {
  521|       |            /* need to expand buffer */
  522|    762|            if (IntArray_ReAlloc(items))
  ------------------
  |  Branch (522:17): [True: 0, False: 762]
  ------------------
  523|      0|            {
  524|      0|                return -1;
  525|      0|            }
  526|    762|        }
  527|  7.83k|        items->item[items->used++] = new_item;
  528|  7.83k|        return 0;
  529|  7.83k|    }
  530|       |
  531|      0|    return -1;
  532|  7.83k|}
IntArray_Reset:
  569|  1.29k|{
  570|  1.29k|    items->used = 0;
  571|  1.29k|    return;
  572|  1.29k|}
IntArray_Free:
  576|  1.78k|{
  577|  1.78k|    if (items)
  ------------------
  |  Branch (577:9): [True: 1.78k, False: 0]
  ------------------
  578|  1.78k|    {
  579|  1.78k|        if (items->item)
  ------------------
  |  Branch (579:13): [True: 1.78k, False: 0]
  ------------------
  580|  1.78k|        {
  581|  1.78k|            inchi_free(items->item);
  ------------------
  |  | 1152|  1.78k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 1.78k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 1.78k]
  |  |  ------------------
  ------------------
  582|  1.78k|        }
  583|  1.78k|        memset(items, 0, sizeof(*items)); /* djb-rwth: memset_s C11/Annex K variant? */
  584|  1.78k|    }
  585|  1.78k|    return;
  586|  1.78k|}

ProcessOneStructure:
  199|  70.4k|{
  200|  70.4k|    int nRet = 0,
  201|  70.4k|        nRet1, i, k,
  202|  70.4k|        maxINChI = 0,
  203|  70.4k|        bSortPrintINChIFlags = 0;
  204|  70.4k|    COMP_ATOM_DATA
  205|  70.4k|        composite_norm_data[INCHI_NUM][TAUT_NUM + 1];    /*    [0]:non-taut,
  206|       |                                                        [1]:taut,
  207|       |                                                        [2]:intermediate taut struct */
  208|  70.4k|    NORM_CANON_FLAGS ncFlags;
  209|  70.4k|    NORM_CANON_FLAGS* pncFlags = &ncFlags;
  210|  70.4k|    ORIG_STRUCT OrigStruct;
  211|  70.4k|    ORIG_STRUCT* pOrigStruct = NULL;
  212|  70.4k|    int err, ret1 = 0;
  213|       |
  214|       |    /* djb-rwth: removing redundant code */
  215|       |#ifdef GHI100_FIX
  216|       |#if ((SPRINTF_FLAG != 1) && (SPRINTF_FLAG != 2))
  217|       |    setlocale(LC_ALL, "en-US"); /* djb-rwth: setting all locales to "en-US" */
  218|       |#endif
  219|       |#endif
  220|       |
  221|       |    /*    1. Preliminary work */
  222|       |
  223|       |    /* djb-rwth: fixing coverity ID #499508 */
  224|  70.4k|    if (!orig_inp_data)
  ------------------
  |  Branch (224:9): [True: 0, False: 70.4k]
  ------------------
  225|      0|    {
  226|      0|        goto exit_function;
  227|      0|    }
  228|       |
  229|  70.4k|    int is_polymer = orig_inp_data->valid_polymer
  ------------------
  |  Branch (229:22): [True: 0, False: 70.4k]
  ------------------
  230|      0|                     && orig_inp_data->polymer
  ------------------
  |  Branch (230:25): [True: 0, False: 0]
  ------------------
  231|      0|                     && orig_inp_data->polymer->n ;
  ------------------
  |  Branch (231:25): [True: 0, False: 0]
  ------------------
  232|       |
  233|  70.4k|    int is_polymer2inchi = is_polymer && (ip->nInputType == INPUT_MOLFILE || ip->nInputType == INPUT_SDFILE);
  ------------------
  |  Branch (233:28): [True: 0, False: 70.4k]
  |  Branch (233:43): [True: 0, False: 0]
  |  Branch (233:78): [True: 0, False: 0]
  ------------------
  234|       |
  235|  70.4k|    sd->bUserQuitComponent = 0;
  236|  70.4k|    sd->bUserQuitComponentDisplay = 0;
  237|  70.4k|    memset(composite_norm_data, 0, sizeof(composite_norm_data)); /* djb-rwth: memset_s C11/Annex K variant? */
  238|  70.4k|    memset(pncFlags, 0, sizeof(*pncFlags)); /* djb-rwth: memset_s C11/Annex K variant? */
  239|       |
  240|       |
  241|       |
  242|       |    /* For experimental purposes only */
  243|       |    /*ret1 = DoOneStructureEarlyPreprocessing( num_inp, sd, ip, inp_file,
  244|       |                                             log_file, out_file, prb_file,
  245|       |                                             orig_inp_data, prep_inp_data );
  246|       |    */
  247|  70.4k|    ret1 = DoOneStructureEarlyPreprocessing(ic, pCG, num_inp, sd, ip,
  248|  70.4k|        inp_file, log_file, out_file, prb_file,
  249|  70.4k|        orig_inp_data, prep_inp_data);
  250|  70.4k|    switch ( ret1 )
  ------------------
  |  Branch (250:14): [True: 0, False: 70.4k]
  ------------------
  251|  70.4k|    {
  252|      0|    case _IS_SKIP:
  ------------------
  |  |   16|      0|#define _IS_SKIP   -2
  ------------------
  |  Branch (252:5): [True: 0, False: 70.4k]
  ------------------
  253|      0|    case _IS_ERROR:
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (253:5): [True: 0, False: 70.4k]
  ------------------
  254|      0|    case _IS_FATAL:
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
  |  Branch (254:5): [True: 0, False: 70.4k]
  ------------------
  255|      0|        nRet = ret1;
  256|  70.4k|    }
  257|       |
  258|  70.4k|    if ( ret1 )
  ------------------
  |  Branch (258:10): [True: 0, False: 70.4k]
  ------------------
  259|      0|    {
  260|      0|        goto exit_function;
  261|      0|    }
  262|       |
  263|       |    /*(@nnuk : Nauman Ullah Khan)
  264|       |     *invoking Molecular Inorganics preprocessing (if flag is active)
  265|       |     */
  266|  70.4k|    if ( ip->bMolecularInorganics && nRet != _IS_FATAL && nRet != _IS_ERROR )
  ------------------
  |  |   13|   140k|#define _IS_FATAL   3
  ------------------
                  if ( ip->bMolecularInorganics && nRet != _IS_FATAL && nRet != _IS_ERROR )
  ------------------
  |  |   12|  70.4k|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (266:10): [True: 70.4k, False: 0]
  |  Branch (266:38): [True: 70.4k, False: 0]
  |  Branch (266:59): [True: 70.4k, False: 0]
  ------------------
  267|  70.4k|    {
  268|       |        /* Capture the native input as OrigStruct before MolecularInorganicsPreprocessing()
  269|       |         * disconnects bonds in orig_inp_data. This mirrors the standard path (where
  270|       |         * orig_inp_data stays pristine because preprocessing works on a copy) so the
  271|       |         * AuxInfo reversibility layers (/rA, /rB, /rC), including atom coordinates,
  272|       |         * describe the original drawn structure. */
  273|  70.4k|        pOrigStruct = &OrigStruct;
  274|  70.4k|        memset(pOrigStruct, 0, sizeof(*pOrigStruct));
  275|  70.4k|        OrigAtData_StoreNativeInput(pCG, &nRet, sd, ip, orig_inp_data, pOrigStruct);
  276|  70.4k|        if ( nRet == _IS_FATAL || nRet == _IS_ERROR )
  ------------------
  |  |   13|   140k|#define _IS_FATAL   3
  ------------------
                      if ( nRet == _IS_FATAL || nRet == _IS_ERROR )
  ------------------
  |  |   12|  70.4k|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (276:14): [True: 0, False: 70.4k]
  |  Branch (276:35): [True: 0, False: 70.4k]
  ------------------
  277|      0|        {
  278|       |            /* Route to the shared cleanup so OrigStruct_Free() releases pOrigStruct */
  279|      0|            goto after_structure_generation;
  280|      0|        }
  281|       |
  282|       |        /* Call the MolecularInorganicsPreprocessing function to handle specific inorganics-related tasks */
  283|  70.4k|        ret1 = MolecularInorganicsPreprocessing(orig_inp_data, ip);
  284|       |
  285|       |        /* Check for errors during preprocessing */
  286|  70.4k|        if ( ret1 < 0 )
  ------------------
  |  Branch (286:14): [True: 0, False: 70.4k]
  ------------------
  287|      0|        {
  288|       |            /* Log and handle fatal error in molecular inorganics preprocessing */
  289|      0|            fprintf(stderr, "Error during Molecular Inorganics preprocessing\n");
  290|      0|            AddErrorMessage(sd->pStrErrStruct, "Molecular Inorganics preprocessing failed");
  291|      0|            nRet = _IS_FATAL;
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
  292|      0|            goto exit_function;
  293|      0|        }
  294|       |
  295|       |        /* Preserve SDF output in Molecular Inorganics mode if requested */
  296|  70.4k|        ret1 = OrigAtData_SaveMolfile(orig_inp_data, sd, ip, num_inp, out_file);
  297|  70.4k|        if (ret1)
  ------------------
  |  Branch (297:13): [True: 0, False: 70.4k]
  ------------------
  298|      0|        {
  299|      0|            goto exit_function;
  300|      0|        }
  301|       |
  302|  70.4k|        nRet1 = CreateOneStructureINChI(pCG, ic, sd, ip, szTitle,
  303|  70.4k|            pINChI, pINChI_Aux, INCHI_BAS,
  ------------------
  |  |  570|  70.4k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  304|  70.4k|            inp_file, log_file, out_file, prb_file,
  305|  70.4k|            orig_inp_data, prep_inp_data,
  306|  70.4k|            composite_norm_data,
  307|  70.4k|            num_inp, strbuf, pncFlags);
  308|  70.4k|        nRet = inchi_max(nRet, nRet1);
  ------------------
  |  |  138|  70.4k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 70.4k]
  |  |  ------------------
  ------------------
  309|       |
  310|       |        /* If preprocessing indicates we need a reconnected InChI, create it here */
  311|  70.4k|        if ( ip->bMolecularInorganicsReconnectedInChI && nRet != _IS_FATAL &&
  ------------------
  |  |   13|  76.8k|#define _IS_FATAL   3
  ------------------
  |  Branch (311:14): [True: 6.41k, False: 64.0k]
  |  Branch (311:58): [True: 6.41k, False: 2]
  ------------------
  312|  6.41k|            nRet != _IS_ERROR &&
  ------------------
  |  |   12|  76.8k|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (312:13): [True: 6.41k, False: 0]
  ------------------
  313|  6.41k|            (sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE) &&
  ------------------
  |  |  570|  6.41k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          (sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE) &&
  ------------------
  |  |  975|  6.41k|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
  |  Branch (313:13): [True: 0, False: 6.41k]
  ------------------
  314|      0|            (ip->bTautFlags & TG_FLAG_RECONNECT_COORD) )
  ------------------
  |  |  932|      0|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  |  Branch (314:13): [True: 0, False: 0]
  ------------------
  315|      0|        {
  316|       |
  317|      0|            nRet1 = CreateOneStructureINChI(pCG, ic, sd, ip, szTitle,
  318|      0|                pINChI, pINChI_Aux, INCHI_REC,
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  319|      0|                inp_file, log_file, out_file, prb_file,
  320|      0|                orig_inp_data, prep_inp_data,
  321|      0|                composite_norm_data,
  322|      0|                num_inp, strbuf, pncFlags);
  323|      0|            nRet = inchi_max(nRet, nRet1);
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  324|       |
  325|      0|            if ( nRet1 == _IS_FATAL || nRet1 == _IS_ERROR )
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
                          if ( nRet1 == _IS_FATAL || nRet1 == _IS_ERROR )
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (325:18): [True: 0, False: 0]
  |  Branch (325:40): [True: 0, False: 0]
  ------------------
  326|      0|            {
  327|      0|                fprintf(stderr, "Error during reconnected InChI generation.\n");
  328|      0|                goto exit_function;
  329|      0|            }
  330|       |
  331|      0|            if ( nRet != _IS_FATAL && nRet != _IS_ERROR )
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
                          if ( nRet != _IS_FATAL && nRet != _IS_ERROR )
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (331:18): [True: 0, False: 0]
  |  Branch (331:39): [True: 0, False: 0]
  ------------------
  332|      0|            {
  333|      0|                maxINChI = 2;  /* Update to indicate reconnected InChI has been generated */
  334|      0|            }
  335|      0|        }
  336|       |
  337|  70.4k|        else if (nRet != _IS_FATAL && nRet != _IS_ERROR)
  ------------------
  |  |   13|   140k|#define _IS_FATAL   3
  ------------------
                      else if (nRet != _IS_FATAL && nRet != _IS_ERROR)
  ------------------
  |  |   12|  70.4k|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (337:18): [True: 70.4k, False: 2]
  |  Branch (337:39): [True: 70.4k, False: 2]
  ------------------
  338|  70.4k|        {
  339|  70.4k|            maxINChI = 1;
  340|  70.4k|        }
  341|       |
  342|       |        /*
  343|       |         * InChI is already generated via the Molecular Inorganics-specific path.
  344|       |         * Skip the standard structure-generation path to prevent duplicate
  345|       |         * CreateOneStructureINChI() calls and redundant allocations.
  346|       |         *
  347|       |         * pOrigStruct and OrigStruct were populated above from the native input, so the shared
  348|       |         * cleanup path (SortAndPrintINChI + OrigStruct_Free) emits the AuxInfo
  349|       |         * reversibility layers (/rA, /rB, /rC), including atom coordinates, and
  350|       |         * releases it.
  351|       |         */
  352|  70.4k|        goto after_structure_generation;
  353|  70.4k|    }
  354|       |
  355|       |
  356|      0|    if ( is_polymer )
  ------------------
  |  Branch (356:10): [True: 0, False: 0]
  ------------------
  357|      0|    {
  358|       |        /* Polymer house-keeping related to possible CRU frame shift(s) */
  359|       |
  360|      0|        orig_inp_data->polymer->frame_shift_scheme = ip->bFrameShiftScheme;
  361|      0|        orig_inp_data->polymer->treat = ip->bPolymers;
  362|       |
  363|      0|        if ( !is_polymer2inchi )
  ------------------
  |  Branch (363:14): [True: 0, False: 0]
  ------------------
  364|      0|        {
  365|       |            /* Polymer structure is being restored from InChI string            */
  366|       |            /* If CRUs were pre-cyclized, re-open them in preferred forms here  */
  367|      0|            if ( orig_inp_data->polymer->frame_shift_scheme == FSS_STARS_CYCLED )
  ------------------
  |  Branch (367:18): [True: 0, False: 0]
  ------------------
  368|      0|            {
  369|      0|                OAD_Polymer_SmartReopenCyclizedUnits(orig_inp_data->polymer,
  370|      0|                    orig_inp_data->at,
  371|      0|                    orig_inp_data->num_inp_atoms,
  372|      0|                    &orig_inp_data->num_inp_bonds);
  373|      0|            }
  374|      0|        }
  375|      0|    }
  376|       |
  377|       |
  378|      0|    ret1 = OrigAtData_SaveMolfile(orig_inp_data, sd, ip, num_inp, out_file);
  379|      0|    if ( ret1 )
  ------------------
  |  Branch (379:10): [True: 0, False: 0]
  ------------------
  380|      0|    {
  381|      0|        goto exit_function;
  382|      0|    }
  383|       |
  384|       |
  385|      0|    pOrigStruct = &OrigStruct;
  386|      0|    memset(pOrigStruct, 0, sizeof(*pOrigStruct)); /* djb-rwth: memset_s C11/Annex K variant? */
  387|       |
  388|      0|    OrigAtData_StoreNativeInput(pCG, &nRet, sd, ip, orig_inp_data, pOrigStruct);
  389|       |
  390|       |    /*    2. Create INChI for the whole disconnected or original structure */
  391|       |
  392|      0|    if ( nRet != _IS_FATAL && nRet != _IS_ERROR )
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
                  if ( nRet != _IS_FATAL && nRet != _IS_ERROR )
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (392:10): [True: 0, False: 0]
  |  Branch (392:31): [True: 0, False: 0]
  ------------------
  393|      0|    {
  394|      0|        nRet1 = CreateOneStructureINChI(pCG, ic, sd, ip, szTitle,
  395|      0|            pINChI, pINChI_Aux, INCHI_BAS,
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  396|      0|            inp_file, log_file, out_file, prb_file,
  397|      0|            orig_inp_data, prep_inp_data,
  398|      0|            composite_norm_data,
  399|      0|            num_inp, strbuf, pncFlags);
  400|      0|        nRet = inchi_max(nRet, nRet1);
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  401|       |
  402|       |        /* If we create InChI from polymer-containing structure */
  403|      0|        if ( is_polymer2inchi )
  ------------------
  |  Branch (403:14): [True: 0, False: 0]
  ------------------
  404|      0|        {
  405|      0|            int polymer_repr_type = OAD_Polymer_GetRepresentation(orig_inp_data->polymer);
  406|       |
  407|      0|#ifdef ALLOW_MIXED_SRU_AND_MON
  408|      0|            if ( polymer_repr_type == POLYMER_REPRESENTATION_STRUCTURE_BASED ||
  ------------------
  |  |  173|      0|#define POLYMER_REPRESENTATION_STRUCTURE_BASED 2
  ------------------
  |  Branch (408:18): [True: 0, False: 0]
  ------------------
  409|      0|                polymer_repr_type == POLYMER_REPRESENTATION_MIXED )
  ------------------
  |  |  174|      0|#define POLYMER_REPRESENTATION_MIXED 3
  ------------------
  |  Branch (409:17): [True: 0, False: 0]
  ------------------
  410|       |#else
  411|       |            if ( polymer_repr_type == POLYMER_REPRESENTATION_STRUCTURE_BASED )
  412|       |#endif
  413|      0|            {
  414|       |                /* Temporarily copy ptr to polymer data to prep_inp_data */
  415|      0|                OAD_Polymer* prep_polymer = prep_inp_data->polymer; /* may be NULL */
  416|      0|                prep_inp_data->polymer = orig_inp_data->polymer;
  417|       |
  418|      0|                OAD_Polymer_FindBackbones(prep_inp_data, /* NB: not orig_inp_data! */
  419|      0|                    &(composite_norm_data[INCHI_BAS][TAUT_YES]),
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                                  &(composite_norm_data[INCHI_BAS][TAUT_YES]),
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  420|      0|                    &err, sd->pStrErrStruct);
  421|      0|                if ( err )
  ------------------
  |  Branch (421:22): [True: 0, False: 0]
  ------------------
  422|      0|                {
  423|      0|                    ret1 = _IS_ERROR;
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  424|      0|                }
  425|      0|                nRet = inchi_max(nRet, ret1);
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  426|      0|                prep_inp_data->polymer = prep_polymer;    /* restore temp copied*/
  427|      0|            }
  428|      0|        }
  429|      0|    }
  430|       |
  431|      0|    if ( nRet != _IS_FATAL && nRet != _IS_ERROR )
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
                  if ( nRet != _IS_FATAL && nRet != _IS_ERROR )
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (431:10): [True: 0, False: 0]
  |  Branch (431:31): [True: 0, False: 0]
  ------------------
  432|      0|    {
  433|      0|        maxINChI = 1;
  434|      0|    }
  435|       |
  436|       |
  437|       |    /* 3. Create INChI for the whole metal-reconnected structure */
  438|       |
  439|      0|    if ( nRet != _IS_FATAL &&
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
  |  Branch (439:10): [True: 0, False: 0]
  ------------------
  440|      0|        nRet != _IS_ERROR &&
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (440:9): [True: 0, False: 0]
  ------------------
  441|      0|        (sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE) &&
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      (sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE) &&
  ------------------
  |  |  975|      0|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
  |  Branch (441:9): [True: 0, False: 0]
  ------------------
  442|      0|        (ip->bTautFlags & TG_FLAG_RECONNECT_COORD) )
  ------------------
  |  |  932|      0|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  |  Branch (442:9): [True: 0, False: 0]
  ------------------
  443|      0|    {
  444|       |
  445|      0|        nRet1 = CreateOneStructureINChI(pCG, ic, sd, ip, szTitle,
  446|      0|            pINChI, pINChI_Aux, INCHI_REC, inp_file,
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  447|      0|            log_file, out_file, prb_file,
  448|      0|            orig_inp_data, prep_inp_data,
  449|      0|            composite_norm_data,
  450|      0|            num_inp, strbuf, pncFlags);
  451|      0|        nRet = inchi_max(nRet, nRet1);
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  452|       |
  453|      0|        if ( is_polymer2inchi )
  ------------------
  |  Branch (453:14): [True: 0, False: 0]
  ------------------
  454|      0|        {
  455|      0|            ret1 = 0;
  456|       |            /* temporarily copy ptr to polymer data to prep_inp_data */
  457|      0|            prep_inp_data->polymer = orig_inp_data->polymer;
  458|       |
  459|      0|            OAD_Polymer_FindBackbones(prep_inp_data, /* NB: not orig_inp_data! */
  460|      0|                &(composite_norm_data[INCHI_REC][TAUT_YES]),
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              &(composite_norm_data[INCHI_REC][TAUT_YES]),
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  461|      0|                &err, sd->pStrErrStruct);
  462|      0|            if ( err )
  ------------------
  |  Branch (462:18): [True: 0, False: 0]
  ------------------
  463|      0|            {
  464|      0|                ret1 = _IS_ERROR;
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  465|      0|            }
  466|      0|            nRet = inchi_max(nRet, ret1);
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  467|      0|            prep_inp_data->polymer = NULL;    /* remove temp copied */
  468|      0|        }
  469|      0|        if ( nRet != _IS_FATAL && nRet != _IS_ERROR )
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
                      if ( nRet != _IS_FATAL && nRet != _IS_ERROR )
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (469:14): [True: 0, False: 0]
  |  Branch (469:35): [True: 0, False: 0]
  ------------------
  470|      0|        {
  471|      0|            maxINChI = 2;
  472|      0|        }
  473|      0|    }
  474|       |
  475|  70.4k|after_structure_generation:
  476|       |
  477|  70.4k|    if ( nRet != _IS_FATAL && nRet != _IS_ERROR )
  ------------------
  |  |   13|   140k|#define _IS_FATAL   3
  ------------------
                  if ( nRet != _IS_FATAL && nRet != _IS_ERROR )
  ------------------
  |  |   12|  70.4k|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (477:10): [True: 70.4k, False: 2]
  |  Branch (477:31): [True: 70.4k, False: 2]
  ------------------
  478|  70.4k|    {
  479|  70.4k|        if ( (sd->bChiralFlag & FLAG_INP_AT_CHIRAL) &&
  ------------------
  |  |  669|  70.4k|#define FLAG_INP_AT_CHIRAL 1
  ------------------
  |  Branch (479:14): [True: 0, False: 70.4k]
  ------------------
  480|      0|            (ip->nMode & REQ_MODE_STEREO) &&
  ------------------
  |  |   19|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
  |  Branch (480:13): [True: 0, False: 0]
  ------------------
  481|      0|            !(ip->nMode & (REQ_MODE_RELATIVE_STEREO | REQ_MODE_RACEMIC_STEREO)) &&
  ------------------
  |  |   26|      0|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
                          !(ip->nMode & (REQ_MODE_RELATIVE_STEREO | REQ_MODE_RACEMIC_STEREO)) &&
  ------------------
  |  |   28|      0|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  |  Branch (481:13): [True: 0, False: 0]
  ------------------
  482|      0|            !bIsStructChiral(pINChI, sd->num_components) )
  ------------------
  |  Branch (482:13): [True: 0, False: 0]
  ------------------
  483|      0|        {
  484|      0|            if ( !ip->bNoWarnings )
  ------------------
  |  Branch (484:18): [True: 0, False: 0]
  ------------------
  485|      0|            {
  486|      0|                WarningMessage(sd->pStrErrStruct, "Not chiral");
  ------------------
  |  |  132|      0|#define WarningMessage AddErrorMessage
  ------------------
  487|      0|            }
  488|      0|        }
  489|  70.4k|        if ( !sd->bUserQuitComponent && !sd->bUserQuit )
  ------------------
  |  Branch (489:14): [True: 70.4k, False: 0]
  |  Branch (489:41): [True: 70.4k, False: 0]
  ------------------
  490|  70.4k|        {
  491|  70.4k|            nRet1 = TreatCreateINChIWarning(sd, ip, prep_inp_data, num_inp,
  492|  70.4k|                inp_file, log_file, out_file, prb_file);
  493|  70.4k|            nRet = inchi_max(nRet, nRet1);
  ------------------
  |  |  138|  70.4k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 70.4k]
  |  |  ------------------
  ------------------
  494|  70.4k|        }
  495|  70.4k|    }
  496|       |
  497|       |
  498|       |    /*    4. Sort and print INChI for the whole structure */
  499|       |
  500|  70.4k|    PrepareSaveOptBits(&save_opt_bits, ip);
  501|  70.4k|    if ( nRet != _IS_FATAL && nRet != _IS_ERROR )
  ------------------
  |  |   13|   140k|#define _IS_FATAL   3
  ------------------
                  if ( nRet != _IS_FATAL && nRet != _IS_ERROR )
  ------------------
  |  |   12|  70.4k|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (501:10): [True: 70.4k, False: 2]
  |  Branch (501:31): [True: 70.4k, False: 2]
  ------------------
  502|  70.4k|    {
  503|  70.4k|        nRet1 = SortAndPrintINChI(pCG, out_file, strbuf, log_file, ip,
  504|  70.4k|            orig_inp_data, prep_inp_data,
  505|  70.4k|            composite_norm_data,
  506|  70.4k|            pOrigStruct, sd->num_components,
  507|  70.4k|            sd->num_non_taut, sd->num_taut,
  508|  70.4k|            sd->bTautFlags, sd->bTautFlagsDone,
  509|  70.4k|            pncFlags, num_inp,
  510|  70.4k|            pINChI, pINChI_Aux,
  511|  70.4k|            &bSortPrintINChIFlags, save_opt_bits); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  512|  70.4k|    }
  513|       |
  514|       |
  515|       |    /*    5. Post-process */
  516|       |
  517|  70.4k|    DisplayOrigAndResultStructuresAndComponents(nRet, ic, pCG, sd, ip, szTitle,
  518|  70.4k|        pINChI, pINChI_Aux,
  519|  70.4k|        inp_file, log_file, out_file,
  520|  70.4k|        orig_inp_data, prep_inp_data,
  521|  70.4k|        num_inp, maxINChI,
  522|  70.4k|        composite_norm_data);
  523|       |
  524|       |
  525|  70.4k|    SaveOkProcessedMolfile(nRet, sd, ip, prb_file, inp_file);
  526|       |
  527|       |
  528|       |    /* Cleanup */
  529|       |
  530|   211k|    for ( i = 0; i < INCHI_NUM; i++ )
  ------------------
  |  |  569|   211k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (530:18): [True: 140k, False: 70.4k]
  ------------------
  531|   140k|    {
  532|   563k|        for ( k = 0; k < TAUT_NUM + 1; k++ )
  ------------------
  |  |  573|   563k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (532:22): [True: 422k, False: 140k]
  ------------------
  533|   422k|        {
  534|   422k|            FreeCompAtomData(&composite_norm_data[i][k]);
  535|   422k|        }
  536|   140k|    }
  537|       |
  538|  70.4k|    OrigStruct_Free(pOrigStruct);
  539|       |
  540|  70.4k|exit_function:
  541|       |
  542|  70.4k|    return nRet;
  543|  70.4k|}
OrigAtData_SaveMolfile:
  629|  70.4k|{
  630|  70.4k|    int ret = 0;
  631|       |
  632|  70.4k|    if ( !(ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY) )
  ------------------
  |  |  133|  70.4k|#define INCHI_OUT_SDFILE_ONLY           0x0010   /* save input data in a Molfile instead of creating INChI */
  ------------------
  |  Branch (632:10): [True: 70.4k, False: 0]
  ------------------
  633|  70.4k|    {
  634|  70.4k|        return _IS_OKAY;
  ------------------
  |  |   10|  70.4k|#define _IS_OKAY    0
  ------------------
  635|  70.4k|    }
  636|      0|    else
  637|      0|    {
  638|      0|        char szNumber[256];
  639|      0|        sprintf(szNumber, "Structure #%ld. %s%s%s%s", num_inp, SDF_LBL_VAL(ip->pSdfLabel, ip->pSdfValue));
  ------------------
  |  |  830|      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 \
  |  |  ------------------
  |  |  |  Branch (830:28): [True: 0, False: 0]
  |  |  |  Branch (830:35): [True: 0, False: 0]
  |  |  |  Branch (830:65): [True: 0, False: 0]
  |  |  |  Branch (830:72): [True: 0, False: 0]
  |  |  |  Branch (830:96): [True: 0, False: 0]
  |  |  |  Branch (830:103): [True: 0, False: 0]
  |  |  |  Branch (830:115): [True: 0, False: 0]
  |  |  |  Branch (830:122): [True: 0, False: 0]
  |  |  |  Branch (830:163): [True: 0, False: 0]
  |  |  |  Branch (830:170): [True: 0, False: 0]
  |  |  |  Branch (830:185): [True: 0, False: 0]
  |  |  |  Branch (830:192): [True: 0, False: 0]
  |  |  ------------------
  |  |  831|      0|                                                                                                                                                                                                       : gsEmpty
  ------------------
  640|      0|        ret = OrigAtData_WriteToSDfile(orig_inp_data, out_file, szNumber, NULL,
  641|      0|            (sd->bChiralFlag & FLAG_INP_AT_CHIRAL) ? 1 : 0,
  ------------------
  |  |  669|      0|#define FLAG_INP_AT_CHIRAL 1
  ------------------
  |  Branch (641:13): [True: 0, False: 0]
  ------------------
  642|      0|            (ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ATOMS_DT) ? 1 : 0,
  ------------------
  |  |  140|      0|#define INCHI_OUT_SDFILE_ATOMS_DT       0x0800   /* SDfile output H isotopes as D and T     */
  ------------------
  |  Branch (642:13): [True: 0, False: 0]
  ------------------
  643|      0|            ip->pSdfLabel, ip->pSdfValue);
  644|      0|    }
  645|       |
  646|      0|    return ret;
  647|  70.4k|}
CreateOneStructureINChI:
  887|  70.4k|{
  888|  70.4k|    int i, j, k, nRet = 0, n = 0l;
  889|       |#if defined (TARGET_EXE_STANDALONE) && defined(_WIN32)
  890|       |    int err_display;
  891|       |#endif
  892|       |
  893|       |#ifdef GHI100_FIX
  894|       |#if ((SPRINTF_FLAG != 1) && (SPRINTF_FLAG != 2))
  895|       |    setlocale(LC_ALL, "en-US"); /* djb-rwth: setting all locales to "en-US" */
  896|       |#endif
  897|       |#endif
  898|       |
  899|  70.4k|    PINChI2     *pINChI = NULL;
  900|  70.4k|    PINChI_Aux2 *pINChI_Aux = NULL;
  901|       |
  902|  70.4k|    INP_ATOM_DATA InpCurAtData;
  903|  70.4k|    INP_ATOM_DATA* inp_cur_data;
  904|       |
  905|  70.4k|    INP_ATOM_DATA InpNormAtData, InpNormTautData;
  906|  70.4k|    INP_ATOM_DATA* inp_norm_data[TAUT_NUM]; /*  = { &InpNormAtData, &InpNormTautData }; */
  907|  70.4k|    ORIG_ATOM_DATA* cur_prep_inp_data = prep_inp_data + iINChI;
  908|  70.4k|    inchiTime      ulTStart;
  909|       |
  910|       |    /* Always create info data structures (but do not display them always )
  911|       |    #ifndef COMPILE_ANSI_ONLY
  912|       |    */
  913|  70.4k|    int            bShowStructure = 0;
  914|  70.4k|    int            bStructurePreprocessed = 0; /* All changes except disconnection */
  915|  70.4k|    int            bStructureDisconnected = 0;
  916|  70.4k|    int            bAlsoOutputReconnected = 0, bINCHI_LIB_Flag = 0;
  917|  70.4k|    COMP_ATOM_DATA* composite_norm_data = composite_norm_data2[iINChI];
  918|  70.4k|    INP_ATOM_DATA2* all_inp_norm_data = NULL;
  919|       |    /*#endif*/
  920|       |
  921|       |    /*        Order of actions:
  922|       |
  923|       |        if ( orig_inp_data is NOT empty AND
  924|       |             prep_inp_data[0] IS empty ) then do
  925|       |             in PreprocessOneStructure()        :
  926|       |
  927|       |            1. copy orig_inp_data --> prep_inp_data[0]
  928|       |            2. fix odd things in prep_inp_data[0]
  929|       |            3. if( orig_inp_data->bDisconnectSalts ) then
  930|       |                  -- disconnect salts in prep_inp_data[0]
  931|       |            4. move protons to neutralize charges on heteroatoms
  932|       |            5. if( orig_inp_data->bDisconnectCoord ) then
  933|       |                  -- copy prep_inp_data[0] --> prep_inp_data[1]
  934|       |                  -- disconnect metals in prep_inp_data[0]
  935|       |
  936|       |        iINChI = 0
  937|       |        =========
  938|       |        (normal/disconnected layer)
  939|       |
  940|       |            1. normalize prep_inp_data[0] in inp_norm_data[0,1]
  941|       |            2. create INChI[ iINChI ] out of inp_norm_data[0,1]
  942|       |
  943|       |
  944|       |        iINChI = 1 AND orig_inp_data->bDisconnectCoord > 0
  945|       |        =================================================
  946|       |        (reconnected layer)
  947|       |
  948|       |            1. normalize prep_inp_data[1] in inp_norm_data[0,1]
  949|       |            2. create INChI[ iINChI ] out of inp_norm_data[0,1]
  950|       |
  951|       |    */
  952|       |
  953|  70.4k|    ip->msec_LeftTime = ip->msec_MaxTime; /* start timeout countdown for each component */
  954|       |
  955|  70.4k|    inp_cur_data = &InpCurAtData;
  956|  70.4k|    inp_norm_data[TAUT_NON] = &InpNormAtData;
  ------------------
  |  |  574|  70.4k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  957|  70.4k|    inp_norm_data[TAUT_YES] = &InpNormTautData;
  ------------------
  |  |  575|  70.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  958|       |
  959|  70.4k|    memset(inp_cur_data, 0, sizeof(*inp_cur_data)); /* djb-rwth: memset_s C11/Annex K variant? */
  960|  70.4k|    memset(inp_norm_data[TAUT_NON], 0, sizeof(*inp_norm_data[0])); /* djb-rwth: memset_s C11/Annex K variant? */
  ------------------
  |  |  574|  70.4k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  961|  70.4k|    memset(inp_norm_data[TAUT_YES], 0, sizeof(*inp_norm_data[0])); /* djb-rwth: memset_s C11/Annex K variant? */
  ------------------
  |  |  575|  70.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  962|       |
  963|  70.4k|    {
  964|       |        /*#ifndef COMPILE_ANSI_ONLY*/
  965|  70.4k|        memset(composite_norm_data + TAUT_NON, 0, sizeof(composite_norm_data[0])); /* djb-rwth: memset_s C11/Annex K variant? */
  ------------------
  |  |  574|  70.4k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  966|  70.4k|        memset(composite_norm_data + TAUT_YES, 0, sizeof(composite_norm_data[0])); /* djb-rwth: memset_s C11/Annex K variant? */
  ------------------
  |  |  575|  70.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  967|  70.4k|        memset(composite_norm_data + TAUT_INI, 0, sizeof(composite_norm_data[0])); /* djb-rwth: memset_s C11/Annex K variant? */
  ------------------
  |  |  576|  70.4k|#define TAUT_INI            2    /* 2 => intermediate tautomeric structure */
  ------------------
  968|  70.4k|    }   /*#endif*/
  969|       |
  970|  70.4k|    if ( ip->bAllowEmptyStructure && !orig_inp_data->at && !orig_inp_data->num_inp_atoms )
  ------------------
  |  Branch (970:10): [True: 0, False: 70.4k]
  |  Branch (970:38): [True: 0, False: 0]
  |  Branch (970:60): [True: 0, False: 0]
  ------------------
  971|      0|    {
  972|      0|        ;
  973|      0|    }
  974|  70.4k|    else if ( !orig_inp_data->at || !orig_inp_data->num_inp_atoms )
  ------------------
  |  Branch (974:15): [True: 0, False: 70.4k]
  |  Branch (974:37): [True: 0, False: 70.4k]
  ------------------
  975|      0|    {
  976|      0|        return 0; /* nothing to do */
  977|      0|    }
  978|  70.4k|    if ( iINChI == 1 && orig_inp_data->bDisconnectCoord <= 0 )
  ------------------
  |  Branch (978:10): [True: 0, False: 70.4k]
  |  Branch (978:25): [True: 0, False: 0]
  ------------------
  979|      0|    {
  980|      0|        return 0;
  981|      0|    }
  982|       |
  983|       |    /* m = iINChI; */ /* orig_inp_data index */
  984|  70.4k|    if ( iINChI != INCHI_BAS && iINChI != INCHI_REC )
  ------------------
  |  |  570|   140k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                  if ( iINChI != INCHI_BAS && iINChI != INCHI_REC )
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (984:10): [True: 0, False: 70.4k]
  |  Branch (984:33): [True: 0, False: 0]
  ------------------
  985|      0|    {
  986|      0|        AddErrorMessage(sd->pStrErrStruct, "Fatal undetermined program error");
  987|      0|        sd->nStructReadError = 97;
  988|      0|        nRet = sd->nErrorType = _IS_FATAL;
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
  989|      0|        inchi_free(all_inp_norm_data); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  990|      0|        goto exit_function;
  991|      0|    }
  992|       |
  993|       |    /*******************************************************************
  994|       |     *                                                                 *
  995|       |     *                                                                 *
  996|       |     *  Whole structure preprocessing: 1st step of the normalization   *
  997|       |     *                                                                 *
  998|       |     *  Happen only on the first call to CreateOneStructureINChI()      *
  999|       |     *                                                                 *
 1000|       |     *                                                                 *
 1001|       |     *******************************************************************/
 1002|       |
 1003|  70.4k|    if ( (!prep_inp_data->at || !prep_inp_data->num_inp_atoms) &&
  ------------------
  |  Branch (1003:11): [True: 70.4k, False: 0]
  |  Branch (1003:33): [True: 0, False: 0]
  ------------------
 1004|  70.4k|        orig_inp_data->num_inp_atoms > 0 )
  ------------------
  |  Branch (1004:9): [True: 70.4k, False: 0]
  ------------------
 1005|  70.4k|    {
 1006|       |        /* The structure has not been preprocessed */
 1007|  70.4k|        if ( ip->msec_MaxTime )
  ------------------
  |  Branch (1007:14): [True: 0, False: 70.4k]
  ------------------
 1008|      0|        {
 1009|      0|            InchiTimeGet(&ulTStart);
 1010|      0|        }
 1011|       |
 1012|  70.4k|        PreprocessOneStructure(ic, sd, ip, orig_inp_data, prep_inp_data);
 1013|       |
 1014|  70.4k|        pncFlags->bTautFlags[iINChI][TAUT_YES] =
  ------------------
  |  |  575|  70.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1015|  70.4k|            pncFlags->bTautFlags[iINChI][TAUT_NON] =
  ------------------
  |  |  574|  70.4k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1016|  70.4k|            sd->bTautFlags[INCHI_BAS] | ip->bTautFlags;
  ------------------
  |  |  570|  70.4k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1017|       |
 1018|  70.4k|        pncFlags->bTautFlagsDone[iINChI][TAUT_YES] =
  ------------------
  |  |  575|  70.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1019|  70.4k|            pncFlags->bTautFlagsDone[iINChI][TAUT_NON] =
  ------------------
  |  |  574|  70.4k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1020|  70.4k|            sd->bTautFlagsDone[INCHI_BAS] | ip->bTautFlagsDone;
  ------------------
  |  |  570|  70.4k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1021|       |
 1022|  70.4k|        {
 1023|       |            /*#ifndef COMPILE_ANSI_ONLY*/
 1024|       |            /* in this location the call happens once for each input structure, before preprocessing */
 1025|  70.4k|            bStructurePreprocessed = (0 != (sd->bTautFlagsDone[INCHI_BAS] & (
  ------------------
  |  |  570|  70.4k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1026|  70.4k|                TG_FLAG_MOVE_HPLUS2NEUTR_DONE |
  ------------------
  |  |  962|  70.4k|#define TG_FLAG_MOVE_HPLUS2NEUTR_DONE    0x00000001   /* protons have been moved to neutralize */
  ------------------
 1027|  70.4k|                TG_FLAG_DISCONNECT_SALTS_DONE |
  ------------------
  |  |  964|  70.4k|#define TG_FLAG_DISCONNECT_SALTS_DONE    0x00000004
  ------------------
 1028|  70.4k|                TG_FLAG_MOVE_POS_CHARGES_DONE |
  ------------------
  |  |  966|  70.4k|#define TG_FLAG_MOVE_POS_CHARGES_DONE    0x00000010
  ------------------
 1029|  70.4k|                TG_FLAG_FIX_ODD_THINGS_DONE)));
  ------------------
  |  |  978|  70.4k|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
 1030|       |
 1031|  70.4k|            bStructureDisconnected = (0 != (sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE));
  ------------------
  |  |  570|  70.4k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          bStructureDisconnected = (0 != (sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE));
  ------------------
  |  |  975|  70.4k|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
 1032|       |
 1033|  70.4k|            bShowStructure = (bStructurePreprocessed ||
  ------------------
  |  Branch (1033:31): [True: 783, False: 69.6k]
  ------------------
 1034|  69.6k|                bStructureDisconnected ||
  ------------------
  |  Branch (1034:17): [True: 0, False: 69.6k]
  ------------------
 1035|  69.6k|                prep_inp_data[0].num_components > 1);
  ------------------
  |  Branch (1035:17): [True: 790, False: 68.8k]
  ------------------
 1036|       |
 1037|       |            /* sd->bTautFlags[] contains output flags
 1038|       |               ip->bTautFlags   contains input flags
 1039|       |            */
 1040|  70.4k|            bAlsoOutputReconnected = (sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE) &&
  ------------------
  |  |  570|  70.4k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          bAlsoOutputReconnected = (sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE) &&
  ------------------
  |  |  975|  70.4k|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
  |  Branch (1040:38): [True: 0, False: 70.4k]
  ------------------
 1041|      0|                (ip->bTautFlags & TG_FLAG_RECONNECT_COORD);
  ------------------
  |  |  932|      0|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  |  Branch (1041:17): [True: 0, False: 0]
  ------------------
 1042|  70.4k|            bINCHI_LIB_Flag = 0;
 1043|       |
 1044|       |            /*************** output structures to TARGET_LIB_FOR_WINCHI conditions *********************
 1045|       |             *
 1046|       |             *  Send to TARGET_LIB_FOR_WINCHI:
 1047|       |             *
 1048|       |             *  type                      component  conditions
 1049|       |             *
 1050|       |             *  COMPONENT_ORIGINAL              #0:  (num_components > 1)
 1051|       |             *  COMPONENT_ORIGINAL_PREPROCESSED #0:  (num_components > 1) && (preprocessed)
 1052|       |             *  COMPONENT_ORIGINAL              #1:  (num_components = 1) && (preprocessed)
 1053|       |             *
 1054|       |             *  Flags explanation:
 1055|       |             *        MAIN => iINChI=0,  RECN => iINChI=1 (Reconnected)
 1056|       |             *        ORIG => Original, PREP => Preprocessed
 1057|       |             *
 1058|       |             *  Possible flags:           k
 1059|       |             *
 1060|       |             *  COMP_ORIG_0_MAIN  0x0001  0  COMPONENT_ORIGINAL, bMain, component #0
 1061|       |             *  COMP_ORIG_0_RECN  0x0002  1  COMPONENT_ORIGINAL, bRecn, component #0
 1062|       |             *
 1063|       |             *  COMP_PREP_0_MAIN  0x0004  2  COMPONENT_ORIGINAL_PREPROCESSED, bMain, component #0
 1064|       |             *  COMP_PREP_0_RECN  0x0008  3  COMPONENT_ORIGINAL_PREPROCESSED, bRecn, component #0
 1065|       |             *
 1066|       |             *  COMP_ORIG_1_MAIN  0x0010  4  COMPONENT_ORIGINAL, bMain, component #1
 1067|       |             *  COMP_ORIG_1_RECN  0x0020  5  COMPONENT_ORIGINAL, bRecn, component #1
 1068|       |             *
 1069|       |             *  bReconnected  = k%2     (0 or 1)
 1070|       |             *  nComponent    = k/4     (0 or 1)
 1071|       |             *  bPreprocessed = (k/2)%2 (0 or 1)
 1072|       |             *
 1073|       |             ******************************************************************************/
 1074|       |
 1075|       |             /* Original -> Main, component #0, Original */
 1076|  70.4k|            if ( prep_inp_data[INCHI_BAS].num_components > 1 )
  ------------------
  |  |  570|  70.4k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1076:18): [True: 811, False: 69.6k]
  ------------------
 1077|    811|            {
 1078|    811|                bINCHI_LIB_Flag |= COMP_ORIG_0_MAIN;
  ------------------
  |  |   25|    811|#define COMP_ORIG_0_MAIN  0x0001
  ------------------
 1079|    811|            }
 1080|  69.6k|            else
 1081|  69.6k|            {
 1082|       |                /* Original -> Main, component #1, Original */
 1083|  69.6k|                if ( prep_inp_data[INCHI_BAS].num_components == 1 && bStructurePreprocessed )
  ------------------
  |  |  570|  69.6k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1083:22): [True: 69.6k, False: 0]
  |  Branch (1083:70): [True: 762, False: 68.8k]
  ------------------
 1084|    762|                {
 1085|    762|                    bINCHI_LIB_Flag |= COMP_ORIG_1_MAIN;
  ------------------
  |  |   29|    762|#define COMP_ORIG_1_MAIN  0x0010
  ------------------
 1086|       |                    /* preprocessed will be added when output canonicalization results */
 1087|    762|                }
 1088|  69.6k|            }
 1089|       |
 1090|  70.4k|            if ( bAlsoOutputReconnected )
  ------------------
  |  Branch (1090:18): [True: 0, False: 70.4k]
  ------------------
 1091|      0|            {
 1092|       |                /* Original -> Reconnected, component #0, Original */
 1093|      0|                if ( prep_inp_data[INCHI_REC].num_components > 1 )
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1093:22): [True: 0, False: 0]
  ------------------
 1094|      0|                {
 1095|      0|                    bINCHI_LIB_Flag |= COMP_ORIG_0_RECN;
  ------------------
  |  |   26|      0|#define COMP_ORIG_0_RECN  0x0002
  ------------------
 1096|      0|                }
 1097|      0|                else if ( prep_inp_data[INCHI_BAS].num_components == 1 && bStructurePreprocessed )
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1097:27): [True: 0, False: 0]
  |  Branch (1097:75): [True: 0, False: 0]
  ------------------
 1098|      0|                {
 1099|       |                    /* Original -> Reconnected, component #1, Original */
 1100|      0|                    bINCHI_LIB_Flag |= COMP_ORIG_1_RECN;
  ------------------
  |  |   30|      0|#define COMP_ORIG_1_RECN  0x0020
  ------------------
 1101|       |                    /* preprocessed will be added when output canonicalization results */
 1102|      0|                }
 1103|      0|            }
 1104|  70.4k|            if ( ip->msec_MaxTime )
  ------------------
  |  Branch (1104:18): [True: 0, False: 70.4k]
  ------------------
 1105|      0|            {
 1106|      0|                ip->msec_LeftTime -= InchiTimeElapsed(ic, &ulTStart);
 1107|      0|            }
 1108|       |
 1109|       |            /* display the ORIGINAL, UN-PREPROCESSED structure */
 1110|       |
 1111|  70.4k|            if ( ip->bDisplay )
  ------------------
  |  Branch (1111:18): [True: 0, False: 70.4k]
  ------------------
 1112|      0|            {
 1113|      0|                if ( DisplayTheWholeStructure(pCG, ic, sd, ip, szTitle,
  ------------------
  |  Branch (1113:22): [True: 0, False: 0]
  ------------------
 1114|      0|                    inp_file, log_file, orig_inp_data, num_inp,
 1115|      0|                    -1, bShowStructure, bINCHI_LIB_Flag) )
 1116|      0|                {
 1117|      0|                    inchi_free(all_inp_norm_data); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1118|      0|                    goto exit_function;
 1119|      0|                }
 1120|      0|            }
 1121|  70.4k|        } /*#endif */
 1122|       |
 1123|  70.4k|        switch ( sd->nErrorType )
  ------------------
  |  Branch (1123:18): [True: 0, False: 70.4k]
  ------------------
 1124|  70.4k|        {
 1125|      0|        case _IS_ERROR:
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (1125:9): [True: 0, False: 70.4k]
  ------------------
 1126|      0|        case _IS_FATAL:
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
  |  Branch (1126:9): [True: 0, False: 70.4k]
  ------------------
 1127|       |            /* error message */
 1128|      0|            nRet = TreatErrorsInReadTheStructure(sd, ip,
 1129|      0|                LOG_MASK_ALL,
  ------------------
  |  |   98|      0|#define LOG_MASK_ALL     (LOG_MASK_WARN | LOG_MASK_ERR | LOG_MASK_FATAL)
  |  |  ------------------
  |  |  |  |   94|      0|#define LOG_MASK_WARN  1
  |  |  ------------------
  |  |               #define LOG_MASK_ALL     (LOG_MASK_WARN | LOG_MASK_ERR | LOG_MASK_FATAL)
  |  |  ------------------
  |  |  |  |   95|      0|#define LOG_MASK_ERR   2
  |  |  ------------------
  |  |               #define LOG_MASK_ALL     (LOG_MASK_WARN | LOG_MASK_ERR | LOG_MASK_FATAL)
  |  |  ------------------
  |  |  |  |   96|      0|#define LOG_MASK_FATAL 4
  |  |  ------------------
  ------------------
 1130|      0|                inp_file, log_file, out_file, prb_file,
 1131|      0|                prep_inp_data, &num_inp);
 1132|      0|            goto exit_cycle;
 1133|  70.4k|        }
 1134|  70.4k|    }
 1135|       |    /* tranfer flags from INChI_Aux to sd */
 1136|       |
 1137|       |
 1138|  70.4k|    {
 1139|       |        /*#ifndef COMPILE_ANSI_ONLY */ /* { */
 1140|       |
 1141|       |        /******************************************/
 1142|       |        /*      Displaying the structures         */
 1143|       |        /*          Only under WIN32              */
 1144|       |        /******************************************/
 1145|  70.4k|        if ( /* ip->bDisplayCompositeResults && !sd->bUserQuitComponentDisplay && */
 1146|  70.4k|            prep_inp_data[iINChI].num_components > 1
  ------------------
  |  Branch (1146:13): [True: 811, False: 69.6k]
  ------------------
 1147|  70.4k|            )
 1148|    811|        {
 1149|    811|            all_inp_norm_data = (INP_ATOM_DATA2*)inchi_calloc(prep_inp_data[iINChI].num_components, sizeof(all_inp_norm_data[0]));
  ------------------
  |  | 1146|    811|#define inchi_calloc   calloc
  ------------------
 1150|    811|        }
 1151|       |
 1152|       |        /* Display the input structure AFTER PREPROCESSING */
 1153|  70.4k|        switch ( iINChI )
 1154|  70.4k|        {
 1155|  70.4k|        case INCHI_BAS:
  ------------------
  |  |  570|  70.4k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1155:9): [True: 70.4k, False: 0]
  ------------------
 1156|       |            /*------------ Possibly disconnected structure -------------------*/
 1157|  70.4k|            bStructurePreprocessed = 0 != (sd->bTautFlagsDone[iINChI] & (
 1158|  70.4k|                TG_FLAG_MOVE_HPLUS2NEUTR_DONE |
  ------------------
  |  |  962|  70.4k|#define TG_FLAG_MOVE_HPLUS2NEUTR_DONE    0x00000001   /* protons have been moved to neutralize */
  ------------------
 1159|  70.4k|                TG_FLAG_DISCONNECT_SALTS_DONE |
  ------------------
  |  |  964|  70.4k|#define TG_FLAG_DISCONNECT_SALTS_DONE    0x00000004
  ------------------
 1160|  70.4k|                TG_FLAG_MOVE_POS_CHARGES_DONE |
  ------------------
  |  |  966|  70.4k|#define TG_FLAG_MOVE_POS_CHARGES_DONE    0x00000010
  ------------------
 1161|  70.4k|                TG_FLAG_MOVE_CHARGE_COORD_DONE |
  ------------------
  |  |  977|  70.4k|#define TG_FLAG_MOVE_CHARGE_COORD_DONE   0x00000400   /* changed charge of a disconnected ligand to fit its valence */
  ------------------
 1162|  70.4k|                TG_FLAG_DISCONNECT_COORD_DONE |
  ------------------
  |  |  975|  70.4k|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
 1163|  70.4k|                TG_FLAG_FIX_ODD_THINGS_DONE));
  ------------------
  |  |  978|  70.4k|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
 1164|  70.4k|            bINCHI_LIB_Flag = 0;
 1165|       |            /* Preprocessed/Main -> Main, component #0, Preprocessed */
 1166|  70.4k|            if ( prep_inp_data[iINChI].num_components > 1 &&
  ------------------
  |  Branch (1166:18): [True: 811, False: 69.6k]
  ------------------
 1167|    811|                bStructurePreprocessed )
  ------------------
  |  Branch (1167:17): [True: 21, False: 790]
  ------------------
 1168|     21|            {
 1169|     21|                bINCHI_LIB_Flag |= COMP_PREP_0_MAIN;
  ------------------
  |  |   27|     21|#define COMP_PREP_0_MAIN  0x0004
  ------------------
 1170|     21|            }
 1171|  70.4k|            bShowStructure = (bStructurePreprocessed &&
  ------------------
  |  Branch (1171:31): [True: 783, False: 69.6k]
  ------------------
 1172|    783|                prep_inp_data[iINChI].num_components > 1);
  ------------------
  |  Branch (1172:17): [True: 21, False: 762]
  ------------------
 1173|  70.4k|            break;
 1174|       |
 1175|      0|        case INCHI_REC:
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1175:9): [True: 0, False: 70.4k]
  ------------------
 1176|       |            /*------------ Reconnected structure ------------------------------*/
 1177|      0|            bAlsoOutputReconnected =
 1178|      0|                (sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE) &&
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              (sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE) &&
  ------------------
  |  |  975|      0|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
  |  Branch (1178:17): [True: 0, False: 0]
  ------------------
 1179|      0|                (ip->bTautFlags & TG_FLAG_RECONNECT_COORD);
  ------------------
  |  |  932|      0|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  |  Branch (1179:17): [True: 0, False: 0]
  ------------------
 1180|       |
 1181|      0|            if ( !bAlsoOutputReconnected )
  ------------------
  |  Branch (1181:18): [True: 0, False: 0]
  ------------------
 1182|      0|            {
 1183|      0|                break;
 1184|      0|            }
 1185|       |
 1186|      0|            bStructurePreprocessed = 0 != (sd->bTautFlagsDone[iINChI] & (
 1187|      0|                TG_FLAG_MOVE_HPLUS2NEUTR_DONE |
  ------------------
  |  |  962|      0|#define TG_FLAG_MOVE_HPLUS2NEUTR_DONE    0x00000001   /* protons have been moved to neutralize */
  ------------------
 1188|      0|                TG_FLAG_DISCONNECT_SALTS_DONE |
  ------------------
  |  |  964|      0|#define TG_FLAG_DISCONNECT_SALTS_DONE    0x00000004
  ------------------
 1189|      0|                TG_FLAG_MOVE_POS_CHARGES_DONE |
  ------------------
  |  |  966|      0|#define TG_FLAG_MOVE_POS_CHARGES_DONE    0x00000010
  ------------------
 1190|      0|                TG_FLAG_FIX_ODD_THINGS_DONE));
  ------------------
  |  |  978|      0|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
 1191|      0|            bINCHI_LIB_Flag = 0;
 1192|       |            /* Preprocessed/Reconnected -> Reconnected, component #0, Preprocessed */
 1193|      0|            if ( prep_inp_data[iINChI].num_components > 1 && bStructurePreprocessed )
  ------------------
  |  Branch (1193:18): [True: 0, False: 0]
  |  Branch (1193:62): [True: 0, False: 0]
  ------------------
 1194|      0|            {
 1195|      0|                bINCHI_LIB_Flag |= COMP_PREP_0_RECN;
  ------------------
  |  |   28|      0|#define COMP_PREP_0_RECN  0x0008
  ------------------
 1196|      0|            }
 1197|      0|            bShowStructure = (bStructurePreprocessed &&
  ------------------
  |  Branch (1197:31): [True: 0, False: 0]
  ------------------
 1198|      0|                prep_inp_data[iINChI].num_components > 1);
  ------------------
  |  Branch (1198:17): [True: 0, False: 0]
  ------------------
 1199|      0|            break;
 1200|       |
 1201|      0|        default:
  ------------------
  |  Branch (1201:9): [True: 0, False: 70.4k]
  ------------------
 1202|      0|            bShowStructure = 0;
 1203|  70.4k|        }
 1204|       |
 1205|       |
 1206|  70.4k|        if ( ip->bDisplay && prep_inp_data[iINChI].num_inp_atoms > 0 )
  ------------------
  |  Branch (1206:14): [True: 0, False: 70.4k]
  |  Branch (1206:30): [True: 0, False: 0]
  ------------------
 1207|      0|        {
 1208|      0|            if ( DisplayTheWholeStructure(pCG, ic, sd, ip, szTitle,
  ------------------
  |  Branch (1208:18): [True: 0, False: 0]
  ------------------
 1209|      0|                inp_file, log_file,
 1210|      0|                prep_inp_data + iINChI,
 1211|      0|                num_inp,
 1212|      0|                iINChI,
 1213|      0|                bShowStructure,
 1214|      0|                bINCHI_LIB_Flag) )
 1215|      0|            {
 1216|      0|                inchi_free(all_inp_norm_data); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1217|      0|                goto exit_function;
 1218|      0|            }
 1219|      0|        }
 1220|  70.4k|    } /* #endif */ /* } ifndef COMPILE_ANSI_ONLY */
 1221|       |
 1222|       |
 1223|       |    /* allocate pINChI[iINChI] and pINChI_Aux2[iINChI] -- arrays of pointers to INChI and INChI_Aux */
 1224|       |    /* assign values to sd->num_components[]                                                  */
 1225|       |
 1226|       |    /* djb-rwth: MYREALLOC2 has been replaced and the whole block rewritten to address memory leaks and reading from freed memory locations */
 1227|  70.4k|    do {
 1228|  70.4k|        if ( (sd->num_components[iINChI]) <= ((long long)cur_prep_inp_data->num_components) ) {
  ------------------
  |  Branch (1228:14): [True: 70.4k, False: 0]
  ------------------
 1229|  70.4k|            PINChI2* newPTR1 = (PINChI2*)inchi_calloc(((long long)cur_prep_inp_data->num_components) + 1, sizeof(PINChI2));
  ------------------
  |  | 1146|  70.4k|#define inchi_calloc   calloc
  ------------------
 1230|  70.4k|            PINChI_Aux2* newPTR2 = (PINChI_Aux2*)inchi_calloc(((long long)cur_prep_inp_data->num_components) + 1, sizeof(PINChI_Aux2));
  ------------------
  |  | 1146|  70.4k|#define inchi_calloc   calloc
  ------------------
 1231|  70.4k|            if ( newPTR1 && newPTR2 ) {
  ------------------
  |  Branch (1231:18): [True: 70.4k, False: 0]
  |  Branch (1231:29): [True: 70.4k, False: 0]
  ------------------
 1232|  70.4k|                if ( (pINChI2[iINChI]) && (sd->num_components[iINChI]) > 0 )
  ------------------
  |  Branch (1232:22): [True: 0, False: 70.4k]
  |  Branch (1232:43): [True: 0, False: 0]
  ------------------
 1233|      0|                    memcpy(newPTR1, pINChI2[iINChI], (sd->num_components[iINChI]) * sizeof(PINChI2));
 1234|  70.4k|                if ( (pINChI_Aux2[iINChI]) && (sd->num_components[iINChI]) > 0 )
  ------------------
  |  Branch (1234:22): [True: 0, False: 70.4k]
  |  Branch (1234:47): [True: 0, False: 0]
  ------------------
 1235|      0|                    memcpy(newPTR2, pINChI_Aux2[iINChI], (sd->num_components[iINChI]) * sizeof(PINChI_Aux2));
 1236|  70.4k|                if ( pINChI2[iINChI] )
  ------------------
  |  Branch (1236:22): [True: 0, False: 70.4k]
  ------------------
 1237|      0|                    inchi_free(pINChI2[iINChI]);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1238|  70.4k|                if ( pINChI_Aux2[iINChI] )
  ------------------
  |  Branch (1238:22): [True: 0, False: 70.4k]
  ------------------
 1239|      0|                    inchi_free(pINChI_Aux2[iINChI]);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1240|  70.4k|                pINChI2[iINChI] = newPTR1;
 1241|  70.4k|                pINChI_Aux2[iINChI] = newPTR2;
 1242|  70.4k|                sd->num_components[iINChI] = cur_prep_inp_data->num_components;
 1243|  70.4k|                k = 0;
 1244|  70.4k|            }
 1245|      0|            else {
 1246|      0|                inchi_free(newPTR1);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1247|      0|                inchi_free(newPTR2);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1248|      0|                k = 1;
 1249|      0|            }
 1250|  70.4k|        }
 1251|      0|        else { k = 0; }
 1252|  70.4k|    } while ( 0 );
  ------------------
  |  Branch (1252:15): [Folded, False: 70.4k]
  ------------------
 1253|       |
 1254|  70.4k|    if ( k )
  ------------------
  |  Branch (1254:10): [True: 0, False: 70.4k]
  ------------------
 1255|      0|    {
 1256|      0|        AddErrorMessage(sd->pStrErrStruct, "Cannot allocate output data. Terminating");
 1257|      0|        sd->nStructReadError = 99;
 1258|      0|        sd->nErrorType = _IS_FATAL;
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
 1259|      0|        inchi_free(all_inp_norm_data); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1260|      0|        goto exit_function;
 1261|      0|    }
 1262|       |
 1263|  70.4k|    pINChI = pINChI2[iINChI];
 1264|  70.4k|    pINChI_Aux = pINChI_Aux2[iINChI];
 1265|       |
 1266|       |    /**************************************************************************/
 1267|       |    /*                                                                        */
 1268|       |    /*                                                                        */
 1269|       |    /*   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          */
 1270|       |    /*                                                                        */
 1271|       |    /*                                                                        */
 1272|       |    /*                     O N E   B Y   O N E                                */
 1273|       |    /*                                                                        */
 1274|       |    /*                                                                        */
 1275|       |    /**************************************************************************/
 1276|       |
 1277|  70.4k|    for ( i = 0, nRet = 0;
 1278|   176k|        !sd->bUserQuitComponent && i < cur_prep_inp_data->num_components;
  ------------------
  |  Branch (1278:9): [True: 176k, False: 0]
  |  Branch (1278:36): [True: 106k, False: 70.4k]
  ------------------
 1279|   106k|        i++ )
 1280|   106k|    {
 1281|   106k|        if ( ip->msec_MaxTime )
  ------------------
  |  Branch (1281:14): [True: 0, False: 106k]
  ------------------
 1282|      0|        {
 1283|      0|            InchiTimeGet(&ulTStart);
 1284|      0|        }
 1285|       |
 1286|   106k|#ifndef TARGET_LIB_FOR_WINCHI  /* { */
 1287|   106k|#if ( bREUSE_INCHI == 1 )
 1288|       |
 1289|   106k|        if ( (iINChI == INCHI_REC &&
  ------------------
  |  |  571|   212k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1289:15): [True: 0, False: 106k]
  ------------------
 1290|       |            /*( !ip->bDisplay &&
 1291|       |              !ip->bDisplayCompositeResults && */
 1292|      0|            !(ip->bCompareComponents & CMP_COMPONENTS)) ||
  ------------------
  |  |   54|      0|#define CMP_COMPONENTS              0x0001     /* perform compare components */
  ------------------
  |  Branch (1292:13): [True: 0, False: 0]
  ------------------
 1293|   106k|            sd->bUserQuitComponentDisplay ) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1293:13): [True: 0, False: 106k]
  ------------------
 1294|      0|        {
 1295|       |            /* Reconnected structure (06-20-2005: added "&& !ip->bDisplayCompositeResults" to display composite structure) */
 1296|      0|            int m = iINChI - 1;
 1297|       |
 1298|       |            /* Find whether we have already calculated this INChI in basic (disconnected) layer */
 1299|      0|            for ( j = n = 0; j < prep_inp_data[m].num_components; j++ )
  ------------------
  |  Branch (1299:30): [True: 0, False: 0]
  ------------------
 1300|      0|            {
 1301|      0|                if ( i + 1 == prep_inp_data[m].nOldCompNumber[j] &&
  ------------------
  |  Branch (1301:22): [True: 0, False: 0]
  ------------------
 1302|      0|                    (pINChI2[m][j][TAUT_NON] || pINChI2[m][j][TAUT_YES]) )
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                  (pINChI2[m][j][TAUT_NON] || pINChI2[m][j][TAUT_YES]) )
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1302:22): [True: 0, False: 0]
  |  Branch (1302:49): [True: 0, False: 0]
  ------------------
 1303|      0|                {
 1304|       |                    /* Yes, we have already done this */
 1305|      0|                    if ( !n++ )
  ------------------
  |  Branch (1305:26): [True: 0, False: 0]
  ------------------
 1306|      0|                    {
 1307|      0|                        memcpy(pINChI + i, pINChI2[m] + j, sizeof(pINChI[0]));
 1308|      0|                        memcpy(pINChI_Aux + i, pINChI_Aux2[m] + j, sizeof(pINChI_Aux[0]));
 1309|      0|                        for ( k = 0; k < TAUT_NUM; k++ )
  ------------------
  |  |  573|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1309:38): [True: 0, False: 0]
  ------------------
 1310|      0|                        {
 1311|      0|                            if ( pINChI[i][k] )
  ------------------
  |  Branch (1311:34): [True: 0, False: 0]
  ------------------
 1312|      0|                            {
 1313|      0|                                pINChI[i][k]->nRefCount++;
 1314|      0|                                if ( pINChI[i][k]->nNumberOfAtoms > 0 )
  ------------------
  |  Branch (1314:38): [True: 0, False: 0]
  ------------------
 1315|      0|                                {
 1316|      0|                                    switch ( k )
  ------------------
  |  Branch (1316:46): [True: 0, False: 0]
  ------------------
 1317|      0|                                    {
 1318|      0|                                    case TAUT_NON:
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1318:37): [True: 0, False: 0]
  ------------------
 1319|      0|                                        sd->num_non_taut[iINChI]++;
 1320|      0|                                        break;
 1321|      0|                                    case TAUT_YES:
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1321:37): [True: 0, False: 0]
  ------------------
 1322|      0|                                        if ( pINChI[i][k]->lenTautomer > 0 )
  ------------------
  |  Branch (1322:46): [True: 0, False: 0]
  ------------------
 1323|      0|                                        {
 1324|      0|                                            sd->num_taut[iINChI]++;
 1325|      0|                                        }
 1326|      0|                                        else
 1327|      0|                                            if ( !pINChI[i][TAUT_NON] ||
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1327:50): [True: 0, False: 0]
  ------------------
 1328|      0|                                                !pINChI[i][TAUT_NON]->nNumberOfAtoms )
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1328:49): [True: 0, False: 0]
  ------------------
 1329|      0|                                            {
 1330|      0|                                                sd->num_non_taut[iINChI]++;
 1331|      0|                                            }
 1332|      0|                                        break;
 1333|      0|                                    }
 1334|      0|                                }
 1335|      0|                            }
 1336|      0|                            if ( pINChI_Aux[i][k] )
  ------------------
  |  Branch (1336:34): [True: 0, False: 0]
  ------------------
 1337|      0|                            {
 1338|      0|                                pINChI_Aux[i][k]->nRefCount++;
 1339|      0|                            }
 1340|      0|                        }
 1341|      0|                    }
 1342|      0|                }
 1343|      0|            }
 1344|       |
 1345|      0|            if ( n == 1 )
  ------------------
  |  Branch (1345:18): [True: 0, False: 0]
  ------------------
 1346|      0|            {
 1347|      0|                continue;
 1348|      0|            }
 1349|      0|            if ( n > 1 )
  ------------------
  |  Branch (1349:18): [True: 0, False: 0]
  ------------------
 1350|      0|            {
 1351|       |                /* ith component is equivalent to more than one another component */
 1352|      0|                AddErrorMessage(sd->pStrErrStruct, "Cannot distinguish components");
 1353|      0|                sd->nStructReadError = 99;
 1354|      0|                sd->nErrorType = _IS_ERROR;
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
 1355|      0|                inchi_free(all_inp_norm_data); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1356|      0|                goto exit_function;
 1357|      0|            }
 1358|      0|        }
 1359|       |
 1360|   106k|#endif
 1361|   106k|#endif /* } TARGET_LIB_FOR_WINCHI */
 1362|       |
 1363|       |        /*****************************************************/
 1364|       |        /*  a) Allocate memory and extract current component */
 1365|       |        /*****************************************************/
 1366|       |
 1367|   106k|        nRet = GetOneComponent(ic, sd, ip,
 1368|   106k|            log_file, out_file,
 1369|   106k|            inp_cur_data, cur_prep_inp_data,
 1370|   106k|            i, num_inp);
 1371|       |
 1372|   106k|        if ( ip->msec_MaxTime )
  ------------------
  |  Branch (1372:14): [True: 0, False: 106k]
  ------------------
 1373|      0|        {
 1374|      0|            ip->msec_LeftTime -= InchiTimeElapsed(ic, &ulTStart);
 1375|      0|        }
 1376|       |
 1377|   106k|        switch ( nRet )
  ------------------
  |  Branch (1377:18): [True: 0, False: 106k]
  ------------------
 1378|   106k|        {
 1379|      0|        case _IS_ERROR:
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (1379:9): [True: 0, False: 106k]
  ------------------
 1380|      0|        case _IS_FATAL:
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
  |  Branch (1380:9): [True: 0, False: 106k]
  ------------------
 1381|      0|            goto exit_cycle;
 1382|   106k|        }
 1383|       |
 1384|       |#if !defined(TARGET_API_LIB) && !defined(COMPILE_ANSI_ONLY)
 1385|       |        /*  console request: Display the component? */
 1386|       |        if ( ip->bDisplay && inp_file->f != stdin )
 1387|       |        {
 1388|       |            if ( user_quit(ic, "Enter=Display Component, Esc=Stop ?", ip->ulDisplTime) )
 1389|       |            {
 1390|       |                sd->bUserQuitComponent = 1;
 1391|       |                break;
 1392|       |            }
 1393|       |        }
 1394|       |#endif
 1395|       |
 1396|       |        /*#ifndef COMPILE_ANSI_ONLY
 1397|       |        { */
 1398|       |
 1399|       |        /*  b) Display the extracted original component structure */
 1400|   106k|        if ( ip->bDisplay && inp_cur_data->at && !sd->bUserQuitComponentDisplay )
  ------------------
  |  Branch (1400:14): [True: 0, False: 106k]
  |  Branch (1400:30): [True: 0, False: 0]
  |  Branch (1400:50): [True: 0, False: 0]
  ------------------
 1401|      0|        {
 1402|      0|            if ( cur_prep_inp_data->num_components == 1 )
  ------------------
  |  Branch (1402:18): [True: 0, False: 0]
  ------------------
 1403|      0|            {
 1404|      0|                sprintf(szTitle, "%sInput Structure #%ld.%s%s%s%s%s",
 1405|      0|                    bStructurePreprocessed ? "Preprocessed " : "",
  ------------------
  |  Branch (1405:21): [True: 0, False: 0]
  ------------------
 1406|      0|                    num_inp, SDF_LBL_VAL(ip->pSdfLabel, ip->pSdfValue), iINChI ? " (Reconnected)" : "");
  ------------------
  |  |  830|      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 \
  |  |  ------------------
  |  |  |  Branch (830:28): [True: 0, False: 0]
  |  |  |  Branch (830:35): [True: 0, False: 0]
  |  |  |  Branch (830:65): [True: 0, False: 0]
  |  |  |  Branch (830:72): [True: 0, False: 0]
  |  |  |  Branch (830:96): [True: 0, False: 0]
  |  |  |  Branch (830:103): [True: 0, False: 0]
  |  |  |  Branch (830:115): [True: 0, False: 0]
  |  |  |  Branch (830:122): [True: 0, False: 0]
  |  |  |  Branch (830:163): [True: 0, False: 0]
  |  |  |  Branch (830:170): [True: 0, False: 0]
  |  |  |  Branch (830:185): [True: 0, False: 0]
  |  |  |  Branch (830:192): [True: 0, False: 0]
  |  |  ------------------
  |  |  831|      0|                                                                                                                                                                                                       : gsEmpty
  ------------------
  |  Branch (1406:73): [True: 0, False: 0]
  ------------------
 1407|      0|            }
 1408|      0|            else
 1409|      0|            {
 1410|      0|                sprintf(szTitle, "Component #%d of %d, Input Structure #%ld.%s%s%s%s%s",
 1411|      0|                    i + 1, cur_prep_inp_data->num_components,
 1412|      0|                    num_inp, SDF_LBL_VAL(ip->pSdfLabel, ip->pSdfValue), iINChI ? " (Reconnected)" : "");
  ------------------
  |  |  830|      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 \
  |  |  ------------------
  |  |  |  Branch (830:28): [True: 0, False: 0]
  |  |  |  Branch (830:35): [True: 0, False: 0]
  |  |  |  Branch (830:65): [True: 0, False: 0]
  |  |  |  Branch (830:72): [True: 0, False: 0]
  |  |  |  Branch (830:96): [True: 0, False: 0]
  |  |  |  Branch (830:103): [True: 0, False: 0]
  |  |  |  Branch (830:115): [True: 0, False: 0]
  |  |  |  Branch (830:122): [True: 0, False: 0]
  |  |  |  Branch (830:163): [True: 0, False: 0]
  |  |  |  Branch (830:170): [True: 0, False: 0]
  |  |  |  Branch (830:185): [True: 0, False: 0]
  |  |  |  Branch (830:192): [True: 0, False: 0]
  |  |  ------------------
  |  |  831|      0|                                                                                                                                                                                                       : gsEmpty
  ------------------
  |  Branch (1412:73): [True: 0, False: 0]
  ------------------
 1413|      0|            }
 1414|       |
 1415|       |#if defined (TARGET_EXE_STANDALONE) && defined(_WIN32)
 1416|       |            err_display = DisplayStructure(pCG,
 1417|       |                inp_cur_data->at,
 1418|       |                inp_cur_data->num_at,
 1419|       |                NULL, /* OAD_Polymer *polymer, */
 1420|       |                0,
 1421|       |                1,
 1422|       |                0,
 1423|       |                NULL,
 1424|       |                1           /*isotopic*/,
 1425|       |                0           /*taut*/,
 1426|       |                NULL,
 1427|       |                NULL,
 1428|       |                ip->bAbcNumbers,
 1429|       |                &ip->dp,
 1430|       |                ip->nMode,
 1431|       |                szTitle);
 1432|       |
 1433|       |            sd->bUserQuitComponentDisplay = (err_display == ESC_KEY);
 1434|       |
 1435|       |            if ( !err_display )
 1436|       |            {
 1437|       |                inchi_fprintf(stderr, "Cannot display the structure\n");
 1438|       |            }
 1439|       |#endif
 1440|       |#ifdef TARGET_LIB_FOR_WINCHI
 1441|       |            if ( DRAWDATA && DRAWDATA_EXISTS )
 1442|       |            {
 1443|       |                struct DrawData vDrawData;
 1444|       |                int    nType = COMPONENT_ORIGINAL;
 1445|       |                vDrawData.pWindowData = CreateWinData_(pCG,
 1446|       |                    inp_cur_data->at,
 1447|       |                    inp_cur_data->num_at,
 1448|       |                    0,
 1449|       |                    1 /* bAdd_DT_to_num_H */,
 1450|       |                    0,
 1451|       |                    NULL,
 1452|       |                    1 /* display isotopic if present */,
 1453|       |                    0,
 1454|       |                    NULL,
 1455|       |                    NULL,
 1456|       |                    ip->bAbcNumbers,
 1457|       |                    &ip->dp,
 1458|       |                    ip->nMode);
 1459|       |                if ( vDrawData.pWindowData != NULL )
 1460|       |                {
 1461|       |                    if ( DRAWDATA_EXISTS(i + 1, nType, iINChI) )
 1462|       |                    {
 1463|       |                        /* i = component number */
 1464|       |                        nType = COMPONENT_ORIGINAL_PREPROCESSED;
 1465|       |                    }
 1466|       |                    vDrawData.nComponent = i + 1;
 1467|       |                    vDrawData.nType = nType;
 1468|       |                    vDrawData.bReconnected = iINChI; /* 0=>main; 1=>reconnected */
 1469|       |                    vDrawData.szTitle = inchi__strdup(szTitle);
 1470|       |                    vDrawData.pWindowData->szTitle = inchi__strdup(szTitle);
 1471|       |                    DRAWDATA(&vDrawData);
 1472|       |                }
 1473|       |            }
 1474|       |#endif
 1475|      0|        }
 1476|       |        /*#endif */  /* } COMPILE_ANSI_ONLY */
 1477|       |
 1478|       |
 1479|       |        /*******************************************************************************/
 1480|       |        /*                                                                             */
 1481|       |        /*  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     */
 1482|       |        /*                                                                             */
 1483|       |        /*         (both tautomeric and non-tautomeric if requested)                   */
 1484|       |        /*                                                                             */
 1485|       |        /*******************************************************************************/
 1486|       |        /*  c) Create the component's INChI ( copies ip->bTautFlags into sd->bTautFlags)*/
 1487|       |        /*******************************************************************************/
 1488|       |
 1489|   106k|        nRet = CreateOneComponentINChI(pCG, ic, sd, ip,
 1490|   106k|            inp_cur_data, orig_inp_data,
 1491|   106k|            pINChI/*2[iINChI]*/,
 1492|   106k|            pINChI_Aux/*2[iINChI]*/,
 1493|   106k|            iINChI, i, num_inp,
 1494|   106k|            inp_norm_data, pncFlags, log_file);
 1495|       |
 1496|       |
 1497|       |
 1498|       |        /*  d) Display one component structure and/or INChI results only if there was no error */
 1499|       |
 1500|       |        /* #ifndef COMPILE_ANSI_ONLY */ /* { */
 1501|   106k|        if ( !nRet )
  ------------------
  |  Branch (1501:14): [True: 106k, False: 4]
  ------------------
 1502|   106k|        {
 1503|       |            /*  output one component INChI to the stdout if requested */
 1504|       |            /*
 1505|       |            if ( ip->bDisplayEachComponentINChI ) {
 1506|       |                int cur_num_non_taut = (pINChI[i][TAUT_NON] && pINChI[i][TAUT_NON]->nNumberOfAtoms>0);
 1507|       |                int cur_num_taut     = (pINChI[i][TAUT_YES] && pINChI[i][TAUT_YES]->nNumberOfAtoms>0);
 1508|       |                if ( ip->bDisplayEachComponentINChI && cur_num_non_taut + cur_num_taut ) {
 1509|       |                    SortAndPrintINChI( pCG, stdout, pStr, nStrLen, NULL,
 1510|       |                                       ip, 1, cur_num_non_taut, cur_num_taut,
 1511|       |                                       num_inp, pINChI+i, pINChI_Aux+i,
 1512|       |                                       save_opt_bits);
 1513|       |                }
 1514|       |            }
 1515|       |            */
 1516|       |            /**************************************************************************
 1517|       |             * display from one up to 4 structure pictures-results for each component *
 1518|       |             * Enable buttons:                                                        *
 1519|       |             * BN (non-tautomeric non-isotopic): inp_norm_data[0]->bExists            *
 1520|       |             * TN (tautomeric non-isotopic):     inp_norm_data[1]->bExists            *
 1521|       |             * BI (non-tautomeric isotopic):     inp_norm_data[0]->bExists &&         *
 1522|       |             *                                   inp_norm_data[0]->bHasIsotopicLayer  *
 1523|       |             * TI (tautomeric isotopic):         inp_norm_data[1]->bExists &&         *
 1524|       |             *                                   inp_norm_data[1]->bHasIsotopicLayer  *
 1525|       |             **************************************************************************/
 1526|       |
 1527|   106k|            int bIsotopic, bTautomeric, bDisplayTaut, bHasIsotopicLayer, bFixedBondsTaut, m_max, m, nNumDisplayedFixedBondTaut = 0; /* djb-rwth: ignoring LLVM warning: variable used */
 1528|       |
 1529|   106k|            for ( j = 0;
 1530|   106k|                ip->bDisplay && !sd->bUserQuitComponentDisplay && j < TAUT_NUM;
  ------------------
  |  |  573|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1530:17): [True: 0, False: 106k]
  |  Branch (1530:33): [True: 0, False: 0]
  |  Branch (1530:67): [True: 0, False: 0]
  ------------------
 1531|   106k|                j++ )
 1532|      0|            {
 1533|      0|                if ( inp_norm_data[j]->bExists && !inp_norm_data[j]->bDeleted )
  ------------------
  |  Branch (1533:22): [True: 0, False: 0]
  |  Branch (1533:51): [True: 0, False: 0]
  ------------------
 1534|      0|                {
 1535|      0|                    bTautomeric = (pINChI[i][j]->lenTautomer > 0);
 1536|       |                    /* same as (inp_norm_data[j]->bTautomeric > 0) */
 1537|       |
 1538|       |                   /* If requested tautomeric and no tautmerism found then do not say mobile or fixed H. 2004-10-27 */
 1539|      0|                    bDisplayTaut = (!(ip->nMode & REQ_MODE_BASIC) && !bTautomeric) ? -1 : bTautomeric;
  ------------------
  |  |   15|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (1539:37): [True: 0, False: 0]
  |  Branch (1539:70): [True: 0, False: 0]
  ------------------
 1540|      0|                    bHasIsotopicLayer = (inp_norm_data[j]->bHasIsotopicLayer > 0);
 1541|       |
 1542|      0|                    for ( k = 0; k <= bHasIsotopicLayer; k++ )
  ------------------
  |  Branch (1542:34): [True: 0, False: 0]
  ------------------
 1543|      0|                    {
 1544|      0|                        bIsotopic = (k > 0);
 1545|      0|                        m_max = inp_norm_data[j]->at_fixed_bonds && inp_norm_data[j]->bTautPreprocessed ? 1 : 0;
  ------------------
  |  Branch (1545:33): [True: 0, False: 0]
  |  Branch (1545:69): [True: 0, False: 0]
  ------------------
 1546|      0|                        for ( m = m_max; 0 <= m; m-- )
  ------------------
  |  Branch (1546:42): [True: 0, False: 0]
  ------------------
 1547|      0|                        {
 1548|      0|                            bFixedBondsTaut = (m > 0);
 1549|      0|                            nNumDisplayedFixedBondTaut += bFixedBondsTaut;
 1550|       |                            /* display only one time */
 1551|       |
 1552|       |                        /*  Added number of components, added another format for a single component case - DCh */
 1553|      0|                            if ( cur_prep_inp_data->num_components > 1 )
  ------------------
  |  Branch (1553:34): [True: 0, False: 0]
  ------------------
 1554|      0|                            {
 1555|      0|                                sprintf(szTitle, "%s Component #%d of %d, Structure #%ld%s%s.%s%s%s%s%s",
 1556|      0|                                    bFixedBondsTaut ? "Preprocessed" : "Result for",
  ------------------
  |  Branch (1556:37): [True: 0, False: 0]
  ------------------
 1557|      0|                                    i + 1, cur_prep_inp_data->num_components, num_inp,
 1558|      0|                                    bDisplayTaut == 1 ? ", mobile H" : bDisplayTaut == 0 ? ", fixed H" : "",
  ------------------
  |  Branch (1558:37): [True: 0, False: 0]
  |  Branch (1558:72): [True: 0, False: 0]
  ------------------
 1559|      0|                                    bIsotopic ? ", isotopic" : "",
  ------------------
  |  Branch (1559:37): [True: 0, False: 0]
  ------------------
 1560|      0|                                    SDF_LBL_VAL(ip->pSdfLabel, ip->pSdfValue), iINChI ? " (Reconnected)" : "");
  ------------------
  |  |  830|      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 \
  |  |  ------------------
  |  |  |  Branch (830:28): [True: 0, False: 0]
  |  |  |  Branch (830:35): [True: 0, False: 0]
  |  |  |  Branch (830:65): [True: 0, False: 0]
  |  |  |  Branch (830:72): [True: 0, False: 0]
  |  |  |  Branch (830:96): [True: 0, False: 0]
  |  |  |  Branch (830:103): [True: 0, False: 0]
  |  |  |  Branch (830:115): [True: 0, False: 0]
  |  |  |  Branch (830:122): [True: 0, False: 0]
  |  |  |  Branch (830:163): [True: 0, False: 0]
  |  |  |  Branch (830:170): [True: 0, False: 0]
  |  |  |  Branch (830:185): [True: 0, False: 0]
  |  |  |  Branch (830:192): [True: 0, False: 0]
  |  |  ------------------
  |  |  831|      0|                                                                                                                                                                                                       : gsEmpty
  ------------------
  |  Branch (1560:80): [True: 0, False: 0]
  ------------------
 1561|      0|                            }
 1562|      0|                            else
 1563|      0|                            {
 1564|      0|                                sprintf(szTitle, "%s Structure #%ld%s%s.%s%s%s%s%s",
 1565|      0|                                    bFixedBondsTaut ? "Preprocessed" : "Result for",
  ------------------
  |  Branch (1565:37): [True: 0, False: 0]
  ------------------
 1566|      0|                                    num_inp,
 1567|      0|                                    bDisplayTaut == 1 ? ", mobile H" : bDisplayTaut == 0 ? ", fixed H" : "",
  ------------------
  |  Branch (1567:37): [True: 0, False: 0]
  |  Branch (1567:72): [True: 0, False: 0]
  ------------------
 1568|      0|                                    bIsotopic ? ", isotopic" : "",
  ------------------
  |  Branch (1568:37): [True: 0, False: 0]
  ------------------
 1569|      0|                                    SDF_LBL_VAL(ip->pSdfLabel, ip->pSdfValue), iINChI ? " (Reconnected)" : "");
  ------------------
  |  |  830|      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 \
  |  |  ------------------
  |  |  |  Branch (830:28): [True: 0, False: 0]
  |  |  |  Branch (830:35): [True: 0, False: 0]
  |  |  |  Branch (830:65): [True: 0, False: 0]
  |  |  |  Branch (830:72): [True: 0, False: 0]
  |  |  |  Branch (830:96): [True: 0, False: 0]
  |  |  |  Branch (830:103): [True: 0, False: 0]
  |  |  |  Branch (830:115): [True: 0, False: 0]
  |  |  |  Branch (830:122): [True: 0, False: 0]
  |  |  |  Branch (830:163): [True: 0, False: 0]
  |  |  |  Branch (830:170): [True: 0, False: 0]
  |  |  |  Branch (830:185): [True: 0, False: 0]
  |  |  |  Branch (830:192): [True: 0, False: 0]
  |  |  ------------------
  |  |  831|      0|                                                                                                                                                                                                       : gsEmpty
  ------------------
  |  Branch (1569:80): [True: 0, False: 0]
  ------------------
 1570|      0|                            }
 1571|       |
 1572|       |#if defined (TARGET_EXE_STANDALONE) && defined(_WIN32)
 1573|       |                            if ( bFixedBondsTaut && nNumDisplayedFixedBondTaut != 1 )
 1574|       |                            {
 1575|       |                                continue;
 1576|       |                            }
 1577|       |                            if ( ip->bDisplay )
 1578|       |                            {
 1579|       |                                if ( bFixedBondsTaut )
 1580|       |                                {
 1581|       |                                    err_display = DisplayStructure(pCG,
 1582|       |                                        inp_norm_data[j]->at_fixed_bonds,
 1583|       |                                        inp_norm_data[j]->num_at,
 1584|       |                                        NULL, /* OAD_Polymer *polymer, */
 1585|       |                                        inp_norm_data[j]->num_removed_H,
 1586|       |                                        0 /*bAdd_DT_to_num_H*/,
 1587|       |                                        inp_norm_data[j]->nNumRemovedProtons,
 1588|       |                                        inp_norm_data[j]->nNumRemovedProtonsIsotopic,
 1589|       |                                        bHasIsotopicLayer,
 1590|       |                                        j,
 1591|       |                                        NULL,
 1592|       |                                        NULL,
 1593|       |                                        ip->bAbcNumbers,
 1594|       |                                        &ip->dp,
 1595|       |                                        ip->nMode,
 1596|       |                                        szTitle);
 1597|       |                                }
 1598|       |                                else
 1599|       |                                {
 1600|       |                                    err_display = DisplayStructure(pCG,
 1601|       |                                        inp_norm_data[j]->at,
 1602|       |                                        inp_norm_data[j]->num_at,
 1603|       |                                        NULL, /* OAD_Polymer *polymer, */
 1604|       |                                        0,
 1605|       |                                        0 /*bAdd_DT_to_num_H*/,
 1606|       |                                        0,
 1607|       |                                        NULL,
 1608|       |                                        k,
 1609|       |                                        j,
 1610|       |                                        pINChI[i],
 1611|       |                                        pINChI_Aux[i],
 1612|       |                                        ip->bAbcNumbers,
 1613|       |                                        &ip->dp,
 1614|       |                                        ip->nMode, szTitle);
 1615|       |                                }
 1616|       |                                if ( (sd->bUserQuitComponentDisplay = (err_display == ESC_KEY)) ) /* djb-rwth: addressing LLVM warning */
 1617|       |                                {
 1618|       |                                    break;
 1619|       |                                }
 1620|       |                            }
 1621|       |#endif
 1622|       |#ifdef TARGET_LIB_FOR_WINCHI
 1623|       |
 1624|       |                            if ( DRAWDATA && !bFixedBondsTaut )
 1625|       |                            {
 1626|       |                                struct DrawData vDrawData;
 1627|       |                                vDrawData.pWindowData =
 1628|       |                                    CreateWinData_(pCG,
 1629|       |                                        inp_norm_data[j]->at,
 1630|       |                                        inp_norm_data[j]->num_at,
 1631|       |                                        0,
 1632|       |                                        0 /* bAdd_DT_to_num_H */,
 1633|       |                                        0,
 1634|       |                                        NULL,
 1635|       |                                        k,
 1636|       |                                        j,
 1637|       |                                        pINChI[i],
 1638|       |                                        pINChI_Aux[i],
 1639|       |                                        ip->bAbcNumbers,
 1640|       |                                        &ip->dp,
 1641|       |                                        ip->nMode);
 1642|       |
 1643|       |                                if ( vDrawData.pWindowData != NULL )
 1644|       |                                {
 1645|       |                                    int nType;
 1646|       |                                    vDrawData.nComponent = i + 1;
 1647|       |                                    if ( bTautomeric == 0 )
 1648|       |                                        nType = (bIsotopic == 0) ? COMPONENT_BN
 1649|       |                                        : COMPONENT_BI;
 1650|       |                                    else
 1651|       |                                        nType = (bIsotopic == 0) ? COMPONENT_TN
 1652|       |                                        : COMPONENT_TI;
 1653|       |                                    vDrawData.nType = nType;
 1654|       |
 1655|       |                                    vDrawData.bReconnected = iINChI; /* 0=>main; 1=>reconnected */
 1656|       |                                    vDrawData.szTitle = inchi__strdup(szTitle);
 1657|       |                                    vDrawData.pWindowData->szTitle = inchi__strdup(szTitle);
 1658|       |                                    DRAWDATA(&vDrawData);
 1659|       |                                }
 1660|       |                            }
 1661|       |                            else if ( DRAWDATA && bFixedBondsTaut )
 1662|       |                            {
 1663|       |                                struct DrawData vDrawData;
 1664|       |                                if ( (ip->bCompareComponents & CMP_COMPONENTS) &&
 1665|       |                                    !(ip->bCompareComponents & CMP_COMPONENTS_NONTAUT) &&
 1666|       |                                    !bIsotopic == !inp_norm_data[j]->bHasIsotopicLayer )
 1667|       |                                {
 1668|       |
 1669|       |                                    vDrawData.pWindowData =
 1670|       |                                        CreateWinData_(pCG,
 1671|       |                                            inp_norm_data[j]->at_fixed_bonds,
 1672|       |                                            inp_norm_data[j]->num_at,
 1673|       |                                            inp_norm_data[j]->num_removed_H,
 1674|       |                                            0 /* bAdd_DT_to_num_H */,
 1675|       |                                            inp_norm_data[j]->nNumRemovedProtons,
 1676|       |                                            inp_norm_data[j]->nNumRemovedProtonsIsotopic,
 1677|       |                                            k,
 1678|       |                                            j,
 1679|       |                                            NULL,
 1680|       |                                            NULL,
 1681|       |                                            ip->bAbcNumbers,
 1682|       |                                            &ip->dp,
 1683|       |                                            ip->nMode);
 1684|       |                                }
 1685|       |                                else
 1686|       |                                {
 1687|       |                                    continue;
 1688|       |                                }
 1689|       |                                if ( vDrawData.pWindowData != NULL )
 1690|       |                                {
 1691|       |                                    vDrawData.nComponent = i + 1;
 1692|       |                                    vDrawData.nType = COMPONENT_ORIGINAL_PREPROCESSED;
 1693|       |                                    vDrawData.bReconnected = iINChI; /* 0=>main; 1=>reconnected */
 1694|       |                                    vDrawData.szTitle = inchi__strdup(szTitle);
 1695|       |                                    vDrawData.pWindowData->szTitle = inchi__strdup(szTitle);
 1696|       |                                    DRAWDATA(&vDrawData);
 1697|       |                                }
 1698|       |                            }
 1699|       |#endif
 1700|      0|                        }
 1701|      0|                    }
 1702|      0|                }
 1703|      0|            }
 1704|       |
 1705|       |            /* Save normalized components for composite display */
 1706|   106k|            if ( /*ip->bDisplayCompositeResults && */
 1707|   106k|                all_inp_norm_data
  ------------------
  |  Branch (1707:17): [True: 36.4k, False: 69.6k]
  ------------------
 1708|   106k|                )
 1709|  36.4k|            {
 1710|   109k|                for ( j = 0; j < TAUT_NUM; j++ )
  ------------------
  |  |  573|   109k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1710:30): [True: 72.8k, False: 36.4k]
  ------------------
 1711|  72.8k|                {
 1712|  72.8k|                    if ( inp_norm_data[j]->bExists )
  ------------------
  |  Branch (1712:26): [True: 71.4k, False: 1.40k]
  ------------------
 1713|  71.4k|                    {
 1714|  71.4k|                        all_inp_norm_data[i][j] = *inp_norm_data[j];
 1715|  71.4k|                        memset(inp_norm_data[j], 0, sizeof(*inp_norm_data[0])); /* djb-rwth: memset_s C11/Annex K variant? */
 1716|  71.4k|                    }
 1717|  72.8k|                }
 1718|  36.4k|            }
 1719|   106k|        }
 1720|       |
 1721|       |        /* #endif */ /* } COMPILE_ANSI_ONLY */
 1722|       |
 1723|       |
 1724|   106k|        if ( nRet )
  ------------------
  |  Branch (1724:14): [True: 4, False: 106k]
  ------------------
 1725|      4|        {
 1726|      4|            nRet = TreatErrorsInCreateOneComponentINChI(sd, ip,
 1727|      4|                cur_prep_inp_data,
 1728|      4|                i, num_inp, inp_file,
 1729|      4|                log_file, out_file, prb_file);
 1730|      4|            break;
 1731|      4|        }
 1732|   106k|    }
 1733|       |    /**************************************************************************/
 1734|       |    /*                                                                        */
 1735|       |    /*                                                                        */
 1736|       |    /*   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     */
 1737|       |    /*                                                                        */
 1738|       |    /*          C O M P O N E N T S    O N E   B Y   O N E                    */
 1739|       |    /*                                                                        */
 1740|       |    /*                                                                        */
 1741|       |    /**************************************************************************/
 1742|       |
 1743|  70.4k|exit_cycle:
 1744|  70.4k|    switch ( nRet )
 1745|  70.4k|    {
 1746|      2|    case _IS_FATAL:
  ------------------
  |  |   13|      2|#define _IS_FATAL   3
  ------------------
  |  Branch (1746:5): [True: 2, False: 70.4k]
  ------------------
 1747|      4|    case _IS_ERROR:
  ------------------
  |  |   12|      4|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (1747:5): [True: 2, False: 70.4k]
  ------------------
 1748|      4|        break;
 1749|  70.4k|    default:
  ------------------
  |  Branch (1749:5): [True: 70.4k, False: 4]
  ------------------
 1750|       |
 1751|       |        /* #ifndef COMPILE_ANSI_ONLY *//* { */
 1752|       |            /* composite results picture(s) */
 1753|  70.4k|        if ( all_inp_norm_data )
  ------------------
  |  Branch (1753:14): [True: 811, False: 69.6k]
  ------------------
 1754|    811|        {
 1755|    811|            CreateCompositeNormAtom(composite_norm_data,
 1756|    811|                all_inp_norm_data,
 1757|    811|                prep_inp_data[iINChI].num_components);
 1758|       |            /*
 1759|       |            for ( i = 0; i < prep_inp_data[iINChI].num_components; i ++ ) {
 1760|       |                for ( k = 0; k < TAUT_NUM; k ++ ) {
 1761|       |                   FreeInpAtomData( &all_inp_norm_data[i][k] );
 1762|       |                }
 1763|       |            }
 1764|       |            inchi_free( all_inp_norm_data );
 1765|       |            all_inp_norm_data = NULL;
 1766|       |            */
 1767|    811|        }
 1768|       |        /* #endif */ /* } COMPILE_ANSI_ONLY */
 1769|       |
 1770|  70.4k|        break;
 1771|  70.4k|    }
 1772|       |
 1773|       |    /*#ifndef COMPILE_ANSI_ONLY*/ /* { */
 1774|       |
 1775|       |        /* avoid memory leaks in case of error */
 1776|  70.4k|    if ( all_inp_norm_data )
  ------------------
  |  Branch (1776:10): [True: 811, False: 69.6k]
  ------------------
 1777|    811|    {
 1778|  37.2k|        for ( i = 0; i < prep_inp_data[iINChI].num_components; i++ )
  ------------------
  |  Branch (1778:22): [True: 36.4k, False: 811]
  ------------------
 1779|  36.4k|        {
 1780|   109k|            for ( k = 0; k < TAUT_NUM; k++ )
  ------------------
  |  |  573|   109k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1780:26): [True: 72.8k, False: 36.4k]
  ------------------
 1781|  72.8k|            {
 1782|  72.8k|                FreeInpAtomData(&all_inp_norm_data[i][k]);
 1783|  72.8k|            }
 1784|  36.4k|        }
 1785|    811|        inchi_free(all_inp_norm_data);
  ------------------
  |  | 1152|    811|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 811, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 811]
  |  |  ------------------
  ------------------
 1786|    811|        all_inp_norm_data = NULL;
 1787|    811|    }
 1788|       |    /*#endif */ /* } COMPILE_ANSI_ONLY */
 1789|       |
 1790|  70.4k|    FreeInpAtomData(inp_cur_data);
 1791|   211k|    for ( i = 0; i < TAUT_NUM; i++ )
  ------------------
  |  |  573|   211k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1791:18): [True: 140k, False: 70.4k]
  ------------------
 1792|   140k|    {
 1793|   140k|        FreeInpAtomData(inp_norm_data[i]);
 1794|   140k|    }
 1795|       |
 1796|       |
 1797|  70.4k|exit_function:
 1798|       |
 1799|  70.4k|    return nRet;
 1800|  70.4k|}
CreateOneComponentINChI:
 1821|   106k|{
 1822|   106k|    inchiTime     ulTStart, ulTEnd, * pulTEnd = NULL;
 1823|   106k|    int           k, num_at, ret = 0;
 1824|   106k|    int           bOrigCoord;
 1825|   106k|    INCHI_MODE     bTautFlags = ip->bTautFlags;
 1826|   106k|    INCHI_MODE     bTautFlagsDone = (ip->bTautFlagsDone | sd->bTautFlagsDone[INCHI_BAS]);
  ------------------
  |  |  570|   106k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1827|   106k|    INChI* cur_INChI[TAUT_NUM];
 1828|   106k|    INChI_Aux* cur_INChI_Aux[TAUT_NUM];
 1829|   106k|    long          lElapsedTime;
 1830|       |
 1831|   106k|    int nAllocMode = 0;  /* moved from below 2024-09-01 DT */
 1832|       |
 1833|       |#ifdef GHI100_FIX
 1834|       |#if ((SPRINTF_FLAG != 1) && (SPRINTF_FLAG != 2))
 1835|       |    setlocale(LC_ALL, "en-US"); /* djb-rwth: setting all locales to "en-US" */
 1836|       |#endif
 1837|       |#endif
 1838|       |
 1839|   106k|    InchiTimeGet( &ulTStart );
 1840|       |
 1841|   106k|    bOrigCoord =
 1842|   106k|        !(ip->bINChIOutputOptions & (INCHI_OUT_NO_AUX_INFO | INCHI_OUT_SHORT_AUX_INFO));
  ------------------
  |  |  129|   106k|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
                      !(ip->bINChIOutputOptions & (INCHI_OUT_NO_AUX_INFO | INCHI_OUT_SHORT_AUX_INFO));
  ------------------
  |  |  130|   106k|#define INCHI_OUT_SHORT_AUX_INFO        0x0002   /* output short version of Aux Info        */
  ------------------
 1843|       |
 1844|   318k|    for ( k = 0; k < TAUT_NUM; k++ )
  ------------------
  |  |  573|   318k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1844:18): [True: 212k, False: 106k]
  ------------------
 1845|   212k|    {
 1846|   212k|        cur_INChI[k] = NULL;
 1847|   212k|        cur_INChI_Aux[k] = NULL;
 1848|   212k|    }
 1849|       |
 1850|       |    /*  Allocate memory for non-tautomeric (k=0) and tautomeric (k=1) results */
 1851|   318k|    for ( k = 0; k < TAUT_NUM; k++ )
  ------------------
  |  |  573|   318k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1851:18): [True: 212k, False: 106k]
  ------------------
 1852|   212k|    {
 1853|       |        /* djb-rwth: introducing variables for correct nAllocMode expression */
 1854|   212k|        int nAM1 = 0, nAM2 = 0;
 1855|       |
 1856|   212k|        if ( k == TAUT_YES )
  ------------------
  |  |  575|   212k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1856:14): [True: 106k, False: 106k]
  ------------------
 1857|   106k|            nAM1 = REQ_MODE_TAUT;
  ------------------
  |  |   16|   106k|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
 1858|       |
 1859|   212k|        if ( bTautFlagsDone & (TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE) )
  ------------------
  |  |  981|   212k|#define TG_FLAG_FOUND_ISOTOPIC_H_DONE    0x00004000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
                      if ( bTautFlagsDone & (TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE) )
  ------------------
  |  |  982|   212k|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  |  Branch (1859:14): [True: 8.43k, False: 203k]
  ------------------
 1860|  8.43k|            nAM2 = ip->nMode & REQ_MODE_ISO;
  ------------------
  |  |   17|  8.43k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
 1861|       |
 1862|   212k|        nAllocMode = nAM1 | nAM2; /* djb-rwth: original sequence of bit-wise operations had to be rewritten */
 1863|       |
 1864|       |
 1865|   212k|        if ( (k == TAUT_NON && (ip->nMode & REQ_MODE_BASIC)) ||
  ------------------
  |  |  574|   424k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      if ( (k == TAUT_NON && (ip->nMode & REQ_MODE_BASIC)) ||
  ------------------
  |  |   15|   106k|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (1865:15): [True: 106k, False: 106k]
  |  Branch (1865:32): [True: 35.6k, False: 70.4k]
  ------------------
 1866|   176k|            (k == TAUT_YES && (ip->nMode & REQ_MODE_TAUT)) ) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  575|   352k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          (k == TAUT_YES && (ip->nMode & REQ_MODE_TAUT)) ) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   16|   106k|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  |  Branch (1866:14): [True: 106k, False: 70.4k]
  |  Branch (1866:31): [True: 106k, False: 0]
  ------------------
 1867|   141k|        {
 1868|       |            /*  alloc INChI and INChI_Aux */
 1869|   141k|            cur_INChI[k] = Alloc_INChI(inp_cur_data->at,
 1870|   141k|                inp_cur_data->num_at,
 1871|   141k|                &inp_cur_data->num_bonds,
 1872|   141k|                &inp_cur_data->num_isotopic,
 1873|   141k|                nAllocMode);
 1874|       |
 1875|   141k|            cur_INChI_Aux[k] = Alloc_INChI_Aux(inp_cur_data->num_at,
 1876|   141k|                inp_cur_data->num_isotopic,
 1877|   141k|                nAllocMode,
 1878|   141k|                bOrigCoord);
 1879|   141k|            if ( cur_INChI_Aux[k] )
  ------------------
  |  Branch (1879:18): [True: 141k, False: 0]
  ------------------
 1880|   141k|            {
 1881|   141k|                cur_INChI_Aux[k]->bIsIsotopic = inp_cur_data->num_isotopic;
 1882|   141k|            }
 1883|       |            /*  alloc memory for the output structure: non-tautomeric and tautomeric (for displaying) */
 1884|       |
 1885|   141k|            CreateInpAtomData(inp_norm_data[k], inp_cur_data->num_at, k);
 1886|   141k|        }
 1887|  70.4k|        else
 1888|  70.4k|        {
 1889|  70.4k|            FreeInpAtomData(inp_norm_data[k]);
 1890|  70.4k|        }
 1891|   212k|    }
 1892|       |
 1893|   106k|    lElapsedTime = InchiTimeElapsed(ic, &ulTStart);
 1894|   106k|    if ( ip->msec_MaxTime )
  ------------------
  |  Branch (1894:10): [True: 0, False: 106k]
  ------------------
 1895|      0|    {
 1896|      0|        ip->msec_LeftTime -= lElapsedTime;
 1897|      0|    }
 1898|   106k|    sd->ulStructTime += lElapsedTime;
 1899|       |
 1900|       |    /*^^^#if ( !defined( TARGET_LIB_FOR_WINCHI ) && !defined( TARGET_API_LIB ) ) */
 1901|       |#if ( !defined( TARGET_LIB_FOR_WINCHI ) && !defined( TARGET_API_LIB ) && !defined(TARGET_EXE_STANDALONE) )
 1902|       |#endif
 1903|       |
 1904|       |/******************************************************
 1905|       | *
 1906|       | *  Get one component canonical numberings, etc.
 1907|       | *
 1908|       | ******************************************************/
 1909|       |
 1910|       | /* Create_INChI() return value:
 1911|       |  * num_at <= 0: error code
 1912|       |  * num_at >  0: number of atoms (excluding terminal hydrogen atoms)
 1913|       |  * inp_norm_data[0] => non-tautomeric, inp_norm_data[1] => tautomeric */
 1914|       |
 1915|   106k|    InchiTimeGet(&ulTStart);
 1916|       |
 1917|   106k|    if ( ip->msec_MaxTime )
  ------------------
  |  Branch (1917:10): [True: 0, False: 106k]
  ------------------
 1918|      0|    {
 1919|      0|        ulTEnd = ulTStart;
 1920|      0|        pulTEnd = &ulTEnd;
 1921|      0|        if ( ip->msec_LeftTime > 0 )
  ------------------
  |  Branch (1921:14): [True: 0, False: 0]
  ------------------
 1922|      0|        {
 1923|      0|            InchiTimeAddMsec(ic, pulTEnd, ip->msec_LeftTime);
 1924|      0|        }
 1925|      0|    }
 1926|       |
 1927|   106k|    num_at = Create_INChI(pCG, ic, ip,
 1928|   106k|        cur_INChI, cur_INChI_Aux,
 1929|   106k|        orig_inp_data/* not used */,
 1930|   106k|        inp_cur_data->at, inp_norm_data, inp_cur_data->num_at,
 1931|   106k|        inp_cur_data->keep_explicit_HDT,
 1932|   106k|        ip->nMode,
 1933|   106k|        &bTautFlags, &bTautFlagsDone,
 1934|   106k|        pulTEnd, NULL, sd->pStrErrStruct);
 1935|       |
 1936|   106k|    SetConnectedComponentNumber(inp_cur_data->at, inp_cur_data->num_at, i + 1);
 1937|       |    /*  NB: normalization alters structure component number */
 1938|       |
 1939|   318k|    for ( k = 0; k < TAUT_NUM; k++ )
  ------------------
  |  |  573|   318k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1939:18): [True: 212k, False: 106k]
  ------------------
 1940|   212k|    {
 1941|   212k|        if ( cur_INChI_Aux[k] && cur_INChI_Aux[k]->nNumberOfAtoms > 0 )
  ------------------
  |  Branch (1941:14): [True: 141k, False: 70.4k]
  |  Branch (1941:34): [True: 141k, False: 208]
  ------------------
 1942|   141k|        {
 1943|   141k|            pncFlags->bNormalizationFlags[iINChI][k] |=
 1944|   141k|                cur_INChI_Aux[k]->bNormalizationFlags;
 1945|   141k|            pncFlags->bTautFlags[iINChI][k] |=
 1946|   141k|                cur_INChI_Aux[k]->bTautFlags;
 1947|   141k|            pncFlags->bTautFlagsDone[iINChI][k] |=
 1948|   141k|                cur_INChI_Aux[k]->bTautFlagsDone;
 1949|   141k|            pncFlags->nCanonFlags[iINChI][k] |=
 1950|   141k|                cur_INChI_Aux[k]->nCanonFlags;
 1951|   141k|        }
 1952|   212k|    }
 1953|       |
 1954|       |    /*  Detect errors */
 1955|   106k|    if ( num_at < 0 )
  ------------------
  |  Branch (1955:10): [True: 4, False: 106k]
  ------------------
 1956|      4|    {
 1957|      4|        sd->nErrorCode = num_at;
 1958|      4|    }
 1959|   106k|    else if ( num_at == 0 )
  ------------------
  |  Branch (1959:15): [True: 0, False: 106k]
  ------------------
 1960|      0|    {
 1961|      0|        sd->nErrorCode = -1;
 1962|      0|    }
 1963|   106k|    else if ( cur_INChI[TAUT_NON] && cur_INChI[TAUT_NON]->nErrorCode )
  ------------------
  |  |  574|   106k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  else if ( cur_INChI[TAUT_NON] && cur_INChI[TAUT_NON]->nErrorCode )
  ------------------
  |  |  574|  35.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1963:15): [True: 35.6k, False: 70.4k]
  |  Branch (1963:38): [True: 0, False: 35.6k]
  ------------------
 1964|      0|    {   /*  non-tautomeric error */
 1965|      0|        sd->nErrorCode = cur_INChI[TAUT_NON]->nErrorCode;
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1966|      0|    }
 1967|   106k|    else if ( cur_INChI[TAUT_YES] && cur_INChI[TAUT_YES]->nErrorCode )
  ------------------
  |  |  575|   106k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  else if ( cur_INChI[TAUT_YES] && cur_INChI[TAUT_YES]->nErrorCode )
  ------------------
  |  |  575|   106k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1967:15): [True: 106k, False: 0]
  |  Branch (1967:38): [True: 0, False: 106k]
  ------------------
 1968|      0|    {   /*  tautomeric error */
 1969|      0|        sd->nErrorCode = cur_INChI[TAUT_YES]->nErrorCode;
  ------------------
  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1970|      0|    }
 1971|       |
 1972|       |
 1973|       |#if ( bRELEASE_VERSION == 0 )
 1974|       |    if ( cur_INChI[TAUT_NON] ) sd->bExtract |= cur_INChI[TAUT_NON]->bExtract;
 1975|       |    if ( cur_INChI[TAUT_YES] ) sd->bExtract |= cur_INChI[TAUT_YES]->bExtract;
 1976|       |    if ( (TG_FLAG_TEST_TAUT3_SALTS_DONE & bTautFlagsDone) )
 1977|       |    {
 1978|       |        sd->bExtract |= EXTR_TEST_TAUT3_SALTS_DONE;
 1979|       |    }
 1980|       |#endif
 1981|       |
 1982|       |    /*  Detect and store stereo warnings */
 1983|   106k|    if ( !sd->nErrorCode )
  ------------------
  |  Branch (1983:10): [True: 106k, False: 4]
  ------------------
 1984|   106k|        GetProcessingWarningsOneComponentInChI(cur_INChI, inp_norm_data, sd, ip->bNoWarnings);
 1985|       |
 1986|   106k|    lElapsedTime = InchiTimeElapsed(ic, &ulTStart);
 1987|   106k|    if ( ip->msec_MaxTime )
  ------------------
  |  Branch (1987:10): [True: 0, False: 106k]
  ------------------
 1988|      0|    {
 1989|      0|        ip->msec_LeftTime -= lElapsedTime;
 1990|      0|    }
 1991|   106k|    sd->ulStructTime += lElapsedTime;
 1992|       |
 1993|       |#if !defined(TARGET_API_LIB) && !defined(COMPILE_ANSI_ONLY)
 1994|       |    /*  Display the results */
 1995|       |    if ( ip->bDisplay )
 1996|       |    {
 1997|       |        eat_keyboard_input();
 1998|       |    }
 1999|       |#endif
 2000|       |
 2001|       |    /*  a) No matter what happened save the allocated INChI pointers */
 2002|       |    /*  save the INChI of the current component */
 2003|       |
 2004|   106k|    InchiTimeGet(&ulTStart);
 2005|   318k|    for ( k = 0; k < TAUT_NUM; k++ )
  ------------------
  |  |  573|   318k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (2005:18): [True: 212k, False: 106k]
  ------------------
 2006|   212k|    {
 2007|   212k|        pINChI[i][k] = cur_INChI[k];
 2008|   212k|        pINChI_Aux[i][k] = cur_INChI_Aux[k];
 2009|   212k|        cur_INChI[k] = NULL;
 2010|   212k|        cur_INChI_Aux[k] = NULL;
 2011|   212k|    }
 2012|       |
 2013|       |    /*  b) Count one component structure and/or INChI results only
 2014|       |           if there was no error
 2015|       |           Set inp_norm_data[j]->num_removed_H = number of removed explicit H
 2016|       |    */
 2017|       |
 2018|   106k|    if ( !sd->nErrorCode )
  ------------------
  |  Branch (2018:10): [True: 106k, False: 4]
  ------------------
 2019|   106k|    {
 2020|       |        /*  find where the current processed structure is located */
 2021|   106k|        int cur_is_in_non_taut = (pINChI[i][TAUT_NON] &&
  ------------------
  |  |  574|   106k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2021:35): [True: 35.6k, False: 70.4k]
  ------------------
 2022|  35.6k|            pINChI[i][TAUT_NON]->nNumberOfAtoms > 0);
  ------------------
  |  |  574|  35.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2022:13): [True: 35.4k, False: 204]
  ------------------
 2023|   106k|        int cur_is_in_taut = (pINChI[i][TAUT_YES] &&
  ------------------
  |  |  575|   106k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2023:31): [True: 106k, False: 0]
  ------------------
 2024|   106k|            pINChI[i][TAUT_YES]->nNumberOfAtoms > 0);
  ------------------
  |  |  575|   106k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2024:13): [True: 106k, False: 0]
  ------------------
 2025|       |
 2026|   106k|        int cur_is_non_taut = (cur_is_in_non_taut && 0 == pINChI[i][TAUT_NON]->lenTautomer) ||
  ------------------
  |  |  574|  35.4k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2026:32): [True: 35.4k, False: 70.6k]
  |  Branch (2026:54): [True: 35.4k, False: 0]
  ------------------
 2027|  70.6k|            (cur_is_in_taut && 0 == pINChI[i][TAUT_YES]->lenTautomer); /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |  575|  70.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2027:14): [True: 70.6k, False: 0]
  |  Branch (2027:32): [True: 69.1k, False: 1.44k]
  ------------------
 2028|   106k|        int cur_is_taut = cur_is_in_taut && 0 < pINChI[i][TAUT_YES]->lenTautomer;
  ------------------
  |  |  575|   106k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2028:27): [True: 106k, False: 0]
  |  Branch (2028:45): [True: 36.9k, False: 69.1k]
  ------------------
 2029|       |
 2030|       |        /*
 2031|       |        sd->bTautFlags[iINChI]     |= bTautFlags;
 2032|       |        sd->bTautFlagsDone[iINChI] |= bTautFlagsDone;
 2033|       |        */
 2034|       |
 2035|   106k|        if ( cur_is_non_taut + cur_is_taut )
  ------------------
  |  Branch (2035:14): [True: 106k, False: 0]
  ------------------
 2036|   106k|        {
 2037|       |            /*  count tautomeric and non-tautomeric components of the structures */
 2038|   106k|            int j1 = cur_is_in_non_taut ? TAUT_NON : TAUT_YES;
  ------------------
  |  |  574|  35.4k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                          int j1 = cur_is_in_non_taut ? TAUT_NON : TAUT_YES;
  ------------------
  |  |  575|  70.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2038:22): [True: 35.4k, False: 70.6k]
  ------------------
 2039|   106k|            int j2 = cur_is_in_taut ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  575|   106k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          int j2 = cur_is_in_taut ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  574|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2039:22): [True: 106k, False: 0]
  ------------------
 2040|   106k|            int j;
 2041|   106k|            sd->num_non_taut[iINChI] += cur_is_non_taut;
 2042|   106k|            sd->num_taut[iINChI] += cur_is_taut;
 2043|   247k|            for ( j = j1; j <= j2; j++ )
  ------------------
  |  Branch (2043:27): [True: 141k, False: 106k]
  ------------------
 2044|   141k|            {
 2045|   141k|                int bIsotopic = (pINChI[i][j]->nNumberOfIsotopicAtoms ||
  ------------------
  |  Branch (2045:34): [True: 1.37k, False: 140k]
  ------------------
 2046|   140k|                    pINChI[i][j]->nNumberOfIsotopicTGroups ||
  ------------------
  |  Branch (2046:21): [True: 0, False: 140k]
  ------------------
 2047|   140k|                    (pINChI[i][j]->nPossibleLocationsOfIsotopicH && pINChI[i][j]->nPossibleLocationsOfIsotopicH[0] > 1)); /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2047:22): [True: 6.86k, False: 133k]
  |  Branch (2047:69): [True: 40, False: 6.82k]
  ------------------
 2048|   141k|                if ( pINChI_Aux[i][j] && (j == TAUT_YES) ) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  |  575|   141k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2048:22): [True: 141k, False: 0]
  |  Branch (2048:42): [True: 106k, False: 35.4k]
  ------------------
 2049|   106k|                {
 2050|   106k|                    bIsotopic |= (0 < pINChI_Aux[i][j]->nNumRemovedIsotopicH[0] +
 2051|   106k|                        pINChI_Aux[i][j]->nNumRemovedIsotopicH[1] +
 2052|   106k|                        pINChI_Aux[i][j]->nNumRemovedIsotopicH[2]);
 2053|   106k|                }
 2054|       |
 2055|   141k|                inp_norm_data[j]->bExists = 1; /*  j=0: non-taut exists, j=1: taut exists */
 2056|   141k|                inp_norm_data[j]->bHasIsotopicLayer = bIsotopic;
 2057|       |                /*inp_norm_data[j]->num_removed_H = inp_norm_data[j]->num_at - num_at;*/
 2058|   141k|            }
 2059|   106k|        }
 2060|   106k|    }
 2061|       |
 2062|       |    /* return (sd->nErrorCode==CT_OUT_OF_RAM || sd->nErrorCode==CT_USER_QUIT_ERR)? _IS_FATAL :
 2063|       |            sd->nErrorCode? _IS_ERROR : 0; */
 2064|       |
 2065|   106k|    if ( sd->nErrorCode == CT_OUT_OF_RAM || sd->nErrorCode == CT_USER_QUIT_ERR )
  ------------------
  |  |   21|   212k|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|   106k|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
                  if ( sd->nErrorCode == CT_OUT_OF_RAM || sd->nErrorCode == CT_USER_QUIT_ERR )
  ------------------
  |  |   32|   106k|#define CT_USER_QUIT_ERR     (CT_ERR_FIRST-13)  /*(-30013) */
  |  |  ------------------
  |  |  |  |   18|   106k|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (2065:10): [True: 2, False: 106k]
  |  Branch (2065:45): [True: 0, False: 106k]
  ------------------
 2066|      2|    {
 2067|      2|        ret = _IS_FATAL;
  ------------------
  |  |   13|      2|#define _IS_FATAL   3
  ------------------
 2068|      2|    }
 2069|   106k|    else if ( sd->nErrorCode )
  ------------------
  |  Branch (2069:15): [True: 2, False: 106k]
  ------------------
 2070|      2|    {
 2071|      2|        ret = _IS_ERROR;
  ------------------
  |  |   12|      2|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
 2072|      2|    }
 2073|       |
 2074|   106k|    lElapsedTime = InchiTimeElapsed(ic, &ulTStart);
 2075|   106k|    if ( ip->msec_MaxTime )
  ------------------
  |  Branch (2075:10): [True: 0, False: 106k]
  ------------------
 2076|      0|    {
 2077|      0|        ip->msec_LeftTime -= lElapsedTime;
 2078|      0|    }
 2079|   106k|    sd->ulStructTime += lElapsedTime;
 2080|       |
 2081|   106k|    return ret;
 2082|   106k|}
runichi.c:DoOneStructureEarlyPreprocessing:
  564|  70.4k|{
  565|       |
  566|  70.4k|#if ( RING2CHAIN == 1 || UNDERIVATIZE == 1 )
  567|  70.4k|    int ret1 = 0, ret2 = 0; /* djb-rwth: removing redundant variables */
  568|  70.4k|#endif
  569|       |
  570|       |#if ( REMOVE_ION_PAIRS_ORIG_STRU == 1 )
  571|       |    fix_odd_things(orig_inp_data->num_inp_atoms, orig_inp_data->at, 0, ip->bFixNonUniformDraw);
  572|       |#endif
  573|       |
  574|  70.4k|#if ( UNDERIVATIZE == 1 )
  575|  70.4k|    if ( ip->bUnderivatize )
  ------------------
  |  Branch (575:10): [True: 0, False: 70.4k]
  ------------------
  576|      0|    {
  577|      0|        if ( 0 > (ret2 = OAD_Edit_Underivatize(ic, pCG, orig_inp_data, (ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY), ip->bUnderivatize & 2, ip->pSdfValue)) )
  ------------------
  |  |  133|      0|#define INCHI_OUT_SDFILE_ONLY           0x0010   /* save input data in a Molfile instead of creating INChI */
  ------------------
  |  Branch (577:14): [True: 0, False: 0]
  ------------------
  578|      0|        {
  579|      0|            long num_inp2 = num_inp;
  580|      0|            AddErrorMessage(sd->pStrErrStruct, "Underivatization error");
  581|      0|            sd->nStructReadError = 99;
  582|      0|            sd->nErrorType = _IS_ERROR;
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  583|      0|            TreatErrorsInReadTheStructure(sd, ip, LOG_MASK_ALL, inp_file, log_file, out_file, prb_file,
  ------------------
  |  |   98|      0|#define LOG_MASK_ALL     (LOG_MASK_WARN | LOG_MASK_ERR | LOG_MASK_FATAL)
  |  |  ------------------
  |  |  |  |   94|      0|#define LOG_MASK_WARN  1
  |  |  ------------------
  |  |               #define LOG_MASK_ALL     (LOG_MASK_WARN | LOG_MASK_ERR | LOG_MASK_FATAL)
  |  |  ------------------
  |  |  |  |   95|      0|#define LOG_MASK_ERR   2
  |  |  ------------------
  |  |               #define LOG_MASK_ALL     (LOG_MASK_WARN | LOG_MASK_ERR | LOG_MASK_FATAL)
  |  |  ------------------
  |  |  |  |   96|      0|#define LOG_MASK_FATAL 4
  |  |  ------------------
  ------------------
  584|      0|                prep_inp_data, &num_inp2);
  585|      0|            return _IS_ERROR; /* output only if derivatives found */
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  586|      0|        }
  587|      0|        else if ( 0 < ret2 )
  ------------------
  |  Branch (587:19): [True: 0, False: 0]
  ------------------
  588|      0|        {
  589|      0|            if ( !ip->bNoWarnings )
  ------------------
  |  Branch (589:18): [True: 0, False: 0]
  ------------------
  590|      0|            {
  591|      0|                WarningMessage(sd->pStrErrStruct, "Input structure underivatized");
  ------------------
  |  |  132|      0|#define WarningMessage AddErrorMessage
  ------------------
  592|      0|            }
  593|      0|        }
  594|      0|    }
  595|  70.4k|#endif /* UNDERIVATIZE == 1 */
  596|       |
  597|  70.4k|#if ( RING2CHAIN == 1 )
  598|  70.4k|    if ( ip->bRing2Chain && 0 > (ret1 = Ring2Chain(ic, pCG, orig_inp_data)) )
  ------------------
  |  Branch (598:10): [True: 0, False: 70.4k]
  |  Branch (598:29): [True: 0, False: 0]
  ------------------
  599|      0|    {
  600|      0|        long num_inp2 = num_inp;
  601|      0|        AddErrorMessage(sd->pStrErrStruct, "Ring to chain error");
  602|      0|        sd->nStructReadError = 99;
  603|      0|        sd->nErrorType = _IS_ERROR;
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  604|       |        /* djb-rwth: removing redundant code */
  605|      0|        TreatErrorsInReadTheStructure(sd, ip, LOG_MASK_ALL,
  ------------------
  |  |   98|      0|#define LOG_MASK_ALL     (LOG_MASK_WARN | LOG_MASK_ERR | LOG_MASK_FATAL)
  |  |  ------------------
  |  |  |  |   94|      0|#define LOG_MASK_WARN  1
  |  |  ------------------
  |  |               #define LOG_MASK_ALL     (LOG_MASK_WARN | LOG_MASK_ERR | LOG_MASK_FATAL)
  |  |  ------------------
  |  |  |  |   95|      0|#define LOG_MASK_ERR   2
  |  |  ------------------
  |  |               #define LOG_MASK_ALL     (LOG_MASK_WARN | LOG_MASK_ERR | LOG_MASK_FATAL)
  |  |  ------------------
  |  |  |  |   96|      0|#define LOG_MASK_FATAL 4
  |  |  ------------------
  ------------------
  606|      0|            inp_file, log_file,
  607|      0|            out_file, prb_file,
  608|      0|            prep_inp_data, &num_inp2);
  609|      0|        return _IS_ERROR; /* output only if derivatives found */
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  610|      0|    }
  611|  70.4k|#endif /* RING2CHAIN == 1 */
  612|  70.4k|#if ( RING2CHAIN == 1 || UNDERIVATIZE == 1 )  /***** post v.1 feature *****/
  613|  70.4k|    if ( ip->bIgnoreUnchanged && !ret1 && !ret2 )
  ------------------
  |  Branch (613:10): [True: 0, False: 70.4k]
  |  Branch (613:34): [True: 0, False: 0]
  |  Branch (613:43): [True: 0, False: 0]
  ------------------
  614|      0|    {
  615|      0|        return _IS_SKIP; /* output only if derivatives or ring/chain found */
  ------------------
  |  |   16|      0|#define _IS_SKIP   -2
  ------------------
  616|      0|    }
  617|  70.4k|#endif /* RING2CHAIN == 1 || UNDERIVATIZE == 1 */
  618|  70.4k|    return 0;
  619|  70.4k|}
runichi.c:OrigAtData_StoreNativeInput:
  659|  70.4k|{
  660|       |
  661|       |    /*    v. 1.05 always create and fill OrigStruc as it may be used to store e.g. polymer info    */
  662|       |    /*    If normal AuxInfo is requested, create full reversibility information from native inp data
  663|       |    if ( ip->bINChIOutputOptions & (INCHI_OUT_NO_AUX_INFO | INCHI_OUT_SHORT_AUX_INFO))
  664|       |        return NULL; */
  665|       |
  666|  70.4k|    if ( OrigStruct_FillOut(pCG, orig_inp_data, pOrigStruct, sd) )
  ------------------
  |  Branch (666:10): [True: 0, False: 70.4k]
  ------------------
  667|      0|    {
  668|      0|        AddErrorMessage(sd->pStrErrStruct, "Cannot interpret reversibility information");
  669|      0|        sd->nStructReadError = 99;
  670|      0|        sd->nErrorType = _IS_ERROR;
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  671|      0|        *nRet = _IS_ERROR;
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  672|      0|    }
  673|       |
  674|  70.4k|    return pOrigStruct;
  675|  70.4k|}
runichi.c:PrepareSaveOptBits:
  682|  70.4k|{
  683|  70.4k|    if ( ip->nInputType != INPUT_INCHI )
  ------------------
  |  Branch (683:10): [True: 0, False: 70.4k]
  ------------------
  684|      0|    {
  685|      0|        *save_opt_bits = 0;
  686|      0|        if ( ip->bINChIOutputOptions & INCHI_OUT_SAVEOPT )
  ------------------
  |  |  146|      0|#define INCHI_OUT_SAVEOPT  0x8000
  ------------------
  |  Branch (686:14): [True: 0, False: 0]
  ------------------
  687|      0|        {
  688|      0|            if ( 0 != (ip->bTautFlags & TG_FLAG_RECONNECT_COORD) )
  ------------------
  |  |  932|      0|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  |  Branch (688:18): [True: 0, False: 0]
  ------------------
  689|      0|            {
  690|      0|                (*save_opt_bits) |= SAVE_OPT_RECMET;
  ------------------
  |  |  158|      0|#define SAVE_OPT_RECMET 0x0008
  ------------------
  691|      0|            }
  692|      0|            if ( 0 != (ip->nMode & REQ_MODE_BASIC) )
  ------------------
  |  |   15|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (692:18): [True: 0, False: 0]
  ------------------
  693|      0|            {
  694|      0|                (*save_opt_bits) |= SAVE_OPT_FIXEDH;
  ------------------
  |  |  157|      0|#define SAVE_OPT_FIXEDH 0x0004
  ------------------
  695|      0|            }
  696|      0|            if ( 0 != (ip->nMode & REQ_MODE_DIFF_UU_STEREO) )
  ------------------
  |  |   40|      0|#define REQ_MODE_DIFF_UU_STEREO     0x004000    /* SLUUD Make labels for unknown and undefined stereo different */
  ------------------
  |  Branch (696:18): [True: 0, False: 0]
  ------------------
  697|      0|            {
  698|      0|                (*save_opt_bits) |= SAVE_OPT_SLUUD;
  ------------------
  |  |  155|      0|#define SAVE_OPT_SLUUD  0x0001
  ------------------
  699|      0|            }
  700|      0|            if ( 0 == (ip->nMode & (REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU)) )
  ------------------
  |  |   32|      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)) )
  ------------------
  |  |   30|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  |  Branch (700:18): [True: 0, False: 0]
  ------------------
  701|      0|            {
  702|      0|                (*save_opt_bits) |= SAVE_OPT_SUU;
  ------------------
  |  |  156|      0|#define SAVE_OPT_SUU    0x0002
  ------------------
  703|      0|            }
  704|      0|            if ( 0 != (ip->bTautFlags & TG_FLAG_KETO_ENOL_TAUT) )
  ------------------
  |  |  946|      0|#define TG_FLAG_KETO_ENOL_TAUT           0x00080000   /* turn on keto-enol tautomerism detection */
  ------------------
  |  Branch (704:18): [True: 0, False: 0]
  ------------------
  705|      0|            {
  706|      0|                (*save_opt_bits) |= SAVE_OPT_KET;
  ------------------
  |  |  159|      0|#define SAVE_OPT_KET    0x0010
  ------------------
  707|      0|            }
  708|      0|            if ( 0 != (ip->bTautFlags & TG_FLAG_1_5_TAUT) )
  ------------------
  |  |  947|      0|#define TG_FLAG_1_5_TAUT                 0x00100000   /* turn on 1,5 tautomerism detection */
  ------------------
  |  Branch (708:18): [True: 0, False: 0]
  ------------------
  709|      0|            {
  710|      0|                (*save_opt_bits) |= SAVE_OPT_15T;
  ------------------
  |  |  160|      0|#define SAVE_OPT_15T    0x0020
  ------------------
  711|      0|            }
  712|       |            /* djb-rwth: addressing coverity ID #499536 -- despite different bit-sizes, works properly */
  713|      0|            if (0 != (ip->bTautFlags & TG_FLAG_PT_22_00))
  ------------------
  |  |  953|      0|#define TG_FLAG_PT_22_00                 0x00800000
  ------------------
  |  Branch (713:17): [True: 0, False: 0]
  ------------------
  714|      0|                (*save_opt_bits) |= SAVE_OPT_PT_22_00;
  ------------------
  |  |  161|      0|#define SAVE_OPT_PT_22_00 0x0040
  ------------------
  715|      0|            if ( 0 != (ip->bTautFlags & TG_FLAG_PT_16_00) )
  ------------------
  |  |  954|      0|#define TG_FLAG_PT_16_00                 0x01000000
  ------------------
  |  Branch (715:18): [True: 0, False: 0]
  ------------------
  716|      0|                (*save_opt_bits) |= SAVE_OPT_PT_16_00;
  ------------------
  |  |  162|      0|#define SAVE_OPT_PT_16_00 0x0080
  ------------------
  717|      0|            if ( 0 != (ip->bTautFlags & TG_FLAG_PT_06_00) )
  ------------------
  |  |  955|      0|#define TG_FLAG_PT_06_00                 0x02000000
  ------------------
  |  Branch (717:18): [True: 0, False: 0]
  ------------------
  718|      0|                (*save_opt_bits) |= SAVE_OPT_PT_06_00;
  ------------------
  |  |  163|      0|#define SAVE_OPT_PT_06_00 0x0100
  ------------------
  719|      0|            if ( 0 != (ip->bTautFlags & TG_FLAG_PT_39_00) )
  ------------------
  |  |  956|      0|#define TG_FLAG_PT_39_00                 0x04000000
  ------------------
  |  Branch (719:18): [True: 0, False: 0]
  ------------------
  720|      0|                (*save_opt_bits) |= SAVE_OPT_PT_39_00;
  ------------------
  |  |  164|      0|#define SAVE_OPT_PT_39_00 0x0200
  ------------------
  721|      0|            if ( 0 != (ip->bTautFlags & TG_FLAG_PT_13_00) )
  ------------------
  |  |  957|      0|#define TG_FLAG_PT_13_00                 0x08000000
  ------------------
  |  Branch (721:18): [True: 0, False: 0]
  ------------------
  722|      0|                (*save_opt_bits) |= SAVE_OPT_PT_13_00;
  ------------------
  |  |  165|      0|#define SAVE_OPT_PT_13_00 0x0400
  ------------------
  723|      0|            if ( 0 != (ip->bTautFlags & TG_FLAG_PT_18_00) )
  ------------------
  |  |  958|      0|#define TG_FLAG_PT_18_00                 0x10000000
  ------------------
  |  Branch (723:18): [True: 0, False: 0]
  ------------------
  724|      0|                (*save_opt_bits) |= SAVE_OPT_PT_18_00;
  ------------------
  |  |  166|      0|#define SAVE_OPT_PT_18_00 0x0800
  ------------------
  725|       |            /* Check if /SNon requested and turn OFF stereo bits if so */
  726|      0|            if ( !(ip->nMode & REQ_MODE_STEREO) )
  ------------------
  |  |   19|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
  |  Branch (726:18): [True: 0, False: 0]
  ------------------
  727|      0|            {
  728|      0|                (*save_opt_bits) &= ~SAVE_OPT_SUU;
  ------------------
  |  |  156|      0|#define SAVE_OPT_SUU    0x0002
  ------------------
  729|      0|                (*save_opt_bits) &= ~SAVE_OPT_SLUUD;
  ------------------
  |  |  155|      0|#define SAVE_OPT_SLUUD  0x0001
  ------------------
  730|      0|            }
  731|      0|        }
  732|      0|    }
  733|  70.4k|}
runichi.c:DisplayOrigAndResultStructuresAndComponents:
  755|  70.4k|{
  756|       |
  757|       |
  758|  70.4k|    if ( ip->bDisplay )    ip->bDisplayCompositeResults = 1;    /* v. 1.05 */
  ------------------
  |  Branch (758:10): [True: 0, False: 70.4k]
  ------------------
  759|       |
  760|       |#ifndef COMPILE_ANSI_ONLY /* { */
  761|       |
  762|       |    /* Display equivalent components on original or preprocessed structure(s) */
  763|       |#ifndef TARGET_LIB_FOR_WINCHI
  764|       |    if ( nRet != _IS_FATAL && nRet != _IS_ERROR && /*ip->bDisplay &&*/
  765|       |        (ip->bCompareComponents & CMP_COMPONENTS) && !sd->bUserQuit && !sd->bUserQuitComponent )
  766|       |    {
  767|       |        int j, ret, ord;
  768|       |        int bDisplaySaved = ip->bDisplay;
  769|       |        ORIG_ATOM_DATA* inp_data;
  770|       |        AT_NUMB         nEquSet;
  771|       |        for ( ord = -1; ord < INCHI_NUM; ord++ )
  772|       |        {
  773|       |            switch ( ord )
  774|       |            {
  775|       |            case -1:
  776|       |                j = INCHI_BAS;  /* preprocessed non-tautomeric */
  777|       |                break;
  778|       |            case 0:
  779|       |                j = INCHI_REC;  /* preprocessed tautomeric */
  780|       |                break;
  781|       |            case 1:
  782|       |                j = -1;        /* original input */
  783|       |                break;
  784|       |            default:
  785|       |                continue;
  786|       |            }
  787|       |            inp_data = j < 0 ? orig_inp_data : prep_inp_data + j;
  788|       |            if ( inp_data && inp_data->num_inp_atoms && inp_data->at &&
  789|       |                inp_data->nEquLabels &&
  790|       |                inp_data->nNumEquSets )
  791|       |            {
  792|       |                for ( nEquSet = 1; nEquSet <= inp_data->nNumEquSets; nEquSet++ )
  793|       |                {
  794|       |                    ip->dp.nEquLabels = inp_data->nEquLabels;
  795|       |                    ip->dp.nCurEquLabel = nEquSet;
  796|       |                    ip->dp.nNumEquSets = inp_data->nNumEquSets;
  797|       |                    ip->bDisplay = 1; /* force display if it was not requested */
  798|       |                    ret = DisplayTheWholeStructure(pCG, ic, sd, ip, szTitle,
  799|       |                        inp_file, log_file, inp_data,
  800|       |                        num_inp, j, 1 /*bShowStructure*/, 0);
  801|       |                    ip->dp.nEquLabels = NULL;
  802|       |                    ip->dp.nCurEquLabel = 0;
  803|       |                    ip->dp.nNumEquSets = 0;
  804|       |                    ip->bDisplay = bDisplaySaved; /* restore display option */
  805|       |                    if ( ret )
  806|       |                    {
  807|       |                        /* user pressed Esc */
  808|       |                        goto exit_loop;
  809|       |                    }
  810|       |                }
  811|       |            }
  812|       |        }
  813|       |    exit_loop:;
  814|       |    }
  815|       |#endif
  816|       |
  817|       |    /* Display composite results and equivalent components on composite results */
  818|       |    if ( nRet != _IS_FATAL && nRet != _IS_ERROR && /*ip->bDisplay &&*/ ip->bDisplayCompositeResults )
  819|       |    {
  820|       |        int iINChI;
  821|       |        for ( iINChI = 0; iINChI < maxINChI && !sd->bUserQuitComponentDisplay; iINChI++ )
  822|       |        {
  823|       |            DisplayTheWholeCompositeStructure(pCG, ic, ip, sd, num_inp,
  824|       |                iINChI, pINChI[iINChI], pINChI_Aux[iINChI],
  825|       |                orig_inp_data, prep_inp_data, composite_norm_data[iINChI]);
  826|       |        }
  827|       |#ifndef TARGET_LIB_FOR_WINCHI
  828|       |        if ( !ip->bDisplay && sd->bUserQuitComponentDisplay )
  829|       |        {
  830|       |            sd->bUserQuit = 1;
  831|       |        }
  832|       |#endif
  833|       |    }
  834|       |
  835|       |#endif /* } COMPILE_ANSI_ONLY */
  836|       |
  837|  70.4k|    return;
  838|  70.4k|}
runichi.c:SaveOkProcessedMolfile:
  850|  70.4k|{
  851|  70.4k|    if ( ip->bSaveAllGoodStructsAsProblem &&
  ------------------
  |  Branch (851:10): [True: 0, False: 70.4k]
  ------------------
  852|      0|        nRet != _IS_FATAL &&
  ------------------
  |  |   13|  70.4k|#define _IS_FATAL   3
  ------------------
  |  Branch (852:9): [True: 0, False: 0]
  ------------------
  853|      0|        nRet != _IS_ERROR &&
  ------------------
  |  |   12|  70.4k|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (853:9): [True: 0, False: 0]
  ------------------
  854|      0|        prb_file &&
  ------------------
  |  Branch (854:9): [True: 0, False: 0]
  ------------------
  855|      0|        prb_file->f &&
  ------------------
  |  Branch (855:9): [True: 0, False: 0]
  ------------------
  856|      0|        0L <= sd->fPtrStart &&
  ------------------
  |  Branch (856:9): [True: 0, False: 0]
  ------------------
  857|      0|        sd->fPtrStart < sd->fPtrEnd )
  ------------------
  |  Branch (857:9): [True: 0, False: 0]
  ------------------
  858|      0|    {
  859|      0|        MolfileSaveCopy( inp_file, sd->fPtrStart, sd->fPtrEnd, prb_file->f, 0 ); /* djb-rwth: addressing coverity ID #499510 -- return values handled properly */
  860|      0|    }
  861|       |
  862|  70.4k|    return;
  863|  70.4k|}

GetOneComponent:
  436|   106k|{
  437|   106k|    inchiTime ulTStart;
  438|       |
  439|   106k|    InchiTimeGet( &ulTStart );
  440|       |
  441|   106k|    CreateInpAtomData( inp_cur_data, orig_inp_data->nCurAtLen[i], 0 );
  442|       |
  443|   106k|    inp_cur_data->num_at = ExtractConnectedComponent( orig_inp_data->at, orig_inp_data->num_inp_atoms, i + 1, inp_cur_data->at );
  444|       |
  445|   106k|    if (BuildPolymerCrossingBondEndpointMask(inp_cur_data, orig_inp_data, ip, i + 1) < 0)
  ------------------
  |  Branch (445:9): [True: 0, False: 106k]
  ------------------
  446|      0|    {
  447|      0|        AddErrorMessage(sd->pStrErrStruct, "Out of memory while processing polymer data");
  448|       |
  449|      0|        sd->nErrorCode = CT_OUT_OF_RAM;
  ------------------
  |  |   21|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  450|      0|        sd->nErrorType = _IS_FATAL;
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
  451|       |
  452|      0|        sd->ulStructTime += InchiTimeElapsed(ic, &ulTStart);
  453|       |
  454|      0|        return sd->nErrorType;
  455|      0|    }
  456|       |
  457|   106k|    sd->ulStructTime += InchiTimeElapsed( ic, &ulTStart );
  458|       |
  459|       |
  460|       |    /*  Error processing */
  461|   106k|    if (inp_cur_data->num_at <= 0 || orig_inp_data->nCurAtLen[i] != inp_cur_data->num_at)
  ------------------
  |  Branch (461:9): [True: 0, False: 106k]
  |  Branch (461:38): [True: 0, False: 106k]
  ------------------
  462|      0|    {
  463|       |        /*  Log error message */
  464|      0|        AddErrorMessage( sd->pStrErrStruct, "Cannot extract Component" );
  465|      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 ) );
  ------------------
  |  |  830|      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 \
  |  |  ------------------
  |  |  |  Branch (830:28): [True: 0, False: 0]
  |  |  |  Branch (830:35): [True: 0, False: 0]
  |  |  |  Branch (830:65): [True: 0, False: 0]
  |  |  |  Branch (830:72): [True: 0, False: 0]
  |  |  |  Branch (830:96): [True: 0, False: 0]
  |  |  |  Branch (830:103): [True: 0, False: 0]
  |  |  |  Branch (830:115): [True: 0, False: 0]
  |  |  |  Branch (830:122): [True: 0, False: 0]
  |  |  |  Branch (830:163): [True: 0, False: 0]
  |  |  |  Branch (830:170): [True: 0, False: 0]
  |  |  |  Branch (830:185): [True: 0, False: 0]
  |  |  |  Branch (830:192): [True: 0, False: 0]
  |  |  ------------------
  |  |  831|      0|                                                                                                                                                                                                       : gsEmpty
  ------------------
  466|      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;
  ------------------
  |  |   30|      0|#define CT_ATOMCOUNT_ERR     (CT_ERR_FIRST-11)  /*(-30011) */
  |  |  ------------------
  |  |  |  |   18|      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;
  ------------------
  |  |   38|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (466:26): [True: 0, False: 0]
  |  Branch (466:76): [True: 0, False: 0]
  ------------------
  467|       |        /* num_err ++; */
  468|      0|        sd->nErrorType = _IS_ERROR;
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  469|       |#ifdef TARGET_LIB_FOR_WINCHI
  470|       |        if (( ip->bINChIOutputOptions & INCHI_OUT_WINCHI_WINDOW ) &&
  471|       |            ( ip->bINChIOutputOptions & INCHI_OUT_PLAIN_TEXT ))
  472|       |        {
  473|       |            sd->nErrorType = ProcessStructError( out_file,
  474|       |                                                 log_file,
  475|       |                                                 sd->pStrErrStruct,
  476|       |                                                 sd->nErrorType,
  477|       |                                                 num_inp,
  478|       |                                                 ip );
  479|       |        }
  480|       |#endif
  481|      0|    }
  482|       |
  483|   106k|    return sd->nErrorType;
  484|   106k|}
runichi2.c:BuildPolymerCrossingBondEndpointMask:
  331|   106k|{
  332|   106k|    int orig_idx;
  333|   106k|    int local_idx = 0;
  334|   106k|    int unit_idx;
  335|   106k|    int endpoint_idx;
  336|       |
  337|   106k|    if (inp_cur_data->num_at <= 0 || ip->bPolymers == POLYMERS_NO ||
  ------------------
  |  | 1215|   212k|#define POLYMERS_NO 0		/* ignore polymers										*/
  ------------------
  |  Branch (337:9): [True: 0, False: 106k]
  |  Branch (337:38): [True: 106k, False: 0]
  ------------------
  338|      0|        !orig_inp_data->valid_polymer || !orig_inp_data->polymer ||
  ------------------
  |  Branch (338:9): [True: 0, False: 0]
  |  Branch (338:42): [True: 0, False: 0]
  ------------------
  339|      0|        orig_inp_data->polymer->n <= 0)
  ------------------
  |  Branch (339:9): [True: 0, False: 0]
  ------------------
  340|   106k|    {
  341|   106k|        return 0;
  342|   106k|    }
  343|       |
  344|       |    /* No mask is needed if this component contains no explicit H/D/T atoms. */
  345|      0|    for (local_idx = 0; local_idx < inp_cur_data->num_at; local_idx++)
  ------------------
  |  Branch (345:25): [True: 0, False: 0]
  ------------------
  346|      0|    {
  347|      0|        const char *elname = inp_cur_data->at[local_idx].elname;
  348|       |
  349|      0|        if (elname[1] == '\0' && (elname[0] == 'H' || elname[0] == 'D' || elname[0] == 'T'))
  ------------------
  |  Branch (349:13): [True: 0, False: 0]
  |  Branch (349:35): [True: 0, False: 0]
  |  Branch (349:55): [True: 0, False: 0]
  |  Branch (349:75): [True: 0, False: 0]
  ------------------
  350|      0|        {
  351|      0|            break;
  352|      0|        }
  353|      0|    }
  354|       |
  355|      0|    if (local_idx == inp_cur_data->num_at)
  ------------------
  |  Branch (355:9): [True: 0, False: 0]
  ------------------
  356|      0|    {
  357|      0|        return 0;
  358|      0|    }
  359|       |
  360|      0|    local_idx = 0;
  361|       |
  362|      0|    inp_cur_data->keep_explicit_HDT = (unsigned char *)inchi_calloc((long long)inp_cur_data->num_at, sizeof(inp_cur_data->keep_explicit_HDT[0]));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  363|       |
  364|      0|    if (!inp_cur_data->keep_explicit_HDT)
  ------------------
  |  Branch (364:9): [True: 0, False: 0]
  ------------------
  365|      0|    {
  366|      0|        return -1;
  367|      0|    }
  368|       |
  369|      0|    for (orig_idx = 0; orig_idx < orig_inp_data->num_inp_atoms; orig_idx++)
  ------------------
  |  Branch (369:24): [True: 0, False: 0]
  ------------------
  370|      0|    {
  371|      0|        if (orig_inp_data->at[orig_idx].component != component_number)
  ------------------
  |  Branch (371:13): [True: 0, False: 0]
  ------------------
  372|      0|        {
  373|      0|            continue;
  374|      0|        }
  375|       |
  376|       |        /*
  377|       |         * The mask is consulted only for explicit H/D/T atoms by
  378|       |         * remove_terminal_HDT(), so heavy-atom and pseudoatom endpoints
  379|       |         * do not need to be marked.
  380|       |        */
  381|      0|        if (!(orig_inp_data->at[orig_idx].elname[1] == '\0' &&
  ------------------
  |  Branch (381:15): [True: 0, False: 0]
  ------------------
  382|      0|              (orig_inp_data->at[orig_idx].elname[0] == 'H' ||
  ------------------
  |  Branch (382:16): [True: 0, False: 0]
  ------------------
  383|      0|               orig_inp_data->at[orig_idx].elname[0] == 'D' ||
  ------------------
  |  Branch (383:16): [True: 0, False: 0]
  ------------------
  384|      0|               orig_inp_data->at[orig_idx].elname[0] == 'T')))
  ------------------
  |  Branch (384:16): [True: 0, False: 0]
  ------------------
  385|      0|        {
  386|      0|            local_idx++;
  387|      0|            continue;
  388|      0|        }
  389|       |
  390|      0|        for (unit_idx = 0; unit_idx < orig_inp_data->polymer->n; unit_idx++)
  ------------------
  |  Branch (390:28): [True: 0, False: 0]
  ------------------
  391|      0|        {
  392|      0|            const OAD_PolymerUnit *u = orig_inp_data->polymer->units[unit_idx];
  393|       |
  394|      0|            if (!u || !u->blist)
  ------------------
  |  Branch (394:17): [True: 0, False: 0]
  |  Branch (394:23): [True: 0, False: 0]
  ------------------
  395|      0|            {
  396|      0|                continue;
  397|      0|            }
  398|       |
  399|       |            /*
  400|       |             * Each crossing bond contributes two atom numbers to blist.
  401|       |             * blist uses whole-structure, 1-based atom numbering.
  402|       |             */
  403|      0|            for (endpoint_idx = 0; endpoint_idx < 2 * u->nb; endpoint_idx++)
  ------------------
  |  Branch (403:36): [True: 0, False: 0]
  ------------------
  404|      0|            {
  405|      0|                if (u->blist[endpoint_idx] == orig_idx + 1)
  ------------------
  |  Branch (405:21): [True: 0, False: 0]
  ------------------
  406|      0|                {
  407|      0|                    inp_cur_data->keep_explicit_HDT[local_idx] = 1;
  408|      0|                    break;
  409|      0|                }
  410|      0|            }
  411|       |
  412|      0|            if (inp_cur_data->keep_explicit_HDT[local_idx])
  ------------------
  |  Branch (412:17): [True: 0, False: 0]
  ------------------
  413|      0|            {
  414|      0|                break;
  415|      0|            }
  416|      0|        }
  417|       |
  418|      0|        local_idx++;
  419|      0|    }
  420|       |
  421|      0|    return 0;
  422|      0|}

OrigAtData_Duplicate:
  115|  70.4k|{
  116|  70.4k|    inp_ATOM* at = NULL;
  117|  70.4k|    AT_NUMB* nCurAtLen = NULL;
  118|  70.4k|    AT_NUMB* nOldCompNumber = NULL;
  119|  70.4k|    int k, m, nn;
  120|  70.4k|    int orig_nat = orig_atom->num_inp_atoms;
  121|       |
  122|  70.4k|    int ret = -1; /* fail; 0 - OK */
  123|       |
  124|  70.4k|    if ( new_orig_atom->at &&
  ------------------
  |  Branch (124:10): [True: 0, False: 70.4k]
  ------------------
  125|      0|        new_orig_atom->num_inp_atoms >= orig_nat )
  ------------------
  |  Branch (125:9): [True: 0, False: 0]
  ------------------
  126|      0|    {
  127|      0|        at = new_orig_atom->at;
  128|      0|    }
  129|  70.4k|    else
  130|  70.4k|    {
  131|  70.4k|        at = (inp_ATOM*)inchi_calloc((long long)orig_nat + 1, sizeof(at[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  70.4k|#define inchi_calloc   calloc
  ------------------
  132|  70.4k|        if ( !at )
  ------------------
  |  Branch (132:14): [True: 0, False: 70.4k]
  ------------------
  133|      0|        {
  134|      0|            goto exit_function;
  135|      0|        }
  136|  70.4k|    }
  137|       |
  138|  70.4k|    if ( new_orig_atom->nOldCompNumber &&
  ------------------
  |  Branch (138:10): [True: 0, False: 70.4k]
  ------------------
  139|      0|        new_orig_atom->num_components >= orig_atom->num_components )
  ------------------
  |  Branch (139:9): [True: 0, False: 0]
  ------------------
  140|      0|    {
  141|      0|        nCurAtLen = new_orig_atom->nCurAtLen;
  142|      0|    }
  143|  70.4k|    else
  144|  70.4k|    {
  145|  70.4k|        nCurAtLen = (AT_NUMB*)inchi_calloc((long long)orig_atom->num_components + 1, sizeof(nCurAtLen[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  70.4k|#define inchi_calloc   calloc
  ------------------
  146|  70.4k|        if ( !nCurAtLen )
  ------------------
  |  Branch (146:14): [True: 0, False: 70.4k]
  ------------------
  147|      0|        {
  148|      0|            goto exit_function;
  149|      0|        }
  150|  70.4k|    }
  151|       |
  152|  70.4k|    if ( new_orig_atom->nCurAtLen &&
  ------------------
  |  Branch (152:10): [True: 0, False: 70.4k]
  ------------------
  153|      0|        new_orig_atom->num_components >= orig_atom->num_components )
  ------------------
  |  Branch (153:9): [True: 0, False: 0]
  ------------------
  154|      0|    {
  155|      0|        nOldCompNumber = new_orig_atom->nOldCompNumber;
  156|      0|    }
  157|  70.4k|    else
  158|  70.4k|    {
  159|  70.4k|        nOldCompNumber = (AT_NUMB*)inchi_calloc((long long)orig_atom->num_components + 1,
  ------------------
  |  | 1146|  70.4k|#define inchi_calloc   calloc
  ------------------
  160|  70.4k|            sizeof(nOldCompNumber[0])); /* djb-rwth: cast operator added */
  161|  70.4k|        if ( !nOldCompNumber )
  ------------------
  |  Branch (161:14): [True: 0, False: 70.4k]
  ------------------
  162|      0|        {
  163|      0|            goto exit_function;
  164|      0|        }
  165|  70.4k|    }
  166|       |
  167|  70.4k|    if ( at && nCurAtLen && nOldCompNumber )
  ------------------
  |  Branch (167:10): [True: 70.4k, False: 0]
  |  Branch (167:16): [True: 70.4k, False: 0]
  |  Branch (167:29): [True: 70.4k, False: 0]
  ------------------
  168|  70.4k|    {
  169|       |        /* Copy */
  170|  70.4k|        if ( orig_atom->at )
  ------------------
  |  Branch (170:14): [True: 70.4k, False: 0]
  ------------------
  171|  70.4k|        {
  172|  70.4k|            memcpy(at, orig_atom->at,
  173|  70.4k|                orig_nat * sizeof(new_orig_atom->at[0]));
  174|  70.4k|        }
  175|  70.4k|        if ( orig_atom->nCurAtLen )
  ------------------
  |  Branch (175:14): [True: 0, False: 70.4k]
  ------------------
  176|      0|        {
  177|      0|            memcpy(nCurAtLen, orig_atom->nCurAtLen,
  178|      0|                orig_atom->num_components * sizeof(nCurAtLen[0]));
  179|      0|        }
  180|  70.4k|        if ( orig_atom->nOldCompNumber )
  ------------------
  |  Branch (180:14): [True: 0, False: 70.4k]
  ------------------
  181|      0|        {
  182|      0|            memcpy(nOldCompNumber, orig_atom->nOldCompNumber,
  183|      0|                orig_atom->num_components * sizeof(nOldCompNumber[0]));
  184|      0|        }
  185|       |
  186|       |        /* Deallocate */
  187|  70.4k|        if ( new_orig_atom->at && new_orig_atom->at != at )
  ------------------
  |  Branch (187:14): [True: 0, False: 70.4k]
  |  Branch (187:35): [True: 0, False: 0]
  ------------------
  188|      0|        {
  189|      0|            inchi_free(new_orig_atom->at);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  190|      0|        }
  191|  70.4k|        if ( new_orig_atom->nCurAtLen && new_orig_atom->nCurAtLen != nCurAtLen )
  ------------------
  |  Branch (191:14): [True: 0, False: 70.4k]
  |  Branch (191:42): [True: 0, False: 0]
  ------------------
  192|      0|        {
  193|      0|            inchi_free(new_orig_atom->nCurAtLen);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  194|      0|        }
  195|  70.4k|        if ( new_orig_atom->nOldCompNumber &&
  ------------------
  |  Branch (195:14): [True: 0, False: 70.4k]
  ------------------
  196|      0|            new_orig_atom->nOldCompNumber != nOldCompNumber )
  ------------------
  |  Branch (196:13): [True: 0, False: 0]
  ------------------
  197|      0|        {
  198|      0|            inchi_free(new_orig_atom->nOldCompNumber);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  199|      0|        }
  200|       |
  201|  70.4k|        *new_orig_atom = *orig_atom;
  202|  70.4k|        new_orig_atom->at = at;
  203|  70.4k|        new_orig_atom->nCurAtLen = nCurAtLen;
  204|  70.4k|        new_orig_atom->nOldCompNumber = nOldCompNumber;
  205|       |
  206|       |        /* Data that are not to be copied */
  207|  70.4k|        new_orig_atom->nNumEquSets = 0;
  208|  70.4k|        memset(new_orig_atom->bSavedInINCHI_LIB, 0, sizeof(new_orig_atom->bSavedInINCHI_LIB)); /* djb-rwth: memset_s C11/Annex K variant? */
  209|  70.4k|        memset(new_orig_atom->bPreprocessed, 0, sizeof(new_orig_atom->bPreprocessed)); /* djb-rwth: memset_s C11/Annex K variant? */
  210|       |
  211|       |
  212|       |
  213|  70.4k|        new_orig_atom->szCoord = NULL;
  214|  70.4k|        if ( orig_atom->szCoord )
  ------------------
  |  Branch (214:14): [True: 0, False: 70.4k]
  ------------------
  215|      0|        {
  216|      0|            new_orig_atom->szCoord = (MOL_COORD*)inchi_calloc(orig_nat, sizeof(new_orig_atom->szCoord[0]));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  217|      0|            if ( !new_orig_atom->szCoord )
  ------------------
  |  Branch (217:18): [True: 0, False: 0]
  ------------------
  218|      0|            {
  219|      0|                goto exit_function;
  220|      0|            }
  221|      0|            memcpy(new_orig_atom->szCoord, orig_atom->szCoord, orig_nat * sizeof(new_orig_atom->szCoord[0]));
  222|      0|        }
  223|       |
  224|       |
  225|       |        /* Arrays that are not to be copied */
  226|       |
  227|  70.4k|        new_orig_atom->nEquLabels = NULL;
  228|  70.4k|        new_orig_atom->nSortedOrder = NULL;
  229|       |
  230|  70.4k|        new_orig_atom->polymer = NULL;
  231|  70.4k|        if ( orig_atom->polymer )
  ------------------
  |  Branch (231:14): [True: 0, False: 70.4k]
  ------------------
  232|      0|        {
  233|       |            /* Polymer stuff -- deep copy */
  234|      0|            OAD_Polymer* oldp = orig_atom->polymer;
  235|      0|            OAD_Polymer* newp = NULL;
  236|       |
  237|      0|            newp = (OAD_Polymer*)inchi_calloc(1, sizeof(OAD_Polymer));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  238|      0|            if ( !newp )
  ------------------
  |  Branch (238:18): [True: 0, False: 0]
  ------------------
  239|      0|            {
  240|      0|                inchi_free(newp); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  241|      0|                goto exit_function;
  242|      0|            }
  243|      0|            memcpy(newp, orig_atom->polymer, sizeof(OAD_Polymer));
  244|      0|            newp->units = (OAD_PolymerUnit**)inchi_calloc(newp->n, sizeof(OAD_PolymerUnit*)); /* djb-rwth: inchi_calloc must return OAD_PolymerUnit** */
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  245|      0|            if ( !newp->units )
  ------------------
  |  Branch (245:18): [True: 0, False: 0]
  ------------------
  246|      0|            {
  247|      0|                inchi_free(newp); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  248|      0|                goto exit_function;
  249|      0|            }
  250|      0|            for ( k = 0; k < orig_atom->polymer->n; k++ )
  ------------------
  |  Branch (250:26): [True: 0, False: 0]
  ------------------
  251|      0|            {
  252|      0|                newp->units[k] = OAD_PolymerUnit_CreateCopy(orig_atom->polymer->units[k]);
  253|      0|            }
  254|      0|            if ( oldp->n_pzz > 0 )
  ------------------
  |  Branch (254:18): [True: 0, False: 0]
  ------------------
  255|      0|            {
  256|      0|                newp->n_pzz = oldp->n_pzz;
  257|      0|                newp->pzz = (int*)inchi_calloc(newp->n_pzz, sizeof(int));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  258|      0|                if ( !newp->pzz )
  ------------------
  |  Branch (258:22): [True: 0, False: 0]
  ------------------
  259|      0|                {
  260|      0|                    inchi_free(newp->units); /* djb-rwth: fixing coverity ID #499546 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  261|      0|                    inchi_free(newp); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  262|      0|                    goto exit_function;
  263|      0|                }
  264|      0|                memcpy(newp->pzz, oldp->pzz, newp->n_pzz * sizeof(oldp->pzz[0]));
  265|      0|            }
  266|      0|            new_orig_atom->polymer = newp;
  267|      0|        }
  268|       |
  269|  70.4k|        new_orig_atom->v3000 = NULL;
  270|  70.4k|        if ( orig_atom->v3000 )
  ------------------
  |  Branch (270:14): [True: 0, False: 70.4k]
  ------------------
  271|      0|        {
  272|       |            /* V3000 features -- deep copy */
  273|      0|            OAD_V3000* new_v3000 = NULL;
  274|      0|            new_v3000 = (OAD_V3000*)inchi_calloc(1, sizeof(OAD_V3000));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  275|      0|            if ( !new_v3000 )
  ------------------
  |  Branch (275:18): [True: 0, False: 0]
  ------------------
  276|      0|            {
  277|      0|                inchi_free(new_v3000); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  278|      0|                goto exit_function;
  279|      0|            }
  280|      0|            memcpy(new_v3000, orig_atom->v3000, sizeof(OAD_V3000));
  281|      0|            if ( orig_atom->v3000->atom_index_orig )
  ------------------
  |  Branch (281:18): [True: 0, False: 0]
  ------------------
  282|      0|            {
  283|      0|                new_v3000->atom_index_orig = (int*)inchi_calloc(orig_nat, sizeof(int));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  284|       |                /* if ( NULL==new_v3000->atom_index_orig ) {TREAT_ERR( err, 9001, "Out of RAM"); goto exit_function; } */
  285|      0|                if ( !new_v3000->atom_index_orig )
  ------------------
  |  Branch (285:22): [True: 0, False: 0]
  ------------------
  286|      0|                {
  287|      0|                    inchi_free(new_v3000); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  288|      0|                    goto exit_function;
  289|      0|                }
  290|      0|                memcpy(new_v3000->atom_index_orig, orig_atom->v3000->atom_index_orig, orig_nat * sizeof(int));
  291|      0|            }
  292|      0|            if ( orig_atom->v3000->atom_index_fin )
  ------------------
  |  Branch (292:18): [True: 0, False: 0]
  ------------------
  293|      0|            {
  294|      0|                new_v3000->atom_index_fin = (int*)inchi_calloc(orig_nat, sizeof(int));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  295|       |                /* if ( NULL==new_v3000->atom_index_fin ) {TREAT_ERR( err, 9001, "Out of RAM"); goto exit_function; } */
  296|      0|                if ( !new_v3000->atom_index_fin )
  ------------------
  |  Branch (296:22): [True: 0, False: 0]
  ------------------
  297|      0|                {
  298|      0|                    inchi_free(new_v3000); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  299|      0|                    goto exit_function;
  300|      0|                }
  301|      0|                memcpy(new_v3000->atom_index_fin, orig_atom->v3000->atom_index_fin, orig_nat * sizeof(int));
  302|      0|            }
  303|      0|            if ( orig_atom->v3000->n_haptic_bonds && orig_atom->v3000->lists_haptic_bonds )
  ------------------
  |  Branch (303:18): [True: 0, False: 0]
  |  Branch (303:54): [True: 0, False: 0]
  ------------------
  304|      0|            {
  305|      0|                new_v3000->lists_haptic_bonds = (int**)inchi_calloc(orig_atom->v3000->n_haptic_bonds, sizeof(int*));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  306|       |                /* if ( NULL==new_v3000->lists_haptic_bonds ) { TREAT_ERR( err, 9001, "Out of RAM"); goto exit_function; }*/
  307|      0|                for ( m = 0; m < orig_atom->v3000->n_haptic_bonds; m++ )
  ------------------
  |  Branch (307:30): [True: 0, False: 0]
  ------------------
  308|      0|                {
  309|      0|                    int* lst = NULL;
  310|      0|                    int* old_lst = orig_atom->v3000->lists_haptic_bonds[m];
  311|      0|                    nn = old_lst[2] + 3;
  312|      0|                    lst = new_v3000->lists_haptic_bonds[m] = (int*)inchi_calloc(nn, sizeof(int));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  313|      0|                    if ( !lst )
  ------------------
  |  Branch (313:26): [True: 0, False: 0]
  ------------------
  314|      0|                    {
  315|      0|                        inchi_free(new_v3000->lists_haptic_bonds); /* djb-rwth: fixing coverity ID #499504 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  316|      0|                        inchi_free(new_v3000->atom_index_orig); /* djb-rwth: fixing coverity ID #499540 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  317|      0|                        inchi_free(new_v3000->atom_index_fin); /* djb-rwth: fixing coverity ID #499613 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  318|      0|                        inchi_free(new_v3000); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  319|      0|                        goto exit_function;
  320|      0|                    }
  321|      0|                    memcpy(lst, old_lst, nn * sizeof(int));
  322|      0|                }
  323|      0|            }
  324|      0|            if ( orig_atom->v3000->n_steabs && orig_atom->v3000->lists_steabs )
  ------------------
  |  Branch (324:18): [True: 0, False: 0]
  |  Branch (324:48): [True: 0, False: 0]
  ------------------
  325|      0|            {
  326|      0|                new_v3000->lists_steabs = (int**)inchi_calloc(orig_atom->v3000->n_steabs, sizeof(int*));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  327|       |                /* if ( NULL==new_v3000->lists_steabs ) { TREAT_ERR( err, 9001, "Out of RAM"); goto exit_function; }*/
  328|      0|                for ( m = 0; m < orig_atom->v3000->n_steabs; m++ )
  ------------------
  |  Branch (328:30): [True: 0, False: 0]
  ------------------
  329|      0|                {
  330|      0|                    int* lst = NULL;
  331|      0|                    int* old_lst = orig_atom->v3000->lists_steabs[m];
  332|      0|                    nn = old_lst[1] + 2;
  333|      0|                    lst = new_v3000->lists_steabs[m] = (int*)inchi_calloc(nn, sizeof(int));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  334|      0|                    if ( !lst )
  ------------------
  |  Branch (334:26): [True: 0, False: 0]
  ------------------
  335|      0|                    {
  336|      0|                        inchi_free(new_v3000->lists_haptic_bonds); /* djb-rwth: fixing coverity ID #499504 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  337|      0|                        inchi_free(new_v3000->lists_steabs); /* djb-rwth: fixing coverity ID #499543 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  338|      0|                        inchi_free(new_v3000->atom_index_orig); /* djb-rwth: fixing coverity ID #499540 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  339|      0|                        inchi_free(new_v3000->atom_index_fin); /* djb-rwth: fixing coverity ID #499613 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  340|      0|                        inchi_free(new_v3000); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  341|      0|                        goto exit_function;
  342|      0|                    }
  343|      0|                    memcpy(lst, old_lst, nn * sizeof(int));
  344|      0|                }
  345|      0|            }
  346|      0|            if ( orig_atom->v3000->n_sterel && orig_atom->v3000->lists_sterel )
  ------------------
  |  Branch (346:18): [True: 0, False: 0]
  |  Branch (346:48): [True: 0, False: 0]
  ------------------
  347|      0|            {
  348|      0|                new_v3000->lists_sterel = (int**)inchi_calloc(orig_atom->v3000->n_sterel, sizeof(int*));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  349|      0|                if ( !new_v3000 )
  ------------------
  |  Branch (349:22): [True: 0, False: 0]
  ------------------
  350|      0|                {
  351|      0|                    inchi_free(new_v3000); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  352|      0|                    goto exit_function;
  353|      0|                }
  354|       |                /* if ( NULL==new_v3000->lists_sterel ) { TREAT_ERR( err, 9001, "Out of RAM"); goto exit_function; }*/
  355|      0|                for ( m = 0; m < orig_atom->v3000->n_sterel; m++ )
  ------------------
  |  Branch (355:30): [True: 0, False: 0]
  ------------------
  356|      0|                {
  357|      0|                    int* lst = NULL;
  358|      0|                    int* old_lst = orig_atom->v3000->lists_sterel[m];
  359|      0|                    nn = old_lst[1] + 2;
  360|      0|                    if ( new_v3000->lists_sterel ) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (360:26): [True: 0, False: 0]
  ------------------
  361|      0|                        lst = new_v3000->lists_sterel[m] = (int*)inchi_calloc(nn, sizeof(int));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  362|      0|                    if ( !lst )
  ------------------
  |  Branch (362:26): [True: 0, False: 0]
  ------------------
  363|      0|                    {
  364|      0|                        inchi_free(new_v3000->lists_haptic_bonds); /* djb-rwth: fixing coverity ID #499504 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  365|      0|                        inchi_free(new_v3000->lists_steabs); /* djb-rwth: fixing coverity ID #499543 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  366|      0|                        inchi_free(new_v3000->lists_sterel); /* djb-rwth: fixing coverity ID #499504 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  367|      0|                        inchi_free(new_v3000->atom_index_orig); /* djb-rwth: fixing coverity ID #499540 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  368|      0|                        inchi_free(new_v3000->atom_index_fin); /* djb-rwth: fixing coverity ID #499613 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  369|      0|                        inchi_free(new_v3000); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  370|      0|                        goto exit_function;
  371|      0|                    }
  372|      0|                    memcpy(lst, old_lst, nn * sizeof(int));
  373|      0|                }
  374|      0|            }
  375|      0|            if ( orig_atom->v3000->n_sterac && orig_atom->v3000->lists_sterac )
  ------------------
  |  Branch (375:18): [True: 0, False: 0]
  |  Branch (375:48): [True: 0, False: 0]
  ------------------
  376|      0|            {
  377|      0|                new_v3000->lists_sterac = (int**)inchi_calloc(orig_atom->v3000->n_sterac, sizeof(int*));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  378|       |                /* if ( NULL==new_v3000->lists_sterac ) { TREAT_ERR( err, 9001, "Out of RAM"); goto exit_function; }*/
  379|      0|                if ( new_v3000->lists_sterac ) /* djb-rwth: fixing a NULL pointer dereference */
  ------------------
  |  Branch (379:22): [True: 0, False: 0]
  ------------------
  380|      0|                {
  381|      0|                    for ( m = 0; m < orig_atom->v3000->n_sterac; m++ )
  ------------------
  |  Branch (381:34): [True: 0, False: 0]
  ------------------
  382|      0|                    {
  383|      0|                        int* lst = NULL;
  384|      0|                        int* old_lst = orig_atom->v3000->lists_sterac[m];
  385|      0|                        nn = old_lst[1] + 2;
  386|      0|                        lst = new_v3000->lists_sterac[m] = (int*)inchi_calloc(nn, sizeof(int));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  387|      0|                        if ( !lst )
  ------------------
  |  Branch (387:30): [True: 0, False: 0]
  ------------------
  388|      0|                        {
  389|      0|                            inchi_free(new_v3000->lists_haptic_bonds); /* djb-rwth: fixing coverity ID #499504 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  390|      0|                            inchi_free(new_v3000->lists_steabs); /* djb-rwth: fixing coverity ID #499543 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  391|      0|                            inchi_free(new_v3000->lists_sterel); /* djb-rwth: fixing coverity ID #499504 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  392|      0|                            inchi_free(new_v3000->lists_sterac); /* djb-rwth: fixing coverity ID #499575 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  393|      0|                            inchi_free(new_v3000->atom_index_orig); /* djb-rwth: fixing coverity ID #499540 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  394|      0|                            inchi_free(new_v3000->atom_index_fin); /* djb-rwth: fixing coverity ID #499613 */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  395|      0|                            inchi_free(new_v3000); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  396|      0|                            goto exit_function;
  397|      0|                        }
  398|      0|                        memcpy(lst, old_lst, nn * sizeof(int));
  399|      0|                    }
  400|      0|                }
  401|      0|            }
  402|       |
  403|      0|            new_orig_atom->v3000 = new_v3000;
  404|      0|        }
  405|       |
  406|       |        /* Success */
  407|  70.4k|        ret = 0;
  408|  70.4k|    }
  409|       |
  410|  70.4k|exit_function:
  411|       |
  412|  70.4k|    if ( ret != 0 )
  ------------------
  |  Branch (412:10): [True: 0, False: 70.4k]
  ------------------
  413|      0|    {
  414|      0|        if ( at && new_orig_atom->at != at )
  ------------------
  |  Branch (414:14): [True: 0, False: 0]
  |  Branch (414:20): [True: 0, False: 0]
  ------------------
  415|      0|            inchi_free(at);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  416|      0|        if ( nCurAtLen && new_orig_atom->nCurAtLen != nCurAtLen )
  ------------------
  |  Branch (416:14): [True: 0, False: 0]
  |  Branch (416:27): [True: 0, False: 0]
  ------------------
  417|      0|            inchi_free(nCurAtLen);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  418|      0|        if ( nOldCompNumber && new_orig_atom->nOldCompNumber != nOldCompNumber )
  ------------------
  |  Branch (418:14): [True: 0, False: 0]
  |  Branch (418:32): [True: 0, False: 0]
  ------------------
  419|      0|            inchi_free(nOldCompNumber);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
  420|      0|    }
  421|       |
  422|  70.4k|    return ret;
  423|  70.4k|}
PreprocessOneStructure:
  458|  70.4k|{
  459|  70.4k|    int i;
  460|  70.4k|    INCHI_MODE bTautFlags = 0;
  461|  70.4k|    INCHI_MODE bTautFlagsDone = 0;
  462|       |
  463|       |    /* 1. Copy orig_inp_data --> prep_inp_data */
  464|       |
  465|  70.4k|    if ( 0 > OrigAtData_Duplicate(prep_inp_data, orig_inp_data) )
  ------------------
  |  Branch (465:10): [True: 0, False: 70.4k]
  ------------------
  466|      0|    {
  467|      0|        AddErrorMessage(sd->pStrErrStruct, "Out of RAM");
  468|      0|        sd->nStructReadError = 99;
  469|      0|        sd->nErrorType = _IS_FATAL;
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
  470|      0|        goto exit_function;
  471|      0|    }
  472|       |
  473|       |#if ( bRELEASE_VERSION == 0 && (EXTR_HAS_METAL_ATOM & (EXTR_MASK | EXTR_FLAG) ) )
  474|       |    if ( bHasMetalAtom(orig_inp_data) )
  475|       |    {
  476|       |        sd->bExtract |= EXTR_HAS_METAL_ATOM;
  477|       |    }
  478|       |#endif
  479|       |
  480|       |    /* 2. Fix odd things in prep_inp_data            */
  481|       |
  482|  70.4k|    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) )
  ------------------
  |  |  944|  70.4k|#define TG_FLAG_FIX_SP3_BUG              0x00040000   /* fix sp3 stereo bug: overlapping 2D stereo bond & coordinate scaling */
  ------------------
  |  Branch (482:10): [True: 783, False: 69.6k]
  ------------------
  483|    783|    {
  484|       |        /* changed 2010-03-17 DT */
  485|    783|        if ( !ip->bNoWarnings )
  ------------------
  |  Branch (485:14): [True: 783, False: 0]
  ------------------
  486|    783|        {
  487|    783|            WarningMessage(sd->pStrErrStruct, "Charges were rearranged");
  ------------------
  |  |  132|    783|#define WarningMessage AddErrorMessage
  ------------------
  488|    783|        }
  489|    783|        if ( sd->nErrorType < _IS_WARNING )
  ------------------
  |  |   11|    783|#define _IS_WARNING 1
  ------------------
  |  Branch (489:14): [True: 783, False: 0]
  ------------------
  490|    783|        {
  491|    783|            sd->nErrorType = _IS_WARNING;
  ------------------
  |  |   11|    783|#define _IS_WARNING 1
  ------------------
  492|    783|        }
  493|    783|        sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  570|    783|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  978|    783|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
  494|    783|    }
  495|       |
  496|       |#if ( FIX_ADJ_RAD == 1 )
  497|       |    if ( ip->bTautFlags & TG_FLAG_FIX_ADJ_RADICALS )
  498|       |    {
  499|       |        if ( 0 < FixAdjacentRadicals(prep_inp_data->num_inp_atoms, prep_inp_data->at) )
  500|       |        {
  501|       |            sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ADJ_RADICALS_DONE;
  502|       |        }
  503|       |    }
  504|       |#endif
  505|       |
  506|       |#if ( bRELEASE_VERSION == 0 && (EXTR_FLAGS & EXTR_HAS_FEATURE) )
  507|       |    if ( bFoundFeature(prep_inp_data->at, prep_inp_data->num_inp_atoms) )
  508|       |    {
  509|       |        sd->bExtract |= EXTR_HAS_FEATURE;
  510|       |    }
  511|       |#endif
  512|       |
  513|       |
  514|       |    /* Find whether the structure can be disconnected or is a salt */
  515|       |
  516|       |
  517|       |    /* Needs salt disconnection? */
  518|       |
  519|       |    /* (@nnuk -> Nauman Ullah Khan) :: In case of Metal Salts with MolecularInorganics parameter we need to skip this pre-processing of Salts */
  520|  70.4k|    if ( ip->bMolecularInorganics )
  ------------------
  |  Branch (520:10): [True: 70.4k, False: 0]
  ------------------
  521|  70.4k|    {
  522|  70.4k|        ;
  523|  70.4k|    }
  524|      0|    else if ( ip->bTautFlags & TG_FLAG_DISCONNECT_SALTS )
  ------------------
  |  |  919|      0|#define TG_FLAG_DISCONNECT_SALTS         0x00000002   /* DISCONNECT_SALTS disconnect */
  ------------------
  |  Branch (524:15): [True: 0, False: 0]
  ------------------
  525|      0|    {
  526|      0|        prep_inp_data->bDisconnectSalts = (0 < DisconnectSalts(prep_inp_data, 0));
  527|      0|    }
  528|      0|    else
  529|      0|    {
  530|      0|        prep_inp_data->bDisconnectSalts = 0;
  531|      0|    }
  532|       |
  533|       |    /* Needs metal disconnection? */
  534|       |
  535|  70.4k|    if ( ip->bTautFlags & TG_FLAG_DISCONNECT_COORD )
  ------------------
  |  |  931|  70.4k|#define TG_FLAG_DISCONNECT_COORD         0x00000080   /* find "coord. centers" and disconnect them */
  ------------------
  |  Branch (535:10): [True: 70.4k, False: 0]
  ------------------
  536|  70.4k|    {
  537|  70.4k|        i = (0 != (ip->bTautFlags & TG_FLAG_CHECK_VALENCE_COORD));
  ------------------
  |  |  933|  70.4k|#define TG_FLAG_CHECK_VALENCE_COORD      0x00000200   /* do not disconnect "coord. centers" with usual valence */
  ------------------
  538|  70.4k|        bMayDisconnectMetals(prep_inp_data, i, &bTautFlagsDone); /* changes prep_inp_data->bDisconnectCoord */
  539|  70.4k|        sd->bTautFlagsDone[INCHI_BAS] |= bTautFlagsDone; /* whether any disconnection has been rejected because of the metal proper valence */
  ------------------
  |  |  570|  70.4k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  540|       |
  541|       |#if ( bRELEASE_VERSION == 0 )
  542|       |        if ( i && (bTautFlagsDone & TG_FLAG_CHECK_VALENCE_COORD_DONE) )
  543|       |        {
  544|       |            sd->bExtract |= EXTR_METAL_WAS_NOT_DISCONNECTED;
  545|       |        }
  546|       |#endif
  547|  70.4k|    }
  548|      0|    else
  549|      0|    {
  550|      0|        prep_inp_data->bDisconnectCoord = 0;
  551|      0|    }
  552|  70.4k|    orig_inp_data->bDisconnectSalts = prep_inp_data->bDisconnectSalts;
  553|  70.4k|    orig_inp_data->bDisconnectCoord = prep_inp_data->bDisconnectCoord;
  554|       |
  555|       |    /* 3. if( orig_inp_data->bDisconnectSalts ) then
  556|       |          disconnect salts in prep_inp_data    */
  557|       |
  558|  70.4k|    if ( (ip->bTautFlags & TG_FLAG_DISCONNECT_SALTS) && prep_inp_data->bDisconnectSalts &&
  ------------------
  |  |  919|  70.4k|#define TG_FLAG_DISCONNECT_SALTS         0x00000002   /* DISCONNECT_SALTS disconnect */
  ------------------
  |  Branch (558:10): [True: 0, False: 70.4k]
  |  Branch (558:57): [True: 0, False: 0]
  ------------------
  559|      0|        0 < (i = DisconnectSalts(prep_inp_data, 1)) ) /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  ------------------
  |  Branch (559:9): [True: 0, False: 0]
  ------------------
  560|      0|    {
  561|      0|        if ( !ip->bNoWarnings )
  ------------------
  |  Branch (561:14): [True: 0, False: 0]
  ------------------
  562|      0|        {
  563|      0|            WarningMessage(sd->pStrErrStruct, "Salt was disconnected");
  ------------------
  |  |  132|      0|#define WarningMessage AddErrorMessage
  ------------------
  564|      0|        }
  565|      0|        sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_DISCONNECT_SALTS_DONE;
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_DISCONNECT_SALTS_DONE;
  ------------------
  |  |  964|      0|#define TG_FLAG_DISCONNECT_SALTS_DONE    0x00000004
  ------------------
  566|      0|        if ( sd->nErrorType < _IS_WARNING )
  ------------------
  |  |   11|      0|#define _IS_WARNING 1
  ------------------
  |  Branch (566:14): [True: 0, False: 0]
  ------------------
  567|      0|        {
  568|      0|            sd->nErrorType = _IS_WARNING;
  ------------------
  |  |   11|      0|#define _IS_WARNING 1
  ------------------
  569|      0|        }
  570|      0|        if ( (i = ReconcileAllCmlBondParities(prep_inp_data->at, prep_inp_data->num_inp_atoms, 0)) ) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (570:14): [True: 0, False: 0]
  ------------------
  571|      0|        {
  572|      0|            char szErrCode[16];
  573|      0|            sprintf(szErrCode, "%d", i);
  574|      0|            AddErrorMessage(sd->pStrErrStruct, "0D Parities Reconciliation failed:");
  575|      0|            AddErrorMessage(sd->pStrErrStruct, szErrCode);
  576|      0|        }
  577|       |
  578|       |#if ( bRELEASE_VERSION == 0 )
  579|       |        sd->bExtract |= EXTR_SALT_WAS_DISCONNECTED;
  580|       |#endif
  581|      0|    }
  582|  70.4k|    else
  583|  70.4k|    {
  584|  70.4k|        prep_inp_data->bDisconnectSalts = 0;
  585|  70.4k|    }
  586|       |
  587|       |    /*  Mark the (disconnected) components in prep_inp_data    */
  588|       |
  589|  70.4k|    prep_inp_data->num_components = MarkDisconnectedComponents(prep_inp_data, 0);
  590|       |
  591|  70.4k|    if ( prep_inp_data->num_components < 0 )
  ------------------
  |  Branch (591:10): [True: 0, False: 70.4k]
  ------------------
  592|      0|    {
  593|      0|        AddErrorMessage(sd->pStrErrStruct, "Out of RAM");
  594|      0|        sd->nStructReadError = 99;
  595|      0|        sd->nErrorType = _IS_FATAL;
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
  596|      0|        goto exit_function;
  597|      0|    }
  598|       |
  599|       |    /* Detect isotopic H on heteroatoms -- necessary condition
  600|       |       for global isotopic tautomerism */
  601|       |
  602|  70.4k|    if ( (i = bNumHeterAtomHasIsotopicH(prep_inp_data->at, prep_inp_data->num_inp_atoms)) ) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (602:10): [True: 244, False: 70.2k]
  ------------------
  603|    244|    {
  604|    244|        if ( i & 1 )
  ------------------
  |  Branch (604:14): [True: 120, False: 124]
  ------------------
  605|    120|        {
  606|    120|            sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FOUND_ISOTOPIC_H_DONE;
  ------------------
  |  |  570|    120|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FOUND_ISOTOPIC_H_DONE;
  ------------------
  |  |  981|    120|#define TG_FLAG_FOUND_ISOTOPIC_H_DONE    0x00004000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  607|    120|        }
  608|    244|        if ( i & 2 )
  ------------------
  |  Branch (608:14): [True: 207, False: 37]
  ------------------
  609|    207|        {
  610|    207|            sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE;
  ------------------
  |  |  570|    207|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE;
  ------------------
  |  |  982|    207|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  611|    207|        }
  612|    244|    }
  613|       |
  614|       |    /* 4a. Detect unusual valences                                              */
  615|       |
  616|  70.4k|    if ( OrigAtData_bCheckUnusualValences(prep_inp_data, 1, sd->pStrErrStruct, ip->bNoWarnings) )
  ------------------
  |  Branch (616:10): [True: 8.55k, False: 61.8k]
  ------------------
  617|  8.55k|    {
  618|       |#if ( bRELEASE_VERSION == 0 )
  619|       |        sd->bExtract |= EXTR_UNUSUAL_VALENCES;
  620|       |#else
  621|  8.55k|        ;
  622|  8.55k|#endif
  623|  8.55k|    }
  624|       |
  625|       |
  626|       |    /*    5. if( orig_inp_data->bDisconnectCoord ) then
  627|       |              -- copy prep_inp_data --> prep_inp_data+1
  628|       |              -- disconnect metals in prep_inp_data            */
  629|       |
  630|       |              /* (@nnuk -> Nauman Ullah Khan) :: In case of Metals with MolecularInorganics parameter we need to skip this pre-processing of Metals */
  631|  70.4k|    if ( ip->bMolecularInorganics )
  ------------------
  |  Branch (631:10): [True: 70.4k, False: 0]
  ------------------
  632|  70.4k|    {
  633|  70.4k|        return 0;             /* Skipping over current functionality */
  634|  70.4k|    }
  635|      0|    else if ( prep_inp_data->bDisconnectCoord )
  ------------------
  |  Branch (635:15): [True: 0, False: 0]
  ------------------
  636|      0|    {
  637|       |
  638|      0|        prep_inp_data->num_components = MarkDisconnectedComponents(prep_inp_data, 0);
  639|      0|        if ( prep_inp_data->num_components < 0 )
  ------------------
  |  Branch (639:14): [True: 0, False: 0]
  ------------------
  640|      0|        {
  641|      0|            AddErrorMessage(sd->pStrErrStruct, "Out of RAM");
  642|      0|            sd->nStructReadError = 99;
  643|      0|            sd->nErrorType = _IS_FATAL;
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
  644|      0|            goto exit_function;
  645|      0|        }
  646|       |
  647|       |        /* Save reconnected structure in prep_inp_data+1 if requested */
  648|      0|        if ( 0 != (ip->bTautFlags & TG_FLAG_RECONNECT_COORD) )
  ------------------
  |  |  932|      0|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  |  Branch (648:14): [True: 0, False: 0]
  ------------------
  649|      0|        {
  650|      0|            if ( 0 > OrigAtData_Duplicate(prep_inp_data + 1, prep_inp_data) )
  ------------------
  |  Branch (650:18): [True: 0, False: 0]
  ------------------
  651|      0|            {
  652|      0|                AddErrorMessage(sd->pStrErrStruct, "Out of RAM");
  653|      0|                sd->nStructReadError = 99;
  654|      0|                sd->nErrorType = _IS_FATAL;
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
  655|      0|                goto exit_function;
  656|      0|            }
  657|      0|            sd->bTautFlags[INCHI_REC] = sd->bTautFlags[INCHI_BAS];
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          sd->bTautFlags[INCHI_REC] = sd->bTautFlags[INCHI_BAS];
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  658|      0|            sd->bTautFlagsDone[INCHI_REC] = sd->bTautFlagsDone[INCHI_BAS];
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          sd->bTautFlagsDone[INCHI_REC] = sd->bTautFlagsDone[INCHI_BAS];
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  659|      0|            {
  660|       |                /* Remove "parity undefined in disconnected structure" flag from reconnected structure */
  661|      0|                int k, m; /* djb-rwth: removing redundant variables */
  662|      0|                inp_ATOM* at = (prep_inp_data + 1)->at;
  663|      0|                int       num_at = (prep_inp_data + 1)->num_inp_atoms;
  664|      0|                for ( k = 0; k < num_at; k++ )
  ------------------
  |  Branch (664:30): [True: 0, False: 0]
  ------------------
  665|      0|                {
  666|      0|                    for ( m = 0; m < MAX_NUM_STEREO_BONDS && at[k].sb_parity[m]; m++ ) /* djb-rwth: removing redundant code */
  ------------------
  |  |  873|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (666:34): [True: 0, False: 0]
  |  Branch (666:62): [True: 0, False: 0]
  ------------------
  667|      0|                    {
  668|      0|                        at[k].sb_parity[m] &= SB_PARITY_MASK;
  ------------------
  |  |   64|      0|#define SB_PARITY_MASK 0x07
  ------------------
  669|      0|                    }
  670|      0|                }
  671|      0|            }
  672|      0|        }
  673|       |
  674|       |        /* Make disconnected structure in prep_inp_data */
  675|      0|        i = (0 != (ip->bTautFlags & TG_FLAG_CHECK_VALENCE_COORD));
  ------------------
  |  |  933|      0|#define TG_FLAG_CHECK_VALENCE_COORD      0x00000200   /* do not disconnect "coord. centers" with usual valence */
  ------------------
  676|       |
  677|       |        /*    prep_inp_data->bDisconnectCoord > 1 means add
  678|       |                prep_inp_data->bDisconnectCoord-1 explicit H atoms    */
  679|      0|        if ( 0 < (i = DisconnectMetals(prep_inp_data, i, &bTautFlagsDone)) )
  ------------------
  |  Branch (679:14): [True: 0, False: 0]
  ------------------
  680|      0|        {
  681|      0|            if ( !ip->bNoWarnings )
  ------------------
  |  Branch (681:18): [True: 0, False: 0]
  ------------------
  682|      0|            {
  683|      0|                WarningMessage(sd->pStrErrStruct, "Metal was disconnected");
  ------------------
  |  |  132|      0|#define WarningMessage AddErrorMessage
  ------------------
  684|      0|            }
  685|      0|            sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_DISCONNECT_COORD_DONE;
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_DISCONNECT_COORD_DONE;
  ------------------
  |  |  975|      0|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
  686|      0|            if ( sd->nErrorType < _IS_WARNING )
  ------------------
  |  |   11|      0|#define _IS_WARNING 1
  ------------------
  |  Branch (686:18): [True: 0, False: 0]
  ------------------
  687|      0|            {
  688|      0|                sd->nErrorType = _IS_WARNING;
  ------------------
  |  |   11|      0|#define _IS_WARNING 1
  ------------------
  689|      0|            }
  690|       |
  691|       |#if ( bRELEASE_VERSION == 0 )
  692|       |            sd->bExtract |= EXTR_METAL_WAS_DISCONNECTED;
  693|       |#endif
  694|       |
  695|       |            /* last parm=1 means find link between unchanged by Metal Disconnection components */
  696|      0|            prep_inp_data->num_components = MarkDisconnectedComponents(prep_inp_data, 1);
  697|       |
  698|      0|            if ( prep_inp_data->num_components < 0 )
  ------------------
  |  Branch (698:18): [True: 0, False: 0]
  ------------------
  699|      0|            {
  700|      0|                AddErrorMessage(sd->pStrErrStruct, "Out of RAM");
  701|      0|                sd->nStructReadError = 99;
  702|      0|                sd->nErrorType = _IS_FATAL;
  ------------------
  |  |   13|      0|#define _IS_FATAL   3
  ------------------
  703|      0|                goto exit_function;
  704|      0|            }
  705|       |
  706|      0|            {
  707|       |                /* Set parities for the disconnected structure */
  708|      0|                int k, m, p;
  709|      0|                inp_ATOM* at = (prep_inp_data)->at;
  710|      0|                int       num_at = (prep_inp_data)->num_inp_atoms;
  711|      0|                for ( k = 0; k < num_at; k++ )
  ------------------
  |  Branch (711:30): [True: 0, False: 0]
  ------------------
  712|      0|                {
  713|      0|                    for ( m = 0; m < MAX_NUM_STEREO_BONDS && (p = at[k].sb_parity[m]); m++ )
  ------------------
  |  |  873|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (713:34): [True: 0, False: 0]
  |  Branch (713:62): [True: 0, False: 0]
  ------------------
  714|      0|                    {
  715|      0|                        if ( p & SB_PARITY_FLAG )
  ------------------
  |  |   62|      0|#define SB_PARITY_FLAG 0x38 /**< mask for disconnected metal parity if it is different */
  ------------------
  |  Branch (715:30): [True: 0, False: 0]
  ------------------
  716|      0|                        {
  717|      0|                            at[k].sb_parity[m] = (p >> SB_PARITY_SHFT) & SB_PARITY_MASK;
  ------------------
  |  |   63|      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;
  ------------------
  |  |   64|      0|#define SB_PARITY_MASK 0x07
  ------------------
  718|      0|                        }
  719|      0|                    }
  720|      0|                }
  721|      0|            }
  722|       |
  723|      0|            if ( (i = ReconcileAllCmlBondParities(prep_inp_data->at, prep_inp_data->num_inp_atoms, 1)) ) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (723:18): [True: 0, False: 0]
  ------------------
  724|      0|            {
  725|      0|                char szErrCode[16];
  726|      0|                sprintf(szErrCode, "%d", i);
  727|      0|                AddErrorMessage(sd->pStrErrStruct, "0D Parities Reconciliation failed:");
  728|      0|                AddErrorMessage(sd->pStrErrStruct, szErrCode);
  729|      0|            }
  730|       |
  731|      0|#if ( REMOVE_ION_PAIRS_DISC_STRU == 1 )
  732|      0|            if ( 0 < remove_ion_pairs(prep_inp_data->num_inp_atoms, prep_inp_data->at) )
  ------------------
  |  Branch (732:18): [True: 0, False: 0]
  ------------------
  733|      0|            {
  734|      0|                if ( !ip->bNoWarnings )
  ------------------
  |  Branch (734:22): [True: 0, False: 0]
  ------------------
  735|      0|                {
  736|      0|                    WarningMessage(sd->pStrErrStruct, "Charges were rearranged");
  ------------------
  |  |  132|      0|#define WarningMessage AddErrorMessage
  ------------------
  737|      0|                }
  738|      0|                if ( sd->nErrorType < _IS_WARNING )
  ------------------
  |  |   11|      0|#define _IS_WARNING 1
  ------------------
  |  Branch (738:22): [True: 0, False: 0]
  ------------------
  739|      0|                {
  740|      0|                    sd->nErrorType = _IS_WARNING;
  ------------------
  |  |   11|      0|#define _IS_WARNING 1
  ------------------
  741|      0|                }
  742|      0|                sd->bTautFlagsDone[INCHI_REC] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              sd->bTautFlagsDone[INCHI_REC] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  978|      0|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
  743|      0|                sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  978|      0|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
  744|      0|            }
  745|      0|#endif
  746|       |
  747|       |            /*
  748|       |              if prep_inp_data->nOldCompNumber[i] = iINChI+1 > 0 then
  749|       |              component #(i+1) in prep_inp_data is identical to component #(iINChI+1) in prep_inp_data+1
  750|       |            */
  751|      0|        }
  752|      0|        else if ( i < 0 )
  ------------------
  |  Branch (752:19): [True: 0, False: 0]
  ------------------
  753|      0|        {
  754|      0|            AddErrorMessage(sd->pStrErrStruct, "Cannot disconnect metal error");
  755|      0|            sd->nStructReadError = i;
  756|      0|            sd->nErrorType = _IS_ERROR;
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  757|      0|            goto exit_function;
  758|      0|        }
  759|      0|    }
  760|      0|    else
  761|      0|    {
  762|       |        /* Remove "disconnected structure parities" from the structure */
  763|      0|        int k, m; /* djb-rwth: removing redundant variables */
  764|      0|        inp_ATOM* at = (prep_inp_data)->at;
  765|      0|        int       num_at = (prep_inp_data)->num_inp_atoms;
  766|      0|        for ( k = 0; k < num_at; k++ )
  ------------------
  |  Branch (766:22): [True: 0, False: 0]
  ------------------
  767|      0|        {
  768|      0|            for ( m = 0; m < MAX_NUM_STEREO_BONDS && at[k].sb_parity[m]; m++ ) /* djb-rwth: removing redundant code */
  ------------------
  |  |  873|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (768:26): [True: 0, False: 0]
  |  Branch (768:54): [True: 0, False: 0]
  ------------------
  769|      0|            {
  770|      0|                at[k].sb_parity[m] &= SB_PARITY_MASK;
  ------------------
  |  |   64|      0|#define SB_PARITY_MASK 0x07
  ------------------
  771|      0|            }
  772|      0|        }
  773|      0|    }
  774|       |
  775|      0|exit_function:
  776|       |
  777|      0|    if ( sd->nErrorType < _IS_ERROR && prep_inp_data )
  ------------------
  |  |   12|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (777:10): [True: 0, False: 0]
  |  Branch (777:40): [True: 0, False: 0]
  ------------------
  778|      0|    {
  779|      0|        if ( 0 < post_fix_odd_things(prep_inp_data->num_inp_atoms, prep_inp_data->at) )
  ------------------
  |  Branch (779:14): [True: 0, False: 0]
  ------------------
  780|      0|        {
  781|      0|            if ( !ip->bNoWarnings )
  ------------------
  |  Branch (781:18): [True: 0, False: 0]
  ------------------
  782|      0|            {
  783|      0|                WarningMessage(sd->pStrErrStruct, "Charges were rearranged");
  ------------------
  |  |  132|      0|#define WarningMessage AddErrorMessage
  ------------------
  784|      0|            }
  785|      0|            if ( sd->nErrorType < _IS_WARNING )
  ------------------
  |  |   11|      0|#define _IS_WARNING 1
  ------------------
  |  Branch (785:18): [True: 0, False: 0]
  ------------------
  786|      0|            {
  787|      0|                sd->nErrorType = _IS_WARNING;
  ------------------
  |  |   11|      0|#define _IS_WARNING 1
  ------------------
  788|      0|            }
  789|      0|            sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  978|      0|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
  790|      0|        }
  791|      0|        if ( (sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE) &&
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      if ( (sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE) &&
  ------------------
  |  |  975|      0|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
  |  Branch (791:14): [True: 0, False: 0]
  ------------------
  792|      0|            (prep_inp_data + 1)->at && (prep_inp_data + 1)->num_inp_atoms > 0 )
  ------------------
  |  Branch (792:13): [True: 0, False: 0]
  |  Branch (792:40): [True: 0, False: 0]
  ------------------
  793|      0|        {
  794|      0|            if ( 0 < post_fix_odd_things((prep_inp_data + 1)->num_inp_atoms, (prep_inp_data + 1)->at) )
  ------------------
  |  Branch (794:18): [True: 0, False: 0]
  ------------------
  795|      0|            {
  796|      0|                if ( !ip->bNoWarnings )
  ------------------
  |  Branch (796:22): [True: 0, False: 0]
  ------------------
  797|      0|                {
  798|      0|                    WarningMessage(sd->pStrErrStruct, "Charges were rearranged");
  ------------------
  |  |  132|      0|#define WarningMessage AddErrorMessage
  ------------------
  799|      0|                }
  800|      0|                if ( sd->nErrorType < _IS_WARNING )
  ------------------
  |  |   11|      0|#define _IS_WARNING 1
  ------------------
  |  Branch (800:22): [True: 0, False: 0]
  ------------------
  801|      0|                {
  802|      0|                    sd->nErrorType = _IS_WARNING;
  ------------------
  |  |   11|      0|#define _IS_WARNING 1
  ------------------
  803|      0|                }
  804|      0|                sd->bTautFlagsDone[INCHI_REC] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  571|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              sd->bTautFlagsDone[INCHI_REC] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  978|      0|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
  805|      0|                sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  978|      0|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
  806|      0|            }
  807|      0|        }
  808|      0|    }
  809|       |
  810|      0|    sd->bTautFlags[INCHI_BAS] |= bTautFlags;  /* TG_FLAG_CHECK_VALENCE_COORD_DONE, TG_FLAG_MOVE_CHARGE_COORD_DONE */
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  811|      0|    sd->bTautFlagsDone[INCHI_BAS] |= bTautFlagsDone;  /* TG_FLAG_CHECK_VALENCE_COORD_DONE, TG_FLAG_MOVE_CHARGE_COORD_DONE */
  ------------------
  |  |  570|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  812|       |
  813|      0|    return sd->nErrorType;
  814|  70.4k|}
OAD_PolymerUnit_New:
 1151|  1.16k|{
 1152|  1.16k|    int k, err = 0;
 1153|  1.16k|    OAD_PolymerUnit* u2 = NULL;
 1154|       |
 1155|  1.16k|    u2 = (OAD_PolymerUnit*)inchi_calloc(1, sizeof(OAD_PolymerUnit));
  ------------------
  |  | 1146|  1.16k|#define inchi_calloc   calloc
  ------------------
 1156|  1.16k|    if ( NULL == u2 )
  ------------------
  |  Branch (1156:10): [True: 0, False: 1.16k]
  ------------------
 1157|      0|    {
 1158|      0|        err = 1;
 1159|      0|        goto exit_function;
 1160|      0|    }
 1161|       |
 1162|  1.16k|    u2->id = id;
 1163|  1.16k|    u2->label = label;
 1164|  1.16k|    u2->type = type;
 1165|  1.16k|    u2->subtype = subtype;
 1166|  1.16k|    u2->conn = conn;
 1167|  1.16k|    u2->na = na;
 1168|  1.16k|    u2->nb = nb;
 1169|  1.16k|    u2->cyclizable = CLOSING_SRU_NOT_APPLICABLE;
  ------------------
  |  |   19|  1.16k|#define CLOSING_SRU_NOT_APPLICABLE 0
  ------------------
 1170|  1.16k|    u2->cyclized = 0;
 1171|  5.82k|    for ( k = 0; k < 4; k++ )
  ------------------
  |  Branch (1171:18): [True: 4.66k, False: 1.16k]
  ------------------
 1172|  4.66k|    {
 1173|  4.66k|        u2->xbr1[k] = 0.0;
 1174|  4.66k|        u2->xbr2[k] = 0.0;
 1175|  4.66k|    }
 1176|  1.16k|    strcpy(u2->smt, smt);
 1177|  1.16k|    u2->cap1 = -1;
 1178|  1.16k|    u2->end_atom1 = -1;
 1179|  1.16k|    u2->cap2 = -1;
 1180|  1.16k|    u2->end_atom2 = -1;
 1181|  1.16k|    u2->maxbkbonds = maxbonds;
 1182|  1.16k|    u2->nbkbonds = nbkbonds;
 1183|  1.16k|    u2->cap1_is_undef = 0;
 1184|  1.16k|    u2->cap2_is_undef = 0;
 1185|       |
 1186|  1.16k|    u2->alist = NULL;
 1187|  1.16k|    if ( na > 0 || maxatoms > 0 )
  ------------------
  |  Branch (1187:10): [True: 1.16k, False: 0]
  |  Branch (1187:20): [True: 0, False: 0]
  ------------------
 1188|  1.16k|    {
 1189|  1.16k|        u2->alist = (int*)inchi_calloc(na > 0 ? na : maxatoms, sizeof(int));
  ------------------
  |  | 1146|  1.16k|#define inchi_calloc   calloc
  ------------------
  |  Branch (1189:40): [True: 1.16k, False: 0]
  ------------------
 1190|  1.16k|        if ( !u2->alist )
  ------------------
  |  Branch (1190:14): [True: 0, False: 1.16k]
  ------------------
 1191|      0|        {
 1192|      0|            err = 2;
 1193|      0|            goto exit_function;
 1194|      0|        }
 1195|  6.10k|        for ( k = 0; k < na; k++ )
  ------------------
  |  Branch (1195:22): [True: 4.93k, False: 1.16k]
  ------------------
 1196|  4.93k|        {
 1197|  4.93k|            u2->alist[k] = alist->item[k];
 1198|  4.93k|        }
 1199|  1.16k|    }
 1200|  1.16k|    u2->blist = NULL;
 1201|  1.16k|    if ( nb > 0 || maxbonds > 0 )
  ------------------
  |  Branch (1201:10): [True: 0, False: 1.16k]
  |  Branch (1201:20): [True: 0, False: 1.16k]
  ------------------
 1202|      0|    {
 1203|      0|        u2->blist = (int*)inchi_calloc(nb > 0 ? 2 * nb : 2 * maxbonds, sizeof(int));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (1203:40): [True: 0, False: 0]
  ------------------
 1204|      0|        if ( !u2->blist )
  ------------------
  |  Branch (1204:14): [True: 0, False: 0]
  ------------------
 1205|      0|        {
 1206|      0|            err = 3;
 1207|      0|            goto exit_function;
 1208|      0|        }
 1209|      0|        if ( blist )
  ------------------
  |  Branch (1209:14): [True: 0, False: 0]
  ------------------
 1210|      0|        {
 1211|      0|            for ( k = 0; k < 2 * nb; k++ )
  ------------------
  |  Branch (1211:26): [True: 0, False: 0]
  ------------------
 1212|      0|            {
 1213|      0|                u2->blist[k] = blist->item[k];
 1214|      0|            }
 1215|      0|        }
 1216|       |
 1217|      0|    }
 1218|  1.16k|    u2->bkbonds = NULL;
 1219|       |
 1220|  1.16k|exit_function:
 1221|       |
 1222|  1.16k|    if ( err )
  ------------------
  |  Branch (1222:10): [True: 0, False: 1.16k]
  ------------------
 1223|      0|    {
 1224|      0|        OAD_PolymerUnit_Free(u2);
 1225|      0|        return NULL;
 1226|      0|    }
 1227|       |
 1228|  1.16k|    return u2;
 1229|  1.16k|}
OAD_PolymerUnit_Free:
 1318|  2.30k|{
 1319|       |
 1320|  2.30k|    ITRACE_("\n************** About to free OAD_PolymerUnit @ %-p\n", unit);
  ------------------
  |  |   98|  2.30k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 2.30k]
  |  |  ------------------
  ------------------
  |  Branch (1320:5): [True: 0, False: 0]
  ------------------
 1321|  2.30k|    OAD_PolymerUnit_DebugTrace(unit);
 1322|       |
 1323|  2.30k|    if ( unit )
  ------------------
  |  Branch (1323:10): [True: 1.16k, False: 1.14k]
  ------------------
 1324|  1.16k|    {
 1325|  1.16k|        if ( unit->alist )
  ------------------
  |  Branch (1325:14): [True: 1.16k, False: 0]
  ------------------
 1326|  1.16k|        {
 1327|  1.16k|            inchi_free(unit->alist);
  ------------------
  |  | 1152|  1.16k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 1.16k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
 1328|  1.16k|            unit->alist = NULL;
 1329|  1.16k|        }
 1330|  1.16k|        if ( unit->blist )
  ------------------
  |  Branch (1330:14): [True: 120, False: 1.04k]
  ------------------
 1331|    120|        {
 1332|    120|            inchi_free(unit->blist);
  ------------------
  |  | 1152|    120|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 120, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 120]
  |  |  ------------------
  ------------------
 1333|    120|            unit->blist = NULL;
 1334|    120|        }
 1335|  1.16k|        if ( unit->bkbonds )
  ------------------
  |  Branch (1335:14): [True: 120, False: 1.04k]
  ------------------
 1336|    120|        {
 1337|    120|            imat_free(unit->maxbkbonds, unit->bkbonds);
 1338|    120|            unit->bkbonds = NULL;
 1339|    120|        }
 1340|  1.16k|    }
 1341|       |
 1342|  2.30k|    inchi_free(unit);
  ------------------
  |  | 1152|  2.30k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 1.16k, False: 1.14k]
  |  |  |  Branch (1152:50): [Folded, False: 2.30k]
  |  |  ------------------
  ------------------
 1343|       |
 1344|  2.30k|    return;
 1345|  2.30k|}
UnMarkRingSystemsInp:
 1932|    143|{
 1933|    143|    int i;
 1934|  17.7k|    for ( i = 0; i < num_atoms; i++ )
  ------------------
  |  Branch (1934:18): [True: 17.5k, False: 143]
  ------------------
 1935|  17.5k|    {
 1936|  17.5k|        at[i].bCutVertex = 0;
 1937|  17.5k|        at[i].nRingSystem = 0;
 1938|  17.5k|        at[i].nNumAtInRingSystem = 0;
 1939|  17.5k|        at[i].nBlockSystem = 0;
 1940|  17.5k|    }
 1941|       |
 1942|    143|    return 0;
 1943|    143|}
OAD_Polymer_Free:
 2042|   231k|{
 2043|   231k|    if ( pd )
  ------------------
  |  Branch (2043:10): [True: 837, False: 230k]
  ------------------
 2044|    837|    {
 2045|    837|        if ( pd->pzz )
  ------------------
  |  Branch (2045:14): [True: 0, False: 837]
  ------------------
 2046|      0|        {
 2047|      0|            inchi_free(pd->pzz);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2048|      0|            pd->pzz = NULL;
 2049|      0|            pd->n_pzz = 0;
 2050|      0|        }
 2051|    837|        if ( pd->n && pd->units )
  ------------------
  |  Branch (2051:14): [True: 421, False: 416]
  |  Branch (2051:23): [True: 421, False: 0]
  ------------------
 2052|    421|        {
 2053|    421|            int k;
 2054|  2.72k|            for ( k = 0; k < pd->n; k++ )
  ------------------
  |  Branch (2054:26): [True: 2.30k, False: 421]
  ------------------
 2055|  2.30k|            {
 2056|  2.30k|                OAD_PolymerUnit_Free(pd->units[k]);
 2057|  2.30k|            }
 2058|    421|            inchi_free(pd->units);
  ------------------
  |  | 1152|    421|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 421, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 421]
  |  |  ------------------
  ------------------
 2059|    421|            pd->units = NULL;
 2060|    421|            pd->n = 0;
 2061|    421|        }
 2062|    837|        inchi_free(pd);
  ------------------
  |  | 1152|    837|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 837, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 837]
  |  |  ------------------
  ------------------
 2063|    837|        pd = NULL;
 2064|    837|    }
 2065|       |
 2066|   231k|    return;
 2067|   231k|}
OrigAtData_RemoveHalfBond:
 2492|    202|{
 2493|    202|    int k, kk;
 2494|       |    /* djb-rwth: fixing oss-fuzz issues #68286, #30342 */
 2495|    202|    if ( at && (this_atom >= 0) && (other_atom >= 0) )
  ------------------
  |  Branch (2495:10): [True: 202, False: 0]
  |  Branch (2495:16): [True: 202, False: 0]
  |  Branch (2495:36): [True: 202, False: 0]
  ------------------
 2496|    202|    {
 2497|    202|        inp_ATOM* a = &(at[this_atom]);
 2498|    202|        if ( a )
  ------------------
  |  Branch (2498:14): [True: 202, False: 0]
  ------------------
 2499|    202|        {
 2500|    270|            for ( k = 0; k < a->valence; k++ )
  ------------------
  |  Branch (2500:26): [True: 101, False: 169]
  ------------------
 2501|    101|            {
 2502|    101|                if ( a->neighbor[k] != other_atom )
  ------------------
  |  Branch (2502:22): [True: 68, False: 33]
  ------------------
 2503|     68|                {
 2504|     68|                    continue;
 2505|     68|                }
 2506|       |
 2507|     33|                *bond_type = a->bond_type[k];
 2508|     33|                *bond_stereo = a->bond_stereo[k];
 2509|       |
 2510|     33|                a->neighbor[k] = a->bond_type[k] = a->bond_stereo[k] = 0;
 2511|       |
 2512|     83|                for ( kk = k + 1; kk < a->valence; kk++ )
  ------------------
  |  Branch (2512:35): [True: 50, False: 33]
  ------------------
 2513|     50|                {
 2514|     50|                    a->neighbor[kk - 1] = a->neighbor[kk];
 2515|     50|                    a->bond_type[kk - 1] = a->bond_type[kk];
 2516|     50|                    a->bond_stereo[kk - 1] = a->bond_stereo[kk];
 2517|     50|                }
 2518|  1.60k|                for ( kk = a->valence - 1; kk < MAXVAL; kk++ )
  ------------------
  |  |   70|  1.60k|#define MAXVAL                   50 /* max number of bonds per atom                 */ /* @nnuk : Changed from 20 -> 50 for testing purposes, to account for some structures with one atom having more than 20 bonds */
  ------------------
  |  Branch (2518:44): [True: 1.57k, False: 33]
  ------------------
 2519|  1.57k|                {
 2520|  1.57k|                    a->neighbor[kk] = 0;
 2521|  1.57k|                    a->bond_type[kk] = (U_CHAR)0;
 2522|  1.57k|                    a->bond_stereo[kk] = (S_CHAR)0;
 2523|  1.57k|                }
 2524|     33|                return 1;
 2525|    101|            } /* k */
 2526|    202|        }
 2527|    202|    }
 2528|       |
 2529|    169|    return 0;
 2530|    202|}
OrigAtData_RemoveBond:
 2553|    102|{
 2554|    102|    int del = 0;
 2555|       |
 2556|    102|    if ( at && (this_atom >= 0) && (other_atom >= 0) ) /* djb-rwth: fixing oss-fuzz issue #68329, #68286 */
  ------------------
  |  Branch (2556:10): [True: 102, False: 0]
  |  Branch (2556:16): [True: 102, False: 0]
  |  Branch (2556:36): [True: 101, False: 1]
  ------------------
 2557|    101|    {
 2558|    101|        del = OrigAtData_RemoveHalfBond(this_atom, other_atom, at, bond_type, bond_stereo);
 2559|    101|        del += OrigAtData_RemoveHalfBond(other_atom, this_atom, at, bond_type, bond_stereo);
 2560|       |
 2561|    101|        if ( del == 2 )
  ------------------
  |  Branch (2561:14): [True: 15, False: 86]
  ------------------
 2562|     15|        {
 2563|     15|            (*num_inp_bonds)--;
 2564|     15|            at[this_atom].valence--;
 2565|     15|            at[this_atom].chem_bonds_valence -= *bond_type;
 2566|     15|            at[other_atom].valence--;
 2567|     15|            at[other_atom].chem_bonds_valence -= *bond_type;
 2568|     15|            return 1;
 2569|     15|        }
 2570|    101|    }
 2571|       |
 2572|     87|    return 0;
 2573|    102|}
OrigAtData_AddBond:
 2583|    223|{
 2584|    223|    if ( at )
  ------------------
  |  Branch (2584:10): [True: 223, False: 0]
  ------------------
 2585|    223|    {
 2586|       |        /* djb-rwth: fixing oss-fuzz issue #68286 */
 2587|    223|        int i, k, already_here;
 2588|    223|        inp_ATOM* a = &(at[this_atom]);
 2589|       |
 2590|    223|        if ( at[this_atom].valence >= MAXVAL ||
  ------------------
  |  |   70|    446|#define MAXVAL                   50 /* max number of bonds per atom                 */ /* @nnuk : Changed from 20 -> 50 for testing purposes, to account for some structures with one atom having more than 20 bonds */
  ------------------
  |  Branch (2590:14): [True: 0, False: 223]
  ------------------
 2591|    223|            at[other_atom].valence >= MAXVAL )
  ------------------
  |  |   70|    223|#define MAXVAL                   50 /* max number of bonds per atom                 */ /* @nnuk : Changed from 20 -> 50 for testing purposes, to account for some structures with one atom having more than 20 bonds */
  ------------------
  |  Branch (2591:13): [True: 0, False: 223]
  ------------------
 2592|      0|        {
 2593|      0|            return 0;
 2594|      0|        }
 2595|       |
 2596|    223|        if ( bond_type != INCHI_BOND_TYPE_DOUBLE && bond_type != INCHI_BOND_TYPE_TRIPLE )
  ------------------
  |  Branch (2596:14): [True: 222, False: 1]
  |  Branch (2596:53): [True: 220, False: 2]
  ------------------
 2597|    220|        {
 2598|    220|            bond_type = INCHI_BOND_TYPE_SINGLE;
 2599|    220|        }
 2600|       |
 2601|    223|        k = a->valence;
 2602|    223|        already_here = 0;
 2603|    321|        for ( i = 0; i < k; i++ )
  ------------------
  |  Branch (2603:22): [True: 114, False: 207]
  ------------------
 2604|    114|        {
 2605|    114|            if ( a->neighbor[i] == other_atom )
  ------------------
  |  Branch (2605:18): [True: 16, False: 98]
  ------------------
 2606|     16|            {
 2607|     16|                already_here = 1; break;
 2608|     16|            }
 2609|    114|        }
 2610|       |
 2611|    223|        if ( !already_here )
  ------------------
  |  Branch (2611:14): [True: 207, False: 16]
  ------------------
 2612|    207|        {
 2613|    207|            a->neighbor[k] = other_atom;
 2614|    207|            a->bond_type[k] = (U_CHAR)bond_type;
 2615|    207|            a->bond_stereo[k] = (S_CHAR)bond_stereo;
 2616|    207|            a->chem_bonds_valence += bond_type;
 2617|    207|            a->valence++;
 2618|    207|        }
 2619|       |
 2620|    223|        a = &(at[other_atom]);
 2621|    223|        k = a->valence;
 2622|    223|        already_here = 0;
 2623|    383|        for ( i = 0; i < k; i++ )
  ------------------
  |  Branch (2623:22): [True: 195, False: 188]
  ------------------
 2624|    195|        {
 2625|    195|            if ( a->neighbor[i] == this_atom )
  ------------------
  |  Branch (2625:18): [True: 35, False: 160]
  ------------------
 2626|     35|            {
 2627|     35|                already_here = 1; break;
 2628|     35|            }
 2629|    195|        }
 2630|       |
 2631|    223|        if ( !already_here && (k < MAXVAL) ) /* djb-rwth: condition added to prevent buffer overrun */
  ------------------
  |  |   70|    188|#define MAXVAL                   50 /* max number of bonds per atom                 */ /* @nnuk : Changed from 20 -> 50 for testing purposes, to account for some structures with one atom having more than 20 bonds */
  ------------------
  |  Branch (2631:14): [True: 188, False: 35]
  |  Branch (2631:31): [True: 188, False: 0]
  ------------------
 2632|    188|        {
 2633|    188|            a->neighbor[k] = this_atom;
 2634|    188|            a->bond_type[k] = (U_CHAR)bond_type;
 2635|    188|            a->bond_stereo[k] = (S_CHAR)bond_stereo;
 2636|    188|            a->chem_bonds_valence += bond_type;
 2637|    188|            a->valence++;
 2638|    188|        }
 2639|       |
 2640|    223|        (*num_bonds)++;
 2641|       |
 2642|    223|        return 1;
 2643|    223|    }
 2644|      0|    else
 2645|      0|    {
 2646|      0|        return 0;
 2647|      0|    }
 2648|    223|}
OrigAtData_AddSingleStereolessBond:
 2656|    208|{
 2657|    208|    return OrigAtData_AddBond(this_atom, other_atom, at, INCHI_BOND_TYPE_SINGLE, 0, num_bonds);
 2658|    208|}
OrigAtData_DecreaseBondOrder:
 2723|      9|{
 2724|      9|    int i, k, n_dn = 0;
 2725|      9|    inp_ATOM* a;
 2726|       |
 2727|      9|    a = &(at[this_atom]);
 2728|      9|    if ( a->chem_bonds_valence > MAXVAL - 1 )
  ------------------
  |  |   70|      9|#define MAXVAL                   50 /* max number of bonds per atom                 */ /* @nnuk : Changed from 20 -> 50 for testing purposes, to account for some structures with one atom having more than 20 bonds */
  ------------------
  |  Branch (2728:10): [True: 0, False: 9]
  ------------------
 2729|      0|    {
 2730|      0|        return 0;
 2731|      0|    }
 2732|       |
 2733|      9|    k = a->valence;
 2734|     25|    for ( i = 0; i < k; i++ )
  ------------------
  |  Branch (2734:18): [True: 22, False: 3]
  ------------------
 2735|     22|    {
 2736|     22|        if ( a->neighbor[i] != other_atom )
  ------------------
  |  Branch (2736:14): [True: 16, False: 6]
  ------------------
 2737|     16|        {
 2738|     16|            continue;
 2739|     16|        }
 2740|      6|        if ( a->bond_type[i] < 2 )
  ------------------
  |  Branch (2740:14): [True: 1, False: 5]
  ------------------
 2741|      1|        {
 2742|      1|            return 0;
 2743|      1|        }
 2744|      5|        a->bond_type[i]--;
 2745|      5|        a->chem_bonds_valence--;
 2746|      5|        n_dn++;
 2747|      5|        break;
 2748|      6|    }
 2749|       |
 2750|      8|    a = &(at[other_atom]);
 2751|      8|    k = a->valence;
 2752|     15|    for ( i = 0; i < k; i++ )
  ------------------
  |  Branch (2752:18): [True: 12, False: 3]
  ------------------
 2753|     12|    {
 2754|     12|        if ( a->neighbor[i] != this_atom )
  ------------------
  |  Branch (2754:14): [True: 7, False: 5]
  ------------------
 2755|      7|        {
 2756|      7|            continue;
 2757|      7|        }
 2758|      5|        if ( a->bond_type[i] < 2 )
  ------------------
  |  Branch (2758:14): [True: 0, False: 5]
  ------------------
 2759|      0|        {
 2760|      0|            return 0;
 2761|      0|        }
 2762|      5|        a->bond_type[i]--;
 2763|      5|        a->chem_bonds_valence--;
 2764|      5|        n_dn++;
 2765|      5|        break;
 2766|      5|    }
 2767|       |
 2768|      8|    return n_dn;
 2769|      8|}
OAD_Polymer_FindRingSystems:
 3213|    143|{
 3214|    143|    int i, j, nrings = 0, bond_type, bond_stereo;
 3215|       |
 3216|    143|    if ( NULL == num_ring_sys )
  ------------------
  |  Branch (3216:10): [True: 0, False: 143]
  ------------------
 3217|      0|    {
 3218|      0|        return 0;
 3219|      0|    }
 3220|       |
 3221|       |    /* Remove polymer SRU 'cyclizing' bonds if any */
 3222|    598|    for ( j = 0; j < pd->n; j++ )
  ------------------
  |  Branch (3222:18): [True: 455, False: 143]
  ------------------
 3223|    455|    {
 3224|    455|        if ( pd->units[j]->cyclized )
  ------------------
  |  Branch (3224:14): [True: 0, False: 455]
  ------------------
 3225|      0|        {
 3226|      0|            OrigAtData_RemoveBond(pd->units[j]->end_atom1 - 1,
 3227|      0|                pd->units[j]->end_atom2 - 1,
 3228|      0|                at, &bond_type, &bond_stereo,
 3229|      0|                num_inp_bonds);
 3230|      0|        }
 3231|    455|    }
 3232|       |
 3233|    143|    MarkRingSystemsInp(at, nat, start); /*0 );*/
 3234|       |
 3235|  17.8k|    for ( i = 0; i <= nat; i++ )
  ------------------
  |  Branch (3235:18): [True: 17.7k, False: 143]
  ------------------
 3236|  17.7k|    {
 3237|  17.7k|        num_ring_sys[i] = -1;
 3238|  17.7k|    }
 3239|  17.7k|    for ( i = 0; i < nat; i++ )
  ------------------
  |  Branch (3239:18): [True: 17.5k, False: 143]
  ------------------
 3240|  17.5k|    {
 3241|  17.5k|        if ( at[i].nNumAtInRingSystem > 2 )
  ------------------
  |  Branch (3241:14): [True: 54, False: 17.5k]
  ------------------
 3242|     54|        {
 3243|     54|            int atnum = at[i].orig_at_number;
 3244|     54|            num_ring_sys[atnum] = at[i].nRingSystem;
 3245|     54|            if ( NULL != size_ring_sys )
  ------------------
  |  Branch (3245:18): [True: 54, False: 0]
  ------------------
 3246|     54|            {
 3247|     54|                size_ring_sys[atnum] = at[i].nNumAtInRingSystem;
 3248|     54|            }
 3249|     54|        }
 3250|  17.5k|    }
 3251|       |
 3252|    143|    UnMarkRingSystemsInp(at, nat);
 3253|       |
 3254|  17.7k|    for ( i = 0; i < nat; i++ )
  ------------------
  |  Branch (3254:18): [True: 17.5k, False: 143]
  ------------------
 3255|  17.5k|    {
 3256|  17.5k|        if ( num_ring_sys[i] > -1 )
  ------------------
  |  Branch (3256:14): [True: 47, False: 17.5k]
  ------------------
 3257|     47|        {
 3258|     47|            nrings++;
 3259|     47|        }
 3260|  17.5k|    }
 3261|       |
 3262|       |    /* Restore polymer SRU 'cyclizing' bonds if applicable */
 3263|    598|    for ( j = 0; j < pd->n; j++ )
  ------------------
  |  Branch (3263:18): [True: 455, False: 143]
  ------------------
 3264|    455|    {
 3265|    455|        if ( pd->units[j]->cyclized )
  ------------------
  |  Branch (3265:14): [True: 0, False: 455]
  ------------------
 3266|      0|        {
 3267|      0|            OrigAtData_AddSingleStereolessBond(pd->units[j]->end_atom1 - 1,
 3268|      0|                pd->units[j]->end_atom2 - 1,
 3269|      0|                at,
 3270|      0|                num_inp_bonds);
 3271|      0|        }
 3272|    455|    }
 3273|       |
 3274|    143|    return nrings;
 3275|    143|}
OAD_Polymer_SetAtProps:
 3288|    143|{
 3289|       |    /*  Max rank for in-ring atom is 216 which is achieved for N (element number 7 in Periodic system & erank_rule2[] ),*/
 3290|       |    /*    then goes O with rank 215 (element number 8), and so on... lowest rank is 1 for H .                           */
 3291|       |    /*                                                                                                                  */
 3292|       |    /*  This follows to IUPAC rule 2 [Pure Appl. Chem., Vol. 74, No. 10, 2002, p. 1926] which states:                   */
 3293|       |    /*  a. a ring or ring system containing nitrogen;                                                                   */
 3294|       |    /*  b. a ring or ring system containing the heteroatom occurring earliest in the order given in Rule 4;             */
 3295|       |    /*  ( which is     O > S > Se > Te > N > P > As > Sb > Bi > Si > Ge > Sn > Pb > B > Hg )                            */
 3296|       |    /*  ...                                                                                                             */
 3297|       |
 3298|    143|    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,
 3299|    143|                          175,174,173,172,171,170,169,205,209,213,165,164,163,162,161,160,159,158,157,156,155,154,153,152,
 3300|    143|                          151,204,208,212,147,146,145,144,143,142,141,140,139,138,137,136,135,134,133,132,131,130,129,128,
 3301|    143|                          127,126,125,124,123,122,121,201,119,203,207,116,115,114,113,112,111,110,109,108,107,106,105,104,
 3302|    143|                          103,102,101,100,99,98,97,96,95,94,93,92,91,90,89,88,87,86,85,84,83,82,81 };
 3303|       |
 3304|       |
 3305|       |
 3306|       |    /*  Max rank for chain atom is 215 which is achieved for O (element number 8 in Periodic system & erank_rule4[] ),  */
 3307|       |    /*  then goes N with rank 212 (element number 8), and so on... lowest rank is 1 for H .                             */
 3308|       |    /*                                                                                                                  */
 3309|       |    /*  This follows to IUPAC rule 4 [Pure Appl. Chem., Vol. 74, No. 10, 2002, p. 1927] which states:                   */
 3310|       |    /*  O > S > Se > Te > N > P > As > Sb > Bi > Si > Ge > Sn > Pb > B > Hg                                             */
 3311|       |    /*  Note: Other heteroatoms may be placed within this order as indicated by their positions in the                  */
 3312|       |    /*  periodic table [5].                                                                                             */
 3313|       |
 3314|    143|    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,
 3315|    143|                          175,174,173,172,171,170,169,205,209,213,165,164,163,162,161,160,159,158,157,156,155,154,153,152,
 3316|    143|                          151,204,208,212,147,146,145,144,143,142,141,140,139,138,137,136,135,134,133,132,131,130,129,128,
 3317|    143|                          127,126,125,124,123,122,121,201,119,203,207,116,115,114,113,112,111,110,109,108,107,106,105,104,
 3318|    143|                          103,102,101,100,99,98,97,96,95,94,93,92,91,90,89,88,87,86,85,84,83,82,81 };
 3319|       |
 3320|       |
 3321|    143|    int i, j, k, nrings = 0;
 3322|    143|    int a1, a2, dummy = 0, bond_type = -1, bond_stereo = -1;
 3323|    143|    int* num_ring_sys = NULL, * size_ring_sys = NULL;
 3324|       |    /* djb-rwth: fixing oss-fuzz issue #68112 */
 3325|    143|    int err2_len = sizeof(erank_rule2) / sizeof(erank_rule2[0]);
 3326|    143|    int err4_len = sizeof(erank_rule4) / sizeof(erank_rule4[0]);
 3327|       |
 3328|    143|    if ( (NULL == aprops) || !at || !pd ) /* djb-rwth: fixing oss-fuzz issue #68329, #68286 */
  ------------------
  |  Branch (3328:10): [True: 0, False: 143]
  |  Branch (3328:30): [True: 0, False: 143]
  |  Branch (3328:37): [True: 0, False: 143]
  ------------------
 3329|      0|    {
 3330|      0|        return;
 3331|      0|    }
 3332|       |
 3333|       |    /* Establish element ranks for atoms */
 3334|  17.7k|    for ( k = 0; k < nat; k++ )
  ------------------
  |  Branch (3334:18): [True: 17.5k, False: 143]
  ------------------
 3335|  17.5k|    {
 3336|  17.5k|        int atnum = at[k].orig_at_number, index = k;
 3337|  17.5k|        U_CHAR err4_ind = at[k].el_number;
 3338|  17.5k|        if ( cano_nums )
  ------------------
  |  Branch (3338:14): [True: 0, False: 17.5k]
  ------------------
 3339|      0|        {
 3340|      0|            index = cano_nums[atnum];
 3341|      0|        }
 3342|  17.5k|        if ( index >= 0 && err4_ind < err4_len )
  ------------------
  |  Branch (3342:14): [True: 17.5k, False: 0]
  |  Branch (3342:28): [True: 17.3k, False: 196]
  ------------------
 3343|  17.3k|        {
 3344|  17.3k|            aprops[index].erank = erank_rule4[err4_ind];
 3345|  17.3k|            aprops[index].ring_erank = 0;
 3346|  17.3k|            aprops[index].ring_size = 0;
 3347|  17.3k|            aprops[index].ring_num = -1;
 3348|  17.3k|        }
 3349|    196|        else
 3350|    196|        {
 3351|       |            /* deleted H's go here */
 3352|    196|            ;
 3353|    196|        }
 3354|       |
 3355|  17.5k|    }
 3356|       |
 3357|       |    /* Establish ring systems assignments for atoms */
 3358|    143|    num_ring_sys = (int*)inchi_calloc((long long)nat + 1, sizeof(int)); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|    143|#define inchi_calloc   calloc
  ------------------
 3359|    143|    if ( NULL == num_ring_sys )
  ------------------
  |  Branch (3359:10): [True: 0, False: 143]
  ------------------
 3360|      0|    {
 3361|      0|        goto exit_function;
 3362|      0|    }
 3363|    143|    size_ring_sys = (int*)inchi_calloc((long long)nat + 1, sizeof(int)); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|    143|#define inchi_calloc   calloc
  ------------------
 3364|    143|    if ( NULL == size_ring_sys )
  ------------------
  |  Branch (3364:10): [True: 0, False: 143]
  ------------------
 3365|      0|    {
 3366|      0|        goto exit_function;
 3367|      0|    }
 3368|       |
 3369|       |    /* Note that we get here on the way of InChI2Struct conversion.            */
 3370|       |    /* Break temporarily any of (actually, the first) SRU 'cyclizing' bonds    */
 3371|    598|    for ( j = 0; j < pd->n; j++ )
  ------------------
  |  Branch (3371:18): [True: 455, False: 143]
  ------------------
 3372|    455|    {
 3373|    455|        if ( pd->units[j]->na > 2 && pd->units[j]->nbkbonds > 0 &&
  ------------------
  |  Branch (3373:14): [True: 134, False: 321]
  |  Branch (3373:38): [True: 15, False: 119]
  ------------------
 3374|     15|            pd->units[j]->cyclized == 0 &&
  ------------------
  |  Branch (3374:13): [True: 15, False: 0]
  ------------------
 3375|     15|            pd->units[j]->cyclizable == CLOSING_SRU_RING )
  ------------------
  |  |   20|     15|#define CLOSING_SRU_RING 1
  ------------------
  |  Branch (3375:13): [True: 15, False: 0]
  ------------------
 3376|     15|        {
 3377|     15|            a1 = pd->units[j]->bkbonds[0][0] - 1;
 3378|     15|            a2 = pd->units[j]->bkbonds[0][1] - 1;
 3379|     15|            OrigAtData_RemoveBond(a1, a2, at, &bond_type, &bond_stereo, &dummy);
 3380|     15|        }
 3381|    455|    }
 3382|       |
 3383|    143|    nrings = OAD_Polymer_FindRingSystems(pd, at, nat, num_inp_bonds, num_ring_sys, size_ring_sys, 0);
 3384|       |
 3385|       |    /* Immediately restore just broken bond(s) */
 3386|    598|    for ( j = 0; j < pd->n; j++ )
  ------------------
  |  Branch (3386:18): [True: 455, False: 143]
  ------------------
 3387|    455|    {
 3388|    455|        if ( pd->units[j]->na > 2 &&
  ------------------
  |  Branch (3388:14): [True: 134, False: 321]
  ------------------
 3389|    134|            pd->units[j]->nbkbonds > 0 &&
  ------------------
  |  Branch (3389:13): [True: 15, False: 119]
  ------------------
 3390|     15|            pd->units[j]->cyclized == 0 &&
  ------------------
  |  Branch (3390:13): [True: 15, False: 0]
  ------------------
 3391|     15|            pd->units[j]->cyclizable == CLOSING_SRU_RING )
  ------------------
  |  |   20|     15|#define CLOSING_SRU_RING 1
  ------------------
  |  Branch (3391:13): [True: 15, False: 0]
  ------------------
 3392|     15|        {
 3393|     15|            a1 = pd->units[j]->bkbonds[0][0] - 1;
 3394|     15|            a2 = pd->units[j]->bkbonds[0][1] - 1;
 3395|       |            /* OrigAtData_AddSingleStereolessBond( a1, a2, at, &dummy ); */
 3396|     15|            OrigAtData_AddBond(a1, a2, at, bond_type, bond_stereo, &dummy);
 3397|     15|        }
 3398|    455|    }
 3399|       |
 3400|    143|    if ( nrings )
  ------------------
  |  Branch (3400:10): [True: 14, False: 129]
  ------------------
 3401|     14|    {
 3402|     14|        int max_ring_num = 0;
 3403|       |        /* SRU contains ring[s], proceed with them following (not totally) the IUPAC guidelines */
 3404|  6.85k|        for ( k = 0; k < nat; k++ )
  ------------------
  |  Branch (3404:22): [True: 6.83k, False: 14]
  ------------------
 3405|  6.83k|        {
 3406|       |            /* Browse 0-based original atoms, go to 1-based cano nums domain if cano_nums mapping is suppied */
 3407|  6.83k|            int atnum = at[k].orig_at_number, index = k;
 3408|  6.83k|            if ( cano_nums )
  ------------------
  |  Branch (3408:18): [True: 0, False: 6.83k]
  ------------------
 3409|      0|            {
 3410|      0|                index = cano_nums[atnum] + 1;
 3411|      0|            }
 3412|  6.83k|            if ( num_ring_sys[atnum] >= 0 )
  ------------------
  |  Branch (3412:18): [True: 54, False: 6.78k]
  ------------------
 3413|     54|            {
 3414|     54|                aprops[index].ring_num = num_ring_sys[atnum];  /* temporarily */
 3415|       |
 3416|     54|                if ( max_ring_num < aprops[index].ring_num )
  ------------------
  |  Branch (3416:22): [True: 14, False: 40]
  ------------------
 3417|     14|                    max_ring_num = aprops[index].ring_num;          /* NB: OAD_Polymer_FindRingSystems may return num_ring_sys[]  */
 3418|       |                /* which is not a list of consecutive numbers                 */
 3419|       |
 3420|     54|                aprops[index].ring_size = size_ring_sys[atnum];     /* Size of ring system which includes the atom k .            */
 3421|       |                /* It is used as an additional score for in-ring              */
 3422|       |                /* atoms' prioritizing (instead of criteria in                */
 3423|       |                /* 2c-2h of IUPAC rule 2 which deal with ring sizes).         */
 3424|     54|            }
 3425|  6.83k|        }
 3426|       |
 3427|     76|        for ( i = 0; i <= max_ring_num; i++ )
  ------------------
  |  Branch (3427:22): [True: 62, False: 14]
  ------------------
 3428|     62|        {
 3429|     62|            int erank, max_erank = 0;
 3430|  20.7k|            for ( k = 0; k < nat; k++ )
  ------------------
  |  Branch (3430:26): [True: 20.6k, False: 62]
  ------------------
 3431|  20.6k|            {
 3432|  20.6k|                int atnum = at[k].orig_at_number, index = k;
 3433|  20.6k|                if ( cano_nums )
  ------------------
  |  Branch (3433:22): [True: 0, False: 20.6k]
  ------------------
 3434|      0|                {
 3435|      0|                    index = cano_nums[atnum] + 1;
 3436|      0|                }
 3437|  20.6k|                if ( aprops[index].ring_num == i )
  ------------------
  |  Branch (3437:22): [True: 54, False: 20.6k]
  ------------------
 3438|     54|                {
 3439|     54|                    erank = erank_rule2[at[k].el_number];
 3440|     54|                    if ( erank > max_erank )
  ------------------
  |  Branch (3440:26): [True: 24, False: 30]
  ------------------
 3441|     24|                        max_erank = erank;
 3442|     54|                }
 3443|  20.6k|            }
 3444|  20.7k|            for ( k = 0; k < nat; k++ )
  ------------------
  |  Branch (3444:26): [True: 20.6k, False: 62]
  ------------------
 3445|  20.6k|            {
 3446|  20.6k|                int atnum = at[k].orig_at_number, index = k;
 3447|  20.6k|                if ( cano_nums )
  ------------------
  |  Branch (3447:22): [True: 0, False: 20.6k]
  ------------------
 3448|      0|                {
 3449|      0|                    index = cano_nums[atnum] + 1;
 3450|      0|                }
 3451|  20.6k|                if ( aprops[index].ring_num == i )
  ------------------
  |  Branch (3451:22): [True: 54, False: 20.6k]
  ------------------
 3452|     54|                {
 3453|     54|                    if ( aprops[index].ring_size > 2 )
  ------------------
  |  Branch (3453:26): [True: 54, False: 0]
  ------------------
 3454|     54|                    {
 3455|     54|                        aprops[index].ring_erank = max_erank;
 3456|     54|                    }
 3457|     54|                }
 3458|  20.6k|            }
 3459|     62|        }
 3460|     14|    }
 3461|       |
 3462|    143|exit_function:
 3463|    143|    if ( num_ring_sys )
  ------------------
  |  Branch (3463:10): [True: 143, False: 0]
  ------------------
 3464|    143|    {
 3465|    143|        inchi_free(num_ring_sys);
  ------------------
  |  | 1152|    143|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 143, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 143]
  |  |  ------------------
  ------------------
 3466|    143|    }
 3467|    143|    if ( size_ring_sys )
  ------------------
  |  Branch (3467:10): [True: 143, False: 0]
  ------------------
 3468|    143|    {
 3469|    143|        inchi_free(size_ring_sys);
  ------------------
  |  | 1152|    143|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 143, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 143]
  |  |  ------------------
  ------------------
 3470|    143|    }
 3471|       |
 3472|    143|    return;
 3473|    143|}
OAD_PolymerUnit_DebugTrace:
 3613|  2.30k|{
 3614|  2.30k|    char* conn = "ABSENT", * typ = "ABSENT", * styp = "ABSENT";
 3615|       |
 3616|  2.30k|    if ( !u )
  ------------------
  |  Branch (3616:10): [True: 1.14k, False: 1.16k]
  ------------------
 3617|  1.14k|    {
 3618|  1.14k|        return;
 3619|  1.14k|    }
 3620|       |
 3621|  1.16k|    if ( u->conn == 1 )
  ------------------
  |  Branch (3621:10): [True: 495, False: 669]
  ------------------
 3622|    495|    {
 3623|    495|        conn = "HT"; /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 3624|    495|    }
 3625|    669|    else if ( u->conn == 2 )
  ------------------
  |  Branch (3625:15): [True: 529, False: 140]
  ------------------
 3626|    529|    {
 3627|    529|        conn = "HH"; /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 3628|    529|    }
 3629|    140|    else if ( u->conn == 3 )
  ------------------
  |  Branch (3629:15): [True: 48, False: 92]
  ------------------
 3630|     48|    {
 3631|     48|        conn = "EU"; /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 3632|     48|    }
 3633|       |
 3634|  1.16k|    if ( u->type == 0 )
  ------------------
  |  Branch (3634:10): [True: 0, False: 1.16k]
  ------------------
 3635|      0|    {
 3636|      0|        typ = "NONE"; /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 3637|      0|    }
 3638|  1.16k|    else if ( u->type == 1 )
  ------------------
  |  Branch (3638:15): [True: 12, False: 1.15k]
  ------------------
 3639|     12|    {
 3640|     12|        typ = "SRU"; /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 3641|     12|    }
 3642|  1.15k|    else if ( u->type == 2 )
  ------------------
  |  Branch (3642:15): [True: 2, False: 1.15k]
  ------------------
 3643|      2|    {
 3644|      2|        typ = "MON"; /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 3645|      2|    }
 3646|  1.15k|    else if ( u->type == 3 )
  ------------------
  |  Branch (3646:15): [True: 123, False: 1.02k]
  ------------------
 3647|    123|    {
 3648|    123|        typ = "COP"; /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 3649|    123|    }
 3650|  1.02k|    else if ( u->type == 4 )
  ------------------
  |  Branch (3650:15): [True: 25, False: 1.00k]
  ------------------
 3651|     25|    {
 3652|     25|        typ = "MOD"; /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 3653|     25|    }
 3654|  1.00k|    else if ( u->type == 5 )
  ------------------
  |  Branch (3654:15): [True: 965, False: 37]
  ------------------
 3655|    965|    {
 3656|    965|        typ = "MER"; /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 3657|    965|    }
 3658|       |
 3659|  1.16k|    if ( u->subtype == 1 )
  ------------------
  |  Branch (3659:10): [True: 366, False: 798]
  ------------------
 3660|    366|    {
 3661|    366|        styp = "ALT"; /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 3662|    366|    }
 3663|    798|    else if ( u->subtype == 2 )
  ------------------
  |  Branch (3663:15): [True: 143, False: 655]
  ------------------
 3664|    143|    {
 3665|    143|        styp = "RAN"; /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 3666|    143|    }
 3667|    655|    else if ( u->subtype == 3 )
  ------------------
  |  Branch (3667:15): [True: 30, False: 625]
  ------------------
 3668|     30|    {
 3669|     30|        styp = "BLK"; /* djb-rwth: ignoring LLVM warning: possible presence of global variables */
 3670|     30|    }
 3671|       |
 3672|  1.16k|    {
 3673|  1.16k|        int i, k;
 3674|  1.16k|        int na, nb;
 3675|       |
 3676|  1.16k|        ITRACE_("\n\nPOLYMER UNIT @ %-p", u);
  ------------------
  |  |   98|  1.16k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
  |  Branch (3676:9): [True: 0, False: 0]
  ------------------
 3677|       |
 3678|  1.16k|        ITRACE_("\n\tid=%-d   label=%-d   type=%-s   subtype=%-s   conn=%-s   subscr='%-s'\n",
  ------------------
  |  |   98|  1.16k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
  |  Branch (3678:9): [True: 0, False: 0]
  ------------------
 3679|      0|            u->id, u->label, typ, styp, conn, u->smt);
 3680|       |
 3681|  1.16k|        ITRACE_("\tBracket1 coords: %-f, %-f, %-f, %-f\n", u->xbr1[0], u->xbr1[1], u->xbr1[2], u->xbr1[3]);
  ------------------
  |  |   98|  1.16k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
  |  Branch (3681:9): [True: 0, False: 0]
  ------------------
 3682|  1.16k|        ITRACE_("\tBracket2 coords: %-f, %-f, %-f, %-f\n", u->xbr2[0], u->xbr2[1], u->xbr2[2], u->xbr2[3]);
  ------------------
  |  |   98|  1.16k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
  |  Branch (3682:9): [True: 0, False: 0]
  ------------------
 3683|       |
 3684|  1.16k|        na = u->na;
 3685|  1.16k|        ITRACE_("\t%-d atoms { ", na);
  ------------------
  |  |   98|  1.16k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
  |  Branch (3685:9): [True: 0, False: 0]
  ------------------
 3686|  4.93k|        for ( k = 0; k < na - 1; k++ )
  ------------------
  |  Branch (3686:22): [True: 3.77k, False: 1.16k]
  ------------------
 3687|  3.77k|        {
 3688|  3.77k|            ITRACE_(" %-d, ", u->alist[k]);
  ------------------
  |  |   98|  3.77k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 3.77k]
  |  |  ------------------
  ------------------
  |  Branch (3688:13): [True: 0, False: 0]
  ------------------
 3689|  3.77k|        }
 3690|  1.16k|        ITRACE_(" %-d }\n", u->alist[na - 1]);
  ------------------
  |  |   98|  1.16k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
  |  Branch (3690:9): [True: 0, False: 0]
  ------------------
 3691|       |
 3692|  1.16k|        nb = u->nb;
 3693|  1.16k|        ITRACE_("\t%-d bonds crossing unit borders { ", nb);
  ------------------
  |  |   98|  1.16k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
  |  Branch (3693:9): [True: 0, False: 0]
  ------------------
 3694|       |
 3695|  1.40k|        for ( k = 0; k < nb; k++ )
  ------------------
  |  Branch (3695:22): [True: 240, False: 1.16k]
  ------------------
 3696|    240|        {
 3697|    240|            ITRACE_(" %-d-%-d ", u->blist[2 * k], u->blist[2 * k + 1]);
  ------------------
  |  |   98|    240|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 240]
  |  |  ------------------
  ------------------
  |  Branch (3697:13): [True: 0, False: 0]
  ------------------
 3698|    240|        }
 3699|  1.16k|        ITRACE_("}\n");
  ------------------
  |  |   98|  1.16k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
  |  Branch (3699:9): [True: 0, False: 0]
  ------------------
 3700|       |
 3701|  1.16k|        ITRACE_("\tCRU caps and end atoms { ");
  ------------------
  |  |   98|  1.16k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
  |  Branch (3701:9): [True: 0, False: 0]
  ------------------
 3702|       |
 3703|  1.16k|        ITRACE_("*%-d-[-%-d(end1) ... ", u->cap1, u->end_atom1);
  ------------------
  |  |   98|  1.16k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
  |  Branch (3703:9): [True: 0, False: 0]
  ------------------
 3704|  1.16k|        ITRACE_("%-d(end2)-]-*%-d", u->end_atom2, u->cap2);
  ------------------
  |  |   98|  1.16k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
  |  Branch (3704:9): [True: 0, False: 0]
  ------------------
 3705|  1.16k|        ITRACE_(" }\n");
  ------------------
  |  |   98|  1.16k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
  |  Branch (3705:9): [True: 0, False: 0]
  ------------------
 3706|       |
 3707|  1.16k|        ITRACE_("\tBackbone bonds (may include 'artificially cyclizing' one) : %-d bonds ", u->nbkbonds);
  ------------------
  |  |   98|  1.16k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
  |  Branch (3707:9): [True: 0, False: 0]
  ------------------
 3708|  1.16k|        if ( u->nbkbonds )
  ------------------
  |  Branch (3708:14): [True: 16, False: 1.14k]
  ------------------
 3709|     16|        {
 3710|     16|            ITRACE_(" { ");
  ------------------
  |  |   98|     16|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 16]
  |  |  ------------------
  ------------------
  |  Branch (3710:13): [True: 0, False: 0]
  ------------------
 3711|     43|            for ( i = 0; i < u->nbkbonds; i++ )
  ------------------
  |  Branch (3711:26): [True: 27, False: 16]
  ------------------
 3712|     27|            {
 3713|     27|                ITRACE_("(%-d, %-d)  ", u->bkbonds[i][0], u->bkbonds[i][1]);
  ------------------
  |  |   98|     27|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 27]
  |  |  ------------------
  ------------------
  |  Branch (3713:17): [True: 0, False: 0]
  ------------------
 3714|     27|            }
 3715|     16|            ITRACE_("}\n");
  ------------------
  |  |   98|     16|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 16]
  |  |  ------------------
  ------------------
  |  Branch (3715:13): [True: 0, False: 0]
  ------------------
 3716|     16|        }
 3717|  1.16k|    }
 3718|       |
 3719|       |
 3720|  1.16k|    return;
 3721|  2.30k|}
OAD_Polymer_SmartReopenCyclizedUnits:
 3852|    143|{
 3853|    143|    int i;
 3854|       |    /* djb-rwth: fixing oss-fuzz issue #68329 */
 3855|    143|    OAD_AtProps* aprops = (OAD_AtProps*)inchi_calloc((long long)nat + 1, sizeof(OAD_AtProps)); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|    143|#define inchi_calloc   calloc
  ------------------
 3856|       |    /* nat + 1: add extra element for possibe 1-based indexing */
 3857|       |
 3858|    143|    if ( !p )
  ------------------
  |  Branch (3858:10): [True: 0, False: 143]
  ------------------
 3859|      0|    {
 3860|      0|        inchi_free(aprops); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3861|      0|        return;
 3862|      0|    }
 3863|    143|    if ( p->n < 1 )
  ------------------
  |  Branch (3863:10): [True: 0, False: 143]
  ------------------
 3864|      0|    {
 3865|      0|        inchi_free(aprops); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3866|      0|        return;
 3867|      0|    }
 3868|    143|    if ( !p->really_do_frame_shift )
  ------------------
  |  Branch (3868:10): [True: 0, False: 143]
  ------------------
 3869|      0|    {
 3870|      0|        inchi_free(aprops); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3871|      0|        return;
 3872|      0|    }
 3873|       |    /* djb-rwth: fixing oss-fuzz issue #68329 */
 3874|    143|    if ( nat <= 0 )
  ------------------
  |  Branch (3874:10): [True: 0, False: 143]
  ------------------
 3875|      0|    {
 3876|      0|        inchi_free(aprops); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3877|      0|        return;
 3878|      0|    }
 3879|       |
 3880|       |    /*ITRACE_( "\n\n*********************************************************************\n* ENTERING OAD_Polymer_SmartReopenCyclizedUnits()" );
 3881|       |    OAD_Polymer_DebugTrace( p );*/
 3882|       |
 3883|       |    /* Set atom properties for sorting */
 3884|    143|    if ( !aprops || !at ) /* djb-rwth: fixing oss-fuzz issue #68329, #68286 */
  ------------------
  |  Branch (3884:10): [True: 0, False: 143]
  |  Branch (3884:21): [True: 0, False: 143]
  ------------------
 3885|      0|    {
 3886|      0|        inchi_free(aprops); /* djb-rwth: avoiding memory leak */
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3887|      0|        return;
 3888|      0|    }
 3889|    143|    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*/
 3890|    598|    for ( i = 0; i < p->n; i++ )
  ------------------
  |  Branch (3890:18): [True: 455, False: 143]
  ------------------
 3891|    455|    {
 3892|    455|        if ( p->units[i] ) /* djb-rwth: fixing oss-fuzz issue #68329 */
  ------------------
  |  Branch (3892:14): [True: 455, False: 0]
  ------------------
 3893|    455|        {
 3894|    455|            OAD_PolymerUnit* u = p->units[i];
 3895|    455|            if ( p->frame_shift_scheme == FSS_NONE )
  ------------------
  |  Branch (3895:18): [True: 0, False: 455]
  ------------------
 3896|      0|            {
 3897|      0|                continue;
 3898|      0|            }
 3899|    455|            if ( /* !u->cyclizable || u->cyclized  || */
 3900|    455|                u->nbkbonds < 1 ||
  ------------------
  |  Branch (3900:17): [True: 346, False: 109]
  ------------------
 3901|    109|                u->cap1 < 1 || u->cap2 < 1 ||
  ------------------
  |  Branch (3901:17): [True: 2, False: 107]
  |  Branch (3901:32): [True: 1, False: 106]
  ------------------
 3902|    106|                u->cap1 > nat || u->cap2 > nat )
  ------------------
  |  Branch (3902:17): [True: 1, False: 105]
  |  Branch (3902:34): [True: 1, False: 104]
  ------------------
 3903|    351|            {
 3904|    351|                continue;
 3905|    351|            }
 3906|    104|            if ( OAD_PolymerUnit_SetReopeningDetails(u, at) )
  ------------------
  |  Branch (3906:18): [True: 104, False: 0]
  ------------------
 3907|    104|            {
 3908|    104|                int senior_bond;
 3909|    104|                OAD_PolymerUnit_SortBackboneBondsAndSetSeniors(u, at, aprops, &senior_bond);
 3910|    104|            }
 3911|    104|            OAD_PolymerUnit_ReopenCyclized(u, at, aprops, nat, num_inp_bonds);
 3912|    104|        }
 3913|    455|    }
 3914|       |
 3915|    143|    p->really_do_frame_shift = 0;
 3916|    143|    inchi_free(aprops);
  ------------------
  |  | 1152|    143|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 143, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 143]
  |  |  ------------------
  ------------------
 3917|       |
 3918|    143|    return;
 3919|    143|}
OAD_PolymerUnit_ReopenCyclized:
 3928|    104|{
 3929|    104|    int bond_type, bond_stereo;
 3930|       |
 3931|    104|    if ( u->cyclizable == CLOSING_SRU_RING )
  ------------------
  |  |   20|    104|#define CLOSING_SRU_RING 1
  ------------------
  |  Branch (3931:10): [True: 87, False: 17]
  ------------------
 3932|     87|    {
 3933|       |        /* Decyclize artificially introduced bond */
 3934|     87|        OrigAtData_RemoveBond(u->end_atom1 - 1, u->end_atom2 - 1,
 3935|     87|            at, &bond_type, &bond_stereo, num_inp_bonds);
 3936|     87|    }
 3937|     17|    else if ( u->cyclizable == CLOSING_SRU_HIGHER_ORDER_BOND )
  ------------------
  |  |   21|     17|#define CLOSING_SRU_HIGHER_ORDER_BOND 2
  ------------------
  |  Branch (3937:15): [True: 9, False: 8]
  ------------------
 3938|      9|    {
 3939|      9|        OrigAtData_DecreaseBondOrder(u->end_atom1 - 1, u->end_atom2 - 1, at);
 3940|      9|    }
 3941|      8|    else if ( u->cyclizable == CLOSING_SRU_DIRADICAL )
  ------------------
  |  |   22|      8|#define CLOSING_SRU_DIRADICAL 3
  ------------------
  |  Branch (3941:15): [True: 8, False: 0]
  ------------------
 3942|      8|    {
 3943|      8|        if ( at[u->end_atom1 - 1].radical == RADICAL_TRIPLET )
  ------------------
  |  |   77|      8|#define RADICAL_TRIPLET 3
  ------------------
  |  Branch (3943:14): [True: 0, False: 8]
  ------------------
 3944|      0|        {
 3945|      0|            at[u->end_atom1 - 1].radical = 0;
 3946|      0|        }
 3947|      8|    }
 3948|       |
 3949|       |    /* Add explicitly connections to star atoms */
 3950|    104|    OrigAtData_AddSingleStereolessBond(u->cap1 - 1, u->end_atom1 - 1,
 3951|    104|        at, num_inp_bonds);
 3952|    104|    OrigAtData_AddSingleStereolessBond(u->cap2 - 1, u->end_atom2 - 1,
 3953|    104|        at, num_inp_bonds);
 3954|       |
 3955|       |    /* Create crossing bonds */
 3956|    104|    u->nb = 2;
 3957|    104|    u->nbkbonds = 0;
 3958|    104|    if ( !u->blist )
  ------------------
  |  Branch (3958:10): [True: 104, False: 0]
  ------------------
 3959|    104|    {
 3960|    104|        u->blist = (int*)inchi_calloc(2 * (long long)u->nb, sizeof(int)); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|    104|#define inchi_calloc   calloc
  ------------------
 3961|    104|    }
 3962|    104|    if ( !u->blist )
  ------------------
  |  Branch (3962:10): [True: 0, False: 104]
  ------------------
 3963|      0|    {
 3964|      0|        return;
 3965|      0|    }
 3966|       |
 3967|    104|    u->blist[0] = u->cap1;
 3968|    104|    u->blist[1] = u->end_atom1;
 3969|    104|    u->blist[2] = u->cap2;
 3970|    104|    u->blist[3] = u->end_atom2;
 3971|       |
 3972|    104|    return;
 3973|    104|}
OAD_PolymerUnit_SetReopeningDetails:
 3978|    104|{
 3979|    104|    int k;
 3980|       |
 3981|       |    /* Check reopening  type */
 3982|       |
 3983|       |    /* Caps are separated by one atom - that's not error but do nothing */
 3984|    104|    if ( u->nbkbonds == 0 )
  ------------------
  |  Branch (3984:10): [True: 0, False: 104]
  ------------------
 3985|      0|    {
 3986|      0|        ;
 3987|      0|    }
 3988|    104|    else if ( u->nbkbonds == 1 )
  ------------------
  |  Branch (3988:15): [True: 28, False: 76]
  ------------------
 3989|     28|    {
 3990|     28|        u->end_atom1 = u->bkbonds[0][0];
 3991|     28|        u->end_atom2 = u->bkbonds[0][1];
 3992|       |
 3993|     28|        if ( u->end_atom1 == u->end_atom2 )
  ------------------
  |  Branch (3993:14): [True: 8, False: 20]
  ------------------
 3994|      8|        {
 3995|      8|#ifdef ALLOW_CLOSING_SRU_VIA_DIRADICAL
 3996|      8|            u->cyclizable = CLOSING_SRU_DIRADICAL;
  ------------------
  |  |   22|      8|#define CLOSING_SRU_DIRADICAL 3
  ------------------
 3997|       |#else
 3998|       |            u->cyclizable = CLOSING_SRU_NOT_APPLICABLE;
 3999|       |#endif
 4000|      8|        }
 4001|     20|        else
 4002|     20|        {
 4003|       |            /* If caps are separated by two atoms - that's not error but do nothing */
 4004|     37|            for ( k = 0; k < at[u->end_atom1 - 1].valence; k++ )
  ------------------
  |  Branch (4004:26): [True: 30, False: 7]
  ------------------
 4005|     30|            {
 4006|     30|                if ( at[u->end_atom1 - 1].neighbor[k] == u->end_atom2 - 1 )
  ------------------
  |  Branch (4006:22): [True: 13, False: 17]
  ------------------
 4007|     13|                {
 4008|     13|                    if ( at[u->end_atom1 - 1].bond_type[k] > 1 )
  ------------------
  |  Branch (4008:26): [True: 5, False: 8]
  ------------------
 4009|      5|#ifdef ALLOW_CLOSING_SRU_VIA_HIGHER_ORDER_BOND
 4010|      5|                        u->cyclizable = CLOSING_SRU_HIGHER_ORDER_BOND;
  ------------------
  |  |   21|      5|#define CLOSING_SRU_HIGHER_ORDER_BOND 2
  ------------------
 4011|       |#else
 4012|       |                        /*                  u->cyclizable = CLOSING_SRU_NOT_APPLICABLE;*/
 4013|       |#endif
 4014|     13|                        break;
 4015|     13|                }
 4016|     30|            }
 4017|     20|        }
 4018|     28|    } /*    */
 4019|       |
 4020|    104|    return u->nbkbonds;
 4021|    104|}
OAD_PolymerUnit_SortBackboneBondsAndSetSeniors:
 4030|    104|{
 4031|    104|    int j, * bnum = NULL;
 4032|       |
 4033|    104|    *senior_bond = 0;
 4034|       |
 4035|       |    /* Sort backbone (== frame shiftable) bonds if necessary */
 4036|    104|    if ( u->nbkbonds > 1 )
  ------------------
  |  Branch (4036:10): [True: 76, False: 28]
  ------------------
 4037|     76|    {
 4038|     76|        bnum = (int*)inchi_calloc(u->nbkbonds, sizeof(int));
  ------------------
  |  | 1146|     76|#define inchi_calloc   calloc
  ------------------
 4039|     76|        if ( bnum )
  ------------------
  |  Branch (4039:14): [True: 76, False: 0]
  ------------------
 4040|     76|        {
 4041|    838|            for ( j = 0; j < u->nbkbonds; j++ )
  ------------------
  |  Branch (4041:26): [True: 762, False: 76]
  ------------------
 4042|    762|            {
 4043|    762|                bnum[j] = j;
 4044|    762|            }
 4045|     76|            OAD_PolymerUnit_SortBackboneBonds(u, aprops, bnum);
 4046|     76|            *senior_bond = bnum[0];
 4047|     76|            inchi_free(bnum);
  ------------------
  |  | 1152|     76|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 76, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 76]
  |  |  ------------------
  ------------------
 4048|     76|        }
 4049|     76|    }
 4050|       |
 4051|       |    /* v. 1.05+ : place senior atom the first ("left") in the senior bond */
 4052|    104|    if ( OAD_Polymer_IsFirstAtomRankLower(u->bkbonds[*senior_bond][0], u->bkbonds[*senior_bond][1], aprops) == 1 )
  ------------------
  |  Branch (4052:10): [True: 53, False: 51]
  ------------------
 4053|     53|    {
 4054|     53|        int tmp = u->bkbonds[*senior_bond][0];
 4055|     53|        u->bkbonds[*senior_bond][0] = u->bkbonds[*senior_bond][1];
 4056|     53|        u->bkbonds[*senior_bond][1] = tmp;
 4057|     53|    }
 4058|       |
 4059|    104|    u->end_atom1 = u->bkbonds[*senior_bond][0];
 4060|    104|    u->end_atom2 = u->bkbonds[*senior_bond][1];
 4061|       |
 4062|    104|    return;
 4063|    104|}
OAD_PolymerUnit_SortBackboneBonds:
 4070|     76|{
 4071|     76|    int i, j, tmp;
 4072|     76|    int n = u->nbkbonds;
 4073|     76|    if ( NULL == bnum )
  ------------------
  |  Branch (4073:10): [True: 0, False: 76]
  ------------------
 4074|      0|    {
 4075|      0|        return;
 4076|      0|    }
 4077|    762|    for ( i = 1; i < n; i++ )
  ------------------
  |  Branch (4077:18): [True: 686, False: 76]
  ------------------
 4078|    686|    {
 4079|    686|        tmp = bnum[i];
 4080|    686|        j = i - 1;
 4081|  3.12k|        while ( j >= 0 && OAD_Polymer_CompareBackboneBondsSeniority(u->bkbonds[bnum[j]], u->bkbonds[tmp], aprops) > 0 )
  ------------------
  |  Branch (4081:17): [True: 3.03k, False: 86]
  |  Branch (4081:27): [True: 2.43k, False: 600]
  ------------------
 4082|  2.43k|        {
 4083|  2.43k|            bnum[j + 1] = bnum[j];
 4084|  2.43k|            j--;
 4085|  2.43k|        }
 4086|    686|        bnum[j + 1] = tmp;
 4087|    686|    }
 4088|       |
 4089|     76|    return;
 4090|     76|}
OAD_Polymer_CompareBackboneBondsSeniority:
 4099|  3.03k|{
 4100|  3.03k|    int b1min, b1max, b2min, b2max, tmp, cmp = 0;
 4101|       |
 4102|       |    /* Find min and max ext-ranked ends of the both bonds */
 4103|  3.03k|    b1max = b1[0]; b1min = b1[1];
 4104|  3.03k|    b2max = b2[0]; b2min = b2[1];
 4105|  3.03k|    if ( OAD_Polymer_IsFirstAtomRankLower(b1min, b1max, aprops) == -1 )
  ------------------
  |  Branch (4105:10): [True: 551, False: 2.48k]
  ------------------
 4106|    551|    {
 4107|    551|        tmp = b1max;
 4108|    551|        b1max = b1min;
 4109|    551|        b1min = tmp;
 4110|    551|    }
 4111|  3.03k|    if ( OAD_Polymer_IsFirstAtomRankLower(b2min, b2max, aprops) == -1 )
  ------------------
  |  Branch (4111:10): [True: 1.27k, False: 1.76k]
  ------------------
 4112|  1.27k|    {
 4113|  1.27k|        tmp = b2max;
 4114|  1.27k|        b2max = b2min;
 4115|  1.27k|        b2min = tmp;
 4116|  1.27k|    }
 4117|       |
 4118|       |    /* Compare bonds' seniority */
 4119|       |
 4120|       |    /* First, favor the bond which has greater ext-rank end
 4121|       |       NB: the result may be 0, that is, equal max ext. ranks */
 4122|       |
 4123|  3.03k|    cmp = OAD_Polymer_CompareRanksOfTwoAtoms(b1max, b2max, aprops);
 4124|  3.03k|    if ( cmp == 1 )
  ------------------
  |  Branch (4124:10): [True: 276, False: 2.76k]
  ------------------
 4125|    276|    {
 4126|    276|        return   1;        /* rank(b1max) < rank(b2max), so bond2 is senior */
 4127|    276|    }
 4128|  2.76k|    else if ( cmp == -1 )
  ------------------
  |  Branch (4128:15): [True: 31, False: 2.73k]
  ------------------
 4129|     31|    {
 4130|     31|        return  -1;        /* rank(b1max) > rank(b2max), so bond1 is senior */
 4131|     31|    }
 4132|       |
 4133|       |    /* Max ends are of the same rank, so favor the bond with lesser min-rank end
 4134|       |       NB: the result may NOT be 0, that is, the case is always resolved    */
 4135|       |
 4136|  2.73k|    cmp = OAD_Polymer_CompareRanksOfTwoAtoms(b1min, b2min, aprops); /*OAD_Polymer_IsFirstAtomRankLower( b1min, b2min, aprops );*/
 4137|       |
 4138|  2.73k|    if ( cmp == 1 )
  ------------------
  |  Branch (4138:10): [True: 17, False: 2.71k]
  ------------------
 4139|     17|    {
 4140|     17|        return  -1;         /* rank(b1min) < rank(b2min), so bond1 is senior */
 4141|     17|    }
 4142|  2.71k|    else if ( cmp == -1 )
  ------------------
  |  Branch (4142:15): [True: 225, False: 2.49k]
  ------------------
 4143|    225|    {
 4144|    225|        return   1;         /* rank(b1min) > rank(b2min), so bond2 is senior */
 4145|    225|    }
 4146|       |
 4147|       |    /* Min ends are of the same rank. Here is the time to compare directly
 4148|       |       which canonical number is larger of max-ends ... */
 4149|       |
 4150|  2.49k|    if ( b1max < b2max )
  ------------------
  |  Branch (4150:10): [True: 1.80k, False: 685]
  ------------------
 4151|  1.80k|    {
 4152|  1.80k|        return  1;
 4153|  1.80k|    }
 4154|    685|    if ( b1max > b2max )
  ------------------
  |  Branch (4154:10): [True: 99, False: 586]
  ------------------
 4155|     99|    {
 4156|     99|        return -1;
 4157|     99|    }
 4158|       |
 4159|       |    /* ... they are the same, so compare which canonical number is larger for min-ends ... */
 4160|       |
 4161|    586|    if ( b1min < b2min )
  ------------------
  |  Branch (4161:10): [True: 18, False: 568]
  ------------------
 4162|     18|    {
 4163|     18|        return -1;          /* b1min < b2min, so bond1 is senior */
 4164|     18|    }
 4165|    568|    if ( b1min > b2min )
  ------------------
  |  Branch (4165:10): [True: 133, False: 435]
  ------------------
 4166|    133|    {
 4167|    133|        return  1;          /* b1min > b2min, so bond2 is senior */
 4168|    133|    }
 4169|       |
 4170|    435|    return 0;    /* we should not reach there */
 4171|    568|}
OAD_Polymer_CompareRanksOfTwoAtoms:
 4180|  11.9k|{
 4181|  11.9k|    const int HETEROCYC = 3, HETEROAT = 2, CARBOCYC = 1, CARBOAT = 0;
 4182|       |    /* NB: Carbon's rank is always 2, next to the lowest */
 4183|       |
 4184|  11.9k|    int a1 = atom1 - 1;
 4185|  11.9k|    int a2 = atom2 - 1;
 4186|  11.9k|    int a1typ = CARBOAT;
 4187|  11.9k|    int a2typ = CARBOAT;
 4188|       |
 4189|       |    /* djb-rwth: fixing oss-fuzz issue #69501, #68277 */
 4190|  11.9k|    if ( (a1 < 0) || (a2 < 0) )
  ------------------
  |  Branch (4190:10): [True: 5.21k, False: 6.73k]
  |  Branch (4190:22): [True: 637, False: 6.09k]
  ------------------
 4191|  5.85k|    {
 4192|  5.85k|        return 0;
 4193|  5.85k|    }
 4194|       |
 4195|  6.09k|    if ( aprops[a1].ring_size > 2 )
  ------------------
  |  Branch (4195:10): [True: 1, False: 6.09k]
  ------------------
 4196|      1|    {
 4197|      1|        if ( aprops[a1].ring_erank <= 2 )
  ------------------
  |  Branch (4197:14): [True: 0, False: 1]
  ------------------
 4198|      0|        {
 4199|      0|            a1typ = CARBOCYC;
 4200|      0|        }
 4201|      1|        else
 4202|      1|        {
 4203|      1|            a1typ = HETEROCYC;
 4204|      1|        }
 4205|      1|    }
 4206|  6.09k|    else
 4207|  6.09k|    {
 4208|  6.09k|        if ( aprops[a1].erank == 2 )
  ------------------
  |  Branch (4208:14): [True: 451, False: 5.64k]
  ------------------
 4209|    451|        {
 4210|    451|            a1typ = CARBOAT;
 4211|    451|        }
 4212|  5.64k|        else
 4213|  5.64k|        {
 4214|  5.64k|            a1typ = HETEROAT;
 4215|  5.64k|        }
 4216|  6.09k|    }
 4217|       |
 4218|  6.09k|    if ( aprops[a2].ring_size > 2 )
  ------------------
  |  Branch (4218:10): [True: 4, False: 6.09k]
  ------------------
 4219|      4|    {
 4220|      4|        if ( aprops[a2].ring_erank <= 2 )
  ------------------
  |  Branch (4220:14): [True: 0, False: 4]
  ------------------
 4221|      0|        {
 4222|      0|            a2typ = CARBOCYC;
 4223|      0|        }
 4224|      4|        else
 4225|      4|        {
 4226|      4|            a2typ = HETEROCYC;
 4227|      4|        }
 4228|      4|    }
 4229|  6.09k|    else
 4230|  6.09k|    {
 4231|  6.09k|        if ( aprops[a2].erank == 2 )
  ------------------
  |  Branch (4231:14): [True: 355, False: 5.73k]
  ------------------
 4232|    355|        {
 4233|    355|            a2typ = CARBOAT;
 4234|    355|        }
 4235|  5.73k|        else
 4236|  5.73k|        {
 4237|  5.73k|            a2typ = HETEROAT;
 4238|  5.73k|        }
 4239|  6.09k|    }
 4240|       |
 4241|       |    /* Compare */
 4242|       |
 4243|       |    /*
 4244|       |        Follow IUPAC Rule 1
 4245|       |            'The basic order of seniority of subunits is:
 4246|       |                heterocyclic rings and ring systems > heteroatom chains >
 4247|       |                    > carbocyclic rings and ring systems > acyclic carbon chains'
 4248|       |    */
 4249|       |
 4250|  6.09k|    if ( a1typ == HETEROCYC && a2typ == HETEROCYC )   /* a1 and a2 are HETEROCYC */
  ------------------
  |  Branch (4250:10): [True: 1, False: 6.09k]
  |  Branch (4250:32): [True: 1, False: 0]
  ------------------
 4251|      1|    {
 4252|       |        /* Try resolving by senior-heteroatom ring */
 4253|      1|        if ( aprops[a1].ring_erank < aprops[a2].ring_erank )
  ------------------
  |  Branch (4253:14): [True: 0, False: 1]
  ------------------
 4254|      0|        {
 4255|      0|            return  1;
 4256|      0|        }
 4257|      1|        if ( aprops[a1].ring_erank > aprops[a2].ring_erank )
  ------------------
  |  Branch (4257:14): [True: 0, False: 1]
  ------------------
 4258|      0|        {
 4259|      0|            return -1;
 4260|      0|        }
 4261|       |        /* Same senior-heteroatom rings, try resolving by total ring size */
 4262|      1|        if ( aprops[a1].ring_size < aprops[a2].ring_size )
  ------------------
  |  Branch (4262:14): [True: 0, False: 1]
  ------------------
 4263|      0|        {
 4264|      0|            return  1;
 4265|      0|        }
 4266|      1|        if ( aprops[a1].ring_size > aprops[a2].ring_size )
  ------------------
  |  Branch (4266:14): [True: 0, False: 1]
  ------------------
 4267|      0|        {
 4268|      0|            return -1;
 4269|      0|        }
 4270|       |        /* Could not resolve... */
 4271|      1|        return 0;
 4272|      1|    }
 4273|  6.09k|    else if ( a1typ == HETEROCYC )
  ------------------
  |  Branch (4273:15): [True: 0, False: 6.09k]
  ------------------
 4274|      0|    {
 4275|      0|        return -1;  /* a1 is HETEROCYC, a2 is any other (==junior) */
 4276|      0|    }
 4277|  6.09k|    else if ( a2typ == HETEROCYC )
  ------------------
  |  Branch (4277:15): [True: 3, False: 6.09k]
  ------------------
 4278|      3|    {
 4279|      3|        return  1;  /* a2 is HETEROCYC, a1 is any other (==junior) */
 4280|      3|    }
 4281|       |
 4282|       |    /* HETEROCYC left out */
 4283|       |
 4284|  6.09k|    if ( a1typ == HETEROAT && a2typ == HETEROAT )  /* a1 and a2 are HETEROAT */
  ------------------
  |  Branch (4284:10): [True: 5.64k, False: 451]
  |  Branch (4284:31): [True: 5.41k, False: 226]
  ------------------
 4285|  5.41k|    {
 4286|  5.41k|        if ( aprops[a1].erank < aprops[a2].erank )
  ------------------
  |  Branch (4286:14): [True: 775, False: 4.64k]
  ------------------
 4287|    775|        {
 4288|    775|            return  1;
 4289|    775|        }
 4290|  4.64k|        if ( aprops[a1].erank > aprops[a2].erank )
  ------------------
  |  Branch (4290:14): [True: 1.02k, False: 3.61k]
  ------------------
 4291|  1.02k|        {
 4292|  1.02k|            return -1;
 4293|  1.02k|        }
 4294|       |        /* Could not resolve... */
 4295|  3.61k|        return 0;
 4296|  4.64k|    }
 4297|    677|    else if ( a1typ == HETEROAT )
  ------------------
  |  Branch (4297:15): [True: 226, False: 451]
  ------------------
 4298|    226|    {
 4299|    226|        return -1;  /* a1 is HETEROAT, a2 is any other (==junior) */
 4300|    226|    }
 4301|    451|    else if ( a2typ == HETEROAT )
  ------------------
  |  Branch (4301:15): [True: 322, False: 129]
  ------------------
 4302|    322|    {
 4303|    322|        return  1;  /* a2 is HETEROAT, a1 is any other (==junior) */
 4304|    322|    }
 4305|       |
 4306|       |    /* HETEROAT left out */
 4307|    129|    if ( a1typ == CARBOCYC && a2typ == CARBOCYC ) /* a1 and a2 are CARBOCYC */
  ------------------
  |  Branch (4307:10): [True: 0, False: 129]
  |  Branch (4307:31): [True: 0, False: 0]
  ------------------
 4308|      0|    {
 4309|       |        /* Same senior-atom (C) ring, try resolving by total ring size */
 4310|      0|        if ( aprops[a1].ring_size < aprops[a2].ring_size )
  ------------------
  |  Branch (4310:14): [True: 0, False: 0]
  ------------------
 4311|      0|        {
 4312|      0|            return  1;
 4313|      0|        }
 4314|      0|        if ( aprops[a1].ring_size > aprops[a2].ring_size )
  ------------------
  |  Branch (4314:14): [True: 0, False: 0]
  ------------------
 4315|      0|        {
 4316|      0|            return -1;
 4317|      0|        }
 4318|       |        /* Could not resolve... */
 4319|      0|        return 0;
 4320|      0|    }
 4321|    129|    else if ( a1typ == CARBOCYC )
  ------------------
  |  Branch (4321:15): [True: 0, False: 129]
  ------------------
 4322|      0|    {
 4323|      0|        return -1;
 4324|      0|    }
 4325|    129|    else if ( a2typ == CARBOCYC )
  ------------------
  |  Branch (4325:15): [True: 0, False: 129]
  ------------------
 4326|      0|    {
 4327|      0|        return  1;
 4328|      0|    }
 4329|       |
 4330|    129|    return 0;        /* 0 means unresolved. It is legal here */
 4331|    129|}
OAD_Polymer_IsFirstAtomRankLower:
 4340|  6.18k|{
 4341|       |    /* Compare ext-ranks */
 4342|  6.18k|    int result = OAD_Polymer_CompareRanksOfTwoAtoms(atom1, atom2, aprops);
 4343|       |
 4344|  6.18k|    if ( result )
  ------------------
  |  Branch (4344:10): [True: 1.80k, False: 4.38k]
  ------------------
 4345|  1.80k|    {
 4346|  1.80k|        return result;
 4347|  1.80k|    }
 4348|       |
 4349|       |    /* Could not resolve who is junior by extended-ranks...             */
 4350|       |    /* As a last resort, simply check which canonical number is lesser  */
 4351|  4.38k|    if ( atom1 < atom2 )
  ------------------
  |  Branch (4351:10): [True: 1.62k, False: 2.75k]
  ------------------
 4352|  1.62k|    {
 4353|  1.62k|        return  1;
 4354|  1.62k|    }
 4355|  2.75k|    if ( atom1 > atom2 )
  ------------------
  |  Branch (4355:10): [True: 867, False: 1.88k]
  ------------------
 4356|    867|    {
 4357|    867|        return -1;
 4358|    867|    }
 4359|       |
 4360|       |    /* should not reach there */
 4361|  1.88k|    return 0;
 4362|  2.75k|}
runichi3.c:OrigAtData_bCheckUnusualValences:
   58|  70.4k|{
   59|  70.4k|    int i, val, num_found = 0;
   60|  70.4k|    char msg[32];
   61|  70.4k|    int len, num_H;
   62|       |
   63|  70.4k|    int already_here = (orig_at_data && orig_at_data->num_inp_atoms > 0);
  ------------------
  |  Branch (63:25): [True: 70.4k, False: 0]
  |  Branch (63:41): [True: 70.4k, False: 0]
  ------------------
   64|       |
   65|  70.4k|    inp_ATOM* at = already_here ? orig_at_data->at : NULL;
  ------------------
  |  Branch (65:20): [True: 70.4k, False: 0]
  ------------------
   66|       |
   67|  70.4k|    if ( at )
  ------------------
  |  Branch (67:10): [True: 70.4k, False: 0]
  ------------------
   68|  70.4k|    {
   69|   229k|        for ( i = 0, num_found = 0; i < orig_at_data->num_inp_atoms; i++ )
  ------------------
  |  Branch (69:37): [True: 159k, False: 70.4k]
  ------------------
   70|   159k|        {
   71|   159k|            num_H = bAddIsoH ? NUMH(at, i) : at[i].num_H;
  ------------------
  |  |   56|   159k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|   159k|#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 (71:21): [True: 159k, False: 0]
  ------------------
   72|       |
   73|   159k|            val = detect_unusual_el_valence(at[i].el_number,
   74|   159k|                at[i].charge,
   75|   159k|                at[i].radical,
   76|   159k|                at[i].chem_bonds_valence,
   77|   159k|                num_H,
   78|   159k|                at[i].valence);
   79|   159k|            if ( val )
  ------------------
  |  Branch (79:18): [True: 13.3k, False: 145k]
  ------------------
   80|  13.3k|            {
   81|  13.3k|                num_found++;
   82|  13.3k|                if ( !bNoWarnings )
  ------------------
  |  Branch (82:22): [True: 13.3k, False: 0]
  ------------------
   83|  13.3k|                {
   84|  13.3k|                    WarningMessage(pStrErrStruct, "Accepted unusual valence(s):");
  ------------------
  |  |  132|  13.3k|#define WarningMessage AddErrorMessage
  ------------------
   85|  13.3k|                }
   86|  13.3k|                len = sprintf(msg, "%s", at[i].elname);
   87|  13.3k|                if ( at[i].charge )
  ------------------
  |  Branch (87:22): [True: 1.93k, False: 11.4k]
  ------------------
   88|  1.93k|                {
   89|  1.93k|                    len += sprintf(msg + len, "%+d", at[i].charge);
   90|  1.93k|                }
   91|  13.3k|                if ( at[i].radical )
  ------------------
  |  Branch (91:22): [True: 193, False: 13.1k]
  ------------------
   92|    193|                {
   93|    193|                    len += sprintf(msg + len, ",%s", at[i].radical == RADICAL_SINGLET ? "s" :
  ------------------
  |  |   75|    193|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (93:54): [True: 0, False: 193]
  ------------------
   94|    193|                        at[i].radical == RADICAL_DOUBLET ? "d" :
  ------------------
  |  |   76|    193|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (94:25): [True: 37, False: 156]
  ------------------
   95|    193|                        at[i].radical == RADICAL_TRIPLET ? "t" : "?");
  ------------------
  |  |   77|    156|#define RADICAL_TRIPLET 3
  ------------------
  |  Branch (95:25): [True: 17, False: 139]
  ------------------
   96|    193|                }
   97|  13.3k|                len += sprintf(msg + len, "(%d)", val);
   98|  13.3k|                if ( !bNoWarnings )
  ------------------
  |  Branch (98:22): [True: 13.3k, False: 0]
  ------------------
   99|  13.3k|                {
  100|  13.3k|                    WarningMessage(pStrErrStruct, msg);
  ------------------
  |  |  132|  13.3k|#define WarningMessage AddErrorMessage
  ------------------
  101|  13.3k|                }
  102|  13.3k|            }
  103|   159k|        }
  104|  70.4k|    }
  105|       |
  106|  70.4k|    return num_found;
  107|  70.4k|}

SortAndPrintINChI:
   87|  75.4k|{
   88|  75.4k|    INCHI_SORT *pINChISort[INCHI_NUM][TAUT_NUM];
   89|  75.4k|    int j, i, k, k1, ret, ret2, iINChI, max_num_components; /* djb-rwth: ignoring LLVM warning: variable used */
   90|  75.4k|    int INCHI_basic_or_INCHI_reconnected;
   91|       |    /* djb-rwth: removing redundant variables */
   92|  75.4k|    int bDisconnectedCoord = ( 0 != ( bTautFlagsDone[0] & TG_FLAG_DISCONNECT_COORD_DONE ) );
  ------------------
  |  |  975|  75.4k|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
   93|  75.4k|    int bINChIOutputOptions0, bCurOption, bINChIOutputOptionsCur, bEmbedReconnected;
   94|  75.4k|    static const char szAnnHdr[] = "InChI ANNOTATED CONTENTS";
   95|       |#ifdef TARGET_LIB_FOR_WINCHI
   96|       |    int ikflag = 0;
   97|       |    out_file->type = INCHI_IOS_TYPE_STRING;
   98|       |#endif
   99|       |
  100|       |    /*
  101|       |        Note:
  102|       |
  103|       |        pINChI[INCHI_BAS] refers to either disconnected or original structure;
  104|       |            num_components[INCHI_BAS] > 0 if there was input structure
  105|       |        pINChI[INCHI_REC] refers to the reconnected structure,
  106|       |            and only if the input structure has been disconnected, that is,
  107|       |            num_components[INCHI_REC] > 0
  108|       |    */
  109|       |
  110|  75.4k|    ret = 1;
  111|       |
  112|   226k|    for (i = 0; i < INCHI_NUM; i++)
  ------------------
  |  |  569|   226k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (112:17): [True: 150k, False: 75.4k]
  ------------------
  113|   150k|    {
  114|   452k|        for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  573|   452k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (114:21): [True: 301k, False: 150k]
  ------------------
  115|   301k|        {
  116|   301k|            bTautFlags[i] |= pncFlags->bTautFlags[i][k];
  117|   301k|            bTautFlagsDone[i] |= pncFlags->bTautFlagsDone[i][k];
  118|   301k|        }
  119|   150k|    }
  120|       |
  121|       |    /* djb-rwth: removing redundant code */
  122|       |
  123|  75.4k|    max_num_components = 0;
  124|   226k|    for (j = 0; j < INCHI_NUM; j++)
  ------------------
  |  |  569|   226k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (124:17): [True: 150k, False: 75.4k]
  ------------------
  125|   150k|    {
  126|   150k|        if (max_num_components < num_components[j])
  ------------------
  |  Branch (126:13): [True: 75.4k, False: 75.4k]
  ------------------
  127|  75.4k|        {
  128|  75.4k|            max_num_components = num_components[j];
  129|  75.4k|        }
  130|   150k|    }
  131|  75.4k|    if (max_num_components <= 0)
  ------------------
  |  Branch (131:9): [True: 0, False: 75.4k]
  ------------------
  132|      0|    {
  133|      0|        max_num_components = 1;
  134|      0|    }
  135|       |
  136|   226k|    for (j = 0, i = 0; j < INCHI_NUM; j++)
  ------------------
  |  |  569|   226k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (136:24): [True: 150k, False: 75.4k]
  ------------------
  137|   150k|    {
  138|   150k|        if (num_components[j])
  ------------------
  |  Branch (138:13): [True: 75.4k, False: 75.4k]
  ------------------
  139|  75.4k|        {
  140|   226k|            for (k1 = 0; k1 < TAUT_NUM; k1++)
  ------------------
  |  |  573|   226k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (140:26): [True: 150k, False: 75.4k]
  ------------------
  141|   150k|            {
  142|   150k|                pINChISort[j][k1] =
  143|   150k|                    (INCHI_SORT *) inchi_calloc( max_num_components,
  ------------------
  |  | 1146|   150k|#define inchi_calloc   calloc
  ------------------
  144|   150k|                                               sizeof( pINChISort[0][0][0] ) );
  145|   150k|                i += !pINChISort[j][k1]; /* number of failed allocatons */
  146|   150k|            }
  147|  75.4k|        }
  148|  75.4k|        else
  149|  75.4k|        {
  150|   226k|            for (k1 = 0; k1 < TAUT_NUM; k1++)
  ------------------
  |  |  573|   226k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (150:26): [True: 150k, False: 75.4k]
  ------------------
  151|   150k|            {
  152|   150k|                pINChISort[j][k1] = NULL; /* keep BC happy */
  153|   150k|            }
  154|  75.4k|        }
  155|   150k|    }
  156|       |
  157|  75.4k|    if (i)
  ------------------
  |  Branch (157:9): [True: 0, False: 75.4k]
  ------------------
  158|      0|    {
  159|      0|        ret = CT_OUT_OF_RAM;
  ------------------
  |  |   21|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  160|      0|        goto exit_function;
  161|      0|    }
  162|       |
  163|   226k|    for (j = 0; j < INCHI_NUM; j++)
  ------------------
  |  |  569|   226k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (163:17): [True: 150k, False: 75.4k]
  ------------------
  164|   150k|    {
  165|   150k|        if (!num_components[j])
  ------------------
  |  Branch (165:13): [True: 75.4k, False: 75.4k]
  ------------------
  166|  75.4k|        {
  167|  75.4k|            continue;
  168|  75.4k|        }
  169|  75.4k|        iINChI = j;
  170|       |
  171|       |#if ( OUTPUT_CONNECTED_METAL_ONLY == 1 ) /* test: output connected as the only one INChI */
  172|       |        if (INCHI_BAS == j && num_components[INCHI_REC])
  173|       |        {
  174|       |            j = INCHI_REC;
  175|       |        }
  176|       |#endif
  177|       |
  178|       |        /* j = INCHI_BAS; <- for debug only */
  179|       |        /* for only normal or disconnected coord compounds */
  180|       |        /* (j=0=INCHI_BAS => normal or disconnected, j=1=INCHI_REC => reconnected */
  181|       |
  182|   226k|        for (k1 = 0; k1 < TAUT_NUM; k1++)
  ------------------
  |  |  573|   226k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (182:22): [True: 150k, False: 75.4k]
  ------------------
  183|   150k|        {
  184|   558k|            for (i = 0; i < num_components[j]; i++)
  ------------------
  |  Branch (184:25): [True: 407k, False: 150k]
  ------------------
  185|   407k|            {
  186|  1.22M|                for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  573|  1.22M|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (186:29): [True: 814k, False: 407k]
  ------------------
  187|   814k|                {
  188|   814k|                    pINChISort[j][k1][i].pINChI[k] = pINChI[j][i][k];
  189|   814k|                    pINChISort[j][k1][i].pINChI_Aux[k] = pINChI_Aux[j][i][k];
  190|   814k|                }
  191|   407k|                pINChISort[j][k1][i].ord_number = i;
  192|   407k|            }
  193|   150k|        }
  194|       |
  195|       |        /* Sort component INChIs */
  196|   226k|        for (k1 = 0; k1 < TAUT_NUM; k1++)
  ------------------
  |  |  573|   226k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (196:22): [True: 150k, False: 75.4k]
  ------------------
  197|   150k|        {
  198|   150k|            switch (k1)
  ------------------
  |  Branch (198:21): [True: 150k, False: 0]
  ------------------
  199|   150k|            {
  200|  75.4k|                case TAUT_NON:
  ------------------
  |  |  574|  75.4k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (200:17): [True: 75.4k, False: 75.4k]
  ------------------
  201|  75.4k|                    qsort( pINChISort[j][k1],
  202|  75.4k|                           num_components[j],
  203|  75.4k|                           sizeof( pINChISort[0][0][0] ),
  204|  75.4k|                           CompINChINonTaut2 );
  205|  75.4k|                    break;
  206|  75.4k|                case TAUT_YES:
  ------------------
  |  |  575|  75.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (206:17): [True: 75.4k, False: 75.4k]
  ------------------
  207|  75.4k|                    qsort( pINChISort[j][k1],
  208|  75.4k|                           num_components[j],
  209|  75.4k|                           sizeof( pINChISort[0][0][0] ),
  210|  75.4k|                           CompINChITaut2 );
  211|  75.4k|                    break;
  212|   150k|            }
  213|   150k|        }
  214|       |
  215|       |#ifndef COMPILE_ANSI_ONLY
  216|       |        /* Find equivalent and wINChI display order;
  217|       |        use requested in ip->bCompareComponents comparison */
  218|       |
  219|       |        ret = SaveEquComponentsInfoAndSortOrder( iINChI, pINChISort[j],
  220|       |                                                  num_components,
  221|       |                                                  orig_inp_data, prep_inp_data,
  222|       |#if ( FIX_DALKE_BUGS == 1 )
  223|       |                                                  composite_norm_data ? composite_norm_data[j] : NULL,
  224|       |#else
  225|       |                                                  composite_norm_data[j],
  226|       |#endif
  227|       |                                                  ip->bCompareComponents );
  228|       |        if (RETURNED_ERROR( ret ))
  229|       |        {
  230|       |            ret = 0;
  231|       |            goto exit_function;
  232|       |        }
  233|       |        else
  234|       |        {
  235|       |            ret = 1;
  236|       |        }
  237|       |#endif
  238|  75.4k|    } /* j */
  239|       |
  240|  75.4k|    if (!( ip->bINChIOutputOptions & INCHI_OUT_PRINT_OPTIONS ))
  ------------------
  |  |  168|  75.4k|#define INCHI_OUT_PRINT_OPTIONS       (INCHI_OUT_EMBED_REC |           \
  |  |  ------------------
  |  |  |  |  132|  75.4k|#define INCHI_OUT_EMBED_REC             0x0008   /* embed reconnected INChI into disconnected INChI */
  |  |  ------------------
  |  |  169|  75.4k|                                       INCHI_OUT_PLAIN_TEXT |          \
  |  |  ------------------
  |  |  |  |  135|  75.4k|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  |  |  ------------------
  |  |  170|  75.4k|                                       INCHI_OUT_PLAIN_TEXT_COMMENTS)
  |  |  ------------------
  |  |  |  |  136|  75.4k|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  |  |  ------------------
  ------------------
  |  Branch (240:9): [True: 70.4k, False: 5.02k]
  ------------------
  241|  70.4k|    {
  242|       |        /* Prepare InChI from the structures obtained by
  243|       |           reversing InChI for returning to the caller */
  244|   211k|        for (j = 0; j < INCHI_NUM; j++)
  ------------------
  |  |  569|   211k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (244:21): [True: 140k, False: 70.4k]
  ------------------
  245|   140k|        {
  246|   140k|            if (!num_components[j])
  ------------------
  |  Branch (246:17): [True: 70.4k, False: 70.4k]
  ------------------
  247|  70.4k|            {
  248|  70.4k|                continue;
  249|  70.4k|            }
  250|       |
  251|       |            /* pINChI[iINCHI][iComponent][bTaut] */
  252|       |            /* j  = disconnected/connected */
  253|       |            /* k1 = sort order for Mobile or Fixed H */
  254|       |
  255|  70.4k|            k1 = TAUT_YES; /* in Mobile H order */
  ------------------
  |  |  575|  70.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  256|       |            /* store components in Mobile H order */
  257|       |
  258|   176k|            for (i = 0; i < num_components[j] && i < max_num_components; i++) /* djb-rwth: fixing undefined index value / buffer overflow */
  ------------------
  |  Branch (258:25): [True: 106k, False: 70.4k]
  |  Branch (258:50): [True: 106k, False: 0]
  ------------------
  259|   106k|            {
  260|       |
  261|   106k|                if (pINChISort[j][k1][i].pINChI[TAUT_NON] &&
  ------------------
  |  |  574|   106k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (261:21): [True: 35.6k, False: 70.4k]
  ------------------
  262|  35.6k|                    !pINChISort[j][k1][i].pINChI[TAUT_YES])
  ------------------
  |  |  575|  35.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (262:21): [True: 0, False: 35.6k]
  ------------------
  263|      0|                {
  264|       |                    /* make sure Mobile-H is always present */
  265|      0|                    for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  573|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (265:33): [True: 0, False: 0]
  ------------------
  266|      0|                    {
  267|      0|                        pINChI[j][i][k] = pINChISort[j][k1][i].pINChI[ALT_TAUT( k )];
  ------------------
  |  |  577|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  268|      0|                        pINChI_Aux[j][i][k] = pINChISort[j][k1][i].pINChI_Aux[ALT_TAUT( k )];
  ------------------
  |  |  577|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  575|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (577:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  269|      0|                    }
  270|      0|                }
  271|   106k|                else
  272|   106k|                {
  273|   318k|                    for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  573|   318k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (273:33): [True: 212k, False: 106k]
  ------------------
  274|   212k|                    {
  275|   212k|                        pINChI[j][i][k] = pINChISort[j][k1][i].pINChI[k];
  276|   212k|                        pINChI_Aux[j][i][k] = pINChISort[j][k1][i].pINChI_Aux[k];
  277|   212k|                    }
  278|   106k|                }
  279|   106k|            }
  280|  70.4k|        }
  281|  70.4k|    }
  282|  5.02k|    else
  283|  5.02k|    {
  284|       |        /* Print InChI string(s) */
  285|  5.02k|        bINChIOutputOptions0 = ip->bINChIOutputOptions & ~INCHI_OUT_PRINT_OPTIONS;
  ------------------
  |  |  168|  5.02k|#define INCHI_OUT_PRINT_OPTIONS       (INCHI_OUT_EMBED_REC |           \
  |  |  ------------------
  |  |  |  |  132|  5.02k|#define INCHI_OUT_EMBED_REC             0x0008   /* embed reconnected INChI into disconnected INChI */
  |  |  ------------------
  |  |  169|  5.02k|                                       INCHI_OUT_PLAIN_TEXT |          \
  |  |  ------------------
  |  |  |  |  135|  5.02k|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  |  |  ------------------
  |  |  170|  5.02k|                                       INCHI_OUT_PLAIN_TEXT_COMMENTS)
  |  |  ------------------
  |  |  |  |  136|  5.02k|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  |  |  ------------------
  ------------------
  286|  5.02k|        bEmbedReconnected = ip->bINChIOutputOptions & INCHI_OUT_EMBED_REC;
  ------------------
  |  |  132|  5.02k|#define INCHI_OUT_EMBED_REC             0x0008   /* embed reconnected INChI into disconnected INChI */
  ------------------
  287|       |
  288|  15.0k|        for (i = 1; i <= 2; i++)
  ------------------
  |  Branch (288:21): [True: 10.0k, False: 5.02k]
  ------------------
  289|  10.0k|        {
  290|  10.0k|            bCurOption = INCHI_OUT_PLAIN_TEXT;
  ------------------
  |  |  135|  10.0k|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  ------------------
  291|  10.0k|            if (i == 2)
  ------------------
  |  Branch (291:17): [True: 5.02k, False: 5.02k]
  ------------------
  292|  5.02k|            {
  293|  5.02k|                bCurOption = INCHI_OUT_PLAIN_TEXT_COMMENTS;
  ------------------
  |  |  136|  5.02k|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  ------------------
  294|       |                /* continue; */
  295|  5.02k|            }
  296|  10.0k|            if (!( ip->bINChIOutputOptions & bCurOption ))
  ------------------
  |  Branch (296:17): [True: 5.02k, False: 5.02k]
  ------------------
  297|  5.02k|            {
  298|  5.02k|                continue;
  299|  5.02k|            }
  300|       |
  301|  5.02k|            bINChIOutputOptionsCur = bINChIOutputOptions0 | bCurOption;
  302|  5.02k|            if (i == 1)
  ------------------
  |  Branch (302:17): [True: 5.02k, False: 0]
  ------------------
  303|  5.02k|            {
  304|       |                /* output INChI */
  305|  5.02k|                bINChIOutputOptionsCur |= bEmbedReconnected;
  306|  5.02k|            }
  307|      0|            else if (i == 2)
  ------------------
  |  Branch (307:22): [True: 0, False: 0]
  ------------------
  308|      0|            {
  309|       |                /* output annotation */
  310|      0|                inchi_ios_print( out_file, "\n==== %s ====\n", szAnnHdr );
  311|      0|                ITRACE_( "\n==== %s ====\n", szAnnHdr );
  ------------------
  |  |   98|      0|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (98:17): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (311:17): [True: 0, False: 0]
  ------------------
  312|      0|                bINChIOutputOptionsCur |= bEmbedReconnected;
  313|      0|                bINChIOutputOptionsCur &= ~INCHI_OUT_TABBED_OUTPUT;
  ------------------
  |  |  139|      0|#define INCHI_OUT_TABBED_OUTPUT         0x0400   /* tab-delimited (only for plain text)     */
  ------------------
  314|      0|            }
  315|      0|            else
  316|      0|            {
  317|      0|                continue;
  318|      0|            }
  319|       |
  320|       |#if 0 /*^^^#ifdef TARGET_LIB_FOR_WINCHI*/
  321|       |            inchi_ios_free_str( out_file );
  322|       |#endif
  323|       |
  324|  5.02k|            INCHI_basic_or_INCHI_reconnected = INCHI_BAS;
  ------------------
  |  |  570|  5.02k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  325|       |
  326|  5.02k|            ret2 = OutputINChI2( pCG,
  327|  5.02k|                                 strbuf,
  328|  5.02k|                                 pINChISort,
  329|  5.02k|                                 INCHI_basic_or_INCHI_reconnected,
  330|  5.02k|                                 orig_inp_data,
  331|  5.02k|                                 pOrigStruct,
  332|  5.02k|                                 ip,
  333|  5.02k|                                 bDisconnectedCoord,
  334|  5.02k|                                 OUT_TN,
  ------------------
  |  |  583|  5.02k|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  335|  5.02k|                                 bINChIOutputOptionsCur,
  336|  5.02k|                                 num_components,
  337|  5.02k|                                 num_non_taut,
  338|  5.02k|                                 num_taut,
  339|  5.02k|                                 out_file,
  340|  5.02k|                                 log_file,
  341|  5.02k|                                 num_inp,
  342|  5.02k|                                 pSortPrintINChIFlags,
  343|  5.02k|                                 save_opt_bits );
  344|       |
  345|  5.02k|            ret &= ret2;
  346|       |
  347|       |#ifdef TARGET_LIB_FOR_WINCHI
  348|       |            /* always calculate InChIKey */
  349|       |            winchi_calc_inchikey( ret, &ikflag, ip, out_file, log_file );
  350|       |            /*push_to_winchi_text_window( out_file );
  351|       |            inchi_ios_flush( out_file );*/
  352|       |
  353|       |#endif
  354|       |
  355|  5.02k|            if (!ret)
  ------------------
  |  Branch (355:17): [True: 0, False: 5.02k]
  ------------------
  356|      0|            {
  357|      0|                break;
  358|      0|            }
  359|  5.02k|        } /* i */
  360|  5.02k|    }
  361|       |
  362|       |
  363|  75.4k|exit_function:
  364|       |
  365|   226k|    for (j = 0; j < INCHI_NUM; j++)
  ------------------
  |  |  569|   226k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (365:17): [True: 150k, False: 75.4k]
  ------------------
  366|   150k|    {
  367|   452k|        for (k1 = 0; k1 < TAUT_NUM; k1++) /* djb-rwth: removing redundant code */
  ------------------
  |  |  573|   452k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (367:22): [True: 301k, False: 150k]
  ------------------
  368|   301k|        {
  369|   301k|            if (pINChISort[j][k1])
  ------------------
  |  Branch (369:17): [True: 150k, False: 150k]
  ------------------
  370|   150k|            {
  371|   150k|                inchi_free( pINChISort[j][k1] );
  ------------------
  |  | 1152|   150k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 150k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 150k]
  |  |  ------------------
  ------------------
  372|   150k|            }
  373|   301k|        }
  374|   150k|    }
  375|       |
  376|       |
  377|  75.4k|    ret = ret ? 0 : _IS_FATAL;
  ------------------
  |  |   13|  75.4k|#define _IS_FATAL   3
  ------------------
  |  Branch (377:11): [True: 75.4k, False: 0]
  ------------------
  378|       |
  379|  75.4k|    return ret;
  380|  75.4k|}
FreeAllINChIArrays:
 1290|   186k|{
 1291|   186k|    int k;
 1292|   559k|    for (k = 0; k < INCHI_NUM; k++)
  ------------------
  |  |  569|   559k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1292:17): [True: 372k, False: 186k]
  ------------------
 1293|   372k|    {
 1294|   372k|        int nk = num_components[k];
 1295|       |
 1296|   372k|        FreeINChIArrays( pINChI[k], pINChI_Aux[k], num_components[k] );
 1297|       |
 1298|   372k|        num_components[k] = 0;
 1299|       |
 1300|   372k|        if (nk &&                /* added check for nk: 2013-12-15 IPl */
  ------------------
  |  Branch (1300:13): [True: 75.4k, False: 297k]
  ------------------
 1301|  75.4k|             pINChI[k])
  ------------------
  |  Branch (1301:14): [True: 75.4k, False: 0]
  ------------------
 1302|  75.4k|        {
 1303|  75.4k|            inchi_free( pINChI[k] );
  ------------------
  |  | 1152|  75.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 75.4k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 75.4k]
  |  |  ------------------
  ------------------
 1304|  75.4k|            pINChI[k] = NULL;
 1305|  75.4k|        }
 1306|       |
 1307|   372k|        if (nk &&                /* added check for nk: 2013-12-15 IPl */
  ------------------
  |  Branch (1307:13): [True: 75.4k, False: 297k]
  ------------------
 1308|  75.4k|             pINChI_Aux[k])
  ------------------
  |  Branch (1308:14): [True: 75.4k, False: 0]
  ------------------
 1309|  75.4k|        {
 1310|  75.4k|            inchi_free( pINChI_Aux[k] );
  ------------------
  |  | 1152|  75.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 75.4k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 75.4k]
  |  |  ------------------
  ------------------
 1311|  75.4k|            pINChI_Aux[k] = NULL;
 1312|  75.4k|        }
 1313|   372k|    }
 1314|       |
 1315|   186k|    return;
 1316|   186k|}
FreeINChIArrays:
 1323|   372k|{
 1324|   372k|    int i, k;
 1325|       |    /* Release allocated memory */
 1326|   372k|    if (pINChI)
  ------------------
  |  Branch (1326:9): [True: 75.4k, False: 297k]
  ------------------
 1327|  75.4k|    {
 1328|   279k|        for (i = 0; i < num_components; i++)
  ------------------
  |  Branch (1328:21): [True: 203k, False: 75.4k]
  ------------------
 1329|   203k|        {
 1330|   610k|            for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  573|   610k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1330:25): [True: 407k, False: 203k]
  ------------------
 1331|   407k|            {
 1332|   407k|                Free_INChI( &pINChI[i][k] );
 1333|   407k|            }
 1334|   203k|        }
 1335|  75.4k|    }
 1336|   372k|    if (pINChI_Aux)
  ------------------
  |  Branch (1336:9): [True: 75.4k, False: 297k]
  ------------------
 1337|  75.4k|    {
 1338|   279k|        for (i = 0; i < num_components; i++)
  ------------------
  |  Branch (1338:21): [True: 203k, False: 75.4k]
  ------------------
 1339|   203k|        {
 1340|   610k|            for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  573|   610k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1340:25): [True: 407k, False: 203k]
  ------------------
 1341|   407k|            {
 1342|   407k|                Free_INChI_Aux( &pINChI_Aux[i][k] );
 1343|   407k|            }
 1344|   203k|        }
 1345|  75.4k|    }
 1346|   372k|}
TreatErrorsInCreateOneComponentINChI:
 1360|      4|{
 1361|      4|    if (sd->nErrorCode)
  ------------------
  |  Branch (1361:9): [True: 4, False: 0]
  ------------------
 1362|      4|    {
 1363|      4|        AddErrorMessage( sd->pStrErrStruct, ErrMsg( sd->nErrorCode ) );
 1364|      4|        inchi_ios_eprint( log_file,
 1365|      4|                          "Error %d (%s) structure #%ld component %d.%s%s%s%s\n",
 1366|      4|                          sd->nErrorCode, sd->pStrErrStruct,
 1367|      4|                          num_inp, i + 1, SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ) );
  ------------------
  |  |  830|      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 \
  |  |  ------------------
  |  |  |  Branch (830:28): [True: 0, False: 4]
  |  |  |  Branch (830:35): [True: 0, False: 0]
  |  |  |  Branch (830:65): [True: 0, False: 4]
  |  |  |  Branch (830:72): [True: 0, False: 0]
  |  |  |  Branch (830:96): [True: 0, False: 4]
  |  |  |  Branch (830:103): [True: 0, False: 0]
  |  |  |  Branch (830:115): [True: 0, False: 0]
  |  |  |  Branch (830:122): [True: 0, False: 0]
  |  |  |  Branch (830:163): [True: 0, False: 4]
  |  |  |  Branch (830:170): [True: 0, False: 0]
  |  |  |  Branch (830:185): [True: 0, False: 4]
  |  |  |  Branch (830:192): [True: 0, False: 0]
  |  |  ------------------
  |  |  831|      4|                                                                                                                                                                                                       : gsEmpty
  ------------------
 1368|      4|        sd->nErrorType = ( sd->nErrorCode == CT_OUT_OF_RAM || sd->nErrorCode == CT_USER_QUIT_ERR )
  ------------------
  |  |   21|      8|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      4|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
                      sd->nErrorType = ( sd->nErrorCode == CT_OUT_OF_RAM || sd->nErrorCode == CT_USER_QUIT_ERR )
  ------------------
  |  |   32|      2|#define CT_USER_QUIT_ERR     (CT_ERR_FIRST-13)  /*(-30013) */
  |  |  ------------------
  |  |  |  |   18|      2|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (1368:28): [True: 2, False: 2]
  |  Branch (1368:63): [True: 0, False: 2]
  ------------------
 1369|      4|            ? _IS_FATAL
  ------------------
  |  |   13|      2|#define _IS_FATAL   3
  ------------------
 1370|      4|            : _IS_ERROR;
  ------------------
  |  |   12|      6|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
 1371|       |
 1372|       |#ifdef TARGET_LIB_FOR_WINCHI
 1373|       |        if (( ip->bINChIOutputOptions & INCHI_OUT_WINCHI_WINDOW ) &&
 1374|       |            ( ip->bINChIOutputOptions & INCHI_OUT_PLAIN_TEXT ))
 1375|       |        {
 1376|       |            sd->nErrorType = ProcessStructError( out_file, log_file,
 1377|       |                                                 sd->pStrErrStruct, sd->nErrorType,
 1378|       |                                                 num_inp, ip );
 1379|       |            /*  Save the problem structure */
 1380|       |            if (prb_file->f &&
 1381|       |                 0L <= sd->fPtrStart && sd->fPtrStart < sd->fPtrEnd &&
 1382|       |                 !ip->bSaveAllGoodStructsAsProblem)
 1383|       |            {
 1384|       |                MolfileSaveCopy( inp_file, sd->fPtrStart, sd->fPtrEnd, prb_file->f, num_inp );
 1385|       |            }
 1386|       |        }
 1387|       |        else
 1388|       |        {
 1389|       |            /*  Save the problem structure */
 1390|       |            if (sd->nErrorCode &&
 1391|       |                 prb_file->f &&
 1392|       |                 0L <= sd->fPtrStart && sd->fPtrStart < sd->fPtrEnd &&
 1393|       |                 !ip->bSaveAllGoodStructsAsProblem)
 1394|       |            {
 1395|       |                MolfileSaveCopy( inp_file, sd->fPtrStart, sd->fPtrEnd, prb_file->f, num_inp );
 1396|       |            }
 1397|       |        }
 1398|       |#endif
 1399|      4|    }
 1400|       |
 1401|       |/* #ifndef TARGET_API_LIB */
 1402|       |#if ( !defined( TARGET_API_LIB ) && !defined(TARGET_EXE_STANDALONE) )
 1403|       |    /*  print the logfile record */
 1404|       |    if (log_file->f && log_file->f != stderr && ( sd->ulStructTime >= 1000 || sd->nErrorCode ))
 1405|       |    {
 1406|       |        fprintf( log_file->f, "%10lu msec structure #%ld.%s%s%s%s (%d component%s, %d atom%s, error=%d).\n",
 1407|       |                sd->ulStructTime, num_inp, SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ),
 1408|       |                orig_inp_data->num_components, orig_inp_data->num_components == 1 ? "" : "s",
 1409|       |                orig_inp_data->num_inp_atoms, orig_inp_data->num_inp_atoms == 1 ? "" : "s", sd->nErrorCode );
 1410|       |    }
 1411|       |#endif
 1412|       |
 1413|      4|    return sd->nErrorType;
 1414|      4|}
TreatCreateINChIWarning:
 1426|  70.4k|{
 1427|       |
 1428|       |#if ( bRELEASE_VERSION == 0 && (EXTR_FLAGS || EXTR_MASK) )
 1429|       |    if (EXTR_MASK ? ( ( sd->bExtract & EXTR_MASK ) == EXTR_FLAGS )
 1430|       |                    : ( sd->bExtract & EXTR_FLAGS )
 1431|       |       )
 1432|       |    {
 1433|       |        char szMsg[64];
 1434|       |        sprintf( szMsg, "ExtractStruct.code=0x%X", sd->bExtract );
 1435|       |        if (!ip->bNoWarnings)
 1436|       |        {
 1437|       |            WarningMessage( sd->pStrErrStruct, szMsg );
 1438|       |        }
 1439|       |    }
 1440|       |#endif
 1441|       |
 1442|  70.4k|    if (!sd->nErrorCode && sd->pStrErrStruct[0])
  ------------------
  |  Branch (1442:9): [True: 70.4k, False: 0]
  |  Branch (1442:28): [True: 9.45k, False: 60.9k]
  ------------------
 1443|  9.45k|    {
 1444|  9.45k|        inchi_ios_eprint( log_file, "Warning (%s) structure #%ld.%s%s%s%s\n",
 1445|  9.45k|            sd->pStrErrStruct, num_inp, SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ) );
  ------------------
  |  |  830|  9.45k|#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 \
  |  |  ------------------
  |  |  |  Branch (830:28): [True: 0, False: 9.45k]
  |  |  |  Branch (830:35): [True: 0, False: 0]
  |  |  |  Branch (830:65): [True: 0, False: 9.45k]
  |  |  |  Branch (830:72): [True: 0, False: 0]
  |  |  |  Branch (830:96): [True: 0, False: 9.45k]
  |  |  |  Branch (830:103): [True: 0, False: 0]
  |  |  |  Branch (830:115): [True: 0, False: 0]
  |  |  |  Branch (830:122): [True: 0, False: 0]
  |  |  |  Branch (830:163): [True: 0, False: 9.45k]
  |  |  |  Branch (830:170): [True: 0, False: 0]
  |  |  |  Branch (830:185): [True: 0, False: 9.45k]
  |  |  |  Branch (830:192): [True: 0, False: 0]
  |  |  ------------------
  |  |  831|  9.45k|                                                                                                                                                                                                       : gsEmpty
  ------------------
 1446|  9.45k|        sd->nErrorType = _IS_WARNING;
  ------------------
  |  |   11|  9.45k|#define _IS_WARNING 1
  ------------------
 1447|       |
 1448|       |#ifdef TARGET_LIB_FOR_WINCHI
 1449|       |        if (( ip->bINChIOutputOptions & INCHI_OUT_WINCHI_WINDOW ) &&
 1450|       |            ( ip->bINChIOutputOptions & INCHI_OUT_PLAIN_TEXT ))
 1451|       |        {
 1452|       |            sd->nErrorType = ProcessStructError( out_file,
 1453|       |                                                 log_file,
 1454|       |                                                 sd->pStrErrStruct,
 1455|       |                                                 sd->nErrorType,
 1456|       |                                                 num_inp,
 1457|       |                                                 ip );
 1458|       |        }
 1459|       |#endif
 1460|       |        /*  save the structure as a problem structure if requested */
 1461|  9.45k|        if (ip->bSaveWarningStructsAsProblem && !ip->bSaveAllGoodStructsAsProblem &&
  ------------------
  |  Branch (1461:13): [True: 0, False: 9.45k]
  |  Branch (1461:49): [True: 0, False: 0]
  ------------------
 1462|      0|             prb_file->f && 0L <= sd->fPtrStart && sd->fPtrStart < sd->fPtrEnd)
  ------------------
  |  Branch (1462:14): [True: 0, False: 0]
  |  Branch (1462:29): [True: 0, False: 0]
  |  Branch (1462:52): [True: 0, False: 0]
  ------------------
 1463|      0|        {   /* djb-rwth: addressing coverity ID #499545 -- return values handled properly */
 1464|      0|            MolfileSaveCopy( inp_file,
 1465|      0|                             sd->fPtrStart,
 1466|      0|                             sd->fPtrEnd,
 1467|      0|                             prb_file->f,
 1468|      0|                             num_inp );
 1469|      0|        }
 1470|       |
 1471|       |#if ( bRELEASE_VERSION == 0 )
 1472|       |        /*  otherwise extract the structure as a problem structure if requested */
 1473|       |        else
 1474|       |            if (( EXTR_MASK ? ( ( sd->bExtract & EXTR_MASK ) == EXTR_FLAGS ) : ( sd->bExtract & EXTR_FLAGS ) )
 1475|       |                            && !ip->bSaveAllGoodStructsAsProblem &&
 1476|       |                               prb_file->f &&
 1477|       |                               0L <= sd->fPtrStart && sd->fPtrStart < sd->fPtrEnd)
 1478|       |            {
 1479|       |                MolfileSaveCopy( inp_file->f,
 1480|       |                                 sd->fPtrStart,
 1481|       |                                 sd->fPtrEnd,
 1482|       |                                 prb_file->f,
 1483|       |                                 num_inp );
 1484|       |            }
 1485|       |#endif
 1486|  9.45k|    }
 1487|       |
 1488|       |#if ( bRELEASE_VERSION != 1 && bOUTPUT_ONE_STRUCT_TIME == 1 )
 1489|       |#ifndef TARGET_API_LIB
 1490|       |    if (log_file && log_file != stderr)
 1491|       |    {
 1492|       |        fprintf( log_file, "%10lu msec structure %1dD #%ld.%s%s%s%s (%d component%s, %d atom%s, error=%d).\n",
 1493|       |                sd->ulStructTime, orig_inp_data->num_dimensions, num_inp, SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ),
 1494|       |                orig_inp_data->num_components, orig_inp_data->num_components == 1 ? "" : "s",
 1495|       |                orig_inp_data->num_inp_atoms, orig_inp_data->num_inp_atoms == 1 ? "" : "s", sd->nErrorCode );
 1496|       |    }
 1497|       |#else
 1498|       |    if (log_file)
 1499|       |    {
 1500|       |        inchi_ios_eprint( log_file, "%10lu msec structure %1dD #%ld.%s%s%s%s (%d component%s, %d atom%s, error=%d).\n",
 1501|       |                sd->ulStructTime, orig_inp_data->num_dimensions, num_inp, SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ),
 1502|       |                orig_inp_data->num_components, orig_inp_data->num_components == 1 ? "" : "s",
 1503|       |                orig_inp_data->num_inp_atoms, orig_inp_data->num_inp_atoms == 1 ? "" : "s", sd->nErrorCode );
 1504|       |    }
 1505|       |#endif
 1506|       |#endif
 1507|       |
 1508|  70.4k|    return sd->nErrorType;
 1509|  70.4k|}
GetProcessingWarningsOneComponentInChI:
 1519|   106k|{
 1520|   106k|    int i, ret = 0;
 1521|   318k|    for (i = 0; i < TAUT_NUM; i++)
  ------------------
  |  |  573|   318k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1521:17): [True: 212k, False: 106k]
  ------------------
 1522|   212k|    {
 1523|   212k|        if (cur_INChI[i] && cur_INChI[i]->nNumberOfAtoms > 0)
  ------------------
  |  Branch (1523:13): [True: 141k, False: 70.4k]
  |  Branch (1523:29): [True: 141k, False: 204]
  ------------------
 1524|   141k|        {
 1525|   141k|            ret |= GetProcessingWarningsOneInChI( cur_INChI[i],
 1526|   141k|                                                  inp_norm_data[i],
 1527|   141k|                                                  sd->pStrErrStruct,
 1528|   141k|                                                  bNoWarnings );
 1529|   141k|        }
 1530|   212k|    }
 1531|       |
 1532|   106k|    return ret;
 1533|   106k|}
GetProcessingWarningsOneInChI:
 1543|   141k|{
 1544|   141k|    int j;
 1545|   141k|    int nAmbiguousStereoAtoms, nAmbiguousStereoBonds;
 1546|   141k|    nAmbiguousStereoAtoms = 0;
 1547|   141k|    nAmbiguousStereoBonds = 0;
 1548|       |
 1549|   141k|    if (inp_norm_data->at)
  ------------------
  |  Branch (1549:9): [True: 141k, False: 0]
  ------------------
 1550|   141k|    {
 1551|   331k|        for (j = 0; j < pINChI->nNumberOfAtoms; j++)
  ------------------
  |  Branch (1551:21): [True: 189k, False: 141k]
  ------------------
 1552|   189k|        {
 1553|   189k|            if (inp_norm_data->at[j].bAmbiguousStereo & ( AMBIGUOUS_STEREO_ATOM | AMBIGUOUS_STEREO_ATOM_ISO ))
  ------------------
  |  |  246|   189k|#define AMBIGUOUS_STEREO_ATOM      2
  ------------------
                          if (inp_norm_data->at[j].bAmbiguousStereo & ( AMBIGUOUS_STEREO_ATOM | AMBIGUOUS_STEREO_ATOM_ISO ))
  ------------------
  |  |  248|   189k|#define AMBIGUOUS_STEREO_ATOM_ISO  8
  ------------------
  |  Branch (1553:17): [True: 0, False: 189k]
  ------------------
 1554|      0|            {
 1555|      0|                nAmbiguousStereoAtoms++;
 1556|      0|            }
 1557|   189k|            if (inp_norm_data->at[j].bAmbiguousStereo & ( AMBIGUOUS_STEREO_BOND | AMBIGUOUS_STEREO_BOND_ISO ))
  ------------------
  |  |  247|   189k|#define AMBIGUOUS_STEREO_BOND      4
  ------------------
                          if (inp_norm_data->at[j].bAmbiguousStereo & ( AMBIGUOUS_STEREO_BOND | AMBIGUOUS_STEREO_BOND_ISO ))
  ------------------
  |  |  249|   189k|#define AMBIGUOUS_STEREO_BOND_ISO  16
  ------------------
  |  Branch (1557:17): [True: 0, False: 189k]
  ------------------
 1558|      0|            {
 1559|      0|                nAmbiguousStereoBonds++;
 1560|      0|            }
 1561|   189k|        }
 1562|   141k|        if (nAmbiguousStereoAtoms)
  ------------------
  |  Branch (1562:13): [True: 0, False: 141k]
  ------------------
 1563|      0|        {
 1564|      0|            if (!bNoWarnings)
  ------------------
  |  Branch (1564:17): [True: 0, False: 0]
  ------------------
 1565|      0|            {
 1566|      0|                WarningMessage( pStrErrStruct, "Ambiguous stereo:" );
  ------------------
  |  |  132|      0|#define WarningMessage AddErrorMessage
  ------------------
 1567|      0|                WarningMessage( pStrErrStruct, "center(s)" );
  ------------------
  |  |  132|      0|#define WarningMessage AddErrorMessage
  ------------------
 1568|      0|            }
 1569|      0|        }
 1570|   141k|        if (nAmbiguousStereoBonds)
  ------------------
  |  Branch (1570:13): [True: 0, False: 141k]
  ------------------
 1571|      0|        {
 1572|      0|            if (!bNoWarnings)
  ------------------
  |  Branch (1572:17): [True: 0, False: 0]
  ------------------
 1573|      0|            {
 1574|      0|                WarningMessage( pStrErrStruct, "Ambiguous stereo:" );
  ------------------
  |  |  132|      0|#define WarningMessage AddErrorMessage
  ------------------
 1575|      0|                WarningMessage( pStrErrStruct, "bond(s)" );
  ------------------
  |  |  132|      0|#define WarningMessage AddErrorMessage
  ------------------
 1576|      0|            }
 1577|      0|        }
 1578|   141k|    }
 1579|       |
 1580|   141k|    return ( nAmbiguousStereoAtoms || nAmbiguousStereoBonds );
  ------------------
  |  Branch (1580:14): [True: 0, False: 141k]
  |  Branch (1580:39): [True: 0, False: 141k]
  ------------------
 1581|   141k|}

sha2_starts:
   58|  12.6k|{
   59|  12.6k|    ctx->total[0] = 0;
   60|  12.6k|    ctx->total[1] = 0;
   61|       |
   62|  12.6k|    ctx->state[0] = 0x6A09E667;
   63|  12.6k|    ctx->state[1] = 0xBB67AE85;
   64|  12.6k|    ctx->state[2] = 0x3C6EF372;
   65|  12.6k|    ctx->state[3] = 0xA54FF53A;
   66|  12.6k|    ctx->state[4] = 0x510E527F;
   67|  12.6k|    ctx->state[5] = 0x9B05688C;
   68|  12.6k|    ctx->state[6] = 0x1F83D9AB;
   69|  12.6k|    ctx->state[7] = 0x5BE0CD19;
   70|  12.6k|}
sha2_update:
  207|  37.9k|{
  208|  37.9k|    int fill;
  209|  37.9k|    unsigned long left;
  210|       |
  211|  37.9k|    if (ilen <= 0)
  ------------------
  |  Branch (211:9): [True: 2.78k, False: 35.1k]
  ------------------
  212|  2.78k|        return;
  213|       |
  214|  35.1k|    left = ctx->total[0] & 0x3F;
  215|  35.1k|    fill = 64 - left;
  216|       |
  217|  35.1k|    ctx->total[0] += ilen;
  218|  35.1k|    ctx->total[0] &= 0xFFFFFFFF;
  219|       |
  220|  35.1k|    if (ctx->total[0] < (unsigned long)ilen)
  ------------------
  |  Branch (220:9): [True: 0, False: 35.1k]
  ------------------
  221|      0|        ctx->total[1]++;
  222|       |
  223|  35.1k|    if (left && ilen >= fill)
  ------------------
  |  Branch (223:9): [True: 22.4k, False: 12.6k]
  |  Branch (223:17): [True: 12.8k, False: 9.64k]
  ------------------
  224|  12.8k|    {
  225|  12.8k|        memcpy((void *)(ctx->buffer + left),
  226|  12.8k|               (void *)input, fill);
  227|  12.8k|        sha2_process(ctx, ctx->buffer);
  228|  12.8k|        input += fill;
  229|  12.8k|        ilen -= fill;
  230|  12.8k|        left = 0;
  231|  12.8k|    }
  232|       |
  233|  94.6k|    while (ilen >= 64)
  ------------------
  |  Branch (233:12): [True: 59.4k, False: 35.1k]
  ------------------
  234|  59.4k|    {
  235|  59.4k|        sha2_process(ctx, input); /* djb-rwth: ignoring LLVM warning as ilen >= 64 just in test case */
  236|  59.4k|        input += 64;
  237|  59.4k|        ilen -= 64;
  238|  59.4k|    }
  239|       |
  240|  35.1k|    if (ilen > 0)
  ------------------
  |  Branch (240:9): [True: 22.4k, False: 12.6k]
  ------------------
  241|  22.4k|    {
  242|  22.4k|        memcpy((void *)(ctx->buffer + left),
  243|  22.4k|               (void *)input, ilen);
  244|  22.4k|    }
  245|  35.1k|}
sha2_finish:
  258|  12.6k|{
  259|  12.6k|    unsigned long last, padn;
  260|  12.6k|    unsigned long high, low;
  261|  12.6k|    unsigned char msglen[8];
  262|       |
  263|  12.6k|    high = (ctx->total[0] >> 29) | (ctx->total[1] << 3);
  264|  12.6k|    low = (ctx->total[0] << 3);
  265|       |
  266|  12.6k|    PUT_UINT32_BE(high, msglen, 0);
  ------------------
  |  |   46|  12.6k|    {                                              \
  |  |   47|  12.6k|        (b)[(i)] = (unsigned char)((n) >> 24);     \
  |  |   48|  12.6k|        (b)[(i) + 1] = (unsigned char)((n) >> 16); \
  |  |   49|  12.6k|        (b)[(i) + 2] = (unsigned char)((n) >> 8);  \
  |  |   50|  12.6k|        (b)[(i) + 3] = (unsigned char)((n));       \
  |  |   51|  12.6k|    }
  ------------------
  267|  12.6k|    PUT_UINT32_BE(low, msglen, 4);
  ------------------
  |  |   46|  12.6k|    {                                              \
  |  |   47|  12.6k|        (b)[(i)] = (unsigned char)((n) >> 24);     \
  |  |   48|  12.6k|        (b)[(i) + 1] = (unsigned char)((n) >> 16); \
  |  |   49|  12.6k|        (b)[(i) + 2] = (unsigned char)((n) >> 8);  \
  |  |   50|  12.6k|        (b)[(i) + 3] = (unsigned char)((n));       \
  |  |   51|  12.6k|    }
  ------------------
  268|       |
  269|  12.6k|    last = ctx->total[0] & 0x3F;
  270|  12.6k|    padn = (last < 56) ? (56 - last) : (120 - last);
  ------------------
  |  Branch (270:12): [True: 12.4k, False: 187]
  ------------------
  271|       |
  272|  12.6k|    sha2_update(ctx, (unsigned char *)sha2_padding, padn);
  273|  12.6k|    sha2_update(ctx, msglen, 8);
  274|       |
  275|  12.6k|    PUT_UINT32_BE(ctx->state[0], output, 0);
  ------------------
  |  |   46|  12.6k|    {                                              \
  |  |   47|  12.6k|        (b)[(i)] = (unsigned char)((n) >> 24);     \
  |  |   48|  12.6k|        (b)[(i) + 1] = (unsigned char)((n) >> 16); \
  |  |   49|  12.6k|        (b)[(i) + 2] = (unsigned char)((n) >> 8);  \
  |  |   50|  12.6k|        (b)[(i) + 3] = (unsigned char)((n));       \
  |  |   51|  12.6k|    }
  ------------------
  276|  12.6k|    PUT_UINT32_BE(ctx->state[1], output, 4);
  ------------------
  |  |   46|  12.6k|    {                                              \
  |  |   47|  12.6k|        (b)[(i)] = (unsigned char)((n) >> 24);     \
  |  |   48|  12.6k|        (b)[(i) + 1] = (unsigned char)((n) >> 16); \
  |  |   49|  12.6k|        (b)[(i) + 2] = (unsigned char)((n) >> 8);  \
  |  |   50|  12.6k|        (b)[(i) + 3] = (unsigned char)((n));       \
  |  |   51|  12.6k|    }
  ------------------
  277|  12.6k|    PUT_UINT32_BE(ctx->state[2], output, 8);
  ------------------
  |  |   46|  12.6k|    {                                              \
  |  |   47|  12.6k|        (b)[(i)] = (unsigned char)((n) >> 24);     \
  |  |   48|  12.6k|        (b)[(i) + 1] = (unsigned char)((n) >> 16); \
  |  |   49|  12.6k|        (b)[(i) + 2] = (unsigned char)((n) >> 8);  \
  |  |   50|  12.6k|        (b)[(i) + 3] = (unsigned char)((n));       \
  |  |   51|  12.6k|    }
  ------------------
  278|  12.6k|    PUT_UINT32_BE(ctx->state[3], output, 12);
  ------------------
  |  |   46|  12.6k|    {                                              \
  |  |   47|  12.6k|        (b)[(i)] = (unsigned char)((n) >> 24);     \
  |  |   48|  12.6k|        (b)[(i) + 1] = (unsigned char)((n) >> 16); \
  |  |   49|  12.6k|        (b)[(i) + 2] = (unsigned char)((n) >> 8);  \
  |  |   50|  12.6k|        (b)[(i) + 3] = (unsigned char)((n));       \
  |  |   51|  12.6k|    }
  ------------------
  279|  12.6k|    PUT_UINT32_BE(ctx->state[4], output, 16);
  ------------------
  |  |   46|  12.6k|    {                                              \
  |  |   47|  12.6k|        (b)[(i)] = (unsigned char)((n) >> 24);     \
  |  |   48|  12.6k|        (b)[(i) + 1] = (unsigned char)((n) >> 16); \
  |  |   49|  12.6k|        (b)[(i) + 2] = (unsigned char)((n) >> 8);  \
  |  |   50|  12.6k|        (b)[(i) + 3] = (unsigned char)((n));       \
  |  |   51|  12.6k|    }
  ------------------
  280|  12.6k|    PUT_UINT32_BE(ctx->state[5], output, 20);
  ------------------
  |  |   46|  12.6k|    {                                              \
  |  |   47|  12.6k|        (b)[(i)] = (unsigned char)((n) >> 24);     \
  |  |   48|  12.6k|        (b)[(i) + 1] = (unsigned char)((n) >> 16); \
  |  |   49|  12.6k|        (b)[(i) + 2] = (unsigned char)((n) >> 8);  \
  |  |   50|  12.6k|        (b)[(i) + 3] = (unsigned char)((n));       \
  |  |   51|  12.6k|    }
  ------------------
  281|  12.6k|    PUT_UINT32_BE(ctx->state[6], output, 24);
  ------------------
  |  |   46|  12.6k|    {                                              \
  |  |   47|  12.6k|        (b)[(i)] = (unsigned char)((n) >> 24);     \
  |  |   48|  12.6k|        (b)[(i) + 1] = (unsigned char)((n) >> 16); \
  |  |   49|  12.6k|        (b)[(i) + 2] = (unsigned char)((n) >> 8);  \
  |  |   50|  12.6k|        (b)[(i) + 3] = (unsigned char)((n));       \
  |  |   51|  12.6k|    }
  ------------------
  282|  12.6k|    PUT_UINT32_BE(ctx->state[7], output, 28);
  ------------------
  |  |   46|  12.6k|    {                                              \
  |  |   47|  12.6k|        (b)[(i)] = (unsigned char)((n) >> 24);     \
  |  |   48|  12.6k|        (b)[(i) + 1] = (unsigned char)((n) >> 16); \
  |  |   49|  12.6k|        (b)[(i) + 2] = (unsigned char)((n) >> 8);  \
  |  |   50|  12.6k|        (b)[(i) + 3] = (unsigned char)((n));       \
  |  |   51|  12.6k|    }
  ------------------
  283|  12.6k|}
sha2_csum:
  314|  12.6k|{
  315|  12.6k|    sha2_context ctx;
  316|       |
  317|  12.6k|    sha2_starts(&ctx);
  318|  12.6k|    sha2_update(&ctx, input, ilen);
  319|  12.6k|    sha2_finish(&ctx, output);
  320|  12.6k|}
sha2.c:sha2_process:
   73|  72.3k|{
   74|  72.3k|    unsigned long temp1, temp2, W[64];
   75|  72.3k|    unsigned long A, B, C, D, E, F, G, H;
   76|       |
   77|  72.3k|    GET_UINT32_BE(W[0], data, 0);
  ------------------
  |  |   40|  72.3k|    {                                                                                                                                                     \
  |  |   41|  72.3k|        (n) = ((unsigned long)(b)[(i)] << 24) | ((unsigned long)(b)[(i) + 1] << 16) | ((unsigned long)(b)[(i) + 2] << 8) | ((unsigned long)(b)[(i) + 3]); \
  |  |   42|  72.3k|    }
  ------------------
   78|  72.3k|    GET_UINT32_BE(W[1], data, 4);
  ------------------
  |  |   40|  72.3k|    {                                                                                                                                                     \
  |  |   41|  72.3k|        (n) = ((unsigned long)(b)[(i)] << 24) | ((unsigned long)(b)[(i) + 1] << 16) | ((unsigned long)(b)[(i) + 2] << 8) | ((unsigned long)(b)[(i) + 3]); \
  |  |   42|  72.3k|    }
  ------------------
   79|  72.3k|    GET_UINT32_BE(W[2], data, 8);
  ------------------
  |  |   40|  72.3k|    {                                                                                                                                                     \
  |  |   41|  72.3k|        (n) = ((unsigned long)(b)[(i)] << 24) | ((unsigned long)(b)[(i) + 1] << 16) | ((unsigned long)(b)[(i) + 2] << 8) | ((unsigned long)(b)[(i) + 3]); \
  |  |   42|  72.3k|    }
  ------------------
   80|  72.3k|    GET_UINT32_BE(W[3], data, 12);
  ------------------
  |  |   40|  72.3k|    {                                                                                                                                                     \
  |  |   41|  72.3k|        (n) = ((unsigned long)(b)[(i)] << 24) | ((unsigned long)(b)[(i) + 1] << 16) | ((unsigned long)(b)[(i) + 2] << 8) | ((unsigned long)(b)[(i) + 3]); \
  |  |   42|  72.3k|    }
  ------------------
   81|  72.3k|    GET_UINT32_BE(W[4], data, 16);
  ------------------
  |  |   40|  72.3k|    {                                                                                                                                                     \
  |  |   41|  72.3k|        (n) = ((unsigned long)(b)[(i)] << 24) | ((unsigned long)(b)[(i) + 1] << 16) | ((unsigned long)(b)[(i) + 2] << 8) | ((unsigned long)(b)[(i) + 3]); \
  |  |   42|  72.3k|    }
  ------------------
   82|  72.3k|    GET_UINT32_BE(W[5], data, 20);
  ------------------
  |  |   40|  72.3k|    {                                                                                                                                                     \
  |  |   41|  72.3k|        (n) = ((unsigned long)(b)[(i)] << 24) | ((unsigned long)(b)[(i) + 1] << 16) | ((unsigned long)(b)[(i) + 2] << 8) | ((unsigned long)(b)[(i) + 3]); \
  |  |   42|  72.3k|    }
  ------------------
   83|  72.3k|    GET_UINT32_BE(W[6], data, 24);
  ------------------
  |  |   40|  72.3k|    {                                                                                                                                                     \
  |  |   41|  72.3k|        (n) = ((unsigned long)(b)[(i)] << 24) | ((unsigned long)(b)[(i) + 1] << 16) | ((unsigned long)(b)[(i) + 2] << 8) | ((unsigned long)(b)[(i) + 3]); \
  |  |   42|  72.3k|    }
  ------------------
   84|  72.3k|    GET_UINT32_BE(W[7], data, 28);
  ------------------
  |  |   40|  72.3k|    {                                                                                                                                                     \
  |  |   41|  72.3k|        (n) = ((unsigned long)(b)[(i)] << 24) | ((unsigned long)(b)[(i) + 1] << 16) | ((unsigned long)(b)[(i) + 2] << 8) | ((unsigned long)(b)[(i) + 3]); \
  |  |   42|  72.3k|    }
  ------------------
   85|  72.3k|    GET_UINT32_BE(W[8], data, 32);
  ------------------
  |  |   40|  72.3k|    {                                                                                                                                                     \
  |  |   41|  72.3k|        (n) = ((unsigned long)(b)[(i)] << 24) | ((unsigned long)(b)[(i) + 1] << 16) | ((unsigned long)(b)[(i) + 2] << 8) | ((unsigned long)(b)[(i) + 3]); \
  |  |   42|  72.3k|    }
  ------------------
   86|  72.3k|    GET_UINT32_BE(W[9], data, 36);
  ------------------
  |  |   40|  72.3k|    {                                                                                                                                                     \
  |  |   41|  72.3k|        (n) = ((unsigned long)(b)[(i)] << 24) | ((unsigned long)(b)[(i) + 1] << 16) | ((unsigned long)(b)[(i) + 2] << 8) | ((unsigned long)(b)[(i) + 3]); \
  |  |   42|  72.3k|    }
  ------------------
   87|  72.3k|    GET_UINT32_BE(W[10], data, 40);
  ------------------
  |  |   40|  72.3k|    {                                                                                                                                                     \
  |  |   41|  72.3k|        (n) = ((unsigned long)(b)[(i)] << 24) | ((unsigned long)(b)[(i) + 1] << 16) | ((unsigned long)(b)[(i) + 2] << 8) | ((unsigned long)(b)[(i) + 3]); \
  |  |   42|  72.3k|    }
  ------------------
   88|  72.3k|    GET_UINT32_BE(W[11], data, 44);
  ------------------
  |  |   40|  72.3k|    {                                                                                                                                                     \
  |  |   41|  72.3k|        (n) = ((unsigned long)(b)[(i)] << 24) | ((unsigned long)(b)[(i) + 1] << 16) | ((unsigned long)(b)[(i) + 2] << 8) | ((unsigned long)(b)[(i) + 3]); \
  |  |   42|  72.3k|    }
  ------------------
   89|  72.3k|    GET_UINT32_BE(W[12], data, 48);
  ------------------
  |  |   40|  72.3k|    {                                                                                                                                                     \
  |  |   41|  72.3k|        (n) = ((unsigned long)(b)[(i)] << 24) | ((unsigned long)(b)[(i) + 1] << 16) | ((unsigned long)(b)[(i) + 2] << 8) | ((unsigned long)(b)[(i) + 3]); \
  |  |   42|  72.3k|    }
  ------------------
   90|  72.3k|    GET_UINT32_BE(W[13], data, 52);
  ------------------
  |  |   40|  72.3k|    {                                                                                                                                                     \
  |  |   41|  72.3k|        (n) = ((unsigned long)(b)[(i)] << 24) | ((unsigned long)(b)[(i) + 1] << 16) | ((unsigned long)(b)[(i) + 2] << 8) | ((unsigned long)(b)[(i) + 3]); \
  |  |   42|  72.3k|    }
  ------------------
   91|  72.3k|    GET_UINT32_BE(W[14], data, 56);
  ------------------
  |  |   40|  72.3k|    {                                                                                                                                                     \
  |  |   41|  72.3k|        (n) = ((unsigned long)(b)[(i)] << 24) | ((unsigned long)(b)[(i) + 1] << 16) | ((unsigned long)(b)[(i) + 2] << 8) | ((unsigned long)(b)[(i) + 3]); \
  |  |   42|  72.3k|    }
  ------------------
   92|  72.3k|    GET_UINT32_BE(W[15], data, 60);
  ------------------
  |  |   40|  72.3k|    {                                                                                                                                                     \
  |  |   41|  72.3k|        (n) = ((unsigned long)(b)[(i)] << 24) | ((unsigned long)(b)[(i) + 1] << 16) | ((unsigned long)(b)[(i) + 2] << 8) | ((unsigned long)(b)[(i) + 3]); \
  |  |   42|  72.3k|    }
  ------------------
   93|       |
   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
   96|       |
   97|  72.3k|#define S0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3))
   98|  72.3k|#define S1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10))
   99|       |
  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  102|       |
  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  105|       |
  106|  72.3k|#define R(t)                             \
  107|  72.3k|    (                                    \
  108|  72.3k|        W[t] = S1(W[t - 2]) + W[t - 7] + \
  109|  72.3k|               S0(W[t - 15]) + W[t - 16])
  110|       |
  111|  72.3k|#define P(a, b, c, d, e, f, g, h, x, K)          \
  112|  72.3k|    {                                            \
  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  115|  72.3k|        d += temp1;                              \
  116|  72.3k|        h = temp1 + temp2;                       \
  117|  72.3k|    }
  118|       |
  119|  72.3k|    A = ctx->state[0];
  120|  72.3k|    B = ctx->state[1];
  121|  72.3k|    C = ctx->state[2];
  122|  72.3k|    D = ctx->state[3];
  123|  72.3k|    E = ctx->state[4];
  124|  72.3k|    F = ctx->state[5];
  125|  72.3k|    G = ctx->state[6];
  126|  72.3k|    H = ctx->state[7];
  127|       |
  128|  72.3k|    P(A, B, C, D, E, F, G, H, W[0], 0x428A2F98);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  129|  72.3k|    P(H, A, B, C, D, E, F, G, W[1], 0x71374491);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  130|  72.3k|    P(G, H, A, B, C, D, E, F, W[2], 0xB5C0FBCF);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  131|  72.3k|    P(F, G, H, A, B, C, D, E, W[3], 0xE9B5DBA5);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  132|  72.3k|    P(E, F, G, H, A, B, C, D, W[4], 0x3956C25B);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  133|  72.3k|    P(D, E, F, G, H, A, B, C, W[5], 0x59F111F1);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  134|  72.3k|    P(C, D, E, F, G, H, A, B, W[6], 0x923F82A4);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  135|  72.3k|    P(B, C, D, E, F, G, H, A, W[7], 0xAB1C5ED5);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  136|  72.3k|    P(A, B, C, D, E, F, G, H, W[8], 0xD807AA98);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  137|  72.3k|    P(H, A, B, C, D, E, F, G, W[9], 0x12835B01);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  138|  72.3k|    P(G, H, A, B, C, D, E, F, W[10], 0x243185BE);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  139|  72.3k|    P(F, G, H, A, B, C, D, E, W[11], 0x550C7DC3);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  140|  72.3k|    P(E, F, G, H, A, B, C, D, W[12], 0x72BE5D74);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  141|  72.3k|    P(D, E, F, G, H, A, B, C, W[13], 0x80DEB1FE);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  142|  72.3k|    P(C, D, E, F, G, H, A, B, W[14], 0x9BDC06A7);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  143|  72.3k|    P(B, C, D, E, F, G, H, A, W[15], 0xC19BF174);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  144|  72.3k|    P(A, B, C, D, E, F, G, H, R(16), 0xE49B69C1);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  145|  72.3k|    P(H, A, B, C, D, E, F, G, R(17), 0xEFBE4786);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  146|  72.3k|    P(G, H, A, B, C, D, E, F, R(18), 0x0FC19DC6);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  147|  72.3k|    P(F, G, H, A, B, C, D, E, R(19), 0x240CA1CC);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  148|  72.3k|    P(E, F, G, H, A, B, C, D, R(20), 0x2DE92C6F);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  149|  72.3k|    P(D, E, F, G, H, A, B, C, R(21), 0x4A7484AA);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  150|  72.3k|    P(C, D, E, F, G, H, A, B, R(22), 0x5CB0A9DC);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  151|  72.3k|    P(B, C, D, E, F, G, H, A, R(23), 0x76F988DA);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  152|  72.3k|    P(A, B, C, D, E, F, G, H, R(24), 0x983E5152);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  153|  72.3k|    P(H, A, B, C, D, E, F, G, R(25), 0xA831C66D);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  154|  72.3k|    P(G, H, A, B, C, D, E, F, R(26), 0xB00327C8);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  155|  72.3k|    P(F, G, H, A, B, C, D, E, R(27), 0xBF597FC7);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  156|  72.3k|    P(E, F, G, H, A, B, C, D, R(28), 0xC6E00BF3);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  157|  72.3k|    P(D, E, F, G, H, A, B, C, R(29), 0xD5A79147);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  158|  72.3k|    P(C, D, E, F, G, H, A, B, R(30), 0x06CA6351);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  159|  72.3k|    P(B, C, D, E, F, G, H, A, R(31), 0x14292967);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  160|  72.3k|    P(A, B, C, D, E, F, G, H, R(32), 0x27B70A85);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  161|  72.3k|    P(H, A, B, C, D, E, F, G, R(33), 0x2E1B2138);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  162|  72.3k|    P(G, H, A, B, C, D, E, F, R(34), 0x4D2C6DFC);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  163|  72.3k|    P(F, G, H, A, B, C, D, E, R(35), 0x53380D13);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  164|  72.3k|    P(E, F, G, H, A, B, C, D, R(36), 0x650A7354);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  165|  72.3k|    P(D, E, F, G, H, A, B, C, R(37), 0x766A0ABB);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  166|  72.3k|    P(C, D, E, F, G, H, A, B, R(38), 0x81C2C92E);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  167|  72.3k|    P(B, C, D, E, F, G, H, A, R(39), 0x92722C85);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  168|  72.3k|    P(A, B, C, D, E, F, G, H, R(40), 0xA2BFE8A1);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  169|  72.3k|    P(H, A, B, C, D, E, F, G, R(41), 0xA81A664B);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  170|  72.3k|    P(G, H, A, B, C, D, E, F, R(42), 0xC24B8B70);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  171|  72.3k|    P(F, G, H, A, B, C, D, E, R(43), 0xC76C51A3);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  172|  72.3k|    P(E, F, G, H, A, B, C, D, R(44), 0xD192E819);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  173|  72.3k|    P(D, E, F, G, H, A, B, C, R(45), 0xD6990624);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  174|  72.3k|    P(C, D, E, F, G, H, A, B, R(46), 0xF40E3585);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  175|  72.3k|    P(B, C, D, E, F, G, H, A, R(47), 0x106AA070);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  176|  72.3k|    P(A, B, C, D, E, F, G, H, R(48), 0x19A4C116);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  177|  72.3k|    P(H, A, B, C, D, E, F, G, R(49), 0x1E376C08);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  178|  72.3k|    P(G, H, A, B, C, D, E, F, R(50), 0x2748774C);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  179|  72.3k|    P(F, G, H, A, B, C, D, E, R(51), 0x34B0BCB5);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  180|  72.3k|    P(E, F, G, H, A, B, C, D, R(52), 0x391C0CB3);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  181|  72.3k|    P(D, E, F, G, H, A, B, C, R(53), 0x4ED8AA4A);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  182|  72.3k|    P(C, D, E, F, G, H, A, B, R(54), 0x5B9CCA4F);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  183|  72.3k|    P(B, C, D, E, F, G, H, A, R(55), 0x682E6FF3);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  184|  72.3k|    P(A, B, C, D, E, F, G, H, R(56), 0x748F82EE);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  185|  72.3k|    P(H, A, B, C, D, E, F, G, R(57), 0x78A5636F);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  186|  72.3k|    P(G, H, A, B, C, D, E, F, R(58), 0x84C87814);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  187|  72.3k|    P(F, G, H, A, B, C, D, E, R(59), 0x8CC70208);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  188|  72.3k|    P(E, F, G, H, A, B, C, D, R(60), 0x90BEFFFA);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  189|  72.3k|    P(D, E, F, G, H, A, B, C, R(61), 0xA4506CEB);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  190|  72.3k|    P(C, D, E, F, G, H, A, B, R(62), 0xBEF9A3F7);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  191|  72.3k|    P(B, C, D, E, F, G, H, A, R(63), 0xC67178F2);
  ------------------
  |  |  112|  72.3k|    {                                            \
  |  |  113|  72.3k|        temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  101|  72.3k|#define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp1 = h + S3(e) + F1(e, f, g) + K + x; \
  |  |  ------------------
  |  |  |  |  104|  72.3k|#define F1(x, y, z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  114|  72.3k|        temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  100|  72.3k|#define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
  |  |  |  |  ------------------
  |  |  |  |  |  |   95|  72.3k|#define ROTR(x, n) (SHR(x, n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   94|  72.3k|#define SHR(x, n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                       temp2 = S2(a) + F0(a, b, c);             \
  |  |  ------------------
  |  |  |  |  103|  72.3k|#define F0(x, y, z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  115|  72.3k|        d += temp1;                              \
  |  |  116|  72.3k|        h = temp1 + temp2;                       \
  |  |  117|  72.3k|    }
  ------------------
  192|       |
  193|  72.3k|    ctx->state[0] += A;
  194|  72.3k|    ctx->state[1] += B;
  195|  72.3k|    ctx->state[2] += C;
  196|  72.3k|    ctx->state[3] += D;
  197|  72.3k|    ctx->state[4] += E;
  198|  72.3k|    ctx->state[5] += F;
  199|  72.3k|    ctx->state[6] += G;
  200|  72.3k|    ctx->state[7] += H;
  201|  72.3k|}

cmp_iso_atw_diff_component_no:
  135|  1.62k|{
  136|  1.62k|    int ret = (int)((const inp_ATOM *)a1)->iso_atw_diff - (int)((const inp_ATOM *)a2)->iso_atw_diff;
  137|  1.62k|    if (!ret) /*  make the sort stable */
  ------------------
  |  Branch (137:9): [True: 1.57k, False: 44]
  ------------------
  138|  1.57k|    {
  139|  1.57k|        ret = (int)((const inp_ATOM *)a1)->component - (int)((const inp_ATOM *)a2)->component;
  140|  1.57k|    }
  141|       |
  142|  1.62k|    return ret;
  143|  1.62k|}
the_only_doublet_neigh:
  150|  17.3k|{
  151|  17.3k|    int i, neigh1, num_rad1 = 0, num_rad2 = 0;
  152|       |
  153|  17.3k|    inp_ATOM *a = at + i1, *b;
  154|  17.3k|    if (RADICAL_DOUBLET != a->radical)
  ------------------
  |  |   76|  17.3k|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (154:9): [True: 0, False: 17.3k]
  ------------------
  155|      0|    {
  156|      0|        return -1;
  157|      0|    }
  158|  39.9k|    for (i = 0; i < a->valence; i++)
  ------------------
  |  Branch (158:17): [True: 22.5k, False: 17.3k]
  ------------------
  159|  22.5k|    {
  160|  22.5k|        b = at + ((int)a->neighbor[i]); /* djb-rwth: removing redundant code */
  161|  22.5k|        if (RADICAL_DOUBLET == b->radical)
  ------------------
  |  |   76|  22.5k|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (161:13): [True: 159, False: 22.3k]
  ------------------
  162|    159|        {
  163|    159|            num_rad1++;
  164|    159|            *ineigh1 = i;
  165|    159|        }
  166|  22.5k|    }
  167|       |
  168|  17.3k|    if (1 == num_rad1)
  ------------------
  |  Branch (168:9): [True: 63, False: 17.3k]
  ------------------
  169|     63|    {
  170|     63|        a = at + (neigh1 = (int)a->neighbor[*ineigh1]);
  171|    265|        for (i = 0; i < a->valence; i++)
  ------------------
  |  Branch (171:21): [True: 202, False: 63]
  ------------------
  172|    202|        {
  173|    202|            b = at + (int)a->neighbor[i];
  174|    202|            if (RADICAL_DOUBLET == b->radical)
  ------------------
  |  |   76|    202|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (174:17): [True: 151, False: 51]
  ------------------
  175|    151|            {
  176|    151|                num_rad2++;
  177|    151|                *ineigh2 = i;
  178|    151|            }
  179|    202|        }
  180|       |
  181|     63|        if (1 == num_rad2)
  ------------------
  |  Branch (181:13): [True: 13, False: 50]
  ------------------
  182|     13|        {
  183|     13|            return neigh1;
  184|     13|        }
  185|     63|    }
  186|       |
  187|  17.3k|    return -1;
  188|  17.3k|}
fix_non_uniform_drawn_oxoanions:
  196|   216k|{
  197|       |    /* For central halogen, apply the following
  198|       |    correction rules:
  199|       |
  200|       |    O                             O(-)
  201|       |    ||                            |
  202|       |    O=Hal(-)=O         ===>        O=Hal=O
  203|       |    ||                            ||
  204|       |    O                             O
  205|       |
  206|       |    (perchlorate, etc.)
  207|       |
  208|       |
  209|       |    O                             O(-)
  210|       |    ||                            |
  211|       |    Hal(-)=O         ===>         Hal=O
  212|       |    ||                            ||
  213|       |    O                             O
  214|       |
  215|       |    (chlorate, etc.)
  216|       |
  217|       |    O                             O(-)
  218|       |    ||                            |
  219|       |    Hal(-)=O         ===>         Hal=O
  220|       |
  221|       |
  222|       |    (chlorite, etc.)
  223|       |
  224|       |    Hal(-)=O         ===>         Hal-O(-)
  225|       |
  226|       |
  227|       |    (hypochlorite, etc.)
  228|       |
  229|       |
  230|       |
  231|       |    For halcogenes (S, Se, Te)
  232|       |    Y                               Y(-)
  233|       |    ||                              |
  234|       |    RnX(-)            ===>          RnX
  235|       |
  236|       |    if:
  237|       |    1) (X = S, Y = O) || (X = Se, Y = S, O) || (X = Te, Y = O, S, Se)
  238|       |    2) valence of X exceeds 6, in initially drawn form
  239|       |
  240|       |
  241|       |    So the following is corrected:
  242|       |
  243|       |    O                               O(-)
  244|       |    ||                              |
  245|       |    O=S(-)-R            ===>        O=S-R
  246|       |    ||                              ||
  247|       |    O                               O
  248|       |
  249|       |    Or
  250|       |
  251|       |    O                              O-
  252|       |    ||                             |
  253|       |    F5Te(-)            ===>        F5Te
  254|       |
  255|       |    but the following remains unchanged:
  256|       |
  257|       |
  258|       |    O
  259|       |    ||
  260|       |    O=S(-)-R
  261|       |
  262|       |
  263|       |    The central atom (of IUPAC Group 16-17) is shown as negative but it contains double bond(s)
  264|       |    to terminal atom of greater electronegativity (of Group 16).
  265|       |    The central atom is halcogen (S,Se,Te) in highest oxidation state or halogen.
  266|       |
  267|       |    Fix:
  268|       |    move negative charge to terminal atom and change double bond to a single one.
  269|       |
  270|       |    Eligible central atom    Eligible terminal atom at double bond's end
  271|       |    Cl              O
  272|       |    Br              O
  273|       |    I               O
  274|       |    [At              S,Se,Te]
  275|       |    S               O
  276|       |    Se              O,S
  277|       |    Te              O, S, Se
  278|       |
  279|       |    Comments:
  280|       |    1. Central atoms of Groups 13-15 are not considered.
  281|       |    2. Pauling electronegativities are:
  282|       |    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)
  283|       |
  284|       |
  285|       |    */
  286|       |
  287|       |    /* constants for element numbers */
  288|   216k|    enum elems
  289|   216k|    {
  290|   216k|        dNone,
  291|   216k|        dCl = 17,
  292|   216k|        dBr = 35,
  293|   216k|        dI = 53,
  294|   216k|        dAt = 85,
  295|   216k|        dO = 8,
  296|   216k|        dS = 16,
  297|   216k|        dSe = 34,
  298|   216k|        dTe = 52,
  299|   216k|        dP = 15,
  300|   216k|        dC = 6,
  301|   216k|        dN = 7
  302|   216k|    };
  303|       |
  304|   216k|    static U_CHAR allowed_elnums_center_halogen[] = {dCl, dBr, dI, dAt};
  305|   216k|    static U_CHAR allowed_elnums_center_halcogen[] = {dS, dSe, dTe};
  306|       |
  307|   216k|    int en_center;
  308|   216k|    int i, j, k;
  309|       |
  310|  1.27M|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (310:17): [True: 1.05M, False: 216k]
  ------------------
  311|  1.05M|    {
  312|       |        /* Find appropriate central atom. This center should be: ...*/
  313|       |
  314|       |        /* charged exactly (-1) ... */
  315|  1.05M|        if (at[i].charge != -1)
  ------------------
  |  Branch (315:13): [True: 1.01M, False: 44.2k]
  ------------------
  316|  1.01M|        {
  317|  1.01M|            continue;
  318|  1.01M|        }
  319|  44.2k|        en_center = at[i].el_number;
  320|       |        /*  from eligible element list ... */
  321|  44.2k|        if (!memchr(allowed_elnums_center_halogen, en_center, sizeof(allowed_elnums_center_halogen)))
  ------------------
  |  Branch (321:13): [True: 44.0k, False: 191]
  ------------------
  322|  44.0k|        {
  323|       |            /* central atom is not not halogen; check if it is halcogen */
  324|  44.0k|            if (memchr(allowed_elnums_center_halcogen, en_center, sizeof(allowed_elnums_center_halcogen)))
  ------------------
  |  Branch (324:17): [True: 5.66k, False: 38.3k]
  ------------------
  325|  5.66k|            {
  326|  5.66k|                if (at[i].chem_bonds_valence < 7)
  ------------------
  |  Branch (326:21): [True: 5.33k, False: 327]
  ------------------
  327|  5.33k|                {
  328|       |                    /* central atom is anionic halcogen, but not in the highest oxidation state */
  329|  5.33k|                    continue;
  330|  5.33k|                }
  331|  5.66k|            }
  332|  38.3k|            else
  333|  38.3k|            {
  334|  38.3k|                continue;
  335|  38.3k|            }
  336|  44.0k|        }
  337|       |
  338|       |        /* OK, found central halogen or eligible central halcogen. */
  339|       |
  340|       |        /* non-radical... */
  341|    518|        if (at[i].radical && (at[i].radical != RADICAL_SINGLET))
  ------------------
  |  |   75|    175|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (341:13): [True: 175, False: 343]
  |  Branch (341:30): [True: 175, False: 0]
  ------------------
  342|    175|        {
  343|    175|            continue;
  344|    175|        }
  345|       |
  346|       |        /* Center found, now examine the adjacent terminals... */
  347|    343|        {
  348|    343|            int en_term, kk = 0, jj = 0, min_en = 999, iso = 0, min_iso = 999;
  349|    343|            jj = -1;
  350|  1.92k|            for (k = 0; k < at[i].valence; k++)
  ------------------
  |  Branch (350:25): [True: 1.58k, False: 343]
  ------------------
  351|  1.58k|            {
  352|  1.58k|                j = at[i].neighbor[k];
  353|       |
  354|       |                /* Terminal should be: ... */
  355|       |
  356|       |                /* terminal... */
  357|  1.58k|                if (at[j].valence != 1)
  ------------------
  |  Branch (357:21): [True: 425, False: 1.16k]
  ------------------
  358|    425|                {
  359|    425|                    continue;
  360|    425|                }
  361|       |                /* double-bonded ... */
  362|  1.16k|                if (at[i].bond_type[k] != BOND_TYPE_DOUBLE)
  ------------------
  |  |   33|  1.16k|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (362:21): [True: 461, False: 700]
  ------------------
  363|    461|                {
  364|    461|                    continue;
  365|    461|                }
  366|       |                /* zero-charged ... */
  367|    700|                if (at[j].charge != 0)
  ------------------
  |  Branch (367:21): [True: 172, False: 528]
  ------------------
  368|    172|                {
  369|    172|                    continue;
  370|    172|                }
  371|       |                /* non-radical */
  372|    528|                if (at[j].radical && (at[j].radical != RADICAL_SINGLET))
  ------------------
  |  |   75|     67|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (372:21): [True: 67, False: 461]
  |  Branch (372:38): [True: 67, False: 0]
  ------------------
  373|     67|                {
  374|     67|                    continue;
  375|     67|                }
  376|       |                /*  of eligible elements list ... */
  377|    461|                en_term = at[j].el_number;
  378|    461|                switch (en_term)
  379|    461|                {
  380|    216|                case dO:
  ------------------
  |  Branch (380:17): [True: 216, False: 245]
  ------------------
  381|    216|                    break;
  382|    162|                case dS:
  ------------------
  |  Branch (382:17): [True: 162, False: 299]
  ------------------
  383|    162|                    if ((en_center == dSe) || (en_center == dAt) || (en_center == dTe))
  ------------------
  |  Branch (383:25): [True: 51, False: 111]
  |  Branch (383:47): [True: 0, False: 111]
  |  Branch (383:69): [True: 19, False: 92]
  ------------------
  384|     70|                        break;
  385|     92|                    continue;
  386|     92|                case dSe:
  ------------------
  |  Branch (386:17): [True: 46, False: 415]
  ------------------
  387|     46|                    if ((en_center == dAt) || (en_center == dTe))
  ------------------
  |  Branch (387:25): [True: 0, False: 46]
  |  Branch (387:47): [True: 0, False: 46]
  ------------------
  388|      0|                        break;
  389|     46|                    continue;
  390|     46|                case dTe:
  ------------------
  |  Branch (390:17): [True: 36, False: 425]
  ------------------
  391|     36|                    if (en_center == dAt)
  ------------------
  |  Branch (391:25): [True: 0, False: 36]
  ------------------
  392|      0|                        break;
  393|     36|                    continue;
  394|     36|                default:
  ------------------
  |  Branch (394:17): [True: 1, False: 460]
  ------------------
  395|      1|                    continue;
  396|    461|                }
  397|       |
  398|       |                /* From several candidates, select one with less el. number (==more electronegative). */
  399|    286|                if (en_term < min_en)
  ------------------
  |  Branch (399:21): [True: 156, False: 130]
  ------------------
  400|    156|                {
  401|    156|                    min_en = en_term;
  402|    156|                    kk = k;
  403|    156|                    jj = j;
  404|    156|                    min_iso = at[j].iso_atw_diff > 0 ? at[i].iso_atw_diff - 1 : at[i].iso_atw_diff;
  ------------------
  |  Branch (404:31): [True: 0, False: 156]
  ------------------
  405|    156|                    continue;
  406|    156|                }
  407|       |                /* From same-element candidates, select one with less isotopic mass (arbitrary choice). */
  408|    130|                else if (en_term == min_en)
  ------------------
  |  Branch (408:26): [True: 129, False: 1]
  ------------------
  409|    129|                {
  410|    129|                    iso = at[j].iso_atw_diff > 0 ? at[i].iso_atw_diff - 1 : at[i].iso_atw_diff;
  ------------------
  |  Branch (410:27): [True: 0, False: 129]
  ------------------
  411|    129|                    if (iso < min_iso)
  ------------------
  |  Branch (411:25): [True: 0, False: 129]
  ------------------
  412|      0|                    {
  413|      0|                        min_iso = iso;
  414|      0|                        kk = k;
  415|      0|                        jj = j;
  416|      0|                        continue;
  417|      0|                    }
  418|    129|                }
  419|    286|            } /* end of checking nbrs. */
  420|       |
  421|       |            /* If OK, apply changes. */
  422|    343|            if (jj >= 0)
  ------------------
  |  Branch (422:17): [True: 156, False: 187]
  ------------------
  423|    156|            {
  424|    156|                at[i].charge = 0;
  425|    156|                at[jj].charge = -1;
  426|    156|                at[i].bond_type[kk] = BOND_TYPE_SINGLE;
  ------------------
  |  |   32|    156|#define BOND_TYPE_SINGLE    1
  ------------------
  427|    156|                at[jj].bond_type[0] = BOND_TYPE_SINGLE;
  ------------------
  |  |   32|    156|#define BOND_TYPE_SINGLE    1
  ------------------
  428|    156|                at[i].bond_stereo[kk] = at[jj].bond_stereo[0] = 0;
  429|    156|                at[i].chem_bonds_valence--;
  430|    156|                at[jj].chem_bonds_valence--;
  431|    156|                (*num_changes)++;
  432|    156|            }
  433|    343|        }
  434|    343|    } /* end of search for candidate centers. */
  435|       |
  436|   216k|    return 0;
  437|   216k|}
fix_non_uniform_drawn_amidiniums:
  446|   216k|{
  447|       |    /* Amidines include carboxamidines RC(=NR)NR2,
  448|       |    sulfinamidines RS(=NR)NR2 and phosphinamidines, R2P(=NR)NR2.
  449|       |
  450|       |
  451|       |    NR                              NR
  452|       |    |                               |
  453|       |    R"-Y-NHR'         ===>          R"-Y=N(+)HR'
  454|       |    (+)
  455|       |
  456|       |
  457|       |    Y = C, S, P
  458|       |
  459|       |
  460|       |    Fix:
  461|       |    move positive charge to nitrogen and change single bond to a double one.
  462|       |
  463|       |
  464|       |    Comment:
  465|       |    Fix is applied only if at least one of R's at N is hydrogen
  466|       |    (otherwise we have just a '+' delocalization which is already recognized).
  467|       |
  468|       |
  469|       |    */
  470|       |
  471|       |    /* constants for element numbers */
  472|   216k|    enum elems
  473|   216k|    {
  474|   216k|        dNone,
  475|   216k|        dCl = 17,
  476|   216k|        dBr = 35,
  477|   216k|        dI = 53,
  478|   216k|        dAt = 85,
  479|   216k|        dO = 8,
  480|   216k|        dS = 16,
  481|   216k|        dSe = 34,
  482|   216k|        dTe = 52,
  483|   216k|        dP = 15,
  484|   216k|        dC = 6,
  485|   216k|        dN = 7
  486|   216k|    };
  487|       |
  488|   216k|    static U_CHAR allowed_elnums_center[] = {dC, dS, dP};
  489|   216k|    int en_center;
  490|   216k|    int i, j, k, jj, kk, k1;
  491|   216k|    int mismatch = 0, nuH = 0, nuN = 0, nitrogens[MAXVAL];
  492|       |
  493|  1.27M|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (493:17): [True: 1.05M, False: 216k]
  ------------------
  494|  1.05M|    {
  495|       |        /* Find appropriate central atom. This center should be: ...*/
  496|       |
  497|       |        /* charged exactly (+1) ... */
  498|  1.05M|        if (at[i].charge != 1)
  ------------------
  |  Branch (498:13): [True: 981k, False: 75.8k]
  ------------------
  499|   981k|        {
  500|   981k|            continue;
  501|   981k|        }
  502|  75.8k|        en_center = at[i].el_number;
  503|       |        /*  from eligible element list ... */
  504|  75.8k|        if (!memchr(allowed_elnums_center, en_center, sizeof(allowed_elnums_center)))
  ------------------
  |  Branch (504:13): [True: 64.3k, False: 11.5k]
  ------------------
  505|  64.3k|        {
  506|  64.3k|            continue;
  507|  64.3k|        }
  508|       |        /* has exactly 3 neighbours connected by single bonds*/
  509|  11.5k|        if (at[i].valence != 3)
  ------------------
  |  Branch (509:13): [True: 10.2k, False: 1.32k]
  ------------------
  510|  10.2k|        {
  511|  10.2k|            continue;
  512|  10.2k|        }
  513|  1.32k|        if (at[i].chem_bonds_valence != 3)
  ------------------
  |  Branch (513:13): [True: 511, False: 812]
  ------------------
  514|    511|        {
  515|    511|            continue;
  516|    511|        }
  517|       |
  518|       |        /* non-radical. */
  519|    812|        if (at[i].radical && (at[i].radical != RADICAL_SINGLET))
  ------------------
  |  |   75|     22|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (519:13): [True: 22, False: 790]
  |  Branch (519:30): [True: 22, False: 0]
  ------------------
  520|     22|        {
  521|     22|            continue;
  522|     22|        }
  523|       |
  524|       |        /* NB: center must have neutral neighbours, two of them are aliphatic N's of which at least one bears H. */
  525|    790|        mismatch = nuH = nuN = kk = 0;           /* djb-rwth: removing redundant code */
  526|    790|        memset(nitrogens, 0, sizeof(nitrogens)); /* djb-rwth: memset_s C11/Annex K variant? */
  527|    790|        jj = -1;
  528|  2.31k|        for (k = 0; k < at[i].valence; k++)
  ------------------
  |  Branch (528:21): [True: 1.82k, False: 490]
  ------------------
  529|  1.82k|        {
  530|  1.82k|            j = at[i].neighbor[k];
  531|       |
  532|  1.82k|            if (at[j].charge != 0)
  ------------------
  |  Branch (532:17): [True: 118, False: 1.70k]
  ------------------
  533|    118|            {
  534|    118|                mismatch = 1;
  535|    118|                break;
  536|    118|            }
  537|  1.70k|            if (at[j].el_number == dN)
  ------------------
  |  Branch (537:17): [True: 248, False: 1.45k]
  ------------------
  538|    248|            {
  539|    248|                if ((at[j].valence > 3) || (at[j].chem_bonds_valence > 3))
  ------------------
  |  Branch (539:21): [True: 39, False: 209]
  |  Branch (539:44): [True: 143, False: 66]
  ------------------
  540|    182|                {
  541|    182|                    mismatch = 1;
  542|    182|                    break;
  543|    182|                }
  544|     66|                nuH += NUMH(at, j);
  ------------------
  |  |   56|     66|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|     66|#define NUM_ISO_H(AT, N) (AT[N].num_iso_H[0] + AT[N].num_iso_H[1] + AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  545|     66|                nuN++;
  546|     66|                if (jj < 0)
  ------------------
  |  Branch (546:21): [True: 41, False: 25]
  ------------------
  547|     41|                {
  548|     41|                    jj = j;
  549|     41|                    kk = k;
  550|     41|                }
  551|     66|            }
  552|  1.70k|        }
  553|       |
  554|       |        /* If OK, apply changes. */
  555|    790|        if (mismatch)
  ------------------
  |  Branch (555:13): [True: 300, False: 490]
  ------------------
  556|    300|        {
  557|    300|            continue;
  558|    300|        }
  559|    490|        if (nuN != 2)
  ------------------
  |  Branch (559:13): [True: 467, False: 23]
  ------------------
  560|    467|        {
  561|    467|            continue;
  562|    467|        }
  563|     23|        if (nuH < 1)
  ------------------
  |  Branch (563:13): [True: 20, False: 3]
  ------------------
  564|     20|        {
  565|     20|            continue;
  566|     20|        }
  567|      3|        if (jj >= 0)
  ------------------
  |  Branch (567:13): [True: 3, False: 0]
  ------------------
  568|      3|        {
  569|      3|            at[i].charge = 0;
  570|      3|            at[jj].charge = 1;
  571|      3|            at[i].bond_type[kk] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   33|      3|#define BOND_TYPE_DOUBLE    2
  ------------------
  572|      6|            for (k1 = 0; k1 < at[jj].valence && i != at[jj].neighbor[k1]; k1++)
  ------------------
  |  Branch (572:26): [True: 6, False: 0]
  |  Branch (572:49): [True: 3, False: 3]
  ------------------
  573|      3|                ;
  574|      3|            at[jj].bond_type[k1] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   33|      3|#define BOND_TYPE_DOUBLE    2
  ------------------
  575|      3|            at[i].chem_bonds_valence++;
  576|      3|            at[jj].chem_bonds_valence++;
  577|       |            /* NB: do nothing with wedge stereo bonds (retain wedge) */
  578|       |
  579|      3|            (*num_changes)++;
  580|      3|        }
  581|      3|    } /* end of search for candidate centers. */
  582|       |
  583|   216k|    return 0;
  584|   216k|}
fix_odd_things:
  591|   216k|{
  592|       |    /* N;P;As;Sb;O;S;Se;Te;C;Si */
  593|   216k|    static const U_CHAR en[] = {
  594|   216k|        EL_NUMBER_N,
  ------------------
  |  |   14|   216k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  595|   216k|        EL_NUMBER_P,
  ------------------
  |  |   18|   216k|#define EL_NUMBER_P  ((U_CHAR)15)
  ------------------
  596|   216k|        EL_NUMBER_AS,
  ------------------
  |  |   22|   216k|#define EL_NUMBER_AS ((U_CHAR)33)
  ------------------
  597|   216k|        EL_NUMBER_SB,
  ------------------
  |  |   25|   216k|#define EL_NUMBER_SB ((U_CHAR)51)
  ------------------
  598|   216k|        EL_NUMBER_O,
  ------------------
  |  |   15|   216k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  599|   216k|        EL_NUMBER_S,
  ------------------
  |  |   19|   216k|#define EL_NUMBER_S  ((U_CHAR)16)
  ------------------
  600|   216k|        EL_NUMBER_SE,
  ------------------
  |  |   23|   216k|#define EL_NUMBER_SE ((U_CHAR)34)
  ------------------
  601|   216k|        EL_NUMBER_TE};
  ------------------
  |  |   26|   216k|#define EL_NUMBER_TE ((U_CHAR)52)
  ------------------
  602|   216k|    static int ne = sizeof(en) / sizeof(en[0]);
  603|       |
  604|   216k|#define FIRST_NEIGHB2 4
  605|   216k|#define FIRST_CENTER2 5
  606|       |
  607|   216k|    int i1, i2, k1, k2, c = -1, num_changes = 0;
  608|       |    /* djb-rwth: removing redundant variables */
  609|       |
  610|   216k|    if (bFixNonUniformDraw)
  ------------------
  |  Branch (610:9): [True: 216k, False: 0]
  ------------------
  611|   216k|    {
  612|   216k|        int ret1;                                                             /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  613|   216k|        ret1 = fix_non_uniform_drawn_oxoanions(num_atoms, at, &num_changes);  /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  614|   216k|        ret1 = fix_non_uniform_drawn_amidiniums(num_atoms, at, &num_changes); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  615|   216k|    }
  616|       |
  617|       |    /* H(-)-X  -> H-X(-);  H(+)-X  -> H-X(+) */
  618|  1.27M|    for (i1 = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (618:18): [True: 1.05M, False: 216k]
  ------------------
  619|  1.05M|    {
  620|  1.05M|        if (1 == at[i1].valence &&
  ------------------
  |  Branch (620:13): [True: 110k, False: 947k]
  ------------------
  621|   110k|            1 == abs(at[i1].charge) &&
  ------------------
  |  Branch (621:13): [True: 44.4k, False: 65.5k]
  ------------------
  622|  44.4k|            (0 == at[i1].radical || RADICAL_SINGLET == at[i1].radical) &&
  ------------------
  |  |   75|  7.91k|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (622:14): [True: 36.5k, False: 7.91k]
  |  Branch (622:37): [True: 0, False: 7.91k]
  ------------------
  623|  36.5k|            BOND_TYPE_SINGLE == at[i1].bond_type[0] &&
  ------------------
  |  |   32|  36.5k|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (623:13): [True: 16.4k, False: 20.0k]
  ------------------
  624|  16.4k|            EL_NUMBER_H == at[i1].el_number && EL_NUMBER_H != at[i2 = (int)at[i1].neighbor[0]].el_number &&
  ------------------
  |  |   11|  16.4k|#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 &&
  ------------------
  |  |   11|      0|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
  |  Branch (624:13): [True: 0, False: 16.4k]
  |  Branch (624:48): [True: 0, False: 0]
  ------------------
  625|      0|            !NUMH(at, i1) && !NUMH(at, i2))
  ------------------
  |  |   56|  1.05M|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|      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))
  ------------------
  |  |   56|      0|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|      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 (625:13): [True: 0, False: 0]
  |  Branch (625:30): [True: 0, False: 0]
  ------------------
  626|      0|        {
  627|      0|            at[i2].charge += at[i1].charge;
  628|      0|            at[i1].charge = 0;
  629|      0|        }
  630|  1.05M|    }
  631|       |
  632|       |    /* replace XHm(-)--Y==XHn(+) with XHm==Y--XHn, (n>=0 ,m>=0, X=N,P,As,Sb,O,S,Se,Te) */
  633|  1.27M|    for (i1 = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (633:18): [True: 1.05M, False: 216k]
  ------------------
  634|  1.05M|    {
  635|  1.05M|        if (1 != at[i1].charge ||
  ------------------
  |  Branch (635:13): [True: 981k, False: 75.8k]
  ------------------
  636|  75.8k|            (at[i1].radical && RADICAL_SINGLET != at[i1].radical) ||
  ------------------
  |  |   75|  4.10k|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (636:14): [True: 4.10k, False: 71.7k]
  |  Branch (636:32): [True: 4.10k, False: 0]
  ------------------
  637|  71.7k|            at[i1].chem_bonds_valence == at[i1].valence ||
  ------------------
  |  Branch (637:13): [True: 44.4k, False: 27.3k]
  ------------------
  638|  27.3k|            !memchr(en, at[i1].el_number, ne) ||
  ------------------
  |  Branch (638:13): [True: 9.66k, False: 17.7k]
  ------------------
  639|  17.7k|            get_el_valence(at[i1].el_number, at[i1].charge, 0) != at[i1].chem_bonds_valence + NUMH(at, i1)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   56|  17.7k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  17.7k|#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 (639:13): [True: 3.02k, False: 14.6k]
  ------------------
  640|  1.04M|        {
  641|  1.04M|            continue;
  642|  1.04M|        }
  643|       |
  644|       |        /* found a candidate at[i1] for X in XHn(+) */
  645|  14.6k|        if (1 == at[i1].valence &&
  ------------------
  |  Branch (645:13): [True: 707, False: 13.9k]
  ------------------
  646|    707|            BOND_TYPE_DOUBLE == at[i1].bond_type[0])
  ------------------
  |  |   33|    707|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (646:13): [True: 378, False: 329]
  ------------------
  647|    378|        {
  648|    378|            c = (int)at[i1].neighbor[0];
  649|  1.43k|            for (k2 = 0; k2 < at[c].valence; k2++)
  ------------------
  |  Branch (649:26): [True: 1.06k, False: 367]
  ------------------
  650|  1.06k|            {
  651|  1.06k|                i2 = at[c].neighbor[k2];
  652|  1.06k|                if (1 == at[i2].valence &&
  ------------------
  |  Branch (652:21): [True: 632, False: 432]
  ------------------
  653|    632|                    -1 == at[i2].charge &&
  ------------------
  |  Branch (653:21): [True: 93, False: 539]
  ------------------
  654|     93|                    at[i2].el_number == at[i1].el_number && /* exact match */
  ------------------
  |  Branch (654:21): [True: 33, False: 60]
  ------------------
  655|     33|                    (0 == at[i2].radical || RADICAL_SINGLET == at[i2].radical) &&
  ------------------
  |  |   75|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (655:22): [True: 33, False: 0]
  |  Branch (655:45): [True: 0, False: 0]
  ------------------
  656|     33|                    BOND_TYPE_SINGLE == at[i2].bond_type[0] &&
  ------------------
  |  |   32|     33|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (656:21): [True: 12, False: 21]
  ------------------
  657|       |                    /*memchr(en, at[i2].el_number, ne) &&*/
  658|     12|                    get_el_valence(at[i2].el_number, at[i2].charge, 0) == at[i2].chem_bonds_valence + NUMH(at, i2))
  ------------------
  |  |   56|     12|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|     12|#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 (658:21): [True: 11, False: 1]
  ------------------
  659|     11|                {
  660|       |                    /* found both X(-) and X(+); change bonds and remove charges */
  661|     30|                    for (k1 = 0; k1 < at[c].valence && i1 != at[c].neighbor[k1]; k1++)
  ------------------
  |  Branch (661:34): [True: 30, False: 0]
  |  Branch (661:56): [True: 19, False: 11]
  ------------------
  662|     19|                        ;
  663|     11|                    at[i1].charge = at[i2].charge = 0;
  664|     11|                    at[i1].bond_type[0] = at[c].bond_type[k1] = BOND_TYPE_SINGLE;
  ------------------
  |  |   32|     11|#define BOND_TYPE_SINGLE    1
  ------------------
  665|     11|                    at[i1].chem_bonds_valence--;
  666|     11|                    at[i2].bond_type[0] = at[c].bond_type[k2] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   33|     11|#define BOND_TYPE_DOUBLE    2
  ------------------
  667|     11|                    at[i2].chem_bonds_valence++;
  668|     11|                    num_changes++;
  669|     11|                    break;
  670|     11|                }
  671|  1.06k|            }
  672|    378|        }
  673|  14.3k|        else
  674|  14.3k|        {
  675|       |            /* explicit H case: detect H-neighbors and Y */
  676|  14.3k|            int ineigh, neigh, i1_c, i2_c, num_H_i1, num_H_i2;
  677|  42.8k|            for (ineigh = 0, num_H_i1 = 0, i1_c = -1; ineigh < at[i1].valence; ineigh++)
  ------------------
  |  Branch (677:55): [True: 29.8k, False: 12.9k]
  ------------------
  678|  29.8k|            {
  679|  29.8k|                neigh = at[i1].neighbor[ineigh];
  680|  29.8k|                if (at[neigh].el_number == EL_NUMBER_H)
  ------------------
  |  |   11|  29.8k|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
  |  Branch (680:21): [True: 2.50k, False: 27.3k]
  ------------------
  681|  2.50k|                {
  682|  2.50k|                    if (at[neigh].chem_bonds_valence == 1 &&
  ------------------
  |  Branch (682:25): [True: 1.14k, False: 1.36k]
  ------------------
  683|  1.14k|                        (0 == at[neigh].radical || RADICAL_SINGLET == at[neigh].radical))
  ------------------
  |  |   75|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (683:26): [True: 1.14k, False: 0]
  |  Branch (683:52): [True: 0, False: 0]
  ------------------
  684|  1.14k|                    {
  685|  1.14k|                        num_H_i1++; /* found H-neighbor */
  686|  1.14k|                    }
  687|  1.36k|                    else
  688|  1.36k|                    {
  689|  1.36k|                        break; /* wrong neighbor */
  690|  1.36k|                    }
  691|  2.50k|                }
  692|  27.3k|                else if (at[i1].bond_type[ineigh] == BOND_TYPE_DOUBLE)
  ------------------
  |  |   33|  27.3k|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (692:26): [True: 11.4k, False: 15.9k]
  ------------------
  693|  11.4k|                {
  694|       |                    /* found a candidate for Y; bond must be double */
  695|  11.4k|                    i1_c = ineigh;
  696|  11.4k|                    c = neigh;
  697|  11.4k|                }
  698|  29.8k|            }
  699|  14.3k|            if (i1_c < 0 || num_H_i1 + 1 != at[i1].valence)
  ------------------
  |  Branch (699:17): [True: 5.46k, False: 8.84k]
  |  Branch (699:29): [True: 8.47k, False: 372]
  ------------------
  700|  13.9k|            {
  701|  13.9k|                continue;
  702|  13.9k|            }
  703|  1.13k|            for (k2 = 0; k2 < at[c].valence; k2++)
  ------------------
  |  Branch (703:26): [True: 814, False: 324]
  ------------------
  704|    814|            {
  705|    814|                i2 = at[c].neighbor[k2];
  706|    814|                if (-1 == at[i2].charge &&
  ------------------
  |  Branch (706:21): [True: 92, False: 722]
  ------------------
  707|     92|                    at[i2].el_number == at[i1].el_number && /* exact match */
  ------------------
  |  Branch (707:21): [True: 76, False: 16]
  ------------------
  708|     76|                    (0 == at[i2].radical || RADICAL_SINGLET == at[i2].radical) &&
  ------------------
  |  |   75|      1|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (708:22): [True: 75, False: 1]
  |  Branch (708:45): [True: 0, False: 1]
  ------------------
  709|     75|                    get_el_valence(at[i2].el_number, at[i2].charge, 0) == at[i2].chem_bonds_valence + NUMH(at, i2))
  ------------------
  |  |   56|     75|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|     75|#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 (709:21): [True: 75, False: 0]
  ------------------
  710|     75|                {
  711|    194|                    for (ineigh = 0, num_H_i2 = 0, i2_c = -1; ineigh < at[i2].valence; ineigh++)
  ------------------
  |  Branch (711:63): [True: 146, False: 48]
  ------------------
  712|    146|                    {
  713|    146|                        neigh = at[i2].neighbor[ineigh];
  714|    146|                        if (at[neigh].el_number == EL_NUMBER_H)
  ------------------
  |  |   11|    146|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
  |  Branch (714:29): [True: 70, False: 76]
  ------------------
  715|     70|                        {
  716|     70|                            if (at[neigh].chem_bonds_valence == 1 &&
  ------------------
  |  Branch (716:33): [True: 48, False: 22]
  ------------------
  717|     48|                                (0 == at[neigh].radical || RADICAL_SINGLET == at[neigh].radical))
  ------------------
  |  |   75|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (717:34): [True: 48, False: 0]
  |  Branch (717:60): [True: 0, False: 0]
  ------------------
  718|     48|                            {
  719|     48|                                num_H_i2++; /* found H-neighbor */
  720|     48|                            }
  721|     22|                            else
  722|     22|                            {
  723|     22|                                break; /* wrong neighbor */
  724|     22|                            }
  725|     70|                        }
  726|     76|                        else
  727|     76|                        {
  728|     76|                            if (c == neigh && at[i2].bond_type[ineigh] == BOND_TYPE_SINGLE)
  ------------------
  |  |   32|     75|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (728:33): [True: 75, False: 1]
  |  Branch (728:47): [True: 71, False: 4]
  ------------------
  729|     71|                            {
  730|     71|                                i2_c = ineigh; /* position of Y neighbor; bond must be single */
  731|     71|                            }
  732|      5|                            else
  733|      5|                            {
  734|      5|                                break;
  735|      5|                            }
  736|     76|                        }
  737|    146|                    }
  738|     75|                    if (num_H_i2 + (i2_c >= 0) != at[i2].valence)
  ------------------
  |  Branch (738:25): [True: 27, False: 48]
  ------------------
  739|     27|                    {
  740|     27|                        continue;
  741|     27|                    }
  742|       |                    /* found both X(-) and X(+); change bonds and remove charges */
  743|     94|                    for (k1 = 0; k1 < at[c].valence && i1 != at[c].neighbor[k1]; k1++)
  ------------------
  |  Branch (743:34): [True: 94, False: 0]
  |  Branch (743:56): [True: 46, False: 48]
  ------------------
  744|     46|                        ;
  745|     48|                    if ((i1_c >= 0) && (i2_c >= 0)) /* djb-rwth: fixing coverity ID #499537 */
  ------------------
  |  Branch (745:25): [True: 48, False: 0]
  |  Branch (745:40): [True: 48, False: 0]
  ------------------
  746|     48|                    {
  747|     48|                        at[i1].charge = at[i2].charge = 0;
  748|     48|                        at[i1].bond_type[i1_c] = at[c].bond_type[k1] = BOND_TYPE_SINGLE;
  ------------------
  |  |   32|     48|#define BOND_TYPE_SINGLE    1
  ------------------
  749|     48|                        at[i1].chem_bonds_valence--;
  750|     48|                        at[i2].bond_type[i2_c] = at[c].bond_type[k2] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   33|     48|#define BOND_TYPE_DOUBLE    2
  ------------------
  751|     48|                        at[i2].chem_bonds_valence++;
  752|     48|                        num_changes++;
  753|     48|                        break;
  754|     48|                    }
  755|      0|                    else
  756|      0|                    {
  757|      0|                        continue;
  758|      0|                    }
  759|     48|                }
  760|    814|            } /* k2 */
  761|    372|        }
  762|  14.6k|    }
  763|       |
  764|       |    /* Replace
  765|       |
  766|       |    X-                X        X=O,S,Se,Te -- terminal atoms  (NEIGHB2)
  767|       |    \ |               \ ||
  768|       |    >Y++    with      >Y        Y=S,Se,Te   -- central cation  (CENTER2)
  769|       |    / |               / ||
  770|       |    X-                X        Y valence=4, original Y bond valence = 4
  771|       |
  772|       |
  773|       |    --- the following case of P is processed separately in remove_ion_pairs()
  774|       |    --- therefire, it has been disabled here, see #ifndef FIX_P_IV_Plus_O_Minus -- 2010-03-17 DT
  775|       |
  776|       |    X-                X        X=O,S,Se,Te -- terminal atoms  (NEIGHB2)
  777|       |    \ |               \ ||
  778|       |    >P+     with      >P
  779|       |    / |               / |
  780|       |    X-                X-       Y valence=4, original Y bond valence = 4
  781|       |
  782|       |    */
  783|       |
  784|  1.27M|    for (i1 = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (784:18): [True: 1.05M, False: 216k]
  ------------------
  785|  1.05M|    {
  786|  1.05M|        if (1 == at[i1].valence &&
  ------------------
  |  Branch (786:13): [True: 110k, False: 947k]
  ------------------
  787|   110k|            -1 == at[i1].charge &&
  ------------------
  |  Branch (787:13): [True: 33.7k, False: 76.2k]
  ------------------
  788|  33.7k|            (0 == at[i1].radical || RADICAL_SINGLET == at[i1].radical) &&
  ------------------
  |  |   75|  5.09k|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (788:14): [True: 28.6k, False: 5.09k]
  |  Branch (788:37): [True: 0, False: 5.09k]
  ------------------
  789|  28.6k|            !NUMH(at, i1) &&
  ------------------
  |  |   56|  1.08M|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  28.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 (789:13): [True: 28.3k, False: 324]
  ------------------
  790|  28.3k|            BOND_TYPE_SINGLE == at[i1].bond_type[0] &&
  ------------------
  |  |   32|  28.3k|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (790:13): [True: 13.8k, False: 14.4k]
  ------------------
  791|  13.8k|            memchr(en + FIRST_NEIGHB2, at[i1].el_number, (long long)ne - FIRST_NEIGHB2)) /* djb-rwth: cast operator added */
  ------------------
  |  |  604|  13.8k|#define FIRST_NEIGHB2 4
  ------------------
                          memchr(en + FIRST_NEIGHB2, at[i1].el_number, (long long)ne - FIRST_NEIGHB2)) /* djb-rwth: cast operator added */
  ------------------
  |  |  604|  13.8k|#define FIRST_NEIGHB2 4
  ------------------
  |  Branch (791:13): [True: 12.2k, False: 1.65k]
  ------------------
  792|  12.2k|        {
  793|  12.2k|            int charge, i;
  794|       |            /* found a candidate for X */
  795|  12.2k|            c = (int)at[i1].neighbor[0];                                                                                    /* candidate for Y */
  796|  12.2k|            if (((charge = 2) == at[c].charge && memchr(en + FIRST_CENTER2, at[c].el_number, (long long)ne - FIRST_CENTER2) /* djb-rwth: cast operator added */
  ------------------
  |  |  605|     12|#define FIRST_CENTER2 5
  ------------------
                          if (((charge = 2) == at[c].charge && memchr(en + FIRST_CENTER2, at[c].el_number, (long long)ne - FIRST_CENTER2) /* djb-rwth: cast operator added */
  ------------------
  |  |  605|     12|#define FIRST_CENTER2 5
  ------------------
  |  Branch (796:18): [True: 12, False: 12.2k]
  |  Branch (796:50): [True: 0, False: 12]
  ------------------
  797|       |
  798|       |#ifndef FIX_P_IV_Plus_O_Minus
  799|       |                 || (charge = 1) == at[c].charge && EL_NUMBER_P == at[c].el_number
  800|       |#endif
  801|  12.2k|                 ) &&
  802|      0|                4 == at[c].valence &&
  ------------------
  |  Branch (802:17): [True: 0, False: 0]
  ------------------
  803|      0|                (0 == at[c].radical || RADICAL_SINGLET == at[c].radical) &&
  ------------------
  |  |   75|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (803:18): [True: 0, False: 0]
  |  Branch (803:40): [True: 0, False: 0]
  ------------------
  804|      0|                at[c].valence == at[c].chem_bonds_valence &&
  ------------------
  |  Branch (804:17): [True: 0, False: 0]
  ------------------
  805|      0|                !NUMH(at, c))
  ------------------
  |  |   56|      0|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|      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 (805:17): [True: 0, False: 0]
  ------------------
  806|      0|            {
  807|      0|                ; /* accept */
  808|      0|            }
  809|  12.2k|            else
  810|  12.2k|            {
  811|  12.2k|                continue; /* ignore at[i1] */
  812|  12.2k|            }
  813|      0|            for (k2 = 0; k2 < at[c].valence; k2++)
  ------------------
  |  Branch (813:26): [True: 0, False: 0]
  ------------------
  814|      0|            {
  815|      0|                i2 = at[c].neighbor[k2];
  816|      0|                if (i2 == i1)
  ------------------
  |  Branch (816:21): [True: 0, False: 0]
  ------------------
  817|      0|                {
  818|      0|                    continue;
  819|      0|                }
  820|      0|                if (1 == at[i2].valence &&
  ------------------
  |  Branch (820:21): [True: 0, False: 0]
  ------------------
  821|      0|                    -1 == at[i2].charge &&
  ------------------
  |  Branch (821:21): [True: 0, False: 0]
  ------------------
  822|      0|                    memchr(en + FIRST_NEIGHB2, at[i2].el_number, (long long)ne - FIRST_NEIGHB2) && /* djb-rwth: cast operator added */
  ------------------
  |  |  604|      0|#define FIRST_NEIGHB2 4
  ------------------
                                  memchr(en + FIRST_NEIGHB2, at[i2].el_number, (long long)ne - FIRST_NEIGHB2) && /* djb-rwth: cast operator added */
  ------------------
  |  |  604|      0|#define FIRST_NEIGHB2 4
  ------------------
  |  Branch (822:21): [True: 0, False: 0]
  ------------------
  823|       |                    /*at[i2].el_number == at[i1].el_number &&*/                                    /* exact match */
  824|      0|                    (0 == at[i2].radical || RADICAL_SINGLET == at[i2].radical) &&
  ------------------
  |  |   75|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (824:22): [True: 0, False: 0]
  |  Branch (824:45): [True: 0, False: 0]
  ------------------
  825|      0|                    !NUMH(at, i2) &&
  ------------------
  |  |   56|      0|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|      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 (825:21): [True: 0, False: 0]
  ------------------
  826|      0|                    BOND_TYPE_SINGLE == at[i2].bond_type[0])
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (826:21): [True: 0, False: 0]
  ------------------
  827|      0|                {
  828|       |                    /* found both X(-) and X(-); change bonds and remove charges */
  829|      0|                    for (k1 = 0; k1 < at[c].valence && i1 != at[c].neighbor[k1]; k1++)
  ------------------
  |  Branch (829:34): [True: 0, False: 0]
  |  Branch (829:56): [True: 0, False: 0]
  ------------------
  830|      0|                    {
  831|      0|                        ;
  832|      0|                    }
  833|      0|                    for (i = 0; i < charge; i++)
  ------------------
  |  Branch (833:33): [True: 0, False: 0]
  ------------------
  834|      0|                    {
  835|       |                        /* in case of P it does not matter which X atom is neutralized
  836|       |                        because of tautomerism. However, neutral central atom is important
  837|       |                        for the neutralization of the components */
  838|      0|                        switch (i)
  ------------------
  |  Branch (838:33): [True: 0, False: 0]
  ------------------
  839|      0|                        {
  840|      0|                        case 0:
  ------------------
  |  Branch (840:25): [True: 0, False: 0]
  ------------------
  841|      0|                            at[i1].charge++; /* = 0; changed 2010-03-17 DT*/
  842|      0|                            at[i1].bond_type[0] = at[c].bond_type[k1] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  843|      0|                            at[i1].bond_stereo[0] = at[c].bond_stereo[k1] = 0;
  844|      0|                            at[i1].chem_bonds_valence++;
  845|      0|                            at[c].chem_bonds_valence++;
  846|      0|                            if (bFixBug)
  ------------------
  |  Branch (846:33): [True: 0, False: 0]
  ------------------
  847|      0|                                at[c].charge--; /* added 2010-03-17 DT*/
  848|      0|                            num_changes++;
  849|      0|                            break;
  850|      0|                        case 1:
  ------------------
  |  Branch (850:25): [True: 0, False: 0]
  ------------------
  851|      0|                            at[i2].charge++; /*= 0; changed 2010-03-17 DT*/
  852|      0|                            at[i2].bond_type[0] = at[c].bond_type[k2] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   33|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  853|      0|                            at[i2].bond_stereo[0] = at[c].bond_stereo[k2] = 0;
  854|      0|                            at[i2].chem_bonds_valence++;
  855|      0|                            at[c].chem_bonds_valence++;
  856|      0|                            if (bFixBug)
  ------------------
  |  Branch (856:33): [True: 0, False: 0]
  ------------------
  857|      0|                                at[c].charge--; /* added 2010-03-17 DT */
  858|      0|                            num_changes++;
  859|      0|                            break;
  860|      0|                        }
  861|      0|                    }
  862|       |
  863|       |                    /*   -- removed -- 2010-03-17 DT
  864|       |                    #if ( FIX_ODD_THINGS_REM_Plus_BUG == 1 )
  865|       |                    at[c].charge -= charge;
  866|       |                    #else
  867|       |                    if ( bFixBug )
  868|       |                    {
  869|       |                    at[c].charge -= charge;
  870|       |                    }
  871|       |                    #endif
  872|       |                    */
  873|      0|                    break;
  874|      0|                }
  875|      0|            }
  876|      0|        }
  877|  1.05M|    }
  878|       |
  879|       |    /* A(doublet)-B(doublet) -> A=B  (A and B have no other doublet neighbors) */
  880|       |    /* A(doublet)=B(doublet) -> A#B  (A and B have no other doublet neighbors) */
  881|  1.27M|    for (i1 = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (881:18): [True: 1.05M, False: 216k]
  ------------------
  882|  1.05M|    {
  883|  1.05M|        if (RADICAL_DOUBLET == at[i1].radical &&
  ------------------
  |  |   76|  1.05M|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (883:13): [True: 17.3k, False: 1.03M]
  ------------------
  884|  17.3k|            0 <= (i2 = the_only_doublet_neigh(at, i1, &k1, &k2)))
  ------------------
  |  Branch (884:13): [True: 13, False: 17.3k]
  ------------------
  885|     13|        {
  886|     13|            if (at[i1].bond_type[k1] <= BOND_TYPE_DOUBLE)
  ------------------
  |  |   33|     13|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (886:17): [True: 7, False: 6]
  ------------------
  887|      7|            {
  888|      7|                at[i1].bond_type[k1]++;
  889|      7|                at[i1].chem_bonds_valence++;
  890|      7|                at[i2].bond_type[k2]++;
  891|      7|                at[i2].chem_bonds_valence++;
  892|      7|                at[i1].radical = 0;
  893|      7|                at[i2].radical = 0;
  894|      7|            }
  895|     13|        }
  896|  1.05M|    }
  897|       |
  898|   216k|#if (REMOVE_ION_PAIRS_EARLY == 1)
  899|   216k|    num_changes += remove_ion_pairs(num_atoms, at);
  900|   216k|#endif
  901|       |
  902|   216k|    return num_changes;
  903|   216k|}
nFindOneOM:
  915|    147|{
  916|    147|    int i, n_OM, best_value, cur_value, diff; /* djb-rwth: removing redundant variables */
  917|    147|    int num_best;
  918|       |
  919|    147|    if (1 == num_OM)
  ------------------
  |  Branch (919:9): [True: 93, False: 54]
  ------------------
  920|     93|    {
  921|     93|        return ord_OM[0];
  922|     93|    }
  923|     54|    if (1 > num_OM)
  ------------------
  |  Branch (923:9): [True: 0, False: 54]
  ------------------
  924|      0|    {
  925|      0|        return -1;
  926|      0|    }
  927|       |
  928|       |    /* select neighbors with min. number of bonds */
  929|     54|    num_best = 1;
  930|     54|    n_OM = (int)at[at_no].neighbor[ord_OM[0]];
  931|     54|    best_value = (int)at[n_OM].valence;
  932|       |    /* compare number of bonds; move indexes of the best neighbors to the first elements of ord_OM[] */
  933|    108|    for (i = 1; i < num_OM; i++)
  ------------------
  |  Branch (933:17): [True: 54, False: 54]
  ------------------
  934|     54|    {
  935|     54|        n_OM = at[at_no].neighbor[ord_OM[i]];
  936|     54|        cur_value = (int)at[n_OM].valence;
  937|     54|        diff = cur_value - best_value;
  938|     54|        if (diff < 0)
  ------------------
  |  Branch (938:13): [True: 0, False: 54]
  ------------------
  939|      0|        {
  940|       |            /* djb-rwth: removing redundant code */
  941|      0|            best_value = cur_value;
  942|      0|            ord_OM[0] = ord_OM[i];
  943|      0|            num_best = 1;
  944|      0|        }
  945|     54|        else if (diff == 0)
  ------------------
  |  Branch (945:18): [True: 54, False: 0]
  ------------------
  946|     54|        { /* was '=', pointed by WDI */
  947|     54|            ord_OM[num_best++] = ord_OM[i];
  948|     54|        }
  949|     54|    }
  950|     54|    num_OM = num_best;
  951|     54|    if (1 == num_OM)
  ------------------
  |  Branch (951:9): [True: 0, False: 54]
  ------------------
  952|      0|    {
  953|      0|        return ord_OM[0];
  954|      0|    }
  955|       |
  956|       |    /* select neighbors with min. periodic numbers */
  957|     54|    num_best = 1;
  958|     54|    n_OM = (int)at[at_no].neighbor[ord_OM[0]];
  959|     54|    best_value = (int)at[n_OM].el_number;
  960|       |
  961|       |    /* compare periodic numbers; move indexes of the best neighbors to the first elements of ord_OM[] */
  962|    108|    for (i = 1; i < num_OM; i++)
  ------------------
  |  Branch (962:17): [True: 54, False: 54]
  ------------------
  963|     54|    {
  964|     54|        n_OM = at[at_no].neighbor[ord_OM[i]];
  965|     54|        cur_value = (int)at[n_OM].el_number;
  966|     54|        diff = cur_value - best_value;
  967|     54|        if (diff < 0)
  ------------------
  |  Branch (967:13): [True: 0, False: 54]
  ------------------
  968|      0|        {
  969|       |            /* djb-rwth: removing redundant code */
  970|      0|            best_value = cur_value;
  971|      0|            ord_OM[0] = ord_OM[i];
  972|      0|            num_best = 1;
  973|      0|        }
  974|     54|        else if (diff == 0)
  ------------------
  |  Branch (974:18): [True: 4, False: 50]
  ------------------
  975|      4|        { /* was '=', pointed by WDI */
  976|      4|            ord_OM[num_best++] = ord_OM[i];
  977|      4|        }
  978|     54|    }
  979|     54|    num_OM = num_best;
  980|     54|    if (1 == num_OM)
  ------------------
  |  Branch (980:9): [True: 50, False: 4]
  ------------------
  981|     50|    {
  982|     50|        return ord_OM[0];
  983|     50|    }
  984|       |
  985|       |    /* if neighbors are not terminal atoms then reject */
  986|      4|    if (1 < at[n_OM].valence)
  ------------------
  |  Branch (986:9): [True: 0, False: 4]
  ------------------
  987|      0|    {
  988|      0|        return -1;
  989|      0|    }
  990|       |
  991|       |    /* if neighbors are terminal atoms then the one without isotope or with lightest isotope */
  992|      4|    num_best = 1;
  993|      4|    n_OM = (int)at[at_no].neighbor[ord_OM[0]];
  994|      4|    best_value = (int)at[n_OM].iso_atw_diff;
  995|       |
  996|       |    /* compare periodic numbers; move indexes of the best neighbors to the first elements of ord_OM[] */
  997|      8|    for (i = 1; i < num_OM; i++)
  ------------------
  |  Branch (997:17): [True: 4, False: 4]
  ------------------
  998|      4|    {
  999|      4|        n_OM = at[at_no].neighbor[ord_OM[i]];
 1000|      4|        cur_value = (int)at[n_OM].el_number;
 1001|      4|        diff = cur_value - best_value;
 1002|      4|        if ((!cur_value && best_value) || diff < 0)
  ------------------
  |  Branch (1002:14): [True: 0, False: 4]
  |  Branch (1002:28): [True: 0, False: 0]
  |  Branch (1002:43): [True: 0, False: 4]
  ------------------
 1003|      0|        {
 1004|       |            /* djb-rwth: removing redundant code */
 1005|      0|            best_value = cur_value;
 1006|      0|            ord_OM[0] = ord_OM[i];
 1007|      0|            num_best = 1;
 1008|      0|        }
 1009|      4|        else if (diff == 0)
  ------------------
  |  Branch (1009:18): [True: 0, False: 4]
  ------------------
 1010|      0|        {
 1011|       |            /* was '=', pointed by WDI */
 1012|      0|            ord_OM[num_best++] = ord_OM[i];
 1013|      0|        }
 1014|      4|    }
 1015|       |
 1016|      4|    num_OM = num_best;
 1017|      4|    if (1 == num_OM)
  ------------------
  |  Branch (1017:9): [True: 4, False: 0]
  ------------------
 1018|      4|    {
 1019|      4|        return ord_OM[0];
 1020|      4|    }
 1021|       |
 1022|       |    /* return any */
 1023|      0|    return ord_OM[0];
 1024|      4|}
remove_ion_pairs:
 1031|   216k|{
 1032|   216k|    int num_changes = 0;
 1033|   216k|#define MAX_NEIGH 6
 1034|       |
 1035|   216k|    int i, n, n2, i1, i2, i3, i4, type, chrg;
 1036|   216k|    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;
 1037|       |
 1038|   216k|#ifdef FIX_P_IV_Plus_O_Minus
 1039|   216k|    int num_P_IV_plus = 0; /* added 2010-03-17 DT */
 1040|   216k|#endif
 1041|       |
 1042|   216k|    inp_ATOM *a;
 1043|       |    /****** count candidates ********/
 1044|  1.27M|    for (i = 0, a = at; i < num_atoms; i++, a++)
  ------------------
  |  Branch (1044:25): [True: 1.05M, False: 216k]
  ------------------
 1045|  1.05M|    {
 1046|  1.05M|        if (1 == (chrg = a->charge) || -1 == chrg)
  ------------------
  |  Branch (1046:13): [True: 75.8k, False: 981k]
  |  Branch (1046:40): [True: 44.1k, False: 937k]
  ------------------
 1047|   119k|        {
 1048|   119k|            switch (ion_el_group(a->el_number))
  ------------------
  |  Branch (1048:21): [True: 68.3k, False: 51.6k]
  ------------------
 1049|   119k|            {
 1050|  16.1k|            case EL_NUMBER_C:
  ------------------
  |  |   13|  16.1k|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (1050:13): [True: 16.1k, False: 103k]
  ------------------
 1051|  16.1k|                if (chrg > 0)
  ------------------
  |  Branch (1051:21): [True: 7.97k, False: 8.17k]
  ------------------
 1052|  7.97k|                {
 1053|  7.97k|                    num_C_plus++;
 1054|  7.97k|                }
 1055|  8.17k|                else
 1056|  8.17k|                {
 1057|  8.17k|                    num_C_minus++;
 1058|  8.17k|                }
 1059|  16.1k|                break;
 1060|  22.2k|            case EL_NUMBER_O:
  ------------------
  |  |   15|  22.2k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (1060:13): [True: 22.2k, False: 97.6k]
  ------------------
 1061|  22.2k|                if (chrg > 0)
  ------------------
  |  Branch (1061:21): [True: 9.52k, False: 12.7k]
  ------------------
 1062|  9.52k|                {
 1063|  9.52k|                    num_O_plus++;
 1064|  9.52k|                }
 1065|  12.7k|                else
 1066|  12.7k|                {
 1067|  12.7k|                    num_O_minus++;
 1068|  12.7k|                }
 1069|  22.2k|                break;
 1070|  29.9k|            case EL_NUMBER_N:
  ------------------
  |  |   14|  29.9k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (1070:13): [True: 29.9k, False: 90.0k]
  ------------------
 1071|  29.9k|                if (chrg > 0)
  ------------------
  |  Branch (1071:21): [True: 11.1k, False: 18.7k]
  ------------------
 1072|  11.1k|                {
 1073|  11.1k|                    num_N_plus++;
 1074|  11.1k|                }
 1075|  18.7k|                else
 1076|  18.7k|                {
 1077|  18.7k|                    num_N_minus++;
 1078|  18.7k|                }
 1079|  29.9k|#ifdef FIX_P_IV_Plus_O_Minus
 1080|  29.9k|                    num_P_IV_plus += a->el_number != EL_NUMBER_N &&
  ------------------
  |  |   14|  59.8k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (1080:38): [True: 7.62k, False: 22.3k]
  ------------------
 1081|  7.62k|                                     chrg == 1 &&
  ------------------
  |  Branch (1081:38): [True: 2.66k, False: 4.95k]
  ------------------
 1082|  2.66k|                                     a->valence == 4 &&
  ------------------
  |  Branch (1082:38): [True: 142, False: 2.52k]
  ------------------
 1083|    142|                                     a->chem_bonds_valence == 4; /* added 2010-03-17 DT */
  ------------------
  |  Branch (1083:38): [True: 104, False: 38]
  ------------------
 1084|  29.9k|#endif
 1085|  29.9k|                    break;
 1086|   119k|            }
 1087|   119k|        }
 1088|   937k|        else if (!chrg && a->chem_bonds_valence + NUMH(a, 0) == 2 &&
  ------------------
  |  |   56|   933k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|   933k|#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 (1088:18): [True: 933k, False: 3.80k]
  |  Branch (1088:27): [True: 46.0k, False: 887k]
  ------------------
 1089|  46.0k|                 get_el_valence(a->el_number, 0, 0) == 4 &&
  ------------------
  |  Branch (1089:18): [True: 1.84k, False: 44.2k]
  ------------------
 1090|  1.84k|                 ion_el_group(a->el_number) == EL_NUMBER_C)
  ------------------
  |  |   13|  1.84k|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (1090:18): [True: 1.60k, False: 239]
  ------------------
 1091|  1.60k|        {
 1092|  1.60k|            num_C_II++;
 1093|  1.60k|        }
 1094|  1.05M|    }
 1095|       |
 1096|   216k|    num_All = num_C_II + num_C_plus + num_C_minus + num_N_plus + num_N_minus + num_O_plus + num_O_minus;
 1097|       |
 1098|       |    /* do not add num_P_IV_plus ! -- 2010-03-17 DT */
 1099|   216k|    if (!num_All)
  ------------------
  |  Branch (1099:9): [True: 183k, False: 32.7k]
  ------------------
 1100|   183k|    {
 1101|   183k|        return 0;
 1102|   183k|    }
 1103|       |
 1104|       |    /**************************************************************************/
 1105|       |    /*************************** Terminal ion pairs ***************************/
 1106|       |    /**************************************************************************/
 1107|       |
 1108|       |    /*-------------------------------------------------------------------------
 1109|       |    Pair type 1            N=N,P,As,Sb; O=O,S,Se,Te
 1110|       |    ===========
 1111|       |
 1112|       |    X              X     if X is another -O(-) then neutralize O(-)
 1113|       |    |              |     that has the smallest periodic table number
 1114|       |    O=N(+)-O(-) => O=N=O
 1115|       |    i    n
 1116|       |    --------------------------------------------------------------------------*/
 1117|       |
 1118|   621k|    for (type = 1; type <= 18; type++)
  ------------------
  |  Branch (1118:20): [True: 589k, False: 32.7k]
  ------------------
 1119|   589k|    {
 1120|   589k|        if ((!type || 1 == type))
  ------------------
  |  Branch (1120:14): [True: 0, False: 589k]
  |  Branch (1120:23): [True: 32.7k, False: 556k]
  ------------------
 1121|  32.7k|        {
 1122|  44.2k|            for (i = 0; i < num_atoms && 0 < num_N_plus && 0 < num_O_minus; i++)
  ------------------
  |  Branch (1122:25): [True: 42.4k, False: 1.80k]
  |  Branch (1122:42): [True: 19.6k, False: 22.8k]
  |  Branch (1122:60): [True: 11.5k, False: 8.07k]
  ------------------
 1123|  11.5k|            {
 1124|  11.5k|                if (1 == at[i].charge && 3 == nNoMetalNumBonds(at, i) &&
  ------------------
  |  Branch (1124:21): [True: 3.36k, False: 8.15k]
  |  Branch (1124:42): [True: 718, False: 2.65k]
  ------------------
 1125|    718|                    4 == nNoMetalBondsValence(at, i) &&
  ------------------
  |  Branch (1125:21): [True: 532, False: 186]
  ------------------
 1126|    532|                    ion_el_group(at[i].el_number) == EL_NUMBER_N)
  ------------------
  |  |   14|    532|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (1126:21): [True: 504, False: 28]
  ------------------
 1127|    504|                {
 1128|    504|                    int num_OM = 0, ord_OM[3]; /* -O(-) */
 1129|    504|                    int num_O = 0;             /* =O    */
 1130|    504|                    int num_O_other = 0;
 1131|  2.01k|                    for (i1 = 0; i1 < at[i].valence; i1++)
  ------------------
  |  Branch (1131:34): [True: 1.51k, False: 504]
  ------------------
 1132|  1.51k|                    {
 1133|  1.51k|                        n = at[i].neighbor[i1];
 1134|  1.51k|                        if (1 == nNoMetalNumBonds(at, n) && 0 == num_of_H(at, n) &&
  ------------------
  |  Branch (1134:29): [True: 638, False: 875]
  |  Branch (1134:61): [True: 604, False: 34]
  ------------------
 1135|    604|                            ion_el_group(at[n].el_number) == EL_NUMBER_O) /* djb-rwth: ignoring LLVM warning: variable used */
  ------------------
  |  |   15|    604|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (1135:29): [True: 458, False: 146]
  ------------------
 1136|    458|                        {
 1137|    458|                            if (BOND_TYPE_SINGLE == at[i].bond_type[i1] &&
  ------------------
  |  |   32|    458|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1137:33): [True: 229, False: 229]
  ------------------
 1138|    229|                                -1 == at[n].charge)
  ------------------
  |  Branch (1138:33): [True: 223, False: 6]
  ------------------
 1139|    223|                            {
 1140|    223|                                ord_OM[num_OM++] = i1;
 1141|    223|                            }
 1142|    235|                            else if (BOND_TYPE_DOUBLE == at[n].bond_type[0] &&
  ------------------
  |  |   33|    235|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (1142:38): [True: 229, False: 6]
  ------------------
 1143|    229|                                     0 == at[n].charge)
  ------------------
  |  Branch (1143:38): [True: 225, False: 4]
  ------------------
 1144|    225|                            {
 1145|    225|                                num_O++;
 1146|    225|                            }
 1147|     10|                            else
 1148|     10|                            {
 1149|     10|                                num_O_other++;
 1150|     10|                            }
 1151|    458|                        }
 1152|  1.51k|                    }
 1153|    504|                    if (num_OM > 0 && num_O > 0 && !num_O_other &&
  ------------------
  |  Branch (1153:25): [True: 206, False: 298]
  |  Branch (1153:39): [True: 78, False: 128]
  |  Branch (1153:52): [True: 78, False: 0]
  ------------------
 1154|     78|                        0 <= (i1 = nFindOneOM(at, i, ord_OM, num_OM)))
  ------------------
  |  Branch (1154:25): [True: 78, False: 0]
  ------------------
 1155|     78|                    {
 1156|       |                        /* remove charges and increase bond order */
 1157|     78|                        n = at[i].neighbor[i1];
 1158|     78|                        i2 = (int)(is_in_the_list(at[n].neighbor, (AT_NUMB)i, at[n].valence) - at[n].neighbor);
 1159|     78|                        at[i].bond_type[i1]++;
 1160|     78|                        at[n].bond_type[i2]++;
 1161|     78|                        at[i].chem_bonds_valence++;
 1162|     78|                        at[n].chem_bonds_valence++;
 1163|     78|                        at[i].charge--;
 1164|     78|                        at[n].charge++;
 1165|     78|                        at[i].radical = 0;
 1166|     78|                        at[n].radical = 0;
 1167|     78|                        num_changes++;
 1168|     78|                        num_N_plus--;
 1169|     78|                        num_O_minus--;
 1170|     78|                        num_All -= 2;
 1171|     78|                    }
 1172|    504|                }
 1173|  11.5k|            }
 1174|       |
 1175|  32.7k|#ifdef FIX_P_IV_Plus_O_Minus
 1176|       |
 1177|       |            /*-------------------------------------------------------------------------
 1178|       |            Pair type 1a           P=P,As,Sb; O=O,S,Se,Te  -- added 2010-03-17
 1179|       |            =============
 1180|       |
 1181|       |            X              X     if X, Y, or Z is another -O(-) then neutralize O(-)
 1182|       |            |              |     that has the smallest periodic table number
 1183|       |            Y-P(+)-O(-) => Y-P=O
 1184|       |            |i   n         |
 1185|       |            Z              Z
 1186|       |
 1187|       |            --------------------------------------------------------------------------*/
 1188|       |
 1189|  33.1k|            for (i = 0; i < num_atoms && 0 < num_P_IV_plus /*&& 0 < num_N_plus*/ && 0 < num_O_minus; i++)
  ------------------
  |  Branch (1189:25): [True: 33.1k, False: 30]
  |  Branch (1189:42): [True: 472, False: 32.6k]
  |  Branch (1189:85): [True: 467, False: 5]
  ------------------
 1190|    467|            {
 1191|    467|                if (1 == at[i].charge && 4 == nNoMetalNumBonds(at, i) &&
  ------------------
  |  Branch (1191:21): [True: 186, False: 281]
  |  Branch (1191:42): [True: 112, False: 74]
  ------------------
 1192|    112|                    4 == nNoMetalBondsValence(at, i) &&
  ------------------
  |  Branch (1192:21): [True: 105, False: 7]
  ------------------
 1193|    105|                    at[i].el_number != EL_NUMBER_N && ion_el_group(at[i].el_number) == EL_NUMBER_N)
  ------------------
  |  |   14|    572|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
                                  at[i].el_number != EL_NUMBER_N && ion_el_group(at[i].el_number) == EL_NUMBER_N)
  ------------------
  |  |   14|    102|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (1193:21): [True: 102, False: 3]
  |  Branch (1193:55): [True: 99, False: 3]
  ------------------
 1194|     99|                {
 1195|     99|                    int num_OM = 0, ord_OM[4]; /* -O(-) */
 1196|       |                    /*int num_O  = 0;*/        /* =O    */
 1197|       |                                               /* djb-rwth: removing redundant variables */
 1198|    495|                    for (i1 = 0; i1 < at[i].valence; i1++)
  ------------------
  |  Branch (1198:34): [True: 396, False: 99]
  ------------------
 1199|    396|                    {
 1200|    396|                        n = at[i].neighbor[i1];
 1201|    396|                        if (1 == nNoMetalNumBonds(at, n) && 0 == num_of_H(at, n) &&
  ------------------
  |  Branch (1201:29): [True: 186, False: 210]
  |  Branch (1201:61): [True: 168, False: 18]
  ------------------
 1202|    168|                            ion_el_group(at[n].el_number) == EL_NUMBER_O) /* djb-rwth: ignoring LLVM warning: variable used */
  ------------------
  |  |   15|    168|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (1202:29): [True: 128, False: 40]
  ------------------
 1203|    128|                        {
 1204|    128|                            if (BOND_TYPE_SINGLE == at[i].bond_type[i1] &&
  ------------------
  |  |   32|    128|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1204:33): [True: 128, False: 0]
  ------------------
 1205|    128|                                -1 == at[n].charge)
  ------------------
  |  Branch (1205:33): [True: 123, False: 5]
  ------------------
 1206|    123|                            {
 1207|    123|                                ord_OM[num_OM++] = i1;
 1208|       |                                /*
 1209|       |                                }
 1210|       |                                if ( BOND_TYPE_DOUBLE == at[n].bond_type[0] &&
 1211|       |                                0                == at[n].charge       ) {
 1212|       |                                num_O ++;
 1213|       |                                */
 1214|    123|                            }
 1215|       |                            /* djb-rwth: removing redundant code */
 1216|    128|                        }
 1217|    396|                    }
 1218|     99|                    if (num_OM > 0 /*&& num_O > 0 && !num_O_other*/ &&
  ------------------
  |  Branch (1218:25): [True: 69, False: 30]
  ------------------
 1219|     69|                        0 <= (i1 = nFindOneOM(at, i, ord_OM, num_OM)))
  ------------------
  |  Branch (1219:25): [True: 69, False: 0]
  ------------------
 1220|     69|                    {
 1221|       |                        /* remove charges and increase bond order */
 1222|     69|                        n = at[i].neighbor[i1];
 1223|     69|                        i2 = is_in_the_list(at[n].neighbor, (AT_NUMB)i, at[n].valence) - at[n].neighbor;
 1224|     69|                        at[i].bond_type[i1]++;
 1225|     69|                        at[n].bond_type[i2]++;
 1226|     69|                        at[i].chem_bonds_valence++;
 1227|     69|                        at[n].chem_bonds_valence++;
 1228|     69|                        at[i].charge--;
 1229|     69|                        at[n].charge++;
 1230|     69|                        at[i].radical = 0;
 1231|     69|                        at[n].radical = 0;
 1232|     69|                        num_changes++;
 1233|     69|                        num_N_plus--;
 1234|     69|                        num_O_minus--;
 1235|     69|                        num_P_IV_plus--;
 1236|     69|                        num_All -= 2;
 1237|     69|                    }
 1238|     99|                }
 1239|    467|            }
 1240|  32.7k|#endif /* FIX_P_IV_Plus_O_Minus */
 1241|  32.7k|        }
 1242|       |
 1243|       |        /*-------------------------------------------------------------------------
 1244|       |        Terminal pair types: 2,3,4,5,6,7,8,9   N=N,P,As,Sb; O=O,S,Se,Te; C=C,Si
 1245|       |        ====================================
 1246|       |        type #
 1247|       |        2 2:  O=N-C(II)-     => O=N#C-      N=N,P,As,Sb; O=O,S,Se,Te; C=C,Si
 1248|       |        3 9:  O=O(+)-C(-)(III) => O=O=C(IV)
 1249|       |        4 3:  O(-)-N(+)(IV)  => O=N(V)  (input structure has at least 1 double bond)
 1250|       |        5 4:  O(-)-O(+)(III) => O=O(IV)
 1251|       |        6 8:  O(-)-O-C(+)(III) => O=O=C(IV)
 1252|       |        7 5:  N(-)=N(+)(IV)  => N#N(V)    allow terminal H on N(-)
 1253|       |        8 6:  N(-)=O(+)(III) => N#O-
 1254|       |        9 7:  N(-)=C(+)(III) => N#C-
 1255|       |        --------------------------------------------------------------------------*/
 1256|       |
 1257|   589k|        if (!type || (2 <= type && type <= 9)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1257:13): [True: 0, False: 589k]
  |  Branch (1257:23): [True: 556k, False: 32.7k]
  |  Branch (1257:36): [True: 261k, False: 294k]
  ------------------
 1258|   261k|        {
 1259|  1.73M|            for (i = 0; i < num_atoms && 0 < num_All; i++)
  ------------------
  |  Branch (1259:25): [True: 1.47M, False: 257k]
  |  Branch (1259:42): [True: 1.47M, False: 4.34k]
  ------------------
 1260|  1.47M|            {
 1261|  1.47M|                if (0 == at[i].charge && 1 == nNoMetalNumBonds(at, i) && 2 == nNoMetalBondsValence(at, i) &&
  ------------------
  |  Branch (1261:21): [True: 826k, False: 647k]
  |  Branch (1261:42): [True: 326k, False: 499k]
  |  Branch (1261:74): [True: 91.6k, False: 235k]
  ------------------
 1262|  91.6k|                    0 == num_of_H(at, i) &&
  ------------------
  |  Branch (1262:21): [True: 90.8k, False: 790]
  ------------------
 1263|  90.8k|                    ion_el_group(at[i].el_number) == EL_NUMBER_O &&
  ------------------
  |  |   15|  1.56M|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (1263:21): [True: 72.3k, False: 18.5k]
  ------------------
 1264|  72.3k|                    0 <= (i1 = nNoMetalNeighIndex(at, i)) &&
  ------------------
  |  Branch (1264:21): [True: 65.7k, False: 6.59k]
  ------------------
 1265|  65.7k|                    at[i].bond_type[i1] <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   34|  65.7k|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1265:21): [True: 65.7k, False: 0]
  ------------------
 1266|  65.7k|                {
 1267|       |                    /* terminal O= */
 1268|  65.7k|                    n = at[i].neighbor[i1];
 1269|  65.7k|                    if ((!type || type == 2) && 0 < num_C_II)
  ------------------
  |  Branch (1269:26): [True: 0, False: 65.7k]
  |  Branch (1269:35): [True: 7.89k, False: 57.8k]
  |  Branch (1269:49): [True: 383, False: 7.51k]
  ------------------
 1270|    383|                    {
 1271|       |                        /* avoid alternating bonds */
 1272|    383|                        if (0 == at[n].charge &&
  ------------------
  |  Branch (1272:29): [True: 258, False: 125]
  ------------------
 1273|    258|                            2 == nNoMetalNumBonds(at, n) && 3 == nNoMetalBondsValence(at, n) &&
  ------------------
  |  Branch (1273:29): [True: 198, False: 60]
  |  Branch (1273:61): [True: 179, False: 19]
  ------------------
 1274|    179|                            0 == num_of_H(at, n) &&
  ------------------
  |  Branch (1274:29): [True: 177, False: 2]
  ------------------
 1275|    177|                            ion_el_group(at[n].el_number) == EL_NUMBER_N &&
  ------------------
  |  |   14|    560|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (1275:29): [True: 171, False: 6]
  ------------------
 1276|    171|                            0 <= (i2 = nNoMetalOtherNeighIndex(at, n, i)) &&
  ------------------
  |  Branch (1276:29): [True: 143, False: 28]
  ------------------
 1277|    143|                            at[n].bond_type[i2] <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   34|    143|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1277:29): [True: 143, False: 0]
  ------------------
 1278|    143|                        {
 1279|       |                            /* i2 = index of opposite to at[i] neighbor of at[n] */
 1280|       |                            /*i2 = (at[n].neighbor[0] == i);*/
 1281|    143|                            n2 = at[n].neighbor[i2];
 1282|    143|                            if (0 == at[n2].charge &&
  ------------------
  |  Branch (1282:33): [True: 136, False: 7]
  ------------------
 1283|    136|                                2 == at[n2].valence && 2 == at[n2].chem_bonds_valence &&
  ------------------
  |  Branch (1283:33): [True: 93, False: 43]
  |  Branch (1283:56): [True: 89, False: 4]
  ------------------
 1284|     89|                                0 == num_of_H(at, n2) &&
  ------------------
  |  Branch (1284:33): [True: 89, False: 0]
  ------------------
 1285|     89|                                ion_el_group(at[n2].el_number) == EL_NUMBER_C)
  ------------------
  |  |   13|     89|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (1285:33): [True: 0, False: 89]
  ------------------
 1286|      0|                            {
 1287|       |                                /*       i n n2     */
 1288|       |                                /* found O=N-C(II)- */
 1289|       |                                /* convert O=N-C(II)-     => O=N#C- */
 1290|       |
 1291|      0|                                i3 = (at[n2].neighbor[0] != n); /* index of at[n] neighbor of n2 */
 1292|      0|                                at[n].chem_bonds_valence = 5;   /* N */
 1293|      0|                                at[n2].chem_bonds_valence = 4;  /* C */
 1294|      0|                                at[n].bond_type[i2] = BOND_TYPE_TRIPLE;
  ------------------
  |  |   34|      0|#define BOND_TYPE_TRIPLE    3
  ------------------
 1295|      0|                                at[n2].bond_type[i3] = BOND_TYPE_TRIPLE;
  ------------------
  |  |   34|      0|#define BOND_TYPE_TRIPLE    3
  ------------------
 1296|      0|                                at[n2].radical = 0;
 1297|      0|                                num_changes++;
 1298|      0|                                num_C_II--;
 1299|      0|                                num_All--;
 1300|      0|                                continue;
 1301|      0|                            }
 1302|    143|                        }
 1303|    383|                    }
 1304|       |
 1305|  65.7k|                    if ((!type || type == 3) && 0 < num_O_plus && 0 < num_C_minus)
  ------------------
  |  Branch (1305:26): [True: 0, False: 65.7k]
  |  Branch (1305:35): [True: 7.89k, False: 57.8k]
  |  Branch (1305:49): [True: 2.73k, False: 5.16k]
  |  Branch (1305:67): [True: 834, False: 1.90k]
  ------------------
 1306|    834|                    {
 1307|    834|                        if (1 == at[n].charge && 2 == nNoMetalNumBonds(at, n) && 3 == nNoMetalBondsValence(at, n) &&
  ------------------
  |  Branch (1307:29): [True: 578, False: 256]
  |  Branch (1307:50): [True: 563, False: 15]
  |  Branch (1307:82): [True: 562, False: 1]
  ------------------
 1308|    562|                            0 == num_of_H(at, n) &&
  ------------------
  |  Branch (1308:29): [True: 545, False: 17]
  ------------------
 1309|    545|                            ion_el_group(at[n].el_number) == EL_NUMBER_O &&
  ------------------
  |  |   15|  1.37k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (1309:29): [True: 288, False: 257]
  ------------------
 1310|    288|                            0 <= (i2 = nNoMetalOtherNeighIndex(at, n, i)) &&
  ------------------
  |  Branch (1310:29): [True: 288, False: 0]
  ------------------
 1311|    288|                            at[n].bond_type[i2] <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   34|    288|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1311:29): [True: 288, False: 0]
  ------------------
 1312|    288|                        {
 1313|       |                            /* found O=O(+)- */
 1314|       |                            /* i2 = index of opposite to at[i] neighbor of at[n] */
 1315|       |                            /*i2 = (at[n].neighbor[0] == i);*/
 1316|    288|                            n2 = at[n].neighbor[i2];
 1317|    288|                            if (-1 == at[n2].charge && 3 >= nNoMetalNumBonds(at, n2) && 3 == nNoMetalBondsValence(at, n2) + NUMH(at, n2) &&
  ------------------
  |  |   56|    296|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|      8|#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 (1317:33): [True: 27, False: 261]
  |  Branch (1317:56): [True: 8, False: 19]
  |  Branch (1317:89): [True: 7, False: 1]
  ------------------
 1318|      7|                                ion_el_group(at[n2].el_number) == EL_NUMBER_C)
  ------------------
  |  |   13|      7|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (1318:33): [True: 7, False: 0]
  ------------------
 1319|      7|                            {
 1320|       |                                /*             i n    n2        */
 1321|       |                                /* found found O=O(+)-C(-)(III) */
 1322|       |                                /* convert O=O(+)-C(-)(III)     => O=O=C(IV) */
 1323|      7|                                i3 = (at[n2].neighbor[0] != n); /* index of at[n] neighbor of n2 */
 1324|      7|                                at[n].charge--;
 1325|      7|                                at[n2].charge++;
 1326|      7|                                at[n].chem_bonds_valence += 1;  /* =O- => =O= */
 1327|      7|                                at[n2].chem_bonds_valence += 1; /* -C  => =C  */
 1328|      7|                                at[n].bond_type[i2] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   33|      7|#define BOND_TYPE_DOUBLE    2
  ------------------
 1329|      7|                                at[n2].bond_type[i3] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   33|      7|#define BOND_TYPE_DOUBLE    2
  ------------------
 1330|      7|                                num_changes++;
 1331|      7|                                num_O_plus--;
 1332|      7|                                num_C_minus--;
 1333|      7|                                num_All -= 2;
 1334|      7|                                continue;
 1335|      7|                            }
 1336|    288|                        }
 1337|    834|                    }
 1338|  65.7k|                }
 1339|       |
 1340|  1.40M|                else if (-1 == at[i].charge &&
  ------------------
  |  Branch (1340:26): [True: 332k, False: 1.07M]
  ------------------
 1341|   332k|                         0 < num_O_minus + num_N_minus &&
  ------------------
  |  Branch (1341:26): [True: 259k, False: 72.7k]
  ------------------
 1342|   259k|                         0 < num_N_plus + num_O_plus + num_C_plus &&
  ------------------
  |  Branch (1342:26): [True: 170k, False: 88.8k]
  ------------------
 1343|   170k|                         1 == nNoMetalNumBonds(at, i) && 1 == nNoMetalBondsValence(at, i) &&
  ------------------
  |  Branch (1343:26): [True: 134k, False: 36.8k]
  |  Branch (1343:58): [True: 86.5k, False: 47.4k]
  ------------------
 1344|  86.5k|                         0 == num_of_H(at, i) &&
  ------------------
  |  Branch (1344:26): [True: 85.4k, False: 1.06k]
  ------------------
 1345|  85.4k|                         ion_el_group(at[i].el_number) == EL_NUMBER_O &&
  ------------------
  |  |   15|  1.49M|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (1345:26): [True: 56.5k, False: 28.9k]
  ------------------
 1346|  56.5k|                         0 <= (i1 = nNoMetalNeighIndex(at, i)) &&
  ------------------
  |  Branch (1346:26): [True: 55.6k, False: 843]
  ------------------
 1347|  55.6k|                         at[i].bond_type[i1] <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   34|  55.6k|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1347:26): [True: 55.6k, False: 0]
  ------------------
 1348|  55.6k|                {
 1349|       |                    /* terminal O(-)- */
 1350|  55.6k|                    n = at[i].neighbor[i1];
 1351|       |
 1352|  55.6k|                    if ((!type || type == 4) && 0 < num_O_minus && 0 < num_N_plus && /* O(-)-N(+)(IV) */
  ------------------
  |  Branch (1352:26): [True: 0, False: 55.6k]
  |  Branch (1352:35): [True: 7.49k, False: 48.1k]
  |  Branch (1352:49): [True: 7.49k, False: 0]
  |  Branch (1352:68): [True: 1.81k, False: 5.68k]
  ------------------
 1353|  1.81k|                        1 == at[n].charge && 3 >= nNoMetalNumBonds(at, n) && 4 == nNoMetalBondsValence(at, n) &&
  ------------------
  |  Branch (1353:25): [True: 812, False: 1.00k]
  |  Branch (1353:46): [True: 255, False: 557]
  |  Branch (1353:78): [True: 142, False: 113]
  ------------------
 1354|    142|                        0 == num_of_H(at, n) &&
  ------------------
  |  Branch (1354:25): [True: 136, False: 6]
  ------------------
 1355|    136|                        ion_el_group(at[n].el_number) == EL_NUMBER_N /* except >O(+)- */
  ------------------
  |  |   14|    136|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (1355:25): [True: 129, False: 7]
  ------------------
 1356|  55.6k|                    )
 1357|    129|                    {
 1358|       |                        /* found O(-)-N(+)(IV) */
 1359|       |                        /* convert O(-)-N(+)(IV)     => O=N(V)  */
 1360|       |
 1361|    129|                        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] */
 1362|    129|                        at[i].charge++;
 1363|    129|                        at[n].charge--;
 1364|    129|                        at[i].chem_bonds_valence++;
 1365|    129|                        at[n].chem_bonds_valence++;
 1366|    129|                        at[i].bond_type[i1]++;
 1367|    129|                        at[n].bond_type[i2]++;
 1368|    129|                        num_changes++;
 1369|    129|                        num_O_minus--;
 1370|    129|                        num_N_plus--;
 1371|    129|                        num_All -= 2;
 1372|    129|                        continue;
 1373|    129|                    }
 1374|       |
 1375|  55.5k|                    if ((!type || type == 5) && 0 < num_O_minus && 0 < num_O_plus && /* O(-)-O(+)(III) */
  ------------------
  |  Branch (1375:26): [True: 0, False: 55.5k]
  |  Branch (1375:35): [True: 7.26k, False: 48.2k]
  |  Branch (1375:49): [True: 7.26k, False: 0]
  |  Branch (1375:68): [True: 3.72k, False: 3.53k]
  ------------------
 1376|  3.72k|                        1 == at[n].charge && 3 >= nNoMetalNumBonds(at, n) && 3 == nNoMetalBondsValence(at, n) &&
  ------------------
  |  Branch (1376:25): [True: 1.78k, False: 1.94k]
  |  Branch (1376:46): [True: 996, False: 791]
  |  Branch (1376:78): [True: 897, False: 99]
  ------------------
 1377|    897|                        0 == num_of_H(at, n) &&
  ------------------
  |  Branch (1377:25): [True: 811, False: 86]
  ------------------
 1378|    811|                        ion_el_group(at[n].el_number) == EL_NUMBER_O /* except >O(+)- */
  ------------------
  |  |   15|    811|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (1378:25): [True: 785, False: 26]
  ------------------
 1379|  55.5k|                    )
 1380|    785|                    {
 1381|       |                        /* found  O(+)(III) */
 1382|       |                        /* convert O(-)-O(+)(III)    => O=O(IV) */
 1383|       |
 1384|    785|                        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] */
 1385|    785|                        at[i].charge++;
 1386|    785|                        at[n].charge--;
 1387|    785|                        at[i].chem_bonds_valence++;
 1388|    785|                        at[n].chem_bonds_valence++;
 1389|    785|                        at[i].bond_type[i1]++;
 1390|    785|                        at[n].bond_type[i2]++;
 1391|    785|                        num_changes++;
 1392|    785|                        num_O_minus--;
 1393|    785|                        num_O_plus--;
 1394|    785|                        num_All -= 2;
 1395|    785|                        continue;
 1396|    785|                    }
 1397|       |
 1398|       |                    /* i    n n2        */
 1399|  54.7k|                    if ((!type || type == 6) && /* O(-)-O-C(+)(III) */
  ------------------
  |  Branch (1399:26): [True: 0, False: 54.7k]
  |  Branch (1399:35): [True: 6.48k, False: 48.2k]
  ------------------
 1400|  6.48k|                        0 < num_O_minus && 0 < num_C_plus &&
  ------------------
  |  Branch (1400:25): [True: 6.48k, False: 0]
  |  Branch (1400:44): [True: 3.25k, False: 3.22k]
  ------------------
 1401|  3.25k|                        0 == at[n].charge && 2 == nNoMetalNumBonds(at, n) && 2 == nNoMetalBondsValence(at, n) &&
  ------------------
  |  Branch (1401:25): [True: 2.48k, False: 766]
  |  Branch (1401:46): [True: 989, False: 1.49k]
  |  Branch (1401:78): [True: 797, False: 192]
  ------------------
 1402|    797|                        0 == num_of_H(at, n) &&
  ------------------
  |  Branch (1402:25): [True: 794, False: 3]
  ------------------
 1403|    794|                        ion_el_group(at[n].el_number) == EL_NUMBER_O &&
  ------------------
  |  |   15|  55.5k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (1403:25): [True: 717, False: 77]
  ------------------
 1404|    717|                        0 <= (i2 = nNoMetalOtherNeighIndex(at, n, i)) &&
  ------------------
  |  Branch (1404:25): [True: 381, False: 336]
  ------------------
 1405|    381|                        at[n].bond_type[i2] <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   34|    381|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1405:25): [True: 381, False: 0]
  ------------------
 1406|    381|                    {
 1407|       |                        /* found O(-)-O- */
 1408|       |                        /* i2 = index of opposite to at[i] neighbor of at[n] */
 1409|       |                        /*i2 = (at[n].neighbor[0] == i);*/
 1410|    381|                        n2 = at[n].neighbor[i2];
 1411|    381|                        if (1 == at[n2].charge && 3 >= nNoMetalNumBonds(at, n2) &&
  ------------------
  |  Branch (1411:29): [True: 116, False: 265]
  |  Branch (1411:51): [True: 108, False: 8]
  ------------------
 1412|    108|                            3 == nNoMetalBondsValence(at, n2) + NUMH(at, n2) &&
  ------------------
  |  |   56|    489|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|    108|#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 (1412:29): [True: 91, False: 17]
  ------------------
 1413|     91|                            ion_el_group(at[n2].el_number) == EL_NUMBER_C)
  ------------------
  |  |   13|     91|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (1413:29): [True: 1, False: 90]
  ------------------
 1414|      1|                        {
 1415|       |                            /*       i    n n2  */
 1416|       |                            /* found O(-)-O-C(+)(III) */
 1417|       |                            /* convert O(-)-O-C(+)(III)     => O=O=C(IV) */
 1418|       |                            /*i3 = (at[n2].neighbor[0] != n);*/ /* i3 = index of at[n] neighbor of at[n2] */
 1419|      1|                            i3 = (int)(is_in_the_list(at[n2].neighbor, (AT_NUMB)n, at[n2].valence) - at[n2].neighbor);
 1420|       |                            /*i4 = index of at[i] in the adjacency list of at[n] */
 1421|      1|                            i4 = (int)(is_in_the_list(at[n].neighbor, (AT_NUMB)i, at[n].valence) - at[n].neighbor);
 1422|      1|                            at[i].charge++;
 1423|      1|                            at[n2].charge--;
 1424|      1|                            at[i].chem_bonds_valence += 1;  /* O-  => O=  */
 1425|      1|                            at[n].chem_bonds_valence += 2;  /* -O- => =O= */
 1426|      1|                            at[n2].chem_bonds_valence += 1; /* -C  => =C  */
 1427|      1|                            at[i].bond_type[i1] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   33|      1|#define BOND_TYPE_DOUBLE    2
  ------------------
 1428|      1|                            at[n].bond_type[i4] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   33|      1|#define BOND_TYPE_DOUBLE    2
  ------------------
 1429|      1|                            at[n].bond_type[i2] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   33|      1|#define BOND_TYPE_DOUBLE    2
  ------------------
 1430|      1|                            at[n2].bond_type[i3] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   33|      1|#define BOND_TYPE_DOUBLE    2
  ------------------
 1431|      1|                            num_changes++;
 1432|      1|                            num_O_minus--;
 1433|      1|                            num_C_plus--;
 1434|      1|                            num_All -= 2;
 1435|      1|                            continue;
 1436|      1|                        }
 1437|    381|                    }
 1438|  54.7k|                }
 1439|  1.35M|                else if (-1 == at[i].charge && 0 < num_N_minus && 0 < num_N_plus + num_O_plus + num_C_plus &&
  ------------------
  |  Branch (1439:26): [True: 276k, False: 1.07M]
  |  Branch (1439:48): [True: 165k, False: 111k]
  |  Branch (1439:67): [True: 106k, False: 58.8k]
  ------------------
 1440|   106k|                         1 == nNoMetalNumBonds(at, i) && 2 == nNoMetalBondsValence(at, i) + NUMH(at, i) &&
  ------------------
  |  |   56|  1.42M|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  74.2k|#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 (1440:26): [True: 74.2k, False: 32.1k]
  |  Branch (1440:58): [True: 42.4k, False: 31.8k]
  ------------------
 1441|       |                         /*0 == num_of_H( at, i ) &&*/
 1442|  42.4k|                         ion_el_group(at[i].el_number) == EL_NUMBER_N &&
  ------------------
  |  |   14|  1.39M|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (1442:26): [True: 40.9k, False: 1.42k]
  ------------------
 1443|  40.9k|                         0 <= (i1 = nNoMetalNeighIndex(at, i)) &&
  ------------------
  |  Branch (1443:26): [True: 40.4k, False: 570]
  ------------------
 1444|  40.4k|                         at[i].bond_type[i1] <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   34|  40.4k|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1444:26): [True: 40.4k, False: 0]
  ------------------
 1445|  40.4k|                {
 1446|       |                    /* terminal N(-)= */
 1447|  40.4k|                    n = at[i].neighbor[i1 = 0];
 1448|  40.4k|                    if ((!type || type == 7) && 0 < num_N_plus && /* N(-)=N(+)(IV) */
  ------------------
  |  Branch (1448:26): [True: 0, False: 40.4k]
  |  Branch (1448:35): [True: 5.48k, False: 34.9k]
  |  Branch (1448:49): [True: 4.26k, False: 1.21k]
  ------------------
 1449|  4.26k|                        1 == at[n].charge && 3 >= nNoMetalNumBonds(at, n) && 4 == nNoMetalBondsValence(at, n) &&
  ------------------
  |  Branch (1449:25): [True: 2.42k, False: 1.84k]
  |  Branch (1449:46): [True: 1.88k, False: 545]
  |  Branch (1449:78): [True: 1.50k, False: 379]
  ------------------
 1450|  1.50k|                        0 == num_of_H(at, n) &&
  ------------------
  |  Branch (1450:25): [True: 1.49k, False: 7]
  ------------------
 1451|  1.49k|                        ion_el_group(at[n].el_number) == EL_NUMBER_N)
  ------------------
  |  |   14|  1.49k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (1451:25): [True: 1.49k, False: 1]
  ------------------
 1452|  1.49k|                    {
 1453|       |                        /* found N(-)-N(+)(IV) */
 1454|       |                        /* convert N(-)=N(+)(IV)     => N#N(V)  */
 1455|       |
 1456|  1.49k|                        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] */
 1457|  1.49k|                        at[i].charge++;
 1458|  1.49k|                        at[n].charge--;
 1459|  1.49k|                        at[i].chem_bonds_valence++;
 1460|  1.49k|                        at[n].chem_bonds_valence++;
 1461|  1.49k|                        at[i].bond_type[i1]++;
 1462|  1.49k|                        at[n].bond_type[i2]++;
 1463|  1.49k|                        num_changes++;
 1464|  1.49k|                        num_N_minus--;
 1465|  1.49k|                        num_N_plus--;
 1466|  1.49k|                        num_All -= 2;
 1467|  1.49k|                        continue;
 1468|  1.49k|                    }
 1469|  38.9k|                    if ((!type || type == 8) && 0 < num_O_plus && /* N(-)=O(+)(III) */
  ------------------
  |  Branch (1469:26): [True: 0, False: 38.9k]
  |  Branch (1469:35): [True: 3.98k, False: 34.9k]
  |  Branch (1469:49): [True: 1.45k, False: 2.52k]
  ------------------
 1470|  1.45k|                        1 == at[n].charge && 2 == nNoMetalNumBonds(at, n) && 3 == nNoMetalBondsValence(at, n) &&
  ------------------
  |  Branch (1470:25): [True: 1.13k, False: 323]
  |  Branch (1470:46): [True: 539, False: 594]
  |  Branch (1470:78): [True: 539, False: 0]
  ------------------
 1471|    539|                        0 == num_of_H(at, n) &&
  ------------------
  |  Branch (1471:25): [True: 537, False: 2]
  ------------------
 1472|    537|                        ion_el_group(at[n].el_number) == EL_NUMBER_O)
  ------------------
  |  |   15|    537|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (1472:25): [True: 534, False: 3]
  ------------------
 1473|    534|                    {
 1474|       |                        /* found N(-)-O(+)(III) */
 1475|       |                        /* convert N(-)=O(+)(III)    => N#O(IV)- */
 1476|    534|                        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] */
 1477|    534|                        at[i].charge++;
 1478|    534|                        at[n].charge--;
 1479|    534|                        at[i].chem_bonds_valence++;
 1480|    534|                        at[n].chem_bonds_valence++;
 1481|    534|                        at[i].bond_type[i1]++;
 1482|    534|                        at[n].bond_type[i2]++;
 1483|    534|                        num_changes++;
 1484|    534|                        num_N_minus--;
 1485|    534|                        num_O_plus--;
 1486|    534|                        num_All -= 2;
 1487|    534|                        continue;
 1488|    534|                    }
 1489|  38.3k|                    if ((!type || type == 9) && 0 < num_C_plus && /* N(-)=C(+)(III) */
  ------------------
  |  Branch (1489:26): [True: 0, False: 38.3k]
  |  Branch (1489:35): [True: 3.45k, False: 34.9k]
  |  Branch (1489:49): [True: 983, False: 2.46k]
  ------------------
 1490|    983|                        1 == at[n].charge && 2 == at[n].valence && 3 == at[n].chem_bonds_valence &&
  ------------------
  |  Branch (1490:25): [True: 276, False: 707]
  |  Branch (1490:46): [True: 8, False: 268]
  |  Branch (1490:68): [True: 5, False: 3]
  ------------------
 1491|      5|                        0 == num_of_H(at, n) &&
  ------------------
  |  Branch (1491:25): [True: 4, False: 1]
  ------------------
 1492|      4|                        ion_el_group(at[n].el_number) == EL_NUMBER_C)
  ------------------
  |  |   13|      4|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (1492:25): [True: 3, False: 1]
  ------------------
 1493|      3|                    {
 1494|       |                        /* found N(-)=C(+)(III) */
 1495|       |                        /* convert N(-)=C(+)(III)    => N#C(IV)- */
 1496|       |
 1497|      3|                        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] */
 1498|      3|                        at[i].charge++;
 1499|      3|                        at[n].charge--;
 1500|      3|                        at[i].chem_bonds_valence++;
 1501|      3|                        at[n].chem_bonds_valence++;
 1502|      3|                        at[i].bond_type[i1]++;
 1503|      3|                        at[n].bond_type[i2]++;
 1504|      3|                        num_changes++;
 1505|      3|                        num_N_minus--;
 1506|      3|                        num_C_plus--;
 1507|      3|                        num_All -= 2;
 1508|      3|                        continue;
 1509|      3|                    }
 1510|  38.3k|                }
 1511|  1.47M|            }
 1512|   261k|        }
 1513|       |
 1514|       |        /**************************************************************************/
 1515|       |        /*********************** NON-Terminal ion pairs ***************************/
 1516|       |        /**************************************************************************/
 1517|       |        /*-------------------------------------------------------------------------
 1518|       |        Non-Terminal pair types: 10,11,12,13,14   N=N,P,As,Sb; O=O,S,Se,Te; C=C,Si
 1519|       |        ========================================
 1520|       |
 1521|       |        10:  N(+)(IV)-C(-)(III)     => N(V)=C(IV)  (N has 3 or 2 bonds)
 1522|       |        11:  N(+)(IV)=C(-)(III)     => N(V)#C(IV)  (N has 3 or 2 bonds)
 1523|       |        12:  N(+)(IV)-N(-)(II)      => N(V)=N(III) (allow terminal H on N(-))
 1524|       |        13: -O(+)-C(-)(III)         => -O=C-
 1525|       |        14: -O(+)=C(-)(III)         => -O#C-
 1526|       |        15:  O(+)(III)-N(-)(II)     => O(IV)=N(III) (allow terminal H on N(-))
 1527|       |        --------------------------------------------------------------------------*/
 1528|       |
 1529|   589k|        if (!type || (10 <= type && type <= 15)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1529:13): [True: 0, False: 589k]
  |  Branch (1529:23): [True: 294k, False: 294k]
  |  Branch (1529:37): [True: 196k, False: 98.1k]
  ------------------
 1530|   196k|        {
 1531|  1.26M|            for (i = 0; i < num_atoms && 0 < num_All; i++)
  ------------------
  |  Branch (1531:25): [True: 1.07M, False: 186k]
  |  Branch (1531:42): [True: 1.06M, False: 10.1k]
  ------------------
 1532|  1.06M|            {
 1533|  1.06M|                if (1 == at[i].charge &&
  ------------------
  |  Branch (1533:21): [True: 206k, False: 860k]
  ------------------
 1534|   206k|                    0 < num_N_plus + num_O_plus && 0 < num_C_minus + num_N_minus &&
  ------------------
  |  Branch (1534:21): [True: 117k, False: 89.4k]
  |  Branch (1534:52): [True: 79.0k, False: 38.1k]
  ------------------
 1535|  79.0k|                    4 >= nNoMetalNumBonds(at, i) && 4 == nNoMetalBondsValence(at, i) &&
  ------------------
  |  Branch (1535:21): [True: 78.9k, False: 186]
  |  Branch (1535:53): [True: 40.0k, False: 38.8k]
  ------------------
 1536|  40.0k|                    0 == num_of_H(at, i) &&
  ------------------
  |  Branch (1536:21): [True: 35.1k, False: 4.88k]
  ------------------
 1537|  35.1k|                    ion_el_group(at[i].el_number) == EL_NUMBER_N)
  ------------------
  |  |   14|  35.1k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (1537:21): [True: 32.9k, False: 2.20k]
  ------------------
 1538|  32.9k|                {
 1539|       |                    /* found non-terminal N(+)(IV) */
 1540|  32.9k|                    if ((!type || 10 == type) && 0 < num_N_plus && 0 < num_C_minus)
  ------------------
  |  Branch (1540:26): [True: 0, False: 32.9k]
  |  Branch (1540:35): [True: 5.69k, False: 27.2k]
  |  Branch (1540:50): [True: 5.69k, False: 0]
  |  Branch (1540:68): [True: 1.19k, False: 4.50k]
  ------------------
 1541|  1.19k|                    {
 1542|  1.19k|                        int num_neigh = 0, pos_neigh = -1;
 1543|  3.98k|                        for (i1 = 0; i1 < at[i].valence; i1++)
  ------------------
  |  Branch (1543:38): [True: 2.79k, False: 1.19k]
  ------------------
 1544|  2.79k|                        {
 1545|  2.79k|                            n = at[i].neighbor[i1];
 1546|  2.79k|                            if (-1 == at[n].charge && 3 >= at[n].valence && 3 == at[n].chem_bonds_valence + NUMH(at, n) &&
  ------------------
  |  |   56|  3.55k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|    765|#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 (1546:33): [True: 789, False: 2.00k]
  |  Branch (1546:55): [True: 765, False: 24]
  |  Branch (1546:77): [True: 636, False: 129]
  ------------------
 1547|       |                                /*0 == at[n].num_H &&*/
 1548|    636|                                at[i].bond_type[i1] == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|  3.42k|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1548:33): [True: 19, False: 617]
  ------------------
 1549|     19|                                ion_el_group(at[n].el_number) == EL_NUMBER_C)
  ------------------
  |  |   13|     19|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (1549:33): [True: 18, False: 1]
  ------------------
 1550|     18|                            {
 1551|       |                                /* found N(+)(IV)-C(-)(III); prepare conversion to N(V)=C(IV) */
 1552|     18|                                num_neigh++;
 1553|     18|                                pos_neigh = i1;
 1554|     18|                            }
 1555|  2.79k|                        }
 1556|  1.19k|                        i1 = pos_neigh;
 1557|  1.19k|                        if (1 == num_neigh &&
  ------------------
  |  Branch (1557:29): [True: 18, False: 1.17k]
  ------------------
 1558|     18|                            at[i].bond_type[i1] <= BOND_TYPE_TRIPLE &&
  ------------------
  |  |   34|  1.20k|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1558:29): [True: 18, False: 0]
  ------------------
 1559|     18|                            !has_other_ion_neigh(at, i, n = at[i].neighbor[i1]) &&
  ------------------
  |  Branch (1559:29): [True: 15, False: 3]
  ------------------
 1560|     15|                            !has_other_ion_neigh(at, n, i))
  ------------------
  |  Branch (1560:29): [True: 12, False: 3]
  ------------------
 1561|     12|                        {
 1562|       |                            /*n = at[i].neighbor[i1=pos_neigh];*/
 1563|     12|                            i2 = (int)(is_in_the_list(at[n].neighbor, (AT_NUMB)i, at[n].valence) - at[n].neighbor);
 1564|     12|                            at[i].charge--;
 1565|     12|                            at[n].charge++;
 1566|     12|                            at[i].chem_bonds_valence++;
 1567|     12|                            at[n].chem_bonds_valence++;
 1568|     12|                            at[i].bond_type[i1]++;
 1569|     12|                            at[n].bond_type[i2]++;
 1570|     12|                            num_changes++;
 1571|     12|                            num_C_minus--;
 1572|     12|                            num_N_plus--;
 1573|     12|                            num_All -= 2;
 1574|     12|                            continue;
 1575|     12|                        }
 1576|  1.19k|                    }
 1577|  32.9k|                    if ((!type || 11 == type) && 0 < num_N_plus && 0 < num_C_minus)
  ------------------
  |  Branch (1577:26): [True: 0, False: 32.9k]
  |  Branch (1577:35): [True: 5.68k, False: 27.2k]
  |  Branch (1577:50): [True: 5.68k, False: 0]
  |  Branch (1577:68): [True: 1.17k, False: 4.50k]
  ------------------
 1578|  1.17k|                    {
 1579|  1.17k|                        int num_neigh = 0, pos_neigh = -1;
 1580|  3.94k|                        for (i1 = 0; i1 < at[i].valence; i1++)
  ------------------
  |  Branch (1580:38): [True: 2.76k, False: 1.17k]
  ------------------
 1581|  2.76k|                        {
 1582|  2.76k|                            n = at[i].neighbor[i1];
 1583|  2.76k|                            if (-1 == at[n].charge && 3 >= at[n].valence && 3 == at[n].chem_bonds_valence + NUMH(at, n) &&
  ------------------
  |  |   56|  3.51k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|    753|#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 (1583:33): [True: 777, False: 1.98k]
  |  Branch (1583:55): [True: 753, False: 24]
  |  Branch (1583:77): [True: 624, False: 129]
  ------------------
 1584|       |                                /*0 == at[n].num_H &&*/
 1585|    624|                                at[i].bond_type[i1] == BOND_TYPE_DOUBLE &&
  ------------------
  |  |   33|  3.38k|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (1585:33): [True: 53, False: 571]
  ------------------
 1586|     53|                                ion_el_group(at[n].el_number) == EL_NUMBER_C)
  ------------------
  |  |   13|     53|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (1586:33): [True: 52, False: 1]
  ------------------
 1587|     52|                            {
 1588|       |                                /* found N(+)(IV)=C(-)(III); prepare conversion to N(V)#C(IV) */
 1589|     52|                                num_neigh++;
 1590|     52|                                pos_neigh = i1;
 1591|     52|                            }
 1592|  2.76k|                        }
 1593|  1.17k|                        if (1 == num_neigh &&
  ------------------
  |  Branch (1593:29): [True: 52, False: 1.12k]
  ------------------
 1594|     52|                            !has_other_ion_neigh(at, i, n = at[i].neighbor[i1 = pos_neigh]) &&
  ------------------
  |  Branch (1594:29): [True: 39, False: 13]
  ------------------
 1595|     39|                            !has_other_ion_neigh(at, n, i))
  ------------------
  |  Branch (1595:29): [True: 35, False: 4]
  ------------------
 1596|     35|                        {
 1597|       |                            /*n = at[i].neighbor[i1=pos_neigh];*/
 1598|     35|                            i2 = (int)(is_in_the_list(at[n].neighbor, (AT_NUMB)i, at[n].valence) - at[n].neighbor);
 1599|     35|                            at[i].charge--;
 1600|     35|                            at[n].charge++;
 1601|     35|                            at[i].chem_bonds_valence++;
 1602|     35|                            at[n].chem_bonds_valence++;
 1603|     35|                            at[i].bond_type[i1]++;
 1604|     35|                            at[n].bond_type[i2]++;
 1605|     35|                            num_changes++;
 1606|     35|                            num_C_minus--;
 1607|     35|                            num_N_plus--;
 1608|     35|                            num_All -= 2;
 1609|     35|                            continue;
 1610|     35|                        }
 1611|  1.17k|                    }
 1612|  32.9k|                    if (!type || (12 == type && 0 < num_N_plus && 0 < num_N_minus)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1612:25): [True: 0, False: 32.9k]
  |  Branch (1612:35): [True: 5.64k, False: 27.2k]
  |  Branch (1612:49): [True: 5.64k, False: 0]
  |  Branch (1612:67): [True: 4.57k, False: 1.07k]
  ------------------
 1613|  4.57k|                    {
 1614|  4.57k|                        int num_neigh = 0, pos_neigh = -1;
 1615|  14.0k|                        for (i1 = 0; i1 < at[i].valence; i1++)
  ------------------
  |  Branch (1615:38): [True: 9.46k, False: 4.57k]
  ------------------
 1616|  9.46k|                        {
 1617|  9.46k|                            n = at[i].neighbor[i1];
 1618|  9.46k|                            if (-1 == at[n].charge && 2 >= nNoMetalNumBonds(at, n) &&
  ------------------
  |  Branch (1618:33): [True: 1.02k, False: 8.44k]
  |  Branch (1618:55): [True: 700, False: 324]
  ------------------
 1619|    700|                                2 == nNoMetalBondsValence(at, n) + NUMH(at, n) &&
  ------------------
  |  |   56|  10.1k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|    700|#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 (1619:33): [True: 409, False: 291]
  ------------------
 1620|       |                                /*0 == num_of_H( at, n ) &&*/
 1621|    409|                                at[i].bond_type[i1] == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|  9.87k|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1621:33): [True: 397, False: 12]
  ------------------
 1622|    397|                                ion_el_group(at[n].el_number) == EL_NUMBER_N)
  ------------------
  |  |   14|    397|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (1622:33): [True: 388, False: 9]
  ------------------
 1623|    388|                            {
 1624|       |                                /* found N(+)(IV)=N(-)(II); prepare conversion to N(V)#N(III) */
 1625|    388|                                num_neigh++;
 1626|    388|                                pos_neigh = i1;
 1627|    388|                            }
 1628|  9.46k|                        }
 1629|  4.57k|                        if (1 == num_neigh &&
  ------------------
  |  Branch (1629:29): [True: 380, False: 4.19k]
  ------------------
 1630|    380|                            !has_other_ion_neigh(at, i, n = at[i].neighbor[i1 = pos_neigh]) &&
  ------------------
  |  Branch (1630:29): [True: 357, False: 23]
  ------------------
 1631|    357|                            !has_other_ion_neigh(at, n, i))
  ------------------
  |  Branch (1631:29): [True: 333, False: 24]
  ------------------
 1632|    333|                        {
 1633|       |                            /*n = at[i].neighbor[i1=pos_neigh];*/
 1634|    333|                            i2 = (int)(is_in_the_list(at[n].neighbor, (AT_NUMB)i, at[n].valence) - at[n].neighbor);
 1635|    333|                            at[i].charge--;
 1636|    333|                            at[n].charge++;
 1637|    333|                            at[i].chem_bonds_valence++;
 1638|    333|                            at[n].chem_bonds_valence++;
 1639|    333|                            at[i].bond_type[i1]++;
 1640|    333|                            at[n].bond_type[i2]++;
 1641|    333|                            num_changes++;
 1642|    333|                            num_N_minus--;
 1643|    333|                            num_N_plus--;
 1644|    333|                            num_All -= 2;
 1645|    333|                            continue;
 1646|    333|                        }
 1647|  4.57k|                    }
 1648|  32.9k|                }
 1649|  1.03M|                else if (1 == at[i].charge &&
  ------------------
  |  Branch (1649:26): [True: 173k, False: 860k]
  ------------------
 1650|   173k|                         0 < num_O_plus && 0 < num_C_minus + num_N_minus &&
  ------------------
  |  Branch (1650:26): [True: 58.0k, False: 115k]
  |  Branch (1650:44): [True: 33.9k, False: 24.0k]
  ------------------
 1651|  33.9k|                         3 >= nNoMetalNumBonds(at, i) && 3 == nNoMetalBondsValence(at, i) &&
  ------------------
  |  Branch (1651:26): [True: 27.8k, False: 6.08k]
  |  Branch (1651:58): [True: 24.0k, False: 3.79k]
  ------------------
 1652|  24.0k|                         0 == num_of_H(at, i) &&
  ------------------
  |  Branch (1652:26): [True: 18.8k, False: 5.28k]
  ------------------
 1653|  18.8k|                         ion_el_group(at[i].el_number) == EL_NUMBER_O)
  ------------------
  |  |   15|  18.8k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (1653:26): [True: 14.4k, False: 4.39k]
  ------------------
 1654|  14.4k|                {
 1655|       |                    /* found non-terminal O(+)(III) */
 1656|  14.4k|                    if ((!type || 13 == type) && 0 < num_C_minus)
  ------------------
  |  Branch (1656:26): [True: 0, False: 14.4k]
  |  Branch (1656:35): [True: 2.45k, False: 11.9k]
  |  Branch (1656:50): [True: 1.93k, False: 524]
  ------------------
 1657|  1.93k|                    {
 1658|  1.93k|                        int num_neigh = 0, pos_neigh = -1;
 1659|  6.49k|                        for (i1 = 0; i1 < at[i].valence; i1++)
  ------------------
  |  Branch (1659:38): [True: 4.56k, False: 1.93k]
  ------------------
 1660|  4.56k|                        {
 1661|  4.56k|                            n = at[i].neighbor[i1];
 1662|  4.56k|                            if (-1 == at[n].charge && 3 >= at[n].valence && 3 == at[n].chem_bonds_valence + NUMH(at, n) &&
  ------------------
  |  |   56|  6.25k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  1.68k|#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 (1662:33): [True: 1.74k, False: 2.82k]
  |  Branch (1662:55): [True: 1.68k, False: 53]
  |  Branch (1662:77): [True: 915, False: 774]
  ------------------
 1663|       |                                /*0 == at[n].num_H &&*/
 1664|    915|                                at[i].bond_type[i1] == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|  5.47k|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1664:33): [True: 330, False: 585]
  ------------------
 1665|    330|                                ion_el_group(at[n].el_number) == EL_NUMBER_C)
  ------------------
  |  |   13|    330|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (1665:33): [True: 304, False: 26]
  ------------------
 1666|    304|                            {
 1667|       |                                /* found O(+)(III)-C(-)(II); prepare conversion to O(IV)=C(IV) */
 1668|    304|                                num_neigh++;
 1669|    304|                                pos_neigh = i1;
 1670|    304|                            }
 1671|  4.56k|                        }
 1672|  1.93k|                        if (1 == num_neigh &&
  ------------------
  |  Branch (1672:29): [True: 304, False: 1.62k]
  ------------------
 1673|    304|                            !has_other_ion_neigh(at, i, n = at[i].neighbor[i1 = pos_neigh]) &&
  ------------------
  |  Branch (1673:29): [True: 248, False: 56]
  ------------------
 1674|    248|                            !has_other_ion_neigh(at, n, i))
  ------------------
  |  Branch (1674:29): [True: 42, False: 206]
  ------------------
 1675|     42|                        {
 1676|       |                            /*n = at[i].neighbor[i1=pos_neigh];*/
 1677|     42|                            i2 = (int)(is_in_the_list(at[n].neighbor, (AT_NUMB)i, at[n].valence) - at[n].neighbor);
 1678|     42|                            at[i].charge--;
 1679|     42|                            at[n].charge++;
 1680|     42|                            at[i].chem_bonds_valence++;
 1681|     42|                            at[n].chem_bonds_valence++;
 1682|     42|                            at[i].bond_type[i1]++;
 1683|     42|                            at[n].bond_type[i2]++;
 1684|     42|                            num_changes++;
 1685|     42|                            num_C_minus--;
 1686|     42|                            num_O_plus--;
 1687|     42|                            num_All -= 2;
 1688|     42|                            continue;
 1689|     42|                        }
 1690|  1.93k|                    }
 1691|  14.3k|                    if ((!type || 14 == type) && 0 < num_C_minus)
  ------------------
  |  Branch (1691:26): [True: 0, False: 14.3k]
  |  Branch (1691:35): [True: 2.41k, False: 11.9k]
  |  Branch (1691:50): [True: 1.88k, False: 524]
  ------------------
 1692|  1.88k|                    {
 1693|  1.88k|                        int num_neigh = 0, pos_neigh = -1;
 1694|  6.32k|                        for (i1 = 0; i1 < at[i].valence; i1++)
  ------------------
  |  Branch (1694:38): [True: 4.43k, False: 1.88k]
  ------------------
 1695|  4.43k|                        {
 1696|  4.43k|                            n = at[i].neighbor[i1];
 1697|  4.43k|                            if (-1 == at[n].charge && 3 >= at[n].valence && 3 == at[n].chem_bonds_valence + NUMH(at, n) &&
  ------------------
  |  |   56|  6.08k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  1.64k|#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 (1697:33): [True: 1.70k, False: 2.73k]
  |  Branch (1697:55): [True: 1.64k, False: 53]
  |  Branch (1697:77): [True: 873, False: 774]
  ------------------
 1698|       |                                /*0 == at[n].num_H &&*/
 1699|    873|                                at[i].bond_type[i1] == BOND_TYPE_DOUBLE &&
  ------------------
  |  |   33|  5.31k|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (1699:33): [True: 583, False: 290]
  ------------------
 1700|    583|                                ion_el_group(at[n].el_number) == EL_NUMBER_C)
  ------------------
  |  |   13|    583|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (1700:33): [True: 580, False: 3]
  ------------------
 1701|    580|                            {
 1702|       |                                /* found O(+)(III)=C(-)(III); prepare conversion to O(IV)#C(IV) */
 1703|    580|                                num_neigh++;
 1704|    580|                                pos_neigh = i1;
 1705|    580|                            }
 1706|  4.43k|                        }
 1707|  1.88k|                        if (1 == num_neigh &&
  ------------------
  |  Branch (1707:29): [True: 580, False: 1.30k]
  ------------------
 1708|    580|                            !has_other_ion_neigh(at, i, n = at[i].neighbor[i1 = pos_neigh]) &&
  ------------------
  |  Branch (1708:29): [True: 426, False: 154]
  ------------------
 1709|    426|                            !has_other_ion_neigh(at, n, i))
  ------------------
  |  Branch (1709:29): [True: 226, False: 200]
  ------------------
 1710|    226|                        {
 1711|       |                            /*n = at[i].neighbor[i1=pos_neigh];*/
 1712|    226|                            i2 = (int)(is_in_the_list(at[n].neighbor, (AT_NUMB)i, at[n].valence) - at[n].neighbor);
 1713|    226|                            at[i].charge--;
 1714|    226|                            at[n].charge++;
 1715|    226|                            at[i].chem_bonds_valence++;
 1716|    226|                            at[n].chem_bonds_valence++;
 1717|    226|                            at[i].bond_type[i1]++;
 1718|    226|                            at[n].bond_type[i2]++;
 1719|    226|                            num_changes++;
 1720|    226|                            num_C_minus--;
 1721|    226|                            num_O_plus--;
 1722|    226|                            num_All -= 2;
 1723|    226|                            continue;
 1724|    226|                        }
 1725|  1.88k|                    }
 1726|  14.1k|                    if ((!type || 15 == type) && 0 < num_N_minus)
  ------------------
  |  Branch (1726:26): [True: 0, False: 14.1k]
  |  Branch (1726:35): [True: 2.18k, False: 11.9k]
  |  Branch (1726:50): [True: 833, False: 1.35k]
  ------------------
 1727|    833|                    {
 1728|    833|                        int num_neigh = 0, pos_neigh = -1;
 1729|  2.70k|                        for (i1 = 0; i1 < at[i].valence; i1++)
  ------------------
  |  Branch (1729:38): [True: 1.87k, False: 833]
  ------------------
 1730|  1.87k|                        {
 1731|  1.87k|                            n = at[i].neighbor[i1];
 1732|  1.87k|                            if (-1 == at[n].charge && 2 >= nNoMetalNumBonds(at, n) &&
  ------------------
  |  Branch (1732:33): [True: 957, False: 914]
  |  Branch (1732:55): [True: 901, False: 56]
  ------------------
 1733|    901|                                2 == nNoMetalBondsValence(at, n) + NUMH(at, n) &&
  ------------------
  |  |   56|  2.77k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|    901|#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 (1733:33): [True: 595, False: 306]
  ------------------
 1734|       |                                /*0 == num_of_H( at, n ) &&*/
 1735|    595|                                at[i].bond_type[i1] == BOND_TYPE_SINGLE &&
  ------------------
  |  |   32|  2.46k|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1735:33): [True: 503, False: 92]
  ------------------
 1736|    503|                                ion_el_group(at[n].el_number) == EL_NUMBER_N)
  ------------------
  |  |   14|    503|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (1736:33): [True: 474, False: 29]
  ------------------
 1737|    474|                            {
 1738|       |                                /* found O(+)(III)=N(-)(II); prepare conversion to O(IV)#N(III) */
 1739|    474|                                num_neigh++;
 1740|    474|                                pos_neigh = i1;
 1741|    474|                            }
 1742|  1.87k|                        }
 1743|    833|                        if (1 == num_neigh &&
  ------------------
  |  Branch (1743:29): [True: 474, False: 359]
  ------------------
 1744|    474|                            !has_other_ion_neigh(at, i, n = at[i].neighbor[i1 = pos_neigh]) &&
  ------------------
  |  Branch (1744:29): [True: 320, False: 154]
  ------------------
 1745|    320|                            !has_other_ion_neigh(at, n, i))
  ------------------
  |  Branch (1745:29): [True: 258, False: 62]
  ------------------
 1746|    258|                        {
 1747|       |                            /*n = at[i].neighbor[i1=pos_neigh];*/
 1748|    258|                            i2 = (int)(is_in_the_list(at[n].neighbor, (AT_NUMB)i, at[n].valence) - at[n].neighbor);
 1749|    258|                            at[i].charge--;
 1750|    258|                            at[n].charge++;
 1751|    258|                            at[i].chem_bonds_valence++;
 1752|    258|                            at[n].chem_bonds_valence++;
 1753|    258|                            at[i].bond_type[i1]++;
 1754|    258|                            at[n].bond_type[i2]++;
 1755|    258|                            num_changes++;
 1756|    258|                            num_N_minus--;
 1757|    258|                            num_O_plus--;
 1758|    258|                            num_All -= 2;
 1759|    258|                            continue;
 1760|    258|                        }
 1761|    833|                    }
 1762|  14.1k|                }
 1763|  1.06M|            }
 1764|   196k|        }
 1765|       |
 1766|       |        /**************************************************************************/
 1767|       |        /*********************** NON-Terminal ion triples *************************/
 1768|       |        /**************************************************************************/
 1769|       |        /*-------------------------------------------------------------------------
 1770|       |        Non-Terminal triple types: 16, 17, 18   N=N,P,As,Sb; O=O,S,Se,Te; C=C,Si
 1771|       |        ========================================
 1772|       |        16: C(+)(III)-O-N(-)(II)  => C(IV)=O=N(III)  (allow terminal H on N(-))
 1773|       |        |                     |
 1774|       |        17: C(+)(III)-N-C(-)(III)  => C(IV)=N=C(IV)
 1775|       |
 1776|       |        18: C(-)(III)-N=C(+)(III)  => C(IV)=N#C(IV)   (may have two or no charges)
 1777|       |        C(IV)=N-C(II)          => C(IV)=N#C(IV)
 1778|       |
 1779|       |        */
 1780|       |
 1781|   589k|        if ((!type || 16 == type) && 0 < num_C_plus && 0 < num_N_minus)
  ------------------
  |  Branch (1781:14): [True: 0, False: 589k]
  |  Branch (1781:23): [True: 32.7k, False: 556k]
  |  Branch (1781:38): [True: 7.80k, False: 24.9k]
  |  Branch (1781:56): [True: 3.20k, False: 4.60k]
  ------------------
 1782|  3.20k|        {
 1783|  3.20k|            int m[2], j[2], k;
 1784|  21.4k|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1784:25): [True: 18.2k, False: 3.20k]
  ------------------
 1785|  18.2k|            {
 1786|  18.2k|                if (0 == at[i].charge && 2 == nNoMetalNumBonds(at, i) && 2 == nNoMetalBondsValence(at, i) &&
  ------------------
  |  Branch (1786:21): [True: 9.27k, False: 9.00k]
  |  Branch (1786:42): [True: 3.67k, False: 5.59k]
  |  Branch (1786:74): [True: 1.56k, False: 2.10k]
  ------------------
 1787|  1.56k|                    0 == num_of_H(at, i) &&
  ------------------
  |  Branch (1787:21): [True: 1.42k, False: 140]
  ------------------
 1788|  1.42k|                    0 <= (j[0] = nNoMetalNeighIndex(at, i)) &&
  ------------------
  |  Branch (1788:21): [True: 1.33k, False: 92]
  ------------------
 1789|  1.33k|                    at[m[0] = at[i].neighbor[j[0]]].charge &&
  ------------------
  |  Branch (1789:21): [True: 1.11k, False: 220]
  ------------------
 1790|  1.11k|                    0 <= (j[1] = nNoMetalOtherNeighIndex(at, i, m[0])) &&
  ------------------
  |  Branch (1790:21): [True: 864, False: 248]
  ------------------
 1791|    864|                    0 == at[m[0]].charge + at[m[1] = at[i].neighbor[j[1]]].charge &&
  ------------------
  |  Branch (1791:21): [True: 543, False: 321]
  ------------------
 1792|    543|                    5 >= nNoMetalBondsValence(at, m[0]) + nNoMetalBondsValence(at, m[1]) &&
  ------------------
  |  Branch (1792:21): [True: 276, False: 267]
  ------------------
 1793|       |                    /*5 >= at[m[0]].chem_bonds_valence + at[m[1]].chem_bonds_valence &&*/
 1794|    276|                    ion_el_group(at[i].el_number) == EL_NUMBER_O)
  ------------------
  |  |   15|    276|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (1794:21): [True: 57, False: 219]
  ------------------
 1795|     57|                {
 1796|       |                    /* found non-terminal A(+)-O-B(-); chem_bond_val of A+B <= 5 */
 1797|     57|                    int n_N = -1, n_C = -1, i_C = -1;
 1798|    171|                    for (k = 0; k < 2; k++)
  ------------------
  |  Branch (1798:33): [True: 114, False: 57]
  ------------------
 1799|    114|                    {
 1800|    114|                        n = m[k];
 1801|    114|                        if (-1 == at[n].charge && 2 == nNoMetalNumBonds(at, n) + NUMH(at, n) &&
  ------------------
  |  |   56|    171|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|     57|#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 (1801:29): [True: 57, False: 57]
  |  Branch (1801:51): [True: 23, False: 34]
  ------------------
 1802|       |                            /*0 == num_of_H( at, n ) &&*/
 1803|     23|                            ion_el_group(at[n].el_number) == EL_NUMBER_N)
  ------------------
  |  |   14|     23|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (1803:29): [True: 22, False: 1]
  ------------------
 1804|     22|                        {
 1805|     22|                            n_N = n;
 1806|     22|                        }
 1807|     92|                        else if (1 == at[n].charge && 3 == at[n].chem_bonds_valence + NUMH(at, n) &&
  ------------------
  |  |   56|    149|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|     57|#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 (1807:34): [True: 57, False: 35]
  |  Branch (1807:55): [True: 42, False: 15]
  ------------------
 1808|     42|                                 ion_el_group(at[n].el_number) == EL_NUMBER_C)
  ------------------
  |  |   13|     42|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (1808:34): [True: 19, False: 23]
  ------------------
 1809|     19|                        {
 1810|     19|                            n_C = n;
 1811|     19|                            i_C = k;
 1812|     19|                        }
 1813|    114|                    }
 1814|     57|                    if (n_C < 0 || n_N < 0 ||
  ------------------
  |  Branch (1814:25): [True: 38, False: 19]
  |  Branch (1814:36): [True: 3, False: 16]
  ------------------
 1815|     16|                        has_other_ion_in_sphere_2(at, n_C, n_N) ||
  ------------------
  |  Branch (1815:25): [True: 6, False: 10]
  ------------------
 1816|     10|                        has_other_ion_in_sphere_2(at, n_N, n_C))
  ------------------
  |  Branch (1816:25): [True: 0, False: 10]
  ------------------
 1817|     47|                    {
 1818|     47|                        continue;
 1819|     47|                    }
 1820|       |
 1821|       |                    /* C(+)(III)-O-N(-)(II)  => C(IV)=O=N(III) */
 1822|     30|                    for (k = 0; k < 2; k++)
  ------------------
  |  Branch (1822:33): [True: 20, False: 10]
  ------------------
 1823|     20|                    {
 1824|     20|                        n = k ? n_C : n_N;
  ------------------
  |  Branch (1824:29): [True: 10, False: 10]
  ------------------
 1825|     20|                        i1 = k ? j[i_C] : j[1 - i_C];
  ------------------
  |  Branch (1825:30): [True: 10, False: 10]
  ------------------
 1826|     20|                        i2 = (int)(is_in_the_list(at[n].neighbor, (AT_NUMB)i, at[n].valence) - at[n].neighbor);
 1827|     20|                        at[i].bond_type[i1]++;
 1828|     20|                        at[n].bond_type[i2]++;
 1829|     20|                        at[i].chem_bonds_valence++;
 1830|     20|                        at[n].chem_bonds_valence++;
 1831|     20|                        at[n].charge += (k ? -1 : 1);
  ------------------
  |  Branch (1831:42): [True: 10, False: 10]
  ------------------
 1832|     20|                    }
 1833|     10|                    num_changes++;
 1834|     10|                    num_N_minus--;
 1835|     10|                    num_C_plus--;
 1836|     10|                    num_All -= 2;
 1837|     10|                }
 1838|  18.2k|            }
 1839|  3.20k|        }
 1840|       |
 1841|   589k|        if ((!type || 17 == type) && 0 < num_C_plus && 0 < num_C_minus)
  ------------------
  |  Branch (1841:14): [True: 0, False: 589k]
  |  Branch (1841:23): [True: 32.7k, False: 556k]
  |  Branch (1841:38): [True: 7.79k, False: 24.9k]
  |  Branch (1841:56): [True: 2.18k, False: 5.60k]
  ------------------
 1842|  2.18k|        {
 1843|  2.18k|            int m[3], c[3], j[3], k;
 1844|  14.4k|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1844:25): [True: 12.2k, False: 2.18k]
  ------------------
 1845|  12.2k|            {
 1846|  12.2k|                if (0 == at[i].charge && 3 == nNoMetalNumBonds(at, i) && 3 == nNoMetalBondsValence(at, i) &&
  ------------------
  |  Branch (1846:21): [True: 5.91k, False: 6.29k]
  |  Branch (1846:42): [True: 1.70k, False: 4.20k]
  |  Branch (1846:74): [True: 770, False: 937]
  ------------------
 1847|    770|                    0 == num_of_H(at, i) &&
  ------------------
  |  Branch (1847:21): [True: 658, False: 112]
  ------------------
 1848|    658|                    0 <= (j[0] = nNoMetalNeighIndex(at, i)) &&
  ------------------
  |  Branch (1848:21): [True: 657, False: 1]
  ------------------
 1849|    657|                    0 <= (j[1] = nNoMetalOtherNeighIndex(at, i, m[0] = at[i].neighbor[j[0]])) &&
  ------------------
  |  Branch (1849:21): [True: 650, False: 7]
  ------------------
 1850|    650|                    0 <= (j[2] = nNoMetalOtherNeighIndex2(at, i, m[0], m[1] = at[i].neighbor[j[1]])) &&
  ------------------
  |  Branch (1850:21): [True: 501, False: 149]
  ------------------
 1851|    501|                    1 == !(c[0] = at[m[0]].charge) + !(c[1] = at[m[1]].charge) + !(c[2] = at[m[2] = at[i].neighbor[j[2]]].charge) &&
  ------------------
  |  Branch (1851:21): [True: 183, False: 318]
  ------------------
 1852|    183|                    0 == c[0] + c[1] + c[2] &&
  ------------------
  |  Branch (1852:21): [True: 182, False: 1]
  ------------------
 1853|    182|                    2 == (3 == (c[0] ? at[m[0]].chem_bonds_valence + NUMH(at, m[0]) : 0)) + (3 == (c[1] ? at[m[1]].chem_bonds_valence + NUMH(at, m[1]) : 0)) + (3 == (c[2] ? at[m[2]].chem_bonds_valence + NUMH(at, m[2]) : 0)) &&
  ------------------
  |  |   56|    113|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|    113|#define NUM_ISO_H(AT, N) (AT[N].num_iso_H[0] + AT[N].num_iso_H[1] + AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
                                  2 == (3 == (c[0] ? at[m[0]].chem_bonds_valence + NUMH(at, m[0]) : 0)) + (3 == (c[1] ? at[m[1]].chem_bonds_valence + NUMH(at, m[1]) : 0)) + (3 == (c[2] ? at[m[2]].chem_bonds_valence + NUMH(at, m[2]) : 0)) &&
  ------------------
  |  |   56|    167|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|    167|#define NUM_ISO_H(AT, N) (AT[N].num_iso_H[0] + AT[N].num_iso_H[1] + AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
                                  2 == (3 == (c[0] ? at[m[0]].chem_bonds_valence + NUMH(at, m[0]) : 0)) + (3 == (c[1] ? at[m[1]].chem_bonds_valence + NUMH(at, m[1]) : 0)) + (3 == (c[2] ? at[m[2]].chem_bonds_valence + NUMH(at, m[2]) : 0)) &&
  ------------------
  |  |   56|     84|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|     84|#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 (1853:21): [True: 11, False: 171]
  |  Branch (1853:33): [True: 113, False: 69]
  |  Branch (1853:100): [True: 167, False: 15]
  |  Branch (1853:167): [True: 84, False: 98]
  ------------------
 1854|     11|                    ion_el_group(at[i].el_number) == EL_NUMBER_N)
  ------------------
  |  |   14|     11|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (1854:21): [True: 0, False: 11]
  ------------------
 1855|      0|                {
 1856|       |                    /* found non-terminal A(+)-O-B(-) */
 1857|      0|                    int n_Cp = -1, n_Cm = -1, i_Cp = -1, i_Cm = -1; /* p = positive, m = negatice ion C */
 1858|      0|                    for (k = 0; k < 3; k++)
  ------------------
  |  Branch (1858:33): [True: 0, False: 0]
  ------------------
 1859|      0|                    {
 1860|      0|                        if (c[k])
  ------------------
  |  Branch (1860:29): [True: 0, False: 0]
  ------------------
 1861|      0|                        {
 1862|      0|                            n = m[k];
 1863|      0|                            if (-1 == at[n].charge &&
  ------------------
  |  Branch (1863:33): [True: 0, False: 0]
  ------------------
 1864|      0|                                ion_el_group(at[n].el_number) == EL_NUMBER_C)
  ------------------
  |  |   13|      0|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (1864:33): [True: 0, False: 0]
  ------------------
 1865|      0|                            {
 1866|      0|                                n_Cm = n;
 1867|      0|                                i_Cm = k;
 1868|      0|                            }
 1869|      0|                            else if (1 == at[n].charge &&
  ------------------
  |  Branch (1869:38): [True: 0, False: 0]
  ------------------
 1870|      0|                                     ion_el_group(at[n].el_number) == EL_NUMBER_C)
  ------------------
  |  |   13|      0|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (1870:38): [True: 0, False: 0]
  ------------------
 1871|      0|                            {
 1872|      0|                                n_Cp = n;
 1873|      0|                                i_Cp = k;
 1874|      0|                            }
 1875|      0|                        }
 1876|      0|                    }
 1877|      0|                    if (n_Cp < 0 || n_Cm < 0 ||
  ------------------
  |  Branch (1877:25): [True: 0, False: 0]
  |  Branch (1877:37): [True: 0, False: 0]
  ------------------
 1878|      0|                        has_other_ion_in_sphere_2(at, n_Cp, n_Cm) ||
  ------------------
  |  Branch (1878:25): [True: 0, False: 0]
  ------------------
 1879|      0|                        has_other_ion_in_sphere_2(at, n_Cm, n_Cp))
  ------------------
  |  Branch (1879:25): [True: 0, False: 0]
  ------------------
 1880|      0|                    {
 1881|      0|                        continue;
 1882|      0|                    }
 1883|       |
 1884|       |                    /*           |                     |       */
 1885|       |                    /* C(+)(III)-N-C(-)(III)  => C(IV)=N=C(IV) */
 1886|      0|                    for (k = 0; k < 2; k++)
  ------------------
  |  Branch (1886:33): [True: 0, False: 0]
  ------------------
 1887|      0|                    {
 1888|      0|                        n = k ? n_Cp : n_Cm;
  ------------------
  |  Branch (1888:29): [True: 0, False: 0]
  ------------------
 1889|      0|                        i1 = k ? j[i_Cp] : j[i_Cm];
  ------------------
  |  Branch (1889:30): [True: 0, False: 0]
  ------------------
 1890|      0|                        i2 = (int)(is_in_the_list(at[n].neighbor, (AT_NUMB)i, at[n].valence) - at[n].neighbor);
 1891|      0|                        at[i].bond_type[i1]++;
 1892|      0|                        at[n].bond_type[i2]++;
 1893|      0|                        at[i].chem_bonds_valence++;
 1894|      0|                        at[n].chem_bonds_valence++;
 1895|      0|                        at[n].charge += (k ? -1 : 1);
  ------------------
  |  Branch (1895:42): [True: 0, False: 0]
  ------------------
 1896|      0|                    }
 1897|      0|                    num_changes++;
 1898|      0|                    num_C_minus--;
 1899|      0|                    num_C_plus--;
 1900|      0|                    num_All -= 2;
 1901|      0|                }
 1902|  12.2k|            }
 1903|  2.18k|        }
 1904|       |
 1905|   589k|        if ((!type || 18 == type) && ((0 < num_C_plus && 0 < num_C_minus) || 0 < num_C_II)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (1905:14): [True: 0, False: 589k]
  |  Branch (1905:23): [True: 32.7k, False: 556k]
  |  Branch (1905:40): [True: 7.79k, False: 24.9k]
  |  Branch (1905:58): [True: 2.18k, False: 5.60k]
  |  Branch (1905:78): [True: 1.52k, False: 29.0k]
  ------------------
 1906|  3.71k|        {
 1907|  3.71k|            int m[2], v[2], j[2], k;
 1908|  23.7k|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1908:25): [True: 20.0k, False: 3.71k]
  ------------------
 1909|  20.0k|            {
 1910|  20.0k|                if (0 == at[i].charge && 2 == nNoMetalNumBonds(at, i) && 3 == nNoMetalBondsValence(at, i) &&
  ------------------
  |  Branch (1910:21): [True: 12.7k, False: 7.26k]
  |  Branch (1910:42): [True: 4.21k, False: 8.56k]
  |  Branch (1910:74): [True: 2.07k, False: 2.14k]
  ------------------
 1911|  2.07k|                    0 == num_of_H(at, i) &&
  ------------------
  |  Branch (1911:21): [True: 2.03k, False: 44]
  ------------------
 1912|  2.03k|                    0 <= (j[0] = nNoMetalNeighIndex(at, i)) &&
  ------------------
  |  Branch (1912:21): [True: 1.93k, False: 97]
  ------------------
 1913|  1.93k|                    0 <= (j[1] = nNoMetalOtherNeighIndex(at, i, m[0] = at[i].neighbor[j[0]])) &&
  ------------------
  |  Branch (1913:21): [True: 1.58k, False: 352]
  ------------------
 1914|  1.58k|                    0 == at[m[0]].charge + at[m[1] = at[i].neighbor[j[1]]].charge &&
  ------------------
  |  Branch (1914:21): [True: 1.42k, False: 160]
  ------------------
 1915|  1.42k|                    6 == (v[0] = at[m[0]].chem_bonds_valence + NUMH(at, m[0])) + (v[1] = at[m[1]].chem_bonds_valence + NUMH(at, m[1])) &&
  ------------------
  |  |   56|  1.42k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  1.42k|#define NUM_ISO_H(AT, N) (AT[N].num_iso_H[0] + AT[N].num_iso_H[1] + AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
                                  6 == (v[0] = at[m[0]].chem_bonds_valence + NUMH(at, m[0])) + (v[1] = at[m[1]].chem_bonds_valence + NUMH(at, m[1])) &&
  ------------------
  |  |   56|  1.42k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  1.42k|#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 (1915:21): [True: 167, False: 1.25k]
  ------------------
 1916|    167|                    2 >= abs(v[0] - v[1]) &&
  ------------------
  |  Branch (1916:21): [True: 166, False: 1]
  ------------------
 1917|    166|                    ion_el_group(at[i].el_number) == EL_NUMBER_N &&
  ------------------
  |  |   14|  20.2k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (1917:21): [True: 83, False: 83]
  ------------------
 1918|     83|                    ion_el_group(at[m[0]].el_number) == EL_NUMBER_C &&
  ------------------
  |  |   13|  20.1k|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (1918:21): [True: 39, False: 44]
  ------------------
 1919|     39|                    ion_el_group(at[m[1]].el_number) == EL_NUMBER_C)
  ------------------
  |  |   13|     39|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (1919:21): [True: 6, False: 33]
  ------------------
 1920|      6|                {
 1921|       |                    /*                    n_Cm      i n_Cp */
 1922|       |                    /* found non-terminal C(-)(III)-N=C(+)(III) or C(IV)=N-C(II): Cm-N-Cp */
 1923|       |                    /* convert to C(IV)=N#C(IV) */
 1924|      6|                    int n_Cp = -1, n_Cm = -1, i_Cp = -1, i_Cm = -1; /* p = positive, m = negatice ion C */
 1925|     18|                    for (k = 0; k < 2; k++)
  ------------------
  |  Branch (1925:33): [True: 12, False: 6]
  ------------------
 1926|     12|                    {
 1927|     12|                        n = m[k];
 1928|     12|                        if (v[k] == 4 || (v[k] == 3 && at[i].bond_type[j[k]] == BOND_TYPE_SINGLE)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   32|      4|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1928:29): [True: 4, False: 8]
  |  Branch (1928:43): [True: 4, False: 4]
  |  Branch (1928:56): [True: 2, False: 2]
  ------------------
 1929|      6|                        {
 1930|      6|                            n_Cm = n;
 1931|      6|                            i_Cm = k;
 1932|      6|                        }
 1933|      6|                        else if (v[k] == 2 || (v[k] == 3 && at[i].bond_type[j[k]] == BOND_TYPE_DOUBLE)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   33|      2|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (1933:34): [True: 4, False: 2]
  |  Branch (1933:48): [True: 2, False: 0]
  |  Branch (1933:61): [True: 2, False: 0]
  ------------------
 1934|      6|                        {
 1935|      6|                            n_Cp = n;
 1936|      6|                            i_Cp = k;
 1937|      6|                        }
 1938|     12|                    }
 1939|      6|                    if (n_Cp < 0 || n_Cm < 0 || at[n_Cp].valence + NUMH(at, n_Cp) != 2)
  ------------------
  |  |   56|      6|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|      6|#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 (1939:25): [True: 0, False: 6]
  |  Branch (1939:37): [True: 0, False: 6]
  |  Branch (1939:49): [True: 4, False: 2]
  ------------------
 1940|      4|                    {
 1941|      4|                        continue; /* guarantees at[n_Cp].valence <= 2 */
 1942|      4|                    }
 1943|      2|                    if (v[i_Cp] == 2 || !at[n_Cp].charge)
  ------------------
  |  Branch (1943:25): [True: 0, False: 2]
  |  Branch (1943:41): [True: 0, False: 2]
  ------------------
 1944|      0|                    {
 1945|      0|                        if (at[n_Cp].valence == 2)
  ------------------
  |  Branch (1945:29): [True: 0, False: 0]
  ------------------
 1946|      0|                        {
 1947|       |                            /* neighbor of at[n_Cp] opposite to at[i] */
 1948|      0|                            k = at[n_Cp].neighbor[at[n_Cp].neighbor[0] == i];
 1949|      0|                            if (ion_el_group(at[k].el_number) == EL_NUMBER_N)
  ------------------
  |  |   14|      0|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (1949:33): [True: 0, False: 0]
  ------------------
 1950|      0|                            {
 1951|      0|                                continue;
 1952|      0|                            }
 1953|      0|                        }
 1954|      0|                    }
 1955|      2|                    else if (at[n_Cp].charge)
  ------------------
  |  Branch (1955:30): [True: 2, False: 0]
  ------------------
 1956|      2|                    {
 1957|      2|                        if (has_other_ion_in_sphere_2(at, n_Cp, n_Cm) ||
  ------------------
  |  Branch (1957:29): [True: 0, False: 2]
  ------------------
 1958|      2|                            has_other_ion_in_sphere_2(at, n_Cm, n_Cp))
  ------------------
  |  Branch (1958:29): [True: 0, False: 2]
  ------------------
 1959|      0|                        {
 1960|      0|                            continue;
 1961|      0|                        }
 1962|      2|                    }
 1963|      0|                    else
 1964|      0|                    {
 1965|      0|                        continue; /* unknown case */
 1966|      0|                    }
 1967|       |
 1968|       |                    /*                                         */
 1969|       |                    /* C(-)(III)-N=C(+)(III)  => C(IV)=N#C(IV) */
 1970|       |                    /* C(IV)=N-C(II)          => C(IV)=N#C(IV) */
 1971|      2|                    if (at[n_Cp].charge)
  ------------------
  |  Branch (1971:25): [True: 2, False: 0]
  ------------------
 1972|      2|                    {
 1973|      2|                        num_C_minus--;
 1974|      2|                        num_C_plus--;
 1975|      2|                        num_All -= 2;
 1976|      2|                    }
 1977|      0|                    else
 1978|      0|                    {
 1979|      0|                        num_C_II--;
 1980|      0|                        num_All--;
 1981|      0|                    }
 1982|       |
 1983|      6|                    for (k = 0; k < 2; k++)
  ------------------
  |  Branch (1983:33): [True: 4, False: 2]
  ------------------
 1984|      4|                    {
 1985|      4|                        n = k ? n_Cp : n_Cm;
  ------------------
  |  Branch (1985:29): [True: 2, False: 2]
  ------------------
 1986|      4|                        i3 = k ? i_Cp : i_Cm;          /* added to fix the bug */
  ------------------
  |  Branch (1986:30): [True: 2, False: 2]
  ------------------
 1987|       |                        /*i1 = k? j[i_Cp] : j[i_Cm];*/ /* replaced with next line */
 1988|      4|                        i1 = j[i3];
 1989|      4|                        if (v[i3 /*was i1*/] < 4)
  ------------------
  |  Branch (1989:29): [True: 4, False: 0]
  ------------------
 1990|      4|                        {
 1991|       |                            /* WDI found a bug here: bounds violation */
 1992|      4|                            int delta = 4 - v[i3 /*was i1*/];
 1993|      4|                            i2 = (int)(is_in_the_list(at[n].neighbor, (AT_NUMB)i, at[n].valence) - at[n].neighbor);
 1994|      4|                            at[i].bond_type[i1] += delta;
 1995|      4|                            at[n].bond_type[i2] += delta;
 1996|      4|                            at[i].chem_bonds_valence += delta;
 1997|      4|                            at[n].chem_bonds_valence += delta;
 1998|      4|                            at[n].charge = 0;
 1999|      4|                            at[n].radical = 0;
 2000|      4|                        }
 2001|      4|                    }
 2002|      2|                    at[i].charge = 0;
 2003|      2|                    at[i].radical = 0;
 2004|      2|                    num_changes++;
 2005|      2|                }
 2006|  20.0k|            }
 2007|  3.71k|        }
 2008|   589k|    }
 2009|       |
 2010|  32.7k|    return num_changes;
 2011|   216k|}
RemoveInpAtBond:
 2017|  2.24k|{
 2018|  2.24k|    int i, j, m, m2; /* djb-rwth: removing redundant variables */
 2019|  2.24k|    inp_ATOM *at = atom + iat;
 2020|  2.24k|    inp_ATOM *at2 = NULL;
 2021|  2.24k|    int val = at->valence - 1;
 2022|       |
 2023|  2.24k|    if (val >= 0)
  ------------------
  |  Branch (2023:9): [True: 2.24k, False: 0]
  ------------------
 2024|  2.24k|    {
 2025|  2.24k|        int bond = at->bond_type[k];
 2026|  2.24k|        if (bond > BOND_TYPE_TRIPLE)
  ------------------
  |  |   34|  2.24k|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (2026:13): [True: 0, False: 2.24k]
  ------------------
 2027|      0|            bond = BOND_TYPE_SINGLE; /* added 08-06-2003 */
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
 2028|       |
 2029|       |        /* update CML tetrahedral atom parity. */
 2030|  2.24k|        if (at->p_parity)
  ------------------
  |  Branch (2030:13): [True: 13, False: 2.22k]
  ------------------
 2031|     13|        {
 2032|     45|            for (m = 0; m < MAX_NUM_STEREO_ATOM_NEIGH; m++)
  ------------------
  |  |  877|     45|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (2032:25): [True: 37, False: 8]
  ------------------
 2033|     37|            {
 2034|     37|                if (at->p_orig_at_num[m] == at->orig_at_number)
  ------------------
  |  Branch (2034:21): [True: 5, False: 32]
  ------------------
 2035|      5|                {
 2036|      5|                    at->p_parity = 0;
 2037|      5|                    break; /* only 3 bonds are present; removing one bond removes stereo */
 2038|      5|                }
 2039|     37|            }
 2040|     13|            if (at->p_parity /* at->valence == MAX_NUM_STEREO_ATOM_NEIGH*/)
  ------------------
  |  Branch (2040:17): [True: 8, False: 5]
  ------------------
 2041|      8|            {
 2042|       |                /* p_orig_at_num is a fixed size array of MAX_NUM_STEREO_ATOM_NEIGH (4) elements */
 2043|     18|                for (m = 0; m < at->valence && m < MAX_NUM_STEREO_ATOM_NEIGH; m++) /* djb-rwth: fixing GH PR #72 */
  ------------------
  |  |  877|     18|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (2043:29): [True: 18, False: 0]
  |  Branch (2043:48): [True: 18, False: 0]
  ------------------
 2044|     18|                {
 2045|     18|                    if (atom[(int)at->neighbor[k]].orig_at_number == at->p_orig_at_num[m])
  ------------------
  |  Branch (2045:25): [True: 8, False: 10]
  ------------------
 2046|      8|                    {
 2047|      8|                        break;
 2048|      8|                    }
 2049|     18|                }
 2050|      8|                if (m < at->valence && m < MAX_NUM_STEREO_ATOM_NEIGH) /* djb-rwth: fixing GH PR #72 */
  ------------------
  |  |  877|      8|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (2050:21): [True: 8, False: 0]
  |  Branch (2050:40): [True: 8, False: 0]
  ------------------
 2051|      8|                {
 2052|      8|                    at->p_orig_at_num[m] = at->orig_at_number;
 2053|      8|                }
 2054|      0|                else
 2055|      0|                {
 2056|      0|                    at->p_parity = 0; /* wrong neighbors: at->neighbor[k] is not in the list of a stereo neighbors */
 2057|      0|                }
 2058|      8|            }
 2059|     13|        }
 2060|       |
 2061|       |        /* update CML stereogenic bond parities; at this point no removed explicit H exist yet */
 2062|  2.24k|        if (at->sb_parity[0])
  ------------------
  |  Branch (2062:13): [True: 15, False: 2.22k]
  ------------------
 2063|     15|        {
 2064|     34|            for (m = 0; m < MAX_NUM_STEREO_BONDS && at->sb_parity[m];)
  ------------------
  |  |  873|     68|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2064:25): [True: 34, False: 0]
  |  Branch (2064:53): [True: 19, False: 15]
  ------------------
 2065|     19|            {
 2066|     19|                if (k == at->sb_ord[m] || (k == at->sn_ord[m] && val < 2 && ATOM_PARITY_WELL_DEF(at->sb_parity[m]))) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  259|      5|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      5|#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)
  |  |  ------------------
  |  |  |  |  236|      5|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 5, False: 0]
  |  |  |  Branch (259:75): [True: 3, False: 2]
  |  |  ------------------
  ------------------
  |  Branch (2066:21): [True: 4, False: 15]
  |  Branch (2066:44): [True: 13, False: 2]
  |  Branch (2066:66): [True: 5, False: 8]
  ------------------
 2067|      7|                {
 2068|       |                    /* !!! FLAW: does take into account removed H !!! */
 2069|       |                    /* stereogenic bond is being removed OR */
 2070|       |                    /* remove stereogenic bond because its only neighbor is being removed */
 2071|      7|                    int pnxt_atom, pinxt2cur, pinxt_sb_parity_ord;
 2072|      7|                    int len = get_opposite_sb_atom(atom, iat, at->sb_ord[m], &pnxt_atom, &pinxt2cur, &pinxt_sb_parity_ord);
 2073|      7|                    if (len)
  ------------------
  |  Branch (2073:25): [True: 7, False: 0]
  ------------------
 2074|      7|                    {
 2075|      7|                        i = pinxt_sb_parity_ord;
 2076|      7|                        at2 = atom + pnxt_atom;
 2077|       |                        /* djb-rwth: removing redundant code */
 2078|      7|                    }
 2079|      0|                    else
 2080|      0|                    {
 2081|      0|                        i = MAX_NUM_STEREO_BONDS;
  ------------------
  |  |  873|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
 2082|      0|                    }
 2083|       |                    /*
 2084|       |                    at2 = atom + at->neighbor[ (int)at->sb_ord[m] ];
 2085|       |                    for ( i = 0; i < MAX_NUM_STEREO_BONDS && at2->sb_parity[i]; i ++ )
 2086|       |                    {
 2087|       |                    if ( iat == at2->neighbor[ (int)at2->sb_ord[i] ] )
 2088|       |                    break;
 2089|       |                    }
 2090|       |                    */
 2091|      7|                    if (i < MAX_NUM_STEREO_BONDS && at2->sb_parity[i])
  ------------------
  |  |  873|     14|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2091:25): [True: 7, False: 0]
  |  Branch (2091:53): [True: 7, False: 0]
  ------------------
 2092|      7|                    {
 2093|      7|                        m2 = i;
 2094|       |                        /* remove bond parity from at */
 2095|      7|                        if (m < MAX_NUM_STEREO_BONDS - 1)
  ------------------
  |  |  873|      7|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2095:29): [True: 7, False: 0]
  ------------------
 2096|      7|                        {
 2097|      7|                            memmove(at->sb_parity + m, at->sb_parity + m + 1, (MAX_NUM_STEREO_BONDS - 1 - (long long)m) * sizeof(at->sb_parity[0]));                /* djb-rwth: cast operator added */
  ------------------
  |  |  873|      7|#define MAX_NUM_STEREO_BONDS      3
  ------------------
 2098|      7|                            memmove(at->sb_ord + m, at->sb_ord + m + 1, (MAX_NUM_STEREO_BONDS - 1 - (long long)m) * sizeof(at->sb_ord[0]));                         /* djb-rwth: cast operator added */
  ------------------
  |  |  873|      7|#define MAX_NUM_STEREO_BONDS      3
  ------------------
 2099|      7|                            memmove(at->sn_ord + m, at->sn_ord + m + 1, (MAX_NUM_STEREO_BONDS - 1 - (long long)m) * sizeof(at->sn_ord[0]));                         /* djb-rwth: cast operator added */
  ------------------
  |  |  873|      7|#define MAX_NUM_STEREO_BONDS      3
  ------------------
 2100|      7|                            memmove(at->sn_orig_at_num + m, at->sn_orig_at_num + m + 1, (MAX_NUM_STEREO_BONDS - 1 - (long long)m) * sizeof(at->sn_orig_at_num[0])); /* djb-rwth: cast operator added */
  ------------------
  |  |  873|      7|#define MAX_NUM_STEREO_BONDS      3
  ------------------
 2101|      7|                        }
 2102|      7|                        at->sb_parity[MAX_NUM_STEREO_BONDS - 1] = 0;
  ------------------
  |  |  873|      7|#define MAX_NUM_STEREO_BONDS      3
  ------------------
 2103|      7|                        at->sb_ord[MAX_NUM_STEREO_BONDS - 1] = 0;
  ------------------
  |  |  873|      7|#define MAX_NUM_STEREO_BONDS      3
  ------------------
 2104|      7|                        at->sn_ord[MAX_NUM_STEREO_BONDS - 1] = 0;
  ------------------
  |  |  873|      7|#define MAX_NUM_STEREO_BONDS      3
  ------------------
 2105|      7|                        at->sn_orig_at_num[MAX_NUM_STEREO_BONDS - 1] = 0;
  ------------------
  |  |  873|      7|#define MAX_NUM_STEREO_BONDS      3
  ------------------
 2106|       |                        /* remove bond parity from at2 */
 2107|      7|                        if (m2 < MAX_NUM_STEREO_BONDS - 1)
  ------------------
  |  |  873|      7|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2107:29): [True: 6, False: 1]
  ------------------
 2108|      6|                        {
 2109|      6|                            memmove(at2->sb_parity + m2, at2->sb_parity + m2 + 1, (MAX_NUM_STEREO_BONDS - 1 - (long long)m2) * sizeof(at2->sb_parity[0]));                /* djb-rwth: cast operator added */
  ------------------
  |  |  873|      6|#define MAX_NUM_STEREO_BONDS      3
  ------------------
 2110|      6|                            memmove(at2->sb_ord + m2, at2->sb_ord + m2 + 1, (MAX_NUM_STEREO_BONDS - 1 - (long long)m2) * sizeof(at2->sb_ord[0]));                         /* djb-rwth: cast operator added */
  ------------------
  |  |  873|      6|#define MAX_NUM_STEREO_BONDS      3
  ------------------
 2111|      6|                            memmove(at2->sn_ord + m2, at2->sn_ord + m2 + 1, (MAX_NUM_STEREO_BONDS - 1 - (long long)m2) * sizeof(at2->sn_ord[0]));                         /* djb-rwth: cast operator added */
  ------------------
  |  |  873|      6|#define MAX_NUM_STEREO_BONDS      3
  ------------------
 2112|      6|                            memmove(at2->sn_orig_at_num + m2, at2->sn_orig_at_num + m2 + 1, (MAX_NUM_STEREO_BONDS - 1 - (long long)m2) * sizeof(at2->sn_orig_at_num[0])); /* djb-rwth: cast operator added */
  ------------------
  |  |  873|      6|#define MAX_NUM_STEREO_BONDS      3
  ------------------
 2113|      6|                        }
 2114|      7|                        at2->sb_parity[MAX_NUM_STEREO_BONDS - 1] = 0;
  ------------------
  |  |  873|      7|#define MAX_NUM_STEREO_BONDS      3
  ------------------
 2115|      7|                        at2->sb_ord[MAX_NUM_STEREO_BONDS - 1] = 0;
  ------------------
  |  |  873|      7|#define MAX_NUM_STEREO_BONDS      3
  ------------------
 2116|      7|                        at2->sn_ord[MAX_NUM_STEREO_BONDS - 1] = 0;
  ------------------
  |  |  873|      7|#define MAX_NUM_STEREO_BONDS      3
  ------------------
 2117|      7|                        at2->sn_orig_at_num[MAX_NUM_STEREO_BONDS - 1] = 0;
  ------------------
  |  |  873|      7|#define MAX_NUM_STEREO_BONDS      3
  ------------------
 2118|       |                        /* do not increment m here because the array elements have been shifted */
 2119|      7|                    }
 2120|      0|                    else
 2121|      0|                    {
 2122|      0|                        m++; /* program error: inconsistent stereobond parity */
 2123|      0|                    }
 2124|      7|                }
 2125|     12|                else if (k == at->sn_ord[m])
  ------------------
  |  Branch (2125:26): [True: 10, False: 2]
  ------------------
 2126|     10|                {
 2127|       |                    /* stereogenic bond neighbor is being removed; another neighbor remains */
 2128|       |                    /* !!! FLAW: does take into account removed H !!! */
 2129|     27|                    for (j = 0, i = -1; j < at->valence; j++)
  ------------------
  |  Branch (2129:41): [True: 25, False: 2]
  ------------------
 2130|     25|                    {
 2131|     25|                        if (j != k && j != at->sb_ord[m])
  ------------------
  |  Branch (2131:29): [True: 15, False: 10]
  |  Branch (2131:39): [True: 8, False: 7]
  ------------------
 2132|      8|                        {
 2133|      8|                            i = j;
 2134|      8|                            break;
 2135|      8|                        }
 2136|     25|                    }
 2137|       |
 2138|       |                    /* i is the position of the neighbor that will become a new neighbor */
 2139|       |                    /***************************************************************************
 2140|       |                     *  at->sb_parity[m] is the direction (EVEN=clockwise, ODD=counterclockwise)
 2141|       |                     *  from stereobond to the neighbor. If the neighbor is removed then
 2142|       |                     *  the parity should invert, otherwise it should be unchanged.
 2143|       |                     ***************************************************************************/
 2144|     10|                    if (i < 0)
  ------------------
  |  Branch (2144:25): [True: 2, False: 8]
  ------------------
 2145|      2|                    {
 2146|       |                        /* no alternative neighbor is available */
 2147|      2|                        if (ATOM_PARITY_WELL_DEF(at->sb_parity[m]))
  ------------------
  |  |  259|      2|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      2|#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)
  |  |  ------------------
  |  |  |  |  236|      2|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 2, False: 0]
  |  |  |  Branch (259:75): [True: 0, False: 2]
  |  |  ------------------
  ------------------
 2148|      0|                        {
 2149|       |                            /* parity cannot be not well-defined anymore */
 2150|      0|                            int pnxt_atom, pinxt2cur, pinxt_sb_parity_ord;
 2151|      0|                            int len = get_opposite_sb_atom(atom, iat, at->sb_ord[m], &pnxt_atom, &pinxt2cur, &pinxt_sb_parity_ord);
 2152|      0|                            if (len > 0)
  ------------------
  |  Branch (2152:33): [True: 0, False: 0]
  ------------------
 2153|      0|                            {
 2154|      0|                                atom[pnxt_atom].sb_parity[pinxt_sb_parity_ord] = at->sb_parity[m] = AB_PARITY_UNDF;
  ------------------
  |  |  222|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 2155|      0|                            }
 2156|      0|                        }
 2157|      2|                        at->sn_ord[m] = -99;                  /* sb neighbor has been disconnected */
 2158|      2|                        at->sb_ord[m] -= (at->sb_ord[m] > k); /* same as above */
 2159|      2|                        at->sn_orig_at_num[m] = 0;
 2160|      2|                    }
 2161|      8|                    else if (i < at->valence)
  ------------------
  |  Branch (2161:30): [True: 8, False: 0]
  ------------------
 2162|      8|                    {
 2163|       |                        /* choose another stereogenic bond neighbor, its ord. number is i before bond removal */
 2164|      8|                        if (ATOM_PARITY_WELL_DEF(at->sb_parity[m]))
  ------------------
  |  |  259|      8|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      8|#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)
  |  |  ------------------
  |  |  |  |  236|      8|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 8, False: 0]
  |  |  |  Branch (259:75): [True: 2, False: 6]
  |  |  ------------------
  ------------------
 2165|      2|                        {
 2166|       |                            /* ALL WRONG: 'move' previous stereo bond neighbor to the last position (pos. 2 out of 0,1,2) */
 2167|       |                            /* the parity of the transpositions is (2 - at->sn_ord[m])%2 = at->sn_ord[m] % 2 */
 2168|       |                            /* and replace the neighbor with another; the contribution to the parity is 1 */
 2169|       |
 2170|       |                            /*at->sb_parity[m]      =  2 - ( at->sb_parity[m] + at->sn_ord[m] + 1 ) % 2;*/
 2171|       |
 2172|       |                            /*at->sb_parity[m]      =  2 - ( at->sb_parity[m] + k + i +
 2173|       |                            (i > k) + (i > at->sb_ord[m]) ) % 2;*/
 2174|       |                            /*=== parity should be INVERTED ===*/
 2175|      2|                            at->sb_parity[m] = 3 - at->sb_parity[m];
 2176|      2|                        }
 2177|      8|                        at->sn_ord[m] = i - (i > k);          /* ord. number shifted because preceding bond is removed */
 2178|      8|                        at->sb_ord[m] -= (at->sb_ord[m] > k); /* same as above */
 2179|      8|                        at->sn_orig_at_num[m] = atom[(int)at->neighbor[i]].orig_at_number;
 2180|       |                        /*at->sb_parity[m]      =  2 - ( at->sb_parity[m] + 1 ) % 2;*/
 2181|      8|                    }
 2182|      0|                    else
 2183|      0|                    {
 2184|      0|                        at->sb_parity[m] = 0; /* program error: inconsistent stereobond parity */
 2185|      0|                    }
 2186|     10|                    m++;
 2187|     10|                }
 2188|      2|                else
 2189|      2|                {
 2190|       |                    /* removing another neighbor, k: first move it to the last position (pos. 2 out of 0,1,2) */
 2191|      2|                    if (k < 2 && ATOM_PARITY_WELL_DEF(at->sb_parity[m]))
  ------------------
  |  |  259|      1|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  237|      1|#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)
  |  |  ------------------
  |  |  |  |  236|      1|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (259:38): [True: 1, False: 0]
  |  |  |  Branch (259:75): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2191:25): [True: 1, False: 1]
  ------------------
 2192|      1|                    {
 2193|       |                        /*at->sb_parity[m] =  2 - ( at->sb_parity[m] + k ) % 2;*/
 2194|       |                        /*at->sb_parity[m] =  2 - ( at->sb_parity[m] + (at->sn_ord[m] > k) + (at->sb_ord[m] > k) ) % 2;*/
 2195|      1|                        ; /*==== Parity should remain UNCHANGED ===*/
 2196|      1|                    }
 2197|      2|                    if (at->sb_ord[m] > k)
  ------------------
  |  Branch (2197:25): [True: 1, False: 1]
  ------------------
 2198|      1|                    {
 2199|      1|                        at->sb_ord[m]--;
 2200|      1|                    }
 2201|      2|                    if (at->sn_ord[m] > k)
  ------------------
  |  Branch (2201:25): [True: 0, False: 2]
  ------------------
 2202|      0|                    {
 2203|      0|                        at->sn_ord[m]--;
 2204|      0|                    }
 2205|      2|                    m++;
 2206|      2|                }
 2207|     19|            }
 2208|     15|        }
 2209|       |
 2210|  2.24k|        if (k < val)
  ------------------
  |  Branch (2210:13): [True: 962, False: 1.27k]
  ------------------
 2211|    962|        {
 2212|    962|            memmove(at->neighbor + k, at->neighbor + k + 1, sizeof(at->neighbor[0]) * ((long long)val - (long long)k));          /* djb-rwth: cast operators added */
 2213|    962|            memmove(at->bond_stereo + k, at->bond_stereo + k + 1, sizeof(at->bond_stereo[0]) * ((long long)val - (long long)k)); /* djb-rwth: cast operators added */
 2214|    962|            memmove(at->bond_type + k, at->bond_type + k + 1, sizeof(at->bond_type[0]) * ((long long)val - (long long)k));       /* djb-rwth: cast operators added */
 2215|    962|        }
 2216|       |
 2217|  2.24k|        at->neighbor[val] = 0;
 2218|  2.24k|        at->bond_stereo[val] = 0;
 2219|  2.24k|        at->bond_type[val] = 0;
 2220|  2.24k|        at->valence = val;
 2221|  2.24k|        at->chem_bonds_valence -= bond;
 2222|  2.24k|        return 1;
 2223|  2.24k|    }
 2224|       |
 2225|      0|    return 0;
 2226|  2.24k|}
DisconnectInpAtBond:
 2233|  1.12k|{
 2234|  1.12k|    int neigh, i, ret = 0;
 2235|  1.12k|    int component;
 2236|  1.12k|    neigh = at[iat].neighbor[neigh_ord];
 2237|       |
 2238|  1.89k|    for (i = 0; i < at[neigh].valence; i++)
  ------------------
  |  Branch (2238:17): [True: 1.89k, False: 0]
  ------------------
 2239|  1.89k|    {
 2240|  1.89k|        if (iat == (int)at[neigh].neighbor[i])
  ------------------
  |  Branch (2240:13): [True: 1.12k, False: 772]
  ------------------
 2241|  1.12k|        {
 2242|  1.12k|            break;
 2243|  1.12k|        }
 2244|  1.89k|    }
 2245|       |
 2246|  1.12k|    if (i < at[neigh].valence)
  ------------------
  |  Branch (2246:9): [True: 1.12k, False: 0]
  ------------------
 2247|  1.12k|    {
 2248|  1.12k|        ret += RemoveInpAtBond(at, iat, neigh_ord);
 2249|  1.12k|        ret += RemoveInpAtBond(at, neigh, i);
 2250|  1.12k|        if (nOldCompNumber && ret)
  ------------------
  |  Branch (2250:13): [True: 0, False: 1.12k]
  |  Branch (2250:31): [True: 0, False: 0]
  ------------------
 2251|      0|        {
 2252|      0|            if ((component = at[iat].component)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2252:17): [True: 0, False: 0]
  ------------------
 2253|      0|            {
 2254|      0|                nOldCompNumber[component - 1] = 0;
 2255|      0|            }
 2256|      0|            if ((component = at[neigh].component)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2256:17): [True: 0, False: 0]
  ------------------
 2257|      0|            {
 2258|      0|                nOldCompNumber[component - 1] = 0;
 2259|      0|            }
 2260|      0|        }
 2261|  1.12k|    }
 2262|       |
 2263|  1.12k|    return (ret == 2);
 2264|  1.12k|}
bIsAmmoniumSalt:
 2272|   187k|{
 2273|       |    /* NH4(+charge)-O(-charge)-C -> NH3 + HO-C; any charge including 0, */
 2274|       |    /* any C except charged or radical F, Cl, Br, I                     */
 2275|       |
 2276|   187k|    int num_H, num_non_iso_H, num_impl_iso_H, bDisconnect = 1;
 2277|   187k|    int j, val, neigh, iO = -1, iC, k = -1;
 2278|       |
 2279|   187k|    if (at[i].el_number != EL_NUMBER_N)
  ------------------
  |  |   14|   187k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (2279:9): [True: 168k, False: 19.0k]
  ------------------
 2280|   168k|    {
 2281|   168k|        return 0;
 2282|   168k|    }
 2283|       |
 2284|       |    /* check for NH4-O-C... -> NH3 + HO-C... */
 2285|  19.0k|    val = at[i].valence;
 2286|  19.0k|    num_impl_iso_H = NUM_ISO_H(at, i);
  ------------------
  |  |   55|  19.0k|#define NUM_ISO_H(AT, N) (AT[N].num_iso_H[0] + AT[N].num_iso_H[1] + AT[N].num_iso_H[2])
  ------------------
 2287|  19.0k|    num_non_iso_H = at[i].num_H;
 2288|  19.0k|    num_H = num_non_iso_H + num_impl_iso_H;
 2289|  19.0k|    if (val + num_H == 5)
  ------------------
  |  Branch (2289:9): [True: 65, False: 18.9k]
  ------------------
 2290|     65|    {
 2291|     65|        int num_O = 0;
 2292|     65|        memset(num_explicit_H, 0, (NUM_H_ISOTOPES + 1) * sizeof(num_explicit_H[0])); /* djb-rwth: memset_s C11/Annex K variant? */
  ------------------
  |  |   25|     65|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
 2293|     89|        for (j = 0; j < val; j++)
  ------------------
  |  Branch (2293:21): [True: 89, False: 0]
  ------------------
 2294|     89|        { /* looking for O: H4N-O-C... */
 2295|     89|            neigh = at[i].neighbor[j];
 2296|     89|            if (at[neigh].num_H ||
  ------------------
  |  Branch (2296:17): [True: 6, False: 83]
  ------------------
 2297|     83|                (at[neigh].charge && (at[neigh].el_number != EL_NUMBER_O || at[neigh].charge + at[i].charge)) ||
  ------------------
  |  |   15|     54|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2297:18): [True: 27, False: 56]
  |  Branch (2297:39): [True: 25, False: 2]
  |  Branch (2297:77): [True: 2, False: 0]
  ------------------
 2298|     56|                (at[neigh].radical && at[neigh].radical != RADICAL_SINGLET)) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  |   75|      1|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2298:18): [True: 1, False: 55]
  |  Branch (2298:39): [True: 1, False: 0]
  ------------------
 2299|     34|            {
 2300|     34|                bDisconnect = 0;
 2301|     34|                break; /* reject */
 2302|     34|            }
 2303|     55|            if (at[neigh].el_number == EL_NUMBER_H && at[neigh].valence == 1 &&
  ------------------
  |  |   11|    110|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
  |  Branch (2303:17): [True: 4, False: 51]
  |  Branch (2303:55): [True: 2, False: 2]
  ------------------
 2304|      2|                !at[neigh].charge && !at[neigh].radical)
  ------------------
  |  Branch (2304:17): [True: 2, False: 0]
  |  Branch (2304:38): [True: 2, False: 0]
  ------------------
 2305|      2|            {
 2306|      2|                num_H++; /* at this point at[].num_H does not include explicit H count */
 2307|      2|                num_non_iso_H += (0 == at[neigh].iso_atw_diff);
 2308|      2|                num_explicit_H[at[neigh].iso_atw_diff]++; /* explicit H on N */
 2309|      2|            }
 2310|     53|            else if (at[neigh].el_number == EL_NUMBER_O && at[neigh].valence == 2 && !num_O)
  ------------------
  |  |   15|    106|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2310:22): [True: 10, False: 43]
  |  Branch (2310:60): [True: 10, False: 0]
  |  Branch (2310:86): [True: 8, False: 2]
  ------------------
 2311|      8|            {
 2312|      8|                num_O++; /* found O: N-O- */
 2313|      8|                iO = neigh;
 2314|      8|                k = j;
 2315|      8|                iC = at[iO].neighbor[at[iO].neighbor[0] == i];
 2316|      8|                if (at[iC].el_number != EL_NUMBER_C || /*
  ------------------
  |  |   13|     16|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (2316:21): [True: 4, False: 4]
  ------------------
 2317|       |                                                      at[iC].num_H ||
 2318|       |                                                      at[iC].chem_bonds_valence != 4 || */
 2319|      4|                    at[iC].charge ||
  ------------------
  |  Branch (2319:21): [True: 0, False: 4]
  ------------------
 2320|      4|                    (at[iC].radical && at[iC].radical != RADICAL_SINGLET) /*||
  ------------------
  |  |   75|      2|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2320:22): [True: 2, False: 2]
  |  Branch (2320:40): [True: 2, False: 0]
  ------------------
 2321|       |                                                                        at[iC].valence == at[iC].chem_bonds_valence*/
 2322|      8|                    )                                                     /* djb-rwth: addressing LLVM warning */
 2323|      6|                {
 2324|      6|                    bDisconnect = 0;
 2325|      6|                    break; /* reject */
 2326|      6|                }
 2327|      8|            }
 2328|     45|            else if ((at[neigh].el_number == EL_NUMBER_F ||
  ------------------
  |  |   16|     90|#define EL_NUMBER_F  ((U_CHAR)9)
  ------------------
  |  Branch (2328:23): [True: 8, False: 37]
  ------------------
 2329|     37|                      at[neigh].el_number == EL_NUMBER_CL ||
  ------------------
  |  |   20|     82|#define EL_NUMBER_CL ((U_CHAR)17)
  ------------------
  |  Branch (2329:23): [True: 0, False: 37]
  ------------------
 2330|     37|                      at[neigh].el_number == EL_NUMBER_BR ||
  ------------------
  |  |   24|     82|#define EL_NUMBER_BR ((U_CHAR)35)
  ------------------
  |  Branch (2330:23): [True: 6, False: 31]
  ------------------
 2331|     31|                      at[neigh].el_number == EL_NUMBER_I) &&
  ------------------
  |  |   27|     31|#define EL_NUMBER_I  ((U_CHAR)53)
  ------------------
  |  Branch (2331:23): [True: 13, False: 18]
  ------------------
 2332|     27|                     at[neigh].valence == 1 && at[neigh].chem_bonds_valence == 1 &&
  ------------------
  |  Branch (2332:22): [True: 22, False: 5]
  |  Branch (2332:48): [True: 22, False: 0]
  ------------------
 2333|     22|                     !at[neigh].charge && !NUMH(at, neigh) && !num_O)
  ------------------
  |  |   56|     67|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|     22|#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 (2333:22): [True: 22, False: 0]
  |  Branch (2333:43): [True: 22, False: 0]
  |  Branch (2333:63): [True: 20, False: 2]
  ------------------
 2334|     20|            {
 2335|     20|                num_O++; /* found O: N-O- */
 2336|     20|                iO = neigh;
 2337|     20|                k = j;
 2338|       |                /* djb-rwth: removing redundant code */
 2339|     20|            }
 2340|     25|            else
 2341|     25|            {
 2342|     25|                bDisconnect = 0;
 2343|     25|                break; /* reject */
 2344|     25|            }
 2345|     55|        }
 2346|     65|        if (bDisconnect && (num_O != 1 || num_H != 4))
  ------------------
  |  Branch (2346:13): [True: 0, False: 65]
  |  Branch (2346:29): [True: 0, False: 0]
  |  Branch (2346:43): [True: 0, False: 0]
  ------------------
 2347|      0|        {
 2348|      0|            bDisconnect = 0; /* reject */
 2349|      0|        }
 2350|     65|    }
 2351|  18.9k|    else
 2352|  18.9k|    {
 2353|  18.9k|        bDisconnect = 0;
 2354|  18.9k|    }
 2355|  19.0k|    if (bDisconnect)
  ------------------
  |  Branch (2355:9): [True: 0, False: 19.0k]
  ------------------
 2356|      0|    {
 2357|      0|        *piO = iO;
 2358|      0|        *pk = k;
 2359|      0|    }
 2360|       |
 2361|  19.0k|    return bDisconnect;
 2362|   187k|}
bIsMetalSalt:
 2478|  28.4k|{
 2479|  28.4k|    int type, val, k, iO, iC, j, neigh;
 2480|  28.4k|    int bDisconnect = 1;
 2481|       |
 2482|       |    /* check for a metal atom:
 2483|       |    metal atom should be connected and be a metal */
 2484|  28.4k|    if (!(val = at[i].valence) ||
  ------------------
  |  Branch (2484:9): [True: 12, False: 28.4k]
  ------------------
 2485|  28.4k|        !(type = get_el_type(at[i].el_number)) ||
  ------------------
  |  Branch (2485:9): [True: 22.8k, False: 5.59k]
  ------------------
 2486|  5.59k|        !(type & IS_METAL))
  ------------------
  |  |   82|  5.59k|#define IS_METAL        3          /* metal bitmap */
  ------------------
  |  Branch (2486:9): [True: 0, False: 5.59k]
  ------------------
 2487|  22.8k|    {
 2488|  22.8k|        bDisconnect = 0; /* reject */
 2489|  22.8k|    }
 2490|  5.59k|    else if (at[i].num_H)
  ------------------
  |  Branch (2490:14): [True: 8, False: 5.58k]
  ------------------
 2491|       |    /* metal atom should not have adjacent H or multiple bonds or radical */
 2492|      8|    {
 2493|      8|        bDisconnect = 0; /* reject */
 2494|      8|    }
 2495|  5.58k|    else
 2496|  5.58k|    {
 2497|       |        /* check valence */
 2498|  5.58k|        if ((at[i].charge == 0 &&
  ------------------
  |  Branch (2498:14): [True: 3.83k, False: 1.74k]
  ------------------
 2499|  3.83k|             (((type & 1) && val == get_el_valence(at[i].el_number, 0, 0)) ||
  ------------------
  |  Branch (2499:16): [True: 3.83k, False: 0]
  |  Branch (2499:30): [True: 908, False: 2.92k]
  ------------------
 2500|  2.92k|              ((type & 2) && val == get_el_valence(at[i].el_number, 0, 1)))) ||
  ------------------
  |  Branch (2500:16): [True: 1.23k, False: 1.69k]
  |  Branch (2500:30): [True: 267, False: 967]
  ------------------
 2501|  4.40k|            (at[i].charge > 0 &&
  ------------------
  |  Branch (2501:14): [True: 1.06k, False: 3.34k]
  ------------------
 2502|  1.06k|             (type & 1) && val == get_el_valence(at[i].el_number, at[i].charge, 0))) /* djb-rwth: addressing LLVM warnings */
  ------------------
  |  Branch (2502:14): [True: 1.06k, False: 0]
  |  Branch (2502:28): [True: 0, False: 1.06k]
  ------------------
 2503|  1.17k|        {
 2504|  1.17k|            ; /* accept */
 2505|  1.17k|        }
 2506|  4.40k|        else
 2507|  4.40k|        {
 2508|  4.40k|            bDisconnect = 0; /* reject */
 2509|  4.40k|        }
 2510|  5.58k|    }
 2511|       |
 2512|  28.4k|    if (bDisconnect)
  ------------------
  |  Branch (2512:9): [True: 1.17k, False: 27.2k]
  ------------------
 2513|  1.17k|    {
 2514|       |        /*************************************************************************
 2515|       |         *                                                                  |    *
 2516|       |         * check M neighbors. Disconnect if all neighbors are M-O-C# or M-O-C=   *
 2517|       |         *                                                                  |    *
 2518|       |         *************************************************************************/
 2519|  1.17k|        for (k = 0; k < at[i].valence; k++)
  ------------------
  |  Branch (2519:21): [True: 1.17k, False: 1]
  ------------------
 2520|  1.17k|        {
 2521|  1.17k|            iO = at[i].neighbor[k];
 2522|       |            /* halogenide 2004-07-08 */
 2523|  1.17k|            if ((at[iO].el_number == EL_NUMBER_F ||
  ------------------
  |  |   16|  2.35k|#define EL_NUMBER_F  ((U_CHAR)9)
  ------------------
  |  Branch (2523:18): [True: 5, False: 1.17k]
  ------------------
 2524|  1.17k|                 at[iO].el_number == EL_NUMBER_CL ||
  ------------------
  |  |   20|  2.34k|#define EL_NUMBER_CL ((U_CHAR)17)
  ------------------
  |  Branch (2524:18): [True: 0, False: 1.17k]
  ------------------
 2525|  1.17k|                 at[iO].el_number == EL_NUMBER_BR ||
  ------------------
  |  |   24|  2.34k|#define EL_NUMBER_BR ((U_CHAR)35)
  ------------------
  |  Branch (2525:18): [True: 1, False: 1.17k]
  ------------------
 2526|  1.17k|                 at[iO].el_number == EL_NUMBER_I) &&
  ------------------
  |  |   27|  1.17k|#define EL_NUMBER_I  ((U_CHAR)53)
  ------------------
  |  Branch (2526:18): [True: 6, False: 1.16k]
  ------------------
 2527|     12|                at[iO].valence == 1 && at[iO].chem_bonds_valence == 1 &&
  ------------------
  |  Branch (2527:17): [True: 2, False: 10]
  |  Branch (2527:40): [True: 2, False: 0]
  ------------------
 2528|      2|                !at[iO].charge && !(at[iO].radical && at[iO].radical != RADICAL_SINGLET) && !NUMH(at, iO))
  ------------------
  |  |   75|      0|#define RADICAL_SINGLET 1
  ------------------
                              !at[iO].charge && !(at[iO].radical && at[iO].radical != RADICAL_SINGLET) && !NUMH(at, iO))
  ------------------
  |  |   56|      1|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|      1|#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:17): [True: 1, False: 1]
  |  Branch (2528:37): [True: 0, False: 1]
  |  Branch (2528:55): [True: 0, False: 0]
  |  Branch (2528:93): [True: 1, False: 0]
  ------------------
 2529|      1|            {
 2530|      1|                ; /* found */
 2531|      1|            }
 2532|  1.17k|            else
 2533|  1.17k|            {
 2534|       |                /* -O-C= */
 2535|  1.17k|                if (at[iO].el_number != EL_NUMBER_O ||
  ------------------
  |  |   15|  2.35k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (2535:21): [True: 1.08k, False: 89]
  ------------------
 2536|     89|                    NUMH(at, iO) ||
  ------------------
  |  |   56|  1.26k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|     89|#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 (56:21): [True: 0, False: 89]
  |  |  ------------------
  ------------------
 2537|     89|                    at[iO].valence != 2 ||
  ------------------
  |  Branch (2537:21): [True: 12, False: 77]
  ------------------
 2538|     77|                    at[iO].charge ||
  ------------------
  |  Branch (2538:21): [True: 71, False: 6]
  ------------------
 2539|      6|                    (at[iO].radical && at[iO].radical != RADICAL_SINGLET) ||
  ------------------
  |  |   75|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2539:22): [True: 0, False: 6]
  |  Branch (2539:40): [True: 0, False: 0]
  ------------------
 2540|      6|                    at[iO].valence != at[iO].chem_bonds_valence) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2540:21): [True: 0, False: 6]
  ------------------
 2541|  1.16k|                {
 2542|  1.16k|                    bDisconnect = 0; /* reject */
 2543|  1.16k|                    break;
 2544|  1.16k|                }
 2545|      6|                iC = at[iO].neighbor[at[iO].neighbor[0] == i];
 2546|      6|                if (at[iC].el_number != EL_NUMBER_C ||
  ------------------
  |  |   13|     12|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (2546:21): [True: 4, False: 2]
  ------------------
 2547|      2|                    at[iC].num_H ||
  ------------------
  |  Branch (2547:21): [True: 0, False: 2]
  ------------------
 2548|      2|                    at[iC].chem_bonds_valence != 4 ||
  ------------------
  |  Branch (2548:21): [True: 0, False: 2]
  ------------------
 2549|      2|                    at[iC].charge ||
  ------------------
  |  Branch (2549:21): [True: 0, False: 2]
  ------------------
 2550|      2|                    (at[iC].radical && at[iC].radical != RADICAL_SINGLET) ||
  ------------------
  |  |   75|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2550:22): [True: 0, False: 2]
  |  Branch (2550:40): [True: 0, False: 0]
  ------------------
 2551|      2|                    at[iC].valence == at[iC].chem_bonds_valence) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (2551:21): [True: 0, False: 2]
  ------------------
 2552|      4|                {
 2553|      4|                    bDisconnect = 0; /* reject */
 2554|      4|                    break;
 2555|      4|                }
 2556|      6|                for (j = 0; j < at[iC].valence; j++)
  ------------------
  |  Branch (2556:29): [True: 5, False: 1]
  ------------------
 2557|      5|                {
 2558|      5|                    neigh = at[iC].neighbor[j];
 2559|      5|                    if (at[neigh].el_number == EL_NUMBER_H)
  ------------------
  |  |   11|      5|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
  |  Branch (2559:25): [True: 1, False: 4]
  ------------------
 2560|      1|                    {
 2561|      1|                        break;
 2562|      1|                    }
 2563|      5|                }
 2564|      2|                if (j != at[iC].valence)
  ------------------
  |  Branch (2564:21): [True: 1, False: 1]
  ------------------
 2565|      1|                {
 2566|      1|                    bDisconnect = 0; /* reject */
 2567|      1|                    break;
 2568|      1|                }
 2569|      2|            }
 2570|  1.17k|        }
 2571|  1.17k|    }
 2572|       |
 2573|  28.4k|    return bDisconnect;
 2574|  28.4k|}
bIsMetalToDisconnect:
 2683|  66.5k|{
 2684|  66.5k|    int type, at_valence, num_H;
 2685|       |
 2686|       |    /*
 2687|       |    if ( !at[i].valence )
 2688|       |    */
 2689|       |
 2690|  66.5k|    if (!(type = get_el_type(at[i].el_number)) ||
  ------------------
  |  Branch (2690:9): [True: 58.3k, False: 8.21k]
  ------------------
 2691|  8.21k|        !(type & IS_METAL))
  ------------------
  |  |   82|  8.21k|#define IS_METAL        3          /* metal bitmap */
  ------------------
  |  Branch (2691:9): [True: 0, False: 8.21k]
  ------------------
 2692|  58.3k|    {
 2693|  58.3k|        return 0;
 2694|  58.3k|    }
 2695|       |
 2696|  8.21k|    num_H = NUMH(at, i);
  ------------------
  |  |   56|  8.21k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  8.21k|#define NUM_ISO_H(AT, N) (AT[N].num_iso_H[0] + AT[N].num_iso_H[1] + AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
 2697|  8.21k|    at_valence = num_H + at[i].chem_bonds_valence;
 2698|       |
 2699|  8.21k|    if (!at_valence)
  ------------------
  |  Branch (2699:9): [True: 0, False: 8.21k]
  ------------------
 2700|      0|    {
 2701|      0|        return 0; /* nothing to disconnect */
 2702|      0|    }
 2703|       |
 2704|  8.21k|    if (bCheckMetalValence)
  ------------------
  |  Branch (2704:9): [True: 0, False: 8.21k]
  ------------------
 2705|      0|    {
 2706|      0|        if (abs(at[i].charge) > 1)
  ------------------
  |  Branch (2706:13): [True: 0, False: 0]
  ------------------
 2707|      0|        {
 2708|      0|            return 1; /* multiple charges */
 2709|      0|        }
 2710|       |
 2711|      0|        for (i = 0; i < 2 && (i & type); i++)
  ------------------
  |  Branch (2711:21): [True: 0, False: 0]
  |  Branch (2711:30): [True: 0, False: 0]
  ------------------
 2712|      0|        {
 2713|      0|            if (at_valence == get_el_valence( at[i].el_number, at[i].charge, i )) /* djb-rwth: fixing coverity ID #499532 -- unresolved issue -- revision required */
  ------------------
  |  Branch (2713:17): [True: 0, False: 0]
  ------------------
 2714|      0|            {
 2715|      0|                return 2; /* atom has normal valence */
 2716|      0|            }
 2717|      0|        }
 2718|      0|    }
 2719|       |
 2720|  8.21k|    return 1;
 2721|  8.21k|}
bMayDisconnectMetals:
 2727|  70.4k|{
 2728|  70.4k|    int i, j, k, iO, num_changes, val, bRadOrMultBonds, num_impl_H = 0;
 2729|  70.4k|    S_CHAR num_explicit_H[NUM_H_ISOTOPES + 1];
 2730|  70.4k|    inp_ATOM *at = orig_inp_data->at;
 2731|  70.4k|    int num_at = orig_inp_data->num_inp_atoms;
 2732|  70.4k|    int *nNumImplH = &orig_inp_data->bDisconnectCoord;
 2733|       |
 2734|       |    /* check each atom */
 2735|   229k|    for (i = 0, num_changes = 0; i < num_at; i++)
  ------------------
  |  Branch (2735:34): [True: 159k, False: 70.4k]
  ------------------
 2736|   159k|    {
 2737|       |
 2738|   159k|        if (!(val = at[i].valence) && !NUMH(at, i))
  ------------------
  |  |   56|  92.6k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  92.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 (2738:13): [True: 92.6k, False: 66.5k]
  |  Branch (2738:39): [True: 92.6k, False: 7]
  ------------------
 2739|  92.6k|        {
 2740|  92.6k|            continue; /* disconnected atom */
 2741|  92.6k|        }
 2742|       |
 2743|  66.5k|        bRadOrMultBonds = (val == 0) ||
  ------------------
  |  Branch (2743:27): [True: 7, False: 66.5k]
  ------------------
 2744|  66.5k|                          (val != at[i].chem_bonds_valence) ||                 /* a bond has higher multiplicity than 1 */
  ------------------
  |  Branch (2744:27): [True: 35.0k, False: 31.4k]
  ------------------
 2745|  31.4k|                          (at[i].radical && at[i].radical != RADICAL_SINGLET); /* radical */
  ------------------
  |  |   75|  3.00k|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2745:28): [True: 3.00k, False: 28.4k]
  |  Branch (2745:45): [True: 3.00k, False: 0]
  ------------------
 2746|       |
 2747|  66.5k|        if (!bRadOrMultBonds && bIsAmmoniumSalt(at, i, &iO, &k, num_explicit_H))
  ------------------
  |  Branch (2747:13): [True: 28.4k, False: 38.0k]
  |  Branch (2747:33): [True: 0, False: 28.4k]
  ------------------
 2748|      0|        {
 2749|      0|            ;
 2750|      0|        }
 2751|  66.5k|        else if (!bRadOrMultBonds && bIsMetalSalt(at, i))
  ------------------
  |  Branch (2751:18): [True: 28.4k, False: 38.0k]
  |  Branch (2751:38): [True: 1, False: 28.4k]
  ------------------
 2752|      1|        {
 2753|      1|            ;
 2754|      1|        }
 2755|  66.5k|        else if (1 == (j = bIsMetalToDisconnect(at, i, bCheckMetalValence)))
  ------------------
  |  Branch (2755:18): [True: 8.21k, False: 58.3k]
  ------------------
 2756|  8.21k|        {
 2757|  8.21k|            num_impl_H += NUMH(at, i);
  ------------------
  |  |   56|  8.21k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  8.21k|#define NUM_ISO_H(AT, N) (AT[N].num_iso_H[0] + AT[N].num_iso_H[1] + AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
 2758|  8.21k|            num_changes++;
 2759|  8.21k|        }
 2760|  58.3k|        else if (2 == j && bTautFlagsDone)
  ------------------
  |  Branch (2760:18): [True: 0, False: 58.3k]
  |  Branch (2760:28): [True: 0, False: 0]
  ------------------
 2761|      0|        {
 2762|      0|            *bTautFlagsDone |= TG_FLAG_CHECK_VALENCE_COORD_DONE;
  ------------------
  |  |  976|      0|#define TG_FLAG_CHECK_VALENCE_COORD_DONE 0x00000200   /* did not disconnect "coord. centers" with usual valence */
  ------------------
 2763|      0|        }
 2764|  66.5k|    }
 2765|       |
 2766|  70.4k|    if (nNumImplH)
  ------------------
  |  Branch (2766:9): [True: 70.4k, False: 0]
  ------------------
 2767|  70.4k|    {
 2768|  70.4k|        *nNumImplH = num_changes ? num_impl_H + 1 : 0;
  ------------------
  |  Branch (2768:22): [True: 6.57k, False: 63.8k]
  ------------------
 2769|  70.4k|    }
 2770|       |
 2771|  70.4k|    return num_changes;
 2772|  70.4k|}
add_DT_to_num_H:
 3660|   106k|{
 3661|   106k|    int i, j;
 3662|   258k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (3662:17): [True: 152k, False: 106k]
  ------------------
 3663|   152k|    {
 3664|   610k|        for (j = 0; j < NUM_H_ISOTOPES; j++)
  ------------------
  |  |   25|   610k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3664:21): [True: 458k, False: 152k]
  ------------------
 3665|   458k|        {
 3666|   458k|            at[i].num_H += at[i].num_iso_H[j];
 3667|   458k|        }
 3668|   152k|    }
 3669|   106k|    return 0;
 3670|   106k|}
remove_terminal_HDT:
 3711|   106k|{
 3712|   106k|    AT_NUMB *new_ord;
 3713|   106k|    inp_ATOM *new_at;
 3714|   106k|    char *p;
 3715|   106k|    static const char szHDT[] = "HDT";
 3716|   106k|    static const int kMax = sizeof(szHDT); /*  = 4 */
 3717|   106k|    int ret = -1;
 3718|   106k|    int num_hydrogens = 0, num_H = 0; /*  number of terminal H, D, T */
 3719|   106k|    int i, j, k, n, m;
 3720|   106k|    int val;
 3721|   106k|    AT_RANK new_HydrogenAt_order[NUM_H_ISOTOPES + 1];
 3722|   106k|    AT_RANK new_OtherNeigh_order[MAXVAL];
 3723|   106k|    S_CHAR old_trans[MAX_NUM_STEREO_BONDS];
 3724|       |
 3725|   106k|    int num_OtherNeigh, num_HydrogenAt;
 3726|       |
 3727|   106k|    new_ord = (AT_NUMB *)inchi_calloc(num_atoms, sizeof(new_ord[0])); /* changed malloc to calloc 9-11-2003 */
  ------------------
  |  | 1146|   106k|#define inchi_calloc   calloc
  ------------------
 3728|   106k|    new_at = (inp_ATOM *)inchi_malloc(sizeof(new_at[0]) * num_atoms);
  ------------------
  |  | 1143|   106k|#define inchi_malloc   malloc
  ------------------
 3729|   106k|    if (!new_ord || !new_at)
  ------------------
  |  Branch (3729:9): [True: 0, False: 106k]
  |  Branch (3729:21): [True: 0, False: 106k]
  ------------------
 3730|      0|    {
 3731|      0|        goto exit_function;
 3732|      0|    }
 3733|       |
 3734|       |    /*  move H. D, T to the end of the list of atoms */
 3735|   265k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (3735:17): [True: 159k, False: 106k]
  ------------------
 3736|   159k|    {
 3737|   159k|        at[i].component = i; /*  temporarily save original numbering */
 3738|       |        /*  get k = temp. hydrogen isotope/non-hydrogen atom type: */
 3739|       |        /*  k=0:H, k=2:D, k=3:T, k=4=kMax: not a hydrogen */
 3740|   159k|        k = at[i].elname[1] ? kMax : (p = (char *)strchr(szHDT, at[i].elname[0])) ? (int)(p - szHDT)
  ------------------
  |  Branch (3740:13): [True: 40.9k, False: 118k]
  |  Branch (3740:38): [True: 55.8k, False: 62.4k]
  ------------------
 3741|   118k|                                                                                  : kMax;
 3742|       |        /*  set hydrogen isotope atw differences */
 3743|       |        /*  Notes: k-value of isotopic H is incremented to correct iso_atw_diff value later. */
 3744|       |        /*         1H isotope cannot be detected here. */
 3745|   159k|        if (k == ATW_H || k == ATW_H + 1)
  ------------------
  |  |   26|   318k|#define ATW_H                 1  /* hydrogen atomic weight */
  ------------------
                      if (k == ATW_H || k == ATW_H + 1)
  ------------------
  |  |   26|   159k|#define ATW_H                 1  /* hydrogen atomic weight */
  ------------------
  |  Branch (3745:13): [True: 0, False: 159k]
  |  Branch (3745:27): [True: 0, False: 159k]
  ------------------
 3746|      0|        {
 3747|       |            /* D or T, k = 1 or 2 */
 3748|      0|            at[i].elname[0] = 'H';    /*  hydrogen isotope */
 3749|      0|            at[i].iso_atw_diff = ++k; /*  increment k to make k = iso_atw_diff ( 2 for D, 3 for T ) */
 3750|      0|        }
 3751|   159k|        num_H += (k != kMax && at[i].valence == 1 && at[i].chem_bonds_valence == 1 && !NUMH(at, i));
  ------------------
  |  |   56|  7.24k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  7.24k|#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 (3751:19): [True: 55.8k, False: 103k]
  |  Branch (3751:32): [True: 7.24k, False: 48.5k]
  |  Branch (3751:54): [True: 7.24k, False: 0]
  |  Branch (3751:87): [True: 7.24k, False: 2]
  ------------------
 3752|   159k|    }
 3753|       |
 3754|       |    /* special case: HD, HT, DT, HH: the only non-isotopic H or
 3755|       |     * the lightest isotopic H out of two is removed
 3756|       |     * to become implicit (make the heavier H the "central atom").
 3757|       |     * Note: This must be consistent with MOL_FMT_to_atom()
 3758|       |     * treatment of isotopic Hn aliases.
 3759|       |     */
 3760|   106k|    if (2 == num_H && 2 == num_atoms &&
  ------------------
  |  Branch (3760:9): [True: 1.24k, False: 104k]
  |  Branch (3760:23): [True: 4, False: 1.24k]
  ------------------
 3761|      4|        !NUMH(at, 0) && !NUMH(at, 1) &&
  ------------------
  |  |   56|   106k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|      4|#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, 0) && !NUMH(at, 1) &&
  ------------------
  |  |   56|   106k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|      4|#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 (3761:9): [True: 4, False: 0]
  |  Branch (3761:25): [True: 4, False: 0]
  ------------------
 3762|      4|        (!keep_explicit_HDT ||
  ------------------
  |  Branch (3762:10): [True: 4, False: 0]
  ------------------
 3763|      0|         (!keep_explicit_HDT[0] &&
  ------------------
  |  Branch (3763:11): [True: 0, False: 0]
  ------------------
 3764|      0|             !keep_explicit_HDT[1])))
  ------------------
  |  Branch (3764:14): [True: 0, False: 0]
  ------------------
 3765|      4|    {
 3766|       |
 3767|      4|        if (at[0].iso_atw_diff >= at[1].iso_atw_diff)
  ------------------
  |  Branch (3767:13): [True: 4, False: 0]
  ------------------
 3768|      4|        {
 3769|      4|            new_ord[0] = 0;
 3770|      4|            new_ord[1] = 1;
 3771|      4|        }
 3772|      0|        else
 3773|      0|        {
 3774|      0|            new_ord[0] = 1;
 3775|      0|            new_ord[1] = 0;
 3776|      0|        }
 3777|      4|        if (at[new_ord[1]].charge)
  ------------------
  |  Branch (3777:13): [True: 0, False: 4]
  ------------------
 3778|      0|        {
 3779|      0|            at[new_ord[0]].charge += at[new_ord[1]].charge;
 3780|      0|            at[new_ord[1]].charge = 0;
 3781|      0|        }
 3782|      4|        new_at[new_ord[0]] = at[0];
 3783|      4|        new_at[new_ord[1]] = at[1];
 3784|      4|        num_hydrogens = 1;
 3785|      4|    }
 3786|   106k|    else
 3787|   106k|    {
 3788|       |        /* general case except H-H */
 3789|   265k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (3789:21): [True: 159k, False: 106k]
  ------------------
 3790|   159k|        {
 3791|   159k|            k = (at[i].elname[1] || NUMH(at, i)) ? kMax : (at[i].elname[0] == 'H') ? at[i].iso_atw_diff
  ------------------
  |  |   56|   118k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|   118k|#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 (56:21): [True: 537, False: 117k]
  |  |  ------------------
  ------------------
  |  Branch (3791:18): [True: 40.9k, False: 118k]
  |  Branch (3791:59): [True: 55.8k, False: 61.8k]
  ------------------
 3792|   117k|                                                                                   : kMax;
 3793|   159k|            n = (int)at[i].neighbor[0];
 3794|   159k|            if (k < kMax && at[i].valence == 1 && at[i].chem_bonds_valence == 1 &&
  ------------------
  |  Branch (3794:17): [True: 55.8k, False: 103k]
  |  Branch (3794:29): [True: 7.23k, False: 48.5k]
  |  Branch (3794:51): [True: 7.23k, False: 0]
  ------------------
 3795|  7.23k|                (!keep_explicit_HDT || !keep_explicit_HDT[i]) &&
  ------------------
  |  Branch (3795:18): [True: 7.23k, False: 0]
  |  Branch (3795:40): [True: 0, False: 0]
  ------------------
 3796|       |                /*  the order of comparison is important */
 3797|  7.23k|                ((n > i) /* at[n] has not been encountered yet*/ ||
  ------------------
  |  Branch (3797:18): [True: 708, False: 6.52k]
  ------------------
 3798|  6.52k|                    (int)new_ord[n] < num_atoms - num_hydrogens) /* at[n] might have been encountered; it has not been moved */ &&
  ------------------
  |  Branch (3798:21): [True: 6.52k, False: 0]
  ------------------
 3799|  7.23k|                (!is_el_a_metal(at[n].el_number) || is_only_HDT_neighbors(at, num_atoms, n))/*@nnuk*/)
  ------------------
  |  Branch (3799:18): [True: 6.11k, False: 1.11k]
  |  Branch (3799:53): [True: 337, False: 782]
  ------------------
 3800|  6.45k|            {
 3801|       |                /*  found an explicit terminal hydrogen */
 3802|  6.45k|                num_hydrogens++;
 3803|  6.45k|                if (k == 0 && ATW_H <= at[i].iso_atw_diff && at[i].iso_atw_diff < ATW_H + NUM_H_ISOTOPES)
  ------------------
  |  |   26|  6.40k|#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)
  ------------------
  |  |   26|      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)
  ------------------
  |  |   25|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3803:21): [True: 6.40k, False: 44]
  |  Branch (3803:31): [True: 0, False: 6.40k]
  |  Branch (3803:62): [True: 0, False: 0]
  ------------------
 3804|      0|                {
 3805|      0|                    k = at[i].iso_atw_diff; /*  H isotope has already been marked above or elsewhere */ /* djb-rwth: ignoring LLVM warning: variable used */
 3806|      0|                }
 3807|  6.45k|                if (at[i].charge)
  ------------------
  |  Branch (3807:21): [True: 2, False: 6.44k]
  ------------------
 3808|      2|                {
 3809|       |                    /*  transfer charge from the hydrogen */
 3810|      2|                    at[n].charge += at[i].charge;
 3811|      2|                    at[i].charge = 0;
 3812|      2|                    if (bFixTermHChrg)
  ------------------
  |  Branch (3812:25): [True: 2, False: 0]
  ------------------
 3813|      2|                    {
 3814|       |                        /*    Fixed bug (July 6, 2008 IPl) :
 3815|       |                        if terminal H was charged (not neutralized before call of remove_terminal_HDT)
 3816|       |                        and had an ordering number > than that of heavy-atom neighbour, then
 3817|       |                        charge on neighbour atom was not adjusted (though charge on H was removed). */
 3818|      2|                        if (i > n)
  ------------------
  |  Branch (3818:29): [True: 2, False: 0]
  ------------------
 3819|       |                            /* new_at[new_ord[n]] has been created and filled already */
 3820|      2|                            new_at[new_ord[n]].charge = at[n].charge;
 3821|      2|                    }
 3822|      2|                }
 3823|  6.45k|                new_ord[i] = num_atoms - num_hydrogens; /*  move hydrogens to the end of the list */
 3824|  6.45k|            }
 3825|   152k|            else
 3826|   152k|            {
 3827|       |                /* atom is not an explicit terminal hydrogen */
 3828|   152k|                new_ord[i] = i - num_hydrogens; /*  adjust non-hydrogens positions */
 3829|   152k|            }
 3830|       |
 3831|       |            /*  copy atom to the new position */
 3832|   159k|            new_at[new_ord[i]] = at[i];
 3833|   159k|        } /* i */
 3834|   106k|    } /* general case except H-H */
 3835|       |
 3836|   106k|    if (num_hydrogens)
  ------------------
  |  Branch (3836:9): [True: 5.00k, False: 101k]
  ------------------
 3837|  5.00k|    {
 3838|  5.00k|        int num_others = num_atoms - num_hydrogens; /*  atoms which are not terminal H, D, T */
 3839|  5.00k|        if (num_hydrogens > 1)
  ------------------
  |  Branch (3839:13): [True: 1.28k, False: 3.71k]
  ------------------
 3840|  1.28k|        {
 3841|       |            /*  sort hydrogen isotopes in ascending order, */
 3842|       |            /*  orig, numbers being the secondary sorting key */
 3843|  1.28k|            qsort(new_at + num_others, num_hydrogens, sizeof(new_at[0]), cmp_iso_atw_diff_component_no);
 3844|  1.28k|        }
 3845|       |        /*  save new numbering of hydrogen atoms using temporarily saved orig numbering */
 3846|  11.4k|        for (i = num_others; i < num_atoms; i++)
  ------------------
  |  Branch (3846:30): [True: 6.45k, False: 5.00k]
  ------------------
 3847|  6.45k|        {
 3848|  6.45k|            new_ord[(int)new_at[i].component] = i;
 3849|  6.45k|        }
 3850|       |
 3851|       |        /*  renumber neighbors according to new_ord[] and detach terminal hydrogens */
 3852|  25.7k|        for (i = 0; i < num_others; i++)
  ------------------
  |  Branch (3852:21): [True: 20.7k, False: 5.00k]
  ------------------
 3853|  20.7k|        {
 3854|  20.7k|            memset(new_HydrogenAt_order, 0, sizeof(new_HydrogenAt_order)); /* djb-rwth: memset_s C11/Annex K variant? */
 3855|  20.7k|            memset(new_OtherNeigh_order, 0, sizeof(new_OtherNeigh_order)); /* djb-rwth: memset_s C11/Annex K variant? */
 3856|  20.7k|            num_OtherNeigh = 0;
 3857|  20.7k|            num_HydrogenAt = 0;
 3858|  20.7k|            num_H = 0;
 3859|       |
 3860|  20.9k|            for (m = 0; m < MAX_NUM_STEREO_BONDS && new_at[i].sb_parity[m]; m++)
  ------------------
  |  |  873|  41.9k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (3860:25): [True: 20.9k, False: 0]
  |  Branch (3860:53): [True: 186, False: 20.7k]
  ------------------
 3861|    186|            {
 3862|    186|                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;
 3863|    186|            }
 3864|       |
 3865|  62.7k|            for (k = val = 0; k < new_at[i].valence; k++) /* djb-rwth: removing redundant variables/code */
  ------------------
  |  Branch (3865:31): [True: 41.9k, False: 20.7k]
  ------------------
 3866|  41.9k|            {
 3867|  41.9k|                if (num_others <= (n = new_ord[new_at[i].neighbor[k]]))
  ------------------
  |  Branch (3867:21): [True: 6.45k, False: 35.5k]
  ------------------
 3868|  6.45k|                {
 3869|       |                    /*  discovered neighbor = disconnected explicit hydrogen
 3870|       |                     *  i = new atom new_at[i] ordering number
 3871|       |                     *  n = new number of the explicit H
 3872|       |                     *  k = ordering number of the explicit H in new_at[i] adjacency list
 3873|       |                     */
 3874|  6.45k|                    if (0 < new_at[n].iso_atw_diff && new_at[n].iso_atw_diff < ATW_H + NUM_H_ISOTOPES)
  ------------------
  |  |   26|     35|#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)
  ------------------
  |  |   25|     35|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3874:25): [True: 35, False: 6.41k]
  |  Branch (3874:55): [True: 35, False: 0]
  ------------------
 3875|     35|                    {
 3876|       |                        /* make explicit isotopic H implicit */
 3877|     35|                        new_at[i].num_iso_H[new_at[n].iso_atw_diff - 1]++; /*  isotopic H */
 3878|     35|                        num_HydrogenAt += !new_HydrogenAt_order[new_at[n].iso_atw_diff];
 3879|     35|                        new_HydrogenAt_order[new_at[n].iso_atw_diff] = k + 1;
 3880|     35|                    }
 3881|  6.41k|                    else
 3882|  6.41k|                    {
 3883|       |                        /* make explicit non-isotopic H implicit */
 3884|  6.41k|                        new_at[i].num_H++; /*  non-isotopic H */
 3885|  6.41k|                        num_HydrogenAt += !num_H;
 3886|  6.41k|                        num_H++;
 3887|  6.41k|                        new_HydrogenAt_order[0] = k + 1;
 3888|  6.41k|                    }
 3889|       |                    /*  decrement chem. bonds valence because one bond is removed */
 3890|  6.45k|                    new_at[i].chem_bonds_valence = inchi_max(0, new_at[i].chem_bonds_valence - 1);
  ------------------
  |  |  138|  6.45k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 6.45k]
  |  |  ------------------
  ------------------
 3891|  6.45k|                    new_at[n].neighbor[0] = i; /*  update removed hydrogen neighbor number */
 3892|  6.45k|                    if (new_at[i].sb_parity[0])
  ------------------
  |  Branch (3892:25): [True: 103, False: 6.35k]
  ------------------
 3893|    103|                    {
 3894|       |                        /* if the removed H is an SB neighbor then mark it as removed */
 3895|    206|                        for (m = 0; m < MAX_NUM_STEREO_BONDS && new_at[i].sb_parity[m]; m++)
  ------------------
  |  |  873|    412|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (3895:37): [True: 206, False: 0]
  |  Branch (3895:65): [True: 103, False: 103]
  ------------------
 3896|    103|                        {
 3897|    103|                            if (k == (int)new_at[i].sn_ord[m])
  ------------------
  |  Branch (3897:33): [True: 84, False: 19]
  ------------------
 3898|     84|                            {
 3899|     84|                                new_at[i].sn_ord[m] = -(new_at[n].iso_atw_diff + 1);
 3900|       |                                /* means the SB neighbor has been removed; (-4)=H, (-3)=1H, (-2)=D, (-1)=T */
 3901|     84|                            }
 3902|    103|                        }
 3903|    103|                    }
 3904|  6.45k|                }
 3905|  35.5k|                else
 3906|  35.5k|                {
 3907|       |                    /* discovered a regular (not an explicit H) neighbor */
 3908|  35.5k|                    if (new_at[i].sb_parity[0])
  ------------------
  |  Branch (3908:25): [True: 298, False: 35.2k]
  ------------------
 3909|    298|                    {
 3910|    298|                        if (num_OtherNeigh < MAX_NUM_STEREO_BONDS)
  ------------------
  |  |  873|    298|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (3910:29): [True: 298, False: 0]
  ------------------
 3911|    298|                        {
 3912|    298|                            new_OtherNeigh_order[num_OtherNeigh] = k + 1;
 3913|    298|                        }
 3914|    298|                        num_OtherNeigh++; /* increment outside of if() to detect overflow */
 3915|    298|                        if (val != k)
  ------------------
  |  Branch (3915:29): [True: 57, False: 241]
  ------------------
 3916|     57|                        {
 3917|       |                            /* store new stereobond and sb-neighbor ordering numbers */
 3918|    114|                            for (m = 0; m < MAX_NUM_STEREO_BONDS && new_at[i].sb_parity[m]; m++)
  ------------------
  |  |  873|    228|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (3918:41): [True: 114, False: 0]
  |  Branch (3918:69): [True: 57, False: 57]
  ------------------
 3919|     57|                            {
 3920|     57|                                if (k == (int)new_at[i].sb_ord[m])
  ------------------
  |  Branch (3920:37): [True: 45, False: 12]
  ------------------
 3921|     45|                                    new_at[i].sb_ord[m] = val;
 3922|     12|                                else if (k == (int)new_at[i].sn_ord[m])
  ------------------
  |  Branch (3922:42): [True: 0, False: 12]
  ------------------
 3923|      0|                                    new_at[i].sn_ord[m] = val;
 3924|     57|                            }
 3925|     57|                        }
 3926|    298|                    }
 3927|  35.5k|                    new_at[i].neighbor[val] = new_ord[new_at[i].neighbor[k]];
 3928|  35.5k|                    new_at[i].bond_type[val] = new_at[i].bond_type[k];
 3929|  35.5k|                    new_at[i].bond_stereo[val] = new_at[i].bond_stereo[k];
 3930|  35.5k|                    val++;
 3931|  35.5k|                }
 3932|  41.9k|            }
 3933|  20.7k|            if (new_at[i].valence > val && new_at[i].sb_parity[0])
  ------------------
  |  Branch (3933:17): [True: 6.11k, False: 14.6k]
  |  Branch (3933:44): [True: 85, False: 6.02k]
  ------------------
 3934|     85|            {
 3935|     85|                if (num_HydrogenAt == new_at[i].valence - val && num_HydrogenAt + num_OtherNeigh <= MAXVAL)
  ------------------
  |  |   60|     74|#define MAXVAL 50       /* maximum valence */ /* @nnuk : Changed from 20 -> 50 for testing purposes, to account for some structures with one atom having more than 20 bonds */
  ------------------
  |  Branch (3935:21): [True: 74, False: 11]
  |  Branch (3935:66): [True: 74, False: 0]
  ------------------
 3936|     74|                {
 3937|       |                    /* recalculate parity so that it would describe neighbor sequence H,1H,D,T,neigh[0],neigh[1]... */
 3938|     74|                    memmove(new_OtherNeigh_order + num_HydrogenAt, new_OtherNeigh_order, num_OtherNeigh * sizeof(new_OtherNeigh_order[0]));
 3939|    370|                    for (k = 0, j = 1; k <= NUM_H_ISOTOPES; k++)
  ------------------
  |  |   25|    370|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3939:40): [True: 296, False: 74]
  ------------------
 3940|    296|                    {
 3941|    296|                        if (new_HydrogenAt_order[k] && (num_HydrogenAt - j < MAXVAL) && (num_HydrogenAt - j >= 0)) /* djb-rwth: fixing buffer overruns */
  ------------------
  |  |   60|     81|#define MAXVAL 50       /* maximum valence */ /* @nnuk : Changed from 20 -> 50 for testing purposes, to account for some structures with one atom having more than 20 bonds */
  ------------------
  |  Branch (3941:29): [True: 81, False: 215]
  |  Branch (3941:56): [True: 81, False: 0]
  |  Branch (3941:89): [True: 81, False: 0]
  ------------------
 3942|     81|                        {
 3943|     81|                            new_OtherNeigh_order[num_HydrogenAt - j] = new_HydrogenAt_order[k];
 3944|    162|                            for (m = 0; m < MAX_NUM_STEREO_BONDS && new_at[i].sb_parity[m]; m++)
  ------------------
  |  |  873|    324|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (3944:41): [True: 162, False: 0]
  |  Branch (3944:69): [True: 81, False: 81]
  ------------------
 3945|     81|                            {
 3946|     81|                                if ((int)new_at[i].sn_ord[m] == -(k + 1))
  ------------------
  |  Branch (3946:37): [True: 71, False: 10]
  ------------------
 3947|     71|                                {
 3948|     71|                                    new_at[i].sn_ord[m] = -j;
 3949|       |                                    /* negative means explicit H isotope ord are
 3950|       |                                    (contiguously) in front of the adjacency list */
 3951|     71|                                }
 3952|     81|                            }
 3953|     81|                            j++;
 3954|     81|                        }
 3955|    296|                    }
 3956|       |                    /* at this point new_OtherNeigh_order[] contains
 3957|       |                    incremented old ordering numbers in new order */
 3958|     74|                    k = insertions_sort_AT_RANK(new_OtherNeigh_order, num_HydrogenAt + num_OtherNeigh); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
 3959|       |                    /* djb-rwth: removing redundant code */
 3960|       |                    /*if ( k ) {*/
 3961|       |                    /*
 3962|       |                    for ( m = 0; m < MAX_NUM_STEREO_BONDS && new_at[i].sb_parity[m]; m ++ ) {
 3963|       |                    if ( PARITY_WELL_DEF(new_at[i].sb_parity[m]) ) {
 3964|       |                    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 ) {
 3965|       |                    new_at[i].sb_parity[m] = 3 - new_at[i].sb_parity[m];
 3966|       |                    }
 3967|       |                    }
 3968|       |                    }
 3969|       |                    */
 3970|       |                    /*}*/
 3971|     74|                }
 3972|     85|            }
 3973|  20.7k|            new_at[i].valence = val;
 3974|  20.7k|        }
 3975|  5.00k|        memcpy(at, new_at, sizeof(at[0]) * num_atoms);
 3976|  5.00k|        ret = num_others;
 3977|  5.00k|    }
 3978|   101k|    else
 3979|   101k|    {
 3980|   101k|        ret = num_atoms;
 3981|   101k|    }
 3982|       |
 3983|   106k|exit_function:
 3984|       |
 3985|   106k|    if (new_ord)
  ------------------
  |  Branch (3985:9): [True: 106k, False: 0]
  ------------------
 3986|   106k|    {
 3987|   106k|        inchi_free(new_ord);
  ------------------
  |  | 1152|   106k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 106k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 106k]
  |  |  ------------------
  ------------------
 3988|   106k|    }
 3989|   106k|    if (new_at)
  ------------------
  |  Branch (3989:9): [True: 106k, False: 0]
  ------------------
 3990|   106k|    {
 3991|   106k|        inchi_free(new_at);
  ------------------
  |  | 1152|   106k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 106k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 106k]
  |  |  ------------------
  ------------------
 3992|   106k|    }
 3993|       |
 3994|   106k|    return ret;
 3995|   106k|}
get_iat_number:
 4018|  1.06M|{
 4019|  1.06M|    switch (el_number)
 4020|  1.06M|    {
 4021|   109k|    case EL_NUMBER_H:
  ------------------
  |  |   11|   109k|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
  |  Branch (4021:5): [True: 109k, False: 951k]
  ------------------
 4022|   109k|        return IAT_H;
 4023|   106k|    case EL_NUMBER_C:
  ------------------
  |  |   13|   106k|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (4023:5): [True: 106k, False: 954k]
  ------------------
 4024|   106k|        return IAT_C;
 4025|   108k|    case EL_NUMBER_N:
  ------------------
  |  |   14|   108k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (4025:5): [True: 108k, False: 951k]
  ------------------
 4026|   108k|        return IAT_N;
 4027|  19.5k|    case EL_NUMBER_P:
  ------------------
  |  |   18|  19.5k|#define EL_NUMBER_P  ((U_CHAR)15)
  ------------------
  |  Branch (4027:5): [True: 19.5k, False: 1.04M]
  ------------------
 4028|  19.5k|        return IAT_P;
 4029|   194k|    case EL_NUMBER_O:
  ------------------
  |  |   15|   194k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (4029:5): [True: 194k, False: 865k]
  ------------------
 4030|   194k|        return IAT_O;
 4031|  42.6k|    case EL_NUMBER_S:
  ------------------
  |  |   19|  42.6k|#define EL_NUMBER_S  ((U_CHAR)16)
  ------------------
  |  Branch (4031:5): [True: 42.6k, False: 1.01M]
  ------------------
 4032|  42.6k|        return IAT_S;
 4033|  2.49k|    case EL_NUMBER_SE:
  ------------------
  |  |   23|  2.49k|#define EL_NUMBER_SE ((U_CHAR)34)
  ------------------
  |  Branch (4033:5): [True: 2.49k, False: 1.05M]
  ------------------
 4034|  2.49k|        return IAT_Se;
 4035|  3.75k|    case EL_NUMBER_TE:
  ------------------
  |  |   26|  3.75k|#define EL_NUMBER_TE ((U_CHAR)52)
  ------------------
  |  Branch (4035:5): [True: 3.75k, False: 1.05M]
  ------------------
 4036|  3.75k|        return IAT_Te;
 4037|  11.3k|    case EL_NUMBER_F:
  ------------------
  |  |   16|  11.3k|#define EL_NUMBER_F  ((U_CHAR)9)
  ------------------
  |  Branch (4037:5): [True: 11.3k, False: 1.04M]
  ------------------
 4038|  11.3k|        return IAT_F;
 4039|    438|    case EL_NUMBER_CL:
  ------------------
  |  |   20|    438|#define EL_NUMBER_CL ((U_CHAR)17)
  ------------------
  |  Branch (4039:5): [True: 438, False: 1.06M]
  ------------------
 4040|    438|        return IAT_Cl;
 4041|  1.06k|    case EL_NUMBER_BR:
  ------------------
  |  |   24|  1.06k|#define EL_NUMBER_BR ((U_CHAR)35)
  ------------------
  |  Branch (4041:5): [True: 1.06k, False: 1.05M]
  ------------------
 4042|  1.06k|        return IAT_Br;
 4043|  10.6k|    case EL_NUMBER_I:
  ------------------
  |  |   27|  10.6k|#define EL_NUMBER_I  ((U_CHAR)53)
  ------------------
  |  Branch (4043:5): [True: 10.6k, False: 1.04M]
  ------------------
 4044|  10.6k|        return IAT_I;
 4045|   448k|    default:
  ------------------
  |  Branch (4045:5): [True: 448k, False: 611k]
  ------------------
 4046|   448k|        return -1;
 4047|  1.06M|    }
 4048|  1.06M|}
getElValenceforMolecularInorganics:
 4069|  8.64k|{
 4070|  8.64k|    if (charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE || val_num >= MAX_NUM_VALENCES)
  ------------------
  |  |  571|  17.2k|#define MIN_ATOM_CHARGE        (-2)
  ------------------
                  if (charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE || val_num >= MAX_NUM_VALENCES)
  ------------------
  |  |  572|  17.2k|#define MAX_ATOM_CHARGE         2
  ------------------
                  if (charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE || val_num >= MAX_NUM_VALENCES)
  ------------------
  |  |  575|  8.64k|#define MAX_NUM_VALENCES        5                /* max. number + 1 to provide zero termination */
  ------------------
  |  Branch (4070:9): [True: 0, False: 8.64k]
  |  Branch (4070:37): [True: 0, False: 8.64k]
  |  Branch (4070:65): [True: 0, False: 8.64k]
  ------------------
 4071|      0|    {
 4072|      0|        return 0;
 4073|      0|    }
 4074|       |
 4075|  8.64k|    return (int) MolecularInorganicsArray[nPeriodicNum > 1 ? nPeriodicNum + 1 : 0].cValence[NEUTRAL_STATE + charge][val_num];
  ------------------
  |  |  573|  8.64k|#define NEUTRAL_STATE          (-MIN_ATOM_CHARGE)
  |  |  ------------------
  |  |  |  |  571|  8.64k|#define MIN_ATOM_CHARGE        (-2)
  |  |  ------------------
  ------------------
  |  Branch (4075:43): [True: 8.64k, False: 0]
  ------------------
 4076|  8.64k|}
getElTypeforMolecularInorganics:
 4083|  6.37k|{
 4084|  6.37k|    return MolecularInorganicsArray[nPeriodicNum + 1].nType;
 4085|  6.37k|}
MolecularInorganicsIsMetalToDisconnect:
 4093|  6.37k|{
 4094|       |
 4095|  6.37k|    int at_valence, num_H;
 4096|  6.37k|    int type = getElTypeforMolecularInorganics(at[atom_idx].el_number);
 4097|  6.37k|    int j;
 4098|       |
 4099|       |    /* Calculate the actual valence of the atom
 4100|       |     * It means that the total bounding capacity
 4101|       |     * of the atom has to be taken into account
 4102|       |     * which will further get equated within the
 4103|       |     * elements array to a metal atom(neutral or an ion) */
 4104|  6.37k|    num_H = NUMH(at, atom_idx);
  ------------------
  |  |   56|  6.37k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  6.37k|#define NUM_ISO_H(AT, N) (AT[N].num_iso_H[0] + AT[N].num_iso_H[1] + AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
 4105|  6.37k|    at_valence = num_H + at[atom_idx].chem_bonds_valence;
 4106|       |
 4107|  6.37k|    if (!at_valence || (abs(at[atom_idx].charge) > 1))
  ------------------
  |  Branch (4107:9): [True: 2, False: 6.37k]
  |  Branch (4107:24): [True: 707, False: 5.66k]
  ------------------
 4108|    709|    {
 4109|    709|        return 0; /* Isolated metal atom or Atom has multiple charges */
 4110|    709|    }
 4111|       |
 4112|       |    /* Check if the valence matches a known normal valence */
 4113|  24.9k|    for (j = 0; j < 4; j++)
  ------------------
  |  Branch (4113:17): [True: 20.1k, False: 4.75k]
  ------------------
 4114|  20.1k|    {
 4115|  20.1k|        const int bitmask = (1 << j);                              /* Create bitmask for the j-th bit */
 4116|  20.1k|        const bool is_valence_state_valid = (bitmask & type) != 0; /* Check if the j-th valence state is allowed */
 4117|       |
 4118|  20.1k|        if (is_valence_state_valid && at_valence == getElValenceforMolecularInorganics(at[atom_idx].el_number, at[atom_idx].charge, j))
  ------------------
  |  Branch (4118:13): [True: 8.64k, False: 11.5k]
  |  Branch (4118:39): [True: 911, False: 7.73k]
  ------------------
 4119|    911|        {
 4120|    911|            return 1; /* Atom has normal valence follows disconnection logic if applicable */
 4121|    911|        }
 4122|  20.1k|    }
 4123|       |
 4124|       |    /* Default: Valence greater than usual or the atom is isolated hence no disconnection */
 4125|  4.75k|    return 0;
 4126|  5.66k|}
shouldBondBeCut:
 4137|    747|{
 4138|    747|    int index1, index2, binaryValue;
 4139|       |
 4140|       |    /* Bounds-check the 1-based periodic numbers before indexing the
 4141|       |     * NUM_ELEMENTS x NUM_ELEMENTS table. An out-of-range value (e.g. a
 4142|       |     * pseudo-atom with el_number 0, or a number beyond the table) would
 4143|       |     * otherwise read out of bounds. Default to 0 = keep the bond. */
 4144|    747|    if (atom1 < 1 || atom1 > NUM_ELEMENTS || atom2 < 1 || atom2 > NUM_ELEMENTS)
  ------------------
  |  |   12|  1.49k|#define NUM_ELEMENTS 118 /* Adjust according to the number of elements in the array */
  ------------------
                  if (atom1 < 1 || atom1 > NUM_ELEMENTS || atom2 < 1 || atom2 > NUM_ELEMENTS)
  ------------------
  |  |   12|    747|#define NUM_ELEMENTS 118 /* Adjust according to the number of elements in the array */
  ------------------
  |  Branch (4144:9): [True: 0, False: 747]
  |  Branch (4144:22): [True: 0, False: 747]
  |  Branch (4144:46): [True: 0, False: 747]
  |  Branch (4144:59): [True: 0, False: 747]
  ------------------
 4145|      0|    {
 4146|      0|        return 0;
 4147|      0|    }
 4148|       |
 4149|       |    /* Get the indices corresponding to the atomic numbers */
 4150|    747|    index1 = atom1 - 1;
 4151|    747|    index2 = atom2 - 1;
 4152|       |
 4153|       |    /* Retrieve the binary value from the binary array */
 4154|    747|    binaryValue = binaryArrayMolecularInorganics[index1][index2];
 4155|       |
 4156|       |    /* Output for debugging purposes */
 4157|       |    /*printf("Electronegativity binary value between the atom and it's neighbour is: %d\n", binaryValue); */
 4158|       |
 4159|    747|    return binaryValue;
 4160|    747|}
updateNeighborListMolecularInorganics:
 4168|    358|{
 4169|       |
 4170|    358|    int valence = at[atom_idx].valence;
 4171|    358|    int i, j;
 4172|       |
 4173|    721|    for (i = 0; i < valence; i++)
  ------------------
  |  Branch (4173:17): [True: 363, False: 358]
  ------------------
 4174|    363|    {
 4175|    363|        if (at[atom_idx].neighbor[i] == neighbor_idx)
  ------------------
  |  Branch (4175:13): [True: 0, False: 363]
  ------------------
 4176|      0|        {
 4177|       |            /* Shift remaining neighbors to fill the gap */
 4178|      0|            for (j = i; j < valence - 1; j++)
  ------------------
  |  Branch (4178:25): [True: 0, False: 0]
  ------------------
 4179|      0|            {
 4180|      0|                at[atom_idx].neighbor[j] = at[atom_idx].neighbor[j + 1];
 4181|      0|            }
 4182|      0|            at[atom_idx].valence--; /* Reduce the valence (number of neighbors) */
 4183|       |
 4184|      0|            break;
 4185|      0|        }
 4186|    363|    }
 4187|    358|}
MolecularInorganicsPreprocessing:
 4393|  70.4k|{
 4394|  70.4k|    int ret_code = 0;
 4395|       |
 4396|  70.4k|    if (!ip || !orig_at_data || !orig_at_data->at)
  ------------------
  |  Branch (4396:9): [True: 0, False: 70.4k]
  |  Branch (4396:16): [True: 0, False: 70.4k]
  |  Branch (4396:33): [True: 0, False: 70.4k]
  ------------------
 4397|      0|    {
 4398|      0|        return -1;
 4399|      0|    }
 4400|       |
 4401|  70.4k|    if (!ip->bMolecularInorganics)
  ------------------
  |  Branch (4401:9): [True: 0, False: 70.4k]
  ------------------
 4402|      0|    {
 4403|      0|        return -1;
 4404|      0|    }
 4405|       |
 4406|  70.4k|    ip->bMolecularInorganicsReconnectedInChI = 0;  /*@nnuk: flag reset*/
 4407|       |
 4408|       |    /* Pointer to the array of input atoms from the original atom data structure */
 4409|  70.4k|    inp_ATOM *at = orig_at_data->at;
 4410|       |
 4411|       |    /* Total number of input atoms present in the molecular structure */
 4412|  70.4k|    int num_at = orig_at_data->num_inp_atoms;
 4413|       |
 4414|       |    /* Pointer to the array storing the old component numbers for each atom, used for tracking connectivity */
 4415|  70.4k|    AT_NUMB *nOldCompNumber = orig_at_data->nOldCompNumber;
 4416|       |
 4417|       |    /* Track number of disconnections */
 4418|  70.4k|    int num_disconnected = 0;
 4419|       |
 4420|       |    /* variables declared */
 4421|  70.4k|    int i, j, n, k;
 4422|  70.4k|    int binaryValue;
 4423|  70.4k|    int disconnectDecision;
 4424|  70.4k|    int neigh_pos;
 4425|  70.4k|    int neighbor_idx;
 4426|  70.4k|    int num_metals;
 4427|  70.4k|    int all_metal_atoms_terminal;
 4428|  70.4k|    int has_single_bond_to_metal;
 4429|  70.4k|    int keep_all_metal_bonds;
 4430|       |
 4431|       |    /* memory allocation */
 4432|  70.4k|    S_CHAR* dfs_visited = (S_CHAR*)inchi_calloc(num_at, sizeof(S_CHAR));
  ------------------
  |  | 1146|  70.4k|#define inchi_calloc   calloc
  ------------------
 4433|  70.4k|    int* dfs_stack = (int*)inchi_malloc(num_at * sizeof(int));
  ------------------
  |  | 1143|  70.4k|#define inchi_malloc   malloc
  ------------------
 4434|       |
 4435|  70.4k|    if (!dfs_visited || !dfs_stack)
  ------------------
  |  Branch (4435:9): [True: 0, False: 70.4k]
  |  Branch (4435:25): [True: 0, False: 70.4k]
  ------------------
 4436|      0|    {
 4437|      0|        ret_code = -1;
 4438|      0|        goto cleanup;
 4439|      0|    }
 4440|       |
 4441|       |    /* Before disconnection, invoke ammonium salt functions */
 4442|   229k|    for (j = 0; j < num_at; j++)
  ------------------
  |  Branch (4442:17): [True: 159k, False: 70.4k]
  ------------------
 4443|   159k|    {
 4444|   159k|        int piO, pk;
 4445|   159k|        S_CHAR num_explicit_H[NUM_H_ISOTOPES + 1];
 4446|       |
 4447|   159k|        if (bIsAmmoniumSalt(at, j, &piO, &pk, num_explicit_H))
  ------------------
  |  Branch (4447:13): [True: 0, False: 159k]
  ------------------
 4448|      0|        {
 4449|      0|            DisconnectAmmoniumSalt(at, j, piO, pk, num_explicit_H);
 4450|      0|        }
 4451|   159k|    }
 4452|       |
 4453|       |    /*
 4454|       |     * Detect ring systems before the charge-separated bond pass so that a
 4455|       |     * qualifying metal-containing chelate ring is not disconnected before
 4456|       |     * the chelate protection rule can be applied.
 4457|       |     */
 4458|  70.4k|    MarkRingSystemsInp(at, num_at, 0);
 4459|       |
 4460|       |    /* Disconnect charge-separated metal-ligand bonds, preserving the drawn
 4461|       |     * formal charges. A metal and ligand carrying opposite formal charges
 4462|       |     * across a single (type 1) or coordinative (type 9) bond depict an ionic
 4463|       |     * interaction (e.g. M(2+) ... L(2-)) and must split into the drawn ions
 4464|       |     * regardless of the metal's nominal valence or the presence of other
 4465|       |     * metals in the same component - the heuristics in the disconnection loop
 4466|       |     * below would otherwise keep these bonds connected. DisconnectInpAtBond
 4467|       |     * also decrements valence and chem_bonds_valence on both atoms (a type-9
 4468|       |     * bond counts as single), so no charge is added or removed here: each ion
 4469|       |     * keeps exactly the charge drawn in the input. Higher-order bonds (e.g. a
 4470|       |     * drawn M=O double bond) are genuine covalent bonds and are left intact.
 4471|       |     *
 4472|       |     *
 4473|       |     * An exception is made for non-Group-1/2 metals that belong to a ring
 4474|       |     * containing at least three carbon, nitrogen, or oxygen atoms. Such bonds
 4475|       |     * form part of a qualifying chelate ring and must remain connected.*/
 4476|   229k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (4476:17): [True: 159k, False: 70.4k]
  ------------------
 4477|   159k|    {
 4478|   282k|        for (k = 0; k < at[i].valence; )
  ------------------
  |  Branch (4478:21): [True: 123k, False: 159k]
  ------------------
 4479|   123k|        {
 4480|   123k|            int metal_idx;
 4481|   123k|            int ring_cno_count = 0;
 4482|       |
 4483|   123k|            j = at[i].neighbor[k];
 4484|       |
 4485|       |            /* Process each undirected bond once, from its lower-indexed atom,
 4486|       |             * and only charge-separated metal/non-metal single or coordinative
 4487|       |             * bonds. */
 4488|   123k|            if (j <= i || j >= num_at ||
  ------------------
  |  Branch (4488:17): [True: 61.0k, False: 62.0k]
  |  Branch (4488:27): [True: 0, False: 62.0k]
  ------------------
 4489|  62.0k|                (at[i].bond_type[k] != COORDINATIVE_BOND &&
  ------------------
  |  |  264|   124k|#define COORDINATIVE_BOND 9             /* (@nnuk) introduction of bond_type = 9 (Coordinative Bond) */
  ------------------
  |  Branch (4489:18): [True: 62.0k, False: 0]
  ------------------
 4490|  62.0k|                    at[i].bond_type[k] != BOND_TYPE_SINGLE) ||
  ------------------
  |  |   32|  62.0k|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (4490:21): [True: 19.7k, False: 42.3k]
  ------------------
 4491|  42.3k|                is_el_a_metal(at[i].el_number) ==
  ------------------
  |  Branch (4491:17): [True: 32.1k, False: 10.1k]
  ------------------
 4492|  42.3k|                is_el_a_metal(at[j].el_number) ||
 4493|  10.1k|                !((at[i].charge > 0 && at[j].charge < 0) ||
  ------------------
  |  Branch (4493:20): [True: 2.63k, False: 7.53k]
  |  Branch (4493:40): [True: 691, False: 1.94k]
  ------------------
 4494|  9.47k|                    (at[i].charge < 0 && at[j].charge > 0)))
  ------------------
  |  Branch (4494:22): [True: 981, False: 8.49k]
  |  Branch (4494:42): [True: 321, False: 660]
  ------------------
 4495|   122k|            {
 4496|   122k|                k++;
 4497|   122k|                continue;
 4498|   122k|            }
 4499|       |
 4500|  1.01k|            metal_idx = is_el_a_metal(at[i].el_number) ? i : j;
  ------------------
  |  Branch (4500:25): [True: 445, False: 567]
  ------------------
 4501|       |
 4502|       |            /*
 4503|       |             * Deliberately apply the chelate-ring protection in this preliminary
 4504|       |             * charge-separated bond pass. Without this check, an explicitly charged
 4505|       |             * chelate of a non-Group-1/2 metal could be disconnected before the main
 4506|       |             * decision-tree pass evaluates whether its metal bonds must be retained.
 4507|       |             *
 4508|       |             * The ring criterion follows the 2026-07-16 Molecular Inorganics decision
 4509|       |             * tree: the metal-containing ring system must contain at least three atoms
 4510|       |             * selected from C, N, and O.
 4511|       |            */
 4512|  1.01k|            ring_cno_count = MolecularInorganicsCountRingCNOAtoms(at, num_at, metal_idx);
 4513|       |
 4514|  1.01k|            if (ring_cno_count >= 3)
  ------------------
  |  Branch (4514:17): [True: 71, False: 941]
  ------------------
 4515|     71|            {
 4516|     71|                k++;
 4517|     71|                continue;
 4518|     71|            }
 4519|       |
 4520|    941|            DisconnectInpAtBond(at, nOldCompNumber, i, k);
 4521|    941|            num_disconnected++;
 4522|    941|            ip->bMolecularInorganicsReconnectedInChI = 1;
 4523|    941|        }
 4524|   159k|    }
 4525|       |
 4526|       |    /* Realize the remaining (uncharged) coordinative (type 9) bonds as single
 4527|       |     * bonds, so the rest of the pipeline treats them like the equivalent
 4528|       |     * single-bonded structure.
 4529|       |    */
 4530|  70.4k|    ConvertCoordinativeBondsToSingle(at, num_at);
 4531|       |
 4532|       |    /*
 4533|       |     * Re-perceive ring systems after the charge-separated bond disconnections,
 4534|       |     * because those graph changes may alter the ring membership used by the
 4535|       |     * main Molecular Inorganics decision-tree evaluation.
 4536|       |    */
 4537|  70.4k|    MarkRingSystemsInp(at, num_at, 0);
 4538|       |
 4539|       |    /* Compute the number of metals and whether every metal is terminal. */
 4540|  70.4k|    num_metals = 0;
 4541|  70.4k|    all_metal_atoms_terminal = 1;
 4542|       |
 4543|   229k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (4543:17): [True: 159k, False: 70.4k]
  ------------------
 4544|   159k|    {
 4545|   159k|        if (is_el_a_metal(at[i].el_number))
  ------------------
  |  Branch (4545:13): [True: 10.1k, False: 149k]
  ------------------
 4546|  10.1k|        {
 4547|  10.1k|            num_metals++;
 4548|       |
 4549|  10.1k|            if (at[i].valence != 1 || at[i].bond_type[0] != BOND_TYPE_SINGLE)
  ------------------
  |  |   32|  4.22k|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (4549:17): [True: 5.91k, False: 4.22k]
  |  Branch (4549:39): [True: 602, False: 3.61k]
  ------------------
 4550|  6.51k|            {
 4551|  6.51k|                all_metal_atoms_terminal = 0;
 4552|  6.51k|            }
 4553|  10.1k|        }
 4554|   159k|    }
 4555|       |
 4556|  70.4k|    if (!num_metals)
  ------------------
  |  Branch (4556:9): [True: 61.9k, False: 8.48k]
  ------------------
 4557|  61.9k|    {
 4558|  61.9k|        goto cleanup;
 4559|  61.9k|    }
 4560|       |
 4561|       |    /* Check whether at least one single bond remains attached to a metal. */
 4562|  8.48k|    has_single_bond_to_metal = 0;
 4563|       |
 4564|  30.0k|    for (i = 0; i < num_at && !has_single_bond_to_metal; i++)
  ------------------
  |  Branch (4564:17): [True: 27.3k, False: 2.71k]
  |  Branch (4564:31): [True: 21.6k, False: 5.77k]
  ------------------
 4565|  21.6k|    {
 4566|  21.6k|        if (!is_el_a_metal(at[i].el_number))
  ------------------
  |  Branch (4566:13): [True: 12.9k, False: 8.69k]
  ------------------
 4567|  12.9k|        {
 4568|  12.9k|            continue;
 4569|  12.9k|        }
 4570|       |
 4571|  11.5k|        for (n = 0; n < at[i].valence; n++)
  ------------------
  |  Branch (4571:21): [True: 9.09k, False: 2.40k]
  ------------------
 4572|  9.09k|        {
 4573|  9.09k|            if (at[i].bond_type[n] == BOND_TYPE_SINGLE)
  ------------------
  |  |   32|  9.09k|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (4573:17): [True: 6.28k, False: 2.81k]
  ------------------
 4574|  6.28k|            {
 4575|  6.28k|                has_single_bond_to_metal = 1;
 4576|  6.28k|                break;
 4577|  6.28k|            }
 4578|  9.09k|        }
 4579|  8.69k|    }
 4580|       |
 4581|  8.48k|    if (!has_single_bond_to_metal)
  ------------------
  |  Branch (4581:9): [True: 2.20k, False: 6.28k]
  ------------------
 4582|  2.20k|    {
 4583|  2.20k|        goto cleanup;
 4584|  2.20k|    }
 4585|       |
 4586|       |    /* Evaluate the complete decision tree before changing any remaining
 4587|       |     * metal-ligand bond. If one bond must be retained, all remaining bonds to
 4588|       |     * metal atoms are retained. */
 4589|  6.28k|    keep_all_metal_bonds = 0;
 4590|       |
 4591|  22.7k|    for (i = 0; i < num_at && !keep_all_metal_bonds; i++)
  ------------------
  |  Branch (4591:17): [True: 22.1k, False: 664]
  |  Branch (4591:31): [True: 16.4k, False: 5.61k]
  ------------------
 4592|  16.4k|    {
 4593|  16.4k|        int ring_cno_count = 0;
 4594|  16.4k|        int current_metal_is_group_1_or_2;
 4595|       |
 4596|  16.4k|        if (!is_el_a_metal(at[i].el_number))
  ------------------
  |  Branch (4596:13): [True: 10.1k, False: 6.37k]
  ------------------
 4597|  10.1k|        {
 4598|  10.1k|            continue;
 4599|  10.1k|        }
 4600|       |
 4601|  6.37k|        current_metal_is_group_1_or_2 = MolecularInorganicsIsGroup1or2Metal(at[i].el_number);
 4602|       |
 4603|       |        /*
 4604|       |         * Count C, N, and O atoms in the same ring system as the metal.
 4605|       |         * Group 1 and Group 2 metals are excluded from chelate protection.
 4606|       |         */
 4607|  6.37k|        ring_cno_count = MolecularInorganicsCountRingCNOAtoms(at, num_at, i);
 4608|       |
 4609|  6.37k|        disconnectDecision = MolecularInorganicsIsMetalToDisconnect(at, i);
 4610|       |
 4611|  6.65k|        for (n = 0; n < at[i].valence; n++)
  ------------------
  |  Branch (4611:21): [True: 6.39k, False: 258]
  ------------------
 4612|  6.39k|        {
 4613|  6.39k|            int bond_has_stereo = 0;
 4614|  6.39k|            int bond_links_to_other_metal = 0;
 4615|  6.39k|            int dfs_stack_size;
 4616|       |
 4617|  6.39k|            neighbor_idx = at[i].neighbor[n];
 4618|       |
 4619|  6.39k|            if (neighbor_idx < 0 || neighbor_idx >= num_at)
  ------------------
  |  Branch (4619:17): [True: 0, False: 6.39k]
  |  Branch (4619:37): [True: 0, False: 6.39k]
  ------------------
 4620|      0|            {
 4621|      0|                continue;
 4622|      0|            }
 4623|       |
 4624|  6.39k|            bond_has_stereo = MolecularInorganicsBondHasStereo(at, i, n);
 4625|       |
 4626|       |            /* The actual bond must be a non-stereogenic single bond. */
 4627|  6.39k|            if (at[i].bond_type[n] != BOND_TYPE_SINGLE || bond_has_stereo)
  ------------------
  |  |   32|  12.7k|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (4627:17): [True: 1.76k, False: 4.62k]
  |  Branch (4627:59): [True: 0, False: 4.62k]
  ------------------
 4628|  1.76k|            {
 4629|  1.76k|                keep_all_metal_bonds = 1;
 4630|  1.76k|                break;
 4631|  1.76k|            }
 4632|       |
 4633|  4.62k|            if (disconnectDecision != 1)
  ------------------
  |  Branch (4633:17): [True: 3.88k, False: 747]
  ------------------
 4634|  3.88k|            {
 4635|  3.88k|                keep_all_metal_bonds = 1;
 4636|  3.88k|                break;
 4637|  3.88k|            }
 4638|       |
 4639|       |            /* The bonded atom pair must satisfy the binary disconnection table. */
 4640|    747|            binaryValue = shouldBondBeCut(at[i].el_number, at[neighbor_idx].el_number);
 4641|       |
 4642|    747|            if (binaryValue != 1)
  ------------------
  |  Branch (4642:17): [True: 467, False: 280]
  ------------------
 4643|    467|            {
 4644|    467|                keep_all_metal_bonds = 1;
 4645|    467|                break;
 4646|    467|            }
 4647|       |
 4648|       |            /* Determine whether the actual bond is part of a path from this
 4649|       |             * metal atom to another metal atom. The current metal is excluded
 4650|       |             * from the traversal so that only paths starting through this bond
 4651|       |             * are considered. */
 4652|    280|            memset(dfs_visited, 0, num_at * sizeof(*dfs_visited));
 4653|    280|            dfs_stack_size = 0;
 4654|    280|            dfs_visited[i] = 1;
 4655|    280|            dfs_visited[neighbor_idx] = 1;
 4656|    280|            dfs_stack[dfs_stack_size++] = neighbor_idx;
 4657|       |
 4658|  1.22k|            while (dfs_stack_size && !bond_links_to_other_metal)
  ------------------
  |  Branch (4658:20): [True: 1.04k, False: 183]
  |  Branch (4658:38): [True: 1.04k, False: 0]
  ------------------
 4659|  1.04k|            {
 4660|  1.04k|                int current_atom = dfs_stack[--dfs_stack_size];
 4661|       |
 4662|  1.04k|                if (is_el_a_metal(at[current_atom].el_number))
  ------------------
  |  Branch (4662:21): [True: 97, False: 946]
  ------------------
 4663|     97|                {
 4664|     97|                    bond_links_to_other_metal = 1;
 4665|     97|                    break;
 4666|     97|                }
 4667|       |
 4668|  2.90k|                for (neigh_pos = 0; neigh_pos < at[current_atom].valence; neigh_pos++)
  ------------------
  |  Branch (4668:37): [True: 1.96k, False: 946]
  ------------------
 4669|  1.96k|                {
 4670|  1.96k|                    int neighbor_atom = at[current_atom].neighbor[neigh_pos];
 4671|       |
 4672|  1.96k|                    if (neighbor_atom < 0 || neighbor_atom >= num_at || dfs_visited[neighbor_atom])
  ------------------
  |  Branch (4672:25): [True: 0, False: 1.96k]
  |  Branch (4672:46): [True: 0, False: 1.96k]
  |  Branch (4672:73): [True: 1.17k, False: 784]
  ------------------
 4673|  1.17k|                    {
 4674|  1.17k|                        continue;
 4675|  1.17k|                    }
 4676|       |
 4677|    784|                    dfs_visited[neighbor_atom] = 1;
 4678|    784|                    dfs_stack[dfs_stack_size++] = neighbor_atom;
 4679|    784|                }
 4680|    946|            }
 4681|       |
 4682|       |            /*
 4683|       |             * Retain a linkage to another metal unless:
 4684|       |             * 1) all metal atoms are terminal, or
 4685|       |             * 2) the current metal belongs to Group 1 or Group 2.
 4686|       |            */
 4687|    280|            if (bond_links_to_other_metal && !all_metal_atoms_terminal && !current_metal_is_group_1_or_2)
  ------------------
  |  Branch (4687:17): [True: 97, False: 183]
  |  Branch (4687:46): [True: 89, False: 8]
  |  Branch (4687:75): [True: 2, False: 87]
  ------------------
 4688|      2|            {
 4689|      2|                keep_all_metal_bonds = 1;
 4690|      2|                break;
 4691|      2|            }
 4692|       |
 4693|       |            /*
 4694|       |             * Protect a qualifying chelate ring. Group 1 and Group 2 metals return
 4695|       |             * zero from MolecularInorganicsCountRingCNOAtoms().
 4696|       |            */
 4697|    278|            if (ring_cno_count >= 3)
  ------------------
  |  Branch (4697:17): [True: 2, False: 276]
  ------------------
 4698|      2|            {
 4699|      2|                keep_all_metal_bonds = 1;
 4700|      2|                break;
 4701|      2|            }
 4702|    278|        }
 4703|  6.37k|    }
 4704|       |
 4705|  6.28k|    if (keep_all_metal_bonds)
  ------------------
  |  Branch (4705:9): [True: 6.11k, False: 164]
  ------------------
 4706|  6.11k|    {
 4707|  6.11k|        ip->bMolecularInorganicsReconnectedInChI = 1;
 4708|  6.11k|        goto cleanup;
 4709|  6.11k|    }
 4710|       |
 4711|       |    /* All remaining metal bonds satisfy the complete decision tree and may be
 4712|       |     * disconnected.
 4713|       |    **/
 4714|  1.06k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (4714:17): [True: 896, False: 164]
  ------------------
 4715|    896|    {
 4716|    896|        if (!is_el_a_metal(at[i].el_number))
  ------------------
  |  Branch (4716:13): [True: 729, False: 167]
  ------------------
 4717|    729|        {
 4718|    729|            continue;
 4719|    729|        }
 4720|       |
 4721|    346|        for (n = at[i].valence - 1; n >= 0; n--)
  ------------------
  |  Branch (4721:37): [True: 179, False: 167]
  ------------------
 4722|    179|        {
 4723|    179|            neighbor_idx = at[i].neighbor[n];
 4724|       |
 4725|    179|            if (neighbor_idx < 0 || neighbor_idx >= num_at)
  ------------------
  |  Branch (4725:17): [True: 0, False: 179]
  |  Branch (4725:37): [True: 0, False: 179]
  ------------------
 4726|      0|            {
 4727|      0|                continue;
 4728|      0|            }
 4729|       |
 4730|    179|            DisconnectInpAtBond(at, nOldCompNumber, i, n);
 4731|       |
 4732|       |            /* Updating the metal as well as neighbor list */
 4733|    179|            updateNeighborListMolecularInorganics(at, i, neighbor_idx);
 4734|    179|            updateNeighborListMolecularInorganics(at, neighbor_idx, i);
 4735|       |
 4736|    179|            at[i].charge += 1;            /* Metal atom loses an electron -> +1 charge */
 4737|    179|            at[neighbor_idx].charge -= 1; /* Neighbor atom gains an electron -> -1 charge */
 4738|       |
 4739|    179|            num_disconnected++;
 4740|    179|        }
 4741|    167|    }
 4742|       |
 4743|  70.4k|cleanup:
 4744|  70.4k|    if (dfs_visited) inchi_free(dfs_visited);
  ------------------
  |  | 1152|  70.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 70.4k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 70.4k]
  |  |  ------------------
  ------------------
  |  Branch (4744:9): [True: 70.4k, False: 0]
  ------------------
 4745|  70.4k|    if (dfs_stack) inchi_free(dfs_stack);
  ------------------
  |  | 1152|  70.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 70.4k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 70.4k]
  |  |  ------------------
  ------------------
  |  Branch (4745:9): [True: 70.4k, False: 0]
  ------------------
 4746|       |
 4747|  70.4k|    return (ret_code < 0) ? ret_code : num_disconnected;
  ------------------
  |  Branch (4747:12): [True: 0, False: 70.4k]
  ------------------
 4748|    164|}
bHeteroAtomMayHaveXchgIsoH:
 4754|  3.38k|{
 4755|  3.38k|    inp_ATOM *at = atom + iat, *at2;
 4756|  3.38k|    int j, val, is_H = 0, num_H, iat_numb, bAccept; /* djb-rwth: removing redundant variables */
 4757|       |
 4758|  3.38k|    if (0 > (iat_numb = get_iat_number(at->el_number)))
  ------------------
  |  Branch (4758:9): [True: 125, False: 3.26k]
  ------------------
 4759|    125|    {
 4760|    125|        return 0;
 4761|    125|    }
 4762|       |
 4763|  3.26k|    if (abs(at->charge) > 1 || (at->radical && RADICAL_SINGLET != at->radical)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   75|    227|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (4763:9): [True: 9, False: 3.25k]
  |  Branch (4763:33): [True: 227, False: 3.02k]
  |  Branch (4763:48): [True: 227, False: 0]
  ------------------
 4764|    236|    {
 4765|    236|        return 0;
 4766|    236|    }
 4767|       |
 4768|  3.02k|    val = -1;
 4769|  3.02k|    switch (iat_numb)
  ------------------
  |  Branch (4769:13): [True: 2.93k, False: 88]
  ------------------
 4770|  3.02k|    {
 4771|  1.21k|    case IAT_N:
  ------------------
  |  Branch (4771:5): [True: 1.21k, False: 1.80k]
  ------------------
 4772|  1.23k|    case IAT_P:
  ------------------
  |  Branch (4772:5): [True: 14, False: 3.01k]
  ------------------
 4773|       |        /* djb-rwth: removing redundant code */
 4774|  1.23k|        val = 3 + at->charge;
 4775|  1.23k|        break;
 4776|       |
 4777|    134|    case IAT_O:
  ------------------
  |  Branch (4777:5): [True: 134, False: 2.89k]
  ------------------
 4778|    203|    case IAT_S:
  ------------------
  |  Branch (4778:5): [True: 69, False: 2.95k]
  ------------------
 4779|    204|    case IAT_Se:
  ------------------
  |  Branch (4779:5): [True: 1, False: 3.02k]
  ------------------
 4780|    209|    case IAT_Te:
  ------------------
  |  Branch (4780:5): [True: 5, False: 3.01k]
  ------------------
 4781|       |        /* djb-rwth: removing redundant code */
 4782|    209|        val = 2 + at->charge;
 4783|    209|        break;
 4784|       |
 4785|     11|    case IAT_F:
  ------------------
  |  Branch (4785:5): [True: 11, False: 3.01k]
  ------------------
 4786|     35|    case IAT_Cl:
  ------------------
  |  Branch (4786:5): [True: 24, False: 3.00k]
  ------------------
 4787|     37|    case IAT_Br:
  ------------------
  |  Branch (4787:5): [True: 2, False: 3.02k]
  ------------------
 4788|     82|    case IAT_I:
  ------------------
  |  Branch (4788:5): [True: 45, False: 2.97k]
  ------------------
 4789|     82|        if (at->charge == 0)
  ------------------
  |  Branch (4789:13): [True: 51, False: 31]
  ------------------
 4790|     51|        {
 4791|       |            /* djb-rwth: removing redundant code */
 4792|     51|            val = 1;
 4793|     51|        }
 4794|     82|        break;
 4795|       |
 4796|  1.41k|    case IAT_H:
  ------------------
  |  Branch (4796:5): [True: 1.41k, False: 1.61k]
  ------------------
 4797|  1.41k|        if (at->valence == 0 &&
  ------------------
  |  Branch (4797:13): [True: 657, False: 757]
  ------------------
 4798|    657|            at->charge == 1)
  ------------------
  |  Branch (4798:13): [True: 651, False: 6]
  ------------------
 4799|    651|        {
 4800|    651|            is_H = 1; /* isolated proton */
 4801|    651|            val = 0;
 4802|    651|        }
 4803|  3.02k|    }
 4804|  3.02k|    if (val < 0)
  ------------------
  |  Branch (4804:9): [True: 882, False: 2.14k]
  ------------------
 4805|    882|    {
 4806|    882|        return 0;
 4807|    882|    }
 4808|  2.14k|    num_H = NUMH(at, 0);
  ------------------
  |  |   56|  2.14k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  2.14k|#define NUM_ISO_H(AT, N) (AT[N].num_iso_H[0] + AT[N].num_iso_H[1] + AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
 4809|  2.14k|    if (val != at->chem_bonds_valence + num_H)
  ------------------
  |  Branch (4809:9): [True: 1.16k, False: 976]
  ------------------
 4810|  1.16k|    {
 4811|  1.16k|        return 0;
 4812|  1.16k|    }
 4813|    976|    if (is_H)
  ------------------
  |  Branch (4813:9): [True: 651, False: 325]
  ------------------
 4814|    651|    {
 4815|    651|        return 2; /* H atom */
 4816|    651|    }
 4817|    325|    else
 4818|    325|    {
 4819|       |        /* djb-rwth: removing redundant code */
 4820|    765|        for (j = 0, bAccept = 1; j < at->valence && bAccept; j++)
  ------------------
  |  Branch (4820:34): [True: 516, False: 249]
  |  Branch (4820:53): [True: 516, False: 0]
  ------------------
 4821|    516|        {
 4822|    516|            at2 = atom + (int)at->neighbor[j];
 4823|    516|            if ((at2->charge && at->charge) ||
  ------------------
  |  Branch (4823:18): [True: 64, False: 452]
  |  Branch (4823:33): [True: 49, False: 15]
  ------------------
 4824|    467|                (at2->radical && RADICAL_SINGLET != at2->radical)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   75|     27|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (4824:18): [True: 27, False: 440]
  |  Branch (4824:34): [True: 27, False: 0]
  ------------------
 4825|     76|            {
 4826|     76|                return 0; /* adjacent charged/radical atoms: do not neutralizate */
 4827|     76|            }
 4828|    516|        }
 4829|    325|    }
 4830|       |
 4831|    249|    return 1;
 4832|    976|}
bNumHeterAtomHasIsotopicH:
 4838|   216k|{
 4839|   216k|    int i, j, val, is_H = 0, num_H, iat_numb, bAccept, num_iso_H, cur_num_iso_H, num_iso_atoms; /* djb-rwth: removing redundant variables */
 4840|   216k|    inp_ATOM *at, *at2;
 4841|       |
 4842|   216k|    num_iso_H = 0;
 4843|   216k|    num_iso_atoms = 0;
 4844|       |
 4845|  1.27M|    for (i = 0, at = atom; i < num_atoms; i++, at++)
  ------------------
  |  Branch (4845:28): [True: 1.05M, False: 216k]
  ------------------
 4846|  1.05M|    {
 4847|       |
 4848|  1.05M|        num_iso_atoms += (at->iso_atw_diff != 0 || NUM_ISO_H(at, 0));
  ------------------
  |  |   55|  1.05M|#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 (55:26): [True: 869, False: 1.05M]
  |  |  ------------------
  ------------------
  |  Branch (4848:27): [True: 982, False: 1.05M]
  ------------------
 4849|       |        /* isotopic atoms and implicit isotopic H */
 4850|       |
 4851|  1.05M|        if (0 > (iat_numb = get_iat_number(at->el_number)))
  ------------------
  |  Branch (4851:13): [True: 448k, False: 608k]
  ------------------
 4852|   448k|        {
 4853|   448k|            continue;
 4854|   448k|        }
 4855|       |
 4856|   608k|        if (abs(at->charge) > 1 || (at->radical && RADICAL_SINGLET != at->radical)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   75|  20.4k|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (4856:13): [True: 755, False: 607k]
  |  Branch (4856:37): [True: 20.4k, False: 587k]
  |  Branch (4856:52): [True: 20.4k, False: 0]
  ------------------
 4857|  21.1k|        {
 4858|  21.1k|            continue;
 4859|  21.1k|        }
 4860|       |
 4861|   587k|        val = -1;
 4862|   587k|        switch (iat_numb)
  ------------------
  |  Branch (4862:17): [True: 489k, False: 97.6k]
  ------------------
 4863|   587k|        {
 4864|   100k|        case IAT_N:
  ------------------
  |  Branch (4864:9): [True: 100k, False: 486k]
  ------------------
 4865|   118k|        case IAT_P:
  ------------------
  |  Branch (4865:9): [True: 17.2k, False: 570k]
  ------------------
 4866|       |            /* djb-rwth: removing redundant code */
 4867|   118k|            val = 3 + at->charge;
 4868|   118k|            break;
 4869|       |
 4870|   193k|        case IAT_O:
  ------------------
  |  Branch (4870:9): [True: 193k, False: 393k]
  ------------------
 4871|   235k|        case IAT_S:
  ------------------
  |  Branch (4871:9): [True: 41.5k, False: 545k]
  ------------------
 4872|   237k|        case IAT_Se:
  ------------------
  |  Branch (4872:9): [True: 2.29k, False: 585k]
  ------------------
 4873|   241k|        case IAT_Te:
  ------------------
  |  Branch (4873:9): [True: 3.70k, False: 583k]
  ------------------
 4874|       |            /* djb-rwth: removing redundant code */
 4875|   241k|            val = 2 + at->charge;
 4876|   241k|            break;
 4877|       |
 4878|  11.0k|        case IAT_F:
  ------------------
  |  Branch (4878:9): [True: 11.0k, False: 576k]
  ------------------
 4879|  11.2k|        case IAT_Cl:
  ------------------
  |  Branch (4879:9): [True: 151, False: 587k]
  ------------------
 4880|  12.2k|        case IAT_Br:
  ------------------
  |  Branch (4880:9): [True: 993, False: 586k]
  ------------------
 4881|  22.4k|        case IAT_I:
  ------------------
  |  Branch (4881:9): [True: 10.1k, False: 577k]
  ------------------
 4882|  22.4k|            if (at->charge == 0)
  ------------------
  |  Branch (4882:17): [True: 17.1k, False: 5.25k]
  ------------------
 4883|  17.1k|            {
 4884|       |                /* djb-rwth: removing redundant code */
 4885|  17.1k|                val = 1;
 4886|  17.1k|            }
 4887|  22.4k|            break;
 4888|       |
 4889|   108k|        case IAT_H:
  ------------------
  |  Branch (4889:9): [True: 108k, False: 479k]
  ------------------
 4890|   108k|            if (at->valence == 0 &&
  ------------------
  |  Branch (4890:17): [True: 66.5k, False: 41.4k]
  ------------------
 4891|  66.5k|                at->charge == 1)
  ------------------
  |  Branch (4891:17): [True: 35.0k, False: 31.4k]
  ------------------
 4892|  35.0k|            {
 4893|  35.0k|                is_H = 1; /* isolated proton */
 4894|  35.0k|                val = 0;
 4895|  35.0k|            }
 4896|   587k|        }
 4897|   587k|        if (val < 0)
  ------------------
  |  Branch (4897:13): [True: 175k, False: 411k]
  ------------------
 4898|   175k|        {
 4899|   175k|            continue;
 4900|   175k|        }
 4901|       |
 4902|   411k|        num_H = NUMH(at, 0);
  ------------------
  |  |   56|   411k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|   411k|#define NUM_ISO_H(AT, N) (AT[N].num_iso_H[0] + AT[N].num_iso_H[1] + AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
 4903|   411k|        if (val != at->chem_bonds_valence + num_H)
  ------------------
  |  Branch (4903:13): [True: 284k, False: 127k]
  ------------------
 4904|   284k|        {
 4905|   284k|            continue;
 4906|   284k|        }
 4907|       |
 4908|   127k|        if (is_H)
  ------------------
  |  Branch (4908:13): [True: 35.0k, False: 92.1k]
  ------------------
 4909|  35.0k|        {
 4910|  35.0k|            bAccept = 1;
 4911|  35.0k|            cur_num_iso_H = (at->iso_atw_diff != 0);
 4912|  35.0k|        }
 4913|  92.1k|        else
 4914|  92.1k|        {
 4915|  92.1k|            cur_num_iso_H = 0;
 4916|   212k|            for (j = 0, bAccept = 1; j < at->valence && bAccept; j++)
  ------------------
  |  Branch (4916:38): [True: 137k, False: 75.2k]
  |  Branch (4916:57): [True: 137k, False: 0]
  ------------------
 4917|   137k|            {
 4918|   137k|                at2 = atom + (int)at->neighbor[j];
 4919|   137k|                if ((at2->charge && at->charge) ||
  ------------------
  |  Branch (4919:22): [True: 35.1k, False: 101k]
  |  Branch (4919:37): [True: 11.5k, False: 23.6k]
  ------------------
 4920|   125k|                    (at2->radical && RADICAL_SINGLET != at2->radical)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |   75|  5.38k|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (4920:22): [True: 5.38k, False: 120k]
  |  Branch (4920:38): [True: 5.38k, False: 0]
  ------------------
 4921|  16.9k|                {
 4922|  16.9k|                    bAccept = 0; /* adjacent charged/radical atoms: do not neutralizate */
 4923|  16.9k|                    break;
 4924|  16.9k|                }
 4925|   120k|                else if (at2->el_number == EL_NUMBER_H &&
  ------------------
  |  |   11|   240k|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
  |  Branch (4925:26): [True: 14.6k, False: 105k]
  ------------------
 4926|  14.6k|                         at2->valence == 1 && at2->iso_atw_diff)
  ------------------
  |  Branch (4926:26): [True: 6.04k, False: 8.62k]
  |  Branch (4926:47): [True: 70, False: 5.97k]
  ------------------
 4927|     70|                {
 4928|     70|                    cur_num_iso_H++; /* isotopic explicit H */
 4929|     70|                }
 4930|   137k|            }
 4931|       |
 4932|  92.1k|            if (bAccept)
  ------------------
  |  Branch (4932:17): [True: 75.2k, False: 16.9k]
  ------------------
 4933|  75.2k|            {
 4934|  75.2k|                num_iso_atoms -= cur_num_iso_H; /* avoid counting explicit H as isotopic atom */
 4935|  75.2k|                cur_num_iso_H += NUM_ISO_H(at, 0);
  ------------------
  |  |   55|  75.2k|#define NUM_ISO_H(AT, N) (AT[N].num_iso_H[0] + AT[N].num_iso_H[1] + AT[N].num_iso_H[2])
  ------------------
 4936|  75.2k|            }
 4937|  92.1k|        }
 4938|       |
 4939|   127k|        num_iso_H += (bAccept && cur_num_iso_H); /* number of acceptable heteroatoms that have isotopic H */
  ------------------
  |  Branch (4939:23): [True: 110k, False: 16.9k]
  |  Branch (4939:34): [True: 740, False: 109k]
  ------------------
 4940|   127k|    }
 4941|       |
 4942|   216k|    return ((num_iso_H ? 1 : 0) | (num_iso_atoms ? 2 : 0));
  ------------------
  |  Branch (4942:14): [True: 176, False: 216k]
  |  Branch (4942:36): [True: 853, False: 215k]
  ------------------
 4943|   216k|}
cmp_components:
 4950|   225k|{
 4951|   225k|    int ret;
 4952|   225k|    AT_NUMB n1;
 4953|   225k|    AT_NUMB n2;
 4954|       |
 4955|   225k|    n1 = ((const AT_NUMB *)a1)[0];
 4956|       |    /* number of atoms in the component -- descending order */
 4957|   225k|    n2 = ((const AT_NUMB *)a2)[0];
 4958|       |
 4959|   225k|    if ((ret = (int)n2 - (int)n1)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (4959:9): [True: 700, False: 225k]
  ------------------
 4960|    700|    {
 4961|    700|        return ret;
 4962|    700|    }
 4963|       |
 4964|       |    /* stable sort */
 4965|   225k|    n1 = ((const AT_NUMB *)a1)[1];
 4966|       |    /* component ordering number -- ascending order */
 4967|   225k|    n2 = ((const AT_NUMB *)a2)[1];
 4968|       |
 4969|   225k|    ret = (int)n1 - (int)n2;
 4970|       |
 4971|   225k|    return ret;
 4972|   225k|}
MarkDisconnectedComponents:
 5170|  70.4k|{
 5171|  70.4k|    typedef AT_NUMB AT_TRIPLE[3];
 5172|       |
 5173|  70.4k|    inp_ATOM *at = orig_at_data->at;
 5174|  70.4k|    int num_at = orig_at_data->num_inp_atoms;
 5175|  70.4k|    AT_NUMB *nCurAtLen = NULL;
 5176|       |
 5177|  70.4k|    AT_NUMB *nNewCompNumber = NULL;
 5178|  70.4k|    AT_NUMB *nPrevAtom = NULL;
 5179|  70.4k|    S_CHAR *iNeigh = NULL;
 5180|       |
 5181|  70.4k|    AT_NUMB *nOldCompNumber = NULL;
 5182|  70.4k|    int i, j, num_components, ret;
 5183|  70.4k|    int new_comp_no;
 5184|  70.4k|    AT_NUMB old_comp_no, another_comp_no, no_component;
 5185|       |
 5186|       |    /* component_nbr[i][0] = number of atoms in the component i-1
 5187|       |     * component_nbr[i][1] = original component number (id-1) = i
 5188|       |     * after sorting:
 5189|       |     * component_nbr[j][2] = new number of component #(component_nbr[i][1]+1)
 5190|       |     */
 5191|  70.4k|    AT_TRIPLE *component_nbr = NULL;
 5192|  70.4k|    int fst_at, nxt_at, cur_at, cur_neq_fst; /* moved from below 2024-09-01 DT */
 5193|       |
 5194|       |    /* initialize */
 5195|  70.4k|    if (bProcessOldCompNumbers && !orig_at_data->nOldCompNumber)
  ------------------
  |  Branch (5195:9): [True: 0, False: 70.4k]
  |  Branch (5195:35): [True: 0, False: 0]
  ------------------
 5196|      0|    {
 5197|      0|        bProcessOldCompNumbers = 0;
 5198|      0|    }
 5199|  70.4k|    num_components = 0;
 5200|       |
 5201|       |    /*
 5202|       |    for ( j = 0; j < num_at; j ++ )
 5203|       |    {
 5204|       |    at[j].component = 0;
 5205|       |    }
 5206|       |    */
 5207|       |
 5208|  70.4k|    ret = -1;
 5209|  70.4k|    if (!num_at)
  ------------------
  |  Branch (5209:9): [True: 0, False: 70.4k]
  ------------------
 5210|      0|    {
 5211|      0|        return 0;
 5212|      0|    }
 5213|       |
 5214|  70.4k|    nNewCompNumber = (AT_NUMB *)inchi_calloc(num_at, sizeof(nNewCompNumber[0]));
  ------------------
  |  | 1146|  70.4k|#define inchi_calloc   calloc
  ------------------
 5215|  70.4k|    nPrevAtom = (AT_NUMB *)inchi_calloc(num_at, sizeof(nPrevAtom[0]));
  ------------------
  |  | 1146|  70.4k|#define inchi_calloc   calloc
  ------------------
 5216|  70.4k|    iNeigh = (S_CHAR *)inchi_calloc(num_at, sizeof(iNeigh[0]));
  ------------------
  |  | 1146|  70.4k|#define inchi_calloc   calloc
  ------------------
 5217|       |
 5218|  70.4k|    if (!nNewCompNumber || !nPrevAtom || !iNeigh) /* nNewCompNumber: for non-recursive DFS only: */
  ------------------
  |  Branch (5218:9): [True: 0, False: 70.4k]
  |  Branch (5218:28): [True: 0, False: 70.4k]
  |  Branch (5218:42): [True: 0, False: 70.4k]
  ------------------
 5219|      0|    {
 5220|      0|        goto exit_function;
 5221|      0|    }
 5222|       |
 5223|       |    /*printf("\nnum_at = %d\n", num_at);*/
 5224|       |
 5225|       |    /* Mark and count; avoid deep DFS recursion: it may make verifying software unhappy */
 5226|       |    /* nNewCompNumber[i] will contain new component number for atoms at[i], i=0..num_at-1 */
 5227|       |
 5228|   229k|    for (j = 0; j < num_at; j++)
  ------------------
  |  Branch (5228:17): [True: 159k, False: 70.4k]
  ------------------
 5229|   159k|    {
 5230|   159k|        if (!nNewCompNumber[j])
  ------------------
  |  Branch (5230:13): [True: 106k, False: 53.1k]
  ------------------
 5231|   106k|        {
 5232|       |            /* mark starting with at[j] */
 5233|   106k|            fst_at = 0;
 5234|   106k|            nxt_at = 0;
 5235|   106k|            cur_at = j;
 5236|   106k|            cur_neq_fst = 1;
 5237|   106k|            num_components++;
 5238|       |
 5239|       |            /* first time at at[j] */
 5240|   106k|            fst_at = cur_at;
 5241|   106k|            nNewCompNumber[fst_at] = (AT_NUMB)num_components;
 5242|       |
 5243|       |            /* find next neighbor */
 5244|   106k|            do
 5245|   281k|            {
 5246|   281k|                if (iNeigh[cur_at] < at[cur_at].valence)
  ------------------
  |  Branch (5246:21): [True: 121k, False: 159k]
  ------------------
 5247|   121k|                {
 5248|   121k|                    int ineigh_incr = (int)iNeigh[cur_at];
 5249|   121k|                    nxt_at = at[cur_at].neighbor[ineigh_incr];
 5250|   121k|                    iNeigh[cur_at]++;
 5251|       |
 5252|   121k|                    if (!nNewCompNumber[nxt_at])
  ------------------
  |  Branch (5252:25): [True: 53.1k, False: 68.6k]
  ------------------
 5253|  53.1k|                    {
 5254|       |                        /* forward edge: found new atom */
 5255|  53.1k|                        nNewCompNumber[nxt_at] = (AT_NUMB)num_components;
 5256|  53.1k|                        nPrevAtom[nxt_at] = (AT_NUMB)cur_at;
 5257|  53.1k|                        cur_at = nxt_at;
 5258|  53.1k|                    }
 5259|   121k|                }
 5260|   159k|                else if (cur_at == fst_at)
  ------------------
  |  Branch (5260:26): [True: 106k, False: 53.1k]
  ------------------
 5261|   106k|                {
 5262|   106k|                    cur_neq_fst = 0;
 5263|       |                    /* break;  done */
 5264|   106k|                }
 5265|  53.1k|                else
 5266|  53.1k|                {
 5267|  53.1k|                    cur_at = nPrevAtom[cur_at]; /* retract */
 5268|  53.1k|                }
 5269|   281k|            } while (cur_neq_fst);
  ------------------
  |  Branch (5269:22): [True: 174k, False: 106k]
  ------------------
 5270|   106k|        }
 5271|   159k|    }
 5272|       |
 5273|  70.4k|    inchi_free(nPrevAtom);
  ------------------
  |  | 1152|  70.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 70.4k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 70.4k]
  |  |  ------------------
  ------------------
 5274|  70.4k|    nPrevAtom = NULL;
 5275|  70.4k|    inchi_free(iNeigh);
  ------------------
  |  | 1152|  70.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 70.4k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 70.4k]
  |  |  ------------------
  ------------------
 5276|  70.4k|    iNeigh = NULL;
 5277|       |
 5278|       |    /* Allocate more memory */
 5279|  70.4k|    i = inchi_max(num_components, orig_at_data->num_components);
  ------------------
  |  |  138|  70.4k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 70.4k, False: 0]
  |  |  ------------------
  ------------------
 5280|       |
 5281|  70.4k|    nCurAtLen = (AT_NUMB *)inchi_calloc((long long)num_components + 1, sizeof(nCurAtLen[0]));           /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  70.4k|#define inchi_calloc   calloc
  ------------------
 5282|  70.4k|    nOldCompNumber = (AT_NUMB *)inchi_calloc((long long)i + 1, sizeof(nOldCompNumber[0]));              /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  70.4k|#define inchi_calloc   calloc
  ------------------
 5283|  70.4k|    component_nbr = (AT_TRIPLE *)inchi_calloc((long long)num_components + 1, sizeof(component_nbr[0])); /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  70.4k|#define inchi_calloc   calloc
  ------------------
 5284|       |
 5285|  70.4k|    if (!nCurAtLen || !nOldCompNumber || !component_nbr)
  ------------------
  |  Branch (5285:9): [True: 0, False: 70.4k]
  |  Branch (5285:23): [True: 0, False: 70.4k]
  |  Branch (5285:42): [True: 0, False: 70.4k]
  ------------------
 5286|      0|    {
 5287|      0|        goto exit_function;
 5288|      0|    }
 5289|       |
 5290|       |    /* Count atoms per component and renumber the components */
 5291|   176k|    for (i = 0; i < num_components; i++)
  ------------------
  |  Branch (5291:17): [True: 106k, False: 70.4k]
  ------------------
 5292|   106k|    {
 5293|   106k|        component_nbr[i][0] = 0; /* number of atoms in the component */
 5294|   106k|        component_nbr[i][1] = i; /* component ordering number */
 5295|   106k|    }
 5296|       |
 5297|   229k|    for (j = 0; j < num_at; j++)
  ------------------
  |  Branch (5297:17): [True: 159k, False: 70.4k]
  ------------------
 5298|   159k|    {
 5299|   159k|        component_nbr[(int)nNewCompNumber[j] - 1][0]++; /* count atoms in each component */
 5300|   159k|    }
 5301|       |
 5302|       |    /* Sort settings
 5303|       |    key: number of atoms
 5304|       |    order: descending
 5305|       |    stable sort
 5306|       |    */
 5307|       |
 5308|  70.4k|    qsort( (void*) component_nbr[0], num_components, sizeof( component_nbr[0] ), cmp_components ); /* djb-rwth: fixed buffer overrun */
 5309|       |
 5310|       |    /* Invert the transposition */
 5311|   176k|    for (i = 0; i < num_components; i++)
  ------------------
  |  Branch (5311:17): [True: 106k, False: 70.4k]
  ------------------
 5312|   106k|    {
 5313|   106k|        nCurAtLen[i] = component_nbr[i][0];
 5314|   106k|        component_nbr[component_nbr[i][1]][2] = i + 1;
 5315|   106k|    }
 5316|       |
 5317|       |    /* Renumber the components so that the component with the greatest number of atoms is the first */
 5318|  70.4k|    no_component = num_at + 1;
 5319|       |
 5320|   229k|    for (j = 0; j < num_at; j++)
  ------------------
  |  Branch (5320:17): [True: 159k, False: 70.4k]
  ------------------
 5321|   159k|    {
 5322|       |        /* new component number for at[j] */
 5323|   159k|        new_comp_no = component_nbr[(int)nNewCompNumber[j] - 1][2] - 1; /* starts from 0 */
 5324|   159k|        if (bProcessOldCompNumbers)
  ------------------
  |  Branch (5324:13): [True: 0, False: 159k]
  ------------------
 5325|      0|        {
 5326|       |            /* old component number for at[j] */
 5327|      0|            old_comp_no = at[j].component;
 5328|       |            /* fill out nOldCompNumber[]; initially it contains zeroes */
 5329|      0|            if (!old_comp_no)
  ------------------
  |  Branch (5329:17): [True: 0, False: 0]
  ------------------
 5330|      0|            {
 5331|      0|                nOldCompNumber[new_comp_no] = no_component; /* atom did not have component number */
 5332|      0|            }
 5333|      0|            else if (nOldCompNumber[new_comp_no] != old_comp_no)
  ------------------
  |  Branch (5333:22): [True: 0, False: 0]
  ------------------
 5334|      0|            {
 5335|      0|                if (!nOldCompNumber[new_comp_no])
  ------------------
  |  Branch (5335:21): [True: 0, False: 0]
  ------------------
 5336|      0|                {
 5337|      0|                    nOldCompNumber[new_comp_no] = old_comp_no;
 5338|      0|                }
 5339|      0|                else
 5340|      0|                {
 5341|       |                    /* at[j] moved from old comp #old_comp_no to old comp #nOldCompNumber[new_comp_no]
 5342|       |                    Both components cannot be equal to any current component */
 5343|      0|                    another_comp_no = nOldCompNumber[new_comp_no];
 5344|      0|                    for (i = 0; i < num_components; i++)
  ------------------
  |  Branch (5344:33): [True: 0, False: 0]
  ------------------
 5345|      0|                    {
 5346|      0|                        if (nOldCompNumber[i] == old_comp_no ||
  ------------------
  |  Branch (5346:29): [True: 0, False: 0]
  ------------------
 5347|      0|                            nOldCompNumber[i] == another_comp_no)
  ------------------
  |  Branch (5347:29): [True: 0, False: 0]
  ------------------
 5348|      0|                        {
 5349|      0|                            nOldCompNumber[i] = no_component;
 5350|      0|                        }
 5351|      0|                    }
 5352|       |                    /* nOldCompNumber[new_comp_no] = num_at+1; */
 5353|      0|                }
 5354|      0|            }
 5355|      0|        }
 5356|       |
 5357|       |        /* orig_at_data->nOldCompNumber */
 5358|       |
 5359|       |        /* Finally, set the new component number for atom j (NB: starts from 1 ) */
 5360|   159k|        at[j].component = new_comp_no + 1;
 5361|   159k|    }
 5362|       |
 5363|  70.4k|    if (bProcessOldCompNumbers)
  ------------------
  |  Branch (5363:9): [True: 0, False: 70.4k]
  ------------------
 5364|      0|    {
 5365|      0|        for (j = 0; j < num_components; j++)
  ------------------
  |  Branch (5365:21): [True: 0, False: 0]
  ------------------
 5366|      0|        {
 5367|      0|            if (nOldCompNumber[j] == no_component)
  ------------------
  |  Branch (5367:17): [True: 0, False: 0]
  ------------------
 5368|      0|            {
 5369|       |                /* the component has atom from another component */
 5370|      0|                nOldCompNumber[j] = 0;
 5371|      0|            }
 5372|      0|            else if (nOldCompNumber[j] &&
  ------------------
  |  Branch (5372:22): [True: 0, False: 0]
  ------------------
 5373|      0|                     !orig_at_data->nOldCompNumber[nOldCompNumber[j] - 1])
  ------------------
  |  Branch (5373:22): [True: 0, False: 0]
  ------------------
 5374|      0|            {
 5375|       |                /* the component has changed in the previous processing  */
 5376|      0|                nOldCompNumber[j] = 0;
 5377|      0|            }
 5378|      0|        }
 5379|      0|    }
 5380|  70.4k|    else
 5381|  70.4k|    {
 5382|   176k|        for (j = 0; j < num_components; j++)
  ------------------
  |  Branch (5382:21): [True: 106k, False: 70.4k]
  ------------------
 5383|   106k|        {
 5384|   106k|            nOldCompNumber[j] = j + 1;
 5385|   106k|        }
 5386|  70.4k|    }
 5387|       |
 5388|  70.4k|    ret = num_components;
 5389|       |
 5390|  70.4k|exit_function:
 5391|       |
 5392|  70.4k|    if (nNewCompNumber)
  ------------------
  |  Branch (5392:9): [True: 70.4k, False: 0]
  ------------------
 5393|  70.4k|    {
 5394|  70.4k|        inchi_free(nNewCompNumber);
  ------------------
  |  | 1152|  70.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 70.4k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 70.4k]
  |  |  ------------------
  ------------------
 5395|  70.4k|    }
 5396|  70.4k|    if (component_nbr)
  ------------------
  |  Branch (5396:9): [True: 70.4k, False: 0]
  ------------------
 5397|  70.4k|    {
 5398|  70.4k|        inchi_free(component_nbr);
  ------------------
  |  | 1152|  70.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 70.4k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 70.4k]
  |  |  ------------------
  ------------------
 5399|  70.4k|    }
 5400|       |
 5401|  70.4k|    if (ret < 0)
  ------------------
  |  Branch (5401:9): [True: 0, False: 70.4k]
  ------------------
 5402|      0|    {
 5403|      0|        if (nPrevAtom)
  ------------------
  |  Branch (5403:13): [True: 0, False: 0]
  ------------------
 5404|      0|        {
 5405|      0|            inchi_free(nPrevAtom);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5406|      0|            nPrevAtom = NULL;
 5407|      0|        }
 5408|      0|        if (iNeigh)
  ------------------
  |  Branch (5408:13): [True: 0, False: 0]
  ------------------
 5409|      0|        {
 5410|      0|            inchi_free(iNeigh);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5411|      0|            iNeigh = NULL;
 5412|      0|        }
 5413|      0|        if (nCurAtLen)
  ------------------
  |  Branch (5413:13): [True: 0, False: 0]
  ------------------
 5414|      0|        {
 5415|      0|            inchi_free(nCurAtLen);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5416|      0|            nCurAtLen = NULL;
 5417|      0|        }
 5418|      0|        if (nOldCompNumber)
  ------------------
  |  Branch (5418:13): [True: 0, False: 0]
  ------------------
 5419|      0|        {
 5420|      0|            inchi_free(nOldCompNumber);
  ------------------
  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5421|      0|            nOldCompNumber = NULL;
 5422|      0|        }
 5423|      0|        num_components = ret;
 5424|      0|    }
 5425|       |
 5426|       |    /* avoid memory leaks */
 5427|  70.4k|    if (orig_at_data->nCurAtLen)
  ------------------
  |  Branch (5427:9): [True: 70.4k, False: 0]
  ------------------
 5428|  70.4k|    {
 5429|  70.4k|        inchi_free(orig_at_data->nCurAtLen);
  ------------------
  |  | 1152|  70.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 70.4k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 70.4k]
  |  |  ------------------
  ------------------
 5430|  70.4k|    }
 5431|  70.4k|    if (orig_at_data->nOldCompNumber)
  ------------------
  |  Branch (5431:9): [True: 70.4k, False: 0]
  ------------------
 5432|  70.4k|    {
 5433|  70.4k|        inchi_free(orig_at_data->nOldCompNumber);
  ------------------
  |  | 1152|  70.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 70.4k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 70.4k]
  |  |  ------------------
  ------------------
 5434|  70.4k|    }
 5435|       |
 5436|  70.4k|    orig_at_data->nCurAtLen = nCurAtLen;
 5437|  70.4k|    orig_at_data->nOldCompNumber = nOldCompNumber;
 5438|       |
 5439|  70.4k|    orig_at_data->num_components = num_components;
 5440|       |
 5441|  70.4k|    return ret; /* number of disconnected components;
 5442|       |             1=>single connected structure        */
 5443|  70.4k|}
ExtractConnectedComponent:
 5452|   106k|{
 5453|   106k|    int i, j, num_component_at;
 5454|   106k|    AT_NUMB *number;
 5455|       |
 5456|   106k|    if (NULL == (number = (AT_NUMB *)inchi_calloc(num_at, sizeof(AT_NUMB))))
  ------------------
  |  | 1146|   106k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5456:9): [True: 0, False: 106k]
  ------------------
 5457|      0|    {
 5458|      0|        return CT_OUT_OF_RAM; /* out of memory */ /*   <BRKPT> */
  ------------------
  |  |   21|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   18|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 5459|      0|    }
 5460|       |
 5461|       |    /* copy atoms */
 5462|   585M|    for (i = 0, num_component_at = 0; i < num_at; i++)
  ------------------
  |  Branch (5462:39): [True: 585M, False: 106k]
  ------------------
 5463|   585M|    {
 5464|   585M|        if (at[i].component == component_number)
  ------------------
  |  Branch (5464:13): [True: 159k, False: 585M]
  ------------------
 5465|   159k|        {
 5466|   159k|            number[i] = num_component_at;
 5467|   159k|            component_at[num_component_at++] = at[i];
 5468|   159k|        }
 5469|   585M|    }
 5470|       |
 5471|       |    /* renumber neighbors */
 5472|   265k|    for (i = 0; i < num_component_at; i++)
  ------------------
  |  Branch (5472:17): [True: 159k, False: 106k]
  ------------------
 5473|   159k|    {
 5474|   159k|        component_at[i].orig_compt_at_numb = (AT_NUMB)(i + 1);
 5475|   281k|        for (j = 0; j < component_at[i].valence; j++)
  ------------------
  |  Branch (5475:21): [True: 121k, False: 159k]
  ------------------
 5476|   121k|        {
 5477|   121k|            component_at[i].neighbor[j] = number[(int)component_at[i].neighbor[j]];
 5478|   121k|        }
 5479|   159k|    }
 5480|       |
 5481|   106k|    inchi_free(number);
  ------------------
  |  | 1152|   106k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 106k, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 106k]
  |  |  ------------------
  ------------------
 5482|       |
 5483|   106k|    return num_component_at;
 5484|   106k|}
SetConnectedComponentNumber:
 5488|   252k|{
 5489|   252k|    int i;
 5490|  1.30M|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (5490:17): [True: 1.05M, False: 252k]
  ------------------
 5491|  1.05M|    {
 5492|  1.05M|        at[i].component = (AT_NUMB)component_number;
 5493|  1.05M|    }
 5494|       |
 5495|   252k|    return 0;
 5496|   252k|}
Free_INChI_Stereo:
 5500|  1.54M|{
 5501|  1.54M|    if (pINChI_Stereo)
  ------------------
  |  Branch (5501:9): [True: 360k, False: 1.18M]
  ------------------
 5502|   360k|    {
 5503|   360k|        qzfree(pINChI_Stereo->nNumber);
  ------------------
  |  | 1176|   360k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|   351k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 351k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 351k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 351k, False: 9.37k]
  |  |  |  Branch (1176:61): [Folded, False: 360k]
  |  |  ------------------
  ------------------
 5504|   360k|        qzfree(pINChI_Stereo->t_parity);
  ------------------
  |  | 1176|   360k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|   351k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 351k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 351k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 351k, False: 9.37k]
  |  |  |  Branch (1176:61): [Folded, False: 360k]
  |  |  ------------------
  ------------------
 5505|   360k|        qzfree(pINChI_Stereo->nNumberInv);
  ------------------
  |  | 1176|   360k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|   298k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 298k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 298k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 298k, False: 62.1k]
  |  |  |  Branch (1176:61): [Folded, False: 360k]
  |  |  ------------------
  ------------------
 5506|   360k|        qzfree(pINChI_Stereo->t_parityInv);
  ------------------
  |  | 1176|   360k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|   298k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 298k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 298k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 298k, False: 62.1k]
  |  |  |  Branch (1176:61): [Folded, False: 360k]
  |  |  ------------------
  ------------------
 5507|   360k|        qzfree(pINChI_Stereo->nBondAtom1);
  ------------------
  |  | 1176|   360k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|  61.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 61.4k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 61.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 61.4k, False: 299k]
  |  |  |  Branch (1176:61): [Folded, False: 360k]
  |  |  ------------------
  ------------------
 5508|   360k|        qzfree(pINChI_Stereo->nBondAtom2);
  ------------------
  |  | 1176|   360k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|  61.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 61.4k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 61.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 61.4k, False: 299k]
  |  |  |  Branch (1176:61): [Folded, False: 360k]
  |  |  ------------------
  ------------------
 5509|   360k|        qzfree(pINChI_Stereo->b_parity);
  ------------------
  |  | 1176|   360k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|  61.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 61.4k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 61.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 61.4k, False: 299k]
  |  |  |  Branch (1176:61): [Folded, False: 360k]
  |  |  ------------------
  ------------------
 5510|   360k|    }
 5511|       |
 5512|  1.54M|    return 0;
 5513|  1.54M|}
Alloc_INChI_Stereo:
 5517|   298k|{
 5518|       |
 5519|   298k|    INChI_Stereo *pINChI_Stereo = (INChI_Stereo *)
 5520|   298k|        inchi_calloc(1, sizeof(INChI_Stereo));
  ------------------
  |  | 1146|   298k|#define inchi_calloc   calloc
  ------------------
 5521|       |
 5522|   298k|    if (pINChI_Stereo)
  ------------------
  |  Branch (5522:9): [True: 298k, False: 0]
  ------------------
 5523|   298k|    {
 5524|   298k|        if (num_at &&
  ------------------
  |  Branch (5524:13): [True: 298k, False: 0]
  ------------------
 5525|   298k|            (pINChI_Stereo->nNumber = (AT_NUMB *)inchi_calloc(num_at, sizeof(pINChI_Stereo->nNumber[0]))) &&
  ------------------
  |  | 1146|   298k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5525:13): [True: 298k, False: 0]
  ------------------
 5526|   298k|            (pINChI_Stereo->t_parity = (S_CHAR *)inchi_calloc(num_at, sizeof(pINChI_Stereo->t_parity[0]))) &&
  ------------------
  |  | 1146|   298k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5526:13): [True: 298k, False: 0]
  ------------------
 5527|   298k|            (pINChI_Stereo->nNumberInv = (AT_NUMB *)inchi_calloc(num_at, sizeof(pINChI_Stereo->nNumberInv[0]))) &&
  ------------------
  |  | 1146|   298k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5527:13): [True: 298k, False: 0]
  ------------------
 5528|   298k|            (pINChI_Stereo->t_parityInv = (S_CHAR *)inchi_calloc(num_at, sizeof(pINChI_Stereo->t_parityInv[0]))))
  ------------------
  |  | 1146|   298k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5528:13): [True: 298k, False: 0]
  ------------------
 5529|   298k|        {
 5530|   298k|            ;
 5531|   298k|        }
 5532|      0|        else if (num_at)
  ------------------
  |  Branch (5532:18): [True: 0, False: 0]
  ------------------
 5533|      0|        {
 5534|      0|            goto out_of_RAM;
 5535|      0|        }
 5536|       |
 5537|   298k|        if (num_bonds &&
  ------------------
  |  Branch (5537:13): [True: 51.7k, False: 247k]
  ------------------
 5538|  51.7k|            (pINChI_Stereo->nBondAtom1 = (AT_NUMB *)inchi_calloc(num_bonds, sizeof(pINChI_Stereo->nBondAtom1[0]))) &&
  ------------------
  |  | 1146|  51.7k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5538:13): [True: 51.7k, False: 0]
  ------------------
 5539|  51.7k|            (pINChI_Stereo->nBondAtom2 = (AT_NUMB *)inchi_calloc(num_bonds, sizeof(pINChI_Stereo->nBondAtom2[0]))) &&
  ------------------
  |  | 1146|  51.7k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5539:13): [True: 51.7k, False: 0]
  ------------------
 5540|  51.7k|            (pINChI_Stereo->b_parity = (S_CHAR *)inchi_calloc(num_bonds, sizeof(pINChI_Stereo->b_parity[0]))))
  ------------------
  |  | 1146|  51.7k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5540:13): [True: 51.7k, False: 0]
  ------------------
 5541|  51.7k|        {
 5542|  51.7k|            ;
 5543|  51.7k|        }
 5544|   247k|        else if (num_bonds)
  ------------------
  |  Branch (5544:18): [True: 0, False: 247k]
  ------------------
 5545|      0|        {
 5546|      0|            goto out_of_RAM;
 5547|      0|        }
 5548|       |
 5549|   298k|        return pINChI_Stereo;
 5550|       |
 5551|      0|    out_of_RAM:
 5552|       |
 5553|      0|        Free_INChI_Stereo(pINChI_Stereo);
 5554|      0|        qzfree(pINChI_Stereo);
  ------------------
  |  | 1176|      0|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 0, False: 0]
  |  |  |  Branch (1176:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5555|      0|    } /* if ( pINChI_Stereo )  */
 5556|       |
 5557|      0|    return NULL;
 5558|   298k|}
Free_INChI:
 5562|  1.28M|{
 5563|       |
 5564|  1.28M|    INChI *pINChI;
 5565|       |
 5566|  1.28M|    if ((pINChI = *ppINChI)) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  Branch (5566:9): [True: 387k, False: 893k]
  ------------------
 5567|   387k|    {
 5568|       |
 5569|   387k|#if (bREUSE_INCHI == 1)
 5570|   387k|        if (pINChI->nRefCount-- > 0)
  ------------------
  |  Branch (5570:13): [True: 0, False: 387k]
  ------------------
 5571|      0|            return 1;
 5572|   387k|#endif
 5573|       |
 5574|   387k|        Free_INChI_Members(pINChI);
 5575|   387k|        qzfree(pINChI);
  ------------------
  |  | 1176|   387k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|   387k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 387k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 387k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 387k, False: 0]
  |  |  |  Branch (1176:61): [Folded, False: 387k]
  |  |  ------------------
  ------------------
 5576|   387k|        *ppINChI = NULL;
 5577|   387k|    }
 5578|       |
 5579|  1.28M|    return 0;
 5580|  1.28M|}
Free_INChI_Members:
 5584|   773k|{
 5585|   773k|    if (pINChI)
  ------------------
  |  Branch (5585:9): [True: 773k, False: 0]
  ------------------
 5586|   773k|    {
 5587|   773k|        Free_INChI_Stereo(pINChI->Stereo);
 5588|   773k|        Free_INChI_Stereo(pINChI->StereoIsotopic);
 5589|   773k|        qzfree(pINChI->nAtom);
  ------------------
  |  | 1176|   773k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|   721k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 721k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 721k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 721k, False: 51.5k]
  |  |  |  Branch (1176:61): [Folded, False: 773k]
  |  |  ------------------
  ------------------
 5590|   773k|        qzfree(pINChI->nConnTable);
  ------------------
  |  | 1176|   773k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|   682k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 682k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 682k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 682k, False: 90.8k]
  |  |  |  Branch (1176:61): [Folded, False: 773k]
  |  |  ------------------
  ------------------
 5591|   773k|        qzfree(pINChI->nTautomer);
  ------------------
  |  | 1176|   773k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|   296k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 296k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 296k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 296k, False: 476k]
  |  |  |  Branch (1176:61): [Folded, False: 773k]
  |  |  ------------------
  ------------------
 5592|   773k|        qzfree(pINChI->nNum_H);
  ------------------
  |  | 1176|   773k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|   697k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 697k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 697k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 697k, False: 75.7k]
  |  |  |  Branch (1176:61): [Folded, False: 773k]
  |  |  ------------------
  ------------------
 5593|   773k|        qzfree(pINChI->nNum_H_fixed);
  ------------------
  |  | 1176|   773k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|   388k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 388k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 388k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 388k, False: 384k]
  |  |  |  Branch (1176:61): [Folded, False: 773k]
  |  |  ------------------
  ------------------
 5594|   773k|        qzfree(pINChI->IsotopicAtom);
  ------------------
  |  | 1176|   773k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|  37.9k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 37.9k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 37.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 37.9k, False: 735k]
  |  |  |  Branch (1176:61): [Folded, False: 773k]
  |  |  ------------------
  ------------------
 5595|   773k|        qzfree(pINChI->IsotopicTGroup);
  ------------------
  |  | 1176|   773k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|  2.24k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 2.24k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 2.24k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 2.24k, False: 771k]
  |  |  |  Branch (1176:61): [Folded, False: 773k]
  |  |  ------------------
  ------------------
 5596|   773k|        qzfree(pINChI->nPossibleLocationsOfIsotopicH);
  ------------------
  |  | 1176|   773k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|  9.05k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 9.05k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 9.05k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 9.05k, False: 764k]
  |  |  |  Branch (1176:61): [Folded, False: 773k]
  |  |  ------------------
  ------------------
 5597|   773k|        qzfree(pINChI->Stereo);
  ------------------
  |  | 1176|   773k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|   317k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 317k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 317k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 317k, False: 456k]
  |  |  |  Branch (1176:61): [Folded, False: 773k]
  |  |  ------------------
  ------------------
 5598|   773k|        qzfree(pINChI->StereoIsotopic);
  ------------------
  |  | 1176|   773k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|  43.8k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 43.8k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 43.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 43.8k, False: 729k]
  |  |  |  Branch (1176:61): [Folded, False: 773k]
  |  |  ------------------
  ------------------
 5599|   773k|        qzfree(pINChI->szHillFormula);
  ------------------
  |  | 1176|   773k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|   685k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 685k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 685k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 685k, False: 88.0k]
  |  |  |  Branch (1176:61): [Folded, False: 773k]
  |  |  ------------------
  ------------------
 5600|   773k|    }
 5601|       |
 5602|   773k|    return 0;
 5603|   773k|}
Alloc_INChI:
 5611|   289k|{
 5612|   289k|    int i, num_bonds, num_isotopic_atoms;
 5613|   289k|    INChI *pINChI;
 5614|   289k|    int bIsotopic = (nAllocMode & REQ_MODE_ISO);
  ------------------
  |  |   17|   289k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
 5615|       |    /* int    bTautomeric = (nAllocMode & REQ_MODE_TAUT); */
 5616|       |
 5617|   289k|    if (num_at <= 0 ||
  ------------------
  |  Branch (5617:9): [True: 0, False: 289k]
  ------------------
 5618|   289k|        NULL == (pINChI = (INChI *)inchi_calloc(1, sizeof(INChI))))
  ------------------
  |  | 1146|   289k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5618:9): [True: 0, False: 289k]
  ------------------
 5619|      0|    {
 5620|      0|        return NULL;
 5621|      0|    }
 5622|       |
 5623|  1.40M|    for (i = 0, num_bonds = 0, num_isotopic_atoms = 0; i < num_at; i++)
  ------------------
  |  Branch (5623:56): [True: 1.11M, False: 289k]
  ------------------
 5624|  1.11M|    {
 5625|  1.11M|        num_bonds += at[i].valence;
 5626|       |        /* if ( bIsotopic ) { */
 5627|  1.11M|        num_isotopic_atoms += (0 != at[i].iso_atw_diff ||
  ------------------
  |  Branch (5627:32): [True: 1.68k, False: 1.10M]
  ------------------
 5628|  1.10M|                               !strcmp(at[i].elname, "D") ||
  ------------------
  |  Branch (5628:32): [True: 0, False: 1.10M]
  ------------------
 5629|  1.10M|                               !strcmp(at[i].elname, "T") ||
  ------------------
  |  Branch (5629:32): [True: 0, False: 1.10M]
  ------------------
 5630|  1.10M|                               at[i].num_iso_H[0] ||
  ------------------
  |  Branch (5630:32): [True: 554, False: 1.10M]
  ------------------
 5631|  1.10M|                               at[i].num_iso_H[1] ||
  ------------------
  |  Branch (5631:32): [True: 189, False: 1.10M]
  ------------------
 5632|  1.10M|                               at[i].num_iso_H[2]);
  ------------------
  |  Branch (5632:32): [True: 214, False: 1.10M]
  ------------------
 5633|       |        /* } */
 5634|  1.11M|    }
 5635|   289k|    num_bonds /= 2;
 5636|       |
 5637|   289k|    *found_num_bonds = num_bonds;
 5638|   289k|    *found_num_isotopic = num_isotopic_atoms;
 5639|       |
 5640|   289k|    if ((pINChI->nAtom = (U_CHAR *)inchi_calloc(num_at, sizeof(pINChI->nAtom[0]))) &&
  ------------------
  |  | 1146|   289k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5640:9): [True: 289k, False: 0]
  ------------------
 5641|   289k|        (pINChI->nConnTable = (AT_NUMB *)inchi_calloc((long long)num_at + (long long)num_bonds, sizeof(pINChI->nConnTable[0]))) &&              /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|   289k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5641:9): [True: 289k, False: 0]
  ------------------
 5642|   289k|        (pINChI->nTautomer = (AT_NUMB *)inchi_calloc(((3 + INCHI_T_NUM_MOVABLE) * (long long)num_at) / 2 + 1, sizeof(pINChI->nTautomer[0]))) && /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|   289k|#define inchi_calloc   calloc
  ------------------
                      (pINChI->nTautomer = (AT_NUMB *)inchi_calloc(((3 + INCHI_T_NUM_MOVABLE) * (long long)num_at) / 2 + 1, sizeof(pINChI->nTautomer[0]))) && /* djb-rwth: cast operator added */
  ------------------
  |  |  749|   289k|#define INCHI_T_NUM_MOVABLE  2
  ------------------
  |  Branch (5642:9): [True: 289k, False: 0]
  ------------------
 5643|   289k|        (pINChI->nNum_H = (S_CHAR *)inchi_calloc(num_at, sizeof(pINChI->nNum_H[0]))) &&
  ------------------
  |  | 1146|   289k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5643:9): [True: 289k, False: 0]
  ------------------
 5644|   289k|        (pINChI->nNum_H_fixed = (S_CHAR *)inchi_calloc(num_at, sizeof(pINChI->nNum_H_fixed[0]))))
  ------------------
  |  | 1146|   289k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5644:9): [True: 289k, False: 0]
  ------------------
 5645|   289k|    {
 5646|   289k|        ;
 5647|       |        /* nTautomer length: max. number of tautomeric groups is num_at/2
 5648|       |
 5649|       |        1 word                     -> number of t-groups
 5650|       |
 5651|       |        each group has:
 5652|       |
 5653|       |        1 word                     -> number of endpoints+INCHI_T_NUM_MOVABLE
 5654|       |        INCHI_T_NUM_MOVABLE words   -> number(s) of moveable attachments
 5655|       |        numbers of endpoints words -> canon. numbers
 5656|       |
 5657|       |        max. occurs if each t-group has 2 atoms (num_at/2 t-groups) and all atoms
 5658|       |        belong to t-groups (num_at endpoints)
 5659|       |
 5660|       |        Total: 1 + (number of t-groups)*(1+INCHI_T_NUM_MOVABLE) + (number of endpoints) <=
 5661|       |        1 + (num_at/2) * (1+INCHI_T_NUM_MOVABLE) + num_at <=
 5662|       |        1 + (3+INCHI_T_NUM_MOVABLE)*num_at/2 words.
 5663|       |        */
 5664|   289k|    }
 5665|      0|    else
 5666|      0|    {
 5667|      0|        goto out_of_RAM;
 5668|      0|    }
 5669|       |
 5670|   289k|    pINChI->szHillFormula = NULL; /*  the length is unknown */
 5671|       |
 5672|   289k|    if (bIsotopic)
  ------------------
  |  Branch (5672:9): [True: 9.05k, False: 280k]
  ------------------
 5673|  9.05k|    {
 5674|  9.05k|        if (num_isotopic_atoms &&
  ------------------
  |  Branch (5674:13): [True: 2.24k, False: 6.81k]
  ------------------
 5675|  2.24k|            (pINChI->IsotopicAtom = (INChI_IsotopicAtom *)inchi_calloc(num_isotopic_atoms, sizeof(INChI_IsotopicAtom))) &&
  ------------------
  |  | 1146|  2.24k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5675:13): [True: 2.24k, False: 0]
  ------------------
 5676|  2.24k|            (pINChI->IsotopicTGroup = (INChI_IsotopicTGroup *)inchi_calloc(num_isotopic_atoms, sizeof(INChI_IsotopicTGroup))))
  ------------------
  |  | 1146|  2.24k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5676:13): [True: 2.24k, False: 0]
  ------------------
 5677|  2.24k|        {
 5678|  2.24k|            ;
 5679|  2.24k|        }
 5680|  6.81k|        else if (num_isotopic_atoms)
  ------------------
  |  Branch (5680:18): [True: 0, False: 6.81k]
  ------------------
 5681|      0|        {
 5682|      0|            goto out_of_RAM;
 5683|      0|        }
 5684|  9.05k|        if (!(pINChI->nPossibleLocationsOfIsotopicH = (AT_NUMB *)inchi_calloc((long long)num_at + 1, sizeof(pINChI->nPossibleLocationsOfIsotopicH[0])))) /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  9.05k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5684:13): [True: 0, False: 9.05k]
  ------------------
 5685|      0|        {
 5686|      0|            goto out_of_RAM;
 5687|      0|        }
 5688|  9.05k|    }
 5689|       |
 5690|   289k|    if ((pINChI->Stereo = Alloc_INChI_Stereo(num_at, num_bonds)))
  ------------------
  |  Branch (5690:9): [True: 289k, False: 0]
  ------------------
 5691|   289k|    {
 5692|   289k|        ;
 5693|   289k|    }
 5694|      0|    else
 5695|      0|    {
 5696|      0|        goto out_of_RAM;
 5697|      0|    }
 5698|       |
 5699|   289k|    if (bIsotopic)
  ------------------
  |  Branch (5699:9): [True: 9.05k, False: 280k]
  ------------------
 5700|  9.05k|    {
 5701|  9.05k|        if ((pINChI->StereoIsotopic = Alloc_INChI_Stereo(num_at, num_bonds)))
  ------------------
  |  Branch (5701:13): [True: 9.05k, False: 0]
  ------------------
 5702|  9.05k|        {
 5703|  9.05k|            ;
 5704|  9.05k|        }
 5705|      0|        else
 5706|      0|        {
 5707|      0|            goto out_of_RAM;
 5708|      0|        }
 5709|  9.05k|    }
 5710|       |
 5711|   289k|    return pINChI;
 5712|       |
 5713|      0|out_of_RAM:
 5714|      0|    if (pINChI)
  ------------------
  |  Branch (5714:9): [True: 0, False: 0]
  ------------------
 5715|      0|    {
 5716|      0|        Free_INChI(&pINChI);
 5717|       |        /*
 5718|       |        inchi_free(pINChI);
 5719|       |        */
 5720|      0|    }
 5721|       |
 5722|       |    return NULL;
 5723|   289k|}
Free_INChI_Aux:
 5727|  1.28M|{
 5728|  1.28M|    INChI_Aux *pINChI_Aux = *ppINChI_Aux;
 5729|  1.28M|    if (pINChI_Aux)
  ------------------
  |  Branch (5729:9): [True: 387k, False: 893k]
  ------------------
 5730|   387k|    {
 5731|       |
 5732|   387k|#if (bREUSE_INCHI == 1)
 5733|   387k|        if (pINChI_Aux->nRefCount-- > 0)
  ------------------
  |  Branch (5733:13): [True: 0, False: 387k]
  ------------------
 5734|      0|            return 1;
 5735|   387k|#endif
 5736|       |
 5737|   387k|        qzfree(pINChI_Aux->nOrigAtNosInCanonOrd);
  ------------------
  |  | 1176|   387k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|   289k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 289k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 289k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 289k, False: 97.5k]
  |  |  |  Branch (1176:61): [Folded, False: 387k]
  |  |  ------------------
  ------------------
 5738|   387k|        qzfree(pINChI_Aux->nIsotopicOrigAtNosInCanonOrd);
  ------------------
  |  | 1176|   387k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|  9.05k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 9.05k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 9.05k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 9.05k, False: 378k]
  |  |  |  Branch (1176:61): [Folded, False: 387k]
  |  |  ------------------
  ------------------
 5739|   387k|        qzfree(pINChI_Aux->nOrigAtNosInCanonOrdInv);
  ------------------
  |  | 1176|   387k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|   289k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 289k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 289k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 289k, False: 97.5k]
  |  |  |  Branch (1176:61): [Folded, False: 387k]
  |  |  ------------------
  ------------------
 5740|   387k|        qzfree(pINChI_Aux->nIsotopicOrigAtNosInCanonOrdInv);
  ------------------
  |  | 1176|   387k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|  9.05k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 9.05k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 9.05k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 9.05k, False: 378k]
  |  |  |  Branch (1176:61): [Folded, False: 387k]
  |  |  ------------------
  ------------------
 5741|   387k|        qzfree(pINChI_Aux->szOrigCoord);
  ------------------
  |  | 1176|   387k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 0, False: 387k]
  |  |  |  Branch (1176:61): [Folded, False: 387k]
  |  |  ------------------
  ------------------
 5742|   387k|        qzfree(pINChI_Aux->OrigInfo);
  ------------------
  |  | 1176|   387k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|   289k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 289k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 289k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 289k, False: 97.5k]
  |  |  |  Branch (1176:61): [Folded, False: 387k]
  |  |  ------------------
  ------------------
 5743|       |        /*
 5744|       |        qzfree( pINChI_Aux->nOriginalAtomNumber          );
 5745|       |        qzfree( pINChI_Aux->nCanonicalTGroupNumbers      );
 5746|       |        qzfree( pINChI_Aux->nIsotopicCanonicalTGroupNumbers);
 5747|       |        qzfree( pINChI_Aux->nTautomer                    );
 5748|       |        qzfree( pINChI_Aux->nNontautomericCanonicalNumbers         );
 5749|       |        qzfree( pINChI_Aux->nIsotopicCanonicalNumbers    );
 5750|       |        qzfree( pINChI_Aux->nNontautomericIsotopicCanonicalNumbers );
 5751|       |        qzfree( pINChI_Aux->nNontautomericEquNumbers               );
 5752|       |        qzfree( pINChI_Aux->nNontautomericIsotopicEquNumbers       );
 5753|       |        */
 5754|   387k|        qzfree(pINChI_Aux->nConstitEquNumbers);
  ------------------
  |  | 1176|   387k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|   289k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 289k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 289k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 289k, False: 97.5k]
  |  |  |  Branch (1176:61): [Folded, False: 387k]
  |  |  ------------------
  ------------------
 5755|   387k|        qzfree(pINChI_Aux->nConstitEquTGroupNumbers);
  ------------------
  |  | 1176|   387k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|   104k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 104k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 104k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 104k, False: 282k]
  |  |  |  Branch (1176:61): [Folded, False: 387k]
  |  |  ------------------
  ------------------
 5756|   387k|        qzfree(pINChI_Aux->nConstitEquIsotopicNumbers);
  ------------------
  |  | 1176|   387k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|  9.05k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 9.05k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 9.05k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 9.05k, False: 378k]
  |  |  |  Branch (1176:61): [Folded, False: 387k]
  |  |  ------------------
  ------------------
 5757|   387k|        qzfree(pINChI_Aux->nConstitEquIsotopicTGroupNumbers);
  ------------------
  |  | 1176|   387k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|  9.05k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 9.05k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 9.05k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 9.05k, False: 378k]
  |  |  |  Branch (1176:61): [Folded, False: 387k]
  |  |  ------------------
  ------------------
 5758|   387k|        qzfree(pINChI_Aux);
  ------------------
  |  | 1176|   387k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1152|   387k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1152:31): [True: 387k, False: 0]
  |  |  |  |  |  Branch (1152:50): [Folded, False: 387k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1176:27): [True: 387k, False: 0]
  |  |  |  Branch (1176:61): [Folded, False: 387k]
  |  |  ------------------
  ------------------
 5759|   387k|        *ppINChI_Aux = NULL;
 5760|   387k|    }
 5761|       |
 5762|  1.28M|    return 0;
 5763|  1.28M|}
Alloc_INChI_Aux:
 5770|   289k|{
 5771|   289k|    INChI_Aux *pINChI_Aux;
 5772|   289k|    int bIsotopic = (nAllocMode & REQ_MODE_ISO);
  ------------------
  |  |   17|   289k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
 5773|   289k|    int num_at_tg = num_at + num_at / 2;
 5774|       |    /* int    bTautomeric = (nAllocMode & REQ_MODE_TAUT); */
 5775|       |
 5776|   289k|    if (num_at <= 0 ||
  ------------------
  |  Branch (5776:9): [True: 0, False: 289k]
  ------------------
 5777|   289k|        NULL == (pINChI_Aux = (INChI_Aux *)inchi_calloc(1, sizeof(INChI_Aux))))
  ------------------
  |  | 1146|   289k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5777:9): [True: 0, False: 289k]
  ------------------
 5778|      0|    {
 5779|      0|        return NULL;
 5780|      0|    }
 5781|       |
 5782|   289k|    if ((pINChI_Aux->nOrigAtNosInCanonOrd = (AT_NUMB *)
  ------------------
  |  Branch (5782:9): [True: 289k, False: 0]
  ------------------
 5783|   289k|             inchi_calloc(num_at_tg, sizeof(pINChI_Aux->nOrigAtNosInCanonOrd[0]))) &&
  ------------------
  |  | 1146|   289k|#define inchi_calloc   calloc
  ------------------
 5784|   289k|        (pINChI_Aux->nOrigAtNosInCanonOrdInv = (AT_NUMB *)
  ------------------
  |  Branch (5784:9): [True: 289k, False: 0]
  ------------------
 5785|   289k|             inchi_calloc(num_at_tg, sizeof(pINChI_Aux->nOrigAtNosInCanonOrd[0]))) &&
  ------------------
  |  | 1146|   289k|#define inchi_calloc   calloc
  ------------------
 5786|   289k|        (pINChI_Aux->nConstitEquNumbers = (AT_NUMB *)
  ------------------
  |  Branch (5786:9): [True: 289k, False: 0]
  ------------------
 5787|   289k|             inchi_calloc(num_at_tg, sizeof(pINChI_Aux->nConstitEquNumbers[0]))))
  ------------------
  |  | 1146|   289k|#define inchi_calloc   calloc
  ------------------
 5788|   289k|    {
 5789|   289k|        ;
 5790|   289k|    }
 5791|      0|    else
 5792|      0|    {
 5793|      0|        goto out_of_RAM;
 5794|      0|    }
 5795|       |
 5796|   289k|    if (num_at > 1 &&
  ------------------
  |  Branch (5796:9): [True: 104k, False: 184k]
  ------------------
 5797|   104k|        (pINChI_Aux->nConstitEquTGroupNumbers = (AT_NUMB *)inchi_calloc((long long)num_at / 2 + 1, sizeof(pINChI_Aux->nConstitEquTGroupNumbers[0])))) /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|   104k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5797:9): [True: 104k, False: 0]
  ------------------
 5798|   104k|    {
 5799|   104k|        ;
 5800|   104k|    }
 5801|   184k|    else
 5802|   184k|    {
 5803|   184k|        if (num_at > 1)
  ------------------
  |  Branch (5803:13): [True: 0, False: 184k]
  ------------------
 5804|      0|        {
 5805|      0|            goto out_of_RAM;
 5806|      0|        }
 5807|   184k|    }
 5808|       |
 5809|   289k|    if (num_at > 0)
  ------------------
  |  Branch (5809:9): [True: 289k, False: 0]
  ------------------
 5810|   289k|    {
 5811|   289k|        pINChI_Aux->OrigInfo = (ORIG_INFO *)inchi_calloc(num_at, sizeof(pINChI_Aux->OrigInfo[0]));
  ------------------
  |  | 1146|   289k|#define inchi_calloc   calloc
  ------------------
 5812|   289k|        if (!pINChI_Aux->OrigInfo)
  ------------------
  |  Branch (5812:13): [True: 0, False: 289k]
  ------------------
 5813|      0|            goto out_of_RAM;
 5814|   289k|    }
 5815|       |
 5816|   289k|    if (bOrigCoord && num_at > 0)
  ------------------
  |  Branch (5816:9): [True: 0, False: 289k]
  |  Branch (5816:23): [True: 0, False: 0]
  ------------------
 5817|      0|    {
 5818|      0|        pINChI_Aux->szOrigCoord = (MOL_COORD *)inchi_calloc(num_at, sizeof(pINChI_Aux->szOrigCoord[0]));
  ------------------
  |  | 1146|      0|#define inchi_calloc   calloc
  ------------------
 5819|      0|        if (!pINChI_Aux->szOrigCoord)
  ------------------
  |  Branch (5819:13): [True: 0, False: 0]
  ------------------
 5820|      0|            goto out_of_RAM;
 5821|      0|    }
 5822|       |
 5823|   289k|    if (bIsotopic)
  ------------------
  |  Branch (5823:9): [True: 9.05k, False: 280k]
  ------------------
 5824|  9.05k|    {
 5825|  9.05k|        if (/*num_isotopic_atoms &&*/
 5826|  9.05k|            (pINChI_Aux->nIsotopicOrigAtNosInCanonOrd = (AT_NUMB *)inchi_calloc(num_at_tg, sizeof(pINChI_Aux->nIsotopicOrigAtNosInCanonOrd[0]))) &&
  ------------------
  |  | 1146|  9.05k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5826:13): [True: 9.05k, False: 0]
  ------------------
 5827|  9.05k|            (pINChI_Aux->nIsotopicOrigAtNosInCanonOrdInv = (AT_NUMB *)inchi_calloc(num_at_tg, sizeof(pINChI_Aux->nIsotopicOrigAtNosInCanonOrd[0]))) &&
  ------------------
  |  | 1146|  9.05k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5827:13): [True: 9.05k, False: 0]
  ------------------
 5828|  9.05k|            (pINChI_Aux->nConstitEquIsotopicNumbers = (AT_NUMB *)inchi_calloc(num_at_tg, sizeof(pINChI_Aux->nConstitEquIsotopicNumbers[0]))))
  ------------------
  |  | 1146|  9.05k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5828:13): [True: 9.05k, False: 0]
  ------------------
 5829|  9.05k|        {
 5830|  9.05k|            ;
 5831|  9.05k|        }
 5832|      0|        else if (num_isotopic_atoms)
  ------------------
  |  Branch (5832:18): [True: 0, False: 0]
  ------------------
 5833|      0|        {
 5834|      0|            goto out_of_RAM;
 5835|      0|        }
 5836|       |
 5837|  9.05k|        if (                                                                                                                                                              /*num_isotopic_atoms && num_at > 1 &&*/
 5838|  9.05k|            (pINChI_Aux->nConstitEquIsotopicTGroupNumbers = (AT_NUMB *)inchi_calloc((long long)num_at / 2 + 1, sizeof(pINChI_Aux->nConstitEquIsotopicTGroupNumbers[0])))) /* djb-rwth: cast operator added */
  ------------------
  |  | 1146|  9.05k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5838:13): [True: 9.05k, False: 0]
  ------------------
 5839|  9.05k|        {
 5840|  9.05k|            ;
 5841|  9.05k|        }
 5842|      0|        else if (num_isotopic_atoms && num_at > 1)
  ------------------
  |  Branch (5842:18): [True: 0, False: 0]
  |  Branch (5842:40): [True: 0, False: 0]
  ------------------
 5843|      0|        {
 5844|      0|            goto out_of_RAM;
 5845|      0|        }
 5846|  9.05k|    }
 5847|       |
 5848|   289k|    return pINChI_Aux;
 5849|       |
 5850|      0|out_of_RAM:
 5851|       |
 5852|      0|    if (pINChI_Aux)
  ------------------
  |  Branch (5852:9): [True: 0, False: 0]
  ------------------
 5853|      0|    {
 5854|      0|        Free_INChI_Aux(&pINChI_Aux);
 5855|       |        /*
 5856|       |        inchi_free(pINChI_Aux);
 5857|       |        */
 5858|      0|    }
 5859|       |
 5860|       |    return NULL;
 5861|   289k|}
imat_new:
 5885|    890|{
 5886|    890|    int i;
 5887|    890|    if (m == 0 || n == 0)
  ------------------
  |  Branch (5887:9): [True: 770, False: 120]
  |  Branch (5887:19): [True: 0, False: 120]
  ------------------
 5888|    770|    {
 5889|    770|        return 0;
 5890|    770|    }
 5891|    120|    if (*a)
  ------------------
  |  Branch (5891:9): [True: 0, False: 120]
  ------------------
 5892|      0|    {
 5893|      0|        imat_free(m, *a);
 5894|      0|        *a = NULL;
 5895|      0|    }
 5896|    120|    *a = (int **)inchi_calloc(m, sizeof(int *));
  ------------------
  |  | 1146|    120|#define inchi_calloc   calloc
  ------------------
 5897|    120|    if (NULL == *a)
  ------------------
  |  Branch (5897:9): [True: 0, False: 120]
  ------------------
 5898|      0|    {
 5899|      0|        return 1;
 5900|      0|    }
 5901|    937|    for (i = 0; i < m; i++)
  ------------------
  |  Branch (5901:17): [True: 817, False: 120]
  ------------------
 5902|    817|    {
 5903|    817|        (*a)[i] = (int *)inchi_calloc(n, sizeof(int));
  ------------------
  |  | 1146|    817|#define inchi_calloc   calloc
  ------------------
 5904|    817|        if (NULL == (*a)[i])
  ------------------
  |  Branch (5904:13): [True: 0, False: 817]
  ------------------
 5905|      0|        {
 5906|      0|            return 1;
 5907|      0|        }
 5908|    817|    }
 5909|    120|    return 0;
 5910|    120|}
imat_free:
 5916|    120|{
 5917|    120|    int i;
 5918|    120|    if (NULL != a)
  ------------------
  |  Branch (5918:9): [True: 120, False: 0]
  ------------------
 5919|    120|    {
 5920|    937|        for (i = 0; i < m; i++)
  ------------------
  |  Branch (5920:21): [True: 817, False: 120]
  ------------------
 5921|    817|        {
 5922|    817|            if (NULL != a[i]) /* djb-rwth: unresolved issue -- revision required? -- false positive as this function just does the clean-up job */
  ------------------
  |  Branch (5922:17): [True: 817, False: 0]
  ------------------
 5923|    817|            {
 5924|    817|                inchi_free(a[i]);
  ------------------
  |  | 1152|    817|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 817, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 817]
  |  |  ------------------
  ------------------
 5925|    817|            }
 5926|    817|        }
 5927|    120|        inchi_free(a);
  ------------------
  |  | 1152|    120|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1152:31): [True: 120, False: 0]
  |  |  |  Branch (1152:50): [Folded, False: 120]
  |  |  ------------------
  ------------------
 5928|    120|        a = NULL;
 5929|    120|    }
 5930|       |
 5931|    120|    return;
 5932|    120|}
strutil.c:is_only_HDT_neighbors:
 3681|  1.11k|{
 3682|  1.11k|    int v;
 3683|       |
 3684|  1.11k|    if (!at || metal_idx < 0 || metal_idx >= num_atoms)
  ------------------
  |  Branch (3684:9): [True: 0, False: 1.11k]
  |  Branch (3684:16): [True: 0, False: 1.11k]
  |  Branch (3684:33): [True: 0, False: 1.11k]
  ------------------
 3685|      0|    {
 3686|      0|        return 0;
 3687|      0|    }
 3688|       |
 3689|  1.79k|    for (v = 0; v < at[metal_idx].valence; v++)
  ------------------
  |  Branch (3689:17): [True: 1.46k, False: 337]
  ------------------
 3690|  1.46k|    {
 3691|  1.46k|        int nb = at[metal_idx].neighbor[v];
 3692|       |
 3693|  1.46k|        if (nb < 0 || nb >= num_atoms)
  ------------------
  |  Branch (3693:13): [True: 0, False: 1.46k]
  |  Branch (3693:23): [True: 0, False: 1.46k]
  ------------------
 3694|      0|        {
 3695|      0|            continue;
 3696|      0|        }
 3697|       |
 3698|  1.46k|        if (!(at[nb].elname[0] == 'H' && at[nb].elname[1] == '\0'))
  ------------------
  |  Branch (3698:15): [True: 682, False: 779]
  |  Branch (3698:42): [True: 679, False: 3]
  ------------------
 3699|    782|        {
 3700|    782|            return 0;
 3701|    782|        }
 3702|  1.46k|    }
 3703|       |
 3704|    337|    return 1;
 3705|  1.11k|}
strutil.c:MolecularInorganicsCountRingCNOAtoms:
 4320|  7.38k|{
 4321|  7.38k|    int atom_idx;
 4322|  7.38k|    int ring_cno_count = 0;
 4323|  7.38k|    AT_NUMB ring_id;
 4324|       |
 4325|  7.38k|    if (!MolecularInorganicsIsGroup1or2Metal(at[metal_idx].el_number) && at[metal_idx].nRingSystem)
  ------------------
  |  Branch (4325:9): [True: 4.69k, False: 2.69k]
  |  Branch (4325:74): [True: 4.69k, False: 0]
  ------------------
 4326|  4.69k|    {
 4327|  4.69k|        ring_id = at[metal_idx].nRingSystem;
 4328|       |
 4329|  29.1k|        for (atom_idx = 0; atom_idx < num_at; atom_idx++)
  ------------------
  |  Branch (4329:28): [True: 24.4k, False: 4.69k]
  ------------------
 4330|  24.4k|        {
 4331|  24.4k|            if (at[atom_idx].nRingSystem == ring_id &&
  ------------------
  |  Branch (4331:17): [True: 8.53k, False: 15.8k]
  ------------------
 4332|  8.53k|                (at[atom_idx].el_number == 6 ||  /* C */
  ------------------
  |  Branch (4332:18): [True: 394, False: 8.14k]
  ------------------
 4333|  8.14k|                    at[atom_idx].el_number == 7 ||  /* N */
  ------------------
  |  Branch (4333:21): [True: 1.38k, False: 6.76k]
  ------------------
 4334|  6.76k|                    at[atom_idx].el_number == 8))   /* O */
  ------------------
  |  Branch (4334:21): [True: 441, False: 6.32k]
  ------------------
 4335|  2.21k|            {
 4336|  2.21k|                ring_cno_count++;
 4337|  2.21k|            }
 4338|  24.4k|        }
 4339|  4.69k|    }
 4340|       |
 4341|  7.38k|    return ring_cno_count;
 4342|  7.38k|}
strutil.c:ConvertCoordinativeBondsToSingle:
 4211|  70.4k|{
 4212|  70.4k|    int i, k, k2, j;
 4213|       |
 4214|   229k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (4214:17): [True: 159k, False: 70.4k]
  ------------------
 4215|   159k|    {
 4216|   281k|        for (k = 0; k < at[i].valence; k++)
  ------------------
  |  Branch (4216:21): [True: 122k, False: 159k]
  ------------------
 4217|   122k|        {
 4218|   122k|            j = at[i].neighbor[k];
 4219|   122k|            if (j < 0 || j >= num_atoms)
  ------------------
  |  Branch (4219:17): [True: 0, False: 122k]
  |  Branch (4219:26): [True: 0, False: 122k]
  ------------------
 4220|      0|            {
 4221|      0|                continue;
 4222|      0|            }
 4223|       |
 4224|       |            /* Visit each undirected bond once, from the lower-indexed atom, so
 4225|       |             * a multiply-charged pair cannot be neutralized once from each end. */
 4226|   122k|            if (j <= i)
  ------------------
  |  Branch (4226:17): [True: 61.0k, False: 61.0k]
  ------------------
 4227|  61.0k|            {
 4228|  61.0k|                continue;
 4229|  61.0k|            }
 4230|       |
 4231|       |            /* Only coordinative (type 9) bonds are converted; plain single
 4232|       |             * bonds keep their intrinsic formal charges untouched. */
 4233|  61.0k|            if (at[i].bond_type[k] != COORDINATIVE_BOND)
  ------------------
  |  |  264|  61.0k|#define COORDINATIVE_BOND 9             /* (@nnuk) introduction of bond_type = 9 (Coordinative Bond) */
  ------------------
  |  Branch (4233:17): [True: 61.0k, False: 0]
  ------------------
 4234|  61.0k|            {
 4235|  61.0k|                continue;
 4236|  61.0k|            }
 4237|       |
 4238|       |            /* Realize the bond as single on both endpoints so the rest of the
 4239|       |             * pipeline sees a plain single bond from either atom. */
 4240|      0|            at[i].bond_type[k] = BOND_TYPE_SINGLE;
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
 4241|       |
 4242|      0|            for (k2 = 0; k2 < at[j].valence; k2++)
  ------------------
  |  Branch (4242:26): [True: 0, False: 0]
  ------------------
 4243|      0|            {
 4244|      0|                if (at[j].neighbor[k2] == i)
  ------------------
  |  Branch (4244:21): [True: 0, False: 0]
  ------------------
 4245|      0|                {
 4246|      0|                    at[j].bond_type[k2] = BOND_TYPE_SINGLE;
  ------------------
  |  |   32|      0|#define BOND_TYPE_SINGLE    1
  ------------------
 4247|      0|                    break;
 4248|      0|                }
 4249|      0|            }
 4250|       |
 4251|       |            /* Cancel the paired +/- charges: the lone pair becomes the bonding
 4252|       |             * pair, so each atom moves one unit toward neutral. */
 4253|      0|            if (at[i].charge > 0 && at[j].charge < 0)
  ------------------
  |  Branch (4253:17): [True: 0, False: 0]
  |  Branch (4253:37): [True: 0, False: 0]
  ------------------
 4254|      0|            {
 4255|      0|                at[i].charge--;
 4256|      0|                at[j].charge++;
 4257|      0|            }
 4258|      0|            else if (at[i].charge < 0 && at[j].charge > 0)
  ------------------
  |  Branch (4258:22): [True: 0, False: 0]
  |  Branch (4258:42): [True: 0, False: 0]
  ------------------
 4259|      0|            {
 4260|      0|                at[i].charge++;
 4261|      0|                at[j].charge--;
 4262|      0|            }
 4263|      0|        }
 4264|   159k|    }
 4265|  70.4k|}
strutil.c:MolecularInorganicsIsGroup1or2Metal:
 4279|  13.7k|{
 4280|  13.7k|    switch (el_number)
 4281|  13.7k|    {
 4282|       |        /* Group 1 */
 4283|      2|    case 3:   /* Li */
  ------------------
  |  Branch (4283:5): [True: 2, False: 13.7k]
  ------------------
 4284|     98|    case 11:  /* Na */
  ------------------
  |  Branch (4284:5): [True: 96, False: 13.6k]
  ------------------
 4285|  4.37k|    case 19:  /* K  */
  ------------------
  |  Branch (4285:5): [True: 4.27k, False: 9.49k]
  ------------------
 4286|  4.37k|    case 37:  /* Rb */
  ------------------
  |  Branch (4286:5): [True: 7, False: 13.7k]
  ------------------
 4287|  4.39k|    case 55:  /* Cs */
  ------------------
  |  Branch (4287:5): [True: 17, False: 13.7k]
  ------------------
 4288|  4.40k|    case 87:  /* Fr */
  ------------------
  |  Branch (4288:5): [True: 8, False: 13.7k]
  ------------------
 4289|       |
 4290|       |        /* Group 2 */
 4291|  4.40k|    case 4:   /* Be */
  ------------------
  |  Branch (4291:5): [True: 2, False: 13.7k]
  ------------------
 4292|  4.41k|    case 12:  /* Mg */
  ------------------
  |  Branch (4292:5): [True: 6, False: 13.7k]
  ------------------
 4293|  4.41k|    case 20:  /* Ca */
  ------------------
  |  Branch (4293:5): [True: 6, False: 13.7k]
  ------------------
 4294|  4.95k|    case 38:  /* Sr */
  ------------------
  |  Branch (4294:5): [True: 540, False: 13.2k]
  ------------------
 4295|  4.96k|    case 56:  /* Ba */
  ------------------
  |  Branch (4295:5): [True: 6, False: 13.7k]
  ------------------
 4296|  5.01k|    case 88:  /* Ra */
  ------------------
  |  Branch (4296:5): [True: 48, False: 13.7k]
  ------------------
 4297|  5.01k|        return 1;
 4298|       |
 4299|  8.75k|    default:
  ------------------
  |  Branch (4299:5): [True: 8.75k, False: 5.01k]
  ------------------
 4300|  8.75k|        return 0;
 4301|  13.7k|    }
 4302|  13.7k|}
strutil.c:MolecularInorganicsBondHasStereo:
 4357|  6.39k|{
 4358|  6.39k|    int neigh_pos;
 4359|  6.39k|    int neighbor_idx;
 4360|  6.39k|    int bond_has_stereo;
 4361|       |
 4362|  6.39k|    neighbor_idx = at[atom_idx].neighbor[bond_pos];
 4363|  6.39k|    bond_has_stereo = (at[atom_idx].bond_stereo[bond_pos] != 0);
 4364|       |
 4365|  9.31k|    for (neigh_pos = 0; !bond_has_stereo && neigh_pos < at[neighbor_idx].valence; neigh_pos++)
  ------------------
  |  Branch (4365:25): [True: 9.31k, False: 3]
  |  Branch (4365:45): [True: 9.31k, False: 0]
  ------------------
 4366|  9.31k|    {
 4367|  9.31k|        if (at[neighbor_idx].neighbor[neigh_pos] == atom_idx)
  ------------------
  |  Branch (4367:13): [True: 6.39k, False: 2.92k]
  ------------------
 4368|  6.39k|        {
 4369|  6.39k|            bond_has_stereo = (at[neighbor_idx].bond_stereo[neigh_pos] != 0);
 4370|  6.39k|            break;
 4371|  6.39k|        }
 4372|  9.31k|    }
 4373|       |
 4374|  6.39k|    return bond_has_stereo;
 4375|  6.39k|}

get_element_chemical_symbol:
   43|  1.68M|{
   44|  1.68M|    nAtNum -= 1;
   45|       |
   46|  1.68M|    if ( 0 < nAtNum )
  ------------------
  |  Branch (46:10): [True: 1.60M, False: 78.2k]
  ------------------
   47|  1.60M|    {
   48|  1.60M|        nAtNum += 2; /*  bypass D, T */
   49|  1.60M|    }
   50|       |
   51|  1.68M|    if ( 0 <= nAtNum && nAtNum < nElDataLen )
  ------------------
  |  Branch (51:10): [True: 1.68M, False: 0]
  |  Branch (51:25): [True: 1.68M, False: 0]
  ------------------
   52|  1.68M|    {
   53|       |        /* valid element symbol found */
   54|  1.68M|        strcpy(szElement, ElData[nAtNum].szElName);
   55|  1.68M|        return 0;
   56|  1.68M|    }
   57|       |
   58|       |    /* not found */
   59|      0|    strcpy(szElement, "??");
   60|      0|    return -1;
   61|  1.68M|}
get_element_or_pseudoelement_symbol:
   71|  1.97M|{
   72|  1.97M|    nAtNum -= 1;
   73|       |
   74|  1.97M|    if ( 0 < nAtNum )
  ------------------
  |  Branch (74:10): [True: 1.82M, False: 148k]
  ------------------
   75|  1.82M|    {
   76|  1.82M|        nAtNum += 2; /*  bypass D, T */
   77|  1.82M|    }
   78|       |
   79|  1.97M|    if ( 0 <= nAtNum && nAtNum < nElDataLen )
  ------------------
  |  Branch (79:10): [True: 1.97M, False: 0]
  |  Branch (79:25): [True: 1.97M, False: 0]
  ------------------
   80|  1.97M|    {
   81|       |        /* valid element symbol found */
   82|  1.97M|        strcpy(szElement, ElData[nAtNum].szElName);
   83|       |
   84|  1.97M|        if (!strcmp( szElement, "Zy" ))
  ------------------
  |  Branch (84:13): [True: 1.96k, False: 1.96M]
  ------------------
   85|  1.96k|        {
   86|  1.96k|            strcpy(szElement, "Zz");
   87|  1.96k|        }
   88|       |
   89|  1.97M|        return 0;
   90|  1.97M|    }
   91|       |
   92|       |    /* not found */
   93|      0|    strcpy(szElement, "??");
   94|       |
   95|      0|    return -1;
   96|  1.97M|}
el_number_in_internal_ref_table:
  101|   632k|{
  102|   632k|    int i;
  103|   632k|    const char* p;
  104|       |
  105|  31.1M|    for (i = 0; ( p = ElData[i].szElName )[0] && strcmp( p, elname ); i++)
  ------------------
  |  Branch (105:17): [True: 31.1M, False: 29]
  |  Branch (105:50): [True: 30.5M, False: 632k]
  ------------------
  106|  30.5M|    {
  107|  30.5M|        ;
  108|  30.5M|    }
  109|       |
  110|   632k|    return p[0] ? i : ERR_ELEM;
  ------------------
  |  Branch (110:12): [True: 632k, False: 29]
  ------------------
  111|   632k|}
get_periodic_table_number:
  118|  1.24M|{
  119|  1.24M|    int num;
  120|       |
  121|  1.24M|    if (elname == NULL)
  ------------------
  |  Branch (121:9): [True: 0, False: 1.24M]
  ------------------
  122|      0|    {
  123|      0|        return ERR_ELEM;
  124|      0|    }
  125|       |
  126|  1.24M|    if (strlen(elname) == 0)
  ------------------
  |  Branch (126:9): [True: 0, False: 1.24M]
  ------------------
  127|      0|    {
  128|      0|        return ERR_ELEM;
  129|      0|    }
  130|       |
  131|       |    /* the single letter (common) elements */
  132|  1.24M|    if (!elname[1])
  ------------------
  |  Branch (132:9): [True: 1.04M, False: 198k]
  ------------------
  133|  1.04M|    {
  134|  1.04M|        switch (elname[0])
  ------------------
  |  Branch (134:17): [True: 743k, False: 300k]
  ------------------
  135|  1.04M|        {
  136|   144k|            case 'H':
  ------------------
  |  Branch (136:13): [True: 144k, False: 900k]
  ------------------
  137|   144k|                return EL_NUMBER_H;
  ------------------
  |  |   11|   144k|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
  138|      0|                break;
  139|  44.6k|            case 'B':
  ------------------
  |  Branch (139:13): [True: 44.6k, False: 1.00M]
  ------------------
  140|  44.6k|                return EL_NUMBER_B;
  ------------------
  |  |   12|  44.6k|#define EL_NUMBER_B  ((U_CHAR)5)
  ------------------
  141|      0|                break;
  142|   115k|            case 'C':
  ------------------
  |  Branch (142:13): [True: 115k, False: 929k]
  ------------------
  143|   115k|                return EL_NUMBER_C;
  ------------------
  |  |   13|   115k|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  144|      0|                break;
  145|   121k|            case 'N':
  ------------------
  |  Branch (145:13): [True: 121k, False: 923k]
  ------------------
  146|   121k|                return EL_NUMBER_N;
  ------------------
  |  |   14|   121k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  147|      0|                break;
  148|   212k|            case 'O':
  ------------------
  |  Branch (148:13): [True: 212k, False: 832k]
  ------------------
  149|   212k|                return EL_NUMBER_O;
  ------------------
  |  |   15|   212k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  150|      0|                break;
  151|  24.0k|            case 'P':
  ------------------
  |  Branch (151:13): [True: 24.0k, False: 1.02M]
  ------------------
  152|  24.0k|                return EL_NUMBER_P;
  ------------------
  |  |   18|  24.0k|#define EL_NUMBER_P  ((U_CHAR)15)
  ------------------
  153|      0|                break;
  154|  54.9k|            case 'S':
  ------------------
  |  Branch (154:13): [True: 54.9k, False: 989k]
  ------------------
  155|  54.9k|                return EL_NUMBER_S;
  ------------------
  |  |   19|  54.9k|#define EL_NUMBER_S  ((U_CHAR)16)
  ------------------
  156|      0|                break;
  157|  13.1k|            case 'F':
  ------------------
  |  Branch (157:13): [True: 13.1k, False: 1.03M]
  ------------------
  158|  13.1k|                return EL_NUMBER_F;
  ------------------
  |  |   16|  13.1k|#define EL_NUMBER_F  ((U_CHAR)9)
  ------------------
  159|      0|                break;
  160|  13.3k|            case 'I':
  ------------------
  |  Branch (160:13): [True: 13.3k, False: 1.03M]
  ------------------
  161|  13.3k|                return EL_NUMBER_I;
  ------------------
  |  |   27|  13.3k|#define EL_NUMBER_I  ((U_CHAR)53)
  ------------------
  162|      0|                break;
  163|  1.04M|        }
  164|  1.04M|    }
  165|       |
  166|   499k|    num = el_number_in_internal_ref_table( elname );
  167|       |
  168|   499k|    if ( num < ERR_ELEM )
  ------------------
  |  Branch (168:10): [True: 499k, False: 29]
  ------------------
  169|   499k|    {
  170|       |        /* account for D,T in internal table (but not Mendeleev's table) */
  171|   499k|        num = inchi_max( 1, num - 1 );
  ------------------
  |  |  138|   499k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 7.90k, False: 491k]
  |  |  ------------------
  ------------------
  172|   499k|    }
  173|       |
  174|   499k|    return num;
  175|  1.24M|}
if_skip_add_H:
  183|  1.52M|{
  184|  1.52M|    return
  185|  1.52M|        ElData[nPeriodicNum > 1 ? nPeriodicNum + 1 : 0].bSkipAddingH;
  ------------------
  |  Branch (185:16): [True: 1.43M, False: 87.9k]
  ------------------
  186|  1.52M|}
get_el_valence:
  193|  18.6M|{
  194|  18.6M|    int idx = ( nPeriodicNum > 1 ) ? nPeriodicNum + 1 : 0;
  ------------------
  |  Branch (194:15): [True: 16.5M, False: 2.10M]
  ------------------
  195|       |
  196|       |    /* Bounds-check every index before touching ElData[].cValence[][].
  197|       |     * The original code guarded only the upper bound of val_num and the
  198|       |     * charge range; a negative nPeriodicNum/val_num or an element number
  199|       |     * beyond the table would read out of bounds. Return 0 (no known
  200|       |     * valence) for any out-of-range input. */
  201|  18.6M|    if ( nPeriodicNum < 0 || idx > nElDataLen ||
  ------------------
  |  Branch (201:10): [True: 0, False: 18.6M]
  |  Branch (201:30): [True: 0, False: 18.6M]
  ------------------
  202|  18.6M|         val_num < 0 || val_num >= MAX_NUM_VALENCES ||
  ------------------
  |  |  575|  37.3M|#define MAX_NUM_VALENCES        5                /* max. number + 1 to provide zero termination */
  ------------------
  |  Branch (202:10): [True: 0, False: 18.6M]
  |  Branch (202:25): [True: 0, False: 18.6M]
  ------------------
  203|  18.6M|         charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE )
  ------------------
  |  |  571|  37.3M|#define MIN_ATOM_CHARGE        (-2)
  ------------------
                       charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE )
  ------------------
  |  |  572|  18.6M|#define MAX_ATOM_CHARGE         2
  ------------------
  |  Branch (203:10): [True: 22, False: 18.6M]
  |  Branch (203:38): [True: 312, False: 18.6M]
  ------------------
  204|    334|    {
  205|    334|        return 0;
  206|    334|    }
  207|       |
  208|  18.6M|    return ElData[idx].cValence[NEUTRAL_STATE + charge][val_num];
  ------------------
  |  |  573|  18.6M|#define NEUTRAL_STATE          (-MIN_ATOM_CHARGE)
  |  |  ------------------
  |  |  |  |  571|  18.6M|#define MIN_ATOM_CHARGE        (-2)
  |  |  ------------------
  ------------------
  209|  18.6M|}
get_unusual_el_valence:
  221|   263k|{
  222|   263k|    int i, num_found, chem_valence, rad_adj, known_chem_valence, exact_found;
  223|       |
  224|   263k|    if ( !num_bonds && !num_H )
  ------------------
  |  Branch (224:10): [True: 1.84k, False: 261k]
  |  Branch (224:24): [True: 0, False: 1.84k]
  ------------------
  225|      0|    {
  226|      0|        return 0;
  227|      0|    }
  228|       |
  229|   263k|    if ( charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE )
  ------------------
  |  |  571|   527k|#define MIN_ATOM_CHARGE        (-2)
  ------------------
                  if ( charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE )
  ------------------
  |  |  572|   263k|#define MAX_ATOM_CHARGE         2
  ------------------
  |  Branch (229:10): [True: 221, False: 263k]
  |  Branch (229:38): [True: 1.31k, False: 262k]
  ------------------
  230|  1.53k|    {
  231|  1.53k|        if ( bonds_valence == num_bonds )
  ------------------
  |  Branch (231:14): [True: 1.38k, False: 151]
  ------------------
  232|  1.38k|        {
  233|  1.38k|            return 0; /* all single bonds */
  234|  1.38k|        }
  235|    151|        return bonds_valence;
  236|  1.53k|    }
  237|       |
  238|   262k|    if (!get_el_valence( nPeriodicNum, charge, 0 ) && bonds_valence == num_bonds)
  ------------------
  |  Branch (238:9): [True: 11.1k, False: 250k]
  |  Branch (238:55): [True: 7.17k, False: 3.96k]
  ------------------
  239|  7.17k|    {
  240|  7.17k|        return 0;
  241|  7.17k|    }
  242|       |
  243|   254k|    chem_valence = bonds_valence + num_H;
  244|   254k|    rad_adj = 0;
  245|   254k|    num_found = 0;
  246|   254k|    exact_found = 0;
  247|       |
  248|       |    /* Take into account a radical */
  249|   254k|    if ( radical == RADICAL_DOUBLET )
  ------------------
  |  |   76|   254k|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (249:10): [True: 17.2k, False: 237k]
  ------------------
  250|  17.2k|    {
  251|  17.2k|        rad_adj = 1;
  252|  17.2k|    }
  253|   237k|    else if ( radical == RADICAL_TRIPLET )
  ------------------
  |  |   77|   237k|#define RADICAL_TRIPLET 3
  ------------------
  |  Branch (253:15): [True: 5.75k, False: 231k]
  ------------------
  254|  5.75k|    {
  255|  5.75k|        rad_adj = 2;
  256|  5.75k|    }
  257|       |
  258|   532k|    for ( i = 0; i < MAX_NUM_VALENCES; i++ )
  ------------------
  |  |  575|   532k|#define MAX_NUM_VALENCES        5                /* max. number + 1 to provide zero termination */
  ------------------
  |  Branch (258:18): [True: 483k, False: 48.8k]
  ------------------
  259|   483k|    {
  260|   483k|        if (0 < ( known_chem_valence = get_el_valence( nPeriodicNum, charge, i ) - rad_adj ) &&
  ------------------
  |  Branch (260:13): [True: 300k, False: 182k]
  ------------------
  261|   300k|             num_bonds <= known_chem_valence && known_chem_valence <= chem_valence)
  ------------------
  |  Branch (261:14): [True: 254k, False: 45.8k]
  |  Branch (261:49): [True: 233k, False: 21.2k]
  ------------------
  262|   233k|        {
  263|   233k|            num_found++;
  264|   233k|            if ( known_chem_valence == chem_valence )
  ------------------
  |  Branch (264:18): [True: 206k, False: 27.6k]
  ------------------
  265|   206k|            {
  266|   206k|                exact_found = 1;
  267|   206k|                break;
  268|   206k|            }
  269|   233k|        }
  270|   483k|    }
  271|       |
  272|   254k|    return ( exact_found && 1 == num_found ) ? 0 : chem_valence;
  ------------------
  |  Branch (272:14): [True: 206k, False: 48.8k]
  |  Branch (272:29): [True: 189k, False: 16.5k]
  ------------------
  273|   262k|}
needed_unusual_el_valence:
  286|   318k|{
  287|   318k|    int chem_valence, num_H_expected; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
  288|   318k|    char szElement[4];
  289|       |
  290|       |    /*
  291|       |    if ( !num_bonds && !num_H )
  292|       |        return 0;
  293|       |    */
  294|       |
  295|   318k|    if (num_bonds && get_element_chemical_symbol( nPeriodicNum, szElement ) != -1)
  ------------------
  |  Branch (295:9): [True: 133k, False: 184k]
  |  Branch (295:22): [True: 133k, False: 0]
  ------------------
  296|   133k|    {
  297|   133k|        num_H_expected = get_num_H( szElement, 0, NULL, charge, radical, actual_bonds_valence, 0, 0, 0, 0 );
  298|   133k|    }
  299|   184k|    else
  300|   184k|    {
  301|   184k|        num_H_expected = num_H;
  302|   184k|    }
  303|       |
  304|   318k|    chem_valence = bonds_valence + num_H;
  305|       |
  306|       |#if ( (BUILD_WITH_ENG_OPTIONS==1) && (SDF_OUTPUT_HETERO_VALENCE==1) )
  307|       |    if ((nPeriodicNum == 1 && chem_valence != 1) /* H */ || (nPeriodicNum == 6 && chem_valence != 4) /* C */ ||
  308|       |        (nPeriodicNum != 1 && nPeriodicNum != 6) || charge || radical) /* djb-rwth: addressing LLVM warning */
  309|       |    {
  310|       |        return chem_valence ? chem_valence : -1;
  311|       |    }
  312|       |    else
  313|       |    {
  314|       |        return 0;
  315|       |    }
  316|       |#else
  317|   318k|    {
  318|   318k|        int i, num_found, num_found_known, rad_adj, known_chem_valence, exact_found;
  319|       |
  320|   318k|        if (charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE ||
  ------------------
  |  |  571|   637k|#define MIN_ATOM_CHARGE        (-2)
  ------------------
                      if (charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE ||
  ------------------
  |  |  572|   637k|#define MAX_ATOM_CHARGE         2
  ------------------
  |  Branch (320:13): [True: 46, False: 318k]
  |  Branch (320:41): [True: 812, False: 317k]
  ------------------
  321|   317k|             !get_el_valence( nPeriodicNum, charge, 0 ) ||
  ------------------
  |  Branch (321:14): [True: 75.7k, False: 241k]
  ------------------
  322|   241k|             if_skip_add_H( nPeriodicNum ) || bonds_valence != actual_bonds_valence ||
  ------------------
  |  Branch (322:14): [True: 75.7k, False: 166k]
  |  Branch (322:47): [True: 0, False: 166k]
  ------------------
  323|   166k|             num_H_expected != num_H)
  ------------------
  |  Branch (323:14): [True: 820, False: 165k]
  ------------------
  324|   153k|        {
  325|   153k|            if ( !num_H && !num_H_expected && bonds_valence == actual_bonds_valence )
  ------------------
  |  Branch (325:18): [True: 152k, False: 236]
  |  Branch (325:28): [True: 152k, False: 606]
  |  Branch (325:47): [True: 152k, False: 0]
  ------------------
  326|   152k|            {
  327|   152k|                return 0; /* no H */
  328|   152k|            }
  329|    842|            return chem_valence; /* needs to add H-atoms */
  330|   153k|        }
  331|       |
  332|       |        /* take into account radical */
  333|   165k|        if ( radical == RADICAL_DOUBLET )
  ------------------
  |  |   76|   165k|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (333:14): [True: 6.24k, False: 159k]
  ------------------
  334|  6.24k|        {
  335|  6.24k|            rad_adj = 1;
  336|  6.24k|        }
  337|   159k|        else if ( radical == RADICAL_TRIPLET )
  ------------------
  |  |   77|   159k|#define RADICAL_TRIPLET 3
  ------------------
  |  Branch (337:19): [True: 3.10k, False: 156k]
  ------------------
  338|  3.10k|        {
  339|  3.10k|            rad_adj = 2;
  340|  3.10k|        }
  341|   156k|        else
  342|   156k|        {
  343|   156k|            rad_adj = 0;
  344|   156k|        }
  345|       |
  346|   165k|        num_found_known = 0;
  347|   165k|        num_found = 0;
  348|   165k|        exact_found = 0;
  349|       |
  350|   504k|        for ( i = 0; i < MAX_NUM_VALENCES; i++ )
  ------------------
  |  |  575|   504k|#define MAX_NUM_VALENCES        5                /* max. number + 1 to provide zero termination */
  ------------------
  |  Branch (350:22): [True: 439k, False: 64.9k]
  ------------------
  351|   439k|        {
  352|   439k|            if (0 < ( known_chem_valence = get_el_valence( nPeriodicNum, charge, i ) ) &&
  ------------------
  |  Branch (352:17): [True: 219k, False: 219k]
  ------------------
  353|   219k|                 bonds_valence <= ( known_chem_valence -= rad_adj ))
  ------------------
  |  Branch (353:18): [True: 187k, False: 31.8k]
  ------------------
  354|   187k|            {
  355|       |                /* found known valence that fits without H */
  356|   187k|                num_found_known++;
  357|   187k|                if ( known_chem_valence <= chem_valence )
  ------------------
  |  Branch (357:22): [True: 100k, False: 87.3k]
  ------------------
  358|   100k|                {
  359|       |                    /* known valence is large enough to accommodate (implicit) H */
  360|   100k|                    num_found++;
  361|   100k|                }
  362|   187k|                if ( known_chem_valence == chem_valence )
  ------------------
  |  Branch (362:22): [True: 100k, False: 87.3k]
  ------------------
  363|   100k|                {
  364|   100k|                    exact_found = 1;
  365|   100k|                    break;
  366|   100k|                }
  367|   187k|            }
  368|   439k|        }
  369|       |
  370|   165k|        return ( exact_found && 1 == num_found && 1 == num_found_known )
  ------------------
  |  Branch (370:18): [True: 100k, False: 64.9k]
  |  Branch (370:33): [True: 100k, False: 0]
  |  Branch (370:51): [True: 100k, False: 0]
  ------------------
  371|   165k|            ? 0
  372|   165k|            : chem_valence ? chem_valence : -1;    /* needs zero */
  ------------------
  |  Branch (372:15): [True: 14.9k, False: 49.9k]
  ------------------
  373|   318k|    }
  374|   318k|#endif
  375|   318k|}
detect_unusual_el_valence:
  387|  2.11M|{
  388|  2.11M|    int i, chem_valence, rad_adj, known_chem_valence;
  389|       |
  390|  2.11M|    if ( !num_bonds && !num_H )
  ------------------
  |  Branch (390:10): [True: 556k, False: 1.55M]
  |  Branch (390:24): [True: 555k, False: 483]
  ------------------
  391|   555k|    {
  392|   555k|        return 0;
  393|   555k|    }
  394|       |
  395|  1.55M|    if ( charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE )
  ------------------
  |  |  571|  3.11M|#define MIN_ATOM_CHARGE        (-2)
  ------------------
                  if ( charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE )
  ------------------
  |  |  572|  1.55M|#define MAX_ATOM_CHARGE         2
  ------------------
  |  Branch (395:10): [True: 20, False: 1.55M]
  |  Branch (395:38): [True: 350, False: 1.55M]
  ------------------
  396|    370|    {
  397|    370|        if ( bonds_valence == num_bonds )
  ------------------
  |  Branch (397:14): [True: 332, False: 38]
  ------------------
  398|    332|        {
  399|    332|            return 0; /* all single bonds */
  400|    332|        }
  401|     38|        return bonds_valence;
  402|    370|    }
  403|       |
  404|  1.55M|    if (!get_el_valence( nPeriodicNum, charge, 0 ) && bonds_valence == num_bonds)
  ------------------
  |  Branch (404:9): [True: 38.7k, False: 1.52M]
  |  Branch (404:55): [True: 17.1k, False: 21.5k]
  ------------------
  405|  17.1k|    {
  406|  17.1k|        return 0;
  407|  17.1k|    }
  408|       |
  409|  1.54M|    chem_valence = bonds_valence + num_H;
  410|  1.54M|    rad_adj = 0;
  411|       |
  412|       |    /* take into account radical */
  413|  1.54M|    if ( radical == RADICAL_DOUBLET )
  ------------------
  |  |   76|  1.54M|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (413:10): [True: 42.9k, False: 1.49M]
  ------------------
  414|  42.9k|    {
  415|  42.9k|        rad_adj = 1;
  416|  42.9k|    }
  417|  1.49M|    else if ( radical == RADICAL_TRIPLET || radical == RADICAL_SINGLET )
  ------------------
  |  |   77|  2.99M|#define RADICAL_TRIPLET 3
  ------------------
                  else if ( radical == RADICAL_TRIPLET || radical == RADICAL_SINGLET )
  ------------------
  |  |   75|  1.49M|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (417:15): [True: 5.53k, False: 1.49M]
  |  Branch (417:45): [True: 0, False: 1.49M]
  ------------------
  418|  5.53k|    {
  419|  5.53k|        rad_adj = 2;
  420|  5.53k|    }
  421|       |
  422|  2.92M|    for ( i = 0; i < MAX_NUM_VALENCES; i++ )
  ------------------
  |  |  575|  2.92M|#define MAX_NUM_VALENCES        5                /* max. number + 1 to provide zero termination */
  ------------------
  |  Branch (422:18): [True: 2.70M, False: 218k]
  ------------------
  423|  2.70M|    {
  424|  2.70M|        if (0 < ( known_chem_valence = get_el_valence( nPeriodicNum, charge, i ) - rad_adj ))
  ------------------
  |  Branch (424:13): [True: 1.85M, False: 849k]
  ------------------
  425|  1.85M|        {
  426|  1.85M|            if ( known_chem_valence == chem_valence )
  ------------------
  |  Branch (426:18): [True: 1.32M, False: 531k]
  ------------------
  427|  1.32M|            {
  428|  1.32M|                return 0;
  429|  1.32M|            }
  430|  1.85M|        }
  431|  2.70M|    }
  432|       |
  433|   218k|    return chem_valence;
  434|  1.54M|}
get_el_type:
  441|  95.0k|{
  442|  95.0k|    return ElData[nPeriodicNum + 1].nType;
  443|  95.0k|}
is_el_a_metal:
  450|  6.67M|{
  451|  6.67M|    return 0 != ( ElData[nPeriodicNum + 1].nType & IS_METAL );
  ------------------
  |  |   82|  6.67M|#define IS_METAL        3          /* metal bitmap */
  ------------------
  452|  6.67M|}
get_num_H:
  633|   133k|{
  634|   133k|    int val, i, el_number, num_H = 0, num_iso_H;
  635|   133k|    static int intl_el_number_N = 0, intl_el_number_S=0, intl_el_number_O=0, intl_el_number_C=0;
  636|       |
  637|   133k|    if ( !intl_el_number_N )
  ------------------
  |  Branch (637:10): [True: 1, False: 133k]
  ------------------
  638|      1|    {
  639|      1|        intl_el_number_N = el_number_in_internal_ref_table( "N" );
  640|      1|    }
  641|   133k|    if ( !intl_el_number_S )
  ------------------
  |  Branch (641:10): [True: 1, False: 133k]
  ------------------
  642|      1|    {
  643|      1|        intl_el_number_S = el_number_in_internal_ref_table( "S" );
  644|      1|    }
  645|   133k|    if ( !intl_el_number_O )
  ------------------
  |  Branch (645:10): [True: 1, False: 133k]
  ------------------
  646|      1|    {
  647|      1|        intl_el_number_O = el_number_in_internal_ref_table( "O" );
  648|      1|    }
  649|   133k|    if ( !intl_el_number_C )
  ------------------
  |  Branch (649:10): [True: 1, False: 133k]
  ------------------
  650|      1|    {
  651|      1|        intl_el_number_C = el_number_in_internal_ref_table( "C" );
  652|      1|    }
  653|       |
  654|       |
  655|       |    /*  atom_input_valence (cValence) cannot be specified in case of */
  656|       |    /*  aliased MOLFile atom with known inp_num_H or inp_num_iso_H[] */
  657|       |
  658|   133k|    if ( bAliased )
  ------------------
  |  Branch (658:10): [True: 0, False: 133k]
  ------------------
  659|      0|    {
  660|      0|        num_H = inp_num_H;
  661|      0|    }
  662|   133k|    else if (atom_input_valence && atom_input_valence != 15)
  ------------------
  |  Branch (662:14): [True: 0, False: 133k]
  |  Branch (662:36): [True: 0, False: 0]
  ------------------
  663|      0|    {
  664|      0|        num_H = inchi_max( 0, atom_input_valence - chem_bonds_valence );
  ------------------
  |  |  138|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  665|      0|    }
  666|   133k|    else if ( atom_input_valence == 15 )
  ------------------
  |  Branch (666:15): [True: 0, False: 133k]
  ------------------
  667|      0|    {
  668|       |        /* Explicit zero valence (V3000 VAL=-1 / V2000 valence field 15): the */
  669|       |        /* atom must carry neither implicit H nor (chemically) any bonds. Honour */
  670|       |        /* the zero valence regardless of whether bonds were drawn, instead of */
  671|       |        /* treating 15 as a literal target valence and adding 15 - chem_bonds_valence */
  672|       |        /* hydrogens (github #105). */
  673|      0|        num_H = 0;
  674|      0|    }
  675|   133k|    else if (MIN_ATOM_CHARGE <= charge &&
  ------------------
  |  |  571|   133k|#define MIN_ATOM_CHARGE        (-2)
  ------------------
  |  Branch (675:14): [True: 133k, False: 44]
  ------------------
  676|   133k|              MAX_ATOM_CHARGE >= charge &&
  ------------------
  |  |  572|   133k|#define MAX_ATOM_CHARGE         2
  ------------------
  |  Branch (676:15): [True: 133k, False: 812]
  ------------------
  677|   133k|              ERR_ELEM != ( el_number = el_number_in_internal_ref_table( elname ) ) &&
  ------------------
  |  Branch (677:15): [True: 133k, False: 0]
  ------------------
  678|   133k|              !ElData[el_number].bSkipAddingH && !bDoNotAddH)
  ------------------
  |  Branch (678:15): [True: 116k, False: 16.4k]
  |  Branch (678:50): [True: 116k, False: 0]
  ------------------
  679|   116k|    {
  680|       |        /* add hydrogen atoms according to standard element valence */
  681|   116k|        if ( radical && radical != RADICAL_SINGLET )
  ------------------
  |  |   75|  9.75k|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (681:14): [True: 9.75k, False: 106k]
  |  Branch (681:25): [True: 9.75k, False: 0]
  ------------------
  682|  9.75k|        {
  683|  9.75k|            if ( (val = ElData[el_number].cValence[NEUTRAL_STATE + charge][0]) ) /* djb-rwth: addressing LLVM warning */
  ------------------
  |  |  573|  9.75k|#define NEUTRAL_STATE          (-MIN_ATOM_CHARGE)
  |  |  ------------------
  |  |  |  |  571|  9.75k|#define MIN_ATOM_CHARGE        (-2)
  |  |  ------------------
  ------------------
  |  Branch (683:18): [True: 9.65k, False: 102]
  ------------------
  684|  9.65k|            {
  685|  9.65k|                val -= ( radical == RADICAL_DOUBLET ) ? 1
  ------------------
  |  |   76|  9.65k|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (685:24): [True: 6.25k, False: 3.40k]
  ------------------
  686|  9.65k|                    : ( radical == RADICAL_SINGLET || radical == RADICAL_TRIPLET ) ? 2 : val;
  ------------------
  |  |   75|  6.80k|#define RADICAL_SINGLET 1
  ------------------
                                  : ( radical == RADICAL_SINGLET || radical == RADICAL_TRIPLET ) ? 2 : val;
  ------------------
  |  |   77|  3.40k|#define RADICAL_TRIPLET 3
  ------------------
  |  Branch (686:25): [True: 0, False: 3.40k]
  |  Branch (686:55): [True: 3.12k, False: 278]
  ------------------
  687|       |                /* if unknown radical then do not add H */
  688|  9.65k|                num_H = inchi_max( 0, val - chem_bonds_valence );
  ------------------
  |  |  138|  9.65k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 902, False: 8.75k]
  |  |  ------------------
  ------------------
  689|  9.65k|            }
  690|  9.75k|        }
  691|   106k|        else
  692|   106k|        {
  693|       |            /* find the smallest valence that is greater than the sum of the chemical bond valences */
  694|   106k|            for (i = 0;
  695|   138k|                 ( val = ElData[el_number].cValence[NEUTRAL_STATE + charge][i] ) &&
  ------------------
  |  |  573|   138k|#define NEUTRAL_STATE          (-MIN_ATOM_CHARGE)
  |  |  ------------------
  |  |  |  |  571|   138k|#define MIN_ATOM_CHARGE        (-2)
  |  |  ------------------
  ------------------
  |  Branch (695:18): [True: 123k, False: 14.5k]
  ------------------
  696|   123k|                 val < chem_bonds_valence;
  ------------------
  |  Branch (696:18): [True: 31.5k, False: 92.4k]
  ------------------
  697|   106k|                 i++)
  698|  31.5k|            {
  699|  31.5k|                ;
  700|  31.5k|            }
  701|       |
  702|       |            /* special case: do not add H to N(IV), S(III), S+(II), S-(II) */ /* S ions added 2004-05-10 */
  703|   106k|            if ( el_number == intl_el_number_N && !charge && !radical && val == 5 )
  ------------------
  |  Branch (703:18): [True: 25.0k, False: 81.9k]
  |  Branch (703:51): [True: 15.2k, False: 9.75k]
  |  Branch (703:62): [True: 15.2k, False: 0]
  |  Branch (703:74): [True: 3.29k, False: 11.9k]
  ------------------
  704|  3.29k|            {
  705|  3.29k|                val = 3;
  706|  3.29k|            }
  707|       |            /*else if ( el_number == el_number_N && !charge && !radical && val == 3 &&
  708|       |                 chem_bonds_valence == 2 && bHasMetalNeighbor )
  709|       |              {
  710|       |              val = 2;
  711|       |              }
  712|       |            */
  713|   103k|            else if ( el_number == intl_el_number_S && !charge && !radical && val == 4 && chem_bonds_valence == 3 )
  ------------------
  |  Branch (713:23): [True: 8.13k, False: 95.5k]
  |  Branch (713:56): [True: 4.86k, False: 3.27k]
  |  Branch (713:67): [True: 4.86k, False: 0]
  |  Branch (713:79): [True: 1.13k, False: 3.73k]
  |  Branch (713:91): [True: 54, False: 1.07k]
  ------------------
  714|     54|            {
  715|     54|                val = 3;
  716|     54|            }
  717|   103k|            else if ( bHasMetalNeighbor && el_number != intl_el_number_C && val > 0 )
  ------------------
  |  Branch (717:23): [True: 0, False: 103k]
  |  Branch (717:44): [True: 0, False: 0]
  |  Branch (717:77): [True: 0, False: 0]
  ------------------
  718|      0|            {
  719|      0|                val--;
  720|      0|            }
  721|       |            /*
  722|       |            if ( (el_number == el_number_S || el_number == el_number_O) &&
  723|       |                 abs(charge)==1 && !radical && val == 3 && chem_bonds_valence == 2 && bHasMetalNeighbor )
  724|       |              {
  725|       |              val = 2;
  726|       |              }
  727|       |            else
  728|       |            */
  729|       |
  730|   106k|            num_H = inchi_max( 0, val - chem_bonds_valence );
  ------------------
  |  |  138|   106k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (138:26): [True: 17.8k, False: 89.1k]
  |  |  ------------------
  ------------------
  731|   106k|        }
  732|       |
  733|   116k|        num_iso_H = 0;
  734|   116k|        if ( inp_num_iso_H )
  ------------------
  |  Branch (734:14): [True: 0, False: 116k]
  ------------------
  735|      0|        {
  736|      0|            for ( i = 0; i < NUM_H_ISOTOPES; i++ )
  ------------------
  |  |   25|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (736:26): [True: 0, False: 0]
  ------------------
  737|      0|            {
  738|      0|                num_iso_H += inp_num_iso_H[i];
  739|      0|            }
  740|      0|        }
  741|       |
  742|       |        /*  should not happen because atom here is not aliased */
  743|   116k|        if ( num_iso_H )
  ------------------
  |  Branch (743:14): [True: 0, False: 116k]
  ------------------
  744|      0|        {
  745|      0|            if ( num_H >= num_iso_H )
  ------------------
  |  Branch (745:18): [True: 0, False: 0]
  ------------------
  746|      0|            {
  747|      0|                num_H -= num_iso_H;
  748|      0|            }
  749|      0|            else
  750|      0|            {
  751|      0|                num_H = inp_num_H; /*  as requested in the alias */
  752|       |                /* num_H = (num_iso_H - num_H) % 2; */ /*  keep unchanged parity of the total number of H atoms */
  753|      0|            }
  754|      0|        }
  755|       |
  756|       |        /*  should not happen because atom here is not aliased */
  757|   116k|        if ( inp_num_H > num_H )
  ------------------
  |  Branch (757:14): [True: 0, False: 116k]
  ------------------
  758|      0|        {
  759|      0|            num_H = inp_num_H;  /*  as requested in the alias */
  760|       |            /* num_H = inp_num_H + (inp_num_H - num_H)%2; */ /*  keep unchanged parity of the number of non-isotopic H atoms */
  761|      0|        }
  762|   116k|    }
  763|  17.2k|    else
  764|  17.2k|    {
  765|  17.2k|        num_H = inp_num_H;
  766|  17.2k|    }
  767|       |
  768|   133k|    return num_H;
  769|   133k|}
get_atomic_mass_from_elnum:
  774|  1.46k|{
  775|  1.46k|    nAtNum -= 1;
  776|       |
  777|  1.46k|    if ( 0 < nAtNum )
  ------------------
  |  Branch (777:10): [True: 186, False: 1.27k]
  ------------------
  778|    186|    {
  779|    186|        nAtNum += 2; /*  bypass D, T */
  780|    186|    }
  781|       |
  782|  1.46k|    if ( 0 <= nAtNum && nAtNum < nElDataLen )
  ------------------
  |  Branch (782:10): [True: 1.46k, False: 0]
  |  Branch (782:25): [True: 1.46k, False: 0]
  ------------------
  783|  1.46k|    {
  784|  1.46k|        return (int) ElData[nAtNum].nAtMass;
  785|  1.46k|    }
  786|       |
  787|      0|    return 0;
  788|  1.46k|}
is_in_the_list:
  826|   138k|{
  827|   242k|    for ( ; nPathLen && *pathAtom != nNextAtom; nPathLen--, pathAtom++ )
  ------------------
  |  Branch (827:13): [True: 242k, False: 292]
  |  Branch (827:25): [True: 104k, False: 138k]
  ------------------
  828|   104k|    {
  829|   104k|        ;
  830|   104k|    }
  831|   138k|    return nPathLen ? pathAtom : NULL;
  ------------------
  |  Branch (831:12): [True: 138k, False: 292]
  ------------------
  832|   138k|}
num_of_H:
  895|   372k|{
  896|   372k|    static int el_number_H = (int)EL_NUMBER_H;
  ------------------
  |  |   11|   372k|#define EL_NUMBER_H  ((U_CHAR)1)
  ------------------
  897|   372k|    int    i, n, num_explicit_H = 0;
  898|   372k|    inp_ATOM *a = at + iat;
  899|       |
  900|  1.07M|    for (i = 0; i < a->valence; i++)
  ------------------
  |  Branch (900:17): [True: 700k, False: 372k]
  ------------------
  901|   700k|    {
  902|   700k|        n = a->neighbor[i];
  903|   700k|        num_explicit_H += ( 1 == at[n].valence && el_number_H == at[n].el_number );
  ------------------
  |  Branch (903:29): [True: 210k, False: 489k]
  |  Branch (903:51): [True: 33.2k, False: 177k]
  ------------------
  904|   700k|    }
  905|       |
  906|   372k|    return num_explicit_H + NUMH( at, iat );
  ------------------
  |  |   56|   372k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|   372k|#define NUM_ISO_H(AT, N) (AT[N].num_iso_H[0] + AT[N].num_iso_H[1] + AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  907|   372k|}
ion_el_group:
  917|   517k|{
  918|   517k|    switch ( el )
  919|   517k|    {
  920|  47.3k|        case EL_NUMBER_C: /* fallthrough */
  ------------------
  |  |   13|  47.3k|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  |  Branch (920:9): [True: 47.3k, False: 470k]
  ------------------
  921|       |#if ( FIX_REM_ION_PAIRS_Si_BUG == 1 )
  922|       |        case EL_NUMBER_SI:
  923|       |#endif
  924|  47.3k|            return EL_NUMBER_C;
  ------------------
  |  |   13|  47.3k|#define EL_NUMBER_C  ((U_CHAR)6)
  ------------------
  925|   132k|        case EL_NUMBER_N: /* fallthrough */
  ------------------
  |  |   14|   132k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (925:9): [True: 132k, False: 385k]
  ------------------
  926|   167k|        case EL_NUMBER_P:
  ------------------
  |  |   18|   167k|#define EL_NUMBER_P  ((U_CHAR)15)
  ------------------
  |  Branch (926:9): [True: 35.1k, False: 482k]
  ------------------
  927|   174k|        case EL_NUMBER_AS:
  ------------------
  |  |   22|   174k|#define EL_NUMBER_AS ((U_CHAR)33)
  ------------------
  |  Branch (927:9): [True: 7.57k, False: 509k]
  ------------------
  928|   175k|        case EL_NUMBER_SB:
  ------------------
  |  |   25|   175k|#define EL_NUMBER_SB ((U_CHAR)51)
  ------------------
  |  Branch (928:9): [True: 784, False: 516k]
  ------------------
  929|   175k|            return EL_NUMBER_N;
  ------------------
  |  |   14|   175k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  930|   112k|        case EL_NUMBER_O: /* fallthrough */
  ------------------
  |  |   15|   112k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (930:9): [True: 112k, False: 404k]
  ------------------
  931|   178k|        case EL_NUMBER_S:
  ------------------
  |  |   19|   178k|#define EL_NUMBER_S  ((U_CHAR)16)
  ------------------
  |  Branch (931:9): [True: 66.3k, False: 451k]
  ------------------
  932|   186k|        case EL_NUMBER_SE:
  ------------------
  |  |   23|   186k|#define EL_NUMBER_SE ((U_CHAR)34)
  ------------------
  |  Branch (932:9): [True: 7.36k, False: 510k]
  ------------------
  933|   198k|        case EL_NUMBER_TE:
  ------------------
  |  |   26|   198k|#define EL_NUMBER_TE ((U_CHAR)52)
  ------------------
  |  Branch (933:9): [True: 11.7k, False: 505k]
  ------------------
  934|   198k|            return EL_NUMBER_O;
  ------------------
  |  |   15|   198k|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  935|  96.4k|        default:
  ------------------
  |  Branch (935:9): [True: 96.4k, False: 421k]
  ------------------
  936|  96.4k|            return 0;
  937|   517k|    }
  938|   517k|}
has_other_ion_neigh:
  943|  3.21k|{
  944|  3.21k|    int charge = at[iat_ion_neigh].charge;
  945|  3.21k|    int i, neigh;
  946|       |
  947|  9.05k|    for ( i = 0; i < at[iat].valence; i++ )
  ------------------
  |  Branch (947:18): [True: 6.74k, False: 2.31k]
  ------------------
  948|  6.74k|    {
  949|  6.74k|        neigh = at[iat].neighbor[i];
  950|       |
  951|  6.74k|        if (neigh != iat_ion_neigh && at[neigh].charge == charge &&
  ------------------
  |  Branch (951:13): [True: 3.82k, False: 2.91k]
  |  Branch (951:39): [True: 1.01k, False: 2.81k]
  ------------------
  952|  1.01k|            ion_el_group( at[neigh].el_number ))
  ------------------
  |  Branch (952:13): [True: 902, False: 112]
  ------------------
  953|    902|        {
  954|    902|            return 1;
  955|    902|        }
  956|  6.74k|    }
  957|       |
  958|  2.31k|    return 0;
  959|  3.21k|}
has_other_ion_in_sphere_2:
  968|     30|{
  969|     30|#define MAXQ 16
  970|     30|    AT_NUMB q[MAXQ];
  971|     30|    int lenq = 0, lenq2, dist = 0, i = 0, iq, neigh, j, nRet = 0;
  972|     30|    q[lenq++] = iat;
  973|     30|    at[iat].cFlags = 1;
  974|       |
  975|     30|    iq = 0;
  976|     30|    dist = 1;
  977|       |    /* use at->cFlags as an indicator */
  978|       |
  979|     90|    while ( dist <= 2 )
  ------------------
  |  Branch (979:13): [True: 60, False: 30]
  ------------------
  980|     60|    {
  981|    130|        for ( lenq2 = lenq; iq < lenq2; iq++ )
  ------------------
  |  Branch (981:29): [True: 70, False: 60]
  ------------------
  982|     70|        {
  983|     70|            i = q[iq];
  984|       |
  985|    214|            for ( j = 0; j < at[i].valence; j++ )
  ------------------
  |  Branch (985:26): [True: 144, False: 70]
  ------------------
  986|    144|            {
  987|    144|                neigh = at[i].neighbor[j];
  988|       |
  989|    144|                if (!at[neigh].cFlags &&
  ------------------
  |  Branch (989:21): [True: 104, False: 40]
  ------------------
  990|    104|                     at[neigh].valence <= 3 &&
  ------------------
  |  Branch (990:22): [True: 95, False: 9]
  ------------------
  991|     95|                     ion_el_group( at[neigh].el_number ))
  ------------------
  |  Branch (991:22): [True: 79, False: 16]
  ------------------
  992|     79|                {
  993|     79|                    q[lenq++] = neigh;
  994|     79|                    at[neigh].cFlags = 1;
  995|     79|                    if (neigh != iat_ion_neigh &&
  ------------------
  |  Branch (995:25): [True: 49, False: 30]
  ------------------
  996|     49|                         at[iat_ion_neigh].charge == at[neigh].charge)
  ------------------
  |  Branch (996:26): [True: 6, False: 43]
  ------------------
  997|      6|                    {
  998|      6|                        nRet++;
  999|      6|                    }
 1000|     79|                }
 1001|    144|            }
 1002|     70|        }
 1003|       |
 1004|     60|        dist++;
 1005|     60|    }
 1006|       |
 1007|    139|    for ( iq = 0; iq < lenq; iq++ )
  ------------------
  |  Branch (1007:19): [True: 109, False: 30]
  ------------------
 1008|    109|    {
 1009|    109|        i = q[iq];
 1010|    109|        at[i].cFlags = 0;
 1011|    109|    }
 1012|       |
 1013|     30|    return nRet;
 1014|     30|}
nNoMetalNumBonds:
 1019|  1.33M|{
 1020|  1.33M|    int i;
 1021|       |
 1022|  1.33M|    inp_ATOM *a = at + at_no;
 1023|  1.33M|    int num_H = NUMH( a, 0 );
  ------------------
  |  |   56|  1.33M|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|  1.33M|#define NUM_ISO_H(AT, N) (AT[N].num_iso_H[0] + AT[N].num_iso_H[1] + AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
 1024|  1.33M|    int std_chem_bonds_valence = get_el_valence( a->el_number, a->charge, 0 );
 1025|       |
 1026|  1.33M|    if ( a->chem_bonds_valence + num_H > std_chem_bonds_valence )
  ------------------
  |  Branch (1026:10): [True: 356k, False: 977k]
  ------------------
 1027|   356k|    {
 1028|   356k|        int valence_to_metal = 0;
 1029|   356k|        int num_bonds_to_metal = 0;
 1030|       |
 1031|  1.40M|        for ( i = 0; i < a->valence; i++ )
  ------------------
  |  Branch (1031:22): [True: 1.04M, False: 356k]
  ------------------
 1032|  1.04M|        {
 1033|  1.04M|            if (is_el_a_metal( at[(int) a->neighbor[i]].el_number ))
  ------------------
  |  Branch (1033:17): [True: 91.7k, False: 956k]
  ------------------
 1034|  91.7k|            {
 1035|  91.7k|                if (( a->bond_type[i] & BOND_TYPE_MASK ) >= BOND_TYPE_ALTERN)
  ------------------
  |  |  189|  91.7k|#define BOND_TYPE_MASK        0x0f
  ------------------
                              if (( a->bond_type[i] & BOND_TYPE_MASK ) >= BOND_TYPE_ALTERN)
  ------------------
  |  |   35|  91.7k|#define BOND_TYPE_ALTERN    4
  ------------------
  |  Branch (1035:21): [True: 0, False: 91.7k]
  ------------------
 1036|      0|                {
 1037|      0|                    return a->valence; /* fall back */
 1038|      0|                }
 1039|  91.7k|                num_bonds_to_metal++;
 1040|  91.7k|                valence_to_metal += ( a->bond_type[i] & BOND_TYPE_MASK );
  ------------------
  |  |  189|  91.7k|#define BOND_TYPE_MASK        0x0f
  ------------------
 1041|  91.7k|            }
 1042|  1.04M|        }
 1043|       |
 1044|   356k|        if ( a->chem_bonds_valence + num_H - valence_to_metal == std_chem_bonds_valence )
  ------------------
  |  Branch (1044:14): [True: 31.2k, False: 325k]
  ------------------
 1045|  31.2k|        {
 1046|       |            /* removing bonds to metal produces standard valence */
 1047|  31.2k|            return a->valence - num_bonds_to_metal;
 1048|  31.2k|        }
 1049|   356k|    }
 1050|       |
 1051|   977k|#if ( S_VI_O_PLUS_METAL_FIX_BOND == 1 )
 1052|   977k|    else
 1053|   977k|    {
 1054|   977k|        if (1 == a->charge && 2 == get_endpoint_valence( a->el_number ) &&
  ------------------
  |  Branch (1054:13): [True: 92.1k, False: 884k]
  |  Branch (1054:31): [True: 40.6k, False: 51.5k]
  ------------------
 1055|  40.6k|                a->chem_bonds_valence + num_H == std_chem_bonds_valence)
  ------------------
  |  Branch (1055:17): [True: 40.1k, False: 488]
  ------------------
 1056|  40.1k|        {
 1057|  40.1k|            int valence_to_metal = 0;
 1058|  40.1k|            int num_bonds_to_metal = 0;
 1059|   134k|            for ( i = 0; i < a->valence; i++ )
  ------------------
  |  Branch (1059:26): [True: 94.3k, False: 40.1k]
  ------------------
 1060|  94.3k|            {
 1061|  94.3k|                if (is_el_a_metal( at[(int) a->neighbor[i]].el_number ))
  ------------------
  |  Branch (1061:21): [True: 4.77k, False: 89.5k]
  ------------------
 1062|  4.77k|                {
 1063|  4.77k|                    if (( a->bond_type[i] & BOND_TYPE_MASK ) >= BOND_TYPE_ALTERN)
  ------------------
  |  |  189|  4.77k|#define BOND_TYPE_MASK        0x0f
  ------------------
                                  if (( a->bond_type[i] & BOND_TYPE_MASK ) >= BOND_TYPE_ALTERN)
  ------------------
  |  |   35|  4.77k|#define BOND_TYPE_ALTERN    4
  ------------------
  |  Branch (1063:25): [True: 0, False: 4.77k]
  ------------------
 1064|      0|                    {
 1065|      0|                        return a->valence; /* fall back */
 1066|      0|                    }
 1067|  4.77k|                    num_bonds_to_metal++;
 1068|  4.77k|                    valence_to_metal += ( a->bond_type[i] & BOND_TYPE_MASK );
  ------------------
  |  |  189|  4.77k|#define BOND_TYPE_MASK        0x0f
  ------------------
 1069|  4.77k|                }
 1070|  94.3k|            }
 1071|  40.1k|            if ( 1 == valence_to_metal )
  ------------------
  |  Branch (1071:18): [True: 1.89k, False: 38.2k]
  ------------------
 1072|  1.89k|            {
 1073|       |                /* removing bonds to metal produces standard valence */
 1074|  1.89k|                return a->valence - num_bonds_to_metal;
 1075|  1.89k|            }
 1076|  40.1k|        }
 1077|   977k|    }
 1078|  1.30M|#endif
 1079|       |
 1080|  1.30M|    return a->valence;
 1081|  1.33M|}
nNoMetalBondsValence:
 1086|   756k|{
 1087|   756k|    int i;
 1088|       |
 1089|   756k|    inp_ATOM *a = at + at_no;
 1090|   756k|    int num_H = NUMH( a, 0 );
  ------------------
  |  |   56|   756k|#define NUMH(AT, N) (AT[N].num_H + NUM_ISO_H(AT, N))
  |  |  ------------------
  |  |  |  |   55|   756k|#define NUM_ISO_H(AT, N) (AT[N].num_iso_H[0] + AT[N].num_iso_H[1] + AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
 1091|   756k|    int std_chem_bonds_valence = get_el_valence( a->el_number, a->charge, 0 );
 1092|       |
 1093|   756k|    if ( a->chem_bonds_valence + num_H > std_chem_bonds_valence )
  ------------------
  |  Branch (1093:10): [True: 149k, False: 606k]
  ------------------
 1094|   149k|    {
 1095|   149k|        int valence_to_metal = 0;
 1096|       |        /*int num_bonds_to_metal = 0;*/
 1097|       |
 1098|   550k|        for ( i = 0; i < a->valence; i++ )
  ------------------
  |  Branch (1098:22): [True: 401k, False: 149k]
  ------------------
 1099|   401k|        {
 1100|   401k|            if (is_el_a_metal( at[(int) a->neighbor[i]].el_number ))
  ------------------
  |  Branch (1100:17): [True: 59.7k, False: 341k]
  ------------------
 1101|  59.7k|            {
 1102|  59.7k|                if (( a->bond_type[i] & BOND_TYPE_MASK ) >= BOND_TYPE_ALTERN)
  ------------------
  |  |  189|  59.7k|#define BOND_TYPE_MASK        0x0f
  ------------------
                              if (( a->bond_type[i] & BOND_TYPE_MASK ) >= BOND_TYPE_ALTERN)
  ------------------
  |  |   35|  59.7k|#define BOND_TYPE_ALTERN    4
  ------------------
  |  Branch (1102:21): [True: 0, False: 59.7k]
  ------------------
 1103|      0|                {
 1104|      0|                    return a->valence; /* fall back */
 1105|      0|                }
 1106|       |                /* num_bonds_to_metal ++;*/
 1107|  59.7k|                valence_to_metal += ( a->bond_type[i] & BOND_TYPE_MASK );
  ------------------
  |  |  189|  59.7k|#define BOND_TYPE_MASK        0x0f
  ------------------
 1108|  59.7k|            }
 1109|   401k|        }
 1110|       |
 1111|   149k|        if ( a->chem_bonds_valence + num_H - valence_to_metal == std_chem_bonds_valence )
  ------------------
  |  Branch (1111:14): [True: 32.1k, False: 117k]
  ------------------
 1112|  32.1k|        {
 1113|       |            /* removing bonds to metal produces standard valence */
 1114|  32.1k|            return a->chem_bonds_valence - valence_to_metal;
 1115|  32.1k|        }
 1116|   149k|    }
 1117|       |
 1118|   606k|#if ( S_VI_O_PLUS_METAL_FIX_BOND == 1 )
 1119|   606k|    else if (1 == a->charge && 2 == get_endpoint_valence( a->el_number ) &&
  ------------------
  |  Branch (1119:14): [True: 89.3k, False: 517k]
  |  Branch (1119:32): [True: 40.0k, False: 49.2k]
  ------------------
 1120|  40.0k|         a->chem_bonds_valence + num_H == std_chem_bonds_valence)
  ------------------
  |  Branch (1120:10): [True: 39.6k, False: 433]
  ------------------
 1121|  39.6k|    {
 1122|       |
 1123|  39.6k|        int valence_to_metal = 0;
 1124|       |        /* int num_bonds_to_metal = 0;*/
 1125|       |
 1126|   133k|        for ( i = 0; i < a->valence; i++ )
  ------------------
  |  Branch (1126:22): [True: 93.4k, False: 39.6k]
  ------------------
 1127|  93.4k|        {
 1128|  93.4k|            if (is_el_a_metal( at[(int) a->neighbor[i]].el_number ))
  ------------------
  |  Branch (1128:17): [True: 4.68k, False: 88.7k]
  ------------------
 1129|  4.68k|            {
 1130|  4.68k|                if (( a->bond_type[i] & BOND_TYPE_MASK ) >= BOND_TYPE_ALTERN)
  ------------------
  |  |  189|  4.68k|#define BOND_TYPE_MASK        0x0f
  ------------------
                              if (( a->bond_type[i] & BOND_TYPE_MASK ) >= BOND_TYPE_ALTERN)
  ------------------
  |  |   35|  4.68k|#define BOND_TYPE_ALTERN    4
  ------------------
  |  Branch (1130:21): [True: 0, False: 4.68k]
  ------------------
 1131|      0|                {
 1132|      0|                    return a->valence; /* fall back */
 1133|      0|                }
 1134|       |                /* num_bonds_to_metal ++;*/
 1135|  4.68k|                valence_to_metal += ( a->bond_type[i] & BOND_TYPE_MASK );
  ------------------
  |  |  189|  4.68k|#define BOND_TYPE_MASK        0x0f
  ------------------
 1136|  4.68k|            }
 1137|  93.4k|        }
 1138|       |
 1139|  39.6k|        if (1 == valence_to_metal)
  ------------------
  |  Branch (1139:13): [True: 1.82k, False: 37.7k]
  ------------------
 1140|  1.82k|        {/* removing bonds to metal produces standard valence */
 1141|  1.82k|            return a->chem_bonds_valence - valence_to_metal;
 1142|  1.82k|        }
 1143|  39.6k|    }
 1144|   722k|#endif
 1145|       |
 1146|   722k|    return a->chem_bonds_valence;
 1147|   756k|}
nNoMetalNeighIndex:
 1152|   185k|{
 1153|   185k|    int i;
 1154|       |
 1155|   185k|    inp_ATOM* a = at + at_no;
 1156|       |
 1157|   194k|    for ( i = 0; i < a->valence; i++ )
  ------------------
  |  Branch (1157:18): [True: 186k, False: 8.19k]
  ------------------
 1158|   186k|    {
 1159|   186k|        if (!is_el_a_metal( at[(int) a->neighbor[i]].el_number ))
  ------------------
  |  Branch (1159:13): [True: 177k, False: 9.22k]
  ------------------
 1160|   177k|        {
 1161|   177k|            return i;
 1162|   177k|        }
 1163|   186k|    }
 1164|       |
 1165|  8.19k|    return -1;
 1166|   185k|}
nNoMetalOtherNeighIndex:
 1171|  17.7k|{
 1172|  17.7k|    int i, neigh;
 1173|       |
 1174|  17.7k|    inp_ATOM* a = at + at_no;
 1175|       |
 1176|  36.8k|    for ( i = 0; i < a->valence; i++ )
  ------------------
  |  Branch (1176:18): [True: 35.7k, False: 1.16k]
  ------------------
 1177|  35.7k|    {
 1178|  35.7k|        neigh = (int) a->neighbor[i];
 1179|       |
 1180|  35.7k|        if (neigh != cur_neigh && !is_el_a_metal( at[neigh].el_number ))
  ------------------
  |  Branch (1180:13): [True: 18.3k, False: 17.3k]
  |  Branch (1180:35): [True: 16.5k, False: 1.79k]
  ------------------
 1181|  16.5k|        {
 1182|  16.5k|            return i;
 1183|  16.5k|        }
 1184|  35.7k|    }
 1185|       |
 1186|  1.16k|    return -1;
 1187|  17.7k|}
nNoMetalOtherNeighIndex2:
 1195|  10.7k|{
 1196|  10.7k|    int i, neigh;
 1197|       |
 1198|  10.7k|    inp_ATOM* a = at + at_no;
 1199|       |
 1200|  33.1k|    for ( i = 0; i < a->valence; i++ )
  ------------------
  |  Branch (1200:18): [True: 32.0k, False: 1.10k]
  ------------------
 1201|  32.0k|    {
 1202|  32.0k|        neigh = (int) a->neighbor[i];
 1203|       |
 1204|  32.0k|        if (neigh != cur_neigh && neigh != cur_neigh2 && !is_el_a_metal( at[neigh].el_number ))
  ------------------
  |  Branch (1204:13): [True: 21.3k, False: 10.6k]
  |  Branch (1204:35): [True: 10.7k, False: 10.6k]
  |  Branch (1204:58): [True: 9.61k, False: 1.10k]
  ------------------
 1205|  9.61k|        {
 1206|  9.61k|            return i;
 1207|  9.61k|        }
 1208|  32.0k|    }
 1209|       |
 1210|  1.10k|    return -1;
 1211|  10.7k|}
get_endpoint_valence:
 1275|  7.06M|{
 1276|  7.06M|    switch (el_number)
 1277|  7.06M|    {
 1278|  1.36M|        case EL_NUMBER_O:  /* fallthrough */
  ------------------
  |  |   15|  1.36M|#define EL_NUMBER_O  ((U_CHAR)8)
  ------------------
  |  Branch (1278:9): [True: 1.36M, False: 5.70M]
  ------------------
 1279|  1.65M|        case EL_NUMBER_S:
  ------------------
  |  |   19|  1.65M|#define EL_NUMBER_S  ((U_CHAR)16)
  ------------------
  |  Branch (1279:9): [True: 291k, False: 6.77M]
  ------------------
 1280|  1.67M|        case EL_NUMBER_SE:
  ------------------
  |  |   23|  1.67M|#define EL_NUMBER_SE ((U_CHAR)34)
  ------------------
  |  Branch (1280:9): [True: 20.0k, False: 7.04M]
  ------------------
 1281|  1.70M|        case EL_NUMBER_TE:
  ------------------
  |  |   26|  1.70M|#define EL_NUMBER_TE ((U_CHAR)52)
  ------------------
  |  Branch (1281:9): [True: 29.9k, False: 7.03M]
  ------------------
 1282|  1.70M|            return 2;
 1283|   982k|        case EL_NUMBER_N:
  ------------------
  |  |   14|   982k|#define EL_NUMBER_N  ((U_CHAR)7)
  ------------------
  |  Branch (1283:9): [True: 982k, False: 6.08M]
  ------------------
 1284|   982k|            return 3;
 1285|  4.37M|        default:
  ------------------
  |  Branch (1285:9): [True: 4.37M, False: 2.69M]
  ------------------
 1286|  4.37M|            return 0;
 1287|  7.06M|    }
 1288|  7.06M|}
extract_inchi_substring:
 1626|  6.35k|{
 1627|  6.35k|    size_t i;
 1628|  6.35k|    const char *p;
 1629|  6.35k|    char* bufp;
 1630|  6.35k|    char pp;
 1631|       |
 1632|  6.35k|    bufp = *buf;
 1633|  6.35k|    *buf = NULL;
 1634|       |
 1635|  6.35k|    if ( str == NULL )
  ------------------
  |  Branch (1635:10): [True: 0, False: 6.35k]
  ------------------
 1636|      0|    {
 1637|      0|        return;
 1638|      0|    }
 1639|  6.35k|    if (strlen( str ) < 1)
  ------------------
  |  Branch (1639:9): [True: 0, False: 6.35k]
  ------------------
 1640|      0|    {
 1641|      0|        return;
 1642|      0|    }
 1643|       |
 1644|  6.35k|    p = strstr( str, "InChI=" );
 1645|  6.35k|    if (NULL == p)
  ------------------
  |  Branch (1645:9): [True: 0, False: 6.35k]
  ------------------
 1646|      0|        return;
 1647|       |
 1648|  4.20M|    for ( i = 0; i < slen; i++ )
  ------------------
  |  Branch (1648:18): [True: 4.20M, False: 6.16k]
  ------------------
 1649|  4.20M|    {
 1650|  4.20M|        pp = p[i];
 1651|       |
 1652|  4.20M|        if (pp >= 'A' && pp <= 'Z')   continue;
  ------------------
  |  Branch (1652:13): [True: 2.34M, False: 1.86M]
  |  Branch (1652:26): [True: 530k, False: 1.81M]
  ------------------
 1653|  3.67M|        if (pp >= 'a' && pp <= 'z')   continue;
  ------------------
  |  Branch (1653:13): [True: 1.81M, False: 1.86M]
  |  Branch (1653:26): [True: 1.81M, False: 0]
  ------------------
 1654|  1.86M|        if (pp >= '0' && pp <= '9')   continue;
  ------------------
  |  Branch (1654:13): [True: 956k, False: 904k]
  |  Branch (1654:26): [True: 881k, False: 74.7k]
  ------------------
 1655|   979k|        switch (pp)
 1656|   979k|        {
 1657|   219k|            case '(':
  ------------------
  |  Branch (1657:13): [True: 219k, False: 760k]
  ------------------
 1658|   419k|            case ')':
  ------------------
  |  Branch (1658:13): [True: 200k, False: 779k]
  ------------------
 1659|   454k|            case '*':
  ------------------
  |  Branch (1659:13): [True: 35.3k, False: 944k]
  ------------------
 1660|   456k|            case '+':
  ------------------
  |  Branch (1660:13): [True: 1.46k, False: 977k]
  ------------------
 1661|   563k|            case ',':
  ------------------
  |  Branch (1661:13): [True: 107k, False: 872k]
  ------------------
 1662|   705k|            case '-':
  ------------------
  |  Branch (1662:13): [True: 142k, False: 837k]
  ------------------
 1663|   713k|            case '.':
  ------------------
  |  Branch (1663:13): [True: 8.11k, False: 971k]
  ------------------
 1664|   904k|            case '/':
  ------------------
  |  Branch (1664:13): [True: 190k, False: 788k]
  ------------------
 1665|   908k|            case ';':
  ------------------
  |  Branch (1665:13): [True: 4.24k, False: 975k]
  ------------------
 1666|   974k|            case '=':
  ------------------
  |  Branch (1666:13): [True: 65.5k, False: 913k]
  ------------------
 1667|   979k|            case '?':
  ------------------
  |  Branch (1667:13): [True: 4.76k, False: 974k]
  ------------------
 1668|   979k|            case '@':    continue;
  ------------------
  |  Branch (1668:13): [True: 198, False: 979k]
  ------------------
 1669|       |
 1670|    185|            default:    break;
  ------------------
  |  Branch (1670:13): [True: 185, False: 979k]
  ------------------
 1671|   979k|        }
 1672|       |
 1673|    185|        break;
 1674|   979k|    }
 1675|       |
 1676|  6.35k|    *buf = (char*) inchi_calloc( i + 1, sizeof( char ) );
  ------------------
  |  | 1146|  6.35k|#define inchi_calloc   calloc
  ------------------
 1677|  6.35k|    memcpy(*buf, p, i);
 1678|  6.35k|    if ( *buf )
  ------------------
  |  Branch (1678:10): [True: 6.35k, False: 0]
  ------------------
 1679|  6.35k|        (*buf)[i] = '\0';
 1680|       |
 1681|  6.35k|    return;
 1682|  6.35k|}
inchi_memicmp:
 1737|   101k|{
 1738|   101k|    const U_CHAR *s1 = (const U_CHAR*) p1;
 1739|   101k|    const U_CHAR *s2 = (const U_CHAR*) p2;
 1740|   101k|    while (length--)
  ------------------
  |  Branch (1740:12): [True: 101k, False: 0]
  ------------------
 1741|   101k|    {
 1742|   101k|        if (*s1 == *s2 ||
  ------------------
  |  Branch (1742:13): [True: 0, False: 101k]
  ------------------
 1743|   101k|              __MYTOLOWER( (int) *s1 ) == __MYTOLOWER( (int) *s2 ))
  ------------------
  |  | 1732|   101k|#define __MYTOLOWER(c) ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )
  |  |  ------------------
  |  |  |  Branch (1732:26): [True: 101k, False: 0]
  |  |  |  Branch (1732:42): [True: 101k, False: 0]
  |  |  ------------------
  ------------------
                            __MYTOLOWER( (int) *s1 ) == __MYTOLOWER( (int) *s2 ))
  ------------------
  |  | 1732|   101k|#define __MYTOLOWER(c) ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )
  |  |  ------------------
  |  |  |  Branch (1732:26): [True: 101k, False: 0]
  |  |  |  Branch (1732:42): [True: 101k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1743:15): [True: 0, False: 101k]
  ------------------
 1744|      0|        {
 1745|      0|            s1++;
 1746|      0|            s2++;
 1747|      0|        }
 1748|   101k|        else
 1749|   101k|        {
 1750|   101k|            return
 1751|   101k|                __MYTOLOWER( (int) *s1 ) - __MYTOLOWER( (int) *s2 );
  ------------------
  |  | 1732|   101k|#define __MYTOLOWER(c) ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )
  |  |  ------------------
  |  |  |  Branch (1732:26): [True: 101k, False: 0]
  |  |  |  Branch (1732:42): [True: 101k, False: 0]
  |  |  ------------------
  ------------------
                              __MYTOLOWER( (int) *s1 ) - __MYTOLOWER( (int) *s2 );
  ------------------
  |  | 1732|   101k|#define __MYTOLOWER(c) ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )
  |  |  ------------------
  |  |  |  Branch (1732:26): [True: 101k, False: 0]
  |  |  |  Branch (1732:42): [True: 101k, False: 0]
  |  |  ------------------
  ------------------
 1752|   101k|        }
 1753|   101k|    }
 1754|       |
 1755|      0|    return 0;
 1756|   101k|}
inchi_stricmp:
 1761|   694k|{
 1762|   904k|    while ( *s1 )
  ------------------
  |  Branch (1762:13): [True: 891k, False: 12.7k]
  ------------------
 1763|   891k|    {
 1764|   891k|        if (*s1 == *s2 ||
  ------------------
  |  Branch (1764:13): [True: 197k, False: 694k]
  ------------------
 1765|   694k|              __MYTOLOWER( (int) *s1 ) == __MYTOLOWER( (int) *s2 ))
  ------------------
  |  | 1732|   694k|#define __MYTOLOWER(c) ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )
  |  |  ------------------
  |  |  |  Branch (1732:26): [True: 694k, False: 0]
  |  |  |  Branch (1732:42): [True: 681k, False: 12.7k]
  |  |  ------------------
  ------------------
                            __MYTOLOWER( (int) *s1 ) == __MYTOLOWER( (int) *s2 ))
  ------------------
  |  | 1732|   694k|#define __MYTOLOWER(c) ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )
  |  |  ------------------
  |  |  |  Branch (1732:26): [True: 681k, False: 12.7k]
  |  |  |  Branch (1732:42): [True: 668k, False: 12.7k]
  |  |  ------------------
  ------------------
  |  Branch (1765:15): [True: 12.7k, False: 681k]
  ------------------
 1766|   210k|        {
 1767|   210k|            s1++;
 1768|   210k|            s2++;
 1769|   210k|        }
 1770|   681k|        else
 1771|   681k|        {
 1772|   681k|            return
 1773|   681k|                __MYTOLOWER( (int) *s1 ) - __MYTOLOWER( (int) *s2 );
  ------------------
  |  | 1732|   681k|#define __MYTOLOWER(c) ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )
  |  |  ------------------
  |  |  |  Branch (1732:26): [True: 681k, False: 0]
  |  |  |  Branch (1732:42): [True: 681k, False: 0]
  |  |  ------------------
  ------------------
                              __MYTOLOWER( (int) *s1 ) - __MYTOLOWER( (int) *s2 );
  ------------------
  |  | 1732|   681k|#define __MYTOLOWER(c) ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )
  |  |  ------------------
  |  |  |  Branch (1732:26): [True: 668k, False: 12.7k]
  |  |  |  Branch (1732:42): [True: 656k, False: 12.7k]
  |  |  ------------------
  ------------------
 1774|   681k|        }
 1775|   891k|    }
 1776|       |
 1777|  12.7k|    if ( *s2 )
  ------------------
  |  Branch (1777:10): [True: 0, False: 12.7k]
  ------------------
 1778|      0|    {
 1779|      0|        return -1;
 1780|      0|    }
 1781|       |
 1782|  12.7k|    return 0;
 1783|  12.7k|}
inchi__strdup:
 1801|  12.7k|{
 1802|  12.7k|    char* p = NULL;
 1803|  12.7k|    if ( string )
  ------------------
  |  Branch (1803:10): [True: 0, False: 12.7k]
  ------------------
 1804|      0|    {
 1805|      0|        size_t length = strlen( string );
 1806|      0|        p = (char *) inchi_malloc( length + 1 );
  ------------------
  |  | 1143|      0|#define inchi_malloc   malloc
  ------------------
 1807|      0|        if (p)
  ------------------
  |  Branch (1807:13): [True: 0, False: 0]
  ------------------
 1808|      0|        {
 1809|      0|            strcpy(p, string);
 1810|      0|        }
 1811|      0|    }
 1812|       |
 1813|  12.7k|    return p;
 1814|  12.7k|}

LLVMFuzzerTestOneInput:
   27|  6.37k|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   28|       |
   29|  6.37k|  if (size == kSizeMax)
  ------------------
  |  Branch (29:7): [True: 0, False: 6.37k]
  ------------------
   30|      0|    return 0;
   31|       |
   32|  6.37k|  char *szINCHISource = malloc(sizeof(char) * (size + 1));
   33|  6.37k|  memcpy(szINCHISource, data, size);
   34|  6.37k|  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|  6.37k|  char szINCHIKey[28], szXtra1[65], szXtra2[65];
   39|  6.37k|  GetINCHIKeyFromINCHI(szINCHISource, 0, 0, szINCHIKey, szXtra1, szXtra2);
   40|       |
   41|  6.37k|  inchi_InputINCHI inpInChI;
   42|  6.37k|  inpInChI.szInChI = szINCHISource;
   43|  6.37k|  inpInChI.szOptions = NULL;
   44|       |
   45|  6.37k|  inchi_Output out;
   46|  6.37k|  GetINCHIfromINCHI(&inpInChI, &out);
   47|       |
   48|  6.37k|  inchi_OutputStruct outStruct;
   49|  6.37k|  GetStructFromINCHI(&inpInChI, &outStruct);
   50|       |
   51|  6.37k|  free(szINCHISource);
   52|  6.37k|  FreeINCHI(&out);
   53|  6.37k|  FreeStructFromINCHI(&outStruct);
   54|       |
   55|  6.37k|  return 0;
   56|  6.37k|}

