/* Generated by re2c */
// re2c $INPUT -o $OUTPUT -i --tags

// See bug https://github.com/skvadrik/re2c/issues/523
// Tags on all transitions going to bitmap state must be equal.
// Run as `./tags_with_bitmaps ' "aa"'`, expected output is `aa`
// (trimmed quotes ans leading whitespace).

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int match_quoted(const char *s, const char **mbegin, const char **mend) {
    const char *YYCURSOR = s, *YYMARKER = s;

    const char *t1, *t2, *yyt1, *yyt2;
    
{
	char yych;
	unsigned int yyaccept = 0;
	yych = *YYCURSOR;
	switch (yych) {
		case ' ': goto yy3;
		case '"': goto yy4;
		default: goto yy1;
	}
yy1:
	++YYCURSOR;
yy2:
	{ *mbegin = s; *mend = strchr(s, '\0'); return 0; }
yy3:
	yyaccept = 0;
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
		case ' ': goto yy5;
		case '"': goto yy7;
		default: goto yy2;
	}
yy4:
	yyaccept = 0;
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
		case 0x00: goto yy2;
		case '"':
			yyt1 = YYCURSOR;
			yyt2 = YYCURSOR;
			goto yy9;
		default:
			yyt1 = YYCURSOR;
			goto yy8;
	}
yy5:
	yych = *++YYCURSOR;
	switch (yych) {
		case ' ': goto yy5;
		case '"': goto yy7;
		default: goto yy6;
	}
yy6:
	YYCURSOR = YYMARKER;
	if (yyaccept == 0) goto yy2;
	else goto yy10;
yy7:
	yych = *++YYCURSOR;
	switch (yych) {
		case 0x00: goto yy6;
		case '"':
			yyt1 = YYCURSOR;
			yyt2 = YYCURSOR;
			goto yy9;
		default:
			yyt1 = YYCURSOR;
			goto yy8;
	}
yy8:
	yych = *++YYCURSOR;
	switch (yych) {
		case 0x00: goto yy6;
		case '"':
			yyt2 = YYCURSOR;
			goto yy9;
		default: goto yy8;
	}
yy9:
	yyaccept = 1;
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
		case 0x00: goto yy10;
		case ' ': goto yy9;
		case '"':
			yyt2 = YYCURSOR;
			goto yy9;
		default: goto yy8;
	}
yy10:
	t1 = yyt1;
	t2 = yyt2;
	{ *mbegin = t1; *mend = t2; return 1; }
}

}

int main(int argc, char *argv[]) {
    if (argc != 2) {
        printf("USAGE: %s <STRING_WITH_OR_WITHOUT_DOUBLE_QUOTES>\n", argv[0]);
        return EXIT_FAILURE;
    }

    const char *begin, *end;
    match_quoted(argv[1], &begin, &end);
    printf("%.*s\n", (int)(end - begin), begin);
    return EXIT_SUCCESS;
}
tags/tags_with_bitmaps.re:24:17: warning: tag `t2` has 2nd degree of nondeterminism [-Wnondeterministic-tags]
