// File: /workspace/github_c_makefile_star2_O2/msteveb[P]autosetup/./jimsh0.c
// Function: reg
static int reg(regex_t *preg, int paren, int *flagp )
{
	int ret;
	int br;
	int ender;
	int parno = 0;
	int flags;

	*flagp = HASWIDTH;


	if (paren) {
		if (preg->regparse[0] == '?' && preg->regparse[1] == ':') {

			preg->regparse += 2;
			parno = -1;
		}
		else {
			parno = ++preg->re_nsub;
		}
		ret = regnode(preg, OPEN+parno);
	} else
		ret = 0;


	br = regbranch(preg, &flags);
	if (br == 0)
		return 0;
	if (ret != 0)
		regtail(preg, ret, br);
	else
		ret = br;
	if (!(flags&HASWIDTH))
		*flagp &= ~HASWIDTH;
	*flagp |= flags&SPSTART;
	while (*preg->regparse == '|') {
		preg->regparse++;
		br = regbranch(preg, &flags);
		if (br == 0)
			return 0;
		regtail(preg, ret, br);
		if (!(flags&HASWIDTH))
			*flagp &= ~HASWIDTH;
		*flagp |= flags&SPSTART;
	}


	ender = regnode(preg, (paren) ? CLOSE+parno : END);
	regtail(preg, ret, ender);


	for (br = ret; br != 0; br = regnext(preg, br))
		regoptail(preg, br, ender);


	if (paren && *preg->regparse++ != ')') {
		preg->err = REG_ERR_UNMATCHED_PAREN;
		return 0;
	} else if (!paren && *preg->regparse != '\0') {
		if (*preg->regparse == ')') {
			preg->err = REG_ERR_UNMATCHED_PAREN;
			return 0;
		} else {
			preg->err = REG_ERR_JUNK_ON_END;
			return 0;
		}
	}

	return(ret);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movl %esi, %r14d
movq %rdi, %rbx
movl $0x1, (%rdx)
movl $0x0, %r13d
movl $0x0, %r15d
testl %esi, %esi
je 0x11698
movq 0x28(%rbx), %rax
cmpb $0x3f, (%rax)
jne 0x11676
cmpb $0x3a, 0x1(%rax)
jne 0x11676
addq $0x2, %rax
movq %rax, 0x28(%rbx)
pushq $-0x1
popq %r13
jmp 0x1167f
movl (%rbx), %r13d
incl %r13d
movl %r13d, (%rbx)
leal 0x3e9(%r13), %esi
movq %rbx, %rdi
callq 0x20e61
movl %eax, %r15d
addl $0x7d1, %r13d           # imm = 0x7D1
leaq -0x2c(%rbp), %rsi
movq %rbx, %rdi
callq 0x20ea2
testl %eax, %eax
je 0x117ad
testl %r15d, %r15d
movl %r14d, -0x30(%rbp)
je 0x116c4
movq %rbx, %rdi
movl %r15d, %esi
movl %eax, %edx
callq 0x218d0
jmp 0x116c7
movl %eax, %r15d
leaq -0x2c(%rbp), %r14
movl (%r14), %eax
movl (%r12), %ecx
movl %ecx, %edx
andl $-0x2, %edx
testb $0x1, %al
cmovnel %ecx, %edx
andl $0x4, %eax
orl %edx, %eax
movl %eax, (%r12)
movq 0x28(%rbx), %rax
cmpb $0x7c, (%rax)
jne 0x1172e
incq %rax
movq %rax, 0x28(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x20ea2
testl %eax, %eax
je 0x117ad
movq %rbx, %rdi
movl %r15d, %esi
movl %eax, %edx
callq 0x218d0
movl -0x2c(%rbp), %eax
movl (%r12), %ecx
testb $0x1, %al
jne 0x11727
andl $-0x2, %ecx
movl %ecx, (%r12)
andl $0x4, %eax
orl %ecx, %eax
jmp 0x116e1
movq %rbx, %rdi
movl %r13d, %esi
callq 0x20e61
movl %eax, %r14d
movq %rbx, %rdi
movl %r15d, %esi
movl %eax, %edx
callq 0x218d0
movl %r15d, %r12d
testl %r12d, %r12d
je 0x1177e
movq 0x20(%rbx), %rax
movslq %r12d, %rcx
cmpl $0x6, (%rax,%rcx,4)
jne 0x1176e
leal 0x2(%r12), %esi
movq %rbx, %rdi
movl %r14d, %edx
callq 0x218d0
movq %rbx, %rdi
movl %r12d, %esi
callq 0x117c2
movl %eax, %r12d
jmp 0x1174c
movq 0x28(%rbx), %rax
cmpl $0x0, -0x30(%rbp)
je 0x11797
leaq 0x1(%rax), %rcx
movq %rcx, 0x28(%rbx)
cmpb $0x29, (%rax)
jne 0x117a3
jmp 0x117b0
movzbl (%rax), %eax
testl %eax, %eax
je 0x117b0
cmpl $0x29, %eax
jne 0x117a7
pushq $0x8
jmp 0x117a9
pushq $0xb
popq %rax
movl %eax, 0x8(%rbx)
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq