// File: /workspace/github_c_makefile_star2_O0/phase[P]o/libregexp/rregexec.c
// Function: rregexec1
static int
rregexec1(Reprog *progp,	/* program to run */
	Rune *bol,		/* string to run machine on */
	Resub *mp,		/* subexpression elements */
	int ms,			/* number of elements at mp */
	Reljunk *j)
{
	int flag=0;
	Reinst *inst;
	Relist *tlp;
	Rune *s;
	int i, checkstart;
	Rune r, *rp, *ep;
	Relist* tl;		/* This list, next list */
	Relist* nl;
	Relist* tle;		/* ends of this and next list */
	Relist* nle;
	int match;
	Rune *p;

	match = 0;
	checkstart = j->startchar;
	if(mp)
		for(i=0; i<ms; i++) {
			mp[i].s.rsp = 0;
			mp[i].e.rep = 0;
		}
	j->relist[0][0].inst = 0;
	j->relist[1][0].inst = 0;

	/* Execute machine once for each character, including terminal NUL */
	s = j->rstarts;
	do{
		/* fast check for first char */
		if(checkstart) {
			switch(j->starttype) {
			case RUNE:
				p = runestrchr(s, j->startchar);
				if(p == 0 || s == j->reol)
					return match;
				s = p;
				break;
			case BOL:
				if(s == bol)
					break;
				p = runestrchr(s, '\n');
				if(p == 0 || s == j->reol)
					return match;
				s = p+1;
				break;
			}
		}

		r = *s;

		/* switch run lists */
		tl = j->relist[flag];
		tle = j->reliste[flag];
		nl = j->relist[flag^=1];
		nle = j->reliste[flag];
		nl->inst = 0;

		/* Add first instruction to current list */
		_rrenewemptythread(tl, progp->startinst, ms, s);

		/* Execute machine until current list is empty */
		for(tlp=tl; tlp->inst; tlp++){
			for(inst=tlp->inst; ; inst = inst->l.next){
				switch(inst->type){
				case RUNE:	/* regular character */
					if(inst->r.r == r)
						if(_renewthread(nl, inst->l.next, ms, &tlp->se)==nle)
							return -1;
					break;
				case LBRA:
					tlp->se.m[inst->r.subid].s.rsp = s;
					continue;
				case RBRA:
					tlp->se.m[inst->r.subid].e.rep = s;
					continue;
				case ANY:
					if(r != '\n')
						if(_renewthread(nl, inst->l.next, ms, &tlp->se)==nle)
							return -1;
					break;
				case ANYNL:
					if(_renewthread(nl, inst->l.next, ms, &tlp->se)==nle)
							return -1;
					break;
				case BOL:
					if(s == bol || *(s-1) == '\n')
						continue;
					break;
				case EOL:
					if(s == j->reol || r == 0 || r == '\n')
						continue;
					break;
				case CCLASS:
					ep = inst->r.cp->end;
					for(rp = inst->r.cp->spans; rp < ep; rp += 2)
						if(r >= rp[0] && r <= rp[1]){
							if(_renewthread(nl, inst->l.next, ms, &tlp->se)==nle)
								return -1;
							break;
						}
					break;
				case NCCLASS:
					ep = inst->r.cp->end;
					for(rp = inst->r.cp->spans; rp < ep; rp += 2)
						if(r >= rp[0] && r <= rp[1])
							break;
					if(rp == ep)
						if(_renewthread(nl, inst->l.next, ms, &tlp->se)==nle)
							return -1;
					break;
				case OR:
					/* evaluate right choice later */
					if(_renewthread(tlp, inst->r.right, ms, &tlp->se) == tle)
						return -1;
					/* efficiency: advance and re-evaluate */
					continue;
				case END:	/* Match! */
					match = 1;
					tlp->se.m[0].e.rep = s;
					if(mp != 0)
						_renewmatch(mp, ms, &tlp->se);
					break;
				}
				break;
			}
		}
		if(s == j->reol)
			break;
		checkstart = j->startchar && nl->inst==0;
		s++;
	}while(r);
	return match;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x94(%rbp)
movq -0x30(%rbp), %rax
movl 0x24(%rax), %eax
movl %eax, -0x58(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xa059
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0xa057
movq -0x20(%rbp), %rax
movslq -0x54(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq $0x0, (%rax)
movq -0x20(%rbp), %rax
movslq -0x54(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq $0x0, 0x8(%rax)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0xa017
jmp 0xa059
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq $0x0, (%rax)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq $0x0, (%rax)
movq -0x30(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x50(%rbp)
cmpl $0x0, -0x58(%rbp)
je 0xa154
movq -0x30(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0xa4(%rbp)
subl $0x7f, %eax
je 0xa0b2
jmp 0xa0a0
movl -0xa4(%rbp), %eax
subl $0xc3, %eax
je 0xa0fc
jmp 0xa152
movq -0x50(%rbp), %rdi
movq -0x30(%rbp), %rax
movl 0x24(%rax), %esi
callq 0xaa90
movq %rax, -0xa0(%rbp)
cmpq $0x0, -0xa0(%rbp)
je 0xa0e1
movq -0x50(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq 0x40(%rcx), %rax
jne 0xa0ef
movl -0x94(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xa610
movq -0xa0(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0xa152
movq -0x50(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0xa108
jmp 0xa152
movq -0x50(%rbp), %rdi
movl $0xa, %esi
callq 0xaa90
movq %rax, -0xa0(%rbp)
cmpq $0x0, -0xa0(%rbp)
je 0xa135
movq -0x50(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq 0x40(%rcx), %rax
jne 0xa143
movl -0x94(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xa610
movq -0xa0(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x50(%rbp)
jmp 0xa154
movq -0x50(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x78(%rbp)
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq 0x10(%rax,%rcx,8), %rax
movq %rax, -0x88(%rbp)
movq -0x30(%rbp), %rax
movl -0x34(%rbp), %ecx
xorl $0x1, %ecx
movl %ecx, -0x34(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x80(%rbp)
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq 0x10(%rax,%rcx,8), %rax
movq %rax, -0x90(%rbp)
movq -0x80(%rbp), %rax
movq $0x0, (%rax)
movq -0x78(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movl -0x24(%rbp), %edx
movq -0x50(%rbp), %rcx
callq 0x7fb0
movq -0x78(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq $0x0, (%rax)
je 0xa5b0
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xa8(%rbp)
subl $0x7f, %eax
je 0xa2c8
jmp 0xa207
movl -0xa8(%rbp), %eax
subl $0x81, %eax
je 0xa32f
jmp 0xa21a
movl -0xa8(%rbp), %eax
subl $0x82, %eax
je 0xa30c
jmp 0xa22d
movl -0xa8(%rbp), %eax
subl $0x83, %eax
je 0xa522
jmp 0xa240
movl -0xa8(%rbp), %eax
subl $0xc0, %eax
je 0xa353
jmp 0xa253
movl -0xa8(%rbp), %eax
subl $0xc1, %eax
je 0xa391
jmp 0xa266
movl -0xa8(%rbp), %eax
subl $0xc3, %eax
je 0xa3c7
jmp 0xa279
movl -0xa8(%rbp), %eax
subl $0xc4, %eax
je 0xa3e5
jmp 0xa28c
movl -0xa8(%rbp), %eax
subl $0xc5, %eax
je 0xa409
jmp 0xa29f
movl -0xa8(%rbp), %eax
subl $0xc6, %eax
je 0xa491
jmp 0xa2b2
movl -0xa8(%rbp), %eax
subl $0xff, %eax
je 0xa555
jmp 0xa588
movq -0x40(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x5c(%rbp), %eax
jne 0xa307
movq -0x80(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rsi
movl -0x24(%rbp), %edx
movq -0x48(%rbp), %rcx
addq $0x8, %rcx
callq 0x7db0
cmpq -0x90(%rbp), %rax
jne 0xa305
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa610
jmp 0xa307
jmp 0xa588
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
addq $0x8, %rax
movq -0x40(%rbp), %rdx
movslq 0x8(%rdx), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
jmp 0xa58a
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
addq $0x8, %rax
movq -0x40(%rbp), %rdx
movslq 0x8(%rdx), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
jmp 0xa58a
cmpl $0xa, -0x5c(%rbp)
je 0xa38c
movq -0x80(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rsi
movl -0x24(%rbp), %edx
movq -0x48(%rbp), %rcx
addq $0x8, %rcx
callq 0x7db0
cmpq -0x90(%rbp), %rax
jne 0xa38a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa610
jmp 0xa38c
jmp 0xa588
movq -0x80(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rsi
movl -0x24(%rbp), %edx
movq -0x48(%rbp), %rcx
addq $0x8, %rcx
callq 0x7db0
cmpq -0x90(%rbp), %rax
jne 0xa3c2
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa610
jmp 0xa588
movq -0x50(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0xa3db
movq -0x50(%rbp), %rax
cmpl $0xa, -0x4(%rax)
jne 0xa3e0
jmp 0xa58a
jmp 0xa588
movq -0x50(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq 0x40(%rcx), %rax
je 0xa3ff
cmpl $0x0, -0x5c(%rbp)
je 0xa3ff
cmpl $0xa, -0x5c(%rbp)
jne 0xa404
jmp 0xa58a
jmp 0xa588
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x8, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x70(%rbp), %rax
jae 0xa48c
movl -0x5c(%rbp), %eax
movq -0x68(%rbp), %rcx
cmpl (%rcx), %eax
jb 0xa47c
movl -0x5c(%rbp), %eax
movq -0x68(%rbp), %rcx
cmpl 0x4(%rcx), %eax
ja 0xa47c
movq -0x80(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rsi
movl -0x24(%rbp), %edx
movq -0x48(%rbp), %rcx
addq $0x8, %rcx
callq 0x7db0
cmpq -0x90(%rbp), %rax
jne 0xa47a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa610
jmp 0xa48c
jmp 0xa47e
movq -0x68(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x68(%rbp)
jmp 0xa428
jmp 0xa588
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x8, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x70(%rbp), %rax
jae 0xa4e3
movl -0x5c(%rbp), %eax
movq -0x68(%rbp), %rcx
cmpl (%rcx), %eax
jb 0xa4d3
movl -0x5c(%rbp), %eax
movq -0x68(%rbp), %rcx
cmpl 0x4(%rcx), %eax
ja 0xa4d3
jmp 0xa4e3
jmp 0xa4d5
movq -0x68(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x68(%rbp)
jmp 0xa4b0
movq -0x68(%rbp), %rax
cmpq -0x70(%rbp), %rax
jne 0xa520
movq -0x80(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rsi
movl -0x24(%rbp), %edx
movq -0x48(%rbp), %rcx
addq $0x8, %rcx
callq 0x7db0
cmpq -0x90(%rbp), %rax
jne 0xa51e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa610
jmp 0xa520
jmp 0xa588
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
movl -0x24(%rbp), %edx
movq -0x48(%rbp), %rcx
addq $0x8, %rcx
callq 0x7db0
cmpq -0x88(%rbp), %rax
jne 0xa553
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa610
jmp 0xa58a
movl $0x1, -0x94(%rbp)
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x10(%rax)
cmpq $0x0, -0x20(%rbp)
je 0xa586
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %esi
movq -0x48(%rbp), %rdx
addq $0x8, %rdx
callq 0x7ca0
jmp 0xa588
jmp 0xa59b
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0xa1f0
jmp 0xa59d
movq -0x48(%rbp), %rax
addq $0x208, %rax            # imm = 0x208
movq %rax, -0x48(%rbp)
jmp 0xa1d7
movq -0x50(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq 0x40(%rcx), %rax
jne 0xa5c0
jmp 0xa607
movq -0x30(%rbp), %rcx
xorl %eax, %eax
cmpl $0x0, 0x24(%rcx)
movb %al, -0xa9(%rbp)
je 0xa5e3
movq -0x80(%rbp), %rax
cmpq $0x0, (%rax)
sete %al
movb %al, -0xa9(%rbp)
movb -0xa9(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x58(%rbp)
movq -0x50(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x50(%rbp)
cmpl $0x0, -0x5c(%rbp)
jne 0xa082
movl -0x94(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)