// File: /workspace/github_c_makefile_star2_O0/NedFreed[P]msglint/msglint.c
// Function: validatechars
static void validatechars(const char **ptmpl, const char *data, int len,
			  int *olen, const char **pfailstr, dbinfo *db)
{
    const char *tmpl = *ptmpl;
    const char *start = data;
    const char *dend = data + len;
    const char *tokend;
    int stack = -1;
    vcstack vs[10];

    *pfailstr = NULL;
    *olen = -1;
    for (;;) {
	switch (*tmpl) {
	  case 'S':
	    data = dend;
	    ++tmpl;
	    continue;

	  case '$':
	    if (data == dend) {
		++tmpl;
		continue;
	    }
	    if (vcreset(&stack, vs, &data, &tmpl)) continue;
	    goto DONE;

	  case '}':
	    if (stack < 0) {
		if (data == dend) goto DONE;
		*ptmpl = tmpl;
		*olen = data - start;
		return;
	    }
	    if (*vs[stack].type == '*' ||
		(*vs[stack].type == 'R' &&
		 (++vs[stack].count < vs[stack].maxc ||
		  vs[stack].maxc == 0))) {
		vs[stack].data = data;
		tmpl = vs[stack].tmpl;
		continue;
	    }
	    --stack;
	    ++tmpl;
	    continue;

	  case '|':
	    --stack;
	    tmpl = skipvalgroup(tmpl);
	    continue;
	    
	  case '{':
	    /* handle warnings and errors */
	    if (tmpl[1] == 'W' || tmpl[1] == 'U' || tmpl[1] == 'X' ||
		tmpl[1] == 'C') {
		tokend = skipvalgroup(tmpl + 1);
		if (tmpl[1] != 'C')
		    wprintf(db, tmpl[1] == 'X' ? w_error :
			    (tmpl[1] == 'U' ? w_unknown : w_warn),
			    "%.*s", tokend - tmpl - 3, tmpl + 2);
		tmpl = tokend;
		continue;
	    }
	    if (data == dend &&
		(tmpl[1] == 'O' || tmpl[1] == '*' ||
		 (tmpl[1] == 'R' && tmpl[2] == '*'))) {
		tmpl = skipvalgroup(tmpl + 1);
		continue;
	    }
	    break;
	}
	if (data == dend) {
	    if (vcreset(&stack, vs, &data, &tmpl)) continue;
	    break;
	}
	switch (*tmpl) {
	  default:		/* treat as literal */
	    if (*data != *tmpl) {
		if (vcreset(&stack, vs, &data, &tmpl)) continue;
		*pfailstr = ":expected character ";
		goto DONE;
	    }
	    break;

	  case 'A':
	    if (!isalpha(*data)) {
		if (vcreset(&stack, vs, &data, &tmpl)) continue;
		*pfailstr = "a letter";
		goto DONE;
	    }
	    break;

	  case 'L':
	    if (!islower(*data)) {
		if (vcreset(&stack, vs, &data, &tmpl)) continue;
		*pfailstr = "a lowercase letter";
		goto DONE;
	    }
	    break;

	  case 'D':
	    if (!isdigit(*data)) {
		if (vcreset(&stack, vs, &data, &tmpl)) continue;
		*pfailstr = "a digit";
		goto DONE;
	    }
	    break;

	  case 'B':
	    if ((special_table[(unsigned char) *data] & BSPECIAL_BIT) == 0) {
		if (vcreset(&stack, vs, &data, &tmpl)) continue;
		*pfailstr = "a boundary char (" RFC_MIME_BD ")";
		goto DONE;
	    }
	    break;

	  case 'T':
	    if ((special_table[(unsigned char) *data] & TSPECIAL_BIT) != 0) {
		if (vcreset(&stack, vs, &data, &tmpl)) continue;
		*pfailstr = "a token char (" RFC_MIME_TOKEN ")";
		goto DONE;
	    }
	    break;

	  case '{':
	    ++tmpl;
	    ++stack;
	    vs[stack].type = tmpl;
	    vs[stack].tmpl = tmpl + 1;
	    vs[stack].data = data;
	    vs[stack].minc = 0;
	    vs[stack].maxc = 0;
	    vs[stack].count = 0;
	    switch (*tmpl) {
	      default:
		*ptmpl = tmpl;
		return;

	      case 'A':
	      case 'O':
	      case '*':
		++tmpl;
		continue;

	      case 'R':
		++tmpl;
		if (*tmpl == '0') { /* don't allow leading '0' */
		    *ptmpl = tmpl;
		    return;
		}
		while (isdigit(*tmpl)) {
		    vs[stack].minc = 10 * vs[stack].minc + (*tmpl++ - '0');
		}
		if (*tmpl != '*') {
		    *ptmpl = tmpl;
		    return;
		}
		++tmpl;
		while (isdigit(*tmpl)) {
		    vs[stack].maxc = 10 * vs[stack].maxc + (*tmpl++ - '0');
		}
		if (*tmpl != ':') {
		    *ptmpl = tmpl;
		    return;
		}
		vs[stack].tmpl = ++tmpl;
		continue;
	    }
	    break;
	}
	++tmpl;
	++data;
    }
    /* skip over any optional elements of template */
    if (*tmpl == '{' && tmpl[1] == 'O') tmpl = skipvalgroup(tmpl + 1);
  DONE:
    *ptmpl = tmpl;
    *olen = data - start;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movl $0xffffffff, -0x54(%rbp) # imm = 0xFFFFFFFF
movq -0x28(%rbp), %rax
movq $0x0, (%rax)
movq -0x20(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x1f4(%rbp)
subl $0x24, %eax
je 0xa539
jmp 0xa4e4
movl -0x1f4(%rbp), %eax
subl $0x53, %eax
je 0xa523
jmp 0xa4f1
movl -0x1f4(%rbp), %eax
subl $0x7b, %eax
je 0xa6a9
jmp 0xa502
movl -0x1f4(%rbp), %eax
subl $0x7c, %eax
je 0xa68e
jmp 0xa513
movl -0x1f4(%rbp), %eax
subl $0x7d, %eax
je 0xa57b
jmp 0xa7e1
movq -0x48(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0xa4d0
movq -0x10(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0xa554
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0xa4d0
leaq -0x1f0(%rbp), %rsi
leaq -0x54(%rbp), %rdi
leaq -0x10(%rbp), %rdx
leaq -0x38(%rbp), %rcx
callq 0xad00
cmpl $0x0, %eax
je 0xa576
jmp 0xa4d0
jmp 0xacd4
cmpl $0x0, -0x54(%rbp)
jge 0xa5b3
movq -0x10(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0xa590
jmp 0xacd4
movq -0x38(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rcx, %rax
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
jmp 0xacf2
movslq -0x54(%rbp), %rcx
leaq -0x1f0(%rbp), %rax
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2a, %eax
je 0xa63b
movslq -0x54(%rbp), %rcx
leaq -0x1f0(%rbp), %rax
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x52, %eax
jne 0xa674
movslq -0x54(%rbp), %rax
leaq -0x1f0(%rbp), %rcx
imulq $0x28, %rax, %rax
addq %rax, %rcx
movl 0x18(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x18(%rcx)
movslq -0x54(%rbp), %rdx
leaq -0x1f0(%rbp), %rcx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x20(%rcx), %eax
jl 0xa63b
movslq -0x54(%rbp), %rcx
leaq -0x1f0(%rbp), %rax
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x20(%rax)
jne 0xa674
movq -0x10(%rbp), %rcx
movslq -0x54(%rbp), %rdx
leaq -0x1f0(%rbp), %rax
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movslq -0x54(%rbp), %rcx
leaq -0x1f0(%rbp), %rax
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0xa4d0
movl -0x54(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x54(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0xa4d0
movl -0x54(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x54(%rbp)
movq -0x38(%rbp), %rdi
callq 0x9f10
movq %rax, -0x38(%rbp)
jmp 0xa4d0
movq -0x38(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x57, %eax
je 0xa6e1
movq -0x38(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x55, %eax
je 0xa6e1
movq -0x38(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x58, %eax
je 0xa6e1
movq -0x38(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x43, %eax
jne 0xa78b
movq -0x38(%rbp), %rdi
addq $0x1, %rdi
callq 0x9f10
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x43, %eax
je 0xa77e
movq -0x30(%rbp), %rax
movq %rax, -0x200(%rbp)
movq -0x38(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x58, %eax
jne 0xa727
leaq 0x4ff8(%rip), %rax      # 0xf716
movq %rax, -0x208(%rbp)
jmp 0xa74b
movq -0x38(%rbp), %rax
movsbl 0x1(%rax), %edx
leaq 0x4c3b(%rip), %rax      # 0xf371
leaq 0x4fe1(%rip), %rcx      # 0xf71e
cmpl $0x55, %edx
cmoveq %rcx, %rax
movq %rax, -0x208(%rbp)
movq -0x200(%rbp), %rdi
movq -0x208(%rbp), %rsi
movq -0x50(%rbp), %rcx
movq -0x38(%rbp), %rax
subq %rax, %rcx
subq $0x3, %rcx
movq -0x38(%rbp), %r8
addq $0x2, %r8
leaq 0x7c6b(%rip), %rdx      # 0x123e2
movb $0x0, %al
callq 0x2e50
movq -0x50(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0xa4d0
movq -0x10(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0xa7df
movq -0x38(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x4f, %eax
je 0xa7c9
movq -0x38(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2a, %eax
je 0xa7c9
movq -0x38(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x52, %eax
jne 0xa7df
movq -0x38(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x2a, %eax
jne 0xa7df
movq -0x38(%rbp), %rdi
addq $0x1, %rdi
callq 0x9f10
movq %rax, -0x38(%rbp)
jmp 0xa4d0
jmp 0xa7e1
movq -0x10(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0xa812
leaq -0x1f0(%rbp), %rsi
leaq -0x54(%rbp), %rdi
leaq -0x10(%rbp), %rdx
leaq -0x38(%rbp), %rcx
callq 0xad00
cmpl $0x0, %eax
je 0xa80d
jmp 0xa4d0
jmp 0xaca8
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
addl $-0x41, %eax
movl %eax, %ecx
movq %rcx, -0x210(%rbp)
subl $0x3a, %eax
ja 0xa841
movq -0x210(%rbp), %rax
leaq 0x3e14(%rip), %rcx      # 0xe64c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
movq -0x38(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
je 0xa888
leaq -0x1f0(%rbp), %rsi
leaq -0x54(%rbp), %rdi
leaq -0x10(%rbp), %rdx
leaq -0x38(%rbp), %rcx
callq 0xad00
cmpl $0x0, %eax
je 0xa875
jmp 0xa4d0
movq -0x28(%rbp), %rax
leaq 0x7163(%rip), %rcx      # 0x119e3
movq %rcx, (%rax)
jmp 0xacd4
jmp 0xac8b
callq 0x21d0
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
jne 0xa8e2
leaq -0x1f0(%rbp), %rsi
leaq -0x54(%rbp), %rdi
leaq -0x10(%rbp), %rdx
leaq -0x38(%rbp), %rcx
callq 0xad00
cmpl $0x0, %eax
je 0xa8cf
jmp 0xa4d0
movq -0x28(%rbp), %rax
leaq 0x711e(%rip), %rcx      # 0x119f8
movq %rcx, (%rax)
jmp 0xacd4
jmp 0xac8b
callq 0x21d0
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
jne 0xa93c
leaq -0x1f0(%rbp), %rsi
leaq -0x54(%rbp), %rdi
leaq -0x10(%rbp), %rdx
leaq -0x38(%rbp), %rcx
callq 0xad00
cmpl $0x0, %eax
je 0xa929
jmp 0xa4d0
movq -0x28(%rbp), %rax
leaq 0x70cd(%rip), %rcx      # 0x11a01
movq %rcx, (%rax)
jmp 0xacd4
jmp 0xac8b
callq 0x21d0
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0xa996
leaq -0x1f0(%rbp), %rsi
leaq -0x54(%rbp), %rdi
leaq -0x10(%rbp), %rdx
leaq -0x38(%rbp), %rcx
callq 0xad00
cmpl $0x0, %eax
je 0xa983
jmp 0xa4d0
movq -0x28(%rbp), %rax
leaq 0x7086(%rip), %rcx      # 0x11a14
movq %rcx, (%rax)
jmp 0xacd4
jmp 0xac8b
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0xa465(%rip), %rax      # 0x14e10
movzbl (%rax,%rcx), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0xa9ec
leaq -0x1f0(%rbp), %rsi
leaq -0x54(%rbp), %rdi
leaq -0x10(%rbp), %rdx
leaq -0x38(%rbp), %rcx
callq 0xad00
cmpl $0x0, %eax
je 0xa9d9
jmp 0xa4d0
movq -0x28(%rbp), %rax
leaq 0x7038(%rip), %rcx      # 0x11a1c
movq %rcx, (%rax)
jmp 0xacd4
jmp 0xac8b
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0xa40f(%rip), %rax      # 0x14e10
movzbl (%rax,%rcx), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0xaa42
leaq -0x1f0(%rbp), %rsi
leaq -0x54(%rbp), %rdi
leaq -0x10(%rbp), %rdx
leaq -0x38(%rbp), %rcx
callq 0xad00
cmpl $0x0, %eax
je 0xaa2f
jmp 0xa4d0
movq -0x28(%rbp), %rax
leaq 0x7003(%rip), %rcx      # 0x11a3d
movq %rcx, (%rax)
jmp 0xacd4
jmp 0xac8b
movq -0x38(%rbp), %rax
incq %rax
movq %rax, -0x38(%rbp)
movl -0x54(%rbp), %eax
incl %eax
movl %eax, -0x54(%rbp)
movq -0x38(%rbp), %rcx
movslq -0x54(%rbp), %rax
leaq (%rax,%rax,4), %rax
movq %rcx, -0x1f0(%rbp,%rax,8)
movq -0x38(%rbp), %rcx
incq %rcx
movslq -0x54(%rbp), %rax
leaq (%rax,%rax,4), %rax
movq %rcx, -0x1e8(%rbp,%rax,8)
movq -0x10(%rbp), %rcx
movslq -0x54(%rbp), %rax
leaq (%rax,%rax,4), %rax
movq %rcx, -0x1e0(%rbp,%rax,8)
movslq -0x54(%rbp), %rax
leaq (%rax,%rax,4), %rax
movl $0x0, -0x1d4(%rbp,%rax,8)
movslq -0x54(%rbp), %rax
leaq (%rax,%rax,4), %rax
movl $0x0, -0x1d0(%rbp,%rax,8)
movslq -0x54(%rbp), %rax
leaq (%rax,%rax,4), %rax
movl $0x0, -0x1d8(%rbp,%rax,8)
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x214(%rbp)
subl $0x2a, %eax
je 0xab1d
jmp 0xaae6
movl -0x214(%rbp), %eax
subl $0x41, %eax
je 0xab1d
jmp 0xaaf3
movl -0x214(%rbp), %eax
subl $0x4f, %eax
je 0xab1d
jmp 0xab00
movl -0x214(%rbp), %eax
subl $0x52, %eax
je 0xab2e
jmp 0xab0d
movq -0x38(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0xacf2
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0xa4d0
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0xab56
movq -0x38(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0xacf2
jmp 0xab58
callq 0x21d0
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xabbc
movslq -0x54(%rbp), %rcx
leaq -0x1f0(%rbp), %rax
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
imull $0xa, 0x1c(%rax), %ecx
movq -0x38(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x38(%rbp)
movsbl (%rax), %eax
subl $0x30, %eax
addl %eax, %ecx
movslq -0x54(%rbp), %rdx
leaq -0x1f0(%rbp), %rax
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x1c(%rax)
jmp 0xab58
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2a, %eax
je 0xabd8
movq -0x38(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0xacf2
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
callq 0x21d0
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xac48
movslq -0x54(%rbp), %rcx
leaq -0x1f0(%rbp), %rax
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
imull $0xa, 0x20(%rax), %ecx
movq -0x38(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x38(%rbp)
movsbl (%rax), %eax
subl $0x30, %eax
addl %eax, %ecx
movslq -0x54(%rbp), %rdx
leaq -0x1f0(%rbp), %rax
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x20(%rax)
jmp 0xabe4
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
je 0xac64
movq -0x38(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0xacf2
movq -0x38(%rbp), %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movslq -0x54(%rbp), %rdx
leaq -0x1f0(%rbp), %rax
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
jmp 0xa4d0
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0xa4d0
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7b, %eax
jne 0xacd2
movq -0x38(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x4f, %eax
jne 0xacd2
movq -0x38(%rbp), %rdi
addq $0x1, %rdi
callq 0x9f10
movq %rax, -0x38(%rbp)
jmp 0xacd4
movq -0x38(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rcx, %rax
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
nopl (%rax,%rax)