// File: /workspace/github_cpp_makefile_star2_O3/arnoldrobbins[P]mcilroy-regex/re2.cpp
// Function: regSeq(Cenv*)
static Rex *
regSeq(Cenv *env)
{
	Rex *e, *f, *g;
	int c, parno;
	uchar ch;
	uchar data[101];
	if(cdebug)
		printf("regSeq %lx.%d parno=%d\n",
			(unsigned long)env->cursor.p, env->cursor.n, env->parno);
	Seg string(data, 0);
	for( ;  ; ch = c) {	// get string
		c = token(env);
		if(c>T_META || (unsigned)string.n>=sizeof(data)-1)
			break;
		string.p[string.n++] = c;
		eat(env);
	}
	if(c == T_BAD)
		return ERROR;
	if(string.n > 0) switch(c) {
	case T_STAR:
	case T_PLUS:
	case T_LEFT:
	case T_QUES:
	case T_BANG:
		string.n--;
		if(string.n < 0)
			return ERROR;
		if(string.n == 0)
			e = NEW(Ok);
		else {
			Seg copy = string.copy();
			if(copy.p == 0)
				return ERROR;
			e = NEW(String(copy, env->map));
		}
		f = NEW(Onechar(env->map[ch]));
		f = regRep(f, 0, 0, env);
		if(f == ERROR) {
			delete e;
			return f;
		}
		g = regSeq(env);
		return mkSeq(e, mkSeq(f, g));
	default:
		e = NEW(String(string.copy(), env->map));
		f = regSeq(env);
		return mkSeq(e, f);
	} else if(c > T_BACK) {
		eat(env);
		c -= T_BACK;
		if(c>env->parno || env->paren[c] == 0)
			return ERROR;
		env->backref |= 1<<c;
		e = regRep(NEW(Back(c)), 0, 0, env);
	} else switch(c) {
	case T_AND:
	case T_CLOSE:
	case T_BAR:
	case T_END:
		return NEW(Ok);
	case T_DOLL:
		eat(env);
		e = regRep(NEW(End), 0, 0, env);
		break;
	case T_CFLX:
		eat(env);
		e = NEW(Anchor);
		if(env->flags&REG_EXTENDED)
			e = regRep(e, 0, 0, env);
		break;
	case T_OPEN:
		eat(env);
		++env->parnest;
		parno = ++env->parno;
		e = regAlt(parno+1, env);
		if(e == ERROR)
			break;
		if(e->type==OK && env->flags&REG_EXTENDED) {
			delete e;
			return ERROR;
		} 
		if(token(env) != T_CLOSE) {
			delete e;
			return ERROR;
		}
		--env->parnest;
		eat(env);
		if(parno <= BACK_REF_MAX)
			env->paren[parno] = 1;
		e = NEW(Subexp(parno, e));
		if(e == ERROR)
			break;
		e = regRep(e, parno, env->parno, env);
		break;
	case T_BRA:
		eat(env);
		e = regRep(regbra(env), 0, 0, env);
		break;
	case T_DOT:
		eat(env);
		e = regRep(NEW(Dot), 0, 0, env);
		break;
	default:
		return ERROR;
	}
	if(e != ERROR && env->cursor.n > 0)
		e = mkSeq(e, regSeq(env));
	return e;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
leaq 0x20(%rsp), %rax
movq %rax, (%rsp)
movl $0x0, 0x8(%rsp)
callq 0xb15e
movl %eax, %r15d
cmpl $0x100, %eax            # imm = 0x100
jle 0xb354
cmpl $0x104, %r15d           # imm = 0x104
je 0xb7cf
cmpl $0x201, %r15d           # imm = 0x201
jb 0xb4c4
movq 0x8(%rbx), %rax
xorl %ecx, %ecx
cmpb $0x5c, (%rax)
sete %cl
addq %rcx, %rax
incq %rax
movq %rax, 0x8(%rbx)
notl %ecx
addl %ecx, 0x10(%rbx)
addl $0xfffffe00, %r15d      # imm = 0xFFFFFE00
cmpl 0x30(%rbx), %r15d
jg 0xb7cf
movl %r15d, %eax
cmpb $0x0, 0x3b(%rbx,%rax)
je 0xb7cf
movl $0x1, %eax
movl %r15d, %ecx
shll %cl, %eax
orw %ax, 0x38(%rbx)
movl $0x20, %edi
callq 0x5170
movq %rax, %r14
movb $0x8, 0x8(%rax)
movq $0x0, 0x10(%rax)
leaq 0x77ea(%rip), %rax      # 0x12b10
movq %rax, (%r14)
movl %r15d, 0x18(%r14)
testb $0x4, 0x1(%rbx)
je 0xb70a
movq %r14, %rdi
callq 0x9bcc
movl $0x20, %esi
movq %r14, %rdi
callq 0x5180
xorl %r14d, %r14d
jmp 0xb70a
xorl %r14d, %r14d
movl %r15d, %r12d
movq %r14, %r13
incq %r14
movl %r14d, 0x8(%rsp)
movb %r12b, 0x20(%rsp,%r13)
movq 0x8(%rbx), %rax
xorl %ecx, %ecx
cmpb $0x5c, (%rax)
sete %cl
addq %rcx, %rax
incq %rax
movq %rax, 0x8(%rbx)
notl %ecx
addl %ecx, 0x10(%rbx)
movq %rbx, %rdi
callq 0xb15e
movl %eax, %r15d
cmpq $0x62, %r13
ja 0xb39f
cmpl $0x101, %r15d           # imm = 0x101
jl 0xb357
addl $0xfffffefc, %r15d      # imm = 0xFFFFFEFC
cmpl $0xc, %r15d
ja 0xb544
movl $0x109c, %eax           # imm = 0x109C
btl %r15d, %eax
jae 0xb53b
leal -0x1(%r14), %eax
movl %eax, 0x8(%rsp)
cmpq $0x1, %r14
jne 0xb400
movl $0x18, %edi
callq 0x5170
movq %rax, %r14
movb $0x0, 0x8(%rax)
movq $0x0, 0x10(%rax)
leaq 0x722b(%rip), %rax      # 0x12618
leaq 0x10(%rax), %rcx
movq %rcx, (%r14)
testb $0x4, 0x1(%rbx)
je 0xb449
addq $0x18, %rax
jmp 0xb441
movq %rsp, %rdi
callq 0x8304
testq %rax, %rax
je 0xb7cf
movq %rax, %r15
movl %edx, %ebp
movl $0x28, %edi
callq 0x5170
movq %rax, %r14
movq 0x28(%rbx), %rcx
movq %rax, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x877a
testb $0x4, 0x1(%rbx)
je 0xb449
movq (%r14), %rax
addq $0x8, %rax
movq %r14, %rdi
callq *(%rax)
xorl %r14d, %r14d
movzbl %r12b, %r15d
movl $0x28, %edi
callq 0x5170
movq %rax, %rdi
movq 0x28(%rbx), %rax
movb (%rax,%r15), %cl
movb $0x4, 0x8(%rdi)
movq $0x0, 0x10(%rdi)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x18(%rdi)
leaq 0x7325(%rip), %rax      # 0x127a8
leaq 0x10(%rax), %rdx
movq %rdx, (%rdi)
movb %cl, 0x20(%rdi)
testb $0x4, 0x1(%rbx)
je 0xb498
callq *0x18(%rax)
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
movq %rbx, %rcx
callq 0xb801
testq %rax, %rax
je 0xb524
movq %rax, %r15
movq %rbx, %rdi
callq 0xb26c
movq %r15, %rdi
movq %rax, %rsi
callq 0xbaf2
jmp 0xb7b7
xorl %r14d, %r14d
addl $0xfffffeff, %r15d      # imm = 0xFFFFFEFF
cmpl $0xe, %r15d
ja 0xb7d2
leaq 0x1ff9(%rip), %rax      # 0xd4d8
movslq (%rax,%r15,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl $0x18, %edi
callq 0x5170
movq %rax, %r14
movb $0x0, 0x8(%rax)
movq $0x0, 0x10(%rax)
leaq 0x7110(%rip), %rax      # 0x12618
leaq 0x10(%rax), %rcx
movq %rcx, (%r14)
testb $0x4, 0x1(%rbx)
je 0xb7d2
movq %r14, %rdi
callq *0x18(%rax)
jmp 0xb7cf
testq %r14, %r14
je 0xb7cf
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
jmp 0xb7cf
testl %r15d, %r15d
je 0xb7cf
movl $0x28, %edi
callq 0x5170
movq %rax, %r14
movq %rsp, %rdi
callq 0x8304
movq 0x28(%rbx), %rcx
movq %r14, %rdi
movq %rax, %rsi
callq 0x877a
testb $0x4, 0x1(%rbx)
je 0xb7af
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
xorl %r14d, %r14d
jmp 0xb7af
movq 0x8(%rbx), %rax
xorl %ecx, %ecx
cmpb $0x5c, (%rax)
sete %cl
addq %rcx, %rax
incq %rax
movq %rax, 0x8(%rbx)
notl %ecx
addl %ecx, 0x10(%rbx)
movl $0x18, %edi
callq 0x5170
movq %rax, %rdi
movb $0x2, 0x8(%rax)
movq $0x0, 0x10(%rax)
leaq 0x70fa(%rip), %rax      # 0x126b8
jmp 0xb75b
movq 0x8(%rbx), %rax
movq 0x30(%rbx), %r15
xorl %ecx, %ecx
cmpb $0x5c, (%rax)
sete %cl
addq %rcx, %rax
incq %rax
movq %rax, 0x8(%rbx)
notl %ecx
addl %ecx, 0x10(%rbx)
movq %r15, %xmm1
pcmpeqd %xmm0, %xmm0
psubd %xmm0, %xmm1
movdqa %xmm1, 0x10(%rsp)
movq %xmm1, 0x30(%rbx)
leal 0x2(%r15), %edi
movq %rbx, %rsi
callq 0xad80
testq %rax, %rax
je 0xb7cf
movq %rax, %r14
cmpb $0x0, 0x8(%rax)
jne 0xb621
testb $0x1, (%rbx)
jne 0xb52d
movq %rbx, %rdi
callq 0xb15e
cmpl $0x10a, %eax            # imm = 0x10A
jne 0xb52d
decl 0x34(%rbx)
movq 0x8(%rbx), %rax
xorl %ecx, %ecx
cmpb $0x5c, (%rax)
sete %cl
addq %rcx, %rax
incq %rax
movq %rax, 0x8(%rbx)
notl %ecx
addl %ecx, 0x10(%rbx)
movdqa 0x10(%rsp), %xmm0
movd %xmm0, %ebp
cmpl $0x8, %r15d
jg 0xb66a
movslq %ebp, %rax
movb $0x1, 0x3b(%rbx,%rax)
movl $0x28, %edi
callq 0x5170
movb $0x9, 0x8(%rax)
movq $0x0, 0x10(%rax)
leaq 0x74d9(%rip), %rcx      # 0x12b60
movq %rcx, (%rax)
movw %bp, 0x18(%rax)
movb $0x0, 0x1a(%rax)
movq %r14, 0x20(%rax)
testb $0x4, 0x1(%rbx)
jne 0xb7c7
movl 0x30(%rbx), %edx
movq %rax, %rdi
movl %ebp, %esi
jmp 0xb799
movq 0x8(%rbx), %rax
xorl %ecx, %ecx
cmpb $0x5c, (%rax)
sete %cl
addq %rcx, %rax
incq %rax
movq %rax, 0x8(%rbx)
notl %ecx
addl %ecx, 0x10(%rbx)
movl $0x18, %edi
callq 0x5170
movq %rax, %r14
movb $0x1, 0x8(%rax)
movq $0x0, 0x10(%rax)
leaq 0x6f80(%rip), %rcx      # 0x12668
leaq 0x10(%rcx), %rax
movq %rax, (%r14)
movl (%rbx), %eax
btl $0xa, %eax
jae 0xb702
movq %r14, %rdi
callq *0x18(%rcx)
movl (%rbx), %eax
xorl %r14d, %r14d
testb $0x1, %al
je 0xb7a4
movq %r14, %rdi
jmp 0xb795
movq 0x8(%rbx), %rax
xorl %ecx, %ecx
cmpb $0x5c, (%rax)
sete %cl
addq %rcx, %rax
incq %rax
movq %rax, 0x8(%rbx)
notl %ecx
addl %ecx, 0x10(%rbx)
movl $0x20, %edi
callq 0x5170
movq %rax, %rdi
movb $0x3, 0x8(%rax)
movq $0x0, 0x10(%rax)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x18(%rdi)
leaq 0x6fad(%rip), %rax      # 0x12708
leaq 0x10(%rax), %rcx
movq %rcx, (%rdi)
testb $0x4, 0x1(%rbx)
je 0xb795
callq *0x18(%rax)
xorl %edi, %edi
jmp 0xb795
movq 0x8(%rbx), %rax
xorl %ecx, %ecx
cmpb $0x5c, (%rax)
sete %cl
addq %rcx, %rax
incq %rax
movq %rax, 0x8(%rbx)
notl %ecx
addl %ecx, 0x10(%rbx)
movq %rbx, %rdi
callq 0xbb9c
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %rbx, %rcx
callq 0xb801
movq %rax, %r14
testq %r14, %r14
je 0xb7cf
cmpl $0x0, 0x10(%rbx)
jle 0xb7d2
movq %rbx, %rdi
callq 0xb26c
movq %r14, %rdi
movq %rax, %rsi
callq 0xbaf2
movq %rax, %r14
jmp 0xb7d2
movq %rax, %rdi
callq 0xc1ea
xorl %r14d, %r14d
movq %r14, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb7e9
movq %rax, %rbx
movl $0x28, %esi
movq %r14, %rdi
callq 0x5180
movq %rbx, %rdi
callq 0x52b0