// File: /workspace/github_c_makefile_star2_O0/msteveb[P]autosetup/./jimsh0.c
// Function: jim_regexec
int jim_regexec(regex_t  *preg,  const  char *string, size_t nmatch, regmatch_t pmatch[], int eflags)
{
	const char *s;
	int scan;


	if (preg == NULL || preg->program == NULL || string == NULL) {
		return REG_ERR_NULL_ARGUMENT;
	}


	if (*preg->program != REG_MAGIC) {
		return REG_ERR_CORRUPTED;
	}

#ifdef DEBUG
	fprintf(stderr, "regexec: %s\n", string);
	regdump(preg);
#endif

	preg->eflags = eflags;
	preg->pmatch = pmatch;
	preg->nmatch = nmatch;
	preg->start = string;


	for (scan = OPERAND(1); scan != 0; scan += regopsize(preg, scan)) {
		int op = OP(preg, scan);
		if (op == END)
			break;
		if (op == REPX || op == REPXMIN)
			preg->program[scan + 4] = 0;
	}


	if (preg->regmust != 0) {
		s = string;
		while ((s = str_find(s, preg->program[preg->regmust], preg->cflags & REG_ICASE)) != NULL) {
			if (prefix_cmp(preg->program + preg->regmust, preg->regmlen, s, preg->cflags & REG_ICASE) >= 0) {
				break;
			}
			s++;
		}
		if (s == NULL)
			return REG_NOMATCH;
	}


	preg->regbol = string;


	if (preg->reganch) {
		if (eflags & REG_NOTBOL) {

			goto nextline;
		}
		while (1) {
			if (regtry(preg, string)) {
				return REG_NOERROR;
			}
			if (*string) {
nextline:
				if (preg->cflags & REG_NEWLINE) {

					string = strchr(string, '\n');
					if (string) {
						preg->regbol = ++string;
						continue;
					}
				}
			}
			return REG_NOMATCH;
		}
	}


	s = string;
	if (preg->regstart != '\0') {

		while ((s = str_find(s, preg->regstart, preg->cflags & REG_ICASE)) != NULL) {
			if (regtry(preg, s))
				return REG_NOERROR;
			s++;
		}
	}
	else

		while (1) {
			if (regtry(preg, s))
				return REG_NOERROR;
			if (*s == '\0') {
				break;
			}
			else {
				int c;
				s += utf8_tounicode(s, &c);
			}
		}


	return REG_NOMATCH;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x8a35
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x8a35
cmpq $0x0, -0x18(%rbp)
jne 0x8a41
movl $0x3, -0x4(%rbp)
jmp 0x8cdd
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
cmpl $0xfaded00d, (%rax)     # imm = 0xFADED00D
je 0x8a5d
movl $0x11, -0x4(%rbp)
jmp 0x8cdd
movl -0x2c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x38(%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x20(%rbp), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x60(%rax)
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movl $0x3, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x8aed
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x3c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
jne 0x8ab3
jmp 0x8aed
cmpl $0xc, -0x40(%rbp)
je 0x8abf
cmpl $0xd, -0x40(%rbp)
jne 0x8ad7
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x3c(%rbp), %ecx
addl $0x4, %ecx
movslq %ecx, %rcx
movl $0x0, (%rax,%rcx,4)
jmp 0x8ad9
movq -0x10(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0x16360
addl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x8a93
movq -0x10(%rbp), %rax
cmpl $0x0, 0x14(%rax)
je 0x8b8e
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x14(%rcx), %rcx
movl (%rax,%rcx,4), %esi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
andl $0x2, %edx
callq 0x163f0
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x8b79
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rax
movslq 0x14(%rax), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movl 0x18(%rax), %esi
movq -0x38(%rbp), %rdx
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0x2, %ecx
callq 0x16470
cmpl $0x0, %eax
jl 0x8b6b
jmp 0x8b79
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x8b03
cmpq $0x0, -0x38(%rbp)
jne 0x8b8c
movl $0x1, -0x4(%rbp)
jmp 0x8cdd
jmp 0x8b8e
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x8c2e
movl -0x2c(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x8bb5
jmp 0x8be0
jmp 0x8bb7
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x16530
cmpl $0x0, %eax
je 0x8bd5
movl $0x0, -0x4(%rbp)
jmp 0x8cdd
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
je 0x8c22
jmp 0x8be0
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x8c20
movq -0x18(%rbp), %rdi
movl $0xa, %esi
callq 0x61d0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x8c1e
movq -0x18(%rbp), %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rcx, 0x50(%rax)
jmp 0x8bb7
jmp 0x8c20
jmp 0x8c22
movl $0x1, -0x4(%rbp)
jmp 0x8cdd
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x8c91
jmp 0x8c42
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0xc(%rax), %esi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
andl $0x2, %edx
callq 0x163f0
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x8c8f
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x16530
cmpl $0x0, %eax
je 0x8c81
movl $0x0, -0x4(%rbp)
jmp 0x8cdd
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x8c42
jmp 0x8cd6
jmp 0x8c93
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x16530
cmpl $0x0, %eax
je 0x8cae
movl $0x0, -0x4(%rbp)
jmp 0x8cdd
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x8cbc
jmp 0x8cd4
movq -0x38(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x8c93
jmp 0x8cd6
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)