		/*    regexec.c
		 */
		
		/*
		 * "One Ring to rule them all, One Ring to find them..."
		 */
		
		/* This file contains functions for executing a regular expression.  See
		 * also regcomp.c which funnily enough, contains functions for compiling
		 * a regular expression.
		 *
		 * This file is also copied at build time to ext/re/re_exec.c, where
		 * it's built with -DPERL_EXT_RE_BUILD -DPERL_EXT_RE_DEBUG -DPERL_EXT.
		 * This causes the main functions to be compiled under new names and with
		 * debugging support added, which makes "use re 'debug'" work.
		 
		 */
		
		/* NOTE: this is derived from Henry Spencer's regexp code, and should not
		 * confused with the original package (see point 3 below).  Thanks, Henry!
		 */
		
		/* Additional note: this code is very heavily munged from Henry's version
		 * in places.  In some spots I've traded clarity for efficiency, so don't
		 * blame Henry for some of the lack of readability.
		 */
		
		/* The names of the functions have been changed from regcomp and
		 * regexec to  pregcomp and pregexec in order to avoid conflicts
		 * with the POSIX routines of the same names.
		*/
		
		#ifdef PERL_EXT_RE_BUILD
		/* need to replace pregcomp et al, so enable that */
		#  ifndef PERL_IN_XSUB_RE
		#    define PERL_IN_XSUB_RE
		#  endif
		/* need access to debugger hooks */
		#  if defined(PERL_EXT_RE_DEBUG) && !defined(DEBUGGING)
		#    define DEBUGGING
		#  endif
		#endif
		
		#ifdef PERL_IN_XSUB_RE
		/* We *really* need to overwrite these symbols: */
		#  define Perl_regexec_flags my_regexec
		#  define Perl_regdump my_regdump
		#  define Perl_regprop my_regprop
		#  define Perl_re_intuit_start my_re_intuit_start
		/* *These* symbols are masked to allow static link. */
		#  define Perl_pregexec my_pregexec
		#  define Perl_reginitcolors my_reginitcolors
		#  define Perl_regclass_swash my_regclass_swash
		
		#  define PERL_NO_GET_CONTEXT
		#endif
		
		/*
		 * pregcomp and pregexec -- regsub and regerror are not used in perl
		 *
		 *	Copyright (c) 1986 by University of Toronto.
		 *	Written by Henry Spencer.  Not derived from licensed software.
		 *
		 *	Permission is granted to anyone to use this software for any
		 *	purpose on any computer system, and to redistribute it freely,
		 *	subject to the following restrictions:
		 *
		 *	1. The author is not responsible for the consequences of use of
		 *		this software, no matter how awful, even if they arise
		 *		from defects in it.
		 *
		 *	2. The origin of this software must not be misrepresented, either
		 *		by explicit claim or by omission.
		 *
		 *	3. Altered versions must be plainly marked as such, and must not
		 *		be misrepresented as being the original software.
		 *
		 ****    Alterations to Henry's code are...
		 ****
		 ****    Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
		 ****    2000, 2001, 2002, 2003, 2004, 2005, by Larry Wall and others
		 ****
		 ****    You may distribute under the terms of either the GNU General Public
		 ****    License or the Artistic License, as specified in the README file.
		 *
		 * Beware that some of this code is subtly aware of the way operator
		 * precedence is structured in regular expressions.  Serious changes in
		 * regular-expression syntax might require a total rethink.
		 */
		#include "EXTERN.h"
		#define PERL_IN_REGEXEC_C
		#include "perl.h"
		
		#include "regcomp.h"
		
		#define RF_tainted	1		/* tainted information used? */
		#define RF_warned	2		/* warned about big count? */
		#define RF_evaled	4		/* Did an EVAL with setting? */
		#define RF_utf8		8		/* String contains multibyte chars? */
		
		#define UTF ((PL_reg_flags & RF_utf8) != 0)
		
		#define RS_init		1		/* eval environment created */
		#define RS_set		2		/* replsv value is set */
		
		#ifndef STATIC
		#define	STATIC	static
		#endif
		
		#define REGINCLASS(p,c)  (ANYOF_FLAGS(p) ? reginclass(p,c,0,0) : ANYOF_BITMAP_TEST(p,*(c)))
		
		/*
		 * Forwards.
		 */
		
		#define CHR_SVLEN(sv) (do_utf8 ? sv_len_utf8(sv) : SvCUR(sv))
		#define CHR_DIST(a,b) (PL_reg_match_utf8 ? utf8_distance(a,b) : a - b)
		
		#define reghop_c(pos,off) ((char*)reghop((U8*)pos, off))
		#define reghopmaybe_c(pos,off) ((char*)reghopmaybe((U8*)pos, off))
		#define HOP(pos,off) (PL_reg_match_utf8 ? reghop((U8*)pos, off) : (U8*)(pos + off))
		#define HOPMAYBE(pos,off) (PL_reg_match_utf8 ? reghopmaybe((U8*)pos, off) : (U8*)(pos + off))
		#define HOPc(pos,off) ((char*)HOP(pos,off))
		#define HOPMAYBEc(pos,off) ((char*)HOPMAYBE(pos,off))
		
		#define HOPBACK(pos, off) (		\
		    (PL_reg_match_utf8)			\
			? reghopmaybe((U8*)pos, -off)	\
		    : (pos - off >= PL_bostr)		\
			? (U8*)(pos - off)		\
		    : (U8*)NULL				\
		)
		#define HOPBACKc(pos, off) (char*)HOPBACK(pos, off)
		
		#define reghop3_c(pos,off,lim) ((char*)reghop3((U8*)pos, off, (U8*)lim))
		#define reghopmaybe3_c(pos,off,lim) ((char*)reghopmaybe3((U8*)pos, off, (U8*)lim))
		#define HOP3(pos,off,lim) (PL_reg_match_utf8 ? reghop3((U8*)pos, off, (U8*)lim) : (U8*)(pos + off))
		#define HOPMAYBE3(pos,off,lim) (PL_reg_match_utf8 ? reghopmaybe3((U8*)pos, off, (U8*)lim) : (U8*)(pos + off))
		#define HOP3c(pos,off,lim) ((char*)HOP3(pos,off,lim))
		#define HOPMAYBE3c(pos,off,lim) ((char*)HOPMAYBE3(pos,off,lim))
		
		#define LOAD_UTF8_CHARCLASS(class,str) STMT_START { \
		    if (!CAT2(PL_utf8_,class)) { bool ok; ENTER; save_re_context(); ok=CAT2(is_utf8_,class)((const U8*)str); assert(ok); LEAVE; } } STMT_END
		#define LOAD_UTF8_CHARCLASS_ALNUM() LOAD_UTF8_CHARCLASS(alnum,"a")
		#define LOAD_UTF8_CHARCLASS_DIGIT() LOAD_UTF8_CHARCLASS(digit,"0")
		#define LOAD_UTF8_CHARCLASS_SPACE() LOAD_UTF8_CHARCLASS(space," ")
		#define LOAD_UTF8_CHARCLASS_MARK()  LOAD_UTF8_CHARCLASS(mark, "\xcd\x86")
		
		/* for use after a quantifier and before an EXACT-like node -- japhy */
		#define JUMPABLE(rn) ( \
		    OP(rn) == OPEN || OP(rn) == CLOSE || OP(rn) == EVAL || \
		    OP(rn) == SUSPEND || OP(rn) == IFMATCH || \
		    OP(rn) == PLUS || OP(rn) == MINMOD || \
		    (PL_regkind[(U8)OP(rn)] == CURLY && ARG1(rn) > 0) \
		)
		
		#define HAS_TEXT(rn) ( \
		    PL_regkind[(U8)OP(rn)] == EXACT || PL_regkind[(U8)OP(rn)] == REF \
		)
		
		/*
		  Search for mandatory following text node; for lookahead, the text must
		  follow but for lookbehind (rn->flags != 0) we skip to the next step.
		*/
		#define FIND_NEXT_IMPT(rn) STMT_START { \
		    while (JUMPABLE(rn)) \
			if (OP(rn) == SUSPEND || PL_regkind[(U8)OP(rn)] == CURLY) \
			    rn = NEXTOPER(NEXTOPER(rn)); \
			else if (OP(rn) == PLUS) \
			    rn = NEXTOPER(rn); \
			else if (OP(rn) == IFMATCH) \
			    rn = (rn->flags == 0) ? NEXTOPER(NEXTOPER(rn)) : rn + ARG(rn); \
			else rn += NEXT_OFF(rn); \
		} STMT_END 
		
		static void restore_pos(pTHX_ void *arg);
		
		STATIC CHECKPOINT
		S_regcppush(pTHX_ I32 parenfloor)
     1215116    {
     1215116        const int retval = PL_savestack_ix;
		#define REGCP_PAREN_ELEMS 4
     1215116        const int paren_elems_to_push = (PL_regsize - parenfloor) * REGCP_PAREN_ELEMS;
     1215116        int p;
		
     1215116        if (paren_elems_to_push < 0)
      ######    	Perl_croak(aTHX_ "panic: paren_elems_to_push < 0");
		
		#define REGCP_OTHER_ELEMS 6
     1215116        SSGROW(paren_elems_to_push + REGCP_OTHER_ELEMS);
     1393949        for (p = PL_regsize; p > parenfloor; p--) {
		/* REGCP_PARENS_ELEMS are pushed per pairs of parentheses. */
      178833    	SSPUSHINT(PL_regendp[p]);
      178833    	SSPUSHINT(PL_regstartp[p]);
      178833    	SSPUSHPTR(PL_reg_start_tmp[p]);
      178833    	SSPUSHINT(p);
		    }
		/* REGCP_OTHER_ELEMS are pushed in any case, parentheses or no. */
     1215116        SSPUSHINT(PL_regsize);
     1215116        SSPUSHINT(*PL_reglastparen);
     1215116        SSPUSHINT(*PL_reglastcloseparen);
     1215116        SSPUSHPTR(PL_reginput);
		#define REGCP_FRAME_ELEMS 2
		/* REGCP_FRAME_ELEMS are part of the REGCP_OTHER_ELEMS and
		 * are needed for the regexp context stack bookkeeping. */
     1215116        SSPUSHINT(paren_elems_to_push + REGCP_OTHER_ELEMS - REGCP_FRAME_ELEMS);
     1215116        SSPUSHINT(SAVEt_REGCONTEXT); /* Magic cookie. */
		
     1215116        return retval;
		}
		
		/* These are needed since we do not localize EVAL nodes: */
		#  define REGCP_SET(cp)  DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log,		\
					     "  Setting an EVAL scope, savestack=%"IVdf"\n",	\
					     (IV)PL_savestack_ix)); cp = PL_savestack_ix
		
		#  define REGCP_UNWIND(cp)  DEBUG_EXECUTE_r(cp != PL_savestack_ix ?		\
						PerlIO_printf(Perl_debug_log,		\
						"  Clearing an EVAL scope, savestack=%"IVdf"..%"IVdf"\n", \
						(IV)(cp), (IV)PL_savestack_ix) : 0); regcpblow(cp)
		
		STATIC char *
		S_regcppop(pTHX)
      679222    {
      679222        I32 i;
      679222        U32 paren = 0;
      679222        char *input;
		
      679222        GET_RE_DEBUG_FLAGS_DECL;
		
		    /* Pop REGCP_OTHER_ELEMS before the parentheses loop starts. */
      679222        i = SSPOPINT;
      679222        assert(i == SAVEt_REGCONTEXT); /* Check that the magic cookie is there. */
      679222        i = SSPOPINT; /* Parentheses elements to pop. */
      679222        input = (char *) SSPOPPTR;
      679222        *PL_reglastcloseparen = SSPOPINT;
      679222        *PL_reglastparen = SSPOPINT;
      679222        PL_regsize = SSPOPINT;
		
		    /* Now restore the parentheses context. */
      799840        for (i -= (REGCP_OTHER_ELEMS - REGCP_FRAME_ELEMS);
			 i > 0; i -= REGCP_PAREN_ELEMS) {
      120618    	I32 tmps;
      120618    	paren = (U32)SSPOPINT;
      120618    	PL_reg_start_tmp[paren] = (char *) SSPOPPTR;
      120618    	PL_regstartp[paren] = SSPOPINT;
      120618    	tmps = SSPOPINT;
      120618    	if (paren <= *PL_reglastparen)
       23876    	    PL_regendp[paren] = tmps;
			DEBUG_EXECUTE_r(
			    PerlIO_printf(Perl_debug_log,
					  "     restoring \\%"UVuf" to %"IVdf"(%"IVdf")..%"IVdf"%s\n",
					  (UV)paren, (IV)PL_regstartp[paren],
					  (IV)(PL_reg_start_tmp[paren] - PL_bostr),
					  (IV)PL_regendp[paren],
					  (paren > *PL_reglastparen ? "(no)" : ""));
      120618    	);
		    }
		    DEBUG_EXECUTE_r(
			if ((I32)(*PL_reglastparen + 1) <= PL_regnpar) {
			    PerlIO_printf(Perl_debug_log,
					  "     restoring \\%"IVdf"..\\%"IVdf" to undef\n",
					  (IV)(*PL_reglastparen + 1), (IV)PL_regnpar);
			}
      679222        );
		#if 1
		    /* It would seem that the similar code in regtry()
		     * already takes care of this, and in fact it is in
		     * a better location to since this code can #if 0-ed out
		     * but the code in regtry() is needed or otherwise tests
		     * requiring null fields (pat.t#187 and split.t#{13,14}
		     * (as of patchlevel 7877)  will fail.  Then again,
		     * this code seems to be necessary or otherwise
		     * building DynaLoader will fail:
		     * "Error: '*' not in typemap in DynaLoader.xs, line 164"
		     * --jhi */
     1743941        for (paren = *PL_reglastparen + 1; (I32)paren <= PL_regnpar; paren++) {
     1064719    	if ((I32)paren > PL_regsize)
      988140    	    PL_regstartp[paren] = -1;
     1064719    	PL_regendp[paren] = -1;
		    }
		#endif
      679222        return input;
		}
		
		STATIC char *
		S_regcp_set_to(pTHX_ I32 ss)
        5544    {
        5544        const I32 tmp = PL_savestack_ix;
		
        5544        PL_savestack_ix = ss;
        5544        regcppop();
        5544        PL_savestack_ix = tmp;
        5544        return Nullch;
		}
		
		typedef struct re_cc_state
		{
		    I32 ss;
		    regnode *node;
		    struct re_cc_state *prev;
		    CURCUR *cc;
		    regexp *re;
		} re_cc_state;
		
		#define regcpblow(cp) LEAVE_SCOPE(cp)	/* Ignores regcppush()ed data. */
		
		#define TRYPAREN(paren, n, input) {				\
		    if (paren) {						\
			if (n) {						\
			    PL_regstartp[paren] = HOPc(input, -1) - PL_bostr;	\
			    PL_regendp[paren] = input - PL_bostr;		\
			}							\
			else							\
			    PL_regendp[paren] = -1;				\
		    }								\
		    if (regmatch(next))						\
			sayYES;							\
		    if (paren && n)						\
			PL_regendp[paren] = -1;					\
		}
		
		
		/*
		 * pregexec and friends
		 */
		
		/*
		 - pregexec - match a regexp against a string
		 */
		I32
		Perl_pregexec(pTHX_ register regexp *prog, char *stringarg, register char *strend,
			 char *strbeg, I32 minend, SV *screamer, U32 nosave)
		/* strend: pointer to null at end of string */
		/* strbeg: real beginning of string */
		/* minend: end of match must be >=minend after stringarg. */
		/* nosave: For optimizations. */
      ######    {
      ######        return
			regexec_flags(prog, stringarg, strend, strbeg, minend, screamer, NULL,
				      nosave ? 0 : REXEC_COPY_STR);
		}
		
		STATIC void
		S_cache_re(pTHX_ regexp *prog)
    11716568    {
    11716568        PL_regprecomp = prog->precomp;		/* Needed for FAIL. */
		#ifdef DEBUGGING
    11716568        PL_regprogram = prog->program;
		#endif
    11716568        PL_regnpar = prog->nparens;
    11716568        PL_regdata = prog->data;
    11716568        PL_reg_re = prog;
		}
		
		/*
		 * Need to implement the following flags for reg_anch:
		 *
		 * USE_INTUIT_NOML		- Useful to call re_intuit_start() first
		 * USE_INTUIT_ML
		 * INTUIT_AUTORITATIVE_NOML	- Can trust a positive answer
		 * INTUIT_AUTORITATIVE_ML
		 * INTUIT_ONCE_NOML		- Intuit can match in one location only.
		 * INTUIT_ONCE_ML
		 *
		 * Another flag for this function: SECOND_TIME (so that float substrs
		 * with giant delta may be not rechecked).
		 */
		
		/* Assumptions: if ANCH_GPOS, then strpos is anchored. XXXX Check GPOS logic */
		
		/* If SCREAM, then SvPVX_const(sv) should be compatible with strpos and strend.
		   Otherwise, only SvCUR(sv) is used to get strbeg. */
		
		/* XXXX We assume that strpos is strbeg unless sv. */
		
		/* XXXX Some places assume that there is a fixed substring.
			An update may be needed if optimizer marks as "INTUITable"
			RExen without fixed substrings.  Similarly, it is assumed that
			lengths of all the strings are no more than minlen, thus they
			cannot come from lookahead.
			(Or minlen should take into account lookahead.) */
		
		/* A failure to find a constant substring means that there is no need to make
		   an expensive call to REx engine, thus we celebrate a failure.  Similarly,
		   finding a substring too deep into the string means that less calls to
		   regtry() should be needed.
		
		   REx compiler's optimizer found 4 possible hints:
			a) Anchored substring;
			b) Fixed substring;
			c) Whether we are anchored (beginning-of-line or \G);
			d) First node (of those at offset 0) which may distingush positions;
		   We use a)b)d) and multiline-part of c), and try to find a position in the
		   string which does not contradict any of them.
		 */
		
		/* Most of decisions we do here should have been done at compile time.
		   The nodes of the REx which we used for the search should have been
		   deleted from the finite automaton. */
		
		char *
		Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos,
				     char *strend, U32 flags, re_scream_pos_data *data)
     4555374    {
     4555374        register I32 start_shift = 0;
		    /* Should be nonnegative! */
     4555374        register I32 end_shift   = 0;
     4555374        register char *s;
     4555374        register SV *check;
     4555374        char *strbeg;
     4555374        char *t;
     4555374        const int do_utf8 = sv ? SvUTF8(sv) : 0;	/* if no sv we have to assume bytes */
     4555374        I32 ml_anch;
     4555374        register char *other_last = Nullch;	/* other substr checked before this */
     4555374        char *check_at = Nullch;		/* check substr found at this pos */
     4555374        const I32 multiline = prog->reganch & PMf_MULTILINE;
		#ifdef DEBUGGING
     4555374        char *i_strpos = strpos;
     4555374        SV *dsv = PERL_DEBUG_PAD_ZERO(0);
		#endif
		
     4555374        GET_RE_DEBUG_FLAGS_DECL;
		
     4555374        RX_MATCH_UTF8_set(prog,do_utf8);
		
     4555374        if (prog->reganch & ROPT_UTF8) {
			DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log,
        2085    			      "UTF-8 regex...\n"));
        2085    	PL_reg_flags |= RF_utf8;
		    }
		
		    DEBUG_EXECUTE_r({
			 const char *s   = PL_reg_match_utf8 ?
			                 sv_uni_display(dsv, sv, 60, UNI_DISPLAY_REGEX) :
			                 strpos;
			 const int   len = PL_reg_match_utf8 ?
			                 strlen(s) : strend - strpos;
			 if (!PL_colorset)
			      reginitcolors();
			 if (PL_reg_match_utf8)
			     DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log,
						   "UTF-8 target...\n"));
			 PerlIO_printf(Perl_debug_log,
				       "%sGuessing start of match, REx%s \"%s%.60s%s%s\" against \"%s%.*s%s%s\"...\n",
				       PL_colors[4], PL_colors[5], PL_colors[0],
				       prog->precomp,
				       PL_colors[1],
				       (strlen(prog->precomp) > 60 ? "..." : ""),
				       PL_colors[0],
				       (int)(len > 60 ? 60 : len),
				       s, PL_colors[1],
				       (len > 60 ? "..." : "")
			      );
     4555374        });
		
		    /* CHR_DIST() would be more correct here but it makes things slow. */
     4555374        if (prog->minlen > strend - strpos) {
			DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log,
       93641    			      "String too short... [re_intuit_start]\n"));
      ######    	goto fail;
		    }
     4461733        strbeg = (sv && SvPOK(sv)) ? strend - SvCUR(sv) : strpos;
     4461733        PL_regeol = strend;
     4461733        if (do_utf8) {
        4977    	if (!prog->check_utf8 && prog->check_substr)
          89    	    to_utf8_substr(prog);
        4977    	check = prog->check_utf8;
		    } else {
     4456756    	if (!prog->check_substr && prog->check_utf8)
          19    	    to_byte_substr(prog);
     4456756    	check = prog->check_substr;
		    }
     4461733       if (check == &PL_sv_undef) {
			DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log,
           2    		"Non-utf string cannot match utf check string\n"));
      ######    	goto fail;
		    }
     4461731        if (prog->reganch & ROPT_ANCH) {	/* Match at beg-of-str or after \n */
     2624230    	ml_anch = !( (prog->reganch & ROPT_ANCH_SINGLE)
				     || ( (prog->reganch & ROPT_ANCH_BOL)
					  && !multiline ) );	/* Check after \n? */
		
     2624230    	if (!ml_anch) {
     2551524    	  if ( !(prog->reganch & (ROPT_ANCH_GPOS /* Checked by the caller */
						  | ROPT_IMPLICIT)) /* not a real BOL */
			       /* SvCUR is not set on references: SvRV and SvPVX_const overlap */
			       && sv && !SvROK(sv)
			       && (strpos != strbeg)) {
          14    	      DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "Not at start...\n"));
      ######    	      goto fail;
			  }
     2551510    	  if (prog->check_offset_min == prog->check_offset_max &&
			      !(prog->reganch & ROPT_CANY_SEEN)) {
			    /* Substring at constant offset from beg-of-str... */
     1283680    	    I32 slen;
		
     1283680    	    s = HOP3c(strpos, prog->check_offset_min, strend);
     1283680    	    if (SvTAIL(check)) {
       17998    		slen = SvCUR(check);	/* >= 1 */
		
       17998    		if ( strend - s > slen || strend - s < slen - 1
				     || (strend - s == slen && strend[-1] != '\n')) {
        3142    		    DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "String too long...\n"));
      ######    		    goto fail_finish;
				}
				/* Now should match s[0..slen-2] */
       14856    		slen--;
       14856    		if (slen && (*SvPVX_const(check) != *s
					     || (slen > 1
						 && memNE(SvPVX_const(check), s, slen)))) {
				  report_neq:
     1078513    		    DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "String not equal...\n"));
      ######    		    goto fail_finish;
				}
			    }
     1265682    	    else if (*SvPVX_const(check) != *s
				     || ((slen = SvCUR(check)) > 1
					 && memNE(SvPVX_const(check), s, slen)))
     1340536    		goto report_neq;
     1340536    	    goto success_at_start;
			  }
			}
			/* Match is anchored, but substr is not anchored wrt beg-of-str. */
     1340536    	s = strpos;
     1340536    	start_shift = prog->check_offset_min; /* okay to underestimate on CC */
     1340536    	end_shift = prog->minlen - start_shift -
			    CHR_SVLEN(check) + (SvTAIL(check) != 0);
     1340536    	if (!ml_anch) {
     1267830    	    const I32 end = prog->check_offset_max + CHR_SVLEN(check)
     1267830    					 - (SvTAIL(check) != 0);
     1267830    	    const I32 eshift = CHR_DIST((U8*)strend, (U8*)s) - end;
		
     1267830    	    if (end_shift < eshift)
      120985    		end_shift = eshift;
			}
		    }
		    else {				/* Can match at random position */
     1837501    	ml_anch = 0;
     1837501    	s = strpos;
     1837501    	start_shift = prog->check_offset_min; /* okay to underestimate on CC */
			/* Should be nonnegative! */
     1837501    	end_shift = prog->minlen - start_shift -
			    CHR_SVLEN(check) + (SvTAIL(check) != 0);
		    }
		
		#ifdef DEBUGGING	/* 7/99: reports of failure (with the older version) */
     3178037        if (end_shift < 0)
      ######    	Perl_croak(aTHX_ "panic: end_shift");
		#endif
		
		  restart:
		    /* Find a possible match in the region s..strend by looking for
		       the "check" substring in the region corrected by start/end_shift. */
     3193413        if (flags & REXEC_SCREAM) {
          17    	I32 p = -1;			/* Internal iterator of scream. */
          17    	I32 * const pp = data ? data->scream_pos : &p;
		
          17    	if (PL_screamfirst[BmRARE(check)] >= 0
			    || ( BmRARE(check) == '\n'
				 && (BmPREVIOUS(check) == SvCUR(check) - 1)
				 && SvTAIL(check) ))
          17    	    s = screaminstr(sv, check,
					    start_shift + (s - strbeg), end_shift, pp, 0);
			else
          17    	    goto fail_finish;
			/* we may be pointing at the wrong string */
          17    	if (s && RX_MATCH_COPIED(prog))
           4    	    s = strbeg + (s - SvPVX_const(sv));
          17    	if (data)
           2    	    *data->scream_olds = s;
		    }
     3193396        else if (prog->reganch & ROPT_CANY_SEEN)
        3735    	s = fbm_instr((U8*)(s + start_shift),
				      (U8*)(strend - end_shift),
				      check, multiline ? FBMrf_MULTILINE : 0);
		    else
     3189661    	s = fbm_instr(HOP3(s, start_shift, strend),
				      HOP3(strend, -end_shift, strbeg),
				      check, multiline ? FBMrf_MULTILINE : 0);
		
		    /* Update the count-of-usability, remove useless subpatterns,
			unshift s.  */
		
		    DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "%s %s substr \"%s%.*s%s\"%s%s",
					  (s ? "Found" : "Did not find"),
					  (check == (do_utf8 ? prog->anchored_utf8 : prog->anchored_substr) ? "anchored" : "floating"),
					  PL_colors[0],
					  (int)(SvCUR(check) - (SvTAIL(check)!=0)),
					  SvPVX_const(check),
					  PL_colors[1], (SvTAIL(check) ? "$" : ""),
     3193413    			  (s ? " at offset " : "...\n") ) );
		
     3193413        if (!s)
     1255756    	goto fail_finish;
		
     1937657        check_at = s;
		
		    /* Finish the diagnostic message */
     1937657        DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "%ld...\n", (long)(s - i_strpos)) );
		
		    /* Got a candidate.  Check MBOL anchoring, and the *other* substr.
		       Start with the other substr.
		       XXXX no SCREAM optimization yet - and a very coarse implementation
		       XXXX /ttx+/ results in anchored="ttx", floating="x".  floating will
				*always* match.  Probably should be marked during compile...
		       Probably it is right to do no SCREAM here...
		     */
		
     1937657        if (do_utf8 ? (prog->float_utf8 && prog->anchored_utf8) : (prog->float_substr && prog->anchored_substr)) {
			/* Take into account the "other" substring. */
			/* XXXX May be hopelessly wrong for UTF... */
      435932    	if (!other_last)
      435406    	    other_last = strpos;
      435932    	if (check == (do_utf8 ? prog->float_utf8 : prog->float_substr)) {
			  do_other_anchored:
			    {
      190642    		char *last = HOP3c(s, -start_shift, strbeg), *last1, *last2;
      190642    		char *s1 = s;
      190642    		SV* must;
		
      190642    		t = s - prog->check_offset_max;
      190642    		if (s - strpos > prog->check_offset_max  /* signed-corrected t > strpos */
				    && (!do_utf8
					|| ((t = reghopmaybe3_c(s, -(prog->check_offset_max), strpos))
					    && t > strpos)))
				    /* EMPTY */;
				else
      190571    		    t = strpos;
      190642    		t = HOP3c(t, prog->anchored_offset, strend);
      190642    		if (t < other_last)	/* These positions already checked */
         452    		    t = other_last;
      190642    		last2 = last1 = HOP3c(strend, -prog->minlen, strbeg);
      190642    		if (last < last1)
      188328    		    last1 = last;
		 /* XXXX It is not documented what units *_offsets are in.  Assume bytes.  */
				/* On end-of-str: see comment below. */
      190642    		must = do_utf8 ? prog->anchored_utf8 : prog->anchored_substr;
      190642    		if (must == &PL_sv_undef) {
           1    		    s = (char*)NULL;
           1    		    DEBUG_EXECUTE_r(must = prog->anchored_utf8);	/* for debug */
				}
				else
      190641    		    s = fbm_instr(
					(unsigned char*)t,
					HOP3(HOP3(last1, prog->anchored_offset, strend)
						+ SvCUR(must), -(SvTAIL(must)!=0), strbeg),
					must,
					multiline ? FBMrf_MULTILINE : 0
				    );
				DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log,
					"%s anchored substr \"%s%.*s%s\"%s",
					(s ? "Found" : "Contradicts"),
					PL_colors[0],
					  (int)(SvCUR(must)
					  - (SvTAIL(must)!=0)),
					  SvPVX_const(must),
      190642    			  PL_colors[1], (SvTAIL(must) ? "$" : "")));
      190642    		if (!s) {
        1977    		    if (last1 >= last2) {
					DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log,
         130    						", giving up...\n"));
      ######    			goto fail_finish;
				    }
				    DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log,
					", trying floating at offset %ld...\n",
        1847    			(long)(HOP3c(s1, 1, strend) - i_strpos)));
        1847    		    other_last = HOP3c(last1, prog->anchored_offset+1, strend);
        1847    		    s = HOP3c(last, 1, strend);
        1847    		    goto restart;
				}
				else {
				    DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, " at offset %ld...\n",
      188665    			  (long)(s - i_strpos)));
      188665    		    t = HOP3c(s, -prog->anchored_offset, strbeg);
      188665    		    other_last = HOP3c(s, 1, strend);
      188665    		    s = s1;
      188665    		    if (t == strpos)
       14695    			goto try_at_start;
      245349    		    goto try_at_offset;
				}
			    }
			}
			else {		/* Take into account the floating substring. */
      245349    	    char *last, *last1;
      245349    	    char *s1 = s;
      245349    	    SV* must;
		
      245349    	    t = HOP3c(s, -start_shift, strbeg);
      245349    	    last1 = last =
				HOP3c(strend, -prog->minlen + prog->float_min_offset, strbeg);
      245349    	    if (CHR_DIST((U8*)last, (U8*)t) > prog->float_max_offset)
         189    		last = HOP3c(t, prog->float_max_offset, strend);
      245349    	    s = HOP3c(t, prog->float_min_offset, strend);
      245349    	    if (s < other_last)
          10    		s = other_last;
		 /* XXXX It is not documented what units *_offsets are in.  Assume bytes.  */
      245349    	    must = do_utf8 ? prog->float_utf8 : prog->float_substr;
			    /* fbm_instr() takes into account exact value of end-of-str
			       if the check is SvTAIL(ed).  Since false positives are OK,
			       and end-of-str is not later than strend we are OK. */
      245349    	    if (must == &PL_sv_undef) {
           1    		s = (char*)NULL;
           1    		DEBUG_EXECUTE_r(must = prog->float_utf8);	/* for debug message */
			    }
			    else
      245348    		s = fbm_instr((unsigned char*)s,
					      (unsigned char*)last + SvCUR(must)
						  - (SvTAIL(must)!=0),
					      must, multiline ? FBMrf_MULTILINE : 0);
			    DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "%s floating substr \"%s%.*s%s\"%s",
				    (s ? "Found" : "Contradicts"),
				    PL_colors[0],
				      (int)(SvCUR(must) - (SvTAIL(must)!=0)),
				      SvPVX_const(must),
      245349    		      PL_colors[1], (SvTAIL(must) ? "$" : "")));
      245349    	    if (!s) {
        1367    		if (last1 == last) {
				    DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log,
        1289    					    ", giving up...\n"));
      ######    		    goto fail_finish;
				}
				DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log,
				    ", trying anchored starting at offset %ld...\n",
          78    		    (long)(s1 + 1 - i_strpos)));
          78    		other_last = last;
          78    		s = HOP3c(t, 1, strend);
          78    		goto restart;
			    }
			    else {
				DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, " at offset %ld...\n",
      243982    		      (long)(s - i_strpos)));
      243982    		other_last = s; /* Fix this later. --Hugo */
      243982    		s = s1;
      243982    		if (t == strpos)
        5141    		    goto try_at_start;
     1501725    		goto try_at_offset;
			    }
			}
		    }
		
     1501725        t = s - prog->check_offset_max;
     1501725        if (s - strpos > prog->check_offset_max  /* signed-corrected t > strpos */
		        && (!do_utf8
			    || ((t = reghopmaybe3_c(s, -prog->check_offset_max, strpos))
				 && t > strpos))) {
			/* Fixed substring is found far enough so that the match
			   cannot start at strpos. */
		      try_at_offset:
      762180    	if (ml_anch && t[-1] != '\n') {
			    /* Eventually fbm_*() should handle this, but often
			       anchored_offset is not 0, so this check will not be wasted. */
			    /* XXXX In the code below we prefer to look for "^" even in
			       presence of anchored substrings.  And we search even
			       beyond the found float position.  These pessimizations
			       are historical artefacts only.  */
			  find_anchor:
      996765    	    while (t < strend - prog->minlen) {
      996601    		if (*t == '\n') {
       20039    		    if (t < check_at - prog->check_offset_min) {
       12972    			if (do_utf8 ? prog->anchored_utf8 : prog->anchored_substr) {
					    /* Since we moved from the found position,
					       we definitely contradict the found anchored
					       substr.  Due to the above check we do not
					       contradict "check" substr.
					       Thus we can arrive here only if check substr
					       is float.  Redo checking for "other"=="fixed".
					     */
           1    			    strpos = t + 1;			
					    DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "Found /%s^%s/m at offset %ld, rescanning for anchored from offset %ld...\n",
           1    				PL_colors[0], PL_colors[1], (long)(strpos - i_strpos), (long)(strpos - i_strpos + prog->anchored_offset)));
      ######    			    goto do_other_anchored;
					}
					/* We don't contradict the found floating substring. */
					/* XXXX Why not check for STCLASS? */
       12971    			s = t + 1;
					DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "Found /%s^%s/m at offset %ld...\n",
       12971    			    PL_colors[0], PL_colors[1], (long)(s - i_strpos)));
      ######    			goto set_useful;
				    }
				    /* Position contradicts check-string */
				    /* XXXX probably better to look for check-string
				       than for "\n", so one should lower the limit for t? */
				    DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "Found /%s^%s/m, restarting lookup for check-string at offset %ld...\n",
        7067    			PL_colors[0], PL_colors[1], (long)(t + 1 - i_strpos)));
        7067    		    other_last = strpos = s = t + 1;
        7067    		    goto restart;
				}
      976562    		t++;
			    }
			    DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "Did not find /%s^%s/m...\n",
         164    			PL_colors[0], PL_colors[1]));
      ######    	    goto fail_finish;
			}
			else {
			    DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "Starting position does not contradict /%s^%s/m...\n",
      744622    			PL_colors[0], PL_colors[1]));
			}
      744622    	s = t;
		      set_useful:
      757593    	++BmUSEFUL(do_utf8 ? prog->check_utf8 : prog->check_substr);	/* hooray/5 */
		    }
		    else {
			/* The found string does not prohibit matching at strpos,
			   - no optimization of calling REx engine can be performed,
			   unless it was an MBOL and we are not after MBOL,
			   or a future STCLASS check will fail this. */
		      try_at_start:
			/* Even in this situation we may use MBOL flag if strpos is offset
			   wrt the start of the string. */
     1183035    	if (ml_anch && sv && !SvROK(sv)	/* See prev comment on SvROK */
			    && (strpos != strbeg) && strpos[-1] != '\n'
			    /* May be due to an implicit anchor of m{.*foo}  */
			    && !(prog->reganch & ROPT_IMPLICIT))
			{
        2645    	    t = strpos;
        2645    	    goto find_anchor;
			}
			DEBUG_EXECUTE_r( if (ml_anch)
			    PerlIO_printf(Perl_debug_log, "Position at offset %ld does not contradict /%s^%s/m...\n",
					(long)(strpos - i_strpos), PL_colors[0], PL_colors[1]);
     1180390    	);
		      success_at_start:
     1382415    	if (!(prog->reganch & ROPT_NAUGHTY)	/* XXXX If strpos moved? */
			    && (do_utf8 ? (
				prog->check_utf8		/* Could be deleted already */
				&& --BmUSEFUL(prog->check_utf8) < 0
				&& (prog->check_utf8 == prog->float_utf8)
			    ) : (
				prog->check_substr		/* Could be deleted already */
				&& --BmUSEFUL(prog->check_substr) < 0
				&& (prog->check_substr == prog->float_substr)
			    )))
			{
			    /* If flags & SOMETHING - do not do it many times on the same match */
         600    	    DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "... Disabling check substring...\n"));
         600    	    SvREFCNT_dec(do_utf8 ? prog->check_utf8 : prog->check_substr);
         600    	    if (do_utf8 ? prog->check_substr : prog->check_utf8)
           5    		SvREFCNT_dec(do_utf8 ? prog->check_substr : prog->check_utf8);
         600    	    prog->check_substr = prog->check_utf8 = Nullsv;	/* disable */
         600    	    prog->float_substr = prog->float_utf8 = Nullsv;	/* clear */
         600    	    check = Nullsv;			/* abort */
         600    	    s = strpos;
			    /* XXXX This is a remnant of the old implementation.  It
			            looks wasteful, since now INTUIT can use many
			            other heuristics. */
         600    	    prog->reganch &= ~RE_USE_INTUIT;
			}
			else
     1381815    	    s = strpos;
		    }
		
		    /* Last resort... */
		    /* XXXX BmUSEFUL already changed, maybe multiple change is meaningful... */
     2140008        if (prog->regstclass) {
			/* minlen == 0 is possible if regstclass is \b or \B,
			   and the fixed substr is ''$.
			   Since minlen is already taken into account, s+1 is before strend;
			   accidentally, minlen >= 1 guaranties no false positives at s + 1
			   even for \b or \B.  But (minlen? 1 : 0) below assumes that
			   regstclass does not come from lookahead...  */
			/* If regstclass takes bytelength more than 1: If charlength==1, OK.
			   This leaves EXACTF only, which is dealt with in find_byclass().  */
      594787            const U8* str = (U8*)STRING(prog->regstclass);
      594787            const int cl_l = (PL_regkind[(U8)OP(prog->regstclass)] == EXACT
				    ? CHR_DIST(str+STR_LEN(prog->regstclass), str)
      594787    		    : 1);
      594787    	const char * const endpos = (prog->anchored_substr || prog->anchored_utf8 || ml_anch)
				? HOP3c(s, (prog->minlen ? cl_l : 0), strend)
				: (prog->float_substr || prog->float_utf8
				   ? HOP3c(HOP3c(check_at, -start_shift, strbeg),
					   cl_l, strend)
      594787    		   : strend);
		
      594787    	t = s;
      594787    	cache_re(prog);
      594787            s = find_byclass(prog, prog->regstclass, s, endpos, 1);
      594787    	if (!s) {
		#ifdef DEBUGGING
       33286    	    const char *what = 0;
		#endif
       33286    	    if (endpos == strend) {
				DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log,
        9478    				"Could not match STCLASS...\n") );
      ######    		goto fail;
			    }
			    DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log,
       23808    				   "This position contradicts STCLASS...\n") );
       23808    	    if ((prog->reganch & ROPT_ANCH) && !ml_anch)
        5269    		goto fail;
			    /* Contradict one of substrings */
       18539    	    if (prog->anchored_substr || prog->anchored_utf8) {
         862    		if ((do_utf8 ? prog->anchored_utf8 : prog->anchored_substr) == check) {
         797    		    DEBUG_EXECUTE_r( what = "anchored" );
				  hop_and_restart:
        7636    		    s = HOP3c(t, 1, strend);
        7636    		    if (s + start_shift + end_shift > strend) {
					/* XXXX Should be taken into account earlier? */
					DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log,
        1252    					       "Could not match STCLASS...\n") );
      ######    			goto fail;
				    }
        6384    		    if (!check)
      ######    			goto giveup;
				    DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log,
						"Looking for %s substr starting at offset %ld...\n",
        6384    				 what, (long)(s + start_shift - i_strpos)) );
      ######    		    goto restart;
				}
				/* Have both, check_string is floating */
          65    		if (t + start_shift >= check_at) /* Contradicts floating=check */
           7    		    goto retry_floating_check;
				/* Recheck anchored substring, but not floating... */
          58    		s = check_at;
          58    		if (!check)
      ######    		    goto giveup;
				DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log,
					  "Looking for anchored substr starting at offset %ld...\n",
          58    			  (long)(other_last - i_strpos)) );
      ######    		goto do_other_anchored;
			    }
			    /* Another way we could have checked stclass at the
		               current position only: */
       17677    	    if (ml_anch) {
       10845    		s = t = t + 1;
       10845    		if (!check)
           2    		    goto giveup;
				DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log,
					  "Looking for /%s^%s/m starting at offset %ld...\n",
       10843    			  PL_colors[0], PL_colors[1], (long)(t - i_strpos)) );
      ######    		goto try_at_offset;
			    }
        6832    	    if (!(do_utf8 ? prog->float_utf8 : prog->float_substr))	/* Could have been deleted */
      ######    		goto fail;
			    /* Check is floating subtring. */
			  retry_floating_check:
        6839    	    t = check_at - start_shift;
        6839    	    DEBUG_EXECUTE_r( what = "floating" );
      ######    	    goto hop_and_restart;
			}
      561501    	if (t != s) {
		            DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log,
					"By STCLASS: moving %ld --> %ld\n",
		                                  (long)(t - i_strpos), (long)(s - i_strpos))
      151445                       );
		        }
		        else {
		            DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log,
		                                  "Does not contradict STCLASS...\n"); 
      410056                       );
		        }
		    }
		  giveup:
		    DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "%s%s:%s match at offset %ld\n",
					  PL_colors[4], (check ? "Guessed" : "Giving up"),
     2106724    			  PL_colors[5], (long)(s - i_strpos)) );
     2106724        return s;
		
		  fail_finish:				/* Substring not found */
     2338994        if (prog->check_substr || prog->check_utf8)		/* could be removed already */
     2338994    	BmUSEFUL(do_utf8 ? prog->check_utf8 : prog->check_substr) += 5; /* hooray */
		  fail:
		    DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "%sMatch rejected by optimizer%s\n",
     2448650    			  PL_colors[4], PL_colors[5]));
     2448650        return Nullch;
		}
		
		/* We know what class REx starts with.  Try to find this position... */
		STATIC char *
		S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, const char *strend, I32 norun)
     5597636    {
			dVAR;
     5597636    	const I32 doevery = (prog->reganch & ROPT_SKIP) == 0;
     5597636    	char *m;
     5597636    	STRLEN ln;
     5597636    	STRLEN lnc;
     5597636    	register STRLEN uskip;
     5597636    	unsigned int c1;
     5597636    	unsigned int c2;
     5597636    	char *e;
     5597636    	register I32 tmp = 1;	/* Scratch variable? */
     5597636    	register const bool do_utf8 = PL_reg_match_utf8;
		
			/* We know what class it must start with. */
     5597636    	switch (OP(c)) {
			case ANYOF:
     3342502    	    if (do_utf8) {
     1188325    		 while (s + (uskip = UTF8SKIP(s)) <= strend) {
     1188136    		      if ((ANYOF_FLAGS(c) & ANYOF_UNICODE) ||
					  !UTF8_IS_INVARIANT((U8)s[0]) ?
					  reginclass(c, (U8*)s, 0, do_utf8) :
					  REGINCLASS(c, (U8*)s)) {
        4142    			   if (tmp && (norun || regtry(prog, s)))
           4    				goto got_it;
					   else
           4    				tmp = doevery;
				      }
				      else 
     1183994    			   tmp = 1;
     1183998    		      s += uskip;
				 }
			    }
			    else {
     9410736    		 while (s < strend) {
     7602014    		      STRLEN skip = 1;
		
     7602014    		      if (REGINCLASS(c, (U8*)s) ||
					  (ANYOF_FOLD_SHARP_S(c, s, strend) &&
					   /* The assignment of 2 is intentional:
					    * for the folded sharp s, the skip is 2. */
					   (skip = SHARP_S_SKIP))) {
     1971618    			   if (tmp && (norun || regtry(prog, s)))
      442165    				goto got_it;
					   else
      442165    				tmp = doevery;
				      }
				      else 
     5630396    			   tmp = 1;
     6072561    		      s += skip;
				 }
			    }
          35    	    break;
			case CANY:
          35    	    while (s < strend) {
          35    	        if (tmp && (norun || regtry(prog, s)))
      ######    		    goto got_it;
				else
      ######    		    tmp = doevery;
      ######    		s++;
			    }
       25271    	    break;
			case EXACTF:
       25271    	    m   = STRING(c);
       25271    	    ln  = STR_LEN(c);	/* length to match in octets/bytes */
       25271    	    lnc = (I32) ln;	/* length to match in characters */
       25271    	    if (UTF) {
        5925    	        STRLEN ulen1, ulen2;
        5925    		U8 *sm = (U8 *) m;
        5925    		U8 tmpbuf1[UTF8_MAXBYTES_CASE+1];
        5925    		U8 tmpbuf2[UTF8_MAXBYTES_CASE+1];
		
        5925    		to_utf8_lower((U8*)m, tmpbuf1, &ulen1);
        5925    		to_utf8_upper((U8*)m, tmpbuf2, &ulen2);
		
        5925    		c1 = utf8n_to_uvchr(tmpbuf1, UTF8_MAXBYTES_CASE, 
						    0, ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY);
        5925    		c2 = utf8n_to_uvchr(tmpbuf2, UTF8_MAXBYTES_CASE,
						    0, ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY);
        5925    		lnc = 0;
       18113    		while (sm < ((U8 *) m + ln)) {
       12188    		    lnc++;
       12188    		    sm += UTF8SKIP(sm);
				}
			    }
			    else {
       19346    		c1 = *(U8*)m;
       19346    		c2 = PL_fold[c1];
			    }
       19346    	    goto do_exactf;
			case EXACTFL:
     1696824    	    m   = STRING(c);
     1696824    	    ln  = STR_LEN(c);
     1696824    	    lnc = (I32) ln;
     1696824    	    c1 = *(U8*)m;
     1696824    	    c2 = PL_fold_locale[c1];
			  do_exactf:
     1722095    	    e = HOP3c(strend, -((I32)lnc), s);
		
     1722095    	    if (norun && e < s)
      ######    		e = s;			/* Due to minlen logic of intuit() */
		
			    /* The idea in the EXACTF* cases is to first find the
			     * first character of the EXACTF* node and then, if
			     * necessary, case-insensitively compare the full
			     * text of the node.  The c1 and c2 are the first
			     * characters (though in Unicode it gets a bit
			     * more complicated because there are more cases
			     * than just upper and lower: one needs to use
			     * the so-called folding case for case-insensitive
			     * matching (called "loose matching" in Unicode).
			     * ibcmp_utf8() will do just that. */
		
     1722095    	    if (do_utf8) {
        5931    	        UV c, f;
        5931    	        U8 tmpbuf [UTF8_MAXBYTES+1];
        5931    		STRLEN len, foldlen;
				
        5931    		if (c1 == c2) {
				    /* Upper and lower of 1st char are equal -
				     * probably not a "letter". */
        5894    		    while (s <= e) {
        5893    		        c = utf8n_to_uvchr((U8*)s, UTF8_MAXBYTES, &len,
							   ckWARN(WARN_UTF8) ?
							   0 : UTF8_ALLOW_ANY);
        5893    			if ( c == c1
					     && (ln == len ||
						 ibcmp_utf8(s, (char **)0, 0,  do_utf8,
							    m, (char **)0, ln, (bool)UTF))
					     && (norun || regtry(prog, s)) )
           1    			    goto got_it;
					else {
           1    			     U8 foldbuf[UTF8_MAXBYTES_CASE+1];
           1    			     uvchr_to_utf8(tmpbuf, c);
           1    			     f = to_utf8_fold(tmpbuf, foldbuf, &foldlen);
           1    			     if ( f != c
						  && (f == c1 || f == c2)
						  && (ln == foldlen ||
						      !ibcmp_utf8((char *) foldbuf,
								  (char **)0, foldlen, do_utf8,
								  m,
								  (char **)0, ln, (bool)UTF))
						  && (norun || regtry(prog, s)) )
           1    				  goto got_it;
					}
           1    			s += len;
				    }
				}
				else {
          47    		    while (s <= e) {
          46    		      c = utf8n_to_uvchr((U8*)s, UTF8_MAXBYTES, &len,
							   ckWARN(WARN_UTF8) ?
							   0 : UTF8_ALLOW_ANY);
		
					/* Handle some of the three Greek sigmas cases.
					 * Note that not all the possible combinations
					 * are handled here: some of them are handled
					 * by the standard folding rules, and some of
					 * them (the character class or ANYOF cases)
					 * are handled during compiletime in
					 * regexec.c:S_regclass(). */
          46    			if (c == (UV)UNICODE_GREEK_CAPITAL_LETTER_SIGMA ||
					    c == (UV)UNICODE_GREEK_SMALL_LETTER_FINAL_SIGMA)
           6    			    c = (UV)UNICODE_GREEK_SMALL_LETTER_SIGMA;
		
          46    			if ( (c == c1 || c == c2)
					     && (ln == len ||
						 ibcmp_utf8(s, (char **)0, 0,  do_utf8,
							    m, (char **)0, ln, (bool)UTF))
					     && (norun || regtry(prog, s)) )
          12    			    goto got_it;
					else {
          12    			     U8 foldbuf[UTF8_MAXBYTES_CASE+1];
          12    			     uvchr_to_utf8(tmpbuf, c);
          12    			     f = to_utf8_fold(tmpbuf, foldbuf, &foldlen);
          12    			     if ( f != c
						  && (f == c1 || f == c2)
						  && (ln == foldlen ||
						      !ibcmp_utf8((char *) foldbuf,
								  (char **)0, foldlen, do_utf8,
								  m,
								  (char **)0, ln, (bool)UTF))
						  && (norun || regtry(prog, s)) )
           9    				  goto got_it;
					}
           9    			s += len;
				    }
				}
			    }
			    else {
     1716164    		if (c1 == c2)
       54779    		    while (s <= e) {
       53393    			if ( *(U8*)s == c1
					     && (ln == 1 || !(OP(c) == EXACTF
							      ? ibcmp(s, m, ln)
							      : ibcmp_locale(s, m, ln)))
					     && (norun || regtry(prog, s)) )
       52919    			    goto got_it;
       52919    			s++;
				    }
				else
     1769337    		    while (s <= e) {
     1753178    			if ( (*(U8*)s == c1 || *(U8*)s == c2)
					     && (ln == 1 || !(OP(c) == EXACTF
							      ? ibcmp(s, m, ln)
							      : ibcmp_locale(s, m, ln)))
					     && (norun || regtry(prog, s)) )
       55033    			    goto got_it;
       55033    			s++;
				    }
			    }
           8    	    break;
			case BOUNDL:
           8    	    PL_reg_flags |= RF_tainted;
			    /* FALL THROUGH */
			case BOUND:
       21426    	    if (do_utf8) {
          11    		if (s == PL_bostr)
          10    		    tmp = '\n';
				else {
           1    		    U8 *r = reghop3((U8*)s, -1, (U8*)PL_bostr);
				
           1    		    tmp = utf8n_to_uvchr(r, UTF8SKIP(r), 0, 0);
				}
          11    		tmp = ((OP(c) == BOUND ?
					isALNUM_uni(tmp) : isALNUM_LC_uvchr(UNI_TO_NATIVE(tmp))) != 0);
          11    		LOAD_UTF8_CHARCLASS_ALNUM();
          22    		while (s + (uskip = UTF8SKIP(s)) <= strend) {
          13    		    if (tmp == !(OP(c) == BOUND ?
						 swash_fetch(PL_utf8_alnum, (U8*)s, do_utf8) :
						 isALNUM_LC_utf8((U8*)s)))
				    {
          11    			tmp = !tmp;
          11    			if ((norun || regtry(prog, s)))
          11    			    goto got_it;
				    }
          11    		    s += uskip;
				}
			    }
			    else {
       21415    		tmp = (s != PL_bostr) ? UCHARAT(s - 1) : '\n';
       21415    		tmp = ((OP(c) == BOUND ? isALNUM(tmp) : isALNUM_LC(tmp)) != 0);
      127818    		while (s < strend) {
      115967    		    if (tmp ==
					!(OP(c) == BOUND ? isALNUM(*s) : isALNUM_LC(*s))) {
       38613    			tmp = !tmp;
       38613    			if ((norun || regtry(prog, s)))
      106403    			    goto got_it;
				    }
      106403    		    s++;
				}
			    }
       11860    	    if ((!prog->minlen && tmp) && (norun || regtry(prog, s)))
      ######    		goto got_it;
      ######    	    break;
			case NBOUNDL:
      ######    	    PL_reg_flags |= RF_tainted;
			    /* FALL THROUGH */
			case NBOUND:
         111    	    if (do_utf8) {
      ######    		if (s == PL_bostr)
      ######    		    tmp = '\n';
				else {
      ######    		    U8 *r = reghop3((U8*)s, -1, (U8*)PL_bostr);
				
      ######    		    tmp = utf8n_to_uvchr(r, UTF8SKIP(r), 0, 0);
				}
      ######    		tmp = ((OP(c) == NBOUND ?
					isALNUM_uni(tmp) : isALNUM_LC_uvchr(UNI_TO_NATIVE(tmp))) != 0);
      ######    		LOAD_UTF8_CHARCLASS_ALNUM();
      ######    		while (s + (uskip = UTF8SKIP(s)) <= strend) {
      ######    		    if (tmp == !(OP(c) == NBOUND ?
						 swash_fetch(PL_utf8_alnum, (U8*)s, do_utf8) :
						 isALNUM_LC_utf8((U8*)s)))
      ######    			tmp = !tmp;
      ######    		    else if ((norun || regtry(prog, s)))
      ######    			goto got_it;
      ######    		    s += uskip;
				}
			    }
			    else {
         111    		tmp = (s != PL_bostr) ? UCHARAT(s - 1) : '\n';
         111    		tmp = ((OP(c) == NBOUND ?
					isALNUM(tmp) : isALNUM_LC(tmp)) != 0);
         147    		while (s < strend) {
         117    		    if (tmp ==
					!(OP(c) == NBOUND ? isALNUM(*s) : isALNUM_LC(*s)))
          36    			tmp = !tmp;
          81    		    else if ((norun || regtry(prog, s)))
          36    			goto got_it;
          36    		    s++;
				}
			    }
          30    	    if ((!prog->minlen && !tmp) && (norun || regtry(prog, s)))
        1214    		goto got_it;
        1214    	    break;
			case ALNUM:
        1214    	    if (do_utf8) {
         139    		LOAD_UTF8_CHARCLASS_ALNUM();
         239    		while (s + (uskip = UTF8SKIP(s)) <= strend) {
         143    		    if (swash_fetch(PL_utf8_alnum, (U8*)s, do_utf8)) {
          43    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
         100    			tmp = 1;
         100    		    s += uskip;
				}
			    }
			    else {
        1821    		while (s < strend) {
        1351    		    if (isALNUM(*s)) {
         663    			if (tmp && (norun || regtry(prog, s)))
          58    			    goto got_it;
					else
          58    			    tmp = doevery;
				    }
				    else
         688    			tmp = 1;
         746    		    s++;
				}
			    }
      176394    	    break;
			case ALNUML:
      176394    	    PL_reg_flags |= RF_tainted;
      176394    	    if (do_utf8) {
      ######    		while (s + (uskip = UTF8SKIP(s)) <= strend) {
      ######    		    if (isALNUM_LC_utf8((U8*)s)) {
      ######    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
      ######    			tmp = 1;
      ######    		    s += uskip;
				}
			    }
			    else {
      275188    		while (s < strend) {
      176396    		    if (isALNUM_LC(*s)) {
       77602    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
       98794    			tmp = 1;
       98794    		    s++;
				}
			    }
      124421    	    break;
			case NALNUM:
      124421    	    if (do_utf8) {
           2    		LOAD_UTF8_CHARCLASS_ALNUM();
          15    		while (s + (uskip = UTF8SKIP(s)) <= strend) {
          13    		    if (!swash_fetch(PL_utf8_alnum, (U8*)s, do_utf8)) {
      ######    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
          13    			tmp = 1;
          13    		    s += uskip;
				}
			    }
			    else {
      930036    		while (s < strend) {
      820609    		    if (!isALNUM(*s)) {
       14992    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
      805617    			tmp = 1;
      805617    		    s++;
				}
			    }
       47451    	    break;
			case NALNUML:
       47451    	    PL_reg_flags |= RF_tainted;
       47451    	    if (do_utf8) {
      ######    		while (s + (uskip = UTF8SKIP(s)) <= strend) {
      ######    		    if (!isALNUM_LC_utf8((U8*)s)) {
      ######    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
      ######    			tmp = 1;
      ######    		    s += uskip;
				}
			    }
			    else {
       72399    		while (s < strend) {
       47912    		    if (!isALNUM_LC(*s)) {
       22964    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
       24948    			tmp = 1;
       24948    		    s++;
				}
			    }
      142455    	    break;
			case SPACE:
      142455    	    if (do_utf8) {
           1    		LOAD_UTF8_CHARCLASS_SPACE();
           1    		while (s + (uskip = UTF8SKIP(s)) <= strend) {
           1    		    if (*s == ' ' || swash_fetch(PL_utf8_space,(U8*)s, do_utf8)) {
           1    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
      ######    			tmp = 1;
      ######    		    s += uskip;
				}
			    }
			    else {
     2223340    		while (s < strend) {
     2162061    		    if (isSPACE(*s)) {
      205662    			if (tmp && (norun || regtry(prog, s)))
      124487    			    goto got_it;
					else
      124487    			    tmp = doevery;
				    }
				    else
     1956399    			tmp = 1;
     2080886    		    s++;
				}
			    }
         573    	    break;
			case SPACEL:
         573    	    PL_reg_flags |= RF_tainted;
         573    	    if (do_utf8) {
      ######    		while (s + (uskip = UTF8SKIP(s)) <= strend) {
      ######    		    if (*s == ' ' || isSPACE_LC_utf8((U8*)s)) {
      ######    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
      ######    			tmp = 1;
      ######    		    s += uskip;
				}
			    }
			    else {
        9216    		while (s < strend) {
        8983    		    if (isSPACE_LC(*s)) {
        1617    			if (tmp && (norun || regtry(prog, s)))
        1277    			    goto got_it;
					else
        1277    			    tmp = doevery;
				    }
				    else
        7366    			tmp = 1;
        8643    		    s++;
				}
			    }
       14785    	    break;
			case NSPACE:
       14785    	    if (do_utf8) {
           2    		LOAD_UTF8_CHARCLASS_SPACE();
           2    		while (s + (uskip = UTF8SKIP(s)) <= strend) {
           2    		    if (!(*s == ' ' || swash_fetch(PL_utf8_space,(U8*)s, do_utf8))) {
           2    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
      ######    			tmp = 1;
      ######    		    s += uskip;
				}
			    }
			    else {
       28135    		while (s < strend) {
       27406    		    if (!isSPACE(*s)) {
       14054    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
       13352    			tmp = 1;
       13352    		    s++;
				}
			    }
           1    	    break;
			case NSPACEL:
           1    	    PL_reg_flags |= RF_tainted;
           1    	    if (do_utf8) {
      ######    		while (s + (uskip = UTF8SKIP(s)) <= strend) {
      ######    		    if (!(*s == ' ' || isSPACE_LC_utf8((U8*)s))) {
      ######    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
      ######    			tmp = 1;
      ######    		    s += uskip;
				}
			    }
			    else {
           1    		while (s < strend) {
           1    		    if (!isSPACE_LC(*s)) {
           1    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
      ######    			tmp = 1;
      ######    		    s++;
				}
			    }
        2891    	    break;
			case DIGIT:
        2891    	    if (do_utf8) {
           1    		LOAD_UTF8_CHARCLASS_DIGIT();
           1    		while (s + (uskip = UTF8SKIP(s)) <= strend) {
           1    		    if (swash_fetch(PL_utf8_digit,(U8*)s, do_utf8)) {
           1    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
      ######    			tmp = 1;
      ######    		    s += uskip;
				}
			    }
			    else {
        8462    		while (s < strend) {
        7652    		    if (isDIGIT(*s)) {
        2096    			if (tmp && (norun || regtry(prog, s)))
          16    			    goto got_it;
					else
          16    			    tmp = doevery;
				    }
				    else
        5556    			tmp = 1;
        5572    		    s++;
				}
			    }
      ######    	    break;
			case DIGITL:
      ######    	    PL_reg_flags |= RF_tainted;
      ######    	    if (do_utf8) {
      ######    		while (s + (uskip = UTF8SKIP(s)) <= strend) {
      ######    		    if (isDIGIT_LC_utf8((U8*)s)) {
      ######    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
      ######    			tmp = 1;
      ######    		    s += uskip;
				}
			    }
			    else {
      ######    		while (s < strend) {
      ######    		    if (isDIGIT_LC(*s)) {
      ######    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
      ######    			tmp = 1;
      ######    		    s++;
				}
			    }
        1282    	    break;
			case NDIGIT:
        1282    	    if (do_utf8) {
      ######    		LOAD_UTF8_CHARCLASS_DIGIT();
      ######    		while (s + (uskip = UTF8SKIP(s)) <= strend) {
      ######    		    if (!swash_fetch(PL_utf8_digit,(U8*)s, do_utf8)) {
      ######    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
      ######    			tmp = 1;
      ######    		    s += uskip;
				}
			    }
			    else {
        3465    		while (s < strend) {
        2709    		    if (!isDIGIT(*s)) {
         526    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
        2183    			tmp = 1;
        2183    		    s++;
				}
			    }
      ######    	    break;
			case NDIGITL:
      ######    	    PL_reg_flags |= RF_tainted;
      ######    	    if (do_utf8) {
      ######    		while (s + (uskip = UTF8SKIP(s)) <= strend) {
      ######    		    if (!isDIGIT_LC_utf8((U8*)s)) {
      ######    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
      ######    			tmp = 1;
      ######    		    s += uskip;
				}
			    }
			    else {
      ######    		while (s < strend) {
      ######    		    if (!isDIGIT_LC(*s)) {
      ######    			if (tmp && (norun || regtry(prog, s)))
      ######    			    goto got_it;
					else
      ######    			    tmp = doevery;
				    }
				    else
      ######    			tmp = 1;
      ######    		    s++;
				}
			    }
      ######    	    break;
			default:
      ######    	    Perl_croak(aTHX_ "panic: unknown regstclass %d", (int)OP(c));
     2135429    	    break;
			}
     2135429    	return 0;
		      got_it:
     3462207    	return s;
		}
		
		/*
		 - regexec_flags - match a regexp against a string
		 */
		I32
		Perl_regexec_flags(pTHX_ register regexp *prog, char *stringarg, register char *strend,
			      char *strbeg, I32 minend, SV *sv, void *data, U32 flags)
		/* strend: pointer to null at end of string */
		/* strbeg: real beginning of string */
		/* minend: end of match must be >=minend after stringarg. */
		/* data: May be used for some additional optimizations. */
		/* nosave: For optimizations. */
    11094673    {
    11094673        register char *s;
    11094673        register regnode *c;
    11094673        register char *startpos = stringarg;
    11094673        I32 minlen;		/* must match at least this many chars */
    11094673        I32 dontbother = 0;	/* how many characters not to try at end */
    11094673        I32 end_shift = 0;			/* Same for the end. */		/* CC */
    11094673        I32 scream_pos = -1;		/* Internal iterator of scream. */
    11094673        char *scream_olds;
    11094673        SV* oreplsv = GvSV(PL_replgv);
    11094673        const bool do_utf8 = DO_UTF8(sv);
    11094673        const I32 multiline = prog->reganch & PMf_MULTILINE;
		#ifdef DEBUGGING
    11094673        SV *dsv0 = PERL_DEBUG_PAD_ZERO(0);
    11094673        SV *dsv1 = PERL_DEBUG_PAD_ZERO(1);
		#endif
		
    11094673        GET_RE_DEBUG_FLAGS_DECL;
		
    11094673        PERL_UNUSED_ARG(data);
    11094673        RX_MATCH_UTF8_set(prog,do_utf8);
		
    11094673        PL_regcc = 0;
		
    11094673        cache_re(prog);
		#ifdef DEBUGGING
    11094673        PL_regnarrate = DEBUG_r_TEST;
		#endif
		
		    /* Be paranoid... */
    11094673        if (prog == NULL || startpos == NULL) {
      ######    	Perl_croak(aTHX_ "NULL regexp parameter");
    11094673    	return 0;
		    }
		
    11094673        minlen = prog->minlen;
    11094673        if (strend - startpos < minlen) {
		        DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log,
      139799    			      "String too short [regexec_flags]...\n"));
      ######    	goto phooey;
		    }
		
		    /* Check validity of program. */
    10954874        if (UCHARAT(prog->program) != REG_MAGIC) {
      ######    	Perl_croak(aTHX_ "corrupted regexp program");
		    }
		
    10954874        PL_reg_flags = 0;
    10954874        PL_reg_eval_set = 0;
    10954874        PL_reg_maxiter = 0;
		
    10954874        if (prog->reganch & ROPT_UTF8)
        7724    	PL_reg_flags |= RF_utf8;
		
		    /* Mark beginning of line for ^ and lookbehind. */
    10954874        PL_regbol = startpos;
    10954874        PL_bostr  = strbeg;
    10954874        PL_reg_sv = sv;
		
		    /* Mark end of line for $ (and such) */
    10954874        PL_regeol = strend;
		
		    /* see how far we have to get to not match where we matched before */
    10954874        PL_regtill = startpos+minend;
		
		    /* We start without call_cc context.  */
    10954874        PL_reg_call_cc = 0;
		
		    /* If there is a "must appear" string, look for it. */
    10954874        s = startpos;
		
    10954874        if (prog->reganch & ROPT_GPOS_SEEN) { /* Need to have PL_reg_ganch */
      974702    	MAGIC *mg;
		
      974702    	if (flags & REXEC_IGNOREPOS)	/* Means: check only at start */
      440733    	    PL_reg_ganch = startpos;
      533969    	else if (sv && SvTYPE(sv) >= SVt_PVMG
				  && SvMAGIC(sv)
				  && (mg = mg_find(sv, PERL_MAGIC_regex_global))
				  && mg->mg_len >= 0) {
          47    	    PL_reg_ganch = strbeg + mg->mg_len;	/* Defined pos() */
          47    	    if (prog->reganch & ROPT_ANCH_GPOS) {
          22    	        if (s > PL_reg_ganch)
      ######    		    goto phooey;
          22    		s = PL_reg_ganch;
			    }
			}
			else				/* pos() not defined */
      533922    	    PL_reg_ganch = strbeg;
		    }
		
    10954874        if (!(flags & REXEC_CHECKED) && (prog->check_substr != Nullsv || prog->check_utf8 != Nullsv)) {
      696064    	re_scream_pos_data d;
		
      696064    	d.scream_olds = &scream_olds;
      696064    	d.scream_pos = &scream_pos;
      696064    	s = re_intuit_start(prog, sv, s, strend, flags, &d);
      696064    	if (!s) {
      135194    	    DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "Not present...\n"));
      ######    	    goto phooey;	/* not present */
			}
		    }
		
		    DEBUG_EXECUTE_r({
			const char * const s0   = UTF
			    ? pv_uni_display(dsv0, (U8*)prog->precomp, prog->prelen, 60,
					  UNI_DISPLAY_REGEX)
			    : prog->precomp;
			const int len0 = UTF ? SvCUR(dsv0) : prog->prelen;
			const char * const s1 = do_utf8 ? sv_uni_display(dsv1, sv, 60,
							       UNI_DISPLAY_REGEX) : startpos;
			const int len1 = do_utf8 ? SvCUR(dsv1) : strend - startpos;
			 if (!PL_colorset)
			     reginitcolors();
			 PerlIO_printf(Perl_debug_log,
				       "%sMatching REx%s \"%s%*.*s%s%s\" against \"%s%.*s%s%s\"\n",
				       PL_colors[4], PL_colors[5], PL_colors[0],
				       len0, len0, s0,
				       PL_colors[1],
				       len0 > 60 ? "..." : "",
				       PL_colors[0],
				       (int)(len1 > 60 ? 60 : len1),
				       s1, PL_colors[1],
				       (len1 > 60 ? "..." : "")
			      );
    10819680        });
		
		    /* Simplest case:  anchored match need be tried only once. */
		    /*  [unless only anchor is BOL and multiline is set] */
    10819680        if (prog->reganch & (ROPT_ANCH & ~ROPT_ANCH_GPOS)) {
     3521359    	if (s == startpos && regtry(prog, startpos))
     1879531    	    goto got_it;
     1641828    	else if (multiline || (prog->reganch & ROPT_IMPLICIT)
				 || (prog->reganch & ROPT_ANCH_MBOL)) /* XXXX SBOL? */
			{
      447852    	    char *end;
		
      447852    	    if (minlen)
      442132    		dontbother = minlen - 1;
      447852    	    end = HOP3c(strend, -dontbother, strbeg) - 1;
			    /* for multiline we only have to try after newlines */
      447852    	    if (prog->check_substr || prog->check_utf8) {
       16950    		if (s == startpos)
        2094    		    goto after_try;
       19520    		while (1) {
       19520    		    if (regtry(prog, s))
       14919    			goto got_it;
				  after_try:
        6695    		    if (s >= end)
      ######    			goto phooey;
        6695    		    if (prog->reganch & RE_USE_INTUIT) {
        6695    			s = re_intuit_start(prog, sv, s + 1, strend, flags, NULL);
        6695    			if (!s)
        2031    			    goto phooey;
				    }
				    else
      ######    			s++;
				}		
			    } else {
      430902    		if (s > startpos)
      ######    		    s--;
     1567958    		while (s < end) {
     1514301    		    if (*s++ == '\n') {	/* don't need PL_utf8skip here */
      381362    			if (regtry(prog, s))
      377245    			    goto got_it;
				    }
				}		
			    }
			}
     7298321    	goto phooey;
     7298321        } else if (prog->reganch & ROPT_ANCH_GPOS) {
      974521    	if (regtry(prog, PL_reg_ganch))
      895459    	    goto got_it;
     6323800    	goto phooey;
		    }
		
		    /* Messy cases:  unanchored match. */
     6323800        if ((prog->anchored_substr || prog->anchored_utf8) && prog->reganch & ROPT_SKIP) {
			/* we have /x+whatever/ */
			/* it must be a one character string (XXXX Except UTF?) */
       57159    	char ch;
		#ifdef DEBUGGING
       57159    	int did_match = 0;
		#endif
       57159    	if (!(do_utf8 ? prog->anchored_utf8 : prog->anchored_substr))
           2    	    do_utf8 ? to_utf8_substr(prog) : to_byte_substr(prog);
       57159    	ch = SvPVX_const(do_utf8 ? prog->anchored_utf8 : prog->anchored_substr)[0];
		
       57159    	if (do_utf8) {
           2    	    while (s < strend) {
           2    		if (*s == ch) {
           2    		    DEBUG_EXECUTE_r( did_match = 1 );
           2    		    if (regtry(prog, s)) goto got_it;
      ######    		    s += UTF8SKIP(s);
      ######    		    while (s < strend && *s == ch)
      ######    			s += UTF8SKIP(s);
				}
      ######    		s += UTF8SKIP(s);
			    }
			}
			else {
      208614    	    while (s < strend) {
      208059    		if (*s == ch) {
       60518    		    DEBUG_EXECUTE_r( did_match = 1 );
       60518    		    if (regtry(prog, s)) goto got_it;
        3916    		    s++;
        6128    		    while (s < strend && *s == ch)
        2212    			s++;
				}
      151457    		s++;
			    }
			}
			DEBUG_EXECUTE_r(if (!did_match)
				PerlIO_printf(Perl_debug_log,
		                                  "Did not find anchored character...\n")
         555                   );
		    }
     6266641        else if (prog->anchored_substr != Nullsv
			      || prog->anchored_utf8 != Nullsv
			      || ((prog->float_substr != Nullsv || prog->float_utf8 != Nullsv)
				  && prog->float_max_offset < strend - s)) {
      765282    	SV *must;
      765282    	I32 back_max;
      765282    	I32 back_min;
      765282    	char *last;
      765282    	char *last1;		/* Last position checked before */
		#ifdef DEBUGGING
      765282    	int did_match = 0;
		#endif
      765282    	if (prog->anchored_substr || prog->anchored_utf8) {
      763003    	    if (!(do_utf8 ? prog->anchored_utf8 : prog->anchored_substr))
          63    		do_utf8 ? to_utf8_substr(prog) : to_byte_substr(prog);
      763003    	    must = do_utf8 ? prog->anchored_utf8 : prog->anchored_substr;
      763003    	    back_max = back_min = prog->anchored_offset;
			} else {
        2279    	    if (!(do_utf8 ? prog->float_utf8 : prog->float_substr))
      ######    		do_utf8 ? to_utf8_substr(prog) : to_byte_substr(prog);
        2279    	    must = do_utf8 ? prog->float_utf8 : prog->float_substr;
        2279    	    back_max = prog->float_max_offset;
        2279    	    back_min = prog->float_min_offset;
			}
      765282    	if (must == &PL_sv_undef)
			    /* could not downgrade utf8 check substring, so must fail */
           4    	    goto phooey;
		
      765278    	last = HOP3c(strend,	/* Cannot start after this */
					  -(I32)(CHR_SVLEN(must)
						 - (SvTAIL(must) != 0) + back_min), strbeg);
		
      765278    	if (s > PL_bostr)
      681912    	    last1 = HOPc(s, -1);
			else
       83366    	    last1 = s - 1;	/* bogus */
		
			/* XXXX check_substr already used to find "s", can optimize if
			   check_substr==must. */
      765278    	scream_pos = -1;
      765278    	dontbother = end_shift;
      765278    	strend = HOPc(strend, -dontbother);
     1140301    	while ( (s <= last) &&
				((flags & REXEC_SCREAM)
				 ? (s = screaminstr(sv, must, HOP3c(s, back_min, strend) - strbeg,
						    end_shift, &scream_pos, 0))
				 : (s = fbm_instr((unsigned char*)HOP3(s, back_min, strend),
						  (unsigned char*)strend, must,
						  multiline ? FBMrf_MULTILINE : 0))) ) {
			    /* we may be pointing at the wrong string */
     1066268    	    if ((flags & REXEC_SCREAM) && RX_MATCH_COPIED(prog))
           3    		s = strbeg + (s - SvPVX_const(sv));
     1066268    	    DEBUG_EXECUTE_r( did_match = 1 );
     1066268    	    if (HOPc(s, -back_max) > last1) {
     1064471    		last1 = HOPc(s, -back_min);
     1064471    		s = HOPc(s, -back_max);
			    }
			    else {
        1797    		char *t = (last1 >= PL_bostr) ? HOPc(last1, 1) : last1 + 1;
		
        1797    		last1 = HOPc(s, -back_min);
        1797    		s = t;		
			    }
     1066268    	    if (do_utf8) {
        1412    		while (s <= last1) {
        1391    		    if (regtry(prog, s))
        1370    			goto got_it;
          21    		    s += UTF8SKIP(s);
				}
			    }
			    else {
     1440266    		while (s <= last1) {
     1065264    		    if (regtry(prog, s))
      689875    			goto got_it;
      375389    		    s++;
				}
			    }
			}
			DEBUG_EXECUTE_r(if (!did_match)
		                    PerlIO_printf(Perl_debug_log, 
		                                  "Did not find %s substr \"%s%.*s%s\"%s...\n",
					      ((must == prog->anchored_substr || must == prog->anchored_utf8)
					       ? "anchored" : "floating"),
					      PL_colors[0],
					      (int)(SvCUR(must) - (SvTAIL(must)!=0)),
					      SvPVX_const(must),
		                                  PL_colors[1], (SvTAIL(must) ? "$" : ""))
       74033                   );
      ######    	goto phooey;
		    }
     5501359        else if ((c = prog->regstclass)) {
     5002849    	if (minlen) {
     5002847    	    I32 op = (U8)OP(prog->regstclass);
			    /* don't bother with what can't match */
     5002847    	    if (PL_regkind[op] != EXACT && op != CANY)
     3286196    	        strend = HOPc(strend, -(minlen - 1));
			}
			DEBUG_EXECUTE_r({
			    SV *prop = sv_newmortal();
			    const char *s0;
			    const char *s1;
			    int len0;
			    int len1;
		
			    regprop(prop, c);
			    s0 = UTF ?
			      pv_uni_display(dsv0, (U8*)SvPVX_const(prop), SvCUR(prop), 60,
					     UNI_DISPLAY_REGEX) :
			      SvPVX_const(prop);
			    len0 = UTF ? SvCUR(dsv0) : SvCUR(prop);
			    s1 = UTF ?
			      sv_uni_display(dsv1, sv, 60, UNI_DISPLAY_REGEX) : s;
			    len1 = UTF ? SvCUR(dsv1) : strend - s;
			    PerlIO_printf(Perl_debug_log,
					  "Matching stclass \"%*.*s\" against \"%*.*s\"\n",
					  len0, len0, s0,
					  len1, len1, s1);
     5002849    	});
     5002849            if (find_byclass(prog, c, s, strend, 0))
     2900706    	    goto got_it;
     2102143    	DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "Contradicts stclass...\n"));
		    }
		    else {
      498510    	dontbother = 0;
      498510    	if (prog->float_substr != Nullsv || prog->float_utf8 != Nullsv) {
			    /* Trim the end. */
       76982    	    char *last;
       76982    	    SV* float_real;
		
       76982    	    if (!(do_utf8 ? prog->float_utf8 : prog->float_substr))
      ######    		do_utf8 ? to_utf8_substr(prog) : to_byte_substr(prog);
       76982    	    float_real = do_utf8 ? prog->float_utf8 : prog->float_substr;
		
       76982    	    if (flags & REXEC_SCREAM) {
      ######    		last = screaminstr(sv, float_real, s - strbeg,
						   end_shift, &scream_pos, 1); /* last one */
      ######    		if (!last)
      ######    		    last = scream_olds; /* Only one occurrence. */
				/* we may be pointing at the wrong string */
      ######    		else if (RX_MATCH_COPIED(prog))
      ######    		    s = strbeg + (s - SvPVX_const(sv));
			    }
			    else {
       76982    		STRLEN len;
       76982                    const char * const little = SvPV_const(float_real, len);
		
       76982    		if (SvTAIL(float_real)) {
       12644    		    if (memEQ(strend - len + 1, little, len - 1))
       12644    			last = strend - len + 1;
      ######    		    else if (!multiline)
      ######    			last = memEQ(strend - len, little, len)
					    ? strend - len : Nullch;
				    else
       64338    			goto find_last;
				} else {
				  find_last:
       64338    		    if (len)
       64338    			last = rninstr(s, strend, little, little + len);
				    else
      ######    			last = strend;	/* matching "$" */
				}
			    }
       76982    	    if (last == NULL) {
				DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log,
						      "%sCan't trim the tail, match fails (should not happen)%s\n",
      ######    				      PL_colors[4], PL_colors[5]));
      ######    		goto phooey; /* Should not happen! */
			    }
       76982    	    dontbother = strend - last + prog->float_min_offset;
			}
      498510    	if (minlen && (dontbother < minlen))
      251067    	    dontbother = minlen - 1;
      498510    	strend -= dontbother; 		   /* this one's always in bytes! */
			/* We don't know much -- general case. */
      498510    	if (do_utf8) {
       34533    	    for (;;) {
       32419    		if (regtry(prog, s))
       30294    		    goto got_it;
        2125    		if (s >= strend)
          11    		    break;
        2114    		s += UTF8SKIP(s);
			    };
			}
			else {
     4180984    	    do {
     4180984    		if (regtry(prog, s))
      357468    		    goto got_it;
     3823515    	    } while (s++ < strend);
			}
		    }
		
		    /* Failure. */
     7203471        goto phooey;
		
		got_it:
     7203471        RX_MATCH_TAINTED_set(prog, PL_reg_flags & RF_tainted);
		
     7203471        if (PL_reg_eval_set) {
			/* Preserve the current value of $^R */
        3206    	if (oreplsv != GvSV(PL_replgv))
         306    	    sv_setsv(oreplsv, GvSV(PL_replgv));/* So that when GvSV(replgv) is
								  restored, the value remains
								  the same. */
        3206    	restore_pos(aTHX_ 0);
		    }
		
		    /* make sure $`, $&, $', and $digit will work later */
     7203471        if ( !(flags & REXEC_NOT_FIRST) ) {
     6811398    	RX_MATCH_COPY_FREE(prog);
     6811398    	if (flags & REXEC_COPY_STR) {
     3398779    	    I32 i = PL_regeol - startpos + (stringarg - strbeg);
		#ifdef PERL_OLD_COPY_ON_WRITE
			    if ((SvIsCOW(sv)
				 || (SvFLAGS(sv) & CAN_COW_MASK) == CAN_COW_FLAGS)) {
				if (DEBUG_C_TEST) {
				    PerlIO_printf(Perl_debug_log,
						  "Copy on write: regexp capture, type %d\n",
						  (int) SvTYPE(sv));
				}
				prog->saved_copy = sv_setsv_cow(prog->saved_copy, sv);
				prog->subbeg = (char *)SvPVX_const(prog->saved_copy);
				assert (SvPOKp(prog->saved_copy));
			    } else
		#endif
			    {
     3398779    		RX_MATCH_COPIED_on(prog);
     3398779    		s = savepvn(strbeg, i);
     3398779    		prog->subbeg = s;
			    }
     3398779    	    prog->sublen = i;
			}
			else {
     3412619    	    prog->subbeg = strbeg;
     3412619    	    prog->sublen = PL_regeol - strbeg;	/* strend may have been modified */
			}
		    }
		
     7203471        return 1;
		
		phooey:
		    DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "%sMatch failed%s\n",
     3891201    			  PL_colors[4], PL_colors[5]));
     3891201        if (PL_reg_eval_set)
         609    	restore_pos(aTHX_ 0);
     3891201        return 0;
		}
		
		/*
		 - regtry - try match at specific point
		 */
		STATIC I32			/* 0 failure, 1 success */
		S_regtry(pTHX_ regexp *prog, char *startpos)
    13711296    {
    13711296        register I32 i;
    13711296        register I32 *sp;
    13711296        register I32 *ep;
    13711296        CHECKPOINT lastcp;
    13711296        GET_RE_DEBUG_FLAGS_DECL;
		
		#ifdef DEBUGGING
    13711296        PL_regindent = 0;	/* XXXX Not good when matches are reenterable... */
		#endif
    13711296        if ((prog->reganch & ROPT_EVAL_SEEN) && !PL_reg_eval_set) {
        3820    	MAGIC *mg;
		
        3820    	PL_reg_eval_set = RS_init;
			DEBUG_EXECUTE_r(DEBUG_s(
			    PerlIO_printf(Perl_debug_log, "  setting stack tmpbase at %"IVdf"\n",
					  (IV)(PL_stack_sp - PL_stack_base));
        3820    	    ));
        3820    	SAVEI32(cxstack[cxstack_ix].blk_oldsp);
        3820    	cxstack[cxstack_ix].blk_oldsp = PL_stack_sp - PL_stack_base;
			/* Otherwise OP_NEXTSTATE will free whatever on stack now.  */
        3820    	SAVETMPS;
			/* Apparently this is not needed, judging by wantarray. */
			/* SAVEI8(cxstack[cxstack_ix].blk_gimme);
			   cxstack[cxstack_ix].blk_gimme = G_SCALAR; */
		
        3820    	if (PL_reg_sv) {
			    /* Make $_ available to executed code. */
        3820    	    if (PL_reg_sv != DEFSV) {
        3103    		SAVE_DEFSV;
        3103    		DEFSV = PL_reg_sv;
			    }
			
        3820    	    if (!(SvTYPE(PL_reg_sv) >= SVt_PVMG && SvMAGIC(PL_reg_sv)
				  && (mg = mg_find(PL_reg_sv, PERL_MAGIC_regex_global)))) {
				/* prepare for quick setting of pos */
        2403    		sv_magic(PL_reg_sv, (SV*)0,
					PERL_MAGIC_regex_global, Nullch, 0);
        2403    		mg = mg_find(PL_reg_sv, PERL_MAGIC_regex_global);
        2403    		mg->mg_len = -1;
			    }
        3820    	    PL_reg_magic    = mg;
        3820    	    PL_reg_oldpos   = mg->mg_len;
        3820    	    SAVEDESTRUCTOR_X(restore_pos, 0);
		        }
        3820            if (!PL_reg_curpm) {
          86    	    Newz(22, PL_reg_curpm, 1, PMOP);
		#ifdef USE_ITHREADS
		            {
		                SV* repointer = newSViv(0);
		                /* so we know which PL_regex_padav element is PL_reg_curpm */
		                SvFLAGS(repointer) |= SVf_BREAK;
		                av_push(PL_regex_padav,repointer);
		                PL_reg_curpm->op_pmoffset = av_len(PL_regex_padav);
		                PL_regex_pad = AvARRAY(PL_regex_padav);
		            }
		#endif      
		        }
        3820    	PM_SETRE(PL_reg_curpm, prog);
        3820    	PL_reg_oldcurpm = PL_curpm;
        3820    	PL_curpm = PL_reg_curpm;
        3820    	if (RX_MATCH_COPIED(prog)) {
			    /*  Here is a serious problem: we cannot rewrite subbeg,
				since it may be needed if this match fails.  Thus
				$` inside (?{}) could fail... */
        2460    	    PL_reg_oldsaved = prog->subbeg;
        2460    	    PL_reg_oldsavedlen = prog->sublen;
		#ifdef PERL_OLD_COPY_ON_WRITE
			    PL_nrs = prog->saved_copy;
		#endif
        2460    	    RX_MATCH_COPIED_off(prog);
			}
			else
        1360    	    PL_reg_oldsaved = Nullch;
        3820    	prog->subbeg = PL_bostr;
        3820    	prog->sublen = PL_regeol - PL_bostr; /* strend may have been modified */
		    }
    13711296        prog->startp[0] = startpos - PL_bostr;
    13711296        PL_reginput = startpos;
    13711296        PL_regstartp = prog->startp;
    13711296        PL_regendp = prog->endp;
    13711296        PL_reglastparen = &prog->lastparen;
    13711296        PL_reglastcloseparen = &prog->lastcloseparen;
    13711296        prog->lastparen = 0;
    13711296        prog->lastcloseparen = 0;
    13711296        PL_regsize = 0;
    13711296        DEBUG_EXECUTE_r(PL_reg_starttry = startpos);
    13711296        if (PL_reg_start_tmpl <= prog->nparens) {
       52353    	PL_reg_start_tmpl = prog->nparens*3/2 + 3;
       52353            if(PL_reg_start_tmp)
        8495                Renew(PL_reg_start_tmp, PL_reg_start_tmpl, char*);
		        else
       43858                New(22, PL_reg_start_tmp, PL_reg_start_tmpl, char*);
		    }
		
		    /* XXXX What this code is doing here?!!!  There should be no need
		       to do this again and again, PL_reglastparen should take care of
		       this!  --ilya*/
		
		    /* Tests pat.t#187 and split.t#{13,14} seem to depend on this code.
		     * Actually, the code in regcppop() (which Ilya may be meaning by
		     * PL_reglastparen), is not needed at all by the test suite
		     * (op/regexp, op/pat, op/split), but that code is needed, oddly
		     * enough, for building DynaLoader, or otherwise this
		     * "Error: '*' not in typemap in DynaLoader.xs, line 164"
		     * will happen.  Meanwhile, this code *is* needed for the
		     * above-mentioned test suite tests to succeed.  The common theme
		     * on those tests seems to be returning null fields from matches.
		     * --jhi */
		#if 1
    13711296        sp = prog->startp;
    13711296        ep = prog->endp;
    13711296        if (prog->nparens) {
    13824751    	for (i = prog->nparens; i > (I32)*PL_reglastparen; i--) {
     8775065    	    *++sp = -1;
     8775065    	    *++ep = -1;
			}
		    }
		#endif
    13711296        REGCP_SET(lastcp);
    13711296        if (regmatch(prog->program + 1)) {
     7203471    	prog->endp[0] = PL_reginput - PL_bostr;
     7203471    	return 1;
		    }
     6507824        REGCP_UNWIND(lastcp);
     6507824        return 0;
		}
		
		#define RE_UNWIND_BRANCH	1
		#define RE_UNWIND_BRANCHJ	2
		
		union re_unwind_t;
		
		typedef struct {		/* XX: makes sense to enlarge it... */
		    I32 type;
		    I32 prev;
		    CHECKPOINT lastcp;
		} re_unwind_generic_t;
		
		typedef struct {
		    I32 type;
		    I32 prev;
		    CHECKPOINT lastcp;
		    I32 lastparen;
		    regnode *next;
		    char *locinput;
		    I32 nextchr;
		#ifdef DEBUGGING
		    int regindent;
		#endif
		} re_unwind_branch_t;
		
		typedef union re_unwind_t {
		    I32 type;
		    re_unwind_generic_t generic;
		    re_unwind_branch_t branch;
		} re_unwind_t;
		
		#define sayYES goto yes
		#define sayNO goto no
		#define sayNO_ANYOF goto no_anyof
		#define sayYES_FINAL goto yes_final
		#define sayYES_LOUD  goto yes_loud
		#define sayNO_FINAL  goto no_final
		#define sayNO_SILENT goto do_no
		#define saySAME(x) if (x) goto yes; else goto no
		
		#define POSCACHE_SUCCESS 0	/* caching success rather than failure */
		#define POSCACHE_SEEN 1		/* we know what we're caching */
		#define POSCACHE_START 2	/* the real cache: this bit maps to pos 0 */
		#define CACHEsayYES STMT_START { \
		    if (cache_offset | cache_bit) { \
			if (!(PL_reg_poscache[0] & (1<<POSCACHE_SEEN))) \
			    PL_reg_poscache[0] |= (1<<POSCACHE_SUCCESS) || (1<<POSCACHE_SEEN); \
		        else if (!(PL_reg_poscache[0] & (1<<POSCACHE_SUCCESS))) { \
			    /* cache records failure, but this is success */ \
			    DEBUG_r( \
				PerlIO_printf(Perl_debug_log, \
				    "%*s  (remove success from failure cache)\n", \
				    REPORT_CODE_OFF+PL_regindent*2, "") \
			    ); \
			    PL_reg_poscache[cache_offset] &= ~(1<<cache_bit); \
			} \
		    } \
		    sayYES; \
		} STMT_END
		#define CACHEsayNO STMT_START { \
		    if (cache_offset | cache_bit) { \
			if (!(PL_reg_poscache[0] & (1<<POSCACHE_SEEN))) \
			    PL_reg_poscache[0] |= (1<<POSCACHE_SEEN); \
		        else if ((PL_reg_poscache[0] & (1<<POSCACHE_SUCCESS))) { \
			    /* cache records success, but this is failure */ \
			    DEBUG_r( \
				PerlIO_printf(Perl_debug_log, \
				    "%*s  (remove failure from success cache)\n", \
				    REPORT_CODE_OFF+PL_regindent*2, "") \
			    ); \
			    PL_reg_poscache[cache_offset] &= ~(1<<cache_bit); \
			} \
		    } \
		    sayNO; \
		} STMT_END
		
		/* this is used to determine how far from the left messages like
		   'failed...' are printed. Currently 29 makes these messages line
		   up with the opcode they refer to. Earlier perls used 25 which
		   left these messages outdented making reviewing a debug output
		   quite difficult.
		*/
		#define REPORT_CODE_OFF 29
		
		
		/* Make sure there is a test for this +1 options in re_tests */
		#define TRIE_INITAL_ACCEPT_BUFFLEN 4;
		
		#define TRIE_CHECK_STATE_IS_ACCEPTING STMT_START {                       \
		    if ( trie->states[ state ].wordnum ) {                               \
			if ( !accepted ) {                                               \
			    ENTER;                                                       \
			    SAVETMPS;                                                    \
			    bufflen = TRIE_INITAL_ACCEPT_BUFFLEN ;                       \
			    sv_accept_buff=NEWSV( 1234,                                  \
			      bufflen * sizeof(reg_trie_accepted) - 1 );                 \
			    SvCUR_set( sv_accept_buff, sizeof(reg_trie_accepted) );      \
			    SvPOK_on( sv_accept_buff );                                  \
			    sv_2mortal( sv_accept_buff );                                \
			    accept_buff = (reg_trie_accepted*)SvPV_nolen( sv_accept_buff );\
			} else {                                                         \
			    if ( accepted >= bufflen ) {                                 \
			        bufflen *= 2;                                            \
			        accept_buff =(reg_trie_accepted*)SvGROW( sv_accept_buff, \
			            bufflen * sizeof(reg_trie_accepted) );               \
			    }                                                            \
			    SvCUR_set( sv_accept_buff,SvCUR( sv_accept_buff )            \
			        + sizeof( reg_trie_accepted ) );                         \
			}                                                                \
			accept_buff[ accepted ].wordnum = trie->states[ state ].wordnum; \
			accept_buff[ accepted ].endpos = uc;                             \
			++accepted;                                                      \
		    } } STMT_END
		
		#define TRIE_HANDLE_CHAR STMT_START {                                   \
		        if ( uvc < 256 ) {                                              \
		            charid = trie->charmap[ uvc ];                              \
		        } else {                                                        \
		            charid = 0;                                                 \
		            if( trie->widecharmap ) {                                   \
		            SV** svpp = (SV**)NULL;                                     \
		            svpp = hv_fetch( trie->widecharmap, (char*)&uvc,            \
		        		  sizeof( UV ), 0 );                            \
		            if ( svpp ) {                                               \
		        	charid = (U16)SvIV( *svpp );                            \
		                }                                                       \
		            }                                                           \
		        }                                                               \
		        if ( charid &&                                                  \
		             ( base + charid > trie->uniquecharcount ) &&               \
		             ( base + charid - 1 - trie->uniquecharcount < trie->lasttrans) && \
		             trie->trans[ base + charid - 1 - trie->uniquecharcount ].check == state ) \
		        {                                                               \
		            state = trie->trans[ base + charid - 1 - trie->uniquecharcount ].next;     \
		        } else {                                                        \
		            state = 0;                                                  \
		        }                                                               \
		        uc += len;                                                      \
		    } STMT_END
		
		/*
		 - regmatch - main matching routine
		 *
		 * Conceptually the strategy is simple:  check to see whether the current
		 * node matches, call self recursively to see whether the rest matches,
		 * and then act accordingly.  In practice we make some effort to avoid
		 * recursion, in particular by going through "ordinary" nodes (that don't
		 * need to know whether the rest of the match failed) by a loop instead of
		 * by recursion.
		 */
		/* [lwall] I've hoisted the register declarations to the outer block in order to
		 * maybe save a little bit of pushing and popping on the stack.  It also takes
		 * advantage of machines that use a register save mask on subroutine entry.
		 */
		STATIC I32			/* 0 failure, 1 success */
		S_regmatch(pTHX_ regnode *prog)
    28953002    {
		    dVAR;
    28953002        register regnode *scan;	/* Current node. */
    28953002        regnode *next;		/* Next node. */
    28953002        regnode *inner;		/* Next node in internal branch. */
    28953002        register I32 nextchr;	/* renamed nextchr - nextchar colides with
						   function of same name */
    28953002        register I32 n;		/* no or next */
    28953002        register I32 ln = 0;	/* len or last */
    28953002        register char *s = Nullch;	/* operand or save */
    28953002        register char *locinput = PL_reginput;
    28953002        register I32 c1 = 0, c2 = 0, paren;	/* case fold search, parenth */
    28953002        int minmod = 0, sw = 0, logical = 0;
    28953002        I32 unwind = 0;
		
		    /* used by the trie code */
    28953002        SV                 *sv_accept_buff = 0;  /* accepting states we have traversed */
    28953002        reg_trie_accepted  *accept_buff = 0;     /* "" */
    28953002        reg_trie_data      *trie;                /* what trie are we using right now */
    28953002        U32 accepted = 0;                        /* how many accepting states we have seen*/
		
		#if 0
		    I32 firstcp = PL_savestack_ix;
		#endif
    28953002        const register bool do_utf8 = PL_reg_match_utf8;
		#ifdef DEBUGGING
    28953002        SV *dsv0 = PERL_DEBUG_PAD_ZERO(0);
    28953002        SV *dsv1 = PERL_DEBUG_PAD_ZERO(1);
    28953002        SV *dsv2 = PERL_DEBUG_PAD_ZERO(2);
		
    28953002        SV *re_debug_flags = NULL;
		#endif
		
    28953002        GET_RE_DEBUG_FLAGS;
		
		#ifdef DEBUGGING
    28953002        PL_regindent++;
		#endif
		
		
		    /* Note that nextchr is a byte even in UTF */
    28953002        nextchr = UCHARAT(locinput);
    28953002        scan = prog;
    63107958        while (scan != NULL) {
		
		        DEBUG_EXECUTE_r( {
			    SV *prop = sv_newmortal();
			    const int docolor = *PL_colors[0];
			    const int taill = (docolor ? 10 : 7); /* 3 chars for "> <" */
			    int l = (PL_regeol - locinput) > taill ? taill : (PL_regeol - locinput);
			    /* The part of the string before starttry has one color
			       (pref0_len chars), between starttry and current
			       position another one (pref_len - pref0_len chars),
			       after the current position the third one.
			       We assume that pref0_len <= pref_len, otherwise we
			       decrease pref0_len.  */
			    int pref_len = (locinput - PL_bostr) > (5 + taill) - l
				? (5 + taill) - l : locinput - PL_bostr;
			    int pref0_len;
		
			    while (do_utf8 && UTF8_IS_CONTINUATION(*(U8*)(locinput - pref_len)))
				pref_len++;
			    pref0_len = pref_len  - (locinput - PL_reg_starttry);
			    if (l + pref_len < (5 + taill) && l < PL_regeol - locinput)
				l = ( PL_regeol - locinput > (5 + taill) - pref_len
				      ? (5 + taill) - pref_len : PL_regeol - locinput);
			    while (do_utf8 && UTF8_IS_CONTINUATION(*(U8*)(locinput + l)))
				l--;
			    if (pref0_len < 0)
				pref0_len = 0;
			    if (pref0_len > pref_len)
				pref0_len = pref_len;
			    regprop(prop, scan);
			    {
			      const char * const s0 =
				do_utf8 && OP(scan) != CANY ?
				pv_uni_display(dsv0, (U8*)(locinput - pref_len),
					       pref0_len, 60, UNI_DISPLAY_REGEX) :
				locinput - pref_len;
			      const int len0 = do_utf8 ? strlen(s0) : pref0_len;
			      const char * const s1 = do_utf8 && OP(scan) != CANY ?
				pv_uni_display(dsv1, (U8*)(locinput - pref_len + pref0_len),
					       pref_len - pref0_len, 60, UNI_DISPLAY_REGEX) :
				locinput - pref_len + pref0_len;
			      const int len1 = do_utf8 ? strlen(s1) : pref_len - pref0_len;
			      const char * const s2 = do_utf8 && OP(scan) != CANY ?
				pv_uni_display(dsv2, (U8*)locinput,
					       PL_regeol - locinput, 60, UNI_DISPLAY_REGEX) :
				locinput;
			      const int len2 = do_utf8 ? strlen(s2) : l;
			      PerlIO_printf(Perl_debug_log,
					    "%4"IVdf" <%s%.*s%s%s%.*s%s%s%s%.*s%s>%*s|%3"IVdf":%*s%s\n",
					    (IV)(locinput - PL_bostr),
					    PL_colors[4],
					    len0, s0,
					    PL_colors[5],
					    PL_colors[2],
					    len1, s1,
					    PL_colors[3],
					    (docolor ? "" : "> <"),
					    PL_colors[0],
					    len2, s2,
					    PL_colors[1],
					    15 - l - pref_len + 1,
					    "",
					    (IV)(scan - PL_regprogram), PL_regindent*2, "",
					    SvPVX_const(prop));
			    }
    63107958    	});
		
    63107958    	next = scan + NEXT_OFF(scan);
    63107958    	if (next == scan)
    10473303    	    next = NULL;
		
    63107958    	switch (OP(scan)) {
			case BOL:
     4164077    	    if (locinput == PL_bostr)
			    {
				/* regtill = regbol; */
     3026145    		break;
			    }
      929551    	    sayNO;
			case MBOL:
      929551    	    if (locinput == PL_bostr ||
				((nextchr || locinput < PL_regeol) && locinput[-1] == '\n'))
			    {
       43150    		break;
			    }
       43150    	    sayNO;
			case SBOL:
       43150    	    if (locinput == PL_bostr)
       37509    		break;
      978427    	    sayNO;
			case GPOS:
      978427    	    if (locinput == PL_reg_ganch)
      974706    		break;
         911    	    sayNO;
			case EOL:
         911    		goto seol;
			case MEOL:
         911    	    if ((nextchr || locinput < PL_regeol) && nextchr != '\n')
          79    		sayNO;
     1345196    	    break;
			case SEOL:
			  seol:
     1345196    	    if ((nextchr || locinput < PL_regeol) && nextchr != '\n')
      730887    		sayNO;
      614309    	    if (PL_regeol - locinput > 1)
         610    		sayNO;
      129257    	    break;
			case EOS:
      129257    	    if (PL_regeol != locinput)
       89583    		sayNO;
       26157    	    break;
			case SANY:
       26157    	    if (!nextchr && locinput >= PL_regeol)
      ######    		sayNO;
       26157     	    if (do_utf8) {
          25    	        locinput += PL_utf8skip[nextchr];
          25    		if (locinput > PL_regeol)
      ######     		    sayNO;
          25     		nextchr = UCHARAT(locinput);
		 	    }
		 	    else
       26132     		nextchr = UCHARAT(++locinput);
       26132    	    break;
			case CANY:
          67    	    if (!nextchr && locinput >= PL_regeol)
      ######    		sayNO;
          67    	    nextchr = UCHARAT(++locinput);
          67    	    break;
			case REG_ANY:
       92793    	    if ((!nextchr && locinput >= PL_regeol) || nextchr == '\n')
       92640    		sayNO;
       92640    	    if (do_utf8) {
       30015    		locinput += PL_utf8skip[nextchr];
       30015    		if (locinput > PL_regeol)
      ######    		    sayNO;
       30015    		nextchr = UCHARAT(locinput);
			    }
			    else
       62625    		nextchr = UCHARAT(++locinput);
       62625    	    break;
		
		
		
			/*
			   traverse the TRIE keeping track of all accepting states
			   we transition through until we get to a failing node.
		
			   we use two slightly different pieces of code to handle
			   the traversal depending on whether its case sensitive or
			   not. we reuse the accept code however. (this should probably
			   be turned into a macro.)
		
			*/
			case TRIEF:
			case TRIEFL:
			    {
		
       11982    		const U32 uniflags = ckWARN( WARN_UTF8 ) ? 0 : UTF8_ALLOW_ANY;
       11982    		U8 *uc = ( U8* )locinput;
       11982    		U32 state = 1;
       11982    		U16 charid = 0;
       11982    		U32 base = 0;
       11982    		UV uvc = 0;
       11982    		STRLEN len = 0;
       11982    		STRLEN foldlen = 0;
       11982    		U8 *uscan = (U8*)NULL;
       11982    		STRLEN bufflen=0;
       11982    		accepted = 0;
		
       11982    		trie = (reg_trie_data*)PL_regdata->data[ ARG( scan ) ];
		
       29707    		while ( state && uc <= (U8*)PL_regeol ) {
		
       17725    		    TRIE_CHECK_STATE_IS_ACCEPTING;
		
       17725    		    base = trie->states[ state ].trans.base;
		
				    DEBUG_TRIE_EXECUTE_r(
					        PerlIO_printf( Perl_debug_log,
					            "%*s  %sState: %4"UVxf", Base: %4"UVxf", Accepted: %4"UVxf" ",
					            REPORT_CODE_OFF + PL_regindent * 2, "", PL_colors[4],
					            (UV)state, (UV)base, (UV)accepted );
       17725    		    );
		
       17725    		    if ( base ) {
		
       16653    			if ( do_utf8 || UTF ) {
         128    			    if ( foldlen>0 ) {
           5    				uvc = utf8n_to_uvuni( uscan, UTF8_MAXLEN, &len, uniflags );
           5    				foldlen -= len;
           5    				uscan += len;
           5    				len=0;
					    } else {
         123    				U8 foldbuf[ UTF8_MAXBYTES_CASE + 1 ];
         123    				uvc = utf8n_to_uvuni( (U8*)uc, UTF8_MAXLEN, &len, uniflags );
         123    				uvc = to_uni_fold( uvc, foldbuf, &foldlen );
         123    				foldlen -= UNISKIP( uvc );
         123    				uscan = foldbuf + UNISKIP( uvc );
					    }
					} else {
       16525    			    uvc = (UV)*uc;
       16525    			    len = 1;
					}
		
       16653    			TRIE_HANDLE_CHAR;
		
				    } else {
        1072    			state = 0;
				    }
				    DEBUG_TRIE_EXECUTE_r(
				        PerlIO_printf( Perl_debug_log,
				            "Charid:%3x CV:%4"UVxf" After State: %4"UVxf"%s\n",
				            charid, uvc, (UV)state, PL_colors[5] );
       17725    		    );
				}
       11982    		if ( !accepted ) {
       10575    		   sayNO;
				} else {
      315460    		    goto TrieAccept;
				}
			    }
			    /* unreached codepoint: we jump into the middle of the next case
			       from previous if blocks */
			case TRIE:
			    {
      315460    		const U32 uniflags = ckWARN( WARN_UTF8 ) ? 0 : UTF8_ALLOW_ANY;
      315460    		U8 *uc = (U8*)locinput;
      315460    		U32 state = 1;
      315460    		U16 charid = 0;
      315460    		U32 base = 0;
      315460    		UV uvc = 0;
      315460    		STRLEN len = 0;
      315460    		STRLEN bufflen = 0;
      315460    		accepted = 0;
		
      315460    		trie = (reg_trie_data*)PL_regdata->data[ ARG( scan ) ];
		
      737722    		while ( state && uc <= (U8*)PL_regeol ) {
		
      422262    		    TRIE_CHECK_STATE_IS_ACCEPTING;
		
      422262    		    base = trie->states[ state ].trans.base;
		
				    DEBUG_TRIE_EXECUTE_r(
					    PerlIO_printf( Perl_debug_log,
					        "%*s  %sState: %4"UVxf", Base: %4"UVxf", Accepted: %4"UVxf" ",
					        REPORT_CODE_OFF + PL_regindent * 2, "", PL_colors[4],
					        (UV)state, (UV)base, (UV)accepted );
      422262    		    );
		
      422262    		    if ( base ) {
		
      401723    			if ( do_utf8 || UTF ) {
        1873    			    uvc = utf8n_to_uvuni( (U8*)uc, UTF8_MAXLEN, &len, uniflags );
					} else {
      399850    			    uvc = (U32)*uc;
      399850    			    len = 1;
					}
		
      401723                            TRIE_HANDLE_CHAR;
		
				    } else {
       20539    			state = 0;
				    }
				    DEBUG_TRIE_EXECUTE_r(
					    PerlIO_printf( Perl_debug_log,
					        "Charid:%3x CV:%4"UVxf" After State: %4"UVxf"%s\n",
					        charid, uvc, (UV)state, PL_colors[5] );
      422262    		    );
				}
      315460    		if ( !accepted ) {
      290835    		   sayNO;
				}
			    }
		
		
			    /*
			       There was at least one accepting state that we
			       transitioned through. Presumably the number of accepting
			       states is going to be low, typically one or two. So we
			       simply scan through to find the one with lowest wordnum.
			       Once we find it, we swap the last state into its place
			       and decrement the size. We then try to match the rest of
			       the pattern at the point where the word ends, if we
			       succeed then we end the loop, otherwise the loop
			       eventually terminates once all of the accepting states
			       have been tried.
			    */
			TrieAccept:
			    {
       26032    		int gotit = 0;
		
       26032    		if ( accepted == 1 ) {
				    DEBUG_EXECUTE_r({
		                        SV **tmp = av_fetch( trie->words, accept_buff[ 0 ].wordnum-1, 0 );
		       	                PerlIO_printf( Perl_debug_log,
					    "%*s  %sonly one match : #%d <%s>%s\n",
					    REPORT_CODE_OFF+PL_regindent*2, "", PL_colors[4],
		        		    accept_buff[ 0 ].wordnum,
		        		    tmp ? SvPV_nolen_const( *tmp ) : "not compiled under -Dr",
		        		    PL_colors[5] );
       24524    		    });
       24524    		    PL_reginput = (char *)accept_buff[ 0 ].endpos;
				    /* in this case we free tmps/leave before we call regmatch
				       as we wont be using accept_buff again. */
       24524    		    FREETMPS;
       24524    		    LEAVE;
       24524    		    gotit = regmatch( scan + NEXT_OFF( scan ) );
				} else {
		                    DEBUG_EXECUTE_r(
		                        PerlIO_printf( Perl_debug_log,"%*s  %sgot %"IVdf" possible matches%s\n",
		                            REPORT_CODE_OFF + PL_regindent * 2, "", PL_colors[4], (IV)accepted,
		                            PL_colors[5] );
        1508                        );
        5128    		    while ( !gotit && accepted-- ) {
        3620    			U32 best = 0;
        3620    			U32 cur;
        9506    			for( cur = 1 ; cur <= accepted ; cur++ ) {
					    DEBUG_TRIE_EXECUTE_r(
					        PerlIO_printf( Perl_debug_log,
					            "%*s  %sgot %"IVdf" (%d) as best, looking at %"IVdf" (%d)%s\n",
					            REPORT_CODE_OFF + PL_regindent * 2, "", PL_colors[4],
					            (IV)best, accept_buff[ best ].wordnum, (IV)cur,
					            accept_buff[ cur ].wordnum, PL_colors[5] );
        5886    			    );
		
        5886    			    if ( accept_buff[ cur ].wordnum < accept_buff[ best ].wordnum )
        2424    				    best = cur;
					}
					DEBUG_EXECUTE_r({
				            SV **tmp = av_fetch( trie->words, accept_buff[ best ].wordnum - 1, 0 );
		    			    PerlIO_printf( Perl_debug_log, "%*s  %strying alternation #%d <%s> at 0x%p%s\n",
		    			        REPORT_CODE_OFF+PL_regindent*2, "", PL_colors[4],
		    			        accept_buff[best].wordnum,
		        		        tmp ? SvPV_nolen_const( *tmp ) : "not compiled under -Dr",scan,
		        		        PL_colors[5] );
        3620    			});
        3620    			if ( best<accepted ) {
        1592    			    reg_trie_accepted tmp = accept_buff[ best ];
        1592    			    accept_buff[ best ] = accept_buff[ accepted ];
        1592    			    accept_buff[ accepted ] = tmp;
        1592    			    best = accepted;
					}
        3620    			PL_reginput = (char *)accept_buff[ best ].endpos;
		
		                        /* 
		                           as far as I can tell we only need the SAVETMPS/FREETMPS 
		                           for re's with EVAL in them but I'm leaving them in for 
		                           all until I can be sure.
		                         */
        3620    			SAVETMPS;
        3620    			gotit = regmatch( scan + NEXT_OFF( scan ) ) ;
        3620    			FREETMPS;
				    }
        1508    		    FREETMPS;
        1508    		    LEAVE;
				}
				
       26032    		if ( gotit ) {
       24925    		    sayYES;
				} else {
     6811226    		    sayNO;
				}
			    }
			    /* unreached codepoint */
			case EXACT:
     6811226    	    s = STRING(scan);
     6811226    	    ln = STR_LEN(scan);
     6811226    	    if (do_utf8 != UTF) {
				/* The target and the pattern have differing utf8ness. */
        5781    		char *l = locinput;
        5781    		const char *e = s + ln;
		
        5781    		if (do_utf8) {
				    /* The target is utf8, the pattern is not utf8. */
       12364    		    while (s < e) {
        9278    			STRLEN ulen;
        9278    			if (l >= PL_regeol)
           8    			     sayNO;
        9270    			if (NATIVE_TO_UNI(*(U8*)s) !=
					    utf8n_to_uvuni((U8*)l, UTF8_MAXBYTES, &ulen,
							   ckWARN(WARN_UTF8) ?
							   0 : UTF8_ALLOW_ANY))
        2604    			     sayNO;
        6666    			l += ulen;
        6666    			s ++;
				    }
				}
				else {
				    /* The target is not utf8, the pattern is utf8. */
         292    		    while (s < e) {
         243    			STRLEN ulen;
         243    			if (l >= PL_regeol)
           3    			    sayNO;
         240    			if (NATIVE_TO_UNI(*((U8*)l)) !=
					    utf8n_to_uvuni((U8*)s, UTF8_MAXBYTES, &ulen,
							   ckWARN(WARN_UTF8) ?
							   0 : UTF8_ALLOW_ANY))
          31    			    sayNO;
         209    			s += ulen;
         209    			l ++;
				    }
				}
        3135    		locinput = l;
        3135    		nextchr = UCHARAT(locinput);
        3135    		break;
			    }
			    /* The target and the pattern have the same utf8ness. */
			    /* Inline the first character, for speed. */
     6805445    	    if (UCHARAT(s) != nextchr)
     2767374    		sayNO;
     4038071    	    if (PL_regeol - locinput < ln)
        1566    		sayNO;
     4036505    	    if (ln > 1 && memNE(s, locinput, ln))
      403101    		sayNO;
     3633404    	    locinput += ln;
     3633404    	    nextchr = UCHARAT(locinput);
     3633404    	    break;
			case EXACTFL:
     1696542    	    PL_reg_flags |= RF_tainted;
			    /* FALL THROUGH */
			case EXACTF:
     1824337    	    s = STRING(scan);
     1824337    	    ln = STR_LEN(scan);
		
     1824337    	    if (do_utf8 || UTF) {
			      /* Either target or the pattern are utf8. */
        8907    		char *l = locinput;
        8907    		char *e = PL_regeol;
		
        8907    		if (ibcmp_utf8(s, 0,  ln, (bool)UTF,
					       l, &e, 0,  do_utf8)) {
				     /* One more case for the sharp s:
				      * pack("U0U*", 0xDF) =~ /ss/i,
				      * the 0xC3 0x9F are the UTF-8
				      * byte sequence for the U+00DF. */
          15    		     if (!(do_utf8 &&
					   toLOWER(s[0]) == 's' &&
					   ln >= 2 &&
					   toLOWER(s[1]) == 's' &&
					   (U8)l[0] == 0xC3 &&
					   e - l >= 2 &&
					   (U8)l[1] == 0x9F))
        8892    			  sayNO;
				}
        8892    		locinput = e;
        8892    		nextchr = UCHARAT(locinput);
        8892    		break;
			    }
		
			    /* Neither the target and the pattern are utf8. */
		
			    /* Inline the first character, for speed. */
     1815430    	    if (UCHARAT(s) != nextchr &&
				UCHARAT(s) != ((OP(scan) == EXACTF)
					       ? PL_fold : PL_fold_locale)[nextchr])
      107856    		sayNO;
     1707574    	    if (PL_regeol - locinput < ln)
         355    		sayNO;
     1707219    	    if (ln > 1 && (OP(scan) == EXACTF
					   ? ibcmp(s, locinput, ln)
					   : ibcmp_locale(s, locinput, ln)))
     1705025    		sayNO;
     1705025    	    locinput += ln;
     1705025    	    nextchr = UCHARAT(locinput);
     1705025    	    break;
			case ANYOF:
     4437711    	    if (do_utf8) {
       22504    	        STRLEN inclasslen = PL_regeol - locinput;
		
       22504    	        if (!reginclass(scan, (U8*)locinput, &inclasslen, do_utf8))
        2370    		    sayNO_ANYOF;
       20134    		if (locinput >= PL_regeol)
           3    		    sayNO;
       20131    		locinput += inclasslen ? inclasslen : UTF8SKIP(locinput);
       20131    		nextchr = UCHARAT(locinput);
       20131    		break;
			    }
			    else {
     4415207    		if (nextchr < 0)
      ######    		    nextchr = UCHARAT(locinput);
     4415207    		if (!REGINCLASS(scan, (U8*)locinput))
     1051159    		    sayNO_ANYOF;
     2956545    		if (!nextchr && locinput >= PL_regeol)
       31328    		    sayNO;
     2925217    		nextchr = UCHARAT(++locinput);
     2925217    		break;
			    }
			no_anyof:
			    /* If we might have the case of the German sharp s
			     * in a casefolding Unicode character class. */
		
     1461032    	    if (ANYOF_FOLD_SHARP_S(scan, locinput, PL_regeol)) {
           2    		 locinput += SHARP_S_SKIP;
           2    		 nextchr = UCHARAT(locinput);
			    }
			    else
       77601    		 sayNO;
       77601    	    break;
			case ALNUML:
       77601    	    PL_reg_flags |= RF_tainted;
			    /* FALL THROUGH */
			case ALNUM:
       84447    	    if (!nextchr)
           2    		sayNO;
       84445    	    if (do_utf8) {
          35    		LOAD_UTF8_CHARCLASS_ALNUM();
          35    		if (!(OP(scan) == ALNUM
				      ? swash_fetch(PL_utf8_alnum, (U8*)locinput, do_utf8)
				      : isALNUM_LC_utf8((U8*)locinput)))
				{
      ######    		    sayNO;
				}
          35    		locinput += PL_utf8skip[nextchr];
          35    		nextchr = UCHARAT(locinput);
          35    		break;
			    }
       84410    	    if (!(OP(scan) == ALNUM
				  ? isALNUM(nextchr) : isALNUM_LC(nextchr)))
       84323    		sayNO;
       84323    	    nextchr = UCHARAT(++locinput);
       84323    	    break;
			case NALNUML:
       22964    	    PL_reg_flags |= RF_tainted;
			    /* FALL THROUGH */
			case NALNUM:
       59276    	    if (!nextchr && locinput >= PL_regeol)
          96    		sayNO;
       59180    	    if (do_utf8) {
      ######    		LOAD_UTF8_CHARCLASS_ALNUM();
      ######    		if (OP(scan) == NALNUM
				    ? swash_fetch(PL_utf8_alnum, (U8*)locinput, do_utf8)
				    : isALNUM_LC_utf8((U8*)locinput))
				{
      ######    		    sayNO;
				}
      ######    		locinput += PL_utf8skip[nextchr];
      ######    		nextchr = UCHARAT(locinput);
      ######    		break;
			    }
       59180    	    if (OP(scan) == NALNUM
				? isALNUM(nextchr) : isALNUM_LC(nextchr))
       41624    		sayNO;
       41624    	    nextchr = UCHARAT(++locinput);
       41624    	    break;
			case BOUNDL:
			case NBOUNDL:
         128    	    PL_reg_flags |= RF_tainted;
			    /* FALL THROUGH */
			case BOUND:
			case NBOUND:
			    /* was last char in word? */
      416361    	    if (do_utf8) {
          14    		if (locinput == PL_bostr)
          10    		    ln = '\n';
				else {
           4    		    const U8 * const r = reghop3((U8*)locinput, -1, (U8*)PL_bostr);
				
           4    		    ln = utf8n_to_uvchr(r, UTF8SKIP(r), 0, 0);
				}
          14    		if (OP(scan) == BOUND || OP(scan) == NBOUND) {
          14    		    ln = isALNUM_uni(ln);
          14    		    LOAD_UTF8_CHARCLASS_ALNUM();
          14    		    n = swash_fetch(PL_utf8_alnum, (U8*)locinput, do_utf8);
				}
				else {
      ######    		    ln = isALNUM_LC_uvchr(UNI_TO_NATIVE(ln));
      ######    		    n = isALNUM_LC_utf8((U8*)locinput);
				}
			    }
			    else {
      416347    		ln = (locinput != PL_bostr) ?
				    UCHARAT(locinput - 1) : '\n';
      416347    		if (OP(scan) == BOUND || OP(scan) == NBOUND) {
      416219    		    ln = isALNUM(ln);
      416219    		    n = isALNUM(nextchr);
				}
				else {
         128    		    ln = isALNUM_LC(ln);
         128    		    n = isALNUM_LC(nextchr);
				}
			    }
      416361    	    if (((!ln) == (!n)) == (OP(scan) == BOUND ||
						    OP(scan) == BOUNDL))
      189276    		    sayNO;
        7681    	    break;
			case SPACEL:
        7681    	    PL_reg_flags |= RF_tainted;
			    /* FALL THROUGH */
			case SPACE:
      224272    	    if (!nextchr)
         350    		sayNO;
      223922    	    if (do_utf8) {
           4    		if (UTF8_IS_CONTINUED(nextchr)) {
           4    		    LOAD_UTF8_CHARCLASS_SPACE();
           4    		    if (!(OP(scan) == SPACE
					  ? swash_fetch(PL_utf8_space, (U8*)locinput, do_utf8)
					  : isSPACE_LC_utf8((U8*)locinput)))
				    {
      ######    			sayNO;
				    }
           4    		    locinput += PL_utf8skip[nextchr];
           4    		    nextchr = UCHARAT(locinput);
           4    		    break;
				}
      ######    		if (!(OP(scan) == SPACE
				      ? isSPACE(nextchr) : isSPACE_LC(nextchr)))
      ######    		    sayNO;
      ######    		nextchr = UCHARAT(++locinput);
			    }
			    else {
      223918    		if (!(OP(scan) == SPACE
				      ? isSPACE(nextchr) : isSPACE_LC(nextchr)))
        5471    		    sayNO;
      117258    		nextchr = UCHARAT(++locinput);
			    }
      117258    	    break;
			case NSPACEL:
        4947    	    PL_reg_flags |= RF_tainted;
			    /* FALL THROUGH */
			case NSPACE:
      109241    	    if (!nextchr && locinput >= PL_regeol)
          94    		sayNO;
      109147    	    if (do_utf8) {
           3    		LOAD_UTF8_CHARCLASS_SPACE();
           3    		if (OP(scan) == NSPACE
				    ? swash_fetch(PL_utf8_space, (U8*)locinput, do_utf8)
				    : isSPACE_LC_utf8((U8*)locinput))
				{
           3    		    sayNO;
				}
           3    		locinput += PL_utf8skip[nextchr];
           3    		nextchr = UCHARAT(locinput);
           3    		break;
			    }
      109144    	    if (OP(scan) == NSPACE
				? isSPACE(nextchr) : isSPACE_LC(nextchr))
       95889    		sayNO;
       95889    	    nextchr = UCHARAT(++locinput);
       95889    	    break;
			case DIGITL:
      ######    	    PL_reg_flags |= RF_tainted;
			    /* FALL THROUGH */
			case DIGIT:
       63233    	    if (!nextchr)
           6    		sayNO;
       63227    	    if (do_utf8) {
           2    		LOAD_UTF8_CHARCLASS_DIGIT();
           2    		if (!(OP(scan) == DIGIT
				      ? swash_fetch(PL_utf8_digit, (U8*)locinput, do_utf8)
				      : isDIGIT_LC_utf8((U8*)locinput)))
				{
      ######    		    sayNO;
				}
           1    		locinput += PL_utf8skip[nextchr];
           1    		nextchr = UCHARAT(locinput);
           1    		break;
			    }
       63225    	    if (!(OP(scan) == DIGIT
				  ? isDIGIT(nextchr) : isDIGIT_LC(nextchr)))
      ######    		sayNO;
        3877    	    nextchr = UCHARAT(++locinput);
        3877    	    break;
			case NDIGITL:
      ######    	    PL_reg_flags |= RF_tainted;
			    /* FALL THROUGH */
			case NDIGIT:
         526    	    if (!nextchr && locinput >= PL_regeol)
      ######    		sayNO;
         526    	    if (do_utf8) {
      ######    		LOAD_UTF8_CHARCLASS_DIGIT();
      ######    		if (OP(scan) == NDIGIT
				    ? swash_fetch(PL_utf8_digit, (U8*)locinput, do_utf8)
				    : isDIGIT_LC_utf8((U8*)locinput))
				{
      ######    		    sayNO;
				}
      ######    		locinput += PL_utf8skip[nextchr];
      ######    		nextchr = UCHARAT(locinput);
      ######    		break;
			    }
         526    	    if (OP(scan) == NDIGIT
				? isDIGIT(nextchr) : isDIGIT_LC(nextchr))
         526    		sayNO;
         526    	    nextchr = UCHARAT(++locinput);
         526    	    break;
			case CLUMP:
          11    	    if (locinput >= PL_regeol)
      ######    		sayNO;
          11    	    if  (do_utf8) {
           7    		LOAD_UTF8_CHARCLASS_MARK();
           7    		if (swash_fetch(PL_utf8_mark,(U8*)locinput, do_utf8))
      ######    		    sayNO;
           7    		locinput += PL_utf8skip[nextchr];
          10    		while (locinput < PL_regeol &&
				       swash_fetch(PL_utf8_mark,(U8*)locinput, do_utf8))
           3    		    locinput += UTF8SKIP(locinput);
           7    		if (locinput > PL_regeol)
      ######    		    sayNO;
			    } 
			    else
           4    	       locinput++;
          11    	    nextchr = UCHARAT(locinput);
          11    	    break;
			case REFFL:
      ######    	    PL_reg_flags |= RF_tainted;
			    /* FALL THROUGH */
		        case REF:
			case REFF:
        7136    	    n = ARG(scan);  /* which paren pair */
        7136    	    ln = PL_regstartp[n];
        7136    	    PL_reg_leftiter = PL_reg_maxiter;		/* Void cache */
        7136    	    if ((I32)*PL_reglastparen < n || ln == -1)
        6686    		sayNO;			/* Do not match unless seen CLOSEn. */
        6686    	    if (ln == PL_regendp[n])
          10    		break;
		
        6676    	    s = PL_bostr + ln;
        6676    	    if (do_utf8 && OP(scan) != REF) {	/* REF can do byte comparison */
      ######    		char *l = locinput;
      ######    		const char *e = PL_bostr + PL_regendp[n];
				/*
				 * Note that we can't do the "other character" lookup trick as
				 * in the 8-bit case (no pun intended) because in Unicode we
				 * have to map both upper and title case to lower case.
				 */
      ######    		if (OP(scan) == REFF) {
      ######    		    while (s < e) {
      ######    			STRLEN ulen1, ulen2;
      ######    			U8 tmpbuf1[UTF8_MAXBYTES_CASE+1];
      ######    			U8 tmpbuf2[UTF8_MAXBYTES_CASE+1];
		
      ######    			if (l >= PL_regeol)
      ######    			    sayNO;
      ######    			toLOWER_utf8((U8*)s, tmpbuf1, &ulen1);
      ######    			toLOWER_utf8((U8*)l, tmpbuf2, &ulen2);
      ######    			if (ulen1 != ulen2 || memNE((char *)tmpbuf1, (char *)tmpbuf2, ulen1))
      ######    			    sayNO;
      ######    			s += ulen1;
      ######    			l += ulen2;
				    }
				}
      ######    		locinput = l;
      ######    		nextchr = UCHARAT(locinput);
      ######    		break;
			    }
		
			    /* Inline the first character, for speed. */
        6676    	    if (UCHARAT(s) != nextchr &&
				(OP(scan) == REF ||
				 (UCHARAT(s) != ((OP(scan) == REFF
						  ? PL_fold : PL_fold_locale)[nextchr]))))
        2280    		sayNO;
        2280    	    ln = PL_regendp[n] - ln;
        2280    	    if (locinput + ln > PL_regeol)
         110    		sayNO;
        2170    	    if (ln > 1 && (OP(scan) == REF
					   ? memNE(s, locinput, ln)
					   : (OP(scan) == REFF
					      ? ibcmp(s, locinput, ln)
					      : ibcmp_locale(s, locinput, ln))))
        2170    		sayNO;
        2170    	    locinput += ln;
        2170    	    nextchr = UCHARAT(locinput);
        2170    	    break;
		
			case NOTHING:
			case TAIL:
       10629    	    break;
			case BACK:
       10629    	    break;
			case EVAL:
			{
       10629    	    dSP;
       10629    	    OP_4tree *oop = PL_op;
       10629    	    COP *ocurcop = PL_curcop;
       10629    	    PAD *old_comppad;
       10629    	    SV *ret;
       10629    	    struct regexp *oreg = PL_reg_re;
			
       10629    	    n = ARG(scan);
       10629    	    PL_op = (OP_4tree*)PL_regdata->data[n];
       10629    	    DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log, "  re_eval 0x%"UVxf"\n", PTR2UV(PL_op)) );
       10629    	    PAD_SAVE_LOCAL(old_comppad, (PAD*)PL_regdata->data[n + 2]);
       10629    	    PL_regendp[0] = PL_reg_magic->mg_len = locinput - PL_bostr;
		
			    {
       10629    		SV **before = SP;
       10629    		CALLRUNOPS(aTHX);			/* Scalar context. */
       10628    		SPAGAIN;
       10628    		if (SP == before)
      ######    		    ret = &PL_sv_undef;   /* protect against empty (?{}) blocks. */
				else {
       10628    		    ret = POPs;
       10628    		    PUTBACK;
				}
			    }
		
       10628    	    PL_op = oop;
       10628    	    PAD_RESTORE_LOCAL(old_comppad);
       10628    	    PL_curcop = ocurcop;
       10628    	    if (logical) {
       10099    		if (logical == 2) {	/* Postponed subexpression. */
        9905    		    regexp *re;
        9905    		    MAGIC *mg = Null(MAGIC*);
        9905    		    re_cc_state state;
        9905    		    CHECKPOINT cp, lastcp;
        9905                        int toggleutf;
        9905    		    register SV *sv;
		
        9905    		    if(SvROK(ret) && SvSMAGICAL(sv = SvRV(ret)))
        8492    			mg = mg_find(sv, PERL_MAGIC_qr);
        1413    		    else if (SvSMAGICAL(ret)) {
          11    			if (SvGMAGICAL(ret))
           4    			    sv_unmagic(ret, PERL_MAGIC_qr);
					else
           7    			    mg = mg_find(ret, PERL_MAGIC_qr);
				    }
		
        9905    		    if (mg) {
        8498    			re = (regexp *)mg->mg_obj;
        8498    			(void)ReREFCNT_inc(re);
				    }
				    else {
        1407    			STRLEN len;
        1407    			const char *t = SvPV_const(ret, len);
        1407    			PMOP pm;
        1407    			char * const oprecomp = PL_regprecomp;
        1407    			const I32 osize = PL_regsize;
        1407    			const I32 onpar = PL_regnpar;
		
        1407    			Zero(&pm, 1, PMOP);
        1407                            if (DO_UTF8(ret)) pm.op_pmdynflags |= PMdf_DYN_UTF8;
        1407    			re = CALLREGCOMP(aTHX_ (char*)t, (char*)t + len, &pm);
        1407    			if (!(SvFLAGS(ret)
					      & (SVs_TEMP | SVs_PADTMP | SVf_READONLY
						| SVs_GMG)))
           6    			    sv_magic(ret,(SV*)ReREFCNT_inc(re),
							PERL_MAGIC_qr,0,0);
        1407    			PL_regprecomp = oprecomp;
        1407    			PL_regsize = osize;
        1407    			PL_regnpar = onpar;
				    }
				    DEBUG_EXECUTE_r(
					PerlIO_printf(Perl_debug_log,
						      "Entering embedded \"%s%.60s%s%s\"\n",
						      PL_colors[0],
						      re->precomp,
						      PL_colors[1],
						      (strlen(re->precomp) > 60 ? "..." : ""))
        9905    			);
        9905    		    state.node = next;
        9905    		    state.prev = PL_reg_call_cc;
        9905    		    state.cc = PL_regcc;
        9905    		    state.re = PL_reg_re;
		
        9905    		    PL_regcc = 0;
				
        9905    		    cp = regcppush(0);	/* Save *all* the positions. */
        9905    		    REGCP_SET(lastcp);
        9905    		    cache_re(re);
        9905    		    state.ss = PL_savestack_ix;
        9905    		    *PL_reglastparen = 0;
        9905    		    *PL_reglastcloseparen = 0;
        9905    		    PL_reg_call_cc = &state;
        9905    		    PL_reginput = locinput;
        9905    		    toggleutf = ((PL_reg_flags & RF_utf8) != 0) ^
						((re->reganch & ROPT_UTF8) != 0);
        9905    		    if (toggleutf) PL_reg_flags ^= RF_utf8;
		
				    /* XXXX This is too dramatic a measure... */
        9905    		    PL_reg_maxiter = 0;
		
        9905    		    if (regmatch(re->program + 1)) {
					/* Even though we succeeded, we need to restore
					   global variables, since we may be wrapped inside
					   SUSPEND, thus the match may be not finished yet. */
		
					/* XXXX Do this only if SUSPENDed? */
        4319    			PL_reg_call_cc = state.prev;
        4319    			PL_regcc = state.cc;
        4319    			PL_reg_re = state.re;
        4319    			cache_re(PL_reg_re);
        4319    			if (toggleutf) PL_reg_flags ^= RF_utf8;
		
					/* XXXX This is too dramatic a measure... */
        4319    			PL_reg_maxiter = 0;
		
					/* These are needed even if not SUSPEND. */
        4319    			ReREFCNT_dec(re);
        4319    			regcpblow(cp);
        4319    			sayYES;
				    }
        5586    		    ReREFCNT_dec(re);
        5586    		    REGCP_UNWIND(lastcp);
        5586    		    regcppop();
        5586    		    PL_reg_call_cc = state.prev;
        5586    		    PL_regcc = state.cc;
        5586    		    PL_reg_re = state.re;
        5586    		    cache_re(PL_reg_re);
        5586    		    if (toggleutf) PL_reg_flags ^= RF_utf8;
		
				    /* XXXX This is too dramatic a measure... */
        5586    		    PL_reg_maxiter = 0;
		
        5586    		    logical = 0;
        5586    		    sayNO;
				}
         194    		sw = SvTRUE(ret);
         194    		logical = 0;
			    }
			    else {
         529    		sv_setsv(save_scalar(PL_replgv), ret);
         529    		cache_re(oreg);
			    }
         529    	    break;
			}
			case OPEN:
     7139107    	    n = ARG(scan);  /* which paren pair */
     7139107    	    PL_reg_start_tmp[n] = locinput;
     7139107    	    if (n > PL_regsize)
     6305872    		PL_regsize = n;
     6305872    	    break;
			case CLOSE:
     5823937    	    n = ARG(scan);  /* which paren pair */
     5823937    	    PL_regstartp[n] = PL_reg_start_tmp[n] - PL_bostr;
     5823937    	    PL_regendp[n] = locinput - PL_bostr;
     5823937    	    if (n > (I32)*PL_reglastparen)
     4773465    		*PL_reglastparen = n;
     5823937    	    *PL_reglastcloseparen = n;
     5823937    	    break;
			case GROUPP:
         380    	    n = ARG(scan);  /* which paren pair */
         380    	    sw = ((I32)*PL_reglastparen >= n && PL_regendp[n] != -1);
         380    	    break;
			case IFTHEN:
         634    	    PL_reg_leftiter = PL_reg_maxiter;		/* Void cache */
         634    	    if (sw)
         306    		next = NEXTOPER(NEXTOPER(scan));
			    else {
         328    		next = scan + ARG(scan);
         328    		if (OP(next) == IFTHEN) /* Fake one. */
         170    		    next = NEXTOPER(NEXTOPER(next));
			    }
         170    	    break;
			case LOGICAL:
       10159    	    logical = scan->flags;
       10159    	    break;
		/*******************************************************************
		 PL_regcc contains infoblock about the innermost (...)* loop, and
		 a pointer to the next outer infoblock.
		
		 Here is how Y(A)*Z is processed (if it is compiled into CURLYX/WHILEM):
		
		   1) After matching X, regnode for CURLYX is processed;
		
		   2) This regnode creates infoblock on the stack, and calls
		      regmatch() recursively with the starting point at WHILEM node;
		
		   3) Each hit of WHILEM node tries to match A and Z (in the order
		      depending on the current iteration, min/max of {min,max} and
		      greediness).  The information about where are nodes for "A"
		      and "Z" is read from the infoblock, as is info on how many times "A"
		      was already matched, and greediness.
		
		   4) After A matches, the same WHILEM node is hit again.
		
		   5) Each time WHILEM is hit, PL_regcc is the infoblock created by CURLYX
		      of the same pair.  Thus when WHILEM tries to match Z, it temporarily
		      resets PL_regcc, since this Y(A)*Z can be a part of some other loop:
		      as in (Y(A)*Z)*.  If Z matches, the automaton will hit the WHILEM node
		      of the external loop.
		
		 Currently present infoblocks form a tree with a stem formed by PL_curcc
		 and whatever it mentions via ->next, and additional attached trees
		 corresponding to temporarily unset infoblocks as in "5" above.
		
		 In the following picture infoblocks for outer loop of
		 (Y(A)*?Z)*?T are denoted O, for inner I.  NULL starting block
		 is denoted by x.  The matched string is YAAZYAZT.  Temporarily postponed
		 infoblocks are drawn below the "reset" infoblock.
		
		 In fact in the picture below we do not show failed matches for Z and T
		 by WHILEM blocks.  [We illustrate minimal matches, since for them it is
		 more obvious *why* one needs to *temporary* unset infoblocks.]
		
		  Matched	REx position	InfoBlocks	Comment
		  		(Y(A)*?Z)*?T	x
		  		Y(A)*?Z)*?T	x <- O
		  Y		(A)*?Z)*?T	x <- O
		  Y		A)*?Z)*?T	x <- O <- I
		  YA		)*?Z)*?T	x <- O <- I
		  YA		A)*?Z)*?T	x <- O <- I
		  YAA		)*?Z)*?T	x <- O <- I
		  YAA		Z)*?T		x <- O		# Temporary unset I
						     I
		
		  YAAZ		Y(A)*?Z)*?T	x <- O
						     I
		
		  YAAZY		(A)*?Z)*?T	x <- O
						     I
		
		  YAAZY		A)*?Z)*?T	x <- O <- I
						     I
		
		  YAAZYA	)*?Z)*?T	x <- O <- I	
						     I
		
		  YAAZYA	Z)*?T		x <- O		# Temporary unset I
						     I,I
		
		  YAAZYAZ	)*?T		x <- O
						     I,I
		
		  YAAZYAZ	T		x		# Temporary unset O
						O
						I,I
		
		  YAAZYAZT			x
						O
						I,I
		 *******************************************************************/
			case CURLYX: {
     1170519    		CURCUR cc;
     1170519    		CHECKPOINT cp = PL_savestack_ix;
				/* No need to save/restore up to this paren */
     1170519    		I32 parenfloor = scan->flags;
		
     1170519    		if (OP(PREVOPER(next)) == NOTHING) /* LONGJMP */
          12    		    next += ARG(next);
     1170519    		cc.oldcc = PL_regcc;
     1170519    		PL_regcc = &cc;
				/* XXXX Probably it is better to teach regpush to support
				   parenfloor > PL_regsize... */
     1170519    		if (parenfloor > (I32)*PL_reglastparen)
      236255    		    parenfloor = *PL_reglastparen; /* Pessimization... */
     1170519    		cc.parenfloor = parenfloor;
     1170519    		cc.cur = -1;
     1170519    		cc.min = ARG1(scan);
     1170519    		cc.max  = ARG2(scan);
     1170519    		cc.scan = NEXTOPER(scan) + EXTRA_STEP_2ARGS;
     1170519    		cc.next = next;
     1170519    		cc.minmod = minmod;
     1170519    		cc.lastloc = 0;
     1170519    		PL_reginput = locinput;
     1170519    		n = regmatch(PREVOPER(next));	/* start on the WHILEM */
     1170519    		regcpblow(cp);
     1170519    		PL_regcc = cc.oldcc;
     1170519    		saySAME(n);
			    }
			    /* NOT REACHED */
			case WHILEM: {
				/*
				 * This is really hard to understand, because after we match
				 * what we're trying to match, we must make sure the rest of
				 * the REx is going to match for sure, and to do that we have
				 * to go back UP the parse tree by recursing ever deeper.  And
				 * if it fails, we have to reset our parent's current state
				 * that we can try again after backing off.
				 */
		
     1802011    		CHECKPOINT cp, lastcp;
     1802011    		CURCUR* cc = PL_regcc;
     1802011    		char *lastloc = cc->lastloc; /* Detection of 0-len. */
     1802011    		I32 cache_offset = 0, cache_bit = 0;
				
     1802011    		n = cc->cur + 1;	/* how many we know we matched */
     1802011    		PL_reginput = locinput;
		
				DEBUG_EXECUTE_r(
				    PerlIO_printf(Perl_debug_log,
						  "%*s  %ld out of %ld..%ld  cc=%"UVxf"\n",
						  REPORT_CODE_OFF+PL_regindent*2, "",
						  (long)n, (long)cc->min,
						  (long)cc->max, PTR2UV(cc))
     1802011    		    );
		
				/* If degenerate scan matches "", assume scan done. */
		
     1802011    		if (locinput == cc->lastloc && n >= cc->min) {
         572    		    PL_regcc = cc->oldcc;
         572    		    if (PL_regcc)
      ######    			ln = PL_regcc->cur;
				    DEBUG_EXECUTE_r(
					PerlIO_printf(Perl_debug_log,
					   "%*s  empty match detected, try continuation...\n",
					   REPORT_CODE_OFF+PL_regindent*2, "")
         572    			);
         572    		    if (regmatch(cc->next))
         542    			sayYES;
          30    		    if (PL_regcc)
      ######    			PL_regcc->cur = ln;
          30    		    PL_regcc = cc;
          30    		    sayNO;
				}
		
				/* First just match a string of min scans. */
		
     1801439    		if (n < cc->min) {
       13637    		    cc->cur = n;
       13637    		    cc->lastloc = locinput;
       13637    		    if (regmatch(cc->scan))
        1729    			sayYES;
       11908    		    cc->cur = n - 1;
       11908    		    cc->lastloc = lastloc;
       11908    		    sayNO;
				}
		
     1787802    		if (scan->flags) {
				    /* Check whether we already were at this position.
					Postpone detection until we know the match is not
					*that* much linear. */
      148606    		if (!PL_reg_maxiter) {
       29483    		    PL_reg_maxiter = (PL_regeol - PL_bostr + 1) * (scan->flags>>4);
       29483    		    PL_reg_leftiter = PL_reg_maxiter;
				}
      148606    		if (PL_reg_leftiter-- == 0) {
         180    		    const I32 size = (PL_reg_maxiter + 7 + POSCACHE_START)/8;
         180    		    if (PL_reg_poscache) {
         175    			if ((I32)PL_reg_poscache_size < size) {
      ######    			    Renew(PL_reg_poscache, size, char);
      ######    			    PL_reg_poscache_size = size;
					}
         175    			Zero(PL_reg_poscache, size, char);
				    }
				    else {
           5    			PL_reg_poscache_size = size;
           5    			Newz(29, PL_reg_poscache, size, char);
				    }
				    DEBUG_EXECUTE_r(
					PerlIO_printf(Perl_debug_log,
			      "%sDetected a super-linear match, switching on caching%s...\n",
						      PL_colors[4], PL_colors[5])
         180    			);
				}
      148606    		if (PL_reg_leftiter < 0) {
       88440    		    cache_offset = locinput - PL_bostr;
		
       88440    		    cache_offset = (scan->flags & 0xf) - 1 + POSCACHE_START
					    + cache_offset * (scan->flags>>4);
       88440    		    cache_bit = cache_offset % 8;
       88440    		    cache_offset /= 8;
       88440    		    if (PL_reg_poscache[cache_offset] & (1<<cache_bit)) {
				    DEBUG_EXECUTE_r(
					PerlIO_printf(Perl_debug_log,
						      "%*s  already tried at this position...\n",
						      REPORT_CODE_OFF+PL_regindent*2, "")
       83220    			);
       83220    			if (PL_reg_poscache[0] & (1<<POSCACHE_SUCCESS))
					    /* cache records success */
          10    			    sayYES;
					else
					    /* cache records failure */
        5220    			    sayNO_SILENT;
				    }
        5220    		    PL_reg_poscache[cache_offset] |= (1<<cache_bit);
				}
				}
		
				/* Prefer next over scan for minimal matching. */
		
     1704582    		if (cc->minmod) {
        6165    		    PL_regcc = cc->oldcc;
        6165    		    if (PL_regcc)
      ######    			ln = PL_regcc->cur;
        6165    		    cp = regcppush(cc->parenfloor);
        6165    		    REGCP_SET(lastcp);
        6165    		    if (regmatch(cc->next)) {
         606    			regcpblow(cp);
         606    			CACHEsayYES;	/* All done. */
				    }
        5559    		    REGCP_UNWIND(lastcp);
        5559    		    regcppop();
        5559    		    if (PL_regcc)
      ######    			PL_regcc->cur = ln;
        5559    		    PL_regcc = cc;
		
        5559    		    if (n >= cc->max) {	/* Maximum greed exceeded? */
      ######    			if (ckWARN(WARN_REGEXP) && n >= REG_INFTY
					    && !(PL_reg_flags & RF_warned)) {
      ######    			    PL_reg_flags |= RF_warned;
      ######    			    Perl_warner(aTHX_ packWARN(WARN_REGEXP), "%s limit (%d) exceeded",
						 "Complex regular subexpression recursion",
						 REG_INFTY - 1);
					}
      ######    			CACHEsayNO;
				    }
		
				    DEBUG_EXECUTE_r(
					PerlIO_printf(Perl_debug_log,
						      "%*s  trying longer...\n",
						      REPORT_CODE_OFF+PL_regindent*2, "")
        5559    			);
				    /* Try scanning more and see if it helps. */
        5559    		    PL_reginput = locinput;
        5559    		    cc->cur = n;
        5559    		    cc->lastloc = locinput;
        5559    		    cp = regcppush(cc->parenfloor);
        5559    		    REGCP_SET(lastcp);
        5559    		    if (regmatch(cc->scan)) {
        5551    			regcpblow(cp);
        5551    			CACHEsayYES;
				    }
           8    		    REGCP_UNWIND(lastcp);
           8    		    regcppop();
           8    		    cc->cur = n - 1;
           8    		    cc->lastloc = lastloc;
           8    		    CACHEsayNO;
				}
		
				/* Prefer scan over next for maximal matching. */
		
     1698417    		if (n < cc->max) {	/* More greed allowed? */
     1187943    		    cp = regcppush(cc->parenfloor);
     1187943    		    cc->cur = n;
     1187943    		    cc->lastloc = locinput;
     1187943    		    REGCP_SET(lastcp);
     1187943    		    if (regmatch(cc->scan)) {
      526643    			regcpblow(cp);
      526643    			CACHEsayYES;
				    }
      661300    		    REGCP_UNWIND(lastcp);
      661300    		    regcppop();		/* Restore some previous $<digit>s? */
      661300    		    PL_reginput = locinput;
				    DEBUG_EXECUTE_r(
					PerlIO_printf(Perl_debug_log,
						      "%*s  failed, try continuation...\n",
						      REPORT_CODE_OFF+PL_regindent*2, "")
      661300    			);
				}
     1171774    		if (ckWARN(WARN_REGEXP) && n >= REG_INFTY
					&& !(PL_reg_flags & RF_warned)) {
      ######    		    PL_reg_flags |= RF_warned;
      ######    		    Perl_warner(aTHX_ packWARN(WARN_REGEXP), "%s limit (%d) exceeded",
					 "Complex regular subexpression recursion",
					 REG_INFTY - 1);
				}
		
				/* Failed deeper matches of scan, so see if this one works. */
     1171774    		PL_regcc = cc->oldcc;
     1171774    		if (PL_regcc)
      104968    		    ln = PL_regcc->cur;
     1171774    		if (regmatch(cc->next))
     1054662    		    CACHEsayYES;
      117112    		if (PL_regcc)
         579    		    PL_regcc->cur = ln;
      117112    		PL_regcc = cc;
      117112    		cc->cur = n - 1;
      117112    		cc->lastloc = lastloc;
      117112    		CACHEsayNO;
			    }
			    /* NOT REACHED */
			case BRANCHJ:
          36    	    next = scan + ARG(scan);
          36    	    if (next == scan)
      ######    		next = NULL;
          36    	    inner = NEXTOPER(NEXTOPER(scan));
          36    	    goto do_branch;
			case BRANCH:
     1901017    	    inner = NEXTOPER(scan);
			  do_branch:
			    {
     1901053    		c1 = OP(scan);
     1901053    		if (OP(next) != c1)	/* No choice. */
      ######    		    next = inner;	/* Avoid recursion. */
				else {
     1901053    		    const I32 lastparen = *PL_reglastparen;
     1901053    		    I32 unwind1;
     1901053    		    re_unwind_branch_t *uw;
		
				    /* Put unwinding data on stack */
     1901053    		    unwind1 = SSNEWt(1,re_unwind_branch_t);
     1901053    		    uw = SSPTRt(unwind1,re_unwind_branch_t);
     1901053    		    uw->prev = unwind;
     1901053    		    unwind = unwind1;
     1901053    		    uw->type = ((c1 == BRANCH)
						? RE_UNWIND_BRANCH
						: RE_UNWIND_BRANCHJ);
     1901053    		    uw->lastparen = lastparen;
     1901053    		    uw->next = next;
     1901053    		    uw->locinput = locinput;
     1901053    		    uw->nextchr = nextchr;
		#ifdef DEBUGGING
     1901053    		    uw->regindent = ++PL_regindent;
		#endif
		
     1901053    		    REGCP_SET(uw->lastcp);
		
				    /* Now go into the first branch */
     1901053    		    next = inner;
				}
			    }
     1901053    	    break;
			case MINMOD:
      331069    	    minmod = 1;
      331069    	    break;
			case CURLYM:
			{
      264281    	    I32 l = 0;
      264281    	    CHECKPOINT lastcp;
			
			    /* We suppose that the next guy does not need
			       backtracking: in particular, it is of constant non-zero length,
			       and has no parenths to influence future backrefs. */
      264281    	    ln = ARG1(scan);  /* min to match */
      264281    	    n  = ARG2(scan);  /* max to match */
      264281    	    paren = scan->flags;
      264281    	    if (paren) {
      122816    		if (paren > PL_regsize)
      122519    		    PL_regsize = paren;
      122816    		if (paren > (I32)*PL_reglastparen)
      122554    		    *PL_reglastparen = paren;
			    }
      264281    	    scan = NEXTOPER(scan) + NODE_STEP_REGNODE;
      264281    	    if (paren)
      122816    		scan += NEXT_OFF(scan); /* Skip former OPEN. */
      264281    	    PL_reginput = locinput;
      264281    	    if (minmod) {
         224    		minmod = 0;
         224    		if (ln && regrepeat_hard(scan, ln, &l) < ln)
          20    		    sayNO;
         204    		locinput = PL_reginput;
         204    		if (HAS_TEXT(next) || JUMPABLE(next)) {
         174    		    regnode *text_node = next;
		
         174    		    if (! HAS_TEXT(text_node)) FIND_NEXT_IMPT(text_node);
		
         174    		    if (! HAS_TEXT(text_node)) c1 = c2 = -1000;
				    else {
          71    			if (PL_regkind[(U8)OP(text_node)] == REF) {
          60    			    c1 = c2 = -1000;
          60    			    goto assume_ok_MM;
					}
          11    			else { c1 = (U8)*STRING(text_node); }
          11    			if (OP(text_node) == EXACTF || OP(text_node) == REFF)
      ######    			    c2 = PL_fold[c1];
          11    			else if (OP(text_node) == EXACTFL || OP(text_node) == REFFL)
      ######    			    c2 = PL_fold_locale[c1];
					else
          11    			    c2 = c1;
				    }
				}
				else
          30    		    c1 = c2 = -1000;
			    assume_ok_MM:
         204    		REGCP_SET(lastcp);
         424    		while (n >= ln || (n == REG_INFTY && ln > 0)) { /* ln overflow ? */
				    /* If it could work, try it. */
         424    		    if (c1 == -1000 ||
					UCHARAT(PL_reginput) == c1 ||
					UCHARAT(PL_reginput) == c2)
				    {
         424    			if (paren) {
          51    			    if (ln) {
          30    				PL_regstartp[paren] =
						    HOPc(PL_reginput, -l) - PL_bostr;
          30    				PL_regendp[paren] = PL_reginput - PL_bostr;
					    }
					    else
          21    				PL_regendp[paren] = -1;
					}
         424    			if (regmatch(next))
         184    			    sayYES;
         240    			REGCP_UNWIND(lastcp);
				    }
				    /* Couldn't or didn't -- move forward. */
         240    		    PL_reginput = locinput;
         240    		    if (regrepeat_hard(scan, 1, &l)) {
         220    			ln++;
         220    			locinput = PL_reginput;
				    }
				    else
      264057    			sayNO;
				}
			    }
			    else {
      264057    		n = regrepeat_hard(scan, n, &l);
      264057    		locinput = PL_reginput;
				DEBUG_EXECUTE_r(
				    PerlIO_printf(Perl_debug_log,
						  "%*s  matched %"IVdf" times, len=%"IVdf"...\n",
						  (int)(REPORT_CODE_OFF+PL_regindent*2), "",
						  (IV) n, (IV)l)
      264057    		    );
      264057    		if (n >= ln) {
      159005    		    if (HAS_TEXT(next) || JUMPABLE(next)) {
      140327    			regnode *text_node = next;
		
      140327    			if (! HAS_TEXT(text_node)) FIND_NEXT_IMPT(text_node);
		
      140327    			if (! HAS_TEXT(text_node)) c1 = c2 = -1000;
					else {
      111514    			    if (PL_regkind[(U8)OP(text_node)] == REF) {
          60    				c1 = c2 = -1000;
          60    				goto assume_ok_REG;
					    }
      111454    			    else { c1 = (U8)*STRING(text_node); }
		
      111454    			    if (OP(text_node) == EXACTF || OP(text_node) == REFF)
         141    				c2 = PL_fold[c1];
      111313    			    else if (OP(text_node) == EXACTFL || OP(text_node) == REFFL)
           1    				c2 = PL_fold_locale[c1];
					    else
      111312    				c2 = c1;
					}
				    }
				    else
       18678    			c1 = c2 = -1000;
				}
			    assume_ok_REG:
      264057    		REGCP_SET(lastcp);
      300400    		while (n >= ln) {
				    /* If it could work, try it. */
      159674    		    if (c1 == -1000 ||
					UCHARAT(PL_reginput) == c1 ||
					UCHARAT(PL_reginput) == c2)
				    {
					DEBUG_EXECUTE_r(
						PerlIO_printf(Perl_debug_log,
							      "%*s  trying tail with n=%"IVdf"...\n",
							      (int)(REPORT_CODE_OFF+PL_regindent*2), "", (IV)n)
      157852    			    );
      157852    			if (paren) {
      122709    			    if (n) {
       10560    				PL_regstartp[paren] = HOPc(PL_reginput, -l) - PL_bostr;
       10560    				PL_regendp[paren] = PL_reginput - PL_bostr;
					    }
					    else
      112149    				PL_regendp[paren] = -1;
					}
      157852    			if (regmatch(next))
      123331    			    sayYES;
       34521    			REGCP_UNWIND(lastcp);
				    }
				    /* Couldn't or didn't -- back up. */
       36343    		    n--;
       36343    		    locinput = HOPc(locinput, -l);
       36343    		    PL_reginput = locinput;
				}
			    }
        2353    	    sayNO;
        2353    	    break;
			}
			case CURLYN:
        2353    	    paren = scan->flags;	/* Which paren to set */
        2353    	    if (paren > PL_regsize)
        2143    		PL_regsize = paren;
        2353    	    if (paren > (I32)*PL_reglastparen)
        2143    		*PL_reglastparen = paren;
        2353    	    ln = ARG1(scan);  /* min to match */
        2353    	    n  = ARG2(scan);  /* max to match */
        2353                scan = regnext(NEXTOPER(scan) + NODE_STEP_REGNODE);
        2353    	    goto repeat;
			case CURLY:
      287440    	    paren = 0;
      287440    	    ln = ARG1(scan);  /* min to match */
      287440    	    n  = ARG2(scan);  /* max to match */
      287440    	    scan = NEXTOPER(scan) + NODE_STEP_REGNODE;
      287440    	    goto repeat;
			case STAR:
     4979568    	    ln = 0;
     4979568    	    n = REG_INFTY;
     4979568    	    scan = NEXTOPER(scan);
     4979568    	    paren = 0;
     4979568    	    goto repeat;
			case PLUS:
     7128241    	    ln = 1;
     7128241    	    n = REG_INFTY;
     7128241    	    scan = NEXTOPER(scan);
     7128241    	    paren = 0;
			  repeat:
			    /*
			    * Lookahead to avoid useless match attempts
			    * when we know what character comes next.
			    */
		
			    /*
			    * Used to only do .*x and .*?x, but now it allows
			    * for )'s, ('s and (?{ ... })'s to be in the way
			    * of the quantifier and the EXACT-like node.  -- japhy
			    */
		
    12397602    	    if (HAS_TEXT(next) || JUMPABLE(next)) {
     9731128    		U8 *s;
     9731128    		regnode *text_node = next;
		
     9731128    		if (! HAS_TEXT(text_node)) FIND_NEXT_IMPT(text_node);
		
     9731128    		if (! HAS_TEXT(text_node)) c1 = c2 = -1000;
				else {
     3390621    		    if (PL_regkind[(U8)OP(text_node)] == REF) {
        1795    			c1 = c2 = -1000;
        1795    			goto assume_ok_easy;
				    }
     3388826    		    else { s = (U8*)STRING(text_node); }
		
     3388826    		    if (!UTF) {
     3388805    			c2 = c1 = *s;
     3388805    			if (OP(text_node) == EXACTF || OP(text_node) == REFF)
      273976    			    c2 = PL_fold[c1];
     3114829    			else if (OP(text_node) == EXACTFL || OP(text_node) == REFFL)
      ######    			    c2 = PL_fold_locale[c1];
				    }
				    else { /* UTF */
          21    			if (OP(text_node) == EXACTF || OP(text_node) == REFF) {
           3    			     STRLEN ulen1, ulen2;
           3    			     U8 tmpbuf1[UTF8_MAXBYTES_CASE+1];
           3    			     U8 tmpbuf2[UTF8_MAXBYTES_CASE+1];
		
           3    			     to_utf8_lower((U8*)s, tmpbuf1, &ulen1);
           3    			     to_utf8_upper((U8*)s, tmpbuf2, &ulen2);
		
           3    			     c1 = utf8n_to_uvuni(tmpbuf1, UTF8_MAXBYTES, 0,
								 ckWARN(WARN_UTF8) ?
								 0 : UTF8_ALLOW_ANY);
           3    			     c2 = utf8n_to_uvuni(tmpbuf2, UTF8_MAXBYTES, 0,
								 ckWARN(WARN_UTF8) ?
								 0 : UTF8_ALLOW_ANY);
					}
					else {
          18    			    c2 = c1 = utf8n_to_uvchr(s, UTF8_MAXBYTES, 0,
								     ckWARN(WARN_UTF8) ?
								     0 : UTF8_ALLOW_ANY);
					}
				    }
				}
			    }
			    else
     2666474    		c1 = c2 = -1000;
			assume_ok_easy:
    12397602    	    PL_reginput = locinput;
    12397602    	    if (minmod) {
      330231    		CHECKPOINT lastcp;
      330231    		minmod = 0;
      330231    		if (ln && regrepeat(scan, ln) < ln)
          24    		    sayNO;
      330207    		locinput = PL_reginput;
      330207    		REGCP_SET(lastcp);
      330207    		if (c1 != -1000) {
      283692    		    char *e; /* Should not check after this */
      283692    		    char *old = locinput;
      283692    		    int count = 0;
		
      283692    		    if  (n == REG_INFTY) {
      283602    			e = PL_regeol - 1;
      283602    			if (do_utf8)
          28    			    while (UTF8_IS_CONTINUATION(*(U8*)e))
           3    				e--;
				    }
          90    		    else if (do_utf8) {
      ######    			int m = n - ln;
      ######    			for (e = locinput;
					     m >0 && e + UTF8SKIP(e) <= PL_regeol; m--)
      ######    			    e += UTF8SKIP(e);
				    }
				    else {
          90    			e = locinput + n - ln;
          90    			if (e >= PL_regeol)
          10    			    e = PL_regeol - 1;
				    }
      285481    		    while (1) {
					/* Find place 'next' could work */
      285481    			if (!do_utf8) {
      285456    			    if (c1 == c2) {
      809550    				while (locinput <= e &&
						       UCHARAT(locinput) != c1)
      524384    				    locinput++;
					    } else {
         360    				while (locinput <= e
						       && UCHARAT(locinput) != c1
						       && UCHARAT(locinput) != c2)
          70    				    locinput++;
					    }
      285456    			    count = locinput - old;
					}
					else {
          25    			    if (c1 == c2) {
         829    				STRLEN len;
						/* count initialised to
						 * utf8_distance(old, locinput) */
         829    				while (locinput <= e &&
						       utf8n_to_uvchr((U8*)locinput,
								      UTF8_MAXBYTES, &len,
								      ckWARN(WARN_UTF8) ?
								      0 : UTF8_ALLOW_ANY) != (UV)c1) {
         804    				    locinput += len;
         804    				    count++;
						}
					    } else {
      ######    				STRLEN len;
						/* count initialised to
						 * utf8_distance(old, locinput) */
      ######    				while (locinput <= e) {
      ######    				    UV c = utf8n_to_uvchr((U8*)locinput,
									  UTF8_MAXBYTES, &len,
									  ckWARN(WARN_UTF8) ?
      ######    							  0 : UTF8_ALLOW_ANY);
      ######    				    if (c == (UV)c1 || c == (UV)c2)
      ######    					break;
      ######    				    locinput += len;
      ######    				    count++;
						}
					    }
					}
      285481    			if (locinput > e)
          99    			    sayNO;
					/* PL_reginput == old now */
      285382    			if (locinput != old) {
      192938    			    ln = 1;	/* Did some */
      192938    			    if (regrepeat(scan, count) < count)
         194    				sayNO;
					}
					/* PL_reginput == locinput now */
      285188    			TRYPAREN(paren, ln, locinput);
        1789    			PL_reginput = locinput;	/* Could be reset... */
        1789    			REGCP_UNWIND(lastcp);
					/* Couldn't or didn't -- move forward. */
        1789    			old = locinput;
        1789    			if (do_utf8)
      ######    			    locinput += UTF8SKIP(locinput);
					else
        1789    			    locinput++;
        1789    			count = 1;
				    }
				}
				else
      449803    		while (n >= ln || (n == REG_INFTY && ln > 0)) { /* ln overflow ? */
      449803    		    UV c;
      449803    		    if (c1 != -1000) {
      ######    			if (do_utf8)
      ######    			    c = utf8n_to_uvchr((U8*)PL_reginput,
							       UTF8_MAXBYTES, 0,
							       ckWARN(WARN_UTF8) ?
							       0 : UTF8_ALLOW_ANY);
					else
      ######    			    c = UCHARAT(PL_reginput);
					/* If it could work, try it. */
      ######    		        if (c == (UV)c1 || c == (UV)c2)
				        {
      ######    			    TRYPAREN(paren, ln, PL_reginput);
      ######    			    REGCP_UNWIND(lastcp);
				        }
				    }
				    /* If it could work, try it. */
      449803    		    else if (c1 == -1000)
				    {
      449803    			TRYPAREN(paren, ln, PL_reginput);
      406275    			REGCP_UNWIND(lastcp);
				    }
				    /* Couldn't or didn't -- move forward. */
      406275    		    PL_reginput = locinput;
      406275    		    if (regrepeat(scan, 1)) {
      403288    			ln++;
      403288    			locinput = PL_reginput;
				    }
				    else
    12067371    			sayNO;
				}
			    }
			    else {
    12067371    		CHECKPOINT lastcp;
    12067371    		n = regrepeat(scan, n);
    12067371    		locinput = PL_reginput;
    12067371    		if (ln < n && PL_regkind[(U8)OP(next)] == EOL &&
				    (OP(next) != MEOL ||
					OP(next) == SEOL || OP(next) == EOS))
				{
      383154    		    ln = n;			/* why back off? */
				    /* ...because $ and \Z can match before *and* after
				       newline at the end.  Consider "\n\n" =~ /\n+\Z\n/.
				       We should back off by one in this case. */
      383154    		    if (UCHARAT(PL_reginput - 1) == '\n' && OP(next) != EOS)
       25349    			ln--;
				}
    12067371    		REGCP_SET(lastcp);
    12067371    		if (paren) {
        2343    		    UV c = 0;
        2711    		    while (n >= ln) {
        2445    			if (c1 != -1000) {
         244    			    if (do_utf8)
           3    				c = utf8n_to_uvchr((U8*)PL_reginput,
								   UTF8_MAXBYTES, 0,
								   ckWARN(WARN_UTF8) ?
								   0 : UTF8_ALLOW_ANY);
					    else
         241    				c = UCHARAT(PL_reginput);
					}
					/* If it could work, try it. */
        2445    			if (c1 == -1000 || c == (UV)c1 || c == (UV)c2)
					    {
        2325    				TRYPAREN(paren, n, PL_reginput);
         248    				REGCP_UNWIND(lastcp);
					    }
					/* Couldn't or didn't -- back up. */
         368    			n--;
         368    			PL_reginput = locinput = HOPc(locinput, -1);
				    }
				}
				else {
    12065028    		    UV c = 0;
    32332741    		    while (n >= ln) {
    27088717    			if (c1 != -1000) {
    18877035    			    if (do_utf8)
        1457    				c = utf8n_to_uvchr((U8*)PL_reginput,
								   UTF8_MAXBYTES, 0,
								   ckWARN(WARN_UTF8) ?
								   0 : UTF8_ALLOW_ANY);
					    else
    18875578    				c = UCHARAT(PL_reginput);
					}
					/* If it could work, try it. */
    27088717    			if (c1 == -1000 || c == (UV)c1 || c == (UV)c2)
					    {
     9524742    				TRYPAREN(paren, n, PL_reginput);
     2703738    				REGCP_UNWIND(lastcp);
					    }
					/* Couldn't or didn't -- back up. */
    20267713    			n--;
    20267713    			PL_reginput = locinput = HOPc(locinput, -1);
				    }
				}
			    }
     7384519    	    sayNO;
     7384519    	    break;
			case END:
     7384519    	    if (PL_reg_call_cc) {
        5544    		re_cc_state *cur_call_cc = PL_reg_call_cc;
        5544    		CURCUR *cctmp = PL_regcc;
        5544    		regexp *re = PL_reg_re;
        5544    		CHECKPOINT cp, lastcp;
				
        5544    		cp = regcppush(0);	/* Save *all* the positions. */
        5544    		REGCP_SET(lastcp);
        5544    		regcp_set_to(PL_reg_call_cc->ss); /* Restore parens of
								    the caller. */
        5544    		PL_reginput = locinput;	/* Make position available to
							   the callcc. */
        5544    		cache_re(PL_reg_call_cc->re);
        5544    		PL_regcc = PL_reg_call_cc->cc;
        5544    		PL_reg_call_cc = PL_reg_call_cc->prev;
        5544    		if (regmatch(cur_call_cc->node)) {
        4319    		    PL_reg_call_cc = cur_call_cc;
        4319    		    regcpblow(cp);
        4319    		    sayYES;
				}
        1225    		REGCP_UNWIND(lastcp);
        1225    		regcppop();
        1225    		PL_reg_call_cc = cur_call_cc;
        1225    		PL_regcc = cctmp;
        1225    		PL_reg_re = re;
        1225    		cache_re(re);
		
				DEBUG_EXECUTE_r(
				    PerlIO_printf(Perl_debug_log,
						  "%*s  continuation failed...\n",
						  REPORT_CODE_OFF+PL_regindent*2, "")
        1225    		    );
      ######    		sayNO_SILENT;
			    }
     7378975    	    if (locinput < PL_regtill) {
				DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log,
						      "%sMatch possible, but length=%ld is smaller than requested=%ld, failing!%s\n",
						      PL_colors[4],
						      (long)(locinput - PL_reg_starttry),
						      (long)(PL_regtill - PL_reg_starttry),
      175504    				      PL_colors[5]));
      ######    		sayNO_FINAL;		/* Cannot match: too short. */
			    }
     7203471    	    PL_reginput = locinput;	/* put where regtry can find it */
     7203471    	    sayYES_FINAL;		/* Success! */
			case SUCCEED:
      457133    	    PL_reginput = locinput;	/* put where regtry can find it */
      457133    	    sayYES_LOUD;		/* Success! */
			case SUSPEND:
       12899    	    n = 1;
       12899    	    PL_reginput = locinput;
       12899    	    goto do_ifmatch;	
			case UNLESSM:
      767290    	    n = 0;
      767290    	    if (scan->flags) {
      383454    		s = HOPBACKc(locinput, scan->flags);
      383454    		if (!s)
         729    		    goto say_yes;
      382725    		PL_reginput = s;
			    }
			    else
      383836    		PL_reginput = locinput;
      383836    	    goto do_ifmatch;
			case IFMATCH:
       48763    	    n = 1;
       48763    	    if (scan->flags) {
       31949    		s = HOPBACKc(locinput, scan->flags);
       31949    		if (!s)
        2175    		    goto say_no;
       29774    		PL_reginput = s;
			    }
			    else
       16814    		PL_reginput = locinput;
		
			  do_ifmatch:
      826048    	    inner = NEXTOPER(NEXTOPER(scan));
      826048    	    if (regmatch(inner) != n) {
			      say_no:
      300928    		if (logical) {
          30    		    logical = 0;
          30    		    sw = 0;
          30    		    goto do_longjump;
				}
				else
      528024    		    sayNO;
			    }
			  say_yes:
      528024    	    if (logical) {
          30    		logical = 0;
          30    		sw = 1;
			    }
      528024    	    if (OP(scan) == SUSPEND) {
        6494    		locinput = PL_reginput;
        6494    		nextchr = UCHARAT(locinput);
			    }
			    /* FALL THROUGH. */
			case LONGJMP:
			  do_longjump:
      528072    	    next = scan + ARG(scan);
      528072    	    if (next == scan)
      ######    		next = NULL;
      ######    	    break;
			default:
      ######    	    PerlIO_printf(Perl_error_log, "%"UVxf" %d\n",
					  PTR2UV(scan), OP(scan));
      ######    	    Perl_croak(aTHX_ "regexp memory corruption");
			}
		      reenter:
    34154956    	scan = next;
		    }
		
		    /*
		    * We get here only if there's trouble -- normally "case END" is
		    * the terminating point.
		    */
      ######        Perl_croak(aTHX_ "corrupted regexp pointers");
		    /*NOTREACHED*/
      457133        sayNO;
		
		yes_loud:
		    DEBUG_EXECUTE_r(
			PerlIO_printf(Perl_debug_log,
				      "%*s  %scould match...%s\n",
				      REPORT_CODE_OFF+PL_regindent*2, "", PL_colors[4], PL_colors[5])
      457133    	);
      ######        goto yes;
		yes_final:
		    DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "%sMatch successful!%s\n",
     7203471    			  PL_colors[4], PL_colors[5]));
		yes:
		#ifdef DEBUGGING
    17613253        PL_regindent--;
		#endif
		
		#if 0					/* Breaks $^R */
		    if (unwind)
			regcpblow(firstcp);
		#endif
    17613253        return 1;
		
		no:
		    DEBUG_EXECUTE_r(
			PerlIO_printf(Perl_debug_log,
				      "%*s  %sfailed...%s\n",
				      REPORT_CODE_OFF+PL_regindent*2, "", PL_colors[4], PL_colors[5])
    13791480    	);
		    goto do_no;
		no_final:
		do_no:
    15853523        if (unwind) {
     4513775    	re_unwind_t *uw = SSPTRt(unwind,re_unwind_t);
		
     4513775    	switch (uw->type) {
			case RE_UNWIND_BRANCH:
			case RE_UNWIND_BRANCHJ:
			{
     4513775    	    re_unwind_branch_t *uwb = &(uw->branch);
     4513775    	    const I32 lastparen = uwb->lastparen;
			
     4513775    	    REGCP_UNWIND(uwb->lastcp);
     4528858    	    for (n = *PL_reglastparen; n > lastparen; n--)
       15083    		PL_regendp[n] = -1;
     4513775    	    *PL_reglastparen = n;
     4513775    	    scan = next = uwb->next;
     4513775    	    if ( !scan ||
				 OP(scan) != (uwb->type == RE_UNWIND_BRANCH
					      ? BRANCH : BRANCHJ) ) {		/* Failure */
     1802104    		unwind = uwb->prev;
		#ifdef DEBUGGING
     1802104    		PL_regindent--;
		#endif
     1802104    		goto do_no;
			    }
			    /* Have more choice yet.  Reuse the same uwb.  */
     2711671    	    if ((n = (uwb->type == RE_UNWIND_BRANCH
				      ? NEXT_OFF(next) : ARG(next))))
     2711671    		next += n;
			    else
      ######    		next = NULL;	/* XXXX Needn't unwinding in this case... */
     2711671    	    uwb->next = next;
     2711671    	    next = NEXTOPER(scan);
     2711671    	    if (uwb->type == RE_UNWIND_BRANCHJ)
      552876    		next = NEXTOPER(next);
     2711671    	    locinput = uwb->locinput;
     2711671    	    nextchr = uwb->nextchr;
		#ifdef DEBUGGING
     2711671    	    PL_regindent = uwb->regindent;
		#endif
		
     2711671    	    goto reenter;
			}
			/* NOT REACHED */
			default:
      ######    	    Perl_croak(aTHX_ "regexp unwind memory corruption");
			}
			/* NOT REACHED */
		    }
		#ifdef DEBUGGING
    11339748        PL_regindent--;
		#endif
    11339748        return 0;
		}
		
		/*
		 - regrepeat - repeatedly match something simple, report how many
		 */
		/*
		 * [This routine now assumes that it will only match on things of length 1.
		 * That was true before, but now we assume scan - reginput is the count,
		 * rather than incrementing count on every character.  [Er, except utf8.]]
		 */
		STATIC I32
		S_regrepeat(pTHX_ const regnode *p, I32 max)
    12672339    {
		    dVAR;
    12672339        register char *scan;
    12672339        register I32 c;
    12672339        register char *loceol = PL_regeol;
    12672339        register I32 hardcount = 0;
    12672339        register bool do_utf8 = PL_reg_match_utf8;
		
    12672339        scan = PL_reginput;
    12672339        if (max == REG_INFTY)
    11791681    	max = I32_MAX;
      880658        else if (max < loceol - scan)
      824062          loceol = scan + max;
    12672339        switch (OP(p)) {
		    case REG_ANY:
     1045418    	if (do_utf8) {
          35    	    loceol = PL_regeol;
         965    	    while (scan < loceol && hardcount < max && *scan != '\n') {
         930    		scan += UTF8SKIP(scan);
         930    		hardcount++;
			    }
			} else {
    10879832    	    while (scan < loceol && *scan != '\n')
     9834449    		scan++;
			}
      175461    	break;
		    case SANY:
      175461            if (do_utf8) {
           9    	    loceol = PL_regeol;
          22    	    while (scan < loceol && hardcount < max) {
          13    	        scan += UTF8SKIP(scan);
          13    		hardcount++;
			    }
			}
			else
      175452    	    scan = loceol;
      175452    	break;
		    case CANY:
          11    	scan = loceol;
          11    	break;
		    case EXACT:		/* length of string is 1 */
      566018    	c = (U8)*STRING(p);
      829491    	while (scan < loceol && UCHARAT(scan) == c)
      263473    	    scan++;
        6177    	break;
		    case EXACTF:	/* length of string is 1 */
        6177    	c = (U8)*STRING(p);
        8812    	while (scan < loceol &&
			       (UCHARAT(scan) == c || UCHARAT(scan) == PL_fold[c]))
        2635    	    scan++;
      ######    	break;
		    case EXACTFL:	/* length of string is 1 */
      ######    	PL_reg_flags |= RF_tainted;
      ######    	c = (U8)*STRING(p);
      ######    	while (scan < loceol &&
			       (UCHARAT(scan) == c || UCHARAT(scan) == PL_fold_locale[c]))
      ######    	    scan++;
     5258084    	break;
		    case ANYOF:
     5258084    	if (do_utf8) {
       48521    	    loceol = PL_regeol;
     1609686    	    while (hardcount < max && scan < loceol &&
				   reginclass(p, (U8*)scan, 0, do_utf8)) {
     1561165    		scan += UTF8SKIP(scan);
     1561165    		hardcount++;
			    }
			} else {
    32094273    	    while (scan < loceol && REGINCLASS(p, (U8*)scan))
    26884710    		scan++;
			}
      204146    	break;
		    case ALNUM:
      204146    	if (do_utf8) {
         124    	    loceol = PL_regeol;
         124    	    LOAD_UTF8_CHARCLASS_ALNUM();
         417    	    while (hardcount < max && scan < loceol &&
				   swash_fetch(PL_utf8_alnum, (U8*)scan, do_utf8)) {
         293    		scan += UTF8SKIP(scan);
         293    		hardcount++;
			    }
			} else {
     1438040    	    while (scan < loceol && isALNUM(*scan))
     1234018    		scan++;
			}
         194    	break;
		    case ALNUML:
         194    	PL_reg_flags |= RF_tainted;
         194    	if (do_utf8) {
      ######    	    loceol = PL_regeol;
      ######    	    while (hardcount < max && scan < loceol &&
				   isALNUM_LC_utf8((U8*)scan)) {
      ######    		scan += UTF8SKIP(scan);
      ######    		hardcount++;
			    }
			} else {
       11861    	    while (scan < loceol && isALNUM_LC(*scan))
       11667    		scan++;
			}
         412    	break;
		    case NALNUM:
         412    	if (do_utf8) {
      ######    	    loceol = PL_regeol;
      ######    	    LOAD_UTF8_CHARCLASS_ALNUM();
      ######    	    while (hardcount < max && scan < loceol &&
				   !swash_fetch(PL_utf8_alnum, (U8*)scan, do_utf8)) {
      ######    		scan += UTF8SKIP(scan);
      ######    		hardcount++;
			    }
			} else {
         792    	    while (scan < loceol && !isALNUM(*scan))
         380    		scan++;
			}
      ######    	break;
		    case NALNUML:
      ######    	PL_reg_flags |= RF_tainted;
      ######    	if (do_utf8) {
      ######    	    loceol = PL_regeol;
      ######    	    while (hardcount < max && scan < loceol &&
				   !isALNUM_LC_utf8((U8*)scan)) {
      ######    		scan += UTF8SKIP(scan);
      ######    		hardcount++;
			    }
			} else {
      ######    	    while (scan < loceol && !isALNUM_LC(*scan))
      ######    		scan++;
			}
     3557416    	break;
		    case SPACE:
     3557416    	if (do_utf8) {
          41    	    loceol = PL_regeol;
          41    	    LOAD_UTF8_CHARCLASS_SPACE();
          79    	    while (hardcount < max && scan < loceol &&
				   (*scan == ' ' ||
				    swash_fetch(PL_utf8_space,(U8*)scan, do_utf8))) {
          38    		scan += UTF8SKIP(scan);
          38    		hardcount++;
			    }
			} else {
     5748638    	    while (scan < loceol && isSPACE(*scan))
     2191263    		scan++;
			}
        3073    	break;
		    case SPACEL:
        3073    	PL_reg_flags |= RF_tainted;
        3073    	if (do_utf8) {
      ######    	    loceol = PL_regeol;
      ######    	    while (hardcount < max && scan < loceol &&
				   (*scan == ' ' || isSPACE_LC_utf8((U8*)scan))) {
      ######    		scan += UTF8SKIP(scan);
      ######    		hardcount++;
			    }
			} else {
        5364    	    while (scan < loceol && isSPACE_LC(*scan))
        2291    		scan++;
			}
      845081    	break;
		    case NSPACE:
      845081    	if (do_utf8) {
           7    	    loceol = PL_regeol;
           7    	    LOAD_UTF8_CHARCLASS_SPACE();
          47    	    while (hardcount < max && scan < loceol &&
				   !(*scan == ' ' ||
				     swash_fetch(PL_utf8_space,(U8*)scan, do_utf8))) {
          40    		scan += UTF8SKIP(scan);
          40    		hardcount++;
			    }
			} else {
     5503649    	    while (scan < loceol && !isSPACE(*scan))
     4658575    		scan++;
          10    	    break;
			}
		    case NSPACEL:
          10    	PL_reg_flags |= RF_tainted;
          10    	if (do_utf8) {
           7    	    loceol = PL_regeol;
           7    	    while (hardcount < max && scan < loceol &&
				   !(*scan == ' ' || isSPACE_LC_utf8((U8*)scan))) {
      ######    		scan += UTF8SKIP(scan);
      ######    		hardcount++;
			    }
			} else {
          15    	    while (scan < loceol && !isSPACE_LC(*scan))
          12    		scan++;
			}
     1010835    	break;
		    case DIGIT:
     1010835    	if (do_utf8) {
           1    	    loceol = PL_regeol;
           1    	    LOAD_UTF8_CHARCLASS_DIGIT();
           2    	    while (hardcount < max && scan < loceol &&
				   swash_fetch(PL_utf8_digit, (U8*)scan, do_utf8)) {
           1    		scan += UTF8SKIP(scan);
           1    		hardcount++;
			    }
			} else {
     1575243    	    while (scan < loceol && isDIGIT(*scan))
      564409    		scan++;
			}
           8    	break;
		    case NDIGIT:
           8    	if (do_utf8) {
      ######    	    loceol = PL_regeol;
      ######    	    LOAD_UTF8_CHARCLASS_DIGIT();
      ######    	    while (hardcount < max && scan < loceol &&
				   !swash_fetch(PL_utf8_digit, (U8*)scan, do_utf8)) {
      ######    		scan += UTF8SKIP(scan);
      ######    		hardcount++;
			    }
			} else {
          38    	    while (scan < loceol && !isDIGIT(*scan))
          30    		scan++;
			}
    12672339    	break;
		    default:		/* Called on something of 0 width. */
    12672339    	break;		/* So match right here or not at all. */
		    }
		
    12672339        if (hardcount)
       14151    	c = hardcount;
		    else
    12658188    	c = scan - PL_reginput;
    12672339        PL_reginput = scan;
		
		    DEBUG_r({
			        SV *re_debug_flags = NULL;
				SV *prop = sv_newmortal();
		                GET_RE_DEBUG_FLAGS;
		                DEBUG_EXECUTE_r({
				regprop(prop, p);
				PerlIO_printf(Perl_debug_log,
					      "%*s  %s can match %"IVdf" times out of %"IVdf"...\n",
					      REPORT_CODE_OFF+1, "", SvPVX_const(prop),(IV)c,(IV)max);
			});
    12672339    	});
		
    12672339        return(c);
		}
		
		/*
		 - regrepeat_hard - repeatedly match something, report total lenth and length
		 *
		 * The repeater is supposed to have constant non-zero length.
		 */
		
		STATIC I32
		S_regrepeat_hard(pTHX_ regnode *p, I32 max, I32 *lp)
      264490    {
      264490        register char *scan = Nullch;
      264490        register char *start;
      264490        register char *loceol = PL_regeol;
      264490        I32 l = 0;
      264490        I32 count = 0, res = 1;
		
      264490        if (!max)
      ######    	return 0;
		
      264490        start = PL_reginput;
      264490        if (PL_reg_match_utf8) {
        8031    	while (PL_reginput < loceol && (scan = PL_reginput, res = regmatch(p))) {
        7477    	    if (!count++) {
         259    		l = 0;
         767    		while (start < PL_reginput) {
         508    		    l++;
         508    		    start += UTF8SKIP(start);
				}
         259    		*lp = l;
         259    		if (l == 0)
      ######    		    return max;
			    }
        7477    	    if (count == max)
           7    		return count;
			}
		    }
		    else {
      394007    	while (PL_reginput < loceol && (scan = PL_reginput, res = regmatch(p))) {
      130078    	    if (!count++) {
       16022    		*lp = l = PL_reginput - start;
       16022    		if (max != REG_INFTY && l*max < loceol - scan)
        1532    		    loceol = scan + l*max;
       16022    		if (l == 0)
      ######    		    return max;
			    }
			}
		    }
      264483        if (!res)
      258007    	PL_reginput = scan;
		
      264483        return count;
		}
		
		/*
		- regclass_swash - prepare the utf8 swash
		*/
		
		SV *
		Perl_regclass_swash(pTHX_ register const regnode* node, bool doinit, SV** listsvp, SV **altsvp)
     2442710    {
     2442710        SV *sw  = NULL;
     2442710        SV *si  = NULL;
     2442710        SV *alt = NULL;
		
     2442710        if (PL_regdata && PL_regdata->count) {
     2442710    	const U32 n = ARG(node);
		
     2442710    	if (PL_regdata->what[n] == 's') {
     2442707    	    SV *rv = (SV*)PL_regdata->data[n];
     2442707    	    AV *av = (AV*)SvRV((SV*)rv);
     2442707    	    SV **ary = AvARRAY(av);
     2442707    	    SV **a, **b;
			
			    /* See the end of regcomp.c:S_reglass() for
			     * documentation of these array elements. */
		
     2442707    	    si = *ary;
     2442707    	    a  = SvTYPE(ary[1]) == SVt_RV   ? &ary[1] : 0;
     2442707    	    b  = SvTYPE(ary[2]) == SVt_PVAV ? &ary[2] : 0;
		
     2442707    	    if (a)
     2434459    		sw = *a;
        8248    	    else if (si && doinit) {
        8248    		sw = swash_init("utf8", "", si, 1, 0);
        8248    		(void)av_store(av, 1, sw);
			    }
     2442707    	    if (b)
         212    	        alt = *b;
			}
		    }
			
     2442710        if (listsvp)
      ######    	*listsvp = si;
     2442710        if (altsvp)
     2442710    	*altsvp  = alt;
		
     2442710        return sw;
		}
		
		/*
		 - reginclass - determine if a character falls into a character class
		 
		  The n is the ANYOF regnode, the p is the target string, lenp
		  is pointer to the maximum length of how far to go in the p
		  (if the lenp is zero, UTF8SKIP(p) is used),
		  do_utf8 tells whether the target string is in UTF-8.
		
		 */
		
		STATIC bool
		S_reginclass(pTHX_ register const regnode *n, register const U8* p, STRLEN* lenp, register bool do_utf8)
    10774669    {
		    dVAR;
    10774669        const char flags = ANYOF_FLAGS(n);
    10774669        bool match = FALSE;
    10774669        UV c = *p;
    10774669        STRLEN len = 0;
    10774669        STRLEN plen;
		
    10774669        if (do_utf8 && !UTF8_IS_INVARIANT(c))
     2476337    	 c = utf8n_to_uvchr(p, UTF8_MAXBYTES, &len,
					    ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY);
		
    10774669        plen = lenp ? *lenp : UNISKIP(NATIVE_TO_UNI(c));
    10774669        if (do_utf8 || (flags & ANYOF_UNICODE)) {
     2834425            if (lenp)
       22504    	    *lenp = 0;
     2834425    	if (do_utf8 && !ANYOF_RUNTIME(n)) {
     2814335    	    if (len != (STRLEN)-1 && c < 256 && ANYOF_BITMAP_TEST(n, c))
      330803    		match = TRUE;
			}
     2834425    	if (!match && do_utf8 && (flags & ANYOF_UNICODE_ALL) && c >= 256)
       60912    	    match = TRUE;
     2834425    	if (!match) {
     2442710    	    AV *av;
     2442710    	    SV *sw = regclass_swash(n, TRUE, 0, (SV**)&av);
			
     2442710    	    if (sw) {
     2442707    		if (swash_fetch(sw, p, do_utf8))
     1201878    		    match = TRUE;
     1240829    		else if (flags & ANYOF_FOLD) {
        1116    		    if (!match && lenp && av) {
         103    		        I32 i;
				      
         103    			for (i = 0; i <= av_len(av); i++) {
         103    			    SV* sv = *av_fetch(av, i, FALSE);
         103    			    STRLEN len;
         103    			    const char *s = SvPV_const(sv, len);
					
         103    			    if (len <= plen && memEQ(s, (char*)p, len)) {
         103    			        *lenp = len;
         103    				match = TRUE;
         103    				break;
					    }
					}
				    }
        1116    		    if (!match) {
        1013    		        U8 tmpbuf[UTF8_MAXBYTES_CASE+1];
        1013    			STRLEN tmplen;
		
        1013    		        to_utf8_fold(p, tmpbuf, &tmplen);
        1013    			if (swash_fetch(sw, tmpbuf, do_utf8))
         998    			    match = TRUE;
				    }
				}
			    }
			}
     2834425    	if (match && lenp && *lenp == 0)
       19997    	    *lenp = UNISKIP(NATIVE_TO_UNI(c));
		    }
    10774669        if (!match && c < 256) {
     7959215    	if (ANYOF_BITMAP_TEST(n, c))
     4373287    	    match = TRUE;
     3585928    	else if (flags & ANYOF_FOLD) {
        8253    	    U8 f;
		
        8253    	    if (flags & ANYOF_LOCALE) {
          24    		PL_reg_flags |= RF_tainted;
          24    		f = PL_fold_locale[c];
			    }
			    else
        8229    		f = PL_fold[c];
        8253    	    if (f != c && ANYOF_BITMAP_TEST(n, f))
          96    		match = TRUE;
			}
			
     7959215    	if (!match && (flags & ANYOF_CLASS)) {
      100324    	    PL_reg_flags |= RF_tainted;
      100324    	    if (
				(ANYOF_CLASS_TEST(n, ANYOF_ALNUM)   &&  isALNUM_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_NALNUM)  && !isALNUM_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_SPACE)   &&  isSPACE_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_NSPACE)  && !isSPACE_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_DIGIT)   &&  isDIGIT_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_NDIGIT)  && !isDIGIT_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_ALNUMC)  &&  isALNUMC_LC(c)) ||
				(ANYOF_CLASS_TEST(n, ANYOF_NALNUMC) && !isALNUMC_LC(c)) ||
				(ANYOF_CLASS_TEST(n, ANYOF_ALPHA)   &&  isALPHA_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_NALPHA)  && !isALPHA_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_ASCII)   &&  isASCII(c))     ||
				(ANYOF_CLASS_TEST(n, ANYOF_NASCII)  && !isASCII(c))     ||
				(ANYOF_CLASS_TEST(n, ANYOF_CNTRL)   &&  isCNTRL_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_NCNTRL)  && !isCNTRL_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_GRAPH)   &&  isGRAPH_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_NGRAPH)  && !isGRAPH_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_LOWER)   &&  isLOWER_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_NLOWER)  && !isLOWER_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_PRINT)   &&  isPRINT_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_NPRINT)  && !isPRINT_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_PUNCT)   &&  isPUNCT_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_NPUNCT)  && !isPUNCT_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_UPPER)   &&  isUPPER_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_NUPPER)  && !isUPPER_LC(c))  ||
				(ANYOF_CLASS_TEST(n, ANYOF_XDIGIT)  &&  isXDIGIT(c))    ||
				(ANYOF_CLASS_TEST(n, ANYOF_NXDIGIT) && !isXDIGIT(c))    ||
				(ANYOF_CLASS_TEST(n, ANYOF_PSXSPC)  &&  isPSXSPC(c))    ||
				(ANYOF_CLASS_TEST(n, ANYOF_NPSXSPC) && !isPSXSPC(c))    ||
				(ANYOF_CLASS_TEST(n, ANYOF_BLANK)   &&  isBLANK(c))     ||
				(ANYOF_CLASS_TEST(n, ANYOF_NBLANK)  && !isBLANK(c))
				) /* How's that for a conditional? */
			    {
        5078    		match = TRUE;
			    }
			}
		    }
		
    10774669        return (flags & ANYOF_INVERT) ? !match : match;
		}
		
		STATIC U8 *
		S_reghop(pTHX_ U8 *s, I32 off)
       11803    {
       11803        return S_reghop3(aTHX_ s, off, (U8*)(off >= 0 ? PL_regeol : PL_bostr));
		}
		
		STATIC U8 *
		S_reghop3(pTHX_ U8 *s, I32 off, U8* lim)
       30001    {
       30001        if (off >= 0) {
       19935    	while (off-- && s < lim) {
			    /* XXX could check well-formedness here */
         313    	    s += UTF8SKIP(s);
			}
		    }
		    else {
       30118    	while (off++) {
       19739    	    if (s > lim) {
       19476    		s--;
       19476    		if (UTF8_IS_CONTINUED(*s)) {
       10558    		    while (s > (U8*)lim && UTF8_IS_CONTINUATION(*s))
        6419    			s--;
				}
				/* XXX could check well-formedness here */
			    }
			}
		    }
       30001        return s;
		}
		
		STATIC U8 *
		S_reghopmaybe(pTHX_ U8 *s, I32 off)
           4    {
           4        return S_reghopmaybe3(aTHX_ s, off, (U8*)(off >= 0 ? PL_regeol : PL_bostr));
		}
		
		STATIC U8 *
		S_reghopmaybe3(pTHX_ U8* s, I32 off, U8* lim)
          97    {
          97        if (off >= 0) {
          80    	while (off-- && s < lim) {
			    /* XXX could check well-formedness here */
      ######    	    s += UTF8SKIP(s);
			}
          80    	if (off >= 0)
      ######    	    return 0;
		    }
		    else {
          47    	while (off++) {
          30    	    if (s > lim) {
          30    		s--;
          30    		if (UTF8_IS_CONTINUED(*s)) {
          41    		    while (s > (U8*)lim && UTF8_IS_CONTINUATION(*s))
          23    			s--;
				}
				/* XXX could check well-formedness here */
			    }
			    else
          17    		break;
			}
          17    	if (off <= 0)
      ######    	    return 0;
		    }
          97        return s;
		}
		
		static void
		restore_pos(pTHX_ void *arg)
        7635    {
        7635        PERL_UNUSED_ARG(arg);
        7635        if (PL_reg_eval_set) {
        3816    	if (PL_reg_oldsaved) {
        2460    	    PL_reg_re->subbeg = PL_reg_oldsaved;
        2460    	    PL_reg_re->sublen = PL_reg_oldsavedlen;
		#ifdef PERL_OLD_COPY_ON_WRITE
			    PL_reg_re->saved_copy = PL_nrs;
		#endif
        2460    	    RX_MATCH_COPIED_on(PL_reg_re);
			}
        3816    	PL_reg_magic->mg_len = PL_reg_oldpos;
        3816    	PL_reg_eval_set = 0;
        3816    	PL_curpm = PL_reg_oldcurpm;
		    }	
		}
		
		STATIC void
		S_to_utf8_substr(pTHX_ register regexp *prog)
         140    {
         140        if (prog->float_substr && !prog->float_utf8) {
          11    	SV* sv;
          11    	prog->float_utf8 = sv = newSVsv(prog->float_substr);
          11    	sv_utf8_upgrade(sv);
          11    	if (SvTAIL(prog->float_substr))
           1    	    SvTAIL_on(sv);
          11    	if (prog->float_substr == prog->check_substr)
           5    	    prog->check_utf8 = sv;
		    }
         140        if (prog->anchored_substr && !prog->anchored_utf8) {
         137    	SV* sv;
         137    	prog->anchored_utf8 = sv = newSVsv(prog->anchored_substr);
         137    	sv_utf8_upgrade(sv);
         137    	if (SvTAIL(prog->anchored_substr))
          17    	    SvTAIL_on(sv);
         137    	if (prog->anchored_substr == prog->check_substr)
         132    	    prog->check_utf8 = sv;
		    }
		}
		
		STATIC void
		S_to_byte_substr(pTHX_ register regexp *prog)
          33    {
          33        if (prog->float_utf8 && !prog->float_substr) {
          22    	SV* sv;
          22    	prog->float_substr = sv = newSVsv(prog->float_utf8);
          22    	if (sv_utf8_downgrade(sv, TRUE)) {
          18    	    if (SvTAIL(prog->float_utf8))
      ######    		SvTAIL_on(sv);
			} else {
           4    	    SvREFCNT_dec(sv);
           4    	    prog->float_substr = sv = &PL_sv_undef;
			}
          22    	if (prog->float_utf8 == prog->check_utf8)
          16    	    prog->check_substr = sv;
		    }
          33        if (prog->anchored_utf8 && !prog->anchored_substr) {
          31    	SV* sv;
          31    	prog->anchored_substr = sv = newSVsv(prog->anchored_utf8);
          31    	if (sv_utf8_downgrade(sv, TRUE)) {
          25    	    if (SvTAIL(prog->anchored_utf8))
           1    		SvTAIL_on(sv);
			} else {
           6    	    SvREFCNT_dec(sv);
           6    	    prog->anchored_substr = sv = &PL_sv_undef;
			}
          31    	if (prog->anchored_utf8 == prog->check_utf8)
          17    	    prog->check_substr = sv;
		    }
		}
		
		/*
		 * Local variables:
		 * c-indentation-style: bsd
		 * c-basic-offset: 4
		 * indent-tabs-mode: t
		 * End:
		 *
		 * ex: set ts=8 sts=4 sw=4 noet:
		 */

