// File: /workspace/github_c_makefile_star2_O1/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, 0x18(%rsp)
movl %edx, %ebp
movq %rsi, %r13
movq %rdi, 0x40(%rsp)
testb $0x3, %cl
je 0x6c57
movl %ecx, %eax
andl $0x2, %eax
cmpl $0x1, %eax
movl $0x2, %eax
sbbl $0x0, %eax
movl %eax, 0x3c(%rsp)
leaq 0x48(%rsp), %rax
movq $0x0, (%rax)
movq %rax, 0x28(%rsp)
testl %ebp, %ebp
jle 0x6c8b
movl %ecx, 0x54(%rsp)
leaq 0xb6af(%rip), %rdi      # 0x11bf0
movq %r13, 0x30(%rsp)
movabsq $0x100002600, %r8       # imm = 0x100002600
xorl %eax, %eax
movq $0x0, 0x20(%rsp)
movq %rax, 0x8(%rsp)
leal -0x1(%rbp), %r14d
movl %ebp, %ebx
movl $0x1, %eax
xorl %r12d, %r12d
movl 0x3c(%rsp), %esi
leaq 0x28(%rsp), %r15
movq 0x30(%rsp), %r13
movzbl (%r13,%r12), %ecx
cmpl $0x22, %ecx
je 0x665c
cmpl $0x5b, %ecx
je 0x6794
cmpl $0x28, %ecx
je 0x6628
movzbl (%rcx,%rdi), %edx
testl %edx, %esi
jne 0x68ae
cmpb $0x20, %cl
ja 0x65b4
btq %rcx, %r8
jb 0x65d3
leal -0x7f(%rcx), %edx
cmpb $-0x60, %dl
jbe 0x68db
incq %r12
decq %rax
leal (%rax,%rbx), %ecx
cmpl $0x1, %ecx
jg 0x657c
jmp 0x6c7f
testq %r12, %r12
je 0x65fd
movq 0x8(%rsp), %r8
leal 0x1(%r8), %ebx
movq %r15, %rdi
movl $0x2, %esi
movq %r13, %rdx
movl %r12d, %ecx
callq 0x987a
leaq 0xb5f5(%rip), %rdi      # 0x11bf0
jmp 0x6609
movq 0x8(%rsp), %rax
movl %eax, %ebx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x6612
orb $0x1, 0x20(%rax)
movq %rax, 0x20(%rsp)
addq %r12, %r13
incq %r13
subl %r12d, %r14d
movl %r14d, %ebp
jmp 0x6b56
testq %r12, %r12
je 0x6988
movq 0x8(%rsp), %r8
leal 0x1(%r8), %ebp
movq %r15, %rdi
movl $0x2, %esi
movq %r13, %rdx
movl %r12d, %ecx
callq 0x987a
movq %rax, %rcx
movl %ebp, %eax
movq %rax, 0x8(%rsp)
jmp 0x698d
testq %r12, %r12
je 0x6684
movq 0x8(%rsp), %r8
leal 0x1(%r8), %ebp
movq %r15, %rdi
movl $0x2, %esi
movq %r13, %rdx
movl %r12d, %ecx
callq 0x987a
movl %ebp, %eax
movq %rax, 0x8(%rsp)
subq %r12, %rbx
leaq (%r12,%r13), %rdx
incq %rdx
subq %r12, %r14
cmpl $0x1, %ebx
jle 0x6927
movl $0x1, %ebx
movq %rdx, 0x20(%rsp)
movq %rdx, %r13
leaq 0xb542(%rip), %rdx      # 0x11bf0
movzbl (%r13), %eax
cmpq $0x22, %rax
je 0x6785
cmpl $0x1, %r14d
je 0x66e0
cmpb $0x5c, %al
jne 0x66e0
cmpb $0x22, 0x1(%r13)
jne 0x66e0
xorl %ebx, %ebx
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
movl $0x2, %r15d
jmp 0x6779
testl %ebx, %ebx
je 0x66f3
movzbl (%rax,%rdx), %ecx
xorl %ebx, %ebx
testl %ecx, 0x3c(%rsp)
sete %bl
jmp 0x66f5
xorl %ebx, %ebx
cmpq $0xd, %rax
je 0x6700
cmpl $0xa, %eax
jne 0x6731
movq 0x18(%rsp), %rcx
movq %rcx, %rdi
leaq 0x5722(%rip), %rsi      # 0xbe31
leaq 0x759c(%rip), %rdx      # 0xdcb2
xorl %eax, %eax
callq 0x4ae3
leaq 0xb4cc(%rip), %rdx      # 0x11bf0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0x1, %r15d
jmp 0x6779
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0x1, %r15d
testb %al, %al
jns 0x6779
movq 0x18(%rsp), %rcx
movq %rcx, %rdi
leaq 0x5a87(%rip), %rsi      # 0xc1d6
leaq 0x7543(%rip), %rdx      # 0xdc99
xorl %eax, %eax
callq 0x4ae3
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x6772
movl $0x1, 0x5c(%rax)
leaq 0xb477(%rip), %rdx      # 0x11bf0
addq %r15, %r13
addl %ebp, %r14d
jg 0x66ae
testl %ebx, %ebx
setne %al
movq 0x20(%rsp), %rdx
jmp 0x692c
testq %r12, %r12
je 0x67bc
movq 0x8(%rsp), %r8
leal 0x1(%r8), %ebp
movq %r15, %rdi
movl $0x2, %esi
movq %r13, %rdx
movl %r12d, %ecx
callq 0x987a
movl %ebp, %eax
movq %rax, 0x8(%rsp)
leaq 0x755c(%rip), %rbp      # 0xdd1f
subq %r12, %rbx
addq %r12, %r13
incq %r13
subq %r12, %r14
cmpl $0x1, %ebx
jle 0x6897
movsbl (%r13), %ebx
cmpl $0x5d, %ebx
je 0x6897
cmpl $0x1, %r14d
je 0x681c
cmpb $0x5c, %bl
jne 0x681c
cmpb $0x5d, 0x1(%r13)
jne 0x681c
addq $0x2, %r13
addl $-0x2, %r14d
movq 0x18(%rsp), %rdi
leaq 0x5625(%rip), %rsi      # 0xbe31
leaq 0x74da(%rip), %rdx      # 0xdced
xorl %eax, %eax
callq 0x4ae3
jmp 0x688e
testb %bl, %bl
js 0x685b
movslq %ebx, %r15
callq 0x21f0
cmpb $0x2e, %r15b
je 0x6888
movq (%rax), %rax
movzwl (%rax,%r15,2), %eax
andl $0x800, %eax            # imm = 0x800
jne 0x6888
movq 0x18(%rsp), %rdi
leaq 0x55e8(%rip), %rsi      # 0xbe31
leaq 0x74ea(%rip), %rdx      # 0xdd3a
movl %ebx, %ecx
xorl %eax, %eax
callq 0x4ae3
jmp 0x6888
movq 0x18(%rsp), %rdi
leaq 0x596f(%rip), %rsi      # 0xc1d6
movq %rbp, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x4ae3
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x6888
movl $0x1, 0x5c(%rax)
incq %r13
decl %r14d
testl %r14d, %r14d
jg 0x67d8
testl %r14d, %r14d
je 0x6b05
incq %r13
decl %r14d
movl %r14d, %ebp
jmp 0x6b21
testq %r12, %r12
je 0x6b77
movq 0x8(%rsp), %r8
leal 0x1(%r8), %ebp
movq %r15, %rdi
movl $0x2, %esi
movq %r13, %rdx
movl %r12d, %ecx
callq 0x987a
movl %ebp, %r8d
jmp 0x6b7c
testb %cl, %cl
jns 0x68f4
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x68f4
movl $0x1, 0x5c(%rax)
testq %r12, %r12
je 0x6bc0
movq 0x8(%rsp), %r8
leal 0x1(%r8), %eax
movl %eax, 0x14(%rsp)
movq %r15, %rdi
movl $0x2, %esi
movq %r13, %rdx
movl %r12d, %ecx
callq 0x987a
movq %rax, 0x20(%rsp)
jmp 0x6bc9
movb $0x1, %al
movq %rdx, %r13
movq 0x30(%rsp), %rcx
movq %rcx, %rsi
subq %r13, %rsi
addq %r12, %rsi
cmpq $-0x4f, %rsi
setge %sil
andb %al, %sil
movzbl %sil, %ebx
notl %ecx
addl %r13d, %ecx
subl %r12d, %ecx
movq 0x8(%rsp), %r8
leal 0x1(%r8), %r15d
leaq 0x28(%rsp), %rdi
movl $0x3, %esi
callq 0x987a
movq %rax, 0x20(%rsp)
movl %ebx, 0x24(%rax)
testl %r14d, %r14d
je 0x6ad3
incq %r13
decl %r14d
movl %r14d, %ebp
jmp 0x6aef
movq 0x20(%rsp), %rcx
testq %rcx, %rcx
je 0x6996
orb $0x2, 0x20(%rcx)
movq %rcx, 0x20(%rsp)
subq %r12, %rbx
addq %r12, %r13
incq %r13
subq %r12, %r14
cmpl $0x1, %ebx
jle 0x6a7c
movl $0x1, %ebx
movb (%r13), %al
cmpb $0x29, %al
jne 0x69c8
cmpl $0x2, %ebx
jl 0x6a7c
decl %ebx
cmpl $0x1, %r14d
je 0x6a05
cmpb $0x5c, %al
jne 0x6a05
movb 0x1(%r13), %cl
andb $-0x2, %cl
cmpb $0x28, %cl
jne 0x6a05
movq 0x18(%rsp), %rdi
leaq 0x5447(%rip), %rsi      # 0xbe31
leaq 0x7270(%rip), %rdx      # 0xdc61
xorl %eax, %eax
callq 0x4ae3
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
movl $0x2, %r15d
jmp 0x6a70
cmpb $0x28, %al
jne 0x6a32
movq 0x18(%rsp), %rdi
leaq 0x541c(%rip), %rsi      # 0xbe31
leaq 0x7266(%rip), %rdx      # 0xdc82
xorl %eax, %eax
callq 0x4ae3
incl %ebx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0x1, %r15d
jmp 0x6a70
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0x1, %r15d
testb %al, %al
jns 0x6a70
movq 0x18(%rsp), %rdi
leaq 0x5789(%rip), %rsi      # 0xc1d6
leaq 0x7245(%rip), %rdx      # 0xdc99
xorl %eax, %eax
callq 0x4ae3
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x6a70
movl $0x1, 0x5c(%rax)
addq %r15, %r13
addl %ebp, %r14d
jg 0x69b5
testl %r14d, %r14d
je 0x6a8c
incq %r13
decl %r14d
movl %r14d, %ebp
jmp 0x6aa8
xorl %ebp, %ebp
movq 0x18(%rsp), %rdi
leaq 0x573c(%rip), %rsi      # 0xc1d6
leaq 0x71fe(%rip), %rdx      # 0xdc9f
xorl %eax, %eax
callq 0x4ae3
movq 0x8(%rsp), %r8
movq 0x30(%rsp), %rax
leaq (%rax,%r12), %rdx
movl %r13d, %ecx
subl %eax, %ecx
subl %r12d, %ecx
leal 0x1(%r8), %ebx
leaq 0x28(%rsp), %rdi
movl $0x5, %esi
callq 0x987a
jmp 0x6b4f
xorl %ebp, %ebp
movq 0x18(%rsp), %rdi
leaq 0x56f5(%rip), %rsi      # 0xc1d6
leaq 0x71f4(%rip), %rdx      # 0xdcdc
xorl %eax, %eax
callq 0x4ae3
leaq 0xb0fa(%rip), %rdi      # 0x11bf0
movabsq $0x100002600, %r8       # imm = 0x100002600
movl %r15d, %ebx
jmp 0x6b60
xorl %ebp, %ebp
movq 0x18(%rsp), %rdi
leaq 0x56c3(%rip), %rsi      # 0xc1d6
leaq 0x723e(%rip), %rdx      # 0xdd58
xorl %eax, %eax
callq 0x4ae3
movq 0x8(%rsp), %r8
movq 0x30(%rsp), %rax
leaq (%rax,%r12), %rdx
movl %r13d, %ecx
subl %eax, %ecx
subl %r12d, %ecx
leal 0x1(%r8), %ebx
leaq 0x28(%rsp), %rdi
movl $0x4, %esi
callq 0x987a
movq %rax, 0x20(%rsp)
leaq 0xb09a(%rip), %rdi      # 0x11bf0
movabsq $0x100002600, %r8       # imm = 0x100002600
movl %ebx, %eax
movq %r13, 0x30(%rsp)
movq %r13, %r12
testl %ebp, %ebp
jg 0x655b
jmp 0x6c90
movq 0x8(%rsp), %r8
leaq (%r12,%r13), %rdx
leal 0x1(%r8), %eax
movl %eax, 0x14(%rsp)
movq %r15, %rdi
movl $0x1, %esi
movl $0x1, %ecx
callq 0x987a
testb $0x4, 0x54(%rsp)
je 0x6bad
cmpb $0x3b, (%r13,%r12)
je 0x6cc4
movq %rax, 0x20(%rsp)
addq %r12, %r13
incq %r13
subl %r12d, %r14d
movl %r14d, %ebp
jmp 0x6c3d
movq 0x8(%rsp), %rax
movl %eax, 0x14(%rsp)
movq %r13, %r14
addq %r12, %r13
movq %rbx, %rbp
subq %r12, %rbp
movsbl (%r13), %ecx
movq 0x18(%rsp), %rdi
leaq 0x55f0(%rip), %rsi      # 0xc1d6
leaq 0x7185(%rip), %rdx      # 0xdd72
xorl %eax, %eax
callq 0x4ae3
testl %ebp, %ebp
jle 0x6c3d
decl %ebx
leaq (%r14,%rbx), %rax
incq %rax
leaq 0xafe8(%rip), %rdi      # 0x11bf0
movabsq $0x100002600, %r8       # imm = 0x100002600
movl 0x14(%rsp), %ebx
movb (%r13), %cl
addb $-0x7f, %cl
cmpb $-0x60, %cl
ja 0x6b60
incq %r13
leal -0x1(%rbp), %ecx
cmpl $0x1, %ebp
movl %ecx, %ebp
jg 0x6c16
xorl %ebp, %ebp
movq %rax, %r13
jmp 0x6b60
leaq 0xafac(%rip), %rdi      # 0x11bf0
movabsq $0x100002600, %r8       # imm = 0x100002600
movl 0x14(%rsp), %ebx
jmp 0x6b60
leaq 0x48(%rsp), %rax
movq $0x0, (%rax)
leaq 0x28(%rsp), %rdi
movq %rax, (%rdi)
movl $0x6, %esi
movq %r13, %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0x987a
jmp 0x6cb5
addq %r13, %r12
movq 0x8(%rsp), %rax
movl %eax, %ebx
jmp 0x6c90
xorl %ebx, %ebx
movq %r13, %r12
cmpq %r13, %r12
je 0x6cb0
subl %r13d, %r12d
leaq 0x28(%rsp), %rdi
movl $0x2, %esi
movq %r13, %rdx
movl %r12d, %ecx
movl %ebx, %r8d
callq 0x987a
movq 0x48(%rsp), %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rax
subq %r12, %rax
leaq (%r12,%r13), %rdx
incq %rdx
cmpl $0x1, %eax
jle 0x6cf8
leaq (%rbx,%r13), %rcx
decq %rcx
movzbl (%rcx), %esi
cmpl $0xd, %esi
je 0x6cea
cmpl $0xa, %esi
jne 0x6cff
decq %rcx
decl %eax
cmpl $0x1, %eax
jg 0x6cdd
xorl %ebx, %ebx
jmp 0x6d03
decl %ebx
subq %r12, %rbx
jmp 0x6d03
decl %eax
movl %eax, %ebx
leaq 0x28(%rsp), %rdi
movl $0x6, %esi
movl %ebx, %ecx
movl 0x14(%rsp), %r8d
jmp 0x6cab