// File: /workspace/github_c_makefile_star2_O0/phase[P]o/libregexp/regexec.c
// Function: regexec1
static int
regexec1(Reprog *progp,	/* program to run */
	char *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;
	char *s;
	int i, checkstart;
	Rune r, *rp, *ep;
	int n;
	Relist* tl;		/* This list, next list */
	Relist* nl;
	Relist* tle;		/* ends of this and next list */
	Relist* nle;
	int match;
	char *p;

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

	/* Execute machine once for each character, including terminal NUL */
	s = j->starts;
	do{
		/* fast check for first char */
		if(checkstart) {
			switch(j->starttype) {
			case RUNE:
				p = utfrune(s, j->startchar);
				if(p == 0 || s == j->eol)
					return match;
				s = p;
				break;
			case BOL:
				if(s == bol)
					break;
				p = utfrune(s, '\n');
				if(p == 0 || s == j->eol)
					return match;
				s = p+1;
				break;
			}
		}
		r = *(unsigned char*)s;
		if(r < Runeself)
			n = 1;
		else
			n = chartorune(&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 */
		if(match == 0)
			_renewemptythread(tl, progp->startinst, ms, s);

		/* Execute machine until current list is empty */
		for(tlp=tl; tlp->inst; tlp++){	/* assignment = */
			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.sp = s;
					continue;
				case RBRA:
					tlp->se.m[inst->r.subid].e.ep = 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->eol || 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.ep = s;
					if(mp != 0)
						_renewmatch(mp, ms, &tlp->se);
					break;
				}
				break;
			}
		}
		if(s == j->eol)
			break;
		checkstart = j->starttype && nl->inst==0;
		s += n;
	}while(r);
	return match;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %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, -0x9c(%rbp)
movq -0x30(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x58(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x9529
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x9527
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 0x94e7
jmp 0x9529
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 0x28(%rax), %rax
movq %rax, -0x50(%rbp)
cmpl $0x0, -0x58(%rbp)
je 0x9624
movq -0x30(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0xac(%rbp)
subl $0x7f, %eax
je 0x9582
jmp 0x9570
movl -0xac(%rbp), %eax
subl $0xc3, %eax
je 0x95cc
jmp 0x9622
movq -0x50(%rbp), %rdi
movq -0x30(%rbp), %rax
movl 0x24(%rax), %esi
callq 0xab10
movq %rax, -0xa8(%rbp)
cmpq $0x0, -0xa8(%rbp)
je 0x95b1
movq -0x50(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jne 0x95bf
movl -0x9c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x9b2c
movq -0xa8(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x9622
movq -0x50(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0x95d8
jmp 0x9622
movq -0x50(%rbp), %rdi
movl $0xa, %esi
callq 0xab10
movq %rax, -0xa8(%rbp)
cmpq $0x0, -0xa8(%rbp)
je 0x9605
movq -0x50(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jne 0x9613
movl -0x9c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x9b2c
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x9624
movq -0x50(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x5c(%rbp)
cmpl $0x80, -0x5c(%rbp)
jae 0x9640
movl $0x1, -0x74(%rbp)
jmp 0x9650
movq -0x50(%rbp), %rsi
leaq -0x5c(%rbp), %rdi
callq 0xa8f0
movl %eax, -0x74(%rbp)
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %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 -0x30(%rbp), %rax
movl -0x34(%rbp), %ecx
xorl $0x1, %ecx
movl %ecx, -0x34(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x88(%rbp)
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq 0x10(%rax,%rcx,8), %rax
movq %rax, -0x98(%rbp)
movq -0x88(%rbp), %rax
movq $0x0, (%rax)
cmpl $0x0, -0x9c(%rbp)
jne 0x96d1
movq -0x80(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movl -0x24(%rbp), %edx
movq -0x50(%rbp), %rcx
callq 0x7ec0
movq -0x80(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq $0x0, (%rax)
je 0x9ac4
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xb0(%rbp)
subl $0x7f, %eax
je 0x97ca
jmp 0x9709
movl -0xb0(%rbp), %eax
subl $0x81, %eax
je 0x9834
jmp 0x971c
movl -0xb0(%rbp), %eax
subl $0x82, %eax
je 0x9811
jmp 0x972f
movl -0xb0(%rbp), %eax
subl $0x83, %eax
je 0x9a36
jmp 0x9742
movl -0xb0(%rbp), %eax
subl $0xc0, %eax
je 0x9858
jmp 0x9755
movl -0xb0(%rbp), %eax
subl $0xc1, %eax
je 0x9899
jmp 0x9768
movl -0xb0(%rbp), %eax
subl $0xc3, %eax
je 0x98d2
jmp 0x977b
movl -0xb0(%rbp), %eax
subl $0xc4, %eax
je 0x98f3
jmp 0x978e
movl -0xb0(%rbp), %eax
subl $0xc5, %eax
je 0x9917
jmp 0x97a1
movl -0xb0(%rbp), %eax
subl $0xc6, %eax
je 0x99a2
jmp 0x97b4
movl -0xb0(%rbp), %eax
subl $0xff, %eax
je 0x9a69
jmp 0x9a9c
movq -0x40(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x5c(%rbp), %eax
jne 0x980c
movq -0x88(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rsi
movl -0x24(%rbp), %edx
movq -0x48(%rbp), %rcx
addq $0x8, %rcx
callq 0x7db0
cmpq -0x98(%rbp), %rax
jne 0x980a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9b2c
jmp 0x980c
jmp 0x9a9c
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 0x9a9e
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 0x9a9e
cmpl $0xa, -0x5c(%rbp)
je 0x9894
movq -0x88(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rsi
movl -0x24(%rbp), %edx
movq -0x48(%rbp), %rcx
addq $0x8, %rcx
callq 0x7db0
cmpq -0x98(%rbp), %rax
jne 0x9892
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9b2c
jmp 0x9894
jmp 0x9a9c
movq -0x88(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rsi
movl -0x24(%rbp), %edx
movq -0x48(%rbp), %rcx
addq $0x8, %rcx
callq 0x7db0
cmpq -0x98(%rbp), %rax
jne 0x98cd
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9b2c
jmp 0x9a9c
movq -0x50(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x98e9
movq -0x50(%rbp), %rax
movsbl -0x1(%rax), %eax
cmpl $0xa, %eax
jne 0x98ee
jmp 0x9a9e
jmp 0x9a9c
movq -0x50(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq 0x30(%rcx), %rax
je 0x990d
cmpl $0x0, -0x5c(%rbp)
je 0x990d
cmpl $0xa, -0x5c(%rbp)
jne 0x9912
jmp 0x9a9e
jmp 0x9a9c
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 0x999d
movl -0x5c(%rbp), %eax
movq -0x68(%rbp), %rcx
cmpl (%rcx), %eax
jb 0x998d
movl -0x5c(%rbp), %eax
movq -0x68(%rbp), %rcx
cmpl 0x4(%rcx), %eax
ja 0x998d
movq -0x88(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rsi
movl -0x24(%rbp), %edx
movq -0x48(%rbp), %rcx
addq $0x8, %rcx
callq 0x7db0
cmpq -0x98(%rbp), %rax
jne 0x998b
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9b2c
jmp 0x999d
jmp 0x998f
movq -0x68(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x68(%rbp)
jmp 0x9936
jmp 0x9a9c
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 0x99f4
movl -0x5c(%rbp), %eax
movq -0x68(%rbp), %rcx
cmpl (%rcx), %eax
jb 0x99e4
movl -0x5c(%rbp), %eax
movq -0x68(%rbp), %rcx
cmpl 0x4(%rcx), %eax
ja 0x99e4
jmp 0x99f4
jmp 0x99e6
movq -0x68(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x68(%rbp)
jmp 0x99c1
movq -0x68(%rbp), %rax
cmpq -0x70(%rbp), %rax
jne 0x9a34
movq -0x88(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rsi
movl -0x24(%rbp), %edx
movq -0x48(%rbp), %rcx
addq $0x8, %rcx
callq 0x7db0
cmpq -0x98(%rbp), %rax
jne 0x9a32
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9b2c
jmp 0x9a34
jmp 0x9a9c
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 -0x90(%rbp), %rax
jne 0x9a67
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9b2c
jmp 0x9a9e
movl $0x1, -0x9c(%rbp)
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x10(%rax)
cmpq $0x0, -0x20(%rbp)
je 0x9a9a
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %esi
movq -0x48(%rbp), %rdx
addq $0x8, %rdx
callq 0x7ca0
jmp 0x9a9c
jmp 0x9aaf
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x96f2
jmp 0x9ab1
movq -0x48(%rbp), %rax
addq $0x208, %rax            # imm = 0x208
movq %rax, -0x48(%rbp)
jmp 0x96d9
movq -0x50(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jne 0x9ad4
jmp 0x9b23
movq -0x30(%rbp), %rcx
xorl %eax, %eax
cmpl $0x0, 0x20(%rcx)
movb %al, -0xb1(%rbp)
je 0x9afa
movq -0x88(%rbp), %rax
cmpq $0x0, (%rax)
sete %al
movb %al, -0xb1(%rbp)
movb -0xb1(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x58(%rbp)
movl -0x74(%rbp), %ecx
movq -0x50(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
cmpl $0x0, -0x5c(%rbp)
jne 0x9552
movl -0x9c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax,%rax)