unsigned RE_TRANSLATE_TYPE t = (unsigned RE_TRANSLATE_TYPE) preg->translate;
RE_TRANSLATE_TYPE t = preg->translate;
re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,		    eflags)    const regex_t *preg;    const char *string;    int length, start, range, stop, eflags;    size_t nmatch;    regmatch_t pmatch[];{  reg_errcode_t err;  const re_dfa_t *dfa = (const re_dfa_t *) preg->buffer;  int left_lim, right_lim, incr;  int fl_longest_match, match_first, match_kind, match_last = -1;  int extra_nmatch;  int sb, ch;#if defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)  re_match_context_t mctx = { .dfa = dfa };#else  re_match_context_t mctx;#endif  char *fastmap = (preg->fastmap != NULL && preg->fastmap_accurate		   && range && !preg->can_be_null) ? preg->fastmap : NULL;  unsigned RE_TRANSLATE_TYPE t = (unsigned RE_TRANSLATE_TYPE) preg->translate;#if !(defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))  memset (&mctx, '\0', sizeof (re_match_context_t));  mctx.dfa = dfa;#endif  extra_nmatch = (nmatch > preg->re_nsub) ? nmatch - (preg->re_nsub + 1) : 0;  nmatch -= extra_nmatch;  /* Check if the DFA haven't been compiled.  */  if (BE (preg->used == 0 || dfa->init_state == NULL	  || dfa->init_state_word == NULL || dfa->init_state_nl == NULL	  || dfa->init_state_begbuf == NULL, 0))    return REG_NOMATCH;#ifdef DEBUG  /* We assume front-end functions already check them.  */  assert (start + range >= 0 && start + range <= length);#endif  /* If initial states with non-begbuf contexts have no elements,     the regex must be anchored.  If preg->newline_anchor is set,     we'll never use init_state_nl, so do not check it.  */  if (dfa->init_state->nodes.nelem == 0      && dfa->init_state_word->nodes.nelem == 0      && (dfa->init_state_nl->nodes.nelem == 0	  || !preg->newline_anchor))    {      if (start != 0 && start + range != 0)        return REG_NOMATCH;      start = range = 0;    }  /* We must check the longest matching, if nmatch > 0.  */  fl_longest_match = (nmatch != 0 || dfa->nbackref);  err = re_string_allocate (&mctx.input, string, length, dfa->nodes_len + 1,			    preg->translate, preg->syntax & RE_ICASE, dfa);  if (BE (err != REG_NOERROR, 0))    goto free_return;  mctx.input.stop = stop;  mctx.input.raw_stop = stop;  mctx.input.newline_anchor = preg->newline_anchor;  err = match_ctx_init (&mctx, eflags, dfa->nbackref * 2);  if (BE (err != REG_NOERROR, 0))    goto free_return;  /* We will log all the DFA states through which the dfa pass,     if nmatch > 1, or this dfa has "multibyte node", which is a     back-reference or a node which can accept multibyte character or     multi character collating element.  */  if (nmatch > 1 || dfa->has_mb_node)    {      mctx.state_log = re_malloc (re_dfastate_t *, mctx.input.bufs_len + 1);      if (BE (mctx.state_log == NULL, 0))	{	  err = REG_ESPACE;	  goto free_return;	}    }  else    mctx.state_log = NULL;  match_first = start;  mctx.input.tip_context = (eflags & REG_NOTBOL) ? CONTEXT_BEGBUF			   : CONTEXT_NEWLINE | CONTEXT_BEGBUF;  /* Check incrementally whether of not the input string match.  */  incr = (range < 0) ? -1 : 1;  left_lim = (range < 0) ? start + range : start;  right_lim = (range < 0) ? start : start + range;  sb = dfa->mb_cur_max == 1;  match_kind =    (fastmap     ? ((sb || !(preg->syntax & RE_ICASE || t) ? 4 : 0)	| (range >= 0 ? 2 : 0)	| (t != NULL ? 1 : 0))     : 8);  for (;; match_first += incr)    {      err = REG_NOMATCH;      if (match_first < left_lim || right_lim < match_first)	goto free_return;      /* Advance as rapidly as possible through the string, until we	 find a plausible place to start matching.  This may be done	 with varying efficiency, so there are various possibilities:	 only the most common of them are specialized, in order to	 save on code size.  We use a switch statement for speed.  */      switch (match_kind)	{	case 8:	  /* No fastmap.  */	  break;	case 7:	  /* Fastmap with single-byte translation, match forward.  */	  while (BE (match_first < right_lim, 1)		 && !fastmap[t[(unsigned char) string[match_first]]])	    ++match_first;	  goto forward_match_found_start_or_reached_end;	case 6:	  /* Fastmap without translation, match forward.  */	  while (BE (match_first < right_lim, 1)		 && !fastmap[(unsigned char) string[match_first]])	    ++match_first;	forward_match_found_start_or_reached_end:	  if (BE (match_first == right_lim, 0))	    {	      ch = match_first >= length		       ? 0 : (unsigned char) string[match_first];	      if (!fastmap[t ? t[ch] : ch])		goto free_return;	    }	  break;	case 4:	case 5:	  /* Fastmap without multi-byte translation, match backwards.  */	  while (match_first >= left_lim)	    {	      ch = match_first >= length		       ? 0 : (unsigned char) string[match_first];	      if (fastmap[t ? t[ch] : ch])		break;	      --match_first;	    }	  if (match_first < left_lim)	    goto free_return;	  break;	default:	  /* In this case, we can't determine easily the current byte,	     since it might be a component byte of a multibyte	     character.  Then we use the constructed buffer instead.  */	  for (;;)	    {	      /* If MATCH_FIRST is out of the valid range, reconstruct the		 buffers.  */	      unsigned int offset = match_first - mctx.input.raw_mbs_idx;	      if (BE (offset >= (unsigned int) mctx.input.valid_raw_len, 0))		{		  err = re_string_reconstruct (&mctx.input, match_first,					       eflags);		  if (BE (err != REG_NOERROR, 0))		    goto free_return;		  offset = match_first - mctx.input.raw_mbs_idx;		}	      /* If MATCH_FIRST is out of the buffer, leave it as '\0'.		 Note that MATCH_FIRST must not be smaller than 0.  */	      ch = (match_first >= length		    ? 0 : re_string_byte_at (&mctx.input, offset));	      if (fastmap[ch])		break;	      match_first += incr;	      if (match_first < left_lim || match_first > right_lim)	        {	          err = REG_NOMATCH;	          goto free_return;	        }	    }	  break;	}      /* Reconstruct the buffers so that the matcher can assume that	 the matching starts from the beginning of the buffer.  */      err = re_string_reconstruct (&mctx.input, match_first, eflags);      if (BE (err != REG_NOERROR, 0))	goto free_return;#ifdef RE_ENABLE_I18N     /* Don't consider this char as a possible match start if it part,	yet isn't the head, of a multibyte character.  */      if (!sb && !re_string_first_byte (&mctx.input, 0))	continue;#endif      /* It seems to be appropriate one, then use the matcher.  */      /* We assume that the matching starts from 0.  */      mctx.state_log_top = mctx.nbkref_ents = mctx.max_mb_elem_len = 0;      match_last = check_matching (&mctx, fl_longest_match,				   range >= 0 ? &match_first : NULL);      if (match_last != -1)	{	  if (BE (match_last == -2, 0))	    {	      err = REG_ESPACE;	      goto free_return;	    }	  else	    {	      mctx.match_last = match_last;	      if ((!preg->no_sub && nmatch > 1) || dfa->nbackref)		{		  re_dfastate_t *pstate = mctx.state_log[match_last];		  mctx.last_node = check_halt_state_context (&mctx, pstate,							     match_last);		}	      if ((!preg->no_sub && nmatch > 1 && dfa->has_plural_match)		  || dfa->nbackref)		{		  err = prune_impossible_nodes (&mctx);		  if (err == REG_NOERROR)		    break;		  if (BE (err != REG_NOMATCH, 0))		    goto free_return;		  match_last = -1;		}	      else		break; /* We found a match.  */	    }	}      match_ctx_clean (&mctx);    }#ifdef DEBUG  assert (match_last != -1);  assert (err == REG_NOERROR);#endif  /* Set pmatch[] if we need.  */  if (nmatch > 0)    {      int reg_idx;      /* Initialize registers.  */      for (reg_idx = 1; reg_idx < nmatch; ++reg_idx)	pmatch[reg_idx].rm_so = pmatch[reg_idx].rm_eo = -1;      /* Set the points where matching start/end.  */      pmatch[0].rm_so = 0;      pmatch[0].rm_eo = mctx.match_last;      if (!preg->no_sub && nmatch > 1)	{	  err = set_regs (preg, &mctx, nmatch, pmatch,			  dfa->has_plural_match && dfa->nbackref > 0);	  if (BE (err != REG_NOERROR, 0))	    goto free_return;	}      /* At last, add the offset to the each registers, since we slided	 the buffers so that we could assume that the matching starts	 from 0.  */      for (reg_idx = 0; reg_idx < nmatch; ++reg_idx)	if (pmatch[reg_idx].rm_so != -1)	  {#ifdef RE_ENABLE_I18N	    if (BE (mctx.input.offsets_needed != 0, 0))	      {		pmatch[reg_idx].rm_so =		  (pmatch[reg_idx].rm_so == mctx.input.valid_len		   ? mctx.input.valid_raw_len		   : mctx.input.offsets[pmatch[reg_idx].rm_so]);		pmatch[reg_idx].rm_eo =		  (pmatch[reg_idx].rm_eo == mctx.input.valid_len		   ? mctx.input.valid_raw_len		   : mctx.input.offsets[pmatch[reg_idx].rm_eo]);	      }#else	    assert (mctx.input.offsets_needed == 0);#endif	    pmatch[reg_idx].rm_so += match_first;	    pmatch[reg_idx].rm_eo += match_first;	  }      for (reg_idx = 0; reg_idx < extra_nmatch; ++reg_idx)	{	  pmatch[nmatch + reg_idx].rm_so = -1;	  pmatch[nmatch + reg_idx].rm_eo = -1;	}      if (dfa->subexp_map)        for (reg_idx = 0; reg_idx + 1 < nmatch; reg_idx++)          if (dfa->subexp_map[reg_idx] != reg_idx)            {              pmatch[reg_idx + 1].rm_so                = pmatch[dfa->subexp_map[reg_idx] + 1].rm_so;              pmatch[reg_idx + 1].rm_eo                = pmatch[dfa->subexp_map[reg_idx] + 1].rm_eo;            }    } free_return:  re_free (mctx.state_log);  if (dfa->nbackref)    match_ctx_free (&mctx);  re_string_destruct (&mctx.input);  return err;}