// File: /workspace/github_c_makefile_star2_O0/msteveb[P]autosetup/./jimsh0.c
// Function: regrepeat
static int regrepeat(regex_t *preg, int p, int max)
{
	int count = 0;
	const char *scan;
	int opnd;
	int ch;
	int n;

	scan = preg->reginput;
	opnd = OPERAND(p);
	switch (OP(preg, p)) {
	case ANY:
		while (!reg_iseol(preg, *scan) && count < max) {
			count++;
			scan += utf8_charlen(*scan);
		}
		break;
	case EXACTLY:
		while (count < max) {
			n = reg_utf8_tounicode_case(scan, &ch, preg->cflags & REG_ICASE);
			if (preg->program[opnd] != ch) {
				break;
			}
			count++;
			scan += n;
		}
		break;
	case ANYOF:
		while (count < max) {
			n = reg_utf8_tounicode_case(scan, &ch, preg->cflags & REG_ICASE);
			if (reg_iseol(preg, ch) || reg_range_find(preg->program + opnd, ch) == 0) {
				break;
			}
			count++;
			scan += n;
		}
		break;
	case ANYBUT:
		while (count < max) {
			n = reg_utf8_tounicode_case(scan, &ch, preg->cflags & REG_ICASE);
			if (reg_iseol(preg, ch) || reg_range_find(preg->program + opnd, ch) != 0) {
				break;
			}
			count++;
			scan += n;
		}
		break;
	default:
		preg->err = REG_ERR_INTERNAL;
		count = 0;
		break;
	}
	preg->reginput = scan;

	return(count);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x20(%rbp)
movl -0xc(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0xc(%rbp), %rcx
movl (%rax,%rcx,4), %eax
addl $-0x3, %eax
movl %eax, %ecx
movq %rcx, -0x38(%rbp)
subl $0x5, %eax
ja 0x3556a
movq -0x38(%rbp), %rax
leaq 0x2442(%rip), %rcx      # 0x3780c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x353d5
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movsbl (%rax), %esi
callq 0x34fb0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x39(%rbp)
jne 0x353fd
movl -0x14(%rbp), %eax
cmpl -0x10(%rbp), %eax
setl %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x35406
jmp 0x3541d
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x353d5
jmp 0x3557c
jmp 0x35424
movl -0x14(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x35478
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edx
andl $0x2, %edx
leaq -0x28(%rbp), %rsi
callq 0x344c0
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x24(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x28(%rbp), %eax
je 0x3545c
jmp 0x35478
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x2c(%rbp), %ecx
movq -0x20(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
jmp 0x35424
jmp 0x3557c
jmp 0x3547f
movl -0x14(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x354f0
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edx
andl $0x2, %edx
leaq -0x28(%rbp), %rsi
callq 0x344c0
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x34fb0
cmpl $0x0, %eax
jne 0x354d2
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
movslq -0x24(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movl -0x28(%rbp), %esi
callq 0x35000
cmpl $0x0, %eax
jne 0x354d4
jmp 0x354f0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x2c(%rbp), %ecx
movq -0x20(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
jmp 0x3547f
jmp 0x3557c
jmp 0x354f7
movl -0x14(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x35568
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edx
andl $0x2, %edx
leaq -0x28(%rbp), %rsi
callq 0x344c0
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x34fb0
cmpl $0x0, %eax
jne 0x3554a
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
movslq -0x24(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movl -0x28(%rbp), %esi
callq 0x35000
cmpl $0x0, %eax
je 0x3554c
jmp 0x35568
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x2c(%rbp), %ecx
movq -0x20(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
jmp 0x354f7
jmp 0x3557c
movq -0x8(%rbp), %rax
movl $0xe, 0x8(%rax)
movl $0x0, -0x14(%rbp)
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x48(%rax)
movl -0x14(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq