// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0xa183
movq -0x38(%rbp), %rax
cmpq $0x0, (%rax)
je 0xa1a0
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl 0x18(%rax), %eax
movq -0x38(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0x18(%rcx), %eax
jle 0xa1a0
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0xa1a2
cmpl $0x0, -0x3c(%rbp)
jl 0xa392
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x45, %eax
je 0xa1e2
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x65, %eax
jne 0xa1e7
jmp 0xa392
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x4f, %eax
je 0xa251
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x2a, %eax
je 0xa251
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x31, %eax
jne 0xa2c5
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x20(%rax)
jle 0xa2c5
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
movslq -0x3c(%rbp), %rax
imulq $0x60, %rax, %rax
addq %rax, %rsi
addq $0x28, %rsi
movl $0x38, %edx
callq 0x2110
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
callq 0x9f10
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl -0x3c(%rbp), %ecx
subl $0x1, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0xa399
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x41, %eax
jne 0xa384
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
callq 0xa3b0
movq -0x18(%rbp), %rcx
movslq -0x3c(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
movq %rax, 0x10(%rcx)
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7d, %eax
je 0xa382
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0xa382
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
movslq -0x3c(%rbp), %rax
imulq $0x60, %rax, %rax
addq %rax, %rsi
addq $0x28, %rsi
movl $0x38, %edx
callq 0x2110
movq -0x48(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl -0x3c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0xa399
jmp 0xa384
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xa1a2
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)