// File: /workspace/github_c_makefile_star2_O2/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, 0x28(%rsp)
movl %edx, %r15d
movq %rsi, %r9
movq %rdi, 0x38(%rsp)
leaq 0x40(%rsp), %rax
testb $0x3, %cl
je 0x6884
movl %ecx, 0x4c(%rsp)
andl $0x2, %ecx
cmpl $0x1, %ecx
pushq $0x2
popq %rbp
sbbl $0x0, %ebp
andq $0x0, 0x40(%rsp)
leaq 0x18(%rsp), %rcx
movq %rax, (%rcx)
pushq $0x1
popq %r14
leaq 0xca9a(%rip), %rbx      # 0x12c00
movabsq $0x100002600, %rdx      # imm = 0x100002600
movq $0x0, 0x10(%rsp)
movq $0x0, (%rsp)
movl %ebp, 0x24(%rsp)
movl %r15d, %r13d
xorl %r15d, %r15d
xorl %r12d, %r12d
movq %r9, 0x8(%rsp)
leal (%r12,%r13), %eax
testl %eax, %eax
jle 0x685e
movzbl (%r9,%r15), %eax
cmpl $0x22, %eax
je 0x6251
cmpl $0x5b, %eax
je 0x62ba
cmpl $0x28, %eax
je 0x6286
movzbl (%rax,%rbx), %ecx
testl %ecx, %ebp
jne 0x63d1
cmpb $0x20, %al
ja 0x61d5
btq %rax, %rdx
jb 0x61e9
leal -0x7f(%rax), %ecx
cmpb $-0x60, %cl
jbe 0x640a
decq %r12
incq %r15
jmp 0x6193
testq %r12, %r12
je 0x6227
movl %r12d, %ecx
negl %ecx
movq (%rsp), %r8
leal 0x1(%r8), %ebx
leaq 0x18(%rsp), %rdi
pushq $0x2
popq %rsi
movq %r9, %rdx
callq 0x90cc
movabsq $0x100002600, %rdx      # imm = 0x100002600
movq %rax, %rcx
movl %ebx, %eax
movq %rax, (%rsp)
leaq 0xc9db(%rip), %rbx      # 0x12c00
jmp 0x622c
movq 0x10(%rsp), %rcx
testq %rcx, %rcx
je 0x6235
orb $0x1, 0x20(%rcx)
movq %rcx, 0x10(%rsp)
movq 0x8(%rsp), %r9
subq %r12, %r9
incq %r9
leal (%r12,%r13), %r15d
decl %r15d
jmp 0x6185
testq %r12, %r12
je 0x64f6
movl %r12d, %ecx
negl %ecx
movq (%rsp), %r8
leal 0x1(%r8), %eax
movq %rax, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
pushq $0x2
popq %rsi
movq %r9, %rdx
callq 0x90cc
movq 0x8(%rsp), %r9
jmp 0x64ff
testq %r12, %r12
je 0x665b
movl %r12d, %ecx
negl %ecx
movq (%rsp), %r8
leal 0x1(%r8), %ebx
leaq 0x18(%rsp), %rdi
pushq $0x2
popq %rsi
movq %r9, %rdx
callq 0x90cc
movq %rax, %rcx
movl %ebx, %eax
movq %rax, (%rsp)
jmp 0x6660
testq %r12, %r12
je 0x62e7
movl %r12d, %ecx
negl %ecx
movq (%rsp), %r8
leal 0x1(%r8), %ebx
leaq 0x18(%rsp), %rdi
pushq $0x2
popq %rsi
movq %r9, %rdx
callq 0x90cc
movq 0x8(%rsp), %r9
movl %ebx, %eax
movq %rax, (%rsp)
movq %r9, %rax
subq %r12, %rax
movq %rax, 0x10(%rsp)
leaq 0x1(%rax), %rbp
leal (%r12,%r13), %r15d
decl %r15d
testl %r15d, %r15d
jle 0x64b2
movsbl (%rbp), %r13d
cmpl $0x5d, %r13d
je 0x64b8
cmpl $0x1, %r15d
je 0x6350
cmpb $0x5c, %r13b
jne 0x6350
cmpb $0x5d, 0x1(%rbp)
jne 0x6355
addq $0x2, %rbp
addl $-0x2, %r15d
movq 0x28(%rsp), %rdi
leaq 0x5aa6(%rip), %rsi      # 0xbde1
leaq 0x7957(%rip), %rdx      # 0xdc99
xorl %eax, %eax
callq 0x48c0
movq 0x8(%rsp), %r9
jmp 0x62fd
testb %r13b, %r13b
js 0x638f
movslq %r13d, %rbx
callq 0x2200
cmpb $0x2e, %bl
je 0x63c1
movq (%rax), %rax
movzwl (%rax,%rbx,2), %eax
andl $0x800, %eax            # imm = 0x800
jne 0x63c1
movq 0x28(%rsp), %rdi
leaq 0x5a65(%rip), %rsi      # 0xbde1
leaq 0x7963(%rip), %rdx      # 0xdce6
movl %r13d, %ecx
xorl %eax, %eax
callq 0x48c0
jmp 0x63c1
movq 0x28(%rsp), %rdi
leaq 0x5deb(%rip), %rsi      # 0xc186
leaq 0x7929(%rip), %rdx      # 0xdccb
movl %r13d, %ecx
xorl %eax, %eax
callq 0x48c0
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x63c1
movl $0x1, 0x5c(%rax)
incq %rbp
decl %r15d
movq 0x8(%rsp), %r9
jmp 0x62fd
movl %r14d, %ebx
testq %r12, %r12
je 0x67cb
movl %r12d, %ecx
negl %ecx
movq (%rsp), %r8
leal 0x1(%r8), %ebp
leaq 0x18(%rsp), %r14
movq %r14, %rdi
pushq $0x2
popq %rsi
movq %r9, %rdx
callq 0x90cc
movq 0x8(%rsp), %r9
movl %ebp, %r8d
jmp 0x67d4
testb %al, %al
jns 0x6423
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x6423
movl $0x1, 0x5c(%rax)
testq %r12, %r12
je 0x645c
movl %r12d, %ecx
negl %ecx
movq (%rsp), %r8
leal 0x1(%r8), %ebx
leaq 0x18(%rsp), %rdi
pushq $0x2
popq %rsi
movq %r9, %rdx
callq 0x90cc
movq 0x8(%rsp), %r9
movq %rax, 0x10(%rsp)
movl %ebx, %eax
movq %rax, (%rsp)
leaq 0xc7a4(%rip), %rbx      # 0x12c00
addq %r12, %r13
movsbl (%r9,%r15), %ecx
subq %r12, %r9
movq 0x28(%rsp), %rdi
leaq 0x5d13(%rip), %rsi      # 0xc186
leaq 0x78a4(%rip), %rdx      # 0xdd1e
xorl %eax, %eax
movq %r9, %r15
callq 0x48c0
movq %r15, %r9
movl %r13d, %r15d
movabsq $0x100002600, %rdx      # imm = 0x100002600
testl %r15d, %r15d
jle 0x6185
movb (%r9), %al
addb $-0x7f, %al
cmpb $-0x60, %al
ja 0x6185
incq %r9
decl %r15d
jmp 0x6494
je 0x6837
incq %rbp
decl %r15d
movl %ebp, %eax
subl %r9d, %eax
addl %eax, %r12d
movq (%rsp), %r8
leal 0x1(%r8), %ebx
leaq 0x18(%rsp), %rdi
pushq $0x4
popq %rsi
movq 0x10(%rsp), %rdx
movl %r12d, %ecx
callq 0x90cc
movq %rax, 0x10(%rsp)
movq %rbp, %r9
movl %ebx, %eax
movq %rax, (%rsp)
jmp 0x681d
movq (%rsp), %rax
movq %rax, 0x10(%rsp)
movq %r9, %rbp
subq %r12, %rbp
incq %rbp
leal (%r12,%r13), %r15d
decl %r15d
movq %rbp, %r13
movl %r14d, %ecx
testl %r15d, %r15d
jle 0x65de
movzbl (%r13), %eax
cmpq $0x22, %rax
je 0x65de
cmpl $0x1, %r15d
je 0x654a
cmpb $0x5c, %al
jne 0x654a
xorl %ebx, %ebx
cmpb $0x22, 0x1(%r13)
pushq $0x2
popq %rdx
pushq $-0x2
popq %rsi
je 0x65d1
testl %ecx, %ecx
je 0x6564
leaq 0xc6ab(%rip), %rcx      # 0x12c00
movzbl (%rax,%rcx), %ecx
xorl %ebx, %ebx
testl %ecx, 0x24(%rsp)
sete %bl
jmp 0x6566
xorl %ebx, %ebx
cmpq $0xd, %rax
je 0x6571
cmpl $0xa, %eax
jne 0x6590
movq 0x28(%rsp), %rcx
movq %rcx, %rdi
leaq 0x5861(%rip), %rsi      # 0xbde1
leaq 0x76d7(%rip), %rdx      # 0xdc5e
xorl %eax, %eax
callq 0x48c0
jmp 0x65c6
testb %al, %al
jns 0x65c6
movq 0x28(%rsp), %rcx
movq %rcx, %rdi
leaq 0x5be3(%rip), %rsi      # 0xc186
leaq 0x769b(%rip), %rdx      # 0xdc45
xorl %eax, %eax
callq 0x48c0
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x65c6
movl $0x1, 0x5c(%rax)
pushq $0x1
popq %rdx
pushq $-0x1
popq %rsi
movq 0x8(%rsp), %r9
addq %rdx, %r13
addl %esi, %r15d
movl %ebx, %ecx
jmp 0x6515
testl %ecx, %ecx
setne %al
movq %r9, %rcx
subq %r13, %rcx
subq %r12, %rcx
cmpq $-0x4f, %rcx
setge %cl
andb %al, %cl
movzbl %cl, %ebx
notl %r9d
addl %r13d, %r12d
addl %r9d, %r12d
movq 0x10(%rsp), %r8
leal 0x1(%r8), %eax
movq %rax, (%rsp)
leaq 0x18(%rsp), %rdi
pushq $0x3
popq %rsi
movq %rbp, %rdx
movl %r12d, %ecx
callq 0x90cc
movq %rax, 0x10(%rsp)
movl %ebx, 0x24(%rax)
testl %r15d, %r15d
je 0x6636
incq %r13
decl %r15d
jmp 0x6653
xorl %r15d, %r15d
movq 0x28(%rsp), %rdi
leaq 0x5b41(%rip), %rsi      # 0xc186
leaq 0x763c(%rip), %rdx      # 0xdc88
xorl %eax, %eax
callq 0x48c0
movq %r13, %r9
jmp 0x681d
movq 0x10(%rsp), %rcx
testq %rcx, %rcx
je 0x6669
orb $0x2, 0x20(%rcx)
movq %rcx, 0x10(%rsp)
addq %r12, %r13
movq 0x8(%rsp), %rbp
subq %r12, %rbp
movl %r14d, 0x34(%rsp)
movq %rbp, 0x50(%rsp)
movl %r13d, %r15d
leal -0x1(%r15), %r13d
movl %r15d, %r14d
addq $-0x2, %r14
xorl %ebx, %ebx
testl %r13d, %r13d
jle 0x6754
movb 0x1(%rbp,%rbx), %al
cmpb $0x29, %al
je 0x66db
cmpl %ebx, %r14d
je 0x66f0
cmpb $0x5c, %al
jne 0x66f0
movb 0x2(%rbp,%rbx), %al
andb $-0x2, %al
cmpb $0x28, %al
jne 0x6727
movq 0x28(%rsp), %rdi
leaq 0x571e(%rip), %rsi      # 0xbde1
leaq 0x7543(%rip), %rdx      # 0xdc0d
xorl %eax, %eax
callq 0x48c0
addl $-0x2, %r13d
addq $0x2, %rbx
jmp 0x6693
movl 0x34(%rsp), %eax
cmpl $0x2, %eax
jl 0x6782
decl %eax
movl %eax, 0x34(%rsp)
jmp 0x6727
cmpb $0x28, %al
je 0x6732
testb %al, %al
jns 0x6727
movq 0x28(%rsp), %rdi
leaq 0x5a82(%rip), %rsi      # 0xc186
leaq 0x753a(%rip), %rdx      # 0xdc45
xorl %eax, %eax
callq 0x48c0
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x6727
movl $0x1, 0x5c(%rax)
addq %rbx, %rbp
incq %rbp
jmp 0x6683
movq 0x28(%rsp), %rdi
leaq 0x56a3(%rip), %rsi      # 0xbde1
leaq 0x74e9(%rip), %rdx      # 0xdc2e
xorl %eax, %eax
callq 0x48c0
movl 0x34(%rsp), %eax
incl %eax
jmp 0x66ea
leal -0x1(%r15), %eax
cmpl %ebx, %eax
jne 0x6782
leaq (%rbx,%rbp), %r14
incq %r14
xorl %r15d, %r15d
movq 0x28(%rsp), %rdi
leaq 0x5a14(%rip), %rsi      # 0xc186
leaq 0x74d2(%rip), %rdx      # 0xdc4b
xorl %eax, %eax
callq 0x48c0
jmp 0x6791
leaq (%rbx,%rbp), %r14
addq $0x2, %r14
subl %ebx, %r15d
addl $-0x2, %r15d
movl %r14d, %eax
subl 0x8(%rsp), %eax
addl %eax, %r12d
movq (%rsp), %r8
leal 0x1(%r8), %ebx
leaq 0x18(%rsp), %rdi
pushq $0x5
popq %rsi
movq 0x50(%rsp), %rdx
movl %r12d, %ecx
callq 0x90cc
movq %r14, %r9
movl %ebx, %eax
movq %rax, (%rsp)
movl 0x24(%rsp), %ebp
pushq $0x1
popq %r14
jmp 0x6821
leaq 0x18(%rsp), %r14
movq (%rsp), %r8
movq %r9, %rbp
subq %r12, %rbp
leal 0x1(%r8), %eax
movq %rax, (%rsp)
movq %r14, %rdi
movl %ebx, %r14d
movl %ebx, %esi
movq %rbp, %rdx
movl %ebx, %ecx
callq 0x90cc
movq 0x8(%rsp), %rcx
movq %rax, 0x10(%rsp)
testb $0x4, 0x4c(%rsp)
je 0x6810
cmpb $0x3b, (%rcx,%r15)
je 0x68b2
incq %rbp
leal (%r12,%r13), %r15d
decl %r15d
movq %rbp, %r9
movl 0x24(%rsp), %ebp
leaq 0xc3d8(%rip), %rbx      # 0x12c00
movabsq $0x100002600, %rdx      # imm = 0x100002600
jmp 0x6185
xorl %r15d, %r15d
movq 0x28(%rsp), %rdi
leaq 0x5940(%rip), %rsi      # 0xc186
leaq 0x74b7(%rip), %rdx      # 0xdd04
xorl %eax, %eax
callq 0x48c0
movq 0x8(%rsp), %r9
jmp 0x64be
testq %r12, %r12
je 0x687d
negl %r12d
leaq 0x18(%rsp), %rdi
pushq $0x2
popq %rsi
movq %r9, %rdx
movl %r12d, %ecx
movq (%rsp), %r8
callq 0x90cc
movq 0x40(%rsp), %rax
jmp 0x68a3
andq $0x0, 0x40(%rsp)
leaq 0x18(%rsp), %rdi
movq %rax, (%rdi)
pushq $0x6
popq %rsi
movq %r9, %rdx
movl %r15d, %ecx
xorl %r8d, %r8d
callq 0x90cc
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq (%rcx,%r13), %rax
decq %rax
addl %r12d, %r13d
incq %rbp
movq (%rsp), %r8
cmpl $0x2, %r13d
jl 0x68de
movzbl (%rax), %ecx
cmpl $0xd, %ecx
je 0x68d6
cmpl $0xa, %ecx
jne 0x68de
decq %rax
decl %r13d
jmp 0x68c3
decl %r13d
leaq 0x18(%rsp), %rdi
pushq $0x6
popq %rsi
movq %rbp, %rdx
movl %r13d, %ecx
jmp 0x6878