// File: /workspace/github_c_makefile_star2_O3/NedFreed[P]msglint/msglint.c
// Function: valreset
static int valreset(int *pstack, vstack *vs, msgtoken **cur,
		    const char **tmpl, whtwarn_ctx *wht, best_ctx *best)
{
    int stack = *pstack;
    const char *next;

    /* remember best token */
    if (*cur == NULL ||
	(best->tok != NULL && (*cur)->toknum > best->tok->toknum)) {
	best->tok = *cur;
	best->tmpl = *tmpl;
    }

    /* try to back up */
    while (stack >= 0) {
	/* don't allow reset outside a matched enumerated type */
	if (*vs[stack].type == 'E' || *vs[stack].type == 'e') break;

	/* skip an optional, repeat or successful repeat-at-least-once */
	if (*vs[stack].type == 'O' || *vs[stack].type == '*' ||
	    (*vs[stack].type == '1' && vs[stack].count > 0)) {
	    *cur = vs[stack].cur;
	    *wht = vs[stack].wstate;
	    *tmpl = skipvalgroup(vs[stack].vstate);
	    *pstack = stack - 1;
	    return (1);
	}

	/* try a different alternate if available */
	if (*vs[stack].type == 'A') {
	    next = vs[stack].vstate = skipvalseg(vs[stack].vstate);
	    if (*next != '}' && *next != '\0') {
		*cur = vs[stack].cur;
		*wht = vs[stack].wstate;
		*tmpl = next;
		*pstack = stack;
		return (1);
	    }
	}
	--stack;
    }

    /* failed to reset */
    
    return (0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r15
movq %rdx, %r12
movq %rdi, %rbx
movl (%rdi), %r13d
movq (%rdx), %rax
testq %rax, %rax
je 0x9c0e
movq (%r9), %rdi
testq %rdi, %rdi
je 0x9c18
movl 0x18(%rax), %edx
cmpl 0x18(%rdi), %edx
jle 0x9c18
movq %rax, (%r9)
movq (%rcx), %rax
movq %rax, 0x8(%r9)
xorl %ebp, %ebp
testl %r13d, %r13d
js 0x9d23
movq %rcx, (%rsp)
leaq (,%r13,2), %rax
addq %r13, %rax
shlq $0x5, %rax
leaq (%rax,%rsi), %r14
addq $0x28, %r14
movq -0x20(%r14), %rax
movzbl (%rax), %eax
cmpl $0x40, %eax
jle 0x9c72
cmpl $0x44, %eax
jg 0x9c87
cmpl $0x41, %eax
jne 0x9c9e
movq -0x18(%r14), %rdi
callq 0x9d69
movq %rax, -0x18(%r14)
movzbl (%rax), %ecx
testl %ecx, %ecx
je 0x9c9e
cmpl $0x7d, %ecx
je 0x9c9e
jmp 0x9d34
cmpl $0x31, %eax
jne 0x9c80
cmpl $0x0, -0x8(%r14)
jle 0x9c9e
jmp 0x9cb0
cmpl $0x2a, %eax
jne 0x9c9e
jmp 0x9cb0
cmpl $0x45, %eax
je 0x9d23
cmpl $0x4f, %eax
je 0x9cb0
cmpl $0x65, %eax
je 0x9d23
leaq -0x1(%r13), %rax
addq $-0x60, %r14
testq %r13, %r13
movq %rax, %r13
jg 0x9c3e
jmp 0x9d23
movq -0x28(%r14), %rax
movq %rax, (%r12)
movq 0x30(%r14), %rax
movq %rax, 0x30(%r15)
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups %xmm2, 0x20(%r15)
movups %xmm1, 0x10(%r15)
movups %xmm0, (%r15)
movq -0x18(%r14), %rax
xorl %ecx, %ecx
movq (%rsp), %rdi
movzbl (%rax), %edx
cmpl $0x7d, %edx
je 0x9cf4
testl %edx, %edx
jne 0x9cfa
jmp 0x9d0a
testl %ecx, %ecx
jle 0x9d0a
decl %ecx
xorl %esi, %esi
cmpb $0x7b, %dl
sete %sil
addl %esi, %ecx
incq %rax
jmp 0x9ce6
xorl %ecx, %ecx
cmpb $0x7d, %dl
sete %cl
addq %rcx, %rax
movq %rax, (%rdi)
decl %r13d
movl %r13d, (%rbx)
movl $0x1, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x28(%r14), %rcx
movq %rcx, (%r12)
movq 0x30(%r14), %rcx
movq %rcx, 0x30(%r15)
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups %xmm2, 0x20(%r15)
movups %xmm1, 0x10(%r15)
movups %xmm0, (%r15)
movq (%rsp), %rcx
movq %rax, (%rcx)
jmp 0x9d1b