// File: /workspace/github_c_makefile_star2_O0/ksherlock[P]nroff_man/read1.c
// Function: analyze
static unsigned analyze(unsigned *i_ptr) {
	/*
		& 0x01 -> escape sequence detected
		& 0x02 -> continuation detected.
		& 0x04 -> invalid escape sequence detected (and removed)
		& 0x08 -> unsupported escape sequence removed. (or font replacement)
	*/
	unsigned i = *i_ptr;
	unsigned j;
	unsigned kill = 0;
	uint_fast8_t c;
	unsigned rv = 0;

	for (; ;) {
		j = i;
		c = buffer[i++];
		if (c == 0) return rv;
		if (c == '\r' || c == '\n')  goto exit;
		if (c == ' ' || c == '\t') continue;
		if (c >= 0x80 || c < 0x20) { buffer[j] = XSPACE; rv |= 0x08; continue; }
		if (c != ec) continue;
		c = buffer[i++];
		switch(c) {
			default:
				rv |= 0x01;
				break;

			case 0:
			case '\r':
			case '\n':
				rv |= 0x02;
				goto exit;
				break;

			case '"': /* comment */
				goto exit;
			case '#': /* groff comment */
				if (flags.W >= 3) {
					man_warnx("non-standard GNU # comment");					
				}
				rv |= 0x02;
				goto exit;

			case '*':
				/* \*X, \*(XX, or \*[...] */
				c = buffer[i++];
				if (c == 0) goto invalid;
				if (c == '(') goto paren;
				if (c == '[') goto bracket;
				rv |= 0x01;
				break;

			case '[':
			bracket:
				for(;;) {
					c = buffer[i++];
					if (c == 0) goto invalid;
					if (c == ']') break;
				}
				rv |= 0x01;
				break;

			case '(':
			paren:
				c = buffer[i++];
				if (c == 0) goto invalid;
				c = buffer[i++];
				if (c == 0) goto invalid;
				rv |= 0x01;
				break;

#if 0
			case 'f':
				c = buffer[i++];
				if (c == 'C') c = buffer[i++];
				if (c == 0) goto invalid;
				if (c == '[') goto bracket;
				if (c == '(') goto paren;
				rv |= 0x01;
				break;
#endif

			case 'f':
				/* \fC?[BIRP] */
				/* \fC?[321] */
				/* \f(BI */
				c = buffer[i++];
				if (c == 'C') c = buffer[i++];
				if (get_arg(&i, c) < 0) goto invalid;
				kill = 1;
				switch(arg_buffer[0]) {
					default:
					case 'R': case '1': buffer[j++] = FONT_R; break;
					case 'B': case '3': buffer[j++] = FONT_B; break;
					case 'I': case '2': buffer[j++] = FONT_I; break;
					case 'P': buffer[j++] = FONT_P; break;
				}
				break;

			/* everything below are stripped. */
			case 'F': case 'g': case 'k': case 'M': case 'm': 
			case 'n': case 'V': case 'Y':
				c = buffer[i++];
				if (c == 0) goto invalid;
				kill = 1;
				if (c == '(') goto paren;
				if (c == '[') goto bracket;

				break;

			case 'A': case 'B': case 'b': case 'C': case 'D': 
			case 'H': case 'h': case 'L': case 'l': case 'N': 
			case 'o': case 'R': case 'S': case 's': case 'v': 
			case 'w': case 'X': case 'x': case 'Z':
				c = buffer[i++];
				if (c != '\'') goto invalid;
				for(;;) {
					c = buffer[i++];
					if (c == 0) goto invalid;
					if (c == '\'') break;
				}
				rv |= 0x01;
				kill = 1;
				break;
		}
		if (kill) {
			rv |= 0x08;
			while (j < i) buffer[j++] = XSPACE;
			kill = 0;
		}
	}

invalid:
	rv |= 0x04;

exit:
	buffer[j] = 0;

	if (rv & 0x08) {
		/* remove XSPACEs. */
		i = j = *i_ptr;

		for(;;++i) {
			c = buffer[i];
			if (c == 0) break;
			if (c == XSPACE) continue;
			buffer[j++] = c;
		}
		buffer[j] = 0;
	}
	*i_ptr = j;

	return rv;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x14(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa5c1(%rip), %rax      # 0x10300
movb (%rax,%rcx), %al
movb %al, -0x1d(%rbp)
movzbl -0x1d(%rbp), %eax
cmpl $0x0, %eax
jne 0x5d59
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x61df
movzbl -0x1d(%rbp), %eax
cmpl $0xd, %eax
je 0x5d6b
movzbl -0x1d(%rbp), %eax
cmpl $0xa, %eax
jne 0x5d70
jmp 0x6148
movzbl -0x1d(%rbp), %eax
cmpl $0x20, %eax
je 0x5d82
movzbl -0x1d(%rbp), %eax
cmpl $0x9, %eax
jne 0x5d84
jmp 0x5d23
movzbl -0x1d(%rbp), %eax
cmpl $0x80, %eax
jge 0x5d98
movzbl -0x1d(%rbp), %eax
cmpl $0x20, %eax
jge 0x5db6
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0xa55c(%rip), %rax      # 0x10300
movb $-0x7f, (%rax,%rcx)
movl -0x24(%rbp), %eax
orl $0x8, %eax
movl %eax, -0x24(%rbp)
jmp 0x5d23
movzbl -0x1d(%rbp), %eax
movzbl 0x857d(%rip), %ecx      # 0xe33e
cmpl %ecx, %eax
je 0x5dca
jmp 0x5d23
movl -0x14(%rbp), %eax
movl %eax, %ecx
incl %ecx
movl %ecx, -0x14(%rbp)
leaq 0xa525(%rip), %rcx      # 0x10300
movb (%rax,%rcx), %al
movb %al, -0x1d(%rbp)
movzbl -0x1d(%rbp), %eax
movq %rax, -0x30(%rbp)
subq $0x78, %rax
ja 0x5e03
movq -0x30(%rbp), %rax
leaq 0x5642(%rip), %rcx      # 0xb43c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x24(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x6100
movl -0x24(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x24(%rbp)
jmp 0x6148
jmp 0x6148
cmpl $0x3, 0xa4ad(%rip)      # 0x102d8
jb 0x5e3b
xorl %edi, %edi
leaq 0x5de0(%rip), %rsi      # 0xbc16
callq 0x49d0
movl -0x24(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x24(%rbp)
jmp 0x6148
movl -0x14(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa4a1(%rip), %rax      # 0x10300
movb (%rax,%rcx), %al
movb %al, -0x1d(%rbp)
movzbl -0x1d(%rbp), %eax
cmpl $0x0, %eax
jne 0x5e73
jmp 0x613f
movzbl -0x1d(%rbp), %eax
cmpl $0x28, %eax
jne 0x5e7e
jmp 0x5ee2
movzbl -0x1d(%rbp), %eax
cmpl $0x5b, %eax
jne 0x5e89
jmp 0x5e99
movl -0x24(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x6100
jmp 0x5e99
jmp 0x5e9b
movl -0x14(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa44f(%rip), %rax      # 0x10300
movb (%rax,%rcx), %al
movb %al, -0x1d(%rbp)
movzbl -0x1d(%rbp), %eax
cmpl $0x0, %eax
jne 0x5ec5
jmp 0x613f
movzbl -0x1d(%rbp), %eax
cmpl $0x5d, %eax
jne 0x5ed0
jmp 0x5ed2
jmp 0x5e9b
movl -0x24(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x6100
jmp 0x5ee2
movl -0x14(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa408(%rip), %rax      # 0x10300
movb (%rax,%rcx), %al
movb %al, -0x1d(%rbp)
movzbl -0x1d(%rbp), %eax
cmpl $0x0, %eax
jne 0x5f0c
jmp 0x613f
movl -0x14(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa3de(%rip), %rax      # 0x10300
movb (%rax,%rcx), %al
movb %al, -0x1d(%rbp)
movzbl -0x1d(%rbp), %eax
cmpl $0x0, %eax
jne 0x5f36
jmp 0x613f
movl -0x24(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x6100
movl -0x14(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa3a6(%rip), %rax      # 0x10300
movb (%rax,%rcx), %al
movb %al, -0x1d(%rbp)
movzbl -0x1d(%rbp), %eax
cmpl $0x43, %eax
jne 0x5f85
movl -0x14(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa381(%rip), %rax      # 0x10300
movb (%rax,%rcx), %al
movb %al, -0x1d(%rbp)
movzbl -0x1d(%rbp), %esi
leaq -0x14(%rbp), %rdi
callq 0x4640
cmpl $0x0, %eax
jge 0x5f9c
jmp 0x613f
movl $0x1, -0x1c(%rbp)
movzbl 0xb356(%rip), %eax      # 0x11300
addl $-0x31, %eax
movl %eax, %ecx
movq %rcx, -0x38(%rbp)
subl $0x21, %eax
ja 0x5fcc
movq -0x38(%rbp), %rax
leaq 0x565d(%rip), %rcx      # 0xb620
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x5fce
movl -0x18(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x18(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa31c(%rip), %rax      # 0x10300
movb $-0x7d, (%rax,%rcx)
jmp 0x603c
movl -0x18(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x18(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa300(%rip), %rax      # 0x10300
movb $-0x7c, (%rax,%rcx)
jmp 0x603c
movl -0x18(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x18(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa2e4(%rip), %rax      # 0x10300
movb $-0x7b, (%rax,%rcx)
jmp 0x603c
movl -0x18(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x18(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa2c8(%rip), %rax      # 0x10300
movb $-0x7a, (%rax,%rcx)
jmp 0x6100
movl -0x14(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa2a9(%rip), %rax      # 0x10300
movb (%rax,%rcx), %al
movb %al, -0x1d(%rbp)
movzbl -0x1d(%rbp), %eax
cmpl $0x0, %eax
jne 0x606b
jmp 0x613f
movl $0x1, -0x1c(%rbp)
movzbl -0x1d(%rbp), %eax
cmpl $0x28, %eax
jne 0x6080
jmp 0x5ee2
movzbl -0x1d(%rbp), %eax
cmpl $0x5b, %eax
jne 0x608e
jmp 0x5e99
jmp 0x6100
movl -0x14(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa25a(%rip), %rax      # 0x10300
movb (%rax,%rcx), %al
movb %al, -0x1d(%rbp)
movzbl -0x1d(%rbp), %eax
cmpl $0x27, %eax
je 0x60ba
jmp 0x613f
jmp 0x60bc
movl -0x14(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa22e(%rip), %rax      # 0x10300
movb (%rax,%rcx), %al
movb %al, -0x1d(%rbp)
movzbl -0x1d(%rbp), %eax
cmpl $0x0, %eax
jne 0x60e3
jmp 0x613f
movzbl -0x1d(%rbp), %eax
cmpl $0x27, %eax
jne 0x60ee
jmp 0x60f0
jmp 0x60bc
movl -0x24(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x24(%rbp)
movl $0x1, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x613a
movl -0x24(%rbp), %eax
orl $0x8, %eax
movl %eax, -0x24(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x6133
movl -0x18(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x18(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa1d3(%rip), %rax      # 0x10300
movb $-0x7f, (%rax,%rcx)
jmp 0x610f
movl $0x0, -0x1c(%rbp)
jmp 0x5d23
movl -0x24(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x24(%rbp)
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0xa1ac(%rip), %rax      # 0x10300
movb $0x0, (%rax,%rcx)
movl -0x24(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x61d0
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x18(%rbp)
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0xa185(%rip), %rax      # 0x10300
movb (%rax,%rcx), %al
movb %al, -0x1d(%rbp)
movzbl -0x1d(%rbp), %eax
cmpl $0x0, %eax
jne 0x618c
jmp 0x61c0
movzbl -0x1d(%rbp), %eax
cmpl $0x81, %eax
jne 0x6199
jmp 0x61b5
movb -0x1d(%rbp), %dl
movl -0x18(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x18(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa14e(%rip), %rax      # 0x10300
movb %dl, (%rax,%rcx)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x616f
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0xa134(%rip), %rax      # 0x10300
movb $0x0, (%rax,%rcx)
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)