// File: /workspace/github_cpp_makefile_star2_O3/arnoldrobbins[P]mcilroy-regex/re2.cpp
// Function: regbra(Cenv*)
static Rex*			// bracket expression
regbra(Cenv *env)
{
	Class *r = (Class*)NEW(Class);
	Set set;
	int c, i, neg, last, inrange, init;
	neg = 0;
	if(env->cursor.n>0 && *env->cursor.p=='^') {
		env->cursor.next();
		neg = 1;
	}
	if(env->cursor.n < 2)
		goto error;
	inrange = 0;	// 0=no, 1=possibly, 2=definitely
	for(init=1; ; init=0) {
		if(env->cursor.n <= 0)
			goto error;
		c = *env->cursor.p;
		env->cursor.next();
		if(c == ']') {
			if(init) {
				last = c;
				inrange = 1;
				continue;
			}
			if(inrange != 0)
				set.insert(last);
			if(inrange == 2)
				set.insert('-');
			break;
		} else if(c == '-') {
			if(inrange == 0 && !init)
				goto error;
			if(inrange == 1) {
				inrange = 2;
				continue;
			}
		} else if(c == '[') {
			if(env->cursor.n < 2)
				goto error;
			c = *env->cursor.p;
			switch(c) {
			case ':':
				env->cursor.next();
				if(inrange == 1)
					set.insert(last);
				if(!getcharcl(c, &set, env))
					goto error;
				inrange = 0;
				continue;
			case '=':
				env->cursor.next();
				if(inrange == 2)
					goto error;
				if(inrange == 1)
					set.insert(last);
				i = findcollelem(c, env);
				if(i == -1)
					goto error;
				set.insert(i);
				inrange = 0;
				continue;
			case '.':
				env->cursor.next();
				c = findcollelem(c, env);
				if(c == -1)
					goto error;
				break;
			default:
				c = '[';
			}
		}
		if(inrange == 2) {
			if(last > c)
				goto error;
			for(i=last; i<=c; i++)
				set.insert(i);
			inrange = 0;
		} else if(inrange == 1)
			set.insert(last);
		else
			inrange = 1;
		last = c;
	}
	r->orset(&set);
	r->icase(env->map);
	if(neg)
		r->neg(env->flags);
	return r;
error:
	delete r;
	return ERROR;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %r15
movl $0x40, %edi
callq 0x5170
movq %rax, %rdi
movb $0x7, 0x8(%rax)
movq $0x0, 0x10(%rax)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x18(%rdi)
leaq 0x6b7d(%rip), %rax      # 0x12758
leaq 0x10(%rax), %rcx
movq %rcx, (%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x30(%rdi)
testb $0x4, 0x1(%r15)
jne 0xbbfb
movq %rdi, 0x10(%rsp)
jmp 0xbc0a
callq *0x18(%rax)
xorps %xmm0, %xmm0
movq $0x0, 0x10(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movl 0x10(%r15), %r13d
testl %r13d, %r13d
jle 0xbc40
movq 0x8(%r15), %rax
movb (%rax), %cl
cmpb $0x5e, %cl
movb %cl, 0xf(%rsp)
jne 0xbc3a
incq %rax
movq %rax, 0x8(%r15)
decl %r13d
movl %r13d, 0x10(%r15)
cmpl $0x2, %r13d
jae 0xbc64
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xbc50
movq (%rdi), %rax
callq *0x8(%rax)
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
movb $0x1, %dl
xorl %ebp, %ebp
movq 0x8(%r15), %rcx
movzbl (%rcx), %r12d
leaq 0x1(%rcx), %rdi
leal -0x1(%r13), %esi
movq %rdi, 0x8(%r15)
movl %esi, 0x10(%r15)
cmpl $0x2d, %r12d
je 0xbd9f
cmpl $0x5b, %r12d
je 0xbcb4
cmpl $0x5d, %r12d
jne 0xbe0f
testb $0x1, %al
jne 0xbee8
movl $0x1, %ecx
movl $0x5d, %r12d
jmp 0xbe87
cmpl $0x3, %r13d
jb 0xbc40
movzbl (%rdi), %eax
cmpl $0x2e, %eax
je 0xbde6
cmpl $0x3d, %eax
je 0xbdc7
movl $0x5b, %r12d
cmpl $0x3a, %eax
jne 0xbe0f
addq $0x2, %rcx
movq %rcx, 0x8(%r15)
addl $-0x2, %r13d
movl %r13d, 0x10(%r15)
cmpl $0x1, %ebp
jne 0xbd04
movzbl %bl, %esi
leaq 0x20(%rsp), %rdi
callq 0x833e
movl 0x10(%r15), %r13d
movl $0x8, %r14d
movq %r15, 0x18(%rsp)
movq %r13, 0x50(%rsp)
leaq 0x6fc5(%rip), %rax      # 0x12ce0
movq -0x8(%r14,%rax), %rbp
movq %rbp, %rdi
callq 0x50d0
leal 0x2(%rax), %r15d
subl %r15d, %r13d
jle 0xbd84
movq %rax, %r12
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rax
movslq %r12d, %rdx
movq %rbp, %rdi
movq %rax, %rbp
movq %rax, %rsi
movq %rdx, 0x48(%rsp)
callq 0x50e0
testl %eax, %eax
jne 0xbd84
movq 0x48(%rsp), %rax
cmpb $0x3a, (%rbp,%rax)
jne 0xbd84
shlq $0x20, %r12
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %r12
sarq $0x20, %r12
cmpb $0x5d, (%rbp,%r12)
je 0xbea0
addq $0x10, %r14
cmpq $0xc8, %r14
movq 0x50(%rsp), %r13
jne 0xbd14
jmp 0xbc40
testl %ebp, %ebp
sete %al
xorb $0x1, %dl
testb %dl, %al
jne 0xbc40
movl $0x2d, %r12d
movl $0x2, %ecx
cmpl $0x1, %ebp
jne 0xbe0f
movl %ebx, %r12d
jmp 0xbe83
addq $0x2, %rcx
movq %rcx, 0x8(%r15)
addl $-0x2, %r13d
movl %r13d, 0x10(%r15)
cmpl $0x1, %ebp
je 0xbe4c
cmpl $0x2, %ebp
jne 0xbe59
jmp 0xbc40
addq $0x2, %rcx
movq %rcx, 0x8(%r15)
addl $-0x2, %r13d
movl %r13d, 0x10(%r15)
movl $0x2e, %edi
movq %r15, %rsi
callq 0xbf46
movl %eax, %r12d
cmpl $-0x1, %eax
je 0xbc40
cmpl $0x1, %ebp
je 0xbe41
cmpl $0x2, %ebp
jne 0xbe45
cmpl %r12d, %ebx
jg 0xbc40
leal 0x1(%r12), %ebp
leaq 0x20(%rsp), %r14
movzbl %bl, %esi
movq %r14, %rdi
callq 0x833e
incl %ebx
cmpl %ebx, %ebp
jne 0xbe2c
xorl %ecx, %ecx
jmp 0xbe83
movl %ebx, %eax
jmp 0xbe74
movl $0x1, %ecx
jmp 0xbe83
movzbl %bl, %esi
leaq 0x20(%rsp), %rdi
callq 0x833e
movl $0x3d, %edi
movq %r15, %rsi
callq 0xbf46
cmpl $-0x1, %eax
je 0xbc40
xorl %ebp, %ebp
movl %ebx, %r12d
movzbl %al, %esi
leaq 0x20(%rsp), %rdi
callq 0x833e
movl %ebp, %ecx
movl 0x10(%r15), %esi
movb $0x1, %al
xorl %edx, %edx
movl %esi, %r13d
movl %ecx, %ebp
movl %r12d, %ebx
testl %esi, %esi
jg 0xbc6a
jmp 0xbc40
movslq %r15d, %rax
addq %rax, %rbp
movq 0x18(%rsp), %r15
movq %rbp, 0x8(%r15)
movl %r13d, 0x10(%r15)
leaq 0x6e26(%rip), %rax      # 0x12ce0
movq (%r14,%rax), %r14
xorl %ebp, %ebp
movl %ebp, %edi
callq *%r14
testl %eax, %eax
je 0xbed7
movzbl %bpl, %esi
leaq 0x20(%rsp), %rdi
callq 0x833e
incl %ebp
xorl %ecx, %ecx
cmpl $0x100, %ebp            # imm = 0x100
jne 0xbec0
jmp 0xbdbf
testl %ebp, %ebp
je 0xbf0d
movzbl %bl, %esi
leaq 0x20(%rsp), %rdi
callq 0x833e
cmpl $0x2, %ebp
jne 0xbf0d
leaq 0x20(%rsp), %rdi
movl $0x2d, %esi
callq 0x833e
leaq 0x20(%rsp), %rsi
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x86cc
movq 0x28(%r15), %rsi
movq %rbx, %rdi
callq 0x870c
cmpb $0x5e, 0xf(%rsp)
jne 0xbc52
movl (%r15), %esi
movq %rbx, %rdi
callq 0x86e0
jmp 0xbc52