// File: /workspace/github_c_makefile_star2_O3/NedFreed[P]msglint/msglint.c
// Function: tokenize
static msgtoken *tokenize(msgcontext *ctx, const char *dat, int len,
			  int flags, dbinfo *db)
{
    msgtoken *head, *last, **pcur;
    const char *start = dat;
    int clevel, spmask, tflags, toknum = 0;

    if ((flags & HEADTYPE_MASK) == UNSTRUCTURED) {
	head = NULL;
	pcur = &head;
	return (newmsgtoken(&pcur, tok_text, start, len, toknum++));
    }
    spmask = (flags & TSPECIAL) ? TSPECIAL_BIT : SPECIAL_BIT;
    head = last = NULL;
    pcur = &head;
    while (len > 0) {
	/* identify a comment */
	if (*dat == '(') {
	    if (dat != start) {
		last = newmsgtoken(&pcur, tok_atom, start, dat - start,
				   toknum++);
	    }
	    if (last != NULL) last->whiteafter |= 2;
	    start = dat;
	    clevel = 1;
	    ++dat, --len;
	    while (len > 0 && (*dat != ')' || --clevel > 0)) {
		if (*dat == '\\' && len > 1 &&
		    (dat[1] == '(' || dat[1] == ')')) {
		    wprintf(db, w_warn, "quoted comment delimiters unwise");
		    dat += 2, len -= 2;
		    continue;
	        }
		if (*dat == '(') {
		    wprintf(db, w_warn, "nested comments unwise");
		    ++clevel;
		} else if ((unsigned char) *dat > 127) {
		    wprintf(db, w_error, "8-bit");
		    if (ctx->mpart != NULL) {
		        ctx->mpart->saw8bit = 1;
		    }
		}
		++dat, --len;
	    }
	    if (len == 0) {
		wprintf(db, w_error, "unbalanced comment");
	    } else {
		++dat, --len;
	    }
	    newmsgtoken(&pcur, tok_comment, start, dat - start, toknum++);
	    start = dat;
	    continue;
	}

	/* identify a quoted-string */
	if (*dat == '"') {
	    if (dat != start) {
		last = newmsgtoken(&pcur, tok_atom, start, dat - start,
				   toknum++);
	    }
	    tflags = QSTRING_ATOM;
	    start = dat;
	    ++dat, --len;
	    while (len > 0 && *dat != '"') {
		if (*dat == '\\' && len > 1 && dat[1] == '"') {
		    dat += 2, len -= 2;
		    tflags = 0;
		} else {
		    if (tflags &&
			(special_table[(unsigned char) *dat] & spmask) != 0) {
			tflags = 0;
		    }
		    if (*dat == '\n' || *dat == '\r') {
			wprintf(db, w_warn, "newlines in quoted string don't "
			       "work well", db);
		    } else if ((unsigned char) *dat > 127) {
			wprintf(db, w_error, "8-bit", db);
		        if (ctx->mpart != NULL) {
		            ctx->mpart->saw8bit = 1;
		        }
		    }
		    ++dat, --len;
		}
	    }
	    if (tflags && dat - start - 1 > 78) tflags = 0;
	    last = newmsgtoken(&pcur, tok_qstring, start + 1, dat - start - 1,
			       toknum++);
	    last->flags = tflags;
	    if (len == 0) {
		wprintf(db, w_error, "unbalanced quote");
	    } else {
		++dat, --len;
	    }
	    start = dat;
	    continue;
	}

	/* identify a domain literal */
	if (*dat == '[') {
	    if (dat != start) {
		last = newmsgtoken(&pcur, tok_atom, start, dat - start,
				   toknum++);
	    }
	    start = dat;
	    ++dat, --len;
	    while (len > 0 && *dat != ']') {
		if (*dat == '\\' && len > 1 && dat[1] == ']') {
		    dat += 2;
		    len -= 2;
		    wprintf(db, w_warn, "quoted domain separators in domain "
			   "literal unwise");
		    continue;
		}
		if ((unsigned char) *dat >= 128) {
		    wprintf(db, w_error, "8-bit in domain literal %c", *dat);
		    if (ctx->mpart != NULL) {
		        ctx->mpart->saw8bit = 1;
		    }
		} else if (!isdigit(*dat) && *dat != '.') {
		    wprintf(db, w_warn, "unwise domain-literal char %d",
			    *dat);
		}
		++dat, --len;
	    }
	    if (len == 0) {
		wprintf(db, w_error, "unbalanced domain literal");
	    } else {
		++dat, --len;
	    }
	    last = newmsgtoken(&pcur, tok_dstring, start, dat - start,
			       toknum++);
	    start = dat;
	    continue;
	}

	/* handle specials */
	if (special_table[(unsigned char) *dat] & spmask) {
	    if (dat != start) {
		newmsgtoken(&pcur, tok_atom, start, dat - start, toknum++);
	    }
	    last = newmsgtoken(&pcur, tok_special, dat, 1, toknum++);
	    if (*dat == ';' && (flags & SEMIEND)) {
		++dat, --len;
		while (len > 0 &&
		       (dat[len - 1] == '\n' || dat[len - 1] == '\r')) {
		    --len;
		}
		newmsgtoken(&pcur, tok_text, dat, len, toknum++);
		return (head);
	    }
	    ++dat, --len;
	    start = dat;
	    continue;
	}

	/* handle whitespace */
	if (*dat == ' ' || *dat == '\t' || *dat == '\r' || *dat == '\n') {
	    if (dat != start) {
		last = newmsgtoken(&pcur, tok_atom, start, dat - start,
				   toknum++);
	    }
	    if (last != NULL) last->whiteafter |= 1;
	    ++dat, --len;
	    start = dat;
	    continue;
	}

	/* skip illegal characters */
	if (*dat < ' ' || (unsigned char) *dat > 126) {
	    if ((unsigned char) *dat >= 128 && ctx->mpart != NULL) {
	        ctx->mpart->saw8bit = 1;
	    }
	    if (dat != start) {
		last = newmsgtoken(&pcur, tok_atom, start, dat - start,
				   toknum++);
	    }
	    wprintf(db, w_error, "illegal syntax character %c", *dat);
	    while (len > 0 && (*dat < ' ' || (unsigned char) *dat > 126)) {
		++dat, --len;
	    }
	    start = dat;
	    continue;
	}

	/* it's an atom char, just advance */
	++dat, --len;
    }
    if (dat != start) {
	newmsgtoken(&pcur, tok_atom, start, dat - start, toknum++);
    }

    return (head);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r8, 0x20(%rsp)
movl %ecx, %r12d
movl %edx, %ebp
movq %rsi, %r9
movq %rdi, 0x48(%rsp)
leaq 0x50(%rsp), %rax
testb $0x3, %r12b
je 0x6d7f
movl %r12d, %ecx
andl $0x2, %ecx
cmpl $0x1, %ecx
movl $0x2, %r13d
sbbl $0x0, %r13d
movq $0x0, 0x50(%rsp)
movq %rax, 0x10(%rsp)
testl %ebp, %ebp
jle 0x6dbc
leaq 0xb5ff(%rip), %rsi      # 0x11c00
movabsq $0x100002600, %rdi      # imm = 0x100002600
xorl %r15d, %r15d
movq $0x0, 0x28(%rsp)
movl %r12d, 0x34(%rsp)
movl %r13d, 0x1c(%rsp)
leal -0x1(%rbp), %ebx
movl %ebp, %ebp
movl $0x1, %eax
xorl %r14d, %r14d
movq %r9, 0x8(%rsp)
movzbl (%r9,%r14), %ecx
cmpl $0x22, %ecx
je 0x6708
cmpl $0x5b, %ecx
je 0x684e
cmpl $0x28, %ecx
je 0x66df
movzbl (%rcx,%rsi), %edx
testl %edx, %r13d
jne 0x6884
cmpb $0x20, %cl
ja 0x666b
btq %rcx, %rdi
jb 0x668a
leal -0x7f(%rcx), %edx
cmpb $-0x60, %dl
jbe 0x68b7
incq %r14
decq %rax
leal (%rax,%rbp), %ecx
cmpl $0x1, %ecx
jg 0x6633
jmp 0x6da4
testq %r14, %r14
je 0x66b7
leal 0x1(%r15), %ebp
leaq 0x10(%rsp), %rdi
movl $0x2, %esi
movq %r9, %rdx
movl %r14d, %ecx
movl %r15d, %r8d
callq 0x9aaa
leaq 0xb54e(%rip), %rsi      # 0x11c00
movl %ebp, %r15d
jmp 0x66bc
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x66c5
orb $0x1, 0x20(%rax)
movq %rax, 0x28(%rsp)
movq 0x8(%rsp), %r9
addq %r14, %r9
incq %r9
subl %r14d, %ebx
movl %ebx, %ebp
jmp 0x6d3e
testq %r14, %r14
je 0x69cd
movq %r15, %r8
incl %r15d
leaq 0x10(%rsp), %rdi
movl $0x2, %esi
movq %r9, %rdx
movl %r14d, %ecx
callq 0x9aaa
jmp 0x69d2
testq %r14, %r14
je 0x672d
movq %r15, %r8
incl %r15d
leaq 0x10(%rsp), %rdi
movl $0x2, %esi
movq %r9, %rdx
movl %r14d, %ecx
callq 0x9aaa
movq 0x8(%rsp), %r9
subq %r14, %rbp
leaq (%r9,%r14), %rdx
incq %rdx
cmpl $0x2, %ebp
jb 0x6960
subl %r14d, %ebx
movl $0x1, %ebp
movq %rdx, 0x28(%rsp)
movq %rdx, %r12
movq %r15, 0x38(%rsp)
leaq 0xb4a4(%rip), %rdx      # 0x11c00
movzbl (%r12), %eax
cmpq $0x22, %rax
je 0x6969
cmpl $0x1, %ebx
je 0x678c
cmpb $0x5c, %al
jne 0x678c
cmpb $0x22, 0x1(%r12)
jne 0x678c
xorl %ebp, %ebp
movl $0xfffffffe, %r15d      # imm = 0xFFFFFFFE
movl $0x2, %r13d
jmp 0x67f3
testl %ebp, %ebp
je 0x679f
movzbl (%rax,%rdx), %ecx
xorl %ebp, %ebp
testl %ecx, %r13d
sete %bpl
jmp 0x67a1
xorl %ebp, %ebp
cmpq $0xd, %rax
je 0x67ac
cmpl $0xa, %eax
jne 0x67de
movq 0x20(%rsp), %rcx
movq %rcx, %rdi
leaq 0x5606(%rip), %rsi      # 0xbdc1
leaq 0x747c(%rip), %rdx      # 0xdc3e
xorl %eax, %eax
callq 0x3267
leaq 0xb430(%rip), %rdx      # 0x11c00
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl $0x1, %r13d
jmp 0x67ee
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl $0x1, %r13d
testb %al, %al
js 0x680e
movq 0x8(%rsp), %r9
addq %r13, %r12
addl %r15d, %ebx
movl 0x1c(%rsp), %r13d
movq 0x38(%rsp), %r15
jg 0x675c
jmp 0x6969
movq 0x20(%rsp), %rcx
movq %rcx, %rdi
leaq 0x5949(%rip), %rsi      # 0xc166
leaq 0x7401(%rip), %rdx      # 0xdc25
xorl %eax, %eax
callq 0x3267
movq 0x48(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x6840
movl $0x1, 0x5c(%rax)
movq 0x8(%rsp), %r9
leaq 0xb3b4(%rip), %rdx      # 0x11c00
jmp 0x67f3
testq %r14, %r14
je 0x6b95
movq %r15, %r8
incl %r15d
leaq 0x10(%rsp), %rdi
movl $0x2, %esi
movq %r9, %rdx
movl %r14d, %ecx
callq 0x9aaa
movq 0x8(%rsp), %r9
movl %r15d, %eax
movq %rax, 0x38(%rsp)
jmp 0x6b9a
testq %r14, %r14
je 0x6cb2
movq %r15, %r8
incl %r15d
leaq 0x10(%rsp), %rdi
movl $0x2, %esi
movq %r9, %rdx
movl %r14d, %ecx
callq 0x9aaa
leaq 0x10(%rsp), %rdi
movq 0x8(%rsp), %r9
jmp 0x6cb7
testb %cl, %cl
jns 0x68d0
movq 0x48(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x68d0
movl $0x1, 0x5c(%rax)
testq %r14, %r14
je 0x68fe
leal 0x1(%r15), %ebx
leaq 0x10(%rsp), %rdi
movl $0x2, %esi
movq %r9, %rdx
movl %r14d, %ecx
movl %r15d, %r8d
callq 0x9aaa
movq 0x8(%rsp), %r9
movq %rax, 0x28(%rsp)
movl %ebx, %r15d
addq %r14, %r9
subq %r14, %rbp
movsbl (%r9), %ecx
movq 0x20(%rsp), %rdi
leaq 0x5852(%rip), %rsi      # 0xc166
leaq 0x73e3(%rip), %rdx      # 0xdcfe
xorl %eax, %eax
movq %r9, %rbx
callq 0x3267
testl %ebp, %ebp
leaq 0xb2d2(%rip), %rsi      # 0x11c00
movabsq $0x100002600, %rdi      # imm = 0x100002600
jle 0x6dbc
movq %rbx, %r9
movb (%r9), %al
addb $-0x7f, %al
cmpb $-0x60, %al
ja 0x6d48
incq %r9
leal -0x1(%rbp), %eax
cmpl $0x1, %ebp
movl %eax, %ebp
jg 0x6941
jmp 0x6dbc
movb $0x1, %al
xorl %ebx, %ebx
movq %rdx, %r12
jmp 0x6973
testl %ebp, %ebp
setne %al
movq 0x28(%rsp), %rdx
movq %r9, %rcx
subq %r12, %rcx
addq %r14, %rcx
cmpq $-0x4f, %rcx
setge %cl
andb %al, %cl
movzbl %cl, %ebp
notl %r9d
addl %r12d, %r9d
subl %r14d, %r9d
leaq 0x10(%rsp), %rdi
movl $0x3, %esi
movl %r9d, %ecx
movl %r15d, %r8d
callq 0x9aaa
movl %ebp, 0x24(%rax)
testl %ebx, %ebx
je 0x6dd0
movq %rax, 0x28(%rsp)
incl %r15d
incq %r12
decl %ebx
movl %ebx, %ebp
movq %r12, %r9
movl 0x34(%rsp), %r12d
jmp 0x6d37
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x69db
orb $0x2, 0x20(%rax)
movq %rax, 0x28(%rsp)
subq %r14, %rbp
movq 0x8(%rsp), %rsi
leaq (%rsi,%r14), %rcx
incq %rcx
cmpl $0x2, %ebp
jb 0x6b2e
movq %r15, 0x38(%rsp)
subl %r14d, %ebx
movl $0x1, 0x44(%rsp)
movq %rcx, %r15
movl %ebx, %ebp
leaq -0x1(%rbp), %rbx
movl $0x2, %r13d
xorl %r12d, %r12d
movb (%r15,%r12), %al
cmpb $0x29, %al
je 0x6a6c
cmpl %r12d, %ebx
je 0x6a81
cmpb $0x5c, %al
jne 0x6a81
movb 0x1(%r15,%r12), %al
andb $-0x2, %al
cmpb $0x28, %al
jne 0x6aa8
movq 0x20(%rsp), %rdi
leaq 0x537f(%rip), %rsi      # 0xbdc1
leaq 0x71a4(%rip), %rdx      # 0xdbed
xorl %eax, %eax
callq 0x3267
movq 0x8(%rsp), %rsi
addq $0x2, %r12
addq $-0x2, %r13
leal (%r13,%rbp), %eax
cmpl $0x2, %eax
jg 0x6a1a
jmp 0x6b0d
movl 0x44(%rsp), %eax
cmpl $0x1, %eax
jle 0x6d67
decl %eax
movl %eax, 0x44(%rsp)
jmp 0x6aa8
cmpb $0x28, %al
jne 0x6ace
movq 0x20(%rsp), %rdi
leaq 0x5330(%rip), %rsi      # 0xbdc1
leaq 0x7176(%rip), %rdx      # 0xdc0e
xorl %eax, %eax
callq 0x3267
movq 0x8(%rsp), %rsi
incl 0x44(%rsp)
movl 0x1c(%rsp), %r13d
leaq (%r15,%r12), %rcx
incq %rcx
movl %ebp, %eax
subl %r12d, %eax
movl %r12d, %ebx
notl %ebx
addl %ebp, %ebx
cmpl $0x1, %eax
jg 0x6a08
jmp 0x6d52
testb %al, %al
movl 0x1c(%rsp), %r13d
jns 0x6aad
movq 0x20(%rsp), %rdi
leaq 0x5683(%rip), %rsi      # 0xc166
leaq 0x713b(%rip), %rdx      # 0xdc25
xorl %eax, %eax
callq 0x3267
movq 0x48(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x6b06
movl $0x1, 0x5c(%rax)
movq 0x8(%rsp), %rsi
jmp 0x6aad
addq %r12, %r15
subl %r12d, %ebp
movq %r15, %rcx
movl 0x1c(%rsp), %r13d
testl %ebp, %ebp
movq 0x38(%rsp), %r15
je 0x6b2e
incq %rcx
movq %rcx, %r12
decl %ebp
jmp 0x6b52
movq %rcx, %r12
xorl %ebp, %ebp
movq 0x20(%rsp), %rdi
leaq 0x5627(%rip), %rsi      # 0xc166
leaq 0x70e5(%rip), %rdx      # 0xdc2b
xorl %eax, %eax
callq 0x3267
movq 0x8(%rsp), %rsi
leaq (%rsi,%r14), %rdx
movl %r12d, %ecx
subl %esi, %ecx
subl %r14d, %ecx
leal 0x1(%r15), %ebx
leaq 0x10(%rsp), %rdi
movl $0x5, %esi
movl %r15d, %r8d
callq 0x9aaa
movq %r12, %r9
movl %ebx, %r15d
leaq 0xb07f(%rip), %rsi      # 0x11c00
movabsq $0x100002600, %rdi      # imm = 0x100002600
movl 0x34(%rsp), %r12d
jmp 0x6d48
movq %r15, 0x38(%rsp)
movq %rbp, %rax
subq %r14, %rax
leaq (%r9,%r14), %r15
incq %r15
subq %r14, %rbx
cmpl $0x2, %eax
jl 0x6c7d
movl %ebx, %ebp
movsbl (%r15), %r12d
cmpl $0x5d, %r12d
je 0x6cf9
cmpl $0x1, %ebp
je 0x6bf8
cmpb $0x5c, %r12b
jne 0x6bf8
cmpb $0x5d, 0x1(%r15)
jne 0x6bfd
addq $0x2, %r15
addl $-0x2, %ebp
movq 0x20(%rsp), %rdi
leaq 0x51d9(%rip), %rsi      # 0xbdc1
leaq 0x708a(%rip), %rdx      # 0xdc79
xorl %eax, %eax
callq 0x3267
jmp 0x6c6e
testb %r12b, %r12b
js 0x6c37
movslq %r12d, %rbx
callq 0x2200
cmpb $0x2e, %bl
je 0x6c69
movq (%rax), %rax
movzwl (%rax,%rbx,2), %eax
andl $0x800, %eax            # imm = 0x800
jne 0x6c69
movq 0x20(%rsp), %rdi
leaq 0x519d(%rip), %rsi      # 0xbdc1
leaq 0x709b(%rip), %rdx      # 0xdcc6
movl %r12d, %ecx
xorl %eax, %eax
callq 0x3267
jmp 0x6c69
movq 0x20(%rsp), %rdi
leaq 0x5523(%rip), %rsi      # 0xc166
leaq 0x7061(%rip), %rdx      # 0xdcab
movl %r12d, %ecx
xorl %eax, %eax
callq 0x3267
movq 0x48(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x6c69
movl $0x1, 0x5c(%rax)
incq %r15
decl %ebp
testl %ebp, %ebp
movq 0x8(%rsp), %r9
jne 0x6bb5
jmp 0x6c85
decq %rbp
cmpl %r14d, %ebp
jne 0x6d00
xorl %ebp, %ebp
movq 0x20(%rsp), %rdi
leaq 0x54d3(%rip), %rsi      # 0xc166
leaq 0x704a(%rip), %rdx      # 0xdce4
xorl %eax, %eax
callq 0x3267
movq 0x8(%rsp), %r9
movl 0x34(%rsp), %r12d
leaq 0x10(%rsp), %rdi
jmp 0x6d0c
leaq 0x10(%rsp), %rdi
movl %r15d, %r8d
leaq (%r9,%r14), %rdx
leal 0x1(%r8), %r15d
movl $0x1, %esi
movl $0x1, %ecx
callq 0x9aaa
movq 0x8(%rsp), %r9
testb $0x4, %r12b
je 0x6ce7
cmpb $0x3b, (%r9,%r14)
je 0x6dec
movq %rax, 0x28(%rsp)
addq %r14, %r9
incq %r9
subl %r14d, %ebx
movl %ebx, %ebp
jmp 0x6d37
movl 0x34(%rsp), %r12d
jmp 0x6d02
movl %ebx, %ebp
leaq 0x10(%rsp), %rdi
incq %r15
decl %ebp
leaq (%r9,%r14), %rdx
movl %r15d, %ecx
subl %r9d, %ecx
subl %r14d, %ecx
movq 0x38(%rsp), %r8
leal 0x1(%r8), %ebx
movl $0x4, %esi
callq 0x9aaa
movq %rax, 0x28(%rsp)
movq %r15, %r9
movl %ebx, %r15d
leaq 0xaec2(%rip), %rsi      # 0x11c00
movabsq $0x100002600, %rdi      # imm = 0x100002600
testl %ebp, %ebp
jg 0x6621
jmp 0x6dbc
leaq (%r15,%r12), %rcx
incq %rcx
notl %r12d
addl %ebp, %r12d
movl %r12d, %ebp
jmp 0x6b1b
addq %r12, %r15
subl %r12d, %ebp
movq %r15, %rcx
movl 0x1c(%rsp), %r13d
movq 0x38(%rsp), %r15
jmp 0x6b24
movq $0x0, 0x50(%rsp)
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
movl $0x6, %esi
movq %r9, %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0x9aaa
jmp 0x6dc1
leaq 0x10(%rsp), %rdi
movl $0x2, %esi
movq %r9, %rdx
movl %r14d, %ecx
movl %r15d, %r8d
callq 0x9aaa
movq 0x50(%rsp), %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x538f(%rip), %rsi      # 0xc166
leaq 0x6e8a(%rip), %rdx      # 0xdc68
movq 0x20(%rsp), %rdi
xorl %eax, %eax
callq 0x3267
jmp 0x6dbc
movq %rbp, %rax
subq %r14, %rax
leaq (%r9,%r14), %rdx
incq %rdx
cmpl $0x1, %eax
jle 0x6e20
leaq (%r9,%rbp), %rcx
decq %rcx
movzbl (%rcx), %esi
cmpl $0xd, %esi
je 0x6e12
cmpl $0xa, %esi
jne 0x6e27
decq %rcx
decl %eax
cmpl $0x1, %eax
jg 0x6e05
xorl %ebp, %ebp
jmp 0x6e2b
decl %ebp
subq %r14, %rbp
jmp 0x6e2b
decl %eax
movl %eax, %ebp
leaq 0x10(%rsp), %rdi
movl $0x6, %esi
movl %ebp, %ecx
jmp 0x6db4