// File: 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
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x10(%rbp)
leaq -0xa0(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
xorl %edx, %edx
callq 0xbd40
movq -0x10(%rbp), %rdi
callq 0xe7c0
movl %eax, -0x2c(%rbp)
cmpl $0x100, -0x2c(%rbp)     # imm = 0x100
jg 0xea15
movl -0xa8(%rbp), %eax
cmpq $0x64, %rax
jb 0xea17
jmp 0xea4b
movl -0x2c(%rbp), %eax
movb %al, %dl
movq -0xb0(%rbp), %rax
movl -0xa8(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0xa8(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rdi
callq 0x10610
movl -0x2c(%rbp), %eax
movb %al, -0x31(%rbp)
jmp 0xe9f4
cmpl $0x104, -0x2c(%rbp)     # imm = 0x104
jne 0xea64
movq 0x9ab5(%rip), %rax      # 0x18510
movq %rax, -0x8(%rbp)
jmp 0xf2d5
cmpl $0x0, -0xa8(%rbp)
jle 0xede1
movl -0x2c(%rbp), %eax
movl %eax, -0x114(%rbp)
addl $0xfffffefa, %eax       # imm = 0xFFFFFEFA
subl $0x3, %eax
jb 0xeaa8
jmp 0xea86
movl -0x114(%rbp), %eax
subl $0x10b, %eax            # imm = 0x10B
je 0xeaa8
jmp 0xea95
movl -0x114(%rbp), %eax
subl $0x110, %eax            # imm = 0x110
jne 0xecff
jmp 0xeaa8
movl -0xa8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xa8(%rbp)
cmpl $0x0, -0xa8(%rbp)
jge 0xead0
movq 0x9a49(%rip), %rax      # 0x18510
movq %rax, -0x8(%rbp)
jmp 0xf2d5
cmpl $0x0, -0xa8(%rbp)
jne 0xeb38
movl $0x18, %edi
callq 0x51a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x120(%rbp)
callq 0x10700
jmp 0xeaf7
movq -0x120(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xd030
movq %rax, -0x18(%rbp)
jmp 0xec04
movq -0x120(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
movl $0x18, %esi
callq 0x51b0
jmp 0xf2e2
leaq -0xb0(%rbp), %rdi
callq 0x9330
movl %edx, -0xd8(%rbp)
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0xd0(%rbp)
movl -0xd8(%rbp), %eax
movl %eax, -0xc8(%rbp)
cmpq $0x0, -0xd0(%rbp)
jne 0xeb85
movq 0x9994(%rip), %rax      # 0x18510
movq %rax, -0x8(%rbp)
jmp 0xf2d5
movl $0x28, %edi
callq 0x51a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x128(%rbp)
movups -0xd0(%rbp), %xmm0
movaps %xmm0, -0xf0(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rcx
movq -0xf0(%rbp), %rsi
movl -0xe8(%rbp), %edx
callq 0x9bb0
jmp 0xebc6
movq -0x128(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xd030
movq %rax, -0x18(%rbp)
jmp 0xec04
movq -0x128(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
movl $0x28, %esi
callq 0x51b0
jmp 0xf2e2
movl $0x28, %edi
callq 0x51a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x130(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movzbl -0x31(%rbp), %ecx
movzbl (%rax,%rcx), %esi
movl $0x1, %ecx
movl %ecx, %edx
callq 0x10740
jmp 0xec39
movq -0x130(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xd030
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rcx
xorl %edx, %edx
movl %edx, %esi
callq 0xf2f0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq 0x98a3(%rip), %rax      # 0x18510
jne 0xecc2
movq -0x18(%rbp), %rax
movq %rax, -0x138(%rbp)
cmpq $0x0, %rax
je 0xec8d
movq -0x138(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xf2d5
movq -0x130(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
movl $0x28, %esi
callq 0x51b0
jmp 0xf2e2
movq -0x10(%rbp), %rdi
callq 0xe9d0
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xf670
movq -0x140(%rbp), %rdi
movq %rax, %rsi
callq 0xf670
movq %rax, -0x8(%rbp)
jmp 0xf2d5
movl $0x28, %edi
callq 0x51a0
movq %rax, -0x158(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x9330
movl %edx, -0x14c(%rbp)
movq %rax, -0x148(%rbp)
jmp 0xed2b
movq -0x158(%rbp), %rdi
movl -0x14c(%rbp), %eax
movq -0x148(%rbp), %rcx
movq %rcx, -0x110(%rbp)
movl %eax, -0x108(%rbp)
movl -0x108(%rbp), %eax
movl %eax, -0xf8(%rbp)
movq -0x110(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rcx
movq -0x100(%rbp), %rsi
movl -0xf8(%rbp), %edx
callq 0x9bb0
jmp 0xed82
movq -0x158(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xd030
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0xe9d0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xf670
movq %rax, -0x8(%rbp)
jmp 0xf2d5
movq -0x158(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
movl $0x28, %esi
callq 0x51b0
jmp 0xf2e2
cmpl $0x200, -0x2c(%rbp)     # imm = 0x200
jle 0xeeb7
movq -0x10(%rbp), %rdi
callq 0x10610
movl -0x2c(%rbp), %eax
subl $0x200, %eax            # imm = 0x200
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x30(%rcx), %eax
jg 0xee20
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movzbl 0x3b(%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0xee30
movq 0x96e9(%rip), %rax      # 0x18510
movq %rax, -0x8(%rbp)
jmp 0xf2d5
movb -0x2c(%rbp), %sil
movq -0x10(%rbp), %rax
movl 0x38(%rax), %ecx
movb %sil, %dl
btsl %edx, %ecx
movw %cx, 0x38(%rax)
movl $0x20, %edi
callq 0x51a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x160(%rbp)
movl -0x2c(%rbp), %esi
callq 0x10790
jmp 0xee66
movq -0x160(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xd030
movq %rax, %rdi
movq -0x10(%rbp), %rcx
xorl %edx, %edx
movl %edx, %esi
callq 0xf2f0
movq %rax, -0x18(%rbp)
jmp 0xf28d
movq -0x160(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
movl $0x20, %esi
callq 0x51b0
jmp 0xf2e2
movl -0x2c(%rbp), %eax
addl $0xfffffeff, %eax       # imm = 0xFFFFFEFF
movl %eax, %ecx
movq %rcx, -0x168(%rbp)
subl $0xe, %eax
ja 0xf27e
movq -0x168(%rbp), %rax
leaq 0x2815(%rip), %rcx      # 0x116f4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x18, %edi
callq 0x51a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x170(%rbp)
callq 0x10700
jmp 0xef06
movq -0x170(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xd030
movq %rax, -0x8(%rbp)
jmp 0xf2d5
movq -0x170(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
movl $0x18, %esi
callq 0x51b0
jmp 0xf2e2
movq -0x10(%rbp), %rdi
callq 0x10610
movl $0x18, %edi
callq 0x51a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x178(%rbp)
callq 0x107d0
jmp 0xef6e
movq -0x178(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xd030
movq %rax, %rdi
movq -0x10(%rbp), %rcx
xorl %edx, %edx
movl %edx, %esi
callq 0xf2f0
movq %rax, -0x18(%rbp)
jmp 0xf28b
movq -0x178(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
movl $0x18, %esi
callq 0x51b0
jmp 0xf2e2
movq -0x10(%rbp), %rdi
callq 0x10610
movl $0x18, %edi
callq 0x51a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x180(%rbp)
callq 0x10810
jmp 0xefe6
movq -0x180(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xd030
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xf047
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rcx
xorl %edx, %edx
movl %edx, %esi
callq 0xf2f0
movq %rax, -0x18(%rbp)
jmp 0xf047
movq -0x180(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
movl $0x18, %esi
callq 0x51b0
jmp 0xf2e2
jmp 0xf28b
movq -0x10(%rbp), %rdi
callq 0x10610
movq -0x10(%rbp), %rax
movl 0x34(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x34(%rax)
movq -0x10(%rbp), %rcx
movl 0x30(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x30(%rcx)
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %edi
addl $0x1, %edi
movq -0x10(%rbp), %rsi
callq 0xdeb0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq 0x9480(%rip), %rax      # 0x18510
jne 0xf097
jmp 0xf28b
movq -0x18(%rbp), %rax
movzbl 0x8(%rax), %eax
cmpl $0x0, %eax
jne 0xf0e0
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xf0e0
movq -0x18(%rbp), %rax
movq %rax, -0x188(%rbp)
cmpq $0x0, %rax
je 0xf0d0
movq -0x188(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x9439(%rip), %rax      # 0x18510
movq %rax, -0x8(%rbp)
jmp 0xf2d5
movq -0x10(%rbp), %rdi
callq 0xe7c0
cmpl $0x10a, %eax            # imm = 0x10A
je 0xf11e
movq -0x18(%rbp), %rax
movq %rax, -0x190(%rbp)
cmpq $0x0, %rax
je 0xf10e
movq -0x190(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x93fb(%rip), %rax      # 0x18510
movq %rax, -0x8(%rbp)
jmp 0xf2d5
movq -0x10(%rbp), %rax
movl 0x34(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x34(%rax)
movq -0x10(%rbp), %rdi
callq 0x10610
cmpl $0x9, -0x30(%rbp)
jg 0xf147
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
movb $0x1, 0x3b(%rax,%rcx)
movl $0x28, %edi
callq 0x51a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x198(%rbp)
movl -0x30(%rbp), %esi
movq -0x18(%rbp), %rdx
callq 0x10850
jmp 0xf16c
movq -0x198(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xd030
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq 0x9385(%rip), %rax      # 0x18510
jne 0xf1ba
jmp 0xf28b
movq -0x198(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
movl $0x28, %esi
callq 0x51b0
jmp 0xf2e2
movq -0x18(%rbp), %rdi
movl -0x30(%rbp), %esi
movq -0x10(%rbp), %rax
movl 0x30(%rax), %edx
movq -0x10(%rbp), %rcx
callq 0xf2f0
movq %rax, -0x18(%rbp)
jmp 0xf28b
movq -0x10(%rbp), %rdi
callq 0x10610
movq -0x10(%rbp), %rdi
callq 0xf820
movq %rax, %rdi
movq -0x10(%rbp), %rcx
xorl %edx, %edx
movl %edx, %esi
callq 0xf2f0
movq %rax, -0x18(%rbp)
jmp 0xf28b
movq -0x10(%rbp), %rdi
callq 0x10610
movl $0x20, %edi
callq 0x51a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x1a0(%rbp)
movl $0x1, %edx
movl %edx, %esi
callq 0x108a0
jmp 0xf233
movq -0x1a0(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xd030
movq %rax, %rdi
movq -0x10(%rbp), %rcx
xorl %edx, %edx
movl %edx, %esi
callq 0xf2f0
movq %rax, -0x18(%rbp)
jmp 0xf28b
movq -0x1a0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
movl $0x20, %esi
callq 0x51b0
jmp 0xf2e2
movq 0x928b(%rip), %rax      # 0x18510
movq %rax, -0x8(%rbp)
jmp 0xf2d5
jmp 0xf28d
jmp 0xf28f
movq -0x18(%rbp), %rax
cmpq 0x9276(%rip), %rax      # 0x18510
je 0xf2cd
movq -0x10(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jle 0xf2cd
movq -0x18(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq -0x10(%rbp), %rdi
callq 0xe9d0
movq -0x1a8(%rbp), %rdi
movq %rax, %rsi
callq 0xf670
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
movq -0xb8(%rbp), %rdi
callq 0x52d0
nop