// File: /workspace/github_c_makefile_star2_O1/haxlang[P]hax/haxRegexp.c
// Function: RegMatch
static int			/* 0 failure, 1 success */
RegMatch(
Hax_Interp *interp,
char *prog)
{
	Interp *iPtr = (Interp *) interp;
	char *scan;	/* Current node. */
	char *next;		/* Next node. */

	scan = prog;
#ifdef DEBUG
	if (scan != NULL && regnarrate)
		printf("%s(\n", Regprop(scan));
#endif
	while (scan != NULL) {
#ifdef DEBUG
		if (regnarrate)
			printf("%s...\n", Regprop(scan));
#endif
		next = RegNext(interp, scan);

		switch (OP(scan)) {
		case BOL:
			if (iPtr->reginput != iPtr->regbol)
				return(0);
			break;
		case EOL:
			if (*iPtr->reginput != '\0')
				return(0);
			break;
		case ANY:
			if (*iPtr->reginput == '\0')
				return(0);
			iPtr->reginput++;
			break;
		case EXACTLY: {
				int len;
				char *opnd;

				opnd = OPERAND(scan);
				/* Inline the first character, for speed. */
				if (*opnd != *iPtr->reginput)
					return(0);
				len = strlen(opnd);
				if (len > 1 && strncmp(opnd, iPtr->reginput, len) != 0)
					return(0);
				iPtr->reginput += len;
			}
			break;
		case ANYOF:
 			if (*iPtr->reginput == '\0' || strchr(OPERAND(scan), *iPtr->reginput) == NULL)
				return(0);
			iPtr->reginput++;
			break;
		case ANYBUT:
 			if (*iPtr->reginput == '\0' || strchr(OPERAND(scan), *iPtr->reginput) != NULL)
				return(0);
			iPtr->reginput++;
			break;
		case NOTHING:
			break;
		case BACK:
			break;
		case OPEN+1:
		case OPEN+2:
		case OPEN+3:
		case OPEN+4:
		case OPEN+5:
		case OPEN+6:
		case OPEN+7:
		case OPEN+8:
		case OPEN+9: {
				int no;
				char *save;

				no = OP(scan) - OPEN;
				save = iPtr->reginput;

				if (RegMatch(interp, next)) {
					/*
					 * Don't set startp if some later
					 * invocation of the same parentheses
					 * already has.
					 */
					if (iPtr->regstartp[no] == NULL)
						iPtr->regstartp[no] = save;
					return(1);
				} else
					return(0);
			}
			/* NOTREACHED */
		case CLOSE+1:
		case CLOSE+2:
		case CLOSE+3:
		case CLOSE+4:
		case CLOSE+5:
		case CLOSE+6:
		case CLOSE+7:
		case CLOSE+8:
		case CLOSE+9: {
				int no;
				char *save;

				no = OP(scan) - CLOSE;
				save = iPtr->reginput;

				if (RegMatch(interp, next)) {
					/*
					 * Don't set endp if some later
					 * invocation of the same parentheses
					 * already has.
					 */
					if (iPtr->regendp[no] == NULL)
						iPtr->regendp[no] = save;
					return(1);
				} else
					return(0);
			}
			/* NOTREACHED */
		case BRANCH: {
				char *save;

				if (OP(next) != BRANCH)		/* No choice. */
					next = OPERAND(scan);	/* Avoid recursion. */
				else {
					do {
						save = iPtr->reginput;
						if (RegMatch(interp, OPERAND(scan)))
							return(1);
						iPtr->reginput = save;
						scan = RegNext(interp, scan);
					} while (scan != NULL && OP(scan) == BRANCH);
					return(0);
					/* NOTREACHED */
				}
			}
			/* NOTREACHED */
			break;
		case STAR:
		case PLUS: {
				char nextch;
				int no;
				char *save;
				int min;

				/*
				 * Lookahead to avoid useless match attempts
				 * when we know what character comes next.
				 */
				nextch = '\0';
				if (OP(next) == EXACTLY)
					nextch = *OPERAND(next);
				min = (OP(scan) == STAR) ? 0 : 1;
				save = iPtr->reginput;
				no = RegRepeat(interp, OPERAND(scan));
				while (no >= min) {
					/* If it could work, try it. */
					if (nextch == '\0' || *iPtr->reginput == nextch)
						if (RegMatch(interp, next))
							return(1);
					/* Couldn't or didn't -- back up. */
					no--;
					iPtr->reginput = save + no;
				}
				return(0);
			}
			/* NOTREACHED */
		case END:
			return(1);	/* Success! */
		default:
			RegError(interp, (char *) "memory corruption");
			return(0);
		}

		scan = next;
	}

	/*
	 * We get here only if there's trouble -- normally "case END" is
	 * the terminating point.
	 */
	RegError(interp, (char *) "corrupted pointers");
	return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
testq %rsi, %rsi
je 0x59eb
movq %rsi, %r15
leaq 0x2a4(%rbx), %rdx
leaq 0x2b8(%rbx), %rax
movq %rax, 0x10(%rsp)
movq %rdx, (%rsp)
cmpq %r15, %rdx
je 0x5801
movzwl 0x1(%r15), %eax
rolw $0x8, %ax
testw %ax, %ax
je 0x5801
movzwl %ax, %eax
cmpb $0x7, (%r15)
movl %eax, %eax
jne 0x5806
movq %r15, %r14
subq %rax, %r14
jmp 0x580c
xorl %r14d, %r14d
jmp 0x580c
addq %r15, %rax
movq %rax, %r14
movzbl (%r15), %eax
cmpq $0x27, %rax
ja 0x5ada
movsbq %al, %r12
movl $0x1, %ebp
leaq 0xf802(%rip), %rcx      # 0x1502c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x2b8(%rbx), %rax
cmpq 0x2c0(%rbx), %rax
je 0x59df
jmp 0x59fa
movb (%r14), %r12b
cmpb $0x6, %r12b
jne 0x59c3
movq 0x2b8(%rbx), %r13
leaq 0x3(%r15), %rsi
movq %rbx, %rdi
callq 0x57a7
testl %eax, %eax
jne 0x59cc
movq %r13, 0x2b8(%rbx)
movq (%rsp), %rdx
cmpq %r15, %rdx
je 0x58a2
movzwl 0x1(%r15), %eax
rolw $0x8, %ax
testw %ax, %ax
je 0x58a2
movzwl %ax, %eax
cmpb $0x7, (%r15)
movl %eax, %eax
jne 0x58a7
subq %rax, %r15
jmp 0x58aa
xorl %r15d, %r15d
jmp 0x58aa
addq %rax, %r15
xorl %r13d, %r13d
testq %r15, %r15
je 0x59d6
cmpb $0x6, (%r15)
je 0x5859
jmp 0x59d6
movb 0x3(%r15), %al
movq 0x2b8(%rbx), %r12
xorl %ecx, %ecx
movl $0x0, %ebp
cmpb (%r12), %al
jne 0x5927
addq $0x3, %r15
movq %r15, %rdi
callq 0x41d0
movq (%rsp), %rdx
cmpl $0x2, %eax
jl 0x5916
movl %eax, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %r15
callq 0x40c0
movq (%rsp), %rdx
xorl %ecx, %ecx
movl $0x0, %ebp
testl %eax, %eax
movq %r15, %rax
jne 0x5927
cltq
addq %rax, %r12
movq %r12, 0x2b8(%rbx)
movb $0x1, %cl
movl %r13d, %ebp
movl %ebp, %r13d
testb %cl, %cl
jne 0x59df
jmp 0x59fc
movq 0x2b8(%rbx), %rax
cmpb $0x0, (%rax)
je 0x59df
jmp 0x59fa
movq 0x10(%rsp), %rax
movq (%rax), %r12
cmpb $0x0, (%r12)
jne 0x59b6
jmp 0x59fa
movq 0x10(%rsp), %rax
movq (%rax), %r12
movsbl (%r12), %esi
xorl %ebp, %ebp
testl %esi, %esi
je 0x59fc
addq $0x3, %r15
movq %r15, %rdi
callq 0x4250
movq (%rsp), %rdx
testq %rax, %rax
jne 0x59b6
jmp 0x59fc
movq 0x10(%rsp), %rax
movq (%rax), %r12
movsbl (%r12), %esi
xorl %ebp, %ebp
testl %esi, %esi
je 0x59fc
addq $0x3, %r15
movq %r15, %rdi
callq 0x4250
movq (%rsp), %rdx
testq %rax, %rax
jne 0x59fc
incq %r12
movq 0x10(%rsp), %rax
movq %r12, (%rax)
jmp 0x59df
addq $0x3, %r15
movq %r15, %r14
jmp 0x59d6
movl $0x1, %r13d
movq (%rsp), %rdx
movl %r13d, %ebp
cmpb $0x6, %r12b
je 0x59fc
movq %r14, %r15
testq %r14, %r14
jne 0x57db
leaq 0xf80d(%rip), %rsi      # 0x151ff
movq %rbx, %rdi
callq 0x4220
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2b8(%rbx), %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x57a7
testl %eax, %eax
je 0x59fa
movq 0x2c8(%rbx), %rax
cmpq $0x0, -0xa0(%rax,%r12,8)
jne 0x59fc
movq %r15, -0xa0(%rax,%r12,8)
jmp 0x59fc
movq 0x2b8(%rbx), %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x57a7
testl %eax, %eax
je 0x59fa
movq 0x2d0(%rbx), %rax
cmpq $0x0, -0xf0(%rax,%r12,8)
jne 0x59fc
movq %r15, -0xf0(%rax,%r12,8)
jmp 0x59fc
xorl %edx, %edx
cmpb $0x8, (%r14)
jne 0x5a7e
movsbl 0x3(%r14), %edx
xorl %edi, %edi
cmpb $0xa, %r12b
setne %dil
movq 0x2b8(%rbx), %rsi
movzbl 0x3(%r15), %eax
addl $-0x3, %eax
cmpl $0x5, %eax
movq %rsi, (%rsp)
movl %edx, 0x10(%rsp)
ja 0x5b6d
addq $0x6, %r15
leaq 0xf619(%rip), %rcx      # 0x150cc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %edi, %r15d
movq (%rsp), %rdi
callq 0x41d0
movl %r15d, %edi
movq (%rsp), %rsi
movq %rax, %r13
movslq %r13d, %rax
jmp 0x5b68
leaq 0xf70c(%rip), %rsi      # 0x151ed
jmp 0x59f2
movb (%rsi), %al
testb %al, %al
je 0x5b86
movl %edi, 0xc(%rsp)
xorl %r13d, %r13d
movsbl %al, %esi
movq %r15, %rdi
callq 0x4250
testq %rax, %rax
jne 0x5b8e
movq (%rsp), %rsi
movb 0x1(%rsi,%r13), %al
incq %r13
testb %al, %al
jne 0x5af7
jmp 0x5b4a
movb (%rsi), %al
testb %al, %al
je 0x5b86
movl %edi, 0xc(%rsp)
xorl %r13d, %r13d
movsbl %al, %esi
movq %r15, %rdi
callq 0x4250
testq %rax, %rax
je 0x5b8e
movq (%rsp), %rsi
movb 0x1(%rsi,%r13), %al
incq %r13
testb %al, %al
jne 0x5b2a
movq %r13, %rax
jmp 0x5b95
movb (%r15), %al
cmpb (%rsi), %al
jne 0x5b86
xorl %r13d, %r13d
movq %r13, %rcx
incq %r13
cmpb 0x1(%rsi,%rcx), %al
je 0x5b59
movq %r13, %rax
addq %rsi, %rax
jmp 0x5b9c
leaq 0xf69e(%rip), %rsi      # 0x15212
movl %edi, %r15d
movq %rbx, %rdi
callq 0x4220
movl %r15d, %edi
movq (%rsp), %rsi
xorl %r13d, %r13d
movq %rsi, %rax
jmp 0x5b9c
movq %r13, %rax
movq (%rsp), %rsi
addq %rsi, %rax
movl 0xc(%rsp), %edi
movq %rax, 0x2b8(%rbx)
cmpl %edi, %r13d
jl 0x59fa
xorl %r15d, %r15d
cmpb $0xa, %r12b
setne %r15b
movslq %r13d, %r12
incq %r12
movl 0x10(%rsp), %r13d
testl %r13d, %r13d
je 0x5bd6
movq 0x2b8(%rbx), %rax
movsbl (%rax), %eax
cmpl %eax, %r13d
jne 0x5bed
movq %rbx, %rdi
movq %r14, %rsi
callq 0x57a7
movq (%rsp), %rsi
testl %eax, %eax
jne 0x59fc
leaq (%rsi,%r12), %rax
addq $-0x2, %rax
movq %rax, 0x2b8(%rbx)
decq %r12
cmpq %r15, %r12
jg 0x5bc2
jmp 0x59fa
nopl (%rax)